]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/aging_space.hpp
audio.engine.test: cleanup using
[factor.git] / vm / aging_space.hpp
index 743363b10c7e662a59ea3ea1acf8d7ff13ca8d0d..fc6c150d62054820fcc19d1b680d6087a89e16d8 100644 (file)
@@ -1,12 +1,32 @@
-namespace factor
-{
+namespace factor {
 
-struct aging_space : old_space {
-       aging_space(cell size, cell start) : old_space(size,start) {}
+struct aging_space : bump_allocator {
+  object_start_map starts;
 
-       bool is_nursery_p() { return false; }
-       bool is_aging_p()   { return true; }
-       bool is_tenured_p() { return false; }
+  aging_space(cell size, cell start)
+      : bump_allocator(size, start), starts(size, start) {}
+
+  object* allot(cell size) {
+    if (here + size > end)
+      return NULL;
+
+    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;
+    return 0;
+  }
+
+  cell first_object() {
+    if (start != here)
+      return start;
+    return 0;
+  }
 };
 
 }