More GC updates

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4958 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-09-29 14:13:52 +00:00
parent 18f87db0c7
commit 78e6f68250
5 changed files with 125 additions and 2 deletions

View file

@ -272,6 +272,9 @@ NSExtraRefCount (id anObject)
*/
#if GS_WITH_GC
#include <gc.h>
#include <gc_typed.h>
inline NSZone *
fastZone(NSObject *object)
{
@ -294,8 +297,26 @@ NSAllocateObject(Class aClass, unsigned extraBytes, NSZone *zone)
id new = nil;
int size = aClass->instance_size + extraBytes;
if (CLS_ISCLASS(aClass))
new = NSZoneMalloc(zone, size);
NSCAssert((CLS_ISCLASS(aClass)), @"Bad class for new object");
if (zone == GSAtomicMallocZone())
{
new = NSZoneMalloc(zone, size);
}
else
{
GC_descr gc_type = aClass->gc_object_type;
if (gc_type == 0)
{
new = NSZoneMalloc(zone, size);
NSLog(@"No garbage collection information for '%s'", aClass->name);
}
else
{
new = GC_CALLOC_EXPLICTLY_TYPED(1, size, gc_type);
}
}
if (new != nil)
{
memset(new, 0, size);