@@ -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
///
@@ -1373,7 +1380,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
1373
1380
TypeDefKind :: Unknown => unreachable ! ( ) ,
1374
1381
TypeDefKind :: FixedSizeList ( ty, size) => {
1375
1382
self . emit ( & FixedSizeListLower {
1376
- elements : ty,
1383
+ element : ty,
1377
1384
size : * size,
1378
1385
id,
1379
1386
} ) ;
@@ -1593,7 +1600,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
1593
1600
self . lift ( ty) ;
1594
1601
}
1595
1602
self . emit ( & FixedSizeListLift {
1596
- elements : ty,
1603
+ element : ty,
1597
1604
size : * size,
1598
1605
id,
1599
1606
} ) ;
@@ -1758,7 +1765,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
1758
1765
}
1759
1766
1760
1767
TypeDefKind :: Unknown => unreachable ! ( ) ,
1761
- TypeDefKind :: FixedSizeList ( ty , size) => {
1768
+ TypeDefKind :: FixedSizeList ( element , size) => {
1762
1769
// let increment = self.bindgen.sizes().size(ty);
1763
1770
// let mut position = offset;
1764
1771
// let resultvar = self.stack[0];
@@ -1768,11 +1775,29 @@ impl<'a, B: Bindgen> Generator<'a, B> {
1768
1775
// self.write_to_memory(ty, addr.clone(), position);
1769
1776
// position = position + increment;
1770
1777
// }
1771
- self . emit ( & FixedSizeListLower {
1772
- elements : ty,
1773
- size : * size,
1774
- id,
1775
- } ) ;
1778
+ // @@@@
1779
+ // self.emit(&FixedSizeListLower {
1780
+ // elements: ty,
1781
+ // size: *size,
1782
+ // id,
1783
+ // });
1784
+
1785
+ // resembles write_list_to_memory
1786
+ self . push_block ( ) ;
1787
+ self . emit ( & IterElem { element } ) ;
1788
+ self . emit ( & IterBasePointer ) ;
1789
+ let elem_addr = self . stack . pop ( ) . unwrap ( ) ;
1790
+ self . write_to_memory ( element, elem_addr, Default :: default ( ) ) ;
1791
+ self . finish_block ( 0 ) ;
1792
+ // let target = self.stack.pop().unwrap();
1793
+ self . stack . push ( addr) ;
1794
+ self . emit ( & FixedSizeListLowerBlock { element, size : * size, id } ) ;
1795
+
1796
+ // for idx in 0..*size {
1797
+ // //self.write_fields_to_memory(tuple.types.iter(), addr, offset);
1798
+ // self.emit(&FixedSizeListLowerElement { elements: ty, idx, });
1799
+ // self.write_to_memory(ty, addr.clone(), offset + (field_offset));
1800
+ // }
1776
1801
}
1777
1802
} ,
1778
1803
}
@@ -1968,7 +1993,7 @@ impl<'a, B: Bindgen> Generator<'a, B> {
1968
1993
position = position + increment;
1969
1994
}
1970
1995
self . emit ( & FixedSizeListLift {
1971
- elements : ty,
1996
+ element : ty,
1972
1997
size : * size,
1973
1998
id,
1974
1999
} ) ;
0 commit comments