[Tarantool-patches] [PATCH luajit v1 05/11] vm: introduce LFUNC and FFUNC vmstates
Sergey Ostanevich
sergos at tarantool.org
Fri Dec 25 14:07:47 MSK 2020
Hi!
Thanks for the patch!
Some comments below.
<...>
> diff --git a/src/vm_x64.dasc b/src/vm_x64.dasc
> index 80753e0..d4d3a1d 100644
> --- a/src/vm_x64.dasc
> +++ b/src/vm_x64.dasc
> @@ -140,7 +140,7 @@
> |//-----------------------------------------------------------------------
> |.else // x64/POSIX stack layout
> |
> -|.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--).
> +|.define CFRAME_SPACE, qword*7 // Delta for rsp (see <--).
> |.macro saveregs_
> | push rbx; push r15; push r14
> |.if NO_UNWIND
> @@ -161,26 +161,29 @@
> |
> |//----- 16 byte aligned,
> |.if NO_UNWIND
> -|.define SAVE_RET, aword [rsp+aword*11] //<-- rsp entering interpreter.
> -|.define SAVE_R4, aword [rsp+aword*10]
> -|.define SAVE_R3, aword [rsp+aword*9]
> -|.define SAVE_R2, aword [rsp+aword*8]
> -|.define SAVE_R1, aword [rsp+aword*7]
> -|.define SAVE_RU2, aword [rsp+aword*6]
> -|.define SAVE_RU1, aword [rsp+aword*5] //<-- rsp after register saves.
Why did you change all ‘aword’ - which represents address, AFAIU into a qword?
> +|.define SAVE_RET, qword [rsp+qword*13] //<-- rsp entering interpreter.
> +|.define SAVE_R4, qword [rsp+qword*12]
> +|.define SAVE_R3, qword [rsp+qword*11]
> +|.define SAVE_R2, qword [rsp+qword*10]
> +|.define SAVE_R1, qword [rsp+qword*9]
> +|.define SAVE_RU2, qword [rsp+qword*8]
> +|.define SAVE_RU1, qword [rsp+qword*7] //<-- rsp after register saves.
> |.else
> -|.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter.
> -|.define SAVE_R4, aword [rsp+aword*8]
> -|.define SAVE_R3, aword [rsp+aword*7]
> -|.define SAVE_R2, aword [rsp+aword*6]
> -|.define SAVE_R1, aword [rsp+aword*5] //<-- rsp after register saves.
> +|.define SAVE_RET, qword [rsp+qword*11] //<-- rsp entering interpreter.
> +|.define SAVE_R4, qword [rsp+qword*10]
> +|.define SAVE_R3, qword [rsp+qword*9]
> +|.define SAVE_R2, qword [rsp+qword*8]
> +|.define SAVE_R1, qword [rsp+qword*7] //<-- rsp after register saves.
> |.endif
> -|.define SAVE_CFRAME, aword [rsp+aword*4]
> -|.define SAVE_PC, aword [rsp+aword*3]
> -|.define SAVE_L, aword [rsp+aword*2]
> +|.define SAVE_CFRAME, qword [rsp+qword*6]
> +|.define SAVE_UNUSED2, qword [rsp+qword*5]
The naming is quite boggling: to save something unused? Why?
> +|.define SAVE_UNUSED1, dword [rsp+dword*8]
> +|.define SAVE_VMSTATE, dword [rsp+dword*8]
> +|.define SAVE_PC, qword [rsp+qword*3]
> +|.define SAVE_L, qword [rsp+qword*2]
> |.define SAVE_ERRF, dword [rsp+dword*3]
> |.define SAVE_NRES, dword [rsp+dword*2]
> -|.define TMP1, aword [rsp] //<-- rsp while in interpreter.
> +|.define TMP1, qword [rsp] //<-- rsp while in interpreter.
> |//----- 16 byte aligned
> |
> |.define TMP1d, dword [rsp]
> @@ -342,6 +345,20 @@
> | mov dword [DISPATCH+DISPATCH_GL(vmstate)], ~LJ_VMST_..st
> |.endmacro
> |
Can you set an empty versions of the macros for WIN, so that
later at uses do not do not wrap with .if—--.endif?
> +|.if not WIN
> +|// Save vmstate through register.
> +|.macro save_vmstate_through, reg
> +| mov reg, dword [DISPATCH+DISPATCH_GL(vmstate)]
> +| mov SAVE_VMSTATE, reg
> +|.endmacro
> +|
> +|// Restore vmstate through register.
> +|.macro restore_vmstate_through, reg
> +| mov reg, SAVE_VMSTATE
> +| mov dword [DISPATCH+DISPATCH_GL(vmstate)], reg
> +|.endmacro
> +|.endif // WIN
> +|
> |.macro fpop1; fstp st1; .endmacro
More information about the Tarantool-patches
mailing list