Skip to content

Commit 33fa88f

Browse files
committed
Resond to feedback
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
1 parent a2738c0 commit 33fa88f

2 files changed

Lines changed: 10 additions & 28 deletions

File tree

src/hyperlight_wasm/src/sandbox/proto_wasm_sandbox.rs

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ limitations under the License.
1616

1717
use std::collections::HashMap;
1818

19-
use hyperlight_common::flatbuffer_wrappers::function_types::{ParameterType, ReturnType};
2019
use hyperlight_common::flatbuffer_wrappers::host_function_definition::HostFunctionDefinition;
2120
use hyperlight_common::flatbuffer_wrappers::host_function_details::HostFunctionDetails;
2221
use hyperlight_host::func::{HostFunction, ParameterTuple, Registerable, SupportedReturnType};
@@ -52,7 +51,14 @@ impl Registerable for ProtoWasmSandbox {
5251

5352
// Track the host function definition for pushing to guest at load time.
5453
// matching hyperlight-core's FunctionRegistry behavior.
55-
self.track_host_function_definition(name, Args::TYPE, Output::TYPE);
54+
self.host_function_definitions.insert(
55+
name.to_string(),
56+
HostFunctionDefinition {
57+
function_name: name.to_string(),
58+
parameter_types: Some(Args::TYPE.to_vec()),
59+
return_type: Output::TYPE,
60+
},
61+
);
5662
Ok(())
5763
}
5864
}
@@ -129,29 +135,7 @@ impl ProtoWasmSandbox {
129135
name: impl AsRef<str>,
130136
host_func: impl Into<HostFunction<Output, Args>>,
131137
) -> Result<()> {
132-
self.inner
133-
.as_mut()
134-
.ok_or(new_error!("inner sandbox was none"))?
135-
.register(&name, host_func)?;
136-
137-
self.track_host_function_definition(name.as_ref(), Args::TYPE, Output::TYPE);
138-
Ok(())
139-
}
140-
141-
fn track_host_function_definition(
142-
&mut self,
143-
name: &str,
144-
parameter_types: &[ParameterType],
145-
return_type: ReturnType,
146-
) {
147-
self.host_function_definitions.insert(
148-
name.to_string(),
149-
HostFunctionDefinition {
150-
function_name: name.to_string(),
151-
parameter_types: Some(parameter_types.to_vec()),
152-
return_type,
153-
},
154-
);
138+
self.register_host_function(name.as_ref(), host_func)
155139
}
156140

157141
/// Register the given host printing function `print_func` with `self`.

src/hyperlight_wasm/src/sandbox/sandbox_builder.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ use hyperlight_host::{GuestBinary, HyperlightError, Result, is_hypervisor_presen
2020

2121
use super::proto_wasm_sandbox::ProtoWasmSandbox;
2222

23-
// use unreasonably large minimum stack/heap/input data sizes for now to
24-
// deal with the size of wasmtime/wasi-libc aot artifacts
25-
// use reasonably large minimum scratch/heap/input data sizes
23+
// use large minimum scratch/heap/input data sizes
2624
// to deal with the size of wasmtime/wasi-libc aot artifacts
2725
pub const MIN_SCRATCH_SIZE: usize = 2 * 1024 * 1024;
2826
pub const MIN_INPUT_DATA_SIZE: usize = 192 * 1024;

0 commit comments

Comments
 (0)