< prev index next >
test/hotspot/gtest/gc/shared/test_preservedMarks.cpp
Print this page
*** 51,60 ****
--- 51,62 ----
static markWord originalMark() { return markWord(markWord::lock_mask_in_place); }
static markWord changedMark() { return markWord(0x4711); }
};
+ #define ASSERT_MARK_WORD_EQ(a, b) ASSERT_EQ((a).value(), (b).value())
+
TEST_VM(PreservedMarks, iterate_and_restore) {
// Need to disable biased locking to easily
// create oops that "must_be_preseved"
ScopedDisabledBiasedLocking dbl;
*** 63,82 ****
FakeOop o2;
FakeOop o3;
FakeOop o4;
// Make sure initial marks are correct.
! ASSERT_EQ(o1.mark(), FakeOop::originalMark());
! ASSERT_EQ(o2.mark(), FakeOop::originalMark());
! ASSERT_EQ(o3.mark(), FakeOop::originalMark());
! ASSERT_EQ(o4.mark(), FakeOop::originalMark());
// Change the marks and verify change.
o1.set_mark(FakeOop::changedMark());
o2.set_mark(FakeOop::changedMark());
! ASSERT_EQ(o1.mark(), FakeOop::changedMark());
! ASSERT_EQ(o2.mark(), FakeOop::changedMark());
// Push o1 and o2 to have their marks preserved.
pm.push(o1.get_oop(), o1.mark());
pm.push(o2.get_oop(), o2.mark());
--- 65,84 ----
FakeOop o2;
FakeOop o3;
FakeOop o4;
// Make sure initial marks are correct.
! ASSERT_MARK_WORD_EQ(o1.mark(), FakeOop::originalMark());
! ASSERT_MARK_WORD_EQ(o2.mark(), FakeOop::originalMark());
! ASSERT_MARK_WORD_EQ(o3.mark(), FakeOop::originalMark());
! ASSERT_MARK_WORD_EQ(o4.mark(), FakeOop::originalMark());
// Change the marks and verify change.
o1.set_mark(FakeOop::changedMark());
o2.set_mark(FakeOop::changedMark());
! ASSERT_MARK_WORD_EQ(o1.mark(), FakeOop::changedMark());
! ASSERT_MARK_WORD_EQ(o2.mark(), FakeOop::changedMark());
// Push o1 and o2 to have their marks preserved.
pm.push(o1.get_oop(), o1.mark());
pm.push(o2.get_oop(), o2.mark());
*** 90,97 ****
pm.adjust_during_full_gc();
// Restore all preserved and verify that the changed
// mark is now present at o3 and o4.
pm.restore();
! ASSERT_EQ(o3.mark(), FakeOop::changedMark());
! ASSERT_EQ(o4.mark(), FakeOop::changedMark());
}
--- 92,99 ----
pm.adjust_during_full_gc();
// Restore all preserved and verify that the changed
// mark is now present at o3 and o4.
pm.restore();
! ASSERT_MARK_WORD_EQ(o3.mark(), FakeOop::changedMark());
! ASSERT_MARK_WORD_EQ(o4.mark(), FakeOop::changedMark());
}
< prev index next >