-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: (wasm-smith): allow specifying the set of valid imports
- Loading branch information
Showing
3 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/// TODO | ||
#[derive(Debug)] | ||
pub struct Import { | ||
/// TODO | ||
pub module: String, | ||
/// TODO | ||
pub name: Option<String>, | ||
/// TODO | ||
pub desc: EntityDesc, | ||
} | ||
|
||
/// TODO | ||
#[non_exhaustive] | ||
#[derive(Debug)] | ||
pub enum EntityDesc { | ||
/// TODO | ||
Func(FuncType), | ||
/// TODO | ||
Global(GlobalType), | ||
/// TODO | ||
Table(TableType), | ||
/// TODO | ||
Memory(MemoryType), | ||
/// TODO | ||
Instance(InstanceType), | ||
} | ||
|
||
/// A function type. | ||
#[derive(Clone, Debug, PartialEq, Eq, Hash)] | ||
pub struct FuncType { | ||
/// Types of parameters of the function. | ||
pub params: Vec<ValType>, | ||
/// Types of results of the function. | ||
pub results: Vec<ValType>, | ||
} | ||
|
||
/// TODO | ||
#[derive(Clone, Debug, PartialEq)] | ||
pub struct GlobalType { | ||
/// TODO | ||
pub val_type: ValType, | ||
/// TODO | ||
pub mutable: bool, | ||
} | ||
|
||
/// Primitive WASM type. | ||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] | ||
#[non_exhaustive] | ||
pub enum ValType { | ||
/// Signed 32-bit integer. | ||
I32, | ||
/// Signed 64-bit integer. | ||
I64, | ||
/// 32-bit floating point number. | ||
F32, | ||
/// 64-bit floating point number. | ||
F64, | ||
/// TODO: | ||
V128, | ||
/// TODO: | ||
FuncRef, | ||
/// TODO: | ||
ExternRef, | ||
} | ||
|
||
/// TODO: | ||
#[derive(Clone, Debug)] | ||
pub struct MemoryType { | ||
/// TODO: | ||
pub limits: Limits, | ||
} | ||
|
||
/// TODO: | ||
#[derive(Clone, Debug)] | ||
pub struct TableType { | ||
/// TODO: | ||
pub limits: Limits, | ||
/// TODO: | ||
pub elem_ty: ValType, | ||
} | ||
|
||
/// TODO: | ||
#[derive(Clone, Debug)] | ||
pub struct Limits { | ||
/// TODO: | ||
pub min: u32, | ||
/// TODO: | ||
pub max: Option<u32>, | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct InstanceType { | ||
pub exports: indexmap::IndexMap<String, EntityDesc>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(module | ||
(import "env" "tbl" (table (;0;) 1 16 funcref)) | ||
(import "vars" "g" (global (;0;) (mut i32))) | ||
(alias 0 "g" (global (;1;))) | ||
(alias 0 "g" (global (;2;))) | ||
(memory (;0;) 28083) | ||
(global (;3;) (mut f64) (f64.const 0x1.586097aea0767p+157 (;=245755863760007340000000000000000000000000000000;))) | ||
(global (;4;) (mut f64) (f64.const -0x1.b1d12363b1833p-495 (;=-0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016566039552511124;)))) |