Refactor naming and crates info (#8)
* Refactor naming and crates info This commit: * changes workspace crates to have a `wiggle_` prefix in names * rename `memory` module of `wiggle-memory` crate to `runtime` * fixes authors of all crates * Rename wiggle memory crate to runtime
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
[package]
|
||||
name = "wiggle"
|
||||
version = "0.1.0"
|
||||
authors = ["Jakub Konka <kubkonk@jakubkonka.com>"]
|
||||
authors = ["Pat Hickey <phickey@fastly.com>", "Jakub Konka <kubkonk@jakubkonka.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
generate = { path = "crates/generate" }
|
||||
memory = { path = "crates/memory" }
|
||||
wiggle-generate = { path = "crates/generate" }
|
||||
wiggle-runtime = { path = "crates/runtime" }
|
||||
|
||||
[dev-dependencies]
|
||||
proptest = "0.9"
|
||||
@@ -14,6 +14,6 @@ proptest = "0.9"
|
||||
[workspace]
|
||||
members = [
|
||||
"crates/generate",
|
||||
"crates/memory"
|
||||
"crates/runtime"
|
||||
]
|
||||
exclude = ["crates/WASI"]
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
[package]
|
||||
name = "generate"
|
||||
name = "wiggle-generate"
|
||||
version = "0.1.0"
|
||||
authors = ["Jakub Konka <kubkon@jakubkonka.com>"]
|
||||
authors = ["Pat Hickey <phickey@fastly.com>", "Jakub Konka <kubkon@jakubkonka.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
memory = { path = "../memory" }
|
||||
wiggle-runtime = { path = "../runtime" }
|
||||
witx = { path = "../WASI/tools/witx" }
|
||||
quote = "1.0"
|
||||
proc-macro2 = "1.0"
|
||||
|
||||
@@ -30,7 +30,7 @@ pub fn define_func(names: &Names, func: &witx::InterfaceFunc) -> TokenStream {
|
||||
});
|
||||
|
||||
let abi_args = quote!(
|
||||
ctx: &mut #ctx_type, memory: &mut ::memory::GuestMemory,
|
||||
ctx: &mut #ctx_type, memory: &mut wiggle_runtime::GuestMemory,
|
||||
#(#params),*
|
||||
);
|
||||
let abi_ret = if let Some(ret) = &coretype.ret {
|
||||
@@ -62,8 +62,8 @@ pub fn define_func(names: &Names, func: &witx::InterfaceFunc) -> TokenStream {
|
||||
};
|
||||
let err_typename = names.type_ref(&tref, anon_lifetime());
|
||||
quote! {
|
||||
let e = ::memory::GuestError::InFunc { funcname: #funcname, location: #location, err: Box::new(e) };
|
||||
let err: #err_typename = ::memory::GuestErrorType::from_error(e, ctx);
|
||||
let e = wiggle_runtime::GuestError::InFunc { funcname: #funcname, location: #location, err: Box::new(e) };
|
||||
let err: #err_typename = wiggle_runtime::GuestErrorType::from_error(e, ctx);
|
||||
return #abi_ret::from(err);
|
||||
}
|
||||
} else {
|
||||
@@ -111,7 +111,7 @@ pub fn define_func(names: &Names, func: &witx::InterfaceFunc) -> TokenStream {
|
||||
let success = if let Some(ref err_type) = err_type {
|
||||
let err_typename = names.type_ref(&err_type, anon_lifetime());
|
||||
quote! {
|
||||
let success:#err_typename = ::memory::GuestErrorType::success();
|
||||
let success:#err_typename = wiggle_runtime::GuestErrorType::success();
|
||||
#abi_ret::from(success)
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -62,11 +62,11 @@ impl Names {
|
||||
witx::Type::Builtin(builtin) => self.builtin_type(*builtin),
|
||||
witx::Type::Pointer(pointee) => {
|
||||
let pointee_type = self.type_ref(&pointee, lifetime.clone());
|
||||
quote!(::memory::GuestPtrMut<#lifetime, #pointee_type>)
|
||||
quote!(wiggle_runtime::GuestPtrMut<#lifetime, #pointee_type>)
|
||||
}
|
||||
witx::Type::ConstPointer(pointee) => {
|
||||
let pointee_type = self.type_ref(&pointee, lifetime.clone());
|
||||
quote!(::memory::GuestPtr<#lifetime, #pointee_type>)
|
||||
quote!(wiggle_runtime::GuestPtr<#lifetime, #pointee_type>)
|
||||
}
|
||||
_ => unimplemented!("anonymous type ref"),
|
||||
},
|
||||
|
||||
@@ -21,11 +21,14 @@ pub fn define_datatype(names: &Names, namedtype: &witx::NamedType) -> TokenStrea
|
||||
witx::Type::Union(_) => unimplemented!("union types"),
|
||||
witx::Type::Handle(_h) => unimplemented!("handle types"),
|
||||
witx::Type::Builtin(b) => define_builtin(names, &namedtype.name, *b),
|
||||
witx::Type::Pointer(p) => {
|
||||
define_witx_pointer(names, &namedtype.name, quote!(::memory::GuestPtrMut), p)
|
||||
}
|
||||
witx::Type::Pointer(p) => define_witx_pointer(
|
||||
names,
|
||||
&namedtype.name,
|
||||
quote!(wiggle_runtime::GuestPtrMut),
|
||||
p,
|
||||
),
|
||||
witx::Type::ConstPointer(p) => {
|
||||
define_witx_pointer(names, &namedtype.name, quote!(::memory::GuestPtr), p)
|
||||
define_witx_pointer(names, &namedtype.name, quote!(wiggle_runtime::GuestPtr), p)
|
||||
}
|
||||
witx::Type::Array { .. } => unimplemented!("array types"),
|
||||
},
|
||||
@@ -69,18 +72,18 @@ fn define_enum(names: &Names, name: &witx::Id, e: &witx::EnumDatatype) -> TokenS
|
||||
}
|
||||
|
||||
impl ::std::convert::TryFrom<#repr> for #ident {
|
||||
type Error = ::memory::GuestError;
|
||||
fn try_from(value: #repr) -> Result<#ident, ::memory::GuestError> {
|
||||
type Error = wiggle_runtime::GuestError;
|
||||
fn try_from(value: #repr) -> Result<#ident, wiggle_runtime::GuestError> {
|
||||
match value as usize {
|
||||
#(#tryfrom_repr_cases),*,
|
||||
_ => Err(::memory::GuestError::InvalidEnumValue(stringify!(#ident))),
|
||||
_ => Err(wiggle_runtime::GuestError::InvalidEnumValue(stringify!(#ident))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::convert::TryFrom<#abi_repr> for #ident {
|
||||
type Error = ::memory::GuestError;
|
||||
fn try_from(value: #abi_repr) -> Result<#ident, ::memory::GuestError> {
|
||||
type Error = wiggle_runtime::GuestError;
|
||||
fn try_from(value: #abi_repr) -> Result<#ident, wiggle_runtime::GuestError> {
|
||||
#ident::try_from(value as #repr)
|
||||
}
|
||||
}
|
||||
@@ -99,7 +102,7 @@ fn define_enum(names: &Names, name: &witx::Id, e: &witx::EnumDatatype) -> TokenS
|
||||
}
|
||||
}
|
||||
|
||||
impl ::memory::GuestType for #ident {
|
||||
impl wiggle_runtime::GuestType for #ident {
|
||||
fn size() -> u32 {
|
||||
::std::mem::size_of::<#repr>() as u32
|
||||
}
|
||||
@@ -109,7 +112,7 @@ fn define_enum(names: &Names, name: &witx::Id, e: &witx::EnumDatatype) -> TokenS
|
||||
fn name() -> String {
|
||||
stringify!(#ident).to_owned()
|
||||
}
|
||||
fn validate<'a>(location: &::memory::GuestPtr<'a, #ident>) -> Result<(), ::memory::GuestError> {
|
||||
fn validate<'a>(location: &wiggle_runtime::GuestPtr<'a, #ident>) -> Result<(), wiggle_runtime::GuestError> {
|
||||
use ::std::convert::TryFrom;
|
||||
let raw: #repr = unsafe { (location.as_raw() as *const #repr).read() };
|
||||
let _ = #ident::try_from(raw)?;
|
||||
@@ -117,15 +120,15 @@ fn define_enum(names: &Names, name: &witx::Id, e: &witx::EnumDatatype) -> TokenS
|
||||
}
|
||||
}
|
||||
|
||||
impl ::memory::GuestTypeCopy for #ident {}
|
||||
impl ::memory::GuestTypeClone for #ident {
|
||||
fn read_from_guest(location: &::memory::GuestPtr<#ident>) -> Result<#ident, ::memory::GuestError> {
|
||||
impl wiggle_runtime::GuestTypeCopy for #ident {}
|
||||
impl wiggle_runtime::GuestTypeClone for #ident {
|
||||
fn read_from_guest(location: &wiggle_runtime::GuestPtr<#ident>) -> Result<#ident, wiggle_runtime::GuestError> {
|
||||
use ::std::convert::TryFrom;
|
||||
let raw: #repr = unsafe { (location.as_raw() as *const #repr).read() };
|
||||
let val = #ident::try_from(raw)?;
|
||||
Ok(val)
|
||||
}
|
||||
fn write_to_guest(&self, location: &::memory::GuestPtrMut<#ident>) {
|
||||
fn write_to_guest(&self, location: &wiggle_runtime::GuestPtrMut<#ident>) {
|
||||
let val: #repr = #repr::from(*self);
|
||||
unsafe { (location.as_raw() as *mut #repr).write(val) };
|
||||
}
|
||||
@@ -192,13 +195,13 @@ fn define_copy_struct(names: &Names, name: &witx::Id, s: &witx::StructDatatype)
|
||||
quote! {
|
||||
#type_::validate(
|
||||
&ptr.cast(#offset).map_err(|e|
|
||||
::memory::GuestError::InDataField{
|
||||
wiggle_runtime::GuestError::InDataField{
|
||||
typename: stringify!(#ident).to_owned(),
|
||||
field: stringify!(#fieldname).to_owned(),
|
||||
err: Box::new(e),
|
||||
})?
|
||||
).map_err(|e|
|
||||
::memory::GuestError::InDataField {
|
||||
wiggle_runtime::GuestError::InDataField {
|
||||
typename: stringify!(#ident).to_owned(),
|
||||
field: stringify!(#fieldname).to_owned(),
|
||||
err: Box::new(e),
|
||||
@@ -213,7 +216,7 @@ fn define_copy_struct(names: &Names, name: &witx::Id, s: &witx::StructDatatype)
|
||||
#(#member_decls),*
|
||||
}
|
||||
|
||||
impl ::memory::GuestType for #ident {
|
||||
impl wiggle_runtime::GuestType for #ident {
|
||||
fn size() -> u32 {
|
||||
#size
|
||||
}
|
||||
@@ -223,12 +226,12 @@ fn define_copy_struct(names: &Names, name: &witx::Id, s: &witx::StructDatatype)
|
||||
fn name() -> String {
|
||||
stringify!(#ident).to_owned()
|
||||
}
|
||||
fn validate(ptr: &::memory::GuestPtr<#ident>) -> Result<(), ::memory::GuestError> {
|
||||
fn validate(ptr: &wiggle_runtime::GuestPtr<#ident>) -> Result<(), wiggle_runtime::GuestError> {
|
||||
#(#member_valids)*
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
impl ::memory::GuestTypeCopy for #ident {}
|
||||
impl wiggle_runtime::GuestTypeCopy for #ident {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,11 +249,11 @@ fn define_ptr_struct(names: &Names, name: &witx::Id, s: &witx::StructDatatype) -
|
||||
witx::Type::Builtin(builtin) => names.builtin_type(*builtin),
|
||||
witx::Type::Pointer(pointee) => {
|
||||
let pointee_type = names.type_ref(&pointee, quote!('a));
|
||||
quote!(::memory::GuestPtrMut<'a, #pointee_type>)
|
||||
quote!(wiggle_runtime::GuestPtrMut<'a, #pointee_type>)
|
||||
}
|
||||
witx::Type::ConstPointer(pointee) => {
|
||||
let pointee_type = names.type_ref(&pointee, quote!('a));
|
||||
quote!(::memory::GuestPtr<'a, #pointee_type>)
|
||||
quote!(wiggle_runtime::GuestPtr<'a, #pointee_type>)
|
||||
}
|
||||
_ => unimplemented!("other anonymous struct members"),
|
||||
},
|
||||
@@ -264,11 +267,11 @@ fn define_ptr_struct(names: &Names, name: &witx::Id, s: &witx::StructDatatype) -
|
||||
witx::Type::Builtin(builtin) => names.builtin_type(*builtin),
|
||||
witx::Type::Pointer(pointee) => {
|
||||
let pointee_type = names.type_ref(&pointee, anon_lifetime());
|
||||
quote!(::memory::GuestPtrMut::<#pointee_type>)
|
||||
quote!(wiggle_runtime::GuestPtrMut::<#pointee_type>)
|
||||
}
|
||||
witx::Type::ConstPointer(pointee) => {
|
||||
let pointee_type = names.type_ref(&pointee, anon_lifetime());
|
||||
quote!(::memory::GuestPtr::<#pointee_type>)
|
||||
quote!(wiggle_runtime::GuestPtr::<#pointee_type>)
|
||||
}
|
||||
_ => unimplemented!("other anonymous struct members"),
|
||||
},
|
||||
@@ -278,13 +281,13 @@ fn define_ptr_struct(names: &Names, name: &witx::Id, s: &witx::StructDatatype) -
|
||||
quote! {
|
||||
#type_::validate(
|
||||
&ptr.cast(#offset).map_err(|e|
|
||||
::memory::GuestError::InDataField{
|
||||
wiggle_runtime::GuestError::InDataField{
|
||||
typename: stringify!(#ident).to_owned(),
|
||||
field: stringify!(#fieldname).to_owned(),
|
||||
err: Box::new(e),
|
||||
})?
|
||||
).map_err(|e|
|
||||
::memory::GuestError::InDataField {
|
||||
wiggle_runtime::GuestError::InDataField {
|
||||
typename: stringify!(#ident).to_owned(),
|
||||
field: stringify!(#fieldname).to_owned(),
|
||||
err: Box::new(e),
|
||||
@@ -312,13 +315,13 @@ fn define_ptr_struct(names: &Names, name: &witx::Id, s: &witx::StructDatatype) -
|
||||
witx::Type::Pointer(pointee) => {
|
||||
let pointee_type = names.type_ref(&pointee, anon_lifetime());
|
||||
quote! {
|
||||
let #name = ::memory::GuestPtrMut::<#pointee_type>::read_from_guest(&location.cast(#offset)?)?;
|
||||
let #name = wiggle_runtime::GuestPtrMut::<#pointee_type>::read_from_guest(&location.cast(#offset)?)?;
|
||||
}
|
||||
}
|
||||
witx::Type::ConstPointer(pointee) => {
|
||||
let pointee_type = names.type_ref(&pointee, anon_lifetime());
|
||||
quote! {
|
||||
let #name = ::memory::GuestPtr::<#pointee_type>::read_from_guest(&location.cast(#offset)?)?;
|
||||
let #name = wiggle_runtime::GuestPtr::<#pointee_type>::read_from_guest(&location.cast(#offset)?)?;
|
||||
}
|
||||
}
|
||||
_ => unimplemented!("other anonymous struct members"),
|
||||
@@ -338,7 +341,7 @@ fn define_ptr_struct(names: &Names, name: &witx::Id, s: &witx::StructDatatype) -
|
||||
#(#member_decls),*
|
||||
}
|
||||
|
||||
impl<'a> ::memory::GuestType for #ident<'a> {
|
||||
impl<'a> wiggle_runtime::GuestType for #ident<'a> {
|
||||
fn size() -> u32 {
|
||||
#size
|
||||
}
|
||||
@@ -348,17 +351,17 @@ fn define_ptr_struct(names: &Names, name: &witx::Id, s: &witx::StructDatatype) -
|
||||
fn name() -> String {
|
||||
stringify!(#ident).to_owned()
|
||||
}
|
||||
fn validate(ptr: &::memory::GuestPtr<#ident>) -> Result<(), ::memory::GuestError> {
|
||||
fn validate(ptr: &wiggle_runtime::GuestPtr<#ident>) -> Result<(), wiggle_runtime::GuestError> {
|
||||
#(#member_valids)*
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
impl<'a> ::memory::GuestTypePtr<'a> for #ident<'a> {
|
||||
fn read_from_guest(location: &::memory::GuestPtr<'a, #ident<'a>>) -> Result<#ident<'a>, ::memory::GuestError> {
|
||||
impl<'a> wiggle_runtime::GuestTypePtr<'a> for #ident<'a> {
|
||||
fn read_from_guest(location: &wiggle_runtime::GuestPtr<'a, #ident<'a>>) -> Result<#ident<'a>, wiggle_runtime::GuestError> {
|
||||
#(#member_reads)*
|
||||
Ok(#ident { #(#member_names),* })
|
||||
}
|
||||
fn write_to_guest(&self, location: &::memory::GuestPtrMut<'a, Self>) {
|
||||
fn write_to_guest(&self, location: &wiggle_runtime::GuestPtrMut<'a, Self>) {
|
||||
#(#member_writes)*
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
[package]
|
||||
name = "memory"
|
||||
version = "0.1.0"
|
||||
authors = ["Pat Hickey <phickey@fastly.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
thiserror = "1"
|
||||
8
crates/runtime/Cargo.toml
Normal file
8
crates/runtime/Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "wiggle-runtime"
|
||||
version = "0.1.0"
|
||||
authors = ["Pat Hickey <phickey@fastly.com>", "Jakub Konka <kubkon@jakubkonka.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
thiserror = "1"
|
||||
@@ -4,7 +4,7 @@ mod guest_type;
|
||||
mod memory;
|
||||
mod region;
|
||||
|
||||
pub use self::memory::{GuestMemory, GuestPtr, GuestPtrMut, GuestRef, GuestRefMut};
|
||||
pub use error::GuestError;
|
||||
pub use guest_type::{GuestErrorType, GuestType, GuestTypeClone, GuestTypeCopy, GuestTypePtr};
|
||||
pub use memory::{GuestMemory, GuestPtr, GuestPtrMut, GuestRef, GuestRefMut};
|
||||
pub use region::Region;
|
||||
@@ -1,13 +1,15 @@
|
||||
use memory::GuestRef;
|
||||
use proptest::prelude::*;
|
||||
use wiggle_runtime::{
|
||||
GuestError, GuestErrorType, GuestMemory, GuestPtr, GuestPtrMut, GuestRef, GuestRefMut,
|
||||
};
|
||||
|
||||
generate::from_witx!({
|
||||
wiggle_generate::from_witx!({
|
||||
witx: ["tests/test.witx"],
|
||||
ctx: WasiCtx,
|
||||
});
|
||||
|
||||
pub struct WasiCtx {
|
||||
guest_errors: Vec<::memory::GuestError>,
|
||||
guest_errors: Vec<GuestError>,
|
||||
}
|
||||
|
||||
impl WasiCtx {
|
||||
@@ -27,17 +29,16 @@ impl foo::Foo for WasiCtx {
|
||||
fn baz(
|
||||
&mut self,
|
||||
input1: types::Excuse,
|
||||
input2_ptr: ::memory::GuestPtrMut<types::Excuse>,
|
||||
input3_ptr: ::memory::GuestPtr<types::Excuse>,
|
||||
input4_ptr_ptr: ::memory::GuestPtrMut<::memory::GuestPtr<types::Excuse>>,
|
||||
input2_ptr: GuestPtrMut<types::Excuse>,
|
||||
input3_ptr: GuestPtr<types::Excuse>,
|
||||
input4_ptr_ptr: GuestPtrMut<GuestPtr<types::Excuse>>,
|
||||
) -> Result<(), types::Errno> {
|
||||
println!("BAZ input1 {:?}", input1);
|
||||
// Read enum value from mutable:
|
||||
let mut input2_ref: ::memory::GuestRefMut<types::Excuse> =
|
||||
input2_ptr.as_ref_mut().map_err(|e| {
|
||||
eprintln!("input2_ptr error: {}", e);
|
||||
types::Errno::InvalidArg
|
||||
})?;
|
||||
let mut input2_ref: GuestRefMut<types::Excuse> = input2_ptr.as_ref_mut().map_err(|e| {
|
||||
eprintln!("input2_ptr error: {}", e);
|
||||
types::Errno::InvalidArg
|
||||
})?;
|
||||
let input2: types::Excuse = *input2_ref;
|
||||
println!("input2 {:?}", input2);
|
||||
|
||||
@@ -53,7 +54,7 @@ impl foo::Foo for WasiCtx {
|
||||
println!("wrote to input2_ref {:?}", input3);
|
||||
|
||||
// Read ptr value from mutable ptr:
|
||||
let input4_ptr: ::memory::GuestPtr<types::Excuse> =
|
||||
let input4_ptr: GuestPtr<types::Excuse> =
|
||||
input4_ptr_ptr.read_ptr_from_guest().map_err(|e| {
|
||||
eprintln!("input4_ptr_ptr error: {}", e);
|
||||
types::Errno::InvalidArg
|
||||
@@ -96,12 +97,12 @@ impl foo::Foo for WasiCtx {
|
||||
// it must implement GuestErrorType with type Context = WasiCtx.
|
||||
// The context type should let you do logging or debugging or whatever you need
|
||||
// with these errors. We just push them to vecs.
|
||||
impl ::memory::GuestErrorType for types::Errno {
|
||||
impl GuestErrorType for types::Errno {
|
||||
type Context = WasiCtx;
|
||||
fn success() -> types::Errno {
|
||||
types::Errno::Ok
|
||||
}
|
||||
fn from_error(e: ::memory::GuestError, ctx: &mut WasiCtx) -> types::Errno {
|
||||
fn from_error(e: GuestError, ctx: &mut WasiCtx) -> types::Errno {
|
||||
eprintln!("GUEST ERROR: {:?}", e);
|
||||
ctx.guest_errors.push(e);
|
||||
types::Errno::InvalidArg
|
||||
@@ -200,8 +201,7 @@ impl BatExercise {
|
||||
pub fn test(&self) {
|
||||
let mut ctx = WasiCtx::new();
|
||||
let mut host_memory = HostMemory::new();
|
||||
let mut guest_memory =
|
||||
memory::GuestMemory::new(host_memory.as_mut_ptr(), host_memory.len() as u32);
|
||||
let mut guest_memory = GuestMemory::new(host_memory.as_mut_ptr(), host_memory.len() as u32);
|
||||
|
||||
let bat_err = foo::bat(
|
||||
&mut ctx,
|
||||
@@ -300,8 +300,7 @@ impl BazExercise {
|
||||
pub fn test(&self) {
|
||||
let mut ctx = WasiCtx::new();
|
||||
let mut host_memory = HostMemory::new();
|
||||
let mut guest_memory =
|
||||
memory::GuestMemory::new(host_memory.as_mut_ptr(), host_memory.len() as u32);
|
||||
let mut guest_memory = GuestMemory::new(host_memory.as_mut_ptr(), host_memory.len() as u32);
|
||||
|
||||
*guest_memory
|
||||
.ptr_mut(self.input2_loc.ptr)
|
||||
@@ -399,8 +398,7 @@ impl SumOfPairExercise {
|
||||
pub fn test(&self) {
|
||||
let mut ctx = WasiCtx::new();
|
||||
let mut host_memory = HostMemory::new();
|
||||
let mut guest_memory =
|
||||
memory::GuestMemory::new(host_memory.as_mut_ptr(), host_memory.len() as u32);
|
||||
let mut guest_memory = GuestMemory::new(host_memory.as_mut_ptr(), host_memory.len() as u32);
|
||||
|
||||
*guest_memory
|
||||
.ptr_mut(self.input_loc.ptr)
|
||||
@@ -492,8 +490,7 @@ impl SumPairPtrsExercise {
|
||||
pub fn test(&self) {
|
||||
let mut ctx = WasiCtx::new();
|
||||
let mut host_memory = HostMemory::new();
|
||||
let mut guest_memory =
|
||||
memory::GuestMemory::new(host_memory.as_mut_ptr(), host_memory.len() as u32);
|
||||
let mut guest_memory = GuestMemory::new(host_memory.as_mut_ptr(), host_memory.len() as u32);
|
||||
|
||||
*guest_memory
|
||||
.ptr_mut(self.input_first_loc.ptr)
|
||||
|
||||
Reference in New Issue
Block a user