mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-06-23 03:31:56 +00:00
getting rid of calls recursion (continue)
This commit is contained in:
@ -4,7 +4,7 @@ use parking_lot::RwLock;
|
||||
use elements::{FunctionType, Internal, ValueType};
|
||||
use interpreter::Error;
|
||||
use interpreter::module::{ModuleInstanceInterface, ExecutionParams, ItemIndex,
|
||||
CallerContext, ExportEntryType};
|
||||
CallerContext, CallResult, ExportEntryType};
|
||||
use interpreter::memory::MemoryInstance;
|
||||
use interpreter::table::TableInstance;
|
||||
use interpreter::value::RuntimeValue;
|
||||
@ -113,15 +113,15 @@ impl<'a> ModuleInstanceInterface for NativeModuleInstance<'a> {
|
||||
self.env.global(index, variable_type)
|
||||
}
|
||||
|
||||
fn call_function(&self, outer: CallerContext, index: ItemIndex, function_type: Option<&FunctionType>) -> Result<Option<RuntimeValue>, Error> {
|
||||
fn call_function<'b>(&self, outer: CallerContext, index: ItemIndex, function_type: Option<&FunctionType>) -> Result<CallResult<'b>, Error> {
|
||||
self.env.call_function(outer, index, function_type)
|
||||
}
|
||||
|
||||
fn call_function_indirect(&self, outer: CallerContext, table_index: ItemIndex, type_index: u32, func_index: u32) -> Result<Option<RuntimeValue>, Error> {
|
||||
fn call_function_indirect<'b>(&self, outer: CallerContext, table_index: ItemIndex, type_index: u32, func_index: u32) -> Result<CallResult<'b>, Error> {
|
||||
self.env.call_function_indirect(outer, table_index, type_index, func_index)
|
||||
}
|
||||
|
||||
fn call_internal_function(&self, outer: CallerContext, index: u32, function_type: Option<&FunctionType>) -> Result<Option<RuntimeValue>, Error> {
|
||||
fn call_internal_function<'b>(&self, outer: CallerContext, index: u32, function_type: Option<&FunctionType>) -> Result<CallResult<'b>, Error> {
|
||||
if index < NATIVE_INDEX_FUNC_MIN {
|
||||
return self.env.call_internal_function(outer, index, function_type);
|
||||
}
|
||||
@ -131,6 +131,7 @@ impl<'a> ModuleInstanceInterface for NativeModuleInstance<'a> {
|
||||
.get((index - NATIVE_INDEX_FUNC_MIN) as usize)
|
||||
.ok_or(Error::Native(format!("trying to call native function with index {}", index)))
|
||||
.and_then(|f| self.executor.write().execute(&f.name, outer))
|
||||
.map(CallResult::Executed)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user