]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/debug.cpp
io.streams.256color: faster by caching styles
[factor.git] / vm / debug.cpp
index a464ff751bedfbf8c69bb82ba1066fd2508b21e8..4ffa5ac388947f6a9637a5c7ceedad4d04d90ebc 100644 (file)
@@ -13,10 +13,10 @@ ostream& operator<<(ostream& out, const string* str) {
 }
 
 void factor_vm::print_word(ostream& out, word* word, cell nesting) {
-  if (tagged<object>(word->vocabulary).type_p(STRING_TYPE))
+  if (TAG(word->vocabulary) == STRING_TYPE)
     out << untag<string>(word->vocabulary) << ":";
 
-  if (tagged<object>(word->name).type_p(STRING_TYPE))
+  if (TAG(word->name) == STRING_TYPE)
     out << untag<string>(word->name);
   else {
     out << "#<not a string: ";
@@ -62,6 +62,7 @@ void factor_vm::print_alien(ostream& out, alien* alien, cell nesting) {
 }
 
 void factor_vm::print_byte_array(ostream& out, byte_array* array, cell nesting) {
+  (void)nesting;
   cell length = array->capacity;
   cell i;
   bool trimmed;
@@ -112,7 +113,7 @@ void factor_vm::print_nested_obj(ostream& out, cell obj, fixnum nesting) {
 
   quotation* quot;
 
-  switch (tagged<object>(obj).type()) {
+  switch (TAG(obj)) {
     case FIXNUM_TYPE:
       out << untag_fixnum(obj);
       break;
@@ -158,7 +159,7 @@ void factor_vm::print_nested_obj(ostream& out, cell obj, fixnum nesting) {
       print_alien(out, untag<alien>(obj), nesting - 1);
       break;
     default:
-      out << "#<" << type_name(tagged<object>(obj).type()) << " @ ";
+      out << "#<" << type_name(TAG(obj)) << " @ ";
       out << (void*)obj << ">";
       break;
   }
@@ -266,7 +267,7 @@ void factor_vm::dump_memory(ostream& out, cell from, cell to) {
 
 void dump_memory_range(ostream& out, const char* name, cell name_w,
                        cell start, cell end) {
-  out << setw(name_w) << left << name << ": ";
+  out << setw(static_cast<int>(name_w)) << left << name << ": ";
 
   out << "[" << (void*)start << " -> " << (void*)end << "] ";
   out << setw(10) << right << (end - start) << " bytes" << endl;
@@ -348,8 +349,8 @@ struct code_block_printer {
     if (scan->free_p())
       status = "free";
     else {
-      reloc_size += parent->object_size(scan->relocation);
-      parameter_size += parent->object_size(scan->parameters);
+      reloc_size += object_size(scan->relocation);
+      parameter_size += object_size(scan->parameters);
 
       if (parent->code->allocator->state.marked_p((cell)scan))
         status = "marked";
@@ -365,10 +366,10 @@ struct code_block_printer {
   }
 };
 
-/* Dump all code blocks for debugging */
+// Dump all code blocks for debugging
 void factor_vm::dump_code_heap(ostream& out) {
   code_block_printer printer(this, out);
-  code->allocator->iterate(printer);
+  code->allocator->iterate(printer, no_fixup());
   out << printer.reloc_size << " bytes used by relocation tables" << endl;
   out << printer.parameter_size << " bytes used by parameter tables" << endl;
 }
@@ -460,10 +461,10 @@ void factor_vm::factorbug() {
     cin >> setw(1024) >> cmd >> setw(0);
     if (!cin.good()) {
       if (!seen_command) {
-        /* If we exit with an EOF immediately, then
-           dump stacks. This is useful for builder and
-           other cases where Factor is run with stdin
-           redirected to /dev/null */
+        // If we exit with an EOF immediately, then
+        // dump stacks. This is useful for builder and
+        // other cases where Factor is run with stdin
+        // redirected to /dev/null
         fep_disabled = true;
 
         print_datastack(cout);
@@ -537,8 +538,6 @@ void factor_vm::factorbug() {
       ctx->push(addr);
     } else if (cmd == "code")
       dump_code_heap(cout);
-    else if (cmd == "compact-gc")
-      primitive_compact_gc();
     else if (cmd == "gc")
       primitive_full_gc();
     else if (cmd == "compact-gc")