OSDN Git Service

* testsuite/27_io/istream_seeks.cc: Inform DejaGnu of required files.
[pf3gnuchains/gcc-fork.git] / boehm-gc / finalize.c
index 2ee927f..7ff6798 100644 (file)
@@ -324,6 +324,7 @@ finalization_mark_proc * mp;
     struct finalizable_object * curr_fo, * prev_fo;
     int index;
     struct finalizable_object *new_fo;
+    hdr *hhdr;
     DCL_LOCK_STATE;
 
 #   ifdef THREADS
@@ -402,6 +403,19 @@ finalization_mark_proc * mp;
 #      endif
         return;
     }
+    GET_HDR(base, hhdr);
+    if (0 == hhdr) {
+      /* We won't collect it, hence finalizer wouldn't be run. */
+      /* This is changed for gcj, but it will be in version 6.0 of the */
+      /* standard collector distribution.  It costs virtually nothing  */
+      /* here, but it's expensive to check in the hash synchronization */
+      /* code, where it matters.               -HB                     */
+#     ifdef THREADS
+          UNLOCK();
+         ENABLE_SIGNALS();
+#     endif
+      return;
+    }
 #   ifdef THREADS
       new_fo = (struct finalizable_object *)
        GC_generic_malloc_inner(sizeof(struct finalizable_object),NORMAL);
@@ -413,7 +427,7 @@ finalization_mark_proc * mp;
         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 = GC_size(base);
+       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++;
@@ -619,7 +633,7 @@ void GC_finalize()
 void GC_enqueue_all_finalizers()
 {
     struct finalizable_object * curr_fo, * prev_fo, * next_fo;
-    ptr_t real_ptr, real_link;
+    ptr_t real_ptr;
     register int i;
     int fo_size;
     
@@ -694,6 +708,14 @@ GC_API void GC_finalize_all()
 }
 #endif
 
+/* Returns true if it is worth calling GC_invoke_finalizers. (Useful if        */
+/* finalizers can only be called from some kind of `safe state' and    */
+/* getting into that safe state is expensive.)                         */
+int GC_should_invoke_finalizers GC_PROTO((void))
+{
+    return GC_finalize_now != 0;
+}
+
 /* Invoke finalizers for all objects that are ready to be finalized.   */
 /* Should be called without allocation lock.                           */
 int GC_invoke_finalizers()