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,10 +1,10 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2779 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
acquireSwiftRootReadHold,
|
|
4
4
|
hasLiveSwiftRootReaders,
|
|
5
5
|
retainSwiftRootReadHold,
|
|
6
6
|
withSwiftRootLock
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KOULWLTF.mjs";
|
|
8
8
|
import {
|
|
9
9
|
CORE_FOUNDATION_OVERLAY_GLOBALS,
|
|
10
10
|
NATIVE_GRAPH_SDK_VERSION,
|
|
@@ -20,6 +20,9 @@ import {
|
|
|
20
20
|
clearCaseInsensitiveHeaderOverlayCache,
|
|
21
21
|
clearSwiftSdkPathsCache,
|
|
22
22
|
emptyMacroEnvironment,
|
|
23
|
+
encodeWasmName,
|
|
24
|
+
encodeWasmNumber,
|
|
25
|
+
encodeWasmSigned,
|
|
23
26
|
foundationOwnerOf,
|
|
24
27
|
installVerifiedTarball,
|
|
25
28
|
iosDeploymentMinimum,
|
|
@@ -27,9 +30,13 @@ import {
|
|
|
27
30
|
nativelyDeclaredFunctions,
|
|
28
31
|
objcEnumerations,
|
|
29
32
|
objcSdkIntakeFlags,
|
|
33
|
+
readSLEB,
|
|
34
|
+
readULEB,
|
|
35
|
+
readWasmSection,
|
|
30
36
|
rnxHomeDir,
|
|
31
37
|
sdkObjCDeclarationOwners,
|
|
32
38
|
sha256Hex,
|
|
39
|
+
skipLEB,
|
|
33
40
|
stripCCode,
|
|
34
41
|
swiftBuildJobs,
|
|
35
42
|
swiftCodeMask,
|
|
@@ -54,12 +61,13 @@ import {
|
|
|
54
61
|
swiftSharedSdkRoot,
|
|
55
62
|
swiftSharedSdkViewOptions,
|
|
56
63
|
wasmMacroEnvironment,
|
|
64
|
+
wasmSections,
|
|
57
65
|
weakenFoundationOverridesInArchive,
|
|
58
66
|
withFrameworkCompanionImports,
|
|
59
67
|
withoutImportedSdkEnumForwards,
|
|
60
68
|
withoutSwiftDeclarations,
|
|
61
69
|
writeBuildFile
|
|
62
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-6BNEOOBT.mjs";
|
|
63
71
|
import {
|
|
64
72
|
SWIFT_AUTOLINK_LINKER,
|
|
65
73
|
SWIFT_CACHE_HOLD_MARKER,
|
|
@@ -76,7 +84,7 @@ import {
|
|
|
76
84
|
wasmThreadLinkFlags,
|
|
77
85
|
windowAdmission,
|
|
78
86
|
writeSwiftAutolinkLinker
|
|
79
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-HWK2V6R4.mjs";
|
|
80
88
|
import {
|
|
81
89
|
SWIFT_BINARY_TREES_DIR,
|
|
82
90
|
SWIFT_NATIVE_INPUT_ROOT,
|
|
@@ -91,7 +99,7 @@ import {
|
|
|
91
99
|
isSwiftResourcePath,
|
|
92
100
|
isSwiftSourceLinkGraph,
|
|
93
101
|
swiftProjectFilesProblems
|
|
94
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-UBM772FD.mjs";
|
|
95
103
|
import {
|
|
96
104
|
OBJC_RESOURCE_ACCESSOR_BODY,
|
|
97
105
|
OBJC_RESOURCE_ACCESSOR_HEADER,
|
|
@@ -114,16 +122,16 @@ import {
|
|
|
114
122
|
swiftPackagePartition,
|
|
115
123
|
swiftTargetModuleName,
|
|
116
124
|
withoutGlogModuleMap
|
|
117
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-T7DTXCV5.mjs";
|
|
118
126
|
import {
|
|
119
127
|
rnxPublicBrand
|
|
120
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-SNMGOZXQ.mjs";
|
|
121
129
|
import {
|
|
122
130
|
isRecord
|
|
123
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-VJSHIZ7J.mjs";
|
|
124
132
|
import {
|
|
125
133
|
__publicField
|
|
126
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-LVEDBGWX.mjs";
|
|
127
135
|
|
|
128
136
|
// src/swift-compile.ts
|
|
129
137
|
import {
|
|
@@ -2889,6 +2897,7 @@ var SWIFT_DIGEST_SOURCES = [
|
|
|
2889
2897
|
"swift-objc-prebuilt-catalog.ts",
|
|
2890
2898
|
"swift-toolchain.ts",
|
|
2891
2899
|
"swift-shared-sdk.ts",
|
|
2900
|
+
"wasm-binary-sections.ts",
|
|
2892
2901
|
"swift-distribution-mirror.ts",
|
|
2893
2902
|
"swift-design-time.ts",
|
|
2894
2903
|
"binaryen.lock.json",
|
|
@@ -4180,14 +4189,9 @@ import fs from "node:fs";
|
|
|
4180
4189
|
import path6 from "node:path";
|
|
4181
4190
|
var OBJC_RUNTIME_LOOKUP_SECTION = "peach_objc_runtime_lookup";
|
|
4182
4191
|
var leb = (bytes, at) => {
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
const byte = bytes[at.offset++];
|
|
4187
|
-
value += (byte & 127) * scale;
|
|
4188
|
-
if (!(byte & 128)) return value;
|
|
4189
|
-
scale *= 128;
|
|
4190
|
-
}
|
|
4192
|
+
const [value, next] = readULEB(bytes, at.offset);
|
|
4193
|
+
at.offset = next;
|
|
4194
|
+
return value;
|
|
4191
4195
|
};
|
|
4192
4196
|
function objcRootInfo(bytes) {
|
|
4193
4197
|
const at = { offset: 8 };
|
|
@@ -5093,63 +5097,6 @@ function takeGuestStartupData(wasm, address, length) {
|
|
|
5093
5097
|
return { wasm: Buffer.concat(parts), bytes };
|
|
5094
5098
|
}
|
|
5095
5099
|
|
|
5096
|
-
// src/wasm-binary-sections.ts
|
|
5097
|
-
function encodeWasmNumber(value) {
|
|
5098
|
-
const bytes = [];
|
|
5099
|
-
for (let rest = value; ; ) {
|
|
5100
|
-
const byte = rest % 128;
|
|
5101
|
-
rest = Math.floor(rest / 128);
|
|
5102
|
-
if (rest === 0) return [...bytes, byte];
|
|
5103
|
-
bytes.push(byte | 128);
|
|
5104
|
-
}
|
|
5105
|
-
}
|
|
5106
|
-
function encodeWasmName(name) {
|
|
5107
|
-
const bytes = new TextEncoder().encode(name);
|
|
5108
|
-
return [...encodeWasmNumber(bytes.length), ...bytes];
|
|
5109
|
-
}
|
|
5110
|
-
function readWasmSection(bytes, start, end) {
|
|
5111
|
-
let at = start;
|
|
5112
|
-
const number3 = () => {
|
|
5113
|
-
let value = 0;
|
|
5114
|
-
for (let shift = 0; ; shift += 7) {
|
|
5115
|
-
if (at >= end || shift > 63) throw new Error("invalid wasm integer");
|
|
5116
|
-
const byte = bytes[at++];
|
|
5117
|
-
value += (byte & 127) * 2 ** shift;
|
|
5118
|
-
if (!(byte & 128)) return value;
|
|
5119
|
-
}
|
|
5120
|
-
};
|
|
5121
|
-
return {
|
|
5122
|
-
number: number3,
|
|
5123
|
-
byte: () => {
|
|
5124
|
-
if (at >= end) throw new Error("truncated wasm section");
|
|
5125
|
-
return bytes[at++];
|
|
5126
|
-
},
|
|
5127
|
-
name: () => {
|
|
5128
|
-
const length = number3();
|
|
5129
|
-
at += length;
|
|
5130
|
-
if (at > end) throw new Error("truncated wasm name");
|
|
5131
|
-
return Buffer.from(bytes.buffer, bytes.byteOffset + at - length, length).toString();
|
|
5132
|
-
},
|
|
5133
|
-
position: () => at,
|
|
5134
|
-
done: () => at === end
|
|
5135
|
-
};
|
|
5136
|
-
}
|
|
5137
|
-
function wasmSections(bytes) {
|
|
5138
|
-
if (Buffer.from(bytes.subarray(0, 8)).toString("hex") !== "0061736d01000000")
|
|
5139
|
-
throw new Error("not a wasm module");
|
|
5140
|
-
const found = [];
|
|
5141
|
-
for (let at = 8; at < bytes.length; ) {
|
|
5142
|
-
const header = readWasmSection(bytes, at, bytes.length);
|
|
5143
|
-
const id = header.byte();
|
|
5144
|
-
const size = header.number();
|
|
5145
|
-
const start = header.position();
|
|
5146
|
-
if (start + size > bytes.length) throw new Error("truncated wasm section");
|
|
5147
|
-
found.push({ id, offset: at, start, end: start + size });
|
|
5148
|
-
at = start + size;
|
|
5149
|
-
}
|
|
5150
|
-
return found;
|
|
5151
|
-
}
|
|
5152
|
-
|
|
5153
5100
|
// src/wasm-imports.ts
|
|
5154
5101
|
function readWasmImports(bytes, section2, visit) {
|
|
5155
5102
|
const input = readWasmSection(bytes, section2.start, section2.end);
|
|
@@ -5410,23 +5357,13 @@ function wasmReader(bytes, start) {
|
|
|
5410
5357
|
const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
5411
5358
|
let at = start;
|
|
5412
5359
|
const u = () => {
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
value += (byte & 127) * 2 ** shift;
|
|
5417
|
-
if (!(byte & 128)) return value;
|
|
5418
|
-
}
|
|
5360
|
+
const [value, next] = readULEB(bytes, at);
|
|
5361
|
+
at = next;
|
|
5362
|
+
return value;
|
|
5419
5363
|
};
|
|
5420
5364
|
const s = () => {
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
let byte = 0;
|
|
5424
|
-
do {
|
|
5425
|
-
byte = bytes[at++];
|
|
5426
|
-
value |= BigInt(byte & 127) << shift;
|
|
5427
|
-
shift += 7n;
|
|
5428
|
-
} while (byte & 128);
|
|
5429
|
-
if (byte & 64) value -= 1n << shift;
|
|
5365
|
+
const [value, next] = readSLEB(bytes, at);
|
|
5366
|
+
at = next;
|
|
5430
5367
|
return value;
|
|
5431
5368
|
};
|
|
5432
5369
|
return {
|
|
@@ -5462,33 +5399,7 @@ function wasmSections2(bytes) {
|
|
|
5462
5399
|
}
|
|
5463
5400
|
return out;
|
|
5464
5401
|
}
|
|
5465
|
-
var
|
|
5466
|
-
const out = [];
|
|
5467
|
-
do {
|
|
5468
|
-
let byte = value % 128;
|
|
5469
|
-
value = Math.floor(value / 128);
|
|
5470
|
-
if (value) byte |= 128;
|
|
5471
|
-
out.push(byte);
|
|
5472
|
-
} while (value);
|
|
5473
|
-
return out;
|
|
5474
|
-
};
|
|
5475
|
-
var sleb = (value) => {
|
|
5476
|
-
const out = [];
|
|
5477
|
-
for (; ; ) {
|
|
5478
|
-
const byte = Number(value & 127n);
|
|
5479
|
-
value >>= 7n;
|
|
5480
|
-
if (value === 0n && !(byte & 64) || value === -1n && byte & 64) {
|
|
5481
|
-
out.push(byte);
|
|
5482
|
-
return out;
|
|
5483
|
-
}
|
|
5484
|
-
out.push(byte | 128);
|
|
5485
|
-
}
|
|
5486
|
-
};
|
|
5487
|
-
var encodedName = (name) => {
|
|
5488
|
-
const bytes = [...Buffer.from(name)];
|
|
5489
|
-
return [...uleb(bytes.length), ...bytes];
|
|
5490
|
-
};
|
|
5491
|
-
var section = (id, payload) => Uint8Array.from([id, ...uleb(payload.length), ...payload]);
|
|
5402
|
+
var section = (id, payload) => Uint8Array.from([id, ...encodeWasmNumber(payload.length), ...payload]);
|
|
5492
5403
|
function constant2(r) {
|
|
5493
5404
|
const op = r.byte();
|
|
5494
5405
|
if (op !== 65 && op !== 66) throw new Error(`sdk image constant op ${op}`);
|
|
@@ -5775,7 +5686,7 @@ function finishSdkImage(bytes, hostExports, libraries, guestMap) {
|
|
|
5775
5686
|
else data[entry.name] = value;
|
|
5776
5687
|
}
|
|
5777
5688
|
if (entry.kind !== 0 && entry.kind !== 3 || host2.has(entry.name))
|
|
5778
|
-
kept.push([...
|
|
5689
|
+
kept.push([...encodeWasmName(entry.name), entry.kind, ...encodeWasmNumber(entry.index)]);
|
|
5779
5690
|
}
|
|
5780
5691
|
if (guestMap) {
|
|
5781
5692
|
if (guestMap.code.length !== m.bodies.length)
|
|
@@ -5790,19 +5701,19 @@ function finishSdkImage(bytes, hostExports, libraries, guestMap) {
|
|
|
5790
5701
|
const er = wasmReader(bytes, elements.start);
|
|
5791
5702
|
const segments = er.u();
|
|
5792
5703
|
const replaced = /* @__PURE__ */ new Map([
|
|
5793
|
-
[4, [1, 112, 4, ...
|
|
5794
|
-
[7, [...
|
|
5704
|
+
[4, [1, 112, 4, ...encodeWasmNumber(tableEnd + added.length)]],
|
|
5705
|
+
[7, [...encodeWasmNumber(kept.length), ...kept.flat()]],
|
|
5795
5706
|
[
|
|
5796
5707
|
9,
|
|
5797
5708
|
[
|
|
5798
|
-
...
|
|
5709
|
+
...encodeWasmNumber(segments + 1),
|
|
5799
5710
|
...bytes.subarray(er.at, elements.end),
|
|
5800
5711
|
0,
|
|
5801
5712
|
66,
|
|
5802
|
-
...
|
|
5713
|
+
...encodeWasmSigned(BigInt(tableEnd)),
|
|
5803
5714
|
11,
|
|
5804
|
-
...
|
|
5805
|
-
...added.flatMap(
|
|
5715
|
+
...encodeWasmNumber(added.length),
|
|
5716
|
+
...added.flatMap(encodeWasmNumber)
|
|
5806
5717
|
]
|
|
5807
5718
|
]
|
|
5808
5719
|
]);
|
|
@@ -5908,33 +5819,33 @@ function codeOnlySdkImage(bytes, constructorMask) {
|
|
|
5908
5819
|
if (drop) r.skip(1);
|
|
5909
5820
|
gated.push(
|
|
5910
5821
|
66,
|
|
5911
|
-
...
|
|
5822
|
+
...encodeWasmSigned(BigInt(constructorMask + index++)),
|
|
5912
5823
|
45,
|
|
5913
5824
|
0,
|
|
5914
5825
|
0,
|
|
5915
5826
|
4,
|
|
5916
5827
|
64,
|
|
5917
5828
|
16,
|
|
5918
|
-
...
|
|
5829
|
+
...encodeWasmNumber(callee),
|
|
5919
5830
|
...drop ? [26] : [],
|
|
5920
5831
|
11
|
|
5921
5832
|
);
|
|
5922
5833
|
}
|
|
5923
5834
|
if (index > SWIFT_SDK_CONSTRUCTOR_LIMIT)
|
|
5924
5835
|
throw new Error(`${index} sdk constructors exceed the mask`);
|
|
5925
|
-
gated.push(16, ...
|
|
5836
|
+
gated.push(16, ...encodeWasmNumber(functionIndex("__peach_sdk_register")), 11);
|
|
5926
5837
|
bodies[constructors] = Uint8Array.from(gated);
|
|
5927
5838
|
}
|
|
5928
|
-
const codeParts = [Uint8Array.from(
|
|
5929
|
-
for (const body of bodies) codeParts.push(Uint8Array.from(
|
|
5839
|
+
const codeParts = [Uint8Array.from(encodeWasmNumber(bodies.length))];
|
|
5840
|
+
for (const body of bodies) codeParts.push(Uint8Array.from(encodeWasmNumber(body.length)), body);
|
|
5930
5841
|
const codeSize = codeParts.reduce((sum, part) => sum + part.length, 0);
|
|
5931
5842
|
const tls = passiveSegments(bytes)[0];
|
|
5932
5843
|
const out = [bytes.subarray(0, 8)];
|
|
5933
5844
|
for (const s of m.sections) {
|
|
5934
5845
|
if (s.id === 10) {
|
|
5935
|
-
out.push(Uint8Array.from([10, ...
|
|
5846
|
+
out.push(Uint8Array.from([10, ...encodeWasmNumber(codeSize)]));
|
|
5936
5847
|
for (const part of codeParts) out.push(part);
|
|
5937
|
-
} else if (s.id === 11) out.push(section(11, [1, 1, ...
|
|
5848
|
+
} else if (s.id === 11) out.push(section(11, [1, 1, ...encodeWasmNumber(tls.length), ...tls]));
|
|
5938
5849
|
else if (s.id === 12) out.push(section(12, [1]));
|
|
5939
5850
|
else out.push(bytes.subarray(s.offset, s.end));
|
|
5940
5851
|
}
|
|
@@ -6333,41 +6244,6 @@ function readArMembers(buf, includeBitcode = false) {
|
|
|
6333
6244
|
}
|
|
6334
6245
|
|
|
6335
6246
|
// src/swift-wasm-prune.ts
|
|
6336
|
-
function readULEB(b, o) {
|
|
6337
|
-
let res = 0;
|
|
6338
|
-
let shift = 0;
|
|
6339
|
-
let p = o;
|
|
6340
|
-
while (true) {
|
|
6341
|
-
const byte = b[p++];
|
|
6342
|
-
res |= (byte & 127) << shift;
|
|
6343
|
-
if ((byte & 128) === 0) break;
|
|
6344
|
-
shift += 7;
|
|
6345
|
-
}
|
|
6346
|
-
return [res, p];
|
|
6347
|
-
}
|
|
6348
|
-
function readSLEB(b, o) {
|
|
6349
|
-
let res = 0;
|
|
6350
|
-
let shift = 0;
|
|
6351
|
-
let p = o;
|
|
6352
|
-
let byte = 0;
|
|
6353
|
-
do {
|
|
6354
|
-
byte = b[p++];
|
|
6355
|
-
res |= (byte & 127) << shift;
|
|
6356
|
-
shift += 7;
|
|
6357
|
-
} while (byte & 128);
|
|
6358
|
-
if (shift < 32 && byte & 64) res |= ~0 << shift;
|
|
6359
|
-
return [res, p];
|
|
6360
|
-
}
|
|
6361
|
-
function encodeULEB(val) {
|
|
6362
|
-
const out = [];
|
|
6363
|
-
do {
|
|
6364
|
-
let byte = val & 127;
|
|
6365
|
-
val >>>= 7;
|
|
6366
|
-
if (val !== 0) byte |= 128;
|
|
6367
|
-
out.push(byte);
|
|
6368
|
-
} while (val !== 0);
|
|
6369
|
-
return out;
|
|
6370
|
-
}
|
|
6371
6247
|
var WIDE_DATA_RELOCS = /* @__PURE__ */ new Set([16, 19, 22, 27]);
|
|
6372
6248
|
var ROOT_SEG_PREFIXES = [
|
|
6373
6249
|
".init_array",
|
|
@@ -6460,39 +6336,14 @@ function decodeRelocations(buf, sections) {
|
|
|
6460
6336
|
for (let k = 0; k < sectionCount; k++, i++) {
|
|
6461
6337
|
start[i] = length + cur - baseAt;
|
|
6462
6338
|
const rType = buf[cur++];
|
|
6463
|
-
let offset
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
while (true) {
|
|
6468
|
-
const byte = buf[cur++];
|
|
6469
|
-
offset |= (byte & 127) << shift;
|
|
6470
|
-
if (byte < 128) break;
|
|
6471
|
-
shift += 7;
|
|
6472
|
-
}
|
|
6473
|
-
}
|
|
6474
|
-
let symbol = buf[cur++];
|
|
6475
|
-
if (symbol >= 128) {
|
|
6476
|
-
symbol &= 127;
|
|
6477
|
-
let shift = 7;
|
|
6478
|
-
while (true) {
|
|
6479
|
-
const byte = buf[cur++];
|
|
6480
|
-
symbol |= (byte & 127) << shift;
|
|
6481
|
-
if (byte < 128) break;
|
|
6482
|
-
shift += 7;
|
|
6483
|
-
}
|
|
6484
|
-
}
|
|
6339
|
+
let offset;
|
|
6340
|
+
[offset, cur] = readULEB(buf, cur);
|
|
6341
|
+
let symbol;
|
|
6342
|
+
[symbol, cur] = readULEB(buf, cur);
|
|
6485
6343
|
if (rType < 32 && (ADDEND_RELOC_MASK2 & 1 << rType) !== 0) {
|
|
6486
|
-
let
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
while (byte >= 128) {
|
|
6490
|
-
byte = buf[cur++];
|
|
6491
|
-
value |= (byte & 127) << shift;
|
|
6492
|
-
shift += 7;
|
|
6493
|
-
}
|
|
6494
|
-
if (shift < 32 && (byte & 64) !== 0) value |= ~0 << shift;
|
|
6495
|
-
addend[i] = value;
|
|
6344
|
+
let value;
|
|
6345
|
+
[value, cur] = readSLEB(buf, cur);
|
|
6346
|
+
addend[i] = Number(BigInt.asIntN(32, value));
|
|
6496
6347
|
}
|
|
6497
6348
|
ro[i] = offset;
|
|
6498
6349
|
rs[i] = symbol;
|
|
@@ -6609,8 +6460,7 @@ function patchSwiftrtObject(src) {
|
|
|
6609
6460
|
}
|
|
6610
6461
|
cur = c3;
|
|
6611
6462
|
if (ADDEND_RELOCATIONS.has(rType)) {
|
|
6612
|
-
|
|
6613
|
-
cur = c4;
|
|
6463
|
+
cur = skipLEB(buf, cur);
|
|
6614
6464
|
}
|
|
6615
6465
|
}
|
|
6616
6466
|
}
|
|
@@ -6624,25 +6474,14 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
|
|
|
6624
6474
|
let pos = 8;
|
|
6625
6475
|
let cur = 8;
|
|
6626
6476
|
const readU = () => {
|
|
6627
|
-
const
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
let shift = 7;
|
|
6631
|
-
while (true) {
|
|
6632
|
-
const byte = buf[cur++];
|
|
6633
|
-
res |= (byte & 127) << shift;
|
|
6634
|
-
if (byte < 128) return res;
|
|
6635
|
-
shift += 7;
|
|
6636
|
-
}
|
|
6477
|
+
const [res, next] = readULEB(buf, cur);
|
|
6478
|
+
cur = next;
|
|
6479
|
+
return res;
|
|
6637
6480
|
};
|
|
6638
6481
|
const skipU = () => {
|
|
6639
|
-
|
|
6640
|
-
}
|
|
6641
|
-
};
|
|
6642
|
-
const skipS = () => {
|
|
6643
|
-
while (buf[cur++] >= 128) {
|
|
6644
|
-
}
|
|
6482
|
+
cur = skipLEB(buf, cur);
|
|
6645
6483
|
};
|
|
6484
|
+
const skipS = skipU;
|
|
6646
6485
|
let numImportFuncs = 0;
|
|
6647
6486
|
let importsDlsym = false;
|
|
6648
6487
|
const importFuncNames = [];
|
|
@@ -7240,16 +7079,9 @@ function guestWasmSymbols(bytes) {
|
|
|
7240
7079
|
const rawBuf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
7241
7080
|
let cur = 8;
|
|
7242
7081
|
const readU = () => {
|
|
7243
|
-
const
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
let shift = 7;
|
|
7247
|
-
while (true) {
|
|
7248
|
-
const byte = bytes[cur++];
|
|
7249
|
-
res |= (byte & 127) << shift;
|
|
7250
|
-
if ((byte & 128) === 0) return res;
|
|
7251
|
-
shift += 7;
|
|
7252
|
-
}
|
|
7082
|
+
const [res, next] = readULEB(bytes, cur);
|
|
7083
|
+
cur = next;
|
|
7084
|
+
return res;
|
|
7253
7085
|
};
|
|
7254
7086
|
let importsDlsym = false;
|
|
7255
7087
|
const importFuncNames = [];
|
|
@@ -8434,7 +8266,7 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
8434
8266
|
zeroDataReloc(i);
|
|
8435
8267
|
} else {
|
|
8436
8268
|
const repl = firstLiveInSpecialSeg.get(segIdx);
|
|
8437
|
-
const roBytes =
|
|
8269
|
+
const roBytes = encodeWasmNumber(data.ro[i]);
|
|
8438
8270
|
const out = new Uint8Array(1 + roBytes.length + repl.afterRo.length);
|
|
8439
8271
|
out[0] = repl.rType;
|
|
8440
8272
|
out.set(roBytes, 1);
|
|
@@ -8530,9 +8362,9 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
8530
8362
|
}
|
|
8531
8363
|
}
|
|
8532
8364
|
if (entrySlices.length > 0) {
|
|
8533
|
-
const cntBytes = Uint8Array.from(
|
|
8365
|
+
const cntBytes = Uint8Array.from(encodeWasmNumber(entrySlices.length));
|
|
8534
8366
|
const bodyLen = cntBytes.length + entrySlices.reduce((a, b) => a + b.length, 0);
|
|
8535
|
-
const lenBytes = Uint8Array.from(
|
|
8367
|
+
const lenBytes = Uint8Array.from(encodeWasmNumber(bodyLen));
|
|
8536
8368
|
subChunks.push(Uint8Array.of(6), lenBytes, cntBytes);
|
|
8537
8369
|
for (const entry of entrySlices) subChunks.push(entry);
|
|
8538
8370
|
}
|
|
@@ -8589,17 +8421,17 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
8589
8421
|
lp = subEnd;
|
|
8590
8422
|
}
|
|
8591
8423
|
const totalSubLen = subChunks.reduce((a, b) => a + b.length, 0);
|
|
8592
|
-
outChunks.push(Uint8Array.of(0), Uint8Array.from(
|
|
8424
|
+
outChunks.push(Uint8Array.of(0), Uint8Array.from(encodeWasmNumber(totalSubLen)));
|
|
8593
8425
|
for (const chunk of subChunks) outChunks.push(chunk);
|
|
8594
8426
|
} else if (name === "reloc.CODE") {
|
|
8595
8427
|
const [, r1] = readULEB(buf, cp);
|
|
8596
8428
|
const headerSlice = buf.subarray(p, r1);
|
|
8597
|
-
const cntBytes = Uint8Array.from(
|
|
8429
|
+
const cntBytes = Uint8Array.from(encodeWasmNumber(keptCodeRelocs.length));
|
|
8598
8430
|
const relSlices = keptCodeRelocs.map((i) => relocationBytes(code, i));
|
|
8599
8431
|
const totalLen = headerSlice.length + cntBytes.length + relSlices.reduce((a, b) => a + b.length, 0);
|
|
8600
8432
|
outChunks.push(
|
|
8601
8433
|
Uint8Array.of(0),
|
|
8602
|
-
Uint8Array.from(
|
|
8434
|
+
Uint8Array.from(encodeWasmNumber(totalLen)),
|
|
8603
8435
|
headerSlice,
|
|
8604
8436
|
cntBytes
|
|
8605
8437
|
);
|
|
@@ -8607,11 +8439,11 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
8607
8439
|
} else if (name === "reloc.DATA") {
|
|
8608
8440
|
const [, r1] = readULEB(buf, cp);
|
|
8609
8441
|
const headerSlice = buf.subarray(p, r1);
|
|
8610
|
-
const cntBytes = Uint8Array.from(
|
|
8442
|
+
const cntBytes = Uint8Array.from(encodeWasmNumber(keptDataRelocBytes.length));
|
|
8611
8443
|
const totalLen = headerSlice.length + cntBytes.length + keptDataRelocBytes.reduce((a, b) => a + b.length, 0);
|
|
8612
8444
|
outChunks.push(
|
|
8613
8445
|
Uint8Array.of(0),
|
|
8614
|
-
Uint8Array.from(
|
|
8446
|
+
Uint8Array.from(encodeWasmNumber(totalLen)),
|
|
8615
8447
|
headerSlice,
|
|
8616
8448
|
cntBytes
|
|
8617
8449
|
);
|
|
@@ -8621,7 +8453,7 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
8621
8453
|
const nameBytes = buf.subarray(p, cp);
|
|
8622
8454
|
outChunks.push(
|
|
8623
8455
|
Uint8Array.of(0),
|
|
8624
|
-
Uint8Array.from(
|
|
8456
|
+
Uint8Array.from(encodeWasmNumber(nameBytes.length)),
|
|
8625
8457
|
nameBytes
|
|
8626
8458
|
);
|
|
8627
8459
|
} else if (name.startsWith("reloc..debug_")) {
|
|
@@ -8629,7 +8461,7 @@ function pruneSwiftWasmLink(directory, toolchainBin, moduleRoot, staticClangTarg
|
|
|
8629
8461
|
const headerSlice = buf.subarray(p, r1);
|
|
8630
8462
|
outChunks.push(
|
|
8631
8463
|
Uint8Array.of(0),
|
|
8632
|
-
Uint8Array.from(
|
|
8464
|
+
Uint8Array.from(encodeWasmNumber(headerSlice.length + 1)),
|
|
8633
8465
|
headerSlice,
|
|
8634
8466
|
Uint8Array.of(0)
|
|
8635
8467
|
);
|
|
@@ -8882,16 +8714,13 @@ var ByteWriter = class {
|
|
|
8882
8714
|
this.buf[this.pos++] = value;
|
|
8883
8715
|
}
|
|
8884
8716
|
uleb(value) {
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
buf[pos++] = byte;
|
|
8893
|
-
} while (value);
|
|
8894
|
-
this.pos = pos;
|
|
8717
|
+
if (value < 128) {
|
|
8718
|
+
this.byte(value);
|
|
8719
|
+
return;
|
|
8720
|
+
}
|
|
8721
|
+
const encoded = encodeWasmNumber(value);
|
|
8722
|
+
this.ensure(encoded.length);
|
|
8723
|
+
for (let i = 0; i < encoded.length; i++) this.buf[this.pos++] = encoded[i];
|
|
8895
8724
|
}
|
|
8896
8725
|
bytes(source, start = 0, end = source.length) {
|
|
8897
8726
|
const len = end - start;
|
|
@@ -8913,34 +8742,11 @@ var ByteWriter = class {
|
|
|
8913
8742
|
return this.buf.subarray(0, this.pos);
|
|
8914
8743
|
}
|
|
8915
8744
|
};
|
|
8916
|
-
function readNumber(bytes, position) {
|
|
8917
|
-
if (position < bytes.length) {
|
|
8918
|
-
const first = bytes[position];
|
|
8919
|
-
if (first < 128) return [first, position + 1];
|
|
8920
|
-
}
|
|
8921
|
-
let value = 0;
|
|
8922
|
-
let shift = 0;
|
|
8923
|
-
for (; ; ) {
|
|
8924
|
-
if (position >= bytes.length || shift > 63) throw new Error("invalid wasm integer");
|
|
8925
|
-
const byte = bytes[position++];
|
|
8926
|
-
value += (byte & 127) * 2 ** shift;
|
|
8927
|
-
if (!(byte & 128)) return [value, position];
|
|
8928
|
-
shift += 7;
|
|
8929
|
-
}
|
|
8930
|
-
}
|
|
8931
8745
|
function encodeNumber(value) {
|
|
8932
|
-
|
|
8933
|
-
const bytes = [];
|
|
8934
|
-
do {
|
|
8935
|
-
let byte = value % 128;
|
|
8936
|
-
value = Math.floor(value / 128);
|
|
8937
|
-
if (value) byte |= 128;
|
|
8938
|
-
bytes.push(byte);
|
|
8939
|
-
} while (value);
|
|
8940
|
-
return Buffer.from(bytes);
|
|
8746
|
+
return Buffer.from(encodeWasmNumber(value));
|
|
8941
8747
|
}
|
|
8942
8748
|
function readString(bytes, position) {
|
|
8943
|
-
const [length, start] =
|
|
8749
|
+
const [length, start] = readULEB(bytes, position);
|
|
8944
8750
|
if (start + length > bytes.length) throw new Error("invalid wasm string");
|
|
8945
8751
|
return [
|
|
8946
8752
|
Buffer.from(bytes.buffer, bytes.byteOffset + start, length).toString("utf8"),
|
|
@@ -9269,13 +9075,13 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
9269
9075
|
for (const subsection of subsections) {
|
|
9270
9076
|
if (subsection.kind === 6 && objcLoader !== void 0) {
|
|
9271
9077
|
const content = subsection.parts[0];
|
|
9272
|
-
const [count, entriesStart] =
|
|
9078
|
+
const [count, entriesStart] = readULEB(content, 0);
|
|
9273
9079
|
const initWriter = new ByteWriter(content.length + 16);
|
|
9274
9080
|
initWriter.bytes(content, 0, entriesStart);
|
|
9275
9081
|
let entryStart = entriesStart;
|
|
9276
9082
|
for (let i = 0; i < count; i++) {
|
|
9277
|
-
const [, symbolStart] =
|
|
9278
|
-
const [symbol, entryEnd] =
|
|
9083
|
+
const [, symbolStart] = readULEB(content, entryStart);
|
|
9084
|
+
const [symbol, entryEnd] = readULEB(content, symbolStart);
|
|
9279
9085
|
if (symbol === objcLoader) {
|
|
9280
9086
|
initWriter.uleb(1);
|
|
9281
9087
|
initWriter.bytes(content, symbolStart, entryEnd);
|
|
@@ -9345,7 +9151,7 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
9345
9151
|
if (position < bytes.length && bytes[position] < 128) {
|
|
9346
9152
|
size = bytes[position++];
|
|
9347
9153
|
} else {
|
|
9348
|
-
const [val, next] =
|
|
9154
|
+
const [val, next] = readULEB(bytes, position);
|
|
9349
9155
|
size = val;
|
|
9350
9156
|
position = next;
|
|
9351
9157
|
}
|
|
@@ -10104,7 +9910,7 @@ function nameGuestImageAliases(wasm, symbols) {
|
|
|
10104
9910
|
const parts = [wasm.subarray(0, 8)];
|
|
10105
9911
|
let position = 8;
|
|
10106
9912
|
while (position < wasm.length) {
|
|
10107
|
-
const [size, start] =
|
|
9913
|
+
const [size, start] = readULEB(wasm, position + 1);
|
|
10108
9914
|
const end = start + size;
|
|
10109
9915
|
const custom = wasm[position] === 0 ? readString(wasm, start) : void 0;
|
|
10110
9916
|
if (custom?.[0] !== "name") {
|
|
@@ -10115,17 +9921,17 @@ function nameGuestImageAliases(wasm, symbols) {
|
|
|
10115
9921
|
const subsections = [encodedString("name")];
|
|
10116
9922
|
let at = custom[1];
|
|
10117
9923
|
while (at < end) {
|
|
10118
|
-
const [subSize, subStart] =
|
|
9924
|
+
const [subSize, subStart] = readULEB(wasm, at + 1);
|
|
10119
9925
|
const subEnd = subStart + subSize;
|
|
10120
9926
|
if (wasm[at] !== 1) {
|
|
10121
9927
|
subsections.push(wasm.subarray(at, subEnd));
|
|
10122
9928
|
at = subEnd;
|
|
10123
9929
|
continue;
|
|
10124
9930
|
}
|
|
10125
|
-
let [count, cursor] =
|
|
9931
|
+
let [count, cursor] = readULEB(wasm, subStart);
|
|
10126
9932
|
const entries2 = [encodeNumber(count)];
|
|
10127
9933
|
for (; count > 0; count--) {
|
|
10128
|
-
const [index, next] =
|
|
9934
|
+
const [index, next] = readULEB(wasm, cursor);
|
|
10129
9935
|
const [name, after] = readString(wasm, next);
|
|
10130
9936
|
cursor = after;
|
|
10131
9937
|
const symbol = symbols[Number(alias.exec(name)?.[1] ?? -1)];
|
|
@@ -10440,13 +10246,6 @@ function sha256Buffer(bytes) {
|
|
|
10440
10246
|
return createHash5("sha256").update(bytes).digest();
|
|
10441
10247
|
}
|
|
10442
10248
|
var PACK_BYTES = 64 * 1024;
|
|
10443
|
-
function uleb2(value) {
|
|
10444
|
-
const bytes = [];
|
|
10445
|
-
for (let rest = value; ; rest = Math.floor(rest / 128)) {
|
|
10446
|
-
if (rest < 128) return [...bytes, rest];
|
|
10447
|
-
bytes.push(rest % 128 | 128);
|
|
10448
|
-
}
|
|
10449
|
-
}
|
|
10450
10249
|
function encodeGuestDyldTable(rows) {
|
|
10451
10250
|
const encoded = rows.map((row) => ({ ...row, bytes: Buffer.from(row.name) })).sort((a, b) => Buffer.compare(a.bytes, b.bytes));
|
|
10452
10251
|
const packs = [];
|
|
@@ -10459,7 +10258,7 @@ function encodeGuestDyldTable(rows) {
|
|
|
10459
10258
|
value.writeBigUInt64LE(row.value);
|
|
10460
10259
|
const bytes = Buffer.concat([
|
|
10461
10260
|
row.bytes,
|
|
10462
|
-
Buffer.from([0, ...
|
|
10261
|
+
Buffer.from([0, ...encodeWasmNumber(row.image), row.kind]),
|
|
10463
10262
|
value
|
|
10464
10263
|
]);
|
|
10465
10264
|
if (!current.length) firsts.push(row.bytes);
|
|
@@ -10555,16 +10354,6 @@ async function mapLimit(items, limit, worker) {
|
|
|
10555
10354
|
}
|
|
10556
10355
|
|
|
10557
10356
|
// src/swift-guest-dyld-functions.ts
|
|
10558
|
-
var uleb3 = (value) => {
|
|
10559
|
-
const out = [];
|
|
10560
|
-
do {
|
|
10561
|
-
let byte = value % 128;
|
|
10562
|
-
value = Math.floor(value / 128);
|
|
10563
|
-
if (value) byte |= 128;
|
|
10564
|
-
out.push(byte);
|
|
10565
|
-
} while (value);
|
|
10566
|
-
return out;
|
|
10567
|
-
};
|
|
10568
10357
|
var SECTION_ORDER = [1, 2, 3, 4, 5, 13, 6, 7, 8, 9, 12, 10, 11];
|
|
10569
10358
|
function skipValueType(r) {
|
|
10570
10359
|
const type = r.byte();
|
|
@@ -10609,8 +10398,8 @@ function readImports2(bytes, sections) {
|
|
|
10609
10398
|
return { functions, table64 };
|
|
10610
10399
|
}
|
|
10611
10400
|
function vectorSection(id, count, parts) {
|
|
10612
|
-
const body = Buffer.concat([Buffer.from(
|
|
10613
|
-
return Buffer.concat([Buffer.from([id, ...
|
|
10401
|
+
const body = Buffer.concat([Buffer.from(encodeWasmNumber(count)), ...parts]);
|
|
10402
|
+
return Buffer.concat([Buffer.from([id, ...encodeWasmNumber(body.length)]), body]);
|
|
10614
10403
|
}
|
|
10615
10404
|
function rewriteSections(bytes, sections, changes) {
|
|
10616
10405
|
const out = [bytes.subarray(0, 8)];
|
|
@@ -10671,9 +10460,9 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
10671
10460
|
vectorSection(2, count + 1, [
|
|
10672
10461
|
found && header ? bytes.subarray(header.at, found.end) : new Uint8Array(),
|
|
10673
10462
|
Buffer.from([
|
|
10674
|
-
...
|
|
10463
|
+
...encodeWasmNumber(module.length),
|
|
10675
10464
|
...module,
|
|
10676
|
-
...
|
|
10465
|
+
...encodeWasmNumber(name2.length),
|
|
10677
10466
|
...name2,
|
|
10678
10467
|
1,
|
|
10679
10468
|
112,
|
|
@@ -10695,7 +10484,7 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
10695
10484
|
elements.splice(
|
|
10696
10485
|
placementIndex,
|
|
10697
10486
|
0,
|
|
10698
|
-
Buffer.from([1, 0, ...
|
|
10487
|
+
Buffer.from([1, 0, ...encodeWasmNumber(functions.length), ...functions.flatMap(encodeWasmNumber)])
|
|
10699
10488
|
);
|
|
10700
10489
|
const place2 = imports.functions + declared.length;
|
|
10701
10490
|
const instructions = [
|
|
@@ -10709,7 +10498,7 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
10709
10498
|
1,
|
|
10710
10499
|
252,
|
|
10711
10500
|
12,
|
|
10712
|
-
...
|
|
10501
|
+
...encodeWasmNumber(placementIndex),
|
|
10713
10502
|
0,
|
|
10714
10503
|
11
|
|
10715
10504
|
];
|
|
@@ -10730,14 +10519,14 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
10730
10519
|
3,
|
|
10731
10520
|
vectorSection(3, declared.length + 1, [
|
|
10732
10521
|
...declared,
|
|
10733
|
-
Buffer.from(
|
|
10522
|
+
Buffer.from(encodeWasmNumber(types.length))
|
|
10734
10523
|
])
|
|
10735
10524
|
],
|
|
10736
10525
|
[
|
|
10737
10526
|
7,
|
|
10738
10527
|
vectorSection(7, exports.length + 1, [
|
|
10739
10528
|
...exports,
|
|
10740
|
-
Buffer.from([...
|
|
10529
|
+
Buffer.from([...encodeWasmNumber(name.length), ...name, 0, ...encodeWasmNumber(place2)])
|
|
10741
10530
|
])
|
|
10742
10531
|
],
|
|
10743
10532
|
[9, vectorSection(9, elements.length, elements)],
|
|
@@ -10745,7 +10534,7 @@ function appendLazyPlacement(bytes, functions, table) {
|
|
|
10745
10534
|
10,
|
|
10746
10535
|
vectorSection(10, bodies.length + 1, [
|
|
10747
10536
|
...bodies,
|
|
10748
|
-
Buffer.from([...
|
|
10537
|
+
Buffer.from([...encodeWasmNumber(instructions.length), ...instructions])
|
|
10749
10538
|
])
|
|
10750
10539
|
]
|
|
10751
10540
|
])
|
|
@@ -14082,30 +13871,12 @@ function wasmAutolinkEntries(bytes, out) {
|
|
|
14082
13871
|
const len = bytes.length;
|
|
14083
13872
|
while (pos < len) {
|
|
14084
13873
|
const id = bytes[pos++];
|
|
14085
|
-
let sz
|
|
14086
|
-
|
|
14087
|
-
sz &= 127;
|
|
14088
|
-
let shift = 7;
|
|
14089
|
-
while (true) {
|
|
14090
|
-
const b = bytes[pos++];
|
|
14091
|
-
sz |= (b & 127) << shift;
|
|
14092
|
-
if (b < 128) break;
|
|
14093
|
-
shift += 7;
|
|
14094
|
-
}
|
|
14095
|
-
}
|
|
13874
|
+
let sz;
|
|
13875
|
+
[sz, pos] = readULEB(bytes, pos, len);
|
|
14096
13876
|
const end = pos + sz;
|
|
14097
13877
|
if (id === 0) {
|
|
14098
|
-
let nLen
|
|
14099
|
-
|
|
14100
|
-
nLen &= 127;
|
|
14101
|
-
let shift = 7;
|
|
14102
|
-
while (true) {
|
|
14103
|
-
const b = bytes[pos++];
|
|
14104
|
-
nLen |= (b & 127) << shift;
|
|
14105
|
-
if (b < 128) break;
|
|
14106
|
-
shift += 7;
|
|
14107
|
-
}
|
|
14108
|
-
}
|
|
13878
|
+
let nLen;
|
|
13879
|
+
[nLen, pos] = readULEB(bytes, pos, end);
|
|
14109
13880
|
if (nLen === 24 && raw2.toString("ascii", pos, pos + 24) === ".swift1_autolink_entries") {
|
|
14110
13881
|
const payload = raw2.toString("utf8", pos + 24, end);
|
|
14111
13882
|
for (const entry of payload.split("\0")) {
|
|
@@ -14666,7 +14437,7 @@ async function compileGuestLink(options) {
|
|
|
14666
14437
|
};
|
|
14667
14438
|
const sdk = options.sdkImage;
|
|
14668
14439
|
const sdkCallers = sdk.sdkInterface.guestCallers;
|
|
14669
|
-
const sdkObjects = (await import("./swift-sdk-image-
|
|
14440
|
+
const sdkObjects = (await import("./swift-sdk-image-MIWPBZEN.mjs")).readSwiftSdkManifestIndex(
|
|
14670
14441
|
sdk
|
|
14671
14442
|
).guestObjects;
|
|
14672
14443
|
if (!sdkCallers || !sdkObjects)
|
|
@@ -14966,7 +14737,7 @@ async function compileGuestLink(options) {
|
|
|
14966
14737
|
swiftAppModuleThunkSection,
|
|
14967
14738
|
swiftSdkProjectionSpans,
|
|
14968
14739
|
writeSwiftSdkAppLink
|
|
14969
|
-
} = await import("./swift-sdk-app-module-
|
|
14740
|
+
} = await import("./swift-sdk-app-module-ZIN3LFLS.mjs");
|
|
14970
14741
|
const project = options.project;
|
|
14971
14742
|
const work = project ? mkdtempSync2(path14.join(directory, "app-module-")) : path14.join(directory, "app-module");
|
|
14972
14743
|
if (project) chownSync(work, project.uid, project.gid);
|
|
@@ -15652,36 +15423,22 @@ function archiveMember(archive, name) {
|
|
|
15652
15423
|
throw new Error(`swift-icu: ${name} is not in the sdk's icu archive`);
|
|
15653
15424
|
}
|
|
15654
15425
|
function icuSegment(object2) {
|
|
15655
|
-
let at = 8;
|
|
15656
|
-
const leb2 = () => {
|
|
15657
|
-
let result = 0;
|
|
15658
|
-
let shift = 0;
|
|
15659
|
-
let byte;
|
|
15660
|
-
do {
|
|
15661
|
-
byte = object2[at++];
|
|
15662
|
-
result += (byte & 127) * 2 ** shift;
|
|
15663
|
-
shift += 7;
|
|
15664
|
-
} while (byte & 128);
|
|
15665
|
-
return result;
|
|
15666
|
-
};
|
|
15667
15426
|
const found = [];
|
|
15668
|
-
|
|
15669
|
-
|
|
15670
|
-
const
|
|
15671
|
-
|
|
15672
|
-
|
|
15673
|
-
|
|
15674
|
-
|
|
15675
|
-
|
|
15676
|
-
|
|
15677
|
-
|
|
15678
|
-
|
|
15679
|
-
|
|
15680
|
-
|
|
15681
|
-
|
|
15682
|
-
}
|
|
15427
|
+
for (const section2 of wasmSections(object2)) {
|
|
15428
|
+
if (section2.id !== 11) continue;
|
|
15429
|
+
const reader = readWasmSection(object2, section2.start, section2.end);
|
|
15430
|
+
for (let count = reader.number(); count > 0; count--) {
|
|
15431
|
+
if (reader.number() !== 0)
|
|
15432
|
+
throw new Error("swift-icu: unexpected data segment kind");
|
|
15433
|
+
reader.byte();
|
|
15434
|
+
reader.number();
|
|
15435
|
+
reader.byte();
|
|
15436
|
+
const length = reader.number();
|
|
15437
|
+
const start = reader.position();
|
|
15438
|
+
const bytes = object2.subarray(start, start + length);
|
|
15439
|
+
if (bytes[2] === 218 && bytes[3] === 39) found.push(bytes);
|
|
15440
|
+
reader.skip(length);
|
|
15683
15441
|
}
|
|
15684
|
-
at = end;
|
|
15685
15442
|
}
|
|
15686
15443
|
if (found.length !== 1)
|
|
15687
15444
|
throw new Error(`swift-icu: expected one icu data segment, found ${found.length}`);
|
|
@@ -16971,7 +16728,7 @@ var darwinRecordsRegion = (quoted2) => quoted2.length ? ["-Wl,--start-lib", ...q
|
|
|
16971
16728
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
16972
16729
|
var MULTI_MANIFEST_VERSION = 76;
|
|
16973
16730
|
var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
16974
|
-
var compilerSourceDigest = true ? "
|
|
16731
|
+
var compilerSourceDigest = true ? "816651f27c8e6bad4746f2f90d840446903e3c4a2384095dcdf1c9ceb69ceba8" : swiftCompilerSourceDigest(import.meta.dirname);
|
|
16975
16732
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
16976
16733
|
return swiftCompileInputHash(input, release).update(swiftModuleDigest(moduleRoot)).digest("hex");
|
|
16977
16734
|
}
|
|
@@ -21596,7 +21353,7 @@ async function compileSwiftProjectOnce(sources, options) {
|
|
|
21596
21353
|
const distribution = swiftDistributionAt(moduleRoot);
|
|
21597
21354
|
const mirrorDistribution = options.linkOnly || options.project ? null : distribution;
|
|
21598
21355
|
if (distribution) refreshSwiftCacheHold(moduleRoot);
|
|
21599
|
-
const input = distribution && !options.intermediates ? (await import("./swift-package-prebuilt-
|
|
21356
|
+
const input = distribution && !options.intermediates ? (await import("./swift-package-prebuilt-MJSFHIOP.mjs")).useSwiftPackagePrebuilts(
|
|
21600
21357
|
sources,
|
|
21601
21358
|
moduleRoot,
|
|
21602
21359
|
options.toolchainBin
|
|
@@ -21609,7 +21366,7 @@ async function compileSwiftProjectOnce(sources, options) {
|
|
|
21609
21366
|
sources: path23.join(root, "Sources", "App"),
|
|
21610
21367
|
multi: compileTargets(input).length > 0
|
|
21611
21368
|
};
|
|
21612
|
-
const sdkImage = options.linkOnly ? void 0 : await (await import("./swift-sdk-image-
|
|
21369
|
+
const sdkImage = options.linkOnly ? void 0 : await (await import("./swift-sdk-image-MIWPBZEN.mjs")).buildSwiftSdkImage(
|
|
21613
21370
|
moduleRoot,
|
|
21614
21371
|
!!guestGraph,
|
|
21615
21372
|
distribution ? [] : linkedFrameworkTargets(moduleRoot, input).imports,
|
|
@@ -22348,7 +22105,7 @@ ${compatShape}` : "";
|
|
|
22348
22105
|
});
|
|
22349
22106
|
sdkAsset = { key: sdkImage.key, sha256: sdkImage.sha256, binding };
|
|
22350
22107
|
} else {
|
|
22351
|
-
const { buildSwiftAppModule } = await import("./swift-sdk-app-module-
|
|
22108
|
+
const { buildSwiftAppModule } = await import("./swift-sdk-app-module-ZIN3LFLS.mjs");
|
|
22352
22109
|
const binding = await buildSwiftAppModule({
|
|
22353
22110
|
buildRoot: root2,
|
|
22354
22111
|
toolchainBin: options.toolchainBin,
|