3 // It is up to the caller to fill in the object's fields in a
7 inline object* factor_vm::allot_large_object(cell type, cell size) {
8 // If tenured space does not have enough room, collect and compact
9 cell requested_size = size + data->high_water_mark();
10 if (!data->tenured->can_allot_p(requested_size)) {
11 primitive_compact_gc();
13 // If it still won't fit, grow the heap
14 if (!data->tenured->can_allot_p(requested_size)) {
15 gc(collect_growing_heap_op, size);
19 object* obj = data->tenured->allot(size);
21 // Allows initialization code to store old->new pointers
22 // without hitting the write barrier in the common case of
23 // a nursery allocation
24 write_barrier(obj, size);
26 obj->initialize(type);
31 inline object* factor_vm::allot_object(cell type, cell size) {
32 FACTOR_ASSERT(!current_gc);
34 bump_allocator *nursery = data->nursery;
36 // If the object is bigger than the nursery, allocate it in tenured space
37 if (size >= nursery->size)
38 return allot_large_object(type, size);
40 // If the object is smaller than the nursery, allocate it in the nursery,
41 // after a GC if needed
42 if (nursery->here + size > nursery->end)
45 object* obj = nursery->allot(size);
46 obj->initialize(type);