Integrated: 8370077: C2: make Compile::_major_progress a boolean

Marc Chevalier mchevalier at openjdk.org
Fri Oct 31 11:05:39 UTC 2025


On Tue, 21 Oct 2025 08:07:15 GMT, Marc Chevalier <mchevalier at openjdk.org> wrote:

> Simply change `Compile::_major_progress` from `int` to `bool` since we are only checking if it's non-zero.
> 
> There is one detail, we used to have
> 
> void          restore_major_progress(int progress) { _major_progress += progress; }
> 
> 
> It is used after some verification code (maybe not only?) that may reset the major progress, using the progress saved before the said code.
> 
> It has a weird semantics:
> 
> Progress before | Progress after verification | Progress after restore | What would be the assignment semantics
> ----------------|-----------------------------|-----------------------|-
> 0               | 0                           | 0 | 0
> 1               | 0                           | 1 | 1
> 0               | 1                           | 1 | 0 (mismatch!)
> 1               | 1                           | 2 | 1 (same truthiness)
> 
> It is rather a or than a restore, and a proper boolean version of that would be
> 
> void restore_major_progress(bool progress) { _major_progress = _major_progress || progress; }
> 
> but then, I'd argue the name is confusing. It also doesn't fit so well the idea that we just want to be back to the situation before the verification code. I suspect the unsaid assumption, is that the 3rd line (progress clear before, set by verification) is not possible. Anyway, I've tried with this or-semantics, or with a more natural
> 
> void set_major_progress(bool progress) { _major_progress = progress; }
> 
> that actually restore what we saved. Both pass (tier1-6 + some internal tests). Thus, I prefered the simpler semantics.
> 
> Thanks,
> Marc

This pull request has now been integrated.

Changeset: 8ca485cf
Author:    Marc Chevalier <mchevalier at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/8ca485cf98889d1757170a4ec883c93c888a7140
Stats:     17 lines in 2 files changed: 10 ins; 1 del; 6 mod

8370077: C2: make Compile::_major_progress a boolean

Reviewed-by: chagedorn, kvn, dlong, epeter

-------------

PR: https://git.openjdk.org/jdk/pull/27912


More information about the hotspot-compiler-dev mailing list