Skip to content

Commit 2211f6f

Browse files
author
Mike Pall
committed
ARM: Ensure relative GG_State element alignment differently.
Thanks to jojo59516 and dwing4g.
1 parent c4b1e0f commit 2211f6f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/lj_dispatch.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,20 @@ typedef uint16_t HotCount;
7070
typedef struct GG_State {
7171
lua_State L; /* Main thread. */
7272
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
7377
#if LJ_TARGET_MIPS
7478
ASMFunction got[LJ_GOT__MAX]; /* Global offset table. */
7579
#endif
7680
#if LJ_HASJIT
7781
jit_State J; /* JIT state. */
7882
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
7987
#endif
8088
ASMFunction dispatch[GG_LEN_DISP]; /* Instruction dispatch tables. */
8189
BCIns bcff[GG_NUM_ASMFF]; /* Bytecode for ASM fast functions. */

src/lj_jit.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,7 @@ typedef struct jit_State {
406406
size_t szallmcarea; /* Total size of all allocated mcode areas. */
407407

408408
TValue errinfo; /* Additional info element for trace errors. */
409-
}
410-
#if LJ_TARGET_ARM
411-
LJ_ALIGN(16) /* For DISPATCH-relative addresses in assembler part. */
412-
#endif
413-
jit_State;
409+
} jit_State;
414410

415411
/* Trivial PRNG e.g. used for penalty randomization. */
416412
static LJ_AINLINE uint32_t LJ_PRNG_BITS(jit_State *J, int bits)

0 commit comments

Comments
 (0)