]> gitweb.factorcode.org Git - factor.git/commitdiff
VM: simplified logic for allot_object()
authorBjörn Lindqvist <bjourne@gmail.com>
Fri, 14 Aug 2015 22:19:44 +0000 (00:19 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 15 Aug 2015 03:19:57 +0000 (20:19 -0700)
vm/allot.hpp

index 8b965d91f5c1c2abbe2b67b61b20e2171ca6c3fc..931fdcccbc1c466049f57ca70f04bbed9388b6ab 100644 (file)
@@ -9,21 +9,20 @@ inline object* factor_vm::allot_object(cell type, cell size) {
   FACTOR_ASSERT(!current_gc);
 
   bump_allocator *nursery = data->nursery;
+
+  /* If the object is bigger than the nursery, allocate it in tenured
+     space */
+  if (size >= nursery->size)
+    return allot_large_object(type, size);
+
   /* If the object is smaller than the nursery, allocate it in the nursery,
      after a GC if needed */
-  if (nursery->size > size) {
-    /* If there is insufficient room, collect the nursery */
-    if (nursery->here + size > nursery->end)
-      primitive_minor_gc();
+  if (nursery->here + size > nursery->end)
+    primitive_minor_gc();
 
-    object* obj = nursery->allot(size);
-
-    obj->initialize(type);
-    return obj;
-  } /* If the object is bigger than the nursery, allocate it in
-       tenured space */
-  else
-    return allot_large_object(type, size);
+  object* obj = nursery->allot(size);
+  obj->initialize(type);
+  return obj;
 }
 
 }