File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -418,15 +418,28 @@ final class MethodImportTests {
418418 * }
419419 */
420420 public MySwiftClass(long len, long cap) {
421+ this(/*arena=*/null, len, cap);
422+ }
423+ /**
424+ * Create an instance of {@code MySwiftClass}.
425+ * This instance is managed by the passed in {@link SwiftArena} and may not outlive the arena's lifetime.
426+ *
427+ * {@snippet lang=swift :
428+ * public init(len: Swift.Int, cap: Swift.Int)
429+ * }
430+ */
431+ public MySwiftClass(SwiftArena arena, long len, long cap) {
421432 var mh$ = init_len_cap.HANDLE;
422433 try {
423- if (TRACE_DOWNCALLS) {
424- traceDowncall(len, cap);
425- }
426-
427- this.selfMemorySegment = (MemorySegment) mh$.invokeExact(len, cap, TYPE_METADATA);
434+ if (TRACE_DOWNCALLS) {
435+ traceDowncall(len, cap);
436+ }
437+ this.selfMemorySegment = (MemorySegment) mh$.invokeExact(len, cap, TYPE_METADATA.$memorySegment());
438+ if (arena != null) {
439+ arena.register(this);
440+ }
428441 } catch (Throwable ex$) {
429- throw new AssertionError( \ "should not reach here \ ", ex$);
442+ throw new AssertionError( " should not reach here " , ex$);
430443 }
431444 }
432445 """
You can’t perform that action at this time.
0 commit comments