]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/code_blocks.hpp
io.streams.256color: faster by caching styles
[factor.git] / vm / code_blocks.hpp
index 771198092246a7d623dbfd506feb6c33892e3f52..baa0faa6c9d3554d28cfccd28598f8f1252a997a 100644 (file)
@@ -62,7 +62,7 @@ struct code_block {
     header = (header & 0xFFFFFF) | (frame_size << 20);
   }
 
-  template <typename Fixup> cell size(Fixup fixup) const { return size(); }
+  template <typename Fixup> cell size(Fixup fixup) const { (void)fixup; return size(); }
 
   cell entry_point() const { return (cell)(this + 1); }
 
@@ -74,17 +74,18 @@ struct code_block {
   void flush_icache() { factor::flush_icache((cell)this, size()); }
 
   template <typename Iterator> void each_instruction_operand(Iterator& iter) {
-    if (to_boolean(relocation)) {
-      byte_array* rels = (byte_array*)UNTAG(relocation);
+    if (!to_boolean(relocation))
+      return;
 
-      cell index = 0;
-      cell length = (rels->capacity >> TAG_BITS) / sizeof(relocation_entry);
+    byte_array* rels = untag<byte_array>(relocation);
 
-      for (cell i = 0; i < length; i++) {
-        relocation_entry rel = rels->data<relocation_entry>()[i];
-        iter(instruction_operand(rel, this, index));
-        index += rel.number_of_parameters();
-      }
+    cell index = 0;
+    cell length = untag_fixnum(rels->capacity) / sizeof(relocation_entry);
+
+    for (cell i = 0; i < length; i++) {
+      relocation_entry rel = rels->data<relocation_entry>()[i];
+      iter(instruction_operand(rel, this, index));
+      index += rel.number_of_parameters();
     }
   }