quickjs/gen/function_source.c
Ben Noordhuis c7ca3febd3
Don't serialize IC opcodes (#334)
Translate IC opcodes to their non-IC variants before writing them out.
Before this commit they were not byte-swapped properly, breaking the
ability to load serialized bytecode containing ICs on systems with
different endianness. Inline caches are recomputed as needed now.

A pleasing side effect of this change is that serialized bytecode is,
on average, a little smaller because fewer atoms are duplicated now.
2024-03-27 12:07:11 +01:00

82 lines
3.1 KiB
C

/* File generated automatically by the QuickJS-ng compiler. */
#include "quickjs-libc.h"
const uint32_t qjsc_function_source_size = 384;
const uint8_t qjsc_function_source[384] = {
0x09, 0x06, 0x0c, 0x61, 0x63, 0x74, 0x75, 0x61,
0x6c, 0x02, 0x66, 0x0c, 0x65, 0x78, 0x70, 0x65,
0x63, 0x74, 0x14, 0x75, 0x73, 0x65, 0x20, 0x73,
0x74, 0x72, 0x69, 0x63, 0x74, 0x34, 0x66, 0x75,
0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66,
0x28, 0x29, 0x20, 0x7b, 0x20, 0x72, 0x65, 0x74,
0x75, 0x72, 0x6e, 0x20, 0x34, 0x32, 0x20, 0x7d,
0x30, 0x74, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x66,
0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x6a,
0x73, 0x0c, 0x00, 0x02, 0x01, 0x9e, 0x01, 0x00,
0x06, 0x00, 0x03, 0x00, 0x01, 0xa0, 0x01, 0x06,
0xa0, 0x01, 0x00, 0x00, 0x00, 0xac, 0x03, 0x02,
0x00, 0x30, 0xae, 0x03, 0x04, 0x00, 0x70, 0xac,
0x03, 0x04, 0x03, 0x70, 0x10, 0x00, 0x01, 0x00,
0xe0, 0x01, 0x00, 0x01, 0x00, 0x0c, 0x03, 0xc1,
0x05, 0x08, 0xc1, 0x04, 0x3f, 0xd8, 0x00, 0x00,
0x00, 0x80, 0x3f, 0xd7, 0x00, 0x00, 0x00, 0x40,
0x3e, 0xd8, 0x00, 0x00, 0x00, 0x80, 0xbe, 0x00,
0x40, 0xd7, 0x00, 0x00, 0x00, 0x00, 0x04, 0xd9,
0x00, 0x00, 0x00, 0xc8, 0x04, 0xda, 0x00, 0x00,
0x00, 0x3a, 0xd8, 0x00, 0x00, 0x00, 0x61, 0x01,
0x00, 0x38, 0xd7, 0x00, 0x00, 0x00, 0x42, 0x36,
0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0xc9, 0x06,
0xc8, 0x62, 0x01, 0x00, 0x38, 0xd8, 0x00, 0x00,
0x00, 0xaf, 0xe9, 0x0b, 0x38, 0x8f, 0x00, 0x00,
0x00, 0x62, 0x01, 0x00, 0xee, 0x2f, 0x61, 0x03,
0x00, 0x61, 0x02, 0x00, 0x38, 0x39, 0x00, 0x00,
0x00, 0x38, 0xd8, 0x00, 0x00, 0x00, 0x04, 0xd7,
0x00, 0x00, 0x00, 0x9d, 0x31, 0x01, 0x00, 0x04,
0x00, 0xca, 0x62, 0x02, 0x00, 0x42, 0x36, 0x00,
0x00, 0x00, 0x24, 0x00, 0x00, 0xcb, 0x06, 0xc8,
0x62, 0x03, 0x00, 0x38, 0xd8, 0x00, 0x00, 0x00,
0xaf, 0xe9, 0x0b, 0x38, 0x8f, 0x00, 0x00, 0x00,
0x62, 0x03, 0x00, 0xee, 0x2f, 0x68, 0x03, 0x00,
0x68, 0x02, 0x00, 0xc4, 0x28, 0xb6, 0x03, 0x01,
0x01, 0x28, 0x60, 0x01, 0x49, 0x02, 0x21, 0x1a,
0x1b, 0x04, 0x1e, 0x1d, 0x12, 0x26, 0x49, 0x1d,
0x0c, 0x06, 0x11, 0x18, 0x2a, 0x1c, 0x37, 0x41,
0x21, 0x1c, 0x34, 0x18, 0x1b, 0x04, 0x26, 0x11,
0x3f, 0x1d, 0x0c, 0x06, 0x11, 0x18, 0x2a, 0x1c,
0x53, 0x41, 0x00, 0x0c, 0x43, 0x02, 0x01, 0xae,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03,
0x00, 0xbb, 0x2a, 0x28, 0xb6, 0x03, 0x03, 0x01,
0x04, 0x02, 0x1e, 0x0c, 0x0e, 0x1a, 0x66, 0x75,
0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66,
0x28, 0x29, 0x20, 0x7b, 0x20, 0x72, 0x65, 0x74,
0x75, 0x72, 0x6e, 0x20, 0x34, 0x32, 0x20, 0x7d,
};
static JSContext *JS_NewCustomContext(JSRuntime *rt)
{
JSContext *ctx = JS_NewContext(rt);
if (!ctx)
return NULL;
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_function_source, qjsc_function_source_size, 0);
js_std_loop(ctx);
JS_FreeContext(ctx);
js_std_free_handlers(rt);
JS_FreeRuntime(rt);
return 0;
}