@scriptc/compiler 0.0.12 → 0.0.13
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/ambient/scriptc-node-fallback.d.ts +141 -15
- package/dist/backend/cc.d.ts +8 -0
- package/dist/backend/cc.js +12 -0
- package/dist/backend/cc.js.map +1 -1
- package/dist/backend/emission/emit-exprs.js +138 -12
- package/dist/backend/emission/emit-exprs.js.map +1 -1
- package/dist/backend/llvm/emitter.js +43 -6
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/frontend/lowering/crypto-tables.d.ts +7 -0
- package/dist/frontend/lowering/crypto-tables.js +139 -0
- package/dist/frontend/lowering/crypto-tables.js.map +1 -0
- package/dist/frontend/lowering/lower-builtins.d.ts +38 -20
- package/dist/frontend/lowering/lower-builtins.js +111 -39
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +8 -0
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +10 -2
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +69 -7
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +1 -1
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-server.d.ts +21 -0
- package/dist/frontend/lowering/lower-server.js +267 -12
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +4 -4
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +1 -1
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +21 -3
- package/dist/frontend/lowering/lowerer.js +48 -8
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +6 -0
- package/dist/frontend/lowering/surfaces.js +76 -0
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/types.js +12 -0
- package/dist/frontend/types.js.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/ir/nodes.d.ts +99 -9
- package/dist/ir/nodes.js +52 -1
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/validate.js +52 -4
- package/dist/ir/validate.js.map +1 -1
- package/package.json +2 -2
- package/surface-manifest.json +286 -1
|
@@ -226,6 +226,9 @@ const LIB_FN_SYMS = {
|
|
|
226
226
|
"text.decode": "scr_text_decode",
|
|
227
227
|
"zlib.deflateSync": "scr_zlib_deflate",
|
|
228
228
|
"zlib.inflateSync": "scr_zlib_inflate",
|
|
229
|
+
// The CA-store read (tlsca.get/set are may-throw seeds and refuse by
|
|
230
|
+
// omission — the C fallback carries them).
|
|
231
|
+
"tlsca.root": "scr_tls_ca_root",
|
|
229
232
|
"crypto.randomBytes": "scr_crypto_random_bytes",
|
|
230
233
|
"crypto.randomBytesToString": "scr_crypto_random_string",
|
|
231
234
|
"crypto.randomUUID": "scr_crypto_random_uuid",
|
|
@@ -350,6 +353,7 @@ const LIB_FN_SYMS = {
|
|
|
350
353
|
"dyn.iterPack": "scr_dyn_iter_pack",
|
|
351
354
|
"dyn.arrLen": "scr_dyn_arr_len",
|
|
352
355
|
"dyn.arrAt": "scr_dyn_arr_at",
|
|
356
|
+
"dyn.hasKey": "scr_dyn_has_key",
|
|
353
357
|
"dyn.defineProps": "scr_dyn_define_props",
|
|
354
358
|
"dyn.typeof": "scr_dyn_typeof",
|
|
355
359
|
"dyn.toString": "scr_dyn_to_string_method",
|
|
@@ -446,6 +450,12 @@ const LIB_FN_SYMS = {
|
|
|
446
450
|
"net.sockSetEncoding": "scr_net_sock_set_encoding",
|
|
447
451
|
"net.sockSetTimeout": "scr_net_sock_set_timeout",
|
|
448
452
|
"net.sockUnshift": "scr_net_sock_unshift_bytes",
|
|
453
|
+
"net.sockPause": "scr_net_sock_pause",
|
|
454
|
+
"net.sockResume": "scr_net_sock_resume",
|
|
455
|
+
"net.sockSetNoDelay": "scr_net_sock_set_nodelay",
|
|
456
|
+
"net.sockDestroySoon": "scr_net_sock_destroy_soon",
|
|
457
|
+
"net.sockBytesWritten": "scr_net_sock_bytes_written",
|
|
458
|
+
"net.sockReadable": "scr_net_sock_readable",
|
|
449
459
|
"net.sockPipeRes": "scr_http_sock_pipe_res",
|
|
450
460
|
"net.serverEmitConnection": "scr_net_server_emit_connection",
|
|
451
461
|
"net.getAutoSelTimeout": "scr_net_get_autosel_timeout",
|
|
@@ -492,6 +502,7 @@ const LIB_FN_SYMS = {
|
|
|
492
502
|
"http.clientDestroy": "scr_http_client_destroy",
|
|
493
503
|
"http.clientDestroyed": "scr_http_client_destroyed",
|
|
494
504
|
"http2.streamUndefCall": "scr_http2_stream_undef_call",
|
|
505
|
+
"http.agentNew": "scr_http_agent_new",
|
|
495
506
|
// The island surface (--dynamic): eval/import bridge catchably (the
|
|
496
507
|
// may-throw seed's pending check); importDyn answers an engine promise
|
|
497
508
|
// and never throws itself. insp.jsval throws on composite island
|
|
@@ -556,6 +567,9 @@ const LIB_FN_SYMS = {
|
|
|
556
567
|
"process.offWarning": "scr_process_off_warning",
|
|
557
568
|
"process.emitWarning": "scr_process_emit_warning",
|
|
558
569
|
"process.onUnhandledRejection": "scr_process_on_unhandled_rejection",
|
|
570
|
+
"process.offUnhandledRejection": "scr_process_off_unhandled_rejection",
|
|
571
|
+
"process.onRejectionHandled": "scr_process_on_rejection_handled",
|
|
572
|
+
"process.offRejectionHandled": "scr_process_off_rejection_handled",
|
|
559
573
|
// The await lowering's loop hop and the dyn await (both park the
|
|
560
574
|
// current fiber — USES_TIMERS_LIB_FNS marks the loop live).
|
|
561
575
|
"async.hop": "scr_await_hop",
|
|
@@ -633,12 +647,13 @@ const USES_TIMERS_LIB_FNS = new Set([
|
|
|
633
647
|
"http.createServer", "http.createServerEmpty",
|
|
634
648
|
"http.request", "http.requestCb", "http.requestUrl", "http.requestUrlCb",
|
|
635
649
|
"http.requestConn", "http.requestConnCb",
|
|
650
|
+
"http.agentNew", "http.requestAgent", "http.requestAgentCb",
|
|
636
651
|
// The dyn-async slice (emit-exprs.ts's markings): fiber parks, the
|
|
637
652
|
// microtask/immediate mints, the tracing-promise reaction fiber, and
|
|
638
653
|
// the loop-end unhandled-rejection report.
|
|
639
654
|
"async.hop", "async.awaitDyn",
|
|
640
655
|
"dc.tcTracePromise",
|
|
641
|
-
"process.onUnhandledRejection",
|
|
656
|
+
"process.onUnhandledRejection", "process.onRejectionHandled",
|
|
642
657
|
"timers.queueMicrotaskDyn", "timers.setImmediateFnValue", "timers.immediatePromise",
|
|
643
658
|
]);
|
|
644
659
|
/** ScrBytesElem (scr_runtime.h): U8, U32, F32, I32. */
|
|
@@ -4199,8 +4214,21 @@ class LlEmitter {
|
|
|
4199
4214
|
const lj = B.newLabel("ord.j");
|
|
4200
4215
|
B.condBr(truthy, lt, lf);
|
|
4201
4216
|
B.startBlock(lt);
|
|
4202
|
-
|
|
4203
|
-
|
|
4217
|
+
if (e.retag !== undefined) {
|
|
4218
|
+
// Retagged shape: the whole box goes to the union→union helper,
|
|
4219
|
+
// which CONSUMES it (callees own their params) — no release on
|
|
4220
|
+
// this side. The store precedes the pending check so an unwind
|
|
4221
|
+
// leaves only the NULL dummy behind, in a slot nothing reads.
|
|
4222
|
+
const t = B.tmp();
|
|
4223
|
+
B.line(`${t} = call ${ty} @${this.callTarget(e.retag)}(${this.llType(e.left.type)} ${l.name})`);
|
|
4224
|
+
B.line(`store ${ty} ${t}, ptr ${slot}`);
|
|
4225
|
+
if (this.mayThrow.has(e.retag))
|
|
4226
|
+
this.emitPendingCheck();
|
|
4227
|
+
}
|
|
4228
|
+
else {
|
|
4229
|
+
B.line(`store ${ty} ${this.unionExtract(l.name, e.type)}, ptr ${slot}`);
|
|
4230
|
+
this.releaseValue(l.name, e.left.type);
|
|
4231
|
+
}
|
|
4204
4232
|
B.br(lj);
|
|
4205
4233
|
B.startBlock(lf);
|
|
4206
4234
|
this.releaseValue(l.name, e.left.type);
|
|
@@ -10598,9 +10626,11 @@ class LlEmitter {
|
|
|
10598
10626
|
B.line(`call void @${entry}(ptr ${args[0].name}, ptr ${args[1].name}, ptr @${adapter}, i1 ${args[2].name})`);
|
|
10599
10627
|
return { name: "", type: e.type };
|
|
10600
10628
|
}
|
|
10601
|
-
if (e.fn === "http.request" || e.fn === "http.requestCb" || e.fn === "http.requestUrl" || e.fn === "http.requestUrlCb"
|
|
10629
|
+
if (e.fn === "http.request" || e.fn === "http.requestCb" || e.fn === "http.requestUrl" || e.fn === "http.requestUrlCb" ||
|
|
10630
|
+
e.fn === "http.requestAgent" || e.fn === "http.requestAgentCb") {
|
|
10602
10631
|
const isUrl = e.fn.startsWith("http.requestUrl");
|
|
10603
|
-
const
|
|
10632
|
+
const isAgent = e.fn.startsWith("http.requestAgent");
|
|
10633
|
+
const cbIdx = isUrl ? 3 : isAgent ? 8 : 7;
|
|
10604
10634
|
const hasCb = e.fn.endsWith("Cb");
|
|
10605
10635
|
const args = e.args.map((a) => this.emitExpr(a));
|
|
10606
10636
|
let cb = "null";
|
|
@@ -10617,7 +10647,7 @@ class LlEmitter {
|
|
|
10617
10647
|
}
|
|
10618
10648
|
const head = args.slice(0, cbIdx);
|
|
10619
10649
|
const decls = head.map((a) => (this.llType(a.type) === "i1" ? "i1 zeroext" : this.llType(a.type)));
|
|
10620
|
-
const entry = isUrl ? "scr_http_request_url" : "scr_http_request";
|
|
10650
|
+
const entry = isUrl ? "scr_http_request_url" : isAgent ? "scr_http_request_agent" : "scr_http_request";
|
|
10621
10651
|
this.declare(`declare ptr @${entry}(${[...decls, "ptr", "ptr"].join(", ")})`);
|
|
10622
10652
|
const t = B.tmp();
|
|
10623
10653
|
B.line(`${t} = call ptr @${entry}(${[...head.map((a) => `${this.llType(a.type)} ${a.name}`), `ptr ${cb}`, `ptr ${adapter}`].join(", ")})`);
|
|
@@ -10652,6 +10682,13 @@ class LlEmitter {
|
|
|
10652
10682
|
B.line(`call void @scr_http_res_on_finish(ptr ${args[0].name}, ptr ${args[1].name})`);
|
|
10653
10683
|
return { name: "", type: e.type };
|
|
10654
10684
|
}
|
|
10685
|
+
if (e.fn === "net.sockOnFinish") {
|
|
10686
|
+
const args = e.args.map((a) => this.emitExpr(a));
|
|
10687
|
+
this.moveTemp(args[1]);
|
|
10688
|
+
this.declare(`declare void @scr_net_sock_on_finish(ptr, ptr)`);
|
|
10689
|
+
B.line(`call void @scr_net_sock_on_finish(ptr ${args[0].name}, ptr ${args[1].name})`);
|
|
10690
|
+
return { name: "", type: e.type };
|
|
10691
|
+
}
|
|
10655
10692
|
if (e.fn === "island.castFail") {
|
|
10656
10693
|
// The deferred boundary failure: the island value was evaluated
|
|
10657
10694
|
// (its side effects are real), the throw is unconditional
|