mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8199793: [Graal] runtime/CommandLine/PrintTouchedMethods.java crashes with assertion "reference count underflow for symbol"
Remove Symbol::set_permanent to avoid possible race conditions Reviewed-by: coleenp, dholmes, thartmann
This commit is contained in:
parent
7804f9b1e2
commit
33c908457b
2 changed files with 4 additions and 11 deletions
|
@ -2372,9 +2372,9 @@ void Method::log_touched(TRAPS) {
|
||||||
ptr = ptr->_next;
|
ptr = ptr->_next;
|
||||||
}
|
}
|
||||||
TouchedMethodRecord* nptr = NEW_C_HEAP_OBJ(TouchedMethodRecord, mtTracing);
|
TouchedMethodRecord* nptr = NEW_C_HEAP_OBJ(TouchedMethodRecord, mtTracing);
|
||||||
my_class->set_permanent(); // prevent reclaimed by GC
|
my_class->increment_refcount();
|
||||||
my_name->set_permanent();
|
my_name->increment_refcount();
|
||||||
my_sig->set_permanent();
|
my_sig->increment_refcount();
|
||||||
nptr->_class_name = my_class;
|
nptr->_class_name = my_class;
|
||||||
nptr->_method_name = my_name;
|
nptr->_method_name = my_name;
|
||||||
nptr->_method_signature = my_sig;
|
nptr->_method_signature = my_sig;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -165,13 +165,6 @@ class Symbol : public MetaspaceObj {
|
||||||
int refcount() const { return _refcount; }
|
int refcount() const { return _refcount; }
|
||||||
void increment_refcount();
|
void increment_refcount();
|
||||||
void decrement_refcount();
|
void decrement_refcount();
|
||||||
// Set _refcount non zero to avoid being reclaimed by GC.
|
|
||||||
void set_permanent() {
|
|
||||||
assert(LogTouchedMethods, "Should not be called with LogTouchedMethods off");
|
|
||||||
if (_refcount != PERM_REFCOUNT) {
|
|
||||||
_refcount = PERM_REFCOUNT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bool is_permanent() {
|
bool is_permanent() {
|
||||||
return (_refcount == PERM_REFCOUNT);
|
return (_refcount == PERM_REFCOUNT);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue