VM: smaller style-fixes, like removing redundant else clauses and this prefixes

db4
Björn Lindqvist 2015-08-14 22:31:04 +02:00 committed by John Benediktsson
parent e14d820138
commit 5d7fb5da60
8 changed files with 17 additions and 24 deletions

View File

@ -27,7 +27,7 @@ void factor_vm::collect_aging() {
current_gc->op = collect_to_tenured_op; current_gc->op = collect_to_tenured_op;
collector<tenured_space, to_tenured_policy> collector(this, collector<tenured_space, to_tenured_policy> collector(this,
this->data->tenured, data->tenured,
to_tenured_policy(this)); to_tenured_policy(this));
gc_event* event = current_gc->event; gc_event* event = current_gc->event;
@ -53,7 +53,7 @@ void factor_vm::collect_aging() {
data->reset_aging(); data->reset_aging();
collector<aging_space, aging_policy> collector(this, collector<aging_space, aging_policy> collector(this,
this->data->aging, data->aging,
aging_policy(this)); aging_policy(this));
collector.visitor.visit_all_roots(); collector.visitor.visit_all_roots();

View File

@ -19,14 +19,12 @@ struct aging_space : bump_allocator {
cell size = ((object*)scan)->size(); cell size = ((object*)scan)->size();
if (scan + size < here) if (scan + size < here)
return scan + size; return scan + size;
else
return 0; return 0;
} }
cell first_object() { cell first_object() {
if (start != here) if (start != here)
return start; return start;
else
return 0; return 0;
} }
}; };

View File

@ -12,7 +12,7 @@ inline void factor_vm::iterate_callstack_object(callstack* stack_,
Iterator& iterator, Iterator& iterator,
Fixup& fixup) { Fixup& fixup) {
data_root<callstack> stack(stack_, this); 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; fixnum frame_offset = 0;
while (frame_offset < frame_length) { while (frame_offset < frame_length) {
@ -39,7 +39,8 @@ inline void factor_vm::iterate_callstack_object(callstack* stack,
iterate_callstack_object(stack, iterator, none); iterate_callstack_object(stack, iterator, none);
} }
/* Allocates memory */ /* Iterates the callstack from innermost to outermost
callframe. Allocates memory */
template <typename Iterator, typename Fixup> template <typename Iterator, typename Fixup>
void factor_vm::iterate_callstack(context* ctx, Iterator& iterator, void factor_vm::iterate_callstack(context* ctx, Iterator& iterator,
Fixup& fixup) { Fixup& fixup) {

View 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) { cell factor_vm::compute_entry_point_pic_address(word* w, cell tagged_quot) {
if (!to_boolean(tagged_quot) || max_pic_size == 0) if (!to_boolean(tagged_quot) || max_pic_size == 0)
return w->entry_point; return w->entry_point;
else { quotation* q = untag<quotation>(tagged_quot);
quotation* quot = untag<quotation>(tagged_quot); if (quotation_compiled_p(q))
if (quotation_compiled_p(quot)) return q->entry_point;
return quot->entry_point;
else
return w->entry_point; return w->entry_point;
}
} }
cell factor_vm::compute_entry_point_pic_address(cell w_) { cell factor_vm::compute_entry_point_pic_address(cell w_) {

View File

@ -42,7 +42,6 @@ struct code_block {
cell stack_frame_size() const { cell stack_frame_size() const {
if (free_p()) if (free_p())
return 0; return 0;
else
return (header >> 20) & 0xFF0; return (header >> 20) & 0xFF0;
} }
@ -54,7 +53,6 @@ struct code_block {
fake "leaf frame" set up by the signal handler. */ fake "leaf frame" set up by the signal handler. */
if (natural_frame_size == 0 || addr == entry_point()) if (natural_frame_size == 0 || addr == entry_point())
return LEAF_FRAME_SIZE; return LEAF_FRAME_SIZE;
else
return natural_frame_size; return natural_frame_size;
} }

View File

@ -1,8 +1,8 @@
namespace factor { namespace factor {
// gc_info should be kept in sync with: // gc_info should be kept in sync with:
// basis/compiler/codegen/gc-maps/gc-maps.factor
// basis/vm/vm.factor // basis/vm/vm.factor
struct gc_info { struct gc_info {
uint32_t scrub_d_count; uint32_t scrub_d_count;
uint32_t scrub_r_count; uint32_t scrub_r_count;

View File

@ -150,11 +150,10 @@ void quotation_jit::iterate_quotation() {
emit(parent->special_objects[JIT_PROLOG]); emit(parent->special_objects[JIT_PROLOG]);
} }
cell i;
cell length = array_capacity(elements.untagged()); cell length = array_capacity(elements.untagged());
bool tail_call = false; bool tail_call = false;
for (i = 0; i < length; i++) { for (cell i = 0; i < length; i++) {
set_position(i); set_position(i);
data_root<object> obj(array_nth(elements.untagged(), i), parent); data_root<object> obj(array_nth(elements.untagged(), i), parent);

View File

@ -11,7 +11,7 @@ struct tenured_space : free_list_allocator<object> {
if (obj) { if (obj) {
starts.record_object_start_offset(obj); starts.record_object_start_offset(obj);
return obj; return obj;
} else }
return NULL; return NULL;
} }