@@ -325,12 +325,23 @@ def_instruction! {
325325 } : [ 1 ] => [ * size as usize ] ,
326326
327327 /// Pops an array and an address off the stack, passes each element to a block storing it
328- FixedSizeListLowerMemory {
328+ FixedSizeListLowerToMemory {
329329 element: & ' a Type ,
330330 size: u32 ,
331331 id: TypeId ,
332332 } : [ 2 ] => [ 0 ] ,
333333
334+ /// Pops base address, pushes an array
335+ ///
336+ /// This will also pop a block from the block stack which is how to
337+ /// read each individual element from the list.
338+ FixedSizeListLiftFromMemory {
339+ element: & ' a Type ,
340+ size: u32 ,
341+ id: TypeId ,
342+ } : [ 1 ] => [ 1 ] ,
343+
344+
334345 /// Pushes an operand onto the stack representing the list item from
335346 /// each iteration of the list.
336347 ///
@@ -1979,7 +1990,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
19791990 self . write_to_memory ( element, elem_addr, offset) ;
19801991 self . finish_block ( 0 ) ;
19811992 self . stack . push ( addr) ;
1982- self . emit ( & FixedSizeListLowerMemory {
1993+ self . emit ( & FixedSizeListLowerToMemory {
19831994 element,
19841995 size : * size,
19851996 id,
@@ -2172,13 +2183,13 @@ impl<'a, B: Bindgen> Generator<'a, B> {
21722183
21732184 TypeDefKind :: Unknown => unreachable ! ( ) ,
21742185 TypeDefKind :: FixedSizeList ( ty, size) => {
2175- let increment = self . bindgen . sizes ( ) . size ( ty ) ;
2176- let mut position = offset ;
2177- for _ in 0 .. * size {
2178- self . read_from_memory ( ty, addr . clone ( ) , position ) ;
2179- position = position + increment ;
2180- }
2181- self . emit ( & FixedSizeListLift {
2186+ self . push_block ( ) ;
2187+ self . emit ( & IterBasePointer ) ;
2188+ let elemaddr = self . stack . pop ( ) . unwrap ( ) ;
2189+ self . read_from_memory ( ty, elemaddr , Default :: default ( ) ) ;
2190+ self . finish_block ( 1 ) ;
2191+ self . stack . push ( addr . clone ( ) ) ;
2192+ self . emit ( & FixedSizeListLiftFromMemory {
21822193 element : ty,
21832194 size : * size,
21842195 id,
0 commit comments