3 inline cell
array_nth(array
* array
, cell slot
) {
4 FACTOR_ASSERT(slot
< array_capacity(array
));
5 FACTOR_ASSERT(array
->type() == ARRAY_TYPE
);
6 return array
->data()[slot
];
9 inline void factor_vm::set_array_nth(array
* array
, cell slot
, cell value
) {
10 FACTOR_ASSERT(slot
< array_capacity(array
));
11 FACTOR_ASSERT(array
->type() == ARRAY_TYPE
);
12 cell
* slot_ptr
= &array
->data()[slot
];
14 write_barrier(slot_ptr
);
17 struct growable_array
{
19 data_root
<array
> elements
;
22 growable_array(factor_vm
* parent
, cell capacity
= 10)
24 elements(parent
->allot_array(capacity
, false_object
), parent
) {}
26 void reallot_array(cell count
);
28 void append(array
* elts
);