Mercurial > hg > graal-compiler
comparison src/share/vm/oops/method.hpp @ 8124:5fc51c1ecdeb
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 05 Mar 2013 23:44:54 +0100 |
parents | 989155e2d07a 56c364daccc3 |
children | b8f261ba79c6 |
comparison
equal
deleted
inserted
replaced
7943:a413bcd552a4 | 8124:5fc51c1ecdeb |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
99 class CheckedExceptionElement; | 99 class CheckedExceptionElement; |
100 class LocalVariableTableElement; | 100 class LocalVariableTableElement; |
101 class AdapterHandlerEntry; | 101 class AdapterHandlerEntry; |
102 class MethodData; | 102 class MethodData; |
103 class ConstMethod; | 103 class ConstMethod; |
104 class InlineTableSizes; | |
105 class KlassSizeStats; | |
104 | 106 |
105 class Method : public Metadata { | 107 class Method : public Metadata { |
106 friend class VMStructs; | 108 friend class VMStructs; |
107 private: | 109 private: |
108 ConstMethod* _constMethod; // Method read-only data. | 110 ConstMethod* _constMethod; // Method read-only data. |
129 #ifdef GRAAL | 131 #ifdef GRAAL |
130 jlong _graal_invocation_time; | 132 jlong _graal_invocation_time; |
131 int _graal_priority; | 133 int _graal_priority; |
132 #endif | 134 #endif |
133 #ifdef TIERED | 135 #ifdef TIERED |
136 float _rate; // Events (invocation and backedge counter increments) per millisecond | |
134 jlong _prev_time; // Previous time the rate was acquired | 137 jlong _prev_time; // Previous time the rate was acquired |
135 float _rate; // Events (invocation and backedge counter increments) per millisecond | |
136 #endif | 138 #endif |
137 | 139 |
138 #ifndef PRODUCT | 140 #ifndef PRODUCT |
139 int _compiled_invocation_count; // Number of nmethod invocations so far (for perf. debugging) | 141 int _compiled_invocation_count; // Number of nmethod invocations so far (for perf. debugging) |
140 #endif | 142 #endif |
158 public: | 160 public: |
159 | 161 |
160 static Method* allocate(ClassLoaderData* loader_data, | 162 static Method* allocate(ClassLoaderData* loader_data, |
161 int byte_code_size, | 163 int byte_code_size, |
162 AccessFlags access_flags, | 164 AccessFlags access_flags, |
163 int compressed_line_number_size, | 165 InlineTableSizes* sizes, |
164 int localvariable_table_length, | |
165 int exception_table_length, | |
166 int checked_exceptions_length, | |
167 int method_parameters_length, | |
168 u2 generic_signature_index, | |
169 ConstMethod::MethodType method_type, | 166 ConstMethod::MethodType method_type, |
170 TRAPS); | 167 TRAPS); |
171 | 168 |
172 // CDS and vtbl checking can create an empty Method to get vtbl pointer. | 169 // CDS and vtbl checking can create an empty Method to get vtbl pointer. |
173 Method(){} | 170 Method(){} |
208 int generic_signature_index() const { return constMethod()->generic_signature_index(); } | 205 int generic_signature_index() const { return constMethod()->generic_signature_index(); } |
209 void set_generic_signature_index(int index) { constMethod()->set_generic_signature_index(index); } | 206 void set_generic_signature_index(int index) { constMethod()->set_generic_signature_index(index); } |
210 | 207 |
211 // annotations support | 208 // annotations support |
212 AnnotationArray* annotations() const { | 209 AnnotationArray* annotations() const { |
213 InstanceKlass* ik = method_holder(); | 210 return constMethod()->method_annotations(); |
214 if (ik->annotations() == NULL) { | |
215 return NULL; | |
216 } | |
217 return ik->annotations()->get_method_annotations_of(method_idnum()); | |
218 } | 211 } |
219 AnnotationArray* parameter_annotations() const { | 212 AnnotationArray* parameter_annotations() const { |
220 InstanceKlass* ik = method_holder(); | 213 return constMethod()->parameter_annotations(); |
221 if (ik->annotations() == NULL) { | |
222 return NULL; | |
223 } | |
224 return ik->annotations()->get_method_parameter_annotations_of(method_idnum()); | |
225 } | 214 } |
226 AnnotationArray* annotation_default() const { | 215 AnnotationArray* annotation_default() const { |
227 InstanceKlass* ik = method_holder(); | 216 return constMethod()->default_annotations(); |
228 if (ik->annotations() == NULL) { | 217 } |
229 return NULL; | 218 AnnotationArray* type_annotations() const { |
230 } | 219 return constMethod()->type_annotations(); |
231 return ik->annotations()->get_method_default_annotations_of(method_idnum()); | 220 } |
232 } | |
233 AnnotationArray* type_annotations() const { | |
234 InstanceKlass* ik = method_holder(); | |
235 Annotations* type_annos = ik->type_annotations(); | |
236 if (type_annos == NULL) | |
237 return NULL; | |
238 return type_annos->get_method_annotations_of(method_idnum()); | |
239 } | |
240 | 221 |
241 #ifdef CC_INTERP | 222 #ifdef CC_INTERP |
242 void set_result_index(BasicType type); | 223 void set_result_index(BasicType type); |
243 int result_index() { return _result_index; } | 224 int result_index() { return _result_index; } |
244 #endif | 225 #endif |
448 | 429 |
449 // interpreter entry | 430 // interpreter entry |
450 address interpreter_entry() const { return _i2i_entry; } | 431 address interpreter_entry() const { return _i2i_entry; } |
451 // Only used when first initialize so we can set _i2i_entry and _from_interpreted_entry | 432 // Only used when first initialize so we can set _i2i_entry and _from_interpreted_entry |
452 void set_interpreter_entry(address entry) { _i2i_entry = entry; _from_interpreted_entry = entry; } | 433 void set_interpreter_entry(address entry) { _i2i_entry = entry; _from_interpreted_entry = entry; } |
453 int interpreter_kind(void) { | |
454 return constMethod()->interpreter_kind(); | |
455 } | |
456 void set_interpreter_kind(); | |
457 void set_interpreter_kind(int kind) { | |
458 constMethod()->set_interpreter_kind(kind); | |
459 } | |
460 | 434 |
461 // native function (used for native methods only) | 435 // native function (used for native methods only) |
462 enum { | 436 enum { |
463 native_bind_event_is_interesting = true | 437 native_bind_event_is_interesting = true |
464 }; | 438 }; |
492 void print_codes() const { print_codes_on(tty); } | 466 void print_codes() const { print_codes_on(tty); } |
493 void print_codes_on(outputStream* st) const PRODUCT_RETURN; | 467 void print_codes_on(outputStream* st) const PRODUCT_RETURN; |
494 void print_codes_on(int from, int to, outputStream* st) const PRODUCT_RETURN; | 468 void print_codes_on(int from, int to, outputStream* st) const PRODUCT_RETURN; |
495 | 469 |
496 // method parameters | 470 // method parameters |
471 bool has_method_parameters() const | |
472 { return constMethod()->has_method_parameters(); } | |
497 int method_parameters_length() const | 473 int method_parameters_length() const |
498 { return constMethod()->method_parameters_length(); } | 474 { return constMethod()->method_parameters_length(); } |
499 MethodParametersElement* method_parameters_start() const | 475 MethodParametersElement* method_parameters_start() const |
500 { return constMethod()->method_parameters_start(); } | 476 { return constMethod()->method_parameters_start(); } |
501 | 477 |
603 | 579 |
604 // sizing | 580 // sizing |
605 static int header_size() { return sizeof(Method)/HeapWordSize; } | 581 static int header_size() { return sizeof(Method)/HeapWordSize; } |
606 static int size(bool is_native); | 582 static int size(bool is_native); |
607 int size() const { return method_size(); } | 583 int size() const { return method_size(); } |
584 #if INCLUDE_SERVICES | |
585 void collect_statistics(KlassSizeStats *sz) const; | |
586 #endif | |
608 | 587 |
609 // interpreter support | 588 // interpreter support |
610 static ByteSize const_offset() { return byte_offset_of(Method, _constMethod ); } | 589 static ByteSize const_offset() { return byte_offset_of(Method, _constMethod ); } |
611 static ByteSize access_flags_offset() { return byte_offset_of(Method, _access_flags ); } | 590 static ByteSize access_flags_offset() { return byte_offset_of(Method, _access_flags ); } |
612 #ifdef CC_INTERP | 591 #ifdef CC_INTERP |
774 | 753 |
775 // Indicates whether compilation failed earlier for this method, or | 754 // Indicates whether compilation failed earlier for this method, or |
776 // whether it is not compilable for another reason like having a | 755 // whether it is not compilable for another reason like having a |
777 // breakpoint set in it. | 756 // breakpoint set in it. |
778 bool is_not_compilable(int comp_level = CompLevel_any) const; | 757 bool is_not_compilable(int comp_level = CompLevel_any) const; |
779 void set_not_compilable(int comp_level = CompLevel_all, bool report = true); | 758 void set_not_compilable(int comp_level = CompLevel_all, bool report = true, const char* reason = NULL); |
780 void set_not_compilable_quietly(int comp_level = CompLevel_all) { | 759 void set_not_compilable_quietly(int comp_level = CompLevel_all) { |
781 set_not_compilable(comp_level, false); | 760 set_not_compilable(comp_level, false); |
782 } | 761 } |
783 bool is_not_osr_compilable(int comp_level = CompLevel_any) const; | 762 bool is_not_osr_compilable(int comp_level = CompLevel_any) const; |
784 void set_not_osr_compilable(int comp_level = CompLevel_all, bool report = true); | 763 void set_not_osr_compilable(int comp_level = CompLevel_all, bool report = true, const char* reason = NULL); |
785 void set_not_osr_compilable_quietly(int comp_level = CompLevel_all) { | 764 void set_not_osr_compilable_quietly(int comp_level = CompLevel_all) { |
786 set_not_osr_compilable(comp_level, false); | 765 set_not_osr_compilable(comp_level, false); |
787 } | 766 } |
788 | 767 |
789 private: | 768 private: |
790 void print_made_not_compilable(int comp_level, bool is_osr, bool report); | 769 void print_made_not_compilable(int comp_level, bool is_osr, bool report, const char* reason); |
791 | 770 |
792 public: | 771 public: |
793 bool is_not_c1_compilable() const { return access_flags().is_not_c1_compilable(); } | 772 bool is_not_c1_compilable() const { return access_flags().is_not_c1_compilable(); } |
794 void set_not_c1_compilable() { _access_flags.set_not_c1_compilable(); } | 773 void set_not_c1_compilable() { _access_flags.set_not_c1_compilable(); } |
795 bool is_not_c2_compilable() const { return access_flags().is_not_c2_compilable(); } | 774 bool is_not_c2_compilable() const { return access_flags().is_not_c2_compilable(); } |
810 | 789 |
811 // Return if true if not all classes references in signature, including return type, has been loaded | 790 // Return if true if not all classes references in signature, including return type, has been loaded |
812 static bool has_unloaded_classes_in_signature(methodHandle m, TRAPS); | 791 static bool has_unloaded_classes_in_signature(methodHandle m, TRAPS); |
813 | 792 |
814 // Printing | 793 // Printing |
815 void print_short_name(outputStream* st = tty) /*PRODUCT_RETURN*/; // prints as klassname::methodname; Exposed so field engineers can debug VM | 794 void print_short_name(outputStream* st = tty); // prints as klassname::methodname; Exposed so field engineers can debug VM |
795 #if INCLUDE_JVMTI | |
796 void print_name(outputStream* st = tty); // prints as "virtual void foo(int)"; exposed for TraceRedefineClasses | |
797 #else | |
816 void print_name(outputStream* st = tty) PRODUCT_RETURN; // prints as "virtual void foo(int)" | 798 void print_name(outputStream* st = tty) PRODUCT_RETURN; // prints as "virtual void foo(int)" |
799 #endif | |
817 | 800 |
818 // Helper routine used for method sorting | 801 // Helper routine used for method sorting |
819 static void sort_methods(Array<Method*>* methods, | 802 static void sort_methods(Array<Method*>* methods, bool idempotent = false); |
820 Array<AnnotationArray*>* methods_annotations, | |
821 Array<AnnotationArray*>* methods_parameter_annotations, | |
822 Array<AnnotationArray*>* methods_default_annotations, | |
823 Array<AnnotationArray*>* methods_type_annotations, | |
824 bool idempotent = false); | |
825 | 803 |
826 // Deallocation function for redefine classes or if an error occurs | 804 // Deallocation function for redefine classes or if an error occurs |
827 void deallocate_contents(ClassLoaderData* loader_data); | 805 void deallocate_contents(ClassLoaderData* loader_data); |
828 | 806 |
829 // Printing | 807 // Printing |