diff options
author | Mike Pall <mike> | 2015-01-03 15:04:38 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2015-01-03 15:04:38 +0100 |
commit | 054e6abe37450344e20b373ec326055071029e9b (patch) | |
tree | d3abbe61e643f4f59797d2aea24cc3a0643df53b /src/lj_state.c | |
parent | a13dfd66c3427f9cc94044f261a526042b0d02f5 (diff) | |
download | luajit-054e6abe37450344e20b373ec326055071029e9b.tar.gz luajit-054e6abe37450344e20b373ec326055071029e9b.tar.bz2 luajit-054e6abe37450344e20b373ec326055071029e9b.zip |
Add LJ_FR2 mode: Two-slot frame info.
Diffstat (limited to 'src/lj_state.c')
-rw-r--r-- | src/lj_state.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lj_state.c b/src/lj_state.c index 344f8fe1..f7cdb8f3 100644 --- a/src/lj_state.c +++ b/src/lj_state.c | |||
@@ -49,6 +49,7 @@ | |||
49 | ** one extra slot if mobj is not a function. Only lj_meta_tset needs 5 | 49 | ** one extra slot if mobj is not a function. Only lj_meta_tset needs 5 |
50 | ** slots above top, but then mobj is always a function. So we can get by | 50 | ** slots above top, but then mobj is always a function. So we can get by |
51 | ** with 5 extra slots. | 51 | ** with 5 extra slots. |
52 | ** LJ_FR2: We need 2 more slots for the frame PC and the continuation PC. | ||
52 | */ | 53 | */ |
53 | 54 | ||
54 | /* Resize stack slots and adjust pointers in state. */ | 55 | /* Resize stack slots and adjust pointers in state. */ |
@@ -128,8 +129,9 @@ static void stack_init(lua_State *L1, lua_State *L) | |||
128 | L1->stacksize = LJ_STACK_START + LJ_STACK_EXTRA; | 129 | L1->stacksize = LJ_STACK_START + LJ_STACK_EXTRA; |
129 | stend = st + L1->stacksize; | 130 | stend = st + L1->stacksize; |
130 | setmref(L1->maxstack, stend - LJ_STACK_EXTRA - 1); | 131 | setmref(L1->maxstack, stend - LJ_STACK_EXTRA - 1); |
131 | L1->base = L1->top = st+1; | 132 | setthreadV(L1, st++, L1); /* Needed for curr_funcisL() on empty stack. */ |
132 | setthreadV(L1, st, L1); /* Needed for curr_funcisL() on empty stack. */ | 133 | if (LJ_FR2) setnilV(st++); |
134 | L1->base = L1->top = st; | ||
133 | while (st < stend) /* Clear new slots. */ | 135 | while (st < stend) /* Clear new slots. */ |
134 | setnilV(st++); | 136 | setnilV(st++); |
135 | } | 137 | } |
@@ -253,7 +255,7 @@ LUA_API void lua_close(lua_State *L) | |||
253 | for (i = 0;;) { | 255 | for (i = 0;;) { |
254 | hook_enter(g); | 256 | hook_enter(g); |
255 | L->status = 0; | 257 | L->status = 0; |
256 | L->base = L->top = tvref(L->stack) + 1; | 258 | L->base = L->top = tvref(L->stack) + 1 + LJ_FR2; |
257 | L->cframe = NULL; | 259 | L->cframe = NULL; |
258 | if (lj_vm_cpcall(L, NULL, NULL, cpfinalize) == 0) { | 260 | if (lj_vm_cpcall(L, NULL, NULL, cpfinalize) == 0) { |
259 | if (++i >= 10) break; | 261 | if (++i >= 10) break; |