Commit ee373ea7 authored by Radford Neal's avatar Radford Neal

new sggc version with set renamed to sbset to avoid conflicts

parent 7dc423a5
......@@ -18,7 +18,7 @@ with various option settings to test these out, as is done in the
Makefile supplied.
A facility used by SGGC for managing sets of values is documented in
set-doc, and tested in test-set, also runnable with run-tests.
sbset-doc, and tested in test-sbset, also runnable with run-tests.
See VERSIONS for information on current and past stable versions.
......
This diff is collapsed.
BASE RUNS
--
RUNS WITH -alloc-kind
--
RUNS WITH -alloc-small-kind
--
RUNS WITH -alloc-small-kind-quickly
--
RUNS WITH -call-freed
--- out-e-i 2017-04-16 19:36:19.000000000 -0400
+++ o-e-i 2017-05-20 12:24:04.000000000 -0400
@@ -14,3 +14,5 @@
Counts... Gen0: 2, Gen1: 39, Gen2: 714, Uncollected: 0
Big chunks... Gen0: 0, Gen1: 0, Gen2: 1, Uncollected: 0
Number of segments: 31, Total memory usage: 18639 bytes
+Number of freed objects: 45246
+Freed + still around: 46001
--
--- out-e-r 2017-04-16 19:36:19.000000000 -0400
+++ o-e-r 2017-05-20 12:24:04.000000000 -0400
@@ -14,3 +14,5 @@
Counts... Gen0: 86, Gen1: 93, Gen2: 750, Uncollected: 0
Big chunks... Gen0: 0, Gen1: 0, Gen2: 1, Uncollected: 0
Number of segments: 35, Total memory usage: 21555 bytes
+Number of freed objects: 62556
+Freed + still around: 63485
RUNS WITH -check-valid
--
RUNS WITH -clear-free
--
RUNS WITH -clear-free-no-reuse
--- out-e-i 2017-04-16 19:36:19.000000000 -0400
+++ o-e-i 2017-05-20 12:24:04.000000000 -0400
@@ -13,4 +13,4 @@
Allocated objects: 46001
Counts... Gen0: 2, Gen1: 39, Gen2: 714, Uncollected: 0
Big chunks... Gen0: 0, Gen1: 0, Gen2: 1, Uncollected: 0
-Number of segments: 31, Total memory usage: 18639 bytes
+Number of segments: 1155, Total memory usage: 722835 bytes
--
--- out-e-r 2017-04-16 19:36:19.000000000 -0400
+++ o-e-r 2017-05-20 12:24:04.000000000 -0400
@@ -13,4 +13,4 @@
Allocated objects: 63485
Counts... Gen0: 86, Gen1: 93, Gen2: 750, Uncollected: 0
Big chunks... Gen0: 0, Gen1: 0, Gen2: 1, Uncollected: 0
-Number of segments: 35, Total memory usage: 21555 bytes
+Number of segments: 1554, Total memory usage: 986442 bytes
RUNS WITH -data-blocking
--
RUNS WITH -db
--
RUNS WITH -find-obj-ret
--
RUNS WITH -memset-quickly
--
RUNS WITH -no-builtins
--
RUNS WITH -no-max-segments
--
RUNS WITH -no-object-zero
--
RUNS WITH -no-offset
--
RUNS WITH -no-sbset-static
--
RUNS WITH -no-segment-at-a-time
--
RUNS WITH -pg
--
RUNS WITH -seg-blocking
--
RUNS WITH -seg-direct
--- out-e-i 2017-04-16 19:36:19.000000000 -0400
+++ o-e-i 2017-05-20 12:24:05.000000000 -0400
@@ -13,4 +13,4 @@
Allocated objects: 46001
Counts... Gen0: 2, Gen1: 39, Gen2: 714, Uncollected: 0
Big chunks... Gen0: 0, Gen1: 0, Gen2: 1, Uncollected: 0
-Number of segments: 31, Total memory usage: 18639 bytes
+Number of segments: 31, Total memory usage: 18391 bytes
--
--- out-e-r 2017-04-16 19:36:19.000000000 -0400
+++ o-e-r 2017-05-20 12:24:05.000000000 -0400
@@ -13,4 +13,4 @@
Allocated objects: 63485
Counts... Gen0: 86, Gen1: 93, Gen2: 750, Uncollected: 0
Big chunks... Gen0: 0, Gen1: 0, Gen2: 1, Uncollected: 0
-Number of segments: 35, Total memory usage: 21555 bytes
+Number of segments: 35, Total memory usage: 21275 bytes
RUNS WITH -seg-direct-no-max
--- out-e-i 2017-04-16 19:36:19.000000000 -0400
+++ o-e-i 2017-05-20 12:24:05.000000000 -0400
@@ -13,4 +13,4 @@
Allocated objects: 46001
Counts... Gen0: 2, Gen1: 39, Gen2: 714, Uncollected: 0
Big chunks... Gen0: 0, Gen1: 0, Gen2: 1, Uncollected: 0
-Number of segments: 31, Total memory usage: 18639 bytes
+Number of segments: 31, Total memory usage: 18391 bytes
--
--- out-e-r 2017-04-16 19:36:19.000000000 -0400
+++ o-e-r 2017-05-20 12:24:05.000000000 -0400
@@ -13,4 +13,4 @@
Allocated objects: 63485
Counts... Gen0: 86, Gen1: 93, Gen2: 750, Uncollected: 0
Big chunks... Gen0: 0, Gen1: 0, Gen2: 1, Uncollected: 0
-Number of segments: 35, Total memory usage: 21555 bytes
+Number of segments: 35, Total memory usage: 21275 bytes
RUNS WITH -uncollected-nil
--- out-e-i 2017-04-16 19:36:19.000000000 -0400
+++ o-e-i 2017-05-20 12:24:05.000000000 -0400
@@ -11,6 +11,6 @@
11 \ l
12 \ ((O I) (I I) (I O I) (I I I) (I I O I) (I O I I) (I O O O I) (I I O O I) (I I I O I) (I O I I I) (I I I I I) (I O I O O I) (I O O I O I) (I I O I O I) (I I I I O I) (I O I O I I) (I I O I I I) (I O I I I I) (I I O O O O I) (I I I O O O I) (I O O I O O I) (I I I I O O I) (I I O O I O I) (I O O I I O I) (I O O O O I I) (I O I O O I I) (I I I O O I I) (I I O I O I I) (I O I I O I I) (I O O O I I I) (I I I I I I I))
Allocated objects: 46001
-Counts... Gen0: 2, Gen1: 39, Gen2: 714, Uncollected: 0
-Big chunks... Gen0: 0, Gen1: 0, Gen2: 1, Uncollected: 0
+Counts... Gen0: 2, Gen1: 39, Gen2: 713, Uncollected: 1
+Big chunks... Gen0: 0, Gen1: 0, Gen2: 0, Uncollected: 1
Number of segments: 31, Total memory usage: 18639 bytes
--
--- out-e-r 2017-04-16 19:36:19.000000000 -0400
+++ o-e-r 2017-05-20 12:24:05.000000000 -0400
@@ -11,6 +11,6 @@
11 \ l
12 \ ((O I) (I I) (I O I) (I I I) (I I O I) (I O I I) (I O O O I) (I I O O I) (I I I O I) (I O I I I) (I I I I I) (I O I O O I) (I O O I O I) (I I O I O I) (I I I I O I) (I O I O I I) (I I O I I I) (I O I I I I) (I I O O O O I) (I I I O O O I) (I O O I O O I) (I I I I O O I) (I I O O I O I) (I O O I I O I) (I O O O O I I) (I O I O O I I) (I I I O O I I) (I I O I O I I) (I O I I O I I) (I O O O I I I) (I I I I I I I))
Allocated objects: 63485
-Counts... Gen0: 86, Gen1: 93, Gen2: 750, Uncollected: 0
-Big chunks... Gen0: 0, Gen1: 0, Gen2: 1, Uncollected: 0
+Counts... Gen0: 86, Gen1: 93, Gen2: 749, Uncollected: 1
+Big chunks... Gen0: 0, Gen1: 0, Gen2: 0, Uncollected: 1
Number of segments: 35, Total memory usage: 21555 bytes
RUNS WITH -uncollected-nil-syms
--- out-e-i 2017-04-16 19:36:19.000000000 -0400
+++ o-e-i 2017-05-20 12:24:05.000000000 -0400
@@ -11,6 +11,6 @@
11 \ l
12 \ ((O I) (I I) (I O I) (I I I) (I I O I) (I O I I) (I O O O I) (I I O O I) (I I I O I) (I O I I I) (I I I I I) (I O I O O I) (I O O I O I) (I I O I O I) (I I I I O I) (I O I O I I) (I I O I I I) (I O I I I I) (I I O O O O I) (I I I O O O I) (I O O I O O I) (I I I I O O I) (I I O O I O I) (I O O I I O I) (I O O O O I I) (I O I O O I I) (I I I O O I I) (I I O I O I I) (I O I I O I I) (I O O O I I I) (I I I I I I I))
Allocated objects: 46001
-Counts... Gen0: 2, Gen1: 39, Gen2: 714, Uncollected: 0
-Big chunks... Gen0: 0, Gen1: 0, Gen2: 1, Uncollected: 0
+Counts... Gen0: 2, Gen1: 39, Gen2: 649, Uncollected: 65
+Big chunks... Gen0: 0, Gen1: 0, Gen2: 0, Uncollected: 1
Number of segments: 31, Total memory usage: 18639 bytes
--
--- out-e-r 2017-04-16 19:36:19.000000000 -0400
+++ o-e-r 2017-05-20 12:24:05.000000000 -0400
@@ -11,6 +11,6 @@
11 \ l
12 \ ((O I) (I I) (I O I) (I I I) (I I O I) (I O I I) (I O O O I) (I I O O I) (I I I O I) (I O I I I) (I I I I I) (I O I O O I) (I O O I O I) (I I O I O I) (I I I I O I) (I O I O I I) (I I O I I I) (I O I I I I) (I I O O O O I) (I I I O O O I) (I O O I O O I) (I I I I O O I) (I I O O I O I) (I O O I I O I) (I O O O O I I) (I O I O O I I) (I I I O O I I) (I I O I O I I) (I O I I O I I) (I O O O I I I) (I I I I I I I))
Allocated objects: 63485
-Counts... Gen0: 86, Gen1: 93, Gen2: 750, Uncollected: 0
-Big chunks... Gen0: 0, Gen1: 0, Gen2: 1, Uncollected: 0
+Counts... Gen0: 86, Gen1: 93, Gen2: 685, Uncollected: 65
+Big chunks... Gen0: 0, Gen1: 0, Gen2: 0, Uncollected: 1
Number of segments: 35, Total memory usage: 21555 bytes
RUNS WITH -uncollected-nil-syms-globals
--- out-e-i 2017-04-16 19:36:19.000000000 -0400
+++ o-e-i 2017-05-20 12:24:05.000000000 -0400
@@ -11,6 +11,6 @@
11 \ l
12 \ ((O I) (I I) (I O I) (I I I) (I I O I) (I O I I) (I O O O I) (I I O O I) (I I I O I) (I O I I I) (I I I I I) (I O I O O I) (I O O I O I) (I I O I O I) (I I I I O I) (I O I O I I) (I I O I I I) (I O I I I I) (I I O O O O I) (I I I O O O I) (I O O I O O I) (I I I I O O I) (I I O O I O I) (I O O I I O I) (I O O O O I I) (I O I O O I I) (I I I O O I I) (I I O I O I I) (I O I I O I I) (I O O O I I I) (I I I I I I I))
Allocated objects: 46001
-Counts... Gen0: 2, Gen1: 39, Gen2: 714, Uncollected: 0
-Big chunks... Gen0: 0, Gen1: 0, Gen2: 1, Uncollected: 0
-Number of segments: 31, Total memory usage: 18639 bytes
+Counts... Gen0: 2, Gen1: 39, Gen2: 585, Uncollected: 129
+Big chunks... Gen0: 0, Gen1: 0, Gen2: 0, Uncollected: 1
+Number of segments: 31, Total memory usage: 18895 bytes
--
--- out-e-r 2017-04-16 19:36:19.000000000 -0400
+++ o-e-r 2017-05-20 12:24:05.000000000 -0400
@@ -11,6 +11,6 @@
11 \ l
12 \ ((O I) (I I) (I O I) (I I I) (I I O I) (I O I I) (I O O O I) (I I O O I) (I I I O I) (I O I I I) (I I I I I) (I O I O O I) (I O O I O I) (I I O I O I) (I I I I O I) (I O I O I I) (I I O I I I) (I O I I I I) (I I O O O O I) (I I I O O O I) (I O O I O O I) (I I I I O O I) (I I O O I O I) (I O O I I O I) (I O O O O I I) (I O I O O I I) (I I I O O I I) (I I O I O I I) (I O I I O I I) (I O O O I I I) (I I I I I I I))
Allocated objects: 63485
-Counts... Gen0: 86, Gen1: 93, Gen2: 750, Uncollected: 0
-Big chunks... Gen0: 0, Gen1: 0, Gen2: 1, Uncollected: 0
+Counts... Gen0: 86, Gen1: 93, Gen2: 621, Uncollected: 129
+Big chunks... Gen0: 0, Gen1: 0, Gen2: 0, Uncollected: 1
Number of segments: 35, Total memory usage: 21555 bytes
#!/bin/bash
echo "BASE RUNS"
run-e-i
echo "--"
run-e-r
for i in `ls -d interp-* | fgrep -v .dSYM | sed "s/interp//g"`; do
echo " "
echo "RUNS WITH" $i
run-e-i $i
echo "--"
run-e-r $i
done
../sbset-app.h
\ No newline at end of file
../sbset.c
\ No newline at end of file
../sbset.h
\ No newline at end of file
../set-app.h
\ No newline at end of file
../set.c
\ No newline at end of file
../set.h
\ No newline at end of file
......@@ -20,29 +20,29 @@
/* NUMBER OF OFFSET BITS IN A (SEGMENT INDEX, OFFSET) PAIR. */
#define SET_OFFSET_BITS 6 /* Max is 6 for using 64-bit shift/mask operations */
#define SBSET_OFFSET_BITS 6 /* Max is 6 for using 64-bit shift/mask operations*/
/* CHAINS FOR LINKING SEGMENTS IN SETS. */
#define SET_CHAINS 5 /* Number of chains that can be used for sets */
#define SBSET_CHAINS 5 /* Number of chains that can be used for sets */
# define SET_UNUSED_FREE_NEW 0 /* Unused, free or newly allocated objects */
# define SGGC_UNUSED_FREE_NEW 0 /* Unused, free or newly allocated objects */
# define SET_OLD_GEN1 1 /* Objects that survived one GC */
# define SGGC_OLD_GEN1 1 /* Objects that survived one GC */
# define SET_OLD_GEN2_UNCOL 2 /* Objects that survived more than one GC,
# define SGGC_OLD_GEN2_UNCOL 2 /* Objects that survived more than one GC,
and also constant and uncollected objects */
# define SET_OLD_TO_NEW 3 /* Objects maybe with old-to-new references */
# define SGGC_OLD_TO_NEW 3 /* Objects maybe with old-to-new references */
# define SET_LOOK_AT 4 /* Objects that still need to be looked at
# define SGGC_LOOK_AT 4 /* Objects that still need to be looked at
in order to mark objects still in use */
/* EXTRA INFORMATION STORED IN A SET_SEGMENT STRUCTURE. Putting it
/* EXTRA INFORMATION STORED IN A SBSET_SEGMENT STRUCTURE. Putting it
here takes advantage of what might otherwise be 32 bits of unused
padding, and makes the set_segment struct be exactly 64 bytes in
padding, and makes the sbset_segment struct be exactly 64 bytes in
size (maybe advantageous for index computation (if needed), and
perhaps for cache behaviour).
......@@ -52,7 +52,7 @@
#define SGGC_CHUNK_BITS 31 /* Bits used to record the number of chunks */
#define SET_EXTRA_INFO \
#define SBSET_EXTRA_INFO \
union \
{ struct /* For big segments... */ \
{ unsigned char kind; /* The kind of segment (equal to type if big) */ \
......@@ -85,16 +85,16 @@
#ifdef SGGC_MAX_SEGMENTS
#ifdef SGGC_SEG_DIRECT
#define SET_DO_BEFORE_INLINE \
SGGC_EXTERN struct set_segment sggc_segment[SGGC_MAX_SEGMENTS];
#define SBSET_DO_BEFORE_INLINE \
SGGC_EXTERN struct sbset_segment sggc_segment[SGGC_MAX_SEGMENTS];
#else
SGGC_EXTERN struct set_segment *sggc_segment[SGGC_MAX_SEGMENTS];
SGGC_EXTERN struct sbset_segment *sggc_segment[SGGC_MAX_SEGMENTS];
#endif
#else
#ifdef SGGC_SEG_DIRECT
SGGC_EXTERN struct set_segment *sggc_segment;
SGGC_EXTERN struct sbset_segment *sggc_segment;
#else
SGGC_EXTERN struct set_segment **sggc_segment;
SGGC_EXTERN struct sbset_segment **sggc_segment;
#endif
#endif
......@@ -102,12 +102,12 @@ SGGC_EXTERN struct set_segment **sggc_segment;
/* MACRO FOR GETTING SEGMENT POINTER FROM SEGMENT INDEX. */
#ifdef SGGC_SEG_DIRECT
#define SET_SEGMENT(index) (sggc_segment+index)
#define SBSET_SEGMENT(index) (sggc_segment+index)
#else
#define SET_SEGMENT(index) (sggc_segment[index])
#define SBSET_SEGMENT(index) (sggc_segment[index])
#endif
/* INCLUDE THE NON-APPLICATION-SPECIFIC HEADER FOR THE SET MODULE. */
#include "set.h"
#include "sbset.h"
......@@ -20,7 +20,7 @@
#define NEED_SGGC_FUNCTIONS
#include <config.h>
#include <Defn.h>
#include "set.c"
#include "sbset.c"
#if USE_COMPRESSED_POINTERS
......
......@@ -67,7 +67,7 @@
#define SGGC_USE_OFFSET_POINTERS 1 /* Use offset form of data pointers */
#define SET_STATIC 1 /* Static set procedures in source, not linked */
#define SBSET_STATIC 1 /* Static set procedures in source, not linked */
#define SGGC_NO_OBJECT_ZERO /* Make SGGC_NO_OBJECT be all 0s rather than 1s */
......
......@@ -258,30 +258,30 @@ SETS OF OBJECTS
SGGC maintains several sets of objects, using the set facilities
documented in set-doc. Some of these sets share the same 'chain'.
There are five chains, identified by symbols defined in set-app.h (the
application specific header file for use of the set facility by SGGC),
as follows:
There are five chains, identified by symbols defined in sbset-app.h
(the application specific header file for use of the sbset facility by
SGGC), as follows:
SET_UNUSED_FREE_NEW Used for sets of free or newly-allocated objects
SGGC_UNUSED_FREE_NEW Used for sets of free or newly-allocated objects
of different kinds, called 'free_or_new[k]'
for each kind k, and a set of unused big
segments, called 'unused'.
SET_OLD_GEN1 Used for sets of objects in old generation 1,
SGGC_OLD_GEN1 Used for sets of objects in old generation 1,
separated by kind, called 'old_gen1[k]', plus
'old_gen1_big' for the big kinds.
SET_OLD_GEN2_UNCOL Used for sets of objects in old generation 2,
SGGC_OLD_GEN2_UNCOL Used for sets of objects in old generation 2,
separated by kind, called 'old_gen2[k]', plus
'old_gen2_big' for the big kinds, as well as
for the sets of uncollected objects, by kind,
called 'uncollected[k]', and for the set of
constant objects, called 'constants'.
SET_OLD_TO_NEW Used for the set of objects possibly having
SGGC_OLD_TO_NEW Used for the set of objects possibly having
old-to-new references, called 'old_to_new'.
SET_LOOK_AT Used for the set of objects that need to be
SGGC_LOOK_AT Used for the set of objects that need to be
looked at to follow pointers they contain,
called 'to_look_at'.
......@@ -293,7 +293,7 @@ produce a slight efficiency advantage. Note that big kinds must be
put in a separate, single, set since big segments can change their
kind, and would not be removed from a per-kind old_gen set in a way
that would allow them to change to another set sharing the same chain
(something possible only for removal with set_first). This is OK,
(something possible only for removal with sbset_first). This is OK,
because the 'free_or_new[k]' set for a big kind k contains all and
only the newly-free big objects of kind k (with no objects freed in
earlier collections).
......@@ -321,10 +321,10 @@ when checking whether a new reference stored in an object requires
putting the object in 'old_to_new'.
Note that with five chains, plus four bytes of extra information used
by SGGC, the size of a set_segment structure is 64 bytes, which may be
a good size for cache performance. As a power of two, it also allows
efficient indexing in an array of segments, which is used with one
implementation option (the alternative being to use an array of
by SGGC, the size of a sbset_segment structure is 64 bytes, which may
be a good size for cache performance. As a power of two, it also
allows efficient indexing in an array of segments, which is used with
one implementation option (the alternative being to use an array of
pointers to segments).
......@@ -361,7 +361,7 @@ of kind k are added to the 'uncollected[k]' set when allocated, not to
'free_or_new[k]'.
The sggc_alloc_small_kind_quickly function uses a bit vector, called
'sggc_next_free_bits[k]', to represent the free objects of kind k in
'SGGC_next_free_bits[k]', to represent the free objects of kind k in
the segment that such free objects are currently being taken from,
with the next free object being 'sggc_next_free_val[k]'. When
'sggc_next_free_bits[k]' is zero, allocation of a new object will
......@@ -392,7 +392,7 @@ compressed pointer to it, via the structure describing its segment.
Once the marking process has finished, the objects in all the
'free_or_new' sets are known to be unused. However, some of them may
still be in 'old_gen2' or 'old_gen1', so these sets are scanned to
remove elements that are in a set in the SET_UNUSED_FREE_NEW chain.
remove elements that are in a set in the SGGC_UNUSED_FREE_NEW chain.
Such objects are also removed from the 'old_to_new' set (see below).
If the application has registered a procedure that is to be called for
......@@ -541,8 +541,8 @@ different implementation options. The first two below are primarily
useful for debugging and performance evaluation, since the default is
likely to be the best choice.
SET_USE_BUILTINS may be set to 0 or 1 to disable or enable use of the
gcc/clang builtin functions for finding and counting 1 bits. The
SBSET_USE_BUILTINS may be set to 0 or 1 to disable or enable use of
the gcc/clang builtin functions for finding and counting 1 bits. The
default if this is not set is to use them if the compiler appears to
be gcc or clang.
......@@ -603,12 +603,12 @@ include the following:
allocating an object (moving them to 'small_unused' at that time,
preferring to allocate from a partially-used segment), or in a
separate pass over the 'free_or_new' sets at the end of a level 2
garbage collection. The currently unused set_move_first and
set_move_next procedures provided by the set facility are intended
to facilitate this. The segments in 'small_unused' could then be
reused for any small kind. Their data areas might or might not be
freed when they are put in 'small_unused' (perhaps only if a call
of sggc_alloc_zeroed fails).
garbage collection. The currently unused sbset_move_first and
sbset_move_next procedures provided by the set facility are
intended to facilitate this. The segments in 'small_unused' could
then be reused for any small kind. Their data areas might or
might not be freed when they are put in 'small_unused' (perhaps
only if a call of sggc_alloc_zeroed fails).
o Currently, SGGC never frees memory used for auxiliary information,
though it may be reused for other objects of the same kind (or a
......@@ -654,7 +654,7 @@ include the following:
field currently records the necessary information for this.
o Uncollected objects with old-to-new references could be kept in a
separate set that uses the SET_OLD_TO_NEW chain (since they are
separate set that uses the SGGC_OLD_TO_NEW chain (since they are
in separate kinds, hence don't share segments with collected
objects). A record could then be kept of the youngest generation
of any reference from an uncollected object, allowing scanning of
......
This diff is collapsed.
......@@ -26,7 +26,7 @@
/* SELECT WHETHER SGGC_NO_OBJECT IS ALL 0s OR ALL 1s. */
#ifdef SGGC_NO_OBJECT_ZERO
#define SET_NO_VALUE_ZERO
#define SBSET_NO_VALUE_ZERO
#endif
......@@ -39,10 +39,10 @@
#endif
#ifdef SGGC_NO_FUNCTIONS
#define SET_NO_FUNCTIONS
#define SBSET_NO_FUNCTIONS
#endif
#include "set-app.h"
#include "sbset-app.h"
#include <stdlib.h>
#ifdef SGGC_USE_MEMSET
#include <string.h>
......@@ -51,13 +51,13 @@
/* COMPRESSED POINTER (INDEX, OFFSET) TYPE, AND NO OBJECT CONSTANT. */
typedef set_value_t sggc_cptr_t; /* Type of compressed pointer (index,offset)*/
typedef sbset_value_t sggc_cptr_t; /* Type of compressed pointer, index+offset*/
#define SGGC_CPTR_VAL(i,o) SET_VAL((i),(o))
#define SGGC_SEGMENT_INDEX(p) SET_VAL_INDEX(p)
#define SGGC_SEGMENT_OFFSET(p) SET_VAL_OFFSET(p)
#define SGGC_CPTR_VAL(i,o) SBSET_VAL((i),(o))
#define SGGC_SEGMENT_INDEX(p) SBSET_VAL_INDEX(p)
#define SGGC_SEGMENT_OFFSET(p) SBSET_VAL_OFFSET(p)
#define SGGC_NO_OBJECT SET_NO_VALUE /* Special "no object" pointer */
#define SGGC_NO_OBJECT SBSET_NO_VALUE /* Special "no object" pointer */
/* ARRAYS OF POINTERS TO SPACE FOR MAIN AND AUXILIARY DATA . The sggc_data
......@@ -110,7 +110,7 @@ SGGC_EXTERN sggc_dptr *sggc_aux2; /* Pointer to array of pointers
#endif
#define SGGC_CHUNKS_IN_SMALL_SEGMENT (1 << SET_OFFSET_BITS)
#define SGGC_CHUNKS_IN_SMALL_SEGMENT (1 << SBSET_OFFSET_BITS)
/* INLINE FUNCTION TO GET DATA POINTER FOR AN OBJECT, and similarly
......@@ -129,21 +129,21 @@ SGGC_EXTERN sggc_dptr *sggc_aux2; /* Pointer to array of pointers
#endif
static inline char *SGGC_DATA (sggc_cptr_t cptr)
{ return ((char *) (sggc_data[SET_VAL_INDEX(cptr)]
+ (SGGC_OFFSET_CALC) SGGC_CHUNK_SIZE * (SGGC_OFFSET_CALC) cptr));
{ return ((char *) (sggc_data[SBSET_VAL_INDEX(cptr)] +
(SGGC_OFFSET_CALC) SGGC_CHUNK_SIZE * (SGGC_OFFSET_CALC) cptr));
}
#ifdef SGGC_AUX1_SIZE
static inline char *SGGC_AUX1 (sggc_cptr_t cptr)
{ return ((char *) (sggc_aux1[SET_VAL_INDEX(cptr)]
+ (SGGC_OFFSET_CALC) SGGC_AUX1_SIZE * (SGGC_OFFSET_CALC) cptr));
{ return ((char *) (sggc_aux1[SBSET_VAL_INDEX(cptr)] +
(SGGC_OFFSET_CALC) SGGC_AUX1_SIZE * (SGGC_OFFSET_CALC) cptr));
}
#endif
#ifdef SGGC_AUX2_SIZE
static inline char *SGGC_AUX2 (sggc_cptr_t cptr)
{ return ((char *) (sggc_aux2[SET_VAL_INDEX(cptr)]
+ (SGGC_OFFSET_CALC) SGGC_AUX2_SIZE * (SGGC_OFFSET_CALC) cptr));
{ return ((char *) (sggc_aux2[SBSET_VAL_INDEX(cptr)] +
(SGGC_OFFSET_CALC) SGGC_AUX2_SIZE * (SGGC_OFFSET_CALC) cptr));
}
#endif
......@@ -155,21 +155,21 @@ static inline char *SGGC_AUX2 (sggc_cptr_t cptr)
#endif
static inline char *SGGC_DATA (sggc_cptr_t cptr)
{ return sggc_data[SET_VAL_INDEX(cptr)]
+ (SGGC_OFFSET_CALC)SGGC_CHUNK_SIZE * (SGGC_OFFSET_CALC)SET_VAL_OFFSET(cptr);
{ return sggc_data[SBSET_VAL_INDEX(cptr)] +
(SGGC_OFFSET_CALC)SGGC_CHUNK_SIZE * (SGGC_OFFSET_CALC)SBSET_VAL_OFFSET(cptr);
}
#ifdef SGGC_AUX1_SIZE
static inline char *SGGC_AUX1 (sggc_cptr_t cptr)
{ return sggc_aux1[SET_VAL_INDEX(cptr)]
+ (SGGC_OFFSET_CALC)SGGC_AUX1_SIZE * (SGGC_OFFSET_CALC) SET_VAL_OFFSET(cptr);
{ return sggc_aux1[SBSET_VAL_INDEX(cptr)] +
(SGGC_OFFSET_CALC)SGGC_AUX1_SIZE * (SGGC_OFFSET_CALC) SBSET_VAL_OFFSET(cptr);
}
#endif
#ifdef SGGC_AUX2_SIZE
static inline char *SGGC_AUX2 (sggc_cptr_t cptr)
{ return sggc_aux2[SET_VAL_INDEX(cptr)]
+ (SGGC_OFFSET_CALC)SGGC_AUX2_SIZE * (SGGC_OFFSET_CALC) SET_VAL_OFFSET(cptr);
{ return sggc_aux2[SBSET_VAL_INDEX(cptr)] +
(SGGC_OFFSET_CALC)SGGC_AUX2_SIZE * (SGGC_OFFSET_CALC) SBSET_VAL_OFFSET(cptr);
}
#endif
......@@ -193,12 +193,12 @@ SGGC_EXTERN sggc_type_t *sggc_type; /* Types of objects in each segment */
/* Macro to access type of object, using the index of its segment. */
#define SGGC_TYPE(cptr) (sggc_type[SET_VAL_INDEX(cptr)])
#define SGGC_TYPE(cptr) (sggc_type[SBSET_VAL_INDEX(cptr)])
/* Inline function to find the kind of the segment containing an object. */
static inline sggc_kind_t SGGC_KIND (sggc_cptr_t cptr)
{ return SET_SEGMENT(SET_VAL_INDEX(cptr))->x.small.kind; /* same as big.kind */
{ return SBSET_SEGMENT(SBSET_VAL_INDEX(cptr))->x.small.kind; /* == x.big.kind */
}
/* Numbers of chunks for the various kinds (zero for kinds for big segments). */
......@@ -313,7 +313,7 @@ sggc_cptr_t sggc_constant (sggc_type_t type, sggc_kind_t kind, int n_objects,
static inline int sggc_youngest_generation (sggc_cptr_t from_ptr)
{
return set_chain_contains (SET_UNUSED_FREE_NEW, from_ptr);
return sbset_chain_contains (SGGC_UNUSED_FREE_NEW, from_ptr);
}
......@@ -322,7 +322,7 @@ static inline int sggc_youngest_generation (sggc_cptr_t from_ptr)
static inline int sggc_not_marked (sggc_cptr_t cptr)
{
return set_chain_contains (SET_UNUSED_FREE_NEW, cptr);
return sbset_chain_contains (SGGC_UNUSED_FREE_NEW, cptr);
}
......@@ -330,7 +330,7 @@ static inline int sggc_not_marked (sggc_cptr_t cptr)
static inline int sggc_is_constant (sggc_cptr_t cptr)
{
return SET_SEGMENT(SET_VAL_INDEX(cptr)) -> x.small.constant;
return SBSET_SEGMENT(SBSET_VAL_INDEX(cptr)) -> x.small.constant;
/* x.big.constant is the same thing */
}
......@@ -341,10 +341,10 @@ static inline int sggc_is_constant (sggc_cptr_t cptr)
static inline sggc_cptr_t sggc_alloc_small_kind_quickly (sggc_kind_t kind)
{
extern sggc_cptr_t sggc_next_free_val[SGGC_N_KINDS];
extern set_bits_t sggc_next_free_bits[SGGC_N_KINDS];
extern sbset_bits_t sggc_next_free_bits[SGGC_N_KINDS];
extern int sggc_next_segment_not_free[SGGC_N_KINDS];
set_bits_t nfb = sggc_next_free_bits[kind]; /* bits indicating where free */
sbset_bits_t nfb = sggc_next_free_bits[kind]; /* bits indicating where free */
if (nfb == 0)
{ return SGGC_NO_OBJECT;
......@@ -357,17 +357,18 @@ static inline sggc_cptr_t sggc_alloc_small_kind_quickly (sggc_kind_t kind)
if (nfb != 0)
{ sggc_cptr_t new_nfv = nfv + nch;
if ((nfb&1) == 0) /* next object in segment not free, look for first free */
{ int o = set_first_bit_pos(nfb);
{ int o = sbset_first_bit_pos(nfb);
nfb >>= o;
new_nfv += o;
}
sggc_next_free_val[kind] = new_nfv;
}
else if (!sggc_next_segment_not_free[kind])
{ sggc_cptr_t n = set_chain_next_segment (SET_UNUSED_FREE_NEW, nfv);
{ sggc_cptr_t n = sbset_chain_next_segment (SGGC_UNUSED_FREE_NEW, nfv);
sggc_next_free_val[kind] = n;
if (n != SGGC_NO_OBJECT)
{ nfb = set_chain_segment_bits(SET_UNUSED_FREE_NEW,n) >> SET_VAL_OFFSET(n);
{ nfb = sbset_chain_segment_bits(SGGC_UNUSED_FREE_NEW,n)
>> SBSET_VAL_OFFSET(n);
}
}
else
......@@ -391,9 +392,9 @@ static inline sggc_cptr_t sggc_alloc_small_kind_quickly (sggc_kind_t kind)
#ifdef SGGC_KIND_UNCOLLECTED
extern const int sggc_kind_uncollected[SGGC_N_KINDS];
extern struct set sggc_uncollected_sets[SGGC_N_KINDS];
extern struct sbset sggc_uncollected_sets[SGGC_N_KINDS];
if (sggc_kind_uncollected[kind])
{ set_add (&sggc_uncollected_sets[kind], nfv);
{ sbset_add (&sggc_uncollected_sets[kind], nfv);
sggc_info.uncol_count += 1;
}
else
......@@ -412,27 +413,27 @@ static inline void sggc_old_to_new_check (sggc_cptr_t from_ptr,
{
/* If from_ptr is youngest generation, no need to check anything else. */
if (set_chain_contains (SET_UNUSED_FREE_NEW, from_ptr))
if (sbset_chain_contains (SGGC_UNUSED_FREE_NEW, from_ptr))
{ return;
}
/* Can quit now if from_ptr is already in an old-to-new set (which are
the only ones using the SET_OLD_TO_NEW chain). */
the only ones using the SGGC_OLD_TO_NEW chain). */
if (set_chain_contains (SET_OLD_TO_NEW, from_ptr))
if (sbset_chain_contains (SGGC_OLD_TO_NEW, from_ptr))
{ return;
}
/* Note: from_ptr shouldn't be a constant, so below can look in whole chain,
in order to check for from_ptr being old generation 2 or uncollected. */
if (set_chain_contains (SET_OLD_GEN2_UNCOL, from_ptr))
if (sbset_chain_contains (SGGC_OLD_GEN2_UNCOL, from_ptr))
{
/* If from_ptr is in old generation 2 or uncollected, only others in
old generation 2, uncollected, or constants, can possibly be
referenced without using old-to-new. */
if (set_chain_contains (SET_OLD_GEN2_UNCOL, to_ptr))
if (sbset_chain_contains (SGGC_OLD_GEN2_UNCOL, to_ptr))
{
#ifndef SGGC_KIND_UNCOLLECTED
......@@ -462,7 +463,7 @@ static inline void sggc_old_to_new_check (sggc_cptr_t from_ptr,
/* If from_ptr is in old generation 1, only references to newly
allocated objects require using old-to-new. */
if (!set_chain_contains (SET_UNUSED_FREE_NEW, to_ptr))
if (!sbset_chain_contains (SGGC_UNUSED_FREE_NEW, to_ptr))
{ return;
}
}
......@@ -470,8 +471,8 @@ static inline void sggc_old_to_new_check (sggc_cptr_t from_ptr,
/* If we get here, we need to record the existence of an old-to-new
reference in from_ptr. */
extern struct set sggc_old_to_new_set;
set_add (&sggc_old_to_new_set, from_ptr);
extern struct sbset sggc_old_to_new_set;
sbset_add (&sggc_old_to_new_set, from_ptr);
}
......@@ -479,5 +480,5 @@ static inline void sggc_old_to_new_check (sggc_cptr_t from_ptr,
static inline sggc_cptr_t sggc_next_uncollected_of_kind (sggc_cptr_t obj)
{