diff options
author | Mike Pall <mike> | 2020-03-20 13:38:05 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2020-03-20 13:38:05 +0100 |
commit | fc1c4da3cc2b3bb51109a3028b696dbd05add5dc (patch) | |
tree | 82c96507cba456aa362bb7faeb2649103bb8fe45 | |
parent | 0ad60ccbc3768fa8e3e726858adf261950edbc22 (diff) | |
parent | e613105ca92fe25e7bd63031b409faa8c908ac35 (diff) | |
download | luajit-fc1c4da3cc2b3bb51109a3028b696dbd05add5dc.tar.gz luajit-fc1c4da3cc2b3bb51109a3028b696dbd05add5dc.tar.bz2 luajit-fc1c4da3cc2b3bb51109a3028b696dbd05add5dc.zip |
Merge branch 'master' into v2.1
-rw-r--r-- | src/lj_api.c | 8 | ||||
-rw-r--r-- | src/lj_debug.c | 7 | ||||
-rw-r--r-- | src/lj_debug.h | 3 |
3 files changed, 12 insertions, 6 deletions
diff --git a/src/lj_api.c b/src/lj_api.c index 974b5643..24ae6611 100644 --- a/src/lj_api.c +++ b/src/lj_api.c | |||
@@ -892,7 +892,8 @@ LUA_API int lua_next(lua_State *L, int idx) | |||
892 | LUA_API const char *lua_getupvalue(lua_State *L, int idx, int n) | 892 | LUA_API const char *lua_getupvalue(lua_State *L, int idx, int n) |
893 | { | 893 | { |
894 | TValue *val; | 894 | TValue *val; |
895 | const char *name = lj_debug_uvnamev(index2adr(L, idx), (uint32_t)(n-1), &val); | 895 | GCobj *o; |
896 | const char *name = lj_debug_uvnamev(index2adr(L, idx), (uint32_t)(n-1), &val, &o); | ||
896 | if (name) { | 897 | if (name) { |
897 | copyTV(L, L->top, val); | 898 | copyTV(L, L->top, val); |
898 | incr_top(L); | 899 | incr_top(L); |
@@ -1078,13 +1079,14 @@ LUA_API const char *lua_setupvalue(lua_State *L, int idx, int n) | |||
1078 | { | 1079 | { |
1079 | cTValue *f = index2adr(L, idx); | 1080 | cTValue *f = index2adr(L, idx); |
1080 | TValue *val; | 1081 | TValue *val; |
1082 | GCobj *o; | ||
1081 | const char *name; | 1083 | const char *name; |
1082 | api_checknelems(L, 1); | 1084 | api_checknelems(L, 1); |
1083 | name = lj_debug_uvnamev(f, (uint32_t)(n-1), &val); | 1085 | name = lj_debug_uvnamev(f, (uint32_t)(n-1), &val, &o); |
1084 | if (name) { | 1086 | if (name) { |
1085 | L->top--; | 1087 | L->top--; |
1086 | copyTV(L, val, L->top); | 1088 | copyTV(L, val, L->top); |
1087 | lj_gc_barrier(L, funcV(f), L->top); | 1089 | lj_gc_barrier(L, o, L->top); |
1088 | } | 1090 | } |
1089 | return name; | 1091 | return name; |
1090 | } | 1092 | } |
diff --git a/src/lj_debug.c b/src/lj_debug.c index 70f77c74..2f2ea9f0 100644 --- a/src/lj_debug.c +++ b/src/lj_debug.c | |||
@@ -221,19 +221,22 @@ const char *lj_debug_uvname(GCproto *pt, uint32_t idx) | |||
221 | } | 221 | } |
222 | 222 | ||
223 | /* Get name and value of upvalue. */ | 223 | /* Get name and value of upvalue. */ |
224 | const char *lj_debug_uvnamev(cTValue *o, uint32_t idx, TValue **tvp) | 224 | const char *lj_debug_uvnamev(cTValue *o, uint32_t idx, TValue **tvp, GCobj **op) |
225 | { | 225 | { |
226 | if (tvisfunc(o)) { | 226 | if (tvisfunc(o)) { |
227 | GCfunc *fn = funcV(o); | 227 | GCfunc *fn = funcV(o); |
228 | if (isluafunc(fn)) { | 228 | if (isluafunc(fn)) { |
229 | GCproto *pt = funcproto(fn); | 229 | GCproto *pt = funcproto(fn); |
230 | if (idx < pt->sizeuv) { | 230 | if (idx < pt->sizeuv) { |
231 | *tvp = uvval(&gcref(fn->l.uvptr[idx])->uv); | 231 | GCobj *uvo = gcref(fn->l.uvptr[idx]); |
232 | *tvp = uvval(&uvo->uv); | ||
233 | *op = uvo; | ||
232 | return lj_debug_uvname(pt, idx); | 234 | return lj_debug_uvname(pt, idx); |
233 | } | 235 | } |
234 | } else { | 236 | } else { |
235 | if (idx < fn->c.nupvalues) { | 237 | if (idx < fn->c.nupvalues) { |
236 | *tvp = &fn->c.upvalue[idx]; | 238 | *tvp = &fn->c.upvalue[idx]; |
239 | *op = obj2gco(fn); | ||
237 | return ""; | 240 | return ""; |
238 | } | 241 | } |
239 | } | 242 | } |
diff --git a/src/lj_debug.h b/src/lj_debug.h index cc7e93d2..a8be19e8 100644 --- a/src/lj_debug.h +++ b/src/lj_debug.h | |||
@@ -29,7 +29,8 @@ typedef struct lj_Debug { | |||
29 | LJ_FUNC cTValue *lj_debug_frame(lua_State *L, int level, int *size); | 29 | LJ_FUNC cTValue *lj_debug_frame(lua_State *L, int level, int *size); |
30 | LJ_FUNC BCLine LJ_FASTCALL lj_debug_line(GCproto *pt, BCPos pc); | 30 | LJ_FUNC BCLine LJ_FASTCALL lj_debug_line(GCproto *pt, BCPos pc); |
31 | LJ_FUNC const char *lj_debug_uvname(GCproto *pt, uint32_t idx); | 31 | LJ_FUNC const char *lj_debug_uvname(GCproto *pt, uint32_t idx); |
32 | LJ_FUNC const char *lj_debug_uvnamev(cTValue *o, uint32_t idx, TValue **tvp); | 32 | LJ_FUNC const char *lj_debug_uvnamev(cTValue *o, uint32_t idx, TValue **tvp, |
33 | GCobj **op); | ||
33 | LJ_FUNC const char *lj_debug_slotname(GCproto *pt, const BCIns *pc, | 34 | LJ_FUNC const char *lj_debug_slotname(GCproto *pt, const BCIns *pc, |
34 | BCReg slot, const char **name); | 35 | BCReg slot, const char **name); |
35 | LJ_FUNC const char *lj_debug_funcname(lua_State *L, cTValue *frame, | 36 | LJ_FUNC const char *lj_debug_funcname(lua_State *L, cTValue *frame, |