Use middleware reader

This commit is contained in:
Syrus
2020-06-08 13:30:38 -07:00
parent 0ee70d3579
commit 5ec1addae1
4 changed files with 38 additions and 25 deletions

View File

@ -11,10 +11,10 @@ use rayon::prelude::{IntoParallelIterator, IntoParallelRefIterator, ParallelIter
use wasm_common::entity::{EntityRef, PrimaryMap};
use wasm_common::Features;
use wasm_common::{FunctionIndex, FunctionType, LocalFunctionIndex, MemoryIndex, TableIndex};
use wasmer_compiler::wasmparser::{BinaryReader, BinaryReaderError};
use wasmer_compiler::wasmparser::BinaryReaderError;
use wasmer_compiler::TrapInformation;
use wasmer_compiler::{Compilation, CompileError, CompiledFunction, Compiler, SectionIndex};
use wasmer_compiler::{CompilerConfig, ModuleTranslationState, Target};
use wasmer_compiler::{CompilerConfig, MiddlewareBinaryReader, ModuleTranslationState, Target};
use wasmer_compiler::{FunctionBody, FunctionBodyData};
use wasmer_runtime::ModuleInfo;
use wasmer_runtime::TrapCode;
@ -77,7 +77,8 @@ impl Compiler for SinglepassCompiler {
.collect::<Vec<(LocalFunctionIndex, &FunctionBodyData<'_>)>>()
.par_iter()
.map(|(i, input)| {
let mut reader = BinaryReader::new_with_offset(input.data, input.module_offset);
let mut reader =
MiddlewareBinaryReader::new_with_offset(input.data, input.module_offset);
// This local list excludes arguments.
let mut locals = vec![];