peachsim 0.1.2778 → 0.1.2780
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 +295 -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-SPK2673W.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-ZWOS2EDN.mjs → chunk-3BAOVPYB.mjs} +118 -361
- package/dist-lib/esm-chunks/{chunk-MRIDS3GE.mjs → chunk-664T7XWT.mjs} +5 -5
- package/dist-lib/esm-chunks/{chunk-QKTKE4OX.mjs → chunk-7B4ZRXZW.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-G7UJ4BAC.mjs → chunk-7UJZBQ6G.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-EXU474NE.mjs → chunk-B4DO5WJD.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-IQSFMB4R.mjs → chunk-DO3C6MOG.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-K3ULPN2R.mjs → chunk-DZZZCBJY.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-5TIUTQ55.mjs → chunk-EEN3DGCH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZDWMPXYI.mjs → chunk-JIGACUAS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-X25PQNNH.mjs → chunk-JIKQAODQ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-6YHF4VYF.mjs → chunk-MIESONPY.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3RPELUA2.mjs → chunk-NDMVV5PE.mjs} +6 -6
- package/dist-lib/esm-chunks/{chunk-KX7LV722.mjs → chunk-NLIWJ2AO.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-5WASPTSS.mjs → chunk-P7DZLDBL.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-F3OPIKJC.mjs → chunk-RDFBVP4E.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-DLBUPWTI.mjs → chunk-SWCGFJ5A.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-KLA74B7J.mjs → chunk-T6THDRRU.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-3WQANOYY.mjs → chunk-TBKPPEGS.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-QUVLFF6I.mjs → chunk-UHTFNN5A.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GSTHJQMW.mjs → chunk-VV2TNQK4.mjs} +115 -18
- package/dist-lib/esm-chunks/{chunk-VZ3NXXUC.mjs → chunk-WKE7Z3LU.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-LQVLXDRN.mjs → chunk-WXCV7NSJ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-KBYVKTVK.mjs → chunk-X2OBXRGN.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-N2PEXZGL.mjs → chunk-ZDW2NOAO.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-RRIZOLBE.mjs → metro-layout-parser-6N4ZZDLM.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-EIZ7MCKR.mjs → swift-package-prebuilt-GF27A4NU.mjs} +12 -12
- package/dist-lib/esm-chunks/{swift-sdk-app-module-S2LQ4OXD.mjs → swift-sdk-app-module-WWTSGAS7.mjs} +47 -69
- package/dist-lib/esm-chunks/{swift-sdk-image-77FFUGXI.mjs → swift-sdk-image-OQMMOQLZ.mjs} +16 -16
- package/dist-lib/esm-chunks/{swift-sdk-image-producer-XFSFUXQJ.mjs → swift-sdk-image-producer-NOH5SG6O.mjs} +5 -5
- package/dist-lib/expo-swift-bundle.cjs +295 -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 +301 -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 +301 -486
- package/dist-lib/swift-compile.cjs +288 -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/compositor-protocol.d.ts +2 -0
- 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-sdk-surface.ts +1 -0
- 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.2780 | (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;
|
|
@@ -19579,7 +19579,7 @@ var init_react_native_core_digest = __esm({
|
|
|
19579
19579
|
|
|
19580
19580
|
// src/swift-compiler-digest.ts
|
|
19581
19581
|
function swiftArchiveCompilerDigestValue() {
|
|
19582
|
-
return true ? "
|
|
19582
|
+
return true ? "e8ee54259aef0a6a4e89faafc8a3413c810341697abe828044a70a8b46db3c15" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname, "archive");
|
|
19583
19583
|
}
|
|
19584
19584
|
var import_node_crypto16, import_node_fs32, import_node_path31, SWIFT_DIGEST_SOURCES, LINKED_IMAGE_SOURCES, SWIFT_ARCHIVE_DIGEST_SOURCES;
|
|
19585
19585
|
var init_swift_compiler_digest = __esm({
|
|
@@ -19608,6 +19608,7 @@ var init_swift_compiler_digest = __esm({
|
|
|
19608
19608
|
"swift-objc-prebuilt-catalog.ts",
|
|
19609
19609
|
"swift-toolchain.ts",
|
|
19610
19610
|
"swift-shared-sdk.ts",
|
|
19611
|
+
"wasm-binary-sections.ts",
|
|
19611
19612
|
"swift-distribution-mirror.ts",
|
|
19612
19613
|
"swift-design-time.ts",
|
|
19613
19614
|
"binaryen.lock.json",
|
|
@@ -19725,13 +19726,13 @@ var init_swift_standin_digest = __esm({
|
|
|
19725
19726
|
];
|
|
19726
19727
|
RUNTIME_IMPORT = /(?:^|[;\n])[ \t]*(?:import|export)\s+(?!type(?:\s|\{))([\s\S]*?)\s+from\s*['"]([^'"]+)['"]|(?:^|[;\n])[ \t]*import\s+['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
19727
19728
|
standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS, STANDIN_DIGEST_EXCLUDED_FILES);
|
|
19728
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
19729
|
+
STANDIN_SOURCE_DIGEST = true ? "8b7dccbe4ecedba9dc6511eb4ab2e02ce2922969fcd9eebc93f3280c6529a48b" : standinSourceDigest();
|
|
19729
19730
|
}
|
|
19730
19731
|
});
|
|
19731
19732
|
|
|
19732
19733
|
// src/expo-native-compiler-digest.ts
|
|
19733
19734
|
function expoNativeCompilerDigestValue() {
|
|
19734
|
-
return true ? "
|
|
19735
|
+
return true ? "4dc23720ffaa03d981b544bb7024c9d2dc67271f54484b348e256cad727bd94f" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
|
|
19735
19736
|
}
|
|
19736
19737
|
var import_node_crypto18;
|
|
19737
19738
|
var init_expo_native_compiler_digest = __esm({
|
|
@@ -22948,6 +22949,111 @@ var init_swift_objc_runtime = __esm({
|
|
|
22948
22949
|
}
|
|
22949
22950
|
});
|
|
22950
22951
|
|
|
22952
|
+
// src/wasm-binary-sections.ts
|
|
22953
|
+
function encodeWasmNumber(value) {
|
|
22954
|
+
const bytes = [];
|
|
22955
|
+
for (let rest = value; ; ) {
|
|
22956
|
+
const byte = rest % 128;
|
|
22957
|
+
rest = Math.floor(rest / 128);
|
|
22958
|
+
if (rest === 0) return [...bytes, byte];
|
|
22959
|
+
bytes.push(byte | 128);
|
|
22960
|
+
}
|
|
22961
|
+
}
|
|
22962
|
+
function encodeWasmSigned(value) {
|
|
22963
|
+
const out = [];
|
|
22964
|
+
for (; ; ) {
|
|
22965
|
+
const byte = Number(value & 127n);
|
|
22966
|
+
value >>= 7n;
|
|
22967
|
+
if (value === 0n && !(byte & 64) || value === -1n && byte & 64) {
|
|
22968
|
+
out.push(byte);
|
|
22969
|
+
return out;
|
|
22970
|
+
}
|
|
22971
|
+
out.push(byte | 128);
|
|
22972
|
+
}
|
|
22973
|
+
}
|
|
22974
|
+
function encodeWasmName(name3) {
|
|
22975
|
+
const bytes = new TextEncoder().encode(name3);
|
|
22976
|
+
return [...encodeWasmNumber(bytes.length), ...bytes];
|
|
22977
|
+
}
|
|
22978
|
+
function readULEB(bytes, offset, end = bytes.length) {
|
|
22979
|
+
if (offset < end) {
|
|
22980
|
+
const first = bytes[offset];
|
|
22981
|
+
if (first < 128) return [first, offset + 1];
|
|
22982
|
+
}
|
|
22983
|
+
let value = 0;
|
|
22984
|
+
for (let shift = 0; ; shift += 7) {
|
|
22985
|
+
if (offset >= end || shift > 63) throw new Error("invalid wasm integer");
|
|
22986
|
+
const byte = bytes[offset++];
|
|
22987
|
+
value += (byte & 127) * 2 ** shift;
|
|
22988
|
+
if (!(byte & 128)) return [value, offset];
|
|
22989
|
+
}
|
|
22990
|
+
}
|
|
22991
|
+
function readSLEB(bytes, offset, end = bytes.length) {
|
|
22992
|
+
let value = 0n;
|
|
22993
|
+
let shift = 0n;
|
|
22994
|
+
let byte = 0;
|
|
22995
|
+
do {
|
|
22996
|
+
if (offset >= end || shift > 70n) throw new Error("invalid wasm integer");
|
|
22997
|
+
byte = bytes[offset++];
|
|
22998
|
+
value |= BigInt(byte & 127) << shift;
|
|
22999
|
+
shift += 7n;
|
|
23000
|
+
} while (byte & 128);
|
|
23001
|
+
if (byte & 64) value -= 1n << shift;
|
|
23002
|
+
return [value, offset];
|
|
23003
|
+
}
|
|
23004
|
+
function skipLEB(bytes, offset) {
|
|
23005
|
+
while ((bytes[offset++] & 128) !== 0) {
|
|
23006
|
+
}
|
|
23007
|
+
return offset;
|
|
23008
|
+
}
|
|
23009
|
+
function readWasmSection(bytes, start, end) {
|
|
23010
|
+
let at = start;
|
|
23011
|
+
const number3 = () => {
|
|
23012
|
+
const [value, next] = readULEB(bytes, at, end);
|
|
23013
|
+
at = next;
|
|
23014
|
+
return value;
|
|
23015
|
+
};
|
|
23016
|
+
return {
|
|
23017
|
+
number: number3,
|
|
23018
|
+
byte: () => {
|
|
23019
|
+
if (at >= end) throw new Error("truncated wasm section");
|
|
23020
|
+
return bytes[at++];
|
|
23021
|
+
},
|
|
23022
|
+
name: () => {
|
|
23023
|
+
const length = number3();
|
|
23024
|
+
at += length;
|
|
23025
|
+
if (at > end) throw new Error("truncated wasm name");
|
|
23026
|
+
return Buffer.from(bytes.buffer, bytes.byteOffset + at - length, length).toString();
|
|
23027
|
+
},
|
|
23028
|
+
skip: (length) => {
|
|
23029
|
+
at += length;
|
|
23030
|
+
if (at > end) throw new Error("truncated wasm section");
|
|
23031
|
+
},
|
|
23032
|
+
position: () => at,
|
|
23033
|
+
done: () => at === end
|
|
23034
|
+
};
|
|
23035
|
+
}
|
|
23036
|
+
function wasmSections(bytes) {
|
|
23037
|
+
if (Buffer.from(bytes.subarray(0, 8)).toString("hex") !== "0061736d01000000")
|
|
23038
|
+
throw new Error("not a wasm module");
|
|
23039
|
+
const found = [];
|
|
23040
|
+
for (let at = 8; at < bytes.length; ) {
|
|
23041
|
+
const header = readWasmSection(bytes, at, bytes.length);
|
|
23042
|
+
const id = header.byte();
|
|
23043
|
+
const size2 = header.number();
|
|
23044
|
+
const start = header.position();
|
|
23045
|
+
if (start + size2 > bytes.length) throw new Error("truncated wasm section");
|
|
23046
|
+
found.push({ id, offset: at, start, end: start + size2 });
|
|
23047
|
+
at = start + size2;
|
|
23048
|
+
}
|
|
23049
|
+
return found;
|
|
23050
|
+
}
|
|
23051
|
+
var init_wasm_binary_sections = __esm({
|
|
23052
|
+
"src/wasm-binary-sections.ts"() {
|
|
23053
|
+
"use strict";
|
|
23054
|
+
}
|
|
23055
|
+
});
|
|
23056
|
+
|
|
22951
23057
|
// src/swift-shared-sdk.ts
|
|
22952
23058
|
function swiftSharedSdkSourceRoot(moduleRoot, distribution) {
|
|
22953
23059
|
return import_node_path38.default.resolve(moduleRoot, distribution ? "sdk/ios" : "../peachsim/sdk/ios");
|
|
@@ -22998,18 +23104,6 @@ function swiftSharedSdkFlags(moduleRoot, distribution) {
|
|
|
22998
23104
|
import_node_path38.default.join(root, "usr/include")
|
|
22999
23105
|
];
|
|
23000
23106
|
}
|
|
23001
|
-
function readULEB(b, o) {
|
|
23002
|
-
let res = 0;
|
|
23003
|
-
let shift = 0;
|
|
23004
|
-
let p = o;
|
|
23005
|
-
while (true) {
|
|
23006
|
-
const byte = b[p++];
|
|
23007
|
-
res |= (byte & 127) << shift;
|
|
23008
|
-
if ((byte & 128) === 0) break;
|
|
23009
|
-
shift += 7;
|
|
23010
|
-
}
|
|
23011
|
-
return [res, p];
|
|
23012
|
-
}
|
|
23013
23107
|
function weakenFoundationSymbolsInWasmObj(buf) {
|
|
23014
23108
|
let pos = 8;
|
|
23015
23109
|
while (pos < buf.length) {
|
|
@@ -23374,6 +23468,7 @@ var init_swift_shared_sdk = __esm({
|
|
|
23374
23468
|
import_node_path38 = __toESM(require("node:path"), 1);
|
|
23375
23469
|
init_swift_toolchain();
|
|
23376
23470
|
init_swiftTargetContract();
|
|
23471
|
+
init_wasm_binary_sections();
|
|
23377
23472
|
SWIFT_DISTRIBUTION_MIRROR_RECORD = ".peach-mirror.json";
|
|
23378
23473
|
distributionHeaderRoots = /* @__PURE__ */ new Map();
|
|
23379
23474
|
WEAKEN_FOUNDATION_SYMS = /* @__PURE__ */ new Set([
|
|
@@ -24780,16 +24875,12 @@ var init_swift_link_roots = __esm({
|
|
|
24780
24875
|
"use strict";
|
|
24781
24876
|
import_node_fs43 = __toESM(require("node:fs"), 1);
|
|
24782
24877
|
import_node_path42 = __toESM(require("node:path"), 1);
|
|
24878
|
+
init_wasm_binary_sections();
|
|
24783
24879
|
OBJC_RUNTIME_LOOKUP_SECTION = "peach_objc_runtime_lookup";
|
|
24784
24880
|
leb = (bytes, at) => {
|
|
24785
|
-
|
|
24786
|
-
|
|
24787
|
-
|
|
24788
|
-
const byte = bytes[at.offset++];
|
|
24789
|
-
value += (byte & 127) * scale;
|
|
24790
|
-
if (!(byte & 128)) return value;
|
|
24791
|
-
scale *= 128;
|
|
24792
|
-
}
|
|
24881
|
+
const [value, next] = readULEB(bytes, at.offset);
|
|
24882
|
+
at.offset = next;
|
|
24883
|
+
return value;
|
|
24793
24884
|
};
|
|
24794
24885
|
rootsByDistribution = /* @__PURE__ */ new Map();
|
|
24795
24886
|
}
|
|
@@ -25618,68 +25709,6 @@ var init_swift_guest_linked_spans = __esm({
|
|
|
25618
25709
|
}
|
|
25619
25710
|
});
|
|
25620
25711
|
|
|
25621
|
-
// src/wasm-binary-sections.ts
|
|
25622
|
-
function encodeWasmNumber(value) {
|
|
25623
|
-
const bytes = [];
|
|
25624
|
-
for (let rest = value; ; ) {
|
|
25625
|
-
const byte = rest % 128;
|
|
25626
|
-
rest = Math.floor(rest / 128);
|
|
25627
|
-
if (rest === 0) return [...bytes, byte];
|
|
25628
|
-
bytes.push(byte | 128);
|
|
25629
|
-
}
|
|
25630
|
-
}
|
|
25631
|
-
function encodeWasmName(name3) {
|
|
25632
|
-
const bytes = new TextEncoder().encode(name3);
|
|
25633
|
-
return [...encodeWasmNumber(bytes.length), ...bytes];
|
|
25634
|
-
}
|
|
25635
|
-
function readWasmSection(bytes, start, end) {
|
|
25636
|
-
let at = start;
|
|
25637
|
-
const number3 = () => {
|
|
25638
|
-
let value = 0;
|
|
25639
|
-
for (let shift = 0; ; shift += 7) {
|
|
25640
|
-
if (at >= end || shift > 63) throw new Error("invalid wasm integer");
|
|
25641
|
-
const byte = bytes[at++];
|
|
25642
|
-
value += (byte & 127) * 2 ** shift;
|
|
25643
|
-
if (!(byte & 128)) return value;
|
|
25644
|
-
}
|
|
25645
|
-
};
|
|
25646
|
-
return {
|
|
25647
|
-
number: number3,
|
|
25648
|
-
byte: () => {
|
|
25649
|
-
if (at >= end) throw new Error("truncated wasm section");
|
|
25650
|
-
return bytes[at++];
|
|
25651
|
-
},
|
|
25652
|
-
name: () => {
|
|
25653
|
-
const length = number3();
|
|
25654
|
-
at += length;
|
|
25655
|
-
if (at > end) throw new Error("truncated wasm name");
|
|
25656
|
-
return Buffer.from(bytes.buffer, bytes.byteOffset + at - length, length).toString();
|
|
25657
|
-
},
|
|
25658
|
-
position: () => at,
|
|
25659
|
-
done: () => at === end
|
|
25660
|
-
};
|
|
25661
|
-
}
|
|
25662
|
-
function wasmSections(bytes) {
|
|
25663
|
-
if (Buffer.from(bytes.subarray(0, 8)).toString("hex") !== "0061736d01000000")
|
|
25664
|
-
throw new Error("not a wasm module");
|
|
25665
|
-
const found = [];
|
|
25666
|
-
for (let at = 8; at < bytes.length; ) {
|
|
25667
|
-
const header = readWasmSection(bytes, at, bytes.length);
|
|
25668
|
-
const id = header.byte();
|
|
25669
|
-
const size2 = header.number();
|
|
25670
|
-
const start = header.position();
|
|
25671
|
-
if (start + size2 > bytes.length) throw new Error("truncated wasm section");
|
|
25672
|
-
found.push({ id, offset: at, start, end: start + size2 });
|
|
25673
|
-
at = start + size2;
|
|
25674
|
-
}
|
|
25675
|
-
return found;
|
|
25676
|
-
}
|
|
25677
|
-
var init_wasm_binary_sections = __esm({
|
|
25678
|
-
"src/wasm-binary-sections.ts"() {
|
|
25679
|
-
"use strict";
|
|
25680
|
-
}
|
|
25681
|
-
});
|
|
25682
|
-
|
|
25683
25712
|
// src/wasm-imports.ts
|
|
25684
25713
|
function readWasmImports(bytes, section2, visit3) {
|
|
25685
25714
|
const input = readWasmSection(bytes, section2.start, section2.end);
|
|
@@ -25963,23 +25992,13 @@ function wasmReader(bytes, start) {
|
|
|
25963
25992
|
const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
25964
25993
|
let at = start;
|
|
25965
25994
|
const u = () => {
|
|
25966
|
-
|
|
25967
|
-
|
|
25968
|
-
|
|
25969
|
-
value += (byte & 127) * 2 ** shift;
|
|
25970
|
-
if (!(byte & 128)) return value;
|
|
25971
|
-
}
|
|
25995
|
+
const [value, next] = readULEB(bytes, at);
|
|
25996
|
+
at = next;
|
|
25997
|
+
return value;
|
|
25972
25998
|
};
|
|
25973
25999
|
const s = () => {
|
|
25974
|
-
|
|
25975
|
-
|
|
25976
|
-
let byte = 0;
|
|
25977
|
-
do {
|
|
25978
|
-
byte = bytes[at++];
|
|
25979
|
-
value |= BigInt(byte & 127) << shift;
|
|
25980
|
-
shift += 7n;
|
|
25981
|
-
} while (byte & 128);
|
|
25982
|
-
if (byte & 64) value -= 1n << shift;
|
|
26000
|
+
const [value, next] = readSLEB(bytes, at);
|
|
26001
|
+
at = next;
|
|
25983
26002
|
return value;
|
|
25984
26003
|
};
|
|
25985
26004
|
return {
|
|
@@ -26284,7 +26303,7 @@ function finishSdkImage(bytes, hostExports, libraries, guestMap) {
|
|
|
26284
26303
|
else data[entry.name] = value;
|
|
26285
26304
|
}
|
|
26286
26305
|
if (entry.kind !== 0 && entry.kind !== 3 || host2.has(entry.name))
|
|
26287
|
-
kept.push([...
|
|
26306
|
+
kept.push([...encodeWasmName(entry.name), entry.kind, ...encodeWasmNumber(entry.index)]);
|
|
26288
26307
|
}
|
|
26289
26308
|
if (guestMap) {
|
|
26290
26309
|
if (guestMap.code.length !== m.bodies.length)
|
|
@@ -26299,19 +26318,19 @@ function finishSdkImage(bytes, hostExports, libraries, guestMap) {
|
|
|
26299
26318
|
const er = wasmReader(bytes, elements.start);
|
|
26300
26319
|
const segments = er.u();
|
|
26301
26320
|
const replaced = /* @__PURE__ */ new Map([
|
|
26302
|
-
[4, [1, 112, 4, ...
|
|
26303
|
-
[7, [...
|
|
26321
|
+
[4, [1, 112, 4, ...encodeWasmNumber(tableEnd + added.length)]],
|
|
26322
|
+
[7, [...encodeWasmNumber(kept.length), ...kept.flat()]],
|
|
26304
26323
|
[
|
|
26305
26324
|
9,
|
|
26306
26325
|
[
|
|
26307
|
-
...
|
|
26326
|
+
...encodeWasmNumber(segments + 1),
|
|
26308
26327
|
...bytes.subarray(er.at, elements.end),
|
|
26309
26328
|
0,
|
|
26310
26329
|
66,
|
|
26311
|
-
...
|
|
26330
|
+
...encodeWasmSigned(BigInt(tableEnd)),
|
|
26312
26331
|
11,
|
|
26313
|
-
...
|
|
26314
|
-
...added.flatMap(
|
|
26332
|
+
...encodeWasmNumber(added.length),
|
|
26333
|
+
...added.flatMap(encodeWasmNumber)
|
|
26315
26334
|
]
|
|
26316
26335
|
]
|
|
26317
26336
|
]);
|
|
@@ -26417,33 +26436,33 @@ function codeOnlySdkImage(bytes, constructorMask) {
|
|
|
26417
26436
|
if (drop) r.skip(1);
|
|
26418
26437
|
gated.push(
|
|
26419
26438
|
66,
|
|
26420
|
-
...
|
|
26439
|
+
...encodeWasmSigned(BigInt(constructorMask + index++)),
|
|
26421
26440
|
45,
|
|
26422
26441
|
0,
|
|
26423
26442
|
0,
|
|
26424
26443
|
4,
|
|
26425
26444
|
64,
|
|
26426
26445
|
16,
|
|
26427
|
-
...
|
|
26446
|
+
...encodeWasmNumber(callee),
|
|
26428
26447
|
...drop ? [26] : [],
|
|
26429
26448
|
11
|
|
26430
26449
|
);
|
|
26431
26450
|
}
|
|
26432
26451
|
if (index > SWIFT_SDK_CONSTRUCTOR_LIMIT)
|
|
26433
26452
|
throw new Error(`${index} sdk constructors exceed the mask`);
|
|
26434
|
-
gated.push(16, ...
|
|
26453
|
+
gated.push(16, ...encodeWasmNumber(functionIndex("__peach_sdk_register")), 11);
|
|
26435
26454
|
bodies[constructors] = Uint8Array.from(gated);
|
|
26436
26455
|
}
|
|
26437
|
-
const codeParts = [Uint8Array.from(
|
|
26438
|
-
for (const body of bodies) codeParts.push(Uint8Array.from(
|
|
26456
|
+
const codeParts = [Uint8Array.from(encodeWasmNumber(bodies.length))];
|
|
26457
|
+
for (const body of bodies) codeParts.push(Uint8Array.from(encodeWasmNumber(body.length)), body);
|
|
26439
26458
|
const codeSize = codeParts.reduce((sum, part) => sum + part.length, 0);
|
|
26440
26459
|
const tls = passiveSegments(bytes)[0];
|
|
26441
26460
|
const out = [bytes.subarray(0, 8)];
|
|
26442
26461
|
for (const s of m.sections) {
|
|
26443
26462
|
if (s.id === 10) {
|
|
26444
|
-
out.push(Uint8Array.from([10, ...
|
|
26463
|
+
out.push(Uint8Array.from([10, ...encodeWasmNumber(codeSize)]));
|
|
26445
26464
|
for (const part of codeParts) out.push(part);
|
|
26446
|
-
} else if (s.id === 11) out.push(section(11, [1, 1, ...
|
|
26465
|
+
} else if (s.id === 11) out.push(section(11, [1, 1, ...encodeWasmNumber(tls.length), ...tls]));
|
|
26447
26466
|
else if (s.id === 12) out.push(section(12, [1]));
|
|
26448
26467
|
else out.push(bytes.subarray(s.offset, s.end));
|
|
26449
26468
|
}
|
|
@@ -26760,39 +26779,14 @@ function unslottedFunctions(bytes) {
|
|
|
26760
26779
|
}
|
|
26761
26780
|
return definedFuncs - slotted.size;
|
|
26762
26781
|
}
|
|
26763
|
-
var
|
|
26782
|
+
var section, PROCESS_EXPORTS, SWIFT_SDK_CONSTRUCTOR_LIMIT, FUNCTION_RELOCATIONS, MEMORY_RELOCATIONS, ADDEND_RELOCATIONS, FUNCTION_RELOC_MASK, MEMORY_RELOC_MASK, ADDEND_RELOC_MASK;
|
|
26764
26783
|
var init_swift_sdk_image_wasm = __esm({
|
|
26765
26784
|
"src/swift-sdk-image-wasm.ts"() {
|
|
26766
26785
|
"use strict";
|
|
26767
26786
|
init_swift_sdk_image_map();
|
|
26768
26787
|
init_swiftSdkLinkContract();
|
|
26769
|
-
|
|
26770
|
-
|
|
26771
|
-
do {
|
|
26772
|
-
let byte = value % 128;
|
|
26773
|
-
value = Math.floor(value / 128);
|
|
26774
|
-
if (value) byte |= 128;
|
|
26775
|
-
out.push(byte);
|
|
26776
|
-
} while (value);
|
|
26777
|
-
return out;
|
|
26778
|
-
};
|
|
26779
|
-
sleb = (value) => {
|
|
26780
|
-
const out = [];
|
|
26781
|
-
for (; ; ) {
|
|
26782
|
-
const byte = Number(value & 127n);
|
|
26783
|
-
value >>= 7n;
|
|
26784
|
-
if (value === 0n && !(byte & 64) || value === -1n && byte & 64) {
|
|
26785
|
-
out.push(byte);
|
|
26786
|
-
return out;
|
|
26787
|
-
}
|
|
26788
|
-
out.push(byte | 128);
|
|
26789
|
-
}
|
|
26790
|
-
};
|
|
26791
|
-
encodedName = (name3) => {
|
|
26792
|
-
const bytes = [...Buffer.from(name3)];
|
|
26793
|
-
return [...uleb(bytes.length), ...bytes];
|
|
26794
|
-
};
|
|
26795
|
-
section = (id, payload) => Uint8Array.from([id, ...uleb(payload.length), ...payload]);
|
|
26788
|
+
init_wasm_binary_sections();
|
|
26789
|
+
section = (id, payload) => Uint8Array.from([id, ...encodeWasmNumber(payload.length), ...payload]);
|
|
26796
26790
|
PROCESS_EXPORTS = [
|
|
26797
26791
|
"_initialize",
|
|
26798
26792
|
"__wasm_call_ctors",
|
|
@@ -26897,20 +26891,12 @@ function localizeDefinedWasmSymbols(bytes, names) {
|
|
|
26897
26891
|
const output = new Uint8Array(bytes);
|
|
26898
26892
|
let cur = 8;
|
|
26899
26893
|
const readU = () => {
|
|
26900
|
-
const
|
|
26901
|
-
|
|
26902
|
-
|
|
26903
|
-
let shift = 7;
|
|
26904
|
-
while (true) {
|
|
26905
|
-
const byte = bytes[cur++];
|
|
26906
|
-
res |= (byte & 127) << shift;
|
|
26907
|
-
if ((byte & 128) === 0) return res;
|
|
26908
|
-
shift += 7;
|
|
26909
|
-
}
|
|
26894
|
+
const [res, next] = readULEB(bytes, cur);
|
|
26895
|
+
cur = next;
|
|
26896
|
+
return res;
|
|
26910
26897
|
};
|
|
26911
26898
|
const skipU = () => {
|
|
26912
|
-
|
|
26913
|
-
}
|
|
26899
|
+
cur = skipLEB(bytes, cur);
|
|
26914
26900
|
};
|
|
26915
26901
|
const importFuncNames = [];
|
|
26916
26902
|
const importGlobalNames = [];
|
|
@@ -27017,45 +27003,11 @@ function localizeDefinedWasmSymbols(bytes, names) {
|
|
|
27017
27003
|
var init_swift_wasm_archive = __esm({
|
|
27018
27004
|
"src/swift-wasm-archive.ts"() {
|
|
27019
27005
|
"use strict";
|
|
27006
|
+
init_wasm_binary_sections();
|
|
27020
27007
|
}
|
|
27021
27008
|
});
|
|
27022
27009
|
|
|
27023
27010
|
// src/swift-wasm-prune.ts
|
|
27024
|
-
function readULEB2(b, o) {
|
|
27025
|
-
let res = 0;
|
|
27026
|
-
let shift = 0;
|
|
27027
|
-
let p = o;
|
|
27028
|
-
while (true) {
|
|
27029
|
-
const byte = b[p++];
|
|
27030
|
-
res |= (byte & 127) << shift;
|
|
27031
|
-
if ((byte & 128) === 0) break;
|
|
27032
|
-
shift += 7;
|
|
27033
|
-
}
|
|
27034
|
-
return [res, p];
|
|
27035
|
-
}
|
|
27036
|
-
function readSLEB(b, o) {
|
|
27037
|
-
let res = 0;
|
|
27038
|
-
let shift = 0;
|
|
27039
|
-
let p = o;
|
|
27040
|
-
let byte = 0;
|
|
27041
|
-
do {
|
|
27042
|
-
byte = b[p++];
|
|
27043
|
-
res |= (byte & 127) << shift;
|
|
27044
|
-
shift += 7;
|
|
27045
|
-
} while (byte & 128);
|
|
27046
|
-
if (shift < 32 && byte & 64) res |= ~0 << shift;
|
|
27047
|
-
return [res, p];
|
|
27048
|
-
}
|
|
27049
|
-
function encodeULEB(val) {
|
|
27050
|
-
const out = [];
|
|
27051
|
-
do {
|
|
27052
|
-
let byte = val & 127;
|
|
27053
|
-
val >>>= 7;
|
|
27054
|
-
if (val !== 0) byte |= 128;
|
|
27055
|
-
out.push(byte);
|
|
27056
|
-
} while (val !== 0);
|
|
27057
|
-
return out;
|
|
27058
|
-
}
|
|
27059
27011
|
function isRootSegName(name3) {
|
|
27060
27012
|
for (const pref of ROOT_SEG_PREFIXES) {
|
|
27061
27013
|
if (name3 === pref || name3.startsWith(`${pref}.`)) return true;
|
|
@@ -27081,39 +27033,14 @@ function decodeRelocations(buf, sections) {
|
|
|
27081
27033
|
for (let k = 0; k < sectionCount; k++, i++) {
|
|
27082
27034
|
start[i] = length + cur - baseAt;
|
|
27083
27035
|
const rType = buf[cur++];
|
|
27084
|
-
let offset
|
|
27085
|
-
|
|
27086
|
-
|
|
27087
|
-
|
|
27088
|
-
while (true) {
|
|
27089
|
-
const byte = buf[cur++];
|
|
27090
|
-
offset |= (byte & 127) << shift;
|
|
27091
|
-
if (byte < 128) break;
|
|
27092
|
-
shift += 7;
|
|
27093
|
-
}
|
|
27094
|
-
}
|
|
27095
|
-
let symbol2 = buf[cur++];
|
|
27096
|
-
if (symbol2 >= 128) {
|
|
27097
|
-
symbol2 &= 127;
|
|
27098
|
-
let shift = 7;
|
|
27099
|
-
while (true) {
|
|
27100
|
-
const byte = buf[cur++];
|
|
27101
|
-
symbol2 |= (byte & 127) << shift;
|
|
27102
|
-
if (byte < 128) break;
|
|
27103
|
-
shift += 7;
|
|
27104
|
-
}
|
|
27105
|
-
}
|
|
27036
|
+
let offset;
|
|
27037
|
+
[offset, cur] = readULEB(buf, cur);
|
|
27038
|
+
let symbol2;
|
|
27039
|
+
[symbol2, cur] = readULEB(buf, cur);
|
|
27106
27040
|
if (rType < 32 && (ADDEND_RELOC_MASK2 & 1 << rType) !== 0) {
|
|
27107
|
-
let
|
|
27108
|
-
|
|
27109
|
-
|
|
27110
|
-
while (byte >= 128) {
|
|
27111
|
-
byte = buf[cur++];
|
|
27112
|
-
value |= (byte & 127) << shift;
|
|
27113
|
-
shift += 7;
|
|
27114
|
-
}
|
|
27115
|
-
if (shift < 32 && (byte & 64) !== 0) value |= ~0 << shift;
|
|
27116
|
-
addend[i] = value;
|
|
27041
|
+
let value;
|
|
27042
|
+
[value, cur] = readSLEB(buf, cur);
|
|
27043
|
+
addend[i] = Number(BigInt.asIntN(32, value));
|
|
27117
27044
|
}
|
|
27118
27045
|
ro[i] = offset;
|
|
27119
27046
|
rs[i] = symbol2;
|
|
@@ -27148,36 +27075,36 @@ function patchSwiftrtObject(src) {
|
|
|
27148
27075
|
let pos = 8;
|
|
27149
27076
|
while (pos < buf.length) {
|
|
27150
27077
|
const id = buf[pos++];
|
|
27151
|
-
const [sz, p] =
|
|
27078
|
+
const [sz, p] = readULEB(buf, pos);
|
|
27152
27079
|
const end = p + sz;
|
|
27153
27080
|
if (id === 0) {
|
|
27154
|
-
const [nLen, np] =
|
|
27081
|
+
const [nLen, np] = readULEB(buf, p);
|
|
27155
27082
|
const name3 = Buffer.from(buf.subarray(np, np + nLen)).toString("utf8");
|
|
27156
27083
|
const cp = np + nLen;
|
|
27157
27084
|
if (name3 === "linking") {
|
|
27158
|
-
let [, lp] =
|
|
27085
|
+
let [, lp] = readULEB(buf, cp);
|
|
27159
27086
|
while (lp < end) {
|
|
27160
27087
|
const subId = buf[lp++];
|
|
27161
|
-
const [subLen, sp] =
|
|
27088
|
+
const [subLen, sp] = readULEB(buf, lp);
|
|
27162
27089
|
const subEnd = sp + subLen;
|
|
27163
27090
|
if (subId === 8) {
|
|
27164
|
-
let [cnt, cur] =
|
|
27091
|
+
let [cnt, cur] = readULEB(buf, sp);
|
|
27165
27092
|
for (let i = 0; i < cnt; i++) {
|
|
27166
27093
|
const kind = buf[cur++];
|
|
27167
27094
|
const flPos = cur;
|
|
27168
|
-
const [fl, c2] =
|
|
27095
|
+
const [fl, c2] = readULEB(buf, cur);
|
|
27169
27096
|
cur = c2;
|
|
27170
27097
|
const isUndef = (fl & 16) !== 0;
|
|
27171
27098
|
const isExplicitName = (fl & 64) !== 0;
|
|
27172
27099
|
if (kind === 0 || kind === 2 || kind === 4 || kind === 5) {
|
|
27173
|
-
const [, c3] =
|
|
27100
|
+
const [, c3] = readULEB(buf, cur);
|
|
27174
27101
|
cur = c3;
|
|
27175
27102
|
if (!isUndef || isExplicitName) {
|
|
27176
|
-
const [sLen, c4] =
|
|
27103
|
+
const [sLen, c4] = readULEB(buf, cur);
|
|
27177
27104
|
cur = c4 + sLen;
|
|
27178
27105
|
}
|
|
27179
27106
|
} else if (kind === 1) {
|
|
27180
|
-
const [sLen, c3] =
|
|
27107
|
+
const [sLen, c3] = readULEB(buf, cur);
|
|
27181
27108
|
const sName = Buffer.from(buf.subarray(c3, c3 + sLen)).toString("utf8");
|
|
27182
27109
|
if (sName === "_ZN12_GLOBAL__N_18sectionsE") fallbackSymIdx = i;
|
|
27183
27110
|
for (const prefix of ["__start_", "__stop_"]) {
|
|
@@ -27189,13 +27116,13 @@ function patchSwiftrtObject(src) {
|
|
|
27189
27116
|
}
|
|
27190
27117
|
cur = c3 + sLen;
|
|
27191
27118
|
if (!isUndef) {
|
|
27192
|
-
const [, c4] =
|
|
27193
|
-
const [, c5] =
|
|
27194
|
-
const [, c6] =
|
|
27119
|
+
const [, c4] = readULEB(buf, cur);
|
|
27120
|
+
const [, c5] = readULEB(buf, c4);
|
|
27121
|
+
const [, c6] = readULEB(buf, c5);
|
|
27195
27122
|
cur = c6;
|
|
27196
27123
|
}
|
|
27197
27124
|
} else if (kind === 3) {
|
|
27198
|
-
const [, c3] =
|
|
27125
|
+
const [, c3] = readULEB(buf, cur);
|
|
27199
27126
|
cur = c3;
|
|
27200
27127
|
}
|
|
27201
27128
|
}
|
|
@@ -27209,26 +27136,25 @@ function patchSwiftrtObject(src) {
|
|
|
27209
27136
|
pos = 8;
|
|
27210
27137
|
while (pos < buf.length) {
|
|
27211
27138
|
const id = buf[pos++];
|
|
27212
|
-
const [sz, p] =
|
|
27139
|
+
const [sz, p] = readULEB(buf, pos);
|
|
27213
27140
|
const end = p + sz;
|
|
27214
27141
|
if (id === 0) {
|
|
27215
|
-
const [nLen, np] =
|
|
27142
|
+
const [nLen, np] = readULEB(buf, p);
|
|
27216
27143
|
const name3 = Buffer.from(buf.subarray(np, np + nLen)).toString("utf8");
|
|
27217
27144
|
const cp = np + nLen;
|
|
27218
27145
|
if (name3 === "reloc.CODE") {
|
|
27219
|
-
const [, r1] =
|
|
27220
|
-
let [cnt, cur] =
|
|
27146
|
+
const [, r1] = readULEB(buf, cp);
|
|
27147
|
+
let [cnt, cur] = readULEB(buf, r1);
|
|
27221
27148
|
for (let i = 0; i < cnt; i++) {
|
|
27222
27149
|
const rType = buf[cur++];
|
|
27223
|
-
const [, c2] =
|
|
27224
|
-
const [rs, c3] =
|
|
27150
|
+
const [, c2] = readULEB(buf, cur);
|
|
27151
|
+
const [rs, c3] = readULEB(buf, c2);
|
|
27225
27152
|
if (neutralizedSyms.has(rs) && c3 - c2 === 1) {
|
|
27226
27153
|
buf[c2] = fallbackSymIdx;
|
|
27227
27154
|
}
|
|
27228
27155
|
cur = c3;
|
|
27229
27156
|
if (ADDEND_RELOCATIONS.has(rType)) {
|
|
27230
|
-
|
|
27231
|
-
cur = c4;
|
|
27157
|
+
cur = skipLEB(buf, cur);
|
|
27232
27158
|
}
|
|
27233
27159
|
}
|
|
27234
27160
|
}
|
|
@@ -27242,25 +27168,14 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
27242
27168
|
let pos = 8;
|
|
27243
27169
|
let cur = 8;
|
|
27244
27170
|
const readU = () => {
|
|
27245
|
-
const
|
|
27246
|
-
|
|
27247
|
-
|
|
27248
|
-
let shift = 7;
|
|
27249
|
-
while (true) {
|
|
27250
|
-
const byte = buf[cur++];
|
|
27251
|
-
res |= (byte & 127) << shift;
|
|
27252
|
-
if (byte < 128) return res;
|
|
27253
|
-
shift += 7;
|
|
27254
|
-
}
|
|
27171
|
+
const [res, next] = readULEB(buf, cur);
|
|
27172
|
+
cur = next;
|
|
27173
|
+
return res;
|
|
27255
27174
|
};
|
|
27256
27175
|
const skipU = () => {
|
|
27257
|
-
|
|
27258
|
-
}
|
|
27259
|
-
};
|
|
27260
|
-
const skipS = () => {
|
|
27261
|
-
while (buf[cur++] >= 128) {
|
|
27262
|
-
}
|
|
27176
|
+
cur = skipLEB(buf, cur);
|
|
27263
27177
|
};
|
|
27178
|
+
const skipS = skipU;
|
|
27264
27179
|
let numImportFuncs = 0;
|
|
27265
27180
|
let importsDlsym = false;
|
|
27266
27181
|
const importFuncNames = [];
|
|
@@ -27858,16 +27773,9 @@ function guestWasmSymbols(bytes) {
|
|
|
27858
27773
|
const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
27859
27774
|
let cur = 8;
|
|
27860
27775
|
const readU = () => {
|
|
27861
|
-
const
|
|
27862
|
-
|
|
27863
|
-
|
|
27864
|
-
let shift = 7;
|
|
27865
|
-
while (true) {
|
|
27866
|
-
const byte = bytes[cur++];
|
|
27867
|
-
res |= (byte & 127) << shift;
|
|
27868
|
-
if ((byte & 128) === 0) return res;
|
|
27869
|
-
shift += 7;
|
|
27870
|
-
}
|
|
27776
|
+
const [res, next] = readULEB(bytes, cur);
|
|
27777
|
+
cur = next;
|
|
27778
|
+
return res;
|
|
27871
27779
|
};
|
|
27872
27780
|
let importsDlsym = false;
|
|
27873
27781
|
const importFuncNames = [];
|
|
@@ -29008,7 +28916,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
29008
28916
|
if (!deadSpecialSegs.has(sIdx)) continue;
|
|
29009
28917
|
if (!isSpecialSegRelocLive(obj, obj.segNames[sIdx], data.rs[i])) continue;
|
|
29010
28918
|
const first = relocationBytes(data, i);
|
|
29011
|
-
const [, afterRoOff] =
|
|
28919
|
+
const [, afterRoOff] = readULEB(first, 1);
|
|
29012
28920
|
firstLiveInSpecialSeg.set(sIdx, {
|
|
29013
28921
|
rType: first[0],
|
|
29014
28922
|
afterRo: first.subarray(afterRoOff)
|
|
@@ -29038,7 +28946,7 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
29038
28946
|
zeroDataReloc(i);
|
|
29039
28947
|
} else {
|
|
29040
28948
|
const repl = firstLiveInSpecialSeg.get(segIdx);
|
|
29041
|
-
const roBytes =
|
|
28949
|
+
const roBytes = encodeWasmNumber(data.ro[i]);
|
|
29042
28950
|
const out = new Uint8Array(1 + roBytes.length + repl.afterRo.length);
|
|
29043
28951
|
out[0] = repl.rType;
|
|
29044
28952
|
out.set(roBytes, 1);
|
|
@@ -29077,34 +28985,34 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
29077
28985
|
while (pos < buf.length) {
|
|
29078
28986
|
const secStart = pos;
|
|
29079
28987
|
const id = buf[pos++];
|
|
29080
|
-
const [sz, p] =
|
|
28988
|
+
const [sz, p] = readULEB(buf, pos);
|
|
29081
28989
|
const end = p + sz;
|
|
29082
28990
|
if (id === 0) {
|
|
29083
|
-
const [nLen, np] =
|
|
28991
|
+
const [nLen, np] = readULEB(buf, p);
|
|
29084
28992
|
const name3 = rawBuf.toString("utf8", np, np + nLen);
|
|
29085
28993
|
const cp = np + nLen;
|
|
29086
28994
|
if (name3 === "linking") {
|
|
29087
|
-
const [, lpStart] =
|
|
28995
|
+
const [, lpStart] = readULEB(buf, cp);
|
|
29088
28996
|
const subChunks = [buf.subarray(p, lpStart)];
|
|
29089
28997
|
let lp = lpStart;
|
|
29090
28998
|
while (lp < end) {
|
|
29091
28999
|
const subStart = lp;
|
|
29092
29000
|
const subId = buf[lp++];
|
|
29093
|
-
const [subLen, sp] =
|
|
29001
|
+
const [subLen, sp] = readULEB(buf, lp);
|
|
29094
29002
|
const subEnd = sp + subLen;
|
|
29095
29003
|
if (subId === 5) {
|
|
29096
29004
|
const subCopy = new Uint8Array(buf.subarray(subStart, subEnd));
|
|
29097
|
-
let [cnt, cur] =
|
|
29005
|
+
let [cnt, cur] = readULEB(buf, sp);
|
|
29098
29006
|
for (let i = 0; i < cnt; i++) {
|
|
29099
|
-
const [sLen, s2] =
|
|
29007
|
+
const [sLen, s2] = readULEB(buf, cur);
|
|
29100
29008
|
const segName = obj.segNames[i];
|
|
29101
29009
|
const repl = RECORD_SEGS.get(segName);
|
|
29102
29010
|
const isSpecial = repl !== void 0;
|
|
29103
29011
|
if (deadSpecialSegs.has(i) && repl !== void 0)
|
|
29104
29012
|
subCopy.set(Buffer.from(repl, "utf8"), s2 - subStart);
|
|
29105
29013
|
cur = s2 + sLen;
|
|
29106
|
-
const [, s3] =
|
|
29107
|
-
const [segFl, s4] =
|
|
29014
|
+
const [, s3] = readULEB(buf, cur);
|
|
29015
|
+
const [segFl, s4] = readULEB(buf, s3);
|
|
29108
29016
|
const sFlLen = s4 - s3;
|
|
29109
29017
|
const keepRetain = isSpecial ? !deadSpecialSegs.has(i) : isRootSegName(segName) && !segName.startsWith(".init_array") && sLive[i] === 1;
|
|
29110
29018
|
const newSegFl = keepRetain ? segFl | 4 : segFl & ~4;
|
|
@@ -29118,12 +29026,12 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
29118
29026
|
}
|
|
29119
29027
|
subChunks.push(subCopy);
|
|
29120
29028
|
} else if (subId === 6) {
|
|
29121
|
-
let [cnt, cur] =
|
|
29029
|
+
let [cnt, cur] = readULEB(buf, sp);
|
|
29122
29030
|
const entrySlices = [];
|
|
29123
29031
|
for (let i = 0; i < cnt; i++) {
|
|
29124
29032
|
const eStart = cur;
|
|
29125
|
-
const [, s2] =
|
|
29126
|
-
const [symIdx, s3] =
|
|
29033
|
+
const [, s2] = readULEB(buf, cur);
|
|
29034
|
+
const [symIdx, s3] = readULEB(buf, s2);
|
|
29127
29035
|
cur = s3;
|
|
29128
29036
|
if (obj.symKind[symIdx] === 0 && obj.symElemIdx[symIdx] >= obj.numImportFuncs) {
|
|
29129
29037
|
if (fLive[obj.symElemIdx[symIdx] - obj.numImportFuncs] === 1) {
|
|
@@ -29134,19 +29042,19 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
29134
29042
|
}
|
|
29135
29043
|
}
|
|
29136
29044
|
if (entrySlices.length > 0) {
|
|
29137
|
-
const cntBytes = Uint8Array.from(
|
|
29045
|
+
const cntBytes = Uint8Array.from(encodeWasmNumber(entrySlices.length));
|
|
29138
29046
|
const bodyLen = cntBytes.length + entrySlices.reduce((a, b) => a + b.length, 0);
|
|
29139
|
-
const lenBytes = Uint8Array.from(
|
|
29047
|
+
const lenBytes = Uint8Array.from(encodeWasmNumber(bodyLen));
|
|
29140
29048
|
subChunks.push(Uint8Array.of(6), lenBytes, cntBytes);
|
|
29141
29049
|
for (const entry of entrySlices) subChunks.push(entry);
|
|
29142
29050
|
}
|
|
29143
29051
|
} else if (subId === 8) {
|
|
29144
29052
|
const subCopy = new Uint8Array(buf.subarray(subStart, subEnd));
|
|
29145
|
-
let [cnt, cur] =
|
|
29053
|
+
let [cnt, cur] = readULEB(buf, sp);
|
|
29146
29054
|
for (let i = 0; i < cnt; i++) {
|
|
29147
29055
|
const kind = buf[cur++];
|
|
29148
29056
|
const flOffset = cur - subStart;
|
|
29149
|
-
const [fl, c2] =
|
|
29057
|
+
const [fl, c2] = readULEB(buf, cur);
|
|
29150
29058
|
cur = c2;
|
|
29151
29059
|
const isUndef = (fl & 16) !== 0;
|
|
29152
29060
|
const isExplicitName = (fl & 64) !== 0;
|
|
@@ -29166,23 +29074,23 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
29166
29074
|
subCopy[flOffset + 1] = 0;
|
|
29167
29075
|
}
|
|
29168
29076
|
if (kind === 0 || kind === 2 || kind === 4 || kind === 5) {
|
|
29169
|
-
const [, c3] =
|
|
29077
|
+
const [, c3] = readULEB(buf, cur);
|
|
29170
29078
|
cur = c3;
|
|
29171
29079
|
if (!isUndef || isExplicitName) {
|
|
29172
|
-
const [sLen, c4] =
|
|
29080
|
+
const [sLen, c4] = readULEB(buf, cur);
|
|
29173
29081
|
cur = c4 + sLen;
|
|
29174
29082
|
}
|
|
29175
29083
|
} else if (kind === 1) {
|
|
29176
|
-
const [sLen, c3] =
|
|
29084
|
+
const [sLen, c3] = readULEB(buf, cur);
|
|
29177
29085
|
cur = c3 + sLen;
|
|
29178
29086
|
if (!isUndef) {
|
|
29179
|
-
const [, c4] =
|
|
29180
|
-
const [, c5] =
|
|
29181
|
-
const [, c6] =
|
|
29087
|
+
const [, c4] = readULEB(buf, cur);
|
|
29088
|
+
const [, c5] = readULEB(buf, c4);
|
|
29089
|
+
const [, c6] = readULEB(buf, c5);
|
|
29182
29090
|
cur = c6;
|
|
29183
29091
|
}
|
|
29184
29092
|
} else if (kind === 3) {
|
|
29185
|
-
const [, c3] =
|
|
29093
|
+
const [, c3] = readULEB(buf, cur);
|
|
29186
29094
|
cur = c3;
|
|
29187
29095
|
}
|
|
29188
29096
|
}
|
|
@@ -29193,29 +29101,29 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
29193
29101
|
lp = subEnd;
|
|
29194
29102
|
}
|
|
29195
29103
|
const totalSubLen = subChunks.reduce((a, b) => a + b.length, 0);
|
|
29196
|
-
outChunks.push(Uint8Array.of(0), Uint8Array.from(
|
|
29104
|
+
outChunks.push(Uint8Array.of(0), Uint8Array.from(encodeWasmNumber(totalSubLen)));
|
|
29197
29105
|
for (const chunk of subChunks) outChunks.push(chunk);
|
|
29198
29106
|
} else if (name3 === "reloc.CODE") {
|
|
29199
|
-
const [, r1] =
|
|
29107
|
+
const [, r1] = readULEB(buf, cp);
|
|
29200
29108
|
const headerSlice = buf.subarray(p, r1);
|
|
29201
|
-
const cntBytes = Uint8Array.from(
|
|
29109
|
+
const cntBytes = Uint8Array.from(encodeWasmNumber(keptCodeRelocs.length));
|
|
29202
29110
|
const relSlices = keptCodeRelocs.map((i) => relocationBytes(code, i));
|
|
29203
29111
|
const totalLen = headerSlice.length + cntBytes.length + relSlices.reduce((a, b) => a + b.length, 0);
|
|
29204
29112
|
outChunks.push(
|
|
29205
29113
|
Uint8Array.of(0),
|
|
29206
|
-
Uint8Array.from(
|
|
29114
|
+
Uint8Array.from(encodeWasmNumber(totalLen)),
|
|
29207
29115
|
headerSlice,
|
|
29208
29116
|
cntBytes
|
|
29209
29117
|
);
|
|
29210
29118
|
for (const relocation of relSlices) outChunks.push(relocation);
|
|
29211
29119
|
} else if (name3 === "reloc.DATA") {
|
|
29212
|
-
const [, r1] =
|
|
29120
|
+
const [, r1] = readULEB(buf, cp);
|
|
29213
29121
|
const headerSlice = buf.subarray(p, r1);
|
|
29214
|
-
const cntBytes = Uint8Array.from(
|
|
29122
|
+
const cntBytes = Uint8Array.from(encodeWasmNumber(keptDataRelocBytes.length));
|
|
29215
29123
|
const totalLen = headerSlice.length + cntBytes.length + keptDataRelocBytes.reduce((a, b) => a + b.length, 0);
|
|
29216
29124
|
outChunks.push(
|
|
29217
29125
|
Uint8Array.of(0),
|
|
29218
|
-
Uint8Array.from(
|
|
29126
|
+
Uint8Array.from(encodeWasmNumber(totalLen)),
|
|
29219
29127
|
headerSlice,
|
|
29220
29128
|
cntBytes
|
|
29221
29129
|
);
|
|
@@ -29225,15 +29133,15 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
|
|
|
29225
29133
|
const nameBytes = buf.subarray(p, cp);
|
|
29226
29134
|
outChunks.push(
|
|
29227
29135
|
Uint8Array.of(0),
|
|
29228
|
-
Uint8Array.from(
|
|
29136
|
+
Uint8Array.from(encodeWasmNumber(nameBytes.length)),
|
|
29229
29137
|
nameBytes
|
|
29230
29138
|
);
|
|
29231
29139
|
} else if (name3.startsWith("reloc..debug_")) {
|
|
29232
|
-
const [, r1] =
|
|
29140
|
+
const [, r1] = readULEB(buf, cp);
|
|
29233
29141
|
const headerSlice = buf.subarray(p, r1);
|
|
29234
29142
|
outChunks.push(
|
|
29235
29143
|
Uint8Array.of(0),
|
|
29236
|
-
Uint8Array.from(
|
|
29144
|
+
Uint8Array.from(encodeWasmNumber(headerSlice.length + 1)),
|
|
29237
29145
|
headerSlice,
|
|
29238
29146
|
Uint8Array.of(0)
|
|
29239
29147
|
);
|
|
@@ -29363,6 +29271,7 @@ var init_swift_wasm_prune = __esm({
|
|
|
29363
29271
|
init_swift_toolchain();
|
|
29364
29272
|
init_swift_wasm_archive();
|
|
29365
29273
|
init_swiftRuntimeProductContract();
|
|
29274
|
+
init_wasm_binary_sections();
|
|
29366
29275
|
WIDE_DATA_RELOCS = /* @__PURE__ */ new Set([16, 19, 22, 27]);
|
|
29367
29276
|
ROOT_SEG_PREFIXES = [
|
|
29368
29277
|
".init_array",
|
|
@@ -29626,34 +29535,11 @@ var init_nativeWasmContract = __esm({
|
|
|
29626
29535
|
});
|
|
29627
29536
|
|
|
29628
29537
|
// src/swift-guest-image-ledger.ts
|
|
29629
|
-
function readNumber(bytes, position) {
|
|
29630
|
-
if (position < bytes.length) {
|
|
29631
|
-
const first = bytes[position];
|
|
29632
|
-
if (first < 128) return [first, position + 1];
|
|
29633
|
-
}
|
|
29634
|
-
let value = 0;
|
|
29635
|
-
let shift = 0;
|
|
29636
|
-
for (; ; ) {
|
|
29637
|
-
if (position >= bytes.length || shift > 63) throw new Error("invalid wasm integer");
|
|
29638
|
-
const byte = bytes[position++];
|
|
29639
|
-
value += (byte & 127) * 2 ** shift;
|
|
29640
|
-
if (!(byte & 128)) return [value, position];
|
|
29641
|
-
shift += 7;
|
|
29642
|
-
}
|
|
29643
|
-
}
|
|
29644
29538
|
function encodeNumber(value) {
|
|
29645
|
-
|
|
29646
|
-
const bytes = [];
|
|
29647
|
-
do {
|
|
29648
|
-
let byte = value % 128;
|
|
29649
|
-
value = Math.floor(value / 128);
|
|
29650
|
-
if (value) byte |= 128;
|
|
29651
|
-
bytes.push(byte);
|
|
29652
|
-
} while (value);
|
|
29653
|
-
return Buffer.from(bytes);
|
|
29539
|
+
return Buffer.from(encodeWasmNumber(value));
|
|
29654
29540
|
}
|
|
29655
29541
|
function readString(bytes, position) {
|
|
29656
|
-
const [length, start] =
|
|
29542
|
+
const [length, start] = readULEB(bytes, position);
|
|
29657
29543
|
if (start + length > bytes.length) throw new Error("invalid wasm string");
|
|
29658
29544
|
return [
|
|
29659
29545
|
Buffer.from(bytes.buffer, bytes.byteOffset + start, length).toString("utf8"),
|
|
@@ -29979,13 +29865,13 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
29979
29865
|
for (const subsection of subsections) {
|
|
29980
29866
|
if (subsection.kind === 6 && objcLoader !== void 0) {
|
|
29981
29867
|
const content = subsection.parts[0];
|
|
29982
|
-
const [count, entriesStart] =
|
|
29868
|
+
const [count, entriesStart] = readULEB(content, 0);
|
|
29983
29869
|
const initWriter = new ByteWriter(content.length + 16);
|
|
29984
29870
|
initWriter.bytes(content, 0, entriesStart);
|
|
29985
29871
|
let entryStart = entriesStart;
|
|
29986
29872
|
for (let i = 0; i < count; i++) {
|
|
29987
|
-
const [, symbolStart] =
|
|
29988
|
-
const [symbol2, entryEnd] =
|
|
29873
|
+
const [, symbolStart] = readULEB(content, entryStart);
|
|
29874
|
+
const [symbol2, entryEnd] = readULEB(content, symbolStart);
|
|
29989
29875
|
if (symbol2 === objcLoader) {
|
|
29990
29876
|
initWriter.uleb(1);
|
|
29991
29877
|
initWriter.bytes(content, symbolStart, entryEnd);
|
|
@@ -30055,7 +29941,7 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
30055
29941
|
if (position < bytes.length && bytes[position] < 128) {
|
|
30056
29942
|
size2 = bytes[position++];
|
|
30057
29943
|
} else {
|
|
30058
|
-
const [val, next] =
|
|
29944
|
+
const [val, next] = readULEB(bytes, position);
|
|
30059
29945
|
size2 = val;
|
|
30060
29946
|
position = next;
|
|
30061
29947
|
}
|
|
@@ -30811,7 +30697,7 @@ function nameGuestImageAliases(wasm, symbols) {
|
|
|
30811
30697
|
const parts = [wasm.subarray(0, 8)];
|
|
30812
30698
|
let position = 8;
|
|
30813
30699
|
while (position < wasm.length) {
|
|
30814
|
-
const [size2, start] =
|
|
30700
|
+
const [size2, start] = readULEB(wasm, position + 1);
|
|
30815
30701
|
const end = start + size2;
|
|
30816
30702
|
const custom = wasm[position] === 0 ? readString(wasm, start) : void 0;
|
|
30817
30703
|
if (custom?.[0] !== "name") {
|
|
@@ -30822,17 +30708,17 @@ function nameGuestImageAliases(wasm, symbols) {
|
|
|
30822
30708
|
const subsections = [encodedString("name")];
|
|
30823
30709
|
let at = custom[1];
|
|
30824
30710
|
while (at < end) {
|
|
30825
|
-
const [subSize, subStart] =
|
|
30711
|
+
const [subSize, subStart] = readULEB(wasm, at + 1);
|
|
30826
30712
|
const subEnd = subStart + subSize;
|
|
30827
30713
|
if (wasm[at] !== 1) {
|
|
30828
30714
|
subsections.push(wasm.subarray(at, subEnd));
|
|
30829
30715
|
at = subEnd;
|
|
30830
30716
|
continue;
|
|
30831
30717
|
}
|
|
30832
|
-
let [count, cursor] =
|
|
30718
|
+
let [count, cursor] = readULEB(wasm, subStart);
|
|
30833
30719
|
const entries2 = [encodeNumber(count)];
|
|
30834
30720
|
for (; count > 0; count--) {
|
|
30835
|
-
const [index, next] =
|
|
30721
|
+
const [index, next] = readULEB(wasm, cursor);
|
|
30836
30722
|
const [name3, after] = readString(wasm, next);
|
|
30837
30723
|
cursor = after;
|
|
30838
30724
|
const symbol2 = symbols[Number(alias.exec(name3)?.[1] ?? -1)];
|
|
@@ -30856,6 +30742,7 @@ var init_swift_guest_image_ledger = __esm({
|
|
|
30856
30742
|
init_nativeWasmContract();
|
|
30857
30743
|
init_swift_sdk_image_wasm();
|
|
30858
30744
|
init_swiftSdkLinkContract();
|
|
30745
|
+
init_wasm_binary_sections();
|
|
30859
30746
|
ByteWriter = class {
|
|
30860
30747
|
buf;
|
|
30861
30748
|
pos = 0;
|
|
@@ -30876,16 +30763,13 @@ var init_swift_guest_image_ledger = __esm({
|
|
|
30876
30763
|
this.buf[this.pos++] = value;
|
|
30877
30764
|
}
|
|
30878
30765
|
uleb(value) {
|
|
30879
|
-
|
|
30880
|
-
|
|
30881
|
-
|
|
30882
|
-
|
|
30883
|
-
|
|
30884
|
-
|
|
30885
|
-
|
|
30886
|
-
buf[pos++] = byte;
|
|
30887
|
-
} while (value);
|
|
30888
|
-
this.pos = pos;
|
|
30766
|
+
if (value < 128) {
|
|
30767
|
+
this.byte(value);
|
|
30768
|
+
return;
|
|
30769
|
+
}
|
|
30770
|
+
const encoded = encodeWasmNumber(value);
|
|
30771
|
+
this.ensure(encoded.length);
|
|
30772
|
+
for (let i = 0; i < encoded.length; i++) this.buf[this.pos++] = encoded[i];
|
|
30889
30773
|
}
|
|
30890
30774
|
bytes(source, start = 0, end = source.length) {
|
|
30891
30775
|
const len = end - start;
|
|
@@ -31237,13 +31121,6 @@ function sha256Buffer(bytes) {
|
|
|
31237
31121
|
return Buffer.from(new Bun.CryptoHasher("sha256").update(bytes).digest());
|
|
31238
31122
|
return (0, import_node_crypto29.createHash)("sha256").update(bytes).digest();
|
|
31239
31123
|
}
|
|
31240
|
-
function uleb2(value) {
|
|
31241
|
-
const bytes = [];
|
|
31242
|
-
for (let rest = value; ; rest = Math.floor(rest / 128)) {
|
|
31243
|
-
if (rest < 128) return [...bytes, rest];
|
|
31244
|
-
bytes.push(rest % 128 | 128);
|
|
31245
|
-
}
|
|
31246
|
-
}
|
|
31247
31124
|
function encodeGuestDyldTable(rows) {
|
|
31248
31125
|
const encoded = rows.map((row) => ({ ...row, bytes: Buffer.from(row.name) })).sort((a, b) => Buffer.compare(a.bytes, b.bytes));
|
|
31249
31126
|
const packs = [];
|
|
@@ -31256,7 +31133,7 @@ function encodeGuestDyldTable(rows) {
|
|
|
31256
31133
|
value.writeBigUInt64LE(row.value);
|
|
31257
31134
|
const bytes = Buffer.concat([
|
|
31258
31135
|
row.bytes,
|
|
31259
|
-
Buffer.from([0, ...
|
|
31136
|
+
Buffer.from([0, ...encodeWasmNumber(row.image), row.kind]),
|
|
31260
31137
|
value
|
|
31261
31138
|
]);
|
|
31262
31139
|
if (!current2.length) firsts.push(row.bytes);
|
|
@@ -31348,6 +31225,7 @@ var init_swift_guest_dyld_table = __esm({
|
|
|
31348
31225
|
init_sha256();
|
|
31349
31226
|
init_swift_guest_image_ledger();
|
|
31350
31227
|
init_swift_guest_linked_spans();
|
|
31228
|
+
init_wasm_binary_sections();
|
|
31351
31229
|
init_wasm_narrow_boundary();
|
|
31352
31230
|
PACK_BYTES = 64 * 1024;
|
|
31353
31231
|
}
|
|
@@ -31423,8 +31301,8 @@ function readImports2(bytes, sections) {
|
|
|
31423
31301
|
return { functions, table64 };
|
|
31424
31302
|
}
|
|
31425
31303
|
function vectorSection(id, count, parts) {
|
|
31426
|
-
const body = Buffer.concat([Buffer.from(
|
|
31427
|
-
return Buffer.concat([Buffer.from([id, ...
|
|
31304
|
+
const body = Buffer.concat([Buffer.from(encodeWasmNumber(count)), ...parts]);
|
|
31305
|
+
return Buffer.concat([Buffer.from([id, ...encodeWasmNumber(body.length)]), body]);
|
|
31428
31306
|
}
|
|
31429
31307
|
function rewriteSections(bytes, sections, changes) {
|
|
31430
31308
|
const out = [bytes.subarray(0, 8)];
|
|
@@ -31480,9 +31358,9 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
31480
31358
|
vectorSection(2, count + 1, [
|
|
31481
31359
|
found && header ? bytes.subarray(header.at, found.end) : new Uint8Array(),
|
|
31482
31360
|
Buffer.from([
|
|
31483
|
-
...
|
|
31361
|
+
...encodeWasmNumber(module2.length),
|
|
31484
31362
|
...module2,
|
|
31485
|
-
...
|
|
31363
|
+
...encodeWasmNumber(name4.length),
|
|
31486
31364
|
...name4,
|
|
31487
31365
|
1,
|
|
31488
31366
|
112,
|
|
@@ -31504,7 +31382,7 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
31504
31382
|
elements.splice(
|
|
31505
31383
|
placementIndex,
|
|
31506
31384
|
0,
|
|
31507
|
-
Buffer.from([1, 0, ...
|
|
31385
|
+
Buffer.from([1, 0, ...encodeWasmNumber(functions.length), ...functions.flatMap(encodeWasmNumber)])
|
|
31508
31386
|
);
|
|
31509
31387
|
const place2 = imports2.functions + declared.length;
|
|
31510
31388
|
const instructions = [
|
|
@@ -31518,7 +31396,7 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
31518
31396
|
1,
|
|
31519
31397
|
252,
|
|
31520
31398
|
12,
|
|
31521
|
-
...
|
|
31399
|
+
...encodeWasmNumber(placementIndex),
|
|
31522
31400
|
0,
|
|
31523
31401
|
11
|
|
31524
31402
|
];
|
|
@@ -31539,14 +31417,14 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
31539
31417
|
3,
|
|
31540
31418
|
vectorSection(3, declared.length + 1, [
|
|
31541
31419
|
...declared,
|
|
31542
|
-
Buffer.from(
|
|
31420
|
+
Buffer.from(encodeWasmNumber(types2.length))
|
|
31543
31421
|
])
|
|
31544
31422
|
],
|
|
31545
31423
|
[
|
|
31546
31424
|
7,
|
|
31547
31425
|
vectorSection(7, exports2.length + 1, [
|
|
31548
31426
|
...exports2,
|
|
31549
|
-
Buffer.from([...
|
|
31427
|
+
Buffer.from([...encodeWasmNumber(name3.length), ...name3, 0, ...encodeWasmNumber(place2)])
|
|
31550
31428
|
])
|
|
31551
31429
|
],
|
|
31552
31430
|
[9, vectorSection(9, elements.length, elements)],
|
|
@@ -31554,7 +31432,7 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
31554
31432
|
10,
|
|
31555
31433
|
vectorSection(10, bodies.length + 1, [
|
|
31556
31434
|
...bodies,
|
|
31557
|
-
Buffer.from([...
|
|
31435
|
+
Buffer.from([...encodeWasmNumber(instructions.length), ...instructions])
|
|
31558
31436
|
])
|
|
31559
31437
|
]
|
|
31560
31438
|
])
|
|
@@ -31607,22 +31485,13 @@ function placeGuestLazyFunctions(bytes, lazy) {
|
|
|
31607
31485
|
function guestLazyExports(lazy) {
|
|
31608
31486
|
return lazy.map((name3) => JSON.stringify(`--export=${name3}`)).join("\n");
|
|
31609
31487
|
}
|
|
31610
|
-
var
|
|
31488
|
+
var SECTION_ORDER, readExport, lastTableElement;
|
|
31611
31489
|
var init_swift_guest_dyld_functions = __esm({
|
|
31612
31490
|
"src/swift-guest-dyld-functions.ts"() {
|
|
31613
31491
|
"use strict";
|
|
31614
31492
|
init_nativeWasmContract();
|
|
31615
31493
|
init_swift_sdk_image_wasm();
|
|
31616
|
-
|
|
31617
|
-
const out = [];
|
|
31618
|
-
do {
|
|
31619
|
-
let byte = value % 128;
|
|
31620
|
-
value = Math.floor(value / 128);
|
|
31621
|
-
if (value) byte |= 128;
|
|
31622
|
-
out.push(byte);
|
|
31623
|
-
} while (value);
|
|
31624
|
-
return out;
|
|
31625
|
-
};
|
|
31494
|
+
init_wasm_binary_sections();
|
|
31626
31495
|
SECTION_ORDER = [1, 2, 3, 4, 5, 13, 6, 7, 8, 9, 12, 10, 11];
|
|
31627
31496
|
readExport = (r) => {
|
|
31628
31497
|
r.name();
|
|
@@ -34947,30 +34816,12 @@ function wasmAutolinkEntries(bytes, out) {
|
|
|
34947
34816
|
const len = bytes.length;
|
|
34948
34817
|
while (pos < len) {
|
|
34949
34818
|
const id = bytes[pos++];
|
|
34950
|
-
let sz
|
|
34951
|
-
|
|
34952
|
-
sz &= 127;
|
|
34953
|
-
let shift = 7;
|
|
34954
|
-
while (true) {
|
|
34955
|
-
const b = bytes[pos++];
|
|
34956
|
-
sz |= (b & 127) << shift;
|
|
34957
|
-
if (b < 128) break;
|
|
34958
|
-
shift += 7;
|
|
34959
|
-
}
|
|
34960
|
-
}
|
|
34819
|
+
let sz;
|
|
34820
|
+
[sz, pos] = readULEB(bytes, pos, len);
|
|
34961
34821
|
const end = pos + sz;
|
|
34962
34822
|
if (id === 0) {
|
|
34963
|
-
let nLen
|
|
34964
|
-
|
|
34965
|
-
nLen &= 127;
|
|
34966
|
-
let shift = 7;
|
|
34967
|
-
while (true) {
|
|
34968
|
-
const b = bytes[pos++];
|
|
34969
|
-
nLen |= (b & 127) << shift;
|
|
34970
|
-
if (b < 128) break;
|
|
34971
|
-
shift += 7;
|
|
34972
|
-
}
|
|
34973
|
-
}
|
|
34823
|
+
let nLen;
|
|
34824
|
+
[nLen, pos] = readULEB(bytes, pos, end);
|
|
34974
34825
|
if (nLen === 24 && raw2.toString("ascii", pos, pos + 24) === ".swift1_autolink_entries") {
|
|
34975
34826
|
const payload = raw2.toString("utf8", pos + 24, end);
|
|
34976
34827
|
for (const entry of payload.split("\0")) {
|
|
@@ -35207,6 +35058,7 @@ var init_swift_guest_source_inputs = __esm({
|
|
|
35207
35058
|
init_swift_guest_source_plan();
|
|
35208
35059
|
init_swift_runtime_products();
|
|
35209
35060
|
init_swift_wasm_prune();
|
|
35061
|
+
init_wasm_binary_sections();
|
|
35210
35062
|
CLANG_TARGET_MODULE_WRAPPER = ".peach-clang";
|
|
35211
35063
|
PARALLEL_REPLAY = `
|
|
35212
35064
|
const { spawn } = require('node:child_process')
|
|
@@ -37509,6 +37361,7 @@ function swiftModuleInputFiles(root) {
|
|
|
37509
37361
|
...swiftSharedSdkInputFiles(root),
|
|
37510
37362
|
"../peachsim/src/admitted-mac-build.ts",
|
|
37511
37363
|
"../peachsim/src/swift-shared-sdk.ts",
|
|
37364
|
+
"../peachsim/src/wasm-binary-sections.ts",
|
|
37512
37365
|
"../peachsim/src/swift-runtime-products.ts",
|
|
37513
37366
|
"../peachsim/src/swiftRuntimeProductContract.ts",
|
|
37514
37367
|
"../peachsim/src/swiftTargetContract.ts",
|
|
@@ -41240,8 +41093,8 @@ function finishSwiftAppModuleFile(file) {
|
|
|
41240
41093
|
return;
|
|
41241
41094
|
}
|
|
41242
41095
|
const thunks = sdkImportThunks(prefix);
|
|
41243
|
-
const nameBytes = Buffer.from(
|
|
41244
|
-
const header = Buffer.from([0, ...
|
|
41096
|
+
const nameBytes = Buffer.from(encodeWasmName(NATIVE_SDK_THUNK_SECTION));
|
|
41097
|
+
const header = Buffer.from([0, ...encodeWasmNumber(nameBytes.length + thunks.length)]);
|
|
41245
41098
|
(0, import_node_fs61.appendFileSync)(file, Buffer.concat([header, nameBytes, thunks]));
|
|
41246
41099
|
}
|
|
41247
41100
|
function swiftAppModuleInputs(tokens2, buildRoot, sdkLibraries) {
|
|
@@ -41593,17 +41446,17 @@ function sdkImportThunks(bytes) {
|
|
|
41593
41446
|
for (const { type } of imports2)
|
|
41594
41447
|
if (!typeIndex.has(type)) typeIndex.set(type, typeIndex.size + 1);
|
|
41595
41448
|
const loaderType = [96, 1, 127, 0];
|
|
41596
|
-
const vector = (items2) => [...
|
|
41597
|
-
const sectionBytes = (id, body) => [id, ...
|
|
41449
|
+
const vector = (items2) => [...encodeWasmNumber(items2.length), ...items2.flat()];
|
|
41450
|
+
const sectionBytes = (id, body) => [id, ...encodeWasmNumber(body.length), ...body];
|
|
41598
41451
|
const slotGlobals = imports2.map(({ slot }) => [
|
|
41599
|
-
...
|
|
41600
|
-
...
|
|
41452
|
+
...encodeWasmName(NATIVE_SDK_IMPORT_MODULE),
|
|
41453
|
+
...encodeWasmName(String(slot)),
|
|
41601
41454
|
3,
|
|
41602
41455
|
127,
|
|
41603
41456
|
0
|
|
41604
41457
|
]);
|
|
41605
41458
|
const bodies = imports2.map(({ type }, index) => {
|
|
41606
|
-
const slotValue = [35, ...
|
|
41459
|
+
const slotValue = [35, ...encodeWasmNumber(index)];
|
|
41607
41460
|
const code = [
|
|
41608
41461
|
0,
|
|
41609
41462
|
...slotValue,
|
|
@@ -41616,14 +41469,14 @@ function sdkImportThunks(bytes) {
|
|
|
41616
41469
|
16,
|
|
41617
41470
|
0,
|
|
41618
41471
|
11,
|
|
41619
|
-
...Array.from({ length: params[type] }, (_, i) => [32, ...
|
|
41472
|
+
...Array.from({ length: params[type] }, (_, i) => [32, ...encodeWasmNumber(i)]).flat(),
|
|
41620
41473
|
...slotValue,
|
|
41621
41474
|
17,
|
|
41622
|
-
...
|
|
41475
|
+
...encodeWasmNumber(typeIndex.get(type)),
|
|
41623
41476
|
0,
|
|
41624
41477
|
11
|
|
41625
41478
|
];
|
|
41626
|
-
return [...
|
|
41479
|
+
return [...encodeWasmNumber(code.length), ...code];
|
|
41627
41480
|
});
|
|
41628
41481
|
return Uint8Array.from([
|
|
41629
41482
|
0,
|
|
@@ -41641,21 +41494,21 @@ function sdkImportThunks(bytes) {
|
|
|
41641
41494
|
...sectionBytes(
|
|
41642
41495
|
2,
|
|
41643
41496
|
vector([
|
|
41644
|
-
[...
|
|
41497
|
+
[...encodeWasmName("env"), ...encodeWasmName("__indirect_function_table"), 1, ...table],
|
|
41645
41498
|
[
|
|
41646
|
-
...
|
|
41647
|
-
...
|
|
41499
|
+
...encodeWasmName(NATIVE_LAZY_IMPORT_MODULE),
|
|
41500
|
+
...encodeWasmName(NATIVE_LAZY_SLOT_IMPORT),
|
|
41648
41501
|
0,
|
|
41649
41502
|
0
|
|
41650
41503
|
],
|
|
41651
41504
|
...slotGlobals
|
|
41652
41505
|
])
|
|
41653
41506
|
),
|
|
41654
|
-
...sectionBytes(3, vector(imports2.map(({ type }) =>
|
|
41507
|
+
...sectionBytes(3, vector(imports2.map(({ type }) => encodeWasmNumber(typeIndex.get(type))))),
|
|
41655
41508
|
...sectionBytes(
|
|
41656
41509
|
7,
|
|
41657
41510
|
vector(
|
|
41658
|
-
imports2.map(({ slot }, i) => [...
|
|
41511
|
+
imports2.map(({ slot }, i) => [...encodeWasmName(String(slot)), 0, ...encodeWasmNumber(i + 1)])
|
|
41659
41512
|
)
|
|
41660
41513
|
),
|
|
41661
41514
|
...sectionBytes(10, vector(bodies))
|
|
@@ -41775,7 +41628,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
41775
41628
|
syntheticGlobals.push(type);
|
|
41776
41629
|
got.set(index, value);
|
|
41777
41630
|
}
|
|
41778
|
-
return [35, ...
|
|
41631
|
+
return [35, ...encodeWasmNumber(index)];
|
|
41779
41632
|
};
|
|
41780
41633
|
const tlsHelpers = new Map(
|
|
41781
41634
|
symbols.filter((symbol2) => symbol2.kind === 0 && symbol2.name.startsWith(SDK_TLS_HELPER)).map((symbol2) => [symbol2.name.slice(SDK_TLS_HELPER.length), symbol2.index])
|
|
@@ -41827,7 +41680,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
41827
41680
|
const code = [16];
|
|
41828
41681
|
for (let i = 0, rest = helper; i < 5; i++, rest >>>= 7)
|
|
41829
41682
|
code.push(i < 4 ? rest & 127 | 128 : rest & 127);
|
|
41830
|
-
if (addend) code.push(66, ...
|
|
41683
|
+
if (addend) code.push(66, ...encodeWasmSigned(addend), 124);
|
|
41831
41684
|
patchCode(at2, 11, code);
|
|
41832
41685
|
continue;
|
|
41833
41686
|
}
|
|
@@ -41901,7 +41754,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
41901
41754
|
syntheticGlobals.push(valueType);
|
|
41902
41755
|
scratchGlobals.set(valueType, scratch2);
|
|
41903
41756
|
}
|
|
41904
|
-
const index =
|
|
41757
|
+
const index = encodeWasmNumber(scratch2);
|
|
41905
41758
|
patchCode(at - 2, 12, [
|
|
41906
41759
|
36,
|
|
41907
41760
|
...index,
|
|
@@ -41917,7 +41770,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
41917
41770
|
}
|
|
41918
41771
|
const encodedNameBuf = (name3) => {
|
|
41919
41772
|
const raw2 = Buffer.from(name3, "utf8");
|
|
41920
|
-
const len =
|
|
41773
|
+
const len = encodeWasmNumber(raw2.length);
|
|
41921
41774
|
const out = Buffer.allocUnsafe(len.length + raw2.length);
|
|
41922
41775
|
for (let i = 0; i < len.length; i++) out[i] = len[i];
|
|
41923
41776
|
raw2.copy(out, len.length);
|
|
@@ -41962,7 +41815,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
41962
41815
|
}
|
|
41963
41816
|
}
|
|
41964
41817
|
const globalParts = [
|
|
41965
|
-
Buffer.from(
|
|
41818
|
+
Buffer.from(encodeWasmNumber(globalCount - 1 + syntheticGlobals.length))
|
|
41966
41819
|
];
|
|
41967
41820
|
for (let index = 0; index < globalCount; index++) {
|
|
41968
41821
|
const start = gr.at;
|
|
@@ -42007,18 +41860,18 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
42007
41860
|
}
|
|
42008
41861
|
}
|
|
42009
41862
|
const exportParts = [
|
|
42010
|
-
Buffer.from(
|
|
41863
|
+
Buffer.from(encodeWasmNumber(exportCount + 1 + got.size)),
|
|
42011
41864
|
bytes.subarray(originalExportsStart, exportSection.end)
|
|
42012
41865
|
];
|
|
42013
41866
|
for (const [index, value] of got) {
|
|
42014
41867
|
exportParts.push(
|
|
42015
41868
|
encodedNameBuf(`${NATIVE_SDK_GLOBAL_PREFIX}${value}.${index}`),
|
|
42016
|
-
Buffer.from([3, ...
|
|
41869
|
+
Buffer.from([3, ...encodeWasmNumber(index)])
|
|
42017
41870
|
);
|
|
42018
41871
|
}
|
|
42019
41872
|
exportParts.push(encodedNameBuf("__indirect_function_table"), Buffer.from([1, 0]));
|
|
42020
41873
|
const replaced = /* @__PURE__ */ new Map([
|
|
42021
|
-
[2, Buffer.concat([Buffer.from(
|
|
41874
|
+
[2, Buffer.concat([Buffer.from(encodeWasmNumber(importEntryCount)), ...importParts])],
|
|
42022
41875
|
[6, Buffer.concat(globalParts)],
|
|
42023
41876
|
[7, Buffer.concat(exportParts)]
|
|
42024
41877
|
]);
|
|
@@ -42035,7 +41888,7 @@ function resolveSdkReferences(source, sdk2, forwarders) {
|
|
|
42035
41888
|
if (s.id === 10 && rebuiltCode) {
|
|
42036
41889
|
parts.push(rebuiltCode);
|
|
42037
41890
|
} else if (payload) {
|
|
42038
|
-
parts.push(Buffer.from([s.id, ...
|
|
41891
|
+
parts.push(Buffer.from([s.id, ...encodeWasmNumber(payload.length)]), payload);
|
|
42039
41892
|
} else {
|
|
42040
41893
|
parts.push(bytes.subarray(s.offset, s.end));
|
|
42041
41894
|
}
|
|
@@ -42051,7 +41904,7 @@ function expandSdkRelocations(bytes, section2, patches) {
|
|
|
42051
41904
|
patches.sort((a, b) => a.at - b.at);
|
|
42052
41905
|
const r = wasmReader(bytes, section2.start);
|
|
42053
41906
|
const count = r.u();
|
|
42054
|
-
const payload = [Uint8Array.from(
|
|
41907
|
+
const payload = [Uint8Array.from(encodeWasmNumber(count))];
|
|
42055
41908
|
let next = 0;
|
|
42056
41909
|
for (let i = 0; i < count; i++) {
|
|
42057
41910
|
const start = r.at;
|
|
@@ -42071,7 +41924,7 @@ function expandSdkRelocations(bytes, section2, patches) {
|
|
|
42071
41924
|
}
|
|
42072
41925
|
parts.push(bytes.subarray(at, end));
|
|
42073
41926
|
payload.push(
|
|
42074
|
-
Uint8Array.from(
|
|
41927
|
+
Uint8Array.from(encodeWasmNumber(parts.reduce((size3, part) => size3 + part.length, 0))),
|
|
42075
41928
|
...parts
|
|
42076
41929
|
);
|
|
42077
41930
|
}
|
|
@@ -42080,7 +41933,7 @@ function expandSdkRelocations(bytes, section2, patches) {
|
|
|
42080
41933
|
if (next !== patches.length || r.at !== section2.end)
|
|
42081
41934
|
throw new Error("Swift SDK code relocations exceed the code section");
|
|
42082
41935
|
return Buffer.concat([
|
|
42083
|
-
Uint8Array.from([10, ...
|
|
41936
|
+
Uint8Array.from([10, ...encodeWasmNumber(payload.reduce((size2, part) => size2 + part.length, 0))]),
|
|
42084
41937
|
...payload
|
|
42085
41938
|
]);
|
|
42086
41939
|
}
|
|
@@ -42772,7 +42625,7 @@ function partitionParent(section2) {
|
|
|
42772
42625
|
"__objc_class_refs"
|
|
42773
42626
|
].find((name3) => section2 === name3 || section2.startsWith(`${name3}.`));
|
|
42774
42627
|
}
|
|
42775
|
-
var import_node_child_process35, import_node_crypto40, import_node_fs61, import_node_path59, import_node_util11, import_node_zlib4, run5, RELOCATION_WIDTHS, GLOBAL_INDEX, TLS_SLEB64, SDK_TLS_HELPER, SDK_TLS_DELTA, OBJC_SECTION_BOUNDARY,
|
|
42628
|
+
var import_node_child_process35, import_node_crypto40, import_node_fs61, import_node_path59, import_node_util11, import_node_zlib4, run5, RELOCATION_WIDTHS, GLOBAL_INDEX, TLS_SLEB64, SDK_TLS_HELPER, SDK_TLS_DELTA, OBJC_SECTION_BOUNDARY, SCANNED, RUN_GAP;
|
|
42776
42629
|
var init_swift_sdk_app_module = __esm({
|
|
42777
42630
|
"src/swift-sdk-app-module.ts"() {
|
|
42778
42631
|
"use strict";
|
|
@@ -42795,6 +42648,7 @@ var init_swift_sdk_app_module = __esm({
|
|
|
42795
42648
|
init_swift_wasm_prune();
|
|
42796
42649
|
init_swiftSdkLinkContract();
|
|
42797
42650
|
init_swiftTargetContract();
|
|
42651
|
+
init_wasm_binary_sections();
|
|
42798
42652
|
init_wasm_narrow_boundary();
|
|
42799
42653
|
init_wasm_optimize();
|
|
42800
42654
|
run5 = (0, import_node_util11.promisify)(import_node_child_process35.execFile);
|
|
@@ -42815,32 +42669,6 @@ var init_swift_sdk_app_module = __esm({
|
|
|
42815
42669
|
SDK_TLS_HELPER = "__peach_sdk_tls.";
|
|
42816
42670
|
SDK_TLS_DELTA = "__peach_sdk_tls_delta.";
|
|
42817
42671
|
OBJC_SECTION_BOUNDARY = /^__(?:start|stop)_(__objc_(?:selectors|classes|class_refs|cats|protocols|protocol_refs|class_aliases|constant_string))$/;
|
|
42818
|
-
uleb4 = (value) => {
|
|
42819
|
-
const out = [];
|
|
42820
|
-
do {
|
|
42821
|
-
let byte = value % 128;
|
|
42822
|
-
value = Math.floor(value / 128);
|
|
42823
|
-
if (value) byte |= 128;
|
|
42824
|
-
out.push(byte);
|
|
42825
|
-
} while (value);
|
|
42826
|
-
return out;
|
|
42827
|
-
};
|
|
42828
|
-
sleb2 = (value) => {
|
|
42829
|
-
const out = [];
|
|
42830
|
-
for (; ; ) {
|
|
42831
|
-
const byte = Number(value & 127n);
|
|
42832
|
-
value >>= 7n;
|
|
42833
|
-
if (value === 0n && !(byte & 64) || value === -1n && byte & 64) {
|
|
42834
|
-
out.push(byte);
|
|
42835
|
-
return out;
|
|
42836
|
-
}
|
|
42837
|
-
out.push(byte | 128);
|
|
42838
|
-
}
|
|
42839
|
-
};
|
|
42840
|
-
encodedName2 = (name3) => {
|
|
42841
|
-
const bytes = [...Buffer.from(name3)];
|
|
42842
|
-
return [...uleb4(bytes.length), ...bytes];
|
|
42843
|
-
};
|
|
42844
42672
|
SCANNED = /* @__PURE__ */ new Set([
|
|
42845
42673
|
"swift5_protocols",
|
|
42846
42674
|
"swift5_protocol_conformances",
|
|
@@ -43931,36 +43759,22 @@ function archiveMember(archive, name3) {
|
|
|
43931
43759
|
throw new Error(`swift-icu: ${name3} is not in the sdk's icu archive`);
|
|
43932
43760
|
}
|
|
43933
43761
|
function icuSegment(object8) {
|
|
43934
|
-
let at = 8;
|
|
43935
|
-
const leb2 = () => {
|
|
43936
|
-
let result = 0;
|
|
43937
|
-
let shift = 0;
|
|
43938
|
-
let byte;
|
|
43939
|
-
do {
|
|
43940
|
-
byte = object8[at++];
|
|
43941
|
-
result += (byte & 127) * 2 ** shift;
|
|
43942
|
-
shift += 7;
|
|
43943
|
-
} while (byte & 128);
|
|
43944
|
-
return result;
|
|
43945
|
-
};
|
|
43946
43762
|
const found = [];
|
|
43947
|
-
|
|
43948
|
-
|
|
43949
|
-
const
|
|
43950
|
-
|
|
43951
|
-
|
|
43952
|
-
|
|
43953
|
-
|
|
43954
|
-
|
|
43955
|
-
|
|
43956
|
-
|
|
43957
|
-
|
|
43958
|
-
|
|
43959
|
-
|
|
43960
|
-
|
|
43961
|
-
}
|
|
43763
|
+
for (const section2 of wasmSections(object8)) {
|
|
43764
|
+
if (section2.id !== 11) continue;
|
|
43765
|
+
const reader = readWasmSection(object8, section2.start, section2.end);
|
|
43766
|
+
for (let count = reader.number(); count > 0; count--) {
|
|
43767
|
+
if (reader.number() !== 0)
|
|
43768
|
+
throw new Error("swift-icu: unexpected data segment kind");
|
|
43769
|
+
reader.byte();
|
|
43770
|
+
reader.number();
|
|
43771
|
+
reader.byte();
|
|
43772
|
+
const length = reader.number();
|
|
43773
|
+
const start = reader.position();
|
|
43774
|
+
const bytes = object8.subarray(start, start + length);
|
|
43775
|
+
if (bytes[2] === 218 && bytes[3] === 39) found.push(bytes);
|
|
43776
|
+
reader.skip(length);
|
|
43962
43777
|
}
|
|
43963
|
-
at = end;
|
|
43964
43778
|
}
|
|
43965
43779
|
if (found.length !== 1)
|
|
43966
43780
|
throw new Error(`swift-icu: expected one icu data segment, found ${found.length}`);
|
|
@@ -44014,6 +43828,7 @@ var init_swift_icu = __esm({
|
|
|
44014
43828
|
init_icuData();
|
|
44015
43829
|
init_swift_toolchain();
|
|
44016
43830
|
init_swiftTargetContract();
|
|
43831
|
+
init_wasm_binary_sections();
|
|
44017
43832
|
run6 = (0, import_node_util12.promisify)(import_node_child_process37.execFile);
|
|
44018
43833
|
deflate = (0, import_node_util12.promisify)(import_node_zlib5.gzip);
|
|
44019
43834
|
compressBrotli = (0, import_node_util12.promisify)(import_node_zlib5.brotliCompress);
|
|
@@ -50719,7 +50534,7 @@ ${wasmThreadLinkFlags.map((flag) => ` "-Xlinker", ${JSON.stringify(flag
|
|
|
50719
50534
|
REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
50720
50535
|
MULTI_MANIFEST_VERSION = 76;
|
|
50721
50536
|
SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
50722
|
-
compilerSourceDigest = true ? "
|
|
50537
|
+
compilerSourceDigest = true ? "05ea8272883560029dae1c9aef2497d3f4d9e0d3418ef288c47c562673f5ba19" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
50723
50538
|
nativeCxxCompilerFlags = ["-fno-cxx-modules"];
|
|
50724
50539
|
MODULE_MAP_RESPONSE_FILE_RUN = 16;
|
|
50725
50540
|
cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
|
|
@@ -106096,7 +105911,7 @@ var init_nitro_superset = __esm({
|
|
|
106096
105911
|
init_nitroContract();
|
|
106097
105912
|
init_swift_standin_digest();
|
|
106098
105913
|
NITRO_SUPERSET_ENTRY_NAME = "superset";
|
|
106099
|
-
NITRO_COMPILER_DIGEST = true ? "
|
|
105914
|
+
NITRO_COMPILER_DIGEST = true ? "4a3a6b72ce59c3936e7aa74be126ecd9fae095591d2808e5f7a2cad75c921084" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
|
|
106100
105915
|
nitroSupersetLock = parseLock(nitro_superset_lock_default);
|
|
106101
105916
|
nitroSupersetKey = (inputs2) => nativeEntryKey({ ...inputs2, compiler: NITRO_COMPILER_DIGEST });
|
|
106102
105917
|
published2 = /* @__PURE__ */ new Map();
|