]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/aging_space.hpp
webapps.wiki: adding search bar
[factor.git] / vm / aging_space.hpp
index 99efd44de5f498214a7a511816489447e749b504..fc6c150d62054820fcc19d1b680d6087a89e16d8 100644 (file)
@@ -1,29 +1,32 @@
-namespace factor
-{
+namespace factor {
 
-struct aging_space : bump_allocator<object> {
-       object_start_map starts;
+struct aging_space : bump_allocator {
+  object_start_map starts;
 
-       aging_space(cell size, cell start) :
-               bump_allocator<object>(size,start), starts(size,start) {}
+  aging_space(cell size, cell start)
+      : bump_allocator(size, start), starts(size, start) {}
 
-       object *allot(cell size)
-       {
-               if(here + size > end) return NULL;
+  object* allot(cell size) {
+    if (here + size > end)
+      return NULL;
 
-               object *obj = bump_allocator<object>::allot(size);
-               starts.record_object_start_offset(obj);
-               return obj;
-       }
+    object* obj = bump_allocator::allot(size);
+    starts.record_object_start_offset(obj);
+    return obj;
+  }
 
-       cell next_object_after(cell scan)
-       {
-               cell size = ((object *)scan)->size();
-               if(scan + size < here)
-                       return scan + size;
-               else
-                       return 0;
-       }
+  cell next_object_after(cell scan) {
+    cell size = ((object*)scan)->size();
+    if (scan + size < here)
+      return scan + size;
+    return 0;
+  }
+
+  cell first_object() {
+    if (start != here)
+      return start;
+    return 0;
+  }
 };
 
 }