Store the frontend cache's LLVM placeholder as an empty array (#2051)

This commit is contained in:
Chris Tate
2026-10-23 18:19:25 -05:00
committed by GitHub
2 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -176,7 +176,9 @@ test("serialized IR travels as bounded parts through the frontend cache", () =>
const key = readdirSync(family).find((name) => /^[0-9a-f]{64}$/.test(name))!;
const payload = JSON.parse(readFileSync(join(family, key), "utf8"));
expect(payload.schema).toBe("scriptc.native-frontend.v3");
expect(payload.input.llvm).toBe("");
// The placeholders keep NativeExecutableInput's member types: the native
// compiler checks the parsed entry against them when it reads it back.
expect(payload.input.llvm).toEqual([]);
expect(payload.input.ir).toBeNull();
expect(payload.llvm).toBe(first.llvm.join(""));
expect(payload.ir).toEqual(first.ir);
+2 -2
View File
@@ -59,7 +59,7 @@ export interface NativeExecutableInput {
/** The two large artifacts follow the input metadata as separate members so
* an entry can be written as parts instead of one JSON string; the stored
* input carries empty placeholders (`""`, `null`) for them. */
* input carries empty placeholders (`[]`, `null`) for them. */
interface FrontendCacheEntry {
schema: "scriptc.native-frontend.v3";
probes: FrontendInputSnapshot;
@@ -78,7 +78,7 @@ function* frontendCacheParts(
const metadata = JSON.stringify({
schema: "scriptc.native-frontend.v3",
probes,
input: { ...input, llvm: "", ir: null },
input: { ...input, llvm: [], ir: null },
});
yield metadata.slice(0, metadata.length - 1) + ',"llvm":"';
for (const part of joinedParts(input.llvm))