Repository navigation
runtime(host): every language/binary/error kind and window global a native host asks for - #16049
Merged
Merged
Conversation
…and the built-ins a native host admits
A Feather realm creates factory kinds main refused at startup:
perry_host_language_{prototype,intrinsic}_new_v1 kinds 6 Boolean, 7 BigInt
and 8 WeakRef; perry_host_binary_{prototype,constructor}_new_v1 kinds 3
DataView and 4..14 the other typed arrays; perry_host_error_constructor_new_v1
kind 5 AggregateError. All are built now, with the allocation-realm family
numbers the host uses (38/138, 45..55/145..155, 56..58/156..158, 22/122).
- %Boolean.prototype% is a Boolean object with [[BooleanData]] false;
new Boolean(x) is ToBoolean + OrdinaryCreateFromConstructor. BigInt is
callable only (asIntN/asUintN). new WeakRef(target) is the runtime's own
WeakRef cell with the realm prototype; the host weak pass already clears it.
- DataView and typed-array [[Construct]] use the shared runtime constructors,
then the prototype from NewTarget; DataView members, @@toStringTag and
BYTES_PER_ELEMENT are installed. %TypedArray%.from/of accept every brand.
- The global install adds queueMicrotask, structuredClone, atob, btoa, NaN
and Infinity; %Error% gets captureStackTrace and stackTraceLimit.
- Number/Boolean/BigInt primitive bases of a generic Get read the current
realm's prototype.
- perry_host_function_is_native_intrinsic_v1 admits the async-from-sync
iterator methods, the Error stack accessors, collection, generator and
%Iterator.prototype% accessor bodies by code; the async-from-sync and async
generator continuations are internal Promise callbacks.
Default-feature behaviour and generated code are unchanged.
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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
Feather's renderer builds its realm intrinsics through the runtime at startup. On main, PerryCode aborted there:
perry_host_language_prototype_new_v1refused kind 6 ("unknown language prototype"). An audit of every runtime symbol the overlay calls found the same gap in three more factories and in the built-in authentication. Undernative-host-objects, this PR adds:new Boolean(x)is ToBoolean, then OrdinaryCreateFromConstructor. BigInt can be called but not constructed, and has asIntN/asUintN.new WeakRef(target)is the runtime's own WeakRef cell with the realm prototype. The host weak pass already clears that cell.captureStackTraceandstackTraceLimit.perry_host_function_is_native_intrinsic_v1admits these runtime bodies: the async-from-sync iterator methods, the Errorstackaccessors, collection and generator methods matched by code, and the %Iterator.prototype% accessor halves.perry_host_promise_is_internal_callback_v1admits the async-from-sync and async generator continuations.The new kinds use the allocation-realm family numbers the host already maps. The code is in child modules of the host intrinsic files. Default features compile none of it.
Tests
cargo check -p perry-runtimepasses with default features and with Feather's feature set.