ObjFW  Check-in [3c5eb0ddb6]

Overview
Comment:Cache OFAutoreleasePool class.

This improves performance with the GNU runtime, where looking up a class
is quite expensive.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3c5eb0ddb64ed2c3e44f68ffc42408ce0f6cc05062b98c5ce1971590eaa14397
User & Date: js on 2010-07-08 09:44:44
Other Links: manifest | tags
Context
2010-07-08
10:04
Clean up method replacing. check-in: fdcb2a71e4 user: js tags: trunk
09:44
Cache OFAutoreleasePool class. check-in: 3c5eb0ddb6 user: js tags: trunk
09:20
Optimize OFAutoreleasePool. check-in: f92e1c77a0 user: js tags: trunk
Changes

Modified src/OFObject.m from [1881ae5509] to [85afaae721].

64
65
66
67
68
69
70

71
72
73
74
75
76
77
/* Hopefully no arch needs more than 16 bytes padding */
#define PRE_IVAR_ALIGN ((sizeof(struct pre_ivar) + 15) & ~15)
#define PRE_IVAR ((struct pre_ivar*)((char*)self - PRE_IVAR_ALIGN))

static struct {
	Class isa;
} alloc_failed_exception;


size_t of_pagesize;

#ifdef NEED_OBJC_SYNC_INIT
extern BOOL objc_sync_init();
#endif








>







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* Hopefully no arch needs more than 16 bytes padding */
#define PRE_IVAR_ALIGN ((sizeof(struct pre_ivar) + 15) & ~15)
#define PRE_IVAR ((struct pre_ivar*)((char*)self - PRE_IVAR_ALIGN))

static struct {
	Class isa;
} alloc_failed_exception;
static Class autoreleasepool = Nil;

size_t of_pagesize;

#ifdef NEED_OBJC_SYNC_INIT
extern BOOL objc_sync_init();
#endif

123
124
125
126
127
128
129

130
131
132
133
134
135
136
	GetSystemInfo(&si);
	of_pagesize = si.dwPageSize;
#endif
}

+ (void)initialize
{

}

+ alloc
{
	OFObject *instance;
	size_t isize = class_getInstanceSize(self);








>







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
	GetSystemInfo(&si);
	of_pagesize = si.dwPageSize;
#endif
}

+ (void)initialize
{
	autoreleasepool = [OFAutoreleasePool class];
}

+ alloc
{
	OFObject *instance;
	size_t isize = class_getInstanceSize(self);

607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
	if (!c)
		[self dealloc];
#endif
}

- autorelease
{
	[OFAutoreleasePool addObjectToTopmostPool: self];

	return self;
}

- (void)dealloc
{
	void **iter = PRE_IVAR->memchunks + PRE_IVAR->memchunks_size;







|







609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
	if (!c)
		[self dealloc];
#endif
}

- autorelease
{
	[autoreleasepool addObjectToTopmostPool: self];

	return self;
}

- (void)dealloc
{
	void **iter = PRE_IVAR->memchunks + PRE_IVAR->memchunks_size;