]> 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 af787de6b56f68f7caa60518aabac7743c328842..baa0faa6c9d3554d28cfccd28598f8f1252a997a 100644 (file)
@@ -1,19 +1,19 @@
 namespace factor {
 
-/* The compiled code heap is structured into blocks. */
+// The compiled code heap is structured into blocks.
 struct code_block {
-  /* header format (bits indexed with least significant as zero):
-     bit   0  : free?
-     bits  1-2: type (as a code_block_type)
-     if not free:
-       bits  3-23: code size / 8
-       bits 24-31: stack frame size / 16
-     if free:
-       bits  3-end: code size / 8 */
+  // header format (bits indexed with least significant as zero):
+  // bit   0  : free?
+  // bits  1-2: type (as a code_block_type)
+  // if not free:
+  //   bits  3-23: code size / 8
+  //   bits 24-31: stack frame size / 16
+  // if free:
+  //   bits  3-end: code size / 8
   cell header;
-  cell owner;      /* tagged pointer to word, quotation or f */
-  cell parameters; /* tagged pointer to array or f */
-  cell relocation; /* tagged pointer to byte-array or f */
+  cell owner;      // tagged pointer to word, quotation or f
+  cell parameters; // tagged pointer to array or f
+  cell relocation; // tagged pointer to byte-array or f
 
   bool free_p() const { return (header & 1) == 1; }
 
@@ -25,9 +25,7 @@ struct code_block {
     header = ((header & ~0x7) | (type << 1));
   }
 
-  bool pic_p() const { return type() == code_block_pic; }
-
-  bool optimized_p() const { return type() == code_block_optimized; }
+  bool pic_p() const { return type() == CODE_BLOCK_PIC; }
 
   cell size() const {
     cell size;
@@ -47,10 +45,10 @@ struct code_block {
 
   cell stack_frame_size_for_address(cell addr) const {
     cell natural_frame_size = stack_frame_size();
-    /* The first instruction in a code block is the prolog safepoint,
-       and a leaf procedure code block will record a frame size of zero.
-       If we're seeing a stack frame in either of these cases, it's a
-       fake "leaf frame" set up by the signal handler. */
+    // The first instruction in a code block is the prolog safepoint,
+    // and a leaf procedure code block will record a frame size of zero.
+    // If we're seeing a stack frame in either of these cases, it's a
+    // fake "leaf frame" set up by the signal handler.
     if (natural_frame_size == 0 || addr == entry_point())
       return LEAF_FRAME_SIZE;
     return natural_frame_size;
@@ -64,11 +62,11 @@ 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); }
 
-  /* GC info is stored at the end of the block */
+  // GC info is stored at the end of the block
   gc_info* block_gc_info() const {
     return (gc_info*)((uint8_t*)this + size() - sizeof(gc_info));
   }