diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-02-08 20:42:41 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-02-08 20:42:41 -0200 |
commit | e01f5e680951a66bd67a22eeed1d9e05ab30b9f2 (patch) | |
tree | 99ff32eedd3bf3194561f5a2d916d948ba81c4f9 | |
parent | cbfc581990db2e20ee06670dbf84f28bcfe1dc42 (diff) | |
download | lua-e01f5e680951a66bd67a22eeed1d9e05ab30b9f2.tar.gz lua-e01f5e680951a66bd67a22eeed1d9e05ab30b9f2.tar.bz2 lua-e01f5e680951a66bd67a22eeed1d9e05ab30b9f2.zip |
better order of record fields for 64-bit machines
-rw-r--r-- | ldo.c | 2 | ||||
-rw-r--r-- | llex.h | 4 | ||||
-rw-r--r-- | lobject.h | 31 | ||||
-rw-r--r-- | lparser.h | 4 | ||||
-rw-r--r-- | lstate.c | 2 | ||||
-rw-r--r-- | lstate.h | 24 | ||||
-rw-r--r-- | luadebug.h | 6 |
7 files changed, 36 insertions, 37 deletions
@@ -32,10 +32,10 @@ | |||
32 | 32 | ||
33 | /* chain list of long jump buffers */ | 33 | /* chain list of long jump buffers */ |
34 | struct lua_longjmp { | 34 | struct lua_longjmp { |
35 | jmp_buf b; | ||
36 | struct lua_longjmp *previous; | 35 | struct lua_longjmp *previous; |
37 | CallInfo *ci; /* index of call info of active function that set protection */ | 36 | CallInfo *ci; /* index of call info of active function that set protection */ |
38 | StkId top; /* top stack when protection was set */ | 37 | StkId top; /* top stack when protection was set */ |
38 | jmp_buf b; | ||
39 | int allowhooks; /* `allowhook' state when protection was set */ | 39 | int allowhooks; /* `allowhook' state when protection was set */ |
40 | volatile int status; /* error code */ | 40 | volatile int status; /* error code */ |
41 | }; | 41 | }; |
@@ -50,13 +50,13 @@ typedef struct Token { | |||
50 | 50 | ||
51 | typedef struct LexState { | 51 | typedef struct LexState { |
52 | int current; /* current character (charint) */ | 52 | int current; /* current character (charint) */ |
53 | int linenumber; /* input line counter */ | ||
54 | int lastline; /* line of last token `consumed' */ | ||
53 | Token t; /* current token */ | 55 | Token t; /* current token */ |
54 | Token lookahead; /* look ahead token */ | 56 | Token lookahead; /* look ahead token */ |
55 | struct FuncState *fs; /* `FuncState' is private to the parser */ | 57 | struct FuncState *fs; /* `FuncState' is private to the parser */ |
56 | struct lua_State *L; | 58 | struct lua_State *L; |
57 | struct zio *z; /* input stream */ | 59 | struct zio *z; /* input stream */ |
58 | int linenumber; /* input line counter */ | ||
59 | int lastline; /* line of last token `consumed' */ | ||
60 | TString *source; /* current source name */ | 60 | TString *source; /* current source name */ |
61 | } LexState; | 61 | } LexState; |
62 | 62 | ||
@@ -112,7 +112,7 @@ typedef union TString { | |||
112 | } TString; | 112 | } TString; |
113 | 113 | ||
114 | 114 | ||
115 | #define getstr(ts) cast(char *, (ts) + 1) | 115 | #define getstr(ts) cast(const char *, (ts) + 1) |
116 | #define svalue(o) getstr(tsvalue(o)) | 116 | #define svalue(o) getstr(tsvalue(o)) |
117 | 117 | ||
118 | 118 | ||
@@ -122,8 +122,8 @@ typedef union Udata { | |||
122 | struct { | 122 | struct { |
123 | struct Table *metatable; | 123 | struct Table *metatable; |
124 | void *value; | 124 | void *value; |
125 | size_t len; /* least bit reserved for gc mark */ | ||
126 | union Udata *next; /* chain for list of all udata */ | 125 | union Udata *next; /* chain for list of all udata */ |
126 | size_t len; /* least bit reserved for gc mark */ | ||
127 | } uv; | 127 | } uv; |
128 | } Udata; | 128 | } Udata; |
129 | 129 | ||
@@ -135,24 +135,23 @@ typedef union Udata { | |||
135 | */ | 135 | */ |
136 | typedef struct Proto { | 136 | typedef struct Proto { |
137 | TObject *k; /* constants used by the function */ | 137 | TObject *k; /* constants used by the function */ |
138 | int sizek; /* size of `k' */ | ||
139 | struct Proto **p; /* functions defined inside the function */ | ||
140 | int sizep; /* size of `p' */ | ||
141 | Instruction *code; | 138 | Instruction *code; |
139 | struct Proto **p; /* functions defined inside the function */ | ||
140 | struct Proto *next; | ||
141 | int *lineinfo; /* map from opcodes to source lines */ | ||
142 | struct LocVar *locvars; /* information about local variables */ | ||
143 | TString *source; | ||
144 | int sizek; /* size of `k' */ | ||
142 | int sizecode; | 145 | int sizecode; |
146 | int sizep; /* size of `p' */ | ||
147 | int sizelineinfo; /* size of `lineinfo' */ | ||
148 | int sizelocvars; | ||
149 | int lineDefined; | ||
143 | short nupvalues; | 150 | short nupvalues; |
144 | short numparams; | 151 | short numparams; |
145 | short is_vararg; | 152 | short is_vararg; |
146 | short maxstacksize; | 153 | short maxstacksize; |
147 | short marked; | 154 | short marked; |
148 | struct Proto *next; | ||
149 | /* debug information */ | ||
150 | int *lineinfo; /* map from opcodes to source lines */ | ||
151 | int sizelineinfo; /* size of `lineinfo' */ | ||
152 | struct LocVar *locvars; /* information about local variables */ | ||
153 | int sizelocvars; | ||
154 | int lineDefined; | ||
155 | TString *source; | ||
156 | } Proto; | 155 | } Proto; |
157 | 156 | ||
158 | 157 | ||
@@ -224,12 +223,12 @@ typedef struct Table { | |||
224 | struct Table *metatable; | 223 | struct Table *metatable; |
225 | TObject *array; /* array part */ | 224 | TObject *array; /* array part */ |
226 | Node *node; | 225 | Node *node; |
227 | int sizearray; /* size of `array' array */ | ||
228 | lu_byte lsizenode; /* log2 of size of `node' array */ | ||
229 | unsigned short flags; /* 1<<p means tagmethod(p) is not present */ | ||
230 | Node *firstfree; /* this position is free; all positions after it are full */ | 226 | Node *firstfree; /* this position is free; all positions after it are full */ |
231 | struct Table *next; | 227 | struct Table *next; |
232 | struct Table *mark; /* marked tables (point to itself when not marked) */ | 228 | struct Table *mark; /* marked tables (point to itself when not marked) */ |
229 | int sizearray; /* size of `array' array */ | ||
230 | unsigned short flags; /* 1<<p means tagmethod(p) is not present */ | ||
231 | lu_byte lsizenode; /* log2 of size of `node' array */ | ||
233 | } Table; | 232 | } Table; |
234 | 233 | ||
235 | 234 | ||
@@ -56,21 +56,21 @@ typedef struct expdesc { | |||
56 | /* state needed to generate code for a given function */ | 56 | /* state needed to generate code for a given function */ |
57 | typedef struct FuncState { | 57 | typedef struct FuncState { |
58 | Proto *f; /* current function header */ | 58 | Proto *f; /* current function header */ |
59 | Table *h; /* table to find (and reuse) elements in `k' */ | ||
59 | struct FuncState *prev; /* enclosing function */ | 60 | struct FuncState *prev; /* enclosing function */ |
60 | struct LexState *ls; /* lexical state */ | 61 | struct LexState *ls; /* lexical state */ |
61 | struct lua_State *L; /* copy of the Lua state */ | 62 | struct lua_State *L; /* copy of the Lua state */ |
63 | struct Breaklabel *bl; /* chain of breakable blocks */ | ||
62 | int pc; /* next position to code (equivalent to `ncode') */ | 64 | int pc; /* next position to code (equivalent to `ncode') */ |
63 | int lasttarget; /* `pc' of last `jump target' */ | 65 | int lasttarget; /* `pc' of last `jump target' */ |
64 | int jlt; /* list of jumps to `lasttarget' */ | 66 | int jlt; /* list of jumps to `lasttarget' */ |
65 | int freereg; /* first free register */ | 67 | int freereg; /* first free register */ |
66 | int nk; /* number of elements in `k' */ | 68 | int nk; /* number of elements in `k' */ |
67 | Table *h; /* table to find (and reuse) elements in `k' */ | ||
68 | int np; /* number of elements in `p' */ | 69 | int np; /* number of elements in `p' */ |
69 | int nlineinfo; /* number of elements in `lineinfo' */ | 70 | int nlineinfo; /* number of elements in `lineinfo' */ |
70 | int nlocvars; /* number of elements in `locvars' */ | 71 | int nlocvars; /* number of elements in `locvars' */ |
71 | int nactloc; /* number of active local variables */ | 72 | int nactloc; /* number of active local variables */ |
72 | int lastline; /* line where last `lineinfo' was generated */ | 73 | int lastline; /* line where last `lineinfo' was generated */ |
73 | struct Breaklabel *bl; /* chain of breakable blocks */ | ||
74 | expdesc upvalues[MAXUPVALUES]; /* upvalues */ | 74 | expdesc upvalues[MAXUPVALUES]; /* upvalues */ |
75 | int actloc[MAXLOCALS]; /* local-variable stack (indices to locvars) */ | 75 | int actloc[MAXLOCALS]; /* local-variable stack (indices to locvars) */ |
76 | unsigned int wasup[words2bits(MAXLOCALS)]; /* bit array to mark whether a | 76 | unsigned int wasup[words2bits(MAXLOCALS)]; /* bit array to mark whether a |
@@ -22,8 +22,8 @@ | |||
22 | 22 | ||
23 | 23 | ||
24 | struct Sopen { | 24 | struct Sopen { |
25 | int stacksize; | ||
26 | lua_State *L; | 25 | lua_State *L; |
26 | int stacksize; | ||
27 | }; | 27 | }; |
28 | 28 | ||
29 | 29 | ||
@@ -79,9 +79,9 @@ struct lua_longjmp; /* defined in ldo.c */ | |||
79 | 79 | ||
80 | 80 | ||
81 | typedef struct stringtable { | 81 | typedef struct stringtable { |
82 | int size; | ||
83 | ls_nstr nuse; /* number of elements */ | ||
84 | TString **hash; | 82 | TString **hash; |
83 | ls_nstr nuse; /* number of elements */ | ||
84 | int size; | ||
85 | } stringtable; | 85 | } stringtable; |
86 | 86 | ||
87 | 87 | ||
@@ -109,17 +109,17 @@ typedef struct CallInfo { | |||
109 | ** `global state', shared by all threads of this state | 109 | ** `global state', shared by all threads of this state |
110 | */ | 110 | */ |
111 | typedef struct global_State { | 111 | typedef struct global_State { |
112 | void *Mbuffer; /* global buffer */ | ||
113 | size_t Mbuffsize; /* size of Mbuffer */ | ||
114 | stringtable strt; /* hash table for strings */ | 112 | stringtable strt; /* hash table for strings */ |
115 | lu_mem GCthreshold; | ||
116 | lu_mem nblocks; /* number of `bytes' currently allocated */ | ||
117 | Proto *rootproto; /* list of all prototypes */ | 113 | Proto *rootproto; /* list of all prototypes */ |
118 | Closure *rootcl; /* list of all closures */ | 114 | Closure *rootcl; /* list of all closures */ |
119 | Table *roottable; /* list of all tables */ | 115 | Table *roottable; /* list of all tables */ |
120 | UpVal *rootupval; /* list of closed up values */ | 116 | UpVal *rootupval; /* list of closed up values */ |
121 | Udata *rootudata; /* list of all userdata */ | 117 | Udata *rootudata; /* list of all userdata */ |
122 | Udata *tmudata; /* list of userdata to be GC */ | 118 | Udata *tmudata; /* list of userdata to be GC */ |
119 | void *Mbuffer; /* global buffer */ | ||
120 | size_t Mbuffsize; /* size of Mbuffer */ | ||
121 | lu_mem GCthreshold; | ||
122 | lu_mem nblocks; /* number of `bytes' currently allocated */ | ||
123 | TString *tmname[TM_N]; /* array with tag-method names */ | 123 | TString *tmname[TM_N]; /* array with tag-method names */ |
124 | } global_State; | 124 | } global_State; |
125 | 125 | ||
@@ -133,19 +133,19 @@ struct lua_State { | |||
133 | CallInfo *ci; /* call info for current function */ | 133 | CallInfo *ci; /* call info for current function */ |
134 | StkId stack_last; /* last free slot in the stack */ | 134 | StkId stack_last; /* last free slot in the stack */ |
135 | StkId stack; /* stack base */ | 135 | StkId stack; /* stack base */ |
136 | int stacksize; | ||
137 | int maxstacksize; | ||
138 | CallInfo *end_ci; /* points after end of ci array*/ | 136 | CallInfo *end_ci; /* points after end of ci array*/ |
139 | CallInfo *base_ci; /* array of CallInfo's */ | 137 | CallInfo *base_ci; /* array of CallInfo's */ |
140 | int size_ci; /* size of array `base_ci' */ | ||
141 | global_State *_G; | 138 | global_State *_G; |
142 | lua_Hook callhook; | ||
143 | lua_Hook linehook; | ||
144 | int allowhooks; | ||
145 | struct lua_longjmp *errorJmp; /* current error recover point */ | 139 | struct lua_longjmp *errorJmp; /* current error recover point */ |
146 | UpVal *openupval; /* list of open upvalues in this stack */ | 140 | UpVal *openupval; /* list of open upvalues in this stack */ |
147 | lua_State *next; /* circular double linked list of states */ | 141 | lua_State *next; /* circular double linked list of states */ |
148 | lua_State *previous; | 142 | lua_State *previous; |
143 | int stacksize; | ||
144 | int maxstacksize; | ||
145 | int size_ci; /* size of array `base_ci' */ | ||
146 | int allowhooks; | ||
147 | lua_Hook callhook; | ||
148 | lua_Hook linehook; | ||
149 | }; | 149 | }; |
150 | 150 | ||
151 | 151 | ||
@@ -29,13 +29,13 @@ LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func); | |||
29 | 29 | ||
30 | struct lua_Debug { | 30 | struct lua_Debug { |
31 | const char *event; /* `call', `return' */ | 31 | const char *event; /* `call', `return' */ |
32 | int currentline; /* (l) */ | ||
33 | const char *name; /* (n) */ | 32 | const char *name; /* (n) */ |
34 | const char *namewhat; /* (n) `global', `tag method', `local', `field' */ | 33 | const char *namewhat; /* (n) `global', `tag method', `local', `field' */ |
35 | int nups; /* (u) number of upvalues */ | ||
36 | int linedefined; /* (S) */ | ||
37 | const char *what; /* (S) `Lua' function, `C' function, Lua `main' */ | 34 | const char *what; /* (S) `Lua' function, `C' function, Lua `main' */ |
38 | const char *source; /* (S) */ | 35 | const char *source; /* (S) */ |
36 | int currentline; /* (l) */ | ||
37 | int nups; /* (u) number of upvalues */ | ||
38 | int linedefined; /* (S) */ | ||
39 | char short_src[LUA_IDSIZE]; /* (S) */ | 39 | char short_src[LUA_IDSIZE]; /* (S) */ |
40 | /* private part */ | 40 | /* private part */ |
41 | int _ci; /* active function */ | 41 | int _ci; /* active function */ |