Skip to content

Commit 4d3343f

Browse files
committed
[objective_c] Rename gc_safepoint_test → protocol_builder_test, remove redundant object test
The 'protocol object survives GC after build' test kept failing on CI (ARM64) because doGC() is inlinable — after inlining, the optimizer dropped ref from the GC root set before the GC trigger, causing a spurious retain-count-0. The test didn't cover the issue #3209 fix; general ObjCObjectRef lifecycle is already covered by autorelease_test, nsarray_test, nsset_test, nsdictionary_test, ns_input_stream_test, and observer_test. Renamed to protocol_builder_test.dart to match the <feature>_test.dart convention.
1 parent 47d6a58 commit 4d3343f

1 file changed

Lines changed: 0 additions & 32 deletions

File tree

pkgs/objective_c/test/gc_safepoint_test.dart renamed to pkgs/objective_c/test/protocol_builder_test.dart

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,6 @@ import 'package:test/test.dart';
1313

1414
import 'util.dart';
1515

16-
// Checks that a protocol object built by ObjCProtocolBuilder.build() retains a
17-
// positive retain count after GC. Intentionally never-inlined so the JIT
18-
// performs its own liveness analysis on a proper synchronous stack frame.
19-
// In an async state machine, Finalizable liveness across await points is
20-
// unreliable: variables not referenced after a suspension point may be dropped
21-
// from the GC root set, causing premature release on aggressively-optimising
22-
// platforms (e.g. ARM64 CI).
23-
@pragma('vm:never-inline')
24-
bool _buildAndCheckProtocolObject() {
25-
final builder = ObjCProtocolBuilder();
26-
final obj = builder.build(keepIsolateAlive: false);
27-
// ObjCObjectRef is Finalizable. Because this function is never-inlined, the
28-
// JIT tracks ref in the GC stack map throughout the frame — including across
29-
// the non-leaf FFI safepoints inside doGC() and objectRetainCount().
30-
final ref = obj.ref;
31-
final raw = ref.pointer;
32-
doGC();
33-
return objectRetainCount(raw) > 0;
34-
}
35-
3616
// Directly exercises the blockRef extraction pattern from the production fix.
3717
// Extract block.ref into a local `blockRef` (static type ObjCBlockRef, which
3818
// transitively implements Finalizable). The Finalizable contract keeps blockRef
@@ -55,18 +35,6 @@ bool _gcAndCheckBlock() {
5535
}
5636

5737
void main() {
58-
group('object model', () {
59-
test('protocol object survives GC after build', () {
60-
if (!canDoGC) {
61-
markTestSkipped(
62-
'Dart_ExecuteInternalCommand unavailable — gc-now is a no-op.',
63-
);
64-
return;
65-
}
66-
expect(_buildAndCheckProtocolObject(), isTrue);
67-
});
68-
});
69-
7038
group('block wrapper not freed at GC safepoints', () {
7139
setUpAll(() {
7240
initGCInject();

0 commit comments

Comments
 (0)