@@ -81,29 +81,31 @@ static MemorySegment findOrThrow(String symbol) {
81
81
// ==== ------------------------------------------------------------------------------------------------------------
82
82
// free
83
83
84
- /**
85
- * Descriptor for the free C runtime function.
86
- */
87
- public static final FunctionDescriptor free$descriptor = FunctionDescriptor .ofVoid (
88
- ValueLayout .ADDRESS
89
- );
84
+ static abstract class free {
85
+ /**
86
+ * Descriptor for the free C runtime function.
87
+ */
88
+ public static final FunctionDescriptor DESC = FunctionDescriptor .ofVoid (
89
+ ValueLayout .ADDRESS
90
+ );
90
91
91
- /**
92
- * Address of the free C runtime function.
93
- */
94
- public static final MemorySegment free$addr = findOrThrow ("free" );
92
+ /**
93
+ * Address of the free C runtime function.
94
+ */
95
+ public static final MemorySegment ADDR = findOrThrow ("free" );
95
96
96
- /**
97
- * Handle for the free C runtime function.
98
- */
99
- public static final MethodHandle free$handle = Linker .nativeLinker ().downcallHandle (free$addr , free$descriptor );
97
+ /**
98
+ * Handle for the free C runtime function.
99
+ */
100
+ public static final MethodHandle HANDLE = Linker .nativeLinker ().downcallHandle (ADDR , DESC );
101
+ }
100
102
101
103
/**
102
104
* free the given pointer
103
105
*/
104
106
public static void cFree (MemorySegment pointer ) {
105
107
try {
106
- free$handle .invokeExact (pointer );
108
+ free . HANDLE .invokeExact (pointer );
107
109
} catch (Throwable ex$ ) {
108
110
throw new AssertionError ("should not reach here" , ex$ );
109
111
}
@@ -137,7 +139,7 @@ public static long retainCount(MemorySegment object) {
137
139
}
138
140
139
141
public static long retainCount (SwiftHeapObject object ) {
140
- return retainCount (object .$self ());
142
+ return retainCount (object .$memorySegment ());
141
143
}
142
144
143
145
// ==== ------------------------------------------------------------------------------------------------------------
@@ -167,7 +169,7 @@ public static void retain(MemorySegment object) {
167
169
}
168
170
169
171
public static long retain (SwiftHeapObject object ) {
170
- return retainCount (object .$self ());
172
+ return retainCount (object .$memorySegment ());
171
173
}
172
174
173
175
// ==== ------------------------------------------------------------------------------------------------------------
@@ -197,7 +199,7 @@ public static void release(MemorySegment object) {
197
199
}
198
200
199
201
public static long release (SwiftHeapObject object ) {
200
- return retainCount (object .$self ());
202
+ return retainCount (object .$memorySegment ());
201
203
}
202
204
203
205
// ==== ------------------------------------------------------------------------------------------------------------
0 commit comments