Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(0.46.0) Skip zero-init, checks for some BigInteger methods #19603

Conversation

ymanton
Copy link
Member

@ymanton ymanton commented Jun 3, 2024

This patch recognizes the following BigInteger methods:

  • BigInteger.BigInteger(long): void
  • BigInteger.toByteArray(): byte[]
  • BigInteger.stripLeadingZeroBytes(byte[], int, int): int[]
  • BigInteger.stripLeadingZeroBytes(int, byte[], int, int): int[]

and skips array zero-initialization, NULL, and bounds checks in these methods.

Cherry-picked from #19556

@ymanton ymanton requested a review from vijaysun-omr June 3, 2024 14:15
@ymanton ymanton requested a review from dsouzai as a code owner June 3, 2024 14:15
@pshipton pshipton marked this pull request as draft June 3, 2024 14:35
@pshipton
Copy link
Member

pshipton commented Jun 3, 2024

The original change is causing failures in the IBM Java 8 builds, which needs to be resolved before this is added to 0.46.

@vijaysun-omr
Copy link
Contributor

Will wait until we get an update on the reported failure

This patch recognizes the following BigInteger methods:

* BigInteger.BigInteger(long): void
* BigInteger.toByteArray(): byte[]
* BigInteger.stripLeadingZeroBytes(byte[], int, int): int[]
* BigInteger.stripLeadingZeroBytes(int, byte[], int, int): int[]

and skips array zero-initialization, NULL, and bounds checks
in these methods.

Signed-off-by: Younes Manton <[email protected]>

Skip BigInteger zero-init & checks for OpenJ9 only

The BigInteger.toByteArray implementation in OpenJ9 doesn't depend
on zero-initialization and it is currently safe to skip that operation
in that context. The Apache Harmony BigInteger implementation relies
on zero-init and returns the wrong result without it. This patch limits
skipping of zero-init (and NULL and bounds checks, to be conservative)
for BigInteger.toByteArray to OpenJ9 builds.

Signed-off-by: Younes Manton <[email protected]>
@ymanton ymanton force-pushed the skip-zeroinit-checks-bigint-0.46 branch from dabec97 to b8655d4 Compare June 3, 2024 21:44
@pshipton pshipton marked this pull request as ready for review June 3, 2024 21:44
@pshipton
Copy link
Member

pshipton commented Jun 3, 2024

Since the fix doesn't affect OpenJ9 builds, I assume this can be merged as-is.

@ymanton
Copy link
Member Author

ymanton commented Jun 3, 2024

Yes, shouldn't affect OpenJ9, but I just happened to squash the fix on top just before your comment anyway.

@vijaysun-omr
Copy link
Contributor

Corresponding OpenJ9 head stream change is merged now since the relevant tests seem to be passing.

@vijaysun-omr vijaysun-omr merged commit d22a436 into eclipse-openj9:v0.46.0-release Jun 3, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants