]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/object_start_map.cpp
io.streams.256color: faster by caching styles
[factor.git] / vm / object_start_map.cpp
index 0b615d219bfd363bfc46f28625e7606a889e0eac..a27a434fc6eeb555e8acbefb1f95703e3ae02135 100644 (file)
@@ -15,19 +15,17 @@ object_start_map::~object_start_map() { delete[] object_start_offsets; }
 cell object_start_map::find_object_containing_card(cell card_index) {
   if (card_index == 0)
     return start;
-  else {
-    card_index--;
+  card_index--;
 
-    while (object_start_offsets[card_index] == card_starts_inside_object) {
-      /* First card should start with an object */
-      FACTOR_ASSERT(card_index > 0);
-      card_index--;
-    }
-    return start + card_index * card_size + object_start_offsets[card_index];
+  while (object_start_offsets[card_index] == card_starts_inside_object) {
+    // First card should start with an object
+    FACTOR_ASSERT(card_index > 0);
+    card_index--;
   }
+  return start + card_index * card_size + object_start_offsets[card_index];
 }
 
-/* we need to remember the first object allocated in the card */
+// we need to remember the first object allocated in the card
 void object_start_map::record_object_start_offset(object* obj) {
   cell idx = addr_to_card((cell)obj - start);
   card obj_start = ((cell)obj & addr_card_mask);
@@ -44,10 +42,10 @@ void object_start_map::update_card_for_sweep(cell index, uint16_t mask) {
     mask >>= (offset / data_alignment);
 
     if (mask == 0) {
-      /* The rest of the block after the old object start is free */
+      // The rest of the block after the old object start is free
       object_start_offsets[index] = card_starts_inside_object;
     } else {
-      /* Move the object start forward if necessary */
+      // Move the object start forward if necessary
       object_start_offsets[index] =
           (card)(offset + (rightmost_set_bit(mask) * data_alignment));
     }