mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 18:14:38 +02:00
8266936: Add a finalization JFR event
Reviewed-by: coleenp, mchung, egahlin
This commit is contained in:
parent
bcbe3845d9
commit
72a976ef05
36 changed files with 1517 additions and 551 deletions
|
@ -86,6 +86,7 @@ final class Finalizer extends FinalReference<Object> { /* Package-private; must
|
|||
assert finalizee != null;
|
||||
if (!(finalizee instanceof java.lang.Enum)) {
|
||||
jla.invokeFinalize(finalizee);
|
||||
reportComplete(finalizee);
|
||||
|
||||
// Clear stack slot containing this variable, to decrease
|
||||
// the chances of false retention with a conservative GC
|
||||
|
@ -95,6 +96,8 @@ final class Finalizer extends FinalReference<Object> { /* Package-private; must
|
|||
super.clear();
|
||||
}
|
||||
|
||||
private static native void reportComplete(Object finalizee);
|
||||
|
||||
/* Create a privileged secondary finalizer thread in the system thread
|
||||
* group for the given Runnable, and wait for it to complete.
|
||||
*
|
||||
|
|
35
src/java.base/share/native/libjava/Finalizer.c
Normal file
35
src/java.base/share/native/libjava/Finalizer.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "jvm.h"
|
||||
|
||||
#include "java_lang_ref_Finalizer.h"
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_lang_ref_Finalizer_reportComplete(JNIEnv* env, jclass cls, jobject finalizee) {
|
||||
JVM_ReportFinalizationComplete(env, finalizee);
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue