aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/luajit-2.0/src/lj_frame.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/luajit-2.0/src/lj_frame.h')
-rw-r--r--libraries/luajit-2.0/src/lj_frame.h160
1 files changed, 0 insertions, 160 deletions
diff --git a/libraries/luajit-2.0/src/lj_frame.h b/libraries/luajit-2.0/src/lj_frame.h
deleted file mode 100644
index a69917e..0000000
--- a/libraries/luajit-2.0/src/lj_frame.h
+++ /dev/null
@@ -1,160 +0,0 @@
1/*
2** Stack frames.
3** Copyright (C) 2005-2011 Mike Pall. See Copyright Notice in luajit.h
4*/
5
6#ifndef _LJ_FRAME_H
7#define _LJ_FRAME_H
8
9#include "lj_obj.h"
10#include "lj_bc.h"
11
12/* -- Lua stack frame ----------------------------------------------------- */
13
14/* Frame type markers in callee function slot (callee base-1). */
15enum {
16 FRAME_LUA, FRAME_C, FRAME_CONT, FRAME_VARG,
17 FRAME_LUAP, FRAME_CP, FRAME_PCALL, FRAME_PCALLH
18};
19#define FRAME_TYPE 3
20#define FRAME_P 4
21#define FRAME_TYPEP (FRAME_TYPE|FRAME_P)
22
23/* Macros to access and modify Lua frames. */
24#define frame_gc(f) (gcref((f)->fr.func))
25#define frame_func(f) (&frame_gc(f)->fn)
26#define frame_ftsz(f) ((f)->fr.tp.ftsz)
27
28#define frame_type(f) (frame_ftsz(f) & FRAME_TYPE)
29#define frame_typep(f) (frame_ftsz(f) & FRAME_TYPEP)
30#define frame_islua(f) (frame_type(f) == FRAME_LUA)
31#define frame_isc(f) (frame_type(f) == FRAME_C)
32#define frame_iscont(f) (frame_typep(f) == FRAME_CONT)
33#define frame_isvarg(f) (frame_typep(f) == FRAME_VARG)
34#define frame_ispcall(f) ((frame_ftsz(f) & 6) == FRAME_PCALL)
35
36#define frame_pc(f) (mref((f)->fr.tp.pcr, const BCIns))
37#define frame_contpc(f) (frame_pc((f)-1))
38#if LJ_64
39#define frame_contf(f) \
40 ((ASMFunction)(void *)((intptr_t)lj_vm_asm_begin + \
41 (intptr_t)(int32_t)((f)-1)->u32.lo))
42#else
43#define frame_contf(f) ((ASMFunction)gcrefp(((f)-1)->gcr, void))
44#endif
45#define frame_delta(f) (frame_ftsz(f) >> 3)
46#define frame_sized(f) (frame_ftsz(f) & ~FRAME_TYPEP)
47
48#define frame_prevl(f) ((f) - (1+bc_a(frame_pc(f)[-1])))
49#define frame_prevd(f) ((TValue *)((char *)(f) - frame_sized(f)))
50#define frame_prev(f) (frame_islua(f)?frame_prevl(f):frame_prevd(f))
51/* Note: this macro does not skip over FRAME_VARG. */
52
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 ------------------------------------------------------- */
58
59/* Macros to access and modify the C stack frame chain. */
60
61/* These definitions must match with the arch-specific *.dasc files. */
62#if LJ_TARGET_X86
63#define CFRAME_OFS_ERRF (15*4)
64#define CFRAME_OFS_NRES (14*4)
65#define CFRAME_OFS_PREV (13*4)
66#define CFRAME_OFS_L (12*4)
67#define CFRAME_OFS_PC (6*4)
68#define CFRAME_OFS_MULTRES (5*4)
69#define CFRAME_SIZE (12*4)
70#define CFRAME_SHIFT_MULTRES 0
71#elif LJ_TARGET_X64
72#if LJ_ABI_WIN
73#define CFRAME_OFS_PREV (13*8)
74#define CFRAME_OFS_PC (25*4)
75#define CFRAME_OFS_L (24*4)
76#define CFRAME_OFS_ERRF (23*4)
77#define CFRAME_OFS_NRES (22*4)
78#define CFRAME_OFS_MULTRES (21*4)
79#define CFRAME_SIZE (10*8)
80#define CFRAME_SIZE_JIT (CFRAME_SIZE + 9*16 + 4*8)
81#define CFRAME_SHIFT_MULTRES 0
82#else
83#define CFRAME_OFS_PREV (4*8)
84#define CFRAME_OFS_PC (7*4)
85#define CFRAME_OFS_L (6*4)
86#define CFRAME_OFS_ERRF (5*4)
87#define CFRAME_OFS_NRES (4*4)
88#define CFRAME_OFS_MULTRES (1*4)
89#define CFRAME_SIZE (10*8)
90#define CFRAME_SIZE_JIT (CFRAME_SIZE + 16)
91#define CFRAME_SHIFT_MULTRES 0
92#endif
93#elif LJ_TARGET_ARM
94#define CFRAME_OFS_ERRF 24
95#define CFRAME_OFS_NRES 20
96#define CFRAME_OFS_PREV 16
97#define CFRAME_OFS_L 12
98#define CFRAME_OFS_PC 8
99#define CFRAME_OFS_MULTRES 4
100#define CFRAME_SIZE 64
101#define CFRAME_SHIFT_MULTRES 3
102#elif LJ_TARGET_PPC
103#define CFRAME_OFS_ERRF 48
104#define CFRAME_OFS_NRES 44
105#define CFRAME_OFS_PREV 40
106#define CFRAME_OFS_L 36
107#define CFRAME_OFS_PC 32
108#define CFRAME_OFS_MULTRES 28
109#define CFRAME_SIZE 272
110#define CFRAME_SHIFT_MULTRES 3
111#elif LJ_TARGET_PPCSPE
112#define CFRAME_OFS_ERRF 28
113#define CFRAME_OFS_NRES 24
114#define CFRAME_OFS_PREV 20
115#define CFRAME_OFS_L 16
116#define CFRAME_OFS_PC 12
117#define CFRAME_OFS_MULTRES 8
118#define CFRAME_SIZE 184
119#define CFRAME_SHIFT_MULTRES 3
120#elif LJ_TARGET_MIPS
121/* NYI: Dummy definitions for now. */
122#define CFRAME_OFS_ERRF 0
123#define CFRAME_OFS_NRES 0
124#define CFRAME_OFS_PREV 0
125#define CFRAME_OFS_L 0
126#define CFRAME_OFS_PC 0
127#define CFRAME_OFS_MULTRES 0
128#define CFRAME_SIZE 256
129#define CFRAME_SHIFT_MULTRES 3
130#else
131#error "Missing CFRAME_* definitions for this architecture"
132#endif
133
134#ifndef CFRAME_SIZE_JIT
135#define CFRAME_SIZE_JIT CFRAME_SIZE
136#endif
137
138#define CFRAME_RESUME 1
139#define CFRAME_UNWIND_FF 2 /* Only used in unwinder. */
140#define CFRAME_RAWMASK (~(intptr_t)(CFRAME_RESUME|CFRAME_UNWIND_FF))
141
142#define cframe_errfunc(cf) (*(int32_t *)(((char *)(cf))+CFRAME_OFS_ERRF))
143#define cframe_nres(cf) (*(int32_t *)(((char *)(cf))+CFRAME_OFS_NRES))
144#define cframe_prev(cf) (*(void **)(((char *)(cf))+CFRAME_OFS_PREV))
145#define cframe_multres(cf) (*(uint32_t *)(((char *)(cf))+CFRAME_OFS_MULTRES))
146#define cframe_multres_n(cf) (cframe_multres((cf)) >> CFRAME_SHIFT_MULTRES)
147#define cframe_L(cf) \
148 (&gcref(*(GCRef *)(((char *)(cf))+CFRAME_OFS_L))->th)
149#define cframe_pc(cf) \
150 (mref(*(MRef *)(((char *)(cf))+CFRAME_OFS_PC), const BCIns))
151#define setcframe_L(cf, L) \
152 (setmref(*(MRef *)(((char *)(cf))+CFRAME_OFS_L), (L)))
153#define setcframe_pc(cf, pc) \
154 (setmref(*(MRef *)(((char *)(cf))+CFRAME_OFS_PC), (pc)))
155#define cframe_canyield(cf) ((intptr_t)(cf) & CFRAME_RESUME)
156#define cframe_unwind_ff(cf) ((intptr_t)(cf) & CFRAME_UNWIND_FF)
157#define cframe_raw(cf) ((void *)((intptr_t)(cf) & CFRAME_RAWMASK))
158#define cframe_Lpc(L) cframe_pc(cframe_raw(L->cframe))
159
160#endif