Raymond Toy pushed to branch issue-278-more-gencgc-debug-prints at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • src/lisp/gencgc.c
    ... ... @@ -6757,7 +6757,7 @@ scavenge_newspace_generation_one_scan(int generation)
    6757 6757
         int i;
    
    6758 6758
     
    
    6759 6759
         DPRINTF(gencgc_verbose,
    
    6760
    -            (stdout, "Starting one full scan of newspace generation %d\n",
    
    6760
    +            (stderr, "Starting one full scan of newspace generation %d\n",
    
    6761 6761
                  generation));
    
    6762 6762
     
    
    6763 6763
         for (i = 0; i < last_free_page; i++) {
    
    ... ... @@ -6865,7 +6865,7 @@ scavenge_newspace_generation_one_scan(int generation)
    6865 6865
         }
    
    6866 6866
     
    
    6867 6867
         DPRINTF(gencgc_verbose,
    
    6868
    -            (stdout, "Finished one full scan of newspace generation %d\n",
    
    6868
    +            (stderr, "Finished one full scan of newspace generation %d\n",
    
    6869 6869
                  generation));
    
    6870 6870
     }
    
    6871 6871
     
    
    ... ... @@ -6896,7 +6896,7 @@ scavenge_newspace_generation(int generation)
    6896 6896
         int previous_new_areas_index;
    
    6897 6897
     
    
    6898 6898
         DPRINTF(gencgc_verbose,
    
    6899
    -            (stdout, "Start scavenge_newspace_generation %d\n", generation));
    
    6899
    +            (stderr, "Start scavenge_newspace_generation %d\n", generation));
    
    6900 6900
     
    
    6901 6901
     #define SC_NS_GEN_CK 0
    
    6902 6902
     #if SC_NS_GEN_CK
    
    ... ... @@ -7078,7 +7078,7 @@ scavenge_newspace_generation(int generation)
    7078 7078
     #endif
    
    7079 7079
     
    
    7080 7080
         DPRINTF(gencgc_verbose,
    
    7081
    -            (stdout, "Finished scavenge_newspace_generation %d\n", generation));
    
    7081
    +            (stderr, "Finished scavenge_newspace_generation %d\n", generation));
    
    7082 7082
     }
    
    7083 7083
     
    
    7084 7084
     
    
    ... ... @@ -7838,15 +7838,15 @@ garbage_collect_generation(int generation, int raise)
    7838 7838
     #endif
    
    7839 7839
     
    
    7840 7840
         DPRINTF(gencgc_verbose,
    
    7841
    -            (stdout, "Scavenging interrupt handlers ...\n"));
    
    7841
    +            (stderr, "Scavenging interrupt handlers ...\n"));
    
    7842 7842
     
    
    7843 7843
         scavenge_interrupt_handlers();
    
    7844 7844
     
    
    7845 7845
         DPRINTF(gencgc_verbose,
    
    7846
    -            (stdout, "Done scavenging interrupt handlers\n"));
    
    7846
    +            (stderr, "Done scavenging interrupt handlers\n"));
    
    7847 7847
     
    
    7848 7848
         DPRINTF(gencgc_verbose,
    
    7849
    -            (stdout, "Scavenging the binding stack (%d bytes) ...\n",
    
    7849
    +            (stderr, "Scavenging the binding stack (%d bytes) ...\n",
    
    7850 7850
                  ((lispobj *) get_binding_stack_pointer() -
    
    7851 7851
                   binding_stack) * sizeof(lispobj)));
    
    7852 7852
     
    
    ... ... @@ -7855,7 +7855,7 @@ garbage_collect_generation(int generation, int raise)
    7855 7855
     	     (lispobj *) get_binding_stack_pointer() - binding_stack);
    
    7856 7856
     
    
    7857 7857
         DPRINTF(gencgc_verbose,
    
    7858
    -            (stdout, "Done scavenging the binding stack.\n"));
    
    7858
    +            (stderr, "Done scavenging the binding stack.\n"));
    
    7859 7859
     
    
    7860 7860
         /*
    
    7861 7861
          * Scavenge the scavenge_hooks in case this refers to a hook added
    
    ... ... @@ -7865,18 +7865,18 @@ garbage_collect_generation(int generation, int raise)
    7865 7865
          */
    
    7866 7866
     
    
    7867 7867
         DPRINTF(gencgc_verbose,
    
    7868
    -            (stdout, "Scavenging the scavenger hooks ...\n"));
    
    7868
    +            (stderr, "Scavenging the scavenger hooks ...\n"));
    
    7869 7869
     
    
    7870 7870
         scavenge(&scavenger_hooks, 1);
    
    7871 7871
     
    
    7872 7872
         DPRINTF(gencgc_verbose,
    
    7873
    -            (stdout, "Done scavenging the scavenger hooks.\n"));
    
    7873
    +            (stderr, "Done scavenging the scavenger hooks.\n"));
    
    7874 7874
     
    
    7875 7875
         static_space_size = (lispobj *) SymbolValue(STATIC_SPACE_FREE_POINTER)
    
    7876 7876
     	- static_space;
    
    7877 7877
     
    
    7878 7878
         DPRINTF(gencgc_verbose,
    
    7879
    -            (stdout, "Scavenge static space: %ld bytes\n",
    
    7879
    +            (stderr, "Scavenge static space: %ld bytes\n",
    
    7880 7880
                  static_space_size * sizeof(lispobj)));
    
    7881 7881
     
    
    7882 7882
         scavenge(static_space, static_space_size);
    

  • src/lisp/os.h
    ... ... @@ -8,7 +8,13 @@
    8 8
     
    
    9 9
     #include "lisp.h"
    
    10 10
     
    
    11
    -#define DPRINTF(t,a) { if (t) fprintf a; }
    
    11
    +#if defined(__GNUC__) || defined(__clang__)
    
    12
    +#define UNLIKELY(x) __builtin_expect(!!(x), 0)
    
    13
    +#else
    
    14
    +#define UNLIKELY(x) (x)
    
    15
    +#endif
    
    16
    +
    
    17
    +#define DPRINTF(t,a) { if (UNLIKELY(t)) fprintf a; }
    
    12 18
     
    
    13 19
     #ifdef DARWIN
    
    14 20
     #include "Darwin-os.h"