comparison src/share/vm/graal/graalVMEntries.cpp @ 3572:076a2c9caf71

Factor out runtime call target address determination to avoid redundancy between CodeInstaller::site_Call() and VMEntries.getMaxCallTargetOffset()
author Peter Hofer <peter.hofer@jku.at>
date Tue, 06 Sep 2011 11:18:53 +0200
parents a72615456c50
children 96c40b338c1a
comparison
equal deleted inserted replaced
3571:a72615456c50 3572:076a2c9caf71
802 // public long getMaxCallTargetOffset(CiRuntimeCall rtcall); 802 // public long getMaxCallTargetOffset(CiRuntimeCall rtcall);
803 JNIEXPORT jlong JNICALL Java_com_oracle_graal_runtime_VMEntries_getMaxCallTargetOffset(JNIEnv *env, jobject, jobject rtcall) { 803 JNIEXPORT jlong JNICALL Java_com_oracle_graal_runtime_VMEntries_getMaxCallTargetOffset(JNIEnv *env, jobject, jobject rtcall) {
804 TRACE_graal_3("VMEntries::VMEntries_getMaxCallTargetOffset"); 804 TRACE_graal_3("VMEntries::VMEntries_getMaxCallTargetOffset");
805 VM_ENTRY_MARK; 805 VM_ENTRY_MARK;
806 oop call = JNIHandles::resolve(rtcall); 806 oop call = JNIHandles::resolve(rtcall);
807 address target_addr = 0x0; 807 address target_addr = CodeInstaller::runtime_call_target_address(call);
808 if (call == CiRuntimeCall::ArithmeticSin()) {
809 target_addr = CAST_FROM_FN_PTR(address, SharedRuntime::dsin);
810 } else if (call == CiRuntimeCall::ArithmeticCos()) {
811 target_addr = CAST_FROM_FN_PTR(address, SharedRuntime::dcos);
812 } else if (call == CiRuntimeCall::ArithmeticTan()) {
813 target_addr = CAST_FROM_FN_PTR(address, SharedRuntime::dtan);
814 } else if (call == CiRuntimeCall::JavaTimeMillis()) {
815 target_addr = CAST_FROM_FN_PTR(address, os::javaTimeMillis);
816 } else if (call == CiRuntimeCall::JavaTimeNanos()) {
817 target_addr = CAST_FROM_FN_PTR(address, os::javaTimeNanos);
818 }
819 if (target_addr != 0x0) { 808 if (target_addr != 0x0) {
820 int64_t off_low = (int64_t)target_addr - ((int64_t)CodeCache::low_bound() + sizeof(int)); 809 int64_t off_low = (int64_t)target_addr - ((int64_t)CodeCache::low_bound() + sizeof(int));
821 int64_t off_high = (int64_t)target_addr - ((int64_t)CodeCache::high_bound() + sizeof(int)); 810 int64_t off_high = (int64_t)target_addr - ((int64_t)CodeCache::high_bound() + sizeof(int));
822 return MAX2(ABS(off_low), ABS(off_high)); 811 return MAX2(ABS(off_low), ABS(off_high));
823 } 812 }