mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-02 07:43:42 +08:00
Keep the view-header test's loops speculative
Module number globals are now proven int32 through their writes, so the test's generator state starts from a value no analysis bounds to keep its loops on the speculative path. Format int32-slots.ts.
This commit is contained in:
@@ -1722,8 +1722,7 @@ export function analyzeInt32Slots(mod: IrModule, inputs: Int32SlotInputs = {}):
|
||||
if (s.kind === "assign") {
|
||||
boxWrite(s.localId, s.value);
|
||||
globalWrite(s.localId, s.value);
|
||||
}
|
||||
else if (s.kind === "varDecl" && s.init) boxWrite(s.localId, s.init);
|
||||
} else if (s.kind === "varDecl" && s.init) boxWrite(s.localId, s.init);
|
||||
if (s.kind === "fieldSet") {
|
||||
const family = slots.family(s.className, s.field);
|
||||
if (!family || !slots.hasFamily(family)) return;
|
||||
|
||||
@@ -188,9 +188,10 @@ test("a speculative loop reads its views' header fields once, before its copies"
|
||||
// A view held by a const local or by a parameter is the same view in
|
||||
// every iteration. Its data pointer is read before the branch to the fast
|
||||
// copy, and no copy (ordinary, fast, or the one a failed check resumes
|
||||
// in) reads it again.
|
||||
// in) reads it again. `last` starts from a value no analysis bounds,
|
||||
// so the loops speculate on `l`.
|
||||
const llvm = await emitLlvm(`
|
||||
let last = 42;
|
||||
let last = Number(process.argv[2] ?? "42");
|
||||
function fill(array: ArrayBuffer, count: number): void {
|
||||
const buf = new Float64Array(array);
|
||||
let l = last;
|
||||
|
||||
Reference in New Issue
Block a user