14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
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/os.inline.hpp"
41 #include "runtime/signature.hpp"
42 #include "runtime/stubRoutines.hpp"
43 #include "runtime/thread.inline.hpp"
44 #if INCLUDE_JVMCI
45 #include "jvmci/jvmciJavaClasses.hpp"
46 #include "jvmci/jvmciRuntime.hpp"
47 #endif
48
49 // -----------------------------------------------------
50 // Implementation of JavaCallWrapper
51
52 JavaCallWrapper::JavaCallWrapper(const methodHandle& callee_method, Handle receiver, JavaValue* result, TRAPS) {
53 JavaThread* thread = (JavaThread *)THREAD;
130
131
132 // Old thread-local info. has been restored. We are not back in the VM.
133 ThreadStateTransition::transition_from_java(_thread, _thread_in_vm);
134
135 // State has been restored now make the anchor frame visible for the profiler.
136 // Do this after the transition because this allows us to put an assert
137 // the Java->vm transition which checks to see that stack is not walkable
138 // on sparc/ia64 which will catch violations of the reseting of last_Java_frame
139 // invariants (i.e. _flags always cleared on return to Java)
140
141 _thread->frame_anchor()->copy(&_anchor);
142
143 // Release handles after we are marked as being inside the VM again, since this
144 // operation might block
145 JNIHandleBlock::release_block(_old_handles, _thread);
146 }
147
148
149 void JavaCallWrapper::oops_do(OopClosure* f) {
150 f->do_oop((oop*)&_receiver);
151 handles()->oops_do(f);
152 }
153
154
155 // Helper methods
156 static BasicType runtime_type_from(JavaValue* result) {
157 switch (result->get_type()) {
158 case T_BOOLEAN: // fall through
159 case T_CHAR : // fall through
160 case T_SHORT : // fall through
161 case T_INT : // fall through
162 #ifndef _LP64
163 case T_OBJECT : // fall through
164 case T_ARRAY : // fall through
165 #endif
166 case T_BYTE : // fall through
167 case T_VOID : return T_INT;
168 case T_LONG : return T_LONG;
169 case T_FLOAT : return T_FLOAT;
170 case T_DOUBLE : return T_DOUBLE;
|
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
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 "oops/valueKlass.hpp"
35 #include "prims/jniCheck.hpp"
36 #include "runtime/compilationPolicy.hpp"
37 #include "runtime/handles.inline.hpp"
38 #include "runtime/interfaceSupport.hpp"
39 #include "runtime/javaCalls.hpp"
40 #include "runtime/mutexLocker.hpp"
41 #include "runtime/os.inline.hpp"
42 #include "runtime/signature.hpp"
43 #include "runtime/stubRoutines.hpp"
44 #include "runtime/thread.inline.hpp"
45 #if INCLUDE_JVMCI
46 #include "jvmci/jvmciJavaClasses.hpp"
47 #include "jvmci/jvmciRuntime.hpp"
48 #endif
49
50 // -----------------------------------------------------
51 // Implementation of JavaCallWrapper
52
53 JavaCallWrapper::JavaCallWrapper(const methodHandle& callee_method, Handle receiver, JavaValue* result, TRAPS) {
54 JavaThread* thread = (JavaThread *)THREAD;
131
132
133 // Old thread-local info. has been restored. We are not back in the VM.
134 ThreadStateTransition::transition_from_java(_thread, _thread_in_vm);
135
136 // State has been restored now make the anchor frame visible for the profiler.
137 // Do this after the transition because this allows us to put an assert
138 // the Java->vm transition which checks to see that stack is not walkable
139 // on sparc/ia64 which will catch violations of the reseting of last_Java_frame
140 // invariants (i.e. _flags always cleared on return to Java)
141
142 _thread->frame_anchor()->copy(&_anchor);
143
144 // Release handles after we are marked as being inside the VM again, since this
145 // operation might block
146 JNIHandleBlock::release_block(_old_handles, _thread);
147 }
148
149
150 void JavaCallWrapper::oops_do(OopClosure* f) {
151 if (!VTBuffer::is_in_vt_buffer(_receiver)) {
152 f->do_oop((oop*)&_receiver);
153 } else {
154 assert(_receiver->is_value(), "Sanity check");
155 BufferedValuesDealiaser* dealiaser = Thread::current()->buffered_values_dealiaser();
156 assert(dealiaser != NULL, "Sanity check");
157 dealiaser->oops_do(f, _receiver);
158 }
159 handles()->oops_do(f);
160 }
161
162
163 // Helper methods
164 static BasicType runtime_type_from(JavaValue* result) {
165 switch (result->get_type()) {
166 case T_BOOLEAN: // fall through
167 case T_CHAR : // fall through
168 case T_SHORT : // fall through
169 case T_INT : // fall through
170 #ifndef _LP64
171 case T_OBJECT : // fall through
172 case T_ARRAY : // fall through
173 #endif
174 case T_BYTE : // fall through
175 case T_VOID : return T_INT;
176 case T_LONG : return T_LONG;
177 case T_FLOAT : return T_FLOAT;
178 case T_DOUBLE : return T_DOUBLE;
|