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 {
|
|
|
|
|
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;
int32_t retain_count; /* int32_t because atomic ops use int32_t */
};
/* 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;
}
- (uint32_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;
}
- (int32_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;
}
+ (uint32_t)retainCount
{
return UINT32_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;
}
+ (int32_t)retainCount
{
return INT32_MAX;
}
+ (void)release
{
}
+ (void)dealloc
|