ObjFW  Check-in [831ebcd4f5]

Overview
Comment:Make retain counter 32 bit due to atomic ops being 32 bit.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 831ebcd4f501c6710b6c74e621fe2b49e70411d891c1fc05dd8f55c392a4419c
User & Date: js on 2010-01-25 15:22:53
Other Links: manifest | tags
Context
2010-01-25
22:14
Check for atomic ops in configure.ac. check-in: c2af363418 user: js tags: trunk
15:22
Make retain counter 32 bit due to atomic ops being 32 bit. check-in: 831ebcd4f5 user: js tags: trunk
2010-01-24
20:07
Fix a missing return in objc_setProperty. check-in: 63c5c7d501 user: js tags: trunk
Changes

Modified src/OFConstString.m from [d9b21f0f8e] to [69a22d8f6f].

134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
}

- autorelease
{
	return self;
}

- (size_t)retainCount
{
	return SIZE_MAX;
}

- (void)release
{
}

- (void)dealloc







|

|







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
}

- autorelease
{
	return self;
}

- (uint32_t)retainCount
{
	return UINT32_MAX;
}

- (void)release
{
}

- (void)dealloc

Modified src/OFFile.m from [cfa00f6d8b] to [5dcf811aa9].

255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
	return self;
}

- (void)release
{
}

- (size_t)retainCount
{
	return SIZE_MAX;
}

- (void)dealloc
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
	[super dealloc];	/* Get rid of stupid warning */







|

|







255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
	return self;
}

- (void)release
{
}

- (uint32_t)retainCount
{
	return UINT32_MAX;
}

- (void)dealloc
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
	[super dealloc];	/* Get rid of stupid warning */

Modified src/OFObject.h from [9367c723f3] to [b10aa6cbcf].

262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
 * object deallocated if it reaches 0.
 */
- retain;

/**
 * \return The retain count
 */
- (size_t)retainCount;

/**
 * Decreases the retain count.
 *
 * Each time an object is released, the retain count gets decreased and the
 * object deallocated if it reaches 0.
 */







|







262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
 * object deallocated if it reaches 0.
 */
- retain;

/**
 * \return The retain count
 */
- (uint32_t)retainCount;

/**
 * Decreases the retain count.
 *
 * Each time an object is released, the retain count gets decreased and the
 * object deallocated if it reaches 0.
 */

Modified src/OFObject.m from [1a2c0cda4c] to [490f2fcff3].

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifdef OF_GNU_RUNTIME
# import <objc/sarray.h>
#endif

#import "atomic.h"

struct pre_ivar {
	void   **memchunks;
	size_t memchunks_size;
	size_t retain_count;
};

/* 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 {







|
|
|







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifdef OF_GNU_RUNTIME
# import <objc/sarray.h>
#endif

#import "atomic.h"

struct pre_ivar {
	void	 **memchunks;
	size_t	 memchunks_size;
	uint32_t retain_count;	/* uint32_t because we use 32 bit atomic ops */
};

/* 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 {
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
- retain
{
	of_atomic_inc32(&PRE_IVAR->retain_count);

	return self;
}

- (size_t)retainCount
{
	return PRE_IVAR->retain_count;
}

- (void)release
{
	if (!of_atomic_dec32(&PRE_IVAR->retain_count))







|







476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
- retain
{
	of_atomic_inc32(&PRE_IVAR->retain_count);

	return self;
}

- (uint32_t)retainCount
{
	return PRE_IVAR->retain_count;
}

- (void)release
{
	if (!of_atomic_dec32(&PRE_IVAR->retain_count))
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
}

+ autorelease
{
	return self;
}

+ (size_t)retainCount
{
	return SIZE_MAX;
}

+ (void)release
{
}

+ (void)dealloc







|

|







580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
}

+ autorelease
{
	return self;
}

+ (uint32_t)retainCount
{
	return UINT32_MAX;
}

+ (void)release
{
}

+ (void)dealloc