From 8591ace51cb262bc6f35b4213f2ebac8a4b9111f Mon Sep 17 00:00:00 2001 Date: Fri, 22 Jan 2021 14:29:52 +0800 Subject: Backport of JDK-8191129 summary: AARCH64: Invalid value passed to critical JNI function LLT: Bug url: https://bugs.openjdk.java.net/browse/JDK-8191129 --- .../cpu/aarch64/vm/sharedRuntime_aarch64.cpp | 2 +- .../src/cpu/aarch64/vm/vm_version_aarch64.cpp | 3 +++ hotspot/src/share/vm/runtime/arguments.cpp | 22 ------------------- hotspot/src/share/vm/runtime/arguments.hpp | 22 +++++++++++++++++++ 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp index 55c2b5d6d..7143db519 100644 --- a/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp @@ -1545,7 +1545,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, // critical natives they are offset down. GrowableArray arg_order(2 * total_in_args); VMRegPair tmp_vmreg; - tmp_vmreg.set1(r19->as_VMReg()); + tmp_vmreg.set2(r19->as_VMReg()); if (!is_critical_native) { for (int i = total_in_args - 1, c_arg = total_c_args - 1; i >= 0; i--, c_arg--) { diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp index 211baa9dc..ae7265dfc 100644 --- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp @@ -30,6 +30,7 @@ #include "runtime/java.hpp" #include "runtime/stubCodeGenerator.hpp" #include "vm_version_aarch64.hpp" +#include "runtime/arguments.hpp" #ifdef TARGET_OS_FAMILY_linux # include "os_linux.inline.hpp" #endif @@ -339,4 +340,6 @@ void VM_Version::initialize() { g.generate_getPsrInfo()); get_processor_features(); + + UNSUPPORTED_OPTION(CriticalJNINatives, "CriticalJNINatives"); } diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index bd789f637..a9eb3fb10 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -79,28 +79,6 @@ #endif #define DEFAULT_JAVA_LAUNCHER "generic" -// Disable options not supported in this release, with a warning if they -// were explicitly requested on the command-line -#define UNSUPPORTED_OPTION(opt, description) \ -do { \ - if (opt) { \ - if (FLAG_IS_CMDLINE(opt)) { \ - warning(description " is disabled in this release."); \ - } \ - FLAG_SET_DEFAULT(opt, false); \ - } \ -} while(0) - -#define UNSUPPORTED_GC_OPTION(gc) \ -do { \ - if (gc) { \ - if (FLAG_IS_CMDLINE(gc)) { \ - warning(#gc " is not supported in this VM. Using Serial GC."); \ - } \ - FLAG_SET_DEFAULT(gc, false); \ - } \ -} while(0) - char** Arguments::_jvm_flags_array = NULL; int Arguments::_num_jvm_flags = 0; char** Arguments::_jvm_args_array = NULL; diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp index 86c415e6a..a5cd59ea6 100644 --- a/hotspot/src/share/vm/runtime/arguments.hpp +++ b/hotspot/src/share/vm/runtime/arguments.hpp @@ -39,6 +39,28 @@ extern "C" { typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args) ATTRIBUTE_PRINTF(2, 0); } +// Disable options not supported in this release, with a warning if they +// were explicitly requested on the command-line +#define UNSUPPORTED_OPTION(opt, description) \ +do { \ + if (opt) { \ + if (FLAG_IS_CMDLINE(opt)) { \ + warning(description " is disabled in this release."); \ + } \ + FLAG_SET_DEFAULT(opt, false); \ + } \ +} while(0) + +#define UNSUPPORTED_GC_OPTION(gc) \ +do { \ + if (gc) { \ + if (FLAG_IS_CMDLINE(gc)) { \ + warning(#gc " is not supported in this VM. Using Serial GC."); \ + } \ + FLAG_SET_DEFAULT(gc, false); \ + } \ +} while(0) + // Forward declarations class SysClassPath; -- 2.19.0