diff options
| author | Mike Pall <mike> | 2016-11-24 19:14:17 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2016-11-24 19:14:17 +0100 |
| commit | d7243e1de0cb86608956a9af107aff829ad99aeb (patch) | |
| tree | 02a391f062637d77214a71dd02d846e65738c7e4 | |
| parent | 81259898ea177bb7b4becebf3d7686603f6b373b (diff) | |
| download | luajit-d7243e1de0cb86608956a9af107aff829ad99aeb.tar.gz luajit-d7243e1de0cb86608956a9af107aff829ad99aeb.tar.bz2 luajit-d7243e1de0cb86608956a9af107aff829ad99aeb.zip | |
Eliminate use of lightuserdata derived from static data pointers.
Required for >47 bit VA, e.g. ARM64.
| -rw-r--r-- | src/lib_debug.c | 8 | ||||
| -rw-r--r-- | src/lib_package.c | 3 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/lib_debug.c b/src/lib_debug.c index cda7137e..6628d943 100644 --- a/src/lib_debug.c +++ b/src/lib_debug.c | |||
| @@ -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 ((void *)0x3004) |
| 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 | lua_pushlightuserdata(L, 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 | lua_pushlightuserdata(L, 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 | lua_pushlightuserdata(L, 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)); |
diff --git a/src/lib_package.c b/src/lib_package.c index 8c336b02..898897b1 100644 --- a/src/lib_package.c +++ b/src/lib_package.c | |||
| @@ -399,8 +399,7 @@ static int lj_cf_package_loader_preload(lua_State *L) | |||
| 399 | 399 | ||
| 400 | /* ------------------------------------------------------------------------ */ | 400 | /* ------------------------------------------------------------------------ */ |
| 401 | 401 | ||
| 402 | static const int sentinel_ = 0; | 402 | #define sentinel ((void *)0x4004) |
| 403 | #define sentinel ((void *)&sentinel_) | ||
| 404 | 403 | ||
| 405 | static int lj_cf_package_require(lua_State *L) | 404 | static int lj_cf_package_require(lua_State *L) |
| 406 | { | 405 | { |
