@@ -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 ///
@@ -1993,7 +2004,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
19932004 self . write_to_memory ( element, elem_addr, offset) ;
19942005 self . finish_block ( 0 ) ;
19952006 self . stack . push ( addr) ;
1996- self . emit ( & FixedSizeListLowerMemory {
2007+ self . emit ( & FixedSizeListLowerToMemory {
19972008 element,
19982009 size : * size,
19992010 id,
@@ -2187,13 +2198,13 @@ impl<'a, B: Bindgen> Generator<'a, B> {
21872198
21882199 TypeDefKind :: Unknown => unreachable ! ( ) ,
21892200 TypeDefKind :: FixedSizeList ( ty, size) => {
2190- let increment = self . bindgen . sizes ( ) . size ( ty ) ;
2191- let mut position = offset ;
2192- for _ in 0 .. * size {
2193- self . read_from_memory ( ty, addr . clone ( ) , position ) ;
2194- position = position + increment ;
2195- }
2196- self . emit ( & FixedSizeListLift {
2201+ self . push_block ( ) ;
2202+ self . emit ( & IterBasePointer ) ;
2203+ let elemaddr = self . stack . pop ( ) . unwrap ( ) ;
2204+ self . read_from_memory ( ty, elemaddr , Default :: default ( ) ) ;
2205+ self . finish_block ( 1 ) ;
2206+ self . stack . push ( addr . clone ( ) ) ;
2207+ self . emit ( & FixedSizeListLiftFromMemory {
21972208 element : ty,
21982209 size : * size,
21992210 id,
0 commit comments