0.8.21.18:
[sbcl.git] / src / runtime / print.c
index 8534cbb..46f2b2f 100644 (file)
 
 #include <stdio.h>
 
+#include "sbcl.h"
 #include "print.h"
 #include "runtime.h"
-#include "sbcl.h"
 
 /* This file can be skipped if we're not supporting LDB. */
 #if defined(LISP_FEATURE_SB_LDB)
 
-#include "sbcl.h"
 #include "monitor.h"
 #include "vars.h"
 #include "os.h"
+#include "gencgc-alloc-region.h" /* genesis/thread.h needs this */
+#include "genesis/static-symbols.h"
+#include "genesis/primitive-objects.h"
+
+#include "genesis/static-symbols.h"
+
+
 
 static int max_lines = 20, cur_lines = 0;
 static int max_depth = 5, brief_depth = 2, cur_depth = 0;
@@ -44,11 +50,11 @@ static void print_obj(char *prefix, lispobj obj);
 
 char *lowtag_Names[] = {
     "even fixnum",
-    "function pointer",
+    "instance pointer",
     "other immediate [0]",
     "list pointer",
     "odd fixnum",
-    "instance pointer",
+    "function pointer",
     "other immediate [1]",
     "other pointer"
 };
@@ -212,7 +218,7 @@ static void brief_otherimm(lispobj obj)
 
     type = widetag_of(obj);
     switch (type) {
-        case BASE_CHAR_WIDETAG:
+        case CHARACTER_WIDETAG:
             c = (obj>>8)&0xff;
             switch (c) {
                 case '\0':
@@ -269,7 +275,7 @@ static void print_otherimm(lispobj obj)
            printf(", unknown type (0x%0x)", type);
 
     switch (widetag_of(obj)) {
-        case BASE_CHAR_WIDETAG:
+        case CHARACTER_WIDETAG:
             printf(": ");
             brief_otherimm(obj);
             break;
@@ -289,7 +295,7 @@ static void brief_list(lispobj obj)
     int space = 0;
     int length = 0;
 
-    if (!is_valid_lisp_addr((os_vm_address_t)obj))
+    if (!is_valid_lisp_addr((os_vm_address_t)native_pointer(obj)))
        printf("(invalid Lisp-level address)");
     else if (obj == NIL)
         printf("NIL");
@@ -321,7 +327,7 @@ static void brief_list(lispobj obj)
 
 static void print_list(lispobj obj)
 {
-    if (!is_valid_lisp_addr((os_vm_address_t)obj)) {
+    if (!is_valid_lisp_addr((os_vm_address_t)native_pointer(obj))) {
        printf("(invalid address)");
     } else if (obj == NIL) {
         printf(" (NIL)");
@@ -379,7 +385,7 @@ static void brief_otherptr(lispobj obj)
             }
             break;
 
-        case SIMPLE_STRING_WIDETAG:
+        case SIMPLE_BASE_STRING_WIDETAG:
             vector = (struct vector *)ptr;
             putchar('"');
             for (charptr = (char *)vector->data; *charptr != '\0'; charptr++) {
@@ -412,11 +418,16 @@ static void print_slots(char **slots, int count, lispobj *ptr)
  * on the values in sbcl.h (or perhaps be generated automatically
  * by GENESIS as part of sbcl.h). */
 static char *symbol_slots[] = {"value: ", "unused: ",
-    "plist: ", "name: ", "package: ", NULL};
+    "plist: ", "name: ", "package: ",
+#ifdef LISP_FEATURE_SB_THREAD
+    "tls-index: " ,
+#endif                        
+    NULL};
 static char *ratio_slots[] = {"numer: ", "denom: ", NULL};
 static char *complex_slots[] = {"real: ", "imag: ", NULL};
 static char *code_slots[] = {"words: ", "entry: ", "debug: ", NULL};
-static char *fn_slots[] = {"self: ", "next: ", "name: ", "arglist: ", "type: ", NULL};
+static char *fn_slots[] = {
+    "self: ", "next: ", "name: ", "arglist: ", "type: ", NULL};
 static char *closure_slots[] = {"fn: ", NULL};
 static char *funcallable_instance_slots[] = {"fn: ", "lexenv: ", "layout: ", NULL};
 static char *weak_pointer_slots[] = {"value: ", NULL};
@@ -480,11 +491,12 @@ static void print_otherptr(lispobj obj)
                 print_slots(symbol_slots, count, ptr);
                 break;
 
+#if N_WORD_BITS == 32
             case SINGLE_FLOAT_WIDETAG:
                 NEWLINE_OR_RETURN;
                 printf("%g", ((struct single_float *)native_pointer(obj))->value);
                 break;
-
+#endif
             case DOUBLE_FLOAT_WIDETAG:
                 NEWLINE_OR_RETURN;
                 printf("%g", ((struct double_float *)native_pointer(obj))->value);
@@ -524,7 +536,10 @@ static void print_otherptr(lispobj obj)
                 break;
 #endif
 
-            case SIMPLE_STRING_WIDETAG:
+            case SIMPLE_BASE_STRING_WIDETAG:
+#ifdef SIMPLE_CHARACTER_STRING_WIDETAG
+       case SIMPLE_CHARACTER_STRING_WIDETAG: /* FIXME */
+#endif
                 NEWLINE_OR_RETURN;
                 cptr = (char *)(ptr+1);
                 putchar('"');
@@ -587,7 +602,11 @@ static void print_otherptr(lispobj obj)
 #ifdef SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG
            case SIMPLE_ARRAY_COMPLEX_LONG_FLOAT_WIDETAG:
 #endif
-            case COMPLEX_STRING_WIDETAG:
+            case COMPLEX_BASE_STRING_WIDETAG:
+#ifdef COMPLEX_CHARACTER_STRING_WIDETAG
+       case COMPLEX_CHARACTER_STRING_WIDETAG:
+#endif
+            case COMPLEX_VECTOR_NIL_WIDETAG:
             case COMPLEX_BIT_VECTOR_WIDETAG:
             case COMPLEX_VECTOR_WIDETAG:
             case COMPLEX_ARRAY_WIDETAG:
@@ -598,7 +617,6 @@ static void print_otherptr(lispobj obj)
                 break;
 
             case SIMPLE_FUN_HEADER_WIDETAG:
-            case CLOSURE_FUN_HEADER_WIDETAG:
                 print_slots(fn_slots, 5, ptr);
                 break;
 
@@ -631,7 +649,7 @@ static void print_otherptr(lispobj obj)
                print_slots(weak_pointer_slots, 1, ptr);
                 break;
 
-            case BASE_CHAR_WIDETAG:
+            case CHARACTER_WIDETAG:
             case UNBOUND_MARKER_WIDETAG:
                 NEWLINE_OR_RETURN;
                 printf("pointer to an immediate?");
@@ -652,11 +670,11 @@ static void print_otherptr(lispobj obj)
 static void print_obj(char *prefix, lispobj obj)
 {
     static void (*verbose_fns[])(lispobj obj)
-       = {print_fixnum, print_otherptr, print_otherimm, print_list,
-          print_fixnum, print_struct, print_otherimm, print_otherptr};
+       = {print_fixnum, print_struct, print_otherimm, print_list,
+          print_fixnum, print_otherptr, print_otherimm, print_otherptr};
     static void (*brief_fns[])(lispobj obj)
-       = {brief_fixnum, brief_otherptr, brief_otherimm, brief_list,
-          brief_fixnum, brief_struct, brief_otherimm, brief_otherptr};
+       = {brief_fixnum, brief_struct, brief_otherimm, brief_list,
+          brief_fixnum, brief_otherptr, brief_otherimm, brief_otherptr};
     int type = lowtag_of(obj);
     struct var *var = lookup_by_obj(obj);
     char buffer[256];