[PATCH resend] 8152856: Use (~0u) instead of (-1) when left-shifting
Gerard Ziemski
gerard.ziemski at oracle.com
Tue May 24 20:29:19 UTC 2016
hi Alex,
Thank you for the patch.
I know it’s a bit of a hassle, but could you please file a new issue to cover your proposed fix and why you want it in?
cheers
> On May 24, 2016, at 1:27 PM, Alex Henrie <alexhenrie24 at gmail.com> wrote:
>
> # HG changeset patch
> # User ahenrie
> # Date 1463507859 21600
> # Tue May 17 11:57:39 2016 -0600
> # Node ID b7b02a758a39c9dab702c3b14c773fd601951384
> # Parent d2e2a5306fed8dd9bce3d81e8fe15cf465eabb05
> 8152856: Use (~0u) instead of (-1) when left-shifting
>
> diff --git a/src/share/vm/code/dependencies.hpp b/src/share/vm/code/dependencies.hpp
> --- a/src/share/vm/code/dependencies.hpp
> +++ b/src/share/vm/code/dependencies.hpp
> @@ -163,17 +163,17 @@ class Dependencies: public ResourceObj {
> call_site_target_value,
>
> TYPE_LIMIT
> };
> enum {
> 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,
>
> non_ctxk_types = (1 << evol_method) | (1 << call_site_target_value),
> implicit_ctxk_types = 0,
> explicit_ctxk_types = all_types & ~(non_ctxk_types | implicit_ctxk_types),
>
> diff --git a/src/share/vm/oops/cpCache.hpp b/src/share/vm/oops/cpCache.hpp
> --- a/src/share/vm/oops/cpCache.hpp
> +++ b/src/share/vm/oops/cpCache.hpp
> @@ -188,17 +188,17 @@ class ConstantPoolCacheEntry VALUE_OBJ_C
> is_final_shift = 22, // (f) is the field or method final?
> is_volatile_shift = 21, // (v) is the field volatile?
> is_vfinal_shift = 20, // (vf) did the call resolve to a final method?
> // low order bits give field index (for FieldInfo) or method parameter size:
> field_index_bits = 16,
> 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:
> enum {
> cp_index_bits = 2*BitsPerByte,
> cp_index_mask = right_n_bits(cp_index_bits),
> bytecode_1_shift = cp_index_bits,
> bytecode_1_mask = right_n_bits(BitsPerByte), // == (u1)0xFF
More information about the hotspot-dev
mailing list