From c646efc366342564baebd2f17133e14780abcaa8 Mon Sep 17 00:00:00 2001 From: Leonid Mesnik Date: Tue, 20 Aug 2024 18:41:15 +0000 Subject: [PATCH] 8205957: setfldw001/TestDescription.java fails with bad field value Reviewed-by: sspitsyn, dlong --- src/hotspot/share/runtime/javaCalls.cpp | 46 +++++++++++-------- test/hotspot/jtreg/ProblemList-Xcomp.txt | 5 -- .../setfmodw001/TestDescription.java | 8 ---- 3 files changed, 26 insertions(+), 33 deletions(-) diff --git a/src/hotspot/share/runtime/javaCalls.cpp b/src/hotspot/share/runtime/javaCalls.cpp index 0ae0d4540e4..b3b7b6f6834 100644 --- a/src/hotspot/share/runtime/javaCalls.cpp +++ b/src/hotspot/share/runtime/javaCalls.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -357,14 +357,6 @@ void JavaCalls::call_helper(JavaValue* result, const methodHandle& method, JavaC CompilationPolicy::compile_if_required(method, CHECK); - // Since the call stub sets up like the interpreter we call the from_interpreted_entry - // so we can go compiled via a i2c. Otherwise initial entry method will always - // run interpreted. - address entry_point = method->from_interpreted_entry(); - if (JvmtiExport::can_post_interpreter_events() && thread->is_interp_only_mode()) { - entry_point = method->interpreter_entry(); - } - // Figure out if the result value is an oop or not (Note: This is a different value // than result_type. result_type will be T_INT of oops. (it is about size) BasicType result_type = runtime_type_from(result); @@ -398,20 +390,34 @@ void JavaCalls::call_helper(JavaValue* result, const methodHandle& method, JavaC // the call to call_stub, the optimizer produces wrong code. intptr_t* result_val_address = (intptr_t*)(result->get_value_addr()); intptr_t* parameter_address = args->parameters(); + + address entry_point; + { + // The enter_interp_only_mode use handshake to set interp_only mode + // so no safepoint should be allowed between is_interp_only_mode() and call + NoSafepointVerifier nsv; + if (JvmtiExport::can_post_interpreter_events() && thread->is_interp_only_mode()) { + entry_point = method->interpreter_entry(); + } else { + // Since the call stub sets up like the interpreter we call the from_interpreted_entry + // so we can go compiled via a i2c. + entry_point = method->from_interpreted_entry(); #if INCLUDE_JVMCI - // Gets the alternative target (if any) that should be called - Handle alternative_target = args->alternative_target(); - if (!alternative_target.is_null()) { - // Must extract verified entry point from HotSpotNmethod after VM to Java - // transition in JavaCallWrapper constructor so that it is safe with - // respect to nmethod sweeping. - address verified_entry_point = (address) HotSpotJVMCI::InstalledCode::entryPoint(nullptr, alternative_target()); - if (verified_entry_point != nullptr) { - thread->set_jvmci_alternate_call_target(verified_entry_point); - entry_point = method->adapter()->get_i2c_entry(); + // Gets the alternative target (if any) that should be called + Handle alternative_target = args->alternative_target(); + if (!alternative_target.is_null()) { + // Must extract verified entry point from HotSpotNmethod after VM to Java + // transition in JavaCallWrapper constructor so that it is safe with + // respect to nmethod sweeping. + address verified_entry_point = (address) HotSpotJVMCI::InstalledCode::entryPoint(nullptr, alternative_target()); + if (verified_entry_point != nullptr) { + thread->set_jvmci_alternate_call_target(verified_entry_point); + entry_point = method->adapter()->get_i2c_entry(); + } + } +#endif } } -#endif StubRoutines::call_stub()( (address)&link, // (intptr_t*)&(result->_value), // see NOTE above (compiler problem) diff --git a/test/hotspot/jtreg/ProblemList-Xcomp.txt b/test/hotspot/jtreg/ProblemList-Xcomp.txt index 5617ea0efa6..9d91cad1dde 100644 --- a/test/hotspot/jtreg/ProblemList-Xcomp.txt +++ b/test/hotspot/jtreg/ProblemList-Xcomp.txt @@ -29,11 +29,6 @@ vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java 8287324 generic-all -vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/TestDescription.java#id0 8205957 generic-all -vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/TestDescription.java#logging 8205957 generic-all -vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/TestDescription.java#id0 8205957 generic-all -vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/TestDescription.java#logging 8205957 generic-all - vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/TestDescription.java 8245680 windows-x64 vmTestbase/vm/mlvm/mixed/stress/regression/b6969574/INDIFY_Test.java 8265295 linux-x64,windows-x64 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/TestDescription.java index d0cbdc288b4..e52340e7722 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/TestDescription.java @@ -47,11 +47,3 @@ * /test/lib * @run main/othervm/native -agentlib:setfmodw001 nsk.jvmti.SetFieldModificationWatch.setfmodw001 */ - -/* - * @test id=logging - * - * @library /vmTestbase - * /test/lib - * @run main/othervm/native -agentlib:setfmodw001 -XX:TraceJVMTI=ec+,+ioe,+s -Xlog:jvmti=trace:file=vm.%p.log nsk.jvmti.SetFieldModificationWatch.setfmodw001 - */