]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/arrays.hpp
io.streams.256color: faster by caching styles
[factor.git] / vm / arrays.hpp
index 5c039ad2c2b54d3508fb64420ddd68f8210286c5..6be877b63d412cb45f3878c487904286d22f88eb 100644 (file)
@@ -1,18 +1,14 @@
 namespace factor {
 
 inline cell array_nth(array* array, cell slot) {
-#ifdef FACTOR_DEBUG
   FACTOR_ASSERT(slot < array_capacity(array));
   FACTOR_ASSERT(array->type() == ARRAY_TYPE);
-#endif
   return array->data()[slot];
 }
 
 inline void factor_vm::set_array_nth(array* array, cell slot, cell value) {
-#ifdef FACTOR_DEBUG
   FACTOR_ASSERT(slot < array_capacity(array));
   FACTOR_ASSERT(array->type() == ARRAY_TYPE);
-#endif
   cell* slot_ptr = &array->data()[slot];
   *slot_ptr = value;
   write_barrier(slot_ptr);
@@ -22,10 +18,12 @@ struct growable_array {
   cell count;
   data_root<array> elements;
 
+  // Allocates memory
   growable_array(factor_vm* parent, cell capacity = 10)
       : count(0),
         elements(parent->allot_array(capacity, false_object), parent) {}
 
+  void reallot_array(cell count);
   void add(cell elt);
   void append(array* elts);
   void trim();