60 // | result_index (C++ interpreter only) | |
60 // | result_index (C++ interpreter only) | |
61 // |------------------------------------------------------| |
61 // |------------------------------------------------------| |
62 // | method_size | max_stack | |
62 // | method_size | max_stack | |
63 // | max_locals | size_of_parameters | |
63 // | max_locals | size_of_parameters | |
64 // |------------------------------------------------------| |
64 // |------------------------------------------------------| |
65 // | intrinsic_id, highest_tier | (unused) | |
65 // | intrinsic_id, (unused) | throwout_count | |
66 // |------------------------------------------------------| |
66 // |------------------------------------------------------| |
67 // | throwout_count | num_breakpoints | |
67 // | num_breakpoints | (unused) | |
68 // |------------------------------------------------------| |
68 // |------------------------------------------------------| |
69 // | invocation_counter | |
69 // | invocation_counter | |
70 // | backedge_counter | |
70 // | backedge_counter | |
71 // |------------------------------------------------------| |
71 // |------------------------------------------------------| |
72 // | code (pointer) | |
72 // | code (pointer) | |
81 |
81 |
82 |
82 |
83 class CheckedExceptionElement; |
83 class CheckedExceptionElement; |
84 class LocalVariableTableElement; |
84 class LocalVariableTableElement; |
85 class AdapterHandlerEntry; |
85 class AdapterHandlerEntry; |
86 |
|
87 class methodDataOopDesc; |
86 class methodDataOopDesc; |
88 |
87 |
89 class methodOopDesc : public oopDesc { |
88 class methodOopDesc : public oopDesc { |
90 friend class methodKlass; |
89 friend class methodKlass; |
91 friend class VMStructs; |
90 friend class VMStructs; |
92 private: |
91 private: |
93 constMethodOop _constMethod; // Method read-only data. |
92 constMethodOop _constMethod; // Method read-only data. |
94 constantPoolOop _constants; // Constant pool |
93 constantPoolOop _constants; // Constant pool |
95 methodDataOop _method_data; |
94 methodDataOop _method_data; |
96 int _interpreter_invocation_count; // Count of times invoked |
95 int _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered) |
97 AccessFlags _access_flags; // Access flags |
96 AccessFlags _access_flags; // Access flags |
98 int _vtable_index; // vtable index of this method (see VtableIndexFlag) |
97 int _vtable_index; // vtable index of this method (see VtableIndexFlag) |
99 // note: can have vtables with >2**16 elements (because of inheritance) |
98 // note: can have vtables with >2**16 elements (because of inheritance) |
100 #ifdef CC_INTERP |
99 #ifdef CC_INTERP |
101 int _result_index; // C++ interpreter needs for converting results to/from stack |
100 int _result_index; // C++ interpreter needs for converting results to/from stack |
103 u2 _method_size; // size of this object |
102 u2 _method_size; // size of this object |
104 u2 _max_stack; // Maximum number of entries on the expression stack |
103 u2 _max_stack; // Maximum number of entries on the expression stack |
105 u2 _max_locals; // Number of local variables used by this method |
104 u2 _max_locals; // Number of local variables used by this method |
106 u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words |
105 u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words |
107 u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none) |
106 u1 _intrinsic_id; // vmSymbols::intrinsic_id (0 == _none) |
108 u1 _highest_tier_compile; // Highest compile level this method has ever seen. |
|
109 u2 _interpreter_throwout_count; // Count of times method was exited via exception while interpreting |
107 u2 _interpreter_throwout_count; // Count of times method was exited via exception while interpreting |
110 u2 _number_of_breakpoints; // fullspeed debugging support |
108 u2 _number_of_breakpoints; // fullspeed debugging support |
111 InvocationCounter _invocation_counter; // Incremented before each activation of the method - used to trigger frequency-based optimizations |
109 InvocationCounter _invocation_counter; // Incremented before each activation of the method - used to trigger frequency-based optimizations |
112 InvocationCounter _backedge_counter; // Incremented before each backedge taken - used to trigger frequencey-based optimizations |
110 InvocationCounter _backedge_counter; // Incremented before each backedge taken - used to trigger frequencey-based optimizations |
|
111 |
113 #ifndef PRODUCT |
112 #ifndef PRODUCT |
114 int _compiled_invocation_count; // Number of nmethod invocations so far (for perf. debugging) |
113 int _compiled_invocation_count; // Number of nmethod invocations so far (for perf. debugging) |
115 #endif |
114 #endif |
116 // Entry point for calling both from and to the interpreter. |
115 // Entry point for calling both from and to the interpreter. |
117 address _i2i_entry; // All-args-on-stack calling convention |
116 address _i2i_entry; // All-args-on-stack calling convention |
219 void set_max_stack(int size) { _max_stack = size; } |
218 void set_max_stack(int size) { _max_stack = size; } |
220 |
219 |
221 // max locals |
220 // max locals |
222 int max_locals() const { return _max_locals; } |
221 int max_locals() const { return _max_locals; } |
223 void set_max_locals(int size) { _max_locals = size; } |
222 void set_max_locals(int size) { _max_locals = size; } |
224 int highest_tier_compile() { return _highest_tier_compile;} |
223 |
225 void set_highest_tier_compile(int level) { _highest_tier_compile = level;} |
224 int highest_comp_level() const; |
|
225 void set_highest_comp_level(int level); |
|
226 int highest_osr_comp_level() const; |
|
227 void set_highest_osr_comp_level(int level); |
226 |
228 |
227 // Count of times method was exited via exception while interpreting |
229 // Count of times method was exited via exception while interpreting |
228 void interpreter_throwout_increment() { |
230 void interpreter_throwout_increment() { |
229 if (_interpreter_throwout_count < 65534) { |
231 if (_interpreter_throwout_count < 65534) { |
230 _interpreter_throwout_count++; |
232 _interpreter_throwout_count++; |
274 void set_method_data(methodDataOop data) { |
276 void set_method_data(methodDataOop data) { |
275 oop_store_without_check((oop*)&_method_data, (oop)data); |
277 oop_store_without_check((oop*)&_method_data, (oop)data); |
276 } |
278 } |
277 |
279 |
278 // invocation counter |
280 // invocation counter |
279 InvocationCounter* invocation_counter() { return &_invocation_counter; } |
281 InvocationCounter* invocation_counter() { return &_invocation_counter; } |
280 InvocationCounter* backedge_counter() { return &_backedge_counter; } |
282 InvocationCounter* backedge_counter() { return &_backedge_counter; } |
281 int invocation_count() const { return _invocation_counter.count(); } |
283 |
282 int backedge_count() const { return _backedge_counter.count(); } |
284 int invocation_count(); |
283 bool was_executed_more_than(int n) const; |
285 int backedge_count(); |
284 bool was_never_executed() const { return !was_executed_more_than(0); } |
286 |
|
287 bool was_executed_more_than(int n); |
|
288 bool was_never_executed() { return !was_executed_more_than(0); } |
285 |
289 |
286 static void build_interpreter_method_data(methodHandle method, TRAPS); |
290 static void build_interpreter_method_data(methodHandle method, TRAPS); |
287 |
291 |
288 int interpreter_invocation_count() const { return _interpreter_invocation_count; } |
292 int interpreter_invocation_count() { |
|
293 if (TieredCompilation) return invocation_count(); |
|
294 else return _interpreter_invocation_count; |
|
295 } |
289 void set_interpreter_invocation_count(int count) { _interpreter_invocation_count = count; } |
296 void set_interpreter_invocation_count(int count) { _interpreter_invocation_count = count; } |
290 int increment_interpreter_invocation_count() { return ++_interpreter_invocation_count; } |
297 int increment_interpreter_invocation_count() { |
|
298 if (TieredCompilation) ShouldNotReachHere(); |
|
299 return ++_interpreter_invocation_count; |
|
300 } |
291 |
301 |
292 #ifndef PRODUCT |
302 #ifndef PRODUCT |
293 int compiled_invocation_count() const { return _compiled_invocation_count; } |
303 int compiled_invocation_count() const { return _compiled_invocation_count; } |
294 void set_compiled_invocation_count(int count) { _compiled_invocation_count = count; } |
304 void set_compiled_invocation_count(int count) { _compiled_invocation_count = count; } |
295 #endif // not PRODUCT |
305 #endif // not PRODUCT |
296 |
306 |
297 // Clear (non-shared space) pointers which could not be relevant |
307 // Clear (non-shared space) pointers which could not be relevant |
298 // if this (shared) method were mapped into another JVM. |
308 // if this (shared) method were mapped into another JVM. |
359 // Interpreter oopmap support |
369 // Interpreter oopmap support |
360 void mask_for(int bci, InterpreterOopMap* mask); |
370 void mask_for(int bci, InterpreterOopMap* mask); |
361 |
371 |
362 #ifndef PRODUCT |
372 #ifndef PRODUCT |
363 // operations on invocation counter |
373 // operations on invocation counter |
364 void print_invocation_count() const; |
374 void print_invocation_count(); |
365 #endif |
375 #endif |
366 |
376 |
367 // byte codes |
377 // byte codes |
368 void set_code(address code) { return constMethod()->set_code(code); } |
378 void set_code(address code) { return constMethod()->set_code(code); } |
369 address code_base() const { return constMethod()->code_base(); } |
379 address code_base() const { return constMethod()->code_base(); } |
585 // Helper routines for intrinsic_id() and vmIntrinsics::method(). |
595 // Helper routines for intrinsic_id() and vmIntrinsics::method(). |
586 void init_intrinsic_id(); // updates from _none if a match |
596 void init_intrinsic_id(); // updates from _none if a match |
587 static vmSymbols::SID klass_id_for_intrinsics(klassOop holder); |
597 static vmSymbols::SID klass_id_for_intrinsics(klassOop holder); |
588 |
598 |
589 // On-stack replacement support |
599 // On-stack replacement support |
590 bool has_osr_nmethod() { return instanceKlass::cast(method_holder())->lookup_osr_nmethod(this, InvocationEntryBci) != NULL; } |
600 bool has_osr_nmethod(int level, bool match_level) { |
591 nmethod* lookup_osr_nmethod_for(int bci) { return instanceKlass::cast(method_holder())->lookup_osr_nmethod(this, bci); } |
601 return instanceKlass::cast(method_holder())->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL; |
|
602 } |
|
603 |
|
604 nmethod* lookup_osr_nmethod_for(int bci, int level, bool match_level) { |
|
605 return instanceKlass::cast(method_holder())->lookup_osr_nmethod(this, bci, level, match_level); |
|
606 } |
592 |
607 |
593 // Inline cache support |
608 // Inline cache support |
594 void cleanup_inline_caches(); |
609 void cleanup_inline_caches(); |
595 |
610 |
596 // Find if klass for method is loaded |
611 // Find if klass for method is loaded |
598 bool is_klass_loaded(int refinfo_index, bool must_be_resolved = false) const; |
613 bool is_klass_loaded(int refinfo_index, bool must_be_resolved = false) const; |
599 |
614 |
600 // Indicates whether compilation failed earlier for this method, or |
615 // Indicates whether compilation failed earlier for this method, or |
601 // whether it is not compilable for another reason like having a |
616 // whether it is not compilable for another reason like having a |
602 // breakpoint set in it. |
617 // breakpoint set in it. |
603 bool is_not_compilable(int comp_level = CompLevel_highest_tier) const; |
618 bool is_not_compilable(int comp_level = CompLevel_any) const; |
604 void set_not_compilable(int comp_level = CompLevel_highest_tier, bool report = true); |
619 void set_not_compilable(int comp_level = CompLevel_all, bool report = true); |
605 void set_not_compilable_quietly(int comp_level = CompLevel_highest_tier) { |
620 void set_not_compilable_quietly(int comp_level = CompLevel_all) { |
606 set_not_compilable(comp_level, false); |
621 set_not_compilable(comp_level, false); |
607 } |
622 } |
608 |
623 bool is_not_osr_compilable(int comp_level = CompLevel_any) const { |
609 bool is_not_osr_compilable() const { return is_not_compilable() || access_flags().is_not_osr_compilable(); } |
624 return is_not_compilable(comp_level) || access_flags().is_not_osr_compilable(); |
610 void set_not_osr_compilable() { _access_flags.set_not_osr_compilable(); } |
625 } |
611 |
626 void set_not_osr_compilable() { _access_flags.set_not_osr_compilable(); } |
612 bool is_not_tier1_compilable() const { return access_flags().is_not_tier1_compilable(); } |
627 bool is_not_c1_compilable() const { return access_flags().is_not_c1_compilable(); } |
613 void set_not_tier1_compilable() { _access_flags.set_not_tier1_compilable(); } |
628 void set_not_c1_compilable() { _access_flags.set_not_c1_compilable(); } |
|
629 bool is_not_c2_compilable() const { return access_flags().is_not_c2_compilable(); } |
|
630 void set_not_c2_compilable() { _access_flags.set_not_c2_compilable(); } |
614 |
631 |
615 // Background compilation support |
632 // Background compilation support |
616 bool queued_for_compilation() const { return access_flags().queued_for_compilation(); } |
633 bool queued_for_compilation() const { return access_flags().queued_for_compilation(); } |
617 void set_queued_for_compilation() { _access_flags.set_queued_for_compilation(); } |
634 void set_queued_for_compilation() { _access_flags.set_queued_for_compilation(); } |
618 void clear_queued_for_compilation() { _access_flags.clear_queued_for_compilation(); } |
635 void clear_queued_for_compilation() { _access_flags.clear_queued_for_compilation(); } |
619 |
636 |
620 static methodOop method_from_bcp(address bcp); |
637 static methodOop method_from_bcp(address bcp); |
621 |
638 |
622 // Resolve all classes in signature, return 'true' if successful |
639 // Resolve all classes in signature, return 'true' if successful |
623 static bool load_signature_classes(methodHandle m, TRAPS); |
640 static bool load_signature_classes(methodHandle m, TRAPS); |