@@ -47,9 +47,6 @@ pub struct Store<'b> {
4747
4848 // fields outside of the spec but are convenient are below
4949
50- // kv pair for module names and module "addresses" (that make sense with `Self.modules[module_addr]`)
51- pub module_names : BTreeMap < String , usize > ,
52-
5350 // all visible exports and entities added by hand or module instantiation by the interpreter
5451 // currently, all of the exports of an instantiated module is made visible (this is outside of spec)
5552 pub registry : Registry ,
@@ -114,7 +111,6 @@ impl<'b> Store<'b> {
114111 exports : BTreeMap :: new ( ) ,
115112 wasm_bytecode : validation_info. wasm ,
116113 sidetable : validation_info. sidetable . clone ( ) ,
117- name : name. to_owned ( ) ,
118114 } ;
119115
120116 // TODO rewrite this part
@@ -280,10 +276,6 @@ impl<'b> Store<'b> {
280276 let current_module_idx = & self . modules . len ( ) ;
281277 self . modules . push ( module_inst) ;
282278
283- // keep module names, this is outside of the spec
284- self . module_names
285- . insert ( String :: from ( name) , * current_module_idx) ;
286-
287279 // instantiation: step 12-15
288280 // TODO have to stray away from the spec a bit since our codebase does not lend itself well to freely executing instructions by themselves
289281 for (
@@ -739,41 +731,6 @@ impl<'b> Store<'b> {
739731 debug ! ( "Successfully invoked function" ) ;
740732 Ok ( ret)
741733 }
742-
743- //TODO consider further refactor
744- pub fn get_module_idx_from_name ( & self , module_name : & str ) -> Result < usize , RuntimeError > {
745- self . module_names
746- . get ( module_name)
747- . copied ( )
748- . ok_or ( RuntimeError :: ModuleNotFound )
749- }
750-
751- //TODO consider further refactor
752- pub fn get_global_function_idx_by_name (
753- & self ,
754- module_addr : usize ,
755- function_name : & str ,
756- ) -> Option < usize > {
757- self . modules
758- . get ( module_addr) ?
759- . exports
760- . get ( function_name)
761- . and_then ( |value| match value {
762- ExternVal :: Func ( func_addr) => Some ( * func_addr) ,
763- _ => None ,
764- } )
765- }
766-
767- //TODO consider further refactor
768- pub fn register_alias ( & mut self , alias_name : String , module_idx : usize ) {
769- self . module_names . insert ( alias_name, module_idx) ;
770- }
771-
772- //TODO consider further refactor
773- pub fn lookup_function ( & self , target_module : & str , target_function : & str ) -> Option < usize > {
774- let module_addr = * self . module_names . get ( target_module) ?;
775- self . get_global_function_idx_by_name ( module_addr, target_function)
776- }
777734}
778735
779736#[ derive( Debug ) ]
@@ -1068,7 +1025,7 @@ pub struct ModuleInst<'b> {
10681025 pub wasm_bytecode : & ' b [ u8 ] ,
10691026
10701027 // sidetable is not in the spec, but required for control flow
1071- pub sidetable : Sidetable
1028+ pub sidetable : Sidetable ,
10721029}
10731030
10741031#[ derive( Debug , PartialEq , PartialOrd , Eq , Ord ) ]
0 commit comments