diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-18 01:04:43 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-18 01:04:43 +0000 |
commit | 8fee6c5ba203062646a84ef04770c79ba2be0a6a (patch) | |
tree | 0a038d94cc4acd44c0926f011247f6b7969fa84b /boehm-gc/finalize.c | |
parent | 75ae025532a15d2842c5401959ef6775e3ebe550 (diff) | |
download | gcc-8fee6c5ba203062646a84ef04770c79ba2be0a6a.tar.gz |
* Makefile.am, acinclude.m4, configure.in: Imported GC 6.0 and
merged local changes.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44994 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'boehm-gc/finalize.c')
-rw-r--r-- | boehm-gc/finalize.c | 66 |
1 files changed, 45 insertions, 21 deletions
diff --git a/boehm-gc/finalize.c b/boehm-gc/finalize.c index 4c41eb54bf9..229d828632c 100644 --- a/boehm-gc/finalize.c +++ b/boehm-gc/finalize.c @@ -202,15 +202,27 @@ signed_word * log_size_ptr; } new_dl = (struct disappearing_link *) GC_INTERNAL_MALLOC(sizeof(struct disappearing_link),NORMAL); - if (new_dl != 0) { - new_dl -> dl_hidden_obj = HIDE_POINTER(obj); - new_dl -> dl_hidden_link = HIDE_POINTER(link); - dl_set_next(new_dl, dl_head[index]); - dl_head[index] = new_dl; - GC_dl_entries++; - } else { - GC_finalization_failures++; + if (0 == new_dl) { +# ifdef THREADS + UNLOCK(); + ENABLE_SIGNALS(); +# endif + new_dl == GC_oom_fn(sizeof(struct disappearing_link)); + if (0 == new_dl) { + GC_finalization_failures++; + return(0); + } + /* It's not likely we'll make it here, but ... */ +# ifdef THREADS + DISABLE_SIGNALS(); + LOCK(); +# endif } + new_dl -> dl_hidden_obj = HIDE_POINTER(obj); + new_dl -> dl_hidden_link = HIDE_POINTER(link); + dl_set_next(new_dl, dl_head[index]); + dl_head[index] = new_dl; + GC_dl_entries++; # ifdef THREADS UNLOCK(); ENABLE_SIGNALS(); @@ -245,7 +257,7 @@ signed_word * log_size_ptr; UNLOCK(); ENABLE_SIGNALS(); # ifdef DBG_HDRS_ALL - dl_next(curr_dl) = 0; + dl_set_next(curr_dl, 0); # else GC_free((GC_PTR)curr_dl); # endif @@ -416,18 +428,30 @@ finalization_mark_proc * mp; } new_fo = (struct finalizable_object *) GC_INTERNAL_MALLOC(sizeof(struct finalizable_object),NORMAL); - if (new_fo != 0) { - new_fo -> fo_hidden_base = (word)HIDE_POINTER(base); - new_fo -> fo_fn = fn; - new_fo -> fo_client_data = (ptr_t)cd; - new_fo -> fo_object_size = hhdr -> hb_sz; - new_fo -> fo_mark_proc = mp; - fo_set_next(new_fo, fo_head[index]); - GC_fo_entries++; - fo_head[index] = new_fo; - } else { - GC_finalization_failures++; + if (0 == new_fo) { +# ifdef THREADS + UNLOCK(); + ENABLE_SIGNALS(); +# endif + new_fo == GC_oom_fn(sizeof(struct finalizable_object)); + if (0 == new_fo) { + GC_finalization_failures++; + return; + } + /* It's not likely we'll make it here, but ... */ +# ifdef THREADS + DISABLE_SIGNALS(); + LOCK(); +# endif } + new_fo -> fo_hidden_base = (word)HIDE_POINTER(base); + new_fo -> fo_fn = fn; + new_fo -> fo_client_data = (ptr_t)cd; + new_fo -> fo_object_size = hhdr -> hb_sz; + new_fo -> fo_mark_proc = mp; + fo_set_next(new_fo, fo_head[index]); + GC_fo_entries++; + fo_head[index] = new_fo; # ifdef THREADS UNLOCK(); ENABLE_SIGNALS(); @@ -593,7 +617,7 @@ void GC_finalize() GC_words_finalized += ALIGNED_WORDS(curr_fo -> fo_object_size) + ALIGNED_WORDS(sizeof(struct finalizable_object)); - GC_ASSERT(GC_is_marked((ptr_t)curr_fo)); + GC_ASSERT(GC_is_marked(GC_base((ptr_t)curr_fo))); curr_fo = next_fo; } else { prev_fo = curr_fo; |