Mercurial > hg > graal-compiler
changeset 15045:0286888f792b
fix PrintCompilation formatting and use same time source
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Wed, 09 Apr 2014 16:33:32 -0700 |
parents | 5efc947b216b |
children | 5c71dcf0915d |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java src/share/vm/graal/graalCompilerToVM.cpp |
diffstat | 4 files changed, 40 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Wed Apr 09 18:31:45 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Wed Apr 09 16:33:32 2014 -0700 @@ -59,8 +59,6 @@ public class CompilationTask implements Runnable, Comparable<Object> { - private static final long TIMESTAMP_START = System.currentTimeMillis(); - // Keep static finals in a group with withinEnqueue as the last one. CompilationTask can be // called from within it's own clinit so it needs to be careful about accessing state. Once // withinEnqueue is non-null we assume that CompilationTask is fully initialized. @@ -372,18 +370,18 @@ } HotSpotVMConfig config = backend.getRuntime().getConfig(); int compLevel = config.compilationLevelFullOptimization; - char compLevelChar; + String compLevelString; if (config.tieredCompilation) { - compLevelChar = '-'; + compLevelString = "- "; if (compLevel != -1) { - compLevelChar = (char) ('0' + compLevel); + compLevelString = (char) ('0' + compLevel) + " "; } } else { - compLevelChar = ' '; + compLevelString = ""; } boolean hasExceptionHandlers = method.getExceptionHandlers().length > 0; - TTY.println(String.format("%s%7d %4d %c%c%c%c%c%c %s %s(%d bytes)", compilerName, (System.currentTimeMillis() - TIMESTAMP_START), id, isOSR ? '%' : ' ', - Modifier.isSynchronized(mod) ? 's' : ' ', hasExceptionHandlers ? '!' : ' ', blocking ? 'b' : ' ', Modifier.isNative(mod) ? 'n' : ' ', compLevelChar, + TTY.println(String.format("%s%7d %4d %c%c%c%c%c %s %s %s(%d bytes)", compilerName, backend.getRuntime().compilerToVm.getTimeStamp(), id, isOSR ? '%' : ' ', + Modifier.isSynchronized(mod) ? 's' : ' ', hasExceptionHandlers ? '!' : ' ', blocking ? 'b' : ' ', Modifier.isNative(mod) ? 'n' : ' ', compLevelString, MetaUtil.format("%H::%n(%p)", method), isOSR ? "@ " + entryBCI + " " : "", method.getCodeSize())); }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Wed Apr 09 18:31:45 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Wed Apr 09 16:33:32 2014 -0700 @@ -36,7 +36,7 @@ /** * Copies the original bytecode of a given method into a given byte array. - * + * * @param metaspaceMethod the metaspace Method object * @param code the array into which to copy the original bytecode * @return the value of {@code code} @@ -49,7 +49,7 @@ /** * Determines if a given metaspace Method object has balanced monitors. - * + * * @param metaspaceMethod the metaspace Method object to query * @return true if the method has balanced monitors */ @@ -63,7 +63,7 @@ * <li>the method may have a bytecode breakpoint set</li> * <li>the method may have other bytecode features that require special handling by the VM</li> * </ul> - * + * * @param metaspaceMethod the metaspace Method object to query * @return true if the method can be inlined */ @@ -75,7 +75,7 @@ * <li>a CompileOracle directive may forces inlining of this methods</li> * <li>an annotation forces inlining of this method</li> * </ul> - * + * * @param metaspaceMethod the metaspace Method object to query * @return true if the method should be inlined */ @@ -83,7 +83,7 @@ /** * Used to implement {@link ResolvedJavaType#findUniqueConcreteMethod(ResolvedJavaMethod)}. - * + * * @param metaspaceMethod the metaspace Method on which to based the search * @return the metaspace Method result or 0 is there is no unique concrete method for * {@code metaspaceMethod} @@ -92,7 +92,7 @@ /** * Returns the implementor for the given interface class. - * + * * @param metaspaceKlass the metaspace klass to get the implementor for * @return the implementor as metaspace klass pointer or null if there is no implementor */ @@ -100,7 +100,7 @@ /** * Determines if a given metaspace method is ignored by security stack walks. - * + * * @param metaspaceMethod the metaspace Method object * @return true if the method is ignored */ @@ -108,7 +108,7 @@ /** * Converts a name to a metaspace klass. - * + * * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format * @param accessingClass the context of resolution (may be null) * @param resolve force resolution to a {@link ResolvedJavaType}. If true, this method will @@ -134,7 +134,7 @@ /** * Looks up a class entry in a constant pool. - * + * * @param metaspaceConstantPool metaspace constant pool pointer * @param cpi constant pool index * @return a metaspace Klass for a resolved method entry, a metaspace Symbol otherwise (with @@ -144,7 +144,7 @@ /** * Looks up a method entry in a constant pool. - * + * * @param metaspaceConstantPool metaspace constant pool pointer * @param cpi constant pool index * @return a metaspace Method for a resolved method entry, 0 otherwise @@ -154,12 +154,12 @@ /** * Looks up a field entry in a constant pool and attempts to resolve it. The values returned in * {@code info} are: - * + * * <pre> * [(int) flags, // only valid if field is resolved * (int) offset] // only valid if field is resolved * </pre> - * + * * @param metaspaceConstantPool metaspace constant pool pointer * @param cpi constant pool index * @param info an array in which the details of the field are returned @@ -221,7 +221,7 @@ /** * Installs the result of a compilation into the code cache. - * + * * @param compiledCode the result of a compilation * @param code the details of the installed CodeBlob are written to this object * @return the outcome of the installation as a {@link CodeInstallResult}. @@ -230,7 +230,7 @@ /** * Notifies the VM of statistics for a completed compilation. - * + * * @param id the identifier of the compilation * @param method the method compiled * @param osr specifies if the compilation was for on-stack-replacement @@ -257,7 +257,7 @@ /** * Gets the metaspace Method object corresponding to a given {@link Class} object and slot * number. - * + * * @param holder method holder * @param slot slot number of the method * @return the metaspace Method @@ -290,7 +290,7 @@ /** * Invalidates the profiling information and restarts profiling upon the next invocation. - * + * * @param metaspaceMethod the metaspace Method object */ void reprofile(long metaspaceMethod); @@ -311,17 +311,25 @@ /** * Gets the names of the supported GPU architectures. - * + * * @return a comma separated list of names */ String getGPUs(); /** - * + * * @param metaspaceMethod the method to check * @param entryBCI * @param level the compilation level * @return true if the {@code metaspaceMethod} has code for {@code level} */ boolean hasCompiledCodeForOSR(long metaspaceMethod, int entryBCI, int level); + + /** + * Fetch the time stamp used for printing inside hotspot. It's relative to VM start to that all + * events can be ordered. + * + * @return milliseconds since VM start + */ + long getTimeStamp(); }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Wed Apr 09 18:31:45 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Wed Apr 09 16:33:32 2014 -0700 @@ -175,4 +175,5 @@ public native boolean hasCompiledCodeForOSR(long metaspaceMethod, int entryBCI, int level); + public native long getTimeStamp(); }
--- a/src/share/vm/graal/graalCompilerToVM.cpp Wed Apr 09 18:31:45 2014 +0200 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Wed Apr 09 16:33:32 2014 -0700 @@ -772,6 +772,12 @@ return method->lookup_osr_nmethod_for(entry_bci, comp_level, true) != NULL; C2V_END +C2V_VMENTRY(jlong, getTimeStamp, (JNIEnv *env, jobject)) + // tty->time_stamp is the time since VM start which should be used + // for all HotSpot log output when a timestamp is required. + return tty->time_stamp().milliseconds(); +C2V_END + #define CC (char*) /*cast a literal from (const char*)*/ #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f)) @@ -842,6 +848,7 @@ {CC"allocateCompileId", CC"("METASPACE_METHOD"I)I", FN_PTR(allocateCompileId)}, {CC"isMature", CC"("METASPACE_METHOD_DATA")Z", FN_PTR(isMature)}, {CC"hasCompiledCodeForOSR", CC"("METASPACE_METHOD"II)Z", FN_PTR(hasCompiledCodeForOSR)}, + {CC"getTimeStamp", CC"()J", FN_PTR(getTimeStamp)}, }; int CompilerToVM_methods_count() {