Skip to content
This repository was archived by the owner on Mar 24, 2022. It is now read-only.
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions lucet-wasi/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ impl<'a> types::GuestErrorConversion for LucetWasiCtx<'a> {
}

impl<'a> types::UserErrorConversion for LucetWasiCtx<'a> {
fn errno_from_error(&self, e: Error) -> types::Errno {
fn errno_from_error(&self, e: Error) -> Result<types::Errno, String> {
debug!("Error: {:?}", e);
e.into()
Ok(e.into())
}
}

Expand Down
1 change: 1 addition & 0 deletions lucet-wiggle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ lucet-wiggle-macro = { path = "./macro", version = "0.7.0-dev" }
lucet-wiggle-generate = { path = "./generate", version = "0.7.0-dev" }
lucet-runtime = { path = "../lucet-runtime", version = "0.7.0-dev" }
wiggle = { path = "../wasmtime/crates/wiggle", version = "0.21.0" }
wiggle-borrow = { path = "../wasmtime/crates/wiggle/borrow", version = "0.21.0" }

[dev-dependencies]
wiggle-test = { path = "../wasmtime/crates/wiggle/test-helpers" }
Expand Down
5 changes: 4 additions & 1 deletion lucet-wiggle/generate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ pub fn generate(
let mut ctx: #ctx_type = #ctx_constructor;
let r = super::#mod_name::#method_name(&ctx, &memory, #(#call_args),*);
{ #post_hook }
r
match r {
Ok(r) => { r },
Err(e) => { lucet_runtime::lucet_hostcall_terminate!(e); }
}
}
}
});
Expand Down
188 changes: 0 additions & 188 deletions lucet-wiggle/src/borrow.rs

This file was deleted.

25 changes: 16 additions & 9 deletions lucet-wiggle/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
mod borrow;

pub use lucet_wiggle_macro::from_witx;
pub use wiggle::*;

pub mod runtime {
use crate::borrow::BorrowChecker;
use lucet_runtime::vmctx::Vmctx;
use wiggle::{BorrowHandle, GuestError, GuestMemory, Region};
use wiggle_borrow::BorrowChecker;

pub struct LucetMemory<'a> {
vmctx: &'a Vmctx,
Expand Down Expand Up @@ -35,14 +33,23 @@ pub mod runtime {
fn has_outstanding_borrows(&self) -> bool {
self.bc.has_outstanding_borrows()
}
fn is_borrowed(&self, r: Region) -> bool {
self.bc.is_borrowed(r)
fn is_mut_borrowed(&self, r: Region) -> bool {
self.bc.is_mut_borrowed(r)
}
fn is_shared_borrowed(&self, r: Region) -> bool {
self.bc.is_shared_borrowed(r)
}
fn mut_borrow(&self, r: Region) -> Result<BorrowHandle, GuestError> {
self.bc.mut_borrow(r)
}
fn shared_borrow(&self, r: Region) -> Result<BorrowHandle, GuestError> {
self.bc.shared_borrow(r)
}
fn borrow(&self, r: Region) -> Result<BorrowHandle, GuestError> {
self.bc.borrow(r)
fn mut_unborrow(&self, h: BorrowHandle) {
self.bc.mut_unborrow(h)
}
fn unborrow(&self, h: BorrowHandle) {
self.bc.unborrow(h)
fn shared_unborrow(&self, h: BorrowHandle) {
self.bc.shared_unborrow(h)
}
}
}
Loading