48 uint _count_inline_bcs; // Accumulated count of inlined bytecodes |
48 uint _count_inline_bcs; // Accumulated count of inlined bytecodes |
49 // Call-site count / interpreter invocation count, scaled recursively. |
49 // Call-site count / interpreter invocation count, scaled recursively. |
50 // Always between 0.0 and 1.0. Represents the percentage of the method's |
50 // Always between 0.0 and 1.0. Represents the percentage of the method's |
51 // total execution time used at this call site. |
51 // total execution time used at this call site. |
52 const float _site_invoke_ratio; |
52 const float _site_invoke_ratio; |
53 const int _site_depth_adjust; |
53 const int _max_inline_level; // the maximum inline level for this sub-tree (may be adjusted) |
54 float compute_callee_frequency( int caller_bci ) const; |
54 float compute_callee_frequency( int caller_bci ) const; |
55 |
55 |
56 GrowableArray<InlineTree*> _subtrees; |
56 GrowableArray<InlineTree*> _subtrees; |
57 friend class Compile; |
57 friend class Compile; |
58 |
58 |
61 const InlineTree* caller_tree, |
61 const InlineTree* caller_tree, |
62 ciMethod* callee_method, |
62 ciMethod* callee_method, |
63 JVMState* caller_jvms, |
63 JVMState* caller_jvms, |
64 int caller_bci, |
64 int caller_bci, |
65 float site_invoke_ratio, |
65 float site_invoke_ratio, |
66 int site_depth_adjust); |
66 int max_inline_level); |
67 InlineTree *build_inline_tree_for_callee(ciMethod* callee_method, |
67 InlineTree *build_inline_tree_for_callee(ciMethod* callee_method, |
68 JVMState* caller_jvms, |
68 JVMState* caller_jvms, |
69 int caller_bci); |
69 int caller_bci); |
70 const char* try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result); |
70 const char* try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result); |
71 const char* should_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result) const; |
71 const char* should_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result) const; |
72 const char* should_not_inline(ciMethod* callee_method, ciMethod* caller_method, WarmCallInfo* wci_result) const; |
72 const char* should_not_inline(ciMethod* callee_method, ciMethod* caller_method, WarmCallInfo* wci_result) const; |
73 void print_inlining(ciMethod *callee_method, int caller_bci, const char *failure_msg) const; |
73 void print_inlining(ciMethod *callee_method, int caller_bci, const char *failure_msg) const; |
74 |
74 |
75 InlineTree *caller_tree() const { return _caller_tree; } |
75 InlineTree *caller_tree() const { return _caller_tree; } |
76 InlineTree* callee_at(int bci, ciMethod* m) const; |
76 InlineTree* callee_at(int bci, ciMethod* m) const; |
77 int inline_depth() const { return stack_depth() + _site_depth_adjust; } |
77 int inline_level() const { return stack_depth(); } |
78 int stack_depth() const { return _caller_jvms ? _caller_jvms->depth() : 0; } |
78 int stack_depth() const { return _caller_jvms ? _caller_jvms->depth() : 0; } |
79 |
79 |
80 public: |
80 public: |
81 static InlineTree* build_inline_tree_root(); |
81 static InlineTree* build_inline_tree_root(); |
82 static InlineTree* find_subtree_from_root(InlineTree* root, JVMState* jvms, ciMethod* callee, bool create_if_not_found = false); |
82 static InlineTree* find_subtree_from_root(InlineTree* root, JVMState* jvms, ciMethod* callee, bool create_if_not_found = false); |
83 |
83 |
84 // For temporary (stack-allocated, stateless) ilts: |
84 // For temporary (stack-allocated, stateless) ilts: |
85 InlineTree(Compile* c, ciMethod* callee_method, JVMState* caller_jvms, float site_invoke_ratio, int site_depth_adjust); |
85 InlineTree(Compile* c, ciMethod* callee_method, JVMState* caller_jvms, float site_invoke_ratio, int max_inline_level); |
86 |
86 |
87 // InlineTree enum |
87 // InlineTree enum |
88 enum InlineStyle { |
88 enum InlineStyle { |
89 Inline_do_not_inline = 0, // |
89 Inline_do_not_inline = 0, // |
90 Inline_cha_is_monomorphic = 1, // |
90 Inline_cha_is_monomorphic = 1, // |