JDK-8262256 : C2 intrinsincs should not modify IR when bailing out
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,16,17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-02-23
  • Updated: 2021-03-11
  • Resolved: 2021-03-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b13Fixed
Related Reports
Relates :  
Relates :  
Description
The following assert triggers when running test/hotspot/jtreg/compiler/unsafe/OpaqueAccesses.java

--- a/src/hotspot/share/opto/library_call.cpp
+++ b/src/hotspot/share/opto/library_call.cpp
@@ -108,7 +108,9 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) {
 #endif
   ciMethod* callee = kit.callee();
   const int bci    = kit.bci();
-
+#ifdef ASSERT
+  Node* ctrl = kit.control();
+#endif
   // Try to inline the intrinsic.
   if ((CheckIntrinsics ? callee->intrinsic_candidate() : true) &&
       kit.try_to_inline(_last_predicate)) {
@@ -132,6 +134,7 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) {
   }
 
   // The intrinsic bailed out
+  assert(ctrl == kit.control(), "Control flow was added although we bailed out");
   if (jvms->has_method()) {
     // Not a root compile.
     const char* msg;

Comments
Changeset: 54dfd79c Author: Tobias Hartmann <thartmann@openjdk.org> Date: 2021-03-03 11:30:52 +0000 URL: https://git.openjdk.java.net/jdk/commit/54dfd79c
03-03-2021

The problem is that LibraryCallKit::make_unsafe_address adds control flow when the caller might still bail out from intrinsification. Code was added by JDK-8181211 and JDK-8176506.
26-02-2021

ILW = C2 emits intrinsic code even when bailing out (could lead to failures like JDK-8262231), with unsafe accesses, disable affected intrinsic = MLM = P4
23-02-2021