< prev index next >

src/hotspot/share/oops/access.inline.hpp

Print this page
rev 49275 : [mq]: JDK-8199781.patch

@@ -212,10 +212,17 @@
     static oop access_barrier(oop obj) {
       return GCBarrierType::resolve(obj);
     }
   };
 
+  template <class GCBarrierType, DecoratorSet decorators>
+  struct PostRuntimeDispatch<GCBarrierType, BARRIER_EQUALS, decorators>: public AllStatic {
+    static bool access_barrier(oop o1, oop o2) {
+      return GCBarrierType::equals(o1, o2);
+    }
+  };
+
   // Resolving accessors with barriers from the barrier set happens in two steps.
   // 1. Expand paths with runtime-decorators, e.g. is UseCompressedOops on or off.
   // 2. Expand paths for each BarrierSet available in the system.
   template <DecoratorSet decorators, typename FunctionPointerT, BarrierType barrier_type>
   struct BarrierResolver: public AllStatic {

@@ -465,10 +472,26 @@
     static inline oop resolve(oop obj) {
       return _resolve_func(obj);
     }
   };
 
+  template <DecoratorSet decorators, typename T>
+  struct RuntimeDispatch<decorators, T, BARRIER_EQUALS>: AllStatic {
+    typedef typename AccessFunction<decorators, T, BARRIER_EQUALS>::type func_t;
+    static func_t _equals_func;
+
+    static bool equals_init(oop o1, oop o2) {
+      func_t function = BarrierResolver<decorators, func_t, BARRIER_EQUALS>::resolve_barrier();
+      _equals_func = function;
+      return function(o1, o2);
+    }
+
+    static inline bool equals(oop o1, oop o2) {
+      return _equals_func(o1, o2);
+    }
+  };
+
   // Initialize the function pointers to point to the resolving function.
   template <DecoratorSet decorators, typename T>
   typename AccessFunction<decorators, T, BARRIER_STORE>::type
   RuntimeDispatch<decorators, T, BARRIER_STORE>::_store_func = &store_init;
 

@@ -510,10 +533,14 @@
 
   template <DecoratorSet decorators, typename T>
   typename AccessFunction<decorators, T, BARRIER_RESOLVE>::type
   RuntimeDispatch<decorators, T, BARRIER_RESOLVE>::_resolve_func = &resolve_init;
 
+  template <DecoratorSet decorators, typename T>
+  typename AccessFunction<decorators, T, BARRIER_EQUALS>::type
+  RuntimeDispatch<decorators, T, BARRIER_EQUALS>::_equals_func = &equals_init;
+
   // Step 3: Pre-runtime dispatching.
   // The PreRuntimeDispatch class is responsible for filtering the barrier strength
   // decorators. That is, for AS_RAW, it hardwires the accesses without a runtime
   // dispatch point. Otherwise it goes through a runtime check if hardwiring was
   // not possible.

@@ -822,10 +849,25 @@
     inline static typename EnableIf<
       !HasDecorator<decorators, INTERNAL_BT_TO_SPACE_INVARIANT>::value, oop>::type
     resolve(oop obj) {
       return RuntimeDispatch<decorators, oop, BARRIER_RESOLVE>::resolve(obj);
     }
+
+    template <DecoratorSet decorators>
+    inline static typename EnableIf<
+      HasDecorator<decorators, AS_RAW>::value, bool>::type
+    equals(oop o1, oop o2) {
+      typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw;
+      return Raw::equals(o1, o2);
+    }
+
+    template <DecoratorSet decorators>
+    inline static typename EnableIf<
+      !HasDecorator<decorators, AS_RAW>::value, bool>::type
+    equals(oop o1, oop o2) {
+      return RuntimeDispatch<decorators, oop, BARRIER_EQUALS>::equals(o1, o2);
+    }
   };
 
   // This class adds implied decorators that follow according to decorator rules.
   // For example adding default reference strength and default memory ordering
   // semantics.

@@ -1131,10 +1173,16 @@
   template <DecoratorSet decorators>
   inline oop resolve(oop obj) {
     const DecoratorSet expanded_decorators = DecoratorFixup<decorators>::value;
     return PreRuntimeDispatch::resolve<expanded_decorators>(obj);
   }
+
+  template <DecoratorSet decorators>
+  inline bool equals(oop o1, oop o2) {
+    const DecoratorSet expanded_decorators = DecoratorFixup<decorators>::value;
+    return PreRuntimeDispatch::equals<expanded_decorators>(o1, o2);
+  }
 }
 
 template <DecoratorSet decorators>
 template <DecoratorSet expected_decorators>
 void Access<decorators>::verify_decorators() {
< prev index next >