Skip to content

Conversation

@keithw
Copy link
Member

@keithw keithw commented Apr 4, 2022

(This PR is sequenced behind #1875, #1814, #1877, and #1887.)

To pass the ref_func.wasm and unreached-valid.wast tests (the final missing non-SIMD spec tests in the core testsuite), wasm2c needs to be willing to continue translating a module that has failed to validate. (The interpreter doesn't seem to enforce validity as strictly.)

Expose this behavior in wasm2c behind a --unsafe-ignore-validation-failure flag, and add the final two missing tests.

angelamontemayor and others added 11 commits April 4, 2022 21:08
Exports of a module instance are accessed through a pointer to the
instance and a function that returns a pointer to the thing being
exported form the corresponding instance. This change enables each
module instance to have their own exports.
* Remove name mangling of types and WASM_RT_ADD_PREFIX, instead all exported symbols have mangled module name as their prefix
* Add modname_import_t which contains all imported globals, memories and tables
* Add pointers to module instances of every module that the current module import a function from
* Add a pointer to module intance to wasm_rt_elem_t
* Pass corresponding module instance pointer to imported functions: pointer to where the funcion is imported from for CallExpr and pointer from wasm_rt_elem_t for CallIndirectExpr
* init_func_type() is moved to init_module() which needs to be called before any instance of the module is used
* modname_init() takes pointers to each module instance that the module imports from and set up imported globals, memories and tables correspondently
* Memories, tables and globals of spectest are moved into spectest_module_instance. Functions and exports of spectest module is set up to perform the same way as wasm2c output modules
* Only one declaration is written to output header file if the same field form the same module is imported multiple times
…ame_instance_t*)

modname_free(modname_instance_t*) frees all non-imported tables and memories in the given module_instance
This makes sure it's not possible to initialize a module while
leaving the runtime (in practice, the signal handler) uninitialized.
@keithw keithw force-pushed the wasm2c-spec-test-coverage branch from 0a8017b to de0a011 Compare April 6, 2022 11:22
yhdengh and others added 9 commits April 6, 2022 04:33
Restores current versions of all non-SIMD core tests and
multi-memory tests, except for two that are failing:
ref_func.wast and unreached-valid.wast

These two tests produce similar errors when run under
run-interp-spec, so will require further debugging.
To pass the ref_func.wasm and unreached-valid.wast tests,
wasm2c needs to be willing to continue translating a module
that has failed to validate. (The interpreter seems to handle
this similarly.)

Expose this behavior in wasm2c behind a
`--unsafe-ignore-validation-failure` flag, and add the final two
missing tests.
@keithw
Copy link
Member Author

keithw commented Apr 13, 2022

I'm going to close this -- per #1894, the better approach is probably to fix the underlying issues that are causing these modules to fail validation. After d08b0d9, the only remaining case involves validating br_table in the unreached-valid.wast test (#1894 (comment)).

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