Commit 060bda7
Avoid redundant Java GC bridge graph computation (dotnet#131764)
On Android the GC bridge hands a set of cross references to the client
on every collection that finds at least one dead Java peer. The client
answers each of those with an explicit ART collection, and while that
runs the UI thread blocks creating JNI global references, which shows up
as dropped frames.
This skips the SCC computation when it is known to be discarded. The VM
already frees the `MarkCrossReferencesArgs` without forwarding them when
the client is still processing a previous set, so the Tarjan pass and
the allocations feeding it were pure waste. The GC can now ask the
client first via the new `IGCToCLR::IsClientBridgeProcessingActive`, and
skips the work instead. This is behavior neutral: every registered
bridge object is promoted whether or not the cross references were
computed, so skipping only delays reporting a dead peer, it never
collects one early.
Adding a method to `IGCToCLR` is a breaking interface change, so
`EE_INTERFACE_MAJOR_VERSION` goes from 4 to 5.
Part of the investigation in dotnet#131370.
Scoped down from the original version of this PR at @BrzVlad's request —
the timing heuristic that was bundled here has been removed and is not
part of this change.
### Validation
Built `clr` clean (0 errors, 0 warnings) for:
- `android-arm64` Release — the configuration where
`FEATURE_JAVAMARSHAL` is on by default
- `osx-arm64` Checked — non-Android, `FEATURE_JAVAMARSHAL` also on,
covers the interface plumbing outside Android
`gcbridge.cpp` was confirmed compiled into both the CoreCLR VM and the
NativeAOT workstation/server GC objects. The standalone GC sample under
`src/coreclr/gc/sample` is not part of either build and was not
compiled.
> [!NOTE]
> Portions of this pull request description were generated with GitHub
Copilot.
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 91dd8b98-73db-41b0-8d8c-9e1c21b53f5f1 parent 0e3a635 commit 060bda7
13 files changed
Lines changed: 86 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1111 | 1111 | | |
1112 | 1112 | | |
1113 | 1113 | | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
1114 | 1121 | | |
1115 | 1122 | | |
1116 | 1123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
84 | 95 | | |
85 | 96 | | |
86 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
467 | 467 | | |
468 | 468 | | |
469 | 469 | | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
470 | 478 | | |
471 | 479 | | |
472 | 480 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1535 | 1535 | | |
1536 | 1536 | | |
1537 | 1537 | | |
1538 | | - | |
1539 | | - | |
1540 | | - | |
| 1538 | + | |
1541 | 1539 | | |
1542 | | - | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
1543 | 1546 | | |
1544 | 1547 | | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
1545 | 1551 | | |
1546 | 1552 | | |
1547 | 1553 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
171 | 176 | | |
172 | 177 | | |
173 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
826 | 826 | | |
827 | 827 | | |
828 | 828 | | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
829 | 838 | | |
0 commit comments