From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp33.i.mail.ru (smtp33.i.mail.ru [94.100.177.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id CCF3A4765E0 for ; Fri, 25 Dec 2020 14:07:49 +0300 (MSK) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) From: Sergey Ostanevich In-Reply-To: <333d99a8e4406e8c03cba132f9b50435f6d643bd.1608142899.git.skaplun@tarantool.org> Date: Fri, 25 Dec 2020 14:07:47 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <99BCEE4E-7AAC-4140-9BC9-88A19DA3139B@tarantool.org> References: <333d99a8e4406e8c03cba132f9b50435f6d643bd.1608142899.git.skaplun@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH luajit v1 05/11] vm: introduce LFUNC and FFUNC vmstates List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Hi! Thanks for the patch!=20 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 =E2=80=98aword=E2=80=99 - 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=E2=80=94--.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