From 1fddf797242a2999b2e176e2ef119ad4c727847a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Mon, 30 May 2016 03:03:10 +0200 Subject: [PATCH] VM: moving a few methods arounds word_call, word_jump and emit_mega_cache_lookup are only used in quotations.cpp so they should be defined there too. --- vm/dispatch.cpp | 26 -------------------------- vm/jit.hpp | 19 ++----------------- vm/quotations.cpp | 26 ++++++++++++++++++++++++++ vm/quotations.hpp | 15 +++++++++++++++ 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/vm/dispatch.cpp b/vm/dispatch.cpp index f1a4dd8acd..0434bce5f4 100644 --- a/vm/dispatch.cpp +++ b/vm/dispatch.cpp @@ -119,30 +119,4 @@ void factor_vm::primitive_dispatch_stats() { ctx->push(tag(byte_array_from_value(&dispatch_stats))); } -/* Allocates memory */ -void quotation_jit::emit_mega_cache_lookup(cell methods_, fixnum index, - cell cache_) { - data_root methods(methods_, parent); - data_root cache(cache_, parent); - - /* The object must be on the top of the datastack at this point. */ - - /* Do a cache lookup. */ - emit_with_literal(parent->special_objects[MEGA_LOOKUP], cache.value()); - - /* If we end up here, the cache missed. */ - emit(parent->special_objects[JIT_PROLOG]); - - /* Push index, method table and cache on the stack. */ - push(methods.value()); - push(tag_fixnum(index)); - push(cache.value()); - word_call(parent->special_objects[MEGA_MISS_WORD]); - - /* Now the new method has been stored into the cache, and its on - the stack. */ - emit(parent->special_objects[JIT_EPILOG]); - emit(parent->special_objects[JIT_EXECUTE]); -} - } diff --git a/vm/jit.hpp b/vm/jit.hpp index 98950467b8..07ad2d1b84 100644 --- a/vm/jit.hpp +++ b/vm/jit.hpp @@ -35,21 +35,6 @@ struct jit { emit_with_literal(parent->special_objects[JIT_PUSH_IMMEDIATE], literal); } - /* Allocates memory (literal(), emit())*/ - void word_jump(cell word_) { - data_root word(word_, parent); -#ifndef FACTOR_AMD64 - literal(tag_fixnum(xt_tail_pic_offset)); -#endif - literal(word.value()); - emit(parent->special_objects[JIT_WORD_JUMP]); - } - - /* Allocates memory */ - void word_call(cell word) { - emit_with_literal(parent->special_objects[JIT_WORD_CALL], word); - } - bool emit_subprimitive(cell word_, bool tail_call_p, bool stack_frame_p); fixnum get_position() { @@ -57,8 +42,8 @@ struct jit { /* If this is still on, emit() didn't clear it, so the offset was out of bounds */ return -1; - } else - return position; + } + return position; } void set_position(fixnum position_) { diff --git a/vm/quotations.cpp b/vm/quotations.cpp index d5b87308f0..09919adb11 100644 --- a/vm/quotations.cpp +++ b/vm/quotations.cpp @@ -263,6 +263,32 @@ cell quotation_jit::word_stack_frame_size(cell obj) { return JIT_FRAME_SIZE; } +/* Allocates memory */ +void quotation_jit::emit_mega_cache_lookup(cell methods_, fixnum index, + cell cache_) { + data_root methods(methods_, parent); + data_root cache(cache_, parent); + + /* The object must be on the top of the datastack at this point. */ + + /* Do a cache lookup. */ + emit_with_literal(parent->special_objects[MEGA_LOOKUP], cache.value()); + + /* If we end up here, the cache missed. */ + emit(parent->special_objects[JIT_PROLOG]); + + /* Push index, method table and cache on the stack. */ + push(methods.value()); + push(tag_fixnum(index)); + push(cache.value()); + word_call(parent->special_objects[MEGA_MISS_WORD]); + + /* Now the new method has been stored into the cache, and its on + the stack. */ + emit(parent->special_objects[JIT_EPILOG]); + emit(parent->special_objects[JIT_EXECUTE]); +} + /* Allocates memory */ code_block* factor_vm::jit_compile_quotation(cell owner_, cell quot_, bool relocating) { diff --git a/vm/quotations.hpp b/vm/quotations.hpp index cb61820d38..68d0a98720 100644 --- a/vm/quotations.hpp +++ b/vm/quotations.hpp @@ -28,6 +28,21 @@ struct quotation_jit : public jit { bool word_safepoint_p(cell obj); bool no_non_safepoint_words_p(); void iterate_quotation(); + + /* Allocates memory */ + void word_call(cell word) { + emit_with_literal(parent->special_objects[JIT_WORD_CALL], word); + } + + /* Allocates memory (literal(), emit())*/ + void word_jump(cell word_) { + data_root word(word_, parent); +#ifndef FACTOR_AMD64 + literal(tag_fixnum(xt_tail_pic_offset)); +#endif + literal(word.value()); + emit(parent->special_objects[JIT_WORD_JUMP]); + } }; VM_C_API cell lazy_jit_compile(cell quot, factor_vm* parent);