< prev index next > test/hotspot/gtest/nmt/test_vmatree.cpp
Print this page
#include "nmt/vmatree.hpp"
#include "runtime/os.hpp"
#include "unittest.hpp"
using Tree = VMATree;
- using Node = Tree::TreapNode;
+ using TNode = Tree::TreapNode;
using NCS = NativeCallStackStorage;
class NMTVMATreeTest : public testing::Test {
public:
NCS ncs;
return x->val().out.type();
}
int count_nodes(Tree& tree) {
int count = 0;
- treap(tree).visit_in_order([&](Node* x) {
+ treap(tree).visit_in_order([&](TNode* x) {
++count;
});
return count;
}
Tree tree;
tree.reserve_mapping(0, 100 * 10, rd);
for (int i = 0; i < 10; i++) {
tree.commit_mapping(i * 100, 100, rd);
}
- treap(tree).visit_in_order([&](Node* x) {
+ treap(tree).visit_in_order([&](TNode* x) {
VMATree::StateType in = in_type_of(x);
VMATree::StateType out = out_type_of(x);
EXPECT_TRUE((in == VMATree::StateType::Released && out == VMATree::StateType::Committed) ||
(in == VMATree::StateType::Committed && out == VMATree::StateType::Released));
});
}
return false;
};
int i = 0;
- treap(tree).visit_in_order([&](Node* x) {
+ treap(tree).visit_in_order([&](TNode* x) {
if (i < 16) {
found[i] = x->key();
}
i++;
});
Tree tree;
VMATree::RegionData rd{si[0], mtTest };
VMATree::RegionData rd2{si[1], mtNMT };
tree.commit_mapping(50, 50, rd2);
tree.reserve_mapping(0, 100, rd);
- treap(tree).visit_in_order([&](Node* x) {
+ treap(tree).visit_in_order([&](TNode* x) {
EXPECT_TRUE(x->key() == 0 || x->key() == 100);
if (x->key() == 0) {
EXPECT_EQ(x->val().out.regiondata().mem_tag, mtTest);
}
});
Tree::RegionData rd{si[0], mtNMT};
VMATree::RegionData rd2{si[1], mtTest};
Tree tree;
tree.reserve_mapping(0, 100, rd);
tree.commit_mapping(0, 100, rd2);
- treap(tree).visit_range_in_order(0, 99999, [&](Node* x) {
+ treap(tree).visit_range_in_order(0, 99999, [&](TNode* x) {
if (x->key() == 0) {
EXPECT_EQ(mtTest, x->val().out.regiondata().mem_tag);
}
if (x->key() == 100) {
EXPECT_EQ(mtTest, x->val().in.regiondata().mem_tag);
< prev index next >