@threadedstack/wmd-web 0.1.59 → 0.1.60

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/README.md CHANGED
@@ -3040,11 +3040,16 @@ An embedder does nothing to get the twin: update the package and call `container
3040
3040
 
3041
3041
  Off is off: with `gowasm: false` (or no twin source and no table) there is no twin file requested, no twin Worker started, no stub mount in the container (the guest's `/proc/mounts` has none), and no event. What the page does load is four small library modules that main's page does not, because the checkpoint rule needs the twin's spec text even when the twin is off: `src/gowasm/boot-setup.js`, `src/gowasm/setup.js`, `src/gowasm/pins-data.js` and `src/host/gowasm-guard.js`, 4 requests and 39,808 bytes uncompressed (counted once in Chromium against a copy of `origin/main`'s `web/`: 228 requests against 225, 65 distinct paths against 61; `web/test/x6/fix10-count.spec.js`). Nothing else differs in what the page asks for.
3042
3042
 
3043
- ## IOS-7: mobile WebKit runs vm.wasm in interp (D-686)
3044
-
3045
- On a real iPhone the Safari tab dies around the guest kernel's `paging_init` with `--mode jit`; `--mode interp` boots. So in mobile
3046
- WebKit (iPhone, iPad, every iOS browser, iPadOS in desktop mode) `bootWmd` replaces a `--mode jit` in `args` with `--mode interp`
3047
- with no change in the embedder, on every boot and restore path (`vmModeFor` in `src/boot.js`). `bootWmd({mobileJit: true})` keeps
3048
- jit; a caller's own `interp` stays; desktop browsers keep jit. The `memory` boot event carries `mode: 'interp', reason: 'mobile-webkit'`
3049
- when it replaced the mode. The boot key uses the caller's args, so checkpoints and base snapshots restore across the two modes
3050
- without a refusal. Tests: `test/unit/ios7-mobile-interp.test.js`; `test/e2e/ios7-mobile-interp.spec.js` (WebKit with the iPhone 13 profile).
3043
+ ## IOS-9: mobile WebKit runs vm.wasm in jit mode without chaining (D-688; IOS-7, D-686, was interp)
3044
+
3045
+ On a real iPhone (iOS 27.2.1) plain `--mode jit` kills the Safari tab around the guest kernel's `paging_init`; `--mode jit --no-chain`
3046
+ (vm.wasm builds no chaining dispatcher module) boots, and so does `--mode interp`. So in mobile WebKit (iPhone, iPad, every iOS
3047
+ browser, iPadOS in desktop mode) `bootWmd` keeps a `--mode jit` in `args` and adds `--no-chain` right after `--machine` (first,
3048
+ with no `--machine`) when it is not there, with no change in the embedder, on every boot and restore path (`vmModeFor` in
3049
+ `src/boot.js`). A caller's own `interp` stays; desktop browsers are unchanged. `bootWmd({mobileMode: 'interp'})` brings back the
3050
+ IOS-7 rewrite of jit to interp (for an iOS build that needs it); `bootWmd({mobileJit: true})` leaves the caller's args alone. The
3051
+ `memory` boot event carries `mode: 'jit', chain: false, reason: 'mobile-webkit'` (`mode: 'interp'` with `mobileMode: 'interp'`)
3052
+ when it rewrote. The boot key uses the caller's args, so checkpoints and base snapshots restore across the modes without a refusal.
3053
+ Tests: `test/unit/ios9-mobile-nochain.test.js`; `test/e2e/ios9-mobile-nochain.spec.js` (WebKit with the iPhone 13 profile: jit
3054
+ with `chain: false`, `echo ok`; Chromium: unchanged jit); `test/e2e/ios9-speed.spec.js` (`WMD_WEB_IOS9_SPEED=1`, the A/B of
3055
+ D-688). Phone confirmed: jit with `--no-chain` booted 3 of 3 from fresh tabs (D-688).
package/RELEASE.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wmd-web",
3
3
  "version": "0.5.1",
4
- "commit": "9692d8c2eb46b83435b5de1c56c7cebe573001ab",
4
+ "commit": "33022d3290599e07e6dd77309f85be185b0e9646",
5
5
  "previous": null,
6
6
  "decisions": [
7
7
  "D-388",
@@ -80,7 +80,8 @@
80
80
  "D-661",
81
81
  "D-666",
82
82
  "D-686",
83
- "D-687"
83
+ "D-687",
84
+ "D-688"
84
85
  ],
85
86
  "vmSources": "e7ea59770490110be23e658681ad89fd42abad5b",
86
87
  "guest": {
@@ -158,7 +159,7 @@
158
159
  }
159
160
  },
160
161
  "files": {
161
- "README.md": "62fe86fdab0dd16a79503200ba6410970f52b7f580682201835f158ca05292f4",
162
+ "README.md": "169d108bceec3a984b62ccdb7e8e525a490b8628dad69806bce3702b8273bcd1",
162
163
  "edge-site/own/HASHES.txt": "4d83edcb41399bb89eb7b1f89115886d739adac887bdde59a8d33e3a4602683a",
163
164
  "edge-site/own/NOTICES.txt": "8ceca5406ee5833737bd5fa4a41d434bf5e4d26eff6da1e42c693176ee113101",
164
165
  "edge-site/own/acorn/LICENSE": "76a876cf886ff9be2a8b5e2e86514fed06223c8c9f0c1e9ee9606e93841e00b7",
@@ -182,7 +183,7 @@
182
183
  "package.json": "6de9aa9fabdb395651d39997c17e094f01a574f54a36f0af31bd3ffaae53cda1",
183
184
  "src/base.js": "c79df2c3d4a6519fb9a6ef5cda39d66a5b9bc1a6dd009d21e7455e141943079f",
184
185
  "src/blob.js": "bb2a2f0d87ce236280a7be2f246c926010dfe07f649c27da5e70d8eb5eaf7061",
185
- "src/boot.js": "671d05752dcd5606115ac8ee27dfa9d4b4cc0b645faefbc2b979670c3f41c34e",
186
+ "src/boot.js": "c70c7391e7dc1c877b12183c64cd03daf2879f393c4b069fc9753003c717fe32",
186
187
  "src/build/builder.js": "57a8436acc00147d031a42cccffe508f8deb3735b0ab4f9efcc2aa1cf7c6859c",
187
188
  "src/build/context.js": "d38097c61dbdadc4d41290c010425a4422f499aba473fa2b83f2a5c41e543571",
188
189
  "src/build/dockerfile.js": "5957fe3d4ac8ff8b312f980ee04bd1d98ad4373a61f9a33e02f1ff1108b6ea53",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadedstack/wmd-web",
3
- "version": "0.1.59",
3
+ "version": "0.1.60",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/threadedstack/wmd-releases",
6
6
  "repository": {
@@ -9,8 +9,8 @@
9
9
  },
10
10
  "description": "Browser host for wmd's guest vm.wasm (Web Workers + shared memory + WASI preview1)",
11
11
  "wmd": {
12
- "tag": "v0.1.59",
13
- "commit": "9692d8c2eb46b83435b5de1c56c7cebe573001ab",
12
+ "tag": "v0.1.60",
13
+ "commit": "33022d3290599e07e6dd77309f85be185b0e9646",
14
14
  "web": "0.5.1"
15
15
  },
16
16
  "type": "module",
package/src/boot.js CHANGED
@@ -415,19 +415,27 @@ export function isMobileWebKit(nav = globalThis.navigator) {
415
415
  }
416
416
 
417
417
  /**
418
- * IOS-7 (D-686): the vm.wasm arguments for this browser. On a real iPhone every wmd version killed the Safari tab around the guest
419
- * kernel's paging_init with '--mode jit' (vm.wasm's block emitter, even with the JIT imports stubbed); '--mode interp' boots and runs
420
- * commands. So in mobile WebKit an '--mode jit' in the caller's args (wmn and wmr pass it explicitly) is replaced by 'interp', unless
421
- * `mobileJit` is true (testing, or once Apple fixes it). A caller's own 'interp' stays. Returns {args, event}: `args` is the same
422
- * array when nothing changes; `event` is {mode:'interp', reason:'mobile-webkit'} when it was rewritten, else null.
418
+ * IOS-9 (D-688): the vm.wasm arguments for this browser. On a real iPhone (iOS 27.2.1) plain '--mode jit' kills the Safari tab around
419
+ * the guest kernel's paging_init; '--mode jit --no-chain' (no chaining dispatcher module) boots, and so does '--mode interp'. So in mobile
420
+ * WebKit an '--mode jit' in the caller's args (wmn and wmr pass it explicitly) stays jit and gets '--no-chain' right after '--machine'
421
+ * (first, with no '--machine'), unless it has it already. `mobileMode: 'interp'` is the IOS-7 (D-686) behaviour: jit becomes interp
422
+ * (the escape for an iOS build that needs it). `mobileJit` true leaves the caller's args alone (testing, or once Apple fixes it). A caller's
423
+ * own 'interp' stays. Returns {args, event}: `args` is the same array when nothing changes; `event` is {mode:'jit', chain:false,
424
+ * reason:'mobile-webkit'} (or {mode:'interp', reason} for mobileMode 'interp') when it was rewritten, else null.
423
425
  */
424
- export function vmModeFor(args, { nav = globalThis.navigator, mobileJit = false } = {}) {
426
+ export function vmModeFor(args, { nav = globalThis.navigator, mobileJit = false, mobileMode = 'nochain' } = {}) {
425
427
  if (mobileJit || !isMobileWebKit(nav)) return { args, event: null }
426
428
  const i = args.indexOf('--mode')
427
429
  if (i < 0 || args[i + 1] !== 'jit') return { args, event: null }
428
430
  const out = [...args]
429
- out[i + 1] = 'interp'
430
- return { args: out, event: { mode: 'interp', reason: 'mobile-webkit' } }
431
+ if (mobileMode === 'interp') {
432
+ out[i + 1] = 'interp'
433
+ return { args: out, event: { mode: 'interp', reason: 'mobile-webkit' } }
434
+ }
435
+ if (out.includes('--no-chain')) return { args, event: null }
436
+ const m = out.indexOf('--machine')
437
+ out.splice(m < 0 ? 0 : m + 1, 0, '--no-chain')
438
+ return { args: out, event: { mode: 'jit', chain: false, reason: 'mobile-webkit' } }
431
439
  }
432
440
 
433
441
  /**
@@ -945,7 +953,8 @@ export function diskArgs(args, disk) {
945
953
  * @param {object} [o.disk] a disk from openDisk (host/disk.js): the guest gets it as virtio-blk
946
954
  * /dev/vda (vm.wasm's --swap MiB sizes the device) with wmd.disk=data on the kernel line, so guest init leaves
947
955
  * it alone. A machine with a disk takes no checkpoints: guest memory and the disk would not match
948
- * @param {boolean} [o.mobileJit] IOS-7 (D-686): keep the caller's '--mode jit' in mobile WebKit (default false: it runs interp there, vmModeFor). The 'memory' boot event says mode:'interp', reason:'mobile-webkit' when it was replaced
956
+ * @param {boolean} [o.mobileJit] IOS-7 (D-686): leave the caller's args alone in mobile WebKit (default false: '--mode jit' gets '--no-chain' there, vmModeFor)
957
+ * @param {'nochain'|'interp'} [o.mobileMode] IOS-9 (D-688): what mobile WebKit does with '--mode jit' (default 'nochain': jit plus '--no-chain'; 'interp': the IOS-7 rewrite to interp). The 'memory' boot event says mode:'jit', chain:false (or mode:'interp'), reason:'mobile-webkit' when it rewrote
949
958
  * @param {boolean} [o.heapReserve] W21 (default true, false in mobile WebKit: heapReserveDefault, D-516): vm.wasm grows its memory to the maximum
950
959
  * before any thread starts (WMD_HEAP_RESERVE=1), so memory never grows under running
951
960
  * vCPUs. Chromium checks memory.fill/copy against a per-Worker size that lags another
@@ -1095,11 +1104,11 @@ async function bootMachine(o) {
1095
1104
  if (o.checkpoint || o.restore || o.restoreLazy) throw new TypeError('a machine with a disk takes no checkpoints')
1096
1105
  o = { ...o, args: diskArgs(o.args, o.disk) }
1097
1106
  }
1098
- // IOS-7: mobile WebKit runs vm.wasm in interp. Every boot and restore (vm.restore(), bootWmd({restore}), a base snapshot) comes through here.
1107
+ // IOS-7/IOS-9: mobile WebKit runs vm.wasm in jit without chaining (or interp with mobileMode). Every boot and restore (vm.restore(), bootWmd({restore}), a base snapshot) comes through here.
1099
1108
  // The boot key and the base snapshot's command-line check use the caller's own args (keyArgv), so a snapshot taken with jit restores on
1100
- // a phone and one taken on a phone restores with jit elsewhere; only the argv vm.wasm runs with changes.
1109
+ // a phone and one taken on a phone restores elsewhere; only the argv vm.wasm runs with changes.
1101
1110
  const keyArgv = ['vm.wasm', ...o.args]
1102
- const modeChoice = vmModeFor(o.args, { mobileJit: o.mobileJit })
1111
+ const modeChoice = vmModeFor(o.args, { mobileJit: o.mobileJit, mobileMode: o.mobileMode })
1103
1112
  const argv = modeChoice.event ? ['vm.wasm', ...modeChoice.args] : keyArgv
1104
1113
  const env = vmEnv(o.env, o.heapReserve ?? heapReserveDefault())
1105
1114
  // the default Worker is started from a literal new URL(..., import.meta.url) so bundlers (Vite, webpack)
@@ -2,7 +2,7 @@
2
2
  // The files of node in the sandboxed frame: the path under a source (the option edge: { sources } of bootWmd), the role the frame gives the file, its
3
3
  // sha256 and its size. The page accepts a file only when it has exactly this sha256 and size. The notice files travel with the rest.
4
4
  // EDGE_PACKAGE is the package that holds these files, for the {name} {version} {file} of a registry source's url (null: none named).
5
- export const EDGE_PACKAGE = { name: '@threadedstack/wmd-node', version: '0.1.59' }
5
+ export const EDGE_PACKAGE = { name: '@threadedstack/wmd-node', version: '0.1.60' }
6
6
  export const EDGE_PINS = [
7
7
  { path: 'wmd_browser_bg.wasm', role: 'wasm', sha256: '1e3db7f2c5f4be0ee44e5f2c0205cf8ca11f906d9addd5512915fad4821661c2', size: 6334959 },
8
8
  { path: 'wmd_browser.js', role: 'glue', sha256: 'b389b072096881ba39b22cd705d3a230af02acc5409c61fb4f997d1081c4df6f', size: 75647 },
package/wmdpack.wasm CHANGED
Binary file