< prev index next >

src/hotspot/share/prims/jvm.cpp

Print this page

        

@@ -58,10 +58,11 @@
 #include "prims/jvmtiThreadState.hpp"
 #include "prims/nativeLookup.hpp"
 #include "prims/stackwalk.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/atomic.hpp"
+#include "runtime/continuation.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/init.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/handshake.hpp"

@@ -530,14 +531,16 @@
 
 
 // java.lang.Throwable //////////////////////////////////////////////////////
 
 
-JVM_ENTRY(void, JVM_FillInStackTrace(JNIEnv *env, jobject receiver))
+JVM_ENTRY(void, JVM_FillInStackTrace(JNIEnv *env, jobject receiver, jobject contScope))
   JVMWrapper("JVM_FillInStackTrace");
   Handle exception(thread, JNIHandles::resolve_non_null(receiver));
-  java_lang_Throwable::fill_in_stack_trace(exception);
+  Handle scope(thread, JNIHandles::resolve(contScope));
+  
+  java_lang_Throwable::fill_in_stack_trace(exception, scope);
 JVM_END
 
 
 // java.lang.StackTraceElement //////////////////////////////////////////////
 

@@ -562,20 +565,21 @@
 
 // java.lang.StackWalker //////////////////////////////////////////////////////
 
 
 JVM_ENTRY(jobject, JVM_CallStackWalk(JNIEnv *env, jobject stackStream, jlong mode,
-                                     jint skip_frames, jint frame_count, jint start_index,
-                                     jobjectArray frames))
+                                     jint skip_frames, jobject contScope, jobject cont,
+                                     jint frame_count, jint start_index, jobjectArray frames))
   JVMWrapper("JVM_CallStackWalk");
   JavaThread* jt = (JavaThread*) THREAD;
   if (!jt->is_Java_thread() || !jt->has_last_Java_frame()) {
     THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: no stack trace", NULL);
   }
 
   Handle stackStream_h(THREAD, JNIHandles::resolve_non_null(stackStream));
-
+  Handle contScope_h(THREAD, JNIHandles::resolve(contScope));
+  Handle cont_h(THREAD, JNIHandles::resolve(cont));
   // frames array is a Class<?>[] array when only getting caller reference,
   // and a StackFrameInfo[] array (or derivative) otherwise. It should never
   // be null.
   objArrayOop fa = objArrayOop(JNIHandles::resolve_non_null(frames));
   objArrayHandle frames_array_h(THREAD, fa);

@@ -583,21 +587,20 @@
   int limit = start_index + frame_count;
   if (frames_array_h->length() < limit) {
     THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), "not enough space in buffers", NULL);
   }
 
-  oop result = StackWalk::walk(stackStream_h, mode, skip_frames, frame_count,
-                               start_index, frames_array_h, CHECK_NULL);
+  oop result = StackWalk::walk(stackStream_h, mode, skip_frames, contScope_h, cont_h,
+                               frame_count, start_index, frames_array_h, CHECK_NULL);
   return JNIHandles::make_local(env, result);
 JVM_END
 
 
 JVM_ENTRY(jint, JVM_MoreStackWalk(JNIEnv *env, jobject stackStream, jlong mode, jlong anchor,
-                                  jint frame_count, jint start_index,
+                                  jint frame_count, jint start_index, 
                                   jobjectArray frames))
   JVMWrapper("JVM_MoreStackWalk");
-  JavaThread* jt = (JavaThread*) THREAD;
 
   // frames array is a Class<?>[] array when only getting caller reference,
   // and a StackFrameInfo[] array (or derivative) otherwise. It should never
   // be null.
   objArrayOop fa = objArrayOop(JNIHandles::resolve_non_null(frames));

@@ -607,12 +610,23 @@
   if (frames_array_h->length() < limit) {
     THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "not enough space in buffers");
   }
 
   Handle stackStream_h(THREAD, JNIHandles::resolve_non_null(stackStream));
-  return StackWalk::fetchNextBatch(stackStream_h, mode, anchor, frame_count,
-                                   start_index, frames_array_h, THREAD);
+  return StackWalk::fetchNextBatch(stackStream_h, mode, anchor, frame_count, 
+                                  start_index, frames_array_h, THREAD);
+JVM_END
+
+JVM_ENTRY(void, JVM_SetStackWalkContinuation(JNIEnv *env, jobject stackStream, jlong anchor, jobjectArray frames, jobject cont))
+    JVMWrapper("JVM_SetStackWalkContinuation");
+
+    objArrayOop fa = objArrayOop(JNIHandles::resolve_non_null(frames));
+    objArrayHandle frames_array_h(THREAD, fa);
+    Handle stackStream_h(THREAD, JNIHandles::resolve_non_null(stackStream));
+    Handle cont_h(THREAD, JNIHandles::resolve_non_null(cont));
+
+    StackWalk::setContinuation(stackStream_h, anchor, frames_array_h, cont_h, THREAD);
 JVM_END
 
 // java.lang.Object ///////////////////////////////////////////////
 
 

@@ -704,10 +718,16 @@
   }
 
   return JNIHandles::make_local(env, new_obj());
 JVM_END
 
+// java.lang.Continuation /////////////////////////////////////////////////////
+
+JVM_ENTRY(void, JVM_RegisterContinuationMethods(JNIEnv *env, jclass cls))
+  CONT_RegisterNativeMethods(env, cls);
+JVM_END
+
 // java.io.File ///////////////////////////////////////////////////////////////
 
 JVM_LEAF(char*, JVM_NativePath(char* path))
   JVMWrapper("JVM_NativePath");
   return os::native_path(path);

@@ -3665,5 +3685,33 @@
 JVM_END
 
 JVM_ENTRY_NO_ENV(jint, JVM_FindSignal(const char *name))
   return os::get_signal_number(name);
 JVM_END
+
+JVM_ENTRY(void, JVM_FiberStarted(JNIEnv* env, jclass fiber_class, jthread event_hread, jobject fiber))
+  JVMWrapper("JVM_FiberStarted");
+  if (JvmtiExport::should_post_fiber_scheduled()) {
+    JvmtiExport::post_fiber_scheduled(event_hread, fiber);
+  }
+JVM_END
+
+JVM_ENTRY(void, JVM_FiberTerminated(JNIEnv* env, jclass fiber_class, jthread event_hread, jobject fiber))
+  JVMWrapper("JVM_FiberTerminated");
+  if (JvmtiExport::should_post_fiber_terminated()) {
+    JvmtiExport::post_fiber_terminated(event_hread, fiber);
+  }
+JVM_END
+
+JVM_ENTRY(void, JVM_FiberMount(JNIEnv* env, jclass fiber_class, jthread event_hread, jobject fiber))
+  JVMWrapper("JVM_FiberMount");
+  if (JvmtiExport::should_post_fiber_mount()) {
+    JvmtiExport::post_fiber_mount(event_hread, fiber);
+  }
+JVM_END
+
+JVM_ENTRY(void, JVM_FiberUnmount(JNIEnv* env, jclass fiber_class, jthread event_hread, jobject fiber))
+  JVMWrapper("JVM_FiberUnmount");
+  if (JvmtiExport::should_post_fiber_unmount()) {
+    JvmtiExport::post_fiber_unmount(event_hread, fiber);
+  }
+JVM_END
< prev index next >