@@ -1276,37 +1276,13 @@ impl<'a> Inliner<'a> {
12761276 types : & ComponentTypesBuilder ,
12771277 options : & LocalCanonicalOptions ,
12781278 ) -> AdapterOptions {
1279- let memory = options. memory . map ( |i| {
1280- frame. memories [ i] . clone ( ) . map_index ( |i| match i {
1281- EntityIndex :: Memory ( i) => i,
1282- _ => unreachable ! ( ) ,
1279+ let ( memory, memory64) = options
1280+ . memory
1281+ . map ( |i| {
1282+ let ( memory, memory64) = self . memory ( frame, types, i) ;
1283+ ( Some ( memory) , memory64)
12831284 } )
1284- } ) ;
1285- let memory64 = match & memory {
1286- Some ( memory) => match & self . runtime_instances [ memory. instance ] {
1287- InstanceModule :: Static ( idx) => match & memory. item {
1288- ExportItem :: Index ( i) => {
1289- let ty = & self . nested_modules [ * idx] . module . memories [ * i] ;
1290- match ty. idx_type {
1291- IndexType :: I32 => false ,
1292- IndexType :: I64 => true ,
1293- }
1294- }
1295- ExportItem :: Name ( _) => unreachable ! ( ) ,
1296- } ,
1297- InstanceModule :: Import ( ty) => match & memory. item {
1298- ExportItem :: Name ( name) => match types[ * ty] . exports [ name] {
1299- EntityType :: Memory ( m) => match m. idx_type {
1300- IndexType :: I32 => false ,
1301- IndexType :: I64 => true ,
1302- } ,
1303- _ => unreachable ! ( ) ,
1304- } ,
1305- ExportItem :: Index ( _) => unreachable ! ( ) ,
1306- } ,
1307- } ,
1308- None => false ,
1309- } ;
1285+ . unwrap_or ( ( None , false ) ) ;
13101286 let realloc = options. realloc . map ( |i| frame. funcs [ i] . clone ( ) ) ;
13111287 let callback = options. callback . map ( |i| frame. funcs [ i] . clone ( ) ) ;
13121288 let post_return = options. post_return . map ( |i| frame. funcs [ i] . clone ( ) ) ;
0 commit comments