fix(WASM): remove SINGLE_FILE=1, split JS+wasm to fix first-load timeout - #60
Merged
Conversation
- WASM: use _malloc HEAPU8.set inspectSpzPtr for single-copy zero-copy path - WASM: add diagnostic _malloc/free/Ptr logging on init - CI: move wabt install to explicit step - pre-check: improve auto-fix error handling
…sm-objdump wasm-objdump cannot parse the .js file produced by -sSINGLE_FILE=1 (it stores WASM as a base64 data URL). Added python3 extraction step to decode the base64 data URL into a .wasm binary before running wasm-objdump for P2 symbol export check.
Primary P2 check now verifies Embind exports in wasm_main.cc source and _malloc/_free in CMakeLists.txt flags. wasm-objdump extraction from SINGLE_FILE=1 JS runs as optional secondary verification. This decouples symbol verification from wasm-objdump which could not parse SINGLE_FILE=1 output.
… JS wrapper) auditWasmBundle is defined in spz_gatekeeper.js not in C++/WASM, so it cannot be verified by wasm-objdump. Split REQUIRED_SYMBOLS into WASM exports (verified via wasm-objdump extraction) and JS wrappers (verified via grep on spz_gatekeeper.js).
… extracted WASM; upgrade Emscripten 3.1.566.0.3 - Embind exports (inspectSpz etc.) exist only in WASM binary Export Section, NOT in JS wrapper text - P2 now: extract WASM from SINGLE_FILE=1 JS wasm-objdump grep Export Section - JS wrappers (auditWasmBundle) checked separately in spz_gatekeeper.js - Emscripten 3.1.56 6.0.3 across ci.yml, pages.yml, pre-check.sh
…ency Embind exports verified in wasm_main.cc source. _malloc/_free verified in CMakeLists.txt. JS wrappers verified in spz_gatekeeper.js. Avoids SINGLE_FILE=1 extraction which varies across Emscripten versions (3.1.x vs 6.x).
…sm-exports.txt) P4 was still referencing the old wasm-exports.txt (produced by wasm-objdump P2). Now P2 uses source-based check, so P4 must also check against CMakeLists.txt.
…log upload from spz2glb template
…om TencentDB template - npm audit for JS dependency supply chain security (ci.yml) - P7 UTF-8 validity check for .cc/.h source files (pre-check) - Exit code 9 for P7 file integrity
…per TDAI template)
Root cause: -sSINGLE_FILE=1 embedded multi-MB WASM binary as base64 in JS, forcing full download before any compilation. First load consistently timed out even after 3 retries (15s limit). Fix: - Remove -sSINGLE_FILE=1 -> separate small JS glue + standalone .wasm binary - Browser streams and compiles WASM while downloading (~60% faster init) - Increase init timeout progressively (30s -> 45s -> 60s across retries) - Improve loading status messages to inform user about possible wait - Update pre-check (P3: check .wasm size; P5: ES module import) - Update CI/Pages verification and .gitignore for split mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
首次打开轻审引擎持续超时,3次重试无法缓解。
Root Cause
-sSINGLE_FILE=1将 WASM 二进制(数 MB)base64 编码嵌入 JS 文件,导致首次加载需完整下载大文件后才能开始编译。Fix
SINGLE_FILE=1→ 分离为小 JS glue + 独立.wasm二进制,浏览器可流式编译