]> granicus.if.org Git - gc/commitdiff
2009-12-08 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Tue, 8 Dec 2009 10:31:50 +0000 (10:31 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:52 +0000 (21:06 +0400)
* darwin_stop_world.c (GC_push_all_stacks): Fix a bug (call
GC_push_all_stack() instead of GC_push_all_stack_frames()).
* include/private/gc_priv.h (GC_push_all_stack_frames,
GC_push_all_register_frames): Rename to
GC_push_all_stack_sections and GC_push_all_register_sections,
respectively.
* mark_rts.c (GC_push_all_stack_frames,
GC_push_all_register_frames, GC_push_all_stack_part_eager_frames,
GC_push_current_stack): Ditto.
* pthread_stop_world.c (GC_push_all_stacks): Ditto.
* win32_threads.c (GC_push_stack_for): Ditto.
* misc.c (GC_call_with_gc_active): Rename "frame" local variable
to "stacksect".
* pthread_support.c (GC_call_with_gc_active): Ditto.
* win32_threads.c (GC_call_with_gc_active): Ditto.
* pthread_support.c (GC_call_with_gc_active): Update FIXME for
Darwin.
* win32_threads.c (GC_Thread_Rep): Update the comment for
traced_stack_sect.

ChangeLog
darwin_stop_world.c
include/private/gc_priv.h
mark_rts.c
misc.c
pthread_stop_world.c
pthread_support.c
win32_threads.c

index 799adb116578d9cb6f61a0c951d48fe09fc342c5..0e70cdeaa8cbc53b70809e0f5bda6f50465b25cc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2009-12-08  Ivan Maidanski <ivmai@mail.ru>
+
+       * darwin_stop_world.c (GC_push_all_stacks): Fix a bug (call
+       GC_push_all_stack() instead of GC_push_all_stack_frames()).
+       * include/private/gc_priv.h (GC_push_all_stack_frames,
+       GC_push_all_register_frames): Rename to
+       GC_push_all_stack_sections and GC_push_all_register_sections,
+       respectively.
+       * mark_rts.c (GC_push_all_stack_frames,
+       GC_push_all_register_frames, GC_push_all_stack_part_eager_frames,
+       GC_push_current_stack): Ditto.
+       * pthread_stop_world.c (GC_push_all_stacks): Ditto.
+       * win32_threads.c (GC_push_stack_for): Ditto.
+       * misc.c (GC_call_with_gc_active): Rename "frame" local variable
+       to "stacksect".
+       * pthread_support.c (GC_call_with_gc_active): Ditto.
+       * win32_threads.c (GC_call_with_gc_active): Ditto.
+       * pthread_support.c (GC_call_with_gc_active): Update FIXME for
+       Darwin.
+       * win32_threads.c (GC_Thread_Rep): Update the comment for
+       traced_stack_sect.
+
 2009-12-08  Ivan Maidanski <ivmai@mail.ru> (really mostly Hans Boehm)
 
        * darwin_stop_world.c (GC_push_all_stacks): Rename
index 3b4acb09e1dbeebf65e3ca36fcc32036c24fe543..224a78952bbcd31a62754ee2c10efa3de26c0c56 100644 (file)
@@ -177,7 +177,10 @@ GC_INNER void GC_push_all_stacks(void)
         GC_printf("Darwin: Stack for thread 0x%lx = [%p,%p)\n",
                   (unsigned long) p -> id, lo, hi);
 #     endif
-      GC_push_all_stack_frames(lo, hi, p -> traced_stack_sect);
+      /* FIXME: It is impossible to use GC_push_all_stack_sections()    */
+      /* here while GC_do_blocking_inner() and GC_call_with_gc_active() */
+      /* contain unimplemented code for Darwin.                         */
+      GC_push_all_stack(lo, hi);
       total_size += hi - lo; /* lo <= hi */
     } /* for(p=GC_threads[i]...) */
   } /* for(i=0;i<THREAD_TABLE_SZ...) */
@@ -403,7 +406,7 @@ GC_INNER void GC_push_all_stacks(void)
         GC_printf("Darwin: Stack for thread 0x%lx = [%p,%p)\n",
                   (unsigned long) thread, lo, hi);
 #     endif
-      /* FIXME: use GC_push_all_stack_frames. */
+      /* FIXME: use GC_push_all_stack_sections. */
       GC_push_all_stack(lo, hi);
       mach_port_deallocate(my_task, thread);
       total_size += hi - lo; /* lo <= hi */
index 2feff843232ff18c38af4edc2f495e628998e5eb..339a931fcf92925bf3b5f484ac2d5921413055fd 100644 (file)
@@ -1332,7 +1332,7 @@ struct blocking_data {
     void * client_data; /* and result */
 };
 
-/* This is used by GC_call_with_gc_active(), GC_push_all_stack_frames(). */
+/* This is used by GC_call_with_gc_active(), GC_push_all_stack_sections(). */
 struct GC_traced_stack_sect_s {
   ptr_t saved_stack_ptr;
 #ifdef IA64
@@ -1345,7 +1345,7 @@ struct GC_traced_stack_sect_s {
 #ifdef THREADS
 /* Process all "traced stack sections" - scan entire stack except for   */
 /* frames belonging to the user functions invoked by GC_do_blocking().  */
-  GC_INNER void GC_push_all_stack_frames(ptr_t lo, ptr_t hi,
+  GC_INNER void GC_push_all_stack_sections(ptr_t lo, ptr_t hi,
                         struct GC_traced_stack_sect_s *traced_stack_sect);
   GC_EXTERN word GC_total_stacksize; /* updated on every push_all_stacks */
 #else
@@ -1357,8 +1357,8 @@ struct GC_traced_stack_sect_s {
 #endif /* !THREADS */
 
 #ifdef IA64
-  /* Similar to GC_push_all_stack_frames() but for IA-64 registers store. */
-  GC_INNER void GC_push_all_register_frames(ptr_t bs_lo, ptr_t bs_hi,
+  /* Similar to GC_push_all_stack_sections() but for IA-64 registers store. */
+  GC_INNER void GC_push_all_register_sections(ptr_t bs_lo, ptr_t bs_hi,
                   int eager, struct GC_traced_stack_sect_s *traced_stack_sect);
 #endif
 
index 779d54259128dc42371b1cb0ca4249962933861b..377be443f6a418081ebee4b6d45f83b01dce6ccf 100644 (file)
@@ -479,8 +479,8 @@ STATIC void GC_push_conditional_with_exclusions(ptr_t bottom, ptr_t top,
 }
 
 #ifdef IA64
-  /* Similar to GC_push_all_stack_frames() but for IA-64 registers store. */
-  GC_INNER void GC_push_all_register_frames(ptr_t bs_lo, ptr_t bs_hi,
+  /* Similar to GC_push_all_stack_sections() but for IA-64 registers store. */
+  GC_INNER void GC_push_all_register_sections(ptr_t bs_lo, ptr_t bs_hi,
                   int eager, struct GC_traced_stack_sect_s *traced_stack_sect)
   {
     while (traced_stack_sect != NULL) {
@@ -505,7 +505,7 @@ STATIC void GC_push_conditional_with_exclusions(ptr_t bottom, ptr_t top,
 
 #ifdef THREADS
 
-GC_INNER void GC_push_all_stack_frames(ptr_t lo, ptr_t hi,
+GC_INNER void GC_push_all_stack_sections(ptr_t lo, ptr_t hi,
                         struct GC_traced_stack_sect_s *traced_stack_sect)
 {
     while (traced_stack_sect != NULL) {
@@ -577,8 +577,8 @@ STATIC void GC_push_all_stack_partially_eager(ptr_t bottom, ptr_t top,
 # endif
 }
 
-/* Similar to GC_push_all_stack_frames() but also uses cold_gc_frame.   */
-STATIC void GC_push_all_stack_part_eager_frames(ptr_t lo, ptr_t hi,
+/* Similar to GC_push_all_stack_sections() but also uses cold_gc_frame. */
+STATIC void GC_push_all_stack_part_eager_sections(ptr_t lo, ptr_t hi,
         ptr_t cold_gc_frame, struct GC_traced_stack_sect_s *traced_stack_sect)
 {
     GC_ASSERT(traced_stack_sect == NULL || cold_gc_frame == NULL ||
@@ -639,7 +639,7 @@ STATIC void GC_push_current_stack(ptr_t cold_gc_frame, void * context)
           GC_push_all_eager(cold_gc_frame, GC_approx_sp());
 #       endif
 #   else
-        GC_push_all_stack_part_eager_frames(GC_approx_sp(), GC_stackbottom,
+        GC_push_all_stack_part_eager_sections(GC_approx_sp(), GC_stackbottom,
                                         cold_gc_frame, GC_traced_stack_sect);
 #       ifdef IA64
               /* We also need to push the register stack backing store. */
@@ -658,11 +658,11 @@ STATIC void GC_push_current_stack(ptr_t cold_gc_frame, void * context)
                                 GC_traced_stack_sect->backing_store_end)
                     cold_gc_bs_pointer =
                                 GC_traced_stack_sect->backing_store_end;
-                  GC_push_all_register_frames(BACKING_STORE_BASE,
+                  GC_push_all_register_sections(BACKING_STORE_BASE,
                         cold_gc_bs_pointer, FALSE, GC_traced_stack_sect);
                   GC_push_all_eager(cold_gc_bs_pointer, bsp);
                 } else {
-                  GC_push_all_register_frames(BACKING_STORE_BASE, bsp,
+                  GC_push_all_register_sections(BACKING_STORE_BASE, bsp,
                                 TRUE /* eager */, GC_traced_stack_sect);
                 }
                 /* All values should be sufficiently aligned that we    */
diff --git a/misc.c b/misc.c
index 1c8d00aed6493774dea6bb84db6227f705ce5cfd..7fa5899562096e2363de3edf26add5d4f31cdd56 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -1487,43 +1487,43 @@ GC_INNER struct GC_traced_stack_sect_s *GC_traced_stack_sect = NULL;
 GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn,
                                              void * client_data)
 {
-    struct GC_traced_stack_sect_s frame;
+    struct GC_traced_stack_sect_s stacksect;
     GC_ASSERT(GC_is_initialized);
 
     /* Adjust our stack base value (this could happen if        */
     /* GC_get_main_stack_base() is unimplemented or broken for  */
     /* the platform).                                           */
-    if (GC_stackbottom HOTTER_THAN (ptr_t)(&frame))
-      GC_stackbottom = (ptr_t)(&frame);
+    if (GC_stackbottom HOTTER_THAN (ptr_t)(&stacksect))
+      GC_stackbottom = (ptr_t)(&stacksect);
 
     if (GC_blocked_sp == NULL) {
       /* We are not inside GC_do_blocking() - do nothing more.  */
       return fn(client_data);
     }
 
-    /* Setup new "frame".       */
-    frame.saved_stack_ptr = GC_blocked_sp;
+    /* Setup new "stack section".       */
+    stacksect.saved_stack_ptr = GC_blocked_sp;
 #   ifdef IA64
       /* This is the same as in GC_call_with_stack_base().      */
-      frame.backing_store_end = GC_save_regs_in_stack();
+      stacksect.backing_store_end = GC_save_regs_in_stack();
       /* Unnecessarily flushes register stack,          */
       /* but that probably doesn't hurt.                */
-      frame.saved_backing_store_ptr = GC_blocked_register_sp;
+      stacksect.saved_backing_store_ptr = GC_blocked_register_sp;
 #   endif
-    frame.prev = GC_traced_stack_sect;
+    stacksect.prev = GC_traced_stack_sect;
     GC_blocked_sp = NULL;
-    GC_traced_stack_sect = &frame;
+    GC_traced_stack_sect = &stacksect;
 
     client_data = fn(client_data);
     GC_ASSERT(GC_blocked_sp == NULL);
-    GC_ASSERT(GC_traced_stack_sect == &frame);
+    GC_ASSERT(GC_traced_stack_sect == &stacksect);
 
-    /* Restore original "frame".        */
-    GC_traced_stack_sect = frame.prev;
+    /* Restore original "stack section".        */
+    GC_traced_stack_sect = stacksect.prev;
 #   ifdef IA64
-      GC_blocked_register_sp = frame.saved_backing_store_ptr;
+      GC_blocked_register_sp = stacksect.saved_backing_store_ptr;
 #   endif
-    GC_blocked_sp = frame.saved_stack_ptr;
+    GC_blocked_sp = stacksect.saved_stack_ptr;
 
     return client_data; /* result */
 }
index cde37124bd5fcac27780ed6cb4a04c763566ee0b..cf9b8237554960c427be1535f2e87937a8df15d5 100644 (file)
@@ -325,7 +325,7 @@ GC_INNER void GC_push_all_stacks(void)
                     (unsigned)(p -> id), lo, hi);
 #       endif
         if (0 == lo) ABORT("GC_push_all_stacks: sp not set!");
-        GC_push_all_stack_frames(lo, hi, p -> traced_stack_sect);
+        GC_push_all_stack_sections(lo, hi, p -> traced_stack_sect);
 #       ifdef STACK_GROWS_UP
           total_size += lo - hi;
 #       else
@@ -338,8 +338,9 @@ GC_INNER void GC_push_all_stacks(void)
 #         endif
           /* FIXME:  This (if p->id==me) may add an unbounded number of */
           /* entries, and hence overflow the mark stack, which is bad.  */
-          GC_push_all_register_frames(bs_lo, bs_hi, THREAD_EQUAL(p -> id, me),
-                                      p -> traced_stack_sect);
+          GC_push_all_register_sections(bs_lo, bs_hi,
+                                        THREAD_EQUAL(p -> id, me),
+                                        p -> traced_stack_sect);
           total_size += bs_hi - bs_lo; /* bs_lo <= bs_hi */
 #       endif
       }
index 741806fd95028c3596b2a5ce8bbd216c31509700..bb95e19423d2c5ea4e9da67b3e58ce73b237cb8e 100644 (file)
@@ -963,7 +963,7 @@ GC_INNER void GC_do_blocking_inner(ptr_t data, void * context)
 GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn,
                                              void * client_data)
 {
-    struct GC_traced_stack_sect_s frame;
+    struct GC_traced_stack_sect_s stacksect;
     GC_thread me;
     LOCK();   /* This will block if the world is stopped.       */
     me = GC_lookup_thread(pthread_self());
@@ -972,12 +972,12 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn,
     /* GC_get_stack_base() was used which returned GC_SUCCESS). */
     if ((me -> flags & MAIN_THREAD) == 0) {
       GC_ASSERT(me -> stack_end != NULL);
-      if (me -> stack_end HOTTER_THAN (ptr_t)(&frame))
-        me -> stack_end = (ptr_t)(&frame);
+      if (me -> stack_end HOTTER_THAN (ptr_t)(&stacksect))
+        me -> stack_end = (ptr_t)(&stacksect);
     } else {
       /* The original stack. */
-      if (GC_stackbottom HOTTER_THAN (ptr_t)(&frame))
-        GC_stackbottom = (ptr_t)(&frame);
+      if (GC_stackbottom HOTTER_THAN (ptr_t)(&stacksect))
+        GC_stackbottom = (ptr_t)(&stacksect);
     }
 
     if (me -> thread_blocked == FALSE) {
@@ -986,37 +986,37 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn,
       return fn(client_data);
     }
 
-    /* Setup new "frame".       */
+    /* Setup new "stack section".       */
 #   ifdef GC_DARWIN_THREADS
-      /* FIXME: Implement it for Darwin ("frames" are ignored at present). */
+      /* FIXME: Implement it (and GC_do_blocking_inner) for Darwin. */
 #   else
-      frame.saved_stack_ptr = me -> stop_info.stack_ptr;
+      stacksect.saved_stack_ptr = me -> stop_info.stack_ptr;
 #   endif
 #   ifdef IA64
       /* This is the same as in GC_call_with_stack_base().      */
-      frame.backing_store_end = GC_save_regs_in_stack();
+      stacksect.backing_store_end = GC_save_regs_in_stack();
       /* Unnecessarily flushes register stack,          */
       /* but that probably doesn't hurt.                */
-      frame.saved_backing_store_ptr = me -> backing_store_ptr;
+      stacksect.saved_backing_store_ptr = me -> backing_store_ptr;
 #   endif
-    frame.prev = me -> traced_stack_sect;
+    stacksect.prev = me -> traced_stack_sect;
     me -> thread_blocked = FALSE;
-    me -> traced_stack_sect = &frame;
+    me -> traced_stack_sect = &stacksect;
 
     UNLOCK();
     client_data = fn(client_data);
     GC_ASSERT(me -> thread_blocked == FALSE);
-    GC_ASSERT(me -> traced_stack_sect == &frame);
+    GC_ASSERT(me -> traced_stack_sect == &stacksect);
 
-    /* Restore original "frame".        */
+    /* Restore original "stack section".        */
     LOCK();
-    me -> traced_stack_sect = frame.prev;
+    me -> traced_stack_sect = stacksect.prev;
 #   ifdef IA64
-      me -> backing_store_ptr = frame.saved_backing_store_ptr;
+      me -> backing_store_ptr = stacksect.saved_backing_store_ptr;
 #   endif
     me -> thread_blocked = TRUE;
 #   ifndef GC_DARWIN_THREADS
-      me -> stop_info.stack_ptr = frame.saved_stack_ptr;
+      me -> stop_info.stack_ptr = stacksect.saved_stack_ptr;
 #   endif
     UNLOCK();
 
index bd988c3aa5b2813e55c5dbce633f404346498850..82d1d539f1f9f94f0e12522d75531385d43dd247 100644 (file)
@@ -219,9 +219,10 @@ struct GC_Thread_Rep {
                                 /* not need to stop this thread.        */
 
   struct GC_traced_stack_sect_s *traced_stack_sect;
-                        /* Points to the "frame" data held in stack by  */
-                        /* the innermost GC_call_with_gc_active() of    */
-                        /* this thread.  May be NULL.                   */
+                                /* Points to the "stack section" data   */
+                                /* held in stack by the innermost       */
+                                /* GC_call_with_gc_active() of this     */
+                                /* thread.  May be NULL.                */
 
   unsigned finalizer_nested;
   unsigned finalizer_skipped;   /* Used by GC_check_finalizer_nested()  */
@@ -776,7 +777,7 @@ GC_INNER void GC_do_blocking_inner(ptr_t data, void * context)
 GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn,
                                              void * client_data)
 {
-  struct GC_traced_stack_sect_s frame;
+  struct GC_traced_stack_sect_s stacksect;
   GC_thread me;
   LOCK();   /* This will block if the world is stopped.         */
   me = GC_lookup_thread_inner(GetCurrentThreadId());
@@ -784,8 +785,8 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn,
   /* Adjust our stack base value (this could happen unless      */
   /* GC_get_stack_base() was used which returned GC_SUCCESS).   */
   GC_ASSERT(me -> stack_base != NULL);
-  if (me -> stack_base < (ptr_t)(&frame))
-    me -> stack_base = (ptr_t)(&frame);
+  if (me -> stack_base < (ptr_t)(&stacksect))
+    me -> stack_base = (ptr_t)(&stacksect);
 
   if (me -> thread_blocked_sp == NULL) {
     /* We are not inside GC_do_blocking() - do nothing more.    */
@@ -793,31 +794,31 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn,
     return fn(client_data);
   }
 
-  /* Setup new "frame".       */
-  frame.saved_stack_ptr = me -> thread_blocked_sp;
+  /* Setup new "stack section". */
+  stacksect.saved_stack_ptr = me -> thread_blocked_sp;
 # ifdef IA64
     /* This is the same as in GC_call_with_stack_base().        */
-    frame.backing_store_end = GC_save_regs_in_stack();
+    stacksect.backing_store_end = GC_save_regs_in_stack();
     /* Unnecessarily flushes register stack,    */
     /* but that probably doesn't hurt.          */
-    frame.saved_backing_store_ptr = me -> backing_store_ptr;
+    stacksect.saved_backing_store_ptr = me -> backing_store_ptr;
 # endif
-  frame.prev = me -> traced_stack_sect;
+  stacksect.prev = me -> traced_stack_sect;
   me -> thread_blocked_sp = NULL;
-  me -> traced_stack_sect = &frame;
+  me -> traced_stack_sect = &stacksect;
 
   UNLOCK();
   client_data = fn(client_data);
   GC_ASSERT(me -> thread_blocked_sp == NULL);
-  GC_ASSERT(me -> traced_stack_sect == &frame);
+  GC_ASSERT(me -> traced_stack_sect == &stacksect);
 
-  /* Restore original "frame".  */
+  /* Restore original "stack section".  */
   LOCK();
-  me -> traced_stack_sect = frame.prev;
+  me -> traced_stack_sect = stacksect.prev;
 # ifdef IA64
-    me -> backing_store_ptr = frame.saved_backing_store_ptr;
+    me -> backing_store_ptr = stacksect.saved_backing_store_ptr;
 # endif
-  me -> thread_blocked_sp = frame.saved_stack_ptr;
+  me -> thread_blocked_sp = stacksect.saved_stack_ptr;
   UNLOCK();
 
   return client_data; /* result */
@@ -1257,7 +1258,7 @@ STATIC word GC_push_stack_for(GC_thread thread, DWORD me)
       GC_printf("Pushing stack for 0x%x from sp %p to %p from 0x%x\n",
                 (int)thread -> id, sp, thread -> stack_base, (int)me);
 #   endif
-    GC_push_all_stack_frames(sp, thread->stack_base, traced_stack_sect);
+    GC_push_all_stack_sections(sp, thread->stack_base, traced_stack_sect);
   } else {
     /* If not current thread then it is possible for sp to point to     */
     /* the guarded (untouched yet) page just below the current          */