Mercurial > hg > graal-jvmci-8
changeset 16724:300fffc06b55
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 08 Aug 2014 12:33:38 +0200 |
parents | c880fb576c97 (diff) b1911c1e44c8 (current diff) |
children | 22b2950a0613 |
files | |
diffstat | 4 files changed, 34 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java Thu Aug 07 11:06:09 2014 -0700 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java Fri Aug 08 12:33:38 2014 +0200 @@ -23,6 +23,8 @@ package com.oracle.graal.hotspot.test; import static com.oracle.graal.debug.internal.MemUseTrackerImpl.*; +import static com.oracle.graal.hotspot.CompileTheWorld.*; +import static com.oracle.graal.hotspot.CompileTheWorld.Options.*; import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; import static com.oracle.graal.nodes.StructuredGraph.*; @@ -31,15 +33,24 @@ import com.oracle.graal.debug.*; import com.oracle.graal.debug.internal.*; import com.oracle.graal.hotspot.*; +import com.oracle.graal.hotspot.CompileTheWorld.Config; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.printer.*; /** - * Used to benchmark memory usage during Graal compilation. Run with: + * Used to benchmark memory usage during Graal compilation. + * + * To benchmark: * * <pre> * mx vm -XX:-UseGraalClassLoader -cp @com.oracle.graal.hotspot.test com.oracle.graal.hotspot.test.MemoryUsageBenchmark * </pre> + * + * Memory analysis for a {@link CompileTheWorld} execution can also be performed. For example: + * + * <pre> + * mx --vm server vm -XX:-UseGraalClassLoader -G:CompileTheWorldClasspath=$HOME/SPECjvm2008/SPECjvm2008.jar -cp @com.oracle.graal.hotspot.test com.oracle.graal.hotspot.test.MemoryUsageBenchmark + * </pre> */ public class MemoryUsageBenchmark extends GraalCompilerTest { @@ -149,7 +160,16 @@ } public void run() { + compileAndTime("simple"); compileAndTime("complex"); - compileAndTime("simple"); + if (CompileTheWorldClasspath.getValue() != SUN_BOOT_CLASS_PATH) { + CompileTheWorld ctw = new CompileTheWorld(CompileTheWorldClasspath.getValue(), new Config(CompileTheWorldConfig.getValue()), CompileTheWorldStartAt.getValue(), + CompileTheWorldStopAt.getValue(), CompileTheWorldVerbose.getValue()); + try { + ctw.compile(); + } catch (Throwable e) { + e.printStackTrace(); + } + } } }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java Thu Aug 07 11:06:09 2014 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java Fri Aug 08 12:33:38 2014 +0200 @@ -23,6 +23,7 @@ package com.oracle.graal.hotspot; import static com.oracle.graal.compiler.common.GraalOptions.*; +import static com.oracle.graal.debug.internal.MemUseTrackerImpl.*; import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; import static com.oracle.graal.nodes.StructuredGraph.*; @@ -158,6 +159,7 @@ private int classFileCounter = 0; private int compiledMethodsCounter = 0; private long compileTime = 0; + private long memoryUsed = 0; private boolean verbose; private final Config config; @@ -311,7 +313,7 @@ } println(); - println("CompileTheWorld : Done (%d classes, %d methods, %d ms)", classFileCounter, compiledMethodsCounter, compileTime); + println("CompileTheWorld : Done (%d classes, %d methods, %d ms, %d bytes of memory used)", classFileCounter, compiledMethodsCounter, compileTime, memoryUsed); } class CTWCompilationTask extends CompilationTask { @@ -346,11 +348,13 @@ private void compileMethod(HotSpotResolvedJavaMethod method) { try { long start = System.currentTimeMillis(); + long allocatedAtStart = getCurrentThreadAllocatedBytes(); HotSpotBackend backend = runtime.getHostBackend(); CompilationTask task = new CTWCompilationTask(backend, method); task.runCompilation(); + memoryUsed += getCurrentThreadAllocatedBytes() - allocatedAtStart; compileTime += (System.currentTimeMillis() - start); compiledMethodsCounter++; method.reprofile(); // makes the method also not-entrant
--- a/mx/projects Thu Aug 07 11:06:09 2014 -0700 +++ b/mx/projects Fri Aug 08 12:33:38 2014 +0200 @@ -77,6 +77,7 @@ library@JAVA_ALLOCATION_INSTRUMENTER@sourcePath=lib/java-allocation-instrumenter.jar library@JAVA_ALLOCATION_INSTRUMENTER@urls=http://lafo.ssw.uni-linz.ac.at/java-allocation-instrumenter/java-allocation-instrumenter-8f0db117e64e.jar library@JAVA_ALLOCATION_INSTRUMENTER@sha1=476d9a44cd19d6b55f81571077dfa972a4f8a083 +library@JAVA_ALLOCATION_INSTRUMENTER@bootClassPathAgent=true library@VECMATH@path=lib/vecmath-1.3.1.jar library@VECMATH@urls=http://lafo.ssw.uni-linz.ac.at/graal-external-deps/vecmath-1.3.1.jar,http://mirrors.ibiblio.org/pub/mirrors/maven/java3d/jars/vecmath-1.3.1.jar
--- a/mxtool/mx.py Thu Aug 07 11:06:09 2014 -0700 +++ b/mxtool/mx.py Fri Aug 08 12:33:38 2014 +0200 @@ -503,7 +503,7 @@ d.update(buf) return d.hexdigest() -def download_file_with_sha1(name, path, urls, sha1, sha1path, resolve, mustExist, sources=False): +def download_file_with_sha1(name, path, urls, sha1, sha1path, resolve, mustExist, sources=False, canSymlink=True): def _download_lib(): cacheDir = get_env('MX_CACHE_DIR', join(_opts.user_home, '.mx', 'cache')) if not exists(cacheDir): @@ -520,7 +520,8 @@ d = dirname(path) if d != '' and not exists(d): os.makedirs(d) - if 'symlink' in dir(os): + + if canSymlink and 'symlink' in dir(os): if exists(path): os.unlink(path) os.symlink(cachePath, path) @@ -654,7 +655,9 @@ if includedInJDK and java().javaCompliance >= JavaCompliance(includedInJDK): return None - return download_file_with_sha1(self.name, path, self.urls, self.sha1, sha1path, resolve, not self.optional) + bootClassPathAgent = self.bootClassPathAgent.lower() == 'true' if hasattr(self, 'bootClassPathAgent') else False + + return download_file_with_sha1(self.name, path, self.urls, self.sha1, sha1path, resolve, not self.optional, canSymlink=not bootClassPathAgent) def get_source_path(self, resolve): if self.sourcePath is None: