From e01f5e680951a66bd67a22eeed1d9e05ab30b9f2 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 8 Feb 2002 20:42:41 -0200 Subject: better order of record fields for 64-bit machines --- ldo.c | 2 +- llex.h | 4 ++-- lobject.h | 31 +++++++++++++++---------------- lparser.h | 4 ++-- lstate.c | 2 +- lstate.h | 24 ++++++++++++------------ luadebug.h | 6 +++--- 7 files changed, 36 insertions(+), 37 deletions(-) diff --git a/ldo.c b/ldo.c index 6f850cbd..ec39419a 100644 --- 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 index 8f0ae213..67edd491 100644 --- 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 index 6b3a45a9..5b2a1bf3 100644 --- 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<