8157758: JDK9 does not compile on Linux with GCC 6.1 because left-shifting a negative number has undefined behavior

Replace shifts of -1 with shifts of ~0u.

Reviewed-by: kbarrett, mockner
This commit is contained in:
Alex Henrie 2016-06-23 16:46:41 -04:00 committed by Kim Barrett
parent dd9f85e74d
commit 4abb5e4aaf
2 changed files with 2 additions and 2 deletions

View File

@ -168,7 +168,7 @@ class Dependencies: public ResourceObj {
LG2_TYPE_LIMIT = 4, // assert(TYPE_LIMIT <= (1<<LG2_TYPE_LIMIT))
// handy categorizations of dependency types:
all_types = ((1 << TYPE_LIMIT) - 1) & ((-1) << FIRST_TYPE),
all_types = ((1 << TYPE_LIMIT) - 1) & ((~0u) << FIRST_TYPE),
non_klass_types = (1 << call_site_target_value),
klass_types = all_types & ~non_klass_types,

View File

@ -193,7 +193,7 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
field_index_mask = right_n_bits(field_index_bits),
parameter_size_bits = 8, // subset of field_index_mask, range is 0..255
parameter_size_mask = right_n_bits(parameter_size_bits),
option_bits_mask = ~(((-1) << tos_state_shift) | (field_index_mask | parameter_size_mask))
option_bits_mask = ~(((~0u) << tos_state_shift) | (field_index_mask | parameter_size_mask))
};
// specific bit definitions for the indices field: