Skip to content

test(aot): programs whose expected base classes would form a ring - #47766

Closed
robobun wants to merge 1 commit into
mainfrom
robobun/9c88a8fe/aot-object-create-places-in-a-ring
Closed

robobun wants to merge 1 commit into
mainfrom
robobun/9c88a8fe/aot-object-create-places-in-a-ring

Conversation

@robobun

@robobun robobun commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

  • A bun build --compile --aot executable never returns from a store into an object of a ten-line scope chain (objects/object-create-scope-chain-of-function-scopes-and-block-scopes.js). One thread stays at 100% CPU. bun run prints 1 2 true false isFunction,x isFunction,y.
  • The engine made two Object.create call sites classes, each the base of the other. The run time walks the classes below a class without a bound. [JSC] AOT: name no ring of base classes for Object.create call sites and constructor functions WebKit#980 is the fix. No program under test/aot/parallel has that shape.

Fix

Background

  • --aot compiles a program to machine code. One Object.create() call site makes a class, and the first object it is handed becomes the prototype object.
  • run-parallel.ts builds each program under test/aot/parallel with --compile --aot and compares what the executable prints with plain Bun.
  • A // Todo: program is run and reported as skipped. It fails once it passes.
Notes

The programs

"Before" is Bun 4f7acde0f with the engine at 4d45755fed, which main pins, as a user builds: bun build --compile --aot, then timeout 10.

Program What it does Before
objects/object-create-scope-chain-of-function-scopes-and-block-scopes a scope chain of two kinds of scopes, then the scopes get variables exit 124
objects/object-create-places-in-a-ring-and-a-store-to-a-prototype-object two call sites, a new property on an object that lies above another exit 124
objects/object-create-places-in-a-ring-and-a-property-deleted-from-a-prototype-object two call sites, delete exit 124
objects/object-create-places-in-a-ring-and-a-prototype-object-frozen two call sites, Object.freeze exit 124
objects/object-create-places-in-a-ring-and-a-prototype-object-put-below-another three call sites, Object.setPrototypeOf exit 124
objects/object-create-places-in-a-ring-closed-by-calls-in-a-loop two call sites, and a loop closes the ring exit 124
objects/object-create-places-in-a-ring-that-no-run-closes two call sites, and the call that closes the ring never runs exit 124
objects/object-create-place-below-places-in-a-ring a third call site below two that are in a ring exit 124
objects/object-create-handed-the-prototype-object-of-another-place a call site is handed its own object, which another call site has made an object below exit 124
objects/object-create-handed-the-prototype-object-of-another-place-below-object-prototype the same below Object.prototype exit 124
objects/object-create-hands-its-own-object-to-itself-and-then-to-another-place the other call site is handed that object afterwards exit 124
constructor-functions/prototype-object-made-below-that-of-a-class-that-extends-the-function a class extends a constructor function, whose prototype object is then made below that of the class exit 124

The two // Todo: programs are under classes/. A cast names a base class there that closes a ring with the real one. With oven-sh/WebKit#980 their builds end with InvalidLayout under --aot-validate, which is the flag they carry. Without the flag the executable never returns. oven-sh/WebKit#980 says under "What stays" what would fix them.

How it was run

On the rewritten compiler

oven-sh/WebKit#997 and #47942 replace the part of the compiler that made the ring.

  • Bun at the head of AOT: front end, test runs and tests for the rewritten compiler #47942 (72ea3edb8, which pins autobuild-preview-pr-997-30803ce0), release: the twelve programs print what plain Bun prints. Its run-parallel.ts passes the twelve and skips the two // Todo: programs.
  • The two // Todo: programs fail to build there, because --aot-validate is no flag there. Built without it, both print what plain Bun prints.

What happens next

When main pins an engine that holds oven-sh/WebKit#980, this branch is rebased and CI runs the programs on that engine. If main pins the rewritten compiler first, the same happens, and the two // Todo: programs lose their // Flags: and // Todo: lines. On the engine that main pins today, CI ends each of the twelve at its time limit (90 s, 240 s with ASAN).

…ip ci]

Twelve programs for the engine change of oven-sh/WebKit#980: Object.create
call sites whose classes would be each other's base, and a constructor
function below a class that extends it. As an executable each one never
returns on the engine that main pins, so CI is skipped until a pin holds
that change.

Two more programs hold rings that stay after that change. They are marked
Todo, and their builds end with InvalidLayout under --aot-validate once the
pin holds the change.
@robobun

robobun commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Status

@robobun

robobun commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator Author
Updated 12:47 PM PT - Nov 2nd, 2026

❌ @robobun, your commit c186e7a has 52 failures in Build #136953 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 47766

That installs a local version of the PR into your bun-47766 executable, so you can run:

bun-47766 --bun

@Jarred-Sumner

Copy link
Copy Markdown
Collaborator

Closing: #47942 rewrites the front end of the ahead-of-time compiler and its tests for the engine's new compiler (oven-sh/WebKit#997, merged), so this no longer applies and would conflict with it. If the problem still shows once that is in, please open a new pull request against main.

@robobun

robobun commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator Author

Understood. The problem does not show on the new compiler, so I open no new pull request.

If the programs are wanted as tests of this shape for the new compiler, say so here and I will open a pull request against main after #47942 merges.

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