mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-26 10:10:19 +00:00
8302066: Counter _number_of_nmethods_with_dependencies should be atomic.
Reviewed-by: thartmann, kvn
This commit is contained in:
parent
f4b72df428
commit
77ead449e4
@ -168,7 +168,7 @@ class CodeBlob_sizes {
|
||||
|
||||
address CodeCache::_low_bound = 0;
|
||||
address CodeCache::_high_bound = 0;
|
||||
int CodeCache::_number_of_nmethods_with_dependencies = 0;
|
||||
volatile int CodeCache::_number_of_nmethods_with_dependencies = 0;
|
||||
ExceptionCache* volatile CodeCache::_exception_cache_purge_list = nullptr;
|
||||
|
||||
// Initialize arrays of CodeHeap subsets
|
||||
@ -587,7 +587,7 @@ void CodeCache::free(CodeBlob* cb) {
|
||||
if (cb->is_nmethod()) {
|
||||
heap->set_nmethod_count(heap->nmethod_count() - 1);
|
||||
if (((nmethod *)cb)->has_dependencies()) {
|
||||
_number_of_nmethods_with_dependencies--;
|
||||
Atomic::dec(&_number_of_nmethods_with_dependencies);
|
||||
}
|
||||
}
|
||||
if (cb->is_adapter_blob()) {
|
||||
@ -622,7 +622,7 @@ void CodeCache::commit(CodeBlob* cb) {
|
||||
if (cb->is_nmethod()) {
|
||||
heap->set_nmethod_count(heap->nmethod_count() + 1);
|
||||
if (((nmethod *)cb)->has_dependencies()) {
|
||||
_number_of_nmethods_with_dependencies++;
|
||||
Atomic::inc(&_number_of_nmethods_with_dependencies);
|
||||
}
|
||||
}
|
||||
if (cb->is_adapter_blob()) {
|
||||
@ -1219,8 +1219,8 @@ void codeCache_init() {
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
int CodeCache::number_of_nmethods_with_dependencies() {
|
||||
return _number_of_nmethods_with_dependencies;
|
||||
bool CodeCache::has_nmethods_with_dependencies() {
|
||||
return Atomic::load_acquire(&_number_of_nmethods_with_dependencies) != 0;
|
||||
}
|
||||
|
||||
void CodeCache::clear_inline_caches() {
|
||||
@ -1431,7 +1431,9 @@ void CodeCache::make_nmethod_deoptimized(CompiledMethod* nm) {
|
||||
void CodeCache::flush_dependents_on(InstanceKlass* dependee) {
|
||||
assert_lock_strong(Compile_lock);
|
||||
|
||||
if (number_of_nmethods_with_dependencies() == 0) return;
|
||||
if (!has_nmethods_with_dependencies()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int marked = 0;
|
||||
if (dependee->is_linked()) {
|
||||
|
||||
@ -93,9 +93,9 @@ class CodeCache : AllStatic {
|
||||
static GrowableArray<CodeHeap*>* _nmethod_heaps;
|
||||
static GrowableArray<CodeHeap*>* _allocable_heaps;
|
||||
|
||||
static address _low_bound; // Lower bound of CodeHeap addresses
|
||||
static address _high_bound; // Upper bound of CodeHeap addresses
|
||||
static int _number_of_nmethods_with_dependencies; // Total number of nmethods with dependencies
|
||||
static address _low_bound; // Lower bound of CodeHeap addresses
|
||||
static address _high_bound; // Upper bound of CodeHeap addresses
|
||||
static volatile int _number_of_nmethods_with_dependencies; // Total number of nmethods with dependencies
|
||||
|
||||
static uint8_t _unloading_cycle; // Global state for recognizing old nmethods that need to be unloaded
|
||||
static uint64_t _gc_epoch; // Global state for tracking when nmethods were found to be on-stack
|
||||
@ -323,8 +323,8 @@ class CodeCache : AllStatic {
|
||||
// Support for fullspeed debugging
|
||||
static void flush_dependents_on_method(const methodHandle& dependee);
|
||||
|
||||
// tells how many nmethods have dependencies
|
||||
static int number_of_nmethods_with_dependencies();
|
||||
// tells if there are nmethods with dependencies
|
||||
static bool has_nmethods_with_dependencies();
|
||||
|
||||
static int get_codemem_full_count(CodeBlobType code_blob_type) {
|
||||
CodeHeap* heap = get_code_heap(code_blob_type);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user