Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/doCall.cpp @ 3366:e2a92dd0d3d2
7042122: JSR 292: adjust various inline thresholds for JSR 292 API methods and method handle adapters
Reviewed-by: jrose, never, kvn
author | twisti |
---|---|
date | Tue, 10 May 2011 00:45:03 -0700 |
parents | 4124a5a27707 |
children | fabcf26ee72f |
comparison
equal
deleted
inserted
replaced
3365:3cfb240033d1 | 3366:e2a92dd0d3d2 |
---|---|
71 } | 71 } |
72 | 72 |
73 // Note: When we get profiling during stage-1 compiles, we want to pull | 73 // Note: When we get profiling during stage-1 compiles, we want to pull |
74 // from more specific profile data which pertains to this inlining. | 74 // from more specific profile data which pertains to this inlining. |
75 // Right now, ignore the information in jvms->caller(), and do method[bci]. | 75 // Right now, ignore the information in jvms->caller(), and do method[bci]. |
76 ciCallProfile profile = jvms->method()->call_profile_at_bci(jvms->bci()); | 76 ciCallProfile profile = jvms->method()->call_profile_at_bci(jvms->bci()); |
77 Bytecodes::Code bytecode = jvms->method()->java_code_at_bci(jvms->bci()); | |
77 | 78 |
78 // See how many times this site has been invoked. | 79 // See how many times this site has been invoked. |
79 int site_count = profile.count(); | 80 int site_count = profile.count(); |
80 int receiver_count = -1; | 81 int receiver_count = -1; |
81 if (call_is_virtual && UseTypeProfile && profile.has_receiver(0)) { | 82 if (call_is_virtual && UseTypeProfile && profile.has_receiver(0)) { |
114 // Do MethodHandle calls. | 115 // Do MethodHandle calls. |
115 // NOTE: This must happen before normal inlining logic below since | 116 // NOTE: This must happen before normal inlining logic below since |
116 // MethodHandle.invoke* are native methods which obviously don't | 117 // MethodHandle.invoke* are native methods which obviously don't |
117 // have bytecodes and so normal inlining fails. | 118 // have bytecodes and so normal inlining fails. |
118 if (call_method->is_method_handle_invoke()) { | 119 if (call_method->is_method_handle_invoke()) { |
119 if (jvms->method()->java_code_at_bci(jvms->bci()) != Bytecodes::_invokedynamic) { | 120 if (bytecode != Bytecodes::_invokedynamic) { |
120 GraphKit kit(jvms); | 121 GraphKit kit(jvms); |
121 Node* n = kit.argument(0); | 122 Node* n = kit.argument(0); |
122 | 123 |
123 if (n->Opcode() == Op_ConP) { | 124 if (n->Opcode() == Op_ConP) { |
124 const TypeOopPtr* oop_ptr = n->bottom_type()->is_oopptr(); | 125 const TypeOopPtr* oop_ptr = n->bottom_type()->is_oopptr(); |
126 ciMethodHandle* method_handle = const_oop->as_method_handle(); | 127 ciMethodHandle* method_handle = const_oop->as_method_handle(); |
127 | 128 |
128 // Set the actually called method to have access to the class | 129 // Set the actually called method to have access to the class |
129 // and signature in the MethodHandleCompiler. | 130 // and signature in the MethodHandleCompiler. |
130 method_handle->set_callee(call_method); | 131 method_handle->set_callee(call_method); |
132 method_handle->set_call_profile(&profile); | |
131 | 133 |
132 // Get an adapter for the MethodHandle. | 134 // Get an adapter for the MethodHandle. |
133 ciMethod* target_method = method_handle->get_method_handle_adapter(); | 135 ciMethod* target_method = method_handle->get_method_handle_adapter(); |
134 CallGenerator* hit_cg = NULL; | 136 if (target_method != NULL) { |
135 if (target_method != NULL) | 137 CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor); |
136 hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor); | 138 if (hit_cg != NULL && hit_cg->is_inline()) |
137 if (hit_cg != NULL && hit_cg->is_inline()) | 139 return hit_cg; |
138 return hit_cg; | 140 } |
139 } | 141 } |
140 | 142 |
141 return CallGenerator::for_direct_call(call_method); | 143 return CallGenerator::for_direct_call(call_method); |
142 } | 144 } |
143 else { | 145 else { |
149 ciMethodHandle* method_handle = call_site->get_target(); | 151 ciMethodHandle* method_handle = call_site->get_target(); |
150 | 152 |
151 // Set the actually called method to have access to the class | 153 // Set the actually called method to have access to the class |
152 // and signature in the MethodHandleCompiler. | 154 // and signature in the MethodHandleCompiler. |
153 method_handle->set_callee(call_method); | 155 method_handle->set_callee(call_method); |
156 method_handle->set_call_profile(&profile); | |
154 | 157 |
155 // Get an adapter for the MethodHandle. | 158 // Get an adapter for the MethodHandle. |
156 ciMethod* target_method = method_handle->get_invokedynamic_adapter(); | 159 ciMethod* target_method = method_handle->get_invokedynamic_adapter(); |
157 CallGenerator* hit_cg = NULL; | 160 if (target_method != NULL) { |
158 if (target_method != NULL) | 161 CallGenerator* hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor); |
159 hit_cg = this->call_generator(target_method, vtable_index, false, jvms, true, prof_factor); | 162 if (hit_cg != NULL && hit_cg->is_inline()) { |
160 if (hit_cg != NULL && hit_cg->is_inline()) { | 163 CallGenerator* miss_cg = CallGenerator::for_dynamic_call(call_method); |
161 CallGenerator* miss_cg = CallGenerator::for_dynamic_call(call_method); | 164 return CallGenerator::for_predicted_dynamic_call(method_handle, miss_cg, hit_cg, prof_factor); |
162 return CallGenerator::for_predicted_dynamic_call(method_handle, miss_cg, hit_cg, prof_factor); | 165 } |
163 } | 166 } |
164 | 167 |
165 // If something failed, generate a normal dynamic call. | 168 // If something failed, generate a normal dynamic call. |
166 return CallGenerator::for_dynamic_call(call_method); | 169 return CallGenerator::for_dynamic_call(call_method); |
167 } | 170 } |