Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Ostanevich <sergos@tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit v1 05/11] vm: introduce LFUNC and FFUNC vmstates
Date: Fri, 25 Dec 2020 14:07:47 +0300	[thread overview]
Message-ID: <99BCEE4E-7AAC-4140-9BC9-88A19DA3139B@tarantool.org> (raw)
In-Reply-To: <333d99a8e4406e8c03cba132f9b50435f6d643bd.1608142899.git.skaplun@tarantool.org>

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

  reply	other threads:[~2020-12-25 11:07 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 19:13 [Tarantool-patches] [PATCH luajit v1 00/11] LuaJIT memory profiler Sergey Kaplun
2020-12-16 19:13 ` [Tarantool-patches] [PATCH luajit v1 01/11] build: add src dir in building Sergey Kaplun
2020-12-20 21:27   ` Igor Munkin
2020-12-23 18:20     ` Sergey Kaplun
2020-12-16 19:13 ` [Tarantool-patches] [PATCH luajit v1 02/11] utils: introduce leb128 reader and writer Sergey Kaplun
2020-12-20 22:44   ` Igor Munkin
2020-12-23 22:34     ` Sergey Kaplun
2020-12-24  9:11       ` Igor Munkin
2020-12-25  8:46         ` Sergey Kaplun
2020-12-23 16:50   ` Sergey Ostanevich
2020-12-23 22:36     ` Sergey Kaplun
2020-12-16 19:13 ` [Tarantool-patches] [PATCH luajit v1 03/11] profile: introduce profiler writing module Sergey Kaplun
2020-12-21  9:24   ` Igor Munkin
2020-12-24  6:46     ` Sergey Kaplun
2020-12-24 15:45       ` Sergey Ostanevich
2020-12-24 21:20         ` Sergey Kaplun
2020-12-25  9:37           ` Igor Munkin
2020-12-25 10:13             ` Sergey Kaplun
2020-12-16 19:13 ` [Tarantool-patches] [PATCH luajit v1 04/11] profile: introduce symtab write module Sergey Kaplun
2020-12-21 10:30   ` Igor Munkin
2020-12-24  7:00     ` Sergey Kaplun
2020-12-24  9:36       ` Igor Munkin
2020-12-25  8:45         ` Sergey Kaplun
2020-12-16 19:13 ` [Tarantool-patches] [PATCH luajit v1 05/11] vm: introduce LFUNC and FFUNC vmstates Sergey Kaplun
2020-12-25 11:07   ` Sergey Ostanevich [this message]
2020-12-25 11:23     ` Sergey Kaplun
2020-12-16 19:13 ` [Tarantool-patches] [PATCH luajit v1 06/11] core: introduce new mem_L field Sergey Kaplun
2020-12-16 19:13 ` [Tarantool-patches] [PATCH luajit v1 07/11] debug: move debug_frameline to public module API Sergey Kaplun
2020-12-20 22:46   ` Igor Munkin
2020-12-24  6:50     ` Sergey Kaplun
2020-12-16 19:13 ` [Tarantool-patches] [PATCH luajit v1 08/11] profile: introduce memory profiler Sergey Kaplun
2020-12-16 19:13 ` [Tarantool-patches] [PATCH luajit v1 09/11] misc: add Lua API for " Sergey Kaplun
2020-12-24 16:32   ` Sergey Ostanevich
2020-12-24 21:25     ` Sergey Kaplun
2020-12-16 19:13 ` [Tarantool-patches] [PATCH luajit v1 10/11] tools: introduce tools directory Sergey Kaplun
2020-12-20 22:46   ` Igor Munkin
2020-12-24  6:47     ` Sergey Kaplun
2020-12-16 19:13 ` [Tarantool-patches] [PATCH luajit v1 11/11] profile: introduce profile parser Sergey Kaplun
2020-12-24 23:09   ` Igor Munkin
2020-12-25  8:41     ` Sergey Kaplun
2020-12-21 10:43 ` [Tarantool-patches] [PATCH luajit v1 00/11] LuaJIT memory profiler Igor Munkin
2020-12-24  7:02   ` Sergey Kaplun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99BCEE4E-7AAC-4140-9BC9-88A19DA3139B@tarantool.org \
    --to=sergos@tarantool.org \
    --cc=skaplun@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit v1 05/11] vm: introduce LFUNC and FFUNC vmstates' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox