8173795: AOT support in raw_exception_handler_for_return_address is broken
authordlong
Wed, 05 Apr 2017 13:15:44 -0700
changeset 46364 00a21c0ff97e
parent 46363 b53de34a044c
child 46366 b9a1aa504eb5
8173795: AOT support in raw_exception_handler_for_return_address is broken Summary: enable both AOT and nmethod code to take the same path Reviewed-by: kvn
hotspot/src/share/vm/aot/aotCompiledMethod.hpp
hotspot/src/share/vm/aot/aotLoader.cpp
hotspot/src/share/vm/aot/aotLoader.hpp
hotspot/src/share/vm/code/compiledMethod.hpp
hotspot/src/share/vm/runtime/sharedRuntime.cpp
--- a/hotspot/src/share/vm/aot/aotCompiledMethod.hpp	Wed Apr 05 01:11:25 2017 +0000
+++ b/hotspot/src/share/vm/aot/aotCompiledMethod.hpp	Wed Apr 05 13:15:44 2017 -0700
@@ -176,7 +176,7 @@
   virtual bool is_alive() const { return _is_alive(); }
   virtual bool is_in_use() const { return state() == in_use; }
 
-  address exception_begin() { return (address) _code + _meta->exception_handler_offset(); }
+  address exception_begin() const { return (address) _code + _meta->exception_handler_offset(); }
 
   virtual const char* name() const { return _name; }
 
--- a/hotspot/src/share/vm/aot/aotLoader.cpp	Wed Apr 05 01:11:25 2017 +0000
+++ b/hotspot/src/share/vm/aot/aotLoader.cpp	Wed Apr 05 13:15:44 2017 -0700
@@ -89,14 +89,6 @@
   }
 }
 
-address AOTLoader::exception_begin(JavaThread* thread, CodeBlob* blob, address return_address) {
-  assert(blob->is_aot(), "sanity");
-  AOTCompiledMethod* aotm = (AOTCompiledMethod*)blob;
-  // Set flag if return address is a method handle call site.
-  thread->set_is_method_handle_return(aotm->is_method_handle_return(return_address));
-  return aotm->exception_begin();
-}
-
 // Flushing and deoptimization in case of evolution
 void AOTLoader::flush_evol_dependents_on(InstanceKlass* dependee) {
   // make non entrant and mark for deoptimization
--- a/hotspot/src/share/vm/aot/aotLoader.hpp	Wed Apr 05 01:11:25 2017 +0000
+++ b/hotspot/src/share/vm/aot/aotLoader.hpp	Wed Apr 05 13:15:44 2017 -0700
@@ -63,7 +63,6 @@
   static uint64_t get_saved_fingerprint(InstanceKlass* ik) NOT_AOT({ return 0; });
   static void oops_do(OopClosure* f) NOT_AOT_RETURN;
   static void metadata_do(void f(Metadata*)) NOT_AOT_RETURN;
-  static address exception_begin(JavaThread* thread, CodeBlob* blob, address return_address) NOT_AOT({ return NULL; });
 
   NOT_PRODUCT( static void print_statistics() NOT_AOT_RETURN; )
 
--- a/hotspot/src/share/vm/code/compiledMethod.hpp	Wed Apr 05 01:11:25 2017 +0000
+++ b/hotspot/src/share/vm/code/compiledMethod.hpp	Wed Apr 05 13:15:44 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -272,6 +272,8 @@
   bool handler_table_contains(address addr) const { return handler_table_begin() <= addr && addr < handler_table_end(); }
   int handler_table_size() const { return handler_table_end() - handler_table_begin(); }
 
+  virtual address exception_begin() const = 0;
+
   virtual address nul_chk_table_begin() const = 0;
   virtual address nul_chk_table_end() const = 0;
   bool nul_chk_table_contains(address addr) const { return nul_chk_table_begin() <= addr && addr < nul_chk_table_end(); }
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Apr 05 01:11:25 2017 +0000
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Apr 05 13:15:44 2017 -0700
@@ -482,7 +482,7 @@
 
   // The fastest case first
   CodeBlob* blob = CodeCache::find_blob(return_address);
-  nmethod* nm = (blob != NULL) ? blob->as_nmethod_or_null() : NULL;
+  CompiledMethod* nm = (blob != NULL) ? blob->as_compiled_method_or_null() : NULL;
   if (nm != NULL) {
     // Set flag if return address is a method handle call site.
     thread->set_is_method_handle_return(nm->is_method_handle_return(return_address));
@@ -506,13 +506,6 @@
     }
   }
 
-#if INCLUDE_AOT
-  if (UseAOT && blob->is_aot()) {
-    // AOT Compiled code
-    return AOTLoader::exception_begin(thread, blob, return_address);
-  }
-#endif
-
   // Entry code
   if (StubRoutines::returns_to_call_stub(return_address)) {
     return StubRoutines::catch_exception_entry();