@@ -310,18 +310,25 @@ def_instruction! {
310
310
/// Pops all fields for a fixed list off the stack and then composes them
311
311
/// into an array.
312
312
FixedSizeListLift {
313
- elements : & ' a Type ,
313
+ element : & ' a Type ,
314
314
size: u32 ,
315
315
id: TypeId ,
316
316
} : [ * size as usize ] => [ 1 ] ,
317
317
318
318
/// Pops an array off the stack, decomposes the elements and then pushes them onto the stack.
319
319
FixedSizeListLower {
320
- elements : & ' a Type ,
320
+ element : & ' a Type ,
321
321
size: u32 ,
322
322
id: TypeId ,
323
323
} : [ 1 ] => [ * size as usize ] ,
324
324
325
+ /// Pops an array and an address off the stack, passes each element to a block
326
+ FixedSizeListLowerBlock {
327
+ element: & ' a Type ,
328
+ size: u32 ,
329
+ id: TypeId ,
330
+ } : [ 2 ] => [ 0 ] ,
331
+
325
332
/// Pushes an operand onto the stack representing the list item from
326
333
/// each iteration of the list.
327
334
///
@@ -1403,7 +1410,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
1403
1410
TypeDefKind :: Unknown => unreachable ! ( ) ,
1404
1411
TypeDefKind :: FixedSizeList ( ty, size) => {
1405
1412
self . emit ( & FixedSizeListLower {
1406
- elements : ty,
1413
+ element : ty,
1407
1414
size : * size,
1408
1415
id,
1409
1416
} ) ;
@@ -1616,7 +1623,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
1616
1623
self . lift ( ty) ;
1617
1624
}
1618
1625
self . emit ( & FixedSizeListLift {
1619
- elements : ty,
1626
+ element : ty,
1620
1627
size : * size,
1621
1628
id,
1622
1629
} ) ;
@@ -1778,7 +1785,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
1778
1785
}
1779
1786
1780
1787
TypeDefKind :: Unknown => unreachable ! ( ) ,
1781
- TypeDefKind :: FixedSizeList ( ty , size) => {
1788
+ TypeDefKind :: FixedSizeList ( element , size) => {
1782
1789
// let increment = self.bindgen.sizes().size(ty);
1783
1790
// let mut position = offset;
1784
1791
// let resultvar = self.stack[0];
@@ -1788,11 +1795,29 @@ impl<'a, B: Bindgen> Generator<'a, B> {
1788
1795
// self.write_to_memory(ty, addr.clone(), position);
1789
1796
// position = position + increment;
1790
1797
// }
1791
- self . emit ( & FixedSizeListLower {
1792
- elements : ty,
1793
- size : * size,
1794
- id,
1795
- } ) ;
1798
+ // @@@@
1799
+ // self.emit(&FixedSizeListLower {
1800
+ // elements: ty,
1801
+ // size: *size,
1802
+ // id,
1803
+ // });
1804
+
1805
+ // resembles write_list_to_memory
1806
+ self . push_block ( ) ;
1807
+ self . emit ( & IterElem { element } ) ;
1808
+ self . emit ( & IterBasePointer ) ;
1809
+ let elem_addr = self . stack . pop ( ) . unwrap ( ) ;
1810
+ self . write_to_memory ( element, elem_addr, Default :: default ( ) ) ;
1811
+ self . finish_block ( 0 ) ;
1812
+ // let target = self.stack.pop().unwrap();
1813
+ self . stack . push ( addr) ;
1814
+ self . emit ( & FixedSizeListLowerBlock { element, size : * size, id } ) ;
1815
+
1816
+ // for idx in 0..*size {
1817
+ // //self.write_fields_to_memory(tuple.types.iter(), addr, offset);
1818
+ // self.emit(&FixedSizeListLowerElement { elements: ty, idx, });
1819
+ // self.write_to_memory(ty, addr.clone(), offset + (field_offset));
1820
+ // }
1796
1821
}
1797
1822
} ,
1798
1823
}
@@ -1988,7 +2013,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
1988
2013
position = position + increment;
1989
2014
}
1990
2015
self . emit ( & FixedSizeListLift {
1991
- elements : ty,
2016
+ element : ty,
1992
2017
size : * size,
1993
2018
id,
1994
2019
} ) ;
0 commit comments