Repository navigation
Update hyperlight dependencies to 0.18.0 - #561
syntactically wants to merge 6 commits into
Conversation
Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
71340b3 to
8c8224b
Compare
Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
8c8224b to
7b7c876
Compare
It turns out that these mostly do not need to be replaced with new-style h2g queue changes because all the tests end up using mmap regions instead of copying the buffer around. Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
7b7c876 to
44a52c3
Compare
| #[instrument(skip_all, level = "Info")] | ||
| fn init_wasm_runtime(_function_call: FunctionCall) -> Result<Vec<u8>> { | ||
| Ok(get_flatbuffer_result::<i32>(0)) | ||
| fn init_wasm_runtime(_function_call: FunctionCall) -> Result<ReturnValue> { |
There was a problem hiding this comment.
guest_dispatch_function at the bottom of this file still returns Result<Vec<u8>>. hyperlight-guest-bin 0.18 calls it through extern "Rust" fn guest_dispatch_function(FunctionCall) -> Result<ReturnValue>.
| // TODO: check that the next parameter is the correct length | ||
| } | ||
| ReturnValue::VecBytes(b) => to_val_bytes(ctx, get_export, core::iter::once(b.as_ref())), | ||
| ReturnValue::ByteChunks(bs) => to_val_bytes(ctx, get_export, bs.iter().map(|x| x.as_ref())), |
There was a problem hiding this comment.
hostfunc_type declares an i64 result for ByteChunks (packed ptr and len), but this returns Val::I32(addr). Wasmtime fails the call after the host callback has run. VecBytes has the same bug (see the TODO in hostfuncs.rs).
|
|
||
| /// Set the maximum number of guest pages used for Host2Guest buffers | ||
| pub fn with_h2g_pool_pages(mut self, pages: usize) -> Self { | ||
| if pages > (MIN_INPUT_DATA_SIZE / hyperlight_common::vmem::PAGE_SIZE + 1) { |
There was a problem hiding this comment.
new() sets 48 pages, but this ignores anything <= 49. with_h2g_pool_pages(49) is a silent no-op. Use >= against the value new() sets, or document the floor.
| let result: Vec<Bytes> = loaded_wasm_sandbox | ||
| .call_guest_function( | ||
| "ReceiveByteArray", | ||
| (vec![Bytes::from_owner(vec![0x01, 0x02, 0x03])], 3i32), |
There was a problem hiding this comment.
This test sends one chunk and only prints the result. The chunk offset step in to_val_bytes (a + b.len()) only matters with two or more chunks.
(vec![Bytes::from_static(&[0x01]), Bytes::from_static(&[0x02, 0x03])], 3i32)
// ...
let flat: Vec<u8> = result.iter().flatten().copied().collect();
assert_eq!(flat, [0x01, 0x02, 0x03]);| builder | ||
| .with_h2g_pool_pages(128) | ||
| .with_h2g_queue_size(128) | ||
| .with_guest_scratch_size(0x3000) |
There was a problem hiding this comment.
0x3000 is below MIN_SCRATCH_SIZE (2 MiB), so with_guest_scratch_size ignores it. Drop it?
No description provided.