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;
|
|
@@ -6177,7 +6177,7 @@ var init_swift_objc_sdk_tree = __esm({
|
|
|
6177
6177
|
|
|
6178
6178
|
// src/swift-compiler-digest.ts
|
|
6179
6179
|
function swiftArchiveCompilerDigestValue() {
|
|
6180
|
-
return true ? "
|
|
6180
|
+
return true ? "b4b2fc7face997792991900efb229414642f042031ba789c00a1d17e542756e3" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname, "archive");
|
|
6181
6181
|
}
|
|
6182
6182
|
var import_node_crypto10, import_node_fs25, import_node_path25, SWIFT_DIGEST_SOURCES, LINKED_IMAGE_SOURCES, SWIFT_ARCHIVE_DIGEST_SOURCES;
|
|
6183
6183
|
var init_swift_compiler_digest = __esm({
|
|
@@ -6206,6 +6206,7 @@ var init_swift_compiler_digest = __esm({
|
|
|
6206
6206
|
"swift-objc-prebuilt-catalog.ts",
|
|
6207
6207
|
"swift-toolchain.ts",
|
|
6208
6208
|
"swift-shared-sdk.ts",
|
|
6209
|
+
"wasm-binary-sections.ts",
|
|
6209
6210
|
"swift-distribution-mirror.ts",
|
|
6210
6211
|
"swift-design-time.ts",
|
|
6211
6212
|
"binaryen.lock.json",
|
|
@@ -6323,13 +6324,13 @@ var init_swift_standin_digest = __esm({
|
|
|
6323
6324
|
];
|
|
6324
6325
|
RUNTIME_IMPORT = /(?:^|[;\n])[ \t]*(?:import|export)\s+(?!type(?:\s|\{))([\s\S]*?)\s+from\s*['"]([^'"]+)['"]|(?:^|[;\n])[ \t]*import\s+['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
6325
6326
|
standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS, STANDIN_DIGEST_EXCLUDED_FILES);
|
|
6326
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
6327
|
+
STANDIN_SOURCE_DIGEST = true ? "6f991ca933bc6ae43f06c18cb2029ff3209de583afa4457105e7452437c20f01" : standinSourceDigest();
|
|
6327
6328
|
}
|
|
6328
6329
|
});
|
|
6329
6330
|
|
|
6330
6331
|
// src/expo-native-compiler-digest.ts
|
|
6331
6332
|
function expoNativeCompilerDigestValue() {
|
|
6332
|
-
return true ? "
|
|
6333
|
+
return true ? "5217c97f9f40e75420d8af715a312e49984d9ec52582e3c5d6209439c3cb70f4" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
|
|
6333
6334
|
}
|
|
6334
6335
|
var import_node_crypto12;
|
|
6335
6336
|
var init_expo_native_compiler_digest = __esm({
|
|
@@ -27972,6 +27973,111 @@ var init_swift_objc_runtime = __esm({
|
|
|
27972
27973
|
}
|
|
27973
27974
|
});
|
|
27974
27975
|
|
|
27976
|
+
// src/wasm-binary-sections.ts
|
|
27977
|
+
function encodeWasmNumber(value) {
|
|
27978
|
+
const bytes = [];
|
|
27979
|
+
for (let rest = value; ; ) {
|
|
27980
|
+
const byte = rest % 128;
|
|
27981
|
+
rest = Math.floor(rest / 128);
|
|
27982
|
+
if (rest === 0) return [...bytes, byte];
|
|
27983
|
+
bytes.push(byte | 128);
|
|
27984
|
+
}
|
|
27985
|
+
}
|
|
27986
|
+
function encodeWasmSigned(value) {
|
|
27987
|
+
const out = [];
|
|
27988
|
+
for (; ; ) {
|
|
27989
|
+
const byte = Number(value & 127n);
|
|
27990
|
+
value >>= 7n;
|
|
27991
|
+
if (value === 0n && !(byte & 64) || value === -1n && byte & 64) {
|
|
27992
|
+
out.push(byte);
|
|
27993
|
+
return out;
|
|
27994
|
+
}
|
|
27995
|
+
out.push(byte | 128);
|
|
27996
|
+
}
|
|
27997
|
+
}
|
|
27998
|
+
function encodeWasmName(name3) {
|
|
27999
|
+
const bytes = new TextEncoder().encode(name3);
|
|
28000
|
+
return [...encodeWasmNumber(bytes.length), ...bytes];
|
|
28001
|
+
}
|
|
28002
|
+
function readULEB(bytes, offset, end = bytes.length) {
|
|
28003
|
+
if (offset < end) {
|
|
28004
|
+
const first = bytes[offset];
|
|
28005
|
+
if (first < 128) return [first, offset + 1];
|
|
28006
|
+
}
|
|
28007
|
+
let value = 0;
|
|
28008
|
+
for (let shift = 0; ; shift += 7) {
|
|
28009
|
+
if (offset >= end || shift > 63) throw new Error("invalid wasm integer");
|
|
28010
|
+
const byte = bytes[offset++];
|
|
28011
|
+
value += (byte & 127) * 2 ** shift;
|
|
28012
|
+
if (!(byte & 128)) return [value, offset];
|
|
28013
|
+
}
|
|
28014
|
+
}
|
|
28015
|
+
function readSLEB(bytes, offset, end = bytes.length) {
|
|
28016
|
+
let value = 0n;
|
|
28017
|
+
let shift = 0n;
|
|
28018
|
+
let byte = 0;
|
|
28019
|
+
do {
|
|
28020
|
+
if (offset >= end || shift > 70n) throw new Error("invalid wasm integer");
|
|
28021
|
+
byte = bytes[offset++];
|
|
28022
|
+
value |= BigInt(byte & 127) << shift;
|
|
28023
|
+
shift += 7n;
|
|
28024
|
+
} while (byte & 128);
|
|
28025
|
+
if (byte & 64) value -= 1n << shift;
|
|
28026
|
+
return [value, offset];
|
|
28027
|
+
}
|
|
28028
|
+
function skipLEB(bytes, offset) {
|
|
28029
|
+
while ((bytes[offset++] & 128) !== 0) {
|
|
28030
|
+
}
|
|
28031
|
+
return offset;
|
|
28032
|
+
}
|
|
28033
|
+
function readWasmSection(bytes, start, end) {
|
|
28034
|
+
let at = start;
|
|
28035
|
+
const number4 = () => {
|
|
28036
|
+
const [value, next] = readULEB(bytes, at, end);
|
|
28037
|
+
at = next;
|
|
28038
|
+
return value;
|
|
28039
|
+
};
|
|
28040
|
+
return {
|
|
28041
|
+
number: number4,
|
|
28042
|
+
byte: () => {
|
|
28043
|
+
if (at >= end) throw new Error("truncated wasm section");
|
|
28044
|
+
return bytes[at++];
|
|
28045
|
+
},
|
|
28046
|
+
name: () => {
|
|
28047
|
+
const length = number4();
|
|
28048
|
+
at += length;
|
|
28049
|
+
if (at > end) throw new Error("truncated wasm name");
|
|
28050
|
+
return Buffer.from(bytes.buffer, bytes.byteOffset + at - length, length).toString();
|
|
28051
|
+
},
|
|
28052
|
+
skip: (length) => {
|
|
28053
|
+
at += length;
|
|
28054
|
+
if (at > end) throw new Error("truncated wasm section");
|
|
28055
|
+
},
|
|
28056
|
+
position: () => at,
|
|
28057
|
+
done: () => at === end
|
|
28058
|
+
};
|
|
28059
|
+
}
|
|
28060
|
+
function wasmSections(bytes) {
|
|
28061
|
+
if (Buffer.from(bytes.subarray(0, 8)).toString("hex") !== "0061736d01000000")
|
|
28062
|
+
throw new Error("not a wasm module");
|
|
28063
|
+
const found2 = [];
|
|
28064
|
+
for (let at = 8; at < bytes.length; ) {
|
|
28065
|
+
const header = readWasmSection(bytes, at, bytes.length);
|
|
28066
|
+
const id = header.byte();
|
|
28067
|
+
const size2 = header.number();
|
|
28068
|
+
const start = header.position();
|
|
28069
|
+
if (start + size2 > bytes.length) throw new Error("truncated wasm section");
|
|
28070
|
+
found2.push({ id, offset: at, start, end: start + size2 });
|
|
28071
|
+
at = start + size2;
|
|
28072
|
+
}
|
|
28073
|
+
return found2;
|
|
28074
|
+
}
|
|
28075
|
+
var init_wasm_binary_sections = __esm({
|
|
28076
|
+
"src/wasm-binary-sections.ts"() {
|
|
28077
|
+
"use strict";
|
|
28078
|
+
}
|
|
28079
|
+
});
|
|
28080
|
+
|
|
27975
28081
|
// src/swift-shared-sdk.ts
|
|
27976
28082
|
function swiftSharedSdkSourceRoot(moduleRoot, distribution) {
|
|
27977
28083
|
return import_node_path53.default.resolve(moduleRoot, distribution ? "sdk/ios" : "../peachsim/sdk/ios");
|
|
@@ -28022,18 +28128,6 @@ function swiftSharedSdkFlags(moduleRoot, distribution) {
|
|
|
28022
28128
|
import_node_path53.default.join(root, "usr/include")
|
|
28023
28129
|
];
|
|
28024
28130
|
}
|
|
28025
|
-
function readULEB(b, o) {
|
|
28026
|
-
let res = 0;
|
|
28027
|
-
let shift = 0;
|
|
28028
|
-
let p = o;
|
|
28029
|
-
while (true) {
|
|
28030
|
-
const byte = b[p++];
|
|
28031
|
-
res |= (byte & 127) << shift;
|
|
28032
|
-
if ((byte & 128) === 0) break;
|
|
28033
|
-
shift += 7;
|
|
28034
|
-
}
|
|
28035
|
-
return [res, p];
|
|
28036
|
-
}
|
|
28037
28131
|
function weakenFoundationSymbolsInWasmObj(buf) {
|
|
28038
28132
|
let pos = 8;
|
|
28039
28133
|
while (pos < buf.length) {
|
|
@@ -28398,6 +28492,7 @@ var init_swift_shared_sdk = __esm({
|
|
|
28398
28492
|
import_node_path53 = __toESM(require("node:path"), 1);
|
|
28399
28493
|
init_swift_toolchain();
|
|
28400
28494
|
init_swiftTargetContract();
|
|
28495
|
+
init_wasm_binary_sections();
|
|
28401
28496
|
SWIFT_DISTRIBUTION_MIRROR_RECORD = ".peach-mirror.json";
|
|
28402
28497
|
distributionHeaderRoots = /* @__PURE__ */ new Map();
|
|
28403
28498
|
WEAKEN_FOUNDATION_SYMS = /* @__PURE__ */ new Set([
|
|
@@ -29804,16 +29899,12 @@ var init_swift_link_roots = __esm({
|
|
|
29804
29899
|
"use strict";
|
|
29805
29900
|
import_node_fs56 = __toESM(require("node:fs"), 1);
|
|
29806
29901
|
import_node_path57 = __toESM(require("node:path"), 1);
|
|
29902
|
+
init_wasm_binary_sections();
|
|
29807
29903
|
OBJC_RUNTIME_LOOKUP_SECTION = "peach_objc_runtime_lookup";
|
|
29808
29904
|
leb = (bytes, at) => {
|
|
29809
|
-
|
|
29810
|
-
|
|
29811
|
-
|
|
29812
|
-
const byte = bytes[at.offset++];
|
|
29813
|
-
value += (byte & 127) * scale;
|
|
29814
|
-
if (!(byte & 128)) return value;
|
|
29815
|
-
scale *= 128;
|
|
29816
|
-
}
|
|
29905
|
+
const [value, next] = readULEB(bytes, at.offset);
|
|
29906
|
+
at.offset = next;
|
|
29907
|
+
return value;
|
|
29817
29908
|
};
|
|
29818
29909
|
rootsByDistribution = /* @__PURE__ */ new Map();
|
|
29819
29910
|
}
|
|
@@ -30642,68 +30733,6 @@ var init_swift_guest_linked_spans = __esm({
|
|
|
30642
30733
|
}
|
|
30643
30734
|
});
|
|
30644
30735
|
|
|
30645
|
-
// src/wasm-binary-sections.ts
|
|
30646
|
-
function encodeWasmNumber(value) {
|
|
30647
|
-
const bytes = [];
|
|
30648
|
-
for (let rest = value; ; ) {
|
|
30649
|
-
const byte = rest % 128;
|
|
30650
|
-
rest = Math.floor(rest / 128);
|
|
30651
|
-
if (rest === 0) return [...bytes, byte];
|
|
30652
|
-
bytes.push(byte | 128);
|
|
30653
|
-
}
|
|
30654
|
-
}
|
|
30655
|
-
function encodeWasmName(name3) {
|
|
30656
|
-
const bytes = new TextEncoder().encode(name3);
|
|
30657
|
-
return [...encodeWasmNumber(bytes.length), ...bytes];
|
|
30658
|
-
}
|
|
30659
|
-
function readWasmSection(bytes, start, end) {
|
|
30660
|
-
let at = start;
|
|
30661
|
-
const number4 = () => {
|
|
30662
|
-
let value = 0;
|
|
30663
|
-
for (let shift = 0; ; shift += 7) {
|
|
30664
|
-
if (at >= end || shift > 63) throw new Error("invalid wasm integer");
|
|
30665
|
-
const byte = bytes[at++];
|
|
30666
|
-
value += (byte & 127) * 2 ** shift;
|
|
30667
|
-
if (!(byte & 128)) return value;
|
|
30668
|
-
}
|
|
30669
|
-
};
|
|
30670
|
-
return {
|
|
30671
|
-
number: number4,
|
|
30672
|
-
byte: () => {
|
|
30673
|
-
if (at >= end) throw new Error("truncated wasm section");
|
|
30674
|
-
return bytes[at++];
|
|
30675
|
-
},
|
|
30676
|
-
name: () => {
|
|
30677
|
-
const length = number4();
|
|
30678
|
-
at += length;
|
|
30679
|
-
if (at > end) throw new Error("truncated wasm name");
|
|
30680
|
-
return Buffer.from(bytes.buffer, bytes.byteOffset + at - length, length).toString();
|
|
30681
|
-
},
|
|
30682
|
-
position: () => at,
|
|
30683
|
-
done: () => at === end
|
|
30684
|
-
};
|
|
30685
|
-
}
|
|
30686
|
-
function wasmSections(bytes) {
|
|
30687
|
-
if (Buffer.from(bytes.subarray(0, 8)).toString("hex") !== "0061736d01000000")
|
|
30688
|
-
throw new Error("not a wasm module");
|
|
30689
|
-
const found2 = [];
|
|
30690
|
-
for (let at = 8; at < bytes.length; ) {
|
|
30691
|
-
const header = readWasmSection(bytes, at, bytes.length);
|
|
30692
|
-
const id = header.byte();
|
|
30693
|
-
const size2 = header.number();
|
|
30694
|
-
const start = header.position();
|
|
30695
|
-
if (start + size2 > bytes.length) throw new Error("truncated wasm section");
|
|
30696
|
-
found2.push({ id, offset: at, start, end: start + size2 });
|
|
30697
|
-
at = start + size2;
|
|
30698
|
-
}
|
|
30699
|
-
return found2;
|
|
30700
|
-
}
|
|
30701
|
-
var init_wasm_binary_sections = __esm({
|
|
30702
|
-
"src/wasm-binary-sections.ts"() {
|
|
30703
|
-
"use strict";
|
|
30704
|
-
}
|
|
30705
|
-
});
|
|
30706
|
-
|
|
30707
30736
|
// src/wasm-imports.ts
|
|
30708
30737
|
function readWasmImports(bytes, section2, visit3) {
|
|
30709
30738
|
const input = readWasmSection(bytes, section2.start, section2.end);
|
|
@@ -30987,23 +31016,13 @@ function wasmReader(bytes, start) {
|
|
|
30987
31016
|
const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
30988
31017
|
let at = start;
|
|
30989
31018
|
const u = () => {
|
|
30990
|
-
|
|
30991
|
-
|
|
30992
|
-
|
|
30993
|
-
value += (byte & 127) * 2 ** shift;
|
|
30994
|
-
if (!(byte & 128)) return value;
|
|
30995
|
-
}
|
|
31019
|
+
const [value, next] = readULEB(bytes, at);
|
|
31020
|
+
at = next;
|
|
31021
|
+
return value;
|
|
30996
31022
|
};
|
|
30997
31023
|
const s = () => {
|
|
30998
|
-
|
|
30999
|
-
|
|
31000
|
-
let byte = 0;
|
|
31001
|
-
do {
|
|
31002
|
-
byte = bytes[at++];
|
|
31003
|
-
value |= BigInt(byte & 127) << shift;
|
|
31004
|
-
shift += 7n;
|
|
31005
|
-
} while (byte & 128);
|
|
31006
|
-
if (byte & 64) value -= 1n << shift;
|
|
31024
|
+
const [value, next] = readSLEB(bytes, at);
|
|
31025
|
+
at = next;
|
|
31007
31026
|
return value;
|
|
31008
31027
|
};
|
|
31009
31028
|
return {
|
|
@@ -31308,7 +31327,7 @@ function finishSdkImage(bytes, hostExports, libraries, guestMap) {
|
|
|
31308
31327
|
else data[entry.name] = value;
|
|
31309
31328
|
}
|
|
31310
31329
|
if (entry.kind !== 0 && entry.kind !== 3 || host2.has(entry.name))
|
|
31311
|
-
kept.push([...
|
|
31330
|
+
kept.push([...encodeWasmName(entry.name), entry.kind, ...encodeWasmNumber(entry.index)]);
|
|
31312
31331
|
}
|
|
31313
31332
|
if (guestMap) {
|
|
31314
31333
|
if (guestMap.code.length !== m.bodies.length)
|
|
@@ -31323,19 +31342,19 @@ function finishSdkImage(bytes, hostExports, libraries, guestMap) {
|
|
|
31323
31342
|
const er = wasmReader(bytes, elements.start);
|
|
31324
31343
|
const segments = er.u();
|
|
31325
31344
|
const replaced = /* @__PURE__ */ new Map([
|
|
31326
|
-
[4, [1, 112, 4, ...
|
|
31327
|
-
[7, [...
|
|
31345
|
+
[4, [1, 112, 4, ...encodeWasmNumber(tableEnd + added.length)]],
|
|
31346
|
+
[7, [...encodeWasmNumber(kept.length), ...kept.flat()]],
|
|
31328
31347
|
[
|
|
31329
31348
|
9,
|
|
31330
31349
|
[
|
|
31331
|
-
...
|
|
31350
|
+
...encodeWasmNumber(segments + 1),
|
|
31332
31351
|
...bytes.subarray(er.at, elements.end),
|
|
31333
31352
|
0,
|
|
31334
31353
|
66,
|
|
31335
|
-
...
|
|
31354
|
+
...encodeWasmSigned(BigInt(tableEnd)),
|
|
31336
31355
|
11,
|
|
31337
|
-
...
|
|
31338
|
-
...added.flatMap(
|
|
31356
|
+
...encodeWasmNumber(added.length),
|
|
31357
|
+
...added.flatMap(encodeWasmNumber)
|
|
31339
31358
|
]
|
|
31340
31359
|
]
|
|
31341
31360
|
]);
|
|
@@ -31441,33 +31460,33 @@ function codeOnlySdkImage(bytes, constructorMask) {
|
|
|
31441
31460
|
if (drop) r.skip(1);
|
|
31442
31461
|
gated.push(
|
|
31443
31462
|
66,
|
|
31444
|
-
...
|
|
31463
|
+
...encodeWasmSigned(BigInt(constructorMask + index++)),
|
|
31445
31464
|
45,
|
|
31446
31465
|
0,
|
|
31447
31466
|
0,
|
|
31448
31467
|
4,
|
|
31449
31468
|
64,
|
|
31450
31469
|
16,
|
|
31451
|
-
...
|
|
31470
|
+
...encodeWasmNumber(callee),
|
|
31452
31471
|
...drop ? [26] : [],
|
|
31453
31472
|
11
|
|
31454
31473
|
);
|
|
31455
31474
|
}
|
|
31456
31475
|
if (index > SWIFT_SDK_CONSTRUCTOR_LIMIT)
|
|
31457
31476
|
throw new Error(`${index} sdk constructors exceed the mask`);
|
|
31458
|
-
gated.push(16, ...
|
|
31477
|
+
gated.push(16, ...encodeWasmNumber(functionIndex("__peach_sdk_register")), 11);
|
|
31459
31478
|
bodies[constructors] = Uint8Array.from(gated);
|
|
31460
31479
|
}
|
|
31461
|
-
const codeParts = [Uint8Array.from(
|
|
31462
|
-
for (const body of bodies) codeParts.push(Uint8Array.from(
|
|
31480
|
+
const codeParts = [Uint8Array.from(encodeWasmNumber(bodies.length))];
|
|
31481
|
+
for (const body of bodies) codeParts.push(Uint8Array.from(encodeWasmNumber(body.length)), body);
|
|
31463
31482
|
const codeSize = codeParts.reduce((sum, part) => sum + part.length, 0);
|
|
31464
31483
|
const tls = passiveSegments(bytes)[0];
|
|
31465
31484
|
const out = [bytes.subarray(0, 8)];
|
|
31466
31485
|
for (const s of m.sections) {
|
|
31467
31486
|
if (s.id === 10) {
|
|
31468
|
-
out.push(Uint8Array.from([10, ...
|
|
31487
|
+
out.push(Uint8Array.from([10, ...encodeWasmNumber(codeSize)]));
|
|
31469
31488
|
for (const part of codeParts) out.push(part);
|
|
31470
|
-
} else if (s.id === 11) out.push(section(11, [1, 1, ...
|
|
31489
|
+
} else if (s.id === 11) out.push(section(11, [1, 1, ...encodeWasmNumber(tls.length), ...tls]));
|
|
31471
31490
|
else if (s.id === 12) out.push(section(12, [1]));
|
|
31472
31491
|
else out.push(bytes.subarray(s.offset, s.end));
|
|
31473
31492
|
}
|
|
@@ -31784,39 +31803,14 @@ function unslottedFunctions(bytes) {
|
|
|
31784
31803
|
}
|
|
31785
31804
|
return definedFuncs - slotted.size;
|
|
31786
31805
|
}
|
|
31787
|
-
var
|
|
31806
|
+
var section, PROCESS_EXPORTS, SWIFT_SDK_CONSTRUCTOR_LIMIT, FUNCTION_RELOCATIONS, MEMORY_RELOCATIONS, ADDEND_RELOCATIONS, FUNCTION_RELOC_MASK, MEMORY_RELOC_MASK, ADDEND_RELOC_MASK;
|
|
31788
31807
|
var init_swift_sdk_image_wasm = __esm({
|
|
31789
31808
|
"src/swift-sdk-image-wasm.ts"() {
|
|
31790
31809
|
"use strict";
|
|
31791
31810
|
init_swift_sdk_image_map();
|
|
31792
31811
|
init_swiftSdkLinkContract();
|
|
31793
|
-
|
|
31794
|
-
|
|
31795
|
-
do {
|
|
31796
|
-
let byte = value % 128;
|
|
31797
|
-
value = Math.floor(value / 128);
|
|
31798
|
-
if (value) byte |= 128;
|
|
31799
|
-
out.push(byte);
|
|
31800
|
-
} while (value);
|
|
31801
|
-
return out;
|
|
31802
|
-
};
|
|
31803
|
-
sleb = (value) => {
|
|
31804
|
-
const out = [];
|
|
31805
|
-
for (; ; ) {
|
|
31806
|
-
const byte = Number(value & 127n);
|
|
31807
|
-
value >>= 7n;
|
|
31808
|
-
if (value === 0n && !(byte & 64) || value === -1n && byte & 64) {
|
|
31809
|
-
out.push(byte);
|
|
31810
|
-
return out;
|
|
31811
|
-
}
|
|
31812
|
-
out.push(byte | 128);
|
|
31813
|
-
}
|
|
31814
|
-
};
|
|
31815
|
-
encodedName = (name3) => {
|
|
31816
|
-
const bytes = [...Buffer.from(name3)];
|
|
31817
|
-
return [...uleb(bytes.length), ...bytes];
|
|
31818
|
-
};
|
|
31819
|
-
section = (id, payload) => Uint8Array.from([id, ...uleb(payload.length), ...payload]);
|
|
31812
|
+
init_wasm_binary_sections();
|
|
31813
|
+
section = (id, payload) => Uint8Array.from([id, ...encodeWasmNumber(payload.length), ...payload]);
|
|
31820
31814
|
PROCESS_EXPORTS = [
|
|
31821
31815
|
"_initialize",
|
|
31822
31816
|
"__wasm_call_ctors",
|
|
@@ -31921,20 +31915,12 @@ function localizeDefinedWasmSymbols(bytes, names) {
|
|
|
31921
31915
|
const output = new Uint8Array(bytes);
|
|
31922
31916
|
let cur = 8;
|
|
31923
31917
|
const readU = () => {
|
|
31924
|
-
const
|
|
31925
|
-
|
|
31926
|
-
|
|
31927
|
-
let shift = 7;
|
|
31928
|
-
while (true) {
|
|
31929
|
-
const byte = bytes[cur++];
|
|
31930
|
-
res |= (byte & 127) << shift;
|
|
31931
|
-
if ((byte & 128) === 0) return res;
|
|
31932
|
-
shift += 7;
|
|
31933
|
-
}
|
|
31918
|
+
const [res, next] = readULEB(bytes, cur);
|
|
31919
|
+
cur = next;
|
|
31920
|
+
return res;
|
|
31934
31921
|
};
|
|
31935
31922
|
const skipU = () => {
|
|
31936
|
-
|
|
31937
|
-
}
|
|
31923
|
+
cur = skipLEB(bytes, cur);
|
|
31938
31924
|
};
|
|
31939
31925
|
const importFuncNames = [];
|
|
31940
31926
|
const importGlobalNames = [];
|
|
@@ -32041,45 +32027,11 @@ function localizeDefinedWasmSymbols(bytes, names) {
|
|
|
32041
32027
|
var init_swift_wasm_archive = __esm({
|
|
32042
32028
|
"src/swift-wasm-archive.ts"() {
|
|
32043
32029
|
"use strict";
|
|
32030
|
+
init_wasm_binary_sections();
|
|
32044
32031
|
}
|
|
32045
32032
|
});
|
|
32046
32033
|
|
|
32047
32034
|
// src/swift-wasm-prune.ts
|
|
32048
|
-
function readULEB2(b, o) {
|
|
32049
|
-
let res = 0;
|
|
32050
|
-
let shift = 0;
|
|
32051
|
-
let p = o;
|
|
32052
|
-
while (true) {
|
|
32053
|
-
const byte = b[p++];
|
|
32054
|
-
res |= (byte & 127) << shift;
|
|
32055
|
-
if ((byte & 128) === 0) break;
|
|
32056
|
-
shift += 7;
|
|
32057
|
-
}
|
|
32058
|
-
return [res, p];
|
|
32059
|
-
}
|
|
32060
|
-
function readSLEB(b, o) {
|
|
32061
|
-
let res = 0;
|
|
32062
|
-
let shift = 0;
|
|
32063
|
-
let p = o;
|
|
32064
|
-
let byte = 0;
|
|
32065
|
-
do {
|
|
32066
|
-
byte = b[p++];
|
|
32067
|
-
res |= (byte & 127) << shift;
|
|
32068
|
-
shift += 7;
|
|
32069
|
-
} while (byte & 128);
|
|
32070
|
-
if (shift < 32 && byte & 64) res |= ~0 << shift;
|
|
32071
|
-
return [res, p];
|
|
32072
|
-
}
|
|
32073
|
-
function encodeULEB(val) {
|
|
32074
|
-
const out = [];
|
|
32075
|
-
do {
|
|
32076
|
-
let byte = val & 127;
|
|
32077
|
-
val >>>= 7;
|
|
32078
|
-
if (val !== 0) byte |= 128;
|
|
32079
|
-
out.push(byte);
|
|
32080
|
-
} while (val !== 0);
|
|
32081
|
-
return out;
|
|
32082
|
-
}
|
|
32083
32035
|
function isRootSegName(name3) {
|
|
32084
32036
|
for (const pref of ROOT_SEG_PREFIXES) {
|
|
32085
32037
|
if (name3 === pref || name3.startsWith(`${pref}.`)) return true;
|
|
@@ -32105,39 +32057,14 @@ function decodeRelocations(buf, sections) {
|
|
|
32105
32057
|
for (let k = 0; k < sectionCount; k++, i++) {
|
|
32106
32058
|
start[i] = length + cur - baseAt;
|
|
32107
32059
|
const rType = buf[cur++];
|
|
32108
|
-
let offset
|
|
32109
|
-
|
|
32110
|
-
|
|
32111
|
-
|
|
32112
|
-
while (true) {
|
|
32113
|
-
const byte = buf[cur++];
|
|
32114
|
-
offset |= (byte & 127) << shift;
|
|
32115
|
-
if (byte < 128) break;
|
|
32116
|
-
shift += 7;
|
|
32117
|
-
}
|
|
32118
|
-
}
|
|
32119
|
-
let symbol2 = buf[cur++];
|
|
32120
|
-
if (symbol2 >= 128) {
|
|
32121
|
-
symbol2 &= 127;
|
|
32122
|
-
let shift = 7;
|
|
32123
|
-
while (true) {
|
|
32124
|
-
const byte = buf[cur++];
|
|
32125
|
-
symbol2 |= (byte & 127) << shift;
|
|
32126
|
-
if (byte < 128) break;
|
|
32127
|
-
shift += 7;
|
|
32128
|
-
}
|
|
32129
|
-
}
|
|
32060
|
+
let offset;
|
|
32061
|
+
[offset, cur] = readULEB(buf, cur);
|
|
32062
|
+
let symbol2;
|
|
32063
|
+
[symbol2, cur] = readULEB(buf, cur);
|
|
32130
32064
|
if (rType < 32 && (ADDEND_RELOC_MASK2 & 1 << rType) !== 0) {
|
|
32131
|
-
let
|
|
32132
|
-
|
|
32133
|
-
|
|
32134
|
-
while (byte >= 128) {
|
|
32135
|
-
byte = buf[cur++];
|
|
32136
|
-
value |= (byte & 127) << shift;
|
|
32137
|
-
shift += 7;
|
|
32138
|
-
}
|
|
32139
|
-
if (shift < 32 && (byte & 64) !== 0) value |= ~0 << shift;
|
|
32140
|
-
addend[i] = value;
|
|
32065
|
+
let value;
|
|
32066
|
+
[value, cur] = readSLEB(buf, cur);
|
|
32067
|
+
addend[i] = Number(BigInt.asIntN(32, value));
|
|
32141
32068
|
}
|
|
32142
32069
|
ro[i] = offset;
|
|
32143
32070
|
rs[i] = symbol2;
|
|
@@ -32172,36 +32099,36 @@ function patchSwiftrtObject(src) {
|
|
|
32172
32099
|
let pos = 8;
|
|
32173
32100
|
while (pos < buf.length) {
|
|
32174
32101
|
const id = buf[pos++];
|
|
32175
|
-
const [sz, p] =
|
|
32102
|
+
const [sz, p] = readULEB(buf, pos);
|
|
32176
32103
|
const end = p + sz;
|
|
32177
32104
|
if (id === 0) {
|
|
32178
|
-
const [nLen, np] =
|
|
32105
|
+
const [nLen, np] = readULEB(buf, p);
|
|
32179
32106
|
const name3 = Buffer.from(buf.subarray(np, np + nLen)).toString("utf8");
|
|
32180
32107
|
const cp = np + nLen;
|
|
32181
32108
|
if (name3 === "linking") {
|
|
32182
|
-
let [, lp] =
|
|
32109
|
+
let [, lp] = readULEB(buf, cp);
|
|
32183
32110
|
while (lp < end) {
|
|
32184
32111
|
const subId = buf[lp++];
|
|
32185
|
-
const [subLen, sp] =
|
|
32112
|
+
const [subLen, sp] = readULEB(buf, lp);
|
|
32186
32113
|
const subEnd = sp + subLen;
|
|
32187
32114
|
if (subId === 8) {
|
|
32188
|
-
let [cnt, cur] =
|
|
32115
|
+
let [cnt, cur] = readULEB(buf, sp);
|
|
32189
32116
|
for (let i = 0; i < cnt; i++) {
|
|
32190
32117
|
const kind = buf[cur++];
|
|
32191
32118
|
const flPos = cur;
|
|
32192
|
-
const [fl, c2] =
|
|
32119
|
+
const [fl, c2] = readULEB(buf, cur);
|
|
32193
32120
|
cur = c2;
|
|
32194
32121
|
const isUndef = (fl & 16) !== 0;
|
|
32195
32122
|
const isExplicitName = (fl & 64) !== 0;
|
|
32196
32123
|
if (kind === 0 || kind === 2 || kind === 4 || kind === 5) {
|
|
32197
|
-
const [, c3] =
|
|
32124
|
+
const [, c3] = readULEB(buf, cur);
|
|
32198
32125
|
cur = c3;
|
|
32199
32126
|
if (!isUndef || isExplicitName) {
|
|
32200
|
-
const [sLen, c4] =
|
|
32127
|
+
const [sLen, c4] = readULEB(buf, cur);
|
|
32201
32128
|
cur = c4 + sLen;
|
|
32202
32129
|
}
|
|
32203
32130
|
} else if (kind === 1) {
|
|
32204
|
-
const [sLen, c3] =
|
|
32131
|
+
const [sLen, c3] = readULEB(buf, cur);
|
|
32205
32132
|
const sName = Buffer.from(buf.subarray(c3, c3 + sLen)).toString("utf8");
|
|
32206
32133
|
if (sName === "_ZN12_GLOBAL__N_18sectionsE") fallbackSymIdx = i;
|
|
32207
32134
|
for (const prefix of ["__start_", "__stop_"]) {
|
|
@@ -32213,13 +32140,13 @@ function patchSwiftrtObject(src) {
|
|
|
32213
32140
|
}
|
|
32214
32141
|
cur = c3 + sLen;
|
|
32215
32142
|
if (!isUndef) {
|
|
32216
|
-
const [, c4] =
|
|
32217
|
-
const [, c5] =
|
|
32218
|
-
const [, c6] =
|
|
32143
|
+
const [, c4] = readULEB(buf, cur);
|
|
32144
|
+
const [, c5] = readULEB(buf, c4);
|
|
32145
|
+
const [, c6] = readULEB(buf, c5);
|
|
32219
32146
|
cur = c6;
|
|
32220
32147
|
}
|
|
32221
32148
|
} else if (kind === 3) {
|
|
32222
|
-
const [, c3] =
|
|
32149
|
+
const [, c3] = readULEB(buf, cur);
|
|
32223
32150
|
cur = c3;
|
|
32224
32151
|
}
|
|
32225
32152
|
}
|
|
@@ -32233,26 +32160,25 @@ function patchSwiftrtObject(src) {
|
|
|
32233
32160
|
pos = 8;
|
|
32234
32161
|
while (pos < buf.length) {
|
|
32235
32162
|
const id = buf[pos++];
|
|
32236
|
-
const [sz, p] =
|
|
32163
|
+
const [sz, p] = readULEB(buf, pos);
|
|
32237
32164
|
const end = p + sz;
|
|
32238
32165
|
if (id === 0) {
|
|
32239
|
-
const [nLen, np] =
|
|
32166
|
+
const [nLen, np] = readULEB(buf, p);
|
|
32240
32167
|
const name3 = Buffer.from(buf.subarray(np, np + nLen)).toString("utf8");
|
|
32241
32168
|
const cp = np + nLen;
|
|
32242
32169
|
if (name3 === "reloc.CODE") {
|
|
32243
|
-
const [, r1] =
|
|
32244
|
-
let [cnt, cur] =
|
|
32170
|
+
const [, r1] = readULEB(buf, cp);
|
|
32171
|
+
let [cnt, cur] = readULEB(buf, r1);
|
|
32245
32172
|
for (let i = 0; i < cnt; i++) {
|
|
32246
32173
|
const rType = buf[cur++];
|
|
32247
|
-
const [, c2] =
|
|
32248
|
-
const [rs, c3] =
|
|
32174
|
+
const [, c2] = readULEB(buf, cur);
|
|
32175
|
+
const [rs, c3] = readULEB(buf, c2);
|
|
32249
32176
|
if (neutralizedSyms.has(rs) && c3 - c2 === 1) {
|
|
32250
32177
|
buf[c2] = fallbackSymIdx;
|
|
32251
32178
|
}
|
|
32252
32179
|
cur = c3;
|
|
32253
32180
|
if (ADDEND_RELOCATIONS.has(rType)) {
|
|
32254
|
-
|
|
32255
|
-
cur = c4;
|
|
32181
|
+
cur = skipLEB(buf, cur);
|
|
32256
32182
|
}
|
|
32257
32183
|
}
|
|
32258
32184
|
}
|
|
@@ -32266,25 +32192,14 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
32266
32192
|
let pos = 8;
|
|
32267
32193
|
let cur = 8;
|
|
32268
32194
|
const readU = () => {
|
|
32269
|
-
const
|
|
32270
|
-
|
|
32271
|
-
|
|
32272
|
-
let shift = 7;
|
|
32273
|
-
while (true) {
|
|
32274
|
-
const byte = buf[cur++];
|
|
32275
|
-
res |= (byte & 127) << shift;
|
|
32276
|
-
if (byte < 128) return res;
|
|
32277
|
-
shift += 7;
|
|
32278
|
-
}
|
|
32195
|
+
const [res, next] = readULEB(buf, cur);
|
|
32196
|
+
cur = next;
|
|
32197
|
+
return res;
|
|
32279
32198
|
};
|
|
32280
32199
|
const skipU = () => {
|
|
32281
|
-
|
|
32282
|
-
}
|
|
32283
|
-
};
|
|
32284
|
-
const skipS = () => {
|
|
32285
|
-
while (buf[cur++] >= 128) {
|
|
32286
|
-
}
|
|
32200
|
+
cur = skipLEB(buf, cur);
|
|
32287
32201
|
};
|
|
32202
|
+
const skipS = skipU;
|
|
32288
32203
|
let numImportFuncs = 0;
|
|
32289
32204
|
let importsDlsym = false;
|
|
32290
32205
|
const importFuncNames = [];
|
|
@@ -32882,16 +32797,9 @@ function guestWasmSymbols(bytes) {
|
|
|
32882
32797
|
const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
32883
32798
|
let cur = 8;
|
|
32884
32799
|
const readU = () => {
|
|
32885
|
-
const
|
|
32886
|
-
|
|
32887
|
-
|
|
32888
|
-
let shift = 7;
|
|
32889
|
-
while (true) {
|
|
32890
|
-
const byte = bytes[cur++];
|
|
32891
|
-
res |= (byte & 127) << shift;
|
|
32892
|
-
if ((byte & 128) === 0) return res;
|
|
32893
|
-
shift += 7;
|
|
32894
|
-
}
|
|
32800
|
+
const [res, next] = readULEB(bytes, cur);
|
|
32801
|
+
cur = next;
|
|
32802
|
+
return res;
|
|
32895
32803
|
};
|
|
32896
32804
|
let importsDlsym = false;
|
|
32897
32805
|
const importFuncNames = [];
|
|
@@ -34032,7 +33940,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
34032
33940
|
if (!deadSpecialSegs.has(sIdx)) continue;
|
|
34033
33941
|
if (!isSpecialSegRelocLive(obj, obj.segNames[sIdx], data.rs[i])) continue;
|
|
34034
33942
|
const first = relocationBytes(data, i);
|
|
34035
|
-
const [, afterRoOff] =
|
|
33943
|
+
const [, afterRoOff] = readULEB(first, 1);
|
|
34036
33944
|
firstLiveInSpecialSeg.set(sIdx, {
|
|
34037
33945
|
rType: first[0],
|
|
34038
33946
|
afterRo: first.subarray(afterRoOff)
|
|
@@ -34062,7 +33970,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
34062
33970
|
zeroDataReloc(i);
|
|
34063
33971
|
} else {
|
|
34064
33972
|
const repl = firstLiveInSpecialSeg.get(segIdx);
|
|
34065
|
-
const roBytes =
|
|
33973
|
+
const roBytes = encodeWasmNumber(data.ro[i]);
|
|
34066
33974
|
const out = new Uint8Array(1 + roBytes.length + repl.afterRo.length);
|
|
34067
33975
|
out[0] = repl.rType;
|
|
34068
33976
|
out.set(roBytes, 1);
|
|
@@ -34101,34 +34009,34 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
34101
34009
|
while (pos < buf.length) {
|
|
34102
34010
|
const secStart = pos;
|
|
34103
34011
|
const id = buf[pos++];
|
|
34104
|
-
const [sz, p] =
|
|
34012
|
+
const [sz, p] = readULEB(buf, pos);
|
|
34105
34013
|
const end = p + sz;
|
|
34106
34014
|
if (id === 0) {
|
|
34107
|
-
const [nLen, np] =
|
|
34015
|
+
const [nLen, np] = readULEB(buf, p);
|
|
34108
34016
|
const name3 = rawBuf.toString("utf8", np, np + nLen);
|
|
34109
34017
|
const cp = np + nLen;
|
|
34110
34018
|
if (name3 === "linking") {
|
|
34111
|
-
const [, lpStart] =
|
|
34019
|
+
const [, lpStart] = readULEB(buf, cp);
|
|
34112
34020
|
const subChunks = [buf.subarray(p, lpStart)];
|
|
34113
34021
|
let lp = lpStart;
|
|
34114
34022
|
while (lp < end) {
|
|
34115
34023
|
const subStart = lp;
|
|
34116
34024
|
const subId = buf[lp++];
|
|
34117
|
-
const [subLen, sp] =
|
|
34025
|
+
const [subLen, sp] = readULEB(buf, lp);
|
|
34118
34026
|
const subEnd = sp + subLen;
|
|
34119
34027
|
if (subId === 5) {
|
|
34120
34028
|
const subCopy = new Uint8Array(buf.subarray(subStart, subEnd));
|
|
34121
|
-
let [cnt, cur] =
|
|
34029
|
+
let [cnt, cur] = readULEB(buf, sp);
|
|
34122
34030
|
for (let i = 0; i < cnt; i++) {
|
|
34123
|
-
const [sLen, s2] =
|
|
34031
|
+
const [sLen, s2] = readULEB(buf, cur);
|
|
34124
34032
|
const segName = obj.segNames[i];
|
|
34125
34033
|
const repl = RECORD_SEGS.get(segName);
|
|
34126
34034
|
const isSpecial = repl !== void 0;
|
|
34127
34035
|
if (deadSpecialSegs.has(i) && repl !== void 0)
|
|
34128
34036
|
subCopy.set(Buffer.from(repl, "utf8"), s2 - subStart);
|
|
34129
34037
|
cur = s2 + sLen;
|
|
34130
|
-
const [, s3] =
|
|
34131
|
-
const [segFl, s4] =
|
|
34038
|
+
const [, s3] = readULEB(buf, cur);
|
|
34039
|
+
const [segFl, s4] = readULEB(buf, s3);
|
|
34132
34040
|
const sFlLen = s4 - s3;
|
|
34133
34041
|
const keepRetain = isSpecial ? !deadSpecialSegs.has(i) : isRootSegName(segName) && !segName.startsWith(".init_array") && sLive[i] === 1;
|
|
34134
34042
|
const newSegFl = keepRetain ? segFl | 4 : segFl & ~4;
|
|
@@ -34142,12 +34050,12 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
34142
34050
|
}
|
|
34143
34051
|
subChunks.push(subCopy);
|
|
34144
34052
|
} else if (subId === 6) {
|
|
34145
|
-
let [cnt, cur] =
|
|
34053
|
+
let [cnt, cur] = readULEB(buf, sp);
|
|
34146
34054
|
const entrySlices = [];
|
|
34147
34055
|
for (let i = 0; i < cnt; i++) {
|
|
34148
34056
|
const eStart = cur;
|
|
34149
|
-
const [, s2] =
|
|
34150
|
-
const [symIdx, s3] =
|
|
34057
|
+
const [, s2] = readULEB(buf, cur);
|
|
34058
|
+
const [symIdx, s3] = readULEB(buf, s2);
|
|
34151
34059
|
cur = s3;
|
|
34152
34060
|
if (obj.symKind[symIdx] === 0 && obj.symElemIdx[symIdx] >= obj.numImportFuncs) {
|
|
34153
34061
|
if (fLive[obj.symElemIdx[symIdx] - obj.numImportFuncs] === 1) {
|
|
@@ -34158,19 +34066,19 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
34158
34066
|
}
|
|
34159
34067
|
}
|
|
34160
34068
|
if (entrySlices.length > 0) {
|
|
34161
|
-
const cntBytes = Uint8Array.from(
|
|
34069
|
+
const cntBytes = Uint8Array.from(encodeWasmNumber(entrySlices.length));
|
|
34162
34070
|
const bodyLen = cntBytes.length + entrySlices.reduce((a, b) => a + b.length, 0);
|
|
34163
|
-
const lenBytes = Uint8Array.from(
|
|
34071
|
+
const lenBytes = Uint8Array.from(encodeWasmNumber(bodyLen));
|
|
34164
34072
|
subChunks.push(Uint8Array.of(6), lenBytes, cntBytes);
|
|
34165
34073
|
for (const entry of entrySlices) subChunks.push(entry);
|
|
34166
34074
|
}
|
|
34167
34075
|
} else if (subId === 8) {
|
|
34168
34076
|
const subCopy = new Uint8Array(buf.subarray(subStart, subEnd));
|
|
34169
|
-
let [cnt, cur] =
|
|
34077
|
+
let [cnt, cur] = readULEB(buf, sp);
|
|
34170
34078
|
for (let i = 0; i < cnt; i++) {
|
|
34171
34079
|
const kind = buf[cur++];
|
|
34172
34080
|
const flOffset = cur - subStart;
|
|
34173
|
-
const [fl, c2] =
|
|
34081
|
+
const [fl, c2] = readULEB(buf, cur);
|
|
34174
34082
|
cur = c2;
|
|
34175
34083
|
const isUndef = (fl & 16) !== 0;
|
|
34176
34084
|
const isExplicitName = (fl & 64) !== 0;
|
|
@@ -34190,23 +34098,23 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
34190
34098
|
subCopy[flOffset + 1] = 0;
|
|
34191
34099
|
}
|
|
34192
34100
|
if (kind === 0 || kind === 2 || kind === 4 || kind === 5) {
|
|
34193
|
-
const [, c3] =
|
|
34101
|
+
const [, c3] = readULEB(buf, cur);
|
|
34194
34102
|
cur = c3;
|
|
34195
34103
|
if (!isUndef || isExplicitName) {
|
|
34196
|
-
const [sLen, c4] =
|
|
34104
|
+
const [sLen, c4] = readULEB(buf, cur);
|
|
34197
34105
|
cur = c4 + sLen;
|
|
34198
34106
|
}
|
|
34199
34107
|
} else if (kind === 1) {
|
|
34200
|
-
const [sLen, c3] =
|
|
34108
|
+
const [sLen, c3] = readULEB(buf, cur);
|
|
34201
34109
|
cur = c3 + sLen;
|
|
34202
34110
|
if (!isUndef) {
|
|
34203
|
-
const [, c4] =
|
|
34204
|
-
const [, c5] =
|
|
34205
|
-
const [, c6] =
|
|
34111
|
+
const [, c4] = readULEB(buf, cur);
|
|
34112
|
+
const [, c5] = readULEB(buf, c4);
|
|
34113
|
+
const [, c6] = readULEB(buf, c5);
|
|
34206
34114
|
cur = c6;
|
|
34207
34115
|
}
|
|
34208
34116
|
} else if (kind === 3) {
|
|
34209
|
-
const [, c3] =
|
|
34117
|
+
const [, c3] = readULEB(buf, cur);
|
|
34210
34118
|
cur = c3;
|
|
34211
34119
|
}
|
|
34212
34120
|
}
|
|
@@ -34217,29 +34125,29 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
34217
34125
|
lp = subEnd;
|
|
34218
34126
|
}
|
|
34219
34127
|
const totalSubLen = subChunks.reduce((a, b) => a + b.length, 0);
|
|
34220
|
-
outChunks.push(Uint8Array.of(0), Uint8Array.from(
|
|
34128
|
+
outChunks.push(Uint8Array.of(0), Uint8Array.from(encodeWasmNumber(totalSubLen)));
|
|
34221
34129
|
for (const chunk of subChunks) outChunks.push(chunk);
|
|
34222
34130
|
} else if (name3 === "reloc.CODE") {
|
|
34223
|
-
const [, r1] =
|
|
34131
|
+
const [, r1] = readULEB(buf, cp);
|
|
34224
34132
|
const headerSlice = buf.subarray(p, r1);
|
|
34225
|
-
const cntBytes = Uint8Array.from(
|
|
34133
|
+
const cntBytes = Uint8Array.from(encodeWasmNumber(keptCodeRelocs.length));
|
|
34226
34134
|
const relSlices = keptCodeRelocs.map((i) => relocationBytes(code, i));
|
|
34227
34135
|
const totalLen = headerSlice.length + cntBytes.length + relSlices.reduce((a, b) => a + b.length, 0);
|
|
34228
34136
|
outChunks.push(
|
|
34229
34137
|
Uint8Array.of(0),
|
|
34230
|
-
Uint8Array.from(
|
|
34138
|
+
Uint8Array.from(encodeWasmNumber(totalLen)),
|
|
34231
34139
|
headerSlice,
|
|
34232
34140
|
cntBytes
|
|
34233
34141
|
);
|
|
34234
34142
|
for (const relocation of relSlices) outChunks.push(relocation);
|
|
34235
34143
|
} else if (name3 === "reloc.DATA") {
|
|
34236
|
-
const [, r1] =
|
|
34144
|
+
const [, r1] = readULEB(buf, cp);
|
|
34237
34145
|
const headerSlice = buf.subarray(p, r1);
|
|
34238
|
-
const cntBytes = Uint8Array.from(
|
|
34146
|
+
const cntBytes = Uint8Array.from(encodeWasmNumber(keptDataRelocBytes.length));
|
|
34239
34147
|
const totalLen = headerSlice.length + cntBytes.length + keptDataRelocBytes.reduce((a, b) => a + b.length, 0);
|
|
34240
34148
|
outChunks.push(
|
|
34241
34149
|
Uint8Array.of(0),
|
|
34242
|
-
Uint8Array.from(
|
|
34150
|
+
Uint8Array.from(encodeWasmNumber(totalLen)),
|
|
34243
34151
|
headerSlice,
|
|
34244
34152
|
cntBytes
|
|
34245
34153
|
);
|
|
@@ -34249,15 +34157,15 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
34249
34157
|
const nameBytes = buf.subarray(p, cp);
|
|
34250
34158
|
outChunks.push(
|
|
34251
34159
|
Uint8Array.of(0),
|
|
34252
|
-
Uint8Array.from(
|
|
34160
|
+
Uint8Array.from(encodeWasmNumber(nameBytes.length)),
|
|
34253
34161
|
nameBytes
|
|
34254
34162
|
);
|
|
34255
34163
|
} else if (name3.startsWith("reloc..debug_")) {
|
|
34256
|
-
const [, r1] =
|
|
34164
|
+
const [, r1] = readULEB(buf, cp);
|
|
34257
34165
|
const headerSlice = buf.subarray(p, r1);
|
|
34258
34166
|
outChunks.push(
|
|
34259
34167
|
Uint8Array.of(0),
|
|
34260
|
-
Uint8Array.from(
|
|
34168
|
+
Uint8Array.from(encodeWasmNumber(headerSlice.length + 1)),
|
|
34261
34169
|
headerSlice,
|
|
34262
34170
|
Uint8Array.of(0)
|
|
34263
34171
|
);
|
|
@@ -34387,6 +34295,7 @@ var init_swift_wasm_prune = __esm({
|
|
|
34387
34295
|
init_swift_toolchain();
|
|
34388
34296
|
init_swift_wasm_archive();
|
|
34389
34297
|
init_swiftRuntimeProductContract();
|
|
34298
|
+
init_wasm_binary_sections();
|
|
34390
34299
|
WIDE_DATA_RELOCS = /* @__PURE__ */ new Set([16, 19, 22, 27]);
|
|
34391
34300
|
ROOT_SEG_PREFIXES = [
|
|
34392
34301
|
".init_array",
|
|
@@ -34680,34 +34589,11 @@ var init_nativeWasmContract = __esm({
|
|
|
34680
34589
|
});
|
|
34681
34590
|
|
|
34682
34591
|
// src/swift-guest-image-ledger.ts
|
|
34683
|
-
function readNumber(bytes, position) {
|
|
34684
|
-
if (position < bytes.length) {
|
|
34685
|
-
const first = bytes[position];
|
|
34686
|
-
if (first < 128) return [first, position + 1];
|
|
34687
|
-
}
|
|
34688
|
-
let value = 0;
|
|
34689
|
-
let shift = 0;
|
|
34690
|
-
for (; ; ) {
|
|
34691
|
-
if (position >= bytes.length || shift > 63) throw new Error("invalid wasm integer");
|
|
34692
|
-
const byte = bytes[position++];
|
|
34693
|
-
value += (byte & 127) * 2 ** shift;
|
|
34694
|
-
if (!(byte & 128)) return [value, position];
|
|
34695
|
-
shift += 7;
|
|
34696
|
-
}
|
|
34697
|
-
}
|
|
34698
34592
|
function encodeNumber(value) {
|
|
34699
|
-
|
|
34700
|
-
const bytes = [];
|
|
34701
|
-
do {
|
|
34702
|
-
let byte = value % 128;
|
|
34703
|
-
value = Math.floor(value / 128);
|
|
34704
|
-
if (value) byte |= 128;
|
|
34705
|
-
bytes.push(byte);
|
|
34706
|
-
} while (value);
|
|
34707
|
-
return Buffer.from(bytes);
|
|
34593
|
+
return Buffer.from(encodeWasmNumber(value));
|
|
34708
34594
|
}
|
|
34709
34595
|
function readString(bytes, position) {
|
|
34710
|
-
const [length, start] =
|
|
34596
|
+
const [length, start] = readULEB(bytes, position);
|
|
34711
34597
|
if (start + length > bytes.length) throw new Error("invalid wasm string");
|
|
34712
34598
|
return [
|
|
34713
34599
|
Buffer.from(bytes.buffer, bytes.byteOffset + start, length).toString("utf8"),
|
|
@@ -35033,13 +34919,13 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
35033
34919
|
for (const subsection of subsections) {
|
|
35034
34920
|
if (subsection.kind === 6 && objcLoader !== void 0) {
|
|
35035
34921
|
const content = subsection.parts[0];
|
|
35036
|
-
const [count, entriesStart] =
|
|
34922
|
+
const [count, entriesStart] = readULEB(content, 0);
|
|
35037
34923
|
const initWriter = new ByteWriter(content.length + 16);
|
|
35038
34924
|
initWriter.bytes(content, 0, entriesStart);
|
|
35039
34925
|
let entryStart = entriesStart;
|
|
35040
34926
|
for (let i = 0; i < count; i++) {
|
|
35041
|
-
const [, symbolStart] =
|
|
35042
|
-
const [symbol2, entryEnd] =
|
|
34927
|
+
const [, symbolStart] = readULEB(content, entryStart);
|
|
34928
|
+
const [symbol2, entryEnd] = readULEB(content, symbolStart);
|
|
35043
34929
|
if (symbol2 === objcLoader) {
|
|
35044
34930
|
initWriter.uleb(1);
|
|
35045
34931
|
initWriter.bytes(content, symbolStart, entryEnd);
|
|
@@ -35109,7 +34995,7 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
35109
34995
|
if (position < bytes.length && bytes[position] < 128) {
|
|
35110
34996
|
size2 = bytes[position++];
|
|
35111
34997
|
} else {
|
|
35112
|
-
const [val, next] =
|
|
34998
|
+
const [val, next] = readULEB(bytes, position);
|
|
35113
34999
|
size2 = val;
|
|
35114
35000
|
position = next;
|
|
35115
35001
|
}
|
|
@@ -35865,7 +35751,7 @@ function nameGuestImageAliases(wasm, symbols) {
|
|
|
35865
35751
|
const parts2 = [wasm.subarray(0, 8)];
|
|
35866
35752
|
let position = 8;
|
|
35867
35753
|
while (position < wasm.length) {
|
|
35868
|
-
const [size2, start] =
|
|
35754
|
+
const [size2, start] = readULEB(wasm, position + 1);
|
|
35869
35755
|
const end = start + size2;
|
|
35870
35756
|
const custom = wasm[position] === 0 ? readString(wasm, start) : void 0;
|
|
35871
35757
|
if (custom?.[0] !== "name") {
|
|
@@ -35876,17 +35762,17 @@ function nameGuestImageAliases(wasm, symbols) {
|
|
|
35876
35762
|
const subsections = [encodedString("name")];
|
|
35877
35763
|
let at = custom[1];
|
|
35878
35764
|
while (at < end) {
|
|
35879
|
-
const [subSize, subStart] =
|
|
35765
|
+
const [subSize, subStart] = readULEB(wasm, at + 1);
|
|
35880
35766
|
const subEnd = subStart + subSize;
|
|
35881
35767
|
if (wasm[at] !== 1) {
|
|
35882
35768
|
subsections.push(wasm.subarray(at, subEnd));
|
|
35883
35769
|
at = subEnd;
|
|
35884
35770
|
continue;
|
|
35885
35771
|
}
|
|
35886
|
-
let [count, cursor] =
|
|
35772
|
+
let [count, cursor] = readULEB(wasm, subStart);
|
|
35887
35773
|
const entries2 = [encodeNumber(count)];
|
|
35888
35774
|
for (; count > 0; count--) {
|
|
35889
|
-
const [index, next] =
|
|
35775
|
+
const [index, next] = readULEB(wasm, cursor);
|
|
35890
35776
|
const [name3, after] = readString(wasm, next);
|
|
35891
35777
|
cursor = after;
|
|
35892
35778
|
const symbol2 = symbols[Number(alias.exec(name3)?.[1] ?? -1)];
|
|
@@ -35910,6 +35796,7 @@ var init_swift_guest_image_ledger = __esm({
|
|
|
35910
35796
|
init_nativeWasmContract();
|
|
35911
35797
|
init_swift_sdk_image_wasm();
|
|
35912
35798
|
init_swiftSdkLinkContract();
|
|
35799
|
+
init_wasm_binary_sections();
|
|
35913
35800
|
ByteWriter = class {
|
|
35914
35801
|
buf;
|
|
35915
35802
|
pos = 0;
|
|
@@ -35930,16 +35817,13 @@ var init_swift_guest_image_ledger = __esm({
|
|
|
35930
35817
|
this.buf[this.pos++] = value;
|
|
35931
35818
|
}
|
|
35932
35819
|
uleb(value) {
|
|
35933
|
-
|
|
35934
|
-
|
|
35935
|
-
|
|
35936
|
-
|
|
35937
|
-
|
|
35938
|
-
|
|
35939
|
-
|
|
35940
|
-
buf[pos++] = byte;
|
|
35941
|
-
} while (value);
|
|
35942
|
-
this.pos = pos;
|
|
35820
|
+
if (value < 128) {
|
|
35821
|
+
this.byte(value);
|
|
35822
|
+
return;
|
|
35823
|
+
}
|
|
35824
|
+
const encoded = encodeWasmNumber(value);
|
|
35825
|
+
this.ensure(encoded.length);
|
|
35826
|
+
for (let i = 0; i < encoded.length; i++) this.buf[this.pos++] = encoded[i];
|
|
35943
35827
|
}
|
|
35944
35828
|
bytes(source, start = 0, end = source.length) {
|
|
35945
35829
|
const len = end - start;
|
|
@@ -36457,13 +36341,6 @@ function sha256Buffer(bytes) {
|
|
|
36457
36341
|
return Buffer.from(new Bun.CryptoHasher("sha256").update(bytes).digest());
|
|
36458
36342
|
return (0, import_node_crypto34.createHash)("sha256").update(bytes).digest();
|
|
36459
36343
|
}
|
|
36460
|
-
function uleb2(value) {
|
|
36461
|
-
const bytes = [];
|
|
36462
|
-
for (let rest = value; ; rest = Math.floor(rest / 128)) {
|
|
36463
|
-
if (rest < 128) return [...bytes, rest];
|
|
36464
|
-
bytes.push(rest % 128 | 128);
|
|
36465
|
-
}
|
|
36466
|
-
}
|
|
36467
36344
|
function encodeGuestDyldTable(rows) {
|
|
36468
36345
|
const encoded = rows.map((row) => ({ ...row, bytes: Buffer.from(row.name) })).sort((a, b) => Buffer.compare(a.bytes, b.bytes));
|
|
36469
36346
|
const packs = [];
|
|
@@ -36476,7 +36353,7 @@ function encodeGuestDyldTable(rows) {
|
|
|
36476
36353
|
value.writeBigUInt64LE(row.value);
|
|
36477
36354
|
const bytes = Buffer.concat([
|
|
36478
36355
|
row.bytes,
|
|
36479
|
-
Buffer.from([0, ...
|
|
36356
|
+
Buffer.from([0, ...encodeWasmNumber(row.image), row.kind]),
|
|
36480
36357
|
value
|
|
36481
36358
|
]);
|
|
36482
36359
|
if (!current2.length) firsts.push(row.bytes);
|
|
@@ -36568,6 +36445,7 @@ var init_swift_guest_dyld_table = __esm({
|
|
|
36568
36445
|
init_sha256();
|
|
36569
36446
|
init_swift_guest_image_ledger();
|
|
36570
36447
|
init_swift_guest_linked_spans();
|
|
36448
|
+
init_wasm_binary_sections();
|
|
36571
36449
|
init_wasm_narrow_boundary();
|
|
36572
36450
|
PACK_BYTES = 64 * 1024;
|
|
36573
36451
|
}
|
|
@@ -36662,8 +36540,8 @@ function primaryFunctionTable(bytes) {
|
|
|
36662
36540
|
return { name: wasmReader(exported, 0).name(), table64 };
|
|
36663
36541
|
}
|
|
36664
36542
|
function vectorSection(id, count, parts2) {
|
|
36665
|
-
const body = Buffer.concat([Buffer.from(
|
|
36666
|
-
return Buffer.concat([Buffer.from([id, ...
|
|
36543
|
+
const body = Buffer.concat([Buffer.from(encodeWasmNumber(count)), ...parts2]);
|
|
36544
|
+
return Buffer.concat([Buffer.from([id, ...encodeWasmNumber(body.length)]), body]);
|
|
36667
36545
|
}
|
|
36668
36546
|
function rewriteSections(bytes, sections, changes) {
|
|
36669
36547
|
const out = [bytes.subarray(0, 8)];
|
|
@@ -36719,9 +36597,9 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
36719
36597
|
vectorSection(2, count + 1, [
|
|
36720
36598
|
found2 && header ? bytes.subarray(header.at, found2.end) : new Uint8Array(),
|
|
36721
36599
|
Buffer.from([
|
|
36722
|
-
...
|
|
36600
|
+
...encodeWasmNumber(module2.length),
|
|
36723
36601
|
...module2,
|
|
36724
|
-
...
|
|
36602
|
+
...encodeWasmNumber(name4.length),
|
|
36725
36603
|
...name4,
|
|
36726
36604
|
1,
|
|
36727
36605
|
112,
|
|
@@ -36743,7 +36621,7 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
36743
36621
|
elements.splice(
|
|
36744
36622
|
placementIndex,
|
|
36745
36623
|
0,
|
|
36746
|
-
Buffer.from([1, 0, ...
|
|
36624
|
+
Buffer.from([1, 0, ...encodeWasmNumber(functions.length), ...functions.flatMap(encodeWasmNumber)])
|
|
36747
36625
|
);
|
|
36748
36626
|
const place2 = imports2.functions + declared.length;
|
|
36749
36627
|
const instructions = [
|
|
@@ -36757,7 +36635,7 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
36757
36635
|
1,
|
|
36758
36636
|
252,
|
|
36759
36637
|
12,
|
|
36760
|
-
...
|
|
36638
|
+
...encodeWasmNumber(placementIndex),
|
|
36761
36639
|
0,
|
|
36762
36640
|
11
|
|
36763
36641
|
];
|
|
@@ -36778,14 +36656,14 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
36778
36656
|
3,
|
|
36779
36657
|
vectorSection(3, declared.length + 1, [
|
|
36780
36658
|
...declared,
|
|
36781
|
-
Buffer.from(
|
|
36659
|
+
Buffer.from(encodeWasmNumber(types2.length))
|
|
36782
36660
|
])
|
|
36783
36661
|
],
|
|
36784
36662
|
[
|
|
36785
36663
|
7,
|
|
36786
36664
|
vectorSection(7, exports2.length + 1, [
|
|
36787
36665
|
...exports2,
|
|
36788
|
-
Buffer.from([...
|
|
36666
|
+
Buffer.from([...encodeWasmNumber(name3.length), ...name3, 0, ...encodeWasmNumber(place2)])
|
|
36789
36667
|
])
|
|
36790
36668
|
],
|
|
36791
36669
|
[9, vectorSection(9, elements.length, elements)],
|
|
@@ -36793,7 +36671,7 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
36793
36671
|
10,
|
|
36794
36672
|
vectorSection(10, bodies.length + 1, [
|
|
36795
36673
|
...bodies,
|
|
36796
|
-
Buffer.from([...
|
|
36674
|
+
Buffer.from([...encodeWasmNumber(instructions.length), ...instructions])
|
|
36797
36675
|
])
|
|
36798
36676
|
]
|
|
36799
36677
|
])
|
|
@@ -36915,40 +36793,31 @@ function nameLazyFunctions(bytes, functions) {
|
|
|
36915
36793
|
for (const index of functions) {
|
|
36916
36794
|
if (names.has(index)) continue;
|
|
36917
36795
|
const name3 = Buffer.from(String(index - imported));
|
|
36918
|
-
names.set(index, Buffer.from([...
|
|
36796
|
+
names.set(index, Buffer.from([...encodeWasmNumber(name3.length), ...name3]));
|
|
36919
36797
|
}
|
|
36920
36798
|
const ordered = [...names].sort(([a], [b]) => a - b);
|
|
36921
36799
|
const functionNames = Buffer.concat([
|
|
36922
|
-
Buffer.from(
|
|
36923
|
-
...ordered.flatMap(([index, name3]) => [Buffer.from(
|
|
36800
|
+
Buffer.from(encodeWasmNumber(ordered.length)),
|
|
36801
|
+
...ordered.flatMap(([index, name3]) => [Buffer.from(encodeWasmNumber(index)), name3])
|
|
36924
36802
|
]);
|
|
36925
|
-
const content = [...subsections, { id: 1, body: functionNames }].sort((a, b) => a.id - b.id).flatMap(({ id, body }) => [Buffer.from([id, ...
|
|
36803
|
+
const content = [...subsections, { id: 1, body: functionNames }].sort((a, b) => a.id - b.id).flatMap(({ id, body }) => [Buffer.from([id, ...encodeWasmNumber(body.length)]), body]);
|
|
36926
36804
|
const label = Buffer.from("name");
|
|
36927
36805
|
const payload = Buffer.concat([
|
|
36928
|
-
Buffer.from([...
|
|
36806
|
+
Buffer.from([...encodeWasmNumber(label.length), ...label]),
|
|
36929
36807
|
...content
|
|
36930
36808
|
]);
|
|
36931
36809
|
const out = [bytes.subarray(0, 8)];
|
|
36932
36810
|
for (const s of sections) if (s !== custom) out.push(bytes.subarray(s.offset, s.end));
|
|
36933
|
-
out.push(Buffer.from([0, ...
|
|
36811
|
+
out.push(Buffer.from([0, ...encodeWasmNumber(payload.length)]), payload);
|
|
36934
36812
|
return Buffer.concat(out);
|
|
36935
36813
|
}
|
|
36936
|
-
var
|
|
36814
|
+
var SECTION_ORDER, readExport, lastTableElement, exportName;
|
|
36937
36815
|
var init_swift_guest_dyld_functions = __esm({
|
|
36938
36816
|
"src/swift-guest-dyld-functions.ts"() {
|
|
36939
36817
|
"use strict";
|
|
36940
36818
|
init_nativeWasmContract();
|
|
36941
36819
|
init_swift_sdk_image_wasm();
|
|
36942
|
-
|
|
36943
|
-
const out = [];
|
|
36944
|
-
do {
|
|
36945
|
-
let byte = value % 128;
|
|
36946
|
-
value = Math.floor(value / 128);
|
|
36947
|
-
if (value) byte |= 128;
|
|
36948
|
-
out.push(byte);
|
|
36949
|
-
} while (value);
|
|
36950
|
-
return out;
|
|
36951
|
-
};
|
|
36820
|
+
init_wasm_binary_sections();
|
|
36952
36821
|
SECTION_ORDER = [1, 2, 3, 4, 5, 13, 6, 7, 8, 9, 12, 10, 11];
|
|
36953
36822
|
readExport = (r) => {
|
|
36954
36823
|
r.name();
|
|
@@ -40274,30 +40143,12 @@ function wasmAutolinkEntries(bytes, out) {
|
|
|
40274
40143
|
const len = bytes.length;
|
|
40275
40144
|
while (pos < len) {
|
|
40276
40145
|
const id = bytes[pos++];
|
|
40277
|
-
let sz
|
|
40278
|
-
|
|
40279
|
-
sz &= 127;
|
|
40280
|
-
let shift = 7;
|
|
40281
|
-
while (true) {
|
|
40282
|
-
const b = bytes[pos++];
|
|
40283
|
-
sz |= (b & 127) << shift;
|
|
40284
|
-
if (b < 128) break;
|
|
40285
|
-
shift += 7;
|
|
40286
|
-
}
|
|
40287
|
-
}
|
|
40146
|
+
let sz;
|
|
40147
|
+
[sz, pos] = readULEB(bytes, pos, len);
|
|
40288
40148
|
const end = pos + sz;
|
|
40289
40149
|
if (id === 0) {
|
|
40290
|
-
let nLen
|
|
40291
|
-
|
|
40292
|
-
nLen &= 127;
|
|
40293
|
-
let shift = 7;
|
|
40294
|
-
while (true) {
|
|
40295
|
-
const b = bytes[pos++];
|
|
40296
|
-
nLen |= (b & 127) << shift;
|
|
40297
|
-
if (b < 128) break;
|
|
40298
|
-
shift += 7;
|
|
40299
|
-
}
|
|
40300
|
-
}
|
|
40150
|
+
let nLen;
|
|
40151
|
+
[nLen, pos] = readULEB(bytes, pos, end);
|
|
40301
40152
|
if (nLen === 24 && raw2.toString("ascii", pos, pos + 24) === ".swift1_autolink_entries") {
|
|
40302
40153
|
const payload = raw2.toString("utf8", pos + 24, end);
|
|
40303
40154
|
for (const entry of payload.split("\0")) {
|
|
@@ -40534,6 +40385,7 @@ var init_swift_guest_source_inputs = __esm({
|
|
|
40534
40385
|
init_swift_guest_source_plan();
|
|
40535
40386
|
init_swift_runtime_products();
|
|
40536
40387
|
init_swift_wasm_prune();
|
|
40388
|
+
init_wasm_binary_sections();
|
|
40537
40389
|
CLANG_TARGET_MODULE_WRAPPER = ".peach-clang";
|
|
40538
40390
|
PARALLEL_REPLAY = `
|
|
40539
40391
|
const { spawn } = require('node:child_process')
|
|
@@ -46585,8 +46437,8 @@ function finishSwiftAppModuleFile(file) {
|
|
|
46585
46437
|
return;
|
|
46586
46438
|
}
|
|
46587
46439
|
const thunks = sdkImportThunks(prefix);
|
|
46588
|
-
const nameBytes = Buffer.from(
|
|
46589
|
-
const header = Buffer.from([0, ...
|
|
46440
|
+
const nameBytes = Buffer.from(encodeWasmName(NATIVE_SDK_THUNK_SECTION));
|
|
46441
|
+
const header = Buffer.from([0, ...encodeWasmNumber(nameBytes.length + thunks.length)]);
|
|
46590
46442
|
(0, import_node_fs74.appendFileSync)(file, Buffer.concat([header, nameBytes, thunks]));
|
|
46591
46443
|
}
|
|
46592
46444
|
function swiftAppModuleInputs(tokens3, buildRoot, sdkLibraries) {
|
|
@@ -46938,17 +46790,17 @@ function sdkImportThunks(bytes) {
|
|
|
46938
46790
|
for (const { type } of imports2)
|
|
46939
46791
|
if (!typeIndex.has(type)) typeIndex.set(type, typeIndex.size + 1);
|
|
46940
46792
|
const loaderType = [96, 1, 127, 0];
|
|
46941
|
-
const vector = (items2) => [...
|
|
46942
|
-
const sectionBytes = (id, body) => [id, ...
|
|
46793
|
+
const vector = (items2) => [...encodeWasmNumber(items2.length), ...items2.flat()];
|
|
46794
|
+
const sectionBytes = (id, body) => [id, ...encodeWasmNumber(body.length), ...body];
|
|
46943
46795
|
const slotGlobals = imports2.map(({ slot }) => [
|
|
46944
|
-
...
|
|
46945
|
-
...
|
|
46796
|
+
...encodeWasmName(NATIVE_SDK_IMPORT_MODULE),
|
|
46797
|
+
...encodeWasmName(String(slot)),
|
|
46946
46798
|
3,
|
|
46947
46799
|
127,
|
|
46948
46800
|
0
|
|
46949
46801
|
]);
|
|
46950
46802
|
const bodies = imports2.map(({ type }, index) => {
|
|
46951
|
-
const slotValue = [35, ...
|
|
46803
|
+
const slotValue = [35, ...encodeWasmNumber(index)];
|
|
46952
46804
|
const code = [
|
|
46953
46805
|
0,
|
|
46954
46806
|
...slotValue,
|
|
@@ -46961,14 +46813,14 @@ function sdkImportThunks(bytes) {
|
|
|
46961
46813
|
16,
|
|
46962
46814
|
0,
|
|
46963
46815
|
11,
|
|
46964
|
-
...Array.from({ length: params[type] }, (_, i) => [32, ...
|
|
46816
|
+
...Array.from({ length: params[type] }, (_, i) => [32, ...encodeWasmNumber(i)]).flat(),
|
|
46965
46817
|
...slotValue,
|
|
46966
46818
|
17,
|
|
46967
|
-
...
|
|
46819
|
+
...encodeWasmNumber(typeIndex.get(type)),
|
|
46968
46820
|
0,
|
|
46969
46821
|
11
|
|
46970
46822
|
];
|
|
46971
|
-
return [...
|
|
46823
|
+
return [...encodeWasmNumber(code.length), ...code];
|
|
46972
46824
|
});
|
|
46973
46825
|
return Uint8Array.from([
|
|
46974
46826
|
0,
|
|
@@ -46986,21 +46838,21 @@ function sdkImportThunks(bytes) {
|
|
|
46986
46838
|
...sectionBytes(
|
|
46987
46839
|
2,
|
|
46988
46840
|
vector([
|
|
46989
|
-
[...
|
|
46841
|
+
[...encodeWasmName("env"), ...encodeWasmName("__indirect_function_table"), 1, ...table],
|
|
46990
46842
|
[
|
|
46991
|
-
...
|
|
46992
|
-
...
|
|
46843
|
+
...encodeWasmName(NATIVE_LAZY_IMPORT_MODULE),
|
|
46844
|
+
...encodeWasmName(NATIVE_LAZY_SLOT_IMPORT),
|
|
46993
46845
|
0,
|
|
46994
46846
|
0
|
|
46995
46847
|
],
|
|
46996
46848
|
...slotGlobals
|
|
46997
46849
|
])
|
|
46998
46850
|
),
|
|
46999
|
-
...sectionBytes(3, vector(imports2.map(({ type }) =>
|
|
46851
|
+
...sectionBytes(3, vector(imports2.map(({ type }) => encodeWasmNumber(typeIndex.get(type))))),
|
|
47000
46852
|
...sectionBytes(
|
|
47001
46853
|
7,
|
|
47002
46854
|
vector(
|
|
47003
|
-
imports2.map(({ slot }, i) => [...
|
|
46855
|
+
imports2.map(({ slot }, i) => [...encodeWasmName(String(slot)), 0, ...encodeWasmNumber(i + 1)])
|
|
47004
46856
|
)
|
|
47005
46857
|
),
|
|
47006
46858
|
...sectionBytes(10, vector(bodies))
|
|
@@ -47120,7 +46972,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
47120
46972
|
syntheticGlobals.push(type);
|
|
47121
46973
|
got.set(index, value);
|
|
47122
46974
|
}
|
|
47123
|
-
return [35, ...
|
|
46975
|
+
return [35, ...encodeWasmNumber(index)];
|
|
47124
46976
|
};
|
|
47125
46977
|
const tlsHelpers = new Map(
|
|
47126
46978
|
symbols.filter((symbol2) => symbol2.kind === 0 && symbol2.name.startsWith(SDK_TLS_HELPER)).map((symbol2) => [symbol2.name.slice(SDK_TLS_HELPER.length), symbol2.index])
|
|
@@ -47172,7 +47024,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
47172
47024
|
const code = [16];
|
|
47173
47025
|
for (let i = 0, rest = helper; i < 5; i++, rest >>>= 7)
|
|
47174
47026
|
code.push(i < 4 ? rest & 127 | 128 : rest & 127);
|
|
47175
|
-
if (addend) code.push(66, ...
|
|
47027
|
+
if (addend) code.push(66, ...encodeWasmSigned(addend), 124);
|
|
47176
47028
|
patchCode(at2, 11, code);
|
|
47177
47029
|
continue;
|
|
47178
47030
|
}
|
|
@@ -47246,7 +47098,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
47246
47098
|
syntheticGlobals.push(valueType);
|
|
47247
47099
|
scratchGlobals.set(valueType, scratch2);
|
|
47248
47100
|
}
|
|
47249
|
-
const index =
|
|
47101
|
+
const index = encodeWasmNumber(scratch2);
|
|
47250
47102
|
patchCode(at - 2, 12, [
|
|
47251
47103
|
36,
|
|
47252
47104
|
...index,
|
|
@@ -47262,7 +47114,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
47262
47114
|
}
|
|
47263
47115
|
const encodedNameBuf = (name3) => {
|
|
47264
47116
|
const raw2 = Buffer.from(name3, "utf8");
|
|
47265
|
-
const len =
|
|
47117
|
+
const len = encodeWasmNumber(raw2.length);
|
|
47266
47118
|
const out = Buffer.allocUnsafe(len.length + raw2.length);
|
|
47267
47119
|
for (let i = 0; i < len.length; i++) out[i] = len[i];
|
|
47268
47120
|
raw2.copy(out, len.length);
|
|
@@ -47307,7 +47159,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
47307
47159
|
}
|
|
47308
47160
|
}
|
|
47309
47161
|
const globalParts = [
|
|
47310
|
-
Buffer.from(
|
|
47162
|
+
Buffer.from(encodeWasmNumber(globalCount - 1 + syntheticGlobals.length))
|
|
47311
47163
|
];
|
|
47312
47164
|
for (let index = 0; index < globalCount; index++) {
|
|
47313
47165
|
const start = gr.at;
|
|
@@ -47352,18 +47204,18 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
47352
47204
|
}
|
|
47353
47205
|
}
|
|
47354
47206
|
const exportParts = [
|
|
47355
|
-
Buffer.from(
|
|
47207
|
+
Buffer.from(encodeWasmNumber(exportCount + 1 + got.size)),
|
|
47356
47208
|
bytes.subarray(originalExportsStart, exportSection.end)
|
|
47357
47209
|
];
|
|
47358
47210
|
for (const [index, value] of got) {
|
|
47359
47211
|
exportParts.push(
|
|
47360
47212
|
encodedNameBuf(`${NATIVE_SDK_GLOBAL_PREFIX}${value}.${index}`),
|
|
47361
|
-
Buffer.from([3, ...
|
|
47213
|
+
Buffer.from([3, ...encodeWasmNumber(index)])
|
|
47362
47214
|
);
|
|
47363
47215
|
}
|
|
47364
47216
|
exportParts.push(encodedNameBuf("__indirect_function_table"), Buffer.from([1, 0]));
|
|
47365
47217
|
const replaced = /* @__PURE__ */ new Map([
|
|
47366
|
-
[2, Buffer.concat([Buffer.from(
|
|
47218
|
+
[2, Buffer.concat([Buffer.from(encodeWasmNumber(importEntryCount)), ...importParts])],
|
|
47367
47219
|
[6, Buffer.concat(globalParts)],
|
|
47368
47220
|
[7, Buffer.concat(exportParts)]
|
|
47369
47221
|
]);
|
|
@@ -47380,7 +47232,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
47380
47232
|
if (s.id === 10 && rebuiltCode) {
|
|
47381
47233
|
parts2.push(rebuiltCode);
|
|
47382
47234
|
} else if (payload) {
|
|
47383
|
-
parts2.push(Buffer.from([s.id, ...
|
|
47235
|
+
parts2.push(Buffer.from([s.id, ...encodeWasmNumber(payload.length)]), payload);
|
|
47384
47236
|
} else {
|
|
47385
47237
|
parts2.push(bytes.subarray(s.offset, s.end));
|
|
47386
47238
|
}
|
|
@@ -47396,7 +47248,7 @@ function expandSdkRelocations(bytes, section2, patches) {
|
|
|
47396
47248
|
patches.sort((a, b) => a.at - b.at);
|
|
47397
47249
|
const r = wasmReader(bytes, section2.start);
|
|
47398
47250
|
const count = r.u();
|
|
47399
|
-
const payload = [Uint8Array.from(
|
|
47251
|
+
const payload = [Uint8Array.from(encodeWasmNumber(count))];
|
|
47400
47252
|
let next = 0;
|
|
47401
47253
|
for (let i = 0; i < count; i++) {
|
|
47402
47254
|
const start = r.at;
|
|
@@ -47416,7 +47268,7 @@ function expandSdkRelocations(bytes, section2, patches) {
|
|
|
47416
47268
|
}
|
|
47417
47269
|
parts2.push(bytes.subarray(at, end));
|
|
47418
47270
|
payload.push(
|
|
47419
|
-
Uint8Array.from(
|
|
47271
|
+
Uint8Array.from(encodeWasmNumber(parts2.reduce((size3, part) => size3 + part.length, 0))),
|
|
47420
47272
|
...parts2
|
|
47421
47273
|
);
|
|
47422
47274
|
}
|
|
@@ -47425,7 +47277,7 @@ function expandSdkRelocations(bytes, section2, patches) {
|
|
|
47425
47277
|
if (next !== patches.length || r.at !== section2.end)
|
|
47426
47278
|
throw new Error("Swift SDK code relocations exceed the code section");
|
|
47427
47279
|
return Buffer.concat([
|
|
47428
|
-
Uint8Array.from([10, ...
|
|
47280
|
+
Uint8Array.from([10, ...encodeWasmNumber(payload.reduce((size2, part) => size2 + part.length, 0))]),
|
|
47429
47281
|
...payload
|
|
47430
47282
|
]);
|
|
47431
47283
|
}
|
|
@@ -48117,7 +47969,7 @@ function partitionParent(section2) {
|
|
|
48117
47969
|
"__objc_class_refs"
|
|
48118
47970
|
].find((name3) => section2 === name3 || section2.startsWith(`${name3}.`));
|
|
48119
47971
|
}
|
|
48120
|
-
var import_node_child_process38, import_node_crypto45, import_node_fs74, import_node_path74, import_node_util11, import_node_zlib5, run5, RELOCATION_WIDTHS, GLOBAL_INDEX, TLS_SLEB64, SDK_TLS_HELPER, SDK_TLS_DELTA, OBJC_SECTION_BOUNDARY,
|
|
47972
|
+
var import_node_child_process38, import_node_crypto45, import_node_fs74, import_node_path74, import_node_util11, import_node_zlib5, run5, RELOCATION_WIDTHS, GLOBAL_INDEX, TLS_SLEB64, SDK_TLS_HELPER, SDK_TLS_DELTA, OBJC_SECTION_BOUNDARY, SCANNED, RUN_GAP;
|
|
48121
47973
|
var init_swift_sdk_app_module = __esm({
|
|
48122
47974
|
"src/swift-sdk-app-module.ts"() {
|
|
48123
47975
|
"use strict";
|
|
@@ -48140,6 +47992,7 @@ var init_swift_sdk_app_module = __esm({
|
|
|
48140
47992
|
init_swift_wasm_prune();
|
|
48141
47993
|
init_swiftSdkLinkContract();
|
|
48142
47994
|
init_swiftTargetContract();
|
|
47995
|
+
init_wasm_binary_sections();
|
|
48143
47996
|
init_wasm_narrow_boundary();
|
|
48144
47997
|
init_wasm_optimize();
|
|
48145
47998
|
run5 = (0, import_node_util11.promisify)(import_node_child_process38.execFile);
|
|
@@ -48160,32 +48013,6 @@ var init_swift_sdk_app_module = __esm({
|
|
|
48160
48013
|
SDK_TLS_HELPER = "__peach_sdk_tls.";
|
|
48161
48014
|
SDK_TLS_DELTA = "__peach_sdk_tls_delta.";
|
|
48162
48015
|
OBJC_SECTION_BOUNDARY = /^__(?:start|stop)_(__objc_(?:selectors|classes|class_refs|cats|protocols|protocol_refs|class_aliases|constant_string))$/;
|
|
48163
|
-
uleb4 = (value) => {
|
|
48164
|
-
const out = [];
|
|
48165
|
-
do {
|
|
48166
|
-
let byte = value % 128;
|
|
48167
|
-
value = Math.floor(value / 128);
|
|
48168
|
-
if (value) byte |= 128;
|
|
48169
|
-
out.push(byte);
|
|
48170
|
-
} while (value);
|
|
48171
|
-
return out;
|
|
48172
|
-
};
|
|
48173
|
-
sleb2 = (value) => {
|
|
48174
|
-
const out = [];
|
|
48175
|
-
for (; ; ) {
|
|
48176
|
-
const byte = Number(value & 127n);
|
|
48177
|
-
value >>= 7n;
|
|
48178
|
-
if (value === 0n && !(byte & 64) || value === -1n && byte & 64) {
|
|
48179
|
-
out.push(byte);
|
|
48180
|
-
return out;
|
|
48181
|
-
}
|
|
48182
|
-
out.push(byte | 128);
|
|
48183
|
-
}
|
|
48184
|
-
};
|
|
48185
|
-
encodedName2 = (name3) => {
|
|
48186
|
-
const bytes = [...Buffer.from(name3)];
|
|
48187
|
-
return [...uleb4(bytes.length), ...bytes];
|
|
48188
|
-
};
|
|
48189
48016
|
SCANNED = /* @__PURE__ */ new Set([
|
|
48190
48017
|
"swift5_protocols",
|
|
48191
48018
|
"swift5_protocol_conformances",
|
|
@@ -49313,36 +49140,22 @@ function archiveMember(archive, name3) {
|
|
|
49313
49140
|
throw new Error(`swift-icu: ${name3} is not in the sdk's icu archive`);
|
|
49314
49141
|
}
|
|
49315
49142
|
function icuSegment(object9) {
|
|
49316
|
-
let at = 8;
|
|
49317
|
-
const leb2 = () => {
|
|
49318
|
-
let result = 0;
|
|
49319
|
-
let shift = 0;
|
|
49320
|
-
let byte;
|
|
49321
|
-
do {
|
|
49322
|
-
byte = object9[at++];
|
|
49323
|
-
result += (byte & 127) * 2 ** shift;
|
|
49324
|
-
shift += 7;
|
|
49325
|
-
} while (byte & 128);
|
|
49326
|
-
return result;
|
|
49327
|
-
};
|
|
49328
49143
|
const found2 = [];
|
|
49329
|
-
|
|
49330
|
-
|
|
49331
|
-
const
|
|
49332
|
-
|
|
49333
|
-
|
|
49334
|
-
|
|
49335
|
-
|
|
49336
|
-
|
|
49337
|
-
|
|
49338
|
-
|
|
49339
|
-
|
|
49340
|
-
|
|
49341
|
-
|
|
49342
|
-
|
|
49343
|
-
}
|
|
49144
|
+
for (const section2 of wasmSections(object9)) {
|
|
49145
|
+
if (section2.id !== 11) continue;
|
|
49146
|
+
const reader = readWasmSection(object9, section2.start, section2.end);
|
|
49147
|
+
for (let count = reader.number(); count > 0; count--) {
|
|
49148
|
+
if (reader.number() !== 0)
|
|
49149
|
+
throw new Error("swift-icu: unexpected data segment kind");
|
|
49150
|
+
reader.byte();
|
|
49151
|
+
reader.number();
|
|
49152
|
+
reader.byte();
|
|
49153
|
+
const length = reader.number();
|
|
49154
|
+
const start = reader.position();
|
|
49155
|
+
const bytes = object9.subarray(start, start + length);
|
|
49156
|
+
if (bytes[2] === 218 && bytes[3] === 39) found2.push(bytes);
|
|
49157
|
+
reader.skip(length);
|
|
49344
49158
|
}
|
|
49345
|
-
at = end;
|
|
49346
49159
|
}
|
|
49347
49160
|
if (found2.length !== 1)
|
|
49348
49161
|
throw new Error(`swift-icu: expected one icu data segment, found ${found2.length}`);
|
|
@@ -49396,6 +49209,7 @@ var init_swift_icu = __esm({
|
|
|
49396
49209
|
init_icuData();
|
|
49397
49210
|
init_swift_toolchain();
|
|
49398
49211
|
init_swiftTargetContract();
|
|
49212
|
+
init_wasm_binary_sections();
|
|
49399
49213
|
run6 = (0, import_node_util12.promisify)(import_node_child_process40.execFile);
|
|
49400
49214
|
deflate = (0, import_node_util12.promisify)(import_node_zlib6.gzip);
|
|
49401
49215
|
compressBrotli = (0, import_node_util12.promisify)(import_node_zlib6.brotliCompress);
|
|
@@ -56052,7 +55866,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
|
|
|
56052
55866
|
REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
56053
55867
|
MULTI_MANIFEST_VERSION = 76;
|
|
56054
55868
|
SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
56055
|
-
compilerSourceDigest = true ? "
|
|
55869
|
+
compilerSourceDigest = true ? "816651f27c8e6bad4746f2f90d840446903e3c4a2384095dcdf1c9ceb69ceba8" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
56056
55870
|
nativeCxxCompilerFlags = ["-fno-cxx-modules"];
|
|
56057
55871
|
MODULE_MAP_RESPONSE_FILE_RUN = 16;
|
|
56058
55872
|
cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
|
|
@@ -130716,7 +130530,7 @@ var init_nitro_superset = __esm({
|
|
|
130716
130530
|
init_nitroContract();
|
|
130717
130531
|
init_swift_standin_digest();
|
|
130718
130532
|
NITRO_SUPERSET_ENTRY_NAME = "superset";
|
|
130719
|
-
NITRO_COMPILER_DIGEST = true ? "
|
|
130533
|
+
NITRO_COMPILER_DIGEST = true ? "379ef4bc3caf96c52a4ffe7df50670f16d8db945bfbc90e1513bff35258d8b6f" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
|
|
130720
130534
|
nitroSupersetLock = parseLock(nitro_superset_lock_default);
|
|
130721
130535
|
nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
|
|
130722
130536
|
published3 = /* @__PURE__ */ new Map();
|