src/hotspot/share/oops/arrayOop.hpp
changeset 50389 7e8c0409a747
parent 49359 59f6547e151f
child 50882 80abf702eed8
equal deleted inserted replaced
50388:55fac6146d31 50389:7e8c0409a747
    86   // Returns the address of the first element. The elements in the array will not
    86   // Returns the address of the first element. The elements in the array will not
    87   // relocate from this address until a subsequent thread transition.
    87   // relocate from this address until a subsequent thread transition.
    88   inline void* base(BasicType type) const;
    88   inline void* base(BasicType type) const;
    89   inline void* base_raw(BasicType type) const; // GC barrier invariant
    89   inline void* base_raw(BasicType type) const; // GC barrier invariant
    90 
    90 
       
    91   template <typename T>
       
    92   static T* obj_offset_to_raw(arrayOop obj, size_t offset_in_bytes, T* raw) {
       
    93     if (obj != NULL) {
       
    94       assert(raw == NULL, "either raw or in-heap");
       
    95       char* base = reinterpret_cast<char*>((void*) obj);
       
    96       raw = reinterpret_cast<T*>(base + offset_in_bytes);
       
    97     } else {
       
    98       assert(raw != NULL, "either raw or in-heap");
       
    99     }
       
   100     return raw;
       
   101   }
       
   102 
    91   // Tells whether index is within bounds.
   103   // Tells whether index is within bounds.
    92   bool is_within_bounds(int index) const        { return 0 <= index && index < length(); }
   104   bool is_within_bounds(int index) const        { return 0 <= index && index < length(); }
    93 
   105 
    94   // Accessors for instance variable which is not a C++ declared nonstatic
   106   // Accessors for instance variable which is not a C++ declared nonstatic
    95   // field.
   107   // field.