1 /* |
1 /* |
2 * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
264 void unlink(nmethod* nm) { |
264 void unlink(nmethod* nm) { |
265 // Unlinking of the dependencies must happen before the |
265 // Unlinking of the dependencies must happen before the |
266 // handshake separating unlink and purge. |
266 // handshake separating unlink and purge. |
267 nm->flush_dependencies(false /* delete_immediately */); |
267 nm->flush_dependencies(false /* delete_immediately */); |
268 |
268 |
269 // We don't need to take the lock when unlinking nmethods from |
269 // unlink_from_method will take the CompiledMethod_lock. |
|
270 // In this case we don't strictly need it when unlinking nmethods from |
270 // the Method, because it is only concurrently unlinked by |
271 // the Method, because it is only concurrently unlinked by |
271 // the entry barrier, which acquires the per nmethod lock. |
272 // the entry barrier, which acquires the per nmethod lock. |
272 nm->unlink_from_method(false /* acquire_lock */); |
273 nm->unlink_from_method(); |
273 |
274 |
274 if (nm->is_osr_method()) { |
275 if (nm->is_osr_method()) { |
275 // Invalidate the osr nmethod before the handshake. The nmethod |
276 // Invalidate the osr nmethod before the handshake. The nmethod |
276 // will be made unloaded after the handshake. Then invalidate_osr_method() |
277 // will be made unloaded after the handshake. Then invalidate_osr_method() |
277 // will be called again, which will be a no-op. |
278 // will be called again, which will be a no-op. |