17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/cms/compactibleFreeListSpace.hpp"
27 #include "gc/cms/promotionInfo.hpp"
28 #include "gc/shared/genOopClosures.hpp"
29 #include "oops/markOop.inline.hpp"
30 #include "oops/oop.inline.hpp"
31
32 /////////////////////////////////////////////////////////////////////////
33 //// PromotionInfo
34 /////////////////////////////////////////////////////////////////////////
35
36
37 //////////////////////////////////////////////////////////////////////////////
38 // We go over the list of promoted objects, removing each from the list,
39 // and applying the closure (this may, in turn, add more elements to
40 // the tail of the promoted list, and these newly added objects will
41 // also be processed) until the list is empty.
42 // To aid verification and debugging, in the non-product builds
43 // we actually forward _promoHead each time we process a promoted oop.
44 // Note that this is not necessary in general (i.e. when we don't need to
45 // call PromotionInfo::verify()) because oop_iterate can only add to the
46 // end of _promoTail, and never needs to look at _promoHead.
47
48 #define PROMOTED_OOPS_ITERATE_DEFN(OopClosureType, nv_suffix) \
49 \
50 void PromotionInfo::promoted_oops_iterate##nv_suffix(OopClosureType* cl) { \
51 NOT_PRODUCT(verify()); \
52 PromotedObject *curObj, *nextObj; \
53 for (curObj = _promoHead; curObj != NULL; curObj = nextObj) { \
54 if ((nextObj = curObj->next()) == NULL) { \
55 /* protect ourselves against additions due to closure application \
56 below by resetting the list. */ \
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/cms/compactibleFreeListSpace.hpp"
27 #include "gc/cms/promotionInfo.hpp"
28 #include "gc/shared/genOopClosures.hpp"
29 #include "oops/markOop.inline.hpp"
30 #include "oops/oop.inline.hpp"
31
32 /////////////////////////////////////////////////////////////////////////
33 //// PromotionInfo
34 /////////////////////////////////////////////////////////////////////////
35
36
37 PromotedObject* PromotedObject::next() const {
38 assert(!((FreeChunk*)this)->is_free(), "Error");
39 PromotedObject* res;
40 if (UseCompressedOops) {
41 // The next pointer is a compressed oop stored in the top 32 bits
42 res = (PromotedObject*)oopDesc::decode_heap_oop(_data._narrow_next);
43 } else {
44 res = (PromotedObject*)(_next & next_mask);
45 }
46 assert(oop(res)->is_oop_or_null(true /* ignore mark word */), "Expected an oop or NULL at " PTR_FORMAT, p2i(oop(res)));
47 return res;
48 }
49
50 inline void PromotedObject::setNext(PromotedObject* x) {
51 assert(((intptr_t)x & ~next_mask) == 0, "Conflict in bit usage, "
52 "or insufficient alignment of objects");
53 if (UseCompressedOops) {
54 assert(_data._narrow_next == 0, "Overwrite?");
55 _data._narrow_next = oopDesc::encode_heap_oop(oop(x));
56 } else {
57 _next |= (intptr_t)x;
58 }
59 assert(!((FreeChunk*)this)->is_free(), "Error");
60 }
61
62 //////////////////////////////////////////////////////////////////////////////
63 // We go over the list of promoted objects, removing each from the list,
64 // and applying the closure (this may, in turn, add more elements to
65 // the tail of the promoted list, and these newly added objects will
66 // also be processed) until the list is empty.
67 // To aid verification and debugging, in the non-product builds
68 // we actually forward _promoHead each time we process a promoted oop.
69 // Note that this is not necessary in general (i.e. when we don't need to
70 // call PromotionInfo::verify()) because oop_iterate can only add to the
71 // end of _promoTail, and never needs to look at _promoHead.
72
73 #define PROMOTED_OOPS_ITERATE_DEFN(OopClosureType, nv_suffix) \
74 \
75 void PromotionInfo::promoted_oops_iterate##nv_suffix(OopClosureType* cl) { \
76 NOT_PRODUCT(verify()); \
77 PromotedObject *curObj, *nextObj; \
78 for (curObj = _promoHead; curObj != NULL; curObj = nextObj) { \
79 if ((nextObj = curObj->next()) == NULL) { \
80 /* protect ourselves against additions due to closure application \
81 below by resetting the list. */ \
|