fix: support Date as a typed-array element and island-crossing type - #225
Open
techfreaque wants to merge 1 commit into
Open
fix: support Date as a typed-array element and island-crossing type#225techfreaque wants to merge 1 commit into
techfreaque wants to merge 1 commit into
Conversation
Contributor
|
@techfreaque is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
There was a problem hiding this comment.
Additional Suggestions:
Promise.allproducingDate[]selects the pointer-ref store adapter instead of the f64 adapter, causing an f64 epoch-ms payload to be stored through a ref store into an f64 array slot (type mismatch / miscompile).
streamFromArrayAdapterreadsDate[]elements viascr_arr_get_ref(pointer read) instead ofscr_arr_get_f64, miscompilingReadableStream.from(dateArray).
- LLVM backend's
emitJsMarshallacks acase "date", so aDatecrossing the island falls into the JSON-composite default and hitsjsonWriteHelper, which throwsLlvmUnsupportedErrorfordate.
techfreaque
force-pushed
the
fix-date-array-support
branch
from
August 23, 2026 20:34
d69e4ac to
c1a0a02
Compare
Date was already supported as a standalone static type but was not supported as an array element type or as a jsvalIn/jsvalLiftable source. Changes: - ir/nodes.ts: add `case "date"` to isSupportedArrayElem. Dates are stored as epoch-ms f64 scalars at the C level (SCR_ELEM_F64 slots), so they fit the same storage as f64 arrays with re-boxing on read. - emit-types.ts: elemKindC returns "SCR_ELEM_F64" for date (same slot as f64); elemAccess returns "f64" for date elements. - emit-exprs.ts: streamTypedRefAdapter handles date elements alongside f64 (same get path); jsMarshal adds a `case "date"` that emits scr_jsval_from_f64 (passes the epoch-ms timestamp as a JS number). - lowerer.ts: jsvalLiftable and jsvalIn allow date values to cross the island boundary (alongside bytes and url), enabling Date[] to be marshaled into the island in --dynamic mode.
techfreaque
force-pushed
the
fix-date-array-support
branch
from
August 23, 2026 20:42
c1a0a02 to
d0d05ae
Compare
Author
|
Fixed all four issues in d0d05ae:
|
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.
Problem
Datewas supported as a standalone static type but could not appear as an array element (Date[]) or cross the island boundary injsvalIn. Two gaps:isSupportedArrayElemdidn't include"date", soDate[]was rejected at the type-mapping layer.elemKindCthrewInternalCompilerErrorfordateelements, andelemAccessreturned"ref"(wrong — Date is stored asf64).jsvalLiftableandjsvalIndidn't allow Date values to cross the island boundary (alongsidebytesandurl).Fix
ir/nodes.ts—isSupportedArrayElem: addcase "date". Dates are epoch-ms f64 scalars at the C level, stored inSCR_ELEM_F64slots.emit-types.ts:elemKindC: addcase "date"returning"SCR_ELEM_F64"(same storage as f64).elemAccess: return"f64"for date elements.emit-exprs.ts:streamTypedRefAdapter: handle date alongside f64 (samescr_arr_get_f64path).jsMarshal: addcase "date"emittingscr_jsval_from_f64— passes the epoch-ms timestamp as a JS number to the island.lowerer.ts:jsvalLiftable: addt.kind === "date"alongsidebytesandurl.jsvalIn: adde.type.kind === "date"alongsidebytesandurl.Verification
Date[]compiles and round-trips correctly. Date values marshal into the island as f64 millisecond timestamps.packages/compilerbuilds clean.