diff options
author | Mike Pall <mike> | 2014-12-15 02:27:27 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2014-12-15 02:27:27 +0100 |
commit | 881f48f9808a950f8e046a3b299db0269506a87d (patch) | |
tree | 43584223f3b77d77af5a3515b3191c21fd012f01 /src/lj_frame.h | |
parent | b93b624ad88a9455cb3f12db93a9c5e153ff8a62 (diff) | |
download | luajit-881f48f9808a950f8e046a3b299db0269506a87d.tar.gz luajit-881f48f9808a950f8e046a3b299db0269506a87d.tar.bz2 luajit-881f48f9808a950f8e046a3b299db0269506a87d.zip |
Cleanup of frame handling. No functional changes.
Diffstat (limited to 'src/lj_frame.h')
-rw-r--r-- | src/lj_frame.h | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/lj_frame.h b/src/lj_frame.h index fb533b0e..2540f4d4 100644 --- a/src/lj_frame.h +++ b/src/lj_frame.h | |||
@@ -22,8 +22,11 @@ enum { | |||
22 | 22 | ||
23 | /* Macros to access and modify Lua frames. */ | 23 | /* Macros to access and modify Lua frames. */ |
24 | #define frame_gc(f) (gcref((f)->fr.func)) | 24 | #define frame_gc(f) (gcref((f)->fr.func)) |
25 | #define frame_func(f) (&frame_gc(f)->fn) | 25 | #define frame_ftsz(f) ((ptrdiff_t)(f)->fr.tp.ftsz) |
26 | #define frame_ftsz(f) ((f)->fr.tp.ftsz) | 26 | #define frame_pc(f) (mref((f)->fr.tp.pcr, const BCIns)) |
27 | #define setframe_gc(f, p) (setgcref((f)->fr.func, (p))) | ||
28 | #define setframe_ftsz(f, sz) ((f)->fr.tp.ftsz = (int32_t)(sz)) | ||
29 | #define setframe_pc(f, pc) (setmref((f)->fr.tp.pcr, (pc))) | ||
27 | 30 | ||
28 | #define frame_type(f) (frame_ftsz(f) & FRAME_TYPE) | 31 | #define frame_type(f) (frame_ftsz(f) & FRAME_TYPE) |
29 | #define frame_typep(f) (frame_ftsz(f) & FRAME_TYPEP) | 32 | #define frame_typep(f) (frame_ftsz(f) & FRAME_TYPEP) |
@@ -33,8 +36,14 @@ enum { | |||
33 | #define frame_isvarg(f) (frame_typep(f) == FRAME_VARG) | 36 | #define frame_isvarg(f) (frame_typep(f) == FRAME_VARG) |
34 | #define frame_ispcall(f) ((frame_ftsz(f) & 6) == FRAME_PCALL) | 37 | #define frame_ispcall(f) ((frame_ftsz(f) & 6) == FRAME_PCALL) |
35 | 38 | ||
36 | #define frame_pc(f) (mref((f)->fr.tp.pcr, const BCIns)) | 39 | #define frame_func(f) (&frame_gc(f)->fn) |
40 | #define frame_delta(f) (frame_ftsz(f) >> 3) | ||
41 | #define frame_sized(f) (frame_ftsz(f) & ~FRAME_TYPEP) | ||
42 | |||
43 | enum { LJ_CONT_TAILCALL, LJ_CONT_FFI_CALLBACK }; /* Special continuations. */ | ||
44 | |||
37 | #define frame_contpc(f) (frame_pc((f)-1)) | 45 | #define frame_contpc(f) (frame_pc((f)-1)) |
46 | #define frame_contv(f) (((f)-1)->u32.lo) | ||
38 | #if LJ_64 | 47 | #if LJ_64 |
39 | #define frame_contf(f) \ | 48 | #define frame_contf(f) \ |
40 | ((ASMFunction)(void *)((intptr_t)lj_vm_asm_begin + \ | 49 | ((ASMFunction)(void *)((intptr_t)lj_vm_asm_begin + \ |
@@ -42,18 +51,14 @@ enum { | |||
42 | #else | 51 | #else |
43 | #define frame_contf(f) ((ASMFunction)gcrefp(((f)-1)->gcr, void)) | 52 | #define frame_contf(f) ((ASMFunction)gcrefp(((f)-1)->gcr, void)) |
44 | #endif | 53 | #endif |
45 | #define frame_delta(f) (frame_ftsz(f) >> 3) | 54 | #define frame_iscont_fficb(f) \ |
46 | #define frame_sized(f) (frame_ftsz(f) & ~FRAME_TYPEP) | 55 | (LJ_HASFFI && frame_contv(f) == LJ_CONT_FFI_CALLBACK) |
47 | 56 | ||
48 | #define frame_prevl(f) ((f) - (1+bc_a(frame_pc(f)[-1]))) | 57 | #define frame_prevl(f) ((f) - (1+bc_a(frame_pc(f)[-1]))) |
49 | #define frame_prevd(f) ((TValue *)((char *)(f) - frame_sized(f))) | 58 | #define frame_prevd(f) ((TValue *)((char *)(f) - frame_sized(f))) |
50 | #define frame_prev(f) (frame_islua(f)?frame_prevl(f):frame_prevd(f)) | 59 | #define frame_prev(f) (frame_islua(f)?frame_prevl(f):frame_prevd(f)) |
51 | /* Note: this macro does not skip over FRAME_VARG. */ | 60 | /* Note: this macro does not skip over FRAME_VARG. */ |
52 | 61 | ||
53 | #define setframe_pc(f, pc) (setmref((f)->fr.tp.pcr, (pc))) | ||
54 | #define setframe_ftsz(f, sz) ((f)->fr.tp.ftsz = (sz)) | ||
55 | #define setframe_gc(f, p) (setgcref((f)->fr.func, (p))) | ||
56 | |||
57 | /* -- C stack frame ------------------------------------------------------- */ | 62 | /* -- C stack frame ------------------------------------------------------- */ |
58 | 63 | ||
59 | /* Macros to access and modify the C stack frame chain. */ | 64 | /* Macros to access and modify the C stack frame chain. */ |