Created
January 23, 2014 00:39
-
-
Save agentzh/8570578 to your computer and use it in GitHub Desktop.
Disable the stack shrink in LuaJIT 2.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/lj_state.c b/src/lj_state.c | |
| index c7593f5..8c0ff33 100644 | |
| --- a/src/lj_state.c | |
| +++ b/src/lj_state.c | |
| @@ -8,7 +8,7 @@ | |
| #define lj_state_c | |
| #define LUA_CORE | |
| - | |
| +#include <stdio.h> | |
| #include "lj_obj.h" | |
| #include "lj_gc.h" | |
| #include "lj_err.h" | |
| @@ -59,6 +59,8 @@ static void resizestack(lua_State *L, MSize n) | |
| MSize oldsize = L->stacksize; | |
| MSize realsize = n + 1 + LJ_STACK_EXTRA; | |
| GCobj *up; | |
| + | |
| + fprintf(stderr, "STACK %p %u %u\n", L, oldsize, realsize); | |
| lua_assert((MSize)(tvref(L->maxstack)-oldst)==L->stacksize-LJ_STACK_EXTRA-1); | |
| st = (TValue *)lj_mem_realloc(L, tvref(L->stack), | |
| (MSize)(oldsize*sizeof(TValue)), | |
| @@ -89,6 +91,8 @@ void lj_state_shrinkstack(lua_State *L, MSize used) | |
| { | |
| if (L->stacksize > LJ_STACK_MAXEX) | |
| return; /* Avoid stack shrinking while handling stack overflow. */ | |
| + fprintf(stderr, "jit_base=%p L=%p cur_L=%p\n", tvref(G(L)->jit_base), | |
| + L, gcref(G(L)->cur_L)); | |
| if (4*used < L->stacksize && | |
| 2*(LJ_STACK_START+LJ_STACK_EXTRA) < L->stacksize && | |
| /* Don't shrink stack of live trace. */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment