22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/systemDictionary.hpp"
27 #include "classfile/vmSymbols.hpp"
28 #include "code/nmethod.hpp"
29 #include "compiler/compileBroker.hpp"
30 #include "interpreter/interpreter.hpp"
31 #include "interpreter/linkResolver.hpp"
32 #include "memory/universe.inline.hpp"
33 #include "oops/oop.inline.hpp"
34 #include "prims/jniCheck.hpp"
35 #include "runtime/compilationPolicy.hpp"
36 #include "runtime/handles.inline.hpp"
37 #include "runtime/interfaceSupport.hpp"
38 #include "runtime/javaCalls.hpp"
39 #include "runtime/mutexLocker.hpp"
40 #include "runtime/signature.hpp"
41 #include "runtime/stubRoutines.hpp"
42 #ifdef TARGET_OS_FAMILY_linux
43 # include "thread_linux.inline.hpp"
44 #endif
45 #ifdef TARGET_OS_FAMILY_solaris
46 # include "thread_solaris.inline.hpp"
47 #endif
48 #ifdef TARGET_OS_FAMILY_windows
49 # include "thread_windows.inline.hpp"
50 #endif
51 #ifdef TARGET_OS_FAMILY_bsd
52 # include "thread_bsd.inline.hpp"
53 #endif
54
55 // -----------------------------------------------------
56 // Implementation of JavaCallWrapper
57
58 JavaCallWrapper::JavaCallWrapper(methodHandle callee_method, Handle receiver, JavaValue* result, TRAPS) {
59 JavaThread* thread = (JavaThread *)THREAD;
60 bool clear_pending_exception = true;
61
62 guarantee(thread->is_Java_thread(), "crucial check - the VM thread cannot and must not escape to Java code");
63 assert(!thread->owns_locks(), "must release all locks when leaving VM");
64 guarantee(!thread->is_Compiler_thread(), "cannot make java calls from the compiler");
65 _result = result;
66
67 // Allocate handle block for Java code. This must be done before we change thread_state to _thread_in_Java_or_stub,
68 // since it can potentially block.
69 JNIHandleBlock* new_handles = JNIHandleBlock::allocate_block(thread);
70
71 // After this, we are official in JavaCode. This needs to be done before we change any of the thread local
72 // info, since we cannot find oops before the new information is set up completely.
73 ThreadStateTransition::transition(thread, _thread_in_vm, _thread_in_Java);
|
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/systemDictionary.hpp"
27 #include "classfile/vmSymbols.hpp"
28 #include "code/nmethod.hpp"
29 #include "compiler/compileBroker.hpp"
30 #include "interpreter/interpreter.hpp"
31 #include "interpreter/linkResolver.hpp"
32 #include "memory/universe.inline.hpp"
33 #include "oops/oop.inline.hpp"
34 #include "prims/jniCheck.hpp"
35 #include "runtime/compilationPolicy.hpp"
36 #include "runtime/handles.inline.hpp"
37 #include "runtime/interfaceSupport.hpp"
38 #include "runtime/javaCalls.hpp"
39 #include "runtime/mutexLocker.hpp"
40 #include "runtime/signature.hpp"
41 #include "runtime/stubRoutines.hpp"
42 #include "runtime/thread.inline.hpp"
43
44 // -----------------------------------------------------
45 // Implementation of JavaCallWrapper
46
47 JavaCallWrapper::JavaCallWrapper(methodHandle callee_method, Handle receiver, JavaValue* result, TRAPS) {
48 JavaThread* thread = (JavaThread *)THREAD;
49 bool clear_pending_exception = true;
50
51 guarantee(thread->is_Java_thread(), "crucial check - the VM thread cannot and must not escape to Java code");
52 assert(!thread->owns_locks(), "must release all locks when leaving VM");
53 guarantee(!thread->is_Compiler_thread(), "cannot make java calls from the compiler");
54 _result = result;
55
56 // Allocate handle block for Java code. This must be done before we change thread_state to _thread_in_Java_or_stub,
57 // since it can potentially block.
58 JNIHandleBlock* new_handles = JNIHandleBlock::allocate_block(thread);
59
60 // After this, we are official in JavaCode. This needs to be done before we change any of the thread local
61 // info, since we cannot find oops before the new information is set up completely.
62 ThreadStateTransition::transition(thread, _thread_in_vm, _thread_in_Java);
|