]> gitweb.factorcode.org Git - factor.git/commitdiff
VM: uppercasing gc_op
authorBjörn Lindqvist <bjourne@gmail.com>
Wed, 19 Oct 2016 07:05:15 +0000 (09:05 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Wed, 19 Oct 2016 07:09:32 +0000 (09:09 +0200)
basis/tools/memory/memory.factor
basis/vm/vm.factor
vm/aging_collector.cpp
vm/allot.hpp
vm/compaction.cpp
vm/full_collector.cpp
vm/gc.cpp
vm/gc.hpp

index 5358158aafeca85dc6643c2ece8e4bb89ea28399..daf905cace4d09d90aa8788be7683083eb37ac48 100644 (file)
@@ -108,12 +108,12 @@ PRIVATE>
 
 : gc-op-string ( op -- string )
     {
-        { collect-nursery-op      [ "Copying from nursery" ] }
-        { collect-aging-op        [ "Copying from aging"   ] }
-        { collect-to-tenured-op   [ "Copying to tenured"   ] }
-        { collect-full-op         [ "Mark and sweep"       ] }
-        { collect-compact-op      [ "Mark and compact"     ] }
-        { collect-growing-heap-op [ "Grow heap"            ] }
+        { COLLECT-NURSERY-OP           [ "Copying from nursery" ] }
+        { COLLECT-AGING-OP             [ "Copying from aging"   ] }
+        { COLLECT-TO-TENURED-OP        [ "Copying to tenured"   ] }
+        { COLLECT-FULL-OP              [ "Mark and sweep"       ] }
+        { COLLECT-COMPACT-OP           [ "Mark and compact"     ] }
+        { COLLECT-GROWING-DATA-HEAP-OP [ "Grow heap"            ] }
     } case ;
 
 : (space-occupied) ( data-heap-room code-heap-room -- n )
@@ -203,12 +203,12 @@ SYMBOL: gc-events
 SINGLETONS: +unoptimized+ +optimized+ +profiling+ +pic+ ;
 
 TUPLE: code-block
-{ owner read-only }
-{ parameters read-only }
-{ relocation read-only }
-{ type read-only }
-{ size read-only }
-{ entry-point read-only } ;
+    { owner read-only }
+    { parameters read-only }
+    { relocation read-only }
+    { type read-only }
+    { size read-only }
+    { entry-point read-only } ;
 
 TUPLE: code-blocks { blocks groups } { cache hashtable } ;
 
index f14fa9f227d3aaf57e0a4d3fbb533bb43eba5ef4..405aed851373c8faf97d79141aee2c7db0b4481a 100644 (file)
@@ -54,12 +54,12 @@ STRUCT: vm
     { retainstack-size cell_t }
     { callstack-size cell_t } ;
 
-CONSTANT: collect-nursery-op 0
-CONSTANT: collect-aging-op 1
-CONSTANT: collect-to-tenured-op 2
-CONSTANT: collect-full-op 3
-CONSTANT: collect-compact-op 4
-CONSTANT: collect-growing-heap-op 5
+CONSTANT: COLLECT-NURSERY-OP 0
+CONSTANT: COLLECT-AGING-OP 1
+CONSTANT: COLLECT-TO-TENURED-OP 2
+CONSTANT: COLLECT-FULL-OP 3
+CONSTANT: COLLECT-COMPACT-OP 4
+CONSTANT: COLLECT-GROWING-DATA-HEAP-OP 5
 
 STRUCT: copying-sizes
 { size cell_t }
index 335dbba7deb16514a1a26e91122b41a72bd8b188..a152c0270c560a95d399a454d0bb691455b541ef 100644 (file)
@@ -41,7 +41,7 @@ void factor_vm::collect_aging() {
   // everything else to the aging semi-space, and reset the nursery pointer.
   {
     // Change the op so that if we fail here, an assertion will be raised.
-    current_gc->op = collect_to_tenured_op;
+    current_gc->op = COLLECT_TO_TENURED_OP;
 
     slot_visitor<from_tenured_refs_copier>
         visitor(this, from_tenured_refs_copier(data->tenured, &mark_stack));
@@ -64,7 +64,7 @@ void factor_vm::collect_aging() {
   }
   {
     // If collection fails here, do a to_tenured collection.
-    current_gc->op = collect_aging_op;
+    current_gc->op = COLLECT_AGING_OP;
 
     std::swap(data->aging, data->aging_semispace);
     data->reset_aging();
index b5c3f453092481459c6c5fcdffb39bbd89d5f8f7..49ace31043bcb1d3811f123c8962545ee684ccbe 100644 (file)
@@ -46,7 +46,7 @@ inline object* factor_vm::allot_large_object(cell type, cell size) {
 
     // If it still won't fit, grow the heap
     if (!data->tenured->can_allot_p(required_free)) {
-      gc(collect_growing_data_heap_op, size);
+      gc(COLLECT_GROWING_DATA_HEAP_OP, size);
     }
   }
   object* obj = data->tenured->allot(size);
index 4e9590b92ba22a45c2a7ff7bb23f9c3ba5ffff3b..f243ff81e3fcd5e5c1dc0651ee85ddb58e96d58a 100644 (file)
@@ -97,8 +97,8 @@ void factor_vm::collect_compact_impl() {
   const code_block* code_finger = (code_block*)code->allocator->start;
 
   {
-    compaction_fixup fixup(data_forwarding_map, code_forwarding_map, &data_finger,
-                           &code_finger);
+    compaction_fixup fixup(data_forwarding_map, code_forwarding_map,
+                           &data_finger, &code_finger);
     slot_visitor<compaction_fixup> forwarder(this, fixup);
 
     forwarder.visit_uninitialized_code_blocks();
@@ -150,9 +150,9 @@ void factor_vm::collect_compact() {
   collect_mark_impl();
   collect_compact_impl();
 
+  // Compaction did not free up enough memory. Grow the data heap.
   if (data->high_fragmentation_p()) {
-    // Compaction did not free up enough memory. Grow the heap.
-    set_current_gc_op(collect_growing_data_heap_op);
+    set_current_gc_op(COLLECT_GROWING_DATA_HEAP_OP);
     collect_growing_data_heap(0);
   }
 
index 7b466d88b43b6861a61f2de98ad609ae929bfb09..28652b5181b1a9b26001e6b8f93b28707c2c56a1 100644 (file)
@@ -111,12 +111,12 @@ void factor_vm::collect_full() {
 
   if (data->low_memory_p()) {
     // Full GC did not free up enough memory. Grow the heap.
-    set_current_gc_op(collect_growing_data_heap_op);
+    set_current_gc_op(COLLECT_GROWING_DATA_HEAP_OP);
     collect_growing_data_heap(0);
   } else if (data->high_fragmentation_p()) {
     // Enough free memory, but it is not contiguous. Perform a
     // compaction.
-    set_current_gc_op(collect_compact_op);
+    set_current_gc_op(COLLECT_COMPACT_OP);
     collect_compact_impl();
   }
 
index a5e82a79aee852e79730e657ffe0d896c31718fe..1b22f885c851810ea5872a7d2d6d29cf4515fdfb 100644 (file)
--- a/vm/gc.cpp
+++ b/vm/gc.cpp
@@ -65,15 +65,15 @@ gc_state::~gc_state() {
 }
 
 void factor_vm::start_gc_again() {
-  if (current_gc->op == collect_nursery_op) {
+  if (current_gc->op == COLLECT_NURSERY_OP) {
     // Nursery collection can fail if aging does not have enough
     // free space to fit all live objects from nursery.
-    current_gc->op = collect_aging_op;
-  } else if (current_gc->op == collect_aging_op) {
+    current_gc->op = COLLECT_AGING_OP;
+  } else if (current_gc->op == COLLECT_AGING_OP) {
     // Aging collection can fail if the aging semispace cannot fit
     // all the live objects from the other aging semispace and the
     // nursery.
-    current_gc->op = collect_to_tenured_op;
+    current_gc->op = COLLECT_TO_TENURED_OP;
   } else {
     // Nothing else should fail mid-collection due to insufficient
     // space in the target generation.
@@ -110,34 +110,34 @@ void factor_vm::gc(gc_op op, cell requested_size) {
         current_gc->event->op = current_gc->op;
 
       switch (current_gc->op) {
-        case collect_nursery_op:
+        case COLLECT_NURSERY_OP:
           collect_nursery();
           break;
-        case collect_aging_op:
+        case COLLECT_AGING_OP:
           // We end up here if the above fails.
           collect_aging();
           if (data->high_fragmentation_p()) {
             // Change GC op so that if we fail again, we crash.
-            set_current_gc_op(collect_full_op);
+            set_current_gc_op(COLLECT_FULL_OP);
             collect_full();
           }
           break;
-        case collect_to_tenured_op:
+        case COLLECT_TO_TENURED_OP:
           // We end up here if the above fails.
           collect_to_tenured();
           if (data->high_fragmentation_p()) {
             // Change GC op so that if we fail again, we crash.
-            set_current_gc_op(collect_full_op);
+            set_current_gc_op(COLLECT_FULL_OP);
             collect_full();
           }
           break;
-        case collect_full_op:
+        case COLLECT_FULL_OP:
           collect_full();
           break;
-        case collect_compact_op:
+        case COLLECT_COMPACT_OP:
           collect_compact();
           break;
-        case collect_growing_data_heap_op:
+        case COLLECT_GROWING_DATA_HEAP_OP:
           collect_growing_data_heap(requested_size);
           break;
         default:
@@ -169,15 +169,15 @@ void factor_vm::gc(gc_op op, cell requested_size) {
 }
 
 void factor_vm::primitive_minor_gc() {
-  gc(collect_nursery_op, 0);
+  gc(COLLECT_NURSERY_OP, 0);
 }
 
 void factor_vm::primitive_full_gc() {
-  gc(collect_full_op, 0);
+  gc(COLLECT_FULL_OP, 0);
 }
 
 void factor_vm::primitive_compact_gc() {
-  gc(collect_compact_op, 0);
+  gc(COLLECT_COMPACT_OP, 0);
 }
 
 void factor_vm::primitive_enable_gc_events() {
index a1eb59addc26f2c7f50d14893c588afe7d520bbf..b353c00a66a9925799059bcdfa15928b783b6db4 100644 (file)
--- a/vm/gc.hpp
+++ b/vm/gc.hpp
@@ -4,12 +4,12 @@ struct must_start_gc_again {
 };
 
 enum gc_op {
-  collect_nursery_op,
-  collect_aging_op,
-  collect_to_tenured_op,
-  collect_full_op,
-  collect_compact_op,
-  collect_growing_data_heap_op
+  COLLECT_NURSERY_OP,
+  COLLECT_AGING_OP,
+  COLLECT_TO_TENURED_OP,
+  COLLECT_FULL_OP,
+  COLLECT_COMPACT_OP,
+  COLLECT_GROWING_DATA_HEAP_OP
 };
 
 struct gc_event {