]> gitweb.factorcode.org Git - factor.git/commitdiff
VM: smaller style-fixes, like removing redundant else clauses and this prefixes
authorBjörn Lindqvist <bjourne@gmail.com>
Fri, 14 Aug 2015 20:31:04 +0000 (22:31 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 15 Aug 2015 03:19:55 +0000 (20:19 -0700)
vm/aging_collector.cpp
vm/aging_space.hpp
vm/callstack.hpp
vm/code_blocks.cpp
vm/code_blocks.hpp
vm/gc_info.hpp
vm/quotations.cpp
vm/tenured_space.hpp

index 72713fe461c72181ef8e5ded0e4b899377d3808e..1e06ae7ac9d69bae53b3d5eafd19481fe5b69ad4 100644 (file)
@@ -27,7 +27,7 @@ void factor_vm::collect_aging() {
     current_gc->op = collect_to_tenured_op;
 
     collector<tenured_space, to_tenured_policy> collector(this,
-                                                          this->data->tenured,
+                                                          data->tenured,
                                                           to_tenured_policy(this));
     gc_event* event = current_gc->event;
 
@@ -53,7 +53,7 @@ void factor_vm::collect_aging() {
     data->reset_aging();
 
     collector<aging_space, aging_policy> collector(this,
-                                                   this->data->aging,
+                                                   data->aging,
                                                    aging_policy(this));
 
     collector.visitor.visit_all_roots();
index e504faf3170b46bf9ef1bc054012488ac4b5f3cf..fc6c150d62054820fcc19d1b680d6087a89e16d8 100644 (file)
@@ -19,15 +19,13 @@ struct aging_space : bump_allocator {
     cell size = ((object*)scan)->size();
     if (scan + size < here)
       return scan + size;
-    else
-      return 0;
+    return 0;
   }
 
   cell first_object() {
     if (start != here)
       return start;
-    else
-      return 0;
+    return 0;
   }
 };
 
index d683b7a6ab3453738d1840b5986cd16e55603d95..425ddc157f1421c207727750037673cf15742754 100644 (file)
@@ -12,7 +12,7 @@ inline void factor_vm::iterate_callstack_object(callstack* stack_,
                                                 Iterator& iterator,
                                                 Fixup& fixup) {
   data_root<callstack> stack(stack_, this);
-  fixnum frame_length = factor::untag_fixnum(stack->length);
+  fixnum frame_length = untag_fixnum(stack->length);
   fixnum frame_offset = 0;
 
   while (frame_offset < frame_length) {
@@ -39,7 +39,8 @@ inline void factor_vm::iterate_callstack_object(callstack* stack,
   iterate_callstack_object(stack, iterator, none);
 }
 
-/* Allocates memory */
+/* Iterates the callstack from innermost to outermost
+   callframe. Allocates memory */
 template <typename Iterator, typename Fixup>
 void factor_vm::iterate_callstack(context* ctx, Iterator& iterator,
                                   Fixup& fixup) {
index 55885f87d15300cf84b26a9032b13d6438342adf..72bd86c47c0d867580493b58a225f5af3875780f 100644 (file)
@@ -41,13 +41,10 @@ cell factor_vm::compute_entry_point_address(cell obj) {
 cell factor_vm::compute_entry_point_pic_address(word* w, cell tagged_quot) {
   if (!to_boolean(tagged_quot) || max_pic_size == 0)
     return w->entry_point;
-  else {
-    quotation* quot = untag<quotation>(tagged_quot);
-    if (quotation_compiled_p(quot))
-      return quot->entry_point;
-    else
-      return w->entry_point;
-  }
+  quotation* q = untag<quotation>(tagged_quot);
+  if (quotation_compiled_p(q))
+    return q->entry_point;
+  return w->entry_point;
 }
 
 cell factor_vm::compute_entry_point_pic_address(cell w_) {
index a08f78eb3ab363a1d7b3799802d0f00256efcc0c..bfff763eeac4e0ebb7bbeec06481269aa24036d4 100644 (file)
@@ -42,8 +42,7 @@ struct code_block {
   cell stack_frame_size() const {
     if (free_p())
       return 0;
-    else
-      return (header >> 20) & 0xFF0;
+    return (header >> 20) & 0xFF0;
   }
 
   cell stack_frame_size_for_address(cell addr) const {
@@ -54,8 +53,7 @@ struct code_block {
        fake "leaf frame" set up by the signal handler. */
     if (natural_frame_size == 0 || addr == entry_point())
       return LEAF_FRAME_SIZE;
-    else
-      return natural_frame_size;
+    return natural_frame_size;
   }
 
   void set_stack_frame_size(cell frame_size) {
index d71d230b32dbd252fa451b1fa98597511cd73c14..f5a25d2e3dfd200b22fdc2a997f15dab6cdcde8f 100644 (file)
@@ -1,8 +1,8 @@
 namespace factor {
 
 // gc_info should be kept in sync with:
+//   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;
index 828f384edba180d21152ed641bdb644b9ab81f1a..46d07aa294d63b9956418976dc112bf9593c341c 100644 (file)
@@ -150,11 +150,10 @@ void quotation_jit::iterate_quotation() {
     emit(parent->special_objects[JIT_PROLOG]);
   }
 
-  cell i;
   cell length = array_capacity(elements.untagged());
   bool tail_call = false;
 
-  for (i = 0; i < length; i++) {
+  for (cell i = 0; i < length; i++) {
     set_position(i);
 
     data_root<object> obj(array_nth(elements.untagged(), i), parent);
index 5d06683677f0427ff2dd53db269a169675c2f05d..2fff0515ad7cd6e43e18d583d42270413aea6ef2 100644 (file)
@@ -11,8 +11,8 @@ struct tenured_space : free_list_allocator<object> {
     if (obj) {
       starts.record_object_start_offset(obj);
       return obj;
-    } else
-      return NULL;
+    }
+    return NULL;
   }
 
   cell next_allocated_object_after(cell scan) {