Skip to content

Avoid global JNI ref copies in FabricUIManager lookups - #59617

Merged
meta-codesync[bot] merged 1 commit into
react:mainfrom
javache:export-D128203842
Oct 30, 2026
Merged

meta-codesync[bot] merged 1 commit into
react:mainfrom
javache:export-D128203842

Conversation

@javache

@javache javache commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Summary:
Keep a stable owning global JNI reference in the context container and expose a borrowed alias under the existing FabricUIManager key. Use alias reads for synchronous Android Fabric measurement, colour resolution and image prefetching, avoiding global-reference allocation and release on each lookup.

Add instrumentation coverage for exact alias/owner handle identity, mixed legacy global-ref and alias readers, and legacy-copy validity after the aliased handle owner is released. Stale global-ref readers still depend on the current fbjni wrapper representation; these tests exercise that compatibility, not a type-safe C++ guarantee.

Changelog: [Internal]

Differential Revision: D128203842

Summary:
Keep a stable owning global JNI reference in the context container and expose a borrowed alias under the existing `FabricUIManager` key. Use alias reads for synchronous Android Fabric measurement, colour resolution and image prefetching, avoiding global-reference allocation and release on each lookup.

Add instrumentation coverage for exact alias/owner handle identity, mixed legacy global-ref and alias readers, and legacy-copy validity after the aliased handle owner is released. Stale global-ref readers still depend on the current fbjni wrapper representation; these tests exercise that compatibility, not a type-safe C++ guarantee.

Changelog: [Internal]

Differential Revision: D128203842
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 29, 2026
@meta-codesync

meta-codesync Bot commented Oct 29, 2026

Copy link
Copy Markdown

@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D128203842.

@christophpurrer christophpurrer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

@meta-codesync
meta-codesync Bot merged commit 97f6997 into react:main Oct 30, 2026
110 of 112 checks passed
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @javache in 97f6997

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants