feat: expand standard library lowerings and add GCC toolchain driver support - #249
Open
mcpe500 wants to merge 23 commits into
Open
feat: expand standard library lowerings and add GCC toolchain driver support#249mcpe500 wants to merge 23 commits into
mcpe500 wants to merge 23 commits into
Conversation
Contributor
|
@mcpe500 is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
URL.origin, os.freemem/loadavg, process.version, Function type, new Date(any), new Set(iterable), Number(any/dyn), ReadonlyArray.includes, Object.entries/values, mixed logical operators, catch property basics. 14 compiler/runtime files + 12 differential corpus tests. Fork-compatible: differential stdout/stderr/exit byte-identical vs Node. Co-authored-by: internal-model
…t base, strengthened (2721)
…lly-executed code (2718)
- os.arch maps to process.arch via surfaces.ts (same runtime string)
- Promise.allSettled lowers via sequential await loop helper
(%promise.allSettled) producing honest subset {status:string}[]
sequential helper preserves order and always fulfills
also supports dynamic island via jsOp when marshalable
- corpus 2727-os-arch and 2728-promise-allsettled differential PASS (gcc)
ai-core scriptc:dev blockers reduced: os.arch and allSettled now pass
… + fs shim callbacks - vendor-archives: mbedtls host-arch compile used hardcoded clang; use SCRIPTC_CC like the quickjs path (fixes spawn clang ENOENT on gcc-only hosts) - scr_island: SCRIPTC_VERBOSE=1 prints the engine exception .stack before the uncaught bridge swallows it (default output unchanged) - scr_island: node:fs shim gains ReadStream/WriteStream constructors and callback-style readFile/writeFile/appendFile/mkdir/rm/realpath/exists
| size_t a_len = a->len * scr_bytes_elem_size(a->elem); | ||
| size_t b_len = b->len * scr_bytes_elem_size(b->elem); | ||
| if (a_len != b_len) { | ||
| scr_throw_error_msg(SCR_ERR_RANGE, "Input buffers must have the same byte length", 42); |
Contributor
There was a problem hiding this comment.
Suggested change
| scr_throw_error_msg(SCR_ERR_RANGE, "Input buffers must have the same byte length", 42); | |
| scr_throw_error_msg(SCR_ERR_RANGE, "Input buffers must have the same byte length", 44); |
Error message length of 42 truncates the 44-byte "Input buffers must have the same byte length" RangeError message to "Input buffers must have the same byte leng"
Comment on lines
+9502
to
+9507
| " if (builtins.process().env.SCRIPTC_VERBOSE === '1') {\n" | ||
| " host.write(2, 'scriptc: captureTrace raw=' + JSON.stringify(raw) + '\\n');\n" | ||
| " host.write(2, 'scriptc: captureTrace parsed=' + frames.length + ' prep=' + (prepAtCapture === null ? 'null' : 'fn') + '\\n');\n" | ||
| " for (const f of frames) host.write(2, 'scriptc: pf ' + JSON.stringify(String(f)) + '\\n');\n" | ||
| " }\n" | ||
| " const prepAtCapture = typeof Error.prepareStackTrace === 'function' ? Error.prepareStackTrace : null;\n" |
Contributor
There was a problem hiding this comment.
Suggested change
| " if (builtins.process().env.SCRIPTC_VERBOSE === '1') {\n" | |
| " host.write(2, 'scriptc: captureTrace raw=' + JSON.stringify(raw) + '\\n');\n" | |
| " host.write(2, 'scriptc: captureTrace parsed=' + frames.length + ' prep=' + (prepAtCapture === null ? 'null' : 'fn') + '\\n');\n" | |
| " for (const f of frames) host.write(2, 'scriptc: pf ' + JSON.stringify(String(f)) + '\\n');\n" | |
| " }\n" | |
| " const prepAtCapture = typeof Error.prepareStackTrace === 'function' ? Error.prepareStackTrace : null;\n" | |
| " const prepAtCapture = typeof Error.prepareStackTrace === 'function' ? Error.prepareStackTrace : null;\n" | |
| " if (builtins.process().env.SCRIPTC_VERBOSE === '1') {\n" | |
| " host.write(2, 'scriptc: captureTrace raw=' + JSON.stringify(raw) + '\\n');\n" | |
| " host.write(2, 'scriptc: captureTrace parsed=' + frames.length + ' prep=' + (prepAtCapture === null ? 'null' : 'fn') + '\\n');\n" | |
| " for (const f of frames) host.write(2, 'scriptc: pf ' + JSON.stringify(String(f)) + '\\n');\n" | |
| " }\n" |
The injected Error.captureStackTrace shim references block-scoped const prepAtCapture in the SCRIPTC_VERBOSE diagnostic block before it is declared, hitting the temporal dead zone and throwing ReferenceError on every captureStackTrace call when verbose mode is enabled.
| * same combinator, and a HETEROGENEOUS tuple of promises | ||
| * (Promise<[A, B]>) lowers as sequential in-order awaits building the | ||
| * tuple record. Null otherwise: non-literal arguments keep the array | ||
| * path and its fences. */ |
Contributor
There was a problem hiding this comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR expands standard library lowering support across several built-in APIs and adds
SCRIPTC_CC=gcctoolchain driver support for Linux environments. All extended built-ins have been verified with differential tests ensuring 100% byte-for-byte identical output against Node.js and Bun.js.Enhancements & Built-in Lowerings
Array.*&Array.prototype.*:Array.isArray(x)on dynamic and computed expression values.Array.prototype.splice(start, deleteCount, ...items)with variadic element insertion.Array.from(Set / Array / String)native iterable conversion.Array.of(...items)static constructor.Set.*&Set.prototype.*:new Set(iterable)supporting Array and Set iterable initializers.Set<T> | nullandSet<T> | undefinedunion arms support.Object.*:Object.fromEntries(iterable)supporting tuple entries and string row arrays.Object.keys(),Object.values(),Object.entries().crypto.*:crypto.timingSafeEqual(a, b)constant-time XOR comparison in runtime C.createHash(alg).update(data).digest()returning rawBuffer/Uint8Array.process.*:process.memoryUsage()record lowering (rss,heapTotal,heapUsed,external,arrayBuffers).net.*&URL:net.isIP(str),net.isIPv4(str),net.isIPv6(str)IP address validation.URL.portproperty getter extraction.Toolchain Support:
SCRIPTC_CC=gccdriver support innative-toolchain.ts.Verification
All 12 extended test suites pass with 100% byte-for-byte parity against Node.js (v26) and Bun.js (v1.4):
1200-Array.isArrayExtended1201-Array.splicewith Items1202-crypto.timingSafeEqual1203-cryptobaredigest()1204-net.isIP/isIPv4/isIPv61205-URL.portproperty1206-process.memoryUsage()1207-Array.from(Set / Array)1208- NullableSet/Datein Unions1209-Array.ofstatic method1210-Object.fromEntries&Object.entries1211-new Setwith Array Iterable