Mercurial > hg > graal-compiler
comparison src/share/vm/graal/graalVMEntries.cpp @ 3647:dea89750a867
Remove ci usage from switchProbability.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 16 Nov 2011 16:00:11 +0100 |
parents | 148584b96a34 |
children | 81ad8ab1f9fe |
comparison
equal
deleted
inserted
replaced
3646:148584b96a34 | 3647:dea89750a867 |
---|---|
325 } | 325 } |
326 } | 326 } |
327 | 327 |
328 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiMethod_2switchProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) { | 328 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiMethod_2switchProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) { |
329 TRACE_graal_3("VMEntries::RiMethod_typeProfile"); | 329 TRACE_graal_3("VMEntries::RiMethod_typeProfile"); |
330 ciMethodData* method_data; | 330 VM_ENTRY_MARK; |
331 ciMethod* cimethod; | 331 methodOop method = getMethodFromHotSpotMethod(hotspot_method); |
332 { | 332 methodDataOop method_data = method->method_data(); |
333 VM_ENTRY_MARK; | |
334 methodOop method = getMethodFromHotSpotMethod(hotspot_method); | |
335 cimethod = (ciMethod*)CURRENT_ENV->get_object(method); | |
336 } | |
337 method_data = cimethod->method_data(); | |
338 | |
339 jfloat probability = -1; | |
340 | 333 |
341 if (method_data == NULL || !method_data->is_mature()) return NULL; | 334 if (method_data == NULL || !method_data->is_mature()) return NULL; |
342 | 335 |
343 ciProfileData* data = method_data->bci_to_data(bci); | 336 ProfileData* data = method_data->bci_to_data(bci); |
344 if (data == NULL || !data->is_MultiBranchData()) return NULL; | 337 if (data == NULL || !data->is_MultiBranchData()) return NULL; |
345 | 338 |
346 MultiBranchData* branch_data = data->as_MultiBranchData(); | 339 MultiBranchData* branch_data = data->as_MultiBranchData(); |
347 | 340 |
348 long sum = 0; | 341 long sum = 0; |
360 | 353 |
361 // Give up if too few (or too many, in which case the sum will overflow) counts to be meaningful. | 354 // Give up if too few (or too many, in which case the sum will overflow) counts to be meaningful. |
362 // We also check that individual counters are positive first, otherwise the sum can become positive. | 355 // We also check that individual counters are positive first, otherwise the sum can become positive. |
363 if (sum < 10 * (cases + 3)) return NULL; | 356 if (sum < 10 * (cases + 3)) return NULL; |
364 | 357 |
365 { | 358 typeArrayOop probability = oopFactory::new_typeArray(T_DOUBLE, cases + 1, CHECK_NULL); |
366 VM_ENTRY_MARK; | 359 for (int i = 0; i < cases + 1; i++) { |
367 typeArrayOop probability = oopFactory::new_typeArray(T_DOUBLE, cases + 1, CHECK_NULL); | 360 probability->double_at_put(i, counts->at(i) / (double) sum); |
368 for (int i = 0; i < cases + 1; i++) { | 361 } |
369 probability->double_at_put(i, counts->at(i) / (double) sum); | 362 return JNIHandles::make_local(probability); |
370 } | |
371 return JNIHandles::make_local(probability); | |
372 } | |
373 } | 363 } |
374 | 364 |
375 // public native boolean RiMethod_hasCompiledCode(HotSpotMethodResolved method); | 365 // public native boolean RiMethod_hasCompiledCode(HotSpotMethodResolved method); |
376 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiMethod_1hasCompiledCode(JNIEnv *, jobject, jobject hotspot_method) { | 366 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiMethod_1hasCompiledCode(JNIEnv *, jobject, jobject hotspot_method) { |
377 TRACE_graal_3("VMEntries::RiMethod_hasCompiledCode"); | 367 TRACE_graal_3("VMEntries::RiMethod_hasCompiledCode"); |