Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ wasmtime-wit-bindgen = { path = "crates/wit-bindgen", version = "=20.0.0" }
test-programs-artifacts = { path = 'crates/test-programs/artifacts' }

cranelift-wasm = { path = "cranelift/wasm", version = "0.107.0" }
cranelift-codegen = { path = "cranelift/codegen", version = "0.107.0", default-features = false, features = ["std", "unwind"] }
cranelift-codegen = { path = "cranelift/codegen", version = "0.107.0", default-features = false, features = ["std", "unwind", "trace-log"] }
cranelift-frontend = { path = "cranelift/frontend", version = "0.107.0" }
cranelift-entity = { path = "cranelift/entity", version = "0.107.0" }
cranelift-native = { path = "cranelift/native", version = "0.107.0" }
Expand Down
53 changes: 53 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ fn main() -> anyhow::Result<()> {
test_directory_module(out, "tests/misc_testsuite/memory64", strategy)?;
test_directory_module(out, "tests/misc_testsuite/component-model", strategy)?;
test_directory_module(out, "tests/misc_testsuite/function-references", strategy)?;
test_directory_module(out, "tests/misc_testsuite/gc", strategy)?;
// The testsuite of Winch is a subset of the official
// WebAssembly test suite, until parity is reached. This
// check is in place to prevent Cranelift from duplicating
Expand All @@ -59,6 +60,7 @@ fn main() -> anyhow::Result<()> {
"tests/spec_testsuite/proposals/function-references",
strategy,
)?;
test_directory_module(out, "tests/spec_testsuite/proposals/gc", strategy)?;
test_directory_module(
out,
"tests/spec_testsuite/proposals/multi-memory",
Expand Down Expand Up @@ -274,6 +276,57 @@ fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool {
}
}

if testsuite == "gc" {
if [
"array_copy",
"array_fill",
"array_init_data",
"array_init_elem",
"array",
"binary_gc",
"binary",
"br_on_cast_fail",
"br_on_cast",
"br_on_non_null",
"br_on_null",
"br_table",
"call_ref",
"data",
"elem",
"extern",
"func",
"global",
"if",
"linking",
"local_get",
"local_init",
"ref_as_non_null",
"ref_cast",
"ref_eq",
"ref_is_null",
"ref_null",
"ref_test",
"ref",
"return_call_indirect",
"return_call_ref",
"return_call",
"select",
"struct",
"table_sub",
"table",
"type_canon",
"type_equivalence",
"type_rec",
"type_subtyping",
"unreached_invalid",
"unreached_valid",
]
.contains(&testname)
{
return true;
}
}

match env::var("CARGO_CFG_TARGET_ARCH").unwrap().as_str() {
"s390x" => {
// TODO(#6530): These tests require tail calls, but s390x
Expand Down
2 changes: 1 addition & 1 deletion cranelift/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ serde_derive = { workspace = true, optional = true }
bincode = { workspace = true, optional = true }
gimli = { workspace = true, features = ["write"], optional = true }
smallvec = { workspace = true }
regalloc2 = { workspace = true, features = ["checker"] }
regalloc2 = { workspace = true, features = ["checker", "trace-log"] }
souper-ir = { version = "2.1.0", optional = true }
sha2 = { version = "0.10.2", optional = true }
# It is a goal of the cranelift-codegen crate to have minimal external dependencies.
Expand Down
3 changes: 2 additions & 1 deletion cranelift/codegen/src/ir/memflags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ impl MemFlags {
0b1001 => Some(TrapCode::UnreachableCodeReached),
0b1010 => Some(TrapCode::Interrupt),
0b1011 => Some(TrapCode::NullReference),
// 0b1100 => {} not allocated
0b1100 => Some(TrapCode::NullI31Ref),
// 0b1101 => {} not allocated
// 0b1110 => {} not allocated
0b1111 => None,
Expand Down Expand Up @@ -367,6 +367,7 @@ impl MemFlags {
Some(TrapCode::UnreachableCodeReached) => 0b1001,
Some(TrapCode::Interrupt) => 0b1010,
Some(TrapCode::NullReference) => 0b1011,
Some(TrapCode::NullI31Ref) => 0b1100,
None => 0b1111,

Some(TrapCode::User(_)) => panic!("cannot set user trap code in mem flags"),
Expand Down
5 changes: 5 additions & 0 deletions cranelift/codegen/src/ir/trapcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ pub enum TrapCode {

/// A null reference was encountered which was required to be non-null.
NullReference,

/// A null `i31ref` was encountered which was required to be non-null.
NullI31Ref,
}

impl TrapCode {
Expand Down Expand Up @@ -93,6 +96,7 @@ impl Display for TrapCode {
Interrupt => "interrupt",
User(x) => return write!(f, "user{}", x),
NullReference => "null_reference",
NullI31Ref => "null_i31ref",
};
f.write_str(identifier)
}
Expand All @@ -116,6 +120,7 @@ impl FromStr for TrapCode {
"unreachable" => Ok(UnreachableCodeReached),
"interrupt" => Ok(Interrupt),
"null_reference" => Ok(NullReference),
"null_i31ref" => Ok(NullI31Ref),
_ if s.starts_with("user") => s[4..].parse().map(User).map_err(|_| ()),
_ => Err(()),
}
Expand Down
4 changes: 2 additions & 2 deletions cranelift/codegen/src/ir/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ impl Type {
self.replace_lanes(match self.lane_type() {
I8 => I8,
I16 => I16,
I32 | F32 => I32,
I64 | F64 => I64,
I32 | F32 | R32 => I32,
I64 | F64 | R64 => I64,
I128 => I128,
_ => unimplemented!(),
})
Expand Down
Loading