WebAssembly / WebAssembly/binaryen

wasm2js: import { getTempRet0 } from 'env';

Open
#2,716 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

good first bug help wanted
Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 19h
Merged PRs (30d)
69

Description

Hi!

I am using the wasm2js tool on a WebAssembly module written in Rust using wasm-bindgen(no emscripten involved) to generate code that works on Internet Explorer. However, since I added a new library which internally makes use of i64, this import has been added to the wasm2js output:

import { getTempRet0 } from 'env';

From what I understand, this method is used by emscriptem to handle i64 variables. However, my project is not using emscriptem, and I haven't found a way to remove or pollyfill this import, so I get the error saying that env is not found.

Is there something I can do to fix this?

EDIT: This seems like a bug, since setTempRet0 is never imported or used anywhere and no 64 bits variable is taken as a parameter or returned by any exported method. Also, in my case, manually defining function getTempRet0() {return 0} instead of the import makes the module works correctly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the wasm2js entry point and reproduce the Rust wasm-bindgen case that emits import { getTempRet0 } from 'env';. Trace how i64 handling adds this import, then verify the generated output no longer contains an unused env dependency and add a regression test for the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rust, wasm
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.