void primitive_resize_array(void)
{
- F_ARRAY* array; CELL capacity;
- maybe_gc(0);
+ F_ARRAY* array;
+ CELL capacity = to_fixnum(dpeek2());
+ maybe_gc(array_size(capacity));
array = untag_array_fast(dpop());
- capacity = to_fixnum(dpop());
- dpush(tag_object(resize_array(array,capacity,F)));
+ drepl(tag_object(resize_array(array,capacity,F)));
}
void fixup_array(F_ARRAY* array)
return get(ds);
}
+INLINE CELL dpeek2(void)
+{
+ return get(ds - CELLS);
+}
+
INLINE CELL cpop(void)
{
CELL value = get(cs);
void primitive_resize_string(void)
{
- F_STRING* string; CELL capacity;
- maybe_gc(0);
+ F_STRING* string;
+ CELL capacity = to_fixnum(dpeek2());
+ maybe_gc(string_size(capacity));
string = untag_string_fast(dpop());
- capacity = to_fixnum(dpop());
- dpush(tag_object(resize_string(string,capacity,F)));
+ drepl(tag_object(resize_string(string,capacity,F)));
}
F_STRING *memory_to_string(const BYTE* string, CELL length)