< prev index next >

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

Print this page




  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_OOPS_INSTANCEKLASS_INLINE_HPP
  26 #define SHARE_VM_OOPS_INSTANCEKLASS_INLINE_HPP
  27 
  28 #include "memory/iterator.hpp"
  29 #include "oops/instanceKlass.hpp"
  30 #include "oops/klass.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "runtime/orderAccess.inline.hpp"
  33 #include "utilities/debug.hpp"
  34 #include "utilities/globalDefinitions.hpp"
  35 #include "utilities/macros.hpp"
  36 
  37 inline Klass* InstanceKlass::array_klasses_acquire() const {
  38   return (Klass*) OrderAccess::load_ptr_acquire(&_array_klasses);
  39 }
  40 
  41 inline void InstanceKlass::release_set_array_klasses(Klass* k) {
  42   OrderAccess::release_store_ptr(&_array_klasses, k);
  43 }
  44 
  45 inline jmethodID* InstanceKlass::methods_jmethod_ids_acquire() const {
  46   return (jmethodID*)OrderAccess::load_ptr_acquire(&_methods_jmethod_ids);
  47 }
  48 
  49 inline void InstanceKlass::release_set_methods_jmethod_ids(jmethodID* jmeths) {
  50   OrderAccess::release_store_ptr(&_methods_jmethod_ids, jmeths);
  51 }
  52 
  53 // The iteration over the oops in objects is a hot path in the GC code.
  54 // By force inlining the following functions, we get similar GC performance
  55 // as the previous macro based implementation.
  56 
  57 template <bool nv, typename T, class OopClosureType>
  58 ALWAYSINLINE void InstanceKlass::oop_oop_iterate_oop_map(OopMapBlock* map, oop obj, OopClosureType* closure) {
  59   T* p         = (T*)obj->obj_field_addr<T>(map->offset());
  60   T* const end = p + map->count();
  61 
  62   for (; p < end; ++p) {
  63     Devirtualizer<nv>::do_oop(closure, p);
  64   }
  65 }
  66 
  67 #if INCLUDE_ALL_GCS
  68 template <bool nv, typename T, class OopClosureType>
  69 ALWAYSINLINE void InstanceKlass::oop_oop_iterate_oop_map_reverse(OopMapBlock* map, oop obj, OopClosureType* closure) {
  70   T* const start = (T*)obj->obj_field_addr<T>(map->offset());




  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_OOPS_INSTANCEKLASS_INLINE_HPP
  26 #define SHARE_VM_OOPS_INSTANCEKLASS_INLINE_HPP
  27 
  28 #include "memory/iterator.hpp"
  29 #include "oops/instanceKlass.hpp"
  30 #include "oops/klass.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "runtime/orderAccess.inline.hpp"
  33 #include "utilities/debug.hpp"
  34 #include "utilities/globalDefinitions.hpp"
  35 #include "utilities/macros.hpp"
  36 
  37 inline Klass* InstanceKlass::array_klasses_acquire() const {
  38   return OrderAccess::load_acquire(&_array_klasses);
  39 }
  40 
  41 inline void InstanceKlass::release_set_array_klasses(Klass* k) {
  42   OrderAccess::release_store(&_array_klasses, k);
  43 }
  44 
  45 inline jmethodID* InstanceKlass::methods_jmethod_ids_acquire() const {
  46   return OrderAccess::load_acquire(&_methods_jmethod_ids);
  47 }
  48 
  49 inline void InstanceKlass::release_set_methods_jmethod_ids(jmethodID* jmeths) {
  50   OrderAccess::release_store(&_methods_jmethod_ids, jmeths);
  51 }
  52 
  53 // The iteration over the oops in objects is a hot path in the GC code.
  54 // By force inlining the following functions, we get similar GC performance
  55 // as the previous macro based implementation.
  56 
  57 template <bool nv, typename T, class OopClosureType>
  58 ALWAYSINLINE void InstanceKlass::oop_oop_iterate_oop_map(OopMapBlock* map, oop obj, OopClosureType* closure) {
  59   T* p         = (T*)obj->obj_field_addr<T>(map->offset());
  60   T* const end = p + map->count();
  61 
  62   for (; p < end; ++p) {
  63     Devirtualizer<nv>::do_oop(closure, p);
  64   }
  65 }
  66 
  67 #if INCLUDE_ALL_GCS
  68 template <bool nv, typename T, class OopClosureType>
  69 ALWAYSINLINE void InstanceKlass::oop_oop_iterate_oop_map_reverse(OopMapBlock* map, oop obj, OopClosureType* closure) {
  70   T* const start = (T*)obj->obj_field_addr<T>(map->offset());


< prev index next >