35 #include "oops/methodDataOop.hpp" |
35 #include "oops/methodDataOop.hpp" |
36 #include "oops/methodOop.hpp" |
36 #include "oops/methodOop.hpp" |
37 #include "oops/oop.inline.hpp" |
37 #include "oops/oop.inline.hpp" |
38 #include "prims/forte.hpp" |
38 #include "prims/forte.hpp" |
39 #include "prims/jvmtiExport.hpp" |
39 #include "prims/jvmtiExport.hpp" |
|
40 #include "prims/methodHandles.hpp" |
40 #include "runtime/handles.inline.hpp" |
41 #include "runtime/handles.inline.hpp" |
41 #include "runtime/sharedRuntime.hpp" |
42 #include "runtime/sharedRuntime.hpp" |
42 #include "runtime/stubRoutines.hpp" |
43 #include "runtime/stubRoutines.hpp" |
43 #include "runtime/timer.hpp" |
44 #include "runtime/timer.hpp" |
44 |
45 |
178 |
179 |
179 AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(methodHandle m) { |
180 AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(methodHandle m) { |
180 // Abstract method? |
181 // Abstract method? |
181 if (m->is_abstract()) return abstract; |
182 if (m->is_abstract()) return abstract; |
182 |
183 |
183 // Invoker for method handles? |
184 // Method handle primitive? |
184 if (m->is_method_handle_invoke()) return method_handle; |
185 if (m->is_method_handle_intrinsic()) { |
|
186 vmIntrinsics::ID id = m->intrinsic_id(); |
|
187 assert(MethodHandles::is_signature_polymorphic(id), "must match an intrinsic"); |
|
188 MethodKind kind = (MethodKind)( method_handle_invoke_FIRST + |
|
189 ((int)id - vmIntrinsics::FIRST_MH_SIG_POLY) ); |
|
190 assert(kind <= method_handle_invoke_LAST, "parallel enum ranges"); |
|
191 return kind; |
|
192 } |
185 |
193 |
186 // Native method? |
194 // Native method? |
187 // Note: This test must come _before_ the test for intrinsic |
195 // Note: This test must come _before_ the test for intrinsic |
188 // methods. See also comments below. |
196 // methods. See also comments below. |
189 if (m->is_native()) { |
197 if (m->is_native()) { |
190 assert(!m->is_method_handle_invoke(), "overlapping bits here, watch out"); |
198 assert(!m->is_method_handle_intrinsic(), "overlapping bits here, watch out"); |
191 return m->is_synchronized() ? native_synchronized : native; |
199 return m->is_synchronized() ? native_synchronized : native; |
192 } |
200 } |
193 |
201 |
194 // Synchronized? |
202 // Synchronized? |
195 if (m->is_synchronized()) { |
203 if (m->is_synchronized()) { |
237 // Note: for now: zero locals for all non-empty methods |
245 // Note: for now: zero locals for all non-empty methods |
238 return zerolocals; |
246 return zerolocals; |
239 } |
247 } |
240 |
248 |
241 |
249 |
|
250 void AbstractInterpreter::set_entry_for_kind(AbstractInterpreter::MethodKind kind, address entry) { |
|
251 assert(kind >= method_handle_invoke_FIRST && |
|
252 kind <= method_handle_invoke_LAST, "late initialization only for MH entry points"); |
|
253 assert(_entry_table[kind] == _entry_table[abstract], "previous value must be AME entry"); |
|
254 _entry_table[kind] = entry; |
|
255 } |
|
256 |
|
257 |
242 // Return true if the interpreter can prove that the given bytecode has |
258 // Return true if the interpreter can prove that the given bytecode has |
243 // not yet been executed (in Java semantics, not in actual operation). |
259 // not yet been executed (in Java semantics, not in actual operation). |
244 bool AbstractInterpreter::is_not_reached(methodHandle method, int bci) { |
260 bool AbstractInterpreter::is_not_reached(methodHandle method, int bci) { |
245 Bytecodes::Code code = method()->code_at(bci); |
261 Bytecodes::Code code = method()->code_at(bci); |
246 |
262 |
268 case native : tty->print("native" ); break; |
284 case native : tty->print("native" ); break; |
269 case native_synchronized : tty->print("native_synchronized" ); break; |
285 case native_synchronized : tty->print("native_synchronized" ); break; |
270 case empty : tty->print("empty" ); break; |
286 case empty : tty->print("empty" ); break; |
271 case accessor : tty->print("accessor" ); break; |
287 case accessor : tty->print("accessor" ); break; |
272 case abstract : tty->print("abstract" ); break; |
288 case abstract : tty->print("abstract" ); break; |
273 case method_handle : tty->print("method_handle" ); break; |
|
274 case java_lang_math_sin : tty->print("java_lang_math_sin" ); break; |
289 case java_lang_math_sin : tty->print("java_lang_math_sin" ); break; |
275 case java_lang_math_cos : tty->print("java_lang_math_cos" ); break; |
290 case java_lang_math_cos : tty->print("java_lang_math_cos" ); break; |
276 case java_lang_math_tan : tty->print("java_lang_math_tan" ); break; |
291 case java_lang_math_tan : tty->print("java_lang_math_tan" ); break; |
277 case java_lang_math_abs : tty->print("java_lang_math_abs" ); break; |
292 case java_lang_math_abs : tty->print("java_lang_math_abs" ); break; |
278 case java_lang_math_sqrt : tty->print("java_lang_math_sqrt" ); break; |
293 case java_lang_math_sqrt : tty->print("java_lang_math_sqrt" ); break; |
279 case java_lang_math_log : tty->print("java_lang_math_log" ); break; |
294 case java_lang_math_log : tty->print("java_lang_math_log" ); break; |
280 case java_lang_math_log10 : tty->print("java_lang_math_log10" ); break; |
295 case java_lang_math_log10 : tty->print("java_lang_math_log10" ); break; |
281 default : ShouldNotReachHere(); |
296 default: |
|
297 if (kind >= method_handle_invoke_FIRST && |
|
298 kind <= method_handle_invoke_LAST) { |
|
299 const char* kind_name = vmIntrinsics::name_at(method_handle_intrinsic(kind)); |
|
300 if (kind_name[0] == '_') kind_name = &kind_name[1]; // '_invokeExact' => 'invokeExact' |
|
301 tty->print("method_handle_%s", kind_name); |
|
302 break; |
|
303 } |
|
304 ShouldNotReachHere(); |
|
305 break; |
282 } |
306 } |
283 } |
307 } |
284 #endif // PRODUCT |
308 #endif // PRODUCT |
285 |
309 |
286 |
310 |