Skip to content

Serialize CoreFoundation's preprocessing of J2ObjC exceptions. - #2904

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_1009192652
Open

copybara-service[bot] wants to merge 1 commit into
masterfrom
test_1009192652

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Serialize CoreFoundation's preprocessing of J2ObjC exceptions.

The first throw of an NSException runs CoreFoundation's exception preprocessor, which fills in the exception's call stacks without synchronization, so concurrent first throws of a shared Java exception can crash. With --define=j2objc_exception_preprocessing=1, J2ObjC now installs its exception preprocessor when the runtime is loaded, directly in front of CoreFoundation's, and runs CoreFoundation's preprocessor for Java exceptions while holding a lock picked by the exception's address. JavaLangThrowable leaves J2ObjC's frame out of the call stacks that it returns. Preprocessors installed later, such as crash reporters', run before J2ObjC's. Nothing runs when an exception is created anymore.

The first throw of an NSException runs CoreFoundation's exception preprocessor, which fills in the exception's call stacks without synchronization, so concurrent first throws of a shared Java exception can crash. With --define=j2objc_exception_preprocessing=1, J2ObjC now installs its exception preprocessor when the runtime is loaded, directly in front of CoreFoundation's, and runs CoreFoundation's preprocessor for Java exceptions while holding a lock picked by the exception's address. JavaLangThrowable leaves J2ObjC's frame out of the call stacks that it returns. Preprocessors installed later, such as crash reporters', run before J2ObjC's. Nothing runs when an exception is created anymore.

PiperOrigin-RevId: 1009192652

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant