mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Reorder various structs to reduce padding (thanks to /usr/bin/pahole).
This commit is contained in:
parent
1fea5cb822
commit
37a3ca330f
@ -60,9 +60,6 @@ typedef struct ASMState {
|
|||||||
SnapNo snapno; /* Current snapshot number. */
|
SnapNo snapno; /* Current snapshot number. */
|
||||||
SnapNo loopsnapno; /* Loop snapshot number. */
|
SnapNo loopsnapno; /* Loop snapshot number. */
|
||||||
|
|
||||||
Trace *T; /* Trace to assemble. */
|
|
||||||
Trace *parent; /* Parent trace (or NULL). */
|
|
||||||
|
|
||||||
IRRef fuseref; /* Fusion limit (loopref, 0 or FUSE_DISABLED). */
|
IRRef fuseref; /* Fusion limit (loopref, 0 or FUSE_DISABLED). */
|
||||||
IRRef sectref; /* Section base reference (loopref or 0). */
|
IRRef sectref; /* Section base reference (loopref or 0). */
|
||||||
IRRef loopref; /* Reference of LOOP instruction (or 0). */
|
IRRef loopref; /* Reference of LOOP instruction (or 0). */
|
||||||
@ -70,6 +67,9 @@ typedef struct ASMState {
|
|||||||
BCReg topslot; /* Number of slots for stack check (unless 0). */
|
BCReg topslot; /* Number of slots for stack check (unless 0). */
|
||||||
MSize gcsteps; /* Accumulated number of GC steps (per section). */
|
MSize gcsteps; /* Accumulated number of GC steps (per section). */
|
||||||
|
|
||||||
|
Trace *T; /* Trace to assemble. */
|
||||||
|
Trace *parent; /* Parent trace (or NULL). */
|
||||||
|
|
||||||
MCode *mcbot; /* Bottom of reserved MCode. */
|
MCode *mcbot; /* Bottom of reserved MCode. */
|
||||||
MCode *mctop; /* Top of generated MCode. */
|
MCode *mctop; /* Top of generated MCode. */
|
||||||
MCode *mcloop; /* Pointer to loop MCode (or NULL). */
|
MCode *mcloop; /* Pointer to loop MCode (or NULL). */
|
||||||
|
@ -540,7 +540,7 @@ static void atomic(global_State *g, lua_State *L)
|
|||||||
/* Prepare for sweep phase. */
|
/* Prepare for sweep phase. */
|
||||||
g->gc.currentwhite = cast_byte(otherwhite(g)); /* Flip current white. */
|
g->gc.currentwhite = cast_byte(otherwhite(g)); /* Flip current white. */
|
||||||
g->gc.sweepstr = 0;
|
g->gc.sweepstr = 0;
|
||||||
g->gc.sweep = &g->gc.root;
|
setmref(g->gc.sweep, &g->gc.root);
|
||||||
g->gc.state = GCSsweepstring;
|
g->gc.state = GCSsweepstring;
|
||||||
g->gc.estimate = g->gc.total - (MSize)udsize; /* Initial estimate. */
|
g->gc.estimate = g->gc.total - (MSize)udsize; /* Initial estimate. */
|
||||||
}
|
}
|
||||||
@ -569,8 +569,8 @@ static size_t gc_onestep(lua_State *L)
|
|||||||
}
|
}
|
||||||
case GCSsweep: {
|
case GCSsweep: {
|
||||||
MSize old = g->gc.total;
|
MSize old = g->gc.total;
|
||||||
g->gc.sweep = gc_sweep(g, g->gc.sweep, GCSWEEPMAX); /* Partial sweep. */
|
setmref(g->gc.sweep, gc_sweep(g, mref(g->gc.sweep, GCRef), GCSWEEPMAX));
|
||||||
if (gcref(*g->gc.sweep) == NULL) {
|
if (gcref(*mref(g->gc.sweep, GCRef)) == NULL) {
|
||||||
gc_shrink(g, L);
|
gc_shrink(g, L);
|
||||||
g->gc.state = GCSfinalize; /* End of sweep phase. */
|
g->gc.state = GCSfinalize; /* End of sweep phase. */
|
||||||
}
|
}
|
||||||
@ -649,7 +649,7 @@ void lj_gc_fullgc(lua_State *L)
|
|||||||
setvmstate(g, GC);
|
setvmstate(g, GC);
|
||||||
if (g->gc.state <= GCSpropagate) { /* Caught somewhere in the middle. */
|
if (g->gc.state <= GCSpropagate) { /* Caught somewhere in the middle. */
|
||||||
g->gc.sweepstr = 0;
|
g->gc.sweepstr = 0;
|
||||||
g->gc.sweep = &g->gc.root; /* Sweep everything (preserving it). */
|
setmref(g->gc.sweep, &g->gc.root); /* Sweep everything (preserving it). */
|
||||||
setgcrefnull(g->gc.gray); /* Reset lists from partial propagation. */
|
setgcrefnull(g->gc.gray); /* Reset lists from partial propagation. */
|
||||||
setgcrefnull(g->gc.grayagain);
|
setgcrefnull(g->gc.grayagain);
|
||||||
setgcrefnull(g->gc.weak);
|
setgcrefnull(g->gc.weak);
|
||||||
|
@ -304,14 +304,14 @@ typedef struct jit_State {
|
|||||||
BCIns *patchpc; /* PC for pending re-patch. */
|
BCIns *patchpc; /* PC for pending re-patch. */
|
||||||
BCIns patchins; /* Instruction for pending re-patch. */
|
BCIns patchins; /* Instruction for pending re-patch. */
|
||||||
|
|
||||||
TValue errinfo; /* Additional info element for trace errors. */
|
int mcprot; /* Protection of current mcode area. */
|
||||||
|
|
||||||
MCode *mcarea; /* Base of current mcode area. */
|
MCode *mcarea; /* Base of current mcode area. */
|
||||||
MCode *mctop; /* Top of current mcode area. */
|
MCode *mctop; /* Top of current mcode area. */
|
||||||
MCode *mcbot; /* Bottom of current mcode area. */
|
MCode *mcbot; /* Bottom of current mcode area. */
|
||||||
size_t szmcarea; /* Size of current mcode area. */
|
size_t szmcarea; /* Size of current mcode area. */
|
||||||
size_t szallmcarea; /* Total size of all allocated mcode areas. */
|
size_t szallmcarea; /* Total size of all allocated mcode areas. */
|
||||||
int mcprot; /* Protection of current mcode area. */
|
|
||||||
|
TValue errinfo; /* Additional info element for trace errors. */
|
||||||
} jit_State;
|
} jit_State;
|
||||||
|
|
||||||
/* Trivial PRNG e.g. used for penalty randomization. */
|
/* Trivial PRNG e.g. used for penalty randomization. */
|
||||||
|
@ -47,9 +47,9 @@ typedef struct LexState {
|
|||||||
int current; /* Current character (charint). */
|
int current; /* Current character (charint). */
|
||||||
LexToken token; /* Current token. */
|
LexToken token; /* Current token. */
|
||||||
LexToken lookahead; /* Lookahead token. */
|
LexToken lookahead; /* Lookahead token. */
|
||||||
SBuf sb; /* String buffer for tokens. */
|
|
||||||
const char *p; /* Current position in input buffer. */
|
|
||||||
MSize n; /* Bytes left in input buffer. */
|
MSize n; /* Bytes left in input buffer. */
|
||||||
|
const char *p; /* Current position in input buffer. */
|
||||||
|
SBuf sb; /* String buffer for tokens. */
|
||||||
lua_Reader rfunc; /* Reader callback. */
|
lua_Reader rfunc; /* Reader callback. */
|
||||||
void *rdata; /* Reader callback data. */
|
void *rdata; /* Reader callback data. */
|
||||||
BCLine linenumber; /* Input line counter. */
|
BCLine linenumber; /* Input line counter. */
|
||||||
|
@ -532,7 +532,7 @@ typedef struct GCState {
|
|||||||
uint8_t unused2;
|
uint8_t unused2;
|
||||||
MSize sweepstr; /* Sweep position in string table. */
|
MSize sweepstr; /* Sweep position in string table. */
|
||||||
GCRef root; /* List of all collectable objects. */
|
GCRef root; /* List of all collectable objects. */
|
||||||
GCRef *sweep; /* Sweep position in root list. */
|
MRef sweep; /* Sweep position in root list. */
|
||||||
GCRef gray; /* List of gray objects. */
|
GCRef gray; /* List of gray objects. */
|
||||||
GCRef grayagain; /* List of objects for atomic traversal. */
|
GCRef grayagain; /* List of objects for atomic traversal. */
|
||||||
GCRef weak; /* List of weak tables (to be cleared). */
|
GCRef weak; /* List of weak tables (to be cleared). */
|
||||||
|
@ -203,7 +203,7 @@ LUA_API lua_State *lua_newstate(lua_Alloc f, void *ud)
|
|||||||
lj_str_initbuf(L, &g->tmpbuf);
|
lj_str_initbuf(L, &g->tmpbuf);
|
||||||
g->gc.state = GCSpause;
|
g->gc.state = GCSpause;
|
||||||
setgcref(g->gc.root, obj2gco(L));
|
setgcref(g->gc.root, obj2gco(L));
|
||||||
g->gc.sweep = &g->gc.root;
|
setmref(g->gc.sweep, &g->gc.root);
|
||||||
g->gc.total = sizeof(GG_State);
|
g->gc.total = sizeof(GG_State);
|
||||||
g->gc.pause = LUAI_GCPAUSE;
|
g->gc.pause = LUAI_GCPAUSE;
|
||||||
g->gc.stepmul = LUAI_GCMUL;
|
g->gc.stepmul = LUAI_GCMUL;
|
||||||
|
@ -454,8 +454,8 @@ static int handle_luainit(lua_State *L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct Smain {
|
struct Smain {
|
||||||
int argc;
|
|
||||||
char **argv;
|
char **argv;
|
||||||
|
int argc;
|
||||||
int status;
|
int status;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user