Skip to content

Commit 96c775c

Browse files
committed
Remove MultiUseGuestCallContext
Signed-off-by: Jorge Prendes <[email protected]>
1 parent a4f3b58 commit 96c775c

File tree

8 files changed

+28
-351
lines changed

8 files changed

+28
-351
lines changed

src/hyperlight_component_util/src/host.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,14 +357,13 @@ fn emit_component<'a, 'b, 'c>(s: &'c mut State<'a, 'b>, wn: WitName, ct: &'c Com
357357
#(#exports)*
358358
}
359359
impl #ns::#r#trait for ::hyperlight_host::sandbox::UninitializedSandbox {
360-
type Exports<I: #ns::#import_trait + ::std::marker::Send> = #wrapper_name<I, ::hyperlight_host::func::call_ctx::MultiUseGuestCallContext>;
360+
type Exports<I: #ns::#import_trait + ::std::marker::Send> = #wrapper_name<I, ::hyperlight_host::sandbox::initialized_multi_use::MultiUseSandbox>;
361361
fn instantiate<I: #ns::#import_trait + ::std::marker::Send + 'static>(mut self, i: I) -> Self::Exports<I> {
362362
let rts = register_host_functions(&mut self, i);
363363
let noop = ::core::default::Default::default();
364364
let sb = ::hyperlight_host::sandbox_state::sandbox::EvolvableSandbox::evolve(self, noop).unwrap();
365-
let cc = ::hyperlight_host::func::call_ctx::MultiUseGuestCallContext::start(sb);
366365
#wrapper_name {
367-
sb: cc,
366+
sb,
368367
rt: rts,
369368
}
370369
}

src/hyperlight_host/benches/benchmarks.rs

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,9 @@ fn guest_call_benchmark(c: &mut Criterion) {
3838
// Benchmarks a single guest function call.
3939
// The benchmark does **not** include the time to reset the sandbox memory after the call.
4040
group.bench_function("guest_call", |b| {
41-
let mut call_ctx = create_multiuse_sandbox().new_call_context();
41+
let mut sbox = create_multiuse_sandbox();
4242

43-
b.iter(|| {
44-
call_ctx
45-
.call::<String>("Echo", "hello\n".to_string())
46-
.unwrap()
47-
});
43+
b.iter(|| sbox.call::<String>("Echo", "hello\n".to_string()).unwrap());
4844
});
4945

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

72-
let multiuse_sandbox: MultiUseSandbox =
68+
let mut multiuse_sandbox: MultiUseSandbox =
7369
uninitialized_sandbox.evolve(Noop::default()).unwrap();
74-
let mut call_ctx = multiuse_sandbox.new_call_context();
7570

76-
b.iter(|| call_ctx.call::<i32>("Add", (1_i32, 41_i32)).unwrap());
71+
b.iter(|| {
72+
multiuse_sandbox
73+
.call::<i32>("Add", (1_i32, 41_i32))
74+
.unwrap()
75+
});
7776
});
7877

7978
group.finish();
@@ -139,17 +138,6 @@ fn sandbox_benchmark(c: &mut Criterion) {
139138
b.iter(create_multiuse_sandbox);
140139
});
141140

142-
// Benchmarks the time to create a new sandbox and create a new call context.
143-
// Does **not** include the time to drop the sandbox or the call context.
144-
group.bench_function("create_sandbox_and_call_context", |b| {
145-
b.iter_with_large_drop(|| create_multiuse_sandbox().new_call_context());
146-
});
147-
148-
// Benchmarks the time to create a new sandbox, create a new call context, and drop the call context.
149-
group.bench_function("create_sandbox_and_call_context_and_drop", |b| {
150-
b.iter(|| create_multiuse_sandbox().new_call_context());
151-
});
152-
153141
group.finish();
154142
}
155143

src/hyperlight_host/src/func/call_ctx.rs

Lines changed: 0 additions & 235 deletions
This file was deleted.

src/hyperlight_host/src/func/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
/// Context structures used to allow the user to call one or more guest
18-
/// functions on the same Hyperlight sandbox instance, all from within the
19-
/// same state and mutual exclusion context.
20-
pub mod call_ctx;
2117
/// Functionality to check for errors after a guest call
2218
pub(crate) mod guest_err;
2319
/// Definitions and functionality to enable guest-to-host function calling,

src/hyperlight_host/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ pub use sandbox::is_hypervisor_present;
8585
/// The re-export for the `GuestBinary` type
8686
pub use sandbox::uninitialized::GuestBinary;
8787

88-
/// The re-export for the `MultiUseGuestCallContext` type`
89-
pub use crate::func::call_ctx::MultiUseGuestCallContext;
90-
9188
/// The universal `Result` type used throughout the Hyperlight codebase.
9289
pub type Result<T> = core::result::Result<T, error::HyperlightError>;
9390

0 commit comments

Comments
 (0)