native function type
This commit is contained in:
@@ -1322,6 +1322,7 @@ typedef enum {
|
||||
JS_FUNC_KIND_BYTECODE,
|
||||
JS_FUNC_KIND_C_DATA,
|
||||
JS_FUNC_KIND_REGISTER, /* register-based VM function */
|
||||
JS_FUNC_KIND_NATIVE, /* QBE-compiled native function */
|
||||
} JSFunctionKind;
|
||||
|
||||
typedef struct JSFunction {
|
||||
@@ -1340,6 +1341,12 @@ typedef struct JSFunction {
|
||||
JSValue env_record; /* stone record, module environment */
|
||||
JSValue outer_frame; /* JSFrame JSValue, for closures */
|
||||
} reg;
|
||||
struct {
|
||||
void *fn_ptr; /* compiled cell_fn_N pointer */
|
||||
void *dl_handle; /* dylib handle for dlsym lookups */
|
||||
uint16_t nr_slots; /* frame size for this function */
|
||||
JSValue outer_frame; /* GC-traced, for closures */
|
||||
} native;
|
||||
} u;
|
||||
} JSFunction;
|
||||
|
||||
@@ -1362,6 +1369,7 @@ typedef struct JSFunction {
|
||||
JSValue js_call_c_function (JSContext *ctx, JSValue func_obj, JSValue this_obj, int argc, JSValue *argv);
|
||||
JSValue JS_CallInternal (JSContext *ctx, JSValue func_obj, JSValue this_obj, int argc, JSValue *argv, int flags);
|
||||
JSValue JS_CallRegisterVM(JSContext *ctx, JSCodeRegister *code, JSValue this_obj, int argc, JSValue *argv, JSValue env, JSValue outer_frame);
|
||||
JSValue cell_native_dispatch(JSContext *ctx, JSValue func_obj, JSValue this_obj, int argc, JSValue *argv);
|
||||
int JS_DeleteProperty (JSContext *ctx, JSValue obj, JSValue prop);
|
||||
JSValue __attribute__ ((format (printf, 2, 3)))
|
||||
JS_ThrowInternalError (JSContext *ctx, const char *fmt, ...);
|
||||
@@ -1652,6 +1660,7 @@ JSValue js_key_from_string (JSContext *ctx, JSValue val);
|
||||
|
||||
/* mach.c exports */
|
||||
JSValue JS_CallRegisterVM(JSContext *ctx, JSCodeRegister *code, JSValue this_obj, int argc, JSValue *argv, JSValue env, JSValue outer_frame);
|
||||
JSValue js_new_native_function(JSContext *ctx, void *fn_ptr, void *dl_handle, uint16_t nr_slots, int arity, JSValue outer_frame);
|
||||
JSFrameRegister *alloc_frame_register(JSContext *ctx, int slot_count);
|
||||
int reg_vm_check_interrupt(JSContext *ctx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user