changeset 51682:56b9d21a4543 cont

entry_method using vmIntrinsics
author rbackman
date Thu, 13 Sep 2018 09:24:02 +0200
parents 3800d7e9730c
children 604f34b6c6cf
files src/hotspot/share/classfile/vmSymbols.hpp src/hotspot/share/runtime/continuation.cpp src/hotspot/share/runtime/continuation.hpp src/java.base/share/classes/java/lang/Continuation.java
diffstat 4 files changed, 4 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/classfile/vmSymbols.hpp	Wed Sep 12 11:25:47 2018 +0200
+++ b/src/hotspot/share/classfile/vmSymbols.hpp	Thu Sep 13 09:24:02 2018 +0200
@@ -1085,7 +1085,8 @@
                                                                                                                         \
   /* java/lang/Continuation */                                                                                                 \
   do_class(java_lang_Continuation,                      "java/lang/Continuation")                                              \
-  do_alias(continuationEnter_signature,                           void_method_signature)                                       \
+  do_intrinsic(_Continuation_enter,  java_lang_Continuation,       enter_name,    continuationEnter_signature, F_R)            \
+    do_alias(continuationEnter_signature,                           void_method_signature)                                     \
   do_signature(continuationGetStacks_signature,                   "(III)V")                                                    \
   do_alias(continuationOnPinned_signature,                        int_void_signature)                                          \
   do_intrinsic(_Continuation_getSP,  java_lang_Continuation,       getSP_name,    continuationGetSP_signature, F_S)            \
--- a/src/hotspot/share/runtime/continuation.cpp	Wed Sep 12 11:25:47 2018 +0200
+++ b/src/hotspot/share/runtime/continuation.cpp	Thu Sep 13 09:24:02 2018 +0200
@@ -1842,9 +1842,6 @@
 
   HandleMark hm(thread);
 
-  // call here, when we know we can handle safepoints, to initialize Continuation::_entry_method
-  // potentially racy, but benign
-  Continuation::entry_method(thread);
   if (thread->has_pending_exception()) {
     fi->fp = NULL; fi->sp = NULL; fi->pc = NULL;
     log_trace(jvmcont)("=== end of freeze (fail 0)");
@@ -2381,28 +2378,13 @@
   thaw1(JavaThread::current(), fi, return_barrier);
 JRT_END
 
-Method* Continuation::_entry_method = NULL;
-
-Method* Continuation::entry_method(Thread* THREAD) {
-  if (_entry_method == NULL) {
-    CallInfo callinfo;
-    Klass* recvrKlass = SystemDictionary::resolve_or_null(vmSymbols::java_lang_Continuation(), THREAD); // SystemDictionary::Continuation_klass();
-    LinkInfo link_info(recvrKlass, vmSymbols::enter_name(), vmSymbols::continuationEnter_signature());
-    LinkResolver::resolve_special_call(callinfo, Handle(), link_info, THREAD);
-    methodHandle method = callinfo.selected_method();
-    assert(method.not_null(), "should have thrown exception");
-    _entry_method = method();
-  }
-  return _entry_method;
-}
-
 bool Continuation::is_continuation_entry_frame(const frame& f) {
   Method* m = frame_method(f);
   if (m == NULL)
     return false;
 
   // we can do this because the entry frame is never inlined
-  return m == _entry_method;
+  return m->intrinsic_id() == vmIntrinsics::_Continuation_enter;
 }
 // When walking the virtual stack, this method returns true
 // iff the frame is a thawed continuation frame whose
--- a/src/hotspot/share/runtime/continuation.hpp	Wed Sep 12 11:25:47 2018 +0200
+++ b/src/hotspot/share/runtime/continuation.hpp	Thu Sep 13 09:24:02 2018 +0200
@@ -52,10 +52,6 @@
 };
 
 class Continuation : AllStatic {
-private:
-  static Method* _entry_method;
-  static Method* entry_method(Thread*);
-
 public:
   static int freeze(JavaThread* thread, FrameInfo* fi);
   static int prepare_thaw(FrameInfo* fi, bool return_barrier);
--- a/src/java.base/share/classes/java/lang/Continuation.java	Wed Sep 12 11:25:47 2018 +0200
+++ b/src/java.base/share/classes/java/lang/Continuation.java	Thu Sep 13 09:24:02 2018 +0200
@@ -197,6 +197,7 @@
     /**
      * TBD
      */
+    @HotSpotIntrinsicCandidate
     @DontInline
     private void enter() {
         // This method runs in the "entry frame".