Skip to content

Replace handcoded native signature mapping with auto-generated one#27150

Open
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:native-sigs
Open

Replace handcoded native signature mapping with auto-generated one#27150
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:native-sigs

Conversation

@sbc100

@sbc100 sbc100 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Replace the hardcoded mapping in create_pointer_conversion_wrappers with a Python module loaded at runtime.

Add tools/maint/gen_native_sig_info.py to regenerate this module by comparing wasm32 and wasm64 builds to detect pointer arguments.

Signature changes/corrections:

  • _emscripten_proxy_poll_finish: Removed (dead code).
  • setThrew: Corrected from _p to _p_ (has 2 arguments in C).
  • _wasmfs_get_cwd: Corrected from p_ to p (has 0 arguments in C).
  • Void returns: Inconsistent vp signatures (e.g. emscripten_builtin_free, stbi_image_free) normalized to _p.

@sbc100 sbc100 requested review from dschuff, kleisauke and kripken June 18, 2026 20:12
@sbc100 sbc100 changed the title Replace hardcoded native signature mapping with auto-generated module Replace hardcoded native signature mapping with auto-generated one Jun 18, 2026
Comment thread tools/maint/gen_native_sig_info.py Outdated
@sbc100 sbc100 force-pushed the native-sigs branch 3 times, most recently from a6c94b2 to d6e54b0 Compare June 18, 2026 21:58
@sbc100 sbc100 enabled auto-merge (squash) June 18, 2026 22:56
@sbc100 sbc100 force-pushed the native-sigs branch 2 times, most recently from 529b426 to 22dd774 Compare June 19, 2026 00:21
@sbc100 sbc100 changed the title Replace hardcoded native signature mapping with auto-generated one Replace handcoded native signature mapping with auto-generated one Jun 19, 2026
Replace the hardcoded mapping in `create_pointer_conversion_wrappers`
with a Python module loaded at runtime.

Add `tools/maint/gen_native_sig_info.py` to regenerate this module by
comparing wasm32 and wasm64 builds to detect pointer arguments.

Signature changes/corrections:
- `_emscripten_proxy_poll_finish`: Removed (dead code).
- `setThrew`: Corrected from `_p` to `_p_` (has 2 arguments in C).
- `_wasmfs_get_cwd`: Corrected from `p_` to `p` (has 0 arguments in C).
- Void returns: Inconsistent `vp` signatures (e.g. `emscripten_builtin_free`,
  `stbi_image_free`) normalized to `_p`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants