better order of record fields for 64-bit machines

This commit is contained in:
Roberto Ierusalimschy
2002-02-08 20:42:41 -02:00
parent cbfc581990
commit e01f5e6809
7 changed files with 36 additions and 37 deletions

2
ldo.c
View File

@@ -32,10 +32,10 @@
/* chain list of long jump buffers */ /* chain list of long jump buffers */
struct lua_longjmp { struct lua_longjmp {
jmp_buf b;
struct lua_longjmp *previous; struct lua_longjmp *previous;
CallInfo *ci; /* index of call info of active function that set protection */ CallInfo *ci; /* index of call info of active function that set protection */
StkId top; /* top stack when protection was set */ StkId top; /* top stack when protection was set */
jmp_buf b;
int allowhooks; /* `allowhook' state when protection was set */ int allowhooks; /* `allowhook' state when protection was set */
volatile int status; /* error code */ volatile int status; /* error code */
}; };

4
llex.h
View File

@@ -50,13 +50,13 @@ typedef struct Token {
typedef struct LexState { typedef struct LexState {
int current; /* current character (charint) */ int current; /* current character (charint) */
int linenumber; /* input line counter */
int lastline; /* line of last token `consumed' */
Token t; /* current token */ Token t; /* current token */
Token lookahead; /* look ahead token */ Token lookahead; /* look ahead token */
struct FuncState *fs; /* `FuncState' is private to the parser */ struct FuncState *fs; /* `FuncState' is private to the parser */
struct lua_State *L; struct lua_State *L;
struct zio *z; /* input stream */ struct zio *z; /* input stream */
int linenumber; /* input line counter */
int lastline; /* line of last token `consumed' */
TString *source; /* current source name */ TString *source; /* current source name */
} LexState; } LexState;

View File

@@ -112,7 +112,7 @@ typedef union TString {
} TString; } TString;
#define getstr(ts) cast(char *, (ts) + 1) #define getstr(ts) cast(const char *, (ts) + 1)
#define svalue(o) getstr(tsvalue(o)) #define svalue(o) getstr(tsvalue(o))
@@ -122,8 +122,8 @@ typedef union Udata {
struct { struct {
struct Table *metatable; struct Table *metatable;
void *value; void *value;
size_t len; /* least bit reserved for gc mark */
union Udata *next; /* chain for list of all udata */ union Udata *next; /* chain for list of all udata */
size_t len; /* least bit reserved for gc mark */
} uv; } uv;
} Udata; } Udata;
@@ -135,24 +135,23 @@ typedef union Udata {
*/ */
typedef struct Proto { typedef struct Proto {
TObject *k; /* constants used by the function */ 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; 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 sizecode;
int sizep; /* size of `p' */
int sizelineinfo; /* size of `lineinfo' */
int sizelocvars;
int lineDefined;
short nupvalues; short nupvalues;
short numparams; short numparams;
short is_vararg; short is_vararg;
short maxstacksize; short maxstacksize;
short marked; 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; } Proto;
@@ -224,12 +223,12 @@ typedef struct Table {
struct Table *metatable; struct Table *metatable;
TObject *array; /* array part */ TObject *array; /* array part */
Node *node; 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 */ Node *firstfree; /* this position is free; all positions after it are full */
struct Table *next; struct Table *next;
struct Table *mark; /* marked tables (point to itself when not marked) */ 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; } Table;

View File

@@ -56,21 +56,21 @@ typedef struct expdesc {
/* state needed to generate code for a given function */ /* state needed to generate code for a given function */
typedef struct FuncState { typedef struct FuncState {
Proto *f; /* current function header */ Proto *f; /* current function header */
Table *h; /* table to find (and reuse) elements in `k' */
struct FuncState *prev; /* enclosing function */ struct FuncState *prev; /* enclosing function */
struct LexState *ls; /* lexical state */ struct LexState *ls; /* lexical state */
struct lua_State *L; /* copy of the Lua 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 pc; /* next position to code (equivalent to `ncode') */
int lasttarget; /* `pc' of last `jump target' */ int lasttarget; /* `pc' of last `jump target' */
int jlt; /* list of jumps to `lasttarget' */ int jlt; /* list of jumps to `lasttarget' */
int freereg; /* first free register */ int freereg; /* first free register */
int nk; /* number of elements in `k' */ 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 np; /* number of elements in `p' */
int nlineinfo; /* number of elements in `lineinfo' */ int nlineinfo; /* number of elements in `lineinfo' */
int nlocvars; /* number of elements in `locvars' */ int nlocvars; /* number of elements in `locvars' */
int nactloc; /* number of active local variables */ int nactloc; /* number of active local variables */
int lastline; /* line where last `lineinfo' was generated */ int lastline; /* line where last `lineinfo' was generated */
struct Breaklabel *bl; /* chain of breakable blocks */
expdesc upvalues[MAXUPVALUES]; /* upvalues */ expdesc upvalues[MAXUPVALUES]; /* upvalues */
int actloc[MAXLOCALS]; /* local-variable stack (indices to locvars) */ int actloc[MAXLOCALS]; /* local-variable stack (indices to locvars) */
unsigned int wasup[words2bits(MAXLOCALS)]; /* bit array to mark whether a unsigned int wasup[words2bits(MAXLOCALS)]; /* bit array to mark whether a

View File

@@ -22,8 +22,8 @@
struct Sopen { struct Sopen {
int stacksize;
lua_State *L; lua_State *L;
int stacksize;
}; };

View File

@@ -79,9 +79,9 @@ struct lua_longjmp; /* defined in ldo.c */
typedef struct stringtable { typedef struct stringtable {
int size;
ls_nstr nuse; /* number of elements */
TString **hash; TString **hash;
ls_nstr nuse; /* number of elements */
int size;
} stringtable; } stringtable;
@@ -109,17 +109,17 @@ typedef struct CallInfo {
** `global state', shared by all threads of this state ** `global state', shared by all threads of this state
*/ */
typedef struct global_State { typedef struct global_State {
void *Mbuffer; /* global buffer */
size_t Mbuffsize; /* size of Mbuffer */
stringtable strt; /* hash table for strings */ stringtable strt; /* hash table for strings */
lu_mem GCthreshold;
lu_mem nblocks; /* number of `bytes' currently allocated */
Proto *rootproto; /* list of all prototypes */ Proto *rootproto; /* list of all prototypes */
Closure *rootcl; /* list of all closures */ Closure *rootcl; /* list of all closures */
Table *roottable; /* list of all tables */ Table *roottable; /* list of all tables */
UpVal *rootupval; /* list of closed up values */ UpVal *rootupval; /* list of closed up values */
Udata *rootudata; /* list of all userdata */ Udata *rootudata; /* list of all userdata */
Udata *tmudata; /* list of userdata to be GC */ 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 */ TString *tmname[TM_N]; /* array with tag-method names */
} global_State; } global_State;
@@ -133,19 +133,19 @@ struct lua_State {
CallInfo *ci; /* call info for current function */ CallInfo *ci; /* call info for current function */
StkId stack_last; /* last free slot in the stack */ StkId stack_last; /* last free slot in the stack */
StkId stack; /* stack base */ StkId stack; /* stack base */
int stacksize;
int maxstacksize;
CallInfo *end_ci; /* points after end of ci array*/ CallInfo *end_ci; /* points after end of ci array*/
CallInfo *base_ci; /* array of CallInfo's */ CallInfo *base_ci; /* array of CallInfo's */
int size_ci; /* size of array `base_ci' */
global_State *_G; global_State *_G;
lua_Hook callhook;
lua_Hook linehook;
int allowhooks;
struct lua_longjmp *errorJmp; /* current error recover point */ struct lua_longjmp *errorJmp; /* current error recover point */
UpVal *openupval; /* list of open upvalues in this stack */ UpVal *openupval; /* list of open upvalues in this stack */
lua_State *next; /* circular double linked list of states */ lua_State *next; /* circular double linked list of states */
lua_State *previous; lua_State *previous;
int stacksize;
int maxstacksize;
int size_ci; /* size of array `base_ci' */
int allowhooks;
lua_Hook callhook;
lua_Hook linehook;
}; };

View File

@@ -29,13 +29,13 @@ LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func);
struct lua_Debug { struct lua_Debug {
const char *event; /* `call', `return' */ const char *event; /* `call', `return' */
int currentline; /* (l) */
const char *name; /* (n) */ const char *name; /* (n) */
const char *namewhat; /* (n) `global', `tag method', `local', `field' */ 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 *what; /* (S) `Lua' function, `C' function, Lua `main' */
const char *source; /* (S) */ const char *source; /* (S) */
int currentline; /* (l) */
int nups; /* (u) number of upvalues */
int linedefined; /* (S) */
char short_src[LUA_IDSIZE]; /* (S) */ char short_src[LUA_IDSIZE]; /* (S) */
/* private part */ /* private part */
int _ci; /* active function */ int _ci; /* active function */