]> gitweb.factorcode.org Git - factor.git/commitdiff
VM: the jit class doesn't need to store the code block type
authorBjörn Lindqvist <bjourne@gmail.com>
Wed, 19 Oct 2016 07:28:59 +0000 (09:28 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Wed, 19 Oct 2016 07:28:59 +0000 (09:28 +0200)
vm/inline_cache.cpp
vm/jit.cpp
vm/jit.hpp
vm/quotations.cpp
vm/quotations.hpp

index 186a905afe51407c28d1adfd998633af83448107..473d67ab8cd5a5d6fca201d48b9e7782ac9720da 100644 (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;
 }
index 19f97cb0d1d4a42aae2539ac177f9e22cae14935..e382358c669ea9d1ff67b743ad970b50b5d5962a 100644 (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;
index f27c751e72c392c19cf76e2f42f3ad4a5358d704..07290501efca35f97ba0023800347c57a1fa6899 100644 (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&);
index 04f1bf1fec23ecee68467bb4fc3051805c3e3328..f9317fb4f39ddbec6298fb12c15a7b95fd3b3b3b 100644 (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);
 
index ae76e02d6560736023a6d13c0dcabf754a3e3d91..dd80c94882db75fe4fe7e2d1356253fc4d90aed4 100644 (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) {}