Guest User

Untitled

a guest
May 21st, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.74 KB | None | 0 0
  1. From nick@nicksieger.com Tue Apr 06 22:28:02 2010
  2. Content-Type: text/plain; charset="us-ascii"
  3. MIME-Version: 1.0
  4. Content-Transfer-Encoding: 7bit
  5. Subject: [PATCH] Add minimal bits to get coro patch to compile on Mac OSX SL
  6. X-Mercurial-Node: 77819688cf2d743032bbadfad18f04f27158dccf
  7. Message-Id: <77819688cf2d743032bb.1270610881@vanguard.local>
  8. User-Agent: Mercurial-patchbomb/1.3.1
  9. Date: Wed, 07 Apr 2010 03:28:01 -0000
  10. From: Nick Sieger <nick@nicksieger.com>
  11. To: mlvm-dev@openjdk.java.net
  12.  
  13. # HG changeset patch
  14. # User Nick Sieger <nick@nicksieger.com>
  15. # Date 1270610516 18000
  16. # Node ID 77819688cf2d743032bbadfad18f04f27158dccf
  17. # Parent 90fe8277ed0f7663d1fe2f5bc390287df5cd73c8
  18. Add minimal bits to get coro patch to compile on Mac OSX SL
  19.  
  20. diff --git a/coro.patch b/coro.patch
  21. --- a/coro.patch
  22. +++ b/coro.patch
  23. @@ -1,7 +1,7 @@
  24. diff --git a/src/cpu/x86/vm/assembler_x86.hpp b/src/cpu/x86/vm/assembler_x86.hpp
  25. --- a/src/cpu/x86/vm/assembler_x86.hpp
  26. +++ b/src/cpu/x86/vm/assembler_x86.hpp
  27. -@@ -653,7 +653,7 @@ private:
  28. +@@ -653,7 +653,7 @@
  29.  
  30.  
  31. // Instruction prefixes
  32. @@ -13,7 +13,7 @@
  33. diff --git a/src/cpu/x86/vm/frame_x86.cpp b/src/cpu/x86/vm/frame_x86.cpp
  34. --- a/src/cpu/x86/vm/frame_x86.cpp
  35. +++ b/src/cpu/x86/vm/frame_x86.cpp
  36. -@@ -289,7 +289,8 @@ BasicObjectLock* frame::interpreter_fram
  37. +@@ -289,7 +289,8 @@
  38. }
  39.  
  40. BasicObjectLock* frame::interpreter_frame_monitor_end() const {
  41. @@ -38,7 +38,7 @@
  42. diff --git a/src/cpu/x86/vm/frame_x86.inline.hpp b/src/cpu/x86/vm/frame_x86.inline.hpp
  43. --- a/src/cpu/x86/vm/frame_x86.inline.hpp
  44. +++ b/src/cpu/x86/vm/frame_x86.inline.hpp
  45. -@@ -33,6 +33,7 @@ inline frame::frame() {
  46. +@@ -33,6 +33,7 @@
  47. _fp = NULL;
  48. _cb = NULL;
  49. _deopt_state = unknown;
  50. @@ -46,7 +46,7 @@
  51. }
  52.  
  53. inline frame::frame(intptr_t* sp, intptr_t* fp, address pc) {
  54. -@@ -50,6 +51,25 @@ inline frame::frame(intptr_t* sp, intptr
  55. +@@ -50,6 +51,25 @@
  56. } else {
  57. _deopt_state = not_deoptimized;
  58. }
  59. @@ -72,7 +72,7 @@
  60. }
  61.  
  62. inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc) {
  63. -@@ -68,6 +88,7 @@ inline frame::frame(intptr_t* sp, intptr
  64. +@@ -68,6 +88,7 @@
  65. } else {
  66. _deopt_state = not_deoptimized;
  67. }
  68. @@ -80,7 +80,7 @@
  69. }
  70.  
  71. inline frame::frame(intptr_t* sp, intptr_t* fp) {
  72. -@@ -96,6 +117,7 @@ inline frame::frame(intptr_t* sp, intptr
  73. +@@ -96,6 +117,7 @@
  74. } else {
  75. _deopt_state = not_deoptimized;
  76. }
  77. @@ -91,7 +91,7 @@
  78. diff --git a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp
  79. --- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp
  80. +++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp
  81. -@@ -1182,6 +1182,9 @@ void SharedRuntime::restore_native_resul
  82. +@@ -1182,6 +1182,9 @@
  83. }
  84. }
  85.  
  86. @@ -101,7 +101,7 @@
  87. // ---------------------------------------------------------------------------
  88. // Generate a native wrapper for a given method. The method takes arguments
  89. // in the Java compiled code convention, marshals them to the native
  90. -@@ -1366,6 +1369,18 @@ nmethod *SharedRuntime::generate_native_
  91. +@@ -1366,6 +1369,18 @@
  92. __ bind (slowCase);
  93. }
  94. #endif // COMPILER1
  95. @@ -120,7 +120,7 @@
  96.  
  97. // The instruction at the verified entry point must be 5 bytes or longer
  98. // because it can be patched on the fly by make_non_entrant. The stack bang
  99. -@@ -3078,3 +3093,381 @@ void SharedRuntime::generate_stubs() {
  100. +@@ -3078,3 +3093,381 @@
  101. generate_uncommon_trap_blob();
  102. #endif // COMPILER2
  103. }
  104. @@ -451,10 +451,10 @@
  105. + __ get_thread(rax);
  106. + // set new handle and resource areas
  107. + __ movptr(temp, Address(target_coroutine, Coroutine::handle_area_offset()));
  108. -+ __ movptr(Address(target_coroutine, Coroutine::handle_area_offset()), NULL); // TODO is this really needed?
  109. ++ __ movptr(Address(target_coroutine, Coroutine::handle_area_offset()), (RegisterImpl*)NULL); // TODO is this really needed?
  110. + __ movptr(Address(thread, Thread::handle_area_offset()), temp);
  111. + __ movptr(temp, Address(target_coroutine, Coroutine::resource_area_offset()));
  112. -+ __ movptr(Address(target_coroutine, Coroutine::resource_area_offset()), NULL); // TODO is this really needed?
  113. ++ __ movptr(Address(target_coroutine, Coroutine::resource_area_offset()), (RegisterImpl*)NULL); // TODO is this really needed?
  114. + __ movptr(Address(thread, Thread::resource_area_offset()), temp);
  115. +
  116. + // update the thread's stack base and size
  117. @@ -496,16 +496,16 @@
  118. + // slow case (terminate old coroutine)
  119. + __ get_thread(rax);
  120. + __ movptr(rcx, Address(rax, JavaThread::coroutine_temp_offset()));
  121. -+ __ movptr(Address(rax, JavaThread::coroutine_temp_offset()), NULL);
  122. -+ __ movptr(rdx, 0);
  123. ++ __ movptr(Address(rax, JavaThread::coroutine_temp_offset()), (RegisterImpl*)NULL);
  124. ++ __ movptr(rdx, (RegisterImpl*)NULL);
  125. +
  126. + }
  127. + }
  128. +}
  129. -diff --git a/src/os_cpu/linux_x86/vm/threadLS_linux_x86.cpp b/src/os_cpu/linux_x86/vm/threadLS_linux_x86.cpp
  130. ---- a/src/os_cpu/linux_x86/vm/threadLS_linux_x86.cpp
  131. -+++ b/src/os_cpu/linux_x86/vm/threadLS_linux_x86.cpp
  132. -@@ -89,3 +89,26 @@ void ThreadLocalStorage::pd_set_thread(T
  133. +diff --git a/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp b/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp
  134. +--- a/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp
  135. ++++ b/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp
  136. +@@ -89,3 +89,25 @@
  137. }
  138. #endif // !AMD64
  139. }
  140. @@ -531,11 +531,40 @@
  141. + }
  142. +#endif // !AMD64
  143. +}
  144. +diff --git a/src/os_cpu/linux_x86/vm/threadLS_linux_x86.cpp b/src/os_cpu/linux_x86/vm/threadLS_linux_x86.cpp
  145. +--- a/src/os_cpu/linux_x86/vm/threadLS_linux_x86.cpp
  146. ++++ b/src/os_cpu/linux_x86/vm/threadLS_linux_x86.cpp
  147. +@@ -89,3 +89,26 @@
  148. + }
  149. + #endif // !AMD64
  150. + }
  151. ++
  152. ++void ThreadLocalStorage::pd_add_coroutine_stack(Thread* thread, address stack_base, size_t stack_size) {
  153. ++#ifndef AMD64
  154. ++ for (address p = stack_base - stack_size; p < stack_base; p += PAGE_SIZE) {
  155. ++ assert(thread == NULL || _sp_map[(uintptr_t)p >> PAGE_SHIFT] == NULL ||
  156. ++ thread == _sp_map[(uintptr_t)p >> PAGE_SHIFT],
  157. ++ "coroutine exited without detaching from VM??");
  158. ++ _sp_map[(uintptr_t)p >> PAGE_SHIFT] = thread;
  159. ++ }
  160. ++#endif // !AMD64
  161. ++}
  162. ++
  163. ++
  164. ++void ThreadLocalStorage::pd_remove_coroutine_stack(Thread* thread, address stack_base, size_t stack_size) {
  165. ++#ifndef AMD64
  166. ++ for (address p = stack_base - stack_size; p < stack_base; p += PAGE_SIZE) {
  167. ++ assert(thread == _sp_map[(uintptr_t)p >> PAGE_SHIFT],
  168. ++ "coroutine exited without detaching from VM??");
  169. ++ _sp_map[(uintptr_t)p >> PAGE_SHIFT] = NULL;
  170. ++ }
  171. ++#endif // !AMD64
  172. ++}
  173. +
  174. diff --git a/src/os_cpu/windows_x86/vm/threadLS_windows_x86.cpp b/src/os_cpu/windows_x86/vm/threadLS_windows_x86.cpp
  175. --- a/src/os_cpu/windows_x86/vm/threadLS_windows_x86.cpp
  176. +++ b/src/os_cpu/windows_x86/vm/threadLS_windows_x86.cpp
  177. -@@ -46,3 +46,12 @@ void ThreadLocalStorage::pd_set_thread(T
  178. +@@ -46,3 +46,12 @@
  179. void ThreadLocalStorage::pd_set_thread(Thread* thread) {
  180. os::thread_local_storage_at_put(ThreadLocalStorage::thread_index(), thread);
  181. }
  182. @@ -551,7 +580,7 @@
  183. diff --git a/src/share/vm/classfile/javaClasses.cpp b/src/share/vm/classfile/javaClasses.cpp
  184. --- a/src/share/vm/classfile/javaClasses.cpp
  185. +++ b/src/share/vm/classfile/javaClasses.cpp
  186. -@@ -2724,6 +2724,26 @@ void sun_misc_AtomicLongCSImpl::compute_
  187. +@@ -2728,6 +2728,26 @@
  188. }
  189. }
  190.  
  191. @@ -578,7 +607,7 @@
  192. void java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(TRAPS) {
  193. if (_owner_offset != 0) return;
  194.  
  195. -@@ -2847,6 +2867,8 @@ void JavaClasses::compute_offsets() {
  196. +@@ -2851,6 +2871,8 @@
  197.  
  198. // generated interpreter code wants to know about the offsets we just computed:
  199. AbstractAssembler::update_delayed_values();
  200. @@ -590,7 +619,7 @@
  201. diff --git a/src/share/vm/classfile/javaClasses.hpp b/src/share/vm/classfile/javaClasses.hpp
  202. --- a/src/share/vm/classfile/javaClasses.hpp
  203. +++ b/src/share/vm/classfile/javaClasses.hpp
  204. -@@ -1255,6 +1255,25 @@ class java_util_concurrent_locks_Abstrac
  205. +@@ -1256,6 +1256,25 @@
  206. static oop get_owner_threadObj(oop obj);
  207. };
  208.  
  209. @@ -619,7 +648,7 @@
  210. diff --git a/src/share/vm/classfile/systemDictionary.hpp b/src/share/vm/classfile/systemDictionary.hpp
  211. --- a/src/share/vm/classfile/systemDictionary.hpp
  212. +++ b/src/share/vm/classfile/systemDictionary.hpp
  213. -@@ -170,6 +170,10 @@ class SymbolPropertyTable;
  214. +@@ -171,6 +171,10 @@
  215. template(Short_klass, java_lang_Short, Pre) \
  216. template(Integer_klass, java_lang_Integer, Pre) \
  217. template(Long_klass, java_lang_Long, Pre) \
  218. @@ -633,7 +662,7 @@
  219. diff --git a/src/share/vm/classfile/vmSymbols.hpp b/src/share/vm/classfile/vmSymbols.hpp
  220. --- a/src/share/vm/classfile/vmSymbols.hpp
  221. +++ b/src/share/vm/classfile/vmSymbols.hpp
  222. -@@ -356,6 +356,7 @@
  223. +@@ -365,6 +365,7 @@
  224. template(void_float_signature, "()F") \
  225. template(void_double_signature, "()D") \
  226. template(int_void_signature, "(I)V") \
  227. @@ -641,7 +670,7 @@
  228. template(int_int_signature, "(I)I") \
  229. template(int_bool_signature, "(I)Z") \
  230. template(float_int_signature, "(F)I") \
  231. -@@ -461,7 +462,7 @@
  232. +@@ -471,7 +472,7 @@
  233. template(createGarbageCollectorMBean_signature, "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/management/GarbageCollectorMBean;") \
  234. template(trigger_name, "trigger") \
  235. template(clear_name, "clear") \
  236. @@ -650,7 +679,7 @@
  237. template(startAgent_name, "startAgent") \
  238. template(java_lang_management_ThreadInfo_constructor_signature, "(Ljava/lang/Thread;ILjava/lang/Object;Ljava/lang/Thread;JJJJ[Ljava/lang/StackTraceElement;)V") \
  239. template(java_lang_management_ThreadInfo_with_locks_constructor_signature, "(Ljava/lang/Thread;ILjava/lang/Object;Ljava/lang/Thread;JJJJ[Ljava/lang/StackTraceElement;[Ljava/lang/Object;[I[Ljava/lang/Object;)V") \
  240. -@@ -479,7 +480,7 @@
  241. +@@ -489,7 +490,7 @@
  242. template(addThreadDumpForMonitors_name, "addThreadDumpForMonitors") \
  243. template(addThreadDumpForSynchronizers_name, "addThreadDumpForSynchronizers") \
  244. template(addThreadDumpForMonitors_signature, "(Ljava/lang/management/ThreadInfo;[Ljava/lang/Object;[I)V") \
  245. @@ -659,7 +688,7 @@
  246. \
  247. /* JVMTI/java.lang.instrument support and VM Attach mechanism */ \
  248. template(sun_misc_VMSupport, "sun/misc/VMSupport") \
  249. -@@ -489,6 +490,16 @@
  250. +@@ -499,6 +500,16 @@
  251. template(serializePropertiesToByteArray_signature, "()[B") \
  252. template(serializeAgentPropertiesToByteArray_name, "serializeAgentPropertiesToByteArray") \
  253. template(classRedefinedCount_name, "classRedefinedCount") \
  254. @@ -676,14 +705,14 @@
  255. /*end*/
  256.  
  257.  
  258. -@@ -825,8 +836,21 @@
  259. +@@ -835,9 +846,22 @@
  260. do_name( prefetchReadStatic_name, "prefetchReadStatic") \
  261. do_intrinsic(_prefetchWriteStatic, sun_misc_Unsafe, prefetchWriteStatic_name, prefetch_signature, F_SN) \
  262. do_name( prefetchWriteStatic_name, "prefetchWriteStatic") \
  263. + \
  264. /*== LAST_COMPILER_INLINE*/ \
  265. /*the compiler does have special inlining code for these; bytecode inline is just fine */ \
  266. -+ \
  267. + \
  268. + /* coroutine intrinsics */ \
  269. + do_intrinsic(_prepareSwitch, java_dyn_CoroutineSupport, prepareSwitch_name, prepareSwitch_signature, F_SN) \
  270. + do_name( prepareSwitch_name, "prepareSwitch") \
  271. @@ -695,13 +724,14 @@
  272. + do_name( switchToAndTerminate_name, "switchToAndTerminate") \
  273. + do_intrinsic(_switchToAndExit, java_dyn_CoroutineSupport, switchToAndExit_name, switchTo_signature, F_SN) \
  274. + do_name( switchToAndExit_name, "switchToAndExit") \
  275. - \
  276. ++ \
  277. do_intrinsic(_fillInStackTrace, java_lang_Throwable, fillInStackTrace_name, void_throwable_signature, F_RNY) \
  278. \
  279. + do_intrinsic(_StringBuilder_void, java_lang_StringBuilder, object_initializer_name, void_method_signature, F_R) \
  280. diff --git a/src/share/vm/gc_implementation/includeDB_gc_g1 b/src/share/vm/gc_implementation/includeDB_gc_g1
  281. --- a/src/share/vm/gc_implementation/includeDB_gc_g1
  282. +++ b/src/share/vm/gc_implementation/includeDB_gc_g1
  283. -@@ -323,7 +323,7 @@ ptrQueue.hpp
  284. +@@ -323,7 +323,7 @@
  285. ptrQueue.hpp allocation.hpp
  286. ptrQueue.hpp sizes.hpp
  287.  
  288. @@ -713,11 +743,10 @@
  289. diff --git a/src/share/vm/includeDB_core b/src/share/vm/includeDB_core
  290. --- a/src/share/vm/includeDB_core
  291. +++ b/src/share/vm/includeDB_core
  292. -@@ -1300,6 +1300,14 @@ copy_<arch>.hpp
  293. - copy_<arch>.hpp generate_platform_dependent_include
  294. +@@ -1302,6 +1302,14 @@
  295.  
  296. copy_<os_arch>.inline.hpp generate_platform_dependent_include
  297. -+
  298. +
  299. +coroutine.cpp coroutine.hpp
  300. +
  301. +coroutine.hpp jniHandles.hpp
  302. @@ -725,10 +754,11 @@
  303. +coroutine.hpp resourceArea.hpp
  304. +coroutine.hpp javaFrameAnchor.hpp
  305. +coroutine.hpp monitorChunk.hpp
  306. -
  307. ++
  308. cpCacheKlass.cpp bytecodes.hpp
  309. cpCacheKlass.cpp collectedHeap.hpp
  310. -@@ -4181,6 +4189,7 @@ thread.cpp
  311. + cpCacheKlass.cpp constantPoolOop.hpp
  312. +@@ -4185,6 +4193,7 @@
  313. thread.cpp attachListener.hpp
  314. thread.cpp biasedLocking.hpp
  315. thread.cpp classLoader.hpp
  316. @@ -736,7 +766,7 @@
  317. thread.cpp compileBroker.hpp
  318. thread.cpp defaultStream.hpp
  319. thread.cpp deoptimization.hpp
  320. -@@ -4447,6 +4456,7 @@ universe.inline.hpp
  321. +@@ -4451,6 +4460,7 @@
  322.  
  323. unsafe.cpp allocation.inline.hpp
  324. unsafe.cpp copy.hpp
  325. @@ -747,7 +777,7 @@
  326. diff --git a/src/share/vm/prims/jni.cpp b/src/share/vm/prims/jni.cpp
  327. --- a/src/share/vm/prims/jni.cpp
  328. +++ b/src/share/vm/prims/jni.cpp
  329. -@@ -3401,6 +3401,7 @@ static jint attach_current_thread(JavaVM
  330. +@@ -3401,6 +3401,7 @@
  331. thread->set_thread_state(_thread_in_vm);
  332. // Must do this before initialize_thread_local_storage
  333. thread->record_stack_base_and_size();
  334. @@ -758,7 +788,7 @@
  335. diff --git a/src/share/vm/prims/nativeLookup.cpp b/src/share/vm/prims/nativeLookup.cpp
  336. --- a/src/share/vm/prims/nativeLookup.cpp
  337. +++ b/src/share/vm/prims/nativeLookup.cpp
  338. -@@ -77,6 +77,7 @@ char* NativeLookup::long_jni_name(method
  339. +@@ -77,6 +77,7 @@
  340. }
  341.  
  342. extern "C" {
  343. @@ -766,20 +796,20 @@
  344. void JNICALL JVM_RegisterUnsafeMethods(JNIEnv *env, jclass unsafecls);
  345. void JNICALL JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass unsafecls);
  346. void JNICALL JVM_RegisterPerfMethods(JNIEnv *env, jclass perfclass);
  347. -@@ -94,6 +95,9 @@ static address lookup_special_native(cha
  348. - if (strstr(jni_name, "Java_java_io_ObjectInputStream_setPrimitiveFieldValues") != NULL) {
  349. +@@ -95,6 +96,9 @@
  350. return CAST_FROM_FN_PTR(address, JVM_SetPrimitiveFieldValues);
  351. }
  352. -+ }
  353. + }
  354. + if (strstr(jni_name, "Java_java_dyn_CoroutineSupport_registerNatives") != NULL) {
  355. + return CAST_FROM_FN_PTR(address, JVM_RegisterCoroutineSupportMethods);
  356. - }
  357. ++ }
  358. if (strstr(jni_name, "Java_sun_misc_Unsafe_registerNatives") != NULL) {
  359. return CAST_FROM_FN_PTR(address, JVM_RegisterUnsafeMethods);
  360. + }
  361. diff --git a/src/share/vm/prims/unsafe.cpp b/src/share/vm/prims/unsafe.cpp
  362. --- a/src/share/vm/prims/unsafe.cpp
  363. +++ b/src/share/vm/prims/unsafe.cpp
  364. -@@ -1162,6 +1162,172 @@ UNSAFE_ENTRY(void, Unsafe_PrefetchWrite(
  365. +@@ -1162,6 +1162,172 @@
  366. Prefetch::write(addr, (intx)offset);
  367. UNSAFE_END
  368.  
  369. @@ -889,7 +919,7 @@
  370. + Coroutine* coro = (Coroutine*)java_dyn_CoroutineBase::data(old_oop);
  371. + assert(coro != NULL, "NULL old coroutine in switchToAndTerminate");
  372. +
  373. -+ java_dyn_CoroutineBase::set_data(old_oop, NULL);
  374. ++ java_dyn_CoroutineBase::set_data(old_oop, 0);
  375. +
  376. + coro->remove_from_list(THREAD->coroutine_list());
  377. + Coroutine::free_coroutine(coro);
  378. @@ -952,7 +982,7 @@
  379.  
  380. /// JVM_RegisterUnsafeMethods
  381.  
  382. -@@ -1457,6 +1623,27 @@ JNINativeMethod anonk_methods[] = {
  383. +@@ -1457,6 +1623,27 @@
  384. {CC"defineAnonymousClass", CC"("DAC_Args")"CLS, FN_PTR(Unsafe_DefineAnonymousClass)},
  385. };
  386.  
  387. @@ -980,7 +1010,7 @@
  388. #undef CC
  389. #undef FN_PTR
  390.  
  391. -@@ -1555,3 +1742,28 @@ JVM_ENTRY(void, JVM_RegisterUnsafeMethod
  392. +@@ -1555,3 +1742,28 @@
  393. guarantee(status == 0, "register unsafe natives");
  394. }
  395. JVM_END
  396. @@ -1013,7 +1043,7 @@
  397. new file mode 100644
  398. --- /dev/null
  399. +++ b/src/share/vm/runtime/coroutine.cpp
  400. -@@ -0,0 +1,386 @@
  401. +@@ -0,0 +1,383 @@
  402. +/*
  403. + * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
  404. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  405. @@ -1088,10 +1118,7 @@
  406. +
  407. + ShouldNotReachHere();
  408. +}
  409. -+#endif
  410. -+
  411. -+#ifdef LINUX
  412. -+
  413. ++#else
  414. +void coroutine_start(Coroutine* coroutine, jobject coroutineObj) {
  415. + coroutine->thread()->set_thread_state(_thread_in_vm);
  416. +
  417. @@ -1235,12 +1262,12 @@
  418. +
  419. + int capacity = data->capacity();
  420. + int size = 0;
  421. -+ data->data()[capacity - ++size] = NULL;
  422. ++ data->data()[capacity - ++size] = (intptr_t)NULL;
  423. + data->data()[capacity - ++size] = (intptr_t)JNIHandles::make_global(coroutineObj);
  424. + data->data()[capacity - ++size] = (intptr_t)coro;
  425. -+ data->data()[capacity - ++size] = NULL;
  426. ++ data->data()[capacity - ++size] = (intptr_t)NULL;
  427. + data->data()[capacity - ++size] = (intptr_t)coroutine_start;
  428. -+ data->data()[capacity - ++size] = NULL;
  429. ++ data->data()[capacity - ++size] = (intptr_t)NULL;
  430. + data->set_size(size);
  431. +
  432. + coro->_state = _stored;
  433. @@ -1643,7 +1670,7 @@
  434. diff --git a/src/share/vm/runtime/frame.cpp b/src/share/vm/runtime/frame.cpp
  435. --- a/src/share/vm/runtime/frame.cpp
  436. +++ b/src/share/vm/runtime/frame.cpp
  437. -@@ -465,17 +465,17 @@ BasicObjectLock* frame::previous_monitor
  438. +@@ -465,17 +465,17 @@
  439.  
  440. intptr_t* frame::interpreter_frame_local_at(int index) const {
  441. const int n = Interpreter::local_offset_in_bytes(index)/wordSize;
  442. @@ -1664,7 +1691,7 @@
  443. }
  444.  
  445. intptr_t* frame::interpreter_frame_expression_stack_at(jint offset) const {
  446. -@@ -1411,3 +1411,8 @@ StackFrameStream::StackFrameStream(JavaT
  447. +@@ -1411,3 +1411,8 @@
  448. _fr = thread->last_frame();
  449. _is_done = false;
  450. }
  451. @@ -1676,16 +1703,16 @@
  452. diff --git a/src/share/vm/runtime/frame.hpp b/src/share/vm/runtime/frame.hpp
  453. --- a/src/share/vm/runtime/frame.hpp
  454. +++ b/src/share/vm/runtime/frame.hpp
  455. -@@ -47,6 +47,8 @@ class frame VALUE_OBJ_CLASS_SPEC {
  456. - };
  457. +@@ -48,6 +48,8 @@
  458.  
  459. deopt_state _deopt_state;
  460. +
  461. ++ intptr_t _displacement;
  462. +
  463. -+ intptr_t _displacement;
  464. -
  465. public:
  466. // Constructors
  467. -@@ -462,6 +464,7 @@ class StackFrameStream : public StackObj
  468. + frame();
  469. +@@ -462,6 +464,7 @@
  470. bool _is_done;
  471. public:
  472. StackFrameStream(JavaThread *thread, bool update = true);
  473. @@ -1696,7 +1723,7 @@
  474. diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp
  475. --- a/src/share/vm/runtime/globals.hpp
  476. +++ b/src/share/vm/runtime/globals.hpp
  477. -@@ -3516,7 +3516,13 @@ class CommandLineFlags {
  478. +@@ -3516,7 +3516,13 @@
  479. product(bool, UseVMInterruptibleIO, false, \
  480. "(Unstable, Solaris-specific) Thread interrupt before or with " \
  481. "EINTR for I/O operations results in OS_INTRPT. The default value"\
  482. @@ -1714,7 +1741,7 @@
  483. diff --git a/src/share/vm/runtime/handles.hpp b/src/share/vm/runtime/handles.hpp
  484. --- a/src/share/vm/runtime/handles.hpp
  485. +++ b/src/share/vm/runtime/handles.hpp
  486. -@@ -250,6 +250,11 @@ class HandleArea: public Arena {
  487. +@@ -250,6 +250,11 @@
  488. debug_only(_no_handle_mark_nesting = 0);
  489. _prev = prev;
  490. }
  491. @@ -1729,7 +1756,7 @@
  492. diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp
  493. --- a/src/share/vm/runtime/thread.cpp
  494. +++ b/src/share/vm/runtime/thread.cpp
  495. -@@ -1178,6 +1178,10 @@ void JavaThread::initialize() {
  496. +@@ -1178,6 +1178,10 @@
  497. _interp_only_mode = 0;
  498. _special_runtime_exit_condition = _no_async_condition;
  499. _pending_async_exception = NULL;
  500. @@ -1740,16 +1767,16 @@
  501. _is_compiling = false;
  502. _thread_stat = NULL;
  503. _thread_stat = new ThreadStatistics();
  504. -@@ -1356,6 +1360,8 @@ void JavaThread::run() {
  505. -
  506. +@@ -1357,6 +1361,8 @@
  507. // Record real stack base and size.
  508. this->record_stack_base_and_size();
  509. +
  510. ++ this->initialize_coroutine_support();
  511. +
  512. -+ this->initialize_coroutine_support();
  513. -
  514. // Initialize thread local storage; set before calling MutexLocker
  515. this->initialize_thread_local_storage();
  516. -@@ -2396,6 +2402,13 @@ void JavaThread::oops_do(OopClosure* f,
  517. +
  518. +@@ -2396,6 +2402,13 @@
  519. fst.current()->oops_do(f, cf, fst.register_map());
  520. }
  521. }
  522. @@ -1763,7 +1790,7 @@
  523.  
  524. // callee_target is never live across a gc point so NULL it here should
  525. // it still contain a methdOop.
  526. -@@ -2437,6 +2450,13 @@ void JavaThread::nmethods_do(CodeBlobClo
  527. +@@ -2437,6 +2450,13 @@
  528. fst.current()->nmethods_do(cf);
  529. }
  530. }
  531. @@ -1777,7 +1804,7 @@
  532. }
  533.  
  534. // Printing
  535. -@@ -2922,6 +2942,7 @@ jint Threads::create_vm(JavaVMInitArgs*
  536. +@@ -2922,6 +2942,7 @@
  537. // stacksize. This adjusted size is what is used to figure the placement
  538. // of the guard pages.
  539. main_thread->record_stack_base_and_size();
  540. @@ -1785,7 +1812,7 @@
  541. main_thread->initialize_thread_local_storage();
  542.  
  543. main_thread->set_active_handles(JNIHandleBlock::allocate_block());
  544. -@@ -4103,3 +4124,9 @@ void Threads::verify() {
  545. +@@ -4103,3 +4124,9 @@
  546. VMThread* thread = VMThread::vm_thread();
  547. if (thread != NULL) thread->verify();
  548. }
  549. @@ -1798,17 +1825,17 @@
  550. diff --git a/src/share/vm/runtime/thread.hpp b/src/share/vm/runtime/thread.hpp
  551. --- a/src/share/vm/runtime/thread.hpp
  552. +++ b/src/share/vm/runtime/thread.hpp
  553. -@@ -45,6 +45,9 @@ class GCTaskQueue;
  554. - class GCTaskQueue;
  555. +@@ -46,6 +46,9 @@
  556. class ThreadClosure;
  557. class IdealGraphPrinter;
  558. -+
  559. +
  560. +class Coroutine;
  561. +class CoroutineStack;
  562. -
  563. ++
  564. // Class hierarchy
  565. // - Thread
  566. -@@ -486,6 +489,9 @@ public:
  567. + // - NamedThread
  568. +@@ -486,6 +489,9 @@
  569. void leaving_jvmti_env_iteration() { --_jvmti_env_iteration_count; }
  570. bool is_inside_jvmti_env_iteration() { return _jvmti_env_iteration_count > 0; }
  571.  
  572. @@ -1818,11 +1845,10 @@
  573. // Code generation
  574. static ByteSize exception_file_offset() { return byte_offset_of(Thread, _exception_file ); }
  575. static ByteSize exception_line_offset() { return byte_offset_of(Thread, _exception_line ); }
  576. -@@ -786,6 +792,22 @@ class JavaThread: public Thread {
  577. - // JVMTI PopFrame support
  578. +@@ -787,6 +793,22 @@
  579. // This is set to popframe_pending to signal that top Java frame should be popped immediately
  580. int _popframe_condition;
  581. -+
  582. +
  583. + // coroutine support
  584. + CoroutineStack* _coroutine_stack_list;
  585. + Coroutine* _coroutine_list;
  586. @@ -1838,13 +1864,14 @@
  587. + void initialize_coroutine_support();
  588. +
  589. + private:
  590. -
  591. ++
  592. #ifndef PRODUCT
  593. int _jmp_ring_index;
  594. + struct {
  595. diff --git a/src/share/vm/runtime/threadLocalStorage.cpp b/src/share/vm/runtime/threadLocalStorage.cpp
  596. --- a/src/share/vm/runtime/threadLocalStorage.cpp
  597. +++ b/src/share/vm/runtime/threadLocalStorage.cpp
  598. -@@ -41,6 +41,14 @@ void ThreadLocalStorage::set_thread(Thre
  599. +@@ -41,6 +41,14 @@
  600. guarantee(get_thread_slow() == thread, "must be the same thread, slowly");
  601. }
  602.  
  603. @@ -1862,7 +1889,7 @@
  604. diff --git a/src/share/vm/runtime/threadLocalStorage.hpp b/src/share/vm/runtime/threadLocalStorage.hpp
  605. --- a/src/share/vm/runtime/threadLocalStorage.hpp
  606. +++ b/src/share/vm/runtime/threadLocalStorage.hpp
  607. -@@ -36,6 +36,9 @@ class ThreadLocalStorage : AllStatic {
  608. +@@ -36,6 +36,9 @@
  609. static Thread* get_thread_slow();
  610. static void invalidate_all() { pd_invalidate_all(); }
  611.  
  612. @@ -1872,7 +1899,7 @@
  613. // Machine dependent stuff
  614. #include "incls/_threadLS_pd.hpp.incl"
  615.  
  616. -@@ -57,6 +60,10 @@ class ThreadLocalStorage : AllStatic {
  617. +@@ -57,6 +60,10 @@
  618. // Processor dependent parts of set_thread and initialization
  619. static void pd_set_thread(Thread* thread);
  620. static void pd_init();
Add Comment
Please, Sign In to add comment