diff options
author | Mike Pall <mike> | 2020-08-05 15:21:00 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2020-08-05 15:21:00 +0200 |
commit | 2211f6f960b65d200a3142798cf86576405c24cb (patch) | |
tree | dd2c8ef73729f02ed3cddd5068cfaa4954c2e08e | |
parent | c4b1e0feae75248f37945b1993f469df0d9ead53 (diff) | |
download | luajit-2211f6f960b65d200a3142798cf86576405c24cb.tar.gz luajit-2211f6f960b65d200a3142798cf86576405c24cb.tar.bz2 luajit-2211f6f960b65d200a3142798cf86576405c24cb.zip |
ARM: Ensure relative GG_State element alignment differently.
Thanks to jojo59516 and dwing4g.
-rw-r--r-- | src/lj_dispatch.h | 8 | ||||
-rw-r--r-- | src/lj_jit.h | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/lj_dispatch.h b/src/lj_dispatch.h index 17bf93da..6a3bc2bd 100644 --- a/src/lj_dispatch.h +++ b/src/lj_dispatch.h | |||
@@ -70,12 +70,20 @@ typedef uint16_t HotCount; | |||
70 | typedef struct GG_State { | 70 | typedef struct GG_State { |
71 | lua_State L; /* Main thread. */ | 71 | lua_State L; /* Main thread. */ |
72 | global_State g; /* Global state. */ | 72 | global_State g; /* Global state. */ |
73 | #if LJ_TARGET_ARM | ||
74 | /* Make g reachable via K12 encoded DISPATCH-relative addressing. */ | ||
75 | uint8_t align1[(16-sizeof(global_State))&15]; | ||
76 | #endif | ||
73 | #if LJ_TARGET_MIPS | 77 | #if LJ_TARGET_MIPS |
74 | ASMFunction got[LJ_GOT__MAX]; /* Global offset table. */ | 78 | ASMFunction got[LJ_GOT__MAX]; /* Global offset table. */ |
75 | #endif | 79 | #endif |
76 | #if LJ_HASJIT | 80 | #if LJ_HASJIT |
77 | jit_State J; /* JIT state. */ | 81 | jit_State J; /* JIT state. */ |
78 | HotCount hotcount[HOTCOUNT_SIZE]; /* Hot counters. */ | 82 | HotCount hotcount[HOTCOUNT_SIZE]; /* Hot counters. */ |
83 | #if LJ_TARGET_ARM | ||
84 | /* Ditto for J. */ | ||
85 | uint8_t align2[(16-sizeof(jit_State)-sizeof(HotCount)*HOTCOUNT_SIZE)&15]; | ||
86 | #endif | ||
79 | #endif | 87 | #endif |
80 | ASMFunction dispatch[GG_LEN_DISP]; /* Instruction dispatch tables. */ | 88 | ASMFunction dispatch[GG_LEN_DISP]; /* Instruction dispatch tables. */ |
81 | BCIns bcff[GG_NUM_ASMFF]; /* Bytecode for ASM fast functions. */ | 89 | BCIns bcff[GG_NUM_ASMFF]; /* Bytecode for ASM fast functions. */ |
diff --git a/src/lj_jit.h b/src/lj_jit.h index 0e1c4827..4a4b0b1b 100644 --- a/src/lj_jit.h +++ b/src/lj_jit.h | |||
@@ -406,11 +406,7 @@ typedef struct jit_State { | |||
406 | size_t szallmcarea; /* Total size of all allocated mcode areas. */ | 406 | size_t szallmcarea; /* Total size of all allocated mcode areas. */ |
407 | 407 | ||
408 | TValue errinfo; /* Additional info element for trace errors. */ | 408 | TValue errinfo; /* Additional info element for trace errors. */ |
409 | } | 409 | } jit_State; |
410 | #if LJ_TARGET_ARM | ||
411 | LJ_ALIGN(16) /* For DISPATCH-relative addresses in assembler part. */ | ||
412 | #endif | ||
413 | jit_State; | ||
414 | 410 | ||
415 | /* Trivial PRNG e.g. used for penalty randomization. */ | 411 | /* Trivial PRNG e.g. used for penalty randomization. */ |
416 | static LJ_AINLINE uint32_t LJ_PRNG_BITS(jit_State *J, int bits) | 412 | static LJ_AINLINE uint32_t LJ_PRNG_BITS(jit_State *J, int bits) |