mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-14 17:31:20 +00:00
Cargo fmt
This commit is contained in:
@ -1,8 +1,8 @@
|
|||||||
use wasmer_runtime_core::{
|
use wasmer_runtime_core::{
|
||||||
codegen::{Event, EventSink, FunctionMiddleware, InternalEvent},
|
codegen::{Event, EventSink, FunctionMiddleware, InternalEvent},
|
||||||
module::ModuleInfo,
|
module::ModuleInfo,
|
||||||
wasmparser::{Operator, Type as WpType},
|
|
||||||
vm::InternalField,
|
vm::InternalField,
|
||||||
|
wasmparser::{Operator, Type as WpType},
|
||||||
};
|
};
|
||||||
|
|
||||||
static INTERNAL_FIELD: InternalField = InternalField::allocate();
|
static INTERNAL_FIELD: InternalField = InternalField::allocate();
|
||||||
@ -48,12 +48,16 @@ impl FunctionMiddleware for Metering {
|
|||||||
| Operator::Call { .. }
|
| Operator::Call { .. }
|
||||||
| Operator::CallIndirect { .. }
|
| Operator::CallIndirect { .. }
|
||||||
| Operator::Return => {
|
| Operator::Return => {
|
||||||
sink.push(Event::Internal(InternalEvent::GetInternal(INTERNAL_FIELD.index() as _)));
|
sink.push(Event::Internal(InternalEvent::GetInternal(
|
||||||
|
INTERNAL_FIELD.index() as _,
|
||||||
|
)));
|
||||||
sink.push(Event::WasmOwned(Operator::I64Const {
|
sink.push(Event::WasmOwned(Operator::I64Const {
|
||||||
value: self.current_block as i64,
|
value: self.current_block as i64,
|
||||||
}));
|
}));
|
||||||
sink.push(Event::WasmOwned(Operator::I64Add));
|
sink.push(Event::WasmOwned(Operator::I64Add));
|
||||||
sink.push(Event::Internal(InternalEvent::SetInternal(INTERNAL_FIELD.index() as _)));
|
sink.push(Event::Internal(InternalEvent::SetInternal(
|
||||||
|
INTERNAL_FIELD.index() as _,
|
||||||
|
)));
|
||||||
self.current_block = 0;
|
self.current_block = 0;
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
@ -64,7 +68,9 @@ impl FunctionMiddleware for Metering {
|
|||||||
| Operator::BrIf { .. }
|
| Operator::BrIf { .. }
|
||||||
| Operator::Call { .. }
|
| Operator::Call { .. }
|
||||||
| Operator::CallIndirect { .. } => {
|
| Operator::CallIndirect { .. } => {
|
||||||
sink.push(Event::Internal(InternalEvent::GetInternal(INTERNAL_FIELD.index() as _)));
|
sink.push(Event::Internal(InternalEvent::GetInternal(
|
||||||
|
INTERNAL_FIELD.index() as _,
|
||||||
|
)));
|
||||||
sink.push(Event::WasmOwned(Operator::I64Const {
|
sink.push(Event::WasmOwned(Operator::I64Const {
|
||||||
value: self.limit as i64,
|
value: self.limit as i64,
|
||||||
}));
|
}));
|
||||||
|
@ -6,7 +6,13 @@ use crate::{
|
|||||||
types::{LocalOrImport, MemoryIndex},
|
types::{LocalOrImport, MemoryIndex},
|
||||||
vmcalls,
|
vmcalls,
|
||||||
};
|
};
|
||||||
use std::{ffi::c_void, mem, ptr, sync::atomic::{AtomicUsize, Ordering}, sync::Once, cell::UnsafeCell};
|
use std::{
|
||||||
|
cell::UnsafeCell,
|
||||||
|
ffi::c_void,
|
||||||
|
mem, ptr,
|
||||||
|
sync::atomic::{AtomicUsize, Ordering},
|
||||||
|
sync::Once,
|
||||||
|
};
|
||||||
|
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user