Make wasmtime_environ::Module serializable (#2005)

* Define WasmType/WasmFuncType in the Cranelift
* Make `Module` serializable
This commit is contained in:
Yury Delendik
2020-07-10 15:56:43 -05:00
committed by GitHub
parent c3d385e935
commit b2551bb4d0
17 changed files with 205 additions and 62 deletions

View File

@@ -11,6 +11,8 @@ use crate::machinst::RelocDistance;
use alloc::vec::Vec;
use core::fmt;
use core::str::FromStr;
#[cfg(feature = "enable-serde")]
use serde::{Deserialize, Serialize};
/// Function signature.
///
@@ -20,6 +22,7 @@ use core::str::FromStr;
/// A signature can optionally include ISA-specific ABI information which specifies exactly how
/// arguments and return values are passed.
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
pub struct Signature {
/// The arguments passed to the function.
pub params: Vec<AbiParam>,
@@ -145,6 +148,7 @@ impl fmt::Display for Signature {
/// This describes the value type being passed to or from a function along with flags that affect
/// how the argument is passed.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
pub struct AbiParam {
/// Type of the argument value.
pub value_type: Type,
@@ -255,6 +259,7 @@ impl fmt::Display for AbiParam {
/// On some architectures, small integer function arguments are extended to the width of a
/// general-purpose register.
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
pub enum ArgumentExtension {
/// No extension, high bits are indeterminate.
None,
@@ -272,6 +277,7 @@ pub enum ArgumentExtension {
///
/// The argument purpose is used to indicate any special meaning of an argument or return value.
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
pub enum ArgumentPurpose {
/// A normal user program value passed to or from a function.
Normal,