summaryrefslogtreecommitdiff
path: root/src/lj_vm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_vm.h')
-rw-r--r--src/lj_vm.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/lj_vm.h b/src/lj_vm.h
new file mode 100644
index 00000000..f50614bb
--- /dev/null
+++ b/src/lj_vm.h
@@ -0,0 +1,66 @@
1/*
2** Assembler VM interface definitions.
3** Copyright (C) 2005-2009 Mike Pall. See Copyright Notice in luajit.h
4*/
5
6#ifndef _LJ_VM_H
7#define _LJ_VM_H
8
9#include "lj_obj.h"
10
11/* Entry points for ASM parts of VM. */
12LJ_ASMF void lj_vm_call(lua_State *L, TValue *base, int nres1);
13LJ_ASMF int lj_vm_pcall(lua_State *L, TValue *base, int nres1, ptrdiff_t ef);
14typedef TValue *(*lua_CPFunction)(lua_State *L, lua_CFunction func, void *ud);
15LJ_ASMF int lj_vm_cpcall(lua_State *L, lua_CPFunction cp, lua_CFunction func,
16 void *ud);
17LJ_ASMF int lj_vm_resume(lua_State *L, TValue *base, int nres1, ptrdiff_t ef);
18LJ_ASMF_NORET void lj_vm_unwind_c(void *cframe, int errcode);
19LJ_ASMF_NORET void lj_vm_unwind_ff(void *cframe);
20
21/* Miscellaneous functions. */
22#if LJ_TARGET_X86ORX64
23LJ_ASMF int lj_vm_cpuid(uint32_t f, uint32_t res[4]);
24#endif
25LJ_ASMF double lj_vm_foldarith(double x, double y, int op);
26LJ_ASMF double lj_vm_foldfpm(double x, int op);
27
28/* Dispatch targets for recording and hooks. */
29LJ_ASMF void lj_vm_record(void);
30LJ_ASMF void lj_vm_hook(void);
31
32/* Trace exit handling. */
33LJ_ASMF void lj_vm_exit_handler(void);
34LJ_ASMF void lj_vm_exit_interp(void);
35
36/* Handlers callable from compiled code. */
37LJ_ASMF void lj_vm_floor(void);
38LJ_ASMF void lj_vm_ceil(void);
39LJ_ASMF void lj_vm_trunc(void);
40LJ_ASMF void lj_vm_exp(void);
41LJ_ASMF void lj_vm_exp2(void);
42LJ_ASMF void lj_vm_pow(void);
43LJ_ASMF void lj_vm_powi(void);
44
45/* Call gates for functions. */
46LJ_ASMF void lj_gate_lf(void);
47LJ_ASMF void lj_gate_lv(void);
48LJ_ASMF void lj_gate_c(void);
49
50/* Continuations for metamethods. */
51LJ_ASMF void lj_cont_cat(void); /* Continue with concatenation. */
52LJ_ASMF void lj_cont_ra(void); /* Store result in RA from instruction. */
53LJ_ASMF void lj_cont_nop(void); /* Do nothing, just continue execution. */
54LJ_ASMF void lj_cont_condt(void); /* Branch if result is true. */
55LJ_ASMF void lj_cont_condf(void); /* Branch if result is false. */
56
57/* Start of the ASM code. */
58LJ_ASMF void lj_vm_asm_begin(void);
59
60/* Opcode handler offsets, relative to lj_vm_asm_begin. */
61LJ_ASMF const uint16_t lj_vm_op_ofs[];
62
63#define makeasmfunc(ofs) \
64 ((ASMFunction)((char *)lj_vm_asm_begin + (ofs)))
65
66#endif