< 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 {

@@ -48,11 +49,11 @@
    // A max segment size of 64K was chosen because microbenchmarking
    // suggested that it offered a good trade-off between allocation
    // time and time-to-safepoint
    const size_t segment_max = ZUtils::bytes_to_words(64 * K);
  
-   if (_word_size <= segment_max) {
+   if (_word_size <= segment_max || ArrayKlass::cast(_klass)->is_flatArray_klass()) {
      // To small to use segmented clearing
      return ObjArrayAllocator::initialize(mem);
    }
  
    // Segmented clearing

@@ -61,11 +62,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

@@ -150,9 +151,9 @@
    mem_zap_end_padding(mem);
  
    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 >