Skip to content
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
261 changes: 134 additions & 127 deletions Cargo.lock

Large diffs are not rendered by default.

37 changes: 26 additions & 11 deletions crates/hyperlight-dummy-guest/Cargo.lock

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

5 changes: 2 additions & 3 deletions crates/hyperlight-dummy-guest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ publish = false
rust-version = "1.89"

[dependencies]
hyperlight-common = { version = "0.17.0", default-features = false }
hyperlight-guest = { version = "0.17.0", default-features = false }
hyperlight-guest-bin = { version = "0.17.0", default-features = false, features = ["macros"] }
hyperlight-guest = { version = "0.18.0", default-features = false }
hyperlight-guest-bin = { version = "0.18.0", default-features = false, features = ["macros"] }
21 changes: 2 additions & 19 deletions crates/hyperlight-dummy-guest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,13 @@
#![no_main]

extern crate alloc;
extern crate hyperlight_guest_bin;

use alloc::string::String;
use alloc::vec::Vec;

use hyperlight_common::flatbuffer_wrappers::function_call::FunctionCall;
use hyperlight_common::flatbuffer_wrappers::guest_error::ErrorCode;
use hyperlight_guest::bail;
use hyperlight_guest::error::Result;
use hyperlight_guest_bin::guest_function;

#[hyperlight_guest_bin::guest_function("handle_request")]
#[guest_function]
fn handle_request(req: String) -> Result<String> {
assert_eq!(req, r#"{"uri": "/index.html"}"#);
Ok(String::from(r#"{"uri":"/redirected.html"}"#))
}

#[unsafe(no_mangle)]
pub extern "C" fn hyperlight_main() {}

#[unsafe(no_mangle)]
pub fn guest_dispatch_function(function_call: FunctionCall) -> Result<Vec<u8>> {
let function_name = function_call.function_name;
bail!(ErrorCode::GuestFunctionNotFound => "{function_name}");
}

#[unsafe(no_mangle)]
pub extern "C" fn srand(_seed: u32) {}
2 changes: 1 addition & 1 deletion crates/observer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ license.workspace = true
publish = false

[dependencies]
hyperlight-host = { version = "0.17.0", default-features = false, features = [ "kvm", "mshv3" ]}
hyperlight-host = { version = "0.18.0", default-features = false, features = [ "kvm", "mshv3" ]}
libc = "0.2.176"

12 changes: 6 additions & 6 deletions crates/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ sandbox-observer = { path = "../observer" }
# IMPORTANT: pinned to exact version because the wasmtime-aot handler loads .aot files
# compiled by hyperlight-wasm-aot, and wasmtime requires an exact version match for AOT.
# To find the required version, run: cargo install hyperlight-wasm-aot@<version> && rg 'wasmtime' ~/.cargo/registry/src/*/hyperlight-wasm-aot-*/Cargo.toml
wasmtime = { version = "=36.0.14", default-features = false, features = ["cranelift", "runtime", "component-model", "pooling-allocator", "pulley" ] }
wasmtime = { version = "=36.0.18", default-features = false, features = ["cranelift", "runtime", "component-model", "pooling-allocator", "pulley" ] }
# If updating hyperlight-host, don't forget to update crates/hyperlight-dummy-guest/Cargo.toml
hyperlight-host = { version = "0.17.0", default-features = false, features = [ "kvm", "mshv3" ]}
hyperlight-common = { version = "0.17.0", default-features = false }
hyperlight-js = { version = "0.4.0", features = ["mshv3"] }
hyperlight-host = { version = "0.18.0", default-features = false, features = [ "kvm", "mshv3" ]}
hyperlight-common = { version = "0.18.0", default-features = false }
hyperlight-js = { version = "0.5.0", features = ["mshv3"] }
# Keep hyperlight-wasm-aot in tool-versions.sh aligned with this version.
hyperlight-wasm = { version = "0.15.0" }
hyperlight-component-macro = "0.17.0"
hyperlight-wasm = { version = "0.16.0" }
hyperlight-component-macro = "0.18.0"
4 changes: 2 additions & 2 deletions crates/server/src/handlers/hyperlight_dummy.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Arc;

use hyperlight_host::MultiUseSandbox;
use hyperlight_host::Sandbox;
use hyperlight_host::sandbox::snapshot::Snapshot;
use sandbox_observer::observer::CpuTimeObserver;

Expand All @@ -19,7 +19,7 @@ enum DummyLifecycle {
}

pub struct HyperlightDummyContext {
sandbox: MultiUseSandbox,
sandbox: Sandbox,
lifecycle: DummyLifecycle,
}

Expand Down
9 changes: 4 additions & 5 deletions crates/server/src/handlers/hyperlight_wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use super::{Handler, SandboxMemory};
use crate::{DEFAULT_REQUEST_URI, SandboxReuseStrategy};

use bindings::hyperlight::bench::handler_interface::Request;
use hyperlight_host::sandbox::snapshot::Snapshot;
use hyperlight_wasm::{LoadedWasmSandbox, WasmSandbox};
use hyperlight_wasm::{LoadedWasmSandbox, Snapshot, WasmSandbox};
use sandbox_observer::observer::{CpuTimeObserver, Observer};

use std::{os::fd::AsRawFd, sync::Arc};
Expand Down Expand Up @@ -64,8 +63,8 @@ enum WasmState {

enum WasmLifecycle {
Renew,
Restore(Arc<Snapshot>),
Reuse(Arc<Snapshot>),
Restore(Snapshot<LoadedWasmSandbox>),
Reuse(Snapshot<LoadedWasmSandbox>),
}

pub struct HyperlightWASMContext {
Expand Down Expand Up @@ -123,7 +122,7 @@ impl Handler for HyperlightWASMHandler {
let rt = bindings::register_host_functions(&mut sb, state).unwrap();
let sb = sb.load_runtime().unwrap();

let prepare_snapshot = |sandbox: WasmSandbox, lifecycle: fn(Arc<Snapshot>) -> WasmLifecycle| {
let prepare_snapshot = |sandbox: WasmSandbox, lifecycle: fn(Snapshot<LoadedWasmSandbox>) -> WasmLifecycle| {
let mut loaded = unsafe {
sandbox.load_module_by_mapping(worker.aot.base, worker.aot.len)
.expect("Failed to load the Wasm module for snapshot preparation")
Expand Down
2 changes: 1 addition & 1 deletion tool-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
: "${OHA_VERSION:=1.9.0}"

# Must use the Wasmtime version pinned by crates/server/Cargo.toml.
: "${HYPERLIGHT_WASM_AOT_VERSION:=0.15.0}"
: "${HYPERLIGHT_WASM_AOT_VERSION:=0.16.0}"
: "${HYPERLIGHT_WASM_AOT_GIT_URL:=https://github.com/hyperlight-dev/hyperlight-wasm}"
: "${HYPERLIGHT_WASM_AOT_GIT_REV:=}"

Expand Down
Loading