Reorder various structs to reduce padding (thanks to /usr/bin/pahole).

This commit is contained in:
Mike Pall 2010-03-15 23:29:10 +01:00
parent 1fea5cb822
commit 37a3ca330f
7 changed files with 15 additions and 15 deletions

View File

@ -60,9 +60,6 @@ typedef struct ASMState {
SnapNo snapno; /* Current 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 sectref; /* Section base reference (loopref 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). */
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 *mctop; /* Top of generated MCode. */
MCode *mcloop; /* Pointer to loop MCode (or NULL). */

View File

@ -540,7 +540,7 @@ static void atomic(global_State *g, lua_State *L)
/* Prepare for sweep phase. */
g->gc.currentwhite = cast_byte(otherwhite(g)); /* Flip current white. */
g->gc.sweepstr = 0;
g->gc.sweep = &g->gc.root;
setmref(g->gc.sweep, &g->gc.root);
g->gc.state = GCSsweepstring;
g->gc.estimate = g->gc.total - (MSize)udsize; /* Initial estimate. */
}
@ -569,8 +569,8 @@ static size_t gc_onestep(lua_State *L)
}
case GCSsweep: {
MSize old = g->gc.total;
g->gc.sweep = gc_sweep(g, g->gc.sweep, GCSWEEPMAX); /* Partial sweep. */
if (gcref(*g->gc.sweep) == NULL) {
setmref(g->gc.sweep, gc_sweep(g, mref(g->gc.sweep, GCRef), GCSWEEPMAX));
if (gcref(*mref(g->gc.sweep, GCRef)) == NULL) {
gc_shrink(g, L);
g->gc.state = GCSfinalize; /* End of sweep phase. */
}
@ -649,7 +649,7 @@ void lj_gc_fullgc(lua_State *L)
setvmstate(g, GC);
if (g->gc.state <= GCSpropagate) { /* Caught somewhere in the middle. */
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.grayagain);
setgcrefnull(g->gc.weak);

View File

@ -304,14 +304,14 @@ typedef struct jit_State {
BCIns *patchpc; /* PC 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 *mctop; /* Top of current mcode area. */
MCode *mcbot; /* Bottom of current mcode area. */
size_t szmcarea; /* Size of current mcode area. */
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;
/* Trivial PRNG e.g. used for penalty randomization. */

View File

@ -47,9 +47,9 @@ typedef struct LexState {
int current; /* Current character (charint). */
LexToken token; /* Current 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. */
const char *p; /* Current position in input buffer. */
SBuf sb; /* String buffer for tokens. */
lua_Reader rfunc; /* Reader callback. */
void *rdata; /* Reader callback data. */
BCLine linenumber; /* Input line counter. */

View File

@ -532,7 +532,7 @@ typedef struct GCState {
uint8_t unused2;
MSize sweepstr; /* Sweep position in string table. */
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 grayagain; /* List of objects for atomic traversal. */
GCRef weak; /* List of weak tables (to be cleared). */

View File

@ -203,7 +203,7 @@ LUA_API lua_State *lua_newstate(lua_Alloc f, void *ud)
lj_str_initbuf(L, &g->tmpbuf);
g->gc.state = GCSpause;
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.pause = LUAI_GCPAUSE;
g->gc.stepmul = LUAI_GCMUL;

View File

@ -454,8 +454,8 @@ static int handle_luainit(lua_State *L)
}
struct Smain {
int argc;
char **argv;
int argc;
int status;
};