]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/gc_info.hpp
xmode: fix handling of HASH_CHAR and always rules
[factor.git] / vm / gc_info.hpp
index 06710aa856895343164f74a9aebaccc823e2ed6e..79b89589b29dc04a8eeecf971a432bc02f73a853 100644 (file)
@@ -1,24 +1,15 @@
 namespace factor {
 
 // gc_info should be kept in sync with:
-//   core/vm/vm.factor
-
+//   basis/compiler/codegen/gc-maps/gc-maps.factor
+//   basis/vm/vm.factor
 struct gc_info {
-  uint32_t scrub_d_count;
-  uint32_t scrub_r_count;
-  uint32_t check_d_count;
-  uint32_t check_r_count;
   uint32_t gc_root_count;
   uint32_t derived_root_count;
   uint32_t return_address_count;
 
   cell callsite_bitmap_size() {
-    return
-        scrub_d_count +
-        scrub_r_count +
-        check_d_count +
-        check_r_count +
-        gc_root_count;
+    return gc_root_count;
   }
 
   cell total_bitmap_size() {
@@ -39,45 +30,25 @@ struct gc_info {
     return (uint8_t*)base_pointer_map() - total_bitmap_bytes();
   }
 
-  cell callsite_scrub_d(cell index) {
-    cell base = 0;
-    return base + index * scrub_d_count;
-  }
-
-  cell callsite_scrub_r(cell index) {
-    cell base = return_address_count * scrub_d_count;
-    return base + index * scrub_r_count;
-  }
-
-  cell callsite_check_d(cell index) {
-    cell base =
-        return_address_count * scrub_d_count +
-        return_address_count * scrub_r_count;
-    return base + index * check_d_count;
-  }
-
-  cell callsite_check_r(cell index) {
-    cell base =
-        return_address_count * scrub_d_count +
-        return_address_count * scrub_r_count +
-        return_address_count * check_d_count;
-    return base + index * check_r_count;
-  }
 
   cell callsite_gc_roots(cell index) {
-    cell base =
-        return_address_count * scrub_d_count +
-        return_address_count * scrub_r_count +
-        return_address_count * check_d_count +
-        return_address_count * check_r_count;
-    return base + index * gc_root_count;
+    return index * gc_root_count;
   }
 
   uint32_t lookup_base_pointer(cell index, cell derived_root) {
     return base_pointer_map()[index * derived_root_count + derived_root];
   }
 
-  cell return_address_index(cell return_address);
+  cell return_address_index(cell return_address) {
+    uint32_t* return_address_array = return_addresses();
+
+    for (cell i = 0; i < return_address_count; i++) {
+      if (return_address == return_address_array[i])
+        return i;
+    }
+
+    return (cell)-1;
+  }
 };
 
 }