RFR (M): 8184334: Generalizing Atomic with templates

Kim Barrett kim.barrett at oracle.com
Fri Jul 14 18:43:11 UTC 2017


> On Jul 14, 2017, at 12:28 PM, Erik Österlund <erik.osterlund at oracle.com> wrote:
> 
> Hi,
> 
> Bug:
> https://bugs.openjdk.java.net/browse/JDK-8184334
> 
> Webrev:
> http://cr.openjdk.java.net/~eosterlund/8184334/webrev.00/

A few small things I overlooked in our pre-review discussions.

------------------------------------------------------------------------------ 
src/share/vm/metaprogramming/integerTypes.hpp 
 225 template<typename T, typename U>
 226 struct IntegerTypes::Cast<T, U, true, true, false> VALUE_OBJ_CLASS_SPEC {
 227   T operator()(U x) const { return (T)((void*)x); }
 228 };

One of my pre-review comments seems to have been passed over here.

I don't think we need the void* cast at all.  And the rest of this
file consistently prefers C++ cast operators over C-style casts,
suggesting the cast to T should be performed using reinterpret_cast.

------------------------------------------------------------------------------ 
src/share/vm/runtime/atomic.hpp 
  29 #include "metaprogramming/conditional.hpp"
  30 #include "metaprogramming/enableIf.hpp"
...
  34 #include "metaprogramming/isSame.hpp"
  35 #include "metaprogramming/removePointer.hpp"

I think these are remnents of earlier versions of this code, and have
ended up not being used here after all.

------------------------------------------------------------------------------ 
src/os_cpu/linux_x86/vm/atomic_linux_x86.hpp 
 143   volatile jlong dest;

jlong => int64_t ?

------------------------------------------------------------------------------ 
src/os_cpu/linux_arm/vm/atomic_linux_arm.hpp
 150   jlong rv;
jlong => int64_t ?

 176   intptr_t val;
 192   intptr_t old_val;
intptr_t => int64_t ?

------------------------------------------------------------------------------ 
src/os_cpu/bsd_x86/vm/atomic_bsd_x86.hpp
 143   volatile jlong dest;
jlong => int64_t ?

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



More information about the hotspot-runtime-dev mailing list