cranelift: Register all functions in test file for interpreter (#4817)

* cranelift: Implement `bnot` in interpreter

* cranelift: Register all functions in test file for interpreter

* cranelift: Relax signature checking for bools and vectors
This commit is contained in:
Afonso Bordado
2022-08-30 23:45:21 +01:00
committed by GitHub
parent da0d8781b5
commit 3ce3eeb668
7 changed files with 150 additions and 39 deletions

View File

@@ -22,7 +22,17 @@ fn validate_signature_params(sig: &[AbiParam], args: &[impl Value]) -> bool {
args.iter()
.map(|r| r.ty())
.zip(sig.iter().map(|r| r.value_type))
.all(|(a, b)| a == b)
.all(|(a, b)| match (a, b) {
// For these two cases we don't have precise type information for `a`.
// We don't distinguish between different bool types, or different vector types
// The actual error is in `Value::ty` that returns default types for some values
// but we don't have enough information there either.
//
// Ideally the user has run the verifier and caught this properly...
(a, b) if a.is_bool() && b.is_bool() => true,
(a, b) if a.is_vector() && b.is_vector() => true,
(a, b) => a == b,
})
}
/// Interpret a single Cranelift instruction. Note that program traps and interpreter errors are

View File

@@ -679,7 +679,7 @@ impl Value for DataValue {
}
fn not(self) -> ValueResult<Self> {
unary_match!(!(&self); [I8, I16, I32, I64])
unary_match!(!(&self); [B, I8, I16, I32, I64])
}
fn count_ones(self) -> ValueResult<Self> {