Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK18+ disable finalization accordingly to command line option #14307

Merged
merged 1 commit into from
Jan 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions runtime/gc_modron_startup/mminit.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2021 IBM Corp. and others
* Copyright (c) 1991, 2022 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -565,11 +565,18 @@ gcStartupHeapManagement(J9JavaVM *javaVM)
int result = 0;

#if defined(J9VM_GC_FINALIZATION)
result = j9gc_finalizer_startup(javaVM);
if (JNI_OK != result) {
PORT_ACCESS_FROM_JAVAVM(javaVM);
j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_FAILED_TO_INITIALIZE_FINALIZE_SUPPORT);
return result;
#if JAVA_SPEC_VERSION >= 18
if (J9_ARE_ANY_BITS_SET(javaVM->extendedRuntimeFlags, J9_EXTENDED_RUNTIME_DISABLE_FINALIZATION)) {
/* Finalization is disabled */
} else
#endif /* JAVA_SPEC_VERSION >= 18 */
{
result = j9gc_finalizer_startup(javaVM);
if (JNI_OK != result) {
PORT_ACCESS_FROM_JAVAVM(javaVM);
j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_FAILED_TO_INITIALIZE_FINALIZE_SUPPORT);
return result;
}
}
#endif /* J9VM_GC_FINALIZATION */

Expand Down