5797f2a716
- improve `JS_DumpString`: use `L` prefix for wide strings - dump variable kind and flags for locals and closures - disassemble byte code in DUMP_READ_OBJECT - pass start_pos to `dump_byte_code` and `dump_single_byte_code` - write constant pool before function bytecode (bump version to 11) - update generated code
59 lines
1.9 KiB
C
59 lines
1.9 KiB
C
/* File generated automatically by the QuickJS-ng compiler. */
|
|
|
|
#include "quickjs-libc.h"
|
|
|
|
const uint32_t qjsc_test_fib_size = 166;
|
|
|
|
const uint8_t qjsc_test_fib[166] = {
|
|
0x0b, 0x07, 0x28, 0x65, 0x78, 0x61, 0x6d, 0x70,
|
|
0x6c, 0x65, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74,
|
|
0x5f, 0x66, 0x69, 0x62, 0x2e, 0x6a, 0x73, 0x10,
|
|
0x2e, 0x2f, 0x66, 0x69, 0x62, 0x2e, 0x73, 0x6f,
|
|
0x06, 0x66, 0x69, 0x62, 0x0e, 0x63, 0x6f, 0x6e,
|
|
0x73, 0x6f, 0x6c, 0x65, 0x06, 0x6c, 0x6f, 0x67,
|
|
0x16, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57,
|
|
0x6f, 0x72, 0x6c, 0x64, 0x10, 0x66, 0x69, 0x62,
|
|
0x28, 0x31, 0x30, 0x29, 0x3d, 0x0d, 0xb2, 0x03,
|
|
0x01, 0xb4, 0x03, 0x00, 0x00, 0x01, 0x00, 0xb6,
|
|
0x03, 0x00, 0x0c, 0x20, 0x02, 0x01, 0x9e, 0x01,
|
|
0x00, 0x00, 0x00, 0x05, 0x01, 0x00, 0x32, 0x00,
|
|
0xb6, 0x03, 0x00, 0x0c, 0x08, 0xe9, 0x02, 0x29,
|
|
0x38, 0xdc, 0x00, 0x00, 0x00, 0x42, 0xdd, 0x00,
|
|
0x00, 0x00, 0x04, 0xde, 0x00, 0x00, 0x00, 0x24,
|
|
0x01, 0x00, 0x0e, 0x38, 0xdc, 0x00, 0x00, 0x00,
|
|
0x42, 0xdd, 0x00, 0x00, 0x00, 0x04, 0xdf, 0x00,
|
|
0x00, 0x00, 0x65, 0x00, 0x00, 0xbb, 0x0a, 0xee,
|
|
0x24, 0x02, 0x00, 0x0e, 0x06, 0x2e, 0xb2, 0x03,
|
|
0x01, 0x01, 0x0a, 0x01, 0x01, 0x00, 0x04, 0x0a,
|
|
0x02, 0x62, 0x00, 0x4d, 0x30, 0x00,
|
|
};
|
|
|
|
static JSContext *JS_NewCustomContext(JSRuntime *rt)
|
|
{
|
|
JSContext *ctx = JS_NewContext(rt);
|
|
if (!ctx)
|
|
return NULL;
|
|
{
|
|
extern JSModuleDef *js_init_module_fib(JSContext *ctx, const char *name);
|
|
js_init_module_fib(ctx, "examples/fib.so");
|
|
}
|
|
return ctx;
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
JSRuntime *rt;
|
|
JSContext *ctx;
|
|
rt = JS_NewRuntime();
|
|
js_std_set_worker_new_context_func(JS_NewCustomContext);
|
|
js_std_init_handlers(rt);
|
|
JS_SetModuleLoaderFunc(rt, NULL, js_module_loader, NULL);
|
|
ctx = JS_NewCustomContext(rt);
|
|
js_std_add_helpers(ctx, argc, argv);
|
|
js_std_eval_binary(ctx, qjsc_test_fib, qjsc_test_fib_size, 0);
|
|
js_std_loop(ctx);
|
|
JS_FreeContext(ctx);
|
|
js_std_free_handlers(rt);
|
|
JS_FreeRuntime(rt);
|
|
return 0;
|
|
}
|