Skip to content

Commit

Permalink
crucible-wasm: Make it build after haskell-wasm added reference types…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
RyanGlScott committed Jul 31, 2024
1 parent 5ae0ff8 commit 04afc3b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions crucible-wasm/src/Lang/Crucible/Wasm/Instantiate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ valueTypeToType Wasm.I32 = Some (BVRepr (knownNat @32))
valueTypeToType Wasm.I64 = Some (BVRepr (knownNat @64))
valueTypeToType Wasm.F32 = Some (FloatRepr SingleFloatRepr)
valueTypeToType Wasm.F64 = Some (FloatRepr DoubleFloatRepr)
-- See https://github.com/GaloisInc/crucible/issues/1228
valueTypeToType Wasm.Func = error "Func reference types are not currently supported"
valueTypeToType Wasm.Extern = error "Extern reference types are not currently supported"

valueTypesToContext :: [Wasm.ValueType] -> Some (Assignment TypeRepr)
valueTypesToContext = fromList . map valueTypeToType
Expand Down
9 changes: 9 additions & 0 deletions crucible-wasm/src/Lang/Crucible/Wasm/Translate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ translateFunction fty fn@Wasm.Function{ .. } im st hdl =
setupLocal Wasm.F64 =
do r <- newReg (App (DoubleLit 0.0))
modify (addLocal r)
-- See https://github.com/GaloisInc/crucible/issues/1228
setupLocal Wasm.Func =
unimplemented "Func reference values"
setupLocal Wasm.Extern =
unimplemented "Extern reference values"

genReturn :: WasmGenerator s ret (Expr WasmExt s ret)
genReturn = computeReturn (handleReturnType hdl) (Wasm.results fty)
Expand Down Expand Up @@ -801,6 +806,10 @@ genInstruction genReturn im st ctrlStack instr =
-- IReinterpretF BitSize
-- FReinterpretI BitSize

-- RefNull ElemType
-- RefIsNull
-- RefFunc FuncIndex

_ -> unimplemented $ unwords ["Instruction not implemented", show instr]

invokeFn ::
Expand Down

0 comments on commit 04afc3b

Please sign in to comment.