< prev index next >

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

Print this page
@@ -25,10 +25,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 {

@@ -47,11 +48,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

@@ -63,11 +64,15 @@
    // Signal to the ZIterator that this is an invisible root, by setting
    // the mark word to "marked". Reset to prototype() after the clearing.
    if (UseCompactObjectHeaders) {
      oopDesc::release_set_mark(mem, _klass->prototype_header().set_marked());
    } else {
-     arrayOopDesc::set_mark(mem, markWord::prototype().set_marked());
+     if (EnableValhalla) {
+       arrayOopDesc::set_mark(mem, _klass->prototype_header().set_marked());
+     } else {
+       arrayOopDesc::set_mark(mem, markWord::prototype().set_marked());
+     }
      arrayOopDesc::release_set_klass(mem, _klass);
    }
    assert(_length >= 0, "length should be non-negative");
    arrayOopDesc::set_length(mem, _length);
  

@@ -153,11 +158,11 @@
    mem_zap_end_padding(mem);
  
    ZThreadLocalData::clear_invisible_root(_thread);
  
    // Signal to the ZIterator that this is no longer an invisible root
-   if (UseCompactObjectHeaders) {
+   if (UseCompactObjectHeaders || EnableValhalla) {
      oopDesc::release_set_mark(mem, _klass->prototype_header());
    } else {
      oopDesc::release_set_mark(mem, markWord::prototype());
    }
  
< prev index next >