Re[10]: [Gc]: garbage collection on OSX Snow Leopard

Ivan Maidanski ivmai at mail.ru
Tue Oct 20 14:59:59 PDT 2009


Hi!
"Boehm, Hans" <hans.boehm at hp.com> wrote:
> > OpenBSD keeps its own port of the garbage collector (v7.1) 
> > with fixes that apparently have not been accepted upstream.
> > 
> I don't recall a submission of those patches, though it's conceivable they were lost.  If you have a contact, could you suggest they (re)submit a patch?  If they maintain their own that's clearly fine, but seems to involve extra overhead.
> 
> Thanks.
> 
> Hans

I've just "ported" OpenBSD gc7.0 port: http://www.openbsd.org/cgi-bin/cvsweb/ports/devel/boehm-gc/patches/

In major, I've did the following changes:

1. I haven't added include/private/openbsd_stop_world_h and openbsd_stop_world_c to GC tree - instead, I've added the OpenBSD-specific code to pthread_stop_world.h and pthread_stop_world.c (so, no code is duplicated);

2. I haven't add this code to pthread_support.c:

@@ -1103,6 +1106,12 @@ void * GC_start_routine(void * arg)
         GC_enable();
 #     endif
       return GC_inner_start_routine(&sb, arg);
+#   elif defined(GC_OPENBSD_THREADS)
+      /* On OpenBSD GC_get_stack_base() doesn't cause any allocations */
+      struct GC_stack_base sb;
+      if (GC_get_stack_base(&sb) != GC_SUCCESS)
+	ABORT("Failed to get thread stack base.");
+      return GC_inner_start_routine(&sb, arg);
 #   else
       return GC_call_with_stack_base(GC_inner_start_routine, arg);
 #   endif

It seems the authors doesn't fully understand why GC_call_with_stack_base() is used here.

No testing has been done (on my side).

Hans -
what's about legacy/copyright issue? (The code I've just checked in is based (~90%) on 3rd party code.)

Bye.


More information about the Gc mailing list