Skip to content

runtime(host): every language/binary/error kind and window global a native host asks for - #16049

Merged
proggeramlug merged 2 commits into
mainfrom
fmain-host-language-kinds
Dec 4, 2026
Merged

proggeramlug merged 2 commits into
mainfrom
fmain-host-language-kinds

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Feather's renderer builds its realm intrinsics through the runtime at startup. On main, PerryCode aborted there: perry_host_language_prototype_new_v1 refused 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. Under native-host-objects, this PR adds:

  • Language kinds 6 Boolean, 7 BigInt and 8 WeakRef. %Boolean.prototype% is a Boolean object whose [[BooleanData]] is false. 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.
  • Binary kinds 3 DataView and 4..14 for the other eleven typed arrays: [[Construct]] through the shared runtime constructors, then the prototype from NewTarget, plus the DataView accessors and get/set methods, @@toStringTag and BYTES_PER_ELEMENT. %TypedArray%.from/of accept every element type.
  • Error kind 5 AggregateError (ECMA-262 20.5.7.1.1, length 2). %Error% gets captureStackTrace and stackTraceLimit.
  • The global install adds queueMicrotask, structuredClone, atob, btoa, NaN and Infinity.
  • A generic Get on a Number, Boolean or BigInt primitive reads the current realm's prototype.
  • perry_host_function_is_native_intrinsic_v1 admits these runtime bodies: the async-from-sync iterator methods, the Error stack accessors, collection and generator methods matched by code, and the %Iterator.prototype% accessor halves. perry_host_promise_is_internal_callback_v1 admits 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

  • 9 new tests, including host-mode tests on a version-3 test host. They cover Boolean/BigInt/WeakRef prototypes and constructors, DataView and the 11 typed arrays, AggregateError, and an unknown kind that is still refused.
  • cargo check -p perry-runtime passes with default features and with Feather's feature set.
  • The full perry-runtime lib suite with Feather's features has only the 9 failures that also fail on main.

…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.
@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@proggeramlug
proggeramlug marked this pull request as ready for review December 4, 2026 01:11
@proggeramlug
proggeramlug merged commit 4a6c7b7 into main Dec 4, 2026
@proggeramlug
proggeramlug deleted the fmain-host-language-kinds branch December 4, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants