aboutsummaryrefslogtreecommitdiff
path: root/src/lj_ccallback.c
diff options
context:
space:
mode:
authorMike Pall <mike>2015-05-04 06:30:57 +0200
committerMike Pall <mike>2015-05-04 06:30:57 +0200
commita92e73023353e59405ebfdb2837b5742d17946a5 (patch)
tree19dca7d5ffe0b5d133d6fd5434a923aa976aaaeb /src/lj_ccallback.c
parent5caf53d502dbe051dac11d86e1f9ad69bbe3eabf (diff)
downloadluajit-a92e73023353e59405ebfdb2837b5742d17946a5.tar.gz
luajit-a92e73023353e59405ebfdb2837b5742d17946a5.tar.bz2
luajit-a92e73023353e59405ebfdb2837b5742d17946a5.zip
x64: Add LJ_GC64 mode interpreter.
Enable this mode with: make XCFLAGS=-DLUAJIT_ENABLE_GC64
Diffstat (limited to 'src/lj_ccallback.c')
-rw-r--r--src/lj_ccallback.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lj_ccallback.c b/src/lj_ccallback.c
index 66a09440..065c329f 100644
--- a/src/lj_ccallback.c
+++ b/src/lj_ccallback.c
@@ -35,7 +35,7 @@
35#elif LJ_TARGET_X86ORX64 35#elif LJ_TARGET_X86ORX64
36 36
37#define CALLBACK_MCODE_HEAD (LJ_64 ? 8 : 0) 37#define CALLBACK_MCODE_HEAD (LJ_64 ? 8 : 0)
38#define CALLBACK_MCODE_GROUP (-2+1+2+5+(LJ_64 ? 6 : 5)) 38#define CALLBACK_MCODE_GROUP (-2+1+2+(LJ_GC64 ? 10 : 5)+(LJ_64 ? 6 : 5))
39 39
40#define CALLBACK_SLOT2OFS(slot) \ 40#define CALLBACK_SLOT2OFS(slot) \
41 (CALLBACK_MCODE_HEAD + CALLBACK_MCODE_GROUP*((slot)/32) + 4*(slot)) 41 (CALLBACK_MCODE_HEAD + CALLBACK_MCODE_GROUP*((slot)/32) + 4*(slot))
@@ -120,8 +120,13 @@ static void callback_mcode_init(global_State *g, uint8_t *page)
120 /* push ebp/rbp; mov ah, slot>>8; mov ebp, &g. */ 120 /* push ebp/rbp; mov ah, slot>>8; mov ebp, &g. */
121 *p++ = XI_PUSH + RID_EBP; 121 *p++ = XI_PUSH + RID_EBP;
122 *p++ = XI_MOVrib | (RID_EAX+4); *p++ = (uint8_t)(slot >> 8); 122 *p++ = XI_MOVrib | (RID_EAX+4); *p++ = (uint8_t)(slot >> 8);
123#if LJ_GC64
124 *p++ = 0x48; *p++ = XI_MOVri | RID_EBP;
125 *(uint64_t *)p = (uint64_t)(g); p += 8;
126#else
123 *p++ = XI_MOVri | RID_EBP; 127 *p++ = XI_MOVri | RID_EBP;
124 *(int32_t *)p = i32ptr(g); p += 4; 128 *(int32_t *)p = i32ptr(g); p += 4;
129#endif
125#if LJ_64 130#if LJ_64
126 /* jmp [rip-pageofs] where lj_vm_ffi_callback is stored. */ 131 /* jmp [rip-pageofs] where lj_vm_ffi_callback is stored. */
127 *p++ = XI_GROUP5; *p++ = XM_OFS0 + (XOg_JMP<<3) + RID_EBP; 132 *p++ = XI_GROUP5; *p++ = XM_OFS0 + (XOg_JMP<<3) + RID_EBP;