added vm member to jit classes

db4
Phil Dawes 2009-08-17 21:37:09 +01:00
parent 386dafe747
commit 54b3c1ea88
6 changed files with 12 additions and 11 deletions

View File

@ -103,7 +103,7 @@ void update_pic_count(cell type)
struct inline_cache_jit : public jit { struct inline_cache_jit : public jit {
fixnum index; fixnum index;
inline_cache_jit(cell generic_word_) : jit(PIC_TYPE,generic_word_) {}; inline_cache_jit(cell generic_word_,factorvm *vm) : jit(PIC_TYPE,generic_word_,vm) {};
void emit_check(cell klass); void emit_check(cell klass);
void compile_inline_cache(fixnum index, void compile_inline_cache(fixnum index,
@ -173,7 +173,7 @@ code_block *factorvm::compile_inline_cache(fixnum index,cell generic_word_,cell
gc_root<array> methods(methods_); gc_root<array> methods(methods_);
gc_root<array> cache_entries(cache_entries_); gc_root<array> cache_entries(cache_entries_);
inline_cache_jit jit(generic_word.value()); inline_cache_jit jit(generic_word.value(),this);
jit.compile_inline_cache(index, jit.compile_inline_cache(index,
generic_word.value(), generic_word.value(),
methods.value(), methods.value(),

View File

@ -10,7 +10,7 @@ namespace factor
- polymorphic inline caches (inline_cache.cpp) */ - polymorphic inline caches (inline_cache.cpp) */
/* Allocates memory */ /* Allocates memory */
jit::jit(cell type_, cell owner_) jit::jit(cell type_, cell owner_, factorvm *vm)
: type(type_), : type(type_),
owner(owner_), owner(owner_),
code(), code(),
@ -18,7 +18,8 @@ jit::jit(cell type_, cell owner_)
literals(), literals(),
computing_offset_p(false), computing_offset_p(false),
position(0), position(0),
offset(0) offset(0),
myvm(vm)
{ {
if(stack_traces_p()) literal(owner.value()); if(stack_traces_p()) literal(owner.value());
} }

View File

@ -10,9 +10,9 @@ struct jit {
bool computing_offset_p; bool computing_offset_p;
fixnum position; fixnum position;
cell offset; cell offset;
//factorvm *vm; factorvm *myvm;
jit(cell jit_type, cell owner); jit(cell jit_type, cell owner, factorvm *vm);
void compute_position(cell offset); void compute_position(cell offset);
void emit_relocation(cell code_template); void emit_relocation(cell code_template);

View File

@ -20,7 +20,7 @@ code_block *factorvm::compile_profiling_stub(cell word_)
{ {
gc_root<word> word(word_); gc_root<word> word(word_);
jit jit(WORD_TYPE,word.value()); jit jit(WORD_TYPE,word.value(),this);
jit.emit_with(userenv[JIT_PROFILING],word.value()); jit.emit_with(userenv[JIT_PROFILING],word.value());
return jit.to_code_block(); return jit.to_code_block();

View File

@ -285,7 +285,7 @@ void factorvm::jit_compile(cell quot_, bool relocating)
gc_root<quotation> quot(quot_); gc_root<quotation> quot(quot_);
if(quot->code) return; if(quot->code) return;
quotation_jit compiler(quot.value(),true,relocating); quotation_jit compiler(quot.value(),true,relocating,this);
compiler.iterate_quotation(); compiler.iterate_quotation();
code_block *compiled = compiler.to_code_block(); code_block *compiled = compiler.to_code_block();
@ -368,7 +368,7 @@ fixnum factorvm::quot_code_offset_to_scan(cell quot_, cell offset)
gc_root<quotation> quot(quot_); gc_root<quotation> quot(quot_);
gc_root<array> array(quot->array); gc_root<array> array(quot->array);
quotation_jit compiler(quot.value(),false,false); quotation_jit compiler(quot.value(),false,false,this);
compiler.compute_position(offset); compiler.compute_position(offset);
compiler.iterate_quotation(); compiler.iterate_quotation();

4
vm/quotations.hpp Normal file → Executable file
View File

@ -5,8 +5,8 @@ struct quotation_jit : public jit {
gc_root<array> elements; gc_root<array> elements;
bool compiling, relocate; bool compiling, relocate;
quotation_jit(cell quot, bool compiling_, bool relocate_) quotation_jit(cell quot, bool compiling_, bool relocate_, factorvm *vm)
: jit(QUOTATION_TYPE,quot), : jit(QUOTATION_TYPE,quot,vm),
elements(owner.as<quotation>().untagged()->array), elements(owner.as<quotation>().untagged()->array),
compiling(compiling_), compiling(compiling_),
relocate(relocate_) {}; relocate(relocate_) {};