< prev index next >

src/hotspot/share/gc/z/zObjArrayAllocator.cpp

Print this page
@@ -26,10 +26,11 @@
  #include "gc/z/zObjArrayAllocator.hpp"
  #include "gc/z/zUtils.inline.hpp"
  #include "oops/arrayKlass.hpp"
  #include "runtime/interfaceSupport.inline.hpp"
  #include "utilities/debug.hpp"
+ #include "utilities/globalDefinitions.hpp"
  
  ZObjArrayAllocator::ZObjArrayAllocator(Klass* klass, size_t word_size, int length, bool do_zero, Thread* thread)
    : ObjArrayAllocator(klass, word_size, length, do_zero, thread) {}
  
  void ZObjArrayAllocator::yield_for_safepoint() const {

@@ -51,11 +52,11 @@
    const size_t segment_max = ZUtils::bytes_to_words(64 * K);
    const BasicType element_type = ArrayKlass::cast(_klass)->element_type();
    const size_t header = arrayOopDesc::header_size(element_type);
    const size_t payload_size = _word_size - header;
  
-   if (payload_size <= segment_max) {
+   if (payload_size <= segment_max || ArrayKlass::cast(_klass)->is_flatArray_klass()) {
      // To small to use segmented clearing
      return ObjArrayAllocator::initialize(mem);
    }
  
    // Segmented clearing

@@ -64,11 +65,11 @@
    // cleared, therefore we can't expose the header at the end of this
    // function. Instead explicitly initialize it according to our needs.
  
    // Signal to the ZIterator that this is an invisible root, by setting
    // the mark word to "marked". Reset to prototype() after the clearing.
-   arrayOopDesc::set_mark(mem, markWord::prototype().set_marked());
+   arrayOopDesc::set_mark(mem, Klass::default_prototype_header(_klass).set_marked());
    arrayOopDesc::release_set_klass(mem, _klass);
    assert(_length >= 0, "length should be non-negative");
    arrayOopDesc::set_length(mem, _length);
  
    // Keep the array alive across safepoints through an invisible

@@ -133,9 +134,9 @@
    }
  
    ZThreadLocalData::clear_invisible_root(_thread);
  
    // Signal to the ZIterator that this is no longer an invisible root
-   oopDesc::release_set_mark(mem, markWord::prototype());
+   oopDesc::release_set_mark(mem, Klass::default_prototype_header(_klass));
  
    return cast_to_oop(mem);
  }
< prev index next >