Skip to content

Simplify linear-memory host function tests #1241

Open
@graydon

Description

@graydon

PR #1233 tests the linear memory host functions from synthetic wasm guest functions. There are a couple issues with these tests that would be nice to address:

  1. They can probably all just reuse a single definition of the test linear memory pattern -- computed once during wasm synthesis and stored into the wasm as a data section -- rather than imperatively rewriting the contents of linear memory when they run. This is partly a speed issue, partly an issue around "it'd be nice to exercise the data section code paths of wasmi", and partly a simplification issue: if you calculate the LM during synthesis it's a little easier to dump out for inspection.
  2. They probably don't need to be macro-generated? This I'm less certain about -- and it might still benefit from something macro-like such as the crossroads crate for factoring -- but I think the variation-between-tests ought not to be much larger than a couple lines each, and I think writing all those short tests in aggregate might not be much more code than this macro code, and would certainly be easier to understand, run individual tests of, etc.

This is a low-priority code-cleanup bug, not anything especially urgent.

Metadata

Metadata

Assignees

Labels

cleanupnon-observable improvements to the implementation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions