peachsim 0.1.2423 → 0.1.2425
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/cli/outbound-endpoints.ts +138 -23
- 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 +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +113 -26
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +112 -25
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +113 -26
- package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +24 -9
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +22 -7
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +24 -9
- package/dist-lib/native-app-identity-project.cjs +2 -2
- package/dist-lib/native-app-identity-project.mjs +2 -2
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +24 -24
- package/dist-lib/public-origins-lib.json +53 -53
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- 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 +1 -1
- package/dist-lib/skills.cjs +115 -28
- package/dist-lib/swift-compile.cjs +87 -15
- package/dist-lib/swift-compile.mjs +87 -15
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +88 -16
- package/dist-lib/vite.cjs +24 -9
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-globals/src/lockstepCaptureBridgeContract.d.ts +1 -0
- package/kotlin/README.md +4 -3
- package/kotlin/sdk.tar.gz +0 -0
- package/kotlin/toolchain.json +2 -2
- package/package.json +1 -1
- package/src/swift-compile.ts +1 -0
- package/src/swift-guest-compile.ts +2 -0
- package/src/swift-guest-image-ledger.ts +37 -2
- package/src/swift-guest-source-inputs.ts +45 -6
- package/src/visit-parsed-program.ts +21 -6
package/dist-lib/swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2425 | (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 __defProp = Object.defineProperty;
|
package/dist-lib/vite-swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2425 | (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;
|
|
@@ -12215,6 +12215,7 @@ function llvmType(value) {
|
|
|
12215
12215
|
}
|
|
12216
12216
|
}
|
|
12217
12217
|
var OBJC_INIT_RECORD = ".objc_init";
|
|
12218
|
+
var OBJC_LOAD_FUNCTION = ".objcv2_load_function";
|
|
12218
12219
|
function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLookups, preserveCanonical) {
|
|
12219
12220
|
if (Buffer.from(bytes.subarray(0, 8)).toString("hex") !== "0061736d01000000")
|
|
12220
12221
|
throw new Error("expected wasm object");
|
|
@@ -12324,7 +12325,8 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
12324
12325
|
if (sectionName === "linking") {
|
|
12325
12326
|
const version2 = number3();
|
|
12326
12327
|
if (version2 !== 2) throw new Error("unsupported wasm linking version");
|
|
12327
|
-
const
|
|
12328
|
+
const subsections = [];
|
|
12329
|
+
let objcLoader;
|
|
12328
12330
|
while (offset < section.length) {
|
|
12329
12331
|
const kind = section[offset++];
|
|
12330
12332
|
const length = number3();
|
|
@@ -12387,6 +12389,9 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
12387
12389
|
}
|
|
12388
12390
|
} else if (symbolKind === 3) number3();
|
|
12389
12391
|
else throw new Error("unsupported wasm symbol kind");
|
|
12392
|
+
if (name3 === OBJC_LOAD_FUNCTION && symbolKind === 0 && !(flags & 16)) {
|
|
12393
|
+
objcLoader = i;
|
|
12394
|
+
}
|
|
12390
12395
|
const alias = names.get(name3);
|
|
12391
12396
|
if (flags & 16 && symbolKind === 1 && alias) usedSymbols.add(name3);
|
|
12392
12397
|
if ((name3 === "dlsym" && usesDlsym || name3 === "dlerror" && usesDlerror) && flags & 16 && flags & 64 && symbolKind === 0) {
|
|
@@ -12436,7 +12441,36 @@ function rewriteObject(bytes, names, callerAlias, binding, instrumentDynamicLook
|
|
|
12436
12441
|
content = Buffer.concat([...entries, ...extraEntries]);
|
|
12437
12442
|
}
|
|
12438
12443
|
offset = stop;
|
|
12439
|
-
|
|
12444
|
+
subsections.push({ kind, content });
|
|
12445
|
+
}
|
|
12446
|
+
const parts = [encodedString(sectionName), encodeNumber(version2)];
|
|
12447
|
+
for (const subsection of subsections) {
|
|
12448
|
+
let content = subsection.content;
|
|
12449
|
+
if (subsection.kind === 6 && objcLoader !== void 0) {
|
|
12450
|
+
const [count, entriesStart] = readNumber(content, 0);
|
|
12451
|
+
const entries = [content.subarray(0, entriesStart)];
|
|
12452
|
+
let entryStart = entriesStart;
|
|
12453
|
+
for (let i = 0; i < count; i++) {
|
|
12454
|
+
const [, symbolStart] = readNumber(content, entryStart);
|
|
12455
|
+
const [symbol2, entryEnd] = readNumber(content, symbolStart);
|
|
12456
|
+
if (symbol2 === objcLoader) entries.push(encodeNumber(1));
|
|
12457
|
+
entries.push(
|
|
12458
|
+
content.subarray(
|
|
12459
|
+
symbol2 === objcLoader ? symbolStart : entryStart,
|
|
12460
|
+
entryEnd
|
|
12461
|
+
)
|
|
12462
|
+
);
|
|
12463
|
+
entryStart = entryEnd;
|
|
12464
|
+
}
|
|
12465
|
+
if (entryStart !== content.length)
|
|
12466
|
+
throw new Error("invalid init functions subsection");
|
|
12467
|
+
content = Buffer.concat(entries);
|
|
12468
|
+
}
|
|
12469
|
+
parts.push(
|
|
12470
|
+
Buffer.from([subsection.kind]),
|
|
12471
|
+
encodeNumber(content.length),
|
|
12472
|
+
content
|
|
12473
|
+
);
|
|
12440
12474
|
}
|
|
12441
12475
|
section = Buffer.concat(parts);
|
|
12442
12476
|
}
|
|
@@ -15274,6 +15308,25 @@ function clangIrLinkOptions(ir) {
|
|
|
15274
15308
|
return result;
|
|
15275
15309
|
}
|
|
15276
15310
|
var CLANG_TARGET_MODULE_WRAPPER = ".peach-clang";
|
|
15311
|
+
var PARALLEL_REPLAY = `
|
|
15312
|
+
const { spawn } = require('node:child_process')
|
|
15313
|
+
const commands = JSON.parse(require('node:fs').readFileSync(process.env.PEACH_CLANG_REPLAYS, 'utf8'))
|
|
15314
|
+
let next = 0
|
|
15315
|
+
const run = () => {
|
|
15316
|
+
if (next >= commands.length) return Promise.resolve()
|
|
15317
|
+
const [file, ...args] = commands[next++]
|
|
15318
|
+
return new Promise((resolve, reject) => {
|
|
15319
|
+
const child = spawn(file, args, { stdio: 'inherit' })
|
|
15320
|
+
child.on('error', reject)
|
|
15321
|
+
child.on('close', (code) => (code === 0 ? resolve() : reject(new Error('clang link replay failed: ' + file))))
|
|
15322
|
+
}).then(run)
|
|
15323
|
+
}
|
|
15324
|
+
const jobs = Math.max(1, Number(process.env.PEACH_CLANG_JOBS) || 1)
|
|
15325
|
+
Promise.all(Array.from({ length: jobs }, run)).catch((error) => {
|
|
15326
|
+
console.error(error.message)
|
|
15327
|
+
process.exit(1)
|
|
15328
|
+
})
|
|
15329
|
+
`;
|
|
15277
15330
|
function sourceGuestClangLinkOptions(options) {
|
|
15278
15331
|
const wanted = new Set(options.objects.map((file) => import_node_path17.default.resolve(file)));
|
|
15279
15332
|
const commands = /* @__PURE__ */ new Map();
|
|
@@ -15307,7 +15360,7 @@ function sourceGuestClangLinkOptions(options) {
|
|
|
15307
15360
|
commands.set(file, { tool, args: value });
|
|
15308
15361
|
}
|
|
15309
15362
|
}
|
|
15310
|
-
const
|
|
15363
|
+
const replays = [];
|
|
15311
15364
|
for (const [index, file] of [...wanted].entries()) {
|
|
15312
15365
|
const command = commands.get(file);
|
|
15313
15366
|
if (!command) throw new Error(`missing source object producer ${file}`);
|
|
@@ -15333,16 +15386,33 @@ function sourceGuestClangLinkOptions(options) {
|
|
|
15333
15386
|
throw new Error(`missing clang ${flag} for ${file}`);
|
|
15334
15387
|
args[index2 + 1] = flag === "-o" ? output2 : `${output2}.d`;
|
|
15335
15388
|
}
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
[
|
|
15339
|
-
|
|
15340
|
-
|
|
15389
|
+
replays.push({
|
|
15390
|
+
file,
|
|
15391
|
+
compiler: command.args[0],
|
|
15392
|
+
args: [...args, "-S", "-emit-llvm", "-Xclang", "-disable-llvm-passes"],
|
|
15393
|
+
output: output2
|
|
15394
|
+
});
|
|
15395
|
+
}
|
|
15396
|
+
const plan = import_node_path17.default.join(options.directory, "clang-link-replays.json");
|
|
15397
|
+
(0, import_node_fs17.writeFileSync)(
|
|
15398
|
+
plan,
|
|
15399
|
+
JSON.stringify(replays.map(({ compiler, args }) => [compiler, ...args]))
|
|
15400
|
+
);
|
|
15401
|
+
(0, import_node_child_process12.execFileSync)(process.execPath, ["-e", PARALLEL_REPLAY], {
|
|
15402
|
+
stdio: "inherit",
|
|
15403
|
+
env: {
|
|
15404
|
+
...process.env,
|
|
15405
|
+
PEACH_CLANG_REPLAYS: plan,
|
|
15406
|
+
PEACH_CLANG_JOBS: String(options.jobs)
|
|
15407
|
+
}
|
|
15408
|
+
});
|
|
15409
|
+
const result = /* @__PURE__ */ new Map();
|
|
15410
|
+
for (const { file, output: output2 } of replays) {
|
|
15341
15411
|
const flags = clangIrLinkOptions((0, import_node_fs17.readFileSync)(output2, "utf8"));
|
|
15342
|
-
for (let
|
|
15343
|
-
const flag = flags[
|
|
15412
|
+
for (let index = 0; index < flags.length; index++) {
|
|
15413
|
+
const flag = flags[index];
|
|
15344
15414
|
if (flag === "-framework" || flag === "-l" || flag === "--library") {
|
|
15345
|
-
const name3 = flags[++
|
|
15415
|
+
const name3 = flags[++index];
|
|
15346
15416
|
if (!name3 || name3.startsWith("-"))
|
|
15347
15417
|
throw new Error(`missing clang link name after ${flag}`);
|
|
15348
15418
|
} else if (!/^(-l.+|--library=.+)$/.test(flag)) {
|
|
@@ -16429,7 +16499,8 @@ async function compileGuestLink(options) {
|
|
|
16429
16499
|
directory,
|
|
16430
16500
|
toolchainBin: options.toolchainBin,
|
|
16431
16501
|
swiftCompiler: options.swiftCompiler,
|
|
16432
|
-
objects: selectedSource.map((artifact) => artifact.path)
|
|
16502
|
+
objects: selectedSource.map((artifact) => artifact.path),
|
|
16503
|
+
jobs: options.jobs
|
|
16433
16504
|
});
|
|
16434
16505
|
const links = sourceGuestRuntimeLinks({
|
|
16435
16506
|
toolchainBin: options.toolchainBin,
|
|
@@ -18899,7 +18970,7 @@ var darwinRecordsRegion = (quoted2) => quoted2.length ? ["-Wl,--start-lib", ...q
|
|
|
18899
18970
|
var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
|
|
18900
18971
|
var MULTI_MANIFEST_VERSION = 72;
|
|
18901
18972
|
var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
|
|
18902
|
-
var compilerSourceDigest = true ? "
|
|
18973
|
+
var compilerSourceDigest = true ? "714dbca336e958240697a0238ee5b0640b2b212c34df4843e82d0c1abe3e8c43" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
|
|
18903
18974
|
function swiftArtifactHash(input, release, moduleRoot) {
|
|
18904
18975
|
const hash = (0, import_node_crypto15.createHash)("sha256");
|
|
18905
18976
|
hash.update(`swift-compile
|
|
@@ -23652,7 +23723,8 @@ function compileSwiftProjectOnce(input, options) {
|
|
|
23652
23723
|
generatedOwners: preparation.generatedOwners,
|
|
23653
23724
|
output: output2,
|
|
23654
23725
|
optimized,
|
|
23655
|
-
optimize: input.optimize === true
|
|
23726
|
+
optimize: input.optimize === true,
|
|
23727
|
+
jobs: swiftBuildJobs()
|
|
23656
23728
|
});
|
|
23657
23729
|
else
|
|
23658
23730
|
await lowerWasm(output2, optimized, { optimize: input.optimize === true });
|
|
@@ -34624,7 +34696,7 @@ function sourceClosureDigest(srcDir, entrypoints, excludedFiles) {
|
|
|
34624
34696
|
return hash.digest("hex");
|
|
34625
34697
|
}
|
|
34626
34698
|
var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
|
|
34627
|
-
var STANDIN_SOURCE_DIGEST = true ? "
|
|
34699
|
+
var STANDIN_SOURCE_DIGEST = true ? "3a0e0016967d34924d12848e05752d3902596cc16a0f603a5fda32cb024d02f8" : standinSourceDigest();
|
|
34628
34700
|
|
|
34629
34701
|
// src/swift-standins.ts
|
|
34630
34702
|
var import_node_child_process32 = require("node:child_process");
|
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2425 | (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;
|
|
@@ -4382,7 +4382,7 @@ var STANDIN_SOURCE_DIGEST;
|
|
|
4382
4382
|
var init_swift_standin_digest = __esm({
|
|
4383
4383
|
"src/swift-standin-digest.ts"() {
|
|
4384
4384
|
"use strict";
|
|
4385
|
-
STANDIN_SOURCE_DIGEST = true ? "
|
|
4385
|
+
STANDIN_SOURCE_DIGEST = true ? "3a0e0016967d34924d12848e05752d3902596cc16a0f603a5fda32cb024d02f8" : standinSourceDigest();
|
|
4386
4386
|
}
|
|
4387
4387
|
});
|
|
4388
4388
|
|
|
@@ -5759,7 +5759,7 @@ var init_swift_compile = __esm({
|
|
|
5759
5759
|
FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
|
|
5760
5760
|
(module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
|
|
5761
5761
|
).join("");
|
|
5762
|
-
compilerSourceDigest = true ? "
|
|
5762
|
+
compilerSourceDigest = true ? "714dbca336e958240697a0238ee5b0640b2b212c34df4843e82d0c1abe3e8c43" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
|
|
5763
5763
|
C_WORDS = new Set(
|
|
5764
5764
|
"auto bool break case char const continue default do double else enum extern false float for goto if inline int long register restrict return short signed sizeof static struct switch true typedef union unsigned void volatile while YES NO NULL nil Nil id self super instancetype".split(
|
|
5765
5765
|
" "
|
|
@@ -7385,19 +7385,34 @@ init_public_brand();
|
|
|
7385
7385
|
var import_oxc_parser = require("oxc-parser");
|
|
7386
7386
|
init_is_record();
|
|
7387
7387
|
function visitParsedProgram(program, visitor) {
|
|
7388
|
+
const enterByType = /* @__PURE__ */ new Map();
|
|
7389
|
+
const exitByType = /* @__PURE__ */ new Map();
|
|
7390
|
+
for (const key of Object.keys(visitor)) {
|
|
7391
|
+
const handler = Reflect.get(visitor, key);
|
|
7392
|
+
if (typeof handler !== "function") continue;
|
|
7393
|
+
const invoke = (node) => {
|
|
7394
|
+
handler(node);
|
|
7395
|
+
};
|
|
7396
|
+
if (key.endsWith(":exit")) exitByType.set(key.slice(0, -5), invoke);
|
|
7397
|
+
else enterByType.set(key, invoke);
|
|
7398
|
+
}
|
|
7399
|
+
if (enterByType.size === 0 && exitByType.size === 0) return;
|
|
7400
|
+
const hasExit = exitByType.size > 0;
|
|
7388
7401
|
function visit3(value) {
|
|
7389
7402
|
if (Array.isArray(value)) {
|
|
7390
|
-
for (
|
|
7403
|
+
for (let i = 0; i < value.length; i++) visit3(value[i]);
|
|
7391
7404
|
return;
|
|
7392
7405
|
}
|
|
7393
7406
|
if (!isRecord(value) || typeof value.type !== "string") return;
|
|
7394
7407
|
const keys = import_oxc_parser.visitorKeys[value.type];
|
|
7395
7408
|
if (!keys) return;
|
|
7396
|
-
const enter =
|
|
7397
|
-
if (
|
|
7398
|
-
for (
|
|
7399
|
-
|
|
7400
|
-
|
|
7409
|
+
const enter = enterByType.get(value.type);
|
|
7410
|
+
if (enter) enter(value);
|
|
7411
|
+
for (let i = 0; i < keys.length; i++) visit3(value[keys[i]]);
|
|
7412
|
+
if (hasExit) {
|
|
7413
|
+
const exit = exitByType.get(value.type);
|
|
7414
|
+
if (exit) exit(value);
|
|
7415
|
+
}
|
|
7401
7416
|
}
|
|
7402
7417
|
visit3(program);
|
|
7403
7418
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2425 | (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 __defProp = Object.defineProperty;
|
|
@@ -105,6 +105,7 @@ export interface SootSimLockstepCaptureController {
|
|
|
105
105
|
end(): void;
|
|
106
106
|
}
|
|
107
107
|
export interface SootSimLockstepCaptureBridge {
|
|
108
|
+
getProgress(): ReturnType<SootSimLockstepCaptureController['progress']> | null;
|
|
108
109
|
begin(fps: number, options?: {
|
|
109
110
|
baseline?: boolean;
|
|
110
111
|
holdGpuScenes?: boolean;
|
package/kotlin/README.md
CHANGED
|
@@ -10,9 +10,10 @@ traffic in `scripts/debug/peach-swift-lazy-network.sh`.
|
|
|
10
10
|
|
|
11
11
|
- `toolchain.json` pins the patched Kotlin compiler distribution, kotlinx-coroutines,
|
|
12
12
|
and the AndroidX runtime and Compose Multiplatform UI Kotlin/Wasm klibs.
|
|
13
|
-
`fork/compiler.ts` packages the patched jar
|
|
14
|
-
|
|
15
|
-
kotlinx-datetime's declared JS module are verified
|
|
13
|
+
`fork/compiler.ts` packages the patched jar, Wasm/JS and JVM compiler files,
|
|
14
|
+
Compose and serialization plugins, and license records in one verified archive.
|
|
15
|
+
Skiko's browser resources and kotlinx-datetime's declared JS module are verified
|
|
16
|
+
and served beside the wasm.
|
|
16
17
|
Compose libraries and the compiler's bundled Compose plugin are selected only
|
|
17
18
|
for sources referencing `androidx.compose`. `peachsim/kotlin-host` fetches libraries once
|
|
18
19
|
into `~/.peach/kotlin/<version>`. kotlinc needs a Java runtime (17 or newer)
|
package/kotlin/sdk.tar.gz
CHANGED
|
Binary file
|
package/kotlin/toolchain.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compiler": {
|
|
3
3
|
"version": "2.4.20",
|
|
4
|
-
"url": "https://r2.rnxsim.com/peach-kotlin-fork/
|
|
5
|
-
"sha256": "
|
|
4
|
+
"url": "https://r2.rnxsim.com/peach-kotlin-fork/522d34b0c77983e43180fd369d26a140230502c0077ae5422419f9f59ac998a8/kotlin-compiler.tar.gz",
|
|
5
|
+
"sha256": "522d34b0c77983e43180fd369d26a140230502c0077ae5422419f9f59ac998a8",
|
|
6
6
|
"upstreamSha256": "59e9ca74c7904ef2c122b12114937673ccce68de820a663f0ed66ccf8799e0b7"
|
|
7
7
|
},
|
|
8
8
|
"libraries": [
|
package/package.json
CHANGED
package/src/swift-compile.ts
CHANGED
|
@@ -64,6 +64,7 @@ export async function compileGuestLink(options: {
|
|
|
64
64
|
readonly output: string
|
|
65
65
|
readonly optimized: string
|
|
66
66
|
readonly optimize: boolean
|
|
67
|
+
readonly jobs: number
|
|
67
68
|
}): Promise<void> {
|
|
68
69
|
const directory = path.join(options.buildDirectory, '.peach-guest-link')
|
|
69
70
|
mkdirSync(directory, { recursive: true })
|
|
@@ -266,6 +267,7 @@ export async function compileGuestLink(options: {
|
|
|
266
267
|
toolchainBin: options.toolchainBin,
|
|
267
268
|
swiftCompiler: options.swiftCompiler,
|
|
268
269
|
objects: selectedSource.map((artifact) => artifact.path),
|
|
270
|
+
jobs: options.jobs,
|
|
269
271
|
})
|
|
270
272
|
const links = sourceGuestRuntimeLinks({
|
|
271
273
|
toolchainBin: options.toolchainBin,
|
|
@@ -120,6 +120,7 @@ function llvmType(value: number): string {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
const OBJC_INIT_RECORD = '.objc_init'
|
|
123
|
+
const OBJC_LOAD_FUNCTION = '.objcv2_load_function'
|
|
123
124
|
|
|
124
125
|
// change definition names in the linking symbol table, preserving symbol
|
|
125
126
|
// indices and relocations. no app or dependency source bodies are changed.
|
|
@@ -256,7 +257,8 @@ function rewriteObject(
|
|
|
256
257
|
if (sectionName === 'linking') {
|
|
257
258
|
const version = number()
|
|
258
259
|
if (version !== 2) throw new Error('unsupported wasm linking version')
|
|
259
|
-
const
|
|
260
|
+
const subsections: { kind: number; content: Buffer }[] = []
|
|
261
|
+
let objcLoader: number | undefined
|
|
260
262
|
while (offset < section.length) {
|
|
261
263
|
const kind = section[offset++]!
|
|
262
264
|
const length = number()
|
|
@@ -330,6 +332,9 @@ function rewriteObject(
|
|
|
330
332
|
}
|
|
331
333
|
} else if (symbolKind === 3) number()
|
|
332
334
|
else throw new Error('unsupported wasm symbol kind')
|
|
335
|
+
if (name === OBJC_LOAD_FUNCTION && symbolKind === 0 && !(flags & 16)) {
|
|
336
|
+
objcLoader = i
|
|
337
|
+
}
|
|
333
338
|
const alias = names.get(name)
|
|
334
339
|
// an undefined data symbol has no wasm import, only this linking entry.
|
|
335
340
|
if (flags & 16 && symbolKind === 1 && alias) usedSymbols.add(name)
|
|
@@ -392,7 +397,37 @@ function rewriteObject(
|
|
|
392
397
|
content = Buffer.concat([...entries, ...extraEntries])
|
|
393
398
|
}
|
|
394
399
|
offset = stop
|
|
395
|
-
|
|
400
|
+
subsections.push({ kind, content })
|
|
401
|
+
}
|
|
402
|
+
const parts = [encodedString(sectionName), encodeNumber(version)]
|
|
403
|
+
for (const subsection of subsections) {
|
|
404
|
+
let content = subsection.content
|
|
405
|
+
if (subsection.kind === 6 && objcLoader !== undefined) {
|
|
406
|
+
const [count, entriesStart] = readNumber(content, 0)
|
|
407
|
+
const entries = [content.subarray(0, entriesStart)]
|
|
408
|
+
let entryStart = entriesStart
|
|
409
|
+
for (let i = 0; i < count; i++) {
|
|
410
|
+
const [, symbolStart] = readNumber(content, entryStart)
|
|
411
|
+
const [symbol, entryEnd] = readNumber(content, symbolStart)
|
|
412
|
+
// load the merged objc metadata after Swift registration (0) and before user constructors (101+).
|
|
413
|
+
if (symbol === objcLoader) entries.push(encodeNumber(1))
|
|
414
|
+
entries.push(
|
|
415
|
+
content.subarray(
|
|
416
|
+
symbol === objcLoader ? symbolStart : entryStart,
|
|
417
|
+
entryEnd,
|
|
418
|
+
),
|
|
419
|
+
)
|
|
420
|
+
entryStart = entryEnd
|
|
421
|
+
}
|
|
422
|
+
if (entryStart !== content.length)
|
|
423
|
+
throw new Error('invalid init functions subsection')
|
|
424
|
+
content = Buffer.concat(entries)
|
|
425
|
+
}
|
|
426
|
+
parts.push(
|
|
427
|
+
Buffer.from([subsection.kind]),
|
|
428
|
+
encodeNumber(content.length),
|
|
429
|
+
content,
|
|
430
|
+
)
|
|
396
431
|
}
|
|
397
432
|
section = Buffer.concat(parts)
|
|
398
433
|
}
|
|
@@ -46,6 +46,26 @@ export function clangIrLinkOptions(ir: string): string[] {
|
|
|
46
46
|
// target whose <target>.build directory receives the object
|
|
47
47
|
export const CLANG_TARGET_MODULE_WRAPPER = '.peach-clang'
|
|
48
48
|
|
|
49
|
+
const PARALLEL_REPLAY = `
|
|
50
|
+
const { spawn } = require('node:child_process')
|
|
51
|
+
const commands = JSON.parse(require('node:fs').readFileSync(process.env.PEACH_CLANG_REPLAYS, 'utf8'))
|
|
52
|
+
let next = 0
|
|
53
|
+
const run = () => {
|
|
54
|
+
if (next >= commands.length) return Promise.resolve()
|
|
55
|
+
const [file, ...args] = commands[next++]
|
|
56
|
+
return new Promise((resolve, reject) => {
|
|
57
|
+
const child = spawn(file, args, { stdio: 'inherit' })
|
|
58
|
+
child.on('error', reject)
|
|
59
|
+
child.on('close', (code) => (code === 0 ? resolve() : reject(new Error('clang link replay failed: ' + file))))
|
|
60
|
+
}).then(run)
|
|
61
|
+
}
|
|
62
|
+
const jobs = Math.max(1, Number(process.env.PEACH_CLANG_JOBS) || 1)
|
|
63
|
+
Promise.all(Array.from({ length: jobs }, run)).catch((error) => {
|
|
64
|
+
console.error(error.message)
|
|
65
|
+
process.exit(1)
|
|
66
|
+
})
|
|
67
|
+
`
|
|
68
|
+
|
|
49
69
|
/** Replay only selected source-owned Clang commands to retain their IR link options. */
|
|
50
70
|
export function sourceGuestClangLinkOptions(options: {
|
|
51
71
|
buildDirectory: string
|
|
@@ -53,6 +73,7 @@ export function sourceGuestClangLinkOptions(options: {
|
|
|
53
73
|
toolchainBin: string
|
|
54
74
|
swiftCompiler: string
|
|
55
75
|
objects: readonly string[]
|
|
76
|
+
jobs: number
|
|
56
77
|
}): Map<string, string[]> {
|
|
57
78
|
const wanted = new Set(options.objects.map((file) => path.resolve(file)))
|
|
58
79
|
const commands = new Map<string, { tool: string; args: string[] }>()
|
|
@@ -89,7 +110,7 @@ export function sourceGuestClangLinkOptions(options: {
|
|
|
89
110
|
commands.set(file, { tool, args: value })
|
|
90
111
|
}
|
|
91
112
|
}
|
|
92
|
-
const
|
|
113
|
+
const replays: { file: string; compiler: string; args: string[]; output: string }[] = []
|
|
93
114
|
for (const [index, file] of [...wanted].entries()) {
|
|
94
115
|
const command = commands.get(file)
|
|
95
116
|
if (!command) throw new Error(`missing source object producer ${file}`)
|
|
@@ -127,11 +148,29 @@ export function sourceGuestClangLinkOptions(options: {
|
|
|
127
148
|
throw new Error(`missing clang ${flag} for ${file}`)
|
|
128
149
|
args[index + 1] = flag === '-o' ? output : `${output}.d`
|
|
129
150
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
[
|
|
133
|
-
|
|
134
|
-
|
|
151
|
+
replays.push({
|
|
152
|
+
file,
|
|
153
|
+
compiler: command.args[0]!,
|
|
154
|
+
args: [...args, '-S', '-emit-llvm', '-Xclang', '-disable-llvm-passes'],
|
|
155
|
+
output,
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
// the pruner's plan callback is synchronous, so one child runs the replays concurrently
|
|
159
|
+
const plan = path.join(options.directory, 'clang-link-replays.json')
|
|
160
|
+
writeFileSync(
|
|
161
|
+
plan,
|
|
162
|
+
JSON.stringify(replays.map(({ compiler, args }) => [compiler, ...args])),
|
|
163
|
+
)
|
|
164
|
+
execFileSync(process.execPath, ['-e', PARALLEL_REPLAY], {
|
|
165
|
+
stdio: 'inherit',
|
|
166
|
+
env: {
|
|
167
|
+
...process.env,
|
|
168
|
+
PEACH_CLANG_REPLAYS: plan,
|
|
169
|
+
PEACH_CLANG_JOBS: String(options.jobs),
|
|
170
|
+
},
|
|
171
|
+
})
|
|
172
|
+
const result = new Map<string, string[]>()
|
|
173
|
+
for (const { file, output } of replays) {
|
|
135
174
|
const flags = clangIrLinkOptions(readFileSync(output, 'utf8'))
|
|
136
175
|
for (let index = 0; index < flags.length; index++) {
|
|
137
176
|
const flag = flags[index]!
|
|
@@ -3,19 +3,34 @@ import { isRecord } from './is-record'
|
|
|
3
3
|
|
|
4
4
|
// traverse the parser's published child keys without runtime-relative module loads.
|
|
5
5
|
export function visitParsedProgram(program: Program, visitor: VisitorObject): void {
|
|
6
|
+
const enterByType = new Map<string, (node: unknown) => void>()
|
|
7
|
+
const exitByType = new Map<string, (node: unknown) => void>()
|
|
8
|
+
for (const key of Object.keys(visitor)) {
|
|
9
|
+
const handler: unknown = Reflect.get(visitor, key)
|
|
10
|
+
if (typeof handler !== 'function') continue
|
|
11
|
+
const invoke = (node: unknown): void => {
|
|
12
|
+
handler(node)
|
|
13
|
+
}
|
|
14
|
+
if (key.endsWith(':exit')) exitByType.set(key.slice(0, -5), invoke)
|
|
15
|
+
else enterByType.set(key, invoke)
|
|
16
|
+
}
|
|
17
|
+
if (enterByType.size === 0 && exitByType.size === 0) return
|
|
18
|
+
const hasExit = exitByType.size > 0
|
|
6
19
|
function visit(value: unknown): void {
|
|
7
20
|
if (Array.isArray(value)) {
|
|
8
|
-
for (
|
|
21
|
+
for (let i = 0; i < value.length; i++) visit(value[i])
|
|
9
22
|
return
|
|
10
23
|
}
|
|
11
24
|
if (!isRecord(value) || typeof value.type !== 'string') return
|
|
12
25
|
const keys = visitorKeys[value.type]
|
|
13
26
|
if (!keys) return
|
|
14
|
-
const enter
|
|
15
|
-
if (
|
|
16
|
-
for (
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
const enter = enterByType.get(value.type)
|
|
28
|
+
if (enter) enter(value)
|
|
29
|
+
for (let i = 0; i < keys.length; i++) visit(value[keys[i]!])
|
|
30
|
+
if (hasExit) {
|
|
31
|
+
const exit = exitByType.get(value.type)
|
|
32
|
+
if (exit) exit(value)
|
|
33
|
+
}
|
|
19
34
|
}
|
|
20
35
|
visit(program)
|
|
21
36
|
}
|