[Tarantool-patches] [PATCH luajit 2/3] ARM64: More improvements to the generation of immediates.

Sergey Kaplun skaplun at tarantool.org
Wed Aug 27 12:08:27 MSK 2025


Hi, Sergey!
Thanks for the review!
Please consider my answers below.

On 25.08.25, Sergey Bronnikov wrote:
> Hi, Sergey!
> 
> thanks for the patch!
> 
> In general LGTM, I would suggest fixing the description in commit message.
> 
> See below.
> 
> Sergey
> 
> On 7/24/25 12:03, Sergey Kaplun wrote:
> > From: Mike Pall <mike>
> >
> > (cherry picked from commit 69138082a3166105faa8cbb25fadb1e4298686c0)
> >
> > This patch refactors the emitting of immediates for the arm64
> > architecture. The main changes are the following:
> > * Use `emit_getgl()`, `emit_setgl()` instead of `emit_lso()`, where it
> >    is possible, since it makes the code cleaner.
> > * The `RID_GL` is allocated for `g` at the start of the trace emitting.
> >    Also, this register is considered as a candidate to be used as a base
> >    for the N-step offset in `emit_kdelta()`.
> > * The address of `tmptv` is not rematerialized to the register from the
> >    constant not. It is calculated via the adding the corresponding

This "not" looks excessive. Rewritten as the following:
| * The address of `tmptv` is not rematerialized to the register from the
|   constant. It is calculated via the adding the corresponding offset to
|   `RID_GL`.


> >    offset to `RID_GL`.
> it is not clear for me what for hunks with `emit_dm` are needed.

| emit_dm(as, ins, d, m);
Means emit the ins with values to the D and M instruction fields as
registers `d`, `m` respectively.

In the case of this patch, it emits simply:
| mov rd, rm
Where `rd` is the register associated with `ASM_REF_TMP1` (`REF_TRUE`)
and `rm` is `RID_GL`. So this is simply moving the value of `g` from the
`RID_GL` register to the register, which will be an argument for the C
function call like `lj_gc_step_jit()`. Move is used instead of the
constant value loading.

> 
> <snipped>

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list