@scriptc/compiler 0.0.5 → 0.0.7
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.
- package/dist/backend/emission/emit-exprs.js +25 -2
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/emission/emit-walkers.js +47 -0
- package/dist/backend/emission/emit-walkers.js.map +1 -1
- package/dist/backend/emission/emitter.js +7 -0
- package/dist/backend/emission/emitter.js.map +1 -1
- package/dist/backend/emission/may-throw.js +12 -0
- package/dist/backend/emission/may-throw.js.map +1 -1
- package/dist/backend/llvm/dyn.js +23 -1
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.js +28 -4
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +5 -0
- package/dist/backend/llvm/walkers.js +65 -5
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +6 -0
- package/dist/diagnostics/diagnostic.js +16 -0
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/frontend/lib-contract.d.ts +96 -0
- package/dist/frontend/lib-contract.js +291 -0
- package/dist/frontend/lib-contract.js.map +1 -0
- package/dist/frontend/lowering/lower-assert.js +41 -1
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +19 -4
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +7 -0
- package/dist/frontend/lowering/lower-inspect.js +130 -28
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +9 -1
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +1 -1
- package/dist/frontend/lowering/lowerer.js +16 -6
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/types.d.ts +68 -6
- package/dist/frontend/types.js +285 -57
- package/dist/frontend/types.js.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.js +60 -1
- package/dist/index.js.map +1 -1
- package/dist/ir/nodes.d.ts +27 -4
- package/dist/ir/nodes.js +105 -13
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/validate.js +10 -0
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/profile.d.ts +36 -0
- package/dist/library/profile.js +105 -3
- package/dist/library/profile.js.map +1 -1
- package/dist/library/sidecar-validate.d.ts +4 -0
- package/dist/library/sidecar-validate.js +506 -0
- package/dist/library/sidecar-validate.js.map +1 -0
- package/dist/library/sidecar.d.ts +191 -0
- package/dist/library/sidecar.js +568 -0
- package/dist/library/sidecar.js.map +1 -0
- package/dist/library/wyhash.d.ts +12 -0
- package/dist/library/wyhash.js +116 -0
- package/dist/library/wyhash.js.map +1 -0
- package/package.json +2 -2
- package/surface-manifest.json +1 -1
|
@@ -6,7 +6,7 @@ import { buildClassGraph, classFieldIndex, classStructSym, emitClassObjDefs, emi
|
|
|
6
6
|
import { DK, LlDyn } from "./dyn.js";
|
|
7
7
|
import { LlvmUnsupportedError } from "./unsupported.js";
|
|
8
8
|
import { LlWalkers } from "./walkers.js";
|
|
9
|
-
import { arrNewCall, boxAccess, boxNewCall, computeTraced, elemAccess, emitRecordShapes, FN_ATTRS, llFieldType, mapKeyAccess, mapKeyKindNum, mapValKindNum, releaseSym, retainSym, traceArg, vAdapters, } from "./shapes.js";
|
|
9
|
+
import { arrNewCall, boxAccess, boxNewCall, computeTraced, elemAccess, emitRecordShapes, FN_ATTRS, llFieldType, mapKeyAccess, mapKeyKindNum, mapValKindNum, releaseSym, retainSym, traceAdapter, traceArg, vAdapters, } from "./shapes.js";
|
|
10
10
|
export { LlvmUnsupportedError } from "./unsupported.js";
|
|
11
11
|
export function emitLlvmModule(mod) {
|
|
12
12
|
return new LlEmitter(mod).emit();
|
|
@@ -159,6 +159,8 @@ const LIB_FN_SYMS = {
|
|
|
159
159
|
"assert.eqDyn": "scr_assert_eq_dyn",
|
|
160
160
|
"assert.deepResult": "scr_assert_deep_result",
|
|
161
161
|
"assert.sameValue": "scr_assert_same_value_f64",
|
|
162
|
+
"assert.deqEnter": "scr_assert_deq_enter",
|
|
163
|
+
"assert.deqLeave": "scr_assert_deq_leave",
|
|
162
164
|
"assert.match": "scr_assert_match",
|
|
163
165
|
"assert.throwsNone": "scr_assert_throws_none",
|
|
164
166
|
"assert.throwsMismatch": "scr_assert_throws_mismatch",
|
|
@@ -229,6 +231,13 @@ const LIB_FN_SYMS = {
|
|
|
229
231
|
"insp.key": "scr_insp_key",
|
|
230
232
|
"insp.moreItems": "scr_insp_more_items",
|
|
231
233
|
"insp.end": "scr_insp_end",
|
|
234
|
+
// Circular references over cycle-capable composites (Node's
|
|
235
|
+
// seen/circular machinery — none of these throw; refWrap borrows its
|
|
236
|
+
// string and answers +1).
|
|
237
|
+
"insp.circCheck": "scr_insp_circ_check",
|
|
238
|
+
"insp.seenPush": "scr_insp_seen_push",
|
|
239
|
+
"insp.refWrap": "scr_insp_ref_wrap",
|
|
240
|
+
"insp.circular": "scr_insp_circular",
|
|
232
241
|
// WHATWG URL + URLSearchParams (scr_url.c / scr_url_params.c):
|
|
233
242
|
// constructions +1; url.new, the fileURLToPath pair, the win32
|
|
234
243
|
// pathToFileURL flavor, and sp.fromPairs throw catchably (may-throw).
|
|
@@ -417,8 +426,8 @@ const LIB_FN_SYMS = {
|
|
|
417
426
|
"net.sockUnshift": "scr_net_sock_unshift_bytes",
|
|
418
427
|
"net.sockPipeRes": "scr_http_sock_pipe_res",
|
|
419
428
|
"net.serverEmitConnection": "scr_net_server_emit_connection",
|
|
420
|
-
"net.getAutoSelTimeout": "
|
|
421
|
-
"net.setAutoSelTimeout": "
|
|
429
|
+
"net.getAutoSelTimeout": "scr_net_get_autosel_timeout",
|
|
430
|
+
"net.setAutoSelTimeout": "scr_net_set_autosel_timeout",
|
|
422
431
|
"http.reqUrl": "scr_http_req_url",
|
|
423
432
|
"http.reqMethod": "scr_http_req_method",
|
|
424
433
|
"http.reqSocket": "scr_http_req_socket",
|
|
@@ -1067,7 +1076,7 @@ class LlEmitter {
|
|
|
1067
1076
|
// slot } — TDZ reads peek the payload slot (offset 40) directly.
|
|
1068
1077
|
`%ScrBox = type { i64, i32, ptr, ptr, ptr, i64 }`,
|
|
1069
1078
|
// The stack buffer of the emitted JSON serializers { data, len, cap }.
|
|
1070
|
-
`%ScrJsonBuf = type { ptr, i64, i64 }`,
|
|
1079
|
+
`%ScrJsonBuf = type { ptr, i64, i64, ptr, i64, i64 }`,
|
|
1071
1080
|
// The dynCheck error-path spine { parent, key, index } — the emitted
|
|
1072
1081
|
// builders stack-allocate one per recursion level (dyn.ts).
|
|
1073
1082
|
`%ScrDynPath = type { ptr, ptr, i64 }`,
|
|
@@ -1258,6 +1267,15 @@ class LlEmitter {
|
|
|
1258
1267
|
return ` store ${ty} ${zero}, ptr @${mangleGlobal(g.id)} ; ${g.name}`;
|
|
1259
1268
|
});
|
|
1260
1269
|
out.push(`define void @${lib.initSymbol}() ${FN_ATTRS} {`, `entry:`, ` call void @scr_library_entry(i1 zeroext true) ; init always resets the result arena`, ...globalReleaseLines("ci"), ...zeroStores, ` call void @scr_library_reset()`, ...stamps, ` call void @${mangleFunction(this.mod.entry)}()`, ` call void @scr_library_check_exc()`, ` ret void`, `}`, ``, `define void @${lib.sinkRegisterSymbol}(ptr %fn, ptr %ctx) ${FN_ATTRS} {`, `entry:`, ` call void @scr_library_set_sink(ptr %fn, ptr %ctx)`, ` ret void`, `}`, ``);
|
|
1270
|
+
if (lib.identity !== undefined) {
|
|
1271
|
+
// Profile-declared identity getters (the ask-2 sidecar's boot-time
|
|
1272
|
+
// pairing fence): pure data returns with NO entry prologue — exempt
|
|
1273
|
+
// from the poisoned guard and every runtime touch (ratified), so a
|
|
1274
|
+
// host can read them before init and after a trap. The u64 rides
|
|
1275
|
+
// i64 two's-complement (LLVM integer constants are signed).
|
|
1276
|
+
const buildId = BigInt.asIntN(64, BigInt(`0x${lib.identity.buildId}`)).toString();
|
|
1277
|
+
out.push(`define i64 @${lib.identity.buildIdSymbol}() ${FN_ATTRS} { ; identity getter build_id 0x${lib.identity.buildId}`, `entry:`, ` ret i64 ${buildId}`, `}`, ``, `define i32 @${lib.identity.abiVersionSymbol}() ${FN_ATTRS} { ; identity getter abi_version`, `entry:`, ` ret i32 ${lib.identity.abiVersion}`, `}`, ``);
|
|
1278
|
+
}
|
|
1261
1279
|
if (lib.resultResetSymbol !== null) {
|
|
1262
1280
|
out.push(`define void @${lib.resultResetSymbol}() ${FN_ATTRS} {`, `entry:`, ` call void @scr_library_entry(i1 zeroext false)`, ` call void @scr_library_arena_reset()`, ` ret void`, `}`, ``);
|
|
1263
1281
|
}
|
|
@@ -4711,6 +4729,12 @@ class LlEmitter {
|
|
|
4711
4729
|
const t = B.tmp();
|
|
4712
4730
|
B.line(`${t} = call ptr @scr_jb_finish(ptr ${buf})`);
|
|
4713
4731
|
compact = this.own({ name: t, type: e.type });
|
|
4732
|
+
// A cycle-capable root can throw the circular-structure
|
|
4733
|
+
// TypeError mid-walk: finish still runs (frees the buffer, the
|
|
4734
|
+
// partial string joins the frame and releases on unwind), then
|
|
4735
|
+
// the pending check unwinds — the C emitter's contract exactly.
|
|
4736
|
+
if (traceAdapter(this, e.value.type) !== null)
|
|
4737
|
+
this.emitPendingCheck();
|
|
4714
4738
|
}
|
|
4715
4739
|
// A pretty-print form (`stringify(v, null, 2)`): the frontend
|
|
4716
4740
|
// resolved the space to a compile-time indent string (Node's
|