vm: minor fixes after code review

db4
Slava Pestov 2009-11-03 04:56:58 -06:00
parent 51e9a891a8
commit ed3ab1335e
5 changed files with 24 additions and 23 deletions

View File

@ -39,6 +39,7 @@ void factor_vm::throw_error(cell error, stack_frame *callstack_top)
/* Reset local roots */ /* Reset local roots */
data_roots.clear(); data_roots.clear();
bignum_roots.clear(); bignum_roots.clear();
code_roots.clear();
/* If we had an underflow or overflow, stack pointers might be /* If we had an underflow or overflow, stack pointers might be
out of bounds */ out of bounds */

View File

@ -139,7 +139,7 @@ code_block *factor_vm::compile_inline_cache(fixnum index,
return code; 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) void *factor_vm::megamorphic_call_stub(cell generic_word)
{ {
return untag<word>(generic_word)->xt; return untag<word>(generic_word)->xt;
@ -174,7 +174,7 @@ void factor_vm::update_pic_transitions(cell pic_size)
ic_to_pic_transitions++; 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. (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; 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 also, the block containing the return address may now be dead. Use a code_root

View File

@ -6,11 +6,11 @@ namespace factor
/* Simple non-optimizing compiler. /* Simple non-optimizing compiler.
This is one of the two compilers implementing Factor; the second one is written 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 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 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) Calls to words and constant quotations (referenced by conditionals and dips)
are direct jumps to machine code blocks. Literals are also referenced directly are direct jumps to machine code blocks. Literals are also referenced directly

View File

@ -67,9 +67,9 @@ void factor_vm::update_word_xt(word *w_)
{ {
if(!w->profiling) if(!w->profiling)
{ {
/* Note: can't do w->profiling = ... since if LHS /* Note: can't do w->profiling = ... since LHS evaluates
evaluates before RHS, since in that case if RHS does a before RHS, and if RHS does a GC, we will have an
GC, we will have an invalid pointer on the LHS */ invalid pointer on the LHS */
code_block *profiling = compile_profiling_stub(w.value()); code_block *profiling = compile_profiling_stub(w.value());
w->profiling = profiling; w->profiling = profiling;
} }