Mercurial > hg > graal-jvmci-8
comparison src/share/vm/graal/graalVMEntries.cpp @ 3465:8cd198d7cbc1
When a method that has been compiled before is considered for inlining, use its compiled (native) code size for size checks. This avoids inlining compiled methods that already contain many other inlined methods, reducing generated code size and usually execution time as well. Also, add GraalMetrics bookkeeping for inlining.
author | Peter Hofer <peter.hofer@jku.at> |
---|---|
date | Mon, 01 Aug 2011 13:45:25 +0200 |
parents | 76507b87dd25 |
children | b9ed7199f6fb |
comparison
equal
deleted
inserted
replaced
3464:be4ca325525a | 3465:8cd198d7cbc1 |
---|---|
181 TRACE_graal_3("VMEntries::RiMethod_invocationCount"); | 181 TRACE_graal_3("VMEntries::RiMethod_invocationCount"); |
182 methodOop method = getMethodFromHotSpotMethod(hotspot_method); | 182 methodOop method = getMethodFromHotSpotMethod(hotspot_method); |
183 return method->invocation_count(); | 183 return method->invocation_count(); |
184 } | 184 } |
185 | 185 |
186 // public native int RiMethod_throwoutCount(long vmId); | 186 // public native int RiMethod_exceptionProbability(long vmId, int bci); |
187 JNIEXPORT jint JNICALL Java_com_oracle_graal_runtime_VMEntries_RiMethod_2exceptionProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) { | 187 JNIEXPORT jint JNICALL Java_com_oracle_graal_runtime_VMEntries_RiMethod_2exceptionProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) { |
188 TRACE_graal_3("VMEntries::RiMethod_exceptionProbability"); | 188 TRACE_graal_3("VMEntries::RiMethod_exceptionProbability"); |
189 ciMethod* cimethod; | 189 ciMethod* cimethod; |
190 { | 190 { |
191 VM_ENTRY_MARK; | 191 VM_ENTRY_MARK; |
333 for (int i = 0; i < cases + 1; i++) { | 333 for (int i = 0; i < cases + 1; i++) { |
334 probability->double_at_put(i, counts->at(i) / (double) sum); | 334 probability->double_at_put(i, counts->at(i) / (double) sum); |
335 } | 335 } |
336 return JNIHandles::make_local(probability); | 336 return JNIHandles::make_local(probability); |
337 } | 337 } |
338 } | |
339 | |
340 // public native boolean RiMethod_hasCompiledCode(HotSpotMethodResolved method); | |
341 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_runtime_VMEntries_RiMethod_1hasCompiledCode(JNIEnv *, jobject, jobject hotspot_method) { | |
342 TRACE_graal_3("VMEntries::RiMethod_hasCompiledCode"); | |
343 methodOop method = getMethodFromHotSpotMethod(hotspot_method); | |
344 return method->has_compiled_code(); | |
345 } | |
346 | |
347 // public native boolean RiMethod_compiledCodeSize(HotSpotMethodResolved method); | |
348 JNIEXPORT jint JNICALL Java_com_oracle_graal_runtime_VMEntries_RiMethod_1compiledCodeSize(JNIEnv *, jobject, jobject hotspot_method) { | |
349 TRACE_graal_3("VMEntries::RiMethod_compiledCodeSize"); | |
350 nmethod* code = getMethodFromHotSpotMethod(hotspot_method)->code(); | |
351 if (code != NULL) { | |
352 return code->insts_end() - code->verified_entry_point(); | |
353 } | |
354 return -1; | |
338 } | 355 } |
339 | 356 |
340 // public RiType RiSignature_lookupType(String returnType, HotSpotTypeResolved accessingClass); | 357 // public RiType RiSignature_lookupType(String returnType, HotSpotTypeResolved accessingClass); |
341 JNIEXPORT jobject JNICALL Java_com_oracle_graal_runtime_VMEntries_RiSignature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass) { | 358 JNIEXPORT jobject JNICALL Java_com_oracle_graal_runtime_VMEntries_RiSignature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass) { |
342 TRACE_graal_3("VMEntries::RiSignature_lookupType"); | 359 TRACE_graal_3("VMEntries::RiSignature_lookupType"); |
899 {CC"RiMethod_typeProfile", CC"("RESOLVED_METHOD"I)"TYPE_PROFILE, FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiMethod_2typeProfile)}, | 916 {CC"RiMethod_typeProfile", CC"("RESOLVED_METHOD"I)"TYPE_PROFILE, FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiMethod_2typeProfile)}, |
900 {CC"RiMethod_branchProbability", CC"("RESOLVED_METHOD"I)D", FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiMethod_2branchProbability)}, | 917 {CC"RiMethod_branchProbability", CC"("RESOLVED_METHOD"I)D", FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiMethod_2branchProbability)}, |
901 {CC"RiMethod_switchProbability", CC"("RESOLVED_METHOD"I)[D", FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiMethod_2switchProbability)}, | 918 {CC"RiMethod_switchProbability", CC"("RESOLVED_METHOD"I)[D", FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiMethod_2switchProbability)}, |
902 {CC"RiMethod_invocationCount", CC"("RESOLVED_METHOD")I", FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiMethod_1invocationCount)}, | 919 {CC"RiMethod_invocationCount", CC"("RESOLVED_METHOD")I", FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiMethod_1invocationCount)}, |
903 {CC"RiMethod_exceptionProbability", CC"("RESOLVED_METHOD"I)I", FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiMethod_2exceptionProbability)}, | 920 {CC"RiMethod_exceptionProbability", CC"("RESOLVED_METHOD"I)I", FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiMethod_2exceptionProbability)}, |
921 {CC"RiMethod_hasCompiledCode", CC"("RESOLVED_METHOD")Z", FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiMethod_1hasCompiledCode)}, | |
922 {CC"RiMethod_compiledCodeSize", CC"("RESOLVED_METHOD")I", FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiMethod_1compiledCodeSize)}, | |
904 {CC"RiSignature_lookupType", CC"("STRING RESOLVED_TYPE")"TYPE, FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiSignature_1lookupType)}, | 923 {CC"RiSignature_lookupType", CC"("STRING RESOLVED_TYPE")"TYPE, FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiSignature_1lookupType)}, |
905 {CC"RiConstantPool_lookupConstant", CC"("PROXY"I)"OBJECT, FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiConstantPool_1lookupConstant)}, | 924 {CC"RiConstantPool_lookupConstant", CC"("PROXY"I)"OBJECT, FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiConstantPool_1lookupConstant)}, |
906 {CC"RiConstantPool_lookupMethod", CC"("PROXY"IB)"METHOD, FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiConstantPool_1lookupMethod)}, | 925 {CC"RiConstantPool_lookupMethod", CC"("PROXY"IB)"METHOD, FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiConstantPool_1lookupMethod)}, |
907 {CC"RiConstantPool_lookupSignature", CC"("PROXY"I)"SIGNATURE, FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiConstantPool_1lookupSignature)}, | 926 {CC"RiConstantPool_lookupSignature", CC"("PROXY"I)"SIGNATURE, FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiConstantPool_1lookupSignature)}, |
908 {CC"RiConstantPool_lookupType", CC"("PROXY"I)"TYPE, FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiConstantPool_1lookupType)}, | 927 {CC"RiConstantPool_lookupType", CC"("PROXY"I)"TYPE, FN_PTR(Java_com_oracle_graal_runtime_VMEntries_RiConstantPool_1lookupType)}, |