11#include "mjs_internal.h"
13#if defined(__cplusplus)
17#define JUMP_INSTRUCTION_SIZE 2
19enum mjs_call_stack_frame_item {
20 CALL_STACK_FRAME_ITEM_RETVAL_STACK_IDX,
21 CALL_STACK_FRAME_ITEM_LOOP_ADDR_IDX,
22 CALL_STACK_FRAME_ITEM_SCOPE_IDX,
23 CALL_STACK_FRAME_ITEM_RETURN_ADDR,
24 CALL_STACK_FRAME_ITEM_THIS,
26 CALL_STACK_FRAME_ITEMS_CNT
32 mjs_val_t dataview_proto;
38 mjs_val_t last_getprop_obj;
57 mjs_err_t exec_res : 4;
64 struct mbuf bcode_gen;
65 struct mbuf bcode_parts;
68 struct mbuf call_stack;
69 struct mbuf arg_stack;
71 struct mbuf loop_addresses;
72 struct mbuf owned_strings;
73 struct mbuf foreign_strings;
74 struct mbuf owned_values;
75 struct mbuf json_visited_stack;
76 struct mbuf array_buffers;
81 mjs_ffi_resolver_t* dlsym;
84 size_t cur_bcode_offset;
85 mjs_flags_poller_t exec_flags_poller;
92 unsigned inhibit_gc : 1;
94 unsigned generate_jsc : 1;
100typedef uint32_t mjs_header_item_t;
101enum mjs_header_items {
102 MJS_HDR_ITEM_TOTAL_SIZE,
104 MJS_HDR_ITEM_BCODE_OFFSET,
106 MJS_HDR_ITEM_MAP_OFFSET,
112MJS_PRIVATE
size_t mjs_get_func_addr(mjs_val_t v);
114MJS_PRIVATE
int mjs_getretvalpos(
struct mjs*
mjs);
116MJS_PRIVATE
enum mjs_type mjs_get_type(mjs_val_t v);
122MJS_PRIVATE
void mjs_gen_stack_trace(
struct mjs*
mjs,
size_t offset);
124MJS_PRIVATE mjs_val_t vtop(
struct mbuf* m);
125MJS_PRIVATE
size_t mjs_stack_size(
const struct mbuf* m);
126MJS_PRIVATE mjs_val_t* vptr(
struct mbuf* m,
int idx);
127MJS_PRIVATE
void push_mjs_val(
struct mbuf* m, mjs_val_t v);
128MJS_PRIVATE mjs_val_t mjs_pop_val(
struct mbuf* m);
129MJS_PRIVATE mjs_val_t mjs_pop(
struct mjs*
mjs);
130MJS_PRIVATE
void mjs_push(
struct mjs*
mjs, mjs_val_t v);
131MJS_PRIVATE
void mjs_die(
struct mjs*
mjs);
133#if defined(__cplusplus)