changeset 57047:685200a5cea7 lworld

8230960: [lworld] x86: Fix fast class initialization checks after merge
author thartmann
date Mon, 16 Sep 2019 13:32:58 +0200
parents ff8e4784d98c
children 7606cdf58ddd
files src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp src/hotspot/share/runtime/sharedRuntime.cpp
diffstat 2 files changed, 24 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp	Fri Sep 13 14:44:57 2019 +0200
+++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp	Mon Sep 16 13:32:58 2019 +0200
@@ -772,29 +772,6 @@
                             int& frame_complete,
                             int& frame_size_in_words,
                             bool alloc_value_receiver) {
-  // Class initialization barrier for static methods
-  if (VM_Version::supports_fast_class_init_checks()) {
-    Label L_skip_barrier;
-    Register method = rbx;
-
-    { // Bypass the barrier for non-static methods
-      Register flags  = rscratch1;
-      __ movl(flags, Address(method, Method::access_flags_offset()));
-      __ testl(flags, JVM_ACC_STATIC);
-      __ jcc(Assembler::zero, L_skip_barrier); // non-static
-    }
-
-    Register klass = rscratch1;
-    __ load_method_holder(klass, method);
-    __ clinit_barrier(klass, r15_thread, &L_skip_barrier /*L_fast_path*/);
-
-    __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); // slow path
-
-    __ bind(L_skip_barrier);
-   // TODO fix this
-   // c2i_no_clinit_check_entry = __ pc();
-  }
-
   // Before we get into the guts of the C2I adapter, see if we should be here
   // at all.  We've come from compiled code and are attempting to jump to the
   // interpreter, which means the caller made a static call to get here
@@ -1260,6 +1237,29 @@
   // Scalarized c2i adapter
   address c2i_entry = __ pc();
 
+  // Class initialization barrier for static methods
+  address c2i_no_clinit_check_entry = NULL;
+  if (VM_Version::supports_fast_class_init_checks()) {
+    Label L_skip_barrier;
+    Register method = rbx;
+
+    { // Bypass the barrier for non-static methods
+      Register flags  = rscratch1;
+      __ movl(flags, Address(method, Method::access_flags_offset()));
+      __ testl(flags, JVM_ACC_STATIC);
+      __ jcc(Assembler::zero, L_skip_barrier); // non-static
+    }
+
+    Register klass = rscratch1;
+    __ load_method_holder(klass, method);
+    __ clinit_barrier(klass, r15_thread, &L_skip_barrier /*L_fast_path*/);
+
+    __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); // slow path
+
+    __ bind(L_skip_barrier);
+    c2i_no_clinit_check_entry = __ pc();
+  }
+
   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
   bs->c2i_entry_barrier(masm);
 
@@ -1279,10 +1279,6 @@
     gen_c2i_adapter(masm, sig, regs, value_entry_skip_fixup, i2c_entry, oop_maps, frame_complete, frame_size_in_words, false);
   }
 
-  // TODO fix this
-  // Class initialization barrier for static methods
-  address c2i_no_clinit_check_entry = NULL;
-
   __ flush();
 
   // The c2i adapters might safepoint and trigger a GC. The caller must make sure that
--- a/src/hotspot/share/runtime/sharedRuntime.cpp	Fri Sep 13 14:44:57 2019 +0200
+++ b/src/hotspot/share/runtime/sharedRuntime.cpp	Mon Sep 16 13:32:58 2019 +0200
@@ -1496,8 +1496,7 @@
     guarantee(callee != NULL && callee->is_method(), "bad handshake");
     thread->set_vm_result_2(callee);
     thread->set_callee_target(NULL);
-    // TODO fix this
-    if (false && caller_frame.is_entry_frame() && VM_Version::supports_fast_class_init_checks()) {
+    if (caller_frame.is_entry_frame() && VM_Version::supports_fast_class_init_checks()) {
       // Bypass class initialization checks in c2i when caller is in native.
       // JNI calls to static methods don't have class initialization checks.
       // Fast class initialization checks are present in c2i adapters and call into