VM: the jit class doesn't need to store the code block type

char-rename
Björn Lindqvist 2016-10-19 09:28:59 +02:00
parent 453eca66c4
commit 51408b66cb
5 changed files with 10 additions and 13 deletions

View File

@ -32,8 +32,7 @@ void factor_vm::update_pic_count(cell type) {
}
struct inline_cache_jit : public jit {
inline_cache_jit(cell generic_word, factor_vm* vm)
: jit(CODE_BLOCK_PIC, generic_word, vm) {}
inline_cache_jit(cell generic_word, factor_vm* vm) : jit(generic_word, vm) {}
void emit_check_and_jump(cell ic_type, cell i, cell klass, cell method);
void emit_inline_cache(fixnum index, cell generic_word_, cell methods_,
@ -119,7 +118,7 @@ code_block* factor_vm::compile_inline_cache(fixnum index, cell generic_word_,
inline_cache_jit jit(generic_word.value(), this);
jit.emit_inline_cache(index, generic_word.value(), methods.value(),
cache_entries.value(), tail_call_p);
code_block* code = jit.to_code_block(JIT_FRAME_SIZE);
code_block* code = jit.to_code_block(CODE_BLOCK_PIC, JIT_FRAME_SIZE);
initialize_code_block(code);
return code;
}

View File

@ -9,9 +9,8 @@ namespace factor {
// Allocates memory (`code` and `relocation` initializers create
// growable_byte_array)
jit::jit(code_block_type type, cell owner, factor_vm* vm)
: type(type),
owner(owner, vm),
jit::jit(cell owner, factor_vm* vm)
: owner(owner, vm),
code(vm),
relocation(vm),
parameters(vm),
@ -115,7 +114,7 @@ void jit::compute_position(cell offset_) {
}
// Allocates memory (trim(), add_code_block)
code_block* jit::to_code_block(cell frame_size) {
code_block* jit::to_code_block(code_block_type type, cell frame_size) {
// Emit dummy GC info
code.grow_bytes(alignment_for(code.count + 4, data_alignment));
uint32_t dummy_gc_info = 0;

View File

@ -1,7 +1,6 @@
namespace factor {
struct jit {
code_block_type type;
data_root<object> owner;
growable_byte_array code;
growable_byte_array relocation;
@ -12,7 +11,7 @@ struct jit {
cell offset;
factor_vm* parent;
jit(code_block_type type, cell owner, factor_vm* parent);
jit(cell owner, factor_vm* parent);
~jit();
void compute_position(cell offset);
@ -51,7 +50,7 @@ struct jit {
position = position_;
}
code_block* to_code_block(cell frame_size);
code_block* to_code_block(code_block_type type, cell frame_size);
private:
jit(const jit&);

View File

@ -293,8 +293,8 @@ code_block* factor_vm::jit_compile_quotation(cell owner_, cell quot_,
cell frame_size = compiler.word_stack_frame_size(owner_);
code_block* compiled = compiler.to_code_block(frame_size);
code_block* compiled = compiler.to_code_block(CODE_BLOCK_UNOPTIMIZED,
frame_size);
if (relocating)
initialize_code_block(compiled);

View File

@ -6,7 +6,7 @@ struct quotation_jit : public jit {
// Allocates memory
quotation_jit(cell owner, bool compiling, bool relocate, factor_vm* vm)
: jit(CODE_BLOCK_UNOPTIMIZED, owner, vm),
: jit(owner, vm),
elements(false_object, vm),
compiling(compiling),
relocate(relocate) {}