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

crucible-wasm: Build and test with the latest haskell-wasm commit #1232

Merged
merged 11 commits into from
Aug 1, 2024

Conversation

RyanGlScott
Copy link
Contributor

This PR contains a series of small patches that makes crucible-wasm compile with the latest haskell-wasm commit (at the time of writing, this is SPY/haskell-wasm@23aef00). Moreover, in places where crucible-wasm's test suite was lacking, I have added some additional test cases to ensure that any changes introduced in this PR did not cause inadvertent regressions.

Most of the changes on the haskell-wasm side are to adapt to new features in Wasm 2.0. Generally speaking, I have not gone through the effort of implementing support for all of Wasm 2.0's new features, instead leaving that as future work. One particularly notable feature which I did not implement is support for reference types and values, which would require a non-trivial amount of work to support on the crucible-wasm side. See #1228.

After these changes, we will finally be building against a version of haskell-wasm that support GHC 9.8. This will allow us to then add support for GHC 9.8 elsewhere in the crucible repo.

Fixes #1227.

… and values

This bumps the `haskell-wasm` commit to
SPY/haskell-wasm@51cf7e7
and does the minimum amount of work needed to make `crucible-wasm` continue to
compile after these changes. For now, we do not implement full support for
Wasm's reference types and values, as that would require a non-trivial amount
of work to support. See #1228.
This bumps the `haskell-wasm` commit to
SPY/haskell-wasm@de40134
and does the minimum amount of work needed to make `crucible-wasm` continue to
compile after these changes. For now, we do not implement full support for Wasm
2.0's new element segment features, as that would require a non-trivial amount
of work to support. See #1228.
This bumps the `haskell-wasm` commit to
SPY/haskell-wasm@4753ebc.
For now, we do not implement Wasm 2.0's new table-related instructions, as that
would require a non-trivial amount of work to support. See #1228.
This bumps the `haskell-wasm` commit to
SPY/haskell-wasm@82defff
and does the minimum amount of work needed to make `crucible-wasm` continue to
compile after these changes. In particular:

* The `call_indirect` instruction has been generalized so that it can accept an
  arbitrary table index, rather than always hard-coding the table index to 0.
  This is straightforward to generalize on the `crucible-wasm` side as well.
* Wasm 2.0 has a new `elem.drop` instruction. For now, we do not implement
  support for this instruction.
This bumps the `haskell-wasm` commit to
SPY/haskell-wasm@c743e11
and does the minimum amount of work needed to make `crucible-wasm` continue to
compile after these changes. In particular, the `select` instruction now has an
optional value type indicating the type of its first and second operand, which
`crucible-wasm` ignores. This is OK for now, as `crucible-wasm`'s
implementation is currently simple enough where the types of all its stack
values can be inferred without any additional type information.
This bumps the `haskell-wasm` commit to
SPY/haskell-wasm@32392dc
and does the minimum amount of work needed to make `crucible-wasm` continue
to compile after these changes. For now, we do not implement full support
for Wasm 2.0's new data segment features, as that would require a
non-trivial amount of work to support. See #1228.
This bumps the `haskell-wasm` commit to
SPY/haskell-wasm@2bf6e88
and does the minimum amount of work needed to make `crucible-wasm` continue
to compile after these changes. In particular:

* `CurrentMemory` and `GrowMemory` were renamed to `MemorySize` and
  `MemoryGrow`, so I've performed the corresponding renaming on the
  `crucible-wasm` side as well.
* For now, I have not added support for the `memory.fill`, `memory.copy`,
  `memory.init`, or `data.drop` instructions, all of which are new in Wasm 2.0.
We have recently made some changes to the way `crucible-wasm` handled element
segments, so this test case helps ensure that we have not broken anything that
used to work before.
We have recently made some changes to the way `crucible-wasm` handled the
`select` instruction, so this test case helps ensure that we have not broken
anything that used to work before.
@RyanGlScott RyanGlScott force-pushed the T1227-latest-haskell-wasm-commit branch from 5348b60 to c066611 Compare August 1, 2024 12:44
Copy link
Contributor

@mccleeary-galois mccleeary-galois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an expert, but this all seems like a reasonable step towards support of WASM 2.0.

@@ -622,11 +622,11 @@ genInstruction genReturn im st ctrlStack instr =
Just (ConstantGlobal _) -> panic "genInstruction: SetGlobal" ["setGlobal of constant global"]
Just (MutableGlobal gv) -> writeGlobal gv =<< checkStackVal (globalType gv) =<< popStack

Wasm.CurrentMemory ->
Wasm.MemorySize ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add the following to a ticket as well so it doesn't get lost?

I have not added support for the memory.fill, memory.copy,
memory.init, or data.drop instructions, all of which are new in Wasm 2.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened #1233 for this.

@RyanGlScott RyanGlScott merged commit af11dc2 into master Aug 1, 2024
32 checks passed
@RyanGlScott RyanGlScott deleted the T1227-latest-haskell-wasm-commit branch August 1, 2024 15:27
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.

crucible-wasm: Make it build with the latest haskell-wasm commit
3 participants