diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-03-07 15:09:25 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-03-07 15:09:25 -0300 |
| commit | 6048c4f74d7d63d6c2f5a53cd8e4ee01f6702be9 (patch) | |
| tree | 1f8fd00995288958a32ebd8f97863c5f1cb8f776 /lobject.h | |
| parent | 5e870f86a255988ca85eda795adc31063ec1ac70 (diff) | |
| download | lua-6048c4f74d7d63d6c2f5a53cd8e4ee01f6702be9.tar.gz lua-6048c4f74d7d63d6c2f5a53cd8e4ee01f6702be9.tar.bz2 lua-6048c4f74d7d63d6c2f5a53cd8e4ee01f6702be9.zip | |
better way to link callinfo's and stack
Diffstat (limited to 'lobject.h')
| -rw-r--r-- | lobject.h | 22 |
1 files changed, 7 insertions, 15 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.h,v 1.99 2001/02/23 20:32:32 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 1.100 2001/03/02 17:27:50 roberto Exp roberto $ |
| 3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -22,24 +22,15 @@ | |||
| 22 | #endif | 22 | #endif |
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | /* ttype for closures active in the stack */ | ||
| 26 | #define LUA_TMARK 6 | ||
| 27 | |||
| 28 | 25 | ||
| 29 | /* tags for values visible from Lua == first user-created tag */ | 26 | /* tags for values visible from Lua == first user-created tag */ |
| 30 | #define NUM_TAGS 6 | 27 | #define NUM_TAGS 6 |
| 31 | 28 | ||
| 32 | 29 | ||
| 33 | /* check whether `t' is a mark */ | ||
| 34 | #define is_T_MARK(t) (ttype(t) == LUA_TMARK) | ||
| 35 | |||
| 36 | |||
| 37 | |||
| 38 | typedef union { | 30 | typedef union { |
| 39 | struct TString *ts; | 31 | struct TString *ts; |
| 40 | struct Closure *cl; | 32 | struct Closure *cl; |
| 41 | struct Hash *h; | 33 | struct Hash *h; |
| 42 | struct CallInfo *info; | ||
| 43 | lua_Number n; /* LUA_TNUMBER */ | 34 | lua_Number n; /* LUA_TNUMBER */ |
| 44 | } Value; | 35 | } Value; |
| 45 | 36 | ||
| @@ -56,7 +47,6 @@ typedef struct lua_TObject { | |||
| 56 | #define tsvalue(o) ((o)->value.ts) | 47 | #define tsvalue(o) ((o)->value.ts) |
| 57 | #define clvalue(o) ((o)->value.cl) | 48 | #define clvalue(o) ((o)->value.cl) |
| 58 | #define hvalue(o) ((o)->value.h) | 49 | #define hvalue(o) ((o)->value.h) |
| 59 | #define infovalue(o) ((o)->value.info) | ||
| 60 | 50 | ||
| 61 | 51 | ||
| 62 | /* Macros to set values */ | 52 | /* Macros to set values */ |
| @@ -75,9 +65,6 @@ typedef struct lua_TObject { | |||
| 75 | #define sethvalue(obj,x) \ | 65 | #define sethvalue(obj,x) \ |
| 76 | { TObject *_o=(obj); _o->tt=LUA_TTABLE; _o->value.h=(x); } | 66 | { TObject *_o=(obj); _o->tt=LUA_TTABLE; _o->value.h=(x); } |
| 77 | 67 | ||
| 78 | #define setivalue(obj,x) \ | ||
| 79 | { TObject *_o=(obj); _o->tt=LUA_TMARK; _o->value.info=(x); } | ||
| 80 | |||
| 81 | #define setnilvalue(obj) ((obj)->tt=LUA_TNIL) | 68 | #define setnilvalue(obj) ((obj)->tt=LUA_TNIL) |
| 82 | 69 | ||
| 83 | #define setobj(obj1,obj2) \ | 70 | #define setobj(obj1,obj2) \ |
| @@ -85,6 +72,8 @@ typedef struct lua_TObject { | |||
| 85 | o1->tt=o2->tt; o1->value = o2->value; } | 72 | o1->tt=o2->tt; o1->value = o2->value; } |
| 86 | 73 | ||
| 87 | 74 | ||
| 75 | typedef TObject *StkId; /* index to stack elements */ | ||
| 76 | |||
| 88 | 77 | ||
| 89 | /* | 78 | /* |
| 90 | ** String headers for string table | 79 | ** String headers for string table |
| @@ -209,13 +198,16 @@ typedef struct Hash { | |||
| 209 | ** informations about a call (for debugging) | 198 | ** informations about a call (for debugging) |
| 210 | */ | 199 | */ |
| 211 | typedef struct CallInfo { | 200 | typedef struct CallInfo { |
| 212 | struct Closure *func; /* function being called */ | 201 | struct CallInfo *prev; /* linked list */ |
| 202 | StkId base; /* base for called function */ | ||
| 213 | const Instruction **pc; /* current pc of called function */ | 203 | const Instruction **pc; /* current pc of called function */ |
| 214 | int lastpc; /* last pc traced */ | 204 | int lastpc; /* last pc traced */ |
| 215 | int line; /* current line */ | 205 | int line; /* current line */ |
| 216 | int refi; /* current index in `lineinfo' */ | 206 | int refi; /* current index in `lineinfo' */ |
| 217 | } CallInfo; | 207 | } CallInfo; |
| 218 | 208 | ||
| 209 | #define ci_func(ci) (clvalue((ci)->base - 1)) | ||
| 210 | |||
| 219 | 211 | ||
| 220 | extern const TObject luaO_nilobject; | 212 | extern const TObject luaO_nilobject; |
| 221 | 213 | ||
