-
Notifications
You must be signed in to change notification settings - Fork 5k
ci(verify-baseline): parse //@ JSC flags, skip v128 wasm fixtures on x64, re-enable --jit-stress on WebKit changes #34877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
robobun
wants to merge
4
commits into
main
Choose a base branch
from
farm/3cec3838/verify-baseline-jit-stress-env
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
55d3268
ci(verify-baseline): parse //@ JSC flags, skip v128 wasm fixtures on …
robobun 387ca72
ci(verify-baseline): skip --jit-stress on Windows SDE; surface missin…
robobun 503fea4
ci: drop dead vendor/WebKit/ clause from hasWebKitChanges
robobun 326d498
review: exact-match webkit.ts path, skip jit-stress under --skip-emul…
robobun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| // Covers the helper shared by jsc-stress.test.ts and scripts/verify-baseline.ts | ||
| // and keeps verify-baseline's Nehalem skip list in sync with the wasm fixtures. | ||
|
|
||
| import { describe, expect, test } from "bun:test"; | ||
| import { readdirSync } from "fs"; | ||
| import { bunEnv, bunExe, isDebug } from "harness"; | ||
| import path from "path"; | ||
| import { parseJSCFlags, wasmSIMDFixtures } from "./jsc-flags"; | ||
|
|
||
| const fixturesDir = path.join(import.meta.dir, "fixtures"); | ||
| const wasmFixturesDir = path.join(fixturesDir, "wasm"); | ||
| const preloadPath = path.join(import.meta.dir, "preload.js"); | ||
| // Same headroom jsc-stress.test.ts gives debug builds for JIT tier-up loops. | ||
| const fixtureTimeout = isDebug ? 180_000 : undefined; | ||
|
|
||
| describe("parseJSCFlags", () => { | ||
| test("runDefaultWasm", () => { | ||
| expect(parseJSCFlags(path.join(wasmFixturesDir, "bbq-osr-with-exceptions.js"))).toEqual({ | ||
| BUN_JSC_useDollarVM: "1", | ||
| BUN_JSC_jitPolicyScale: "0.1", | ||
| }); | ||
| }); | ||
|
|
||
| test("runDefault", () => { | ||
| expect(parseJSCFlags(path.join(wasmFixturesDir, "omg-tail-call-clobber-scratch-register.js"))).toEqual({ | ||
| BUN_JSC_jitPolicyScale: "0", | ||
| }); | ||
| }); | ||
|
|
||
| test("runFTLNoCJIT implies useFTLJIT / !useConcurrentJIT", () => { | ||
| expect(parseJSCFlags(path.join(fixturesDir, "licm-no-pre-header.js"))).toEqual({ | ||
| BUN_JSC_useFTLJIT: "true", | ||
| BUN_JSC_useConcurrentJIT: "false", | ||
| BUN_JSC_createPreHeaders: "false", | ||
| }); | ||
| }); | ||
|
|
||
| test("no directive", () => { | ||
| expect(parseJSCFlags(path.join(wasmFixturesDir, "ipint-bbq-osr-with-try2.js"))).toEqual({}); | ||
| }); | ||
| }); | ||
|
|
||
| // Nehalem has no AVX so JSC disables useWasmSIMD there, making v128 an invalid | ||
| // wasm type. Assert wasmSIMDFixtures lists exactly the fixtures that fail to | ||
| // parse without SIMD so verify-baseline's skip list stays correct. | ||
| describe.concurrent("wasmSIMDFixtures matches fixtures that require wasm SIMD", () => { | ||
| const allWasmFixtures = readdirSync(wasmFixturesDir) | ||
| .filter(f => f.endsWith(".js")) | ||
| .sort(); | ||
|
|
||
| test("every listed fixture exists on disk", () => { | ||
| const onDisk = new Set(allWasmFixtures); | ||
| expect([...wasmSIMDFixtures].filter(f => !onDisk.has(f))).toEqual([]); | ||
| }); | ||
|
|
||
| for (const fixture of allWasmFixtures) { | ||
| test( | ||
| fixture, | ||
| async () => { | ||
| const fixturePath = path.join(wasmFixturesDir, fixture); | ||
| await using proc = Bun.spawn({ | ||
| cmd: [bunExe(), "--preload", preloadPath, fixturePath], | ||
| // Simulate the Nehalem path: no AVX => JSC disables wasm SIMD. | ||
| env: { ...bunEnv, ...parseJSCFlags(fixturePath), BUN_JSC_useWasmSIMD: "false" }, | ||
| cwd: wasmFixturesDir, | ||
| stdout: "pipe", | ||
| stderr: "pipe", | ||
| }); | ||
| const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]); | ||
|
|
||
| if (wasmSIMDFixtures.has(fixture)) { | ||
| // Must fail to parse with the characteristic error; if it passes, it | ||
| // no longer needs SIMD and should be removed from wasmSIMDFixtures. | ||
| expect(stderr).toContain("WebAssembly.Module doesn't parse"); | ||
| expect(exitCode).not.toBe(0); | ||
| } else { | ||
| // Must pass without SIMD; if it fails with a parse error, add it to | ||
| // wasmSIMDFixtures so verify-baseline skips it under Nehalem. | ||
| if (exitCode !== 0) { | ||
| console.log("stdout:", stdout); | ||
| console.log("stderr:", stderr); | ||
| } | ||
| expect(exitCode).toBe(0); | ||
| } | ||
| }, | ||
| fixtureTimeout, | ||
| ); | ||
| } | ||
| }); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // Shared between jsc-stress.test.ts and scripts/verify-baseline.ts so both | ||
| // spawn fixtures with the same JSC options. | ||
|
|
||
| import fs from "fs"; | ||
|
|
||
| /** | ||
| * Parse JSC option flags from //@ directives at the top of a test file. | ||
| * Converts --flag=value to BUN_JSC_flag=value environment variables. | ||
| * | ||
| * Supported directives: | ||
| * //@ runDefault("--flag=value", ...) | ||
| * //@ runFTLNoCJIT("--flag=value", ...) | ||
| * //@ runDefaultWasm("--flag=value", ...) | ||
| */ | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| export function parseJSCFlags(filePath: string): Record<string, string> { | ||
| const content = fs.readFileSync(filePath, "utf-8"); | ||
| const env: Record<string, string> = {}; | ||
|
|
||
| for (const line of content.split("\n")) { | ||
| if (line === "// @bun" || line.trim() === "") continue; | ||
| if (!line.startsWith("//@")) break; | ||
|
|
||
| const match = line.match(/^\/\/@ (runDefault|runFTLNoCJIT|runDefaultWasm)\((.*)\)/); | ||
| if (!match) continue; | ||
|
|
||
| const [, mode, argsStr] = match; | ||
|
|
||
| // runFTLNoCJIT implies these flags (from WebKit's run-jsc-stress-tests) | ||
| if (mode === "runFTLNoCJIT") { | ||
| env["BUN_JSC_useFTLJIT"] = "true"; | ||
| env["BUN_JSC_useConcurrentJIT"] = "false"; | ||
| } | ||
|
|
||
| // Parse explicit flags: "--key=value" | ||
| const flagPattern = /"--(\w+)=([^"]+)"/g; | ||
| let flagMatch; | ||
| while ((flagMatch = flagPattern.exec(argsStr)) !== null) { | ||
| env[`BUN_JSC_${flagMatch[1]}`] = flagMatch[2]; | ||
| } | ||
| } | ||
|
|
||
| return env; | ||
| } | ||
|
|
||
| // Wasm fixtures whose modules declare v128 (0x7B). JSC's Options.cpp disables | ||
| // useWasmSIMD on x86_64 without AVX, so these fail to parse under Nehalem | ||
| // emulation; verify-baseline.ts skips them on x64. | ||
| export const wasmSIMDFixtures = new Set(["bbq-osr-with-exceptions.js", "omg-tail-call-clobber-scratch-register.js"]); | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.