File tree Expand file tree Collapse file tree 3 files changed +14
-13
lines changed
SwiftKitCore/src/main/java/org/swift/swiftkit/core
SwiftKitFFM/src/main/java/org/swift/swiftkit/ffm Expand file tree Collapse file tree 3 files changed +14
-13
lines changed Original file line number Diff line number Diff line change 1717import java .util .concurrent .atomic .AtomicBoolean ;
1818
1919public abstract class JNISwiftInstance extends SwiftInstance {
20+ /// Pointer to the "self".
21+ private final long selfPointer ;
22+
23+ /**
24+ * The pointer to the instance in memory. I.e. the {@code self} of the Swift object or value.
25+ */
26+ public final long pointer () {
27+ return this .selfPointer ;
28+ }
29+
2030 /**
2131 * The designated constructor of any imported Swift types.
2232 *
2333 * @param pointer a pointer to the memory containing the value
2434 * @param arena the arena this object belongs to. When the arena goes out of scope, this value is destroyed.
2535 */
2636 protected JNISwiftInstance (long pointer , SwiftArena arena ) {
27- super (pointer , arena );
37+ super (arena );
38+ this .selfPointer = pointer ;
2839 }
2940
3041 /**
Original file line number Diff line number Diff line change 1717import java .util .concurrent .atomic .AtomicBoolean ;
1818
1919public abstract class SwiftInstance {
20- /// Pointer to the "self".
21- private final long selfPointer ;
22-
23- /**
24- * The pointer to the instance in memory. I.e. the {@code self} of the Swift object or value.
25- */
26- public final long pointer () {
27- return this .selfPointer ;
28- }
2920
3021 /**
3122 * Called when the arena has decided the value should be destroyed.
@@ -55,8 +46,7 @@ public final long pointer() {
5546 * @param pointer a pointer to the memory containing the value
5647 * @param arena the arena this object belongs to. When the arena goes out of scope, this value is destroyed.
5748 */
58- protected SwiftInstance (long pointer , SwiftArena arena ) {
59- this .selfPointer = pointer ;
49+ protected SwiftInstance (SwiftArena arena ) {
6050 arena .register (this );
6151 }
6252
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ public abstract class FFMSwiftInstance extends SwiftInstance {
4141 * @param arena the arena this object belongs to. When the arena goes out of scope, this value is destroyed.
4242 */
4343 protected FFMSwiftInstance (MemorySegment segment , AllocatingSwiftArena arena ) {
44- super (segment . address (), arena );
44+ super (arena );
4545 this .memorySegment = segment ;
4646 }
4747
You can’t perform that action at this time.
0 commit comments