Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Import when running global.wast #2414

Closed
CharlieTap opened this issue May 6, 2024 · 1 comment
Closed

Missing Import when running global.wast #2414

CharlieTap opened this issue May 6, 2024 · 1 comment

Comments

@CharlieTap
Copy link

Hello I have an issue when running global.json generated from global.wast, for example global.json starts like this:

{"source_filename": ".../wasm-testsuite/global.wast",
 "commands": [
  {"type": "module", "line": 3, "filename": "global.0.wasm"}, 
  {"type": "assert_return", "line": 196, "action": {"type": "invoke", "field": "get-a", "args": []}, "expected": [{"type": "i32", "value": "4294967294"}]}, 

So you can see the instantiate module is the first command with none prior, however global.0.wasm has an import:

 wasm2wat global.0.wasm 
(module
  (type (;0;) (func (param i32 i32) (result i32)))
  (type (;1;) (func (result i32)))
  (type (;2;) (func (result i64)))
  (type (;3;) (func (result externref)))
  (type (;4;) (func (param i32)))
  (type (;5;) (func (param i64)))
  (type (;6;) (func (param externref)))
  (type (;7;) (func (result f32)))
  (type (;8;) (func (result f64)))
  (type (;9;) (func (param f32)))
  (type (;10;) (func (param f64)))
  (type (;11;) (func))
  (type (;12;) (func (param i32) (result i32)))
  (import "spectest" "global_i32" (global (;0;) i32))

If this is the first command in the script how could an import be resolved? Unless a module is instantiable with missing imports? 🤔

@CharlieTap
Copy link
Author

Nevermind 😅 , for those that come up against this in the future there is a predefined script module which is expected to exist for all scripts: https://github.com/WebAssembly/spec/tree/master/interpreter#scripts

It's seems to be a workaround that was used before the "register" command was created

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

No branches or pull requests

1 participant