Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 2 additions & 3 deletions src/hyperlight_component_util/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,13 @@ fn emit_component<'a, 'b, 'c>(s: &'c mut State<'a, 'b>, wn: WitName, ct: &'c Com
#(#exports)*
}
impl #ns::#r#trait for ::hyperlight_host::sandbox::UninitializedSandbox {
type Exports<I: #ns::#import_trait + ::std::marker::Send> = #wrapper_name<I, ::hyperlight_host::func::call_ctx::MultiUseGuestCallContext>;
type Exports<I: #ns::#import_trait + ::std::marker::Send> = #wrapper_name<I, ::hyperlight_host::sandbox::initialized_multi_use::MultiUseSandbox>;
fn instantiate<I: #ns::#import_trait + ::std::marker::Send + 'static>(mut self, i: I) -> Self::Exports<I> {
let rts = register_host_functions(&mut self, i);
let noop = ::core::default::Default::default();
let sb = ::hyperlight_host::sandbox_state::sandbox::EvolvableSandbox::evolve(self, noop).unwrap();
let cc = ::hyperlight_host::func::call_ctx::MultiUseGuestCallContext::start(sb);
#wrapper_name {
sb: cc,
sb,
rt: rts,
}
}
Expand Down
28 changes: 8 additions & 20 deletions src/hyperlight_host/benches/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,9 @@ fn guest_call_benchmark(c: &mut Criterion) {
// Benchmarks a single guest function call.
// The benchmark does **not** include the time to reset the sandbox memory after the call.
group.bench_function("guest_call", |b| {
let mut call_ctx = create_multiuse_sandbox().new_call_context();
let mut sbox = create_multiuse_sandbox();

b.iter(|| {
call_ctx
.call::<String>("Echo", "hello\n".to_string())
.unwrap()
});
b.iter(|| sbox.call::<String>("Echo", "hello\n".to_string()).unwrap());
});

// Benchmarks a single guest function call.
Expand All @@ -69,11 +65,14 @@ fn guest_call_benchmark(c: &mut Criterion) {
.register("HostAdd", |a: i32, b: i32| Ok(a + b))
.unwrap();

let multiuse_sandbox: MultiUseSandbox =
let mut multiuse_sandbox: MultiUseSandbox =
uninitialized_sandbox.evolve(Noop::default()).unwrap();
let mut call_ctx = multiuse_sandbox.new_call_context();

b.iter(|| call_ctx.call::<i32>("Add", (1_i32, 41_i32)).unwrap());
b.iter(|| {
multiuse_sandbox
.call::<i32>("Add", (1_i32, 41_i32))
.unwrap()
});
});

group.finish();
Expand Down Expand Up @@ -139,17 +138,6 @@ fn sandbox_benchmark(c: &mut Criterion) {
b.iter(create_multiuse_sandbox);
});

// Benchmarks the time to create a new sandbox and create a new call context.
// Does **not** include the time to drop the sandbox or the call context.
group.bench_function("create_sandbox_and_call_context", |b| {
b.iter_with_large_drop(|| create_multiuse_sandbox().new_call_context());
});

// Benchmarks the time to create a new sandbox, create a new call context, and drop the call context.
group.bench_function("create_sandbox_and_call_context_and_drop", |b| {
b.iter(|| create_multiuse_sandbox().new_call_context());
});

group.finish();
}

Expand Down
235 changes: 0 additions & 235 deletions src/hyperlight_host/src/func/call_ctx.rs

This file was deleted.

4 changes: 0 additions & 4 deletions src/hyperlight_host/src/func/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

/// Context structures used to allow the user to call one or more guest
/// functions on the same Hyperlight sandbox instance, all from within the
/// same state and mutual exclusion context.
pub mod call_ctx;
/// Functionality to check for errors after a guest call
pub(crate) mod guest_err;
/// Definitions and functionality to enable guest-to-host function calling,
Expand Down
3 changes: 0 additions & 3 deletions src/hyperlight_host/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ pub use sandbox::is_hypervisor_present;
/// The re-export for the `GuestBinary` type
pub use sandbox::uninitialized::GuestBinary;

/// The re-export for the `MultiUseGuestCallContext` type`
pub use crate::func::call_ctx::MultiUseGuestCallContext;

/// The universal `Result` type used throughout the Hyperlight codebase.
pub type Result<T> = core::result::Result<T, error::HyperlightError>;

Expand Down
Loading