8220594: ZGC: Remove superfluous ZPage::is_active()

Reviewed-by: stefank, eosterlund
This commit is contained in:
Per Lidén 2019-03-18 11:50:40 +01:00
parent cc4ae9ab95
commit dd412e66c5
6 changed files with 5 additions and 35 deletions

View File

@ -25,13 +25,11 @@
#include "gc/z/zPage.inline.hpp"
#include "gc/z/zPhysicalMemory.inline.hpp"
#include "gc/z/zVirtualMemory.inline.hpp"
#include "runtime/orderAccess.hpp"
#include "utilities/align.hpp"
#include "utilities/debug.hpp"
ZPage::ZPage(uint8_t type, ZVirtualMemory vmem, ZPhysicalMemory pmem) :
_type(type),
_active(0),
_numa_id((uint8_t)-1),
_seqnum(0),
_virtual(vmem),
@ -47,30 +45,20 @@ ZPage::ZPage(uint8_t type, ZVirtualMemory vmem, ZPhysicalMemory pmem) :
}
ZPage::~ZPage() {
assert(!is_active(), "Should not be active");
assert(_physical.is_null(), "Should be detached");
assert(_physical.is_null(), "Should be null");
}
void ZPage::reset() {
assert(!is_active(), "Should not be active");
_seqnum = ZGlobalSeqNum;
_top = start();
_livemap.reset();
// Make sure we don't make the page active before
// the reset of the above fields are visible.
OrderAccess::storestore();
_active = 1;
}
void ZPage::print_on(outputStream* out) const {
out->print_cr(" %-6s " PTR_FORMAT " " PTR_FORMAT " " PTR_FORMAT " %s%s%s",
out->print_cr(" %-6s " PTR_FORMAT " " PTR_FORMAT " " PTR_FORMAT " %s%s",
type_to_string(), start(), top(), end(),
is_allocating() ? " Allocating" : "",
is_relocatable() ? " Relocatable" : "",
!is_active() ? " Inactive" : "");
is_relocatable() ? " Relocatable" : "");
}
void ZPage::print() const {

View File

@ -37,7 +37,6 @@ class ZPage : public CHeapObj<mtGC> {
private:
// Always hot
const uint8_t _type; // Page type
volatile uint8_t _active; // Active flag
uint8_t _numa_id; // NUMA node affinity
uint32_t _seqnum; // Allocation sequence number
const ZVirtualMemory _virtual; // Virtual start/end address
@ -80,9 +79,6 @@ public:
uintptr_t block_start(uintptr_t addr) const;
bool block_is_obj(uintptr_t addr) const;
bool is_active() const;
void set_inactive();
bool is_allocating() const;
bool is_relocatable() const;

View File

@ -149,20 +149,12 @@ inline bool ZPage::block_is_obj(uintptr_t addr) const {
return ZAddress::offset(addr) < top();
}
inline bool ZPage::is_active() const {
return OrderAccess::load_acquire(&_active) != 0;
}
inline void ZPage::set_inactive() {
OrderAccess::release_store(&_active, (uint8_t)0);
}
inline bool ZPage::is_allocating() const {
return is_active() && _seqnum == ZGlobalSeqNum;
return _seqnum == ZGlobalSeqNum;
}
inline bool ZPage::is_relocatable() const {
return is_active() && _seqnum < ZGlobalSeqNum;
return _seqnum < ZGlobalSeqNum;
}
inline bool ZPage::is_mapped() const {

View File

@ -470,9 +470,6 @@ void ZPageAllocator::free_page(ZPage* page, bool reclaimed) {
// Update used statistics
decrease_used(page->size(), reclaimed);
// Make page inactive
page->set_inactive();
// Cache page
_cache.free_page(page);

View File

@ -118,8 +118,6 @@ ZPage* ZPageCache::alloc_page(uint8_t type, size_t size) {
}
void ZPageCache::free_page(ZPage* page) {
assert(!page->is_active(), "Invalid page state");
const uint8_t type = page->type();
if (type == ZPageTypeSmall) {
_small.get(page->numa_id()).insert_first(page);

View File

@ -174,7 +174,6 @@ public:
// Teardown page
page.physical_memory().clear();
page.set_inactive();
}
// Run the given function with a few different input values.