]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/words.cpp
io.streams.256color: faster by caching styles
[factor.git] / vm / words.cpp
index f7c8199de17f46e557461862726569be325ea043..cce37446ed5ce91926388172a2eb9480560aec83 100644 (file)
@@ -2,14 +2,14 @@
 
 namespace factor {
 
-/* Compile a word definition with the non-optimizing compiler. */
-/* Allocates memory */
+// Compile a word definition with the non-optimizing compiler.
+// Allocates memory
 void factor_vm::jit_compile_word(cell word_, cell def_, bool relocating) {
   data_root<word> word(word_, this);
   data_root<quotation> def(def_, this);
 
-  /* Refuse to compile this word more than once, because quot_compiled_p()
-     depends on the identity of its code block */
+  // Refuse to compile this word more than once, because quot_compiled_p()
+  // depends on the identity of its code block
   if (word->entry_point &&
       word.value() == special_objects[LAZY_JIT_COMPILE_WORD])
     return;
@@ -24,7 +24,7 @@ void factor_vm::jit_compile_word(cell word_, cell def_, bool relocating) {
     jit_compile_quotation(word->pic_tail_def, relocating);
 }
 
-/* Allocates memory */
+// Allocates memory
 word* factor_vm::allot_word(cell name_, cell vocab_, cell hashcode_) {
   data_root<object> vocab(vocab_, this);
   data_root<object> name(name_, this);
@@ -46,8 +46,8 @@ word* factor_vm::allot_word(cell name_, cell vocab_, cell hashcode_) {
   return new_word.untagged();
 }
 
-/* (word) ( name vocabulary hashcode -- word ) */
-/* Allocates memory */
+// (word) ( name vocabulary hashcode -- word )
+// Allocates memory
 void factor_vm::primitive_word() {
   cell hashcode = ctx->pop();
   cell vocab = ctx->pop();
@@ -55,8 +55,8 @@ void factor_vm::primitive_word() {
   ctx->push(tag<word>(allot_word(name, vocab, hashcode)));
 }
 
-/* word-code ( word -- start end ) */
-/* Allocates memory (from_unsigned_cell allocates) */
+// word-code ( word -- start end )
+// Allocates memory (from_unsigned_cell allocates)
 void factor_vm::primitive_word_code() {
   data_root<word> w(ctx->pop(), this);
   check_tagged(w);
@@ -67,10 +67,11 @@ void factor_vm::primitive_word_code() {
 
 void factor_vm::primitive_word_optimized_p() {
   word* w = untag_check<word>(ctx->peek());
-  ctx->replace(tag_boolean(w->code()->optimized_p()));
+  cell t = w->code()->type();
+  ctx->replace(tag_boolean(t == CODE_BLOCK_OPTIMIZED));
 }
 
-/* Allocates memory */
+// Allocates memory
 void factor_vm::primitive_wrapper() {
   wrapper* new_wrapper = allot<wrapper>(sizeof(wrapper));
   new_wrapper->object = ctx->peek();