Skip to content

Conversation

@stefank
Copy link
Owner

@stefank stefank commented Dec 18, 2025

In the lworld branch the new_flags type has been changed to u1 instead of int. We now perform a bunch of bit operations, which results in an int, and then we narrow that down into a u1. After the u1 has been created we check that this doesn't overflow a u1 with the checked_cast check. That's too late.

Mainline code looks like this:

int new_flags = ...
_flags = checked_cast<u1>(new_flags);

and Valhalla code looks like this:

u1 new_flags = ...
_flags = checked_cast<u1>(new_flags);

This voids the benefit of having a checked_cast here. I propose that we revert back to using int new_flags and keep the checked_cast.

While reading this code there were a few things that made the code harder to follow and I've tweaked it.

  1. The bool is_volatile_shift is special-treated and instead of shifting it is directly casted to int. That hard codes a knowledge/assumption that the flag is always going to be 1 (and maybe also what value bools have).

That made me have to look at the actual values of these and at one point I thought that is_volatile_shift was 1 and not 0 and that the above was a bug. The main reason I thought that was this odd order here:

   u1 new_flags = ((is_final_flag ? 1 : 0) << is_final_shift) | static_cast<int>(is_volatile_flag) |
      ((is_flat_flag ? 1 : 0) << is_flat_shift) |
      ((is_null_free_inline_type_flag ? 1 : 0) << is_null_free_inline_type_shift) |
      ((has_null_marker_flag ? 1 : 0) << has_null_marker_shift);

Here the order of usage is

is_final_flag
is_volatile_flag
is_flat_flag
is_null_free_inline_type_flag
has_null_marker_flag

but the enum order has final and volatile swapped:

is_volatile_shift
is_final_shift
is_flat_shift
is_null_free_inline_type_shift
has_null_marker_shift

I'd prefer if we stayed consistent with the order, to lower the risk that some bugs sneak in here. So, I've replaced the cast with a shift (just like the other values are handled) and I ordered functions, parameters, and operations in the same order as the enums.

  1. Tweaked some alignments to make these kind of issues clearer.

Please tell me if I went to far with the style changes.

jaikiran and others added 30 commits November 29, 2025 01:25
…configured with a higher idle timeout

Reviewed-by: dfuchs
Reviewed-by: alanb, rriggs
…ssDeniedException

Reviewed-by: sgehwolf, shade
Reviewed-by: serb, azvegint, prr
…tructions

Reviewed-by: sviswanathan, dlunden, vlivanov, qamai
…etaspace.java fail after recent improvements

Reviewed-by: stuefe, azeller, lucy
…va timed out during warmup

Reviewed-by: djelinski
…it fails when the directory already exists

Reviewed-by: alanb, jpai
… cause AES-GCM encryption failure for certain payload sizes

Co-authored-by: Thomas Holenstein <tholenst@google.com>
Co-authored-by: Lukas Zobernig <zlukas@google.com>
Reviewed-by: shade, sviswanathan
… after JDK-8371667

Reviewed-by: wkemper, kdnilsen, ysr
…ore is_init_completed

Reviewed-by: ayang, sjohanss, eosterlund
…e is_init_completed

Reviewed-by: ayang, sjohanss, eosterlund
…ble constraint

Reviewed-by: mdoerr, stefank, tschatzl, sjohanss
…ngQuicPacket subclasses

Reviewed-by: jpai, dfuchs
david-beaumont and others added 27 commits December 16, 2025 21:11
Reviewed-by: coleenp, stefank, dcubed
Reviewed-by: stefank, phubner
…strict instance fields

Reviewed-by: mcimadamore
Reviewed-by: coleenp, fparain
Merge jdk-27+1
Merge jdk-27+2
8373828: [lworld] Test CheckExamples fails since jimage change

Reviewed-by: rriggs
…ava fails with --enable-preview

Reviewed-by: iklam
…h --enable-preview

8373596: [lworld] Various CDS crashes due to assert(_heap_load_mode != HeapArchiveMode::_uninitialized) failed: not initialized yet
8372743: [lworld] jdk/internal/misc/CDS/ArchivedEnumTest.java fails with --enable-preview
8372607: [lworld] runtime/cds/SharedStringsDedup.java fails with --enable-preview
8372606: [lworld] runtime/cds/SharedStringsRunAuto.java fails with --enable-preview
8372265: [lworld] HelloInlineClassApp "Static field rectangle not as expected"
8371456: [lworld] ResolvedConstants.java fails since jdk-26+22

Reviewed-by: coleenp
@stefank stefank changed the base branch from lworld_8374007_symbol_dead_code to lworld December 19, 2025 12:26
@stefank
Copy link
Owner Author

stefank commented Dec 19, 2025

This was supposed to go to openjdk/valhalla/lworld not stefank/valhalla/lworld

@stefank stefank closed this Dec 19, 2025
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.