mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-28 06:53:42 +08:00
Store the frontend cache's LLVM placeholder as an empty array (#2051)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user