diff --git a/vm/errors.cpp b/vm/errors.cpp index 2bbe3e5328..7d7b1f0080 100755 --- a/vm/errors.cpp +++ b/vm/errors.cpp @@ -39,6 +39,7 @@ void factor_vm::throw_error(cell error, stack_frame *callstack_top) /* Reset local roots */ data_roots.clear(); bignum_roots.clear(); + code_roots.clear(); /* If we had an underflow or overflow, stack pointers might be out of bounds */ diff --git a/vm/inline_cache.cpp b/vm/inline_cache.cpp index fd5e93560b..21912966d0 100755 --- a/vm/inline_cache.cpp +++ b/vm/inline_cache.cpp @@ -139,7 +139,7 @@ code_block *factor_vm::compile_inline_cache(fixnum index, return code; } -/* A generic word's definition performs general method lookup. Allocates memory */ +/* A generic word's definition performs general method lookup. */ void *factor_vm::megamorphic_call_stub(cell generic_word) { return untag(generic_word)->xt; @@ -174,7 +174,7 @@ void factor_vm::update_pic_transitions(cell pic_size) ic_to_pic_transitions++; } -/* The cache_entries parameter is either f (on cold call site) or an array +/* The cache_entries parameter is empty (on cold call site) or has entries (on cache miss). Called from assembly with the actual return address. Compilation of the inline cache may trigger a GC, which may trigger a compaction; also, the block containing the return address may now be dead. Use a code_root diff --git a/vm/math.cpp b/vm/math.cpp index d5d4e89837..4266edc09c 100755 --- a/vm/math.cpp +++ b/vm/math.cpp @@ -379,7 +379,7 @@ fixnum factor_vm::to_fixnum(cell tagged) } } -VM_C_API fixnum to_fixnum(cell tagged,factor_vm *parent) +VM_C_API fixnum to_fixnum(cell tagged, factor_vm *parent) { return parent->to_fixnum(tagged); } @@ -399,7 +399,7 @@ void factor_vm::box_signed_1(s8 n) dpush(tag_fixnum(n)); } -VM_C_API void box_signed_1(s8 n,factor_vm *parent) +VM_C_API void box_signed_1(s8 n, factor_vm *parent) { return parent->box_signed_1(n); } @@ -409,7 +409,7 @@ void factor_vm::box_unsigned_1(u8 n) dpush(tag_fixnum(n)); } -VM_C_API void box_unsigned_1(u8 n,factor_vm *parent) +VM_C_API void box_unsigned_1(u8 n, factor_vm *parent) { return parent->box_unsigned_1(n); } @@ -419,7 +419,7 @@ void factor_vm::box_signed_2(s16 n) dpush(tag_fixnum(n)); } -VM_C_API void box_signed_2(s16 n,factor_vm *parent) +VM_C_API void box_signed_2(s16 n, factor_vm *parent) { return parent->box_signed_2(n); } @@ -429,7 +429,7 @@ void factor_vm::box_unsigned_2(u16 n) dpush(tag_fixnum(n)); } -VM_C_API void box_unsigned_2(u16 n,factor_vm *parent) +VM_C_API void box_unsigned_2(u16 n, factor_vm *parent) { return parent->box_unsigned_2(n); } @@ -439,7 +439,7 @@ void factor_vm::box_signed_4(s32 n) dpush(allot_integer(n)); } -VM_C_API void box_signed_4(s32 n,factor_vm *parent) +VM_C_API void box_signed_4(s32 n, factor_vm *parent) { return parent->box_signed_4(n); } @@ -449,7 +449,7 @@ void factor_vm::box_unsigned_4(u32 n) dpush(allot_cell(n)); } -VM_C_API void box_unsigned_4(u32 n,factor_vm *parent) +VM_C_API void box_unsigned_4(u32 n, factor_vm *parent) { return parent->box_unsigned_4(n); } @@ -459,7 +459,7 @@ void factor_vm::box_signed_cell(fixnum integer) dpush(allot_integer(integer)); } -VM_C_API void box_signed_cell(fixnum integer,factor_vm *parent) +VM_C_API void box_signed_cell(fixnum integer, factor_vm *parent) { return parent->box_signed_cell(integer); } @@ -469,7 +469,7 @@ void factor_vm::box_unsigned_cell(cell cell) dpush(allot_cell(cell)); } -VM_C_API void box_unsigned_cell(cell cell,factor_vm *parent) +VM_C_API void box_unsigned_cell(cell cell, factor_vm *parent) { return parent->box_unsigned_cell(cell); } @@ -482,7 +482,7 @@ void factor_vm::box_signed_8(s64 n) dpush(tag_fixnum(n)); } -VM_C_API void box_signed_8(s64 n,factor_vm *parent) +VM_C_API void box_signed_8(s64 n, factor_vm *parent) { return parent->box_signed_8(n); } @@ -501,7 +501,7 @@ s64 factor_vm::to_signed_8(cell obj) } } -VM_C_API s64 to_signed_8(cell obj,factor_vm *parent) +VM_C_API s64 to_signed_8(cell obj, factor_vm *parent) { return parent->to_signed_8(obj); } @@ -514,7 +514,7 @@ void factor_vm::box_unsigned_8(u64 n) dpush(tag_fixnum(n)); } -VM_C_API void box_unsigned_8(u64 n,factor_vm *parent) +VM_C_API void box_unsigned_8(u64 n, factor_vm *parent) { return parent->box_unsigned_8(n); } @@ -533,7 +533,7 @@ u64 factor_vm::to_unsigned_8(cell obj) } } -VM_C_API u64 to_unsigned_8(cell obj,factor_vm *parent) +VM_C_API u64 to_unsigned_8(cell obj, factor_vm *parent) { return parent->to_unsigned_8(obj); } @@ -553,7 +553,7 @@ float factor_vm::to_float(cell value) return untag_float_check(value); } -VM_C_API float to_float(cell value,factor_vm *parent) +VM_C_API float to_float(cell value, factor_vm *parent) { return parent->to_float(value); } @@ -563,7 +563,7 @@ void factor_vm::box_double(double flo) dpush(allot_float(flo)); } -VM_C_API void box_double(double flo,factor_vm *parent) +VM_C_API void box_double(double flo, factor_vm *parent) { return parent->box_double(flo); } @@ -573,7 +573,7 @@ double factor_vm::to_double(cell value) return untag_float_check(value); } -VM_C_API double to_double(cell value,factor_vm *parent) +VM_C_API double to_double(cell value, factor_vm *parent) { return parent->to_double(value); } diff --git a/vm/quotations.cpp b/vm/quotations.cpp index 2c5e401ad9..fc19266cee 100755 --- a/vm/quotations.cpp +++ b/vm/quotations.cpp @@ -6,11 +6,11 @@ namespace factor /* Simple non-optimizing compiler. This is one of the two compilers implementing Factor; the second one is written -in Factor and performs advanced optimizations. See core/compiler/compiler.factor. +in Factor and performs advanced optimizations. See basis/compiler/compiler.factor. The non-optimizing compiler compiles a quotation at a time by concatenating machine code chunks; prolog, epilog, call word, jump to word, etc. These machine -code chunks are generated from Factor code in core/cpu/.../bootstrap.factor. +code chunks are generated from Factor code in basis/cpu/.../bootstrap.factor. Calls to words and constant quotations (referenced by conditionals and dips) are direct jumps to machine code blocks. Literals are also referenced directly diff --git a/vm/words.cpp b/vm/words.cpp index c375ec2174..dfaeed2496 100644 --- a/vm/words.cpp +++ b/vm/words.cpp @@ -67,9 +67,9 @@ void factor_vm::update_word_xt(word *w_) { if(!w->profiling) { - /* Note: can't do w->profiling = ... since if LHS - evaluates before RHS, since in that case if RHS does a - GC, we will have an invalid pointer on the LHS */ + /* Note: can't do w->profiling = ... since LHS evaluates + before RHS, and if RHS does a GC, we will have an + invalid pointer on the LHS */ code_block *profiling = compile_profiling_stub(w.value()); w->profiling = profiling; }