8266795: Remove dead code LowMemoryDetectorDisabler

Reviewed-by: dholmes
This commit is contained in:
Hamlin Li 2021-05-14 06:52:31 +00:00
parent 1e0ecd6d56
commit 301095c8be
2 changed files with 2 additions and 28 deletions

@ -39,7 +39,6 @@
#include "services/management.hpp"
volatile bool LowMemoryDetector::_enabled_for_collected_pools = false;
volatile jint LowMemoryDetector::_disabled_count = 0;
bool LowMemoryDetector::has_pending_requests() {
assert(Notification_lock->owned_by_self(), "Must own Notification_lock");

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -211,19 +211,13 @@ public:
};
class LowMemoryDetector : public AllStatic {
friend class LowMemoryDetectorDisabler;
friend class ServiceThread;
friend class NotificationThread;
private:
// true if any collected heap has low memory detection enabled
static volatile bool _enabled_for_collected_pools;
// > 0 if temporary disabed
static volatile jint _disabled_count;
static bool has_pending_requests();
static bool temporary_disabled() { return _disabled_count > 0; }
static void disable() { Atomic::inc(&_disabled_count); }
static void enable() { Atomic::dec(&_disabled_count); }
static void process_sensor_changes(TRAPS);
public:
@ -244,19 +238,13 @@ public:
}
}
// indicates if low memory detection is enabled for any collected
// memory pools
static inline bool is_enabled_for_collected_pools() {
return !temporary_disabled() && _enabled_for_collected_pools;
}
// recompute enabled flag
static void recompute_enabled_for_collected_pools();
// low memory detection for collected memory pools.
static inline void detect_low_memory_for_collected_pools() {
// no-op if low memory detection not enabled
if (!is_enabled_for_collected_pools()) {
if (!_enabled_for_collected_pools) {
return;
}
int num_memory_pools = MemoryService::num_memory_pools();
@ -276,17 +264,4 @@ public:
}
};
class LowMemoryDetectorDisabler: public StackObj {
public:
LowMemoryDetectorDisabler()
{
LowMemoryDetector::disable();
}
~LowMemoryDetectorDisabler()
{
assert(LowMemoryDetector::temporary_disabled(), "should be disabled!");
LowMemoryDetector::enable();
}
};
#endif // SHARE_SERVICES_LOWMEMORYDETECTOR_HPP