peachsim 0.1.2623 → 0.1.2624
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-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +5 -5
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +693 -306
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +7 -7
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +5 -5
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-E6V72TM2.mjs → acorn-DH6VFUJ3.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-RLWITQ5C.mjs → chunk-265THLTP.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-PAEJF2JP.mjs → chunk-2YHIYKY2.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-XOAOND7F.mjs → chunk-3XA5HYI5.mjs} +6 -6
- package/dist-lib/esm-chunks/{chunk-W3X7RP3H.mjs → chunk-A2WMBGJO.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-UCW7ITXE.mjs → chunk-AV7G5PTE.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-EIOVKQ2C.mjs → chunk-CM2NU5MS.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-RVM3WWST.mjs → chunk-EFQFJ7M6.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-RLWTJ6II.mjs → chunk-HKPKCJI5.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-4GNQG2GT.mjs → chunk-IMI2NE4A.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-Q7KCK4YO.mjs → chunk-JHMD4G4V.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-4BJIJ3GP.mjs → chunk-LCO2EXKF.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-CXNXKUNJ.mjs → chunk-LD7Z3NDO.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-RBXTTEI6.mjs → chunk-LMWSFXYN.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-IGB7TRLS.mjs → chunk-LOQBWIPM.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-B4APPUTT.mjs → chunk-LT533AHJ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-KPG4FUTY.mjs → chunk-N4ZJZUCO.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-NOM66H2G.mjs → chunk-OLAYY7SG.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GP3KL2GC.mjs → chunk-QNXV766K.mjs} +565 -290
- package/dist-lib/esm-chunks/{chunk-V2CHR3OI.mjs → chunk-QZ5HTMWV.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-B5OQSD4B.mjs → chunk-T7C6Z5UH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ISH6XB23.mjs → chunk-UJORQHAE.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-Q4ZATFEN.mjs → chunk-VH4BJS5V.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-6MNE57DC.mjs → chunk-XONCLAVA.mjs} +8 -7
- package/dist-lib/esm-chunks/{chunk-EI7CZDMR.mjs → chunk-YOD53JTM.mjs} +2 -2
- package/dist-lib/esm-chunks/{metro-layout-parser-OHVROLNJ.mjs → metro-layout-parser-MDVTDJ65.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-DRAUK6KR.mjs → swift-package-prebuilt-ZN7I4FYC.mjs} +12 -12
- package/dist-lib/esm-chunks/{swift-sdk-app-module-U2M7CMKA.mjs → swift-sdk-app-module-DUVE2OXH.mjs} +107 -20
- package/dist-lib/esm-chunks/{swift-sdk-image-ZHWSHCNI.mjs → swift-sdk-image-YSWQBCYV.mjs} +16 -16
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-EOJUCK7N.mjs → swift-sdk-image-producer-MZ235WSK.mjs} +5 -5
- package/dist-lib/expo-swift-bundle.cjs +686 -299
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +7 -7
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +691 -304
- package/dist-lib/host/fetch-proxy-handler.cjs +7 -7
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +30 -15
- package/dist-lib/native-app-identity-project.mjs +44 -29
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +3 -3
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +85 -85
- package/dist-lib/public-origins-lib.json +64 -64
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -2
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +8 -8
- package/dist-lib/skills.cjs +691 -304
- package/dist-lib/swift-compile.cjs +638 -280
- package/dist-lib/swift-compile.mjs +12 -12
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +6 -6
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/magic-string.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +1 -1
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +3 -3
- package/package.json +1 -1
- package/src/bazel-project.ts +34 -18
- package/src/binaryen.lock.json +3 -3
- package/src/swift-compile.ts +8 -0
- package/src/swift-guest-compile.ts +170 -160
- package/src/swift-guest-dyld-table.ts +22 -9
- package/src/swift-guest-link.ts +116 -42
- package/src/swift-guest-linked-spans.ts +63 -14
- package/src/swift-guest-projection-storage.ts +7 -6
- package/src/swift-guest-source-inputs.ts +35 -21
- package/src/swift-objc-compile.ts +1 -0
- package/src/swift-sdk-app-module.ts +118 -15
- package/src/swift-sdk-image-wasm.ts +119 -17
- package/src/swift-sdk-image.ts +4 -1
- package/src/swift-wasm-prune.ts +71 -41
- package/src/wasm-narrow-boundary.ts +31 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2624 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -6418,6 +6418,15 @@ function guestLinkedSpans(map, before, after, owners, sectionOwners = /* @__PURE
|
|
|
6418
6418
|
const unchanged = before === after;
|
|
6419
6419
|
const original = layout(before, !unchanged, !importsLayout);
|
|
6420
6420
|
const optimized = unchanged ? original : layout(after, true, !importsLayout);
|
|
6421
|
+
if (extra?.optimizedDataSegments) {
|
|
6422
|
+
for (const segment of optimized.data) {
|
|
6423
|
+
extra.optimizedDataSegments.push({
|
|
6424
|
+
address: segment.address,
|
|
6425
|
+
offset: segment.bytes.byteOffset - after.byteOffset,
|
|
6426
|
+
length: segment.bytes.length
|
|
6427
|
+
});
|
|
6428
|
+
}
|
|
6429
|
+
}
|
|
6421
6430
|
const collectSymbols = extra?.collectSymbols;
|
|
6422
6431
|
const trackedObject = extra?.trackedObject;
|
|
6423
6432
|
const trackedObjectOwner = extra?.trackedObjectOwner;
|
|
@@ -6586,12 +6595,39 @@ function guestLinkedSpans(map, before, after, owners, sectionOwners = /* @__PURE
|
|
|
6586
6595
|
}
|
|
6587
6596
|
return result;
|
|
6588
6597
|
};
|
|
6598
|
+
const singleSegmentSlice = (module2, start, length) => {
|
|
6599
|
+
const segs = module2.dataByAddress;
|
|
6600
|
+
let low = 0;
|
|
6601
|
+
let high = segs.length;
|
|
6602
|
+
while (low < high) {
|
|
6603
|
+
const middle = low + high >> 1;
|
|
6604
|
+
if (segs[middle].maximumEnd <= start) low = middle + 1;
|
|
6605
|
+
else high = middle;
|
|
6606
|
+
}
|
|
6607
|
+
let found;
|
|
6608
|
+
const end = start + length;
|
|
6609
|
+
for (let index = low; index < segs.length; index++) {
|
|
6610
|
+
const segment = segs[index];
|
|
6611
|
+
if (segment.address >= end) break;
|
|
6612
|
+
if (segment.address + segment.bytes.length > start) {
|
|
6613
|
+
if (found) return void 0;
|
|
6614
|
+
found = segment;
|
|
6615
|
+
}
|
|
6616
|
+
}
|
|
6617
|
+
if (!found || found.address > start || found.address + found.bytes.length < end)
|
|
6618
|
+
return void 0;
|
|
6619
|
+
return found.bytes.subarray(start - found.address, end - found.address);
|
|
6620
|
+
};
|
|
6621
|
+
const sameDataAt = (start, length) => {
|
|
6622
|
+
const origSlice = singleSegmentSlice(original, start, length);
|
|
6623
|
+
const optSlice = origSlice ? singleSegmentSlice(optimized, start, length) : void 0;
|
|
6624
|
+
if (origSlice && optSlice) return Buffer.compare(origSlice, optSlice) === 0;
|
|
6625
|
+
return dataAt(original, start, length).equals(dataAt(optimized, start, length));
|
|
6626
|
+
};
|
|
6589
6627
|
for (const span of spans) {
|
|
6590
6628
|
if (span.address + span.length > original.memoryBytes || span.address + span.length > optimized.memoryBytes)
|
|
6591
6629
|
throw new Error(`linked data lies outside guest memory at ${span.address}`);
|
|
6592
|
-
if (!unchanged && !
|
|
6593
|
-
dataAt(optimized, span.address, span.length)
|
|
6594
|
-
))
|
|
6630
|
+
if (!unchanged && !sameDataAt(span.address, span.length))
|
|
6595
6631
|
throw new Error(`optimization changed linked data at ${span.address}`);
|
|
6596
6632
|
}
|
|
6597
6633
|
let previous;
|
|
@@ -6725,7 +6761,7 @@ function takeGuestStartupData(wasm, address, length) {
|
|
|
6725
6761
|
const bytes = new Uint8Array(length);
|
|
6726
6762
|
const emptied = /* @__PURE__ */ new Set();
|
|
6727
6763
|
let covered = 0;
|
|
6728
|
-
const
|
|
6764
|
+
const patchedBody = Buffer.from(wasm.subarray(body[0], body[1]));
|
|
6729
6765
|
for (const initializer of startupDataInitializers(wasm.subarray(...body))) {
|
|
6730
6766
|
const end = initializer.address + initializer.length;
|
|
6731
6767
|
if (end <= address || initializer.address >= address + length || !initializer.length)
|
|
@@ -6740,19 +6776,18 @@ function takeGuestStartupData(wasm, address, length) {
|
|
|
6740
6776
|
covered += segment.length;
|
|
6741
6777
|
emptied.add(initializer.segment);
|
|
6742
6778
|
const [at, immediateEnd] = initializer.lengthImmediate;
|
|
6743
|
-
|
|
6744
|
-
|
|
6779
|
+
patchedBody.fill(128, at, immediateEnd - 1);
|
|
6780
|
+
patchedBody[immediateEnd - 1] = 0;
|
|
6745
6781
|
}
|
|
6746
6782
|
if (covered !== length)
|
|
6747
6783
|
throw new Error("guest startup data does not initialize the whole range");
|
|
6748
|
-
const
|
|
6749
|
-
const payload = [result.subarray(data[1], segments[0].header)];
|
|
6784
|
+
const payload = [wasm.subarray(data[1], segments[0].header)];
|
|
6750
6785
|
for (const [index, segment] of segments.entries()) {
|
|
6751
6786
|
if (!emptied.has(index)) {
|
|
6752
|
-
payload.push(
|
|
6787
|
+
payload.push(wasm.subarray(segment.header, segment.payload + segment.length));
|
|
6753
6788
|
continue;
|
|
6754
6789
|
}
|
|
6755
|
-
payload.push(
|
|
6790
|
+
payload.push(wasm.subarray(segment.header, segment.sizeAt), Uint8Array.of(0));
|
|
6756
6791
|
}
|
|
6757
6792
|
const section2 = Buffer.concat(payload);
|
|
6758
6793
|
const size = [];
|
|
@@ -6763,7 +6798,14 @@ function takeGuestStartupData(wasm, address, length) {
|
|
|
6763
6798
|
}
|
|
6764
6799
|
size.push(rest % 128 | 128);
|
|
6765
6800
|
}
|
|
6766
|
-
parts
|
|
6801
|
+
const parts = [
|
|
6802
|
+
wasm.subarray(0, body[0]),
|
|
6803
|
+
patchedBody,
|
|
6804
|
+
wasm.subarray(body[1], data[0]),
|
|
6805
|
+
Uint8Array.of(11, ...size),
|
|
6806
|
+
section2,
|
|
6807
|
+
wasm.subarray(data[2])
|
|
6808
|
+
];
|
|
6767
6809
|
return { wasm: Buffer.concat(parts), bytes };
|
|
6768
6810
|
}
|
|
6769
6811
|
var import_node_fs15, import_node_string_decoder, constant;
|
|
@@ -7072,6 +7114,32 @@ function readImports(bytes, imports) {
|
|
|
7072
7114
|
}
|
|
7073
7115
|
return { functionTypes, importedGlobals, memoryPages };
|
|
7074
7116
|
}
|
|
7117
|
+
function countImportedFunctions(bytes, imports) {
|
|
7118
|
+
let count = 0;
|
|
7119
|
+
if (!imports) return count;
|
|
7120
|
+
const r = wasmReader(bytes, imports.start);
|
|
7121
|
+
for (let n = r.u(); n > 0; n--) {
|
|
7122
|
+
r.skip(r.u());
|
|
7123
|
+
r.skip(r.u());
|
|
7124
|
+
const kind = r.byte();
|
|
7125
|
+
if (kind === 0) {
|
|
7126
|
+
r.u();
|
|
7127
|
+
count++;
|
|
7128
|
+
} else if (kind === 1) {
|
|
7129
|
+
r.byte();
|
|
7130
|
+
skipLimits(r);
|
|
7131
|
+
} else if (kind === 2) {
|
|
7132
|
+
skipLimits(r);
|
|
7133
|
+
} else if (kind === 3) {
|
|
7134
|
+
r.byte();
|
|
7135
|
+
r.byte();
|
|
7136
|
+
} else if (kind === 4) {
|
|
7137
|
+
r.byte();
|
|
7138
|
+
r.u();
|
|
7139
|
+
} else throw new Error(`unknown wasm import kind ${kind}`);
|
|
7140
|
+
}
|
|
7141
|
+
return count;
|
|
7142
|
+
}
|
|
7075
7143
|
function* readFunctionNames(bytes, names) {
|
|
7076
7144
|
for (const r = wasmReader(bytes, names.start); r.at < names.end; ) {
|
|
7077
7145
|
const id = r.byte();
|
|
@@ -7439,28 +7507,73 @@ function codeOnlySdkImage(bytes, constructorMask) {
|
|
|
7439
7507
|
return Buffer.concat(out);
|
|
7440
7508
|
}
|
|
7441
7509
|
function constructorKeys(map, bytes) {
|
|
7442
|
-
const m = readModule(bytes);
|
|
7443
7510
|
const first = map.code[0];
|
|
7444
|
-
if (!first
|
|
7445
|
-
const
|
|
7446
|
-
const
|
|
7447
|
-
|
|
7511
|
+
if (!first) throw new Error("link has no code");
|
|
7512
|
+
const sections = wasmSections(bytes);
|
|
7513
|
+
const code = sections.find((s) => s.id === 10);
|
|
7514
|
+
if (!code) throw new Error("link has no code");
|
|
7448
7515
|
const ctors = map.code.find((chunk) => chunk.section === "__wasm_call_ctors");
|
|
7449
7516
|
if (!ctors) throw new Error("link has no constructors");
|
|
7450
|
-
const
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7517
|
+
const importedFuncs = countImportedFunctions(
|
|
7518
|
+
bytes,
|
|
7519
|
+
sections.find((s) => s.id === 2)
|
|
7520
|
+
);
|
|
7521
|
+
const codeReader = wasmReader(bytes, code.start);
|
|
7522
|
+
const bodyCount = codeReader.u();
|
|
7523
|
+
if (!bodyCount) throw new Error("link has no code");
|
|
7524
|
+
const prefixes = new Uint32Array(bodyCount);
|
|
7525
|
+
let delta = 0;
|
|
7526
|
+
let ctorPrefix = -1;
|
|
7527
|
+
let ctorStart = -1;
|
|
7528
|
+
let ctorEnd = -1;
|
|
7529
|
+
for (let i = 0; i < bodyCount; i++) {
|
|
7530
|
+
const prefix = codeReader.at;
|
|
7531
|
+
const size = codeReader.u();
|
|
7532
|
+
prefixes[i] = prefix;
|
|
7533
|
+
if (i === 0) {
|
|
7534
|
+
delta = prefix - first.offset;
|
|
7535
|
+
ctorPrefix = ctors.offset + delta;
|
|
7536
|
+
}
|
|
7537
|
+
if (prefix === ctorPrefix) {
|
|
7538
|
+
ctorStart = codeReader.at;
|
|
7539
|
+
ctorEnd = ctorStart + size;
|
|
7540
|
+
}
|
|
7541
|
+
codeReader.skip(size);
|
|
7542
|
+
}
|
|
7543
|
+
if (ctorStart < 0) throw new Error("constructor function not found by map offset");
|
|
7544
|
+
let sorted = true;
|
|
7545
|
+
for (let i = 1; i < map.code.length; i++) {
|
|
7546
|
+
if (map.code[i].offset < map.code[i - 1].offset) {
|
|
7547
|
+
sorted = false;
|
|
7548
|
+
break;
|
|
7549
|
+
}
|
|
7550
|
+
}
|
|
7551
|
+
const byOffset = sorted ? void 0 : new Map(map.code.map((chunk) => [chunk.offset + delta, chunk]));
|
|
7552
|
+
const findChunk = (targetPrefix) => {
|
|
7553
|
+
if (byOffset) return byOffset.get(targetPrefix);
|
|
7554
|
+
const targetOffset = targetPrefix - delta;
|
|
7555
|
+
let lo = 0;
|
|
7556
|
+
let hi = map.code.length - 1;
|
|
7557
|
+
while (lo <= hi) {
|
|
7558
|
+
const mid = lo + hi >> 1;
|
|
7559
|
+
const offset = map.code[mid].offset;
|
|
7560
|
+
if (offset < targetOffset) lo = mid + 1;
|
|
7561
|
+
else if (offset > targetOffset) hi = mid - 1;
|
|
7562
|
+
else return map.code[mid];
|
|
7563
|
+
}
|
|
7564
|
+
return void 0;
|
|
7565
|
+
};
|
|
7566
|
+
const r = wasmReader(bytes, ctorStart);
|
|
7454
7567
|
for (let n = r.u(); n > 0; n--) {
|
|
7455
7568
|
r.u();
|
|
7456
7569
|
r.byte();
|
|
7457
7570
|
}
|
|
7458
7571
|
const keys = [];
|
|
7459
|
-
while (r.at <
|
|
7572
|
+
while (r.at < ctorEnd) {
|
|
7460
7573
|
const op = r.byte();
|
|
7461
7574
|
if (op === 16) {
|
|
7462
|
-
const callee = r.u() -
|
|
7463
|
-
const chunk =
|
|
7575
|
+
const callee = r.u() - importedFuncs;
|
|
7576
|
+
const chunk = callee >= 0 && callee < bodyCount ? findChunk(prefixes[callee]) : void 0;
|
|
7464
7577
|
if (!chunk) throw new Error("constructor without a map chunk");
|
|
7465
7578
|
keys.push(chunkKey(chunk, ""));
|
|
7466
7579
|
} else if (op !== 26 && op !== 11) throw new Error(`constructor op ${op}`);
|
|
@@ -7543,7 +7656,10 @@ function relocationEdges(bytes, segmentAddress) {
|
|
|
7543
7656
|
r.skip(r.u());
|
|
7544
7657
|
}
|
|
7545
7658
|
}
|
|
7546
|
-
const importedFunctions =
|
|
7659
|
+
const importedFunctions = countImportedFunctions(
|
|
7660
|
+
bytes,
|
|
7661
|
+
sections.find((s) => s.id === 2)
|
|
7662
|
+
);
|
|
7547
7663
|
const data = [];
|
|
7548
7664
|
const dataFunctions = [];
|
|
7549
7665
|
const bodyCount = bodyStarts.length;
|
|
@@ -7657,9 +7773,30 @@ function strongDefinitions(bytes) {
|
|
|
7657
7773
|
).map((s) => s.name);
|
|
7658
7774
|
}
|
|
7659
7775
|
function unslottedFunctions(bytes) {
|
|
7660
|
-
const
|
|
7661
|
-
const
|
|
7662
|
-
|
|
7776
|
+
const sections = wasmSections(bytes);
|
|
7777
|
+
const importedFuncs = countImportedFunctions(
|
|
7778
|
+
bytes,
|
|
7779
|
+
sections.find((s) => s.id === 2)
|
|
7780
|
+
);
|
|
7781
|
+
const code = sections.find((s) => s.id === 10);
|
|
7782
|
+
const definedFuncs = code ? wasmReader(bytes, code.start).u() : 0;
|
|
7783
|
+
const slotted = /* @__PURE__ */ new Set();
|
|
7784
|
+
const elements = sections.find((s) => s.id === 9);
|
|
7785
|
+
if (elements) {
|
|
7786
|
+
const r = wasmReader(bytes, elements.start);
|
|
7787
|
+
for (let n = r.u(); n > 0; n--) {
|
|
7788
|
+
const flags = r.u();
|
|
7789
|
+
if (flags !== 0 && flags !== 2) throw new Error(`sdk image element flags ${flags}`);
|
|
7790
|
+
if (flags === 2) r.u();
|
|
7791
|
+
constant2(r);
|
|
7792
|
+
if (flags === 2) r.byte();
|
|
7793
|
+
for (let i = 0, count = r.u(); i < count; i++) {
|
|
7794
|
+
const index = r.u();
|
|
7795
|
+
if (index >= importedFuncs) slotted.add(index);
|
|
7796
|
+
}
|
|
7797
|
+
}
|
|
7798
|
+
}
|
|
7799
|
+
return definedFuncs - slotted.size;
|
|
7663
7800
|
}
|
|
7664
7801
|
var uleb, sleb, encodedName, section, PROCESS_EXPORTS, SWIFT_SDK_CONSTRUCTOR_LIMIT, FUNCTION_RELOCATIONS, MEMORY_RELOCATIONS, ADDEND_RELOCATIONS, FUNCTION_RELOC_MASK, MEMORY_RELOC_MASK, ADDEND_RELOC_MASK;
|
|
7665
7802
|
var init_swift_sdk_image_wasm = __esm({
|
|
@@ -7921,6 +8058,11 @@ var init_swiftRuntimeProductContract = __esm({
|
|
|
7921
8058
|
});
|
|
7922
8059
|
|
|
7923
8060
|
// src/swift-wasm-prune.ts
|
|
8061
|
+
function sha256Hex(bytes) {
|
|
8062
|
+
if (typeof Bun !== "undefined")
|
|
8063
|
+
return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
|
|
8064
|
+
return (0, import_node_crypto8.createHash)("sha256").update(bytes).digest("hex");
|
|
8065
|
+
}
|
|
7924
8066
|
function readULEB2(b, o) {
|
|
7925
8067
|
let res = 0;
|
|
7926
8068
|
let shift = 0;
|
|
@@ -8673,6 +8815,42 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
8673
8815
|
}
|
|
8674
8816
|
}
|
|
8675
8817
|
}
|
|
8818
|
+
const segObjCClasses = /* @__PURE__ */ new Map();
|
|
8819
|
+
for (let segIdx = 0; segIdx < sEnds.length; segIdx++) {
|
|
8820
|
+
const rangeStart = dataStart + sPayloadStarts[segIdx];
|
|
8821
|
+
const rangeEnd = dataStart + sEnds[segIdx];
|
|
8822
|
+
const sliceLen = rangeEnd - rangeStart;
|
|
8823
|
+
if (sliceLen < 4) continue;
|
|
8824
|
+
const slice = Buffer.from(rawBuf.buffer, rawBuf.byteOffset + rangeStart, sliceLen);
|
|
8825
|
+
let segPos = 0;
|
|
8826
|
+
let classes;
|
|
8827
|
+
while (segPos < sliceLen - 3) {
|
|
8828
|
+
const at = slice.indexOf("So", segPos);
|
|
8829
|
+
if (at < 0 || at >= sliceLen - 2) break;
|
|
8830
|
+
let digitEnd = at + 2;
|
|
8831
|
+
let length = 0;
|
|
8832
|
+
while (digitEnd < sliceLen) {
|
|
8833
|
+
const ch = slice[digitEnd];
|
|
8834
|
+
if (ch < 48 || ch > 57) break;
|
|
8835
|
+
length = length * 10 + (ch - 48);
|
|
8836
|
+
digitEnd++;
|
|
8837
|
+
}
|
|
8838
|
+
if (digitEnd === at + 2) {
|
|
8839
|
+
segPos = at + 2;
|
|
8840
|
+
continue;
|
|
8841
|
+
}
|
|
8842
|
+
segPos = digitEnd;
|
|
8843
|
+
const nameEnd = digitEnd + length;
|
|
8844
|
+
if (nameEnd >= sliceLen || slice[nameEnd] !== 67) continue;
|
|
8845
|
+
const symbol = `._OBJC_CLASS_${slice.toString("latin1", digitEnd, nameEnd)}`;
|
|
8846
|
+
if (!classes) {
|
|
8847
|
+
classes = [symbol];
|
|
8848
|
+
segObjCClasses.set(segIdx, classes);
|
|
8849
|
+
} else if (!classes.includes(symbol)) {
|
|
8850
|
+
classes.push(symbol);
|
|
8851
|
+
}
|
|
8852
|
+
}
|
|
8853
|
+
}
|
|
8676
8854
|
return {
|
|
8677
8855
|
file,
|
|
8678
8856
|
isDist,
|
|
@@ -8702,10 +8880,7 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
8702
8880
|
objcCategoryTargets,
|
|
8703
8881
|
rootFuncs,
|
|
8704
8882
|
rootSegs,
|
|
8705
|
-
|
|
8706
|
-
dataStart + sPayloadStarts[i],
|
|
8707
|
-
dataStart + end
|
|
8708
|
-
])
|
|
8883
|
+
segObjCClasses
|
|
8709
8884
|
};
|
|
8710
8885
|
}
|
|
8711
8886
|
function parseWasmObjectFile(file, isDist) {
|
|
@@ -9073,16 +9248,26 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
9073
9248
|
transformations.set(file, {
|
|
9074
9249
|
output,
|
|
9075
9250
|
inputSha256,
|
|
9076
|
-
outputSha256: (
|
|
9251
|
+
outputSha256: sha256Hex(result),
|
|
9077
9252
|
kind
|
|
9078
9253
|
});
|
|
9079
9254
|
};
|
|
9080
9255
|
const distFiles = [];
|
|
9081
9256
|
const distBaseNames = /* @__PURE__ */ new Set();
|
|
9082
9257
|
const eagerFiles = [];
|
|
9258
|
+
const parsedBuildObjects = /* @__PURE__ */ new Map();
|
|
9083
9259
|
const lazyBuildObjects = /* @__PURE__ */ new Map();
|
|
9084
9260
|
const extraArchiveObjs = [];
|
|
9085
9261
|
const objectBytes = /* @__PURE__ */ new Map();
|
|
9262
|
+
const archiveMembers = /* @__PURE__ */ new Map();
|
|
9263
|
+
const readArchiveMembers = (archive) => {
|
|
9264
|
+
let members = archiveMembers.get(archive);
|
|
9265
|
+
if (!members) {
|
|
9266
|
+
members = readArMembers(new Uint8Array(import_node_fs16.default.readFileSync(archive)));
|
|
9267
|
+
archiveMembers.set(archive, members);
|
|
9268
|
+
}
|
|
9269
|
+
return members;
|
|
9270
|
+
};
|
|
9086
9271
|
let inStartLib = false;
|
|
9087
9272
|
let swiftrtOrigPath = "";
|
|
9088
9273
|
for (const t of tokens) {
|
|
@@ -9119,8 +9304,10 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
9119
9304
|
break;
|
|
9120
9305
|
}
|
|
9121
9306
|
}
|
|
9122
|
-
if (definesObjCClassOrCategory)
|
|
9123
|
-
|
|
9307
|
+
if (definesObjCClassOrCategory) {
|
|
9308
|
+
parsedBuildObjects.set(t, obj);
|
|
9309
|
+
eagerFiles.push(t);
|
|
9310
|
+
} else lazyBuildObjects.set(t, obj);
|
|
9124
9311
|
} else {
|
|
9125
9312
|
eagerFiles.push(t);
|
|
9126
9313
|
}
|
|
@@ -9128,7 +9315,7 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
9128
9315
|
lazyBuildObjects.set(t, parseWasmObjectFile(t, false));
|
|
9129
9316
|
}
|
|
9130
9317
|
} else if (!inStartLib && t.endsWith(".a") && !t.endsWith("libclang_rt.builtins-wasm64.a") && import_node_fs16.default.existsSync(t)) {
|
|
9131
|
-
const members =
|
|
9318
|
+
const members = readArchiveMembers(t);
|
|
9132
9319
|
for (const m of members) {
|
|
9133
9320
|
const object4 = parseWasmObjectBytes(`${t}(${m.name})`, m.bytes, false);
|
|
9134
9321
|
extraArchiveObjs.push(object4);
|
|
@@ -9151,7 +9338,7 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
9151
9338
|
);
|
|
9152
9339
|
const archiveOverlapsDist = (archive) => {
|
|
9153
9340
|
if (!import_node_fs16.default.existsSync(archive)) return false;
|
|
9154
|
-
const members =
|
|
9341
|
+
const members = readArchiveMembers(archive);
|
|
9155
9342
|
return members.some((m) => distBaseNames.has(m.name));
|
|
9156
9343
|
};
|
|
9157
9344
|
for (const t of tokens) {
|
|
@@ -9173,7 +9360,7 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
9173
9360
|
import_node_path17.default.basename(archive)
|
|
9174
9361
|
);
|
|
9175
9362
|
const ordinals = /* @__PURE__ */ new Map();
|
|
9176
|
-
for (const m of
|
|
9363
|
+
for (const m of readArchiveMembers(archive)) {
|
|
9177
9364
|
const ordinal = (ordinals.get(m.name) ?? 0) + 1;
|
|
9178
9365
|
ordinals.set(m.name, ordinal);
|
|
9179
9366
|
if (distBaseNames.has(m.name) || writtenLeftovers.has(m.name)) continue;
|
|
@@ -9207,7 +9394,7 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
9207
9394
|
recordTransformation(
|
|
9208
9395
|
swiftrtOrigPath,
|
|
9209
9396
|
patchedSwiftrtPath,
|
|
9210
|
-
link ? (
|
|
9397
|
+
link ? sha256Hex(input) : "",
|
|
9211
9398
|
result,
|
|
9212
9399
|
"swiftrt"
|
|
9213
9400
|
);
|
|
@@ -9694,7 +9881,7 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
9694
9881
|
}
|
|
9695
9882
|
for (const f of eagerFiles) {
|
|
9696
9883
|
const isDist = f.startsWith(distDir);
|
|
9697
|
-
const obj = distObjs.get(f) ?? parseWasmObjectFile(f, isDist);
|
|
9884
|
+
const obj = distObjs.get(f) ?? parsedBuildObjects.get(f) ?? parseWasmObjectFile(f, isDist);
|
|
9698
9885
|
extractObject(obj);
|
|
9699
9886
|
if (isDist) {
|
|
9700
9887
|
const base = import_node_path17.default.basename(f);
|
|
@@ -9744,32 +9931,9 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
9744
9931
|
"$s10Foundation6BundleC22preferredLocalizations4fromSaySSGAF_tFZTf4nd_n"
|
|
9745
9932
|
]);
|
|
9746
9933
|
const keepObjCClassesNamedInSegment = (obj, segIdx) => {
|
|
9747
|
-
const
|
|
9748
|
-
if (!
|
|
9749
|
-
const
|
|
9750
|
-
if (rangeEnd - rangeStart < 4) return;
|
|
9751
|
-
let bytes = objectBytes.get(obj);
|
|
9752
|
-
if (!bytes) objectBytes.set(obj, bytes = import_node_fs16.default.readFileSync(obj.file));
|
|
9753
|
-
let pos = rangeStart;
|
|
9754
|
-
while (pos < rangeEnd - 3) {
|
|
9755
|
-
const at = bytes.indexOf("So", pos);
|
|
9756
|
-
if (at < 0 || at >= rangeEnd - 2) break;
|
|
9757
|
-
let digitEnd = at + 2;
|
|
9758
|
-
let length = 0;
|
|
9759
|
-
while (digitEnd < rangeEnd) {
|
|
9760
|
-
const ch = bytes[digitEnd];
|
|
9761
|
-
if (ch < 48 || ch > 57) break;
|
|
9762
|
-
length = length * 10 + (ch - 48);
|
|
9763
|
-
digitEnd++;
|
|
9764
|
-
}
|
|
9765
|
-
if (digitEnd === at + 2) {
|
|
9766
|
-
pos = at + 2;
|
|
9767
|
-
continue;
|
|
9768
|
-
}
|
|
9769
|
-
pos = digitEnd;
|
|
9770
|
-
const nameEnd = digitEnd + length;
|
|
9771
|
-
if (nameEnd >= rangeEnd || bytes[nameEnd] !== 67) continue;
|
|
9772
|
-
const symbol = `._OBJC_CLASS_${bytes.toString("latin1", digitEnd, nameEnd)}`;
|
|
9934
|
+
const symbols = obj.segObjCClasses.get(segIdx);
|
|
9935
|
+
if (!symbols) return;
|
|
9936
|
+
for (const symbol of symbols) {
|
|
9773
9937
|
for (const provider of lazyProviders.get(symbol) ?? []) {
|
|
9774
9938
|
eagerDynamicObjects.add(provider);
|
|
9775
9939
|
extractObject(provider);
|
|
@@ -9865,7 +10029,7 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
9865
10029
|
const cached2 = objectBytes.get(obj);
|
|
9866
10030
|
const buf = cached2 ? new Uint8Array(cached2) : new Uint8Array(import_node_fs16.default.readFileSync(obj.file));
|
|
9867
10031
|
const rawBuf = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
9868
|
-
const inputSha256 = link ? (
|
|
10032
|
+
const inputSha256 = link ? sha256Hex(buf) : "";
|
|
9869
10033
|
const fLive = liveFuncs.get(obj);
|
|
9870
10034
|
const sLive = liveSegs.get(obj);
|
|
9871
10035
|
const dLive = liveDataSyms.get(obj);
|
|
@@ -12063,21 +12227,34 @@ var init_wasm_binary_sections = __esm({
|
|
|
12063
12227
|
});
|
|
12064
12228
|
|
|
12065
12229
|
// src/wasm-narrow-boundary.ts
|
|
12066
|
-
function
|
|
12067
|
-
|
|
12068
|
-
|
|
12069
|
-
|
|
12070
|
-
|
|
12230
|
+
function writeWasmCustomSections(bytes, entries2) {
|
|
12231
|
+
if (entries2.length === 0) return Buffer.concat([bytes]);
|
|
12232
|
+
const replaced = new Set(entries2.map(([name3]) => name3));
|
|
12233
|
+
const parts = [];
|
|
12234
|
+
let sliceStart = 0;
|
|
12235
|
+
let sliceEnd = 8;
|
|
12236
|
+
for (const { id, start, end } of wasmSections2(bytes)) {
|
|
12237
|
+
if (id === 0 && replaced.has(readWasmSection(bytes, start, end).name())) {
|
|
12238
|
+
if (sliceEnd > sliceStart) parts.push(bytes.subarray(sliceStart, sliceEnd));
|
|
12239
|
+
sliceStart = end;
|
|
12240
|
+
sliceEnd = end;
|
|
12241
|
+
} else {
|
|
12242
|
+
sliceEnd = end;
|
|
12243
|
+
}
|
|
12244
|
+
}
|
|
12245
|
+
if (sliceEnd > sliceStart) parts.push(bytes.subarray(sliceStart, sliceEnd));
|
|
12246
|
+
for (const [name3, data] of entries2) {
|
|
12247
|
+
const nameBytes = Buffer.from(encodeWasmName(name3));
|
|
12248
|
+
parts.push(
|
|
12249
|
+
Buffer.from([0, ...encodeWasmNumber(nameBytes.length + data.length)]),
|
|
12250
|
+
nameBytes,
|
|
12251
|
+
data
|
|
12252
|
+
);
|
|
12071
12253
|
}
|
|
12072
12254
|
return Buffer.concat(parts);
|
|
12073
12255
|
}
|
|
12074
12256
|
function writeWasmCustomSection(bytes, name3, data) {
|
|
12075
|
-
|
|
12076
|
-
return Buffer.concat([
|
|
12077
|
-
dropWasmCustomSection(bytes, name3),
|
|
12078
|
-
Buffer.from([0, ...encodeWasmNumber(section2.length)]),
|
|
12079
|
-
section2
|
|
12080
|
-
]);
|
|
12257
|
+
return writeWasmCustomSections(bytes, [[name3, data]]);
|
|
12081
12258
|
}
|
|
12082
12259
|
function readWasmMemory(bytes) {
|
|
12083
12260
|
return readWasmMemoryAndTableImports(bytes, wasmSections2(bytes)).memory;
|
|
@@ -12349,6 +12526,11 @@ var init_wasm_narrow_boundary = __esm({
|
|
|
12349
12526
|
});
|
|
12350
12527
|
|
|
12351
12528
|
// src/swift-guest-dyld-table.ts
|
|
12529
|
+
function sha256Buffer(bytes) {
|
|
12530
|
+
if (typeof Bun !== "undefined")
|
|
12531
|
+
return Buffer.from(new Bun.CryptoHasher("sha256").update(bytes).digest());
|
|
12532
|
+
return (0, import_node_crypto11.createHash)("sha256").update(bytes).digest();
|
|
12533
|
+
}
|
|
12352
12534
|
function uleb3(value) {
|
|
12353
12535
|
const bytes = [];
|
|
12354
12536
|
for (let rest = value; ; rest = Math.floor(rest / 128)) {
|
|
@@ -12383,7 +12565,7 @@ function encodeGuestDyldTable(rows) {
|
|
|
12383
12565
|
}
|
|
12384
12566
|
const file = Buffer.concat(packs);
|
|
12385
12567
|
const header = Buffer.alloc(40 + packs.length * 8);
|
|
12386
|
-
(
|
|
12568
|
+
sha256Buffer(file).copy(header, 0);
|
|
12387
12569
|
header.writeUInt32LE(file.length, 32);
|
|
12388
12570
|
header.writeUInt32LE(packs.length, 36);
|
|
12389
12571
|
let offset = 0;
|
|
@@ -12395,11 +12577,11 @@ function encodeGuestDyldTable(rows) {
|
|
|
12395
12577
|
const names = firsts.flatMap((name3) => [name3, Buffer.of(0)]);
|
|
12396
12578
|
return { index: Buffer.concat([header, ...names]), packs: file };
|
|
12397
12579
|
}
|
|
12398
|
-
function moveGuestDyldTable(map, wasm, symbols, bindingValues = /* @__PURE__ */ new Map()) {
|
|
12580
|
+
function moveGuestDyldTable(map, wasm, symbols, bindingValues = /* @__PURE__ */ new Map(), extraSections = []) {
|
|
12399
12581
|
const range = guestDyldValueRange(map);
|
|
12400
12582
|
if (!range) {
|
|
12401
12583
|
if (symbols.length) throw new Error("link map has no dyld values");
|
|
12402
|
-
return wasm;
|
|
12584
|
+
return extraSections.length ? writeWasmCustomSections(wasm, extraSections) : wasm;
|
|
12403
12585
|
}
|
|
12404
12586
|
if (range.length !== symbols.length * 8)
|
|
12405
12587
|
throw new Error("linked dyld values do not match the ledger rows");
|
|
@@ -12414,11 +12596,11 @@ function moveGuestDyldTable(map, wasm, symbols, bindingValues = /* @__PURE__ */
|
|
|
12414
12596
|
return binding === void 0 ? { name: name3, image, kind: 0, value: view.getBigUint64(index2 * 8, true) } : { name: name3, image, kind: 1, value: BigInt(binding) };
|
|
12415
12597
|
});
|
|
12416
12598
|
const { index, packs } = encodeGuestDyldTable(rows);
|
|
12417
|
-
return
|
|
12418
|
-
|
|
12419
|
-
NATIVE_DYLD_PACKS_SECTION,
|
|
12420
|
-
|
|
12421
|
-
);
|
|
12599
|
+
return writeWasmCustomSections(taken.wasm, [
|
|
12600
|
+
[NATIVE_DYLD_TABLE_SECTION, index],
|
|
12601
|
+
[NATIVE_DYLD_PACKS_SECTION, packs],
|
|
12602
|
+
...extraSections
|
|
12603
|
+
]);
|
|
12422
12604
|
}
|
|
12423
12605
|
function guestDyldValueRange(map) {
|
|
12424
12606
|
const suffix = `:(${GUEST_DYLD_VALUES_SECTION})`;
|
|
@@ -12968,6 +13150,7 @@ function finalizeGuestProjectionStorage(options) {
|
|
|
12968
13150
|
const owner = options.owners.get(options.projectionObject);
|
|
12969
13151
|
if (owner === void 0) throw new Error("guest projection object has no image owner");
|
|
12970
13152
|
const ranges = [];
|
|
13153
|
+
const data = [];
|
|
12971
13154
|
const spans = guestLinkedSpans(
|
|
12972
13155
|
options.map,
|
|
12973
13156
|
options.linked,
|
|
@@ -12978,7 +13161,8 @@ function finalizeGuestProjectionStorage(options) {
|
|
|
12978
13161
|
{
|
|
12979
13162
|
trackedObject: options.projectionObject,
|
|
12980
13163
|
trackedObjectOwner: owner,
|
|
12981
|
-
trackedLinearSpans: ranges
|
|
13164
|
+
trackedLinearSpans: ranges,
|
|
13165
|
+
optimizedDataSegments: data
|
|
12982
13166
|
}
|
|
12983
13167
|
);
|
|
12984
13168
|
const images = planGuestProjectionRegions(
|
|
@@ -12987,7 +13171,6 @@ function finalizeGuestProjectionStorage(options) {
|
|
|
12987
13171
|
options.sdkSpans ? [...spans, ...options.sdkSpans] : spans
|
|
12988
13172
|
);
|
|
12989
13173
|
const result = Buffer.from(options.optimized);
|
|
12990
|
-
const data = guestWasmDataSegments(options.optimized, options.sdkSpans === void 0);
|
|
12991
13174
|
const locations = /* @__PURE__ */ new Map();
|
|
12992
13175
|
const counts = /* @__PURE__ */ new Map();
|
|
12993
13176
|
const uuids = /* @__PURE__ */ new Map();
|
|
@@ -13970,17 +14153,17 @@ var init_binaryen_lock = __esm({
|
|
|
13970
14153
|
"linux-x64": {
|
|
13971
14154
|
asset: "x86_64-linux",
|
|
13972
14155
|
upstreamSha256: "195ddc94f9bc89f45abdabb0b9eea86023d727ba90eac8b35b80f2544fc30572",
|
|
13973
|
-
sha256: "
|
|
14156
|
+
sha256: "40062fb1ebbad7f04f361c1e3bb309dffb1d2318dd2e12235a0e7e820e18d6c9"
|
|
13974
14157
|
},
|
|
13975
14158
|
"linux-arm64": {
|
|
13976
14159
|
asset: "aarch64-linux",
|
|
13977
14160
|
upstreamSha256: "c58562417836c5d0493d89bdefc434933bdc097db641b483df86bcfa557a107f",
|
|
13978
|
-
sha256: "
|
|
14161
|
+
sha256: "d79b09d5b66f62f9e4bb691517b174b42bcdc0b7f40769d1993b7c565b0a54c7"
|
|
13979
14162
|
},
|
|
13980
14163
|
"darwin-arm64": {
|
|
13981
14164
|
asset: "arm64-macos",
|
|
13982
14165
|
upstreamSha256: "98aad827847af7ef990ed7098d885725c8e5b5aae75073403635617ae4e259aa",
|
|
13983
|
-
sha256: "
|
|
14166
|
+
sha256: "29342632a4fa52466c4feea846698fe5aa56ff46226a914d60b65b8735373d63"
|
|
13984
14167
|
}
|
|
13985
14168
|
}
|
|
13986
14169
|
};
|
|
@@ -14498,6 +14681,7 @@ function outputPath(args) {
|
|
|
14498
14681
|
}
|
|
14499
14682
|
function withOutput(args, output, discovery) {
|
|
14500
14683
|
const result = [];
|
|
14684
|
+
let stripsDebug = false;
|
|
14501
14685
|
for (let i = 0; i < args.length; i++) {
|
|
14502
14686
|
const arg = args[i];
|
|
14503
14687
|
if (arg === "-o" || arg === "--output") {
|
|
@@ -14507,9 +14691,12 @@ function withOutput(args, output, discovery) {
|
|
|
14507
14691
|
if (arg.startsWith("--output=")) continue;
|
|
14508
14692
|
if (discovery && (arg.startsWith("--why-extract=") || arg.startsWith("--Map=")))
|
|
14509
14693
|
continue;
|
|
14694
|
+
if (arg === "--strip-debug" || arg === "-S" || arg === "--strip-all" || arg === "-s")
|
|
14695
|
+
stripsDebug = true;
|
|
14510
14696
|
result.push(arg);
|
|
14511
14697
|
}
|
|
14512
14698
|
if (discovery) result.push("--allow-multiple-definition");
|
|
14699
|
+
if (!stripsDebug) result.push("--strip-debug");
|
|
14513
14700
|
result.push("-o", output);
|
|
14514
14701
|
return result;
|
|
14515
14702
|
}
|
|
@@ -14540,6 +14727,37 @@ async function linkGuestImages(options) {
|
|
|
14540
14727
|
}
|
|
14541
14728
|
return import_node_fs24.default.readFileSync(trace, "utf8");
|
|
14542
14729
|
};
|
|
14730
|
+
const runLinkAsync = async (name3, arguments_) => {
|
|
14731
|
+
const response = import_node_path24.default.join(directory, `${name3}.rsp`);
|
|
14732
|
+
const trace = import_node_path24.default.join(directory, `${name3}-inputs.txt`);
|
|
14733
|
+
import_node_fs24.default.writeFileSync(
|
|
14734
|
+
response,
|
|
14735
|
+
[...arguments_, "--trace"].map((argument2) => JSON.stringify(argument2)).join(" ")
|
|
14736
|
+
);
|
|
14737
|
+
const output = import_node_fs24.default.openSync(trace, "w");
|
|
14738
|
+
try {
|
|
14739
|
+
await new Promise((resolve, reject) => {
|
|
14740
|
+
const child = (0, import_node_child_process14.spawn)(wasmLd, [`@${response}`], {
|
|
14741
|
+
stdio: ["ignore", output, "pipe"]
|
|
14742
|
+
});
|
|
14743
|
+
const stderr = [];
|
|
14744
|
+
child.stderr?.on("data", (chunk) => stderr.push(chunk));
|
|
14745
|
+
child.once("error", reject);
|
|
14746
|
+
child.once("close", (code, signal) => {
|
|
14747
|
+
if (code === 0) resolve();
|
|
14748
|
+
else
|
|
14749
|
+
reject(
|
|
14750
|
+
new Error(
|
|
14751
|
+
`wasm-ld (${name3}) failed (${signal ?? code}): ${Buffer.concat(stderr).toString("utf8")}`
|
|
14752
|
+
)
|
|
14753
|
+
);
|
|
14754
|
+
});
|
|
14755
|
+
});
|
|
14756
|
+
} finally {
|
|
14757
|
+
import_node_fs24.default.closeSync(output);
|
|
14758
|
+
}
|
|
14759
|
+
return import_node_fs24.default.readFileSync(trace, "utf8");
|
|
14760
|
+
};
|
|
14543
14761
|
const preselection = options.projection && options.preselectionDiscovery ? options.preselectionDiscovery : void 0;
|
|
14544
14762
|
let discoveryProjection;
|
|
14545
14763
|
if (options.projection) {
|
|
@@ -14769,6 +14987,7 @@ async function linkGuestImages(options) {
|
|
|
14769
14987
|
};
|
|
14770
14988
|
const ledgerObjectPromise = compileLedgerAsync("ledger", ledger.llvmIR);
|
|
14771
14989
|
const appLedgerObjectPromise = options.onSplitInputs && ledger.appLLVMIR ? compileLedgerAsync("app-ledger", ledger.appLLVMIR) : void 0;
|
|
14990
|
+
let deferredFinalLink;
|
|
14772
14991
|
try {
|
|
14773
14992
|
const replacements = /* @__PURE__ */ new Map();
|
|
14774
14993
|
const linkedOwners = /* @__PURE__ */ new Map();
|
|
@@ -14870,7 +15089,7 @@ async function linkGuestImages(options) {
|
|
|
14870
15089
|
});
|
|
14871
15090
|
const finalOutput = import_node_path24.default.join(directory, "final.wasm");
|
|
14872
15091
|
const finalWhy = import_node_path24.default.join(directory, "final-why-extract.txt");
|
|
14873
|
-
const
|
|
15092
|
+
const finalLinkArgs = (projectionObject2, layoutMap) => [
|
|
14874
15093
|
...withOutput(finalArgs, finalOutput, false),
|
|
14875
15094
|
ledgerObject,
|
|
14876
15095
|
`@${lazyExports}`,
|
|
@@ -14878,10 +15097,38 @@ async function linkGuestImages(options) {
|
|
|
14878
15097
|
...provider ? [`--undefined=${providerSymbol}`] : [],
|
|
14879
15098
|
...layoutMap ? [`--Map=${layoutMap}`] : [],
|
|
14880
15099
|
`--why-extract=${finalWhy}`
|
|
14881
|
-
]
|
|
15100
|
+
];
|
|
15101
|
+
const linkFinal = (projectionObject2, layoutMap) => runLink("final", finalLinkArgs(projectionObject2, layoutMap));
|
|
15102
|
+
const finalizeFinalLink = (trace) => {
|
|
15103
|
+
const finalSelection = selectedGuestLinkInputs(
|
|
15104
|
+
remapGuestLinkPlan(plan, replacements),
|
|
15105
|
+
finalArgs,
|
|
15106
|
+
import_node_fs24.default.readFileSync(finalWhy, "utf8"),
|
|
15107
|
+
trace,
|
|
15108
|
+
finalArchives
|
|
15109
|
+
);
|
|
15110
|
+
const original = new Map(
|
|
15111
|
+
[...replacements].map(([before2, after2]) => [after2, before2])
|
|
15112
|
+
);
|
|
15113
|
+
const key = (item) => JSON.stringify([original.get(item.artifact) ?? item.artifact, item.member]);
|
|
15114
|
+
const before = new Set(selected.map(key));
|
|
15115
|
+
const after = new Set(finalSelection.map(key));
|
|
15116
|
+
const changed = [...before].filter((item) => !after.has(item));
|
|
15117
|
+
changed.push(...[...after].filter((item) => !before.has(item)));
|
|
15118
|
+
if (changed.length)
|
|
15119
|
+
throw new Error(
|
|
15120
|
+
`guest link selected different inputs after rewriting:
|
|
15121
|
+
${changed.join("\n")}`
|
|
15122
|
+
);
|
|
15123
|
+
import_node_fs24.default.renameSync(finalOutput, outputPath(args));
|
|
15124
|
+
if (KEEP_WASM_NAMES)
|
|
15125
|
+
import_node_fs24.default.writeFileSync(
|
|
15126
|
+
outputPath(args),
|
|
15127
|
+
nameGuestImageAliases(import_node_fs24.default.readFileSync(outputPath(args)), plan.symbols)
|
|
15128
|
+
);
|
|
15129
|
+
};
|
|
14882
15130
|
let projectionObject;
|
|
14883
15131
|
let projectionStorage;
|
|
14884
|
-
let finalTrace;
|
|
14885
15132
|
if (options.projection) {
|
|
14886
15133
|
const projection = options.projection;
|
|
14887
15134
|
if (!plan.images.some((image) => image.id === projection.image))
|
|
@@ -14934,8 +15181,18 @@ async function linkGuestImages(options) {
|
|
|
14934
15181
|
[...projection.clangOptions, "-c", projectionSource, "-o", projectionObject],
|
|
14935
15182
|
{ stdio: "pipe" }
|
|
14936
15183
|
);
|
|
14937
|
-
|
|
14938
|
-
|
|
15184
|
+
if (sharedSdk && options.onFinalLink && options.onSplitInputs && appLedgerObjectPromise) {
|
|
15185
|
+
deferredFinalLink = runLinkAsync(
|
|
15186
|
+
"final",
|
|
15187
|
+
finalLinkArgs(projectionObject, callerMap ? void 0 : layoutMap)
|
|
15188
|
+
).then((trace) => finalizeFinalLink(trace));
|
|
15189
|
+
break;
|
|
15190
|
+
}
|
|
15191
|
+
const finalTrace = linkFinal(projectionObject, callerMap ? void 0 : layoutMap);
|
|
15192
|
+
if (sharedSdk) {
|
|
15193
|
+
finalizeFinalLink(finalTrace);
|
|
15194
|
+
break;
|
|
15195
|
+
}
|
|
14939
15196
|
const wasm = import_node_fs24.default.readFileSync(finalOutput);
|
|
14940
15197
|
const actual = guestProjectionRegionCounts(
|
|
14941
15198
|
images.length,
|
|
@@ -14947,38 +15204,17 @@ async function linkGuestImages(options) {
|
|
|
14947
15204
|
sectionOwners
|
|
14948
15205
|
)
|
|
14949
15206
|
);
|
|
14950
|
-
if (actual.every((count, index) => count <= capacities[index].regions))
|
|
15207
|
+
if (actual.every((count, index) => count <= capacities[index].regions)) {
|
|
15208
|
+
finalizeFinalLink(finalTrace);
|
|
15209
|
+
break;
|
|
15210
|
+
}
|
|
14951
15211
|
capacities = capacities.map((capacity, index) => ({
|
|
14952
15212
|
...capacity,
|
|
14953
15213
|
regions: Math.max(actual[index], capacity.regions)
|
|
14954
15214
|
}));
|
|
14955
15215
|
}
|
|
14956
15216
|
linkedOwners.set(projectionObject, projection.image);
|
|
14957
|
-
} else
|
|
14958
|
-
const finalSelection = selectedGuestLinkInputs(
|
|
14959
|
-
remapGuestLinkPlan(plan, replacements),
|
|
14960
|
-
finalArgs,
|
|
14961
|
-
import_node_fs24.default.readFileSync(finalWhy, "utf8"),
|
|
14962
|
-
finalTrace,
|
|
14963
|
-
finalArchives
|
|
14964
|
-
);
|
|
14965
|
-
const original = new Map([...replacements].map(([before2, after2]) => [after2, before2]));
|
|
14966
|
-
const key = (item) => JSON.stringify([original.get(item.artifact) ?? item.artifact, item.member]);
|
|
14967
|
-
const before = new Set(selected.map(key));
|
|
14968
|
-
const after = new Set(finalSelection.map(key));
|
|
14969
|
-
const changed = [...before].filter((item) => !after.has(item));
|
|
14970
|
-
changed.push(...[...after].filter((item) => !before.has(item)));
|
|
14971
|
-
if (changed.length)
|
|
14972
|
-
throw new Error(
|
|
14973
|
-
`guest link selected different inputs after rewriting:
|
|
14974
|
-
${changed.join("\n")}`
|
|
14975
|
-
);
|
|
14976
|
-
import_node_fs24.default.renameSync(finalOutput, outputPath(args));
|
|
14977
|
-
if (KEEP_WASM_NAMES)
|
|
14978
|
-
import_node_fs24.default.writeFileSync(
|
|
14979
|
-
outputPath(args),
|
|
14980
|
-
nameGuestImageAliases(import_node_fs24.default.readFileSync(outputPath(args)), plan.symbols)
|
|
14981
|
-
);
|
|
15217
|
+
} else finalizeFinalLink(linkFinal());
|
|
14982
15218
|
if (projectionStorage && projectionObject)
|
|
14983
15219
|
options.projection.onReserved(projectionStorage, projectionObject);
|
|
14984
15220
|
options.onLinkedOwners?.(linkedOwners);
|
|
@@ -15014,11 +15250,13 @@ ${changed.join("\n")}`
|
|
|
15014
15250
|
appDefinedSymbols
|
|
15015
15251
|
});
|
|
15016
15252
|
}
|
|
15253
|
+
if (deferredFinalLink) options.onFinalLink?.(deferredFinalLink);
|
|
15017
15254
|
return selected;
|
|
15018
15255
|
} catch (error) {
|
|
15019
15256
|
await Promise.allSettled([
|
|
15020
15257
|
ledgerObjectPromise,
|
|
15021
|
-
...appLedgerObjectPromise ? [appLedgerObjectPromise] : []
|
|
15258
|
+
...appLedgerObjectPromise ? [appLedgerObjectPromise] : [],
|
|
15259
|
+
...deferredFinalLink ? [deferredFinalLink] : []
|
|
15022
15260
|
]);
|
|
15023
15261
|
throw error;
|
|
15024
15262
|
}
|
|
@@ -15650,6 +15888,7 @@ async function linkPrunedGuestImages(options) {
|
|
|
15650
15888
|
identities: aliasGuestLinkIdentities(identities, prepared.archives)
|
|
15651
15889
|
};
|
|
15652
15890
|
}
|
|
15891
|
+
let finalLinkDone;
|
|
15653
15892
|
const selected = await linkCompleteGuestImages({
|
|
15654
15893
|
plan,
|
|
15655
15894
|
args: [...linkedArgs, `--Map=${options.mapPath}`],
|
|
@@ -15663,6 +15902,9 @@ async function linkPrunedGuestImages(options) {
|
|
|
15663
15902
|
resolvePlan: options.resolvePlan,
|
|
15664
15903
|
sharedSdk: options.sharedSdk,
|
|
15665
15904
|
onSplitInputs: options.onSplitInputs,
|
|
15905
|
+
onFinalLink: options.deferFinalLink ? (done) => {
|
|
15906
|
+
finalLinkDone = done;
|
|
15907
|
+
} : void 0,
|
|
15666
15908
|
onDyldRows: options.onDyldRows,
|
|
15667
15909
|
onLinkedOwners: (value) => {
|
|
15668
15910
|
owners = value;
|
|
@@ -15676,7 +15918,8 @@ async function linkPrunedGuestImages(options) {
|
|
|
15676
15918
|
owners,
|
|
15677
15919
|
generatedSectionOwners,
|
|
15678
15920
|
sdk,
|
|
15679
|
-
mapPath: options.mapPath
|
|
15921
|
+
mapPath: options.mapPath,
|
|
15922
|
+
finalLinkDone
|
|
15680
15923
|
};
|
|
15681
15924
|
}
|
|
15682
15925
|
var import_node_child_process14, import_node_fs24, import_node_path24, import_node_util3, execFileAsync, WASM_MAGIC, BITCODE_MAGIC;
|
|
@@ -15754,8 +15997,13 @@ function clangBinaryStamp(file) {
|
|
|
15754
15997
|
const stat = (0, import_node_fs25.statSync)(file, { bigint: true });
|
|
15755
15998
|
return [file, stat.size, stat.mtimeNs].join(":");
|
|
15756
15999
|
}
|
|
16000
|
+
function sha256Hex2(bytes) {
|
|
16001
|
+
if (typeof Bun !== "undefined")
|
|
16002
|
+
return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
|
|
16003
|
+
return (0, import_node_crypto17.createHash)("sha256").update(bytes).digest("hex");
|
|
16004
|
+
}
|
|
15757
16005
|
function clangWrapperStamp(file) {
|
|
15758
|
-
return (
|
|
16006
|
+
return sha256Hex2((0, import_node_fs25.readFileSync)(file));
|
|
15759
16007
|
}
|
|
15760
16008
|
function clangArgsNeedCwd(args) {
|
|
15761
16009
|
const pathFlags = /* @__PURE__ */ new Set([
|
|
@@ -15905,22 +16153,35 @@ function sourceGuestClangLinkOptions(options) {
|
|
|
15905
16153
|
"SOURCE_DATE_EPOCH"
|
|
15906
16154
|
].map((name3) => process.env[name3] ?? "");
|
|
15907
16155
|
const replays = [];
|
|
16156
|
+
const realPathCache = /* @__PURE__ */ new Map();
|
|
16157
|
+
const cachedRealpath = (file) => {
|
|
16158
|
+
let resolved = realPathCache.get(file);
|
|
16159
|
+
if (resolved === void 0) {
|
|
16160
|
+
resolved = (0, import_node_fs25.realpathSync)(file);
|
|
16161
|
+
realPathCache.set(file, resolved);
|
|
16162
|
+
}
|
|
16163
|
+
return resolved;
|
|
16164
|
+
};
|
|
16165
|
+
const resolvedSwiftCompiler = cachedRealpath(options.swiftCompiler);
|
|
15908
16166
|
let clang;
|
|
16167
|
+
let clangWrapper;
|
|
15909
16168
|
let clangStamp;
|
|
15910
16169
|
let wrapperStamp;
|
|
15911
16170
|
for (const file of wanted) {
|
|
15912
16171
|
const command = commands.get(file);
|
|
15913
16172
|
if (!command) throw new Error(`missing source object producer ${file}`);
|
|
15914
16173
|
if (command.tool === "shell") {
|
|
15915
|
-
if (!command.args.length || (
|
|
16174
|
+
if (!command.args.length || cachedRealpath(command.args[0]) !== resolvedSwiftCompiler)
|
|
15916
16175
|
throw new Error(`unsupported source object producer ${file}`);
|
|
15917
16176
|
continue;
|
|
15918
16177
|
}
|
|
15919
|
-
const compiler = command.args[0] ? (
|
|
15920
|
-
clang ??= (
|
|
15921
|
-
if (command.tool !== "clang" || compiler !== clang && compiler !== (
|
|
16178
|
+
const compiler = command.args[0] ? cachedRealpath(command.args[0]) : "";
|
|
16179
|
+
clang ??= cachedRealpath(import_node_path25.default.join(options.toolchainBin, "clang"));
|
|
16180
|
+
if (command.tool !== "clang" || compiler !== clang && compiler !== (clangWrapper ??= cachedRealpath(
|
|
16181
|
+
import_node_path25.default.join(options.buildDirectory, CLANG_TARGET_MODULE_WRAPPER)
|
|
16182
|
+
)))
|
|
15922
16183
|
throw new Error(`unsupported source object producer ${file}`);
|
|
15923
|
-
const key = (
|
|
16184
|
+
const key = sha256Hex2(
|
|
15924
16185
|
JSON.stringify([
|
|
15925
16186
|
"clang-link-options/v2",
|
|
15926
16187
|
clangArgsNeedCwd(command.args) ? process.cwd() : null,
|
|
@@ -15930,11 +16191,8 @@ function sourceGuestClangLinkOptions(options) {
|
|
|
15930
16191
|
compiler === clang ? null : wrapperStamp ??= clangWrapperStamp(compiler),
|
|
15931
16192
|
clangProducerStamp(file)
|
|
15932
16193
|
])
|
|
15933
|
-
).digest("hex");
|
|
15934
|
-
const cacheFile = import_node_path25.default.join(
|
|
15935
|
-
cacheDirectory,
|
|
15936
|
-
(0, import_node_crypto17.createHash)("sha256").update(file).digest("hex") + ".json"
|
|
15937
16194
|
);
|
|
16195
|
+
const cacheFile = import_node_path25.default.join(cacheDirectory, sha256Hex2(file) + ".json");
|
|
15938
16196
|
const cached2 = readClangLinkOptions(cacheFile, key);
|
|
15939
16197
|
if (cached2) {
|
|
15940
16198
|
validateClangLinkOptions(cached2);
|
|
@@ -19300,6 +19558,7 @@ async function linkSwiftSdkImage(moduleRoot, key, directory, work, scopedLookups
|
|
|
19300
19558
|
].map((name3) => `--export=${name3}`),
|
|
19301
19559
|
`@${import_node_path37.default.join(work, "exports.rsp")}`,
|
|
19302
19560
|
"--gc-sections",
|
|
19561
|
+
"--strip-debug",
|
|
19303
19562
|
// strings stay with their objects, so an app loads only the ones its pieces reference
|
|
19304
19563
|
"-O0"
|
|
19305
19564
|
];
|
|
@@ -19360,7 +19619,7 @@ async function linkSwiftSdkImage(moduleRoot, key, directory, work, scopedLookups
|
|
|
19360
19619
|
(0, import_node_fs37.writeFileSync)(import_node_path37.default.join(work, INTERFACE_FILE), JSON.stringify(sdkInterface));
|
|
19361
19620
|
(0, import_node_fs37.writeFileSync)(
|
|
19362
19621
|
import_node_path37.default.join(work, IMAGE_DIGEST),
|
|
19363
|
-
(0, import_node_crypto25.createHash)("sha256").update(image).digest("hex")
|
|
19622
|
+
typeof Bun !== "undefined" ? new Bun.CryptoHasher("sha256").update(image).digest("hex") : (0, import_node_crypto25.createHash)("sha256").update(image).digest("hex")
|
|
19364
19623
|
);
|
|
19365
19624
|
if (swiftSdkImageKey(
|
|
19366
19625
|
moduleRoot,
|
|
@@ -19800,6 +20059,7 @@ __export(swift_sdk_app_module_exports, {
|
|
|
19800
20059
|
readSwiftSdkUsage: () => readSwiftSdkUsage,
|
|
19801
20060
|
selectSwiftSdkData: () => selectSwiftSdkData,
|
|
19802
20061
|
swiftAppModuleInputs: () => swiftAppModuleInputs,
|
|
20062
|
+
swiftAppModuleThunkSection: () => swiftAppModuleThunkSection,
|
|
19803
20063
|
swiftSdkProjectionSpans: () => swiftSdkProjectionSpans,
|
|
19804
20064
|
writeSwiftSdkAppLink: () => writeSwiftSdkAppLink
|
|
19805
20065
|
});
|
|
@@ -19851,9 +20111,12 @@ async function buildSwiftAppModule(options) {
|
|
|
19851
20111
|
linkage: link.linkage,
|
|
19852
20112
|
usage
|
|
19853
20113
|
});
|
|
19854
|
-
(
|
|
20114
|
+
finishSwiftAppModuleFile(options.output);
|
|
19855
20115
|
return binding;
|
|
19856
20116
|
}
|
|
20117
|
+
function swiftAppModuleThunkSection(lowered) {
|
|
20118
|
+
return [NATIVE_SDK_THUNK_SECTION, sdkImportThunks(lowered)];
|
|
20119
|
+
}
|
|
19857
20120
|
function finishSwiftAppModule(lowered) {
|
|
19858
20121
|
return writeWasmCustomSection(
|
|
19859
20122
|
lowered,
|
|
@@ -19861,6 +20124,73 @@ function finishSwiftAppModule(lowered) {
|
|
|
19861
20124
|
sdkImportThunks(lowered)
|
|
19862
20125
|
);
|
|
19863
20126
|
}
|
|
20127
|
+
function finishSwiftAppModuleFile(file) {
|
|
20128
|
+
const fd = (0, import_node_fs38.openSync)(file, "r");
|
|
20129
|
+
let prefixEnd = 8;
|
|
20130
|
+
let hasExistingThunk = false;
|
|
20131
|
+
let prefix;
|
|
20132
|
+
try {
|
|
20133
|
+
const total = (0, import_node_fs38.fstatSync)(fd).size;
|
|
20134
|
+
const probe = Buffer.allocUnsafe(16);
|
|
20135
|
+
let offset = 8;
|
|
20136
|
+
while (offset < total) {
|
|
20137
|
+
const read = (0, import_node_fs38.readSync)(fd, probe, 0, Math.min(16, total - offset), offset);
|
|
20138
|
+
if (read < 2) break;
|
|
20139
|
+
const id = probe[0];
|
|
20140
|
+
let size = 0;
|
|
20141
|
+
let shift = 0;
|
|
20142
|
+
let at = 1;
|
|
20143
|
+
for (; ; ) {
|
|
20144
|
+
const byte = probe[at++];
|
|
20145
|
+
size += (byte & 127) * 2 ** shift;
|
|
20146
|
+
if (!(byte & 128)) break;
|
|
20147
|
+
shift += 7;
|
|
20148
|
+
}
|
|
20149
|
+
const start = offset + at;
|
|
20150
|
+
const next = start + size;
|
|
20151
|
+
if (id === 1 || id === 2) prefixEnd = next;
|
|
20152
|
+
else if (id === 0) {
|
|
20153
|
+
const nameBuf = Buffer.allocUnsafe(Math.min(128, size));
|
|
20154
|
+
const nRead = (0, import_node_fs38.readSync)(fd, nameBuf, 0, nameBuf.length, start);
|
|
20155
|
+
let nLen = 0;
|
|
20156
|
+
let nShift = 0;
|
|
20157
|
+
let nAt = 0;
|
|
20158
|
+
for (; ; ) {
|
|
20159
|
+
if (nAt >= nRead) break;
|
|
20160
|
+
const byte = nameBuf[nAt++];
|
|
20161
|
+
nLen += (byte & 127) * 2 ** nShift;
|
|
20162
|
+
if (!(byte & 128)) break;
|
|
20163
|
+
nShift += 7;
|
|
20164
|
+
}
|
|
20165
|
+
if (nAt + nLen <= nRead && nameBuf.toString("utf8", nAt, nAt + nLen) === NATIVE_SDK_THUNK_SECTION) {
|
|
20166
|
+
hasExistingThunk = true;
|
|
20167
|
+
break;
|
|
20168
|
+
}
|
|
20169
|
+
}
|
|
20170
|
+
offset = next;
|
|
20171
|
+
}
|
|
20172
|
+
if (!hasExistingThunk) {
|
|
20173
|
+
prefix = Buffer.allocUnsafe(prefixEnd);
|
|
20174
|
+
let filled = 0;
|
|
20175
|
+
while (filled < prefixEnd) {
|
|
20176
|
+
const n = (0, import_node_fs38.readSync)(fd, prefix, filled, prefixEnd - filled, filled);
|
|
20177
|
+
if (n <= 0) break;
|
|
20178
|
+
filled += n;
|
|
20179
|
+
}
|
|
20180
|
+
prefix = prefix.subarray(0, filled);
|
|
20181
|
+
}
|
|
20182
|
+
} finally {
|
|
20183
|
+
(0, import_node_fs38.closeSync)(fd);
|
|
20184
|
+
}
|
|
20185
|
+
if (hasExistingThunk || !prefix) {
|
|
20186
|
+
(0, import_node_fs38.writeFileSync)(file, finishSwiftAppModule((0, import_node_fs38.readFileSync)(file)));
|
|
20187
|
+
return;
|
|
20188
|
+
}
|
|
20189
|
+
const thunks = sdkImportThunks(prefix);
|
|
20190
|
+
const nameBytes = Buffer.from(encodedName2(NATIVE_SDK_THUNK_SECTION));
|
|
20191
|
+
const header = Buffer.from([0, ...uleb4(nameBytes.length + thunks.length)]);
|
|
20192
|
+
(0, import_node_fs38.appendFileSync)(file, Buffer.concat([header, nameBytes, thunks]));
|
|
20193
|
+
}
|
|
19864
20194
|
function swiftAppModuleInputs(tokens, buildRoot, sdkLibraries) {
|
|
19865
20195
|
const owned = (token) => import_node_path38.default.resolve(token).startsWith(`${buildRoot}/`) && (!token.includes("/.peach-pruned-objs/") || token.endsWith("/swiftrt-patched.o"));
|
|
19866
20196
|
const inputs = [];
|
|
@@ -20075,6 +20405,7 @@ async function linkSwiftAppModule(options) {
|
|
|
20075
20405
|
"--unresolved-symbols=ignore-all",
|
|
20076
20406
|
"--import-undefined",
|
|
20077
20407
|
"--emit-relocs",
|
|
20408
|
+
"--strip-debug",
|
|
20078
20409
|
"--gc-sections",
|
|
20079
20410
|
"--keep-section=target_features",
|
|
20080
20411
|
"--error-limit=0",
|
|
@@ -20097,7 +20428,16 @@ async function linkSwiftAppModule(options) {
|
|
|
20097
20428
|
const skipPasses = options.layoutMap ? ["duplicate-function-elimination"] : void 0;
|
|
20098
20429
|
const sdkTableEnd = sdk.sdkInterface.layout.tableEnd;
|
|
20099
20430
|
const { loweringCache } = options;
|
|
20100
|
-
const loweringKey = loweringCache && (
|
|
20431
|
+
const loweringKey = loweringCache && (typeof Bun !== "undefined" ? new Bun.CryptoHasher("sha256").update(
|
|
20432
|
+
JSON.stringify([
|
|
20433
|
+
loweringCache.compilerDigest,
|
|
20434
|
+
optimize,
|
|
20435
|
+
skipPasses,
|
|
20436
|
+
sdkTableEnd,
|
|
20437
|
+
lazy,
|
|
20438
|
+
KEEP_WASM_NAMES
|
|
20439
|
+
])
|
|
20440
|
+
).update(bytes).digest("hex") : (0, import_node_crypto26.createHash)("sha256").update(
|
|
20101
20441
|
JSON.stringify([
|
|
20102
20442
|
loweringCache.compilerDigest,
|
|
20103
20443
|
optimize,
|
|
@@ -20106,7 +20446,7 @@ async function linkSwiftAppModule(options) {
|
|
|
20106
20446
|
lazy,
|
|
20107
20447
|
KEEP_WASM_NAMES
|
|
20108
20448
|
])
|
|
20109
|
-
).update(bytes).digest("hex");
|
|
20449
|
+
).update(bytes).digest("hex"));
|
|
20110
20450
|
return {
|
|
20111
20451
|
linkage,
|
|
20112
20452
|
async lower() {
|
|
@@ -20716,7 +21056,8 @@ function createSwiftSdkBinding(linkage, sdk, usage, projection) {
|
|
|
20716
21056
|
bindSwiftAppModule(linkage, sdk),
|
|
20717
21057
|
selectSwiftSdkData(sdk, usage, linkage, projection)
|
|
20718
21058
|
]);
|
|
20719
|
-
|
|
21059
|
+
const sha2562 = typeof Bun !== "undefined" ? new Bun.CryptoHasher("sha256").update(bytes).digest("hex") : (0, import_node_crypto26.createHash)("sha256").update(bytes).digest("hex");
|
|
21060
|
+
return { bytes, sha256: sha2562 };
|
|
20720
21061
|
}
|
|
20721
21062
|
function readSwiftSdkUsage(mapFile, linkedFile, sdkObjects) {
|
|
20722
21063
|
const map = readWasmLinkMap(mapFile, false);
|
|
@@ -21472,6 +21813,7 @@ async function compileGuestLink(options) {
|
|
|
21472
21813
|
onSplitInputs: sdk ? (value) => {
|
|
21473
21814
|
splitInputs = value;
|
|
21474
21815
|
} : void 0,
|
|
21816
|
+
deferFinalLink: Boolean(sdk),
|
|
21475
21817
|
onDyldRows: (rows) => {
|
|
21476
21818
|
lazyFunctions = rows.lazyFunctions;
|
|
21477
21819
|
dyldSymbols = rows.dyldSymbols;
|
|
@@ -21740,156 +22082,164 @@ async function compileGuestLink(options) {
|
|
|
21740
22082
|
});
|
|
21741
22083
|
if (!reserved || !projectionObject) throw new Error("guest projection was not reserved");
|
|
21742
22084
|
if (sdk) {
|
|
21743
|
-
|
|
21744
|
-
|
|
21745
|
-
|
|
21746
|
-
|
|
21747
|
-
|
|
21748
|
-
|
|
21749
|
-
|
|
21750
|
-
|
|
21751
|
-
|
|
21752
|
-
|
|
21753
|
-
|
|
21754
|
-
|
|
21755
|
-
|
|
21756
|
-
|
|
21757
|
-
|
|
21758
|
-
|
|
21759
|
-
|
|
21760
|
-
|
|
21761
|
-
const
|
|
21762
|
-
|
|
21763
|
-
|
|
21764
|
-
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
|
|
21768
|
-
|
|
21769
|
-
|
|
21770
|
-
|
|
21771
|
-
|
|
21772
|
-
|
|
21773
|
-
(object4, product) => sdkObjectImages.get(object4) ?? sdkProductImages.get(product)
|
|
21774
|
-
);
|
|
21775
|
-
let storage = reserved;
|
|
21776
|
-
if (sdkSpans.length > 0) {
|
|
21777
|
-
const sdkCounts = guestProjectionRegionCounts(storage.images.length, sdkSpans);
|
|
21778
|
-
storage = reserveGuestProjectionStorage(
|
|
21779
|
-
storage.images,
|
|
21780
|
-
storage.capacities.map((capacity, index) => ({
|
|
21781
|
-
...capacity,
|
|
21782
|
-
regions: capacity.regions + sdkCounts[index] + 16
|
|
21783
|
-
}))
|
|
21784
|
-
);
|
|
21785
|
-
const projectionSource = import_node_path39.default.join(work, "projection.c");
|
|
21786
|
-
(0, import_node_fs39.writeFileSync)(projectionSource, storage.source);
|
|
21787
|
-
(0, import_node_child_process26.execFileSync)(
|
|
21788
|
-
import_node_path39.default.join(options.toolchainBin, "clang"),
|
|
21789
|
-
[...clangOptions, "-c", projectionSource, "-o", projectionObject],
|
|
21790
|
-
{ stdio: "pipe" }
|
|
21791
|
-
);
|
|
21792
|
-
}
|
|
21793
|
-
let precomputedSymbols;
|
|
21794
|
-
if (splitInputs.appReferencedSymbols && splitInputs.appDefinedSymbols) {
|
|
21795
|
-
const referenced = new Set(splitInputs.appReferencedSymbols);
|
|
21796
|
-
const defined = new Set(splitInputs.appDefinedSymbols);
|
|
21797
|
-
const projSyms = guestWasmSymbols((0, import_node_fs39.readFileSync)(projectionObject));
|
|
21798
|
-
for (const name3 of projSyms.undefined) referenced.add(name3);
|
|
21799
|
-
for (const name3 of projSyms.defined) defined.add(name3);
|
|
21800
|
-
precomputedSymbols = { referenced, defined };
|
|
21801
|
-
}
|
|
21802
|
-
for (; ; ) {
|
|
21803
|
-
const link = await linkSwiftAppModule2({
|
|
21804
|
-
objects: [...owners.keys()],
|
|
21805
|
-
lazyFunctions: splitInputs.lazyFunctions,
|
|
21806
|
-
toolchainBin: options.toolchainBin,
|
|
22085
|
+
try {
|
|
22086
|
+
if (!splitInputs) throw new Error("guest link did not select shared SDK inputs");
|
|
22087
|
+
const {
|
|
22088
|
+
createSwiftSdkBinding: createSwiftSdkBinding2,
|
|
22089
|
+
linkSwiftAppModule: linkSwiftAppModule2,
|
|
22090
|
+
readSwiftSdkUsage: readSwiftSdkUsage2,
|
|
22091
|
+
swiftAppModuleThunkSection: swiftAppModuleThunkSection2,
|
|
22092
|
+
swiftSdkProjectionSpans: swiftSdkProjectionSpans2
|
|
22093
|
+
} = await Promise.resolve().then(() => (init_swift_sdk_app_module(), swift_sdk_app_module_exports));
|
|
22094
|
+
const project = options.project;
|
|
22095
|
+
const work = project ? (0, import_node_fs39.mkdtempSync)(import_node_path39.default.join(directory, "app-module-")) : import_node_path39.default.join(directory, "app-module");
|
|
22096
|
+
if (project) (0, import_node_fs39.chownSync)(work, project.uid, project.gid);
|
|
22097
|
+
else (0, import_node_fs39.mkdirSync)(work, { recursive: true });
|
|
22098
|
+
const layoutMap = import_node_path39.default.join(work, "app.map");
|
|
22099
|
+
let appProjectionObject = projectionObject;
|
|
22100
|
+
const owners = new Map(splitInputs.appObjects).set(appProjectionObject, 0);
|
|
22101
|
+
const sdkObjectKeys = /* @__PURE__ */ new Map();
|
|
22102
|
+
const sdkObjectImages = /* @__PURE__ */ new Map();
|
|
22103
|
+
const sdkProductImages = new Map(prepared?.sdkProducts.images);
|
|
22104
|
+
for (const [file, { image, product, identity }] of splitInputs.sdkObjects) {
|
|
22105
|
+
const key = sdkGuestObjectKey(identity);
|
|
22106
|
+
sdkObjectKeys.set(file, key);
|
|
22107
|
+
sdkObjectImages.set(key, image);
|
|
22108
|
+
const priorImage = sdkProductImages.get(product);
|
|
22109
|
+
if (priorImage !== void 0 && priorImage !== image)
|
|
22110
|
+
throw new Error(`SDK product ${product} has several guest images`);
|
|
22111
|
+
sdkProductImages.set(product, image);
|
|
22112
|
+
}
|
|
22113
|
+
const linkedModule = import_node_path39.default.join(work, "app.wasm");
|
|
22114
|
+
const sdkSpans = swiftSdkProjectionSpans2(
|
|
21807
22115
|
sdk,
|
|
21808
|
-
|
|
21809
|
-
output: options.optimized,
|
|
21810
|
-
optimize: options.optimize,
|
|
21811
|
-
layoutMap,
|
|
21812
|
-
project,
|
|
21813
|
-
precomputedSymbols,
|
|
21814
|
-
loweringCache: project ? void 0 : {
|
|
21815
|
-
file: import_node_path39.default.join(
|
|
21816
|
-
options.buildDirectory,
|
|
21817
|
-
".build",
|
|
21818
|
-
"peach-app-module-lowered.wasm"
|
|
21819
|
-
),
|
|
21820
|
-
compilerDigest: options.compilerDigest
|
|
21821
|
-
}
|
|
21822
|
-
});
|
|
21823
|
-
const map2 = (0, import_node_fs39.readFileSync)(
|
|
21824
|
-
project ? projectOutputFile(work, layoutMap, project) : layoutMap,
|
|
21825
|
-
"utf8"
|
|
21826
|
-
);
|
|
21827
|
-
const values = guestDyldValueRange(map2);
|
|
21828
|
-
const bindingRows = /* @__PURE__ */ new Map();
|
|
21829
|
-
const data = [];
|
|
21830
|
-
for (let at = 0; at < link.linkage.data.length; at += 3) {
|
|
21831
|
-
const address = link.linkage.data[at];
|
|
21832
|
-
const size = link.linkage.data[at + 1];
|
|
21833
|
-
const value = link.linkage.data[at + 2];
|
|
21834
|
-
if (values && address >= values.address && address < values.address + values.length) {
|
|
21835
|
-
if (size !== 8 || (address - values.address) % 8)
|
|
21836
|
-
throw new Error("sdk binding splits a dyld value");
|
|
21837
|
-
bindingRows.set((address - values.address) / 8, value);
|
|
21838
|
-
} else data.push(address, size, value);
|
|
21839
|
-
}
|
|
21840
|
-
const linked = (0, import_node_fs39.readFileSync)(
|
|
21841
|
-
project ? projectOutputFile(work, linkedModule, project) : linkedModule
|
|
22116
|
+
(object4, product) => sdkObjectImages.get(object4) ?? sdkProductImages.get(product)
|
|
21842
22117
|
);
|
|
21843
|
-
const
|
|
21844
|
-
...guestLinkedSpans(map2, linked, linked, owners, splitInputs.appSections, true),
|
|
21845
|
-
...sdkSpans
|
|
21846
|
-
]);
|
|
21847
|
-
if (storage.capacities.some(({ regions }, index) => required[index] > regions)) {
|
|
21848
|
-
storage = reserveGuestProjectionStorage(
|
|
21849
|
-
storage.images,
|
|
21850
|
-
storage.capacities.map((capacity, index) => {
|
|
21851
|
-
const count = required[index];
|
|
21852
|
-
return count > capacity.regions ? { ...capacity, regions: Math.max(count, capacity.regions * 2) } : capacity;
|
|
21853
|
-
})
|
|
21854
|
-
);
|
|
22118
|
+
const compileAppProjection = (source) => {
|
|
21855
22119
|
const projectionSource = import_node_path39.default.join(work, "projection.c");
|
|
21856
|
-
|
|
22120
|
+
const nextObject = import_node_path39.default.join(work, "projection.o");
|
|
22121
|
+
(0, import_node_fs39.writeFileSync)(projectionSource, source);
|
|
21857
22122
|
(0, import_node_child_process26.execFileSync)(
|
|
21858
22123
|
import_node_path39.default.join(options.toolchainBin, "clang"),
|
|
21859
|
-
[...clangOptions, "-c", projectionSource, "-o",
|
|
22124
|
+
[...clangOptions, "-c", projectionSource, "-o", nextObject],
|
|
21860
22125
|
{ stdio: "pipe" }
|
|
21861
22126
|
);
|
|
21862
|
-
|
|
22127
|
+
if (nextObject !== appProjectionObject) {
|
|
22128
|
+
owners.delete(appProjectionObject);
|
|
22129
|
+
appProjectionObject = nextObject;
|
|
22130
|
+
owners.set(appProjectionObject, 0);
|
|
22131
|
+
}
|
|
22132
|
+
};
|
|
22133
|
+
let storage = reserved;
|
|
22134
|
+
if (sdkSpans.length > 0) {
|
|
22135
|
+
const sdkCounts = guestProjectionRegionCounts(storage.images.length, sdkSpans);
|
|
22136
|
+
storage = reserveGuestProjectionStorage(
|
|
22137
|
+
storage.images,
|
|
22138
|
+
storage.capacities.map((capacity, index) => ({
|
|
22139
|
+
...capacity,
|
|
22140
|
+
regions: capacity.regions + sdkCounts[index] + 16
|
|
22141
|
+
}))
|
|
22142
|
+
);
|
|
22143
|
+
compileAppProjection(storage.source);
|
|
21863
22144
|
}
|
|
21864
|
-
|
|
21865
|
-
|
|
21866
|
-
|
|
21867
|
-
|
|
21868
|
-
|
|
21869
|
-
|
|
21870
|
-
|
|
21871
|
-
|
|
22145
|
+
let precomputedSymbols;
|
|
22146
|
+
if (splitInputs.appReferencedSymbols && splitInputs.appDefinedSymbols) {
|
|
22147
|
+
const referenced = new Set(splitInputs.appReferencedSymbols);
|
|
22148
|
+
const defined = new Set(splitInputs.appDefinedSymbols);
|
|
22149
|
+
const projSyms = guestWasmSymbols((0, import_node_fs39.readFileSync)(appProjectionObject));
|
|
22150
|
+
for (const name3 of projSyms.undefined) referenced.add(name3);
|
|
22151
|
+
for (const name3 of projSyms.defined) defined.add(name3);
|
|
22152
|
+
precomputedSymbols = { referenced, defined };
|
|
22153
|
+
}
|
|
22154
|
+
for (; ; ) {
|
|
22155
|
+
const link = await linkSwiftAppModule2({
|
|
22156
|
+
objects: [...owners.keys()],
|
|
22157
|
+
lazyFunctions: splitInputs.lazyFunctions,
|
|
22158
|
+
toolchainBin: options.toolchainBin,
|
|
22159
|
+
sdk,
|
|
22160
|
+
work,
|
|
22161
|
+
output: options.optimized,
|
|
22162
|
+
optimize: options.optimize,
|
|
22163
|
+
layoutMap,
|
|
22164
|
+
project,
|
|
22165
|
+
precomputedSymbols,
|
|
22166
|
+
loweringCache: project ? void 0 : {
|
|
22167
|
+
file: import_node_path39.default.join(
|
|
22168
|
+
options.buildDirectory,
|
|
22169
|
+
".build",
|
|
22170
|
+
"peach-app-module-lowered.wasm"
|
|
22171
|
+
),
|
|
22172
|
+
compilerDigest: options.compilerDigest
|
|
22173
|
+
}
|
|
21872
22174
|
});
|
|
21873
|
-
|
|
22175
|
+
const map2 = (0, import_node_fs39.readFileSync)(
|
|
22176
|
+
project ? projectOutputFile(work, layoutMap, project) : layoutMap,
|
|
22177
|
+
"utf8"
|
|
22178
|
+
);
|
|
22179
|
+
const values = guestDyldValueRange(map2);
|
|
22180
|
+
const bindingRows = /* @__PURE__ */ new Map();
|
|
22181
|
+
const data = [];
|
|
22182
|
+
for (let at = 0; at < link.linkage.data.length; at += 3) {
|
|
22183
|
+
const address = link.linkage.data[at];
|
|
22184
|
+
const size = link.linkage.data[at + 1];
|
|
22185
|
+
const value = link.linkage.data[at + 2];
|
|
22186
|
+
if (values && address >= values.address && address < values.address + values.length) {
|
|
22187
|
+
if (size !== 8 || (address - values.address) % 8)
|
|
22188
|
+
throw new Error("sdk binding splits a dyld value");
|
|
22189
|
+
bindingRows.set((address - values.address) / 8, value);
|
|
22190
|
+
} else data.push(address, size, value);
|
|
22191
|
+
}
|
|
22192
|
+
const linked = (0, import_node_fs39.readFileSync)(
|
|
22193
|
+
project ? projectOutputFile(work, linkedModule, project) : linkedModule
|
|
22194
|
+
);
|
|
22195
|
+
const required = guestProjectionRegionCounts(storage.images.length, [
|
|
22196
|
+
...guestLinkedSpans(map2, linked, linked, owners, splitInputs.appSections, true),
|
|
22197
|
+
...sdkSpans
|
|
22198
|
+
]);
|
|
22199
|
+
if (storage.capacities.some(({ regions }, index) => required[index] > regions)) {
|
|
22200
|
+
storage = reserveGuestProjectionStorage(
|
|
22201
|
+
storage.images,
|
|
22202
|
+
storage.capacities.map((capacity, index) => {
|
|
22203
|
+
const count = required[index];
|
|
22204
|
+
return count > capacity.regions ? { ...capacity, regions: Math.max(count, capacity.regions * 2) } : capacity;
|
|
22205
|
+
})
|
|
22206
|
+
);
|
|
22207
|
+
compileAppProjection(storage.source);
|
|
22208
|
+
continue;
|
|
22209
|
+
}
|
|
22210
|
+
options.onStage("lowering the app image");
|
|
22211
|
+
const lowerPromise = link.lower();
|
|
22212
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
22213
|
+
let binding;
|
|
22214
|
+
try {
|
|
22215
|
+
if (result.finalLinkDone) await result.finalLinkDone;
|
|
22216
|
+
const usage = readSwiftSdkUsage2(result.mapPath, options.output, sdkObjectKeys);
|
|
22217
|
+
binding = createSwiftSdkBinding2({ ...link.linkage, data }, sdk, usage);
|
|
22218
|
+
} catch (error) {
|
|
22219
|
+
await Promise.allSettled([lowerPromise]);
|
|
22220
|
+
throw error;
|
|
22221
|
+
}
|
|
22222
|
+
await lowerPromise;
|
|
22223
|
+
const finalized = finalizeGuestProjectionStorage({
|
|
22224
|
+
map: map2,
|
|
22225
|
+
linked,
|
|
22226
|
+
optimized: (0, import_node_fs39.readFileSync)(options.optimized),
|
|
22227
|
+
owners,
|
|
22228
|
+
sectionOwners: splitInputs.appSections,
|
|
22229
|
+
projectionObject: appProjectionObject,
|
|
22230
|
+
reserved: storage,
|
|
22231
|
+
sdkSpans
|
|
22232
|
+
});
|
|
22233
|
+
(0, import_node_fs39.writeFileSync)(
|
|
22234
|
+
options.optimized,
|
|
22235
|
+
moveGuestDyldTable(map2, finalized.wasm, splitInputs.dyldSymbols, bindingRows, [
|
|
22236
|
+
swiftAppModuleThunkSection2(finalized.wasm)
|
|
22237
|
+
])
|
|
22238
|
+
);
|
|
22239
|
+
return binding;
|
|
21874
22240
|
}
|
|
21875
|
-
|
|
21876
|
-
|
|
21877
|
-
map: map2,
|
|
21878
|
-
linked,
|
|
21879
|
-
optimized: (0, import_node_fs39.readFileSync)(options.optimized),
|
|
21880
|
-
owners,
|
|
21881
|
-
sectionOwners: splitInputs.appSections,
|
|
21882
|
-
projectionObject,
|
|
21883
|
-
reserved: storage,
|
|
21884
|
-
sdkSpans
|
|
21885
|
-
});
|
|
21886
|
-
(0, import_node_fs39.writeFileSync)(
|
|
21887
|
-
options.optimized,
|
|
21888
|
-
finishSwiftAppModule2(
|
|
21889
|
-
moveGuestDyldTable(map2, finalized.wasm, splitInputs.dyldSymbols, bindingRows)
|
|
21890
|
-
)
|
|
21891
|
-
);
|
|
21892
|
-
return binding;
|
|
22241
|
+
} finally {
|
|
22242
|
+
if (result.finalLinkDone) await Promise.allSettled([result.finalLinkDone]);
|
|
21893
22243
|
}
|
|
21894
22244
|
}
|
|
21895
22245
|
options.onStage("lowering the app image");
|
|
@@ -27504,6 +27854,10 @@ async function buildFrameworkProducts(scratch2, args) {
|
|
|
27504
27854
|
// every framework target when callers alternate --cores.
|
|
27505
27855
|
"-Xswiftc",
|
|
27506
27856
|
"-gnone",
|
|
27857
|
+
"-Xcc",
|
|
27858
|
+
"-g0",
|
|
27859
|
+
"-Xcxx",
|
|
27860
|
+
"-g0",
|
|
27507
27861
|
"-Xswiftc",
|
|
27508
27862
|
"-num-threads",
|
|
27509
27863
|
"-Xswiftc",
|
|
@@ -28394,6 +28748,10 @@ ${cap}` : "";
|
|
|
28394
28748
|
// fan-out under high -j.
|
|
28395
28749
|
"-Xswiftc",
|
|
28396
28750
|
"-gnone",
|
|
28751
|
+
"-Xcc",
|
|
28752
|
+
"-g0",
|
|
28753
|
+
"-Xcxx",
|
|
28754
|
+
"-g0",
|
|
28397
28755
|
...incrementalPreview ? [] : [
|
|
28398
28756
|
"-Xswiftc",
|
|
28399
28757
|
"-num-threads",
|
|
@@ -29043,7 +29401,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
|
|
|
29043
29401
|
REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
29044
29402
|
MULTI_MANIFEST_VERSION = 76;
|
|
29045
29403
|
SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
29046
|
-
compilerSourceDigest = true ? "
|
|
29404
|
+
compilerSourceDigest = true ? "ab7e385f5b9ca10737de11d59802a2b57ee084a172b96aa971acb4c26a58a573" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
|
|
29047
29405
|
nativeCxxCompilerFlags = ["-fno-cxx-modules"];
|
|
29048
29406
|
MODULE_MAP_RESPONSE_FILE_RUN = 16;
|
|
29049
29407
|
cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
|