Skip to content

Commit bbf75aa

Browse files
committed
add Inst abstraction type
1 parent 2ef73a8 commit bbf75aa

File tree

4 files changed

+87
-87
lines changed

4 files changed

+87
-87
lines changed

crates/wasmi/src/engine/executor/handler/dispatch.rs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
use super::{
22
exec,
3-
state::{DoneReason, Ip, Mem0Len, Mem0Ptr, Sp, Stack, VmState},
3+
state::{DoneReason, Inst, Ip, Mem0Len, Mem0Ptr, Sp, Stack, VmState},
44
utils::{resolve_instance, set_value},
55
};
66
use crate::{
77
engine::{executor::handler::utils, CallParams, CallResults, CodeMap, EngineFunc},
8-
instance::InstanceEntity,
98
ir::{BoundedSlotSpan, OpCode, Slot, SlotSpan},
109
CallHook,
1110
Error,
1211
Instance,
1312
Store,
1413
};
15-
use core::{marker::PhantomData, ptr::NonNull};
14+
use core::marker::PhantomData;
1615

1716
#[inline(always)]
1817
pub fn fetch_handler(ip: Ip) -> Handler {
@@ -170,7 +169,7 @@ pub fn execute_until_done(
170169
mut sp: Sp,
171170
mut mem0: Mem0Ptr,
172171
mut mem0_len: Mem0Len,
173-
mut instance: NonNull<InstanceEntity>,
172+
mut instance: Inst,
174173
) -> Option<DoneReason> {
175174
let mut handler = fetch_handler(ip);
176175
'exec: loop {
@@ -203,7 +202,7 @@ pub fn execute_until_done(
203202
sp: Sp,
204203
mem0: Mem0Ptr,
205204
mem0_len: Mem0Len,
206-
instance: NonNull<InstanceEntity>,
205+
instance: Inst,
207206
) -> Option<DoneReason> {
208207
let mut state = state;
209208
let handler = fetch_handler(ip);
@@ -224,7 +223,7 @@ impl Done {
224223
_sp: Sp,
225224
_mem0: Mem0Ptr,
226225
_mem0_len: Mem0Len,
227-
_instance: NonNull<InstanceEntity>,
226+
_instance: Inst,
228227
) -> Self {
229228
Self { _priv: () }
230229
}
@@ -242,7 +241,7 @@ pub enum Done {
242241
next_sp: Sp,
243242
next_mem0: Mem0Ptr,
244243
next_mem0_len: Mem0Len,
245-
next_instance: NonNull<InstanceEntity>,
244+
next_instance: Inst,
246245
},
247246
Break,
248247
}
@@ -254,7 +253,7 @@ impl Done {
254253
next_sp: Sp,
255254
next_mem0: Mem0Ptr,
256255
next_mem0_len: Mem0Len,
257-
next_instance: NonNull<InstanceEntity>,
256+
next_instance: Inst,
258257
) -> Self {
259258
Self::Continue {
260259
next_ip,
@@ -270,14 +269,8 @@ impl Done {
270269
}
271270
}
272271

273-
type Handler = fn(
274-
&mut VmState,
275-
ip: Ip,
276-
sp: Sp,
277-
mem0: Mem0Ptr,
278-
mem0_len: Mem0Len,
279-
instance: NonNull<InstanceEntity>,
280-
) -> Done;
272+
type Handler =
273+
fn(&mut VmState, ip: Ip, sp: Sp, mem0: Mem0Ptr, mem0_len: Mem0Len, instance: Inst) -> Done;
281274

282275
macro_rules! compile_or_get_func {
283276
($state:expr, $func:expr) => {{

0 commit comments

Comments
 (0)