# HG changeset patch # User Christian Haeubl # Date 1373277711 -7200 # Node ID 08e06d4a9e731b8d3ffc498d70f805635c27d7c5 # Parent 3c2a77f01e8932ba590d5ba277e3209e5ed925b5 Removed API to access method invocation count from Graal. diff -r 3c2a77f01e89 -r 08e06d4a9e73 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java Mon Jul 08 09:58:00 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java Mon Jul 08 12:01:51 2013 +0200 @@ -75,8 +75,6 @@ @NotReported private final long startTime; @NotReported private long threadAllocatedBytesStart; - @NotReported private int startInvCount; - @NotReported private int endInvCount; private int bytecodeCount; private int codeSize; @@ -94,7 +92,6 @@ name = method.getName(); signature = method.getSignature().getMethodDescriptor(); startTime = System.nanoTime(); - startInvCount = method.invocationCount(); bytecodeCount = method.getCodeSize(); threadAllocatedBytesStart = getThreadAllocatedBytes(); } else { @@ -108,7 +105,6 @@ public void finish(HotSpotResolvedJavaMethod method) { if (ENABLED) { duration = System.nanoTime() - startTime; - endInvCount = method.invocationCount(); codeSize = method.getCompiledCodeSize(); memoryUsed = getThreadAllocatedBytes() - threadAllocatedBytesStart; if (current.get().getLast() != this) { diff -r 3c2a77f01e89 -r 08e06d4a9e73 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Mon Jul 08 09:58:00 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Mon Jul 08 12:01:51 2013 +0200 @@ -92,14 +92,6 @@ ResolvedJavaType getUniqueImplementor(HotSpotResolvedObjectType interfaceType); /** - * Gets the invocation count for a method. - * - * @param metaspaceMethod the metaspace Method object to query - * @return the invocation count for the method - */ - int getInvocationCount(long metaspaceMethod); - - /** * Initializes a {@link HotSpotResolvedJavaMethod} object from a metaspace Method object. * * @param metaspaceMethod the metaspace Method object diff -r 3c2a77f01e89 -r 08e06d4a9e73 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Mon Jul 08 09:58:00 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Mon Jul 08 12:01:51 2013 +0200 @@ -73,9 +73,6 @@ public native ResolvedJavaType getUniqueImplementor(HotSpotResolvedObjectType interfaceType); @Override - public native int getInvocationCount(long metaspaceMethod); - - @Override public native JavaType lookupType(String name, HotSpotResolvedObjectType accessingClass, boolean eagerResolve); @Override diff -r 3c2a77f01e89 -r 08e06d4a9e73 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Mon Jul 08 09:58:00 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Mon Jul 08 12:01:51 2013 +0200 @@ -262,8 +262,8 @@ return graalRuntime().getCompilerToVM().getCompiledCodeSize(metaspaceMethod); } - public int invocationCount() { - return graalRuntime().getCompilerToVM().getInvocationCount(metaspaceMethod); + public boolean hasCompiledCode() { + return getCompiledCodeSize() > 0; } @Override diff -r 3c2a77f01e89 -r 08e06d4a9e73 src/share/vm/graal/graalCompilerToVM.cpp --- a/src/share/vm/graal/graalCompilerToVM.cpp Mon Jul 08 09:58:00 2013 +0200 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Mon Jul 08 12:01:51 2013 +0200 @@ -297,11 +297,6 @@ return NULL; C2V_END -C2V_ENTRY(jint, getInvocationCount, (JNIEnv *, jobject, jlong metaspace_method)) - Method* method = asMethod(metaspace_method); - return method->invocation_count(); -C2V_END - C2V_VMENTRY(void, initializeMethod,(JNIEnv *, jobject, jlong metaspace_method, jobject hotspot_method)) methodHandle method = asMethod(metaspace_method); Handle name = java_lang_String::create_from_symbol(method->name(), CHECK); @@ -325,33 +320,7 @@ HotSpotMethodData::set_normalDataSize(hotspot_method_data, method_data->data_size()); HotSpotMethodData::set_extraDataSize(hotspot_method_data, method_data->extra_data_size()); C2V_END - -// ------------------------------------------------------------------ -// Adjust a CounterData count to be commensurate with -// interpreter_invocation_count. If the MDO exists for -// only 25% of the time the method exists, then the -// counts in the MDO should be scaled by 4X, so that -// they can be usefully and stably compared against the -// invocation counts in methods. -int scale_count(MethodData* method_data, int count) { - if (count > 0) { - int counter_life; - int method_life = method_data->method()->interpreter_invocation_count(); - int current_mileage = MethodData::mileage_of(method_data->method()); - int creation_mileage = method_data->creation_mileage(); - counter_life = current_mileage - creation_mileage; - - // counter_life due to backedge_counter could be > method_life - if (counter_life > method_life) - counter_life = method_life; - if (0 < counter_life && counter_life <= method_life) { - count = (int)((double)count * method_life / counter_life + 0.5); - count = (count > 0) ? count : 1; - } - } - return count; -} - + C2V_ENTRY(jint, getCompiledCodeSize, (JNIEnv *env, jobject, jlong metaspace_method)) nmethod* code = (asMethod(metaspace_method))->code(); return code == NULL ? 0 : code->insts_size(); @@ -1262,7 +1231,6 @@ {CC"initializeMethod", CC"("METASPACE_METHOD HS_RESOLVED_METHOD")V", FN_PTR(initializeMethod)}, {CC"initializeMethodData", CC"("METASPACE_METHOD_DATA METHOD_DATA")V", FN_PTR(initializeMethodData)}, {CC"isMethodCompilable", CC"("METASPACE_METHOD")Z", FN_PTR(isMethodCompilable)}, - {CC"getInvocationCount", CC"("METASPACE_METHOD")I", FN_PTR(getInvocationCount)}, {CC"getCompiledCodeSize", CC"("METASPACE_METHOD")I", FN_PTR(getCompiledCodeSize)}, {CC"getVtableEntryOffset", CC"("METASPACE_METHOD")I", FN_PTR(getVtableEntryOffset)}, {CC"hasVtableEntry", CC"("METASPACE_METHOD")Z", FN_PTR(hasVtableEntry)},