mirror of
https://github.com/fluencelabs/wasmer
synced 2025-07-31 23:32:04 +00:00
Add updates from feedback
Co-authored-by: Nick Lewycky <nick@wasmer.io>
This commit is contained in:
@@ -257,7 +257,11 @@ pub struct CraneliftFunctionCodeGenerator {
|
||||
next_local: usize,
|
||||
position: Position,
|
||||
func_env: FunctionEnvironment,
|
||||
/// Start location of the function as an offset in bytes in the Wasm module
|
||||
/// from the beginning of the code section.
|
||||
start: u32,
|
||||
/// End location of the function as an offset in bytes in the Wasm module
|
||||
/// from the beginning of the code section.
|
||||
end: u32,
|
||||
}
|
||||
|
||||
@@ -1255,11 +1259,9 @@ fn declare_wasm_parameters(builder: &mut FunctionBuilder, entry_block: Ebb) -> u
|
||||
// This is a normal WebAssembly signature parameter, so create a local for it.
|
||||
let local = Variable::new(next_local);
|
||||
builder.declare_var(local, param_type.value_type);
|
||||
//let value_label = ValueLabel::from_u32(next_local as u32);
|
||||
next_local += 1;
|
||||
|
||||
let param_value = builder.ebb_params(entry_block)[i];
|
||||
//builder.set_val_label(param_value, value_label);
|
||||
builder.def_var(local, param_value);
|
||||
}
|
||||
if param_type.purpose == ir::ArgumentPurpose::VMContext {
|
||||
|
@@ -112,18 +112,18 @@ impl FuncResolverBuilder {
|
||||
let generate_debug_info = info.generate_debug_info;
|
||||
let fb = function_bodies.iter().collect::<Vec<(_, _)>>();
|
||||
|
||||
let compiled_functions: Result<
|
||||
Vec<(
|
||||
Vec<u8>,
|
||||
(
|
||||
/// Data about the the compiled machine code.
|
||||
type CompileMetadata = (
|
||||
LocalFuncIndex,
|
||||
Option<(CompiledFunctionData, ValueLabelsRanges, Vec<Option<i32>>)>,
|
||||
RelocSink,
|
||||
LocalTrapSink,
|
||||
),
|
||||
)>,
|
||||
CompileError,
|
||||
> = fb
|
||||
);
|
||||
|
||||
/// Compiled machine code and information about it
|
||||
type CompileData = (Vec<u8>, CompileMetadata);
|
||||
|
||||
let compiled_functions: Result<Vec<CompileData>, CompileError> = fb
|
||||
.par_iter()
|
||||
.map_init(
|
||||
|| Context::new(),
|
||||
|
@@ -79,13 +79,12 @@ impl Instance {
|
||||
unsafe {
|
||||
let backing = &mut *(&mut inner.backing as *mut _);
|
||||
let import_backing = &mut *(&mut inner.import_backing as *mut _);
|
||||
let mut real_ctx = match imports.call_state_creator() {
|
||||
let real_ctx = match imports.call_state_creator() {
|
||||
Some((data, dtor)) => {
|
||||
vm::Ctx::new_with_data(backing, import_backing, &module, data, dtor)
|
||||
}
|
||||
None => vm::Ctx::new(backing, import_backing, &module),
|
||||
};
|
||||
real_ctx.internal.ctx = vmctx.as_mut_ptr();
|
||||
vmctx.as_mut_ptr().write(real_ctx);
|
||||
};
|
||||
Box::leak(vmctx);
|
||||
|
@@ -134,9 +134,6 @@ pub struct InternalCtx {
|
||||
|
||||
/// Interrupt signal mem.
|
||||
pub interrupt_signal_mem: *mut u8,
|
||||
|
||||
/// hmm
|
||||
pub ctx: *mut Ctx,
|
||||
}
|
||||
|
||||
static INTERNAL_FIELDS: AtomicUsize = AtomicUsize::new(0);
|
||||
@@ -309,7 +306,6 @@ impl Ctx {
|
||||
internals: &mut local_backing.internals.0,
|
||||
|
||||
interrupt_signal_mem: get_interrupt_signal_mem(),
|
||||
ctx: std::ptr::null_mut(), //local_backing.vm_memories[LocalMemoryIndex::new(0)],
|
||||
},
|
||||
local_functions: local_backing.local_functions.as_ptr(),
|
||||
|
||||
@@ -340,8 +336,6 @@ impl Ctx {
|
||||
};
|
||||
((*mem).base, (*mem).bound)
|
||||
};
|
||||
|
||||
dbg!(mem_bound);
|
||||
Self {
|
||||
internal: InternalCtx {
|
||||
memories: local_backing.vm_memories.as_mut_ptr(),
|
||||
@@ -365,9 +359,6 @@ impl Ctx {
|
||||
internals: &mut local_backing.internals.0,
|
||||
|
||||
interrupt_signal_mem: get_interrupt_signal_mem(),
|
||||
|
||||
ctx: std::ptr::null_mut(),
|
||||
//first_mem: local_backing.vm_memories[LocalMemoryIndex::new(0)],
|
||||
},
|
||||
local_functions: local_backing.local_functions.as_ptr(),
|
||||
|
||||
@@ -546,7 +537,7 @@ impl Ctx {
|
||||
}
|
||||
|
||||
pub const fn offset_local_functions() -> u8 {
|
||||
15 * (mem::size_of::<usize>() as u8)
|
||||
14 * (mem::size_of::<usize>() as u8)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user