From ba4e623f5e656a12059590e5d83be2a45dccf38d Mon Sep 17 00:00:00 2001 From: rfm Date: Tue, 13 Jan 2009 20:52:49 +0000 Subject: [PATCH] Set some ivars (delegates which should not be retained) to be gc invisible. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27591 72102866-910b-0410-8b05-ffd578937521 --- Source/GSStream.m | 12 ++++++++++++ Source/NSConnection.m | 1 + Source/NSKeyedArchiver.m | 2 ++ Source/NSKeyedUnarchiver.m | 2 ++ Source/NSPort.m | 2 ++ Source/NSXMLParser.m | 6 ++++++ configure | 4 ++-- configure.ac | 2 +- 8 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Source/GSStream.m b/Source/GSStream.m index 7b7406b09..bea1c7c3c 100644 --- a/Source/GSStream.m +++ b/Source/GSStream.m @@ -143,6 +143,11 @@ static RunLoopEventType typeForStream(NSStream *aStream) @implementation GSStream ++ (void) initialize +{ + class_ivar_set_gcinvisible (self, "delegate", YES); +} + - (void) close { if (_currentStatus == NSStreamStatusNotOpen) @@ -626,6 +631,7 @@ static RunLoopEventType typeForStream(NSStream *aStream) if (self == [GSInputStream class]) { GSObjCAddClassBehavior(self, [GSStream class]); + class_ivar_set_gcinvisible (self, "delegate", YES); } } @@ -658,6 +664,7 @@ static RunLoopEventType typeForStream(NSStream *aStream) if (self == [GSOutputStream class]) { GSObjCAddClassBehavior(self, [GSStream class]); + class_ivar_set_gcinvisible (self, "delegate", YES); } } @@ -929,6 +936,11 @@ static RunLoopEventType typeForStream(NSStream *aStream) @implementation GSServerStream ++ (void) initialize +{ + class_ivar_set_gcinvisible (self, "delegate", YES); +} + + (id) serverStreamToAddr: (NSString*)addr port: (int)port { GSServerStream *s; diff --git a/Source/NSConnection.m b/Source/NSConnection.m index 6387b717f..735e514fe 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -545,6 +545,7 @@ static NSLock *cached_proxies_gate = nil; { NSNotificationCenter *nc; + class_ivar_set_gcinvisible (self, "delegate", YES); connectionClass = self; dateClass = [NSDate class]; distantObjectClass = [NSDistantObject class]; diff --git a/Source/NSKeyedArchiver.m b/Source/NSKeyedArchiver.m index 196ab6763..a87ee3dc8 100644 --- a/Source/NSKeyedArchiver.m +++ b/Source/NSKeyedArchiver.m @@ -464,6 +464,8 @@ static NSDictionary *makeReference(unsigned ref) + (void) initialize { + class_ivar_set_gcinvisible (self, "delegate", YES); + if (globalClassMap == 0) { globalClassMap = diff --git a/Source/NSKeyedUnarchiver.m b/Source/NSKeyedUnarchiver.m index c4a8da419..5340475a4 100644 --- a/Source/NSKeyedUnarchiver.m +++ b/Source/NSKeyedUnarchiver.m @@ -274,6 +274,8 @@ static NSMapTable globalClassMap = 0; + (void) initialize { + class_ivar_set_gcinvisible (self, "delegate", YES); + if (globalClassMap == 0) { globalClassMap = diff --git a/Source/NSPort.m b/Source/NSPort.m index 16d588bd1..4f4e7443f 100644 --- a/Source/NSPort.m +++ b/Source/NSPort.m @@ -81,6 +81,8 @@ static Class NSPort_concrete_class; { NSUserDefaults *defs; + class_ivar_set_gcinvisible (self, "delegate", YES); + NSPort_abstract_class = self; NSPort_concrete_class = [NSMessagePort class]; diff --git a/Source/NSXMLParser.m b/Source/NSXMLParser.m index e65e572a1..7b43a04f0 100644 --- a/Source/NSXMLParser.m +++ b/Source/NSXMLParser.m @@ -66,6 +66,12 @@ static NSNull *null = nil; @implementation NSXMLSAXHandler ++ (void) initialize +{ + class_ivar_set_gcinvisible (self, "_delegate", YES); + class_ivar_set_gcinvisible (self, "_owner", YES); +} + - (void) dealloc { DESTROY(_namespaces); diff --git a/configure b/configure index fbdf055b7..4a3abfa08 100755 --- a/configure +++ b/configure @@ -3673,8 +3673,8 @@ cat >>confdefs.h <<\_ACEOF _ACEOF else - { echo "$as_me:$LINENO: It looks like your libgc is quite old ... please use a newer one to support making the garbage collector aware of new threads." >&5 -echo "$as_me: It looks like your libgc is quite old ... please use a newer one to support making the garbage collector aware of new threads." >&6;} + { echo "$as_me:$LINENO: It looks like your libgc is quite old ... please consider using a newer one to support making the garbage collector aware of new threads. You can get libgc source from http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc-source/ but NB. the libgc used must be compatible with the version of the objective-c runtime library that you are using." >&5 +echo "$as_me: It looks like your libgc is quite old ... please consider using a newer one to support making the garbage collector aware of new threads. You can get libgc source from http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc-source/ but NB. the libgc used must be compatible with the version of the objective-c runtime library that you are using." >&6;} fi LIBS="-lobjc_gc -ldl" echo "$as_me:$LINENO: checking for class_ivar_set_gcinvisible" >&5 diff --git a/configure.ac b/configure.ac index f499a55fb..f2a1f551f 100644 --- a/configure.ac +++ b/configure.ac @@ -277,7 +277,7 @@ if test $OBJC_WITH_GC = yes; then AC_DEFINE(HAVE_GC_REGISTER_MY_THREAD,1, [Define if GC_register_my_thread function is available]) else - AC_MSG_NOTICE([It looks like your libgc is quite old ... please use a newer one to support making the garbage collector aware of new threads.]) + AC_MSG_NOTICE([It looks like your libgc is quite old ... please consider using a newer one to support making the garbage collector aware of new threads. You can get libgc source from http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc-source/ but NB. the libgc used must be compatible with the version of the objective-c runtime library that you are using.]) fi LIBS="-lobjc_gc -ldl" AC_CHECK_FUNC(class_ivar_set_gcinvisible, gc_ok=yes, gc_ok=no)