mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 13:18:20 +00:00
Return a FunctionCache instead of its members.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use super::{
|
||||
intrinsics::{
|
||||
func_type_to_llvm, tbaa_label, type_to_llvm, CtxType, GlobalCache, Intrinsics, MemoryCache,
|
||||
func_type_to_llvm, tbaa_label, type_to_llvm, CtxType, FunctionCache, GlobalCache,
|
||||
Intrinsics, MemoryCache,
|
||||
},
|
||||
read_info::blocktype_to_type,
|
||||
// stackmap::{StackmapEntry, StackmapEntryKind, StackmapRegistry, ValueSemantic},
|
||||
@@ -1929,7 +1930,10 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
||||
let func_type = &self.wasm_module.signatures[*sigindex];
|
||||
let func_name = &self.func_names[func_index];
|
||||
|
||||
let (func, callee_vmctx) = self.ctx.func(
|
||||
let FunctionCache {
|
||||
func,
|
||||
vmctx: callee_vmctx,
|
||||
} = self.ctx.func(
|
||||
func_index,
|
||||
self.intrinsics,
|
||||
self.module,
|
||||
|
||||
@@ -501,9 +501,9 @@ pub enum GlobalCache<'ctx> {
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
struct FunctionCache<'ctx> {
|
||||
func: PointerValue<'ctx>,
|
||||
vmctx: BasicValueEnum<'ctx>,
|
||||
pub struct FunctionCache<'ctx> {
|
||||
pub func: PointerValue<'ctx>,
|
||||
pub vmctx: BasicValueEnum<'ctx>,
|
||||
}
|
||||
|
||||
pub struct CtxType<'ctx, 'a> {
|
||||
@@ -882,7 +882,7 @@ impl<'ctx, 'a> CtxType<'ctx, 'a> {
|
||||
context: &'ctx Context,
|
||||
func_name: &String,
|
||||
func_type: &FuncType,
|
||||
) -> (PointerValue<'ctx>, BasicValueEnum<'ctx>) {
|
||||
) -> FunctionCache<'ctx> {
|
||||
let (cached_functions, wasm_module, ctx_ptr_value, cache_builder, offsets) = (
|
||||
&mut self.cached_functions,
|
||||
self.wasm_module,
|
||||
@@ -890,7 +890,7 @@ impl<'ctx, 'a> CtxType<'ctx, 'a> {
|
||||
&self.cache_builder,
|
||||
&self.offsets,
|
||||
);
|
||||
let cached = *cached_functions.entry(function_index).or_insert_with(|| {
|
||||
*cached_functions.entry(function_index).or_insert_with(|| {
|
||||
let llvm_func_type = func_type_to_llvm(context, intrinsics, func_type);
|
||||
if wasm_module.local_func_index(function_index).is_some() {
|
||||
// TODO: assuming names are unique, we don't need the
|
||||
@@ -939,8 +939,7 @@ impl<'ctx, 'a> CtxType<'ctx, 'a> {
|
||||
vmctx: vmctx_ptr,
|
||||
}
|
||||
}
|
||||
});
|
||||
(cached.func, cached.vmctx)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn memory_grow(
|
||||
|
||||
Reference in New Issue
Block a user