Browse Source

small changes in field order in some structs to reduce padding

Roberto Ierusalimschy 11 years ago
parent
commit
0aa32fa0cb
2 changed files with 14 additions and 14 deletions
  1. 12 12
      lobject.h
  2. 2 2
      lstate.h

+ 12 - 12
lobject.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lobject.h,v 2.90 2014/05/07 11:12:51 roberto Exp roberto $
+** $Id: lobject.h,v 2.91 2014/05/15 20:28:39 roberto Exp roberto $
 ** Type definitions for Lua objects
 ** Type definitions for Lua objects
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -373,14 +373,9 @@ typedef struct LocVar {
 */
 */
 typedef struct Proto {
 typedef struct Proto {
   CommonHeader;
   CommonHeader;
-  TValue *k;  /* constants used by the function */
-  Instruction *code;
-  struct Proto **p;  /* functions defined inside the function */
-  int *lineinfo;  /* map from opcodes to source lines (debug information) */
-  LocVar *locvars;  /* information about local variables (debug information) */
-  Upvaldesc *upvalues;  /* upvalue information */
-  union Closure *cache;  /* last created closure with this prototype */
-  TString  *source;  /* used for debug information */
+  lu_byte numparams;  /* number of fixed parameters */
+  lu_byte is_vararg;
+  lu_byte maxstacksize;  /* maximum stack used by this function */
   int sizeupvalues;  /* size of 'upvalues' */
   int sizeupvalues;  /* size of 'upvalues' */
   int sizek;  /* size of `k' */
   int sizek;  /* size of `k' */
   int sizecode;
   int sizecode;
@@ -389,10 +384,15 @@ typedef struct Proto {
   int sizelocvars;
   int sizelocvars;
   int linedefined;
   int linedefined;
   int lastlinedefined;
   int lastlinedefined;
+  TValue *k;  /* constants used by the function */
+  Instruction *code;
+  struct Proto **p;  /* functions defined inside the function */
+  int *lineinfo;  /* map from opcodes to source lines (debug information) */
+  LocVar *locvars;  /* information about local variables (debug information) */
+  Upvaldesc *upvalues;  /* upvalue information */
+  union Closure *cache;  /* last created closure with this prototype */
+  TString  *source;  /* used for debug information */
   GCObject *gclist;
   GCObject *gclist;
-  lu_byte numparams;  /* number of fixed parameters */
-  lu_byte is_vararg;
-  lu_byte maxstacksize;  /* maximum stack used by this function */
 } Proto;
 } Proto;
 
 
 
 

+ 2 - 2
lstate.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lstate.h,v 2.101 2014/02/18 13:39:37 roberto Exp roberto $
+** $Id: lstate.h,v 2.102 2014/02/18 13:46:26 roberto Exp roberto $
 ** Global State
 ** Global State
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -69,9 +69,9 @@ typedef struct CallInfo {
       const Instruction *savedpc;
       const Instruction *savedpc;
     } l;
     } l;
     struct {  /* only for C functions */
     struct {  /* only for C functions */
-      int ctx;  /* context info. in case of yields */
       lua_CFunction k;  /* continuation in case of yields */
       lua_CFunction k;  /* continuation in case of yields */
       ptrdiff_t old_errfunc;
       ptrdiff_t old_errfunc;
+      int ctx;  /* context info. in case of yields */
       lu_byte old_allowhook;
       lu_byte old_allowhook;
       lu_byte status;
       lu_byte status;
     } c;
     } c;