@scriptc/compiler 0.0.34 → 0.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/cc-cache.test.js +969 -7
- package/dist/backend/cc-cache.test.js.map +1 -1
- package/dist/backend/cc.d.ts +90 -18
- package/dist/backend/cc.js +953 -276
- package/dist/backend/cc.js.map +1 -1
- package/dist/backend/llvm/split.d.ts +43 -0
- package/dist/backend/llvm/split.js +227 -0
- package/dist/backend/llvm/split.js.map +1 -0
- package/dist/backend/llvm/split.test.d.ts +1 -0
- package/dist/backend/llvm/split.test.js +102 -0
- package/dist/backend/llvm/split.test.js.map +1 -0
- package/dist/backend/object-localize.test.js +20 -0
- package/dist/backend/object-localize.test.js.map +1 -1
- package/dist/executable/early-cache.d.ts +86 -0
- package/dist/executable/early-cache.js +460 -0
- package/dist/executable/early-cache.js.map +1 -0
- package/dist/executable/early-cache.test.d.ts +1 -0
- package/dist/executable/early-cache.test.js +300 -0
- package/dist/executable/early-cache.test.js.map +1 -0
- package/dist/ffi/profile.d.ts +7 -2
- package/dist/ffi/profile.js +1 -0
- package/dist/ffi/profile.js.map +1 -1
- package/dist/frontend/lowering/lower-builtins.js +2 -2
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +14 -4
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.js +18 -23
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.js +22 -10
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-island.js +3 -3
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.js +1 -1
- package/dist/frontend/lowering/lower-mixins.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +1 -1
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +6 -0
- package/dist/frontend/lowering/lowerer.js +230 -81
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/surfaces.js +1 -1
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/program.js +42 -13
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/ts7/checker.d.ts +40 -2
- package/dist/frontend/ts7/checker.js +194 -32
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/types.js +20 -42
- package/dist/frontend/types.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +219 -101
- package/dist/index.js.map +1 -1
- package/dist/ir/nodes.d.ts +6 -0
- package/dist/ir/nodes.js +28 -0
- package/dist/ir/nodes.js.map +1 -1
- package/dist/ir/validate.js +7 -1
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/early-cache.js +4 -23
- package/dist/library/early-cache.js.map +1 -1
- package/dist/library/implementation-identity.d.ts +23 -0
- package/dist/library/implementation-identity.js +84 -0
- package/dist/library/implementation-identity.js.map +1 -0
- package/dist/startup-cache.d.ts +6 -0
- package/dist/startup-cache.js +6 -0
- package/dist/startup-cache.js.map +1 -0
- package/package.json +3 -2
- package/surface-manifest.json +1 -1
package/dist/backend/cc.d.ts
CHANGED
|
@@ -4,6 +4,11 @@ export interface ToolchainEnvironmentCachePolicy {
|
|
|
4
4
|
}
|
|
5
5
|
export declare function toolchainEnvironmentCachePolicy(env?: NodeJS.ProcessEnv): ToolchainEnvironmentCachePolicy;
|
|
6
6
|
export declare function toolchainEnvironmentFingerprint(env?: NodeJS.ProcessEnv): string;
|
|
7
|
+
/** Inputs that can change which native tool/runtime implementation an
|
|
8
|
+
* executable build selects before compileC has a chance to rediscover it.
|
|
9
|
+
* The early whole-program cache keys this exact posture before restoring a
|
|
10
|
+
* final binary; compileC retains its deeper inode/content validation. */
|
|
11
|
+
export declare function executableNativeEnvironmentFingerprint(env?: NodeJS.ProcessEnv): Promise<string>;
|
|
7
12
|
export interface CcOptions {
|
|
8
13
|
/** Path of the generated (or hand-written) program TU: a .c file, or the
|
|
9
14
|
* LLVM backend's .ll — clang compiles IR text natively on the same
|
|
@@ -18,6 +23,19 @@ export interface CcOptions {
|
|
|
18
23
|
* top-level bytes alone can safely represent. scriptc's frontend supplies
|
|
19
24
|
* this for its generated C/LLVM IR; `--from-c` deliberately does not. */
|
|
20
25
|
cacheIdentity?: string;
|
|
26
|
+
/** Native optimization posture. Release preserves the historical -O2
|
|
27
|
+
* executable lane; dev selects -O0 and may compile a caller-provided LLVM
|
|
28
|
+
* shard set into independently cached objects before the final link. */
|
|
29
|
+
optimization?: "release" | "dev";
|
|
30
|
+
/** Optional equivalent LLVM modules for dev compilation. Unsupported
|
|
31
|
+
* targets or merge failures fall back to the canonical cPath TU. */
|
|
32
|
+
programShards?: readonly {
|
|
33
|
+
name: string;
|
|
34
|
+
source: string;
|
|
35
|
+
}[];
|
|
36
|
+
/** Canonical externally visible definitions retained while shard merging
|
|
37
|
+
* demotes generated cross-shard linkage back to local symbols. */
|
|
38
|
+
programPublicSymbols?: readonly string[];
|
|
21
39
|
/** Build with ASan + the runtime RC audit (test/debug lane). */
|
|
22
40
|
sanitize?: boolean;
|
|
23
41
|
/** Additional native archives/objects, appended after the generated
|
|
@@ -196,6 +214,17 @@ export interface CcOptions {
|
|
|
196
214
|
* The unit also compiles whenever `tls` does — scr_tls.c consults its
|
|
197
215
|
* default-set override and shared Windows-certificate enumerator. */
|
|
198
216
|
tlsCa?: boolean;
|
|
217
|
+
/** Internal compiler hook: called only after a strict native artifact hit
|
|
218
|
+
* or a successful stable build has installed `outPath`. The executable
|
|
219
|
+
* frontend cache uses it to publish its stamp after native dependencies
|
|
220
|
+
* have validated; arbitrary compileC callers leave it unset. */
|
|
221
|
+
onArtifactReady?: (artifact: ValidatedNativeArtifact) => Promise<void>;
|
|
222
|
+
}
|
|
223
|
+
/** Native dependency proof attached to an executable frontend-cache entry.
|
|
224
|
+
* compileC produces this only after its strict local/CAS validation succeeds;
|
|
225
|
+
* the early reader replays it before restoring the final executable. */
|
|
226
|
+
export interface ValidatedNativeArtifact {
|
|
227
|
+
dependencies: NativeArtifactDependency[];
|
|
199
228
|
}
|
|
200
229
|
/** Structured compiler-driver failure. Most callers still let this surface
|
|
201
230
|
* as an internal build error; the TypeScript compiler pipeline recognizes it
|
|
@@ -264,10 +293,11 @@ export declare function cacheTargetIdentity(driver: Pick<CcDriver, "target">, ho
|
|
|
264
293
|
* be used by both arm64 Node and Rosetta/x64 Node on macOS. */
|
|
265
294
|
export declare function vendorCacheTargetFlavor(driver: Pick<CcDriver, "target">, hostPlatform?: NodeJS.Platform, hostArch?: string): string;
|
|
266
295
|
/** Vendor prerequisites live outside the content-addressed build root, so
|
|
267
|
-
* their directory name must carry the
|
|
268
|
-
* identity
|
|
269
|
-
*
|
|
270
|
-
|
|
296
|
+
* their directory name must carry the environment, resolved compiler, owned
|
|
297
|
+
* source bytes, and build-recipe identity of the artifacts that consume them.
|
|
298
|
+
* The short digest keeps the cache path readable while preventing build-order
|
|
299
|
+
* and cross-installation contamination. */
|
|
300
|
+
export declare function vendorCacheBuildIdentity(environmentFingerprint: string, compilerIdentity: string, nativeSourceIdentity: string): string;
|
|
271
301
|
export interface LibArchiveOptions {
|
|
272
302
|
/** The program TU (.c or .ll — clang compiles either with -c). */
|
|
273
303
|
cPath: string;
|
|
@@ -275,6 +305,17 @@ export interface LibArchiveOptions {
|
|
|
275
305
|
* spelling. Library assembly uses this for the identity-free projection of
|
|
276
306
|
* a complete caller-visible TU; its bytes drive every native cache key. */
|
|
277
307
|
programSource?: string;
|
|
308
|
+
/** Optional equivalent LLVM modules for native compilation. The public
|
|
309
|
+
* `programSource` remains the canonical TU/cache identity; these stable
|
|
310
|
+
* shards compile independently and are relocatably merged into one program
|
|
311
|
+
* object before archive assembly. */
|
|
312
|
+
programShards?: readonly {
|
|
313
|
+
name: string;
|
|
314
|
+
source: string;
|
|
315
|
+
}[];
|
|
316
|
+
/** Canonical externally visible definitions retained while the shard merge
|
|
317
|
+
* demotes generated cross-shard linkage back to local symbols. */
|
|
318
|
+
programPublicSymbols?: readonly string[];
|
|
278
319
|
/** Tiny generated C source carrying volatile library identity getters.
|
|
279
320
|
* Its bytes join the complete archive key, but the source itself exists
|
|
280
321
|
* only in the invocation-private build directory and the large program-
|
|
@@ -347,24 +388,55 @@ export declare function ccVersionOnce(argv: string[], environmentFingerprint?: s
|
|
|
347
388
|
export declare function implicitDependencyProbeIncludes(rtDir: string): Promise<string[]>;
|
|
348
389
|
export declare function parseLinkTraceFiles(output: string, cwd: string, excludedRoot: string, driverDryRun?: boolean): Promise<string[]>;
|
|
349
390
|
export declare function runtimeFingerprint(rtDir: string): Promise<string>;
|
|
391
|
+
export interface NativeArtifactDependency {
|
|
392
|
+
path: string;
|
|
393
|
+
kind: "file" | "directory" | "symlink";
|
|
394
|
+
dev: number;
|
|
395
|
+
ino: number;
|
|
396
|
+
size: number;
|
|
397
|
+
mtimeMs: number;
|
|
398
|
+
ctimeMs: number;
|
|
399
|
+
/** Symlinks are identity-bearing paths whose target bytes also matter. */
|
|
400
|
+
targetPath?: string;
|
|
401
|
+
targetKind?: "file" | "directory";
|
|
402
|
+
targetDev?: number;
|
|
403
|
+
targetIno?: number;
|
|
404
|
+
targetSize?: number;
|
|
405
|
+
targetMtimeMs?: number;
|
|
406
|
+
targetCtimeMs?: number;
|
|
407
|
+
/** A directory's recursive namespace. This detects a new nested candidate
|
|
408
|
+
* that can begin shadowing an existing system/header dependency. */
|
|
409
|
+
treeDigest?: string;
|
|
410
|
+
treeExclusions?: string[];
|
|
411
|
+
}
|
|
412
|
+
export declare function nativeArtifactDependenciesStillMatch(dependencies: readonly NativeArtifactDependency[]): Promise<boolean>;
|
|
350
413
|
/** Give one active link/archive operation private names for its cached
|
|
351
414
|
* runtime objects. A hard link keeps the inode alive if another process's LRU
|
|
352
415
|
* sweep unlinks the cache entry; filesystems that cannot hard-link across the
|
|
353
416
|
* cache/tmp boundary fall back to a copy. If eviction wins before staging,
|
|
354
417
|
* the caller catches the read failure and performs a fully fresh compile. */
|
|
355
418
|
export declare function stageRuntimeObjects(objects: ReadonlyMap<string, string>, stageDir: string): Promise<Map<string, string>>;
|
|
356
|
-
/** Compiles one C program together with the runtime sources.
|
|
357
|
-
* With caching disabled, the runtime (a dozen small files) is recompiled on
|
|
358
|
-
* every build in one historical clang invocation — no cached-archive
|
|
359
|
-
* staleness bugs. --dynamic additionally compiles
|
|
360
|
-
* scr_island.c under SCR_DYNAMIC and links the cached engine archive (built
|
|
361
|
-
* lazily, see above); regex-using programs additionally compile scr_regex.c
|
|
362
|
-
* and link libregexp (the cached objects, or the archive's own copy under
|
|
363
|
-
* --dynamic). Without either, the command line is exactly the historical
|
|
364
|
-
* one — regex-free static builds must stay byte-identical.
|
|
365
|
-
*
|
|
366
|
-
* With a caller-supplied dependency identity and an enabled cache root,
|
|
367
|
-
* unchanged programs skip payload code generation/linking via the binary
|
|
368
|
-
* cache after lightweight metadata probes, and misses link the program's own
|
|
369
|
-
* TU against cached per-flavor runtime objects. */
|
|
370
419
|
export declare function compileC(opts: CcOptions): Promise<void>;
|
|
420
|
+
export type NativeCacheWarmProfile = "runtime" | "tls" | "dynamic";
|
|
421
|
+
export interface WarmNativeCachesOptions {
|
|
422
|
+
/** Native object posture to seed. Defaults to the shipped release/-O2 lane. */
|
|
423
|
+
optimization?: "release" | "dev";
|
|
424
|
+
/** Seed ASan + RC-audit objects instead of the ordinary lane. */
|
|
425
|
+
sanitize?: boolean;
|
|
426
|
+
/** Feature families to seed. Defaults to every expensive native family. */
|
|
427
|
+
profiles?: readonly NativeCacheWarmProfile[];
|
|
428
|
+
}
|
|
429
|
+
export interface WarmNativeCachesResult {
|
|
430
|
+
cacheRoot: string;
|
|
431
|
+
profiles: {
|
|
432
|
+
profile: NativeCacheWarmProfile;
|
|
433
|
+
elapsedMs: number;
|
|
434
|
+
}[];
|
|
435
|
+
}
|
|
436
|
+
export declare function supportedNativeCacheWarmProfiles(driver: CcDriver): readonly NativeCacheWarmProfile[];
|
|
437
|
+
/** Populate expensive native prerequisites against the current compiler,
|
|
438
|
+
* target, SDK, and environment. The resulting entries use the exact same
|
|
439
|
+
* identities and validators as ordinary builds; this merely pays their cost
|
|
440
|
+
* before a developer's first program asks for them. Synthetic link products
|
|
441
|
+
* are discarded and never enter the complete-executable cache. */
|
|
442
|
+
export declare function warmNativeCaches(options?: WarmNativeCachesOptions): Promise<WarmNativeCachesResult>;
|