diff --git a/vm/factor.cpp b/vm/factor.cpp index f78999dc82..9abc378eb3 100644 --- a/vm/factor.cpp +++ b/vm/factor.cpp @@ -95,9 +95,29 @@ void factor_vm::init_parameters_from_args(vm_parameters* p, int argc, void factor_vm::prepare_boot_image() { std::cout << "*** Stage 2 early init... " << std::flush; - compile_all_words(); + // Compile all words. + data_root words(instances(WORD_TYPE), this); + + cell n_words = array_capacity(words.untagged()); + for (cell i = 0; i < n_words; i++) { + data_root word(array_nth(words.untagged(), i), this); + + FACTOR_ASSERT(!word->entry_point); + jit_compile_word(word.value(), word->def, false); + } update_code_heap_words(true); - initialize_all_quotations(); + + // Initialize all quotations + data_root quotations(instances(QUOTATION_TYPE), this); + + cell n_quots = array_capacity(quotations.untagged()); + for (cell i = 0; i < n_quots; i++) { + data_root quot(array_nth(quotations.untagged(), i), this); + + if (!quot->entry_point) + quot->entry_point = lazy_jit_compile_entry_point(); + } + special_objects[OBJ_STAGE2] = true_object; std::cout << "done" << std::endl; diff --git a/vm/quotations.cpp b/vm/quotations.cpp index a8ff4b746a..d5b87308f0 100644 --- a/vm/quotations.cpp +++ b/vm/quotations.cpp @@ -364,17 +364,4 @@ void factor_vm::primitive_quotation_compiled_p() { ctx->push(tag_boolean(quotation_compiled_p(quot))); } -/* Allocates memory */ -void factor_vm::initialize_all_quotations() { - cell all_quots = instances(QUOTATION_TYPE); - data_root quotations(all_quots, this); - - cell length = array_capacity(quotations.untagged()); - for (cell i = 0; i < length; i++) { - data_root quot(array_nth(quotations.untagged(), i), this); - if (!quot->entry_point) - quot.untagged()->entry_point = lazy_jit_compile_entry_point(); - } -} - } diff --git a/vm/vm.hpp b/vm/vm.hpp index d316fa7c26..505132ca75 100644 --- a/vm/vm.hpp +++ b/vm/vm.hpp @@ -461,8 +461,6 @@ struct factor_vm { void primitive_word_optimized_p(); void primitive_wrapper(); void jit_compile_word(cell word_, cell def_, bool relocating); - cell find_all_words(); - void compile_all_words(); // math void primitive_bignum_to_fixnum(); @@ -683,7 +681,6 @@ struct factor_vm { cell lazy_jit_compile(cell quot); bool quotation_compiled_p(quotation* quot); void primitive_quotation_compiled_p(); - void initialize_all_quotations(); // dispatch cell search_lookup_alist(cell table, cell klass); diff --git a/vm/words.cpp b/vm/words.cpp index 9ea29007e5..f7c8199de1 100644 --- a/vm/words.cpp +++ b/vm/words.cpp @@ -24,22 +24,6 @@ void factor_vm::jit_compile_word(cell word_, cell def_, bool relocating) { jit_compile_quotation(word->pic_tail_def, relocating); } -/* Allocates memory */ -cell factor_vm::find_all_words() { return instances(WORD_TYPE); } - -/* Allocates memory */ -void factor_vm::compile_all_words() { - data_root words(find_all_words(), this); - - cell length = array_capacity(words.untagged()); - for (cell i = 0; i < length; i++) { - data_root word(array_nth(words.untagged(), i), this); - - if (!word->entry_point || !word->code()->optimized_p()) - jit_compile_word(word.value(), word->def, false); - } -} - /* Allocates memory */ word* factor_vm::allot_word(cell name_, cell vocab_, cell hashcode_) { data_root vocab(vocab_, this);