*/
/* Allocates memory */
inline object* factor_vm::allot_object(cell type, cell size) {
-#ifdef FACTOR_DEBUG
FACTOR_ASSERT(!current_gc);
-#endif
/* If the object is smaller than the nursery, allocate it in the nursery,
after a GC if needed */
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);
if (owner.type_p(QUOTATION_TYPE)) {
tagged<quotation> quot(owner.as<quotation>());
tagged<array> elements(quot->array);
-#ifdef FACTOR_DEBUG
+
FACTOR_ASSERT(array_capacity(elements.untagged()) == 5);
FACTOR_ASSERT(array_nth(elements.untagged(), 4) ==
special_objects[PIC_MISS_WORD] ||
array_nth(elements.untagged(), 4) ==
special_objects[PIC_MISS_TAIL_WORD]);
-#endif
+
tagged<wrapper> word_wrapper(array_nth(elements.untagged(), 0));
return word_wrapper->object;
} else
all_blocks.clear();
all_blocks_set_inserter inserter(this);
allocator->iterate(inserter);
-#if defined(FACTOR_DEBUG)
+#ifdef FACTOR_DEBUG
verify_all_blocks_set();
#endif
}
}
~code_root() {
-#ifdef FACTOR_DEBUG
FACTOR_ASSERT(parent->code_roots.back() == this);
-#endif
parent->code_roots.pop_back();
}
};
void factor_vm::collect_compact_impl(bool trace_contexts_p) {
gc_event* event = current_gc->event;
-#if defined(FACTOR_DEBUG)
+#ifdef FACTOR_DEBUG
code->verify_all_blocks_set();
#endif
}
~gc_bignum() {
-#ifdef FACTOR_DEBUG
FACTOR_ASSERT(parent->bignum_roots.back() == (cell) addr);
-#endif
parent->bignum_roots.pop_back();
}
};
namespace factor {
template <typename Array> cell array_capacity(const Array* array) {
-#ifdef FACTOR_DEBUG
FACTOR_ASSERT(array->type() == Array::type_number);
-#endif
return array->capacity >> TAG_BITS;
}
}
inline static fixnum untag_fixnum(cell tagged) {
-#ifdef FACTOR_DEBUG
FACTOR_ASSERT(TAG(tagged) == FIXNUM_TYPE);
-#endif
return ((fixnum) tagged) >> TAG_BITS;
}
if (start.first == end.first)
bits[start.first] |= start_mask ^ end_mask;
else {
-#ifdef FACTOR_DEBUG
FACTOR_ASSERT(start.first < bits_size);
-#endif
bits[start.first] |= ~start_mask;
for (cell index = start.first + 1; index < end.first; index++)
bits[index] = (cell) - 1;
if (end_mask != 0) {
-#ifdef FACTOR_DEBUG
FACTOR_ASSERT(end.first < bits_size);
-#endif
bits[end.first] |= end_mask;
}
}
/* We have the popcount for every mark_bits_granularity entries; look
up and compute the rest */
Block* forward_block(const Block* original) {
-#ifdef FACTOR_DEBUG
FACTOR_ASSERT(marked_p(original));
-#endif
std::pair<cell, cell> position = bitmap_deref(original);
cell offset = (cell) original & (data_alignment - 1);
cell new_line_number =
approx_popcount + popcount(marked[position.first] & mask);
Block* new_block = (Block*)((char*)line_block(new_line_number) + offset);
-#ifdef FACTOR_DEBUG
FACTOR_ASSERT(new_block <= original);
-#endif
return new_block;
}
card_index--;
while (first_object_in_card(card_index) == card_starts_inside_object) {
-#ifdef FACTOR_DEBUG
/* First card should start with an object */
FACTOR_ASSERT(card_index > 0);
-#endif
card_index--;
}
}
cell value() const {
-#ifdef FACTOR_DEBUG
FACTOR_ASSERT(type_p());
-#endif
return value_;
}
Type* untagged() const {
-#ifdef FACTOR_DEBUG
FACTOR_ASSERT(type_p());
-#endif
return (Type*)(UNTAG(value_));
}
}
inline void check_data_pointer(object* pointer) {
-#ifdef FACTOR_DEBUG
- if (!(current_gc && current_gc->op == collect_growing_heap_op))
- FACTOR_ASSERT(data->seg->in_segment_p((cell) pointer));
-#endif
+ FACTOR_ASSERT((current_gc && current_gc->op == collect_growing_heap_op) ||
+ data->seg->in_segment_p((cell) pointer));
}
// generic arrays