mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-16 21:35:25 +00:00
improved the VMR ctor for committed regions
This commit is contained in:
parent
944b91271f
commit
ce63583ff5
@ -70,6 +70,7 @@ class RegionsTree : public VMATree {
|
||||
return position() - other.position();
|
||||
}
|
||||
inline NativeCallStackStorage::StackIndex out_stack_index() const { return _node->val().out.reserved_stack(); }
|
||||
inline NativeCallStackStorage::StackIndex out_committed_stack_index() const { return _node->val().out.committed_stack(); }
|
||||
inline MemTag in_tag() const { return _node->val().in.mem_tag(); }
|
||||
inline MemTag out_tag() const { return _node->val().out.mem_tag(); }
|
||||
inline void set_in_tag(MemTag tag) { _node->val().in.set_tag(tag); }
|
||||
@ -89,7 +90,7 @@ class RegionsTree : public VMATree {
|
||||
return RegionData(_ncs_storage.push(ncs), tag);
|
||||
}
|
||||
|
||||
inline const NativeCallStack stack(NodeHelper& node) {
|
||||
inline const NativeCallStack reserved_stack(NodeHelper& node) {
|
||||
if (!_with_storage) {
|
||||
return NativeCallStack::empty_stack();
|
||||
}
|
||||
@ -97,6 +98,14 @@ class RegionsTree : public VMATree {
|
||||
return _ncs_storage.get(si);
|
||||
}
|
||||
|
||||
inline const NativeCallStack committed_stack(NodeHelper& node) {
|
||||
if (!_with_storage) {
|
||||
return NativeCallStack::empty_stack();
|
||||
}
|
||||
NativeCallStackStorage::StackIndex si = node.out_committed_stack_index();
|
||||
return _ncs_storage.get(si);
|
||||
}
|
||||
|
||||
size_t committed_size(const VirtualMemoryRegion& rgn);
|
||||
};
|
||||
|
||||
|
||||
@ -38,7 +38,11 @@ void RegionsTree::visit_committed_regions(const VirtualMemoryRegion& rgn, F func
|
||||
visit_range_in_order(start, end, [&](Node* node) {
|
||||
NodeHelper curr(node);
|
||||
if (prev.is_valid() && prev.is_committed_begin()) {
|
||||
VirtualMemoryRegion cmr((address)prev.position(), curr.distance_from(prev), stack(prev), true /*committed*/);
|
||||
VirtualMemoryRegion cmr((address)prev.position(),
|
||||
curr.distance_from(prev),
|
||||
reserved_stack(prev),
|
||||
committed_stack(prev),
|
||||
prev.out_tag());
|
||||
if (!func(cmr)) {
|
||||
return false;
|
||||
}
|
||||
@ -63,7 +67,7 @@ void RegionsTree::visit_reserved_regions(F func) {
|
||||
}
|
||||
prev = curr;
|
||||
if (curr.is_released_begin() || begin_node.out_tag() != curr.out_tag()) {
|
||||
auto st = stack(begin_node);
|
||||
auto st = reserved_stack(begin_node);
|
||||
if (rgn_size == 0) {
|
||||
prev.clear_node();
|
||||
return true;
|
||||
|
||||
@ -214,10 +214,10 @@ class VirtualMemoryRegion {
|
||||
assert(size > 0, "Invalid size");
|
||||
}
|
||||
|
||||
VirtualMemoryRegion(address addr, size_t size, const NativeCallStack& stack, bool committed) :
|
||||
_base_address(addr), _size(size), _mem_tag(mtNone),
|
||||
_reserved_stack(NativeCallStack::empty_stack()) ,
|
||||
_committed_stack(stack) {
|
||||
VirtualMemoryRegion(address addr, size_t size, const NativeCallStack& reserved_stack, const NativeCallStack& committed_stack, MemTag mem_tag = mtNone) :
|
||||
_base_address(addr), _size(size), _mem_tag(mem_tag),
|
||||
_reserved_stack(reserved_stack),
|
||||
_committed_stack(committed_stack) {
|
||||
assert(addr != nullptr, "Invalid address");
|
||||
assert(size > 0, "Invalid size");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user