8210220: [AOT] jdwp test cases are failing with error # ERROR: TEST FAILED: Cought IOException while receiving event packet
authorkvn
Thu, 13 Sep 2018 15:27:21 -0700
changeset 51731 8745f8f1b0f8
parent 51730 cd0775f67ab0
child 51732 dc68380e6497
8210220: [AOT] jdwp test cases are failing with error # ERROR: TEST FAILED: Cought IOException while receiving event packet Summary: don't register AOT method if corresponding java method has breakpoints. Reviewed-by: dlong
src/hotspot/share/aot/aotCodeHeap.cpp
src/hotspot/share/aot/aotCodeHeap.hpp
src/hotspot/share/aot/aotCompiledMethod.cpp
src/hotspot/share/aot/aotCompiledMethod.hpp
src/hotspot/share/aot/aotLoader.cpp
src/hotspot/share/aot/aotLoader.hpp
--- a/src/hotspot/share/aot/aotCodeHeap.cpp	Thu Sep 13 13:41:17 2018 -0700
+++ b/src/hotspot/share/aot/aotCodeHeap.cpp	Thu Sep 13 15:27:21 2018 -0700
@@ -38,6 +38,7 @@
 #include "oops/method.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/os.hpp"
+#include "runtime/safepointVerifiers.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/vm_operations.hpp"
 
@@ -298,15 +299,25 @@
 void AOTCodeHeap::publish_aot(const methodHandle& mh, AOTMethodData* method_data, int code_id) {
   // The method may be explicitly excluded by the user.
   // Or Interpreter uses an intrinsic for this method.
-  if (CompilerOracle::should_exclude(mh) || !AbstractInterpreter::can_be_compiled(mh)) {
+  // Or method has breakpoints.
+  if (CompilerOracle::should_exclude(mh) ||
+      !AbstractInterpreter::can_be_compiled(mh) ||
+      (mh->number_of_breakpoints() > 0)) {
     return;
   }
+  // Make sure no break points were set in the method in case of a safepoint
+  // in the following code until aot code is registered.
+  NoSafepointVerifier nsv;
 
   address code = method_data->_code;
   const char* name = method_data->_name;
   aot_metadata* meta = method_data->_meta;
 
   if (meta->scopes_pcs_begin() == meta->scopes_pcs_end()) {
+    // Switch off NoSafepointVerifier because log_info() may cause safepoint
+    // and it is fine because aot code will not be registered here.
+    PauseNoSafepointVerifier pnsv(&nsv);
+
     // When the AOT compiler compiles something big we fail to generate metadata
     // in CodeInstaller::gather_metadata. In that case the scopes_pcs_begin == scopes_pcs_end.
     // In all successful cases we always have 2 entries of scope pcs.
@@ -343,6 +354,7 @@
 #endif
     Method::set_code(mh, aot);
     if (PrintAOT || (PrintCompilation && PrintAOT)) {
+      PauseNoSafepointVerifier pnsv(&nsv); // aot code is registered already
       aot->print_on(tty, NULL);
     }
     // Publish oop only after we are visible to CompiledMethodIterator
@@ -918,16 +930,6 @@
 }
 #endif
 
-void AOTCodeHeap::flush_evol_dependents_on(InstanceKlass* dependee) {
-  for (int index = 0; index < _method_count; index++) {
-    if (_code_to_aot[index]._state != in_use) {
-      continue; // Skip uninitialized entries.
-    }
-    AOTCompiledMethod* aot = _code_to_aot[index]._aot;
-    aot->flush_evol_dependents_on(dependee);
-  }
-}
-
 void AOTCodeHeap::metadata_do(void f(Metadata*)) {
   for (int index = 0; index < _method_count; index++) {
     if (_code_to_aot[index]._state != in_use) {
--- a/src/hotspot/share/aot/aotCodeHeap.hpp	Thu Sep 13 13:41:17 2018 -0700
+++ b/src/hotspot/share/aot/aotCodeHeap.hpp	Thu Sep 13 15:27:21 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -283,8 +283,6 @@
 
   DEBUG_ONLY( int verify_icholder_relocations(); )
 
-  void flush_evol_dependents_on(InstanceKlass* dependee);
-
   void alive_methods_do(void f(CompiledMethod* nm));
 
 #ifndef PRODUCT
--- a/src/hotspot/share/aot/aotCompiledMethod.cpp	Thu Sep 13 13:41:17 2018 -0700
+++ b/src/hotspot/share/aot/aotCompiledMethod.cpp	Thu Sep 13 15:27:21 2018 -0700
@@ -243,16 +243,6 @@
 }
 #endif // TIERED
 
-// We don't have full dependencies for AOT methods, so flushing is
-// more conservative than for nmethods.
-void AOTCompiledMethod::flush_evol_dependents_on(InstanceKlass* dependee) {
-  if (is_java_method()) {
-    clear_inline_caches();
-    mark_for_deoptimization();
-    make_not_entrant();
-  }
-}
-
 // Iterate over metadata calling this function.   Used by RedefineClasses
 // Copied from nmethod::metadata_do
 void AOTCompiledMethod::metadata_do(void f(Metadata*)) {
--- a/src/hotspot/share/aot/aotCompiledMethod.hpp	Thu Sep 13 13:41:17 2018 -0700
+++ b/src/hotspot/share/aot/aotCompiledMethod.hpp	Thu Sep 13 15:27:21 2018 -0700
@@ -238,11 +238,6 @@
   address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); }
   void    set_original_pc(const frame* fr, address pc) { *orig_pc_addr(fr) = pc; }
 
-#ifdef HOTSWAP
-  // Flushing and deoptimization in case of evolution
-  void flush_evol_dependents_on(InstanceKlass* dependee);
-#endif // HOTSWAP
-
   virtual void metadata_do(void f(Metadata*));
 
   bool metadata_got_contains(Metadata **p) {
--- a/src/hotspot/share/aot/aotLoader.cpp	Thu Sep 13 13:41:17 2018 -0700
+++ b/src/hotspot/share/aot/aotLoader.cpp	Thu Sep 13 15:27:21 2018 -0700
@@ -101,15 +101,6 @@
   }
 }
 
-// Flushing and deoptimization in case of evolution
-void AOTLoader::flush_evol_dependents_on(InstanceKlass* dependee) {
-  // make non entrant and mark for deoptimization
-  FOR_ALL_AOT_HEAPS(heap) {
-    (*heap)->flush_evol_dependents_on(dependee);
-  }
-  Deoptimization::deoptimize_dependents();
-}
-
 /**
  * List of core modules for which we search for shared libraries.
  */
--- a/src/hotspot/share/aot/aotLoader.hpp	Thu Sep 13 13:41:17 2018 -0700
+++ b/src/hotspot/share/aot/aotLoader.hpp	Thu Sep 13 15:27:21 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,11 +68,6 @@
 
   NOT_PRODUCT( static void print_statistics() NOT_AOT_RETURN; )
 
-#ifdef HOTSWAP
-  // Flushing and deoptimization in case of evolution
-  static void flush_evol_dependents_on(InstanceKlass* dependee) NOT_AOT_RETURN;
-#endif // HOTSWAP
-
   static bool reconcile_dynamic_invoke(InstanceKlass* holder, int index, Method* adapter_method, Klass *appendix_klass) NOT_AOT({ return true; });
 };