bytecode serialization

This commit is contained in:
2026-02-09 22:19:41 -06:00
parent 7069475729
commit 407797881c
3 changed files with 365 additions and 0 deletions

View File

@@ -1092,6 +1092,12 @@ MachCode *JS_CompileMach(const char *ast_json);
/* Free a compiled MachCode tree. */
void JS_FreeMachCode(MachCode *mc);
/* Serialize MachCode to binary. Returns sys_malloc'd buffer; caller frees. */
uint8_t *JS_SerializeMachCode(MachCode *mc, size_t *out_size);
/* Deserialize binary back to MachCode. Returns NULL on error. */
MachCode *JS_DeserializeMachCode(const uint8_t *data, size_t size);
/* Load compiled MachCode into a JSContext, materializing JSValues. */
struct JSCodeRegister *JS_LoadMachCode(JSContext *ctx, MachCode *mc, JSValue env);