jseption 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"bytecode.js","sourceRoot":"","sources":["../src/bytecode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAU,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC1H,OAAO,EAAsB,kBAAkB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,WAAW,EAClG,sBAAsB,EAAE,4BAA4B,EAAE,cAAc,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACxH,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAkB,QAAQ,EAAa,MAAM,aAAa,CAAC;AACpG,OAAO,EAAa,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,oFAAoF;AACpF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAI,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,YAAY;AAC9D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC;AAE3B,MAAM,cAAc,GAAG,CAAC,IAAI,CAAC,CAAC;AAe9B,8BAA8B;AAC9B,MAAM,eAAe,GAAG,CAAC,IAAI,CAAC,CAAC;AAC/B,MAAM,eAAe,GAAG,CAAC,IAAI,CAAC,CAAC;AAC/B,MAAM,cAAc,GAAG,CAAC,IAAI,CAAC,CAAC;AAC9B,MAAM,aAAa,GAAG,CAAC,IAAI,CAAC,CAAC;AAC7B,MAAM,YAAY,GAAG,CAAC,IAAI,CAAC,CAAC;AA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,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,WAAW;YAAE,OAAO,mBAAmB,CAAC,GAAG,EAAE,iBAAiB,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;QAC7F,IAAI,CAAC,YAAY,UAAU;YAAE,OAAO,mBAAmB,CAAC,GAAG,EAAE,iBAAiB,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;QAC5F,MAAM,CAAC,CAAC;IACV,CAAC;IACD,IAAI,CAAC,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,mBAAmB,CAAC,GAAG,EAAE,wDAAwD,CAAC,CAAC;IAC1H,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["/*\n * Bytecode serialization: JS_WriteObject / JS_ReadObject.\n *\n * Writes the function tree produced by JS_EVAL_FLAG_COMPILE_ONLY to bytes and\n * reads it back into any runtime of the same jseption version, so that a\n * script can be compiled ahead of time and loaded without parsing. The design\n * follows quickjs.c (bc_write_* / bc_read_*): atoms are runtime specific, so\n * the writer emits an atom table and renumbers every atom (in the function\n * fields and in the atom operands of the byte code, found by walking the\n * opcodes by their format), and the reader interns the strings in its own\n * runtime and patches the operands back.\n *\n * Only load bytecode you produced yourself: like in QuickJS, the reader checks\n * the format (header, bounds, tags, indices, opcode boundaries, checksum), not\n * the semantics of the byte code, and hand-made byte code can reach states the\n * parser never emits.\n *\n * Format (all integers are unsigned LEB128 unless stated otherwise):\n *\n * magic 4 bytes \"JSBC\"\n * format u8 (BC_FORMAT)\n * version length + ASCII bytes: the jseption package version\n * flags BC_FLAG_*\n * strings count, then per string (length << 1 | wide), then the\n * byte length and bytes of the Latin-1 blob, then the\n * byte length and bytes of the UTF-16LE blob\n * atoms count, then the string index of each atom\n * root a tagged value (BC_TAG_FUNCTION_BYTECODE)\n * checksum 8 bytes: two 32-bit little-endian sums (Fletcher style, over\n * little-endian 32-bit words) of everything before them\n *\n * Atom references (function fields and byte code operands) use the encoding of\n * bc_atom_to_idx: predefined atoms (< JS_ATOM_END) and tagged integer atoms are\n * kept, other atoms become JS_ATOM_END + their index in the atom table.\n */\nimport { JSAtom, JS_ATOM_END, JS_ATOM_raw, JS_ATOM_TAG_INT, JS_ATOM_TYPE_STRING, __JS_AtomIsTaggedInt } from './atoms.ts';\nimport { JSContext, JSValue, JS_GetFunctionData, JS_ThrowSyntaxError, JS_ThrowTypeError, JS_NewArray,\n JS_DefinePropertyValue, JS_DefinePropertyValueUint32, JS_IsException, JS_PROP_ENUMERABLE, hooks } from './quickjs.ts';\nimport { JSClosureVar, JSFunctionBytecode, JSFunctionKind, JSVarDef, JSVarKind } from './values.ts';\nimport { OP, OpFmt, short_opcode_info } from './opcodes.ts';\nimport { JSEPTION_VERSION } from './version.ts';\n\n/* keep each function's source text (Function.prototype.toString); off by default */\nexport const JS_WRITE_OBJ_SOURCE = 1 << 0;\n\nexport const BC_MAGIC = [0x4a, 0x53, 0x42, 0x43]; /* \"JSBC\" */\nexport const BC_FORMAT = 1;\n\nconst BC_FLAG_SOURCE = 1 << 0;\n\nconst enum BCTag {\n NULL = 1,\n UNDEFINED,\n FALSE,\n TRUE,\n INT32,\n FLOAT64,\n STRING,\n BIG_INT,\n FUNCTION_BYTECODE,\n TEMPLATE_OBJECT,\n}\n\n/* JSFunctionBytecode flags */\nconst F_HAS_PROTOTYPE = 1 << 0;\nconst F_SIMPLE_PARAMS = 1 << 1;\nconst F_DERIVED_CTOR = 1 << 2;\nconst F_HOME_OBJECT = 1 << 3;\nconst F_NEW_TARGET = 1 << 4;\nconst F_SUPER_CALL = 1 << 5;\nconst F_SUPER = 1 << 6;\nconst F_ARGUMENTS = 1 << 7;\nconst F_HAS_DEBUG = 1 << 8;\nconst F_EVAL = 1 << 9;\nconst F_HAS_SOURCE = 1 << 10;\n\n/* JSVarDef / JSClosureVar flags */\nconst V_CONST = 1 << 0;\nconst V_LEXICAL = 1 << 1;\nconst V_CAPTURED = 1 << 2;\nconst V_STATIC_PRIVATE = 1 << 3;\nconst V_LOCAL = 1 << 4;\nconst V_ARG = 1 << 5;\n\nconst VAR_KIND_MAX = JSVarKind.PRIVATE_GETTER_SETTER;\n\n/* the size of each opcode of the final byte code (0: not an opcode) and what its operand\n holds, indexed by the opcode byte, so that walking the byte code costs a few array reads\n per instruction */\nconst OPK_ATOM = 1, OPK_CONST = 2, OPK_CONST8 = 3, OPK_FCLOSURE = 4, OPK_FCLOSURE8 = 5;\nconst OP_SIZE = new Uint8Array(256);\nconst OP_KIND = new Uint8Array(256);\nfor (let op = 0; op < 256; op++) {\n const info = short_opcode_info(op);\n if (info === undefined) continue;\n OP_SIZE[op] = info.size;\n switch (info.fmt) {\n case OpFmt.atom: case OpFmt.atom_u8: case OpFmt.atom_u16: case OpFmt.atom_label_u8: case OpFmt.atom_label_u16:\n OP_KIND[op] = OPK_ATOM; break;\n case OpFmt.const: OP_KIND[op] = OPK_CONST; break;\n case OpFmt.const8: OP_KIND[op] = OPK_CONST8; break;\n }\n}\nOP_KIND[OP.fclosure] = OPK_FCLOSURE;\nOP_KIND[OP.fclosure8] = OPK_FCLOSURE8;\n\n/* ---------------------------------------------------------------------\n Writer\n --------------------------------------------------------------------- */\n\nclass BCWriteError extends Error {}\n\nclass ByteBuf {\n buf = new Uint8Array(4096);\n len = 0;\n private f64 = new Float64Array(1);\n private f64b = new Uint8Array(this.f64.buffer);\n\n private grow(n: number): void {\n let size = this.buf.length * 2;\n while (size < this.len + n) size *= 2;\n const b = new Uint8Array(size);\n b.set(this.buf.subarray(0, this.len));\n this.buf = b;\n }\n u8(v: number): void {\n if (this.len >= this.buf.length) this.grow(1);\n this.buf[this.len++] = v;\n }\n leb(v: number): void {\n if (this.len + 5 > this.buf.length) this.grow(5);\n const buf = this.buf;\n while (v >= 0x80) {\n buf[this.len++] = (v % 0x80) | 0x80;\n v = Math.floor(v / 0x80);\n }\n buf[this.len++] = v;\n }\n sleb(v: number): void {\n this.leb(v < 0 ? -2 * v - 1 : 2 * v);\n }\n f64v(v: number): void {\n if (this.len + 8 > this.buf.length) this.grow(8);\n this.f64[0] = v;\n const b = this.f64b;\n /* little endian on the wire */\n if (LITTLE_ENDIAN) for (let i = 0; i < 8; i++) this.buf[this.len++] = b[i];\n else for (let i = 7; i >= 0; i--) this.buf[this.len++] = b[i];\n }\n bytes(src: Uint8Array): void {\n if (this.len + src.length > this.buf.length) this.grow(src.length);\n this.buf.set(src, this.len);\n this.len += src.length;\n }\n result(): Uint8Array { return this.buf.slice(0, this.len); }\n}\n\nconst LITTLE_ENDIAN = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;\n\nclass BCWriter {\n out = new ByteBuf();\n strings: string[] = [];\n string_idx = new Map<string, number>();\n atoms: number[] = []; /* string index of each atom table entry */\n atom_idx = new Map<JSAtom, number>();\n constructor(public ctx: JSContext, public flags: number) {}\n\n string_ref(s: string): number {\n let i = this.string_idx.get(s);\n if (i === undefined) {\n i = this.strings.length;\n this.strings.push(s);\n this.string_idx.set(s, i);\n }\n return i;\n }\n\n /* bc_atom_to_idx */\n atom_to_idx(atom: JSAtom): number {\n if (atom < JS_ATOM_END || __JS_AtomIsTaggedInt(atom)) return atom;\n let i = this.atom_idx.get(atom);\n if (i === undefined) {\n const atoms = this.ctx.rt.atoms;\n if (atoms.getType(atom) !== JS_ATOM_TYPE_STRING)\n throw new BCWriteError('cannot serialize a symbol atom: ' + atoms.toDisplayStr(atom));\n i = this.atoms.length;\n this.atoms.push(this.string_ref(atoms.toStr(atom)));\n this.atom_idx.set(atom, i);\n }\n return JS_ATOM_END + i;\n }\n\n atom(atom: JSAtom): void { this.out.leb(this.atom_to_idx(atom)); }\n\n value(v: JSValue | JSFunctionBytecode): void {\n const out = this.out;\n switch (typeof v) {\n case 'undefined': out.u8(BCTag.UNDEFINED); return;\n case 'boolean': out.u8(v ? BCTag.TRUE : BCTag.FALSE); return;\n case 'number':\n if ((v | 0) === v && !(v === 0 && 1 / v < 0)) { out.u8(BCTag.INT32); out.sleb(v); }\n else { out.u8(BCTag.FLOAT64); out.f64v(v); }\n return;\n case 'string': out.u8(BCTag.STRING); out.leb(this.string_ref(v)); return;\n case 'bigint': out.u8(BCTag.BIG_INT); out.leb(this.string_ref(v.toString())); return;\n case 'object':\n if (v === null) { out.u8(BCTag.NULL); return; }\n if (v instanceof JSFunctionBytecode) { this.function(v); return; }\n if (Array.isArray(v) && Object.isFrozen(v) && Object.prototype.hasOwnProperty.call(v, 'raw')) {\n this.template(v);\n return;\n }\n break;\n }\n throw new BCWriteError('unsupported constant in the function tree: ' + describe(v));\n }\n\n /* a template object (js_parse_template): frozen array of cooked strings with a frozen\n 'raw' array of raw strings */\n template(arr: unknown[]): void {\n const out = this.out;\n const raw = (arr as any).raw;\n if (!Array.isArray(raw) || raw.length !== arr.length) throw new BCWriteError('malformed template object');\n out.u8(BCTag.TEMPLATE_OBJECT);\n out.leb(arr.length);\n for (let i = 0; i < arr.length; i++) {\n const c = arr[i], r = raw[i];\n if ((c !== undefined && typeof c !== 'string') || typeof r !== 'string') throw new BCWriteError('malformed template object');\n out.leb(c === undefined ? 0 : this.string_ref(c) + 1);\n out.leb(this.string_ref(r));\n }\n }\n\n function(b: JSFunctionBytecode): void {\n const out = this.out;\n const keep_source = (this.flags & JS_WRITE_OBJ_SOURCE) !== 0 && b.has_debug && b.debug.source !== null;\n let flags = 0;\n if (b.has_prototype) flags |= F_HAS_PROTOTYPE;\n if (b.has_simple_parameter_list) flags |= F_SIMPLE_PARAMS;\n if (b.is_derived_class_constructor) flags |= F_DERIVED_CTOR;\n if (b.need_home_object) flags |= F_HOME_OBJECT;\n if (b.new_target_allowed) flags |= F_NEW_TARGET;\n if (b.super_call_allowed) flags |= F_SUPER_CALL;\n if (b.super_allowed) flags |= F_SUPER;\n if (b.arguments_allowed) flags |= F_ARGUMENTS;\n if (b.has_debug) flags |= F_HAS_DEBUG;\n if (b.is_direct_or_indirect_eval) flags |= F_EVAL;\n if (keep_source) flags |= F_HAS_SOURCE;\n if (b.vardefs.length !== b.arg_count + b.var_count) throw new BCWriteError('inconsistent variable count');\n out.u8(BCTag.FUNCTION_BYTECODE);\n out.leb(flags);\n out.u8(b.js_mode);\n out.u8(b.func_kind);\n this.atom(b.func_name);\n out.leb(b.arg_count);\n out.leb(b.var_count);\n out.leb(b.defined_arg_count);\n out.leb(b.stack_size);\n out.leb(b.closure_var.length);\n out.leb(b.cpool.length);\n out.leb(b.byte_code_len);\n for (const vd of b.vardefs) {\n this.atom(vd.var_name);\n out.leb(vd.scope_level);\n out.sleb(vd.scope_next);\n out.u8((vd.is_const ? V_CONST : 0) | (vd.is_lexical ? V_LEXICAL : 0) | (vd.is_captured ? V_CAPTURED : 0) |\n (vd.is_static_private ? V_STATIC_PRIVATE : 0));\n out.u8(vd.var_kind);\n out.sleb(vd.func_pool_idx);\n }\n for (const cv of b.closure_var) {\n this.atom(cv.var_name);\n out.leb(cv.var_idx);\n out.u8((cv.is_const ? V_CONST : 0) | (cv.is_lexical ? V_LEXICAL : 0) | (cv.is_local ? V_LOCAL : 0) |\n (cv.is_arg ? V_ARG : 0));\n out.u8(cv.var_kind);\n }\n out.bytes(this.byte_code(b));\n if (b.has_debug) {\n this.atom(b.debug.filename);\n const pc2line = b.debug.pc2line;\n if (pc2line === null) out.leb(0);\n else { out.leb(pc2line.length); out.bytes(pc2line); }\n if (keep_source) out.leb(this.string_ref(b.debug.source!));\n }\n for (const v of b.cpool) this.value(v);\n }\n\n /* the byte code with its atom operands renumbered (JS_WriteFunctionBytecode) */\n byte_code(b: JSFunctionBytecode): Uint8Array {\n const len = b.byte_code_len;\n const bc = b.byte_code_buf.slice(0, len);\n let pos = 0;\n while (pos < len) {\n const op = bc[pos], size = OP_SIZE[op];\n if (size === 0) throw new BCWriteError(`invalid opcode ${op} at pc ${pos}`);\n if (OP_KIND[op] === OPK_ATOM && pos + 5 <= len) {\n const atom = (bc[pos + 1] | (bc[pos + 2] << 8) | (bc[pos + 3] << 16) | (bc[pos + 4] << 24)) >>> 0;\n const v = this.atom_to_idx(atom);\n bc[pos + 1] = v; bc[pos + 2] = v >>> 8; bc[pos + 3] = v >>> 16; bc[pos + 4] = v >>> 24;\n }\n pos += size;\n }\n if (pos !== len) throw new BCWriteError('truncated instruction at the end of the byte code');\n return bc;\n }\n\n finish(body: ByteBuf): Uint8Array {\n const out = new ByteBuf();\n for (const c of BC_MAGIC) out.u8(c);\n out.u8(BC_FORMAT);\n out.leb(JSEPTION_VERSION.length);\n for (let i = 0; i < JSEPTION_VERSION.length; i++) out.u8(JSEPTION_VERSION.charCodeAt(i));\n out.leb(this.flags & JS_WRITE_OBJ_SOURCE ? BC_FLAG_SOURCE : 0);\n /* string table */\n const strings = this.strings;\n out.leb(strings.length);\n let narrow_len = 0, wide_len = 0;\n const wide: boolean[] = [];\n for (const s of strings) {\n let w = false;\n for (let i = 0; i < s.length; i++) if (s.charCodeAt(i) > 0xff) { w = true; break; }\n wide.push(w);\n out.leb(s.length * 2 + (w ? 1 : 0));\n if (w) wide_len += s.length; else narrow_len += s.length;\n }\n out.leb(narrow_len);\n const narrow = new Uint8Array(narrow_len);\n let p = 0;\n for (let k = 0; k < strings.length; k++) {\n if (wide[k]) continue;\n const s = strings[k];\n for (let i = 0; i < s.length; i++) narrow[p++] = s.charCodeAt(i);\n }\n out.bytes(narrow);\n out.leb(wide_len * 2);\n const wbuf = new Uint8Array(wide_len * 2);\n p = 0;\n for (let k = 0; k < strings.length; k++) {\n if (!wide[k]) continue;\n const s = strings[k];\n for (let i = 0; i < s.length; i++) { const c = s.charCodeAt(i); wbuf[p++] = c; wbuf[p++] = c >>> 8; }\n }\n out.bytes(wbuf);\n /* atom table */\n out.leb(this.atoms.length);\n for (const i of this.atoms) out.leb(i);\n out.bytes(body.buf.subarray(0, body.len));\n const [a, b] = checksum(out.buf, out.len);\n for (const v of [a, b]) { out.u8(v & 0xff); out.u8((v >>> 8) & 0xff); out.u8((v >>> 16) & 0xff); out.u8(v >>> 24); }\n return out.result();\n }\n}\n\nfunction describe(v: unknown): string {\n if (typeof v === 'function') return 'function object';\n if (Array.isArray(v)) return 'array';\n if (typeof v === 'object' && v !== null) return 'object';\n return typeof v;\n}\n\nconst CHECKSUM_SIZE = 8;\n\n/* Fletcher-style sums of buf[0, end) taken as little-endian 32-bit words (the tail bytewise):\n detects truncation and corrupted bytes, at a quarter of the cost of a bytewise checksum\n (it is not a defence against deliberate tampering) */\nfunction checksum(buf: Uint8Array, end: number): [number, number] {\n const n = end >>> 2;\n let a = 1, b = 0;\n if (LITTLE_ENDIAN) {\n if (buf.byteOffset & 3) buf = buf.slice(0, end);\n const w = new Int32Array(buf.buffer, buf.byteOffset, n);\n for (let i = 0; i < n; i++) { a = (a + w[i]) | 0; b = (b + a) | 0; }\n } else {\n for (let i = 0; i < n; i++) {\n const p = i * 4;\n a = (a + (buf[p] | (buf[p + 1] << 8) | (buf[p + 2] << 16) | (buf[p + 3] << 24))) | 0; b = (b + a) | 0;\n }\n }\n for (let i = n * 4; i < end; i++) { a = (a + buf[i]) | 0; b = (b + a) | 0; }\n return [a >>> 0, b >>> 0];\n}\n\n/* Serialize the function returned by JS_Eval(..., JS_EVAL_FLAG_COMPILE_ONLY) (or any\n bytecode function that does not close over variables). Returns null with a pending\n exception on failure. */\nexport function JS_WriteObject(ctx: JSContext, obj: JSValue, flags = 0): Uint8Array | null {\n const fd = JS_GetFunctionData(obj);\n if (fd === null) {\n JS_ThrowTypeError(ctx, 'JS_WriteObject: not a bytecode function (expected the result of JS_EVAL_FLAG_COMPILE_ONLY)');\n return null;\n }\n const b = fd.function_bytecode;\n if (b.closure_var.length !== 0) {\n JS_ThrowTypeError(ctx, 'JS_WriteObject: the function closes over variables of an enclosing scope');\n return null;\n }\n const w = new BCWriter(ctx, flags);\n try {\n w.function(b);\n const body = w.out;\n return w.finish(body);\n } catch (e) {\n if (e instanceof BCWriteError) { JS_ThrowTypeError(ctx, 'JS_WriteObject: ' + e.message); return null; }\n throw e;\n }\n}\n\n/* ---------------------------------------------------------------------\n Reader\n --------------------------------------------------------------------- */\n\nclass BCReadError extends Error {}\n\nconst MAX_DEPTH = 2000;\n/* parser limits (define_var / add_arg: at most 65534 each; compute_stack_size: JS_STACK_SIZE_MAX) */\nconst MAX_LOCALS = 65535;\nconst MAX_STACK_SIZE = 65534;\n\nclass BCReader {\n pos = 0;\n end: number;\n strings: string[] = [];\n atoms: JSAtom[] = [];\n keep_source = false;\n depth = 0;\n private f64 = new Float64Array(1);\n private f64b = new Uint8Array(this.f64.buffer);\n buf: Uint8Array;\n /* the reader works on a private copy of the input: the byte code is patched in place and\n the functions keep views of it (one copy instead of two per function) */\n constructor(public ctx: JSContext, input: Uint8Array) { this.buf = input.slice(); this.end = this.buf.length; }\n\n fail(msg: string): never { throw new BCReadError(msg); }\n truncated(): never { throw new BCReadError('read after the end of the buffer'); }\n\n u8(): number {\n if (this.pos >= this.end) this.truncated();\n return this.buf[this.pos++];\n }\n leb(): number {\n const buf = this.buf;\n let pos = this.pos;\n if (pos >= this.end) this.truncated();\n let a = buf[pos++];\n if (a < 0x80) { this.pos = pos; return a; }\n let v = a & 0x7f, mul = 0x80;\n for (let i = 1; ; i++) {\n if (pos >= this.end) this.truncated();\n if (i >= 5) this.fail('invalid LEB128 number');\n a = buf[pos++];\n v += (a & 0x7f) * mul;\n if (a < 0x80) break;\n mul *= 0x80;\n }\n if (v > 0xffffffff) this.fail('invalid LEB128 number');\n this.pos = pos;\n return v;\n }\n sleb(): number {\n const v = this.leb();\n return (v % 2 === 1) ? -((v + 1) / 2) : v / 2;\n }\n f64v(): number {\n if (this.pos + 8 > this.end) this.truncated();\n const b = this.f64b, buf = this.buf;\n if (LITTLE_ENDIAN) for (let i = 0; i < 8; i++) b[i] = buf[this.pos++];\n else for (let i = 7; i >= 0; i--) b[i] = buf[this.pos++];\n return this.f64[0];\n }\n /* a count whose items each take at least one byte */\n count(): number {\n const n = this.leb();\n if (n > this.end - this.pos) this.truncated();\n return n;\n }\n bytes(n: number): Uint8Array {\n if (n > this.end - this.pos) this.truncated();\n const r = this.buf.subarray(this.pos, this.pos + n);\n this.pos += n;\n return r;\n }\n string(): string {\n const i = this.leb();\n if (i >= this.strings.length) this.fail(`invalid string index ${i}`);\n return this.strings[i];\n }\n\n /* bc_idx_to_atom */\n idx_to_atom(v: number): JSAtom {\n if (v < JS_ATOM_END || v >= JS_ATOM_TAG_INT) return v;\n const i = v - JS_ATOM_END;\n if (i >= this.atoms.length) this.fail(`invalid atom index ${v}`);\n return this.atoms[i];\n }\n atom(): JSAtom { return this.idx_to_atom(this.leb()); }\n\n header(): void {\n const buf = this.buf;\n if (buf.length < BC_MAGIC.length + 2 + CHECKSUM_SIZE) this.truncated();\n for (let i = 0; i < BC_MAGIC.length; i++) if (buf[i] !== BC_MAGIC[i]) this.fail('not jseption bytecode (bad magic number)');\n this.pos = BC_MAGIC.length;\n const format = this.u8();\n const vlen = this.leb();\n if (vlen > 64) this.fail('not jseption bytecode (bad header)');\n if (vlen > this.end - this.pos) this.truncated();\n let version = '';\n for (let i = 0; i < vlen; i++) version += String.fromCharCode(buf[this.pos++]);\n if (format !== BC_FORMAT || version !== JSEPTION_VERSION)\n this.fail(`bytecode version mismatch: written by jseption ${version} (format ${format}), ` +\n `this is jseption ${JSEPTION_VERSION} (format ${BC_FORMAT})`);\n /* everything after the version is covered by the checksum */\n if (buf.length - CHECKSUM_SIZE < this.pos) this.truncated();\n this.end = buf.length - CHECKSUM_SIZE;\n const [a, b] = checksum(buf, this.end);\n const u32 = (p: number) => (buf[p] | (buf[p + 1] << 8) | (buf[p + 2] << 16) | (buf[p + 3] << 24)) >>> 0;\n if (u32(this.end) !== a || u32(this.end + 4) !== b) this.fail('checksum mismatch (truncated or corrupted bytecode)');\n const flags = this.leb();\n if (flags & ~BC_FLAG_SOURCE) this.fail('unknown flags');\n this.keep_source = (flags & BC_FLAG_SOURCE) !== 0;\n }\n\n string_table(): void {\n const n = this.count();\n const lens = new Array<number>(n);\n let narrow_len = 0, wide_len = 0;\n for (let i = 0; i < n; i++) {\n const v = this.leb();\n lens[i] = v;\n if (v & 1) wide_len += (v - 1) / 2; else narrow_len += v / 2;\n }\n if (this.leb() !== narrow_len) this.fail('inconsistent string table');\n if (narrow_len > this.end - this.pos) this.truncated();\n const narrow = latin1_decode(this.buf, this.pos, this.pos + narrow_len);\n this.pos += narrow_len;\n if (this.leb() !== wide_len * 2) this.fail('inconsistent string table');\n if (wide_len * 2 > this.end - this.pos) this.truncated();\n const wide = utf16_decode(this.buf, this.pos, wide_len);\n this.pos += wide_len * 2;\n const strings = this.strings = new Array<string>(n);\n let np = 0, wp = 0;\n for (let i = 0; i < n; i++) {\n const v = lens[i];\n if (v & 1) { const l = (v - 1) / 2; strings[i] = wide.slice(wp, wp + l); wp += l; }\n else { const l = v / 2; strings[i] = narrow.slice(np, np + l); np += l; }\n }\n }\n\n atom_table(): void {\n const n = this.count();\n const atoms = this.atoms = new Array<JSAtom>(n);\n const table = this.ctx.rt.atoms;\n for (let i = 0; i < n; i++) atoms[i] = table.newAtomStr(this.string());\n }\n\n value(): JSValue | JSFunctionBytecode {\n const tag = this.u8();\n switch (tag) {\n case BCTag.NULL: return null;\n case BCTag.UNDEFINED: return undefined;\n case BCTag.FALSE: return false;\n case BCTag.TRUE: return true;\n case BCTag.INT32: {\n const v = this.sleb();\n if ((v | 0) !== v) this.fail('invalid int32');\n return v;\n }\n case BCTag.FLOAT64: return this.f64v();\n case BCTag.STRING: return this.string();\n case BCTag.BIG_INT: {\n const s = this.string();\n if (!/^-?[0-9]+$/.test(s)) this.fail('invalid BigInt');\n return BigInt(s);\n }\n case BCTag.FUNCTION_BYTECODE: return this.function();\n case BCTag.TEMPLATE_OBJECT: return this.template();\n }\n return this.fail(`invalid tag ${tag} at offset ${this.pos - 1}`);\n }\n\n template(): JSValue {\n const ctx = this.ctx;\n const n = this.count();\n const arr = JS_NewArray(ctx), raw = JS_NewArray(ctx);\n if (JS_IsException(arr) || JS_IsException(raw)) this.fail('out of memory');\n for (let i = 0; i < n; i++) {\n const c = this.leb();\n let cooked: string | undefined;\n if (c !== 0) {\n if (c > this.strings.length) this.fail(`invalid string index ${c - 1}`);\n cooked = this.strings[c - 1];\n }\n JS_DefinePropertyValueUint32(ctx, raw, i, this.string(), JS_PROP_ENUMERABLE);\n JS_DefinePropertyValueUint32(ctx, arr, i, cooked, JS_PROP_ENUMERABLE);\n }\n JS_DefinePropertyValue(ctx, arr, JS_ATOM_raw, raw, 0);\n Object.freeze(raw as object);\n Object.freeze(arr as object);\n return arr;\n }\n\n function(): JSFunctionBytecode {\n if (++this.depth > MAX_DEPTH) this.fail('functions nested too deeply');\n const b = new JSFunctionBytecode();\n const flags = this.leb();\n if (flags >= F_HAS_SOURCE << 1) this.fail('invalid function flags');\n b.has_prototype = (flags & F_HAS_PROTOTYPE) !== 0;\n b.has_simple_parameter_list = (flags & F_SIMPLE_PARAMS) !== 0;\n b.is_derived_class_constructor = (flags & F_DERIVED_CTOR) !== 0;\n b.need_home_object = (flags & F_HOME_OBJECT) !== 0;\n b.new_target_allowed = (flags & F_NEW_TARGET) !== 0;\n b.super_call_allowed = (flags & F_SUPER_CALL) !== 0;\n b.super_allowed = (flags & F_SUPER) !== 0;\n b.arguments_allowed = (flags & F_ARGUMENTS) !== 0;\n b.has_debug = (flags & F_HAS_DEBUG) !== 0;\n b.is_direct_or_indirect_eval = (flags & F_EVAL) !== 0;\n b.js_mode = this.u8();\n const kind = this.u8();\n if (kind > JSFunctionKind.ASYNC_GENERATOR) this.fail('invalid function kind');\n b.func_kind = kind;\n b.func_name = this.atom();\n b.arg_count = this.count();\n b.var_count = this.count();\n b.defined_arg_count = this.leb();\n b.stack_size = this.leb();\n /* the parser's limits: the interpreter sizes each frame from these, so an out-of-range\n value would make it allocate a huge frame instead of failing here */\n if (b.arg_count >= MAX_LOCALS || b.var_count >= MAX_LOCALS) this.fail('too many variables');\n if (b.defined_arg_count > b.arg_count) this.fail('invalid defined argument count');\n if (b.stack_size > MAX_STACK_SIZE) this.fail(`invalid stack size ${b.stack_size}`);\n const closure_count = this.count();\n const cpool_count = this.count();\n const bc_len = this.count();\n const nvars = b.arg_count + b.var_count;\n const vardefs = b.vardefs = new Array<JSVarDef>(nvars);\n for (let i = 0; i < nvars; i++) {\n const vd = new JSVarDef(this.atom());\n vd.scope_level = this.leb();\n vd.scope_next = this.sleb();\n const f = this.u8();\n vd.is_const = (f & V_CONST) !== 0;\n vd.is_lexical = (f & V_LEXICAL) !== 0;\n vd.is_captured = (f & V_CAPTURED) !== 0;\n vd.is_static_private = (f & V_STATIC_PRIVATE) !== 0;\n const k = this.u8();\n if (k > VAR_KIND_MAX) this.fail('invalid variable kind');\n vd.var_kind = k;\n vd.func_pool_idx = this.sleb();\n vardefs[i] = vd;\n }\n const closure_var = b.closure_var = new Array<JSClosureVar>(closure_count);\n for (let i = 0; i < closure_count; i++) {\n const cv = new JSClosureVar();\n cv.var_name = this.atom();\n cv.var_idx = this.leb();\n const f = this.u8();\n cv.is_const = (f & V_CONST) !== 0;\n cv.is_lexical = (f & V_LEXICAL) !== 0;\n cv.is_local = (f & V_LOCAL) !== 0;\n cv.is_arg = (f & V_ARG) !== 0;\n const k = this.u8();\n if (k > VAR_KIND_MAX) this.fail('invalid variable kind');\n cv.var_kind = k;\n closure_var[i] = cv;\n }\n const bc = this.bytes(bc_len);\n b.byte_code_buf = bc;\n b.byte_code_len = bc_len;\n if (b.has_debug) {\n b.debug.filename = this.atom();\n const n = this.leb();\n b.debug.pc2line = this.bytes(n);\n if (flags & F_HAS_SOURCE) {\n if (!this.keep_source) this.fail('invalid function flags');\n const src = this.string();\n b.debug.source = src;\n b.debug.source_len = src.length;\n }\n } else if (flags & F_HAS_SOURCE) {\n this.fail('invalid function flags');\n }\n const cpool = b.cpool = new Array<JSValue | JSFunctionBytecode>(cpool_count);\n for (let i = 0; i < cpool_count; i++) cpool[i] = this.value();\n this.fixup_byte_code(b);\n b.realm = this.ctx;\n this.depth--;\n return b;\n }\n\n /* patch the atom operands and check the instruction boundaries and the constant pool\n indices (JS_ReadFunctionBytecode) */\n fixup_byte_code(b: JSFunctionBytecode): void {\n const bc = b.byte_code_buf, len = b.byte_code_len, cpool = b.cpool;\n let pos = 0;\n const natoms = this.atoms.length, atoms = this.atoms;\n while (pos < len) {\n const op = bc[pos], size = OP_SIZE[op];\n if (size === 0) this.fail(`invalid opcode ${op} at pc ${pos}`);\n if (pos + size > len) this.fail(`truncated instruction at pc ${pos}`);\n const kind = OP_KIND[op];\n if (kind !== 0) {\n if (kind === OPK_ATOM) {\n const v = (bc[pos + 1] | (bc[pos + 2] << 8) | (bc[pos + 3] << 16) | (bc[pos + 4] << 24)) >>> 0;\n if (v >= JS_ATOM_END && v < JS_ATOM_TAG_INT) {\n const i = v - JS_ATOM_END;\n if (i >= natoms) this.fail(`invalid atom index ${v} at pc ${pos}`);\n const atom = atoms[i];\n bc[pos + 1] = atom; bc[pos + 2] = atom >>> 8; bc[pos + 3] = atom >>> 16; bc[pos + 4] = atom >>> 24;\n }\n } else {\n const idx = (kind === OPK_CONST8 || kind === OPK_FCLOSURE8) ? bc[pos + 1]\n : (bc[pos + 1] | (bc[pos + 2] << 8) | (bc[pos + 3] << 16) | (bc[pos + 4] << 24)) >>> 0;\n if (idx >= cpool.length) this.fail(`invalid constant pool index ${idx} at pc ${pos}`);\n if (kind >= OPK_FCLOSURE && !(cpool[idx] instanceof JSFunctionBytecode))\n this.fail(`closure of a constant that is not a function at pc ${pos}`);\n }\n }\n pos += size;\n }\n }\n}\n\n/* buf[start, end) as a Latin-1 string */\nfunction latin1_decode(buf: Uint8Array, start: number, end: number): string {\n const CHUNK = 8192;\n if (end - start <= CHUNK) return String.fromCharCode.apply(null, buf.subarray(start, end) as unknown as number[]);\n const parts: string[] = [];\n for (let i = start; i < end; i += CHUNK)\n parts.push(String.fromCharCode.apply(null, buf.subarray(i, Math.min(end, i + CHUNK)) as unknown as number[]));\n return parts.join('');\n}\n\n/* n UTF-16LE code units at buf[start] as a string (lone surrogates preserved) */\nfunction utf16_decode(buf: Uint8Array, start: number, n: number): string {\n if (n === 0) return '';\n let units: Uint16Array;\n if (LITTLE_ENDIAN) {\n units = new Uint16Array(buf.slice(start, start + 2 * n).buffer);\n } else {\n units = new Uint16Array(n);\n for (let i = 0; i < n; i++) units[i] = buf[start + 2 * i] | (buf[start + 2 * i + 1] << 8);\n }\n const CHUNK = 8192;\n const parts: string[] = [];\n for (let i = 0; i < n; i += CHUNK)\n parts.push(String.fromCharCode.apply(null, units.subarray(i, Math.min(n, i + CHUNK)) as unknown as number[]));\n return parts.join('');\n}\n\n/* Read bytes produced by JS_WriteObject into this context. Returns a function object to\n run with JS_EvalFunction, or JS_EXCEPTION with a SyntaxError pending when the input is\n not valid bytecode of this jseption version. */\nexport function JS_ReadObject(ctx: JSContext, buf: Uint8Array): JSValue {\n if (!(buf instanceof Uint8Array)) return JS_ThrowTypeError(ctx, 'JS_ReadObject: expected a Uint8Array');\n const r = new BCReader(ctx, buf);\n let b: JSFunctionBytecode;\n try {\n r.header();\n r.string_table();\n r.atom_table();\n if (r.u8() !== BCTag.FUNCTION_BYTECODE) r.fail('the root value is not a function');\n b = r.function();\n if (r.pos !== r.end) r.fail('trailing bytes after the root value');\n } catch (e) {\n if (e instanceof BCReadError) return JS_ThrowSyntaxError(ctx, 'JS_ReadObject: ' + e.message);\n if (e instanceof RangeError) return JS_ThrowSyntaxError(ctx, 'JS_ReadObject: ' + e.message);\n throw e;\n }\n if (b.closure_var.length !== 0) return JS_ThrowSyntaxError(ctx, 'JS_ReadObject: the root function has closure variables');\n return hooks.js_closure(ctx, b, null, null);\n}\n\n"]}
1
+ {"version":3,"file":"bytecode.js","sourceRoot":"","sources":["../src/bytecode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAU,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY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,CAAC,OAAO,CAAC,CAAC;QAC7F,IAAI,CAAC,YAAY,UAAU;YAAE,OAAO,mBAAmB,CAAC,GAAG,EAAE,iBAAiB,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;QAC5F,MAAM,CAAC,CAAC;IACV,CAAC;IACD,IAAI,CAAC,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,mBAAmB,CAAC,GAAG,EAAE,wDAAwD,CAAC,CAAC;IAC1H,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9C,CAAC;AAGD,cAAc,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC","sourcesContent":["/*\n * Bytecode serialization: JS_WriteObject / JS_ReadObject.\n *\n * Writes the function tree produced by JS_EVAL_FLAG_COMPILE_ONLY to bytes and\n * reads it back into any runtime of the same jseption version, so that a\n * script can be compiled ahead of time and loaded without parsing. The design\n * follows quickjs.c (bc_write_* / bc_read_*): atoms are runtime specific, so\n * the writer emits an atom table and renumbers every atom (in the function\n * fields and in the atom operands of the byte code, found by walking the\n * opcodes by their format), and the reader interns the strings in its own\n * runtime and patches the operands back.\n *\n * Only load bytecode you produced yourself: like in QuickJS, the reader checks\n * the format (header, bounds, tags, indices, opcode boundaries, checksum), not\n * the semantics of the byte code, and hand-made byte code can reach states the\n * parser never emits.\n *\n * Format (all integers are unsigned LEB128 unless stated otherwise):\n *\n * magic 4 bytes \"JSBC\"\n * format u8 (BC_FORMAT)\n * version length + ASCII bytes: the jseption package version\n * flags BC_FLAG_*\n * strings count, then per string (length << 1 | wide), then the\n * byte length and bytes of the Latin-1 blob, then the\n * byte length and bytes of the UTF-16LE blob\n * atoms count, then the string index of each atom\n * root a tagged value (BC_TAG_FUNCTION_BYTECODE)\n * checksum 8 bytes: two 32-bit little-endian sums (Fletcher style, over\n * little-endian 32-bit words) of everything before them\n *\n * Atom references (function fields and byte code operands) use the encoding of\n * bc_atom_to_idx: predefined atoms (< JS_ATOM_END) and tagged integer atoms are\n * kept, other atoms become JS_ATOM_END + their index in the atom table.\n */\nimport { JSAtom, JS_ATOM_END, JS_ATOM_raw, JS_ATOM_TAG_INT, JS_ATOM_TYPE_STRING, __JS_AtomIsTaggedInt } from './atoms.ts';\nimport { JSContext, JSValue, JS_GetFunctionData, JS_ThrowSyntaxError, JS_ThrowTypeError, JS_NewArray,\n JS_DefinePropertyValue, JS_DefinePropertyValueUint32, JS_IsException, JS_PROP_ENUMERABLE, hooks } from './quickjs.ts';\nimport { JSClosureVar, JSFunctionBytecode, JSFunctionKind, JSVarDef, JSVarKind, JSModuleDef, JSModuleKind,\n JSReqModuleEntry, JSExportEntry, JSExportType, JSStarExportEntry, JSImportEntry } from './values.ts';\nimport { js_module_set_function, hooks_bytecode } from './module.ts';\nimport { OP, OpFmt, short_opcode_info } from './opcodes.ts';\nimport { JSEPTION_VERSION } from './version.ts';\n\n/* keep each function's source text (Function.prototype.toString); off by default */\nexport const JS_WRITE_OBJ_SOURCE = 1 << 0;\n\nexport const BC_MAGIC = [0x4a, 0x53, 0x42, 0x43]; /* \"JSBC\" */\nexport const BC_FORMAT = 1;\n\nconst BC_FLAG_SOURCE = 1 << 0;\n\nconst enum BCTag {\n NULL = 1,\n UNDEFINED,\n FALSE,\n TRUE,\n INT32,\n FLOAT64,\n STRING,\n BIG_INT,\n FUNCTION_BYTECODE,\n TEMPLATE_OBJECT,\n MODULE,\n}\n\n/* JSFunctionBytecode flags */\nconst F_HAS_PROTOTYPE = 1 << 0;\nconst F_SIMPLE_PARAMS = 1 << 1;\nconst F_DERIVED_CTOR = 1 << 2;\nconst F_HOME_OBJECT = 1 << 3;\nconst F_NEW_TARGET = 1 << 4;\nconst F_SUPER_CALL = 1 << 5;\nconst F_SUPER = 1 << 6;\nconst F_ARGUMENTS = 1 << 7;\nconst F_HAS_DEBUG = 1 << 8;\nconst F_EVAL = 1 << 9;\nconst F_HAS_SOURCE = 1 << 10;\n\n/* JSVarDef / JSClosureVar flags */\nconst V_CONST = 1 << 0;\nconst V_LEXICAL = 1 << 1;\nconst V_CAPTURED = 1 << 2;\nconst V_STATIC_PRIVATE = 1 << 3;\nconst V_LOCAL = 1 << 4;\nconst V_ARG = 1 << 5;\n\nconst VAR_KIND_MAX = JSVarKind.PRIVATE_GETTER_SETTER;\n\n/* the size of each opcode of the final byte code (0: not an opcode) and what its operand\n holds, indexed by the opcode byte, so that walking the byte code costs a few array reads\n per instruction */\nconst OPK_ATOM = 1, OPK_CONST = 2, OPK_CONST8 = 3, OPK_FCLOSURE = 4, OPK_FCLOSURE8 = 5;\nconst OP_SIZE = new Uint8Array(256);\nconst OP_KIND = new Uint8Array(256);\nfor (let op = 0; op < 256; op++) {\n const info = short_opcode_info(op);\n if (info === undefined) continue;\n OP_SIZE[op] = info.size;\n switch (info.fmt) {\n case OpFmt.atom: case OpFmt.atom_u8: case OpFmt.atom_u16: case OpFmt.atom_label_u8: case OpFmt.atom_label_u16:\n OP_KIND[op] = OPK_ATOM; break;\n case OpFmt.const: OP_KIND[op] = OPK_CONST; break;\n case OpFmt.const8: OP_KIND[op] = OPK_CONST8; break;\n }\n}\nOP_KIND[OP.fclosure] = OPK_FCLOSURE;\nOP_KIND[OP.fclosure8] = OPK_FCLOSURE8;\n\n/* ---------------------------------------------------------------------\n Writer\n --------------------------------------------------------------------- */\n\nclass BCWriteError extends Error {}\n\nclass ByteBuf {\n buf = new Uint8Array(4096);\n len = 0;\n private f64 = new Float64Array(1);\n private f64b = new Uint8Array(this.f64.buffer);\n\n private grow(n: number): void {\n let size = this.buf.length * 2;\n while (size < this.len + n) size *= 2;\n const b = new Uint8Array(size);\n b.set(this.buf.subarray(0, this.len));\n this.buf = b;\n }\n u8(v: number): void {\n if (this.len >= this.buf.length) this.grow(1);\n this.buf[this.len++] = v;\n }\n leb(v: number): void {\n if (this.len + 5 > this.buf.length) this.grow(5);\n const buf = this.buf;\n while (v >= 0x80) {\n buf[this.len++] = (v % 0x80) | 0x80;\n v = Math.floor(v / 0x80);\n }\n buf[this.len++] = v;\n }\n sleb(v: number): void {\n this.leb(v < 0 ? -2 * v - 1 : 2 * v);\n }\n f64v(v: number): void {\n if (this.len + 8 > this.buf.length) this.grow(8);\n this.f64[0] = v;\n const b = this.f64b;\n /* little endian on the wire */\n if (LITTLE_ENDIAN) for (let i = 0; i < 8; i++) this.buf[this.len++] = b[i];\n else for (let i = 7; i >= 0; i--) this.buf[this.len++] = b[i];\n }\n bytes(src: Uint8Array): void {\n if (this.len + src.length > this.buf.length) this.grow(src.length);\n this.buf.set(src, this.len);\n this.len += src.length;\n }\n result(): Uint8Array { return this.buf.slice(0, this.len); }\n}\n\nconst LITTLE_ENDIAN = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;\n\nclass BCWriter {\n out = new ByteBuf();\n strings: string[] = [];\n string_idx = new Map<string, number>();\n atoms: number[] = []; /* string index of each atom table entry */\n atom_idx = new Map<JSAtom, number>();\n constructor(public ctx: JSContext, public flags: number) {}\n\n string_ref(s: string): number {\n let i = this.string_idx.get(s);\n if (i === undefined) {\n i = this.strings.length;\n this.strings.push(s);\n this.string_idx.set(s, i);\n }\n return i;\n }\n\n /* bc_atom_to_idx */\n atom_to_idx(atom: JSAtom): number {\n if (atom < JS_ATOM_END || __JS_AtomIsTaggedInt(atom)) return atom;\n let i = this.atom_idx.get(atom);\n if (i === undefined) {\n const atoms = this.ctx.rt.atoms;\n if (atoms.getType(atom) !== JS_ATOM_TYPE_STRING)\n throw new BCWriteError('cannot serialize a symbol atom: ' + atoms.toDisplayStr(atom));\n i = this.atoms.length;\n this.atoms.push(this.string_ref(atoms.toStr(atom)));\n this.atom_idx.set(atom, i);\n }\n return JS_ATOM_END + i;\n }\n\n atom(atom: JSAtom): void { this.out.leb(this.atom_to_idx(atom)); }\n\n value(v: JSValue | JSFunctionBytecode): void {\n const out = this.out;\n switch (typeof v) {\n case 'undefined': out.u8(BCTag.UNDEFINED); return;\n case 'boolean': out.u8(v ? BCTag.TRUE : BCTag.FALSE); return;\n case 'number':\n if ((v | 0) === v && !(v === 0 && 1 / v < 0)) { out.u8(BCTag.INT32); out.sleb(v); }\n else { out.u8(BCTag.FLOAT64); out.f64v(v); }\n return;\n case 'string': out.u8(BCTag.STRING); out.leb(this.string_ref(v)); return;\n case 'bigint': out.u8(BCTag.BIG_INT); out.leb(this.string_ref(v.toString())); return;\n case 'object':\n if (v === null) { out.u8(BCTag.NULL); return; }\n if (v instanceof JSFunctionBytecode) { this.function(v); return; }\n if (Array.isArray(v) && Object.isFrozen(v) && Object.prototype.hasOwnProperty.call(v, 'raw')) {\n this.template(v);\n return;\n }\n break;\n }\n throw new BCWriteError('unsupported constant in the function tree: ' + describe(v));\n }\n\n /* a template object (js_parse_template): frozen array of cooked strings with a frozen\n 'raw' array of raw strings */\n template(arr: unknown[]): void {\n const out = this.out;\n const raw = (arr as any).raw;\n if (!Array.isArray(raw) || raw.length !== arr.length) throw new BCWriteError('malformed template object');\n out.u8(BCTag.TEMPLATE_OBJECT);\n out.leb(arr.length);\n for (let i = 0; i < arr.length; i++) {\n const c = arr[i], r = raw[i];\n if ((c !== undefined && typeof c !== 'string') || typeof r !== 'string') throw new BCWriteError('malformed template object');\n out.leb(c === undefined ? 0 : this.string_ref(c) + 1);\n out.leb(this.string_ref(r));\n }\n }\n\n function(b: JSFunctionBytecode): void {\n const out = this.out;\n const keep_source = (this.flags & JS_WRITE_OBJ_SOURCE) !== 0 && b.has_debug && b.debug.source !== null;\n let flags = 0;\n if (b.has_prototype) flags |= F_HAS_PROTOTYPE;\n if (b.has_simple_parameter_list) flags |= F_SIMPLE_PARAMS;\n if (b.is_derived_class_constructor) flags |= F_DERIVED_CTOR;\n if (b.need_home_object) flags |= F_HOME_OBJECT;\n if (b.new_target_allowed) flags |= F_NEW_TARGET;\n if (b.super_call_allowed) flags |= F_SUPER_CALL;\n if (b.super_allowed) flags |= F_SUPER;\n if (b.arguments_allowed) flags |= F_ARGUMENTS;\n if (b.has_debug) flags |= F_HAS_DEBUG;\n if (b.is_direct_or_indirect_eval) flags |= F_EVAL;\n if (keep_source) flags |= F_HAS_SOURCE;\n if (b.vardefs.length !== b.arg_count + b.var_count) throw new BCWriteError('inconsistent variable count');\n out.u8(BCTag.FUNCTION_BYTECODE);\n out.leb(flags);\n out.u8(b.js_mode);\n out.u8(b.func_kind);\n this.atom(b.func_name);\n out.leb(b.arg_count);\n out.leb(b.var_count);\n out.leb(b.defined_arg_count);\n out.leb(b.stack_size);\n out.leb(b.closure_var.length);\n out.leb(b.cpool.length);\n out.leb(b.byte_code_len);\n for (const vd of b.vardefs) {\n this.atom(vd.var_name);\n out.leb(vd.scope_level);\n out.sleb(vd.scope_next);\n out.u8((vd.is_const ? V_CONST : 0) | (vd.is_lexical ? V_LEXICAL : 0) | (vd.is_captured ? V_CAPTURED : 0) |\n (vd.is_static_private ? V_STATIC_PRIVATE : 0));\n out.u8(vd.var_kind);\n out.sleb(vd.func_pool_idx);\n }\n for (const cv of b.closure_var) {\n this.atom(cv.var_name);\n out.leb(cv.var_idx);\n out.u8((cv.is_const ? V_CONST : 0) | (cv.is_lexical ? V_LEXICAL : 0) | (cv.is_local ? V_LOCAL : 0) |\n (cv.is_arg ? V_ARG : 0));\n out.u8(cv.var_kind);\n }\n out.bytes(this.byte_code(b));\n if (b.has_debug) {\n this.atom(b.debug.filename);\n const pc2line = b.debug.pc2line;\n if (pc2line === null) out.leb(0);\n else { out.leb(pc2line.length); out.bytes(pc2line); }\n if (keep_source) out.leb(this.string_ref(b.debug.source!));\n }\n for (const v of b.cpool) this.value(v);\n }\n\n /* a compiled module (JS_WriteModule): its requests, entries and body function */\n module(m: JSModuleDef): void {\n const out = this.out;\n out.u8(BCTag.MODULE);\n this.atom(m.module_name);\n out.leb(m.req_module_entries.length);\n for (const rme of m.req_module_entries) {\n this.atom(rme.module_name);\n if (rme.attributes === null) {\n out.leb(0);\n } else {\n const keys = Object.keys(rme.attributes);\n out.leb(keys.length + 1);\n for (const k of keys) { out.leb(this.string_ref(k)); out.leb(this.string_ref(rme.attributes[k])); }\n }\n }\n out.leb(m.export_entries.length);\n for (const me of m.export_entries) {\n out.u8(me.export_type);\n if (me.export_type === JSExportType.LOCAL) {\n out.leb(me.var_idx);\n } else {\n out.leb(me.req_module_idx);\n this.atom(me.local_name);\n }\n this.atom(me.export_name);\n }\n out.leb(m.star_export_entries.length);\n for (const se of m.star_export_entries) out.leb(se.req_module_idx);\n out.leb(m.import_entries.length);\n for (const mi of m.import_entries) {\n out.leb(mi.var_idx);\n out.u8(mi.is_star ? 1 : 0);\n this.atom(mi.import_name);\n out.leb(mi.req_module_idx);\n }\n out.u8(m.has_tla ? 1 : 0);\n this.function(m.func_bytecode!);\n }\n\n /* the byte code with its atom operands renumbered (JS_WriteFunctionBytecode) */\n byte_code(b: JSFunctionBytecode): Uint8Array {\n const len = b.byte_code_len;\n const bc = b.byte_code_buf.slice(0, len);\n let pos = 0;\n while (pos < len) {\n const op = bc[pos], size = OP_SIZE[op];\n if (size === 0) throw new BCWriteError(`invalid opcode ${op} at pc ${pos}`);\n if (OP_KIND[op] === OPK_ATOM && pos + 5 <= len) {\n const atom = (bc[pos + 1] | (bc[pos + 2] << 8) | (bc[pos + 3] << 16) | (bc[pos + 4] << 24)) >>> 0;\n const v = this.atom_to_idx(atom);\n bc[pos + 1] = v; bc[pos + 2] = v >>> 8; bc[pos + 3] = v >>> 16; bc[pos + 4] = v >>> 24;\n }\n pos += size;\n }\n if (pos !== len) throw new BCWriteError('truncated instruction at the end of the byte code');\n return bc;\n }\n\n finish(body: ByteBuf): Uint8Array {\n const out = new ByteBuf();\n for (const c of BC_MAGIC) out.u8(c);\n out.u8(BC_FORMAT);\n out.leb(JSEPTION_VERSION.length);\n for (let i = 0; i < JSEPTION_VERSION.length; i++) out.u8(JSEPTION_VERSION.charCodeAt(i));\n out.leb(this.flags & JS_WRITE_OBJ_SOURCE ? BC_FLAG_SOURCE : 0);\n /* string table */\n const strings = this.strings;\n out.leb(strings.length);\n let narrow_len = 0, wide_len = 0;\n const wide: boolean[] = [];\n for (const s of strings) {\n let w = false;\n for (let i = 0; i < s.length; i++) if (s.charCodeAt(i) > 0xff) { w = true; break; }\n wide.push(w);\n out.leb(s.length * 2 + (w ? 1 : 0));\n if (w) wide_len += s.length; else narrow_len += s.length;\n }\n out.leb(narrow_len);\n const narrow = new Uint8Array(narrow_len);\n let p = 0;\n for (let k = 0; k < strings.length; k++) {\n if (wide[k]) continue;\n const s = strings[k];\n for (let i = 0; i < s.length; i++) narrow[p++] = s.charCodeAt(i);\n }\n out.bytes(narrow);\n out.leb(wide_len * 2);\n const wbuf = new Uint8Array(wide_len * 2);\n p = 0;\n for (let k = 0; k < strings.length; k++) {\n if (!wide[k]) continue;\n const s = strings[k];\n for (let i = 0; i < s.length; i++) { const c = s.charCodeAt(i); wbuf[p++] = c; wbuf[p++] = c >>> 8; }\n }\n out.bytes(wbuf);\n /* atom table */\n out.leb(this.atoms.length);\n for (const i of this.atoms) out.leb(i);\n out.bytes(body.buf.subarray(0, body.len));\n const [a, b] = checksum(out.buf, out.len);\n for (const v of [a, b]) { out.u8(v & 0xff); out.u8((v >>> 8) & 0xff); out.u8((v >>> 16) & 0xff); out.u8(v >>> 24); }\n return out.result();\n }\n}\n\nfunction describe(v: unknown): string {\n if (typeof v === 'function') return 'function object';\n if (Array.isArray(v)) return 'array';\n if (typeof v === 'object' && v !== null) return 'object';\n return typeof v;\n}\n\nconst CHECKSUM_SIZE = 8;\n\n/* Fletcher-style sums of buf[0, end) taken as little-endian 32-bit words (the tail bytewise):\n detects truncation and corrupted bytes, at a quarter of the cost of a bytewise checksum\n (it is not a defence against deliberate tampering) */\nfunction checksum(buf: Uint8Array, end: number): [number, number] {\n const n = end >>> 2;\n let a = 1, b = 0;\n if (LITTLE_ENDIAN) {\n if (buf.byteOffset & 3) buf = buf.slice(0, end);\n const w = new Int32Array(buf.buffer, buf.byteOffset, n);\n for (let i = 0; i < n; i++) { a = (a + w[i]) | 0; b = (b + a) | 0; }\n } else {\n for (let i = 0; i < n; i++) {\n const p = i * 4;\n a = (a + (buf[p] | (buf[p + 1] << 8) | (buf[p + 2] << 16) | (buf[p + 3] << 24))) | 0; b = (b + a) | 0;\n }\n }\n for (let i = n * 4; i < end; i++) { a = (a + buf[i]) | 0; b = (b + a) | 0; }\n return [a >>> 0, b >>> 0];\n}\n\n/* Serialize the function returned by JS_Eval(..., JS_EVAL_FLAG_COMPILE_ONLY) (or any\n bytecode function that does not close over variables). Returns null with a pending\n exception on failure. */\nexport function JS_WriteObject(ctx: JSContext, obj: JSValue, flags = 0): Uint8Array | null {\n if (obj instanceof JSModuleDef) {\n /* a module compiled with JS_EVAL_TYPE_MODULE | JS_EVAL_FLAG_COMPILE_ONLY */\n if (obj.kind !== JSModuleKind.JS || obj.func_bytecode === null) {\n JS_ThrowTypeError(ctx, 'JS_WriteObject: only JavaScript modules can be written');\n return null;\n }\n const w = new BCWriter(ctx, flags);\n try {\n w.module(obj);\n return w.finish(w.out);\n } catch (e) {\n if (e instanceof BCWriteError) { JS_ThrowTypeError(ctx, 'JS_WriteObject: ' + e.message); return null; }\n throw e;\n }\n }\n const fd = JS_GetFunctionData(obj);\n if (fd === null) {\n JS_ThrowTypeError(ctx, 'JS_WriteObject: not a bytecode function (expected the result of JS_EVAL_FLAG_COMPILE_ONLY)');\n return null;\n }\n const b = fd.function_bytecode;\n if (b.closure_var.length !== 0) {\n JS_ThrowTypeError(ctx, 'JS_WriteObject: the function closes over variables of an enclosing scope');\n return null;\n }\n const w = new BCWriter(ctx, flags);\n try {\n w.function(b);\n const body = w.out;\n return w.finish(body);\n } catch (e) {\n if (e instanceof BCWriteError) { JS_ThrowTypeError(ctx, 'JS_WriteObject: ' + e.message); return null; }\n throw e;\n }\n}\n\n/* ---------------------------------------------------------------------\n Reader\n --------------------------------------------------------------------- */\n\nclass BCReadError extends Error {}\n\nconst MAX_DEPTH = 2000;\n/* parser limits (define_var / add_arg: at most 65534 each; compute_stack_size: JS_STACK_SIZE_MAX) */\nconst MAX_LOCALS = 65535;\nconst MAX_STACK_SIZE = 65534;\n\nclass BCReader {\n pos = 0;\n end: number;\n strings: string[] = [];\n atoms: JSAtom[] = [];\n keep_source = false;\n depth = 0;\n private f64 = new Float64Array(1);\n private f64b = new Uint8Array(this.f64.buffer);\n buf: Uint8Array;\n /* the reader works on a private copy of the input: the byte code is patched in place and\n the functions keep views of it (one copy instead of two per function) */\n constructor(public ctx: JSContext, input: Uint8Array) { this.buf = input.slice(); this.end = this.buf.length; }\n\n fail(msg: string): never { throw new BCReadError(msg); }\n truncated(): never { throw new BCReadError('read after the end of the buffer'); }\n\n u8(): number {\n if (this.pos >= this.end) this.truncated();\n return this.buf[this.pos++];\n }\n leb(): number {\n const buf = this.buf;\n let pos = this.pos;\n if (pos >= this.end) this.truncated();\n let a = buf[pos++];\n if (a < 0x80) { this.pos = pos; return a; }\n let v = a & 0x7f, mul = 0x80;\n for (let i = 1; ; i++) {\n if (pos >= this.end) this.truncated();\n if (i >= 5) this.fail('invalid LEB128 number');\n a = buf[pos++];\n v += (a & 0x7f) * mul;\n if (a < 0x80) break;\n mul *= 0x80;\n }\n if (v > 0xffffffff) this.fail('invalid LEB128 number');\n this.pos = pos;\n return v;\n }\n sleb(): number {\n const v = this.leb();\n return (v % 2 === 1) ? -((v + 1) / 2) : v / 2;\n }\n f64v(): number {\n if (this.pos + 8 > this.end) this.truncated();\n const b = this.f64b, buf = this.buf;\n if (LITTLE_ENDIAN) for (let i = 0; i < 8; i++) b[i] = buf[this.pos++];\n else for (let i = 7; i >= 0; i--) b[i] = buf[this.pos++];\n return this.f64[0];\n }\n /* a count whose items each take at least one byte */\n count(): number {\n const n = this.leb();\n if (n > this.end - this.pos) this.truncated();\n return n;\n }\n bytes(n: number): Uint8Array {\n if (n > this.end - this.pos) this.truncated();\n const r = this.buf.subarray(this.pos, this.pos + n);\n this.pos += n;\n return r;\n }\n string(): string {\n const i = this.leb();\n if (i >= this.strings.length) this.fail(`invalid string index ${i}`);\n return this.strings[i];\n }\n\n /* bc_idx_to_atom */\n idx_to_atom(v: number): JSAtom {\n if (v < JS_ATOM_END || v >= JS_ATOM_TAG_INT) return v;\n const i = v - JS_ATOM_END;\n if (i >= this.atoms.length) this.fail(`invalid atom index ${v}`);\n return this.atoms[i];\n }\n atom(): JSAtom { return this.idx_to_atom(this.leb()); }\n\n header(): void {\n const buf = this.buf;\n if (buf.length < BC_MAGIC.length + 2 + CHECKSUM_SIZE) this.truncated();\n for (let i = 0; i < BC_MAGIC.length; i++) if (buf[i] !== BC_MAGIC[i]) this.fail('not jseption bytecode (bad magic number)');\n this.pos = BC_MAGIC.length;\n const format = this.u8();\n const vlen = this.leb();\n if (vlen > 64) this.fail('not jseption bytecode (bad header)');\n if (vlen > this.end - this.pos) this.truncated();\n let version = '';\n for (let i = 0; i < vlen; i++) version += String.fromCharCode(buf[this.pos++]);\n if (format !== BC_FORMAT || version !== JSEPTION_VERSION)\n this.fail(`bytecode version mismatch: written by jseption ${version} (format ${format}), ` +\n `this is jseption ${JSEPTION_VERSION} (format ${BC_FORMAT})`);\n /* everything after the version is covered by the checksum */\n if (buf.length - CHECKSUM_SIZE < this.pos) this.truncated();\n this.end = buf.length - CHECKSUM_SIZE;\n const [a, b] = checksum(buf, this.end);\n const u32 = (p: number) => (buf[p] | (buf[p + 1] << 8) | (buf[p + 2] << 16) | (buf[p + 3] << 24)) >>> 0;\n if (u32(this.end) !== a || u32(this.end + 4) !== b) this.fail('checksum mismatch (truncated or corrupted bytecode)');\n const flags = this.leb();\n if (flags & ~BC_FLAG_SOURCE) this.fail('unknown flags');\n this.keep_source = (flags & BC_FLAG_SOURCE) !== 0;\n }\n\n string_table(): void {\n const n = this.count();\n const lens = new Array<number>(n);\n let narrow_len = 0, wide_len = 0;\n for (let i = 0; i < n; i++) {\n const v = this.leb();\n lens[i] = v;\n if (v & 1) wide_len += (v - 1) / 2; else narrow_len += v / 2;\n }\n if (this.leb() !== narrow_len) this.fail('inconsistent string table');\n if (narrow_len > this.end - this.pos) this.truncated();\n const narrow = latin1_decode(this.buf, this.pos, this.pos + narrow_len);\n this.pos += narrow_len;\n if (this.leb() !== wide_len * 2) this.fail('inconsistent string table');\n if (wide_len * 2 > this.end - this.pos) this.truncated();\n const wide = utf16_decode(this.buf, this.pos, wide_len);\n this.pos += wide_len * 2;\n const strings = this.strings = new Array<string>(n);\n let np = 0, wp = 0;\n for (let i = 0; i < n; i++) {\n const v = lens[i];\n if (v & 1) { const l = (v - 1) / 2; strings[i] = wide.slice(wp, wp + l); wp += l; }\n else { const l = v / 2; strings[i] = narrow.slice(np, np + l); np += l; }\n }\n }\n\n atom_table(): void {\n const n = this.count();\n const atoms = this.atoms = new Array<JSAtom>(n);\n const table = this.ctx.rt.atoms;\n for (let i = 0; i < n; i++) atoms[i] = table.newAtomStr(this.string());\n }\n\n value(): JSValue | JSFunctionBytecode {\n const tag = this.u8();\n switch (tag) {\n case BCTag.NULL: return null;\n case BCTag.UNDEFINED: return undefined;\n case BCTag.FALSE: return false;\n case BCTag.TRUE: return true;\n case BCTag.INT32: {\n const v = this.sleb();\n if ((v | 0) !== v) this.fail('invalid int32');\n return v;\n }\n case BCTag.FLOAT64: return this.f64v();\n case BCTag.STRING: return this.string();\n case BCTag.BIG_INT: {\n const s = this.string();\n if (!/^-?[0-9]+$/.test(s)) this.fail('invalid BigInt');\n return BigInt(s);\n }\n case BCTag.FUNCTION_BYTECODE: return this.function();\n case BCTag.TEMPLATE_OBJECT: return this.template();\n }\n return this.fail(`invalid tag ${tag} at offset ${this.pos - 1}`);\n }\n\n template(): JSValue {\n const ctx = this.ctx;\n const n = this.count();\n const arr = JS_NewArray(ctx), raw = JS_NewArray(ctx);\n if (JS_IsException(arr) || JS_IsException(raw)) this.fail('out of memory');\n for (let i = 0; i < n; i++) {\n const c = this.leb();\n let cooked: string | undefined;\n if (c !== 0) {\n if (c > this.strings.length) this.fail(`invalid string index ${c - 1}`);\n cooked = this.strings[c - 1];\n }\n JS_DefinePropertyValueUint32(ctx, raw, i, this.string(), JS_PROP_ENUMERABLE);\n JS_DefinePropertyValueUint32(ctx, arr, i, cooked, JS_PROP_ENUMERABLE);\n }\n JS_DefinePropertyValue(ctx, arr, JS_ATOM_raw, raw, 0);\n Object.freeze(raw as object);\n Object.freeze(arr as object);\n return arr;\n }\n\n function(): JSFunctionBytecode {\n if (++this.depth > MAX_DEPTH) this.fail('functions nested too deeply');\n const b = new JSFunctionBytecode();\n const flags = this.leb();\n if (flags >= F_HAS_SOURCE << 1) this.fail('invalid function flags');\n b.has_prototype = (flags & F_HAS_PROTOTYPE) !== 0;\n b.has_simple_parameter_list = (flags & F_SIMPLE_PARAMS) !== 0;\n b.is_derived_class_constructor = (flags & F_DERIVED_CTOR) !== 0;\n b.need_home_object = (flags & F_HOME_OBJECT) !== 0;\n b.new_target_allowed = (flags & F_NEW_TARGET) !== 0;\n b.super_call_allowed = (flags & F_SUPER_CALL) !== 0;\n b.super_allowed = (flags & F_SUPER) !== 0;\n b.arguments_allowed = (flags & F_ARGUMENTS) !== 0;\n b.has_debug = (flags & F_HAS_DEBUG) !== 0;\n b.is_direct_or_indirect_eval = (flags & F_EVAL) !== 0;\n b.js_mode = this.u8();\n const kind = this.u8();\n if (kind > JSFunctionKind.ASYNC_GENERATOR) this.fail('invalid function kind');\n b.func_kind = kind;\n b.func_name = this.atom();\n b.arg_count = this.count();\n b.var_count = this.count();\n b.defined_arg_count = this.leb();\n b.stack_size = this.leb();\n /* the parser's limits: the interpreter sizes each frame from these, so an out-of-range\n value would make it allocate a huge frame instead of failing here */\n if (b.arg_count >= MAX_LOCALS || b.var_count >= MAX_LOCALS) this.fail('too many variables');\n if (b.defined_arg_count > b.arg_count) this.fail('invalid defined argument count');\n if (b.stack_size > MAX_STACK_SIZE) this.fail(`invalid stack size ${b.stack_size}`);\n const closure_count = this.count();\n const cpool_count = this.count();\n const bc_len = this.count();\n const nvars = b.arg_count + b.var_count;\n const vardefs = b.vardefs = new Array<JSVarDef>(nvars);\n for (let i = 0; i < nvars; i++) {\n const vd = new JSVarDef(this.atom());\n vd.scope_level = this.leb();\n vd.scope_next = this.sleb();\n const f = this.u8();\n vd.is_const = (f & V_CONST) !== 0;\n vd.is_lexical = (f & V_LEXICAL) !== 0;\n vd.is_captured = (f & V_CAPTURED) !== 0;\n vd.is_static_private = (f & V_STATIC_PRIVATE) !== 0;\n const k = this.u8();\n if (k > VAR_KIND_MAX) this.fail('invalid variable kind');\n vd.var_kind = k;\n vd.func_pool_idx = this.sleb();\n vardefs[i] = vd;\n }\n const closure_var = b.closure_var = new Array<JSClosureVar>(closure_count);\n for (let i = 0; i < closure_count; i++) {\n const cv = new JSClosureVar();\n cv.var_name = this.atom();\n cv.var_idx = this.leb();\n const f = this.u8();\n cv.is_const = (f & V_CONST) !== 0;\n cv.is_lexical = (f & V_LEXICAL) !== 0;\n cv.is_local = (f & V_LOCAL) !== 0;\n cv.is_arg = (f & V_ARG) !== 0;\n const k = this.u8();\n if (k > VAR_KIND_MAX) this.fail('invalid variable kind');\n cv.var_kind = k;\n closure_var[i] = cv;\n }\n const bc = this.bytes(bc_len);\n b.byte_code_buf = bc;\n b.byte_code_len = bc_len;\n if (b.has_debug) {\n b.debug.filename = this.atom();\n const n = this.leb();\n b.debug.pc2line = this.bytes(n);\n if (flags & F_HAS_SOURCE) {\n if (!this.keep_source) this.fail('invalid function flags');\n const src = this.string();\n b.debug.source = src;\n b.debug.source_len = src.length;\n }\n } else if (flags & F_HAS_SOURCE) {\n this.fail('invalid function flags');\n }\n const cpool = b.cpool = new Array<JSValue | JSFunctionBytecode>(cpool_count);\n for (let i = 0; i < cpool_count; i++) cpool[i] = this.value();\n this.fixup_byte_code(b);\n b.realm = this.ctx;\n this.depth--;\n return b;\n }\n\n /* a compiled module (JS_ReadModule) */\n module(): JSModuleDef {\n const m = new JSModuleDef(this.atom());\n m.realm = this.ctx;\n const nreq = this.count();\n for (let i = 0; i < nreq; i++) {\n const name = this.atom();\n const n = this.leb();\n let attrs: Record<string, string> | null = null;\n if (n > 0) {\n if (n - 1 > this.end - this.pos) this.truncated();\n attrs = Object.create(null);\n for (let j = 0; j < n - 1; j++) { const k = this.string(); attrs![k] = this.string(); }\n }\n m.req_module_entries.push(new JSReqModuleEntry(name, attrs));\n }\n const req_idx = (): number => {\n const i = this.leb();\n if (i >= nreq) this.fail(`invalid module request index ${i}`);\n return i;\n };\n const nexp = this.count();\n const local_exports: number[] = [];\n for (let i = 0; i < nexp; i++) {\n const type = this.u8();\n let me: JSExportEntry;\n if (type === JSExportType.LOCAL) {\n const var_idx = this.leb();\n local_exports.push(var_idx);\n me = new JSExportEntry(0, this.atom(), JSExportType.LOCAL);\n me.var_idx = var_idx;\n me.local_name = me.export_name;\n } else if (type === JSExportType.INDIRECT) {\n const idx = req_idx();\n const local_name = this.atom();\n me = new JSExportEntry(local_name, this.atom(), JSExportType.INDIRECT);\n me.req_module_idx = idx;\n } else {\n this.fail('invalid export entry');\n }\n m.export_entries.push(me!);\n }\n const nstar = this.count();\n for (let i = 0; i < nstar; i++) m.star_export_entries.push(new JSStarExportEntry(req_idx()));\n const nimp = this.count();\n const imports: { var_idx: number; is_star: boolean }[] = [];\n for (let i = 0; i < nimp; i++) {\n const var_idx = this.leb();\n const is_star = this.u8();\n if (is_star > 1) this.fail('invalid import entry');\n const mi = new JSImportEntry(var_idx, is_star === 1, this.atom());\n mi.req_module_idx = req_idx();\n m.import_entries.push(mi);\n imports.push({ var_idx, is_star: is_star === 1 });\n }\n const tla = this.u8();\n if (tla > 1) this.fail('invalid module flags');\n m.has_tla = tla === 1;\n if (this.u8() !== BCTag.FUNCTION_BYTECODE) this.fail('the module body is not a function');\n const b = this.function();\n if (b.func_kind !== JSFunctionKind.ASYNC) this.fail('the module body is not an async function');\n /* the entries index the closure variables of the body */\n const ncv = b.closure_var.length;\n for (const v of local_exports) if (v >= ncv) this.fail(`invalid export variable index ${v}`);\n for (const { var_idx, is_star } of imports) {\n if (var_idx >= ncv) this.fail(`invalid import variable index ${var_idx}`);\n if (b.closure_var[var_idx].is_local !== is_star) this.fail('invalid import variable');\n }\n js_module_set_function(m, b);\n return m;\n }\n\n /* patch the atom operands and check the instruction boundaries and the constant pool\n indices (JS_ReadFunctionBytecode) */\n fixup_byte_code(b: JSFunctionBytecode): void {\n const bc = b.byte_code_buf, len = b.byte_code_len, cpool = b.cpool;\n let pos = 0;\n const natoms = this.atoms.length, atoms = this.atoms;\n while (pos < len) {\n const op = bc[pos], size = OP_SIZE[op];\n if (size === 0) this.fail(`invalid opcode ${op} at pc ${pos}`);\n if (pos + size > len) this.fail(`truncated instruction at pc ${pos}`);\n const kind = OP_KIND[op];\n if (kind !== 0) {\n if (kind === OPK_ATOM) {\n const v = (bc[pos + 1] | (bc[pos + 2] << 8) | (bc[pos + 3] << 16) | (bc[pos + 4] << 24)) >>> 0;\n if (v >= JS_ATOM_END && v < JS_ATOM_TAG_INT) {\n const i = v - JS_ATOM_END;\n if (i >= natoms) this.fail(`invalid atom index ${v} at pc ${pos}`);\n const atom = atoms[i];\n bc[pos + 1] = atom; bc[pos + 2] = atom >>> 8; bc[pos + 3] = atom >>> 16; bc[pos + 4] = atom >>> 24;\n }\n } else {\n const idx = (kind === OPK_CONST8 || kind === OPK_FCLOSURE8) ? bc[pos + 1]\n : (bc[pos + 1] | (bc[pos + 2] << 8) | (bc[pos + 3] << 16) | (bc[pos + 4] << 24)) >>> 0;\n if (idx >= cpool.length) this.fail(`invalid constant pool index ${idx} at pc ${pos}`);\n if (kind >= OPK_FCLOSURE && !(cpool[idx] instanceof JSFunctionBytecode))\n this.fail(`closure of a constant that is not a function at pc ${pos}`);\n }\n }\n pos += size;\n }\n }\n}\n\n/* buf[start, end) as a Latin-1 string */\nfunction latin1_decode(buf: Uint8Array, start: number, end: number): string {\n const CHUNK = 8192;\n if (end - start <= CHUNK) return String.fromCharCode.apply(null, buf.subarray(start, end) as unknown as number[]);\n const parts: string[] = [];\n for (let i = start; i < end; i += CHUNK)\n parts.push(String.fromCharCode.apply(null, buf.subarray(i, Math.min(end, i + CHUNK)) as unknown as number[]));\n return parts.join('');\n}\n\n/* n UTF-16LE code units at buf[start] as a string (lone surrogates preserved) */\nfunction utf16_decode(buf: Uint8Array, start: number, n: number): string {\n if (n === 0) return '';\n let units: Uint16Array;\n if (LITTLE_ENDIAN) {\n units = new Uint16Array(buf.slice(start, start + 2 * n).buffer);\n } else {\n units = new Uint16Array(n);\n for (let i = 0; i < n; i++) units[i] = buf[start + 2 * i] | (buf[start + 2 * i + 1] << 8);\n }\n const CHUNK = 8192;\n const parts: string[] = [];\n for (let i = 0; i < n; i += CHUNK)\n parts.push(String.fromCharCode.apply(null, units.subarray(i, Math.min(n, i + CHUNK)) as unknown as number[]));\n return parts.join('');\n}\n\n/* Read bytes produced by JS_WriteObject into this context. Returns a function object to\n run with JS_EvalFunction, or JS_EXCEPTION with a SyntaxError pending when the input is\n not valid bytecode of this jseption version. */\nexport function JS_ReadObject(ctx: JSContext, buf: Uint8Array): JSValue {\n if (!(buf instanceof Uint8Array)) return JS_ThrowTypeError(ctx, 'JS_ReadObject: expected a Uint8Array');\n const r = new BCReader(ctx, buf);\n let b: JSFunctionBytecode;\n try {\n r.header();\n r.string_table();\n r.atom_table();\n const tag = r.u8();\n if (tag === BCTag.MODULE) {\n const m = r.module();\n if (r.pos !== r.end) r.fail('trailing bytes after the root value');\n return m as unknown as JSValue;\n }\n if (tag !== BCTag.FUNCTION_BYTECODE) r.fail('the root value is not a function');\n b = r.function();\n if (r.pos !== r.end) r.fail('trailing bytes after the root value');\n } catch (e) {\n if (e instanceof BCReadError) return JS_ThrowSyntaxError(ctx, 'JS_ReadObject: ' + e.message);\n if (e instanceof RangeError) return JS_ThrowSyntaxError(ctx, 'JS_ReadObject: ' + e.message);\n throw e;\n }\n if (b.closure_var.length !== 0) return JS_ThrowSyntaxError(ctx, 'JS_ReadObject: the root function has closure variables');\n return hooks.js_closure(ctx, b, null, null);\n}\n\n\nhooks_bytecode.read = (ctx, bytes) => JS_ReadObject(ctx, bytes);\n"]}
package/dist/embed.d.ts CHANGED
@@ -13,6 +13,11 @@ export declare function guestErrorToHost(ctx: JSContext, exc: JSValue): Error;
13
13
  export declare function toGuest(ctx: JSContext, value: unknown, opts?: ToGuestOptions): JSValue;
14
14
  export declare function hostFunction(ctx: JSContext, fn: (...args: any[]) => unknown, name?: string, length?: number, opts?: ToGuestOptions): JSValue;
15
15
  export declare function hostPromise(ctx: JSContext, p: PromiseLike<unknown>, opts?: ToGuestOptions): JSValue;
16
+ export declare function hostPromiseWith(ctx: JSContext, p: PromiseLike<unknown>, resolve: (v: unknown) => JSValue, reject: (e: unknown) => JSValue): JSValue;
16
17
  export declare function expose(ctx: JSContext, name: string, value: unknown, opts?: ToGuestOptions): void;
17
18
  export declare function fromGuest(ctx: JSContext, value: JSValue): unknown;
19
+ export declare const FROM_GUEST_DEFAULT: unique symbol;
20
+ export type FromGuestHook = (v: JSValue) => unknown;
21
+ export declare function fromGuestWith(ctx: JSContext, value: JSValue, hook: FromGuestHook): unknown;
18
22
  export declare function guestPromiseToHost(ctx: JSContext, promise: JSValue): Promise<unknown>;
23
+ export declare function guestPromiseToHostWith(ctx: JSContext, promise: JSValue, convert: (v: JSValue) => unknown, convertRejection: (e: JSValue) => unknown): Promise<unknown>;
package/dist/embed.js CHANGED
@@ -172,23 +172,30 @@ export function hostFunction(ctx, fn, name = fn.name || 'hostFunction', length =
172
172
  /* a guest promise that settles when the host promise does; guest jobs are
173
173
  run after the settlement so `await` continuations execute promptly */
174
174
  export function hostPromise(ctx, p, opts = {}) {
175
+ return hostPromiseWith(ctx, p, v => toGuest(ctx, v, opts), e => toGuest(ctx, e, opts));
176
+ }
177
+ /* hostPromise with the conversions supplied by the caller (the membrane
178
+ converts results live); `reject` converts a rejection reason or an
179
+ exception thrown by `resolve` */
180
+ export function hostPromiseWith(ctx, p, resolve, reject) {
175
181
  const funcs = [undefined, undefined];
176
182
  const promise = JS_NewPromiseCapability(ctx, funcs);
177
183
  if (JS_IsException(promise))
178
184
  throwGuestException(ctx);
179
- const settle = (fn, v) => {
185
+ const settle = (ok, v) => {
186
+ let fn = ok ? funcs[0] : funcs[1];
180
187
  let g;
181
188
  try {
182
- g = toGuest(ctx, v, opts);
189
+ g = ok ? resolve(v) : reject(v);
183
190
  }
184
191
  catch (e) {
185
192
  fn = funcs[1];
186
- g = toGuest(ctx, e, opts);
193
+ g = reject(e);
187
194
  }
188
195
  JS_Call(ctx, fn, undefined, [g]);
189
196
  drainJobs(ctx);
190
197
  };
191
- p.then(v => settle(funcs[0], v), e => settle(funcs[1], e));
198
+ p.then(v => settle(true, v), e => settle(false, e));
192
199
  return promise;
193
200
  }
194
201
  /* define a global variable in the guest */
@@ -200,9 +207,21 @@ export function expose(ctx, name, value, opts = {}) {
200
207
  functions become host functions (that call into the guest), guest
201
208
  promises become host promises, errors become host Errors */
202
209
  export function fromGuest(ctx, value) {
203
- return fromGuestRec(ctx, value, new Map());
210
+ return fromGuestRec(ctx, value, new Map(), undefined);
211
+ }
212
+ /* returned by a fromGuestWith hook to let the default conversion handle a value */
213
+ export const FROM_GUEST_DEFAULT = Symbol('fromGuest default');
214
+ /* fromGuest with a hook that is offered every value first, at every depth
215
+ (the membrane unwraps its proxies and wraps guest functions this way) */
216
+ export function fromGuestWith(ctx, value, hook) {
217
+ return fromGuestRec(ctx, value, new Map(), hook);
204
218
  }
205
- function fromGuestRec(ctx, v, seen) {
219
+ function fromGuestRec(ctx, v, seen, hook) {
220
+ if (hook !== undefined) {
221
+ const r = hook(v);
222
+ if (r !== FROM_GUEST_DEFAULT)
223
+ return r;
224
+ }
206
225
  if (typeof v === 'function') {
207
226
  return (...args) => {
208
227
  const r = JS_Call(ctx, v, undefined, args.map(a => toGuest(ctx, a)));
@@ -230,14 +249,14 @@ function fromGuestRec(ctx, v, seen) {
230
249
  const m = new Map();
231
250
  seen.set(v, m);
232
251
  for (const [k, val] of Map.prototype.entries.call(o))
233
- m.set(fromGuestRec(ctx, k, seen), fromGuestRec(ctx, val, seen));
252
+ m.set(fromGuestRec(ctx, k, seen, hook), fromGuestRec(ctx, val, seen, hook));
234
253
  return m;
235
254
  }
236
255
  case 35 /* JSClassID.SET */: {
237
256
  const s = new Set();
238
257
  seen.set(v, s);
239
258
  for (const val of Set.prototype.values.call(o))
240
- s.add(fromGuestRec(ctx, val, seen));
259
+ s.add(fromGuestRec(ctx, val, seen, hook));
241
260
  return s;
242
261
  }
243
262
  case 19 /* JSClassID.ARRAY_BUFFER */:
@@ -253,7 +272,7 @@ function fromGuestRec(ctx, v, seen) {
253
272
  const a = [];
254
273
  seen.set(v, a);
255
274
  for (let i = 0; i < o.length; i++)
256
- a[i] = fromGuestRec(ctx, o[i], seen);
275
+ a[i] = fromGuestRec(ctx, o[i], seen, hook);
257
276
  return a;
258
277
  }
259
278
  const r = {};
@@ -262,16 +281,29 @@ function fromGuestRec(ctx, v, seen) {
262
281
  const d = Reflect.getOwnPropertyDescriptor(o, k);
263
282
  if (!d.enumerable)
264
283
  continue;
265
- r[k] = fromGuestRec(ctx, o[k], seen);
284
+ r[k] = fromGuestRec(ctx, o[k], seen, hook);
266
285
  }
267
286
  return r;
268
287
  }
269
288
  /* a host promise that settles when the guest promise does */
270
289
  export function guestPromiseToHost(ctx, promise) {
290
+ return guestPromiseToHostWith(ctx, promise, v => fromGuest(ctx, v), e => fromGuestRejection(ctx, e));
291
+ }
292
+ /* guestPromiseToHost with the conversions supplied by the caller */
293
+ export function guestPromiseToHostWith(ctx, promise, convert, convertRejection) {
271
294
  return new Promise((resolve, reject) => {
272
295
  const then = JS_GetPropertyStr(ctx, promise, 'then');
273
- const onFul = JS_NewCFunction(ctx, (_c, _t, argv) => { resolve(fromGuest(ctx, argv[0])); return undefined; }, 'resolve', 1);
274
- const onRej = JS_NewCFunction(ctx, (_c, _t, argv) => { reject(fromGuestRejection(ctx, argv[0])); return undefined; }, 'reject', 1);
296
+ const settle = (fn, conv, v) => {
297
+ try {
298
+ fn(conv(v));
299
+ }
300
+ catch (e) {
301
+ reject(e);
302
+ }
303
+ return undefined;
304
+ };
305
+ const onFul = JS_NewCFunction(ctx, (_c, _t, argv) => settle(resolve, convert, argv[0]), 'resolve', 1);
306
+ const onRej = JS_NewCFunction(ctx, (_c, _t, argv) => settle(reject, convertRejection, argv[0]), 'reject', 1);
275
307
  const r = JS_Call(ctx, then, promise, [onFul, onRej]);
276
308
  if (JS_IsException(r))
277
309
  reject(guestErrorToHost(ctx, JS_GetException(ctx)));
package/dist/embed.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"embed.js","sourceRoot":"","sources":["../src/embed.ts"],"names":[],"mappings":"AAAA;;;;;;;;oEAQoE;AAEpE,OAAO,EAC0B,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAC1F,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EACrF,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EACrF,oBAAoB,EAAE,eAAe,EAAE,OAAO,GAC/C,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAWjE,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAS;IAC5C,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS;IACxG,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,SAAS;IACtE,MAAM,CAAC,cAAc,CAAC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AC,GAAG,EAAE,MAAM,CAAC,CAAC;AAChC,CAAC","sourcesContent":["/* Embedding helpers: moving values between the host and the guest.\n *\n * Guest values are host values, but the sandbox requires that nothing the\n * guest can reach has a host intrinsic in its prototype chain. A host\n * object therefore cannot be handed to the guest as is: `toGuest` copies\n * plain data into guest objects, wraps host functions in guest functions,\n * and bridges host promises to guest promises. `fromGuest` does the\n * reverse so the host gets ordinary host objects (and can call guest\n * functions / await guest promises). Primitives cross unchanged. */\n\nimport {\n JSContext, JSValue, JSClassID, JS_IsException, JS_IsObject, JS_GetClassID, JS_GetAnyOpaque,\n JS_NewObject, JS_NewArrayFrom, JS_NewCFunction, JS_Call, JS_CallConstructor, JS_Throw,\n JS_GetException, JS_GetPropertyStr, JS_SetPropertyStr, JS_ToString, JS_NewErrorNative,\n JS_ExecutePendingJob, JS_IsJobPending, js_meta,\n} from './quickjs.ts';\nimport { JSErrorEnum } from './values.ts';\nimport { JS_NewPromiseCapability } from './builtins/promise.ts';\nimport { JS_NewDate } from './builtins/date.ts';\nimport { JS_NewArrayBufferCopy } from './builtins/typedarray.ts';\n\nexport interface ToGuestOptions {\n /** convert a host value the default rules reject (class instances); return\n * undefined to fall through to the TypeError */\n custom?: (ctx: JSContext, value: object) => JSValue | undefined;\n /** deep-convert the arguments guest code passes to a wrapped host function\n * into plain host values (default: pass the guest values through) */\n convertArgs?: boolean;\n}\n\nconst HOST_INTRINSIC_PROTOS = new Set<object>([\n Object.prototype, Array.prototype, Function.prototype, Error.prototype, Date.prototype, RegExp.prototype,\n Map.prototype, Set.prototype, Promise.prototype, ArrayBuffer.prototype,\n Object.getPrototypeOf(Uint8Array.prototype),\n]);\n\n/* true if the value is already safe to hand to the guest: engine metadata or\n a prototype chain that never reaches a host intrinsic */\nexport function isGuestValue(v: unknown): boolean {\n if (typeof v === 'function' || (typeof v === 'object' && v !== null)) {\n if (js_meta.has(v as object)) return true;\n let p: object | null = v as object;\n while (p !== null) {\n if (HOST_INTRINSIC_PROTOS.has(p) || p === globalThis) return false;\n p = Object.getPrototypeOf(p);\n }\n return true;\n }\n return true;\n}\n\n/* run the guest job queue (promise reactions) until it is empty */\nexport function drainJobs(ctx: JSContext): void {\n const rt = ctx.rt;\n const pctx = { ctx: null as JSContext | null };\n while (JS_IsJobPending(rt)) JS_ExecutePendingJob(rt, pctx);\n}\n\nfunction guestCtor(ctx: JSContext, name: string): JSValue {\n return JS_GetPropertyStr(ctx, ctx.global_obj, name);\n}\n\nfunction throwGuestException(ctx: JSContext): never {\n throw guestErrorToHost(ctx, JS_GetException(ctx));\n}\n\n/* convert a guest exception value into a host Error for host callers */\nexport function guestErrorToHost(ctx: JSContext, exc: JSValue): Error {\n if (JS_IsObject(exc) && JS_GetClassID(exc) === JSClassID.ERROR) {\n const o = exc as any;\n const err = new Error(String(o.message ?? ''));\n err.name = String(o.name ?? 'Error');\n if (typeof o.stack === 'string') (err as any).guestStack = o.stack;\n return err;\n }\n const err = new Error(typeof exc === 'string' ? exc : String(JS_ToString(ctx, exc)));\n (err as any).guestValue = exc;\n return err;\n}\n\nconst ERROR_KINDS: Record<string, JSErrorEnum> = {\n EvalError: JSErrorEnum.EVAL_ERROR, RangeError: JSErrorEnum.RANGE_ERROR, ReferenceError: JSErrorEnum.REFERENCE_ERROR,\n SyntaxError: JSErrorEnum.SYNTAX_ERROR, TypeError: JSErrorEnum.TYPE_ERROR, URIError: JSErrorEnum.URI_ERROR,\n};\n\n/* host value -> guest value */\nexport function toGuest(ctx: JSContext, value: unknown, opts: ToGuestOptions = {}): JSValue {\n return toGuestRec(ctx, value, opts, new Map());\n}\n\nfunction toGuestRec(ctx: JSContext, v: unknown, opts: ToGuestOptions, seen: Map<object, JSValue>): JSValue {\n switch (typeof v) {\n case 'undefined': case 'boolean': case 'number': case 'string': case 'bigint': case 'symbol':\n return v as JSValue;\n case 'function':\n if (isGuestValue(v)) return v as JSValue;\n return hostFunction(ctx, v as (...args: any[]) => unknown, (v as Function).name, (v as Function).length, opts);\n }\n if (v === null) return null;\n const o = v as any;\n if (isGuestValue(o)) return o;\n const cached = seen.get(o);\n if (cached !== undefined) return cached;\n const remember = (g: JSValue): JSValue => { seen.set(o, g); return g; };\n\n if (typeof o.then === 'function') return remember(hostPromise(ctx, o, opts));\n if (Array.isArray(o)) {\n const arr = JS_NewArrayFrom(ctx, []) as any;\n seen.set(o, arr);\n for (let i = 0; i < o.length; i++) arr[i] = toGuestRec(ctx, o[i], opts, seen);\n return arr;\n }\n if (o instanceof Date) return remember(JS_NewDate(ctx, o.getTime()));\n if (o instanceof RegExp) return remember(construct(ctx, 'RegExp', [o.source, o.flags]));\n if (o instanceof Error) {\n const kind = ERROR_KINDS[o.name] ?? JSErrorEnum.PLAIN_ERROR;\n const err = JS_NewErrorNative(ctx, kind, String(o.message));\n return remember(err);\n }\n if (o instanceof Map) {\n const m = construct(ctx, 'Map', []) as any;\n seen.set(o, m);\n for (const [k, val] of o) m.set(toGuestRec(ctx, k, opts, seen), toGuestRec(ctx, val, opts, seen));\n return m;\n }\n if (o instanceof Set) {\n const s = construct(ctx, 'Set', []) as any;\n seen.set(o, s);\n for (const val of o) s.add(toGuestRec(ctx, val, opts, seen));\n return s;\n }\n if (o instanceof ArrayBuffer) return remember(JS_NewArrayBufferCopy(ctx, new Uint8Array(o)));\n if (ArrayBuffer.isView(o)) {\n const buf = JS_NewArrayBufferCopy(ctx, new Uint8Array(o.buffer, o.byteOffset, o.byteLength));\n const name = (o as any)[Symbol.toStringTag] as string; /* \"Uint8Array\", \"DataView\", ... */\n return remember(construct(ctx, name, [buf]));\n }\n const proto = Object.getPrototypeOf(o);\n if (proto === Object.prototype || proto === null) {\n const g = JS_NewObject(ctx) as any;\n seen.set(o, g);\n for (const k of Reflect.ownKeys(o)) {\n const d = Reflect.getOwnPropertyDescriptor(o, k)!;\n if (!d.enumerable) continue;\n g[k] = toGuestRec(ctx, o[k], opts, seen);\n }\n return g;\n }\n if (opts.custom) {\n const r = opts.custom(ctx, o);\n if (r !== undefined) return remember(r);\n }\n throw new TypeError(`toGuest: cannot pass a host ${proto?.constructor?.name ?? 'object'} to the guest; ` +\n 'pass plain data, functions, promises, or provide a custom converter');\n}\n\nfunction construct(ctx: JSContext, ctorName: string, args: unknown[]): JSValue {\n const r = JS_CallConstructor(ctx, guestCtor(ctx, ctorName), args as JSValue[]);\n if (JS_IsException(r)) throwGuestException(ctx);\n return r;\n}\n\n/* a guest function that calls the host function. Host exceptions become\n guest errors; host return values (including promises) are converted. */\nexport function hostFunction(ctx: JSContext, fn: (...args: any[]) => unknown, name = fn.name || 'hostFunction',\n length = fn.length, opts: ToGuestOptions = {}): JSValue {\n return JS_NewCFunction(ctx, (ctx2: JSContext, this_val: JSValue, argv: JSValue[]) => {\n try {\n const args = opts.convertArgs ? argv.map(a => fromGuest(ctx2, a)) : argv;\n const self = opts.convertArgs ? fromGuest(ctx2, this_val) : this_val;\n return toGuest(ctx2, fn.apply(self, args), opts);\n } catch (e) {\n return JS_Throw(ctx2, toGuest(ctx2, e, opts));\n }\n }, name, length);\n}\n\n/* a guest promise that settles when the host promise does; guest jobs are\n run after the settlement so `await` continuations execute promptly */\nexport function hostPromise(ctx: JSContext, p: PromiseLike<unknown>, opts: ToGuestOptions = {}): JSValue {\n const funcs: [JSValue, JSValue] = [undefined, undefined];\n const promise = JS_NewPromiseCapability(ctx, funcs);\n if (JS_IsException(promise)) throwGuestException(ctx);\n const settle = (fn: JSValue, v: unknown) => {\n let g: JSValue;\n try { g = toGuest(ctx, v, opts); } catch (e) { fn = funcs[1]; g = toGuest(ctx, e, opts); }\n JS_Call(ctx, fn, undefined, [g]);\n drainJobs(ctx);\n };\n p.then(v => settle(funcs[0], v), e => settle(funcs[1], e));\n return promise;\n}\n\n/* define a global variable in the guest */\nexport function expose(ctx: JSContext, name: string, value: unknown, opts: ToGuestOptions = {}): void {\n if (JS_SetPropertyStr(ctx, ctx.global_obj, name, toGuest(ctx, value, opts)) < 0) throwGuestException(ctx);\n}\n\n/* guest value -> plain host value: objects and arrays are copied, guest\n functions become host functions (that call into the guest), guest\n promises become host promises, errors become host Errors */\nexport function fromGuest(ctx: JSContext, value: JSValue): unknown {\n return fromGuestRec(ctx, value, new Map());\n}\n\nfunction fromGuestRec(ctx: JSContext, v: JSValue, seen: Map<object, unknown>): unknown {\n if (typeof v === 'function') {\n return (...args: unknown[]) => {\n const r = JS_Call(ctx, v, undefined, args.map(a => toGuest(ctx, a)));\n if (JS_IsException(r)) throwGuestException(ctx);\n return fromGuest(ctx, r);\n };\n }\n if (typeof v !== 'object' || v === null) return v;\n const cached = seen.get(v);\n if (cached !== undefined) return cached;\n const o = v as any;\n switch (JS_GetClassID(v)) {\n case JSClassID.PROMISE:\n return guestPromiseToHost(ctx, v);\n case JSClassID.DATE:\n return new Date(JS_GetAnyOpaque(v) as number);\n case JSClassID.ERROR:\n return guestErrorToHost(ctx, v);\n case JSClassID.REGEXP:\n return new RegExp(o.source, o.flags);\n case JSClassID.MAP: {\n const m = new Map(); seen.set(v, m);\n for (const [k, val] of Map.prototype.entries.call(o)) m.set(fromGuestRec(ctx, k, seen), fromGuestRec(ctx, val, seen));\n return m;\n }\n case JSClassID.SET: {\n const s = new Set(); seen.set(v, s);\n for (const val of Set.prototype.values.call(o)) s.add(fromGuestRec(ctx, val, seen));\n return s;\n }\n case JSClassID.ARRAY_BUFFER:\n /* the guest object is the host ArrayBuffer re-prototyped: copy it */\n return new Uint8Array(o as ArrayBuffer).slice().buffer;\n }\n if (ArrayBuffer.isView(o)) {\n /* guest typed arrays are host views re-prototyped: copy with the host constructor */\n const Ctor = (globalThis as any)[(o as any)[Symbol.toStringTag]];\n return Ctor ? new Ctor(o as any) : new Uint8Array(o as any);\n }\n if (Array.isArray(o)) {\n const a: unknown[] = []; seen.set(v, a);\n for (let i = 0; i < o.length; i++) a[i] = fromGuestRec(ctx, o[i], seen);\n return a;\n }\n const r: Record<PropertyKey, unknown> = {}; seen.set(v, r);\n for (const k of Reflect.ownKeys(o)) {\n const d = Reflect.getOwnPropertyDescriptor(o, k)!;\n if (!d.enumerable) continue;\n r[k] = fromGuestRec(ctx, o[k], seen);\n }\n return r;\n}\n\n/* a host promise that settles when the guest promise does */\nexport function guestPromiseToHost(ctx: JSContext, promise: JSValue): Promise<unknown> {\n return new Promise((resolve, reject) => {\n const then = JS_GetPropertyStr(ctx, promise, 'then');\n const onFul = JS_NewCFunction(ctx, (_c, _t, argv) => { resolve(fromGuest(ctx, argv[0])); return undefined; }, 'resolve', 1);\n const onRej = JS_NewCFunction(ctx, (_c, _t, argv) => { reject(fromGuestRejection(ctx, argv[0])); return undefined; }, 'reject', 1);\n const r = JS_Call(ctx, then, promise, [onFul, onRej]);\n if (JS_IsException(r)) reject(guestErrorToHost(ctx, JS_GetException(ctx)));\n drainJobs(ctx);\n });\n}\n\nfunction fromGuestRejection(ctx: JSContext, reason: JSValue): unknown {\n if (JS_IsObject(reason) && JS_GetClassID(reason) === JSClassID.ERROR) return guestErrorToHost(ctx, reason);\n return fromGuest(ctx, reason);\n}\n"]}
1
+ {"version":3,"file":"embed.js","sourceRoot":"","sources":["../src/embed.ts"],"names":[],"mappings":"AAAA;;;;;;;;oEAQoE;AAEpE,OAAO,EAC0B,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAC1F,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EACrF,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EACrF,oBAAoB,EAAE,eAAe,EAAE,OAAO,GAC/C,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAWjE,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAS;IAC5C,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,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AC,CAAC,CAAC;QACtD,IAAI,cAAc,CAAC,CAAC,CAAC;YAAE,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC3E,SAAS,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAc,EAAE,MAAe;IACzD,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,aAAa,CAAC,MAAM,CAAC,4BAAoB;QAAE,OAAO,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC3G,OAAO,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AAChC,CAAC","sourcesContent":["/* Embedding helpers: moving values between the host and the guest.\n *\n * Guest values are host values, but the sandbox requires that nothing the\n * guest can reach has a host intrinsic in its prototype chain. A host\n * object therefore cannot be handed to the guest as is: `toGuest` copies\n * plain data into guest objects, wraps host functions in guest functions,\n * and bridges host promises to guest promises. `fromGuest` does the\n * reverse so the host gets ordinary host objects (and can call guest\n * functions / await guest promises). Primitives cross unchanged. */\n\nimport {\n JSContext, JSValue, JSClassID, JS_IsException, JS_IsObject, JS_GetClassID, JS_GetAnyOpaque,\n JS_NewObject, JS_NewArrayFrom, JS_NewCFunction, JS_Call, JS_CallConstructor, JS_Throw,\n JS_GetException, JS_GetPropertyStr, JS_SetPropertyStr, JS_ToString, JS_NewErrorNative,\n JS_ExecutePendingJob, JS_IsJobPending, js_meta,\n} from './quickjs.ts';\nimport { JSErrorEnum } from './values.ts';\nimport { JS_NewPromiseCapability } from './builtins/promise.ts';\nimport { JS_NewDate } from './builtins/date.ts';\nimport { JS_NewArrayBufferCopy } from './builtins/typedarray.ts';\n\nexport interface ToGuestOptions {\n /** convert a host value the default rules reject (class instances); return\n * undefined to fall through to the TypeError */\n custom?: (ctx: JSContext, value: object) => JSValue | undefined;\n /** deep-convert the arguments guest code passes to a wrapped host function\n * into plain host values (default: pass the guest values through) */\n convertArgs?: boolean;\n}\n\nconst HOST_INTRINSIC_PROTOS = new Set<object>([\n Object.prototype, Array.prototype, Function.prototype, Error.prototype, Date.prototype, RegExp.prototype,\n Map.prototype, Set.prototype, Promise.prototype, ArrayBuffer.prototype,\n Object.getPrototypeOf(Uint8Array.prototype),\n]);\n\n/* true if the value is already safe to hand to the guest: engine metadata or\n a prototype chain that never reaches a host intrinsic */\nexport function isGuestValue(v: unknown): boolean {\n if (typeof v === 'function' || (typeof v === 'object' && v !== null)) {\n if (js_meta.has(v as object)) return true;\n let p: object | null = v as object;\n while (p !== null) {\n if (HOST_INTRINSIC_PROTOS.has(p) || p === globalThis) return false;\n p = Object.getPrototypeOf(p);\n }\n return true;\n }\n return true;\n}\n\n/* run the guest job queue (promise reactions) until it is empty */\nexport function drainJobs(ctx: JSContext): void {\n const rt = ctx.rt;\n const pctx = { ctx: null as JSContext | null };\n while (JS_IsJobPending(rt)) JS_ExecutePendingJob(rt, pctx);\n}\n\nfunction guestCtor(ctx: JSContext, name: string): JSValue {\n return JS_GetPropertyStr(ctx, ctx.global_obj, name);\n}\n\nfunction throwGuestException(ctx: JSContext): never {\n throw guestErrorToHost(ctx, JS_GetException(ctx));\n}\n\n/* convert a guest exception value into a host Error for host callers */\nexport function guestErrorToHost(ctx: JSContext, exc: JSValue): Error {\n if (JS_IsObject(exc) && JS_GetClassID(exc) === JSClassID.ERROR) {\n const o = exc as any;\n const err = new Error(String(o.message ?? ''));\n err.name = String(o.name ?? 'Error');\n if (typeof o.stack === 'string') (err as any).guestStack = o.stack;\n return err;\n }\n const err = new Error(typeof exc === 'string' ? exc : String(JS_ToString(ctx, exc)));\n (err as any).guestValue = exc;\n return err;\n}\n\nconst ERROR_KINDS: Record<string, JSErrorEnum> = {\n EvalError: JSErrorEnum.EVAL_ERROR, RangeError: JSErrorEnum.RANGE_ERROR, ReferenceError: JSErrorEnum.REFERENCE_ERROR,\n SyntaxError: JSErrorEnum.SYNTAX_ERROR, TypeError: JSErrorEnum.TYPE_ERROR, URIError: JSErrorEnum.URI_ERROR,\n};\n\n/* host value -> guest value */\nexport function toGuest(ctx: JSContext, value: unknown, opts: ToGuestOptions = {}): JSValue {\n return toGuestRec(ctx, value, opts, new Map());\n}\n\nfunction toGuestRec(ctx: JSContext, v: unknown, opts: ToGuestOptions, seen: Map<object, JSValue>): JSValue {\n switch (typeof v) {\n case 'undefined': case 'boolean': case 'number': case 'string': case 'bigint': case 'symbol':\n return v as JSValue;\n case 'function':\n if (isGuestValue(v)) return v as JSValue;\n return hostFunction(ctx, v as (...args: any[]) => unknown, (v as Function).name, (v as Function).length, opts);\n }\n if (v === null) return null;\n const o = v as any;\n if (isGuestValue(o)) return o;\n const cached = seen.get(o);\n if (cached !== undefined) return cached;\n const remember = (g: JSValue): JSValue => { seen.set(o, g); return g; };\n\n if (typeof o.then === 'function') return remember(hostPromise(ctx, o, opts));\n if (Array.isArray(o)) {\n const arr = JS_NewArrayFrom(ctx, []) as any;\n seen.set(o, arr);\n for (let i = 0; i < o.length; i++) arr[i] = toGuestRec(ctx, o[i], opts, seen);\n return arr;\n }\n if (o instanceof Date) return remember(JS_NewDate(ctx, o.getTime()));\n if (o instanceof RegExp) return remember(construct(ctx, 'RegExp', [o.source, o.flags]));\n if (o instanceof Error) {\n const kind = ERROR_KINDS[o.name] ?? JSErrorEnum.PLAIN_ERROR;\n const err = JS_NewErrorNative(ctx, kind, String(o.message));\n return remember(err);\n }\n if (o instanceof Map) {\n const m = construct(ctx, 'Map', []) as any;\n seen.set(o, m);\n for (const [k, val] of o) m.set(toGuestRec(ctx, k, opts, seen), toGuestRec(ctx, val, opts, seen));\n return m;\n }\n if (o instanceof Set) {\n const s = construct(ctx, 'Set', []) as any;\n seen.set(o, s);\n for (const val of o) s.add(toGuestRec(ctx, val, opts, seen));\n return s;\n }\n if (o instanceof ArrayBuffer) return remember(JS_NewArrayBufferCopy(ctx, new Uint8Array(o)));\n if (ArrayBuffer.isView(o)) {\n const buf = JS_NewArrayBufferCopy(ctx, new Uint8Array(o.buffer, o.byteOffset, o.byteLength));\n const name = (o as any)[Symbol.toStringTag] as string; /* \"Uint8Array\", \"DataView\", ... */\n return remember(construct(ctx, name, [buf]));\n }\n const proto = Object.getPrototypeOf(o);\n if (proto === Object.prototype || proto === null) {\n const g = JS_NewObject(ctx) as any;\n seen.set(o, g);\n for (const k of Reflect.ownKeys(o)) {\n const d = Reflect.getOwnPropertyDescriptor(o, k)!;\n if (!d.enumerable) continue;\n g[k] = toGuestRec(ctx, o[k], opts, seen);\n }\n return g;\n }\n if (opts.custom) {\n const r = opts.custom(ctx, o);\n if (r !== undefined) return remember(r);\n }\n throw new TypeError(`toGuest: cannot pass a host ${proto?.constructor?.name ?? 'object'} to the guest; ` +\n 'pass plain data, functions, promises, or provide a custom converter');\n}\n\nfunction construct(ctx: JSContext, ctorName: string, args: unknown[]): JSValue {\n const r = JS_CallConstructor(ctx, guestCtor(ctx, ctorName), args as JSValue[]);\n if (JS_IsException(r)) throwGuestException(ctx);\n return r;\n}\n\n/* a guest function that calls the host function. Host exceptions become\n guest errors; host return values (including promises) are converted. */\nexport function hostFunction(ctx: JSContext, fn: (...args: any[]) => unknown, name = fn.name || 'hostFunction',\n length = fn.length, opts: ToGuestOptions = {}): JSValue {\n return JS_NewCFunction(ctx, (ctx2: JSContext, this_val: JSValue, argv: JSValue[]) => {\n try {\n const args = opts.convertArgs ? argv.map(a => fromGuest(ctx2, a)) : argv;\n const self = opts.convertArgs ? fromGuest(ctx2, this_val) : this_val;\n return toGuest(ctx2, fn.apply(self, args), opts);\n } catch (e) {\n return JS_Throw(ctx2, toGuest(ctx2, e, opts));\n }\n }, name, length);\n}\n\n/* a guest promise that settles when the host promise does; guest jobs are\n run after the settlement so `await` continuations execute promptly */\nexport function hostPromise(ctx: JSContext, p: PromiseLike<unknown>, opts: ToGuestOptions = {}): JSValue {\n return hostPromiseWith(ctx, p, v => toGuest(ctx, v, opts), e => toGuest(ctx, e, opts));\n}\n\n/* hostPromise with the conversions supplied by the caller (the membrane\n converts results live); `reject` converts a rejection reason or an\n exception thrown by `resolve` */\nexport function hostPromiseWith(ctx: JSContext, p: PromiseLike<unknown>, resolve: (v: unknown) => JSValue,\n reject: (e: unknown) => JSValue): JSValue {\n const funcs: [JSValue, JSValue] = [undefined, undefined];\n const promise = JS_NewPromiseCapability(ctx, funcs);\n if (JS_IsException(promise)) throwGuestException(ctx);\n const settle = (ok: boolean, v: unknown) => {\n let fn = ok ? funcs[0] : funcs[1];\n let g: JSValue;\n try { g = ok ? resolve(v) : reject(v); } catch (e) { fn = funcs[1]; g = reject(e); }\n JS_Call(ctx, fn, undefined, [g]);\n drainJobs(ctx);\n };\n p.then(v => settle(true, v), e => settle(false, e));\n return promise;\n}\n\n/* define a global variable in the guest */\nexport function expose(ctx: JSContext, name: string, value: unknown, opts: ToGuestOptions = {}): void {\n if (JS_SetPropertyStr(ctx, ctx.global_obj, name, toGuest(ctx, value, opts)) < 0) throwGuestException(ctx);\n}\n\n/* guest value -> plain host value: objects and arrays are copied, guest\n functions become host functions (that call into the guest), guest\n promises become host promises, errors become host Errors */\nexport function fromGuest(ctx: JSContext, value: JSValue): unknown {\n return fromGuestRec(ctx, value, new Map(), undefined);\n}\n\n/* returned by a fromGuestWith hook to let the default conversion handle a value */\nexport const FROM_GUEST_DEFAULT: unique symbol = Symbol('fromGuest default');\nexport type FromGuestHook = (v: JSValue) => unknown;\n\n/* fromGuest with a hook that is offered every value first, at every depth\n (the membrane unwraps its proxies and wraps guest functions this way) */\nexport function fromGuestWith(ctx: JSContext, value: JSValue, hook: FromGuestHook): unknown {\n return fromGuestRec(ctx, value, new Map(), hook);\n}\n\nfunction fromGuestRec(ctx: JSContext, v: JSValue, seen: Map<object, unknown>, hook: FromGuestHook | undefined): unknown {\n if (hook !== undefined) {\n const r = hook(v);\n if (r !== FROM_GUEST_DEFAULT) return r;\n }\n if (typeof v === 'function') {\n return (...args: unknown[]) => {\n const r = JS_Call(ctx, v, undefined, args.map(a => toGuest(ctx, a)));\n if (JS_IsException(r)) throwGuestException(ctx);\n return fromGuest(ctx, r);\n };\n }\n if (typeof v !== 'object' || v === null) return v;\n const cached = seen.get(v);\n if (cached !== undefined) return cached;\n const o = v as any;\n switch (JS_GetClassID(v)) {\n case JSClassID.PROMISE:\n return guestPromiseToHost(ctx, v);\n case JSClassID.DATE:\n return new Date(JS_GetAnyOpaque(v) as number);\n case JSClassID.ERROR:\n return guestErrorToHost(ctx, v);\n case JSClassID.REGEXP:\n return new RegExp(o.source, o.flags);\n case JSClassID.MAP: {\n const m = new Map(); seen.set(v, m);\n for (const [k, val] of Map.prototype.entries.call(o)) m.set(fromGuestRec(ctx, k, seen, hook), fromGuestRec(ctx, val, seen, hook));\n return m;\n }\n case JSClassID.SET: {\n const s = new Set(); seen.set(v, s);\n for (const val of Set.prototype.values.call(o)) s.add(fromGuestRec(ctx, val, seen, hook));\n return s;\n }\n case JSClassID.ARRAY_BUFFER:\n /* the guest object is the host ArrayBuffer re-prototyped: copy it */\n return new Uint8Array(o as ArrayBuffer).slice().buffer;\n }\n if (ArrayBuffer.isView(o)) {\n /* guest typed arrays are host views re-prototyped: copy with the host constructor */\n const Ctor = (globalThis as any)[(o as any)[Symbol.toStringTag]];\n return Ctor ? new Ctor(o as any) : new Uint8Array(o as any);\n }\n if (Array.isArray(o)) {\n const a: unknown[] = []; seen.set(v, a);\n for (let i = 0; i < o.length; i++) a[i] = fromGuestRec(ctx, o[i], seen, hook);\n return a;\n }\n const r: Record<PropertyKey, unknown> = {}; seen.set(v, r);\n for (const k of Reflect.ownKeys(o)) {\n const d = Reflect.getOwnPropertyDescriptor(o, k)!;\n if (!d.enumerable) continue;\n r[k] = fromGuestRec(ctx, o[k], seen, hook);\n }\n return r;\n}\n\n/* a host promise that settles when the guest promise does */\nexport function guestPromiseToHost(ctx: JSContext, promise: JSValue): Promise<unknown> {\n return guestPromiseToHostWith(ctx, promise, v => fromGuest(ctx, v), e => fromGuestRejection(ctx, e));\n}\n\n/* guestPromiseToHost with the conversions supplied by the caller */\nexport function guestPromiseToHostWith(ctx: JSContext, promise: JSValue, convert: (v: JSValue) => unknown,\n convertRejection: (e: JSValue) => unknown): Promise<unknown> {\n return new Promise((resolve, reject) => {\n const then = JS_GetPropertyStr(ctx, promise, 'then');\n const settle = (fn: (x: unknown) => void, conv: (v: JSValue) => unknown, v: JSValue): JSValue => {\n try { fn(conv(v)); } catch (e) { reject(e); }\n return undefined;\n };\n const onFul = JS_NewCFunction(ctx, (_c, _t, argv) => settle(resolve, convert, argv[0]), 'resolve', 1);\n const onRej = JS_NewCFunction(ctx, (_c, _t, argv) => settle(reject, convertRejection, argv[0]), 'reject', 1);\n const r = JS_Call(ctx, then, promise, [onFul, onRej]);\n if (JS_IsException(r)) reject(guestErrorToHost(ctx, JS_GetException(ctx)));\n drainJobs(ctx);\n });\n}\n\nfunction fromGuestRejection(ctx: JSContext, reason: JSValue): unknown {\n if (JS_IsObject(reason) && JS_GetClassID(reason) === JSClassID.ERROR) return guestErrorToHost(ctx, reason);\n return fromGuest(ctx, reason);\n}\n"]}