mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-08 08:44:37 +08:00
Count class-value constructions in the census, and key caches on both diagnostics
- The heap census also counts instances a class value constructs: the construct thunk that `newValue` calls counts them after its allocation, as `new` does at its own. - A build with SCRIPTC_HEAP_CENSUS set is its own executable cache entry (`heapCensus` in the early cache's key and route key), and one with SCRIPTC_REPR_REPORT set does not read the early cache, since a hit emits no module and so writes no report. The CLI's startup route defers both to the full compiler. - Test: a warm cache still builds the census executable, counting `new` and class-value constructions, and still writes the report.
This commit is contained in:
@@ -168,6 +168,8 @@ export interface EarlyExecutableCacheOptions {
|
||||
checker?: string;
|
||||
/** Omitted unless SCRIPTC_YOUNG_NURSERY=1 (backend/young-nursery.ts). */
|
||||
youngNursery?: true;
|
||||
/** Omitted unless SCRIPTC_HEAP_CENSUS is set (backend/llvm/heap-census.ts). */
|
||||
heapCensus?: true;
|
||||
npmStatic: readonly string[] | "auto" | null;
|
||||
/** Omitted unless shape inference's overlay compiles the packages
|
||||
* (frontend/shape-inference). */
|
||||
@@ -324,6 +326,7 @@ function cacheKey(options: EarlyExecutableCacheOptions): string {
|
||||
...(options.functionLayout !== undefined ? [`layout:${options.functionLayout}`] : []),
|
||||
...(options.checker !== undefined ? [`checker:${options.checker}`] : []),
|
||||
...(options.youngNursery ? ["young-nursery"] : []),
|
||||
...(options.heapCensus ? ["heap-census"] : []),
|
||||
options.npmStatic === null
|
||||
? "<npm-static-off>"
|
||||
: options.npmStatic === "auto"
|
||||
@@ -370,6 +373,7 @@ function routeKey(options: Omit<EarlyExecutableRouteOptions, "nativeEnvironment"
|
||||
if (options.functionLayout !== undefined) hash.update(`layout:${options.functionLayout}\0`);
|
||||
if (options.checker !== undefined) hash.update(`checker:${options.checker}\0`);
|
||||
if (options.youngNursery) hash.update("young-nursery\0");
|
||||
if (options.heapCensus) hash.update("heap-census\0");
|
||||
hash
|
||||
.update(
|
||||
options.npmStatic === null
|
||||
|
||||
Reference in New Issue
Block a user