From ee9e5cba495ab5b6613e705aaccc686b0bca2a44 Mon Sep 17 00:00:00 2001 From: Maddy Date: Fri, 3 Aug 2018 13:00:31 +0000 Subject: [PATCH] Convert the start function index from a `DefinedFuncIndex` to a `FuncIndex`. --- lib/wasm/src/environ/dummy.rs | 4 ++-- lib/wasm/src/environ/spec.rs | 4 ++-- lib/wasm/src/sections_translator.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/wasm/src/environ/dummy.rs b/lib/wasm/src/environ/dummy.rs index b2db269e24..4eaab00fb3 100644 --- a/lib/wasm/src/environ/dummy.rs +++ b/lib/wasm/src/environ/dummy.rs @@ -71,7 +71,7 @@ pub struct DummyModuleInfo { pub globals: Vec>, /// The start function. - pub start_func: Option, + pub start_func: Option, } impl DummyModuleInfo { @@ -418,7 +418,7 @@ impl<'data> ModuleEnvironment<'data> for DummyEnvironment { .push(String::from(name)); } - fn declare_start_func(&mut self, func_index: DefinedFuncIndex) { + fn declare_start_func(&mut self, func_index: FuncIndex) { debug_assert!(self.info.start_func.is_none()); self.info.start_func = Some(func_index); } diff --git a/lib/wasm/src/environ/spec.rs b/lib/wasm/src/environ/spec.rs index 157f531270..bc8e3fa9fa 100644 --- a/lib/wasm/src/environ/spec.rs +++ b/lib/wasm/src/environ/spec.rs @@ -6,7 +6,7 @@ use cranelift_codegen::settings::Flags; use std::vec::Vec; use target_lexicon::Triple; use translation_utils::{ - DefinedFuncIndex, FuncIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, Table, TableIndex, + FuncIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, Table, TableIndex, }; use wasmparser::BinaryReaderError; @@ -284,7 +284,7 @@ pub trait ModuleEnvironment<'data> { fn declare_global_export(&mut self, global_index: GlobalIndex, name: &'data str); /// Declares a start function. - fn declare_start_func(&mut self, index: DefinedFuncIndex); + fn declare_start_func(&mut self, index: FuncIndex); /// Provides the contents of a function body. fn define_function_body(&mut self, body_bytes: &'data [u8]) -> WasmResult<()>; diff --git a/lib/wasm/src/sections_translator.rs b/lib/wasm/src/sections_translator.rs index e1450ee24b..949a74f9d1 100644 --- a/lib/wasm/src/sections_translator.rs +++ b/lib/wasm/src/sections_translator.rs @@ -13,7 +13,7 @@ use environ::{ModuleEnvironment, WasmError, WasmResult}; use std::str::from_utf8; use std::vec::Vec; use translation_utils::{ - type_to_type, DefinedFuncIndex, FuncIndex, Global, GlobalIndex, GlobalInit, Memory, MemoryIndex, + type_to_type, FuncIndex, Global, GlobalIndex, GlobalInit, Memory, MemoryIndex, SignatureIndex, Table, TableElementType, TableIndex, }; use wasmparser; @@ -172,7 +172,7 @@ pub fn parse_start_section(parser: &mut Parser, environ: &mut ModuleEnvironment) loop { match *parser.read() { ParserState::StartSectionEntry(index) => { - environ.declare_start_func(DefinedFuncIndex::new(index as usize)); + environ.declare_start_func(FuncIndex::new(index as usize)); } ParserState::EndSection => break, ParserState::Error(e) => return Err(WasmError::from_binary_reader_error(e)),