mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 00:54:38 +02:00

Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com> Co-authored-by: Erik Osterlund <erik.osterlund@oracle.com> Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com> Co-authored-by: Kim Barrett <kim.barrett@oracle.com> Co-authored-by: Nils Eliasson <nils.eliasson@oracle.com> Co-authored-by: Rickard Backman <rickard.backman@oracle.com> Co-authored-by: Roland Westrelin <rwestrel@redhat.com> Co-authored-by: Coleen Phillimore <coleen.phillimore@oracle.com> Co-authored-by: Robbin Ehn <robbin.ehn@oracle.com> Co-authored-by: Gerard Ziemski <gerard.ziemski@oracle.com> Co-authored-by: Hugh Wilkinson <hugh.wilkinson@intel.com> Co-authored-by: Sandhya Viswanathan <sandhya.viswanathan@intel.com> Co-authored-by: Bill Wheeler <bill.npo.wheeler@intel.com> Co-authored-by: Vinay K. Awasthi <vinay.k.awasthi@intel.com> Co-authored-by: Yasumasa Suenaga <yasuenag@gmail.com> Reviewed-by: pliden, stefank, eosterlund, ehelin, sjohanss, rbackman, coleenp, ihse, jgeorge, lmesnik, rkennke
37 lines
980 B
C++
37 lines
980 B
C++
/*
|
|
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
|
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
|
*/
|
|
|
|
#include "precompiled.hpp"
|
|
#include "gc/z/zLiveMap.inline.hpp"
|
|
#include "unittest.hpp"
|
|
|
|
class ZLiveMapTest : public ::testing::Test {
|
|
protected:
|
|
static void strongly_live_for_large_zpage() {
|
|
// Large ZPages only have room for one object.
|
|
ZLiveMap livemap(1);
|
|
|
|
bool inc_live;
|
|
uintptr_t object = 0u;
|
|
|
|
// Mark the object strong.
|
|
livemap.set_atomic(object, false /* finalizable */, inc_live);
|
|
|
|
// Check that both bits are in the same segment.
|
|
ASSERT_EQ(livemap.index_to_segment(0), livemap.index_to_segment(1));
|
|
|
|
// Check that the object was marked.
|
|
ASSERT_TRUE(livemap.get(0));
|
|
|
|
// Check that the object was strongly marked.
|
|
ASSERT_TRUE(livemap.get(1));
|
|
|
|
ASSERT_TRUE(inc_live);
|
|
}
|
|
};
|
|
|
|
TEST_F(ZLiveMapTest, strongly_live_for_large_zpage) {
|
|
strongly_live_for_large_zpage();
|
|
}
|