aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2010-03-15 23:29:10 +0100
committerMike Pall <mike>2010-03-15 23:29:10 +0100
commit37a3ca330fca12a9f939f923c5d590410e5d9f11 (patch)
tree0fac600c9cc04c6c50ce10224e29a15b358a82fc
parent1fea5cb822a4da746005e0cec35fc2fe2ed5880f (diff)
downloadluajit-37a3ca330fca12a9f939f923c5d590410e5d9f11.tar.gz
luajit-37a3ca330fca12a9f939f923c5d590410e5d9f11.tar.bz2
luajit-37a3ca330fca12a9f939f923c5d590410e5d9f11.zip
Reorder various structs to reduce padding (thanks to /usr/bin/pahole).
-rw-r--r--src/lj_asm.c6
-rw-r--r--src/lj_gc.c8
-rw-r--r--src/lj_jit.h6
-rw-r--r--src/lj_lex.h4
-rw-r--r--src/lj_obj.h2
-rw-r--r--src/lj_state.c2
-rw-r--r--src/luajit.c2
7 files changed, 15 insertions, 15 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c
index 9e8f1fc0..81589cf9 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -60,9 +60,6 @@ typedef struct ASMState {
60 SnapNo snapno; /* Current snapshot number. */ 60 SnapNo snapno; /* Current snapshot number. */
61 SnapNo loopsnapno; /* Loop snapshot number. */ 61 SnapNo loopsnapno; /* Loop snapshot number. */
62 62
63 Trace *T; /* Trace to assemble. */
64 Trace *parent; /* Parent trace (or NULL). */
65
66 IRRef fuseref; /* Fusion limit (loopref, 0 or FUSE_DISABLED). */ 63 IRRef fuseref; /* Fusion limit (loopref, 0 or FUSE_DISABLED). */
67 IRRef sectref; /* Section base reference (loopref or 0). */ 64 IRRef sectref; /* Section base reference (loopref or 0). */
68 IRRef loopref; /* Reference of LOOP instruction (or 0). */ 65 IRRef loopref; /* Reference of LOOP instruction (or 0). */
@@ -70,6 +67,9 @@ typedef struct ASMState {
70 BCReg topslot; /* Number of slots for stack check (unless 0). */ 67 BCReg topslot; /* Number of slots for stack check (unless 0). */
71 MSize gcsteps; /* Accumulated number of GC steps (per section). */ 68 MSize gcsteps; /* Accumulated number of GC steps (per section). */
72 69
70 Trace *T; /* Trace to assemble. */
71 Trace *parent; /* Parent trace (or NULL). */
72
73 MCode *mcbot; /* Bottom of reserved MCode. */ 73 MCode *mcbot; /* Bottom of reserved MCode. */
74 MCode *mctop; /* Top of generated MCode. */ 74 MCode *mctop; /* Top of generated MCode. */
75 MCode *mcloop; /* Pointer to loop MCode (or NULL). */ 75 MCode *mcloop; /* Pointer to loop MCode (or NULL). */
diff --git a/src/lj_gc.c b/src/lj_gc.c
index 276cd4da..d38238dd 100644
--- a/src/lj_gc.c
+++ b/src/lj_gc.c
@@ -540,7 +540,7 @@ static void atomic(global_State *g, lua_State *L)
540 /* Prepare for sweep phase. */ 540 /* Prepare for sweep phase. */
541 g->gc.currentwhite = cast_byte(otherwhite(g)); /* Flip current white. */ 541 g->gc.currentwhite = cast_byte(otherwhite(g)); /* Flip current white. */
542 g->gc.sweepstr = 0; 542 g->gc.sweepstr = 0;
543 g->gc.sweep = &g->gc.root; 543 setmref(g->gc.sweep, &g->gc.root);
544 g->gc.state = GCSsweepstring; 544 g->gc.state = GCSsweepstring;
545 g->gc.estimate = g->gc.total - (MSize)udsize; /* Initial estimate. */ 545 g->gc.estimate = g->gc.total - (MSize)udsize; /* Initial estimate. */
546} 546}
@@ -569,8 +569,8 @@ static size_t gc_onestep(lua_State *L)
569 } 569 }
570 case GCSsweep: { 570 case GCSsweep: {
571 MSize old = g->gc.total; 571 MSize old = g->gc.total;
572 g->gc.sweep = gc_sweep(g, g->gc.sweep, GCSWEEPMAX); /* Partial sweep. */ 572 setmref(g->gc.sweep, gc_sweep(g, mref(g->gc.sweep, GCRef), GCSWEEPMAX));
573 if (gcref(*g->gc.sweep) == NULL) { 573 if (gcref(*mref(g->gc.sweep, GCRef)) == NULL) {
574 gc_shrink(g, L); 574 gc_shrink(g, L);
575 g->gc.state = GCSfinalize; /* End of sweep phase. */ 575 g->gc.state = GCSfinalize; /* End of sweep phase. */
576 } 576 }
@@ -649,7 +649,7 @@ void lj_gc_fullgc(lua_State *L)
649 setvmstate(g, GC); 649 setvmstate(g, GC);
650 if (g->gc.state <= GCSpropagate) { /* Caught somewhere in the middle. */ 650 if (g->gc.state <= GCSpropagate) { /* Caught somewhere in the middle. */
651 g->gc.sweepstr = 0; 651 g->gc.sweepstr = 0;
652 g->gc.sweep = &g->gc.root; /* Sweep everything (preserving it). */ 652 setmref(g->gc.sweep, &g->gc.root); /* Sweep everything (preserving it). */
653 setgcrefnull(g->gc.gray); /* Reset lists from partial propagation. */ 653 setgcrefnull(g->gc.gray); /* Reset lists from partial propagation. */
654 setgcrefnull(g->gc.grayagain); 654 setgcrefnull(g->gc.grayagain);
655 setgcrefnull(g->gc.weak); 655 setgcrefnull(g->gc.weak);
diff --git a/src/lj_jit.h b/src/lj_jit.h
index 76d7942b..7850878d 100644
--- a/src/lj_jit.h
+++ b/src/lj_jit.h
@@ -304,14 +304,14 @@ typedef struct jit_State {
304 BCIns *patchpc; /* PC for pending re-patch. */ 304 BCIns *patchpc; /* PC for pending re-patch. */
305 BCIns patchins; /* Instruction for pending re-patch. */ 305 BCIns patchins; /* Instruction for pending re-patch. */
306 306
307 TValue errinfo; /* Additional info element for trace errors. */ 307 int mcprot; /* Protection of current mcode area. */
308
309 MCode *mcarea; /* Base of current mcode area. */ 308 MCode *mcarea; /* Base of current mcode area. */
310 MCode *mctop; /* Top of current mcode area. */ 309 MCode *mctop; /* Top of current mcode area. */
311 MCode *mcbot; /* Bottom of current mcode area. */ 310 MCode *mcbot; /* Bottom of current mcode area. */
312 size_t szmcarea; /* Size of current mcode area. */ 311 size_t szmcarea; /* Size of current mcode area. */
313 size_t szallmcarea; /* Total size of all allocated mcode areas. */ 312 size_t szallmcarea; /* Total size of all allocated mcode areas. */
314 int mcprot; /* Protection of current mcode area. */ 313
314 TValue errinfo; /* Additional info element for trace errors. */
315} jit_State; 315} jit_State;
316 316
317/* Trivial PRNG e.g. used for penalty randomization. */ 317/* Trivial PRNG e.g. used for penalty randomization. */
diff --git a/src/lj_lex.h b/src/lj_lex.h
index 9bcd3cdb..0718f5a6 100644
--- a/src/lj_lex.h
+++ b/src/lj_lex.h
@@ -47,9 +47,9 @@ typedef struct LexState {
47 int current; /* Current character (charint). */ 47 int current; /* Current character (charint). */
48 LexToken token; /* Current token. */ 48 LexToken token; /* Current token. */
49 LexToken lookahead; /* Lookahead token. */ 49 LexToken lookahead; /* Lookahead token. */
50 SBuf sb; /* String buffer for tokens. */
51 const char *p; /* Current position in input buffer. */
52 MSize n; /* Bytes left in input buffer. */ 50 MSize n; /* Bytes left in input buffer. */
51 const char *p; /* Current position in input buffer. */
52 SBuf sb; /* String buffer for tokens. */
53 lua_Reader rfunc; /* Reader callback. */ 53 lua_Reader rfunc; /* Reader callback. */
54 void *rdata; /* Reader callback data. */ 54 void *rdata; /* Reader callback data. */
55 BCLine linenumber; /* Input line counter. */ 55 BCLine linenumber; /* Input line counter. */
diff --git a/src/lj_obj.h b/src/lj_obj.h
index d463cb2c..a37c0882 100644
--- a/src/lj_obj.h
+++ b/src/lj_obj.h
@@ -532,7 +532,7 @@ typedef struct GCState {
532 uint8_t unused2; 532 uint8_t unused2;
533 MSize sweepstr; /* Sweep position in string table. */ 533 MSize sweepstr; /* Sweep position in string table. */
534 GCRef root; /* List of all collectable objects. */ 534 GCRef root; /* List of all collectable objects. */
535 GCRef *sweep; /* Sweep position in root list. */ 535 MRef sweep; /* Sweep position in root list. */
536 GCRef gray; /* List of gray objects. */ 536 GCRef gray; /* List of gray objects. */
537 GCRef grayagain; /* List of objects for atomic traversal. */ 537 GCRef grayagain; /* List of objects for atomic traversal. */
538 GCRef weak; /* List of weak tables (to be cleared). */ 538 GCRef weak; /* List of weak tables (to be cleared). */
diff --git a/src/lj_state.c b/src/lj_state.c
index 2164b900..1e490b28 100644
--- a/src/lj_state.c
+++ b/src/lj_state.c
@@ -203,7 +203,7 @@ LUA_API lua_State *lua_newstate(lua_Alloc f, void *ud)
203 lj_str_initbuf(L, &g->tmpbuf); 203 lj_str_initbuf(L, &g->tmpbuf);
204 g->gc.state = GCSpause; 204 g->gc.state = GCSpause;
205 setgcref(g->gc.root, obj2gco(L)); 205 setgcref(g->gc.root, obj2gco(L));
206 g->gc.sweep = &g->gc.root; 206 setmref(g->gc.sweep, &g->gc.root);
207 g->gc.total = sizeof(GG_State); 207 g->gc.total = sizeof(GG_State);
208 g->gc.pause = LUAI_GCPAUSE; 208 g->gc.pause = LUAI_GCPAUSE;
209 g->gc.stepmul = LUAI_GCMUL; 209 g->gc.stepmul = LUAI_GCMUL;
diff --git a/src/luajit.c b/src/luajit.c
index a6cc7ce3..cc2bf710 100644
--- a/src/luajit.c
+++ b/src/luajit.c
@@ -454,8 +454,8 @@ static int handle_luainit(lua_State *L)
454} 454}
455 455
456struct Smain { 456struct Smain {
457 int argc;
458 char **argv; 457 char **argv;
458 int argc;
459 int status; 459 int status;
460}; 460};
461 461