* a growing space leak.
*/
-#include "config.h"
-
#ifdef MAKE_BACK_GRAPH
#define MAX_IN 10 /* Maximum in-degree we handle directly */
#include "private/dbg_mlc.h"
-#include <unistd.h>
+/* #include <unistd.h> */
-#if !defined(DBG_HDRS_ALL) || (ALIGNMENT != CPP_WORDSZ/8) || !defined(UNIX_LIKE)
+#if !defined(DBG_HDRS_ALL) || (ALIGNMENT != CPP_WORDSZ/8) /* || !defined(UNIX_LIKE) */
# error Configuration doesnt support MAKE_BACK_GRAPH
#endif
/* if this were production code. */
#define MAX_BACK_EDGE_STRUCTS 100000
static back_edges *back_edge_space = 0;
-int GC_n_back_edge_structs = 0; /* Serves as pointer to never used */
+STATIC int GC_n_back_edge_structs = 0;
+ /* Serves as pointer to never used */
/* back_edges space. */
static back_edges *avail_back_edges = 0;
/* Pointer to free list of deallocated */
static void push_in_progress(ptr_t p)
{
- if (n_in_progress >= in_progress_size)
+ if (n_in_progress >= in_progress_size) {
if (in_progress_size == 0) {
in_progress_size = INITIAL_IN_PROGRESS;
in_progress_space = (ptr_t *)GET_MEM(in_progress_size * sizeof(ptr_t));
in_progress_space = new_in_progress_space;
/* FIXME: This just drops the old space. */
}
+ }
if (in_progress_space == 0)
ABORT("MAKE_BACK_GRAPH: Out of in-progress space: "
"Huge linear data structure?");
static GC_bool is_in_progress(ptr_t p)
{
- int i;
+ size_t i;
for (i = 0; i < n_in_progress; ++i) {
if (in_progress_space[i] == p) return TRUE;
}
} else { \
back_edges *orig_be_ = (back_edges *)((word)q & ~FLAG_MANY); \
back_edges *be_ = orig_be_; \
- int total_, local_; \
- int n_edges_ = be_ -> n_edges; \
+ int local_; \
+ word total_; \
+ word n_edges_ = be_ -> n_edges; \
for (total_ = 0, local_ = 0; total_ < n_edges_; ++local_, ++total_) { \
if (local_ == MAX_IN) { \
be_ = be_ -> cont; \
be -> edges[0] = old_back_ptr;
}
be -> height = HEIGHT_UNKNOWN;
- be -> height_gc_no = GC_gc_no - 1;
+ be -> height_gc_no = (unsigned short)(GC_gc_no - 1);
GC_ASSERT(be >= back_edge_space);
SET_OH_BG_PTR(p, (word)be | FLAG_MANY);
}
do {
f((ptr_t)(h -> hb_body + i), sz, descr);
- i += sz;
- } while (i + sz <= BYTES_TO_WORDS(HBLKSIZE));
+ i += (int)sz;
+ } while (i + (int)sz <= BYTES_TO_WORDS(HBLKSIZE));
}
void GC_apply_to_each_object(per_object_func f)
GC_apply_to_all_blocks(per_object_helper, (word)f);
}
+/*ARGSUSED*/
static void reset_back_edge(ptr_t p, size_t n_bytes, word gc_descr)
{
/* Skip any free list links, or dropped blocks */
deallocate_back_edges(be);
SET_OH_BG_PTR(p, 0);
} else {
- word *currentp;
GC_ASSERT(GC_is_marked(p));
return result;
}
be = (back_edges *)((word)back_ptr & ~FLAG_MANY);
- if (be -> height >= 0 && be -> height_gc_no == GC_gc_no)
+ if (be -> height >= 0 && be -> height_gc_no == (unsigned short)GC_gc_no)
return be -> height;
/* Ignore back edges in DFS */
if (be -> height == HEIGHT_IN_PROGRESS) return 0;
word this_height;
if (GC_is_marked(q) && !(FLAG_MANY & (word)GET_OH_BG_PTR(p))) {
if (GC_print_stats)
- GC_log_printf("Found bogus pointer from 0x%lx to 0x%lx\n", q, p);
+ GC_log_printf("Found bogus pointer from %p to %p\n", q, p);
/* Reachable object "points to" unreachable one. */
/* Could be caused by our lax treatment of GC descriptors. */
this_height = 1;
if (this_height >= result) result = this_height + 1;
});
be -> height = result;
- be -> height_gc_no = GC_gc_no;
+ be -> height_gc_no = (unsigned short)GC_gc_no;
return result;
}
-word GC_max_height;
-ptr_t GC_deepest_obj;
+STATIC word GC_max_height;
+STATIC ptr_t GC_deepest_obj;
/* Compute the maximum height of every unreachable predecessor p of a */
/* reachable object. Arrange to save the heights of all such objects p */
/* next GC. */
/* Set GC_max_height to be the maximum height we encounter, and */
/* GC_deepest_obj to be the corresponding object. */
+/*ARGSUSED*/
static void update_max_height(ptr_t p, size_t n_bytes, word gc_descr)
{
if (GC_is_marked(p) && GC_HAS_DEBUG_INFO(p)) {
- int i;
word p_height = 0;
ptr_t p_deepest_obj = 0;
ptr_t back_ptr;
}
be -> flags |= RETAIN;
be -> height = p_height;
- be -> height_gc_no = GC_gc_no;
+ be -> height_gc_no = (unsigned short)GC_gc_no;
}
if (p_height > GC_max_height) {
GC_max_height = p_height;
}
}
-word GC_max_max_height = 0;
+STATIC word GC_max_max_height = 0;
void GC_traverse_back_graph(void)
{
GC_print_heap_obj(GC_deepest_obj);
}
if (GC_print_stats) {
- GC_log_printf("Needed max total of %ld back-edge structs\n",
+ GC_log_printf("Needed max total of %d back-edge structs\n",
GC_n_back_edge_structs);
}
GC_apply_to_each_object(reset_back_edge);
GC_deepest_obj = 0;
}
-#endif /* MAKE_BACK_GRAPH */
+#else /* !MAKE_BACK_GRAPH */
+
+extern int GC_quiet;
+ /* ANSI C doesn't allow translation units to be empty. */
+
+#endif /* !MAKE_BACK_GRAPH */