Skip to content

Commit 01d7a69

Browse files
committed
rename run -> call
Signed-off-by: Jorge Prendes <[email protected]>
1 parent e27955b commit 01d7a69

File tree

17 files changed

+101
-97
lines changed

17 files changed

+101
-97
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn main() -> hyperlight_host::Result<()> {
5858
let message = "Hello, World! I am executing inside of a VM :)\n".to_string();
5959
// in order to call a function it first must be defined in the guest and exposed so that
6060
// the host can call it
61-
multi_use_sandbox.run::<i32>(
61+
multi_use_sandbox.call::<i32>(
6262
"PrintOutput",
6363
message,
6464
)?;

fuzz/fuzz_targets/host_print.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fuzz_target!(
2727

2828
|data: String| -> Corpus {
2929
let mut sandbox = SANDBOX.get().unwrap().lock().unwrap();
30-
let len: i32 = sandbox.run::<i32>(
30+
let len: i32 = sandbox.call::<i32>(
3131
"PrintOutput",
3232
data,
3333
)

src/hyperlight_host/benches/benchmarks.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn guest_call_benchmark(c: &mut Criterion) {
3636
group.bench_function("guest_call", |b| {
3737
let mut sbox = create_multiuse_sandbox();
3838

39-
b.iter(|| sbox.run::<String>("Echo", "hello\n".to_string()).unwrap());
39+
b.iter(|| sbox.call::<String>("Echo", "hello\n".to_string()).unwrap());
4040
});
4141

4242
// Benchmarks a single guest function call.
@@ -46,7 +46,7 @@ fn guest_call_benchmark(c: &mut Criterion) {
4646
let snapshot = sbox.snapshot().unwrap();
4747

4848
b.iter(|| {
49-
sbox.run::<String>("Echo", "hello\n".to_string()).unwrap();
49+
sbox.call::<String>("Echo", "hello\n".to_string()).unwrap();
5050
sbox.restore(&snapshot).unwrap();
5151
});
5252
});
@@ -63,7 +63,11 @@ fn guest_call_benchmark(c: &mut Criterion) {
6363

6464
let mut multiuse_sandbox: MultiUseSandbox = uninitialized_sandbox.evolve().unwrap();
6565

66-
b.iter(|| multiuse_sandbox.run::<i32>("Add", (1_i32, 41_i32)).unwrap());
66+
b.iter(|| {
67+
multiuse_sandbox
68+
.call::<i32>("Add", (1_i32, 41_i32))
69+
.unwrap()
70+
});
6771
});
6872

6973
group.finish();
@@ -93,7 +97,7 @@ fn guest_call_benchmark_large_param(c: &mut Criterion) {
9397

9498
b.iter(|| {
9599
sandbox
96-
.run::<()>("LargeParameters", (large_vec.clone(), large_string.clone()))
100+
.call::<()>("LargeParameters", (large_vec.clone(), large_string.clone()))
97101
.unwrap()
98102
});
99103
});

src/hyperlight_host/examples/func_ctx/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ fn main() {
2929

3030
// Do several calls against a sandbox running the `simpleguest.exe` binary,
3131
// and print their results
32-
let res: String = sbox.run("Echo", "hello".to_string()).unwrap();
32+
let res: String = sbox.call("Echo", "hello".to_string()).unwrap();
3333
println!("got Echo res: {res}");
3434

35-
let res: i32 = sbox.run("CallMalloc", 200_i32).unwrap();
35+
let res: i32 = sbox.call("CallMalloc", 200_i32).unwrap();
3636
println!("got CallMalloc res: {res}");
3737
}

src/hyperlight_host/examples/guest-debugging/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fn main() -> hyperlight_host::Result<()> {
7575
let message =
7676
"Hello, World! I am executing inside of a VM with debugger attached :)\n".to_string();
7777
multi_use_sandbox_dbg
78-
.run::<i32>(
78+
.call::<i32>(
7979
"PrintOutput", // function must be defined in the guest binary
8080
message.clone(),
8181
)
@@ -84,7 +84,7 @@ fn main() -> hyperlight_host::Result<()> {
8484
let message =
8585
"Hello, World! I am executing inside of a VM without debugger attached :)\n".to_string();
8686
multi_use_sandbox
87-
.run::<i32>(
87+
.call::<i32>(
8888
"PrintOutput", // function must be defined in the guest binary
8989
message.clone(),
9090
)

src/hyperlight_host/examples/hello-world/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn main() -> hyperlight_host::Result<()> {
4040
// Call guest function
4141
let message = "Hello, World! I am executing inside of a VM :)\n".to_string();
4242
multi_use_sandbox
43-
.run::<i32>(
43+
.call::<i32>(
4444
"PrintOutput", // function must be defined in the guest binary
4545
message,
4646
)

src/hyperlight_host/examples/logging/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn main() -> Result<()> {
5050
// Call a guest function 5 times to generate some log entries.
5151
for _ in 0..5 {
5252
multiuse_sandbox
53-
.run::<String>("Echo", "a".to_string())
53+
.call::<String>("Echo", "a".to_string())
5454
.unwrap();
5555
}
5656

@@ -61,7 +61,7 @@ fn main() -> Result<()> {
6161
// Call a guest function that calls the HostPrint host function 5 times to generate some log entries.
6262
for _ in 0..5 {
6363
multiuse_sandbox
64-
.run::<i32>("PrintOutput", msg.clone())
64+
.call::<i32>("PrintOutput", msg.clone())
6565
.unwrap();
6666
}
6767
Ok(())
@@ -94,7 +94,7 @@ fn main() -> Result<()> {
9494

9595
for _ in 0..NUM_CALLS {
9696
barrier.wait();
97-
multiuse_sandbox.run::<()>("Spin", ()).unwrap_err();
97+
multiuse_sandbox.call::<()>("Spin", ()).unwrap_err();
9898
}
9999
thread.join().unwrap();
100100

src/hyperlight_host/examples/metrics/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn do_hyperlight_stuff() {
6161
// Call a guest function 5 times to generate some metrics.
6262
for _ in 0..5 {
6363
multiuse_sandbox
64-
.run::<String>("Echo", "a".to_string())
64+
.call::<String>("Echo", "a".to_string())
6565
.unwrap();
6666
}
6767

@@ -72,7 +72,7 @@ fn do_hyperlight_stuff() {
7272
// Call a guest function that calls the HostPrint host function 5 times to generate some metrics.
7373
for _ in 0..5 {
7474
multiuse_sandbox
75-
.run::<i32>("PrintOutput", msg.clone())
75+
.call::<i32>("PrintOutput", msg.clone())
7676
.unwrap();
7777
}
7878
Ok(())
@@ -108,7 +108,7 @@ fn do_hyperlight_stuff() {
108108

109109
for _ in 0..NUM_CALLS {
110110
barrier.wait();
111-
multiuse_sandbox.run::<()>("Spin", ()).unwrap_err();
111+
multiuse_sandbox.call::<()>("Spin", ()).unwrap_err();
112112
}
113113

114114
for join_handle in join_handles {

src/hyperlight_host/examples/tracing-chrome/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn main() -> Result<()> {
3636

3737
// do the function call
3838
let current_time = std::time::Instant::now();
39-
let res: String = sbox.run("Echo", "Hello, World!".to_string())?;
39+
let res: String = sbox.call("Echo", "Hello, World!".to_string())?;
4040
let elapsed = current_time.elapsed();
4141
println!("Function call finished in {:?}.", elapsed);
4242
assert_eq!(res, "Hello, World!");

src/hyperlight_host/examples/tracing-otlp/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ fn run_example(wait_input: bool) -> HyperlightResult<()> {
136136
// Call a guest function 5 times to generate some log entries.
137137
for _ in 0..5 {
138138
multiuse_sandbox
139-
.run::<String>("Echo", "a".to_string())
139+
.call::<String>("Echo", "a".to_string())
140140
.unwrap();
141141
}
142142

@@ -147,7 +147,7 @@ fn run_example(wait_input: bool) -> HyperlightResult<()> {
147147
// Call a guest function that calls the HostPrint host function 5 times to generate some log entries.
148148
for _ in 0..5 {
149149
multiuse_sandbox
150-
.run::<i32>("PrintOutput", msg.clone())
150+
.call::<i32>("PrintOutput", msg.clone())
151151
.unwrap();
152152
}
153153

@@ -179,7 +179,7 @@ fn run_example(wait_input: bool) -> HyperlightResult<()> {
179179
);
180180
let _entered = span.enter();
181181
barrier.wait();
182-
multiuse_sandbox.run::<()>("Spin", ()).unwrap_err();
182+
multiuse_sandbox.call::<()>("Spin", ()).unwrap_err();
183183
}
184184
thread.join().expect("Thread panicked");
185185
}

0 commit comments

Comments
 (0)