Mercurial > hg > graal-compiler
comparison src/share/vm/runtime/sharedRuntime.hpp @ 6275:957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 21 Aug 2012 10:39:19 +0200 |
parents | 837a304d0ca8 93c71eb28866 |
children | e522a00b91aa |
comparison
equal
deleted
inserted
replaced
5891:fd8832ae511d | 6275:957c266d8bc5 |
---|---|
59 static RuntimeStub* _resolve_opt_virtual_call_blob; | 59 static RuntimeStub* _resolve_opt_virtual_call_blob; |
60 static RuntimeStub* _resolve_virtual_call_blob; | 60 static RuntimeStub* _resolve_virtual_call_blob; |
61 static RuntimeStub* _resolve_static_call_blob; | 61 static RuntimeStub* _resolve_static_call_blob; |
62 | 62 |
63 static DeoptimizationBlob* _deopt_blob; | 63 static DeoptimizationBlob* _deopt_blob; |
64 static RicochetBlob* _ricochet_blob; | |
65 | 64 |
66 static SafepointBlob* _polling_page_safepoint_handler_blob; | 65 static SafepointBlob* _polling_page_safepoint_handler_blob; |
67 static SafepointBlob* _polling_page_return_handler_blob; | 66 static SafepointBlob* _polling_page_return_handler_blob; |
68 | 67 |
69 #ifdef COMPILER2 | 68 #ifdef COMPILER2 |
185 static void throw_IncompatibleClassChangeError(JavaThread* thread); | 184 static void throw_IncompatibleClassChangeError(JavaThread* thread); |
186 static void throw_ArithmeticException(JavaThread* thread); | 185 static void throw_ArithmeticException(JavaThread* thread); |
187 static void throw_NullPointerException(JavaThread* thread); | 186 static void throw_NullPointerException(JavaThread* thread); |
188 static void throw_NullPointerException_at_call(JavaThread* thread); | 187 static void throw_NullPointerException_at_call(JavaThread* thread); |
189 static void throw_StackOverflowError(JavaThread* thread); | 188 static void throw_StackOverflowError(JavaThread* thread); |
190 static void throw_WrongMethodTypeException(JavaThread* thread, oopDesc* required, oopDesc* actual); | |
191 static address continuation_for_implicit_exception(JavaThread* thread, | 189 static address continuation_for_implicit_exception(JavaThread* thread, |
192 address faulting_pc, | 190 address faulting_pc, |
193 ImplicitExceptionKind exception_kind); | 191 ImplicitExceptionKind exception_kind); |
194 #ifdef GRAAL | 192 #ifdef GRAAL |
195 static address deoptimize_for_implicit_exception(JavaThread* thread, address pc, nmethod* nm, int deopt_reason); | 193 static address deoptimize_for_implicit_exception(JavaThread* thread, address pc, nmethod* nm, int deopt_reason); |
224 static address get_resolve_static_call_stub() { | 222 static address get_resolve_static_call_stub() { |
225 assert(_resolve_static_call_blob != NULL, "oops"); | 223 assert(_resolve_static_call_blob != NULL, "oops"); |
226 return _resolve_static_call_blob->entry_point(); | 224 return _resolve_static_call_blob->entry_point(); |
227 } | 225 } |
228 | 226 |
229 static RicochetBlob* ricochet_blob() { | |
230 #ifdef X86 | |
231 // Currently only implemented on x86 | |
232 assert(!EnableInvokeDynamic || _ricochet_blob != NULL, "oops"); | |
233 #endif | |
234 return _ricochet_blob; | |
235 } | |
236 | |
237 static void generate_ricochet_blob(); | |
238 | |
239 static SafepointBlob* polling_page_return_handler_blob() { return _polling_page_return_handler_blob; } | 227 static SafepointBlob* polling_page_return_handler_blob() { return _polling_page_return_handler_blob; } |
240 static SafepointBlob* polling_page_safepoint_handler_blob() { return _polling_page_safepoint_handler_blob; } | 228 static SafepointBlob* polling_page_safepoint_handler_blob() { return _polling_page_safepoint_handler_blob; } |
241 | 229 |
242 // Counters | 230 // Counters |
243 #ifndef PRODUCT | 231 #ifndef PRODUCT |
251 // RedefineClasses() tracing support for obsolete method entry | 239 // RedefineClasses() tracing support for obsolete method entry |
252 static int rc_trace_method_entry(JavaThread* thread, methodOopDesc* m); | 240 static int rc_trace_method_entry(JavaThread* thread, methodOopDesc* m); |
253 | 241 |
254 // To be used as the entry point for unresolved native methods. | 242 // To be used as the entry point for unresolved native methods. |
255 static address native_method_throw_unsatisfied_link_error_entry(); | 243 static address native_method_throw_unsatisfied_link_error_entry(); |
244 static address native_method_throw_unsupported_operation_exception_entry(); | |
256 | 245 |
257 // bytecode tracing is only used by the TraceBytecodes | 246 // bytecode tracing is only used by the TraceBytecodes |
258 static intptr_t trace_bytecode(JavaThread* thread, intptr_t preserve_this_value, intptr_t tos, intptr_t tos2) PRODUCT_RETURN0; | 247 static intptr_t trace_bytecode(JavaThread* thread, intptr_t preserve_this_value, intptr_t tos, intptr_t tos2) PRODUCT_RETURN0; |
259 | 248 |
260 // Used to back off a spin lock that is under heavy contention | 249 // Used to back off a spin lock that is under heavy contention |
290 * on top of the stack. | 279 * on top of the stack. |
291 * The caller (or one of it's callers) must use a ResourceMark | 280 * The caller (or one of it's callers) must use a ResourceMark |
292 * in order to correctly free the result. | 281 * in order to correctly free the result. |
293 */ | 282 */ |
294 static char* generate_class_cast_message(JavaThread* thr, const char* name); | 283 static char* generate_class_cast_message(JavaThread* thr, const char* name); |
295 | |
296 /** | |
297 * Fill in the message for a WrongMethodTypeException | |
298 * | |
299 * @param thr the current thread | |
300 * @param mtype (optional) expected method type (or argument class) | |
301 * @param mhandle (optional) actual method handle (or argument) | |
302 * @return the dynamically allocated exception message | |
303 * | |
304 * BCP for the frame on top of the stack must refer to an | |
305 * 'invokevirtual' op for a method handle, or an 'invokedyamic' op. | |
306 * The caller (or one of its callers) must use a ResourceMark | |
307 * in order to correctly free the result. | |
308 */ | |
309 static char* generate_wrong_method_type_message(JavaThread* thr, | |
310 oopDesc* mtype = NULL, | |
311 oopDesc* mhandle = NULL); | |
312 | |
313 /** Return non-null if the mtype is a klass or Class, not a MethodType. */ | |
314 static oop wrong_method_type_is_for_single_argument(JavaThread* thr, | |
315 oopDesc* mtype); | |
316 | 284 |
317 /** | 285 /** |
318 * Fill in the "X cannot be cast to a Y" message for ClassCastException | 286 * Fill in the "X cannot be cast to a Y" message for ClassCastException |
319 * | 287 * |
320 * @param name the name of the class of the object attempted to be cast | 288 * @param name the name of the class of the object attempted to be cast |
454 // Generate a native wrapper for a given method. The method takes arguments | 422 // Generate a native wrapper for a given method. The method takes arguments |
455 // in the Java compiled code convention, marshals them to the native | 423 // in the Java compiled code convention, marshals them to the native |
456 // convention (handlizes oops, etc), transitions to native, makes the call, | 424 // convention (handlizes oops, etc), transitions to native, makes the call, |
457 // returns to java state (possibly blocking), unhandlizes any result and | 425 // returns to java state (possibly blocking), unhandlizes any result and |
458 // returns. | 426 // returns. |
427 // | |
428 // The wrapper may contain special-case code if the given method | |
429 // is a JNI critical method, or a compiled method handle adapter, | |
430 // such as _invokeBasic, _linkToVirtual, etc. | |
459 static nmethod *generate_native_wrapper(MacroAssembler* masm, | 431 static nmethod *generate_native_wrapper(MacroAssembler* masm, |
460 methodHandle method, | 432 methodHandle method, |
461 int compile_id, | 433 int compile_id, |
462 int total_args_passed, | 434 int total_args_passed, |
463 int max_arg, | 435 int max_arg, |
611 // routine in their middles and end in a return (instead of ending in a jump). | 583 // routine in their middles and end in a return (instead of ending in a jump). |
612 // The native wrappers are stored in real nmethods instead of the BufferBlobs | 584 // The native wrappers are stored in real nmethods instead of the BufferBlobs |
613 // used by the adapters. The code generation happens here because it's very | 585 // used by the adapters. The code generation happens here because it's very |
614 // similar to what the adapters have to do. | 586 // similar to what the adapters have to do. |
615 | 587 |
616 class AdapterHandlerEntry : public BasicHashtableEntry { | 588 class AdapterHandlerEntry : public BasicHashtableEntry<mtCode> { |
617 friend class AdapterHandlerTable; | 589 friend class AdapterHandlerTable; |
618 | 590 |
619 private: | 591 private: |
620 AdapterFingerPrint* _fingerprint; | 592 AdapterFingerPrint* _fingerprint; |
621 address _i2c_entry; | 593 address _i2c_entry; |
648 | 620 |
649 // should never be used | 621 // should never be used |
650 AdapterHandlerEntry(); | 622 AdapterHandlerEntry(); |
651 | 623 |
652 public: | 624 public: |
653 address get_i2c_entry() { return _i2c_entry; } | 625 address get_i2c_entry() const { return _i2c_entry; } |
654 address get_c2i_entry() { return _c2i_entry; } | 626 address get_c2i_entry() const { return _c2i_entry; } |
655 address get_c2i_unverified_entry() { return _c2i_unverified_entry; } | 627 address get_c2i_unverified_entry() const { return _c2i_unverified_entry; } |
656 | 628 |
629 address base_address(); | |
657 void relocate(address new_base); | 630 void relocate(address new_base); |
658 | 631 |
659 AdapterFingerPrint* fingerprint() { return _fingerprint; } | 632 AdapterFingerPrint* fingerprint() const { return _fingerprint; } |
660 | 633 |
661 AdapterHandlerEntry* next() { | 634 AdapterHandlerEntry* next() { |
662 return (AdapterHandlerEntry*)BasicHashtableEntry::next(); | 635 return (AdapterHandlerEntry*)BasicHashtableEntry<mtCode>::next(); |
663 } | 636 } |
664 | 637 |
665 #ifdef ASSERT | 638 #ifdef ASSERT |
666 // Used to verify that code generated for shared adapters is equivalent | 639 // Used to verify that code generated for shared adapters is equivalent |
667 void save_code(unsigned char* code, int length, int total_args_passed, BasicType* sig_bt); | 640 void save_code(unsigned char* code, int length, int total_args_passed, BasicType* sig_bt); |
668 bool compare_code(unsigned char* code, int length, int total_args_passed, BasicType* sig_bt); | 641 bool compare_code(unsigned char* code, int length, int total_args_passed, BasicType* sig_bt); |
669 #endif | 642 #endif |
670 | 643 |
671 void print(); | 644 //virtual void print_on(outputStream* st) const; DO NOT USE |
645 void print_adapter_on(outputStream* st) const; | |
672 }; | 646 }; |
673 | 647 |
674 class AdapterHandlerLibrary: public AllStatic { | 648 class AdapterHandlerLibrary: public AllStatic { |
675 private: | 649 private: |
676 static BufferBlob* _buffer; // the temporary code buffer in CodeCache | 650 static BufferBlob* _buffer; // the temporary code buffer in CodeCache |