Skip to content

Commit 4db6a22

Browse files
author
Your Name
committed
* added new types NSUIntegerAtomic and NSIntegerAtomic to facilitate @Property code
* experimental and *untested* `MulleProxy` class added * added NSAutoreleasePool debugging facility to dump contents into CSV format for postprocessing with sqlite or scripts * method `-[NSThread mulleDetach]` no longer exists! * new NSThread methods `-mulleInitWithObjectFunction:object:` for convenient ownership transfer even when using C functions * improved the teardown code of NSThread and improved the detached case * added various `Instance` functions, where previously `Object` was used exlusively to properly differentiate Class and Instance code * improved and simplified tracing with `MULLE_OBJC_TRACE_ZOMBIE` and `MULLE_OBJC_TRACE_LEAK`, which eliminates the need to use he finer grained variables a lot of times * added `MulleObjCObjectIsInstance` and a host of other introspection functions dealing with Class and Instance distinctions
1 parent ad0f259 commit 4db6a22

File tree

104 files changed

+3881
-391
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+3881
-391
lines changed

.idea/misc.xml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 45 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required( VERSION 3.18) # 3.15 fails on windows
22

3-
project( MulleObjC VERSION 0.24.0 LANGUAGES C)
3+
project( MulleObjC VERSION 0.25.0 LANGUAGES C)
44

55

66
if( "${CMAKE_BUILD_TYPE}" STREQUAL "Release")

RELEASENOTES.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## 0.25.0
2+
3+
* added new types `NSUIntegerAtomic` and `NSIntegerAtomic` to facilitate @property code
4+
* experimental and *untested* `MulleProxy` class added
5+
* added NSAutoreleasePool debugging facility to dump contents into CSV format for postprocessing with sqlite or scripts
6+
* method `-[NSThread mulleDetach]` no longer exists!
7+
* new NSThread methods `-mulleInitWithObjectFunction:object:` for convenient ownership transfer even when using C functions
8+
* improved the teardown code of NSThread and improved the detached case
9+
* added various `Instance` functions, where previously `Object` was used exlusively to properly differentiate Class and Instance code
10+
* improved and simplified tracing with ``MULLE_OBJC_TRACE_ZOMBIE`` and ``MULLE_OBJC_TRACE_LEAK`,` which eliminates the need to use he finer grained variables a lot of times
11+
* added `MulleObjCObjectIsInstance` and a host of other introspection functions dealing with Class and Instance distinctions
12+
13+
114
## 0.24.0
215

316

cmake/reflect/_Headers.cmake

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmake/reflect/_Sources.cmake

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/MulleObjCIntegralType.h

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,163 @@ static inline char *_NSComparisonResultUTF8String( NSComparisonResult result)
2828
}
2929

3030

31+
32+
union _NSUIntegerAtomic
33+
{
34+
NSUInteger value; // dont read, except when debugging
35+
mulle_atomic_pointer_t pointer;
36+
};
37+
38+
typedef union _NSUIntegerAtomic NSUIntegerAtomic;
39+
40+
41+
// ivarType:
42+
// _C_ASSIGN_ID for an ivar/property that is assign only (its a bug don't do this)
43+
// _C_COPY_ID for an ivar/property that stores a copy
44+
// _C_RETAIN_ID the default ivar stores the value retained
45+
//
46+
47+
48+
static inline NSUInteger NSUIntegerAtomicGet( NSUIntegerAtomic *ivar)
49+
{
50+
NSUInteger value;
51+
52+
value = (NSUInteger) _mulle_atomic_pointer_read( &ivar->pointer);
53+
return( value);
54+
}
55+
56+
57+
static inline NSUInteger NSUIntegerAtomicUpdate( NSUIntegerAtomic *ivar,
58+
NSUInteger value)
59+
60+
{
61+
NSUInteger old;
62+
63+
for(;;)
64+
{
65+
old = (NSUInteger) _mulle_atomic_pointer_read( &ivar->pointer);
66+
67+
// can't cas with same value
68+
if( old == value)
69+
return( old);
70+
71+
if( _mulle_atomic_pointer_cas( &ivar->pointer, (void *) value, (void *) old))
72+
{
73+
return( old);
74+
}
75+
}
76+
}
77+
78+
79+
static inline NSUInteger NSUIntegerAtomicMaskedOr( NSUIntegerAtomic *ivar,
80+
NSUInteger mask,
81+
NSUInteger bits)
82+
83+
{
84+
NSUInteger old;
85+
NSUInteger value;
86+
87+
for(;;)
88+
{
89+
old = (NSUInteger) _mulle_atomic_pointer_read( &ivar->pointer);
90+
value = (old & mask) | bits;
91+
92+
// can't cas with same value
93+
if( old == value)
94+
return( old);
95+
96+
if( _mulle_atomic_pointer_cas( &ivar->pointer, (void *) value, (void *) old))
97+
{
98+
return( old);
99+
}
100+
}
101+
}
102+
103+
static inline NSUInteger NSUIntegerAtomicOr( NSUIntegerAtomic *ivar,
104+
NSUInteger bits)
105+
106+
{
107+
NSUInteger old;
108+
NSUInteger value;
109+
110+
for(;;)
111+
{
112+
old = (NSUInteger) _mulle_atomic_pointer_read( &ivar->pointer);
113+
value = old | bits;
114+
115+
// can't cas with same value
116+
if( old == value)
117+
return( old);
118+
119+
if( _mulle_atomic_pointer_cas( &ivar->pointer, (void *) value, (void *) old))
120+
{
121+
return( old);
122+
}
123+
}
124+
}
125+
126+
127+
128+
static inline void NSUIntegerAtomicSet( NSUIntegerAtomic *ivar,
129+
NSUInteger value)
130+
{
131+
(void) NSUIntegerAtomicUpdate( ivar, value);
132+
}
133+
134+
135+
136+
union _NSIntegerAtomic
137+
{
138+
NSInteger value; // dont read, except when debugging
139+
mulle_atomic_pointer_t pointer;
140+
};
141+
142+
typedef union _NSIntegerAtomic NSIntegerAtomic;
143+
144+
145+
// ivarType:
146+
// _C_ASSIGN_ID for an ivar/property that is assign only (its a bug don't do this)
147+
// _C_COPY_ID for an ivar/property that stores a copy
148+
// _C_RETAIN_ID the default ivar stores the value retained
149+
//
150+
151+
152+
static inline NSInteger NSIntegerAtomicGet( NSIntegerAtomic *ivar)
153+
{
154+
NSInteger value;
155+
156+
value = (NSInteger) _mulle_atomic_pointer_read( &ivar->pointer);
157+
return( value);
158+
}
159+
160+
161+
static inline NSInteger NSIntegerAtomicUpdate( NSIntegerAtomic *ivar,
162+
NSInteger value)
163+
164+
{
165+
NSInteger old;
166+
167+
for(;;)
168+
{
169+
old = (NSInteger) _mulle_atomic_pointer_read( &ivar->pointer);
170+
171+
// can't cas with same value
172+
if( old == value)
173+
return( old);
174+
175+
if( _mulle_atomic_pointer_cas( &ivar->pointer, (void *) value, (void *) old))
176+
{
177+
return( old);
178+
}
179+
}
180+
}
181+
182+
183+
static inline void NSIntegerAtomicSet( NSIntegerAtomic *ivar,
184+
NSInteger value)
185+
{
186+
(void) NSIntegerAtomicUpdate( ivar, value);
187+
}
188+
189+
31190
#endif /* ns_int_type_h */

src/MulleObjCVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#define MulleObjC_version__h__
4242

4343

44-
#define MULLE_OBJC_VERSION ((0UL << 20) | (24 << 8) | 0)
44+
#define MULLE_OBJC_VERSION ((0UL << 20) | (25 << 8) | 0)
4545

4646
#endif
4747

src/class/MulleDynamicObject.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#import "MulleDynamicObject.h"
3737

3838
#import "MulleObjCProtocol.h"
39+
#import "MulleObjCFunctions.h"
3940

4041
#import "import-private.h"
4142
#include <ctype.h>
@@ -1949,7 +1950,7 @@ - (id) mutableCopy
19491950
MulleDynamicObject *copy;
19501951
unsigned int n;
19511952

1952-
copy = [MulleObjCObjectGetClass( self) new];
1953+
copy = [MulleObjCInstanceGetClass( self) new];
19531954

19541955
// wipe possibly copied ivars
19551956
n = mulle__pointermap_get_count( &self->__ivars);

src/class/MulleObjCAutoreleasePool.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ void _mulle_objc_poolconfiguration_done( struct _mulle_objc_poolconfiguration
9999

100100
// for NSThread
101101
MULLE_OBJC_GLOBAL
102-
void mulle_objc_thread_new_poolconfiguration( struct _mulle_objc_universe *universe);
102+
struct _mulle_objc_poolconfiguration *
103+
mulle_objc_thread_new_poolconfiguration( struct _mulle_objc_universe *universe);
103104

104105
MULLE_OBJC_GLOBAL
105106
void mulle_objc_thread_reset_poolconfiguration( struct _mulle_objc_universe *universe);

0 commit comments

Comments
 (0)