diff options
Diffstat (limited to 'src/lib_debug.c')
-rw-r--r-- | src/lib_debug.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib_debug.c b/src/lib_debug.c index e7d8d24a..3af7a353 100644 --- a/src/lib_debug.c +++ b/src/lib_debug.c | |||
@@ -29,7 +29,7 @@ LJLIB_CF(debug_getregistry) | |||
29 | return 1; | 29 | return 1; |
30 | } | 30 | } |
31 | 31 | ||
32 | LJLIB_CF(debug_getmetatable) | 32 | LJLIB_CF(debug_getmetatable) LJLIB_REC(.) |
33 | { | 33 | { |
34 | lj_lib_checkany(L, 1); | 34 | lj_lib_checkany(L, 1); |
35 | if (!lua_getmetatable(L, 1)) { | 35 | if (!lua_getmetatable(L, 1)) { |
@@ -231,8 +231,8 @@ LJLIB_CF(debug_upvalueid) | |||
231 | int32_t n = lj_lib_checkint(L, 2) - 1; | 231 | int32_t n = lj_lib_checkint(L, 2) - 1; |
232 | if ((uint32_t)n >= fn->l.nupvalues) | 232 | if ((uint32_t)n >= fn->l.nupvalues) |
233 | lj_err_arg(L, 2, LJ_ERR_IDXRNG); | 233 | lj_err_arg(L, 2, LJ_ERR_IDXRNG); |
234 | setlightudV(L->top-1, isluafunc(fn) ? (void *)gcref(fn->l.uvptr[n]) : | 234 | lua_pushlightuserdata(L, isluafunc(fn) ? (void *)gcref(fn->l.uvptr[n]) : |
235 | (void *)&fn->c.upvalue[n]); | 235 | (void *)&fn->c.upvalue[n]); |
236 | return 1; | 236 | return 1; |
237 | } | 237 | } |
238 | 238 | ||
@@ -283,13 +283,13 @@ LJLIB_CF(debug_setuservalue) | |||
283 | 283 | ||
284 | /* ------------------------------------------------------------------------ */ | 284 | /* ------------------------------------------------------------------------ */ |
285 | 285 | ||
286 | static const char KEY_HOOK = 'h'; | 286 | #define KEY_HOOK (U64x(80000000,00000000)|'h') |
287 | 287 | ||
288 | static void hookf(lua_State *L, lua_Debug *ar) | 288 | static void hookf(lua_State *L, lua_Debug *ar) |
289 | { | 289 | { |
290 | static const char *const hooknames[] = | 290 | static const char *const hooknames[] = |
291 | {"call", "return", "line", "count", "tail return"}; | 291 | {"call", "return", "line", "count", "tail return"}; |
292 | lua_pushlightuserdata(L, (void *)&KEY_HOOK); | 292 | (L->top++)->u64 = KEY_HOOK; |
293 | lua_rawget(L, LUA_REGISTRYINDEX); | 293 | lua_rawget(L, LUA_REGISTRYINDEX); |
294 | if (lua_isfunction(L, -1)) { | 294 | if (lua_isfunction(L, -1)) { |
295 | lua_pushstring(L, hooknames[(int)ar->event]); | 295 | lua_pushstring(L, hooknames[(int)ar->event]); |
@@ -334,7 +334,7 @@ LJLIB_CF(debug_sethook) | |||
334 | count = luaL_optint(L, arg+3, 0); | 334 | count = luaL_optint(L, arg+3, 0); |
335 | func = hookf; mask = makemask(smask, count); | 335 | func = hookf; mask = makemask(smask, count); |
336 | } | 336 | } |
337 | lua_pushlightuserdata(L, (void *)&KEY_HOOK); | 337 | (L->top++)->u64 = KEY_HOOK; |
338 | lua_pushvalue(L, arg+1); | 338 | lua_pushvalue(L, arg+1); |
339 | lua_rawset(L, LUA_REGISTRYINDEX); | 339 | lua_rawset(L, LUA_REGISTRYINDEX); |
340 | lua_sethook(L, func, mask, count); | 340 | lua_sethook(L, func, mask, count); |
@@ -349,7 +349,7 @@ LJLIB_CF(debug_gethook) | |||
349 | if (hook != NULL && hook != hookf) { /* external hook? */ | 349 | if (hook != NULL && hook != hookf) { /* external hook? */ |
350 | lua_pushliteral(L, "external hook"); | 350 | lua_pushliteral(L, "external hook"); |
351 | } else { | 351 | } else { |
352 | lua_pushlightuserdata(L, (void *)&KEY_HOOK); | 352 | (L->top++)->u64 = KEY_HOOK; |
353 | lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */ | 353 | lua_rawget(L, LUA_REGISTRYINDEX); /* get hook */ |
354 | } | 354 | } |
355 | lua_pushstring(L, unmakemask(mask, buff)); | 355 | lua_pushstring(L, unmakemask(mask, buff)); |