Use ordered IndexMap for exports in runtime-core

This commit is contained in:
Syrus 2019-08-01 01:27:21 -07:00
parent 676bccff3c
commit 052ad1381d
4 changed files with 9 additions and 5 deletions

View File

@ -13,7 +13,6 @@ page_size = "0.4.1"
wasmparser = "0.35.1"
parking_lot = "0.9.0"
lazy_static = "1.3.0"
indexmap = "1.0.2"
errno = "0.2.4"
libc = "0.2.60"
hex = "0.3.2"
@ -21,6 +20,10 @@ smallvec = "0.6.10"
bincode = "1.1"
colored = "1.8"
[dependencies.indexmap]
version = "1.0.2"
features = ["serde-1"]
# Dependencies for caching.
[dependencies.serde]
version = "1.0.98"

View File

@ -2,7 +2,7 @@ use crate::{
global::Global, instance::InstanceInner, memory::Memory, module::ExportIndex,
module::ModuleInner, table::Table, types::FuncSig, vm,
};
use std::collections::hash_map;
use indexmap::map::Iter as IndexMapIter;
use std::sync::Arc;
#[derive(Debug, Copy, Clone)]
@ -41,7 +41,7 @@ impl FuncPointer {
pub struct ExportIter<'a> {
inner: &'a InstanceInner,
iter: hash_map::Iter<'a, String, ExportIndex>,
iter: IndexMapIter<'a, String, ExportIndex>,
module: &'a ModuleInner,
}

View File

@ -40,7 +40,7 @@ pub struct ModuleInfo {
pub imported_tables: Map<ImportedTableIndex, (ImportName, TableDescriptor)>,
pub imported_globals: Map<ImportedGlobalIndex, (ImportName, GlobalDescriptor)>,
pub exports: HashMap<String, ExportIndex>,
pub exports: IndexMap<String, ExportIndex>,
pub data_initializers: Vec<DataInitializer>,
pub elem_initializers: Vec<TableInitializer>,

View File

@ -850,6 +850,7 @@ mod vm_ctx_tests {
use crate::cache::Error as CacheError;
use crate::typed_func::Wasm;
use crate::types::{LocalFuncIndex, SigIndex};
use indexmap::IndexMap;
use std::any::Any;
use std::collections::HashMap;
use std::ptr::NonNull;
@ -890,7 +891,7 @@ mod vm_ctx_tests {
imported_tables: Map::new(),
imported_globals: Map::new(),
exports: HashMap::new(),
exports: IndexMap::new(),
data_initializers: Vec::new(),
elem_initializers: Vec::new(),