peachsim 0.1.2778 → 0.1.2779
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 +294 -480
- 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-RWBIRNWO.mjs → acorn-SCZ56W4Q.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-GSTHJQMW.mjs → chunk-6BNEOOBT.mjs} +114 -18
- package/dist-lib/esm-chunks/{chunk-KX7LV722.mjs → chunk-7VWBLM73.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-IQSFMB4R.mjs → chunk-DX5V3733.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-KBYVKTVK.mjs → chunk-E56EZ3QT.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-EXU474NE.mjs → chunk-FNQXQNQK.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3WQANOYY.mjs → chunk-H2V3ZZTO.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-5WASPTSS.mjs → chunk-H6JAFCAZ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-VZ3NXXUC.mjs → chunk-HMFIO57I.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-6YHF4VYF.mjs → chunk-HWK2V6R4.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-LQVLXDRN.mjs → chunk-KAMO4C4X.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-5TIUTQ55.mjs → chunk-KFDP4372.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-F3OPIKJC.mjs → chunk-KOULWLTF.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-DLBUPWTI.mjs → chunk-LVEDBGWX.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-X25PQNNH.mjs → chunk-MJXJYVF5.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-QKTKE4OX.mjs → chunk-MK4VAM4G.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZWOS2EDN.mjs → chunk-Q6XMYYNV.mjs} +118 -361
- package/dist-lib/esm-chunks/{chunk-K3ULPN2R.mjs → chunk-SFTGQN5D.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-KLA74B7J.mjs → chunk-SM5MJSQP.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-G7UJ4BAC.mjs → chunk-SNMGOZXQ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-MRIDS3GE.mjs → chunk-SZI5IZ76.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-N2PEXZGL.mjs → chunk-T7DTXCV5.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZDWMPXYI.mjs → chunk-UBM772FD.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-QUVLFF6I.mjs → chunk-VJSHIZ7J.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3RPELUA2.mjs → chunk-Z42YJEC4.mjs} +6 -6
- package/dist-lib/esm-chunks/{metro-layout-parser-RRIZOLBE.mjs → metro-layout-parser-7S5M3EG6.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-EIZ7MCKR.mjs → swift-package-prebuilt-MJSFHIOP.mjs} +12 -12
- package/dist-lib/esm-chunks/{swift-sdk-app-module-S2LQ4OXD.mjs → swift-sdk-app-module-ZIN3LFLS.mjs} +47 -69
- package/dist-lib/esm-chunks/{swift-sdk-image-77FFUGXI.mjs → swift-sdk-image-MIWPBZEN.mjs} +16 -16
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-XFSFUXQJ.mjs → swift-sdk-image-producer-OTH543HF.mjs} +5 -5
- package/dist-lib/expo-swift-bundle.cjs +294 -480
- 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 +300 -486
- package/dist-lib/host/fetch-proxy-handler.cjs +22 -11
- 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 +1 -1
- package/dist-lib/native-app-identity-project.mjs +15 -15
- 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 +86 -86
- package/dist-lib/public-origins-lib.json +70 -70
- 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 +300 -486
- package/dist-lib/swift-compile.cjs +287 -465
- 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/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +15 -2
- package/dist-types/packages/peach-engine/src/render-worker/worklet-wire.d.ts +10 -1
- package/package.json +1 -1
- package/src/swift-compiler-digest.ts +1 -0
- package/src/swift-guest-dyld-functions.ts +1 -11
- package/src/swift-guest-dyld-table.ts +2 -9
- package/src/swift-guest-image-ledger.ts +9 -35
- package/src/swift-guest-source-inputs.ts +5 -22
- package/src/swift-icu.ts +15 -28
- package/src/swift-link-roots.ts +4 -8
- package/src/swift-sdk-app-module.ts +5 -27
- package/src/swift-sdk-image-wasm.ts +12 -41
- package/src/swift-shared-sdk.ts +1 -13
- package/src/swift-wasm-archive.ts +6 -11
- package/src/swift-wasm-prune.ts +22 -100
- package/src/wasm-binary-sections.ts +61 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2779 | (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;
|
|
@@ -10502,7 +10502,7 @@ var init_swift_objc_sdk_tree = __esm({
|
|
|
10502
10502
|
|
|
10503
10503
|
// src/swift-compiler-digest.ts
|
|
10504
10504
|
function swiftArchiveCompilerDigestValue() {
|
|
10505
|
-
return true ? "
|
|
10505
|
+
return true ? "b4b2fc7face997792991900efb229414642f042031ba789c00a1d17e542756e3" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname, "archive");
|
|
10506
10506
|
}
|
|
10507
10507
|
var import_node_crypto10, import_node_fs20, import_node_path17, SWIFT_DIGEST_SOURCES, LINKED_IMAGE_SOURCES, SWIFT_ARCHIVE_DIGEST_SOURCES;
|
|
10508
10508
|
var init_swift_compiler_digest = __esm({
|
|
@@ -10531,6 +10531,7 @@ var init_swift_compiler_digest = __esm({
|
|
|
10531
10531
|
"swift-objc-prebuilt-catalog.ts",
|
|
10532
10532
|
"swift-toolchain.ts",
|
|
10533
10533
|
"swift-shared-sdk.ts",
|
|
10534
|
+
"wasm-binary-sections.ts",
|
|
10534
10535
|
"swift-distribution-mirror.ts",
|
|
10535
10536
|
"swift-design-time.ts",
|
|
10536
10537
|
"binaryen.lock.json",
|
|
@@ -14424,6 +14425,111 @@ var init_swift_objc_standin = __esm({
|
|
|
14424
14425
|
}
|
|
14425
14426
|
});
|
|
14426
14427
|
|
|
14428
|
+
// src/wasm-binary-sections.ts
|
|
14429
|
+
function encodeWasmNumber(value) {
|
|
14430
|
+
const bytes = [];
|
|
14431
|
+
for (let rest = value; ; ) {
|
|
14432
|
+
const byte = rest % 128;
|
|
14433
|
+
rest = Math.floor(rest / 128);
|
|
14434
|
+
if (rest === 0) return [...bytes, byte];
|
|
14435
|
+
bytes.push(byte | 128);
|
|
14436
|
+
}
|
|
14437
|
+
}
|
|
14438
|
+
function encodeWasmSigned(value) {
|
|
14439
|
+
const out = [];
|
|
14440
|
+
for (; ; ) {
|
|
14441
|
+
const byte = Number(value & 127n);
|
|
14442
|
+
value >>= 7n;
|
|
14443
|
+
if (value === 0n && !(byte & 64) || value === -1n && byte & 64) {
|
|
14444
|
+
out.push(byte);
|
|
14445
|
+
return out;
|
|
14446
|
+
}
|
|
14447
|
+
out.push(byte | 128);
|
|
14448
|
+
}
|
|
14449
|
+
}
|
|
14450
|
+
function encodeWasmName(name3) {
|
|
14451
|
+
const bytes = new TextEncoder().encode(name3);
|
|
14452
|
+
return [...encodeWasmNumber(bytes.length), ...bytes];
|
|
14453
|
+
}
|
|
14454
|
+
function readULEB(bytes, offset, end = bytes.length) {
|
|
14455
|
+
if (offset < end) {
|
|
14456
|
+
const first = bytes[offset];
|
|
14457
|
+
if (first < 128) return [first, offset + 1];
|
|
14458
|
+
}
|
|
14459
|
+
let value = 0;
|
|
14460
|
+
for (let shift = 0; ; shift += 7) {
|
|
14461
|
+
if (offset >= end || shift > 63) throw new Error("invalid wasm integer");
|
|
14462
|
+
const byte = bytes[offset++];
|
|
14463
|
+
value += (byte & 127) * 2 ** shift;
|
|
14464
|
+
if (!(byte & 128)) return [value, offset];
|
|
14465
|
+
}
|
|
14466
|
+
}
|
|
14467
|
+
function readSLEB(bytes, offset, end = bytes.length) {
|
|
14468
|
+
let value = 0n;
|
|
14469
|
+
let shift = 0n;
|
|
14470
|
+
let byte = 0;
|
|
14471
|
+
do {
|
|
14472
|
+
if (offset >= end || shift > 70n) throw new Error("invalid wasm integer");
|
|
14473
|
+
byte = bytes[offset++];
|
|
14474
|
+
value |= BigInt(byte & 127) << shift;
|
|
14475
|
+
shift += 7n;
|
|
14476
|
+
} while (byte & 128);
|
|
14477
|
+
if (byte & 64) value -= 1n << shift;
|
|
14478
|
+
return [value, offset];
|
|
14479
|
+
}
|
|
14480
|
+
function skipLEB(bytes, offset) {
|
|
14481
|
+
while ((bytes[offset++] & 128) !== 0) {
|
|
14482
|
+
}
|
|
14483
|
+
return offset;
|
|
14484
|
+
}
|
|
14485
|
+
function readWasmSection(bytes, start, end) {
|
|
14486
|
+
let at = start;
|
|
14487
|
+
const number3 = () => {
|
|
14488
|
+
const [value, next] = readULEB(bytes, at, end);
|
|
14489
|
+
at = next;
|
|
14490
|
+
return value;
|
|
14491
|
+
};
|
|
14492
|
+
return {
|
|
14493
|
+
number: number3,
|
|
14494
|
+
byte: () => {
|
|
14495
|
+
if (at >= end) throw new Error("truncated wasm section");
|
|
14496
|
+
return bytes[at++];
|
|
14497
|
+
},
|
|
14498
|
+
name: () => {
|
|
14499
|
+
const length = number3();
|
|
14500
|
+
at += length;
|
|
14501
|
+
if (at > end) throw new Error("truncated wasm name");
|
|
14502
|
+
return Buffer.from(bytes.buffer, bytes.byteOffset + at - length, length).toString();
|
|
14503
|
+
},
|
|
14504
|
+
skip: (length) => {
|
|
14505
|
+
at += length;
|
|
14506
|
+
if (at > end) throw new Error("truncated wasm section");
|
|
14507
|
+
},
|
|
14508
|
+
position: () => at,
|
|
14509
|
+
done: () => at === end
|
|
14510
|
+
};
|
|
14511
|
+
}
|
|
14512
|
+
function wasmSections(bytes) {
|
|
14513
|
+
if (Buffer.from(bytes.subarray(0, 8)).toString("hex") !== "0061736d01000000")
|
|
14514
|
+
throw new Error("not a wasm module");
|
|
14515
|
+
const found = [];
|
|
14516
|
+
for (let at = 8; at < bytes.length; ) {
|
|
14517
|
+
const header = readWasmSection(bytes, at, bytes.length);
|
|
14518
|
+
const id = header.byte();
|
|
14519
|
+
const size2 = header.number();
|
|
14520
|
+
const start = header.position();
|
|
14521
|
+
if (start + size2 > bytes.length) throw new Error("truncated wasm section");
|
|
14522
|
+
found.push({ id, offset: at, start, end: start + size2 });
|
|
14523
|
+
at = start + size2;
|
|
14524
|
+
}
|
|
14525
|
+
return found;
|
|
14526
|
+
}
|
|
14527
|
+
var init_wasm_binary_sections = __esm({
|
|
14528
|
+
"src/wasm-binary-sections.ts"() {
|
|
14529
|
+
"use strict";
|
|
14530
|
+
}
|
|
14531
|
+
});
|
|
14532
|
+
|
|
14427
14533
|
// src/swift-shared-sdk.ts
|
|
14428
14534
|
function swiftSharedSdkSourceRoot(moduleRoot, distribution) {
|
|
14429
14535
|
return import_node_path23.default.resolve(moduleRoot, distribution ? "sdk/ios" : "../peachsim/sdk/ios");
|
|
@@ -14474,18 +14580,6 @@ function swiftSharedSdkFlags(moduleRoot, distribution) {
|
|
|
14474
14580
|
import_node_path23.default.join(root, "usr/include")
|
|
14475
14581
|
];
|
|
14476
14582
|
}
|
|
14477
|
-
function readULEB(b, o) {
|
|
14478
|
-
let res = 0;
|
|
14479
|
-
let shift = 0;
|
|
14480
|
-
let p = o;
|
|
14481
|
-
while (true) {
|
|
14482
|
-
const byte = b[p++];
|
|
14483
|
-
res |= (byte & 127) << shift;
|
|
14484
|
-
if ((byte & 128) === 0) break;
|
|
14485
|
-
shift += 7;
|
|
14486
|
-
}
|
|
14487
|
-
return [res, p];
|
|
14488
|
-
}
|
|
14489
14583
|
function weakenFoundationSymbolsInWasmObj(buf) {
|
|
14490
14584
|
let pos = 8;
|
|
14491
14585
|
while (pos < buf.length) {
|
|
@@ -14850,6 +14944,7 @@ var init_swift_shared_sdk = __esm({
|
|
|
14850
14944
|
import_node_path23 = __toESM(require("node:path"), 1);
|
|
14851
14945
|
init_swift_toolchain();
|
|
14852
14946
|
init_swiftTargetContract();
|
|
14947
|
+
init_wasm_binary_sections();
|
|
14853
14948
|
SWIFT_DISTRIBUTION_MIRROR_RECORD = ".peach-mirror.json";
|
|
14854
14949
|
distributionHeaderRoots = /* @__PURE__ */ new Map();
|
|
14855
14950
|
WEAKEN_FOUNDATION_SYMS = /* @__PURE__ */ new Set([
|
|
@@ -16354,16 +16449,12 @@ var init_swift_link_roots = __esm({
|
|
|
16354
16449
|
"use strict";
|
|
16355
16450
|
import_node_fs27 = __toESM(require("node:fs"), 1);
|
|
16356
16451
|
import_node_path27 = __toESM(require("node:path"), 1);
|
|
16452
|
+
init_wasm_binary_sections();
|
|
16357
16453
|
OBJC_RUNTIME_LOOKUP_SECTION = "peach_objc_runtime_lookup";
|
|
16358
16454
|
leb = (bytes, at) => {
|
|
16359
|
-
|
|
16360
|
-
|
|
16361
|
-
|
|
16362
|
-
const byte = bytes[at.offset++];
|
|
16363
|
-
value += (byte & 127) * scale;
|
|
16364
|
-
if (!(byte & 128)) return value;
|
|
16365
|
-
scale *= 128;
|
|
16366
|
-
}
|
|
16455
|
+
const [value, next] = readULEB(bytes, at.offset);
|
|
16456
|
+
at.offset = next;
|
|
16457
|
+
return value;
|
|
16367
16458
|
};
|
|
16368
16459
|
rootsByDistribution = /* @__PURE__ */ new Map();
|
|
16369
16460
|
}
|
|
@@ -17192,68 +17283,6 @@ var init_swift_guest_linked_spans = __esm({
|
|
|
17192
17283
|
}
|
|
17193
17284
|
});
|
|
17194
17285
|
|
|
17195
|
-
// src/wasm-binary-sections.ts
|
|
17196
|
-
function encodeWasmNumber(value) {
|
|
17197
|
-
const bytes = [];
|
|
17198
|
-
for (let rest = value; ; ) {
|
|
17199
|
-
const byte = rest % 128;
|
|
17200
|
-
rest = Math.floor(rest / 128);
|
|
17201
|
-
if (rest === 0) return [...bytes, byte];
|
|
17202
|
-
bytes.push(byte | 128);
|
|
17203
|
-
}
|
|
17204
|
-
}
|
|
17205
|
-
function encodeWasmName(name3) {
|
|
17206
|
-
const bytes = new TextEncoder().encode(name3);
|
|
17207
|
-
return [...encodeWasmNumber(bytes.length), ...bytes];
|
|
17208
|
-
}
|
|
17209
|
-
function readWasmSection(bytes, start, end) {
|
|
17210
|
-
let at = start;
|
|
17211
|
-
const number3 = () => {
|
|
17212
|
-
let value = 0;
|
|
17213
|
-
for (let shift = 0; ; shift += 7) {
|
|
17214
|
-
if (at >= end || shift > 63) throw new Error("invalid wasm integer");
|
|
17215
|
-
const byte = bytes[at++];
|
|
17216
|
-
value += (byte & 127) * 2 ** shift;
|
|
17217
|
-
if (!(byte & 128)) return value;
|
|
17218
|
-
}
|
|
17219
|
-
};
|
|
17220
|
-
return {
|
|
17221
|
-
number: number3,
|
|
17222
|
-
byte: () => {
|
|
17223
|
-
if (at >= end) throw new Error("truncated wasm section");
|
|
17224
|
-
return bytes[at++];
|
|
17225
|
-
},
|
|
17226
|
-
name: () => {
|
|
17227
|
-
const length = number3();
|
|
17228
|
-
at += length;
|
|
17229
|
-
if (at > end) throw new Error("truncated wasm name");
|
|
17230
|
-
return Buffer.from(bytes.buffer, bytes.byteOffset + at - length, length).toString();
|
|
17231
|
-
},
|
|
17232
|
-
position: () => at,
|
|
17233
|
-
done: () => at === end
|
|
17234
|
-
};
|
|
17235
|
-
}
|
|
17236
|
-
function wasmSections(bytes) {
|
|
17237
|
-
if (Buffer.from(bytes.subarray(0, 8)).toString("hex") !== "0061736d01000000")
|
|
17238
|
-
throw new Error("not a wasm module");
|
|
17239
|
-
const found = [];
|
|
17240
|
-
for (let at = 8; at < bytes.length; ) {
|
|
17241
|
-
const header = readWasmSection(bytes, at, bytes.length);
|
|
17242
|
-
const id = header.byte();
|
|
17243
|
-
const size2 = header.number();
|
|
17244
|
-
const start = header.position();
|
|
17245
|
-
if (start + size2 > bytes.length) throw new Error("truncated wasm section");
|
|
17246
|
-
found.push({ id, offset: at, start, end: start + size2 });
|
|
17247
|
-
at = start + size2;
|
|
17248
|
-
}
|
|
17249
|
-
return found;
|
|
17250
|
-
}
|
|
17251
|
-
var init_wasm_binary_sections = __esm({
|
|
17252
|
-
"src/wasm-binary-sections.ts"() {
|
|
17253
|
-
"use strict";
|
|
17254
|
-
}
|
|
17255
|
-
});
|
|
17256
|
-
|
|
17257
17286
|
// src/wasm-imports.ts
|
|
17258
17287
|
function readWasmImports(bytes, section2, visit3) {
|
|
17259
17288
|
const input = readWasmSection(bytes, section2.start, section2.end);
|
|
@@ -17537,23 +17566,13 @@ function wasmReader(bytes, start) {
|
|
|
17537
17566
|
const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
17538
17567
|
let at = start;
|
|
17539
17568
|
const u = () => {
|
|
17540
|
-
|
|
17541
|
-
|
|
17542
|
-
|
|
17543
|
-
value += (byte & 127) * 2 ** shift;
|
|
17544
|
-
if (!(byte & 128)) return value;
|
|
17545
|
-
}
|
|
17569
|
+
const [value, next] = readULEB(bytes, at);
|
|
17570
|
+
at = next;
|
|
17571
|
+
return value;
|
|
17546
17572
|
};
|
|
17547
17573
|
const s = () => {
|
|
17548
|
-
|
|
17549
|
-
|
|
17550
|
-
let byte = 0;
|
|
17551
|
-
do {
|
|
17552
|
-
byte = bytes[at++];
|
|
17553
|
-
value |= BigInt(byte & 127) << shift;
|
|
17554
|
-
shift += 7n;
|
|
17555
|
-
} while (byte & 128);
|
|
17556
|
-
if (byte & 64) value -= 1n << shift;
|
|
17574
|
+
const [value, next] = readSLEB(bytes, at);
|
|
17575
|
+
at = next;
|
|
17557
17576
|
return value;
|
|
17558
17577
|
};
|
|
17559
17578
|
return {
|
|
@@ -17858,7 +17877,7 @@ function finishSdkImage(bytes, hostExports, libraries, guestMap) {
|
|
|
17858
17877
|
else data[entry.name] = value;
|
|
17859
17878
|
}
|
|
17860
17879
|
if (entry.kind !== 0 && entry.kind !== 3 || host2.has(entry.name))
|
|
17861
|
-
kept.push([...
|
|
17880
|
+
kept.push([...encodeWasmName(entry.name), entry.kind, ...encodeWasmNumber(entry.index)]);
|
|
17862
17881
|
}
|
|
17863
17882
|
if (guestMap) {
|
|
17864
17883
|
if (guestMap.code.length !== m.bodies.length)
|
|
@@ -17873,19 +17892,19 @@ function finishSdkImage(bytes, hostExports, libraries, guestMap) {
|
|
|
17873
17892
|
const er = wasmReader(bytes, elements.start);
|
|
17874
17893
|
const segments = er.u();
|
|
17875
17894
|
const replaced = /* @__PURE__ */ new Map([
|
|
17876
|
-
[4, [1, 112, 4, ...
|
|
17877
|
-
[7, [...
|
|
17895
|
+
[4, [1, 112, 4, ...encodeWasmNumber(tableEnd + added.length)]],
|
|
17896
|
+
[7, [...encodeWasmNumber(kept.length), ...kept.flat()]],
|
|
17878
17897
|
[
|
|
17879
17898
|
9,
|
|
17880
17899
|
[
|
|
17881
|
-
...
|
|
17900
|
+
...encodeWasmNumber(segments + 1),
|
|
17882
17901
|
...bytes.subarray(er.at, elements.end),
|
|
17883
17902
|
0,
|
|
17884
17903
|
66,
|
|
17885
|
-
...
|
|
17904
|
+
...encodeWasmSigned(BigInt(tableEnd)),
|
|
17886
17905
|
11,
|
|
17887
|
-
...
|
|
17888
|
-
...added.flatMap(
|
|
17906
|
+
...encodeWasmNumber(added.length),
|
|
17907
|
+
...added.flatMap(encodeWasmNumber)
|
|
17889
17908
|
]
|
|
17890
17909
|
]
|
|
17891
17910
|
]);
|
|
@@ -17991,33 +18010,33 @@ function codeOnlySdkImage(bytes, constructorMask) {
|
|
|
17991
18010
|
if (drop) r.skip(1);
|
|
17992
18011
|
gated.push(
|
|
17993
18012
|
66,
|
|
17994
|
-
...
|
|
18013
|
+
...encodeWasmSigned(BigInt(constructorMask + index++)),
|
|
17995
18014
|
45,
|
|
17996
18015
|
0,
|
|
17997
18016
|
0,
|
|
17998
18017
|
4,
|
|
17999
18018
|
64,
|
|
18000
18019
|
16,
|
|
18001
|
-
...
|
|
18020
|
+
...encodeWasmNumber(callee),
|
|
18002
18021
|
...drop ? [26] : [],
|
|
18003
18022
|
11
|
|
18004
18023
|
);
|
|
18005
18024
|
}
|
|
18006
18025
|
if (index > SWIFT_SDK_CONSTRUCTOR_LIMIT)
|
|
18007
18026
|
throw new Error(`${index} sdk constructors exceed the mask`);
|
|
18008
|
-
gated.push(16, ...
|
|
18027
|
+
gated.push(16, ...encodeWasmNumber(functionIndex("__peach_sdk_register")), 11);
|
|
18009
18028
|
bodies[constructors] = Uint8Array.from(gated);
|
|
18010
18029
|
}
|
|
18011
|
-
const codeParts = [Uint8Array.from(
|
|
18012
|
-
for (const body of bodies) codeParts.push(Uint8Array.from(
|
|
18030
|
+
const codeParts = [Uint8Array.from(encodeWasmNumber(bodies.length))];
|
|
18031
|
+
for (const body of bodies) codeParts.push(Uint8Array.from(encodeWasmNumber(body.length)), body);
|
|
18013
18032
|
const codeSize = codeParts.reduce((sum, part) => sum + part.length, 0);
|
|
18014
18033
|
const tls = passiveSegments(bytes)[0];
|
|
18015
18034
|
const out = [bytes.subarray(0, 8)];
|
|
18016
18035
|
for (const s of m.sections) {
|
|
18017
18036
|
if (s.id === 10) {
|
|
18018
|
-
out.push(Uint8Array.from([10, ...
|
|
18037
|
+
out.push(Uint8Array.from([10, ...encodeWasmNumber(codeSize)]));
|
|
18019
18038
|
for (const part of codeParts) out.push(part);
|
|
18020
|
-
} else if (s.id === 11) out.push(section(11, [1, 1, ...
|
|
18039
|
+
} else if (s.id === 11) out.push(section(11, [1, 1, ...encodeWasmNumber(tls.length), ...tls]));
|
|
18021
18040
|
else if (s.id === 12) out.push(section(12, [1]));
|
|
18022
18041
|
else out.push(bytes.subarray(s.offset, s.end));
|
|
18023
18042
|
}
|
|
@@ -18334,39 +18353,14 @@ function unslottedFunctions(bytes) {
|
|
|
18334
18353
|
}
|
|
18335
18354
|
return definedFuncs - slotted.size;
|
|
18336
18355
|
}
|
|
18337
|
-
var
|
|
18356
|
+
var section, PROCESS_EXPORTS, SWIFT_SDK_CONSTRUCTOR_LIMIT, FUNCTION_RELOCATIONS, MEMORY_RELOCATIONS, ADDEND_RELOCATIONS, FUNCTION_RELOC_MASK, MEMORY_RELOC_MASK, ADDEND_RELOC_MASK;
|
|
18338
18357
|
var init_swift_sdk_image_wasm = __esm({
|
|
18339
18358
|
"src/swift-sdk-image-wasm.ts"() {
|
|
18340
18359
|
"use strict";
|
|
18341
18360
|
init_swift_sdk_image_map();
|
|
18342
18361
|
init_swiftSdkLinkContract();
|
|
18343
|
-
|
|
18344
|
-
|
|
18345
|
-
do {
|
|
18346
|
-
let byte = value % 128;
|
|
18347
|
-
value = Math.floor(value / 128);
|
|
18348
|
-
if (value) byte |= 128;
|
|
18349
|
-
out.push(byte);
|
|
18350
|
-
} while (value);
|
|
18351
|
-
return out;
|
|
18352
|
-
};
|
|
18353
|
-
sleb = (value) => {
|
|
18354
|
-
const out = [];
|
|
18355
|
-
for (; ; ) {
|
|
18356
|
-
const byte = Number(value & 127n);
|
|
18357
|
-
value >>= 7n;
|
|
18358
|
-
if (value === 0n && !(byte & 64) || value === -1n && byte & 64) {
|
|
18359
|
-
out.push(byte);
|
|
18360
|
-
return out;
|
|
18361
|
-
}
|
|
18362
|
-
out.push(byte | 128);
|
|
18363
|
-
}
|
|
18364
|
-
};
|
|
18365
|
-
encodedName = (name3) => {
|
|
18366
|
-
const bytes = [...Buffer.from(name3)];
|
|
18367
|
-
return [...uleb(bytes.length), ...bytes];
|
|
18368
|
-
};
|
|
18369
|
-
section = (id, payload) => Uint8Array.from([id, ...uleb(payload.length), ...payload]);
|
|
18362
|
+
init_wasm_binary_sections();
|
|
18363
|
+
section = (id, payload) => Uint8Array.from([id, ...encodeWasmNumber(payload.length), ...payload]);
|
|
18370
18364
|
PROCESS_EXPORTS = [
|
|
18371
18365
|
"_initialize",
|
|
18372
18366
|
"__wasm_call_ctors",
|
|
@@ -18471,20 +18465,12 @@ function localizeDefinedWasmSymbols(bytes, names) {
|
|
|
18471
18465
|
const output = new Uint8Array(bytes);
|
|
18472
18466
|
let cur = 8;
|
|
18473
18467
|
const readU = () => {
|
|
18474
|
-
const
|
|
18475
|
-
|
|
18476
|
-
|
|
18477
|
-
let shift = 7;
|
|
18478
|
-
while (true) {
|
|
18479
|
-
const byte = bytes[cur++];
|
|
18480
|
-
res |= (byte & 127) << shift;
|
|
18481
|
-
if ((byte & 128) === 0) return res;
|
|
18482
|
-
shift += 7;
|
|
18483
|
-
}
|
|
18468
|
+
const [res, next] = readULEB(bytes, cur);
|
|
18469
|
+
cur = next;
|
|
18470
|
+
return res;
|
|
18484
18471
|
};
|
|
18485
18472
|
const skipU = () => {
|
|
18486
|
-
|
|
18487
|
-
}
|
|
18473
|
+
cur = skipLEB(bytes, cur);
|
|
18488
18474
|
};
|
|
18489
18475
|
const importFuncNames = [];
|
|
18490
18476
|
const importGlobalNames = [];
|
|
@@ -18591,45 +18577,11 @@ function localizeDefinedWasmSymbols(bytes, names) {
|
|
|
18591
18577
|
var init_swift_wasm_archive = __esm({
|
|
18592
18578
|
"src/swift-wasm-archive.ts"() {
|
|
18593
18579
|
"use strict";
|
|
18580
|
+
init_wasm_binary_sections();
|
|
18594
18581
|
}
|
|
18595
18582
|
});
|
|
18596
18583
|
|
|
18597
18584
|
// src/swift-wasm-prune.ts
|
|
18598
|
-
function readULEB2(b, o) {
|
|
18599
|
-
let res = 0;
|
|
18600
|
-
let shift = 0;
|
|
18601
|
-
let p = o;
|
|
18602
|
-
while (true) {
|
|
18603
|
-
const byte = b[p++];
|
|
18604
|
-
res |= (byte & 127) << shift;
|
|
18605
|
-
if ((byte & 128) === 0) break;
|
|
18606
|
-
shift += 7;
|
|
18607
|
-
}
|
|
18608
|
-
return [res, p];
|
|
18609
|
-
}
|
|
18610
|
-
function readSLEB(b, o) {
|
|
18611
|
-
let res = 0;
|
|
18612
|
-
let shift = 0;
|
|
18613
|
-
let p = o;
|
|
18614
|
-
let byte = 0;
|
|
18615
|
-
do {
|
|
18616
|
-
byte = b[p++];
|
|
18617
|
-
res |= (byte & 127) << shift;
|
|
18618
|
-
shift += 7;
|
|
18619
|
-
} while (byte & 128);
|
|
18620
|
-
if (shift < 32 && byte & 64) res |= ~0 << shift;
|
|
18621
|
-
return [res, p];
|
|
18622
|
-
}
|
|
18623
|
-
function encodeULEB(val) {
|
|
18624
|
-
const out = [];
|
|
18625
|
-
do {
|
|
18626
|
-
let byte = val & 127;
|
|
18627
|
-
val >>>= 7;
|
|
18628
|
-
if (val !== 0) byte |= 128;
|
|
18629
|
-
out.push(byte);
|
|
18630
|
-
} while (val !== 0);
|
|
18631
|
-
return out;
|
|
18632
|
-
}
|
|
18633
18585
|
function isRootSegName(name3) {
|
|
18634
18586
|
for (const pref of ROOT_SEG_PREFIXES) {
|
|
18635
18587
|
if (name3 === pref || name3.startsWith(`${pref}.`)) return true;
|
|
@@ -18655,39 +18607,14 @@ function decodeRelocations(buf, sections) {
|
|
|
18655
18607
|
for (let k = 0; k < sectionCount; k++, i++) {
|
|
18656
18608
|
start[i] = length + cur - baseAt;
|
|
18657
18609
|
const rType = buf[cur++];
|
|
18658
|
-
let offset
|
|
18659
|
-
|
|
18660
|
-
|
|
18661
|
-
|
|
18662
|
-
while (true) {
|
|
18663
|
-
const byte = buf[cur++];
|
|
18664
|
-
offset |= (byte & 127) << shift;
|
|
18665
|
-
if (byte < 128) break;
|
|
18666
|
-
shift += 7;
|
|
18667
|
-
}
|
|
18668
|
-
}
|
|
18669
|
-
let symbol2 = buf[cur++];
|
|
18670
|
-
if (symbol2 >= 128) {
|
|
18671
|
-
symbol2 &= 127;
|
|
18672
|
-
let shift = 7;
|
|
18673
|
-
while (true) {
|
|
18674
|
-
const byte = buf[cur++];
|
|
18675
|
-
symbol2 |= (byte & 127) << shift;
|
|
18676
|
-
if (byte < 128) break;
|
|
18677
|
-
shift += 7;
|
|
18678
|
-
}
|
|
18679
|
-
}
|
|
18610
|
+
let offset;
|
|
18611
|
+
[offset, cur] = readULEB(buf, cur);
|
|
18612
|
+
let symbol2;
|
|
18613
|
+
[symbol2, cur] = readULEB(buf, cur);
|
|
18680
18614
|
if (rType < 32 && (ADDEND_RELOC_MASK2 & 1 << rType) !== 0) {
|
|
18681
|
-
let
|
|
18682
|
-
|
|
18683
|
-
|
|
18684
|
-
while (byte >= 128) {
|
|
18685
|
-
byte = buf[cur++];
|
|
18686
|
-
value |= (byte & 127) << shift;
|
|
18687
|
-
shift += 7;
|
|
18688
|
-
}
|
|
18689
|
-
if (shift < 32 && (byte & 64) !== 0) value |= ~0 << shift;
|
|
18690
|
-
addend[i] = value;
|
|
18615
|
+
let value;
|
|
18616
|
+
[value, cur] = readSLEB(buf, cur);
|
|
18617
|
+
addend[i] = Number(BigInt.asIntN(32, value));
|
|
18691
18618
|
}
|
|
18692
18619
|
ro[i] = offset;
|
|
18693
18620
|
rs[i] = symbol2;
|
|
@@ -18722,36 +18649,36 @@ function patchSwiftrtObject(src) {
|
|
|
18722
18649
|
let pos = 8;
|
|
18723
18650
|
while (pos < buf.length) {
|
|
18724
18651
|
const id = buf[pos++];
|
|
18725
|
-
const [sz, p] =
|
|
18652
|
+
const [sz, p] = readULEB(buf, pos);
|
|
18726
18653
|
const end = p + sz;
|
|
18727
18654
|
if (id === 0) {
|
|
18728
|
-
const [nLen, np] =
|
|
18655
|
+
const [nLen, np] = readULEB(buf, p);
|
|
18729
18656
|
const name3 = Buffer.from(buf.subarray(np, np + nLen)).toString("utf8");
|
|
18730
18657
|
const cp = np + nLen;
|
|
18731
18658
|
if (name3 === "linking") {
|
|
18732
|
-
let [, lp] =
|
|
18659
|
+
let [, lp] = readULEB(buf, cp);
|
|
18733
18660
|
while (lp < end) {
|
|
18734
18661
|
const subId = buf[lp++];
|
|
18735
|
-
const [subLen, sp] =
|
|
18662
|
+
const [subLen, sp] = readULEB(buf, lp);
|
|
18736
18663
|
const subEnd = sp + subLen;
|
|
18737
18664
|
if (subId === 8) {
|
|
18738
|
-
let [cnt, cur] =
|
|
18665
|
+
let [cnt, cur] = readULEB(buf, sp);
|
|
18739
18666
|
for (let i = 0; i < cnt; i++) {
|
|
18740
18667
|
const kind = buf[cur++];
|
|
18741
18668
|
const flPos = cur;
|
|
18742
|
-
const [fl, c2] =
|
|
18669
|
+
const [fl, c2] = readULEB(buf, cur);
|
|
18743
18670
|
cur = c2;
|
|
18744
18671
|
const isUndef = (fl & 16) !== 0;
|
|
18745
18672
|
const isExplicitName = (fl & 64) !== 0;
|
|
18746
18673
|
if (kind === 0 || kind === 2 || kind === 4 || kind === 5) {
|
|
18747
|
-
const [, c3] =
|
|
18674
|
+
const [, c3] = readULEB(buf, cur);
|
|
18748
18675
|
cur = c3;
|
|
18749
18676
|
if (!isUndef || isExplicitName) {
|
|
18750
|
-
const [sLen, c4] =
|
|
18677
|
+
const [sLen, c4] = readULEB(buf, cur);
|
|
18751
18678
|
cur = c4 + sLen;
|
|
18752
18679
|
}
|
|
18753
18680
|
} else if (kind === 1) {
|
|
18754
|
-
const [sLen, c3] =
|
|
18681
|
+
const [sLen, c3] = readULEB(buf, cur);
|
|
18755
18682
|
const sName = Buffer.from(buf.subarray(c3, c3 + sLen)).toString("utf8");
|
|
18756
18683
|
if (sName === "_ZN12_GLOBAL__N_18sectionsE") fallbackSymIdx = i;
|
|
18757
18684
|
for (const prefix of ["__start_", "__stop_"]) {
|
|
@@ -18763,13 +18690,13 @@ function patchSwiftrtObject(src) {
|
|
|
18763
18690
|
}
|
|
18764
18691
|
cur = c3 + sLen;
|
|
18765
18692
|
if (!isUndef) {
|
|
18766
|
-
const [, c4] =
|
|
18767
|
-
const [, c5] =
|
|
18768
|
-
const [, c6] =
|
|
18693
|
+
const [, c4] = readULEB(buf, cur);
|
|
18694
|
+
const [, c5] = readULEB(buf, c4);
|
|
18695
|
+
const [, c6] = readULEB(buf, c5);
|
|
18769
18696
|
cur = c6;
|
|
18770
18697
|
}
|
|
18771
18698
|
} else if (kind === 3) {
|
|
18772
|
-
const [, c3] =
|
|
18699
|
+
const [, c3] = readULEB(buf, cur);
|
|
18773
18700
|
cur = c3;
|
|
18774
18701
|
}
|
|
18775
18702
|
}
|
|
@@ -18783,26 +18710,25 @@ function patchSwiftrtObject(src) {
|
|
|
18783
18710
|
pos = 8;
|
|
18784
18711
|
while (pos < buf.length) {
|
|
18785
18712
|
const id = buf[pos++];
|
|
18786
|
-
const [sz, p] =
|
|
18713
|
+
const [sz, p] = readULEB(buf, pos);
|
|
18787
18714
|
const end = p + sz;
|
|
18788
18715
|
if (id === 0) {
|
|
18789
|
-
const [nLen, np] =
|
|
18716
|
+
const [nLen, np] = readULEB(buf, p);
|
|
18790
18717
|
const name3 = Buffer.from(buf.subarray(np, np + nLen)).toString("utf8");
|
|
18791
18718
|
const cp = np + nLen;
|
|
18792
18719
|
if (name3 === "reloc.CODE") {
|
|
18793
|
-
const [, r1] =
|
|
18794
|
-
let [cnt, cur] =
|
|
18720
|
+
const [, r1] = readULEB(buf, cp);
|
|
18721
|
+
let [cnt, cur] = readULEB(buf, r1);
|
|
18795
18722
|
for (let i = 0; i < cnt; i++) {
|
|
18796
18723
|
const rType = buf[cur++];
|
|
18797
|
-
const [, c2] =
|
|
18798
|
-
const [rs, c3] =
|
|
18724
|
+
const [, c2] = readULEB(buf, cur);
|
|
18725
|
+
const [rs, c3] = readULEB(buf, c2);
|
|
18799
18726
|
if (neutralizedSyms.has(rs) && c3 - c2 === 1) {
|
|
18800
18727
|
buf[c2] = fallbackSymIdx;
|
|
18801
18728
|
}
|
|
18802
18729
|
cur = c3;
|
|
18803
18730
|
if (ADDEND_RELOCATIONS.has(rType)) {
|
|
18804
|
-
|
|
18805
|
-
cur = c4;
|
|
18731
|
+
cur = skipLEB(buf, cur);
|
|
18806
18732
|
}
|
|
18807
18733
|
}
|
|
18808
18734
|
}
|
|
@@ -18816,25 +18742,14 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
18816
18742
|
let pos = 8;
|
|
18817
18743
|
let cur = 8;
|
|
18818
18744
|
const readU = () => {
|
|
18819
|
-
const
|
|
18820
|
-
|
|
18821
|
-
|
|
18822
|
-
let shift = 7;
|
|
18823
|
-
while (true) {
|
|
18824
|
-
const byte = buf[cur++];
|
|
18825
|
-
res |= (byte & 127) << shift;
|
|
18826
|
-
if (byte < 128) return res;
|
|
18827
|
-
shift += 7;
|
|
18828
|
-
}
|
|
18745
|
+
const [res, next] = readULEB(buf, cur);
|
|
18746
|
+
cur = next;
|
|
18747
|
+
return res;
|
|
18829
18748
|
};
|
|
18830
18749
|
const skipU = () => {
|
|
18831
|
-
|
|
18832
|
-
}
|
|
18833
|
-
};
|
|
18834
|
-
const skipS = () => {
|
|
18835
|
-
while (buf[cur++] >= 128) {
|
|
18836
|
-
}
|
|
18750
|
+
cur = skipLEB(buf, cur);
|
|
18837
18751
|
};
|
|
18752
|
+
const skipS = skipU;
|
|
18838
18753
|
let numImportFuncs = 0;
|
|
18839
18754
|
let importsDlsym = false;
|
|
18840
18755
|
const importFuncNames = [];
|
|
@@ -19432,16 +19347,9 @@ function guestWasmSymbols(bytes) {
|
|
|
19432
19347
|
const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
19433
19348
|
let cur = 8;
|
|
19434
19349
|
const readU = () => {
|
|
19435
|
-
const
|
|
19436
|
-
|
|
19437
|
-
|
|
19438
|
-
let shift = 7;
|
|
19439
|
-
while (true) {
|
|
19440
|
-
const byte = bytes[cur++];
|
|
19441
|
-
res |= (byte & 127) << shift;
|
|
19442
|
-
if ((byte & 128) === 0) return res;
|
|
19443
|
-
shift += 7;
|
|
19444
|
-
}
|
|
19350
|
+
const [res, next] = readULEB(bytes, cur);
|
|
19351
|
+
cur = next;
|
|
19352
|
+
return res;
|
|
19445
19353
|
};
|
|
19446
19354
|
let importsDlsym = false;
|
|
19447
19355
|
const importFuncNames = [];
|
|
@@ -20582,7 +20490,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
20582
20490
|
if (!deadSpecialSegs.has(sIdx)) continue;
|
|
20583
20491
|
if (!isSpecialSegRelocLive(obj, obj.segNames[sIdx], data.rs[i])) continue;
|
|
20584
20492
|
const first = relocationBytes(data, i);
|
|
20585
|
-
const [, afterRoOff] =
|
|
20493
|
+
const [, afterRoOff] = readULEB(first, 1);
|
|
20586
20494
|
firstLiveInSpecialSeg.set(sIdx, {
|
|
20587
20495
|
rType: first[0],
|
|
20588
20496
|
afterRo: first.subarray(afterRoOff)
|
|
@@ -20612,7 +20520,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
20612
20520
|
zeroDataReloc(i);
|
|
20613
20521
|
} else {
|
|
20614
20522
|
const repl = firstLiveInSpecialSeg.get(segIdx);
|
|
20615
|
-
const roBytes =
|
|
20523
|
+
const roBytes = encodeWasmNumber(data.ro[i]);
|
|
20616
20524
|
const out = new Uint8Array(1 + roBytes.length + repl.afterRo.length);
|
|
20617
20525
|
out[0] = repl.rType;
|
|
20618
20526
|
out.set(roBytes, 1);
|
|
@@ -20651,34 +20559,34 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
20651
20559
|
while (pos < buf.length) {
|
|
20652
20560
|
const secStart = pos;
|
|
20653
20561
|
const id = buf[pos++];
|
|
20654
|
-
const [sz, p] =
|
|
20562
|
+
const [sz, p] = readULEB(buf, pos);
|
|
20655
20563
|
const end = p + sz;
|
|
20656
20564
|
if (id === 0) {
|
|
20657
|
-
const [nLen, np] =
|
|
20565
|
+
const [nLen, np] = readULEB(buf, p);
|
|
20658
20566
|
const name3 = rawBuf.toString("utf8", np, np + nLen);
|
|
20659
20567
|
const cp = np + nLen;
|
|
20660
20568
|
if (name3 === "linking") {
|
|
20661
|
-
const [, lpStart] =
|
|
20569
|
+
const [, lpStart] = readULEB(buf, cp);
|
|
20662
20570
|
const subChunks = [buf.subarray(p, lpStart)];
|
|
20663
20571
|
let lp = lpStart;
|
|
20664
20572
|
while (lp < end) {
|
|
20665
20573
|
const subStart = lp;
|
|
20666
20574
|
const subId = buf[lp++];
|
|
20667
|
-
const [subLen, sp] =
|
|
20575
|
+
const [subLen, sp] = readULEB(buf, lp);
|
|
20668
20576
|
const subEnd = sp + subLen;
|
|
20669
20577
|
if (subId === 5) {
|
|
20670
20578
|
const subCopy = new Uint8Array(buf.subarray(subStart, subEnd));
|
|
20671
|
-
let [cnt, cur] =
|
|
20579
|
+
let [cnt, cur] = readULEB(buf, sp);
|
|
20672
20580
|
for (let i = 0; i < cnt; i++) {
|
|
20673
|
-
const [sLen, s2] =
|
|
20581
|
+
const [sLen, s2] = readULEB(buf, cur);
|
|
20674
20582
|
const segName = obj.segNames[i];
|
|
20675
20583
|
const repl = RECORD_SEGS.get(segName);
|
|
20676
20584
|
const isSpecial = repl !== void 0;
|
|
20677
20585
|
if (deadSpecialSegs.has(i) && repl !== void 0)
|
|
20678
20586
|
subCopy.set(Buffer.from(repl, "utf8"), s2 - subStart);
|
|
20679
20587
|
cur = s2 + sLen;
|
|
20680
|
-
const [, s3] =
|
|
20681
|
-
const [segFl, s4] =
|
|
20588
|
+
const [, s3] = readULEB(buf, cur);
|
|
20589
|
+
const [segFl, s4] = readULEB(buf, s3);
|
|
20682
20590
|
const sFlLen = s4 - s3;
|
|
20683
20591
|
const keepRetain = isSpecial ? !deadSpecialSegs.has(i) : isRootSegName(segName) && !segName.startsWith(".init_array") && sLive[i] === 1;
|
|
20684
20592
|
const newSegFl = keepRetain ? segFl | 4 : segFl & ~4;
|
|
@@ -20692,12 +20600,12 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
20692
20600
|
}
|
|
20693
20601
|
subChunks.push(subCopy);
|
|
20694
20602
|
} else if (subId === 6) {
|
|
20695
|
-
let [cnt, cur] =
|
|
20603
|
+
let [cnt, cur] = readULEB(buf, sp);
|
|
20696
20604
|
const entrySlices = [];
|
|
20697
20605
|
for (let i = 0; i < cnt; i++) {
|
|
20698
20606
|
const eStart = cur;
|
|
20699
|
-
const [, s2] =
|
|
20700
|
-
const [symIdx, s3] =
|
|
20607
|
+
const [, s2] = readULEB(buf, cur);
|
|
20608
|
+
const [symIdx, s3] = readULEB(buf, s2);
|
|
20701
20609
|
cur = s3;
|
|
20702
20610
|
if (obj.symKind[symIdx] === 0 && obj.symElemIdx[symIdx] >= obj.numImportFuncs) {
|
|
20703
20611
|
if (fLive[obj.symElemIdx[symIdx] - obj.numImportFuncs] === 1) {
|
|
@@ -20708,19 +20616,19 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
20708
20616
|
}
|
|
20709
20617
|
}
|
|
20710
20618
|
if (entrySlices.length > 0) {
|
|
20711
|
-
const cntBytes = Uint8Array.from(
|
|
20619
|
+
const cntBytes = Uint8Array.from(encodeWasmNumber(entrySlices.length));
|
|
20712
20620
|
const bodyLen = cntBytes.length + entrySlices.reduce((a, b) => a + b.length, 0);
|
|
20713
|
-
const lenBytes = Uint8Array.from(
|
|
20621
|
+
const lenBytes = Uint8Array.from(encodeWasmNumber(bodyLen));
|
|
20714
20622
|
subChunks.push(Uint8Array.of(6), lenBytes, cntBytes);
|
|
20715
20623
|
for (const entry of entrySlices) subChunks.push(entry);
|
|
20716
20624
|
}
|
|
20717
20625
|
} else if (subId === 8) {
|
|
20718
20626
|
const subCopy = new Uint8Array(buf.subarray(subStart, subEnd));
|
|
20719
|
-
let [cnt, cur] =
|
|
20627
|
+
let [cnt, cur] = readULEB(buf, sp);
|
|
20720
20628
|
for (let i = 0; i < cnt; i++) {
|
|
20721
20629
|
const kind = buf[cur++];
|
|
20722
20630
|
const flOffset = cur - subStart;
|
|
20723
|
-
const [fl, c2] =
|
|
20631
|
+
const [fl, c2] = readULEB(buf, cur);
|
|
20724
20632
|
cur = c2;
|
|
20725
20633
|
const isUndef = (fl & 16) !== 0;
|
|
20726
20634
|
const isExplicitName = (fl & 64) !== 0;
|
|
@@ -20740,23 +20648,23 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
20740
20648
|
subCopy[flOffset + 1] = 0;
|
|
20741
20649
|
}
|
|
20742
20650
|
if (kind === 0 || kind === 2 || kind === 4 || kind === 5) {
|
|
20743
|
-
const [, c3] =
|
|
20651
|
+
const [, c3] = readULEB(buf, cur);
|
|
20744
20652
|
cur = c3;
|
|
20745
20653
|
if (!isUndef || isExplicitName) {
|
|
20746
|
-
const [sLen, c4] =
|
|
20654
|
+
const [sLen, c4] = readULEB(buf, cur);
|
|
20747
20655
|
cur = c4 + sLen;
|
|
20748
20656
|
}
|
|
20749
20657
|
} else if (kind === 1) {
|
|
20750
|
-
const [sLen, c3] =
|
|
20658
|
+
const [sLen, c3] = readULEB(buf, cur);
|
|
20751
20659
|
cur = c3 + sLen;
|
|
20752
20660
|
if (!isUndef) {
|
|
20753
|
-
const [, c4] =
|
|
20754
|
-
const [, c5] =
|
|
20755
|
-
const [, c6] =
|
|
20661
|
+
const [, c4] = readULEB(buf, cur);
|
|
20662
|
+
const [, c5] = readULEB(buf, c4);
|
|
20663
|
+
const [, c6] = readULEB(buf, c5);
|
|
20756
20664
|
cur = c6;
|
|
20757
20665
|
}
|
|
20758
20666
|
} else if (kind === 3) {
|
|
20759
|
-
const [, c3] =
|
|
20667
|
+
const [, c3] = readULEB(buf, cur);
|
|
20760
20668
|
cur = c3;
|
|
20761
20669
|
}
|
|
20762
20670
|
}
|
|
@@ -20767,29 +20675,29 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
20767
20675
|
lp = subEnd;
|
|
20768
20676
|
}
|
|
20769
20677
|
const totalSubLen = subChunks.reduce((a, b) => a + b.length, 0);
|
|
20770
|
-
outChunks.push(Uint8Array.of(0), Uint8Array.from(
|
|
20678
|
+
outChunks.push(Uint8Array.of(0), Uint8Array.from(encodeWasmNumber(totalSubLen)));
|
|
20771
20679
|
for (const chunk of subChunks) outChunks.push(chunk);
|
|
20772
20680
|
} else if (name3 === "reloc.CODE") {
|
|
20773
|
-
const [, r1] =
|
|
20681
|
+
const [, r1] = readULEB(buf, cp);
|
|
20774
20682
|
const headerSlice = buf.subarray(p, r1);
|
|
20775
|
-
const cntBytes = Uint8Array.from(
|
|
20683
|
+
const cntBytes = Uint8Array.from(encodeWasmNumber(keptCodeRelocs.length));
|
|
20776
20684
|
const relSlices = keptCodeRelocs.map((i) => relocationBytes(code, i));
|
|
20777
20685
|
const totalLen = headerSlice.length + cntBytes.length + relSlices.reduce((a, b) => a + b.length, 0);
|
|
20778
20686
|
outChunks.push(
|
|
20779
20687
|
Uint8Array.of(0),
|
|
20780
|
-
Uint8Array.from(
|
|
20688
|
+
Uint8Array.from(encodeWasmNumber(totalLen)),
|
|
20781
20689
|
headerSlice,
|
|
20782
20690
|
cntBytes
|
|
20783
20691
|
);
|
|
20784
20692
|
for (const relocation of relSlices) outChunks.push(relocation);
|
|
20785
20693
|
} else if (name3 === "reloc.DATA") {
|
|
20786
|
-
const [, r1] =
|
|
20694
|
+
const [, r1] = readULEB(buf, cp);
|
|
20787
20695
|
const headerSlice = buf.subarray(p, r1);
|
|
20788
|
-
const cntBytes = Uint8Array.from(
|
|
20696
|
+
const cntBytes = Uint8Array.from(encodeWasmNumber(keptDataRelocBytes.length));
|
|
20789
20697
|
const totalLen = headerSlice.length + cntBytes.length + keptDataRelocBytes.reduce((a, b) => a + b.length, 0);
|
|
20790
20698
|
outChunks.push(
|
|
20791
20699
|
Uint8Array.of(0),
|
|
20792
|
-
Uint8Array.from(
|
|
20700
|
+
Uint8Array.from(encodeWasmNumber(totalLen)),
|
|
20793
20701
|
headerSlice,
|
|
20794
20702
|
cntBytes
|
|
20795
20703
|
);
|
|
@@ -20799,15 +20707,15 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
20799
20707
|
const nameBytes = buf.subarray(p, cp);
|
|
20800
20708
|
outChunks.push(
|
|
20801
20709
|
Uint8Array.of(0),
|
|
20802
|
-
Uint8Array.from(
|
|
20710
|
+
Uint8Array.from(encodeWasmNumber(nameBytes.length)),
|
|
20803
20711
|
nameBytes
|
|
20804
20712
|
);
|
|
20805
20713
|
} else if (name3.startsWith("reloc..debug_")) {
|
|
20806
|
-
const [, r1] =
|
|
20714
|
+
const [, r1] = readULEB(buf, cp);
|
|
20807
20715
|
const headerSlice = buf.subarray(p, r1);
|
|
20808
20716
|
outChunks.push(
|
|
20809
20717
|
Uint8Array.of(0),
|
|
20810
|
-
Uint8Array.from(
|
|
20718
|
+
Uint8Array.from(encodeWasmNumber(headerSlice.length + 1)),
|
|
20811
20719
|
headerSlice,
|
|
20812
20720
|
Uint8Array.of(0)
|
|
20813
20721
|
);
|
|
@@ -20937,6 +20845,7 @@ var init_swift_wasm_prune = __esm({
|
|
|
20937
20845
|
init_swift_toolchain();
|
|
20938
20846
|
init_swift_wasm_archive();
|
|
20939
20847
|
init_swiftRuntimeProductContract();
|
|
20848
|
+
init_wasm_binary_sections();
|
|
20940
20849
|
WIDE_DATA_RELOCS = /* @__PURE__ */ new Set([16, 19, 22, 27]);
|
|
20941
20850
|
ROOT_SEG_PREFIXES = [
|
|
20942
20851
|
".init_array",
|
|
@@ -21200,34 +21109,11 @@ var init_nativeWasmContract = __esm({
|
|
|
21200
21109
|
});
|
|
21201
21110
|
|
|
21202
21111
|
// src/swift-guest-image-ledger.ts
|
|
21203
|
-
function readNumber(bytes, position) {
|
|
21204
|
-
if (position < bytes.length) {
|
|
21205
|
-
const first = bytes[position];
|
|
21206
|
-
if (first < 128) return [first, position + 1];
|
|
21207
|
-
}
|
|
21208
|
-
let value = 0;
|
|
21209
|
-
let shift = 0;
|
|
21210
|
-
for (; ; ) {
|
|
21211
|
-
if (position >= bytes.length || shift > 63) throw new Error("invalid wasm integer");
|
|
21212
|
-
const byte = bytes[position++];
|
|
21213
|
-
value += (byte & 127) * 2 ** shift;
|
|
21214
|
-
if (!(byte & 128)) return [value, position];
|
|
21215
|
-
shift += 7;
|
|
21216
|
-
}
|
|
21217
|
-
}
|
|
21218
21112
|
function encodeNumber(value) {
|
|
21219
|
-
|
|
21220
|
-
const bytes = [];
|
|
21221
|
-
do {
|
|
21222
|
-
let byte = value % 128;
|
|
21223
|
-
value = Math.floor(value / 128);
|
|
21224
|
-
if (value) byte |= 128;
|
|
21225
|
-
bytes.push(byte);
|
|
21226
|
-
} while (value);
|
|
21227
|
-
return Buffer.from(bytes);
|
|
21113
|
+
return Buffer.from(encodeWasmNumber(value));
|
|
21228
21114
|
}
|
|
21229
21115
|
function readString(bytes, position) {
|
|
21230
|
-
const [length, start] =
|
|
21116
|
+
const [length, start] = readULEB(bytes, position);
|
|
21231
21117
|
if (start + length > bytes.length) throw new Error("invalid wasm string");
|
|
21232
21118
|
return [
|
|
21233
21119
|
Buffer.from(bytes.buffer, bytes.byteOffset + start, length).toString("utf8"),
|
|
@@ -21553,13 +21439,13 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
21553
21439
|
for (const subsection of subsections) {
|
|
21554
21440
|
if (subsection.kind === 6 && objcLoader !== void 0) {
|
|
21555
21441
|
const content = subsection.parts[0];
|
|
21556
|
-
const [count, entriesStart] =
|
|
21442
|
+
const [count, entriesStart] = readULEB(content, 0);
|
|
21557
21443
|
const initWriter = new ByteWriter(content.length + 16);
|
|
21558
21444
|
initWriter.bytes(content, 0, entriesStart);
|
|
21559
21445
|
let entryStart = entriesStart;
|
|
21560
21446
|
for (let i = 0; i < count; i++) {
|
|
21561
|
-
const [, symbolStart] =
|
|
21562
|
-
const [symbol2, entryEnd] =
|
|
21447
|
+
const [, symbolStart] = readULEB(content, entryStart);
|
|
21448
|
+
const [symbol2, entryEnd] = readULEB(content, symbolStart);
|
|
21563
21449
|
if (symbol2 === objcLoader) {
|
|
21564
21450
|
initWriter.uleb(1);
|
|
21565
21451
|
initWriter.bytes(content, symbolStart, entryEnd);
|
|
@@ -21629,7 +21515,7 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
21629
21515
|
if (position < bytes.length && bytes[position] < 128) {
|
|
21630
21516
|
size2 = bytes[position++];
|
|
21631
21517
|
} else {
|
|
21632
|
-
const [val, next] =
|
|
21518
|
+
const [val, next] = readULEB(bytes, position);
|
|
21633
21519
|
size2 = val;
|
|
21634
21520
|
position = next;
|
|
21635
21521
|
}
|
|
@@ -22385,7 +22271,7 @@ function nameGuestImageAliases(wasm, symbols) {
|
|
|
22385
22271
|
const parts = [wasm.subarray(0, 8)];
|
|
22386
22272
|
let position = 8;
|
|
22387
22273
|
while (position < wasm.length) {
|
|
22388
|
-
const [size2, start] =
|
|
22274
|
+
const [size2, start] = readULEB(wasm, position + 1);
|
|
22389
22275
|
const end = start + size2;
|
|
22390
22276
|
const custom = wasm[position] === 0 ? readString(wasm, start) : void 0;
|
|
22391
22277
|
if (custom?.[0] !== "name") {
|
|
@@ -22396,17 +22282,17 @@ function nameGuestImageAliases(wasm, symbols) {
|
|
|
22396
22282
|
const subsections = [encodedString("name")];
|
|
22397
22283
|
let at = custom[1];
|
|
22398
22284
|
while (at < end) {
|
|
22399
|
-
const [subSize, subStart] =
|
|
22285
|
+
const [subSize, subStart] = readULEB(wasm, at + 1);
|
|
22400
22286
|
const subEnd = subStart + subSize;
|
|
22401
22287
|
if (wasm[at] !== 1) {
|
|
22402
22288
|
subsections.push(wasm.subarray(at, subEnd));
|
|
22403
22289
|
at = subEnd;
|
|
22404
22290
|
continue;
|
|
22405
22291
|
}
|
|
22406
|
-
let [count, cursor] =
|
|
22292
|
+
let [count, cursor] = readULEB(wasm, subStart);
|
|
22407
22293
|
const entries2 = [encodeNumber(count)];
|
|
22408
22294
|
for (; count > 0; count--) {
|
|
22409
|
-
const [index, next] =
|
|
22295
|
+
const [index, next] = readULEB(wasm, cursor);
|
|
22410
22296
|
const [name3, after] = readString(wasm, next);
|
|
22411
22297
|
cursor = after;
|
|
22412
22298
|
const symbol2 = symbols[Number(alias.exec(name3)?.[1] ?? -1)];
|
|
@@ -22430,6 +22316,7 @@ var init_swift_guest_image_ledger = __esm({
|
|
|
22430
22316
|
init_nativeWasmContract();
|
|
22431
22317
|
init_swift_sdk_image_wasm();
|
|
22432
22318
|
init_swiftSdkLinkContract();
|
|
22319
|
+
init_wasm_binary_sections();
|
|
22433
22320
|
ByteWriter = class {
|
|
22434
22321
|
buf;
|
|
22435
22322
|
pos = 0;
|
|
@@ -22450,16 +22337,13 @@ var init_swift_guest_image_ledger = __esm({
|
|
|
22450
22337
|
this.buf[this.pos++] = value;
|
|
22451
22338
|
}
|
|
22452
22339
|
uleb(value) {
|
|
22453
|
-
|
|
22454
|
-
|
|
22455
|
-
|
|
22456
|
-
|
|
22457
|
-
|
|
22458
|
-
|
|
22459
|
-
|
|
22460
|
-
buf[pos++] = byte;
|
|
22461
|
-
} while (value);
|
|
22462
|
-
this.pos = pos;
|
|
22340
|
+
if (value < 128) {
|
|
22341
|
+
this.byte(value);
|
|
22342
|
+
return;
|
|
22343
|
+
}
|
|
22344
|
+
const encoded = encodeWasmNumber(value);
|
|
22345
|
+
this.ensure(encoded.length);
|
|
22346
|
+
for (let i = 0; i < encoded.length; i++) this.buf[this.pos++] = encoded[i];
|
|
22463
22347
|
}
|
|
22464
22348
|
bytes(source, start = 0, end = source.length) {
|
|
22465
22349
|
const len = end - start;
|
|
@@ -22811,13 +22695,6 @@ function sha256Buffer(bytes) {
|
|
|
22811
22695
|
return Buffer.from(new Bun.CryptoHasher("sha256").update(bytes).digest());
|
|
22812
22696
|
return (0, import_node_crypto19.createHash)("sha256").update(bytes).digest();
|
|
22813
22697
|
}
|
|
22814
|
-
function uleb2(value) {
|
|
22815
|
-
const bytes = [];
|
|
22816
|
-
for (let rest = value; ; rest = Math.floor(rest / 128)) {
|
|
22817
|
-
if (rest < 128) return [...bytes, rest];
|
|
22818
|
-
bytes.push(rest % 128 | 128);
|
|
22819
|
-
}
|
|
22820
|
-
}
|
|
22821
22698
|
function encodeGuestDyldTable(rows) {
|
|
22822
22699
|
const encoded = rows.map((row) => ({ ...row, bytes: Buffer.from(row.name) })).sort((a, b) => Buffer.compare(a.bytes, b.bytes));
|
|
22823
22700
|
const packs = [];
|
|
@@ -22830,7 +22707,7 @@ function encodeGuestDyldTable(rows) {
|
|
|
22830
22707
|
value.writeBigUInt64LE(row.value);
|
|
22831
22708
|
const bytes = Buffer.concat([
|
|
22832
22709
|
row.bytes,
|
|
22833
|
-
Buffer.from([0, ...
|
|
22710
|
+
Buffer.from([0, ...encodeWasmNumber(row.image), row.kind]),
|
|
22834
22711
|
value
|
|
22835
22712
|
]);
|
|
22836
22713
|
if (!current2.length) firsts.push(row.bytes);
|
|
@@ -22922,6 +22799,7 @@ var init_swift_guest_dyld_table = __esm({
|
|
|
22922
22799
|
init_sha256();
|
|
22923
22800
|
init_swift_guest_image_ledger();
|
|
22924
22801
|
init_swift_guest_linked_spans();
|
|
22802
|
+
init_wasm_binary_sections();
|
|
22925
22803
|
init_wasm_narrow_boundary();
|
|
22926
22804
|
PACK_BYTES = 64 * 1024;
|
|
22927
22805
|
}
|
|
@@ -22997,8 +22875,8 @@ function readImports2(bytes, sections) {
|
|
|
22997
22875
|
return { functions, table64 };
|
|
22998
22876
|
}
|
|
22999
22877
|
function vectorSection(id, count, parts) {
|
|
23000
|
-
const body = Buffer.concat([Buffer.from(
|
|
23001
|
-
return Buffer.concat([Buffer.from([id, ...
|
|
22878
|
+
const body = Buffer.concat([Buffer.from(encodeWasmNumber(count)), ...parts]);
|
|
22879
|
+
return Buffer.concat([Buffer.from([id, ...encodeWasmNumber(body.length)]), body]);
|
|
23002
22880
|
}
|
|
23003
22881
|
function rewriteSections(bytes, sections, changes) {
|
|
23004
22882
|
const out = [bytes.subarray(0, 8)];
|
|
@@ -23054,9 +22932,9 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
23054
22932
|
vectorSection(2, count + 1, [
|
|
23055
22933
|
found && header ? bytes.subarray(header.at, found.end) : new Uint8Array(),
|
|
23056
22934
|
Buffer.from([
|
|
23057
|
-
...
|
|
22935
|
+
...encodeWasmNumber(module2.length),
|
|
23058
22936
|
...module2,
|
|
23059
|
-
...
|
|
22937
|
+
...encodeWasmNumber(name4.length),
|
|
23060
22938
|
...name4,
|
|
23061
22939
|
1,
|
|
23062
22940
|
112,
|
|
@@ -23078,7 +22956,7 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
23078
22956
|
elements.splice(
|
|
23079
22957
|
placementIndex,
|
|
23080
22958
|
0,
|
|
23081
|
-
Buffer.from([1, 0, ...
|
|
22959
|
+
Buffer.from([1, 0, ...encodeWasmNumber(functions.length), ...functions.flatMap(encodeWasmNumber)])
|
|
23082
22960
|
);
|
|
23083
22961
|
const place2 = imports2.functions + declared.length;
|
|
23084
22962
|
const instructions = [
|
|
@@ -23092,7 +22970,7 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
23092
22970
|
1,
|
|
23093
22971
|
252,
|
|
23094
22972
|
12,
|
|
23095
|
-
...
|
|
22973
|
+
...encodeWasmNumber(placementIndex),
|
|
23096
22974
|
0,
|
|
23097
22975
|
11
|
|
23098
22976
|
];
|
|
@@ -23113,14 +22991,14 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
23113
22991
|
3,
|
|
23114
22992
|
vectorSection(3, declared.length + 1, [
|
|
23115
22993
|
...declared,
|
|
23116
|
-
Buffer.from(
|
|
22994
|
+
Buffer.from(encodeWasmNumber(types2.length))
|
|
23117
22995
|
])
|
|
23118
22996
|
],
|
|
23119
22997
|
[
|
|
23120
22998
|
7,
|
|
23121
22999
|
vectorSection(7, exports2.length + 1, [
|
|
23122
23000
|
...exports2,
|
|
23123
|
-
Buffer.from([...
|
|
23001
|
+
Buffer.from([...encodeWasmNumber(name3.length), ...name3, 0, ...encodeWasmNumber(place2)])
|
|
23124
23002
|
])
|
|
23125
23003
|
],
|
|
23126
23004
|
[9, vectorSection(9, elements.length, elements)],
|
|
@@ -23128,7 +23006,7 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
23128
23006
|
10,
|
|
23129
23007
|
vectorSection(10, bodies.length + 1, [
|
|
23130
23008
|
...bodies,
|
|
23131
|
-
Buffer.from([...
|
|
23009
|
+
Buffer.from([...encodeWasmNumber(instructions.length), ...instructions])
|
|
23132
23010
|
])
|
|
23133
23011
|
]
|
|
23134
23012
|
])
|
|
@@ -23181,22 +23059,13 @@ function placeGuestLazyFunctions(bytes, lazy) {
|
|
|
23181
23059
|
function guestLazyExports(lazy) {
|
|
23182
23060
|
return lazy.map((name3) => JSON.stringify(`--export=${name3}`)).join("\n");
|
|
23183
23061
|
}
|
|
23184
|
-
var
|
|
23062
|
+
var SECTION_ORDER, readExport, lastTableElement;
|
|
23185
23063
|
var init_swift_guest_dyld_functions = __esm({
|
|
23186
23064
|
"src/swift-guest-dyld-functions.ts"() {
|
|
23187
23065
|
"use strict";
|
|
23188
23066
|
init_nativeWasmContract();
|
|
23189
23067
|
init_swift_sdk_image_wasm();
|
|
23190
|
-
|
|
23191
|
-
const out = [];
|
|
23192
|
-
do {
|
|
23193
|
-
let byte = value % 128;
|
|
23194
|
-
value = Math.floor(value / 128);
|
|
23195
|
-
if (value) byte |= 128;
|
|
23196
|
-
out.push(byte);
|
|
23197
|
-
} while (value);
|
|
23198
|
-
return out;
|
|
23199
|
-
};
|
|
23068
|
+
init_wasm_binary_sections();
|
|
23200
23069
|
SECTION_ORDER = [1, 2, 3, 4, 5, 13, 6, 7, 8, 9, 12, 10, 11];
|
|
23201
23070
|
readExport = (r) => {
|
|
23202
23071
|
r.name();
|
|
@@ -26530,30 +26399,12 @@ function wasmAutolinkEntries(bytes, out) {
|
|
|
26530
26399
|
const len = bytes.length;
|
|
26531
26400
|
while (pos < len) {
|
|
26532
26401
|
const id = bytes[pos++];
|
|
26533
|
-
let sz
|
|
26534
|
-
|
|
26535
|
-
sz &= 127;
|
|
26536
|
-
let shift = 7;
|
|
26537
|
-
while (true) {
|
|
26538
|
-
const b = bytes[pos++];
|
|
26539
|
-
sz |= (b & 127) << shift;
|
|
26540
|
-
if (b < 128) break;
|
|
26541
|
-
shift += 7;
|
|
26542
|
-
}
|
|
26543
|
-
}
|
|
26402
|
+
let sz;
|
|
26403
|
+
[sz, pos] = readULEB(bytes, pos, len);
|
|
26544
26404
|
const end = pos + sz;
|
|
26545
26405
|
if (id === 0) {
|
|
26546
|
-
let nLen
|
|
26547
|
-
|
|
26548
|
-
nLen &= 127;
|
|
26549
|
-
let shift = 7;
|
|
26550
|
-
while (true) {
|
|
26551
|
-
const b = bytes[pos++];
|
|
26552
|
-
nLen |= (b & 127) << shift;
|
|
26553
|
-
if (b < 128) break;
|
|
26554
|
-
shift += 7;
|
|
26555
|
-
}
|
|
26556
|
-
}
|
|
26406
|
+
let nLen;
|
|
26407
|
+
[nLen, pos] = readULEB(bytes, pos, end);
|
|
26557
26408
|
if (nLen === 24 && raw2.toString("ascii", pos, pos + 24) === ".swift1_autolink_entries") {
|
|
26558
26409
|
const payload = raw2.toString("utf8", pos + 24, end);
|
|
26559
26410
|
for (const entry of payload.split("\0")) {
|
|
@@ -26790,6 +26641,7 @@ var init_swift_guest_source_inputs = __esm({
|
|
|
26790
26641
|
init_swift_guest_source_plan();
|
|
26791
26642
|
init_swift_runtime_products();
|
|
26792
26643
|
init_swift_wasm_prune();
|
|
26644
|
+
init_wasm_binary_sections();
|
|
26793
26645
|
CLANG_TARGET_MODULE_WRAPPER = ".peach-clang";
|
|
26794
26646
|
PARALLEL_REPLAY = `
|
|
26795
26647
|
const { spawn } = require('node:child_process')
|
|
@@ -33047,8 +32899,8 @@ function finishSwiftAppModuleFile(file) {
|
|
|
33047
32899
|
return;
|
|
33048
32900
|
}
|
|
33049
32901
|
const thunks = sdkImportThunks(prefix);
|
|
33050
|
-
const nameBytes = Buffer.from(
|
|
33051
|
-
const header = Buffer.from([0, ...
|
|
32902
|
+
const nameBytes = Buffer.from(encodeWasmName(NATIVE_SDK_THUNK_SECTION));
|
|
32903
|
+
const header = Buffer.from([0, ...encodeWasmNumber(nameBytes.length + thunks.length)]);
|
|
33052
32904
|
(0, import_node_fs46.appendFileSync)(file, Buffer.concat([header, nameBytes, thunks]));
|
|
33053
32905
|
}
|
|
33054
32906
|
function swiftAppModuleInputs(tokens2, buildRoot, sdkLibraries) {
|
|
@@ -33400,17 +33252,17 @@ function sdkImportThunks(bytes) {
|
|
|
33400
33252
|
for (const { type } of imports2)
|
|
33401
33253
|
if (!typeIndex.has(type)) typeIndex.set(type, typeIndex.size + 1);
|
|
33402
33254
|
const loaderType = [96, 1, 127, 0];
|
|
33403
|
-
const vector = (items2) => [...
|
|
33404
|
-
const sectionBytes = (id, body) => [id, ...
|
|
33255
|
+
const vector = (items2) => [...encodeWasmNumber(items2.length), ...items2.flat()];
|
|
33256
|
+
const sectionBytes = (id, body) => [id, ...encodeWasmNumber(body.length), ...body];
|
|
33405
33257
|
const slotGlobals = imports2.map(({ slot }) => [
|
|
33406
|
-
...
|
|
33407
|
-
...
|
|
33258
|
+
...encodeWasmName(NATIVE_SDK_IMPORT_MODULE),
|
|
33259
|
+
...encodeWasmName(String(slot)),
|
|
33408
33260
|
3,
|
|
33409
33261
|
127,
|
|
33410
33262
|
0
|
|
33411
33263
|
]);
|
|
33412
33264
|
const bodies = imports2.map(({ type }, index) => {
|
|
33413
|
-
const slotValue = [35, ...
|
|
33265
|
+
const slotValue = [35, ...encodeWasmNumber(index)];
|
|
33414
33266
|
const code = [
|
|
33415
33267
|
0,
|
|
33416
33268
|
...slotValue,
|
|
@@ -33423,14 +33275,14 @@ function sdkImportThunks(bytes) {
|
|
|
33423
33275
|
16,
|
|
33424
33276
|
0,
|
|
33425
33277
|
11,
|
|
33426
|
-
...Array.from({ length: params[type] }, (_, i) => [32, ...
|
|
33278
|
+
...Array.from({ length: params[type] }, (_, i) => [32, ...encodeWasmNumber(i)]).flat(),
|
|
33427
33279
|
...slotValue,
|
|
33428
33280
|
17,
|
|
33429
|
-
...
|
|
33281
|
+
...encodeWasmNumber(typeIndex.get(type)),
|
|
33430
33282
|
0,
|
|
33431
33283
|
11
|
|
33432
33284
|
];
|
|
33433
|
-
return [...
|
|
33285
|
+
return [...encodeWasmNumber(code.length), ...code];
|
|
33434
33286
|
});
|
|
33435
33287
|
return Uint8Array.from([
|
|
33436
33288
|
0,
|
|
@@ -33448,21 +33300,21 @@ function sdkImportThunks(bytes) {
|
|
|
33448
33300
|
...sectionBytes(
|
|
33449
33301
|
2,
|
|
33450
33302
|
vector([
|
|
33451
|
-
[...
|
|
33303
|
+
[...encodeWasmName("env"), ...encodeWasmName("__indirect_function_table"), 1, ...table],
|
|
33452
33304
|
[
|
|
33453
|
-
...
|
|
33454
|
-
...
|
|
33305
|
+
...encodeWasmName(NATIVE_LAZY_IMPORT_MODULE),
|
|
33306
|
+
...encodeWasmName(NATIVE_LAZY_SLOT_IMPORT),
|
|
33455
33307
|
0,
|
|
33456
33308
|
0
|
|
33457
33309
|
],
|
|
33458
33310
|
...slotGlobals
|
|
33459
33311
|
])
|
|
33460
33312
|
),
|
|
33461
|
-
...sectionBytes(3, vector(imports2.map(({ type }) =>
|
|
33313
|
+
...sectionBytes(3, vector(imports2.map(({ type }) => encodeWasmNumber(typeIndex.get(type))))),
|
|
33462
33314
|
...sectionBytes(
|
|
33463
33315
|
7,
|
|
33464
33316
|
vector(
|
|
33465
|
-
imports2.map(({ slot }, i) => [...
|
|
33317
|
+
imports2.map(({ slot }, i) => [...encodeWasmName(String(slot)), 0, ...encodeWasmNumber(i + 1)])
|
|
33466
33318
|
)
|
|
33467
33319
|
),
|
|
33468
33320
|
...sectionBytes(10, vector(bodies))
|
|
@@ -33582,7 +33434,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
33582
33434
|
syntheticGlobals.push(type);
|
|
33583
33435
|
got.set(index, value);
|
|
33584
33436
|
}
|
|
33585
|
-
return [35, ...
|
|
33437
|
+
return [35, ...encodeWasmNumber(index)];
|
|
33586
33438
|
};
|
|
33587
33439
|
const tlsHelpers = new Map(
|
|
33588
33440
|
symbols.filter((symbol2) => symbol2.kind === 0 && symbol2.name.startsWith(SDK_TLS_HELPER)).map((symbol2) => [symbol2.name.slice(SDK_TLS_HELPER.length), symbol2.index])
|
|
@@ -33634,7 +33486,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
33634
33486
|
const code = [16];
|
|
33635
33487
|
for (let i = 0, rest = helper; i < 5; i++, rest >>>= 7)
|
|
33636
33488
|
code.push(i < 4 ? rest & 127 | 128 : rest & 127);
|
|
33637
|
-
if (addend) code.push(66, ...
|
|
33489
|
+
if (addend) code.push(66, ...encodeWasmSigned(addend), 124);
|
|
33638
33490
|
patchCode(at2, 11, code);
|
|
33639
33491
|
continue;
|
|
33640
33492
|
}
|
|
@@ -33708,7 +33560,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
33708
33560
|
syntheticGlobals.push(valueType);
|
|
33709
33561
|
scratchGlobals.set(valueType, scratch2);
|
|
33710
33562
|
}
|
|
33711
|
-
const index =
|
|
33563
|
+
const index = encodeWasmNumber(scratch2);
|
|
33712
33564
|
patchCode(at - 2, 12, [
|
|
33713
33565
|
36,
|
|
33714
33566
|
...index,
|
|
@@ -33724,7 +33576,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
33724
33576
|
}
|
|
33725
33577
|
const encodedNameBuf = (name3) => {
|
|
33726
33578
|
const raw2 = Buffer.from(name3, "utf8");
|
|
33727
|
-
const len =
|
|
33579
|
+
const len = encodeWasmNumber(raw2.length);
|
|
33728
33580
|
const out = Buffer.allocUnsafe(len.length + raw2.length);
|
|
33729
33581
|
for (let i = 0; i < len.length; i++) out[i] = len[i];
|
|
33730
33582
|
raw2.copy(out, len.length);
|
|
@@ -33769,7 +33621,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
33769
33621
|
}
|
|
33770
33622
|
}
|
|
33771
33623
|
const globalParts = [
|
|
33772
|
-
Buffer.from(
|
|
33624
|
+
Buffer.from(encodeWasmNumber(globalCount - 1 + syntheticGlobals.length))
|
|
33773
33625
|
];
|
|
33774
33626
|
for (let index = 0; index < globalCount; index++) {
|
|
33775
33627
|
const start = gr.at;
|
|
@@ -33814,18 +33666,18 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
33814
33666
|
}
|
|
33815
33667
|
}
|
|
33816
33668
|
const exportParts = [
|
|
33817
|
-
Buffer.from(
|
|
33669
|
+
Buffer.from(encodeWasmNumber(exportCount + 1 + got.size)),
|
|
33818
33670
|
bytes.subarray(originalExportsStart, exportSection.end)
|
|
33819
33671
|
];
|
|
33820
33672
|
for (const [index, value] of got) {
|
|
33821
33673
|
exportParts.push(
|
|
33822
33674
|
encodedNameBuf(`${NATIVE_SDK_GLOBAL_PREFIX}${value}.${index}`),
|
|
33823
|
-
Buffer.from([3, ...
|
|
33675
|
+
Buffer.from([3, ...encodeWasmNumber(index)])
|
|
33824
33676
|
);
|
|
33825
33677
|
}
|
|
33826
33678
|
exportParts.push(encodedNameBuf("__indirect_function_table"), Buffer.from([1, 0]));
|
|
33827
33679
|
const replaced = /* @__PURE__ */ new Map([
|
|
33828
|
-
[2, Buffer.concat([Buffer.from(
|
|
33680
|
+
[2, Buffer.concat([Buffer.from(encodeWasmNumber(importEntryCount)), ...importParts])],
|
|
33829
33681
|
[6, Buffer.concat(globalParts)],
|
|
33830
33682
|
[7, Buffer.concat(exportParts)]
|
|
33831
33683
|
]);
|
|
@@ -33842,7 +33694,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
33842
33694
|
if (s.id === 10 && rebuiltCode) {
|
|
33843
33695
|
parts.push(rebuiltCode);
|
|
33844
33696
|
} else if (payload) {
|
|
33845
|
-
parts.push(Buffer.from([s.id, ...
|
|
33697
|
+
parts.push(Buffer.from([s.id, ...encodeWasmNumber(payload.length)]), payload);
|
|
33846
33698
|
} else {
|
|
33847
33699
|
parts.push(bytes.subarray(s.offset, s.end));
|
|
33848
33700
|
}
|
|
@@ -33858,7 +33710,7 @@ function expandSdkRelocations(bytes, section2, patches) {
|
|
|
33858
33710
|
patches.sort((a, b) => a.at - b.at);
|
|
33859
33711
|
const r = wasmReader(bytes, section2.start);
|
|
33860
33712
|
const count = r.u();
|
|
33861
|
-
const payload = [Uint8Array.from(
|
|
33713
|
+
const payload = [Uint8Array.from(encodeWasmNumber(count))];
|
|
33862
33714
|
let next = 0;
|
|
33863
33715
|
for (let i = 0; i < count; i++) {
|
|
33864
33716
|
const start = r.at;
|
|
@@ -33878,7 +33730,7 @@ function expandSdkRelocations(bytes, section2, patches) {
|
|
|
33878
33730
|
}
|
|
33879
33731
|
parts.push(bytes.subarray(at, end));
|
|
33880
33732
|
payload.push(
|
|
33881
|
-
Uint8Array.from(
|
|
33733
|
+
Uint8Array.from(encodeWasmNumber(parts.reduce((size3, part) => size3 + part.length, 0))),
|
|
33882
33734
|
...parts
|
|
33883
33735
|
);
|
|
33884
33736
|
}
|
|
@@ -33887,7 +33739,7 @@ function expandSdkRelocations(bytes, section2, patches) {
|
|
|
33887
33739
|
if (next !== patches.length || r.at !== section2.end)
|
|
33888
33740
|
throw new Error("Swift SDK code relocations exceed the code section");
|
|
33889
33741
|
return Buffer.concat([
|
|
33890
|
-
Uint8Array.from([10, ...
|
|
33742
|
+
Uint8Array.from([10, ...encodeWasmNumber(payload.reduce((size2, part) => size2 + part.length, 0))]),
|
|
33891
33743
|
...payload
|
|
33892
33744
|
]);
|
|
33893
33745
|
}
|
|
@@ -34579,7 +34431,7 @@ function partitionParent(section2) {
|
|
|
34579
34431
|
"__objc_class_refs"
|
|
34580
34432
|
].find((name3) => section2 === name3 || section2.startsWith(`${name3}.`));
|
|
34581
34433
|
}
|
|
34582
|
-
var import_node_child_process29, import_node_crypto31, import_node_fs46, import_node_path45, import_node_util9, import_node_zlib5, run3, RELOCATION_WIDTHS, GLOBAL_INDEX, TLS_SLEB64, SDK_TLS_HELPER, SDK_TLS_DELTA, OBJC_SECTION_BOUNDARY,
|
|
34434
|
+
var import_node_child_process29, import_node_crypto31, import_node_fs46, import_node_path45, import_node_util9, import_node_zlib5, run3, RELOCATION_WIDTHS, GLOBAL_INDEX, TLS_SLEB64, SDK_TLS_HELPER, SDK_TLS_DELTA, OBJC_SECTION_BOUNDARY, SCANNED, RUN_GAP;
|
|
34583
34435
|
var init_swift_sdk_app_module = __esm({
|
|
34584
34436
|
"src/swift-sdk-app-module.ts"() {
|
|
34585
34437
|
"use strict";
|
|
@@ -34602,6 +34454,7 @@ var init_swift_sdk_app_module = __esm({
|
|
|
34602
34454
|
init_swift_wasm_prune();
|
|
34603
34455
|
init_swiftSdkLinkContract();
|
|
34604
34456
|
init_swiftTargetContract();
|
|
34457
|
+
init_wasm_binary_sections();
|
|
34605
34458
|
init_wasm_narrow_boundary();
|
|
34606
34459
|
init_wasm_optimize();
|
|
34607
34460
|
run3 = (0, import_node_util9.promisify)(import_node_child_process29.execFile);
|
|
@@ -34622,32 +34475,6 @@ var init_swift_sdk_app_module = __esm({
|
|
|
34622
34475
|
SDK_TLS_HELPER = "__peach_sdk_tls.";
|
|
34623
34476
|
SDK_TLS_DELTA = "__peach_sdk_tls_delta.";
|
|
34624
34477
|
OBJC_SECTION_BOUNDARY = /^__(?:start|stop)_(__objc_(?:selectors|classes|class_refs|cats|protocols|protocol_refs|class_aliases|constant_string))$/;
|
|
34625
|
-
uleb4 = (value) => {
|
|
34626
|
-
const out = [];
|
|
34627
|
-
do {
|
|
34628
|
-
let byte = value % 128;
|
|
34629
|
-
value = Math.floor(value / 128);
|
|
34630
|
-
if (value) byte |= 128;
|
|
34631
|
-
out.push(byte);
|
|
34632
|
-
} while (value);
|
|
34633
|
-
return out;
|
|
34634
|
-
};
|
|
34635
|
-
sleb2 = (value) => {
|
|
34636
|
-
const out = [];
|
|
34637
|
-
for (; ; ) {
|
|
34638
|
-
const byte = Number(value & 127n);
|
|
34639
|
-
value >>= 7n;
|
|
34640
|
-
if (value === 0n && !(byte & 64) || value === -1n && byte & 64) {
|
|
34641
|
-
out.push(byte);
|
|
34642
|
-
return out;
|
|
34643
|
-
}
|
|
34644
|
-
out.push(byte | 128);
|
|
34645
|
-
}
|
|
34646
|
-
};
|
|
34647
|
-
encodedName2 = (name3) => {
|
|
34648
|
-
const bytes = [...Buffer.from(name3)];
|
|
34649
|
-
return [...uleb4(bytes.length), ...bytes];
|
|
34650
|
-
};
|
|
34651
34478
|
SCANNED = /* @__PURE__ */ new Set([
|
|
34652
34479
|
"swift5_protocols",
|
|
34653
34480
|
"swift5_protocol_conformances",
|
|
@@ -35738,36 +35565,22 @@ function archiveMember(archive, name3) {
|
|
|
35738
35565
|
throw new Error(`swift-icu: ${name3} is not in the sdk's icu archive`);
|
|
35739
35566
|
}
|
|
35740
35567
|
function icuSegment(object8) {
|
|
35741
|
-
let at = 8;
|
|
35742
|
-
const leb2 = () => {
|
|
35743
|
-
let result = 0;
|
|
35744
|
-
let shift = 0;
|
|
35745
|
-
let byte;
|
|
35746
|
-
do {
|
|
35747
|
-
byte = object8[at++];
|
|
35748
|
-
result += (byte & 127) * 2 ** shift;
|
|
35749
|
-
shift += 7;
|
|
35750
|
-
} while (byte & 128);
|
|
35751
|
-
return result;
|
|
35752
|
-
};
|
|
35753
35568
|
const found = [];
|
|
35754
|
-
|
|
35755
|
-
|
|
35756
|
-
const
|
|
35757
|
-
|
|
35758
|
-
|
|
35759
|
-
|
|
35760
|
-
|
|
35761
|
-
|
|
35762
|
-
|
|
35763
|
-
|
|
35764
|
-
|
|
35765
|
-
|
|
35766
|
-
|
|
35767
|
-
|
|
35768
|
-
}
|
|
35569
|
+
for (const section2 of wasmSections(object8)) {
|
|
35570
|
+
if (section2.id !== 11) continue;
|
|
35571
|
+
const reader = readWasmSection(object8, section2.start, section2.end);
|
|
35572
|
+
for (let count = reader.number(); count > 0; count--) {
|
|
35573
|
+
if (reader.number() !== 0)
|
|
35574
|
+
throw new Error("swift-icu: unexpected data segment kind");
|
|
35575
|
+
reader.byte();
|
|
35576
|
+
reader.number();
|
|
35577
|
+
reader.byte();
|
|
35578
|
+
const length = reader.number();
|
|
35579
|
+
const start = reader.position();
|
|
35580
|
+
const bytes = object8.subarray(start, start + length);
|
|
35581
|
+
if (bytes[2] === 218 && bytes[3] === 39) found.push(bytes);
|
|
35582
|
+
reader.skip(length);
|
|
35769
35583
|
}
|
|
35770
|
-
at = end;
|
|
35771
35584
|
}
|
|
35772
35585
|
if (found.length !== 1)
|
|
35773
35586
|
throw new Error(`swift-icu: expected one icu data segment, found ${found.length}`);
|
|
@@ -35821,6 +35634,7 @@ var init_swift_icu = __esm({
|
|
|
35821
35634
|
init_icuData();
|
|
35822
35635
|
init_swift_toolchain();
|
|
35823
35636
|
init_swiftTargetContract();
|
|
35637
|
+
init_wasm_binary_sections();
|
|
35824
35638
|
run4 = (0, import_node_util10.promisify)(import_node_child_process31.execFile);
|
|
35825
35639
|
deflate = (0, import_node_util10.promisify)(import_node_zlib6.gzip);
|
|
35826
35640
|
compressBrotli = (0, import_node_util10.promisify)(import_node_zlib6.brotliCompress);
|
|
@@ -42544,7 +42358,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
|
|
|
42544
42358
|
REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
42545
42359
|
MULTI_MANIFEST_VERSION = 76;
|
|
42546
42360
|
SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
42547
|
-
compilerSourceDigest = true ? "
|
|
42361
|
+
compilerSourceDigest = true ? "816651f27c8e6bad4746f2f90d840446903e3c4a2384095dcdf1c9ceb69ceba8" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
|
|
42548
42362
|
nativeCxxCompilerFlags = ["-fno-cxx-modules"];
|
|
42549
42363
|
MODULE_MAP_RESPONSE_FILE_RUN = 16;
|
|
42550
42364
|
cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
|
|
@@ -88649,7 +88463,7 @@ var init_swift_standin_digest = __esm({
|
|
|
88649
88463
|
];
|
|
88650
88464
|
RUNTIME_IMPORT = /(?:^|[;\n])[ \t]*(?:import|export)\s+(?!type(?:\s|\{))([\s\S]*?)\s+from\s*['"]([^'"]+)['"]|(?:^|[;\n])[ \t]*import\s+['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
88651
88465
|
standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS, STANDIN_DIGEST_EXCLUDED_FILES);
|
|
88652
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
88466
|
+
STANDIN_SOURCE_DIGEST = true ? "6f991ca933bc6ae43f06c18cb2029ff3209de583afa4457105e7452437c20f01" : standinSourceDigest();
|
|
88653
88467
|
}
|
|
88654
88468
|
});
|
|
88655
88469
|
|
|
@@ -107485,7 +107299,7 @@ var init_nitro_superset = __esm({
|
|
|
107485
107299
|
init_nitroContract();
|
|
107486
107300
|
init_swift_standin_digest();
|
|
107487
107301
|
NITRO_SUPERSET_ENTRY_NAME = "superset";
|
|
107488
|
-
NITRO_COMPILER_DIGEST = true ? "
|
|
107302
|
+
NITRO_COMPILER_DIGEST = true ? "379ef4bc3caf96c52a4ffe7df50670f16d8db945bfbc90e1513bff35258d8b6f" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
|
|
107489
107303
|
nitroSupersetLock = parseLock(nitro_superset_lock_default);
|
|
107490
107304
|
nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
|
|
107491
107305
|
published = /* @__PURE__ */ new Map();
|
|
@@ -108189,7 +108003,7 @@ var init_expo_eager_seam_contract = __esm({
|
|
|
108189
108003
|
|
|
108190
108004
|
// src/expo-native-compiler-digest.ts
|
|
108191
108005
|
function expoNativeCompilerDigestValue() {
|
|
108192
|
-
return true ? "
|
|
108006
|
+
return true ? "5217c97f9f40e75420d8af715a312e49984d9ec52582e3c5d6209439c3cb70f4" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
|
|
108193
108007
|
}
|
|
108194
108008
|
var import_node_crypto80;
|
|
108195
108009
|
var init_expo_native_compiler_digest = __esm({
|