hotspot/src/share/vm/gc/cms/promotionInfo.cpp
changeset 35862 411842d0c882
parent 34129 41cd6f08f3e8
child 38198 8144ec8f789e
--- a/hotspot/src/share/vm/gc/cms/promotionInfo.cpp	Wed Jan 27 11:41:44 2016 +0100
+++ b/hotspot/src/share/vm/gc/cms/promotionInfo.cpp	Mon Jan 18 10:25:41 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,31 @@
 /////////////////////////////////////////////////////////////////////////
 
 
+PromotedObject* PromotedObject::next() const {
+  assert(!((FreeChunk*)this)->is_free(), "Error");
+  PromotedObject* res;
+  if (UseCompressedOops) {
+    // The next pointer is a compressed oop stored in the top 32 bits
+    res = (PromotedObject*)oopDesc::decode_heap_oop(_data._narrow_next);
+  } else {
+    res = (PromotedObject*)(_next & next_mask);
+  }
+  assert(oop(res)->is_oop_or_null(true /* ignore mark word */), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(res)));
+  return res;
+}
+
+inline void PromotedObject::setNext(PromotedObject* x) {
+  assert(((intptr_t)x & ~next_mask) == 0, "Conflict in bit usage, "
+         "or insufficient alignment of objects");
+  if (UseCompressedOops) {
+    assert(_data._narrow_next == 0, "Overwrite?");
+    _data._narrow_next = oopDesc::encode_heap_oop(oop(x));
+  } else {
+    _next |= (intptr_t)x;
+  }
+  assert(!((FreeChunk*)this)->is_free(), "Error");
+}
+
 //////////////////////////////////////////////////////////////////////////////
 // We go over the list of promoted objects, removing each from the list,
 // and applying the closure (this may, in turn, add more elements to