# HG changeset patch # User iklam # Date 1522111254 25200 # Node ID 537ef53e26af061bbc8621d631a6fe81902ef6ec # Parent f40a666a75bc586671d19bf8fe04490b4194d129 8199793: [Graal] runtime/CommandLine/PrintTouchedMethods.java crashes with assertion "reference count underflow for symbol" Summary: Remove Symbol::set_permanent to avoid possible race conditions Reviewed-by: coleenp, dholmes, thartmann diff -r f40a666a75bc -r 537ef53e26af src/hotspot/share/oops/method.cpp --- a/src/hotspot/share/oops/method.cpp Mon Mar 26 19:00:47 2018 -0400 +++ b/src/hotspot/share/oops/method.cpp Mon Mar 26 17:40:54 2018 -0700 @@ -2372,9 +2372,9 @@ ptr = ptr->_next; } TouchedMethodRecord* nptr = NEW_C_HEAP_OBJ(TouchedMethodRecord, mtTracing); - my_class->set_permanent(); // prevent reclaimed by GC - my_name->set_permanent(); - my_sig->set_permanent(); + my_class->increment_refcount(); + my_name->increment_refcount(); + my_sig->increment_refcount(); nptr->_class_name = my_class; nptr->_method_name = my_name; nptr->_method_signature = my_sig; diff -r f40a666a75bc -r 537ef53e26af src/hotspot/share/oops/symbol.hpp --- a/src/hotspot/share/oops/symbol.hpp Mon Mar 26 19:00:47 2018 -0400 +++ b/src/hotspot/share/oops/symbol.hpp Mon Mar 26 17:40:54 2018 -0700 @@ -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. * * This code is free software; you can redistribute it and/or modify it @@ -165,13 +165,6 @@ int refcount() const { return _refcount; } void increment_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() { return (_refcount == PERM_REFCOUNT); }