Skip to content

Fix signedness error of max LOS size in C2 (backport #348)#350

Merged
wks merged 2 commits intojdk-11from
mergify/bp/jdk-11/pr-348
Mar 23, 2026
Merged

Fix signedness error of max LOS size in C2 (backport #348)#350
wks merged 2 commits intojdk-11from
mergify/bp/jdk-11/pr-348

Conversation

@mergify
Copy link
Copy Markdown

@mergify mergify Bot commented Mar 23, 2026

The PlanConstraints::max_non_los_default_alloc_bytes constant is a usize and can be usize::MAX for some plans including NoGC. The C2 code erroneously considered it signed and did signed comparison against object sizes. Consequently, when allocating dynamically sized arrays, the C2-generated code always goes to the slow path. It slows down certain workloads (such as hsqldb and luindex in DaCapo 2006) by 20% in total time.

We fix this bug by always performing 64-bit unsigned comparison.


This is an automatic backport of pull request #348 done by Mergify.

The `PlanConstraints::max_non_los_default_alloc_bytes` constant is a
`usize` and can be `usize::MAX` for some plans including NoGC. The C2
code erroneously considered it signed and did signed comparison against
object sizes. Consequently, when allocating dynamically sized arrays,
the C2-generated code always goes to the slow path. It slows down
certain workloads (such as hsqldb and luindex in DaCapo 2006) by 20% in
total time.

We fix this bug by always performing 64-bit unsigned comparison.

(cherry picked from commit e6dcac0)

# Conflicts:
#	mmtk/Cargo.lock
@mergify
Copy link
Copy Markdown
Author

mergify Bot commented Mar 23, 2026

Cherry-pick of e6dcac0 has failed:

On branch mergify/bp/jdk-11/pr-348
Your branch is up to date with 'origin/jdk-11'.

You are currently cherry-picking commit e6dcac0.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   mmtk/Cargo.toml
	modified:   openjdk/mmtkBarrierSetC2.cpp

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   mmtk/Cargo.lock

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@wks wks merged commit 8a733dd into jdk-11 Mar 23, 2026
54 of 57 checks passed
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.

2 participants