Skip to content

Conversation

asselyam
Copy link

In ObjectHandlesImpl all methods specific to weak handles (like createWeak, isWeak, and destroyWeak) were removed. It no longer knows the difference between a strong and a weak handle. Its only job is to store an object at a given index and retrieve it.

In JNIGlobalHandles the single ObjectHandlesImpl instance was replaced with two separate instances: strongGlobalHandles and weakGlobalHandles. The 64-bit global handle space was split into two distinct ranges (strong and weak) by using a bit flag (bit 62). Two new methods, encodeStrong and encodeWeak, were created to correctly place a handle's value into its designated range.

Removed HandleWeakReference and made ObjectHandlesImpl to be a storage class
In JNIGlobalHandles created 2 instances of ObjectHandlesImpl (one for strong and one for weak hadles). I divided the total global handels range into two halfs at bit 62. Bit 62 is 0 for strong global handles and 1 for weak global handles. Therefore a validation tag is redused from 32 bit to 31 bit
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 15, 2025
@asselyam
Copy link
Author

asselyam commented Oct 15, 2025

Hello Dr. @christianhaeubl, per our discussion, I've opened this PR with the strong/weak handle refactoring. I'd appreciate your review when you have a moment. Thank you!

@christianhaeubl christianhaeubl self-requested a review October 15, 2025 17:34
resolved some grammar mistakes and updated the split point in JNIGlobalHandles and replaced it from bit 62 to bit 30, because it did not fit in the global handles range
@oracle-contributor-agreement
Copy link

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement bot added OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. and removed OCA Verified All contributors have signed the Oracle Contributor Agreement. labels Oct 21, 2025
@asselyam asselyam force-pushed the fix-jniobjecthandles branch from 1c0319c to 29dee8d Compare October 21, 2025 21:38
@oracle-contributor-agreement
Copy link

Thank you for signing the OCA.

@oracle-contributor-agreement oracle-contributor-agreement bot added OCA Verified All contributors have signed the Oracle Contributor Agreement. and removed OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. labels Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant