Skip to content

Commit e929cb7

Browse files
committed
fixup! stack-switching: add stub Val::ContRef
1 parent 7d4e678 commit e929cb7

6 files changed

Lines changed: 19 additions & 1 deletion

File tree

crates/c-api/src/val.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ impl wasm_val_t {
9898
Val::ExternRef(_) => crate::abort("creating a wasm_val_t from an externref"),
9999
Val::ExnRef(_) => crate::abort("creating a wasm_val_t from an exnref"),
100100
Val::V128(_) => crate::abort("creating a wasm_val_t from a v128"),
101+
Val::ContRef(_) => crate::abort("creating a wasm_val_t from a contref"),
101102
}
102103
}
103104

@@ -259,6 +260,7 @@ impl wasmtime_val_t {
259260
v128: val.as_u128().to_le_bytes(),
260261
},
261262
},
263+
Val::ContRef(_) => crate::abort("contrefs not yet supported in C API (#10248)"),
262264
}
263265
}
264266

crates/fuzzing/src/generators/value.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub enum DiffValue {
1818
ExternRef { null: bool },
1919
AnyRef { null: bool },
2020
ExnRef { null: bool },
21+
ContRef { null: bool },
2122
}
2223

2324
impl DiffValue {
@@ -32,6 +33,7 @@ impl DiffValue {
3233
DiffValue::ExternRef { .. } => DiffValueType::ExternRef,
3334
DiffValue::AnyRef { .. } => DiffValueType::AnyRef,
3435
DiffValue::ExnRef { .. } => DiffValueType::ExnRef,
36+
DiffValue::ContRef { .. } => DiffValueType::ContRef,
3537
}
3638
}
3739

@@ -189,6 +191,7 @@ impl DiffValue {
189191
ExternRef => DiffValue::ExternRef { null: true },
190192
AnyRef => DiffValue::AnyRef { null: true },
191193
ExnRef => DiffValue::ExnRef { null: true },
194+
ContRef => DiffValue::ContRef { null: true },
192195
};
193196
arbitrary::Result::Ok(val)
194197
}
@@ -236,6 +239,7 @@ impl Hash for DiffValue {
236239
DiffValue::FuncRef { null } => null.hash(state),
237240
DiffValue::AnyRef { null } => null.hash(state),
238241
DiffValue::ExnRef { null } => null.hash(state),
242+
DiffValue::ContRef { null } => null.hash(state),
239243
}
240244
}
241245
}
@@ -273,6 +277,7 @@ impl PartialEq for DiffValue {
273277
(Self::ExternRef { null: a }, Self::ExternRef { null: b }) => a == b,
274278
(Self::AnyRef { null: a }, Self::AnyRef { null: b }) => a == b,
275279
(Self::ExnRef { null: a }, Self::ExnRef { null: b }) => a == b,
280+
(Self::ContRef { null: a }, Self::ContRef { null: b }) => a == b,
276281
_ => false,
277282
}
278283
}
@@ -291,6 +296,7 @@ pub enum DiffValueType {
291296
ExternRef,
292297
AnyRef,
293298
ExnRef,
299+
ContRef,
294300
}
295301

296302
impl TryFrom<wasmtime::ValType> for DiffValueType {
@@ -310,6 +316,7 @@ impl TryFrom<wasmtime::ValType> for DiffValueType {
310316
(true, HeapType::I31) => Ok(Self::AnyRef),
311317
(true, HeapType::None) => Ok(Self::AnyRef),
312318
(true, HeapType::Exn) => Ok(Self::ExnRef),
319+
(true, HeapType::Cont) => Ok(Self::ContRef),
313320
_ => Err("non-null reference types are not supported yet"),
314321
},
315322
}

crates/fuzzing/src/oracles/diff_spec.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ impl From<&DiffValue> for SpecValue {
107107
DiffValue::FuncRef { .. }
108108
| DiffValue::ExternRef { .. }
109109
| DiffValue::AnyRef { .. }
110-
| DiffValue::ExnRef { .. } => {
110+
| DiffValue::ExnRef { .. }
111+
| DiffValue::ContRef { .. } => {
111112
unimplemented!()
112113
}
113114
}

crates/fuzzing/src/oracles/diff_v8.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ impl DiffInstance for V8Instance {
191191
DiffValue::V128(_) => return Ok(None),
192192
DiffValue::AnyRef { .. } => unimplemented!(),
193193
DiffValue::ExnRef { .. } => unimplemented!(),
194+
DiffValue::ContRef { .. } => unimplemented!(),
194195
});
195196
}
196197
// JS doesn't support v128 return values
@@ -316,6 +317,7 @@ fn get_diff_value(
316317
DiffValueType::AnyRef => unimplemented!(),
317318
DiffValueType::ExnRef => unimplemented!(),
318319
DiffValueType::V128 => unreachable!(),
320+
DiffValueType::ContRef => unimplemented!(),
319321
}
320322
}
321323

crates/fuzzing/src/oracles/diff_wasmi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ impl From<&DiffValue> for wasmi::Val {
195195
}
196196
DiffValue::AnyRef { .. } => unimplemented!(),
197197
DiffValue::ExnRef { .. } => unimplemented!(),
198+
DiffValue::ContRef { .. } => unimplemented!(),
198199
}
199200
}
200201
}

crates/fuzzing/src/oracles/diff_wasmtime.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ impl From<&DiffValue> for Val {
227227
assert!(null);
228228
Val::ExnRef(None)
229229
}
230+
DiffValue::ContRef { null } => {
231+
assert!(null);
232+
Val::ExnRef(None)
233+
}
230234
}
231235
}
232236
}
@@ -243,6 +247,7 @@ impl From<Val> for DiffValue {
243247
Val::FuncRef(r) => DiffValue::FuncRef { null: r.is_none() },
244248
Val::AnyRef(r) => DiffValue::AnyRef { null: r.is_none() },
245249
Val::ExnRef(e) => DiffValue::ExnRef { null: e.is_none() },
250+
Val::ContRef(c) => DiffValue::ContRef { null: c.is_none() },
246251
}
247252
}
248253
}

0 commit comments

Comments
 (0)