Raymond Toy pushed to branch master at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • src/lisp/gencgc.c
    ... ... @@ -6756,10 +6756,9 @@ scavenge_newspace_generation_one_scan(int generation)
    6756 6756
     {
    
    6757 6757
         int i;
    
    6758 6758
     
    
    6759
    -#if 0
    
    6760
    -    fprintf(stderr, "Starting one full scan of newspace generation %d\n",
    
    6761
    -	    generation);
    
    6762
    -#endif
    
    6759
    +    DPRINTF(gencgc_verbose,
    
    6760
    +            (stderr, "Starting one full scan of newspace generation %d\n",
    
    6761
    +             generation));
    
    6763 6762
     
    
    6764 6763
         for (i = 0; i < last_free_page; i++) {
    
    6765 6764
     	if (PAGE_ALLOCATED(i) && !PAGE_UNBOXED(i)
    
    ... ... @@ -6864,10 +6863,10 @@ scavenge_newspace_generation_one_scan(int generation)
    6864 6863
     	    i = last_page;
    
    6865 6864
     	}
    
    6866 6865
         }
    
    6867
    -#if 0
    
    6868
    -    fprintf(stderr, "Finished one full scan of newspace generation %d\n",
    
    6869
    -	    generation);
    
    6870
    -#endif
    
    6866
    +
    
    6867
    +    DPRINTF(gencgc_verbose,
    
    6868
    +            (stderr, "Finished one full scan of newspace generation %d\n",
    
    6869
    +             generation));
    
    6871 6870
     }
    
    6872 6871
     
    
    6873 6872
     /* Scan all weak objects and reset weak object lists */
    
    ... ... @@ -6896,9 +6895,8 @@ scavenge_newspace_generation(int generation)
    6896 6895
         struct new_area (*previous_new_areas)[] = NULL;
    
    6897 6896
         int previous_new_areas_index;
    
    6898 6897
     
    
    6899
    -#if 0
    
    6900
    -    fprintf(stderr, "Start scavenge_newspace_generation %d\n", generation);
    
    6901
    -#endif
    
    6898
    +    DPRINTF(gencgc_verbose,
    
    6899
    +            (stderr, "Start scavenge_newspace_generation %d\n", generation));
    
    6902 6900
     
    
    6903 6901
     #define SC_NS_GEN_CK 0
    
    6904 6902
     #if SC_NS_GEN_CK
    
    ... ... @@ -7078,9 +7076,9 @@ scavenge_newspace_generation(int generation)
    7078 7076
     		    "*** scav.new.gen. %d: write protected page %d written to? dont_move=%d\n",
    
    7079 7077
     		    generation, i, PAGE_DONT_MOVE(i));
    
    7080 7078
     #endif
    
    7081
    -#if 0
    
    7082
    -    fprintf(stderr, "Finished scavenge_newspace_generation %d\n", generation);
    
    7083
    -#endif
    
    7079
    +
    
    7080
    +    DPRINTF(gencgc_verbose,
    
    7081
    +            (stderr, "Finished scavenge_newspace_generation %d\n", generation));
    
    7084 7082
     }
    
    7085 7083
     
    
    7086 7084
     
    
    ... ... @@ -7839,20 +7837,26 @@ garbage_collect_generation(int generation, int raise)
    7839 7837
         scavenge_control_stack();
    
    7840 7838
     #endif
    
    7841 7839
     
    
    7840
    +    DPRINTF(gencgc_verbose,
    
    7841
    +            (stderr, "Scavenging interrupt handlers ...\n"));
    
    7842
    +
    
    7842 7843
         scavenge_interrupt_handlers();
    
    7843 7844
     
    
    7844
    -#ifdef PRINTNOISE
    
    7845
    -    printf("Scavenging the binding stack (%d bytes) ...\n",
    
    7846
    -	   ((lispobj *) get_binding_stack_pointer() -
    
    7847
    -	    binding_stack) * sizeof(lispobj));
    
    7848
    -#endif
    
    7845
    +    DPRINTF(gencgc_verbose,
    
    7846
    +            (stderr, "Done scavenging interrupt handlers\n"));
    
    7847
    +
    
    7848
    +    DPRINTF(gencgc_verbose,
    
    7849
    +            (stderr, "Scavenging the binding stack (%d bytes) ...\n",
    
    7850
    +             ((lispobj *) get_binding_stack_pointer() -
    
    7851
    +              binding_stack) * sizeof(lispobj)));
    
    7852
    +
    
    7849 7853
         /* Scavenge the binding stack. */
    
    7850 7854
         scavenge(binding_stack,
    
    7851 7855
     	     (lispobj *) get_binding_stack_pointer() - binding_stack);
    
    7852 7856
     
    
    7853
    -#ifdef PRINTNOISE
    
    7854
    -    printf("Done scavenging the binding stack.\n");
    
    7855
    -#endif
    
    7857
    +    DPRINTF(gencgc_verbose,
    
    7858
    +            (stderr, "Done scavenging the binding stack.\n"));
    
    7859
    +
    
    7856 7860
         /*
    
    7857 7861
          * Scavenge the scavenge_hooks in case this refers to a hook added
    
    7858 7862
          * in a prior generation GC. From here on the scavenger_hook will
    
    ... ... @@ -7860,30 +7864,44 @@ garbage_collect_generation(int generation, int raise)
    7860 7864
          * doing here.
    
    7861 7865
          */
    
    7862 7866
     
    
    7863
    -#ifdef PRINTNOISE
    
    7864
    -    printf("Scavenging the scavenger hooks ...\n");
    
    7865
    -#endif
    
    7867
    +    DPRINTF(gencgc_verbose,
    
    7868
    +            (stderr, "Scavenging the scavenger hooks ...\n"));
    
    7869
    +
    
    7866 7870
         scavenge(&scavenger_hooks, 1);
    
    7867
    -#ifdef PRINTNOISE
    
    7868
    -    printf("Done scavenging the scavenger hooks.\n");
    
    7869
    -#endif
    
    7871
    +
    
    7872
    +    DPRINTF(gencgc_verbose,
    
    7873
    +            (stderr, "Done scavenging the scavenger hooks.\n"));
    
    7870 7874
     
    
    7871 7875
         static_space_size = (lispobj *) SymbolValue(STATIC_SPACE_FREE_POINTER)
    
    7872 7876
     	- static_space;
    
    7873
    -    if (gencgc_verbose > 1)
    
    7874
    -	fprintf(stderr, "Scavenge static space: %ld bytes\n",
    
    7875
    -		static_space_size * sizeof(lispobj));
    
    7877
    +
    
    7878
    +    DPRINTF(gencgc_verbose,
    
    7879
    +            (stderr, "Scavenge static space: %ld bytes\n",
    
    7880
    +             static_space_size * sizeof(lispobj)));
    
    7881
    +
    
    7876 7882
         scavenge(static_space, static_space_size);
    
    7877 7883
     
    
    7884
    +    DPRINTF(gencgc_verbose,
    
    7885
    +            (stderr, "Done scavenging static space\n"));
    
    7886
    +
    
    7878 7887
         /*
    
    7879 7888
          * All generations but the generation being GCed need to be
    
    7880 7889
          * scavenged. The new_space generation needs special handling as
    
    7881 7890
          * objects may be moved in - it is handle separately below.
    
    7882 7891
          */
    
    7883
    -    for (i = 0; i < NUM_GENERATIONS; i++)
    
    7884
    -	if (i != generation && i != new_space)
    
    7892
    +    for (i = 0; i < NUM_GENERATIONS; i++) {
    
    7893
    +	if (i != generation && i != new_space) {
    
    7894
    +            DPRINTF(gencgc_verbose,
    
    7895
    +                    (stderr, "Scavenge generation %lu (gen = %d, new space = %d)\n",
    
    7896
    +                     i, generation, new_space));
    
    7897
    +
    
    7885 7898
     	    scavenge_generation(i);
    
    7886 7899
     
    
    7900
    +            DPRINTF(gencgc_verbose,
    
    7901
    +                    (stderr, "Done scavenging generation %lu\n", i));
    
    7902
    +        }
    
    7903
    +    }
    
    7904
    +
    
    7887 7905
         /*
    
    7888 7906
          * Finally scavenge the new_space generation.  Keep going until no
    
    7889 7907
          * more objects are moved into the new generation.
    

  • 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"