commit e01f5e680951a66bd67a22eeed1d9e05ab30b9f2
parent cbfc581990db2e20ee06670dbf84f28bcfe1dc42
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Fri, 8 Feb 2002 20:42:19 -0200
better order of record fields for 64-bit machines
Diffstat:
7 files changed, 36 insertions(+), 37 deletions(-)
diff --git a/ldo.c b/ldo.c
@@ -32,10 +32,10 @@
/* chain list of long jump buffers */
struct lua_longjmp {
- jmp_buf b;
struct lua_longjmp *previous;
CallInfo *ci; /* index of call info of active function that set protection */
StkId top; /* top stack when protection was set */
+ jmp_buf b;
int allowhooks; /* `allowhook' state when protection was set */
volatile int status; /* error code */
};
diff --git a/llex.h b/llex.h
@@ -50,13 +50,13 @@ typedef struct Token {
typedef struct LexState {
int current; /* current character (charint) */
+ int linenumber; /* input line counter */
+ int lastline; /* line of last token `consumed' */
Token t; /* current token */
Token lookahead; /* look ahead token */
struct FuncState *fs; /* `FuncState' is private to the parser */
struct lua_State *L;
struct zio *z; /* input stream */
- int linenumber; /* input line counter */
- int lastline; /* line of last token `consumed' */
TString *source; /* current source name */
} LexState;
diff --git a/lobject.h b/lobject.h
@@ -112,7 +112,7 @@ typedef union TString {
} TString;
-#define getstr(ts) cast(char *, (ts) + 1)
+#define getstr(ts) cast(const char *, (ts) + 1)
#define svalue(o) getstr(tsvalue(o))
@@ -122,8 +122,8 @@ typedef union Udata {
struct {
struct Table *metatable;
void *value;
- size_t len; /* least bit reserved for gc mark */
union Udata *next; /* chain for list of all udata */
+ size_t len; /* least bit reserved for gc mark */
} uv;
} Udata;
@@ -135,24 +135,23 @@ typedef union Udata {
*/
typedef struct Proto {
TObject *k; /* constants used by the function */
- int sizek; /* size of `k' */
- struct Proto **p; /* functions defined inside the function */
- int sizep; /* size of `p' */
Instruction *code;
+ struct Proto **p; /* functions defined inside the function */
+ struct Proto *next;
+ int *lineinfo; /* map from opcodes to source lines */
+ struct LocVar *locvars; /* information about local variables */
+ TString *source;
+ int sizek; /* size of `k' */
int sizecode;
+ int sizep; /* size of `p' */
+ int sizelineinfo; /* size of `lineinfo' */
+ int sizelocvars;
+ int lineDefined;
short nupvalues;
short numparams;
short is_vararg;
short maxstacksize;
short marked;
- struct Proto *next;
- /* debug information */
- int *lineinfo; /* map from opcodes to source lines */
- int sizelineinfo; /* size of `lineinfo' */
- struct LocVar *locvars; /* information about local variables */
- int sizelocvars;
- int lineDefined;
- TString *source;
} Proto;
@@ -224,12 +223,12 @@ typedef struct Table {
struct Table *metatable;
TObject *array; /* array part */
Node *node;
- int sizearray; /* size of `array' array */
- lu_byte lsizenode; /* log2 of size of `node' array */
- unsigned short flags; /* 1<<p means tagmethod(p) is not present */
Node *firstfree; /* this position is free; all positions after it are full */
struct Table *next;
struct Table *mark; /* marked tables (point to itself when not marked) */
+ int sizearray; /* size of `array' array */
+ unsigned short flags; /* 1<<p means tagmethod(p) is not present */
+ lu_byte lsizenode; /* log2 of size of `node' array */
} Table;
diff --git a/lparser.h b/lparser.h
@@ -56,21 +56,21 @@ typedef struct expdesc {
/* state needed to generate code for a given function */
typedef struct FuncState {
Proto *f; /* current function header */
+ Table *h; /* table to find (and reuse) elements in `k' */
struct FuncState *prev; /* enclosing function */
struct LexState *ls; /* lexical state */
struct lua_State *L; /* copy of the Lua state */
+ struct Breaklabel *bl; /* chain of breakable blocks */
int pc; /* next position to code (equivalent to `ncode') */
int lasttarget; /* `pc' of last `jump target' */
int jlt; /* list of jumps to `lasttarget' */
int freereg; /* first free register */
int nk; /* number of elements in `k' */
- Table *h; /* table to find (and reuse) elements in `k' */
int np; /* number of elements in `p' */
int nlineinfo; /* number of elements in `lineinfo' */
int nlocvars; /* number of elements in `locvars' */
int nactloc; /* number of active local variables */
int lastline; /* line where last `lineinfo' was generated */
- struct Breaklabel *bl; /* chain of breakable blocks */
expdesc upvalues[MAXUPVALUES]; /* upvalues */
int actloc[MAXLOCALS]; /* local-variable stack (indices to locvars) */
unsigned int wasup[words2bits(MAXLOCALS)]; /* bit array to mark whether a
diff --git a/lstate.c b/lstate.c
@@ -22,8 +22,8 @@
struct Sopen {
- int stacksize;
lua_State *L;
+ int stacksize;
};
diff --git a/lstate.h b/lstate.h
@@ -79,9 +79,9 @@ struct lua_longjmp; /* defined in ldo.c */
typedef struct stringtable {
- int size;
- ls_nstr nuse; /* number of elements */
TString **hash;
+ ls_nstr nuse; /* number of elements */
+ int size;
} stringtable;
@@ -109,17 +109,17 @@ typedef struct CallInfo {
** `global state', shared by all threads of this state
*/
typedef struct global_State {
- void *Mbuffer; /* global buffer */
- size_t Mbuffsize; /* size of Mbuffer */
stringtable strt; /* hash table for strings */
- lu_mem GCthreshold;
- lu_mem nblocks; /* number of `bytes' currently allocated */
Proto *rootproto; /* list of all prototypes */
Closure *rootcl; /* list of all closures */
Table *roottable; /* list of all tables */
UpVal *rootupval; /* list of closed up values */
Udata *rootudata; /* list of all userdata */
Udata *tmudata; /* list of userdata to be GC */
+ void *Mbuffer; /* global buffer */
+ size_t Mbuffsize; /* size of Mbuffer */
+ lu_mem GCthreshold;
+ lu_mem nblocks; /* number of `bytes' currently allocated */
TString *tmname[TM_N]; /* array with tag-method names */
} global_State;
@@ -133,19 +133,19 @@ struct lua_State {
CallInfo *ci; /* call info for current function */
StkId stack_last; /* last free slot in the stack */
StkId stack; /* stack base */
- int stacksize;
- int maxstacksize;
CallInfo *end_ci; /* points after end of ci array*/
CallInfo *base_ci; /* array of CallInfo's */
- int size_ci; /* size of array `base_ci' */
global_State *_G;
- lua_Hook callhook;
- lua_Hook linehook;
- int allowhooks;
struct lua_longjmp *errorJmp; /* current error recover point */
UpVal *openupval; /* list of open upvalues in this stack */
lua_State *next; /* circular double linked list of states */
lua_State *previous;
+ int stacksize;
+ int maxstacksize;
+ int size_ci; /* size of array `base_ci' */
+ int allowhooks;
+ lua_Hook callhook;
+ lua_Hook linehook;
};
diff --git a/luadebug.h b/luadebug.h
@@ -29,13 +29,13 @@ LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func);
struct lua_Debug {
const char *event; /* `call', `return' */
- int currentline; /* (l) */
const char *name; /* (n) */
const char *namewhat; /* (n) `global', `tag method', `local', `field' */
- int nups; /* (u) number of upvalues */
- int linedefined; /* (S) */
const char *what; /* (S) `Lua' function, `C' function, Lua `main' */
const char *source; /* (S) */
+ int currentline; /* (l) */
+ int nups; /* (u) number of upvalues */
+ int linedefined; /* (S) */
char short_src[LUA_IDSIZE]; /* (S) */
/* private part */
int _ci; /* active function */