src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTCompiler.java
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File hotspot Cdiff src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTCompiler.java

src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTCompiler.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 33,43 **** import org.graalvm.compiler.options.OptionValues; import jdk.vm.ci.meta.ResolvedJavaMethod; ! public class AOTCompiler { private final Main main; private final OptionValues graalOptions; --- 33,43 ---- import org.graalvm.compiler.options.OptionValues; import jdk.vm.ci.meta.ResolvedJavaMethod; ! final class AOTCompiler { private final Main main; private final OptionValues graalOptions;
*** 66,118 **** private final AtomicInteger failedMethodCount = new AtomicInteger(); /** * Create a compile queue with the given number of threads. */ ! public CompileQueue(final int threads) { super(threads, threads, 0L, TimeUnit.MILLISECONDS, new PriorityBlockingQueue<>()); startTime = System.currentTimeMillis(); } @Override protected void afterExecute(Runnable r, Throwable t) { AOTCompilationTask task = (AOTCompilationTask) r; if (task.getResult() != null) { final int count = successfulMethodCount.incrementAndGet(); if (count % 100 == 0) { ! main.printInfo("."); } CompiledMethodInfo result = task.getResult(); if (result != null) { task.getHolder().addCompiledMethod(result); } } else { failedMethodCount.incrementAndGet(); ! main.printlnVerbose(""); ResolvedJavaMethod method = task.getMethod(); ! main.printlnVerbose(" failed " + method.getName() + method.getSignature().toMethodDescriptor()); } } @Override protected void terminated() { final long endTime = System.currentTimeMillis(); final int success = successfulMethodCount.get(); final int failed = failedMethodCount.get(); ! main.printlnInfo(""); ! main.printlnInfo(success + " methods compiled, " + failed + " methods failed (" + (endTime - startTime) + " ms)"); } } /** * @param main * @param graalOptions * @param aotBackend * @param threads number of compilation threads */ ! public AOTCompiler(Main main, OptionValues graalOptions, AOTBackend aotBackend, final int threads) { this.main = main; this.graalOptions = graalOptions; this.compileQueue = new CompileQueue(threads); this.backend = aotBackend; } --- 66,118 ---- private final AtomicInteger failedMethodCount = new AtomicInteger(); /** * Create a compile queue with the given number of threads. */ ! CompileQueue(final int threads) { super(threads, threads, 0L, TimeUnit.MILLISECONDS, new PriorityBlockingQueue<>()); startTime = System.currentTimeMillis(); } @Override protected void afterExecute(Runnable r, Throwable t) { AOTCompilationTask task = (AOTCompilationTask) r; if (task.getResult() != null) { final int count = successfulMethodCount.incrementAndGet(); if (count % 100 == 0) { ! main.printer.printInfo("."); } CompiledMethodInfo result = task.getResult(); if (result != null) { task.getHolder().addCompiledMethod(result); } } else { failedMethodCount.incrementAndGet(); ! main.printer.printlnVerbose(""); ResolvedJavaMethod method = task.getMethod(); ! main.printer.printlnVerbose(" failed " + method.getName() + method.getSignature().toMethodDescriptor()); } } @Override protected void terminated() { final long endTime = System.currentTimeMillis(); final int success = successfulMethodCount.get(); final int failed = failedMethodCount.get(); ! main.printer.printlnInfo(""); ! main.printer.printlnInfo(success + " methods compiled, " + failed + " methods failed (" + (endTime - startTime) + " ms)"); } } /** * @param main * @param graalOptions * @param aotBackend * @param threads number of compilation threads */ ! AOTCompiler(Main main, OptionValues graalOptions, AOTBackend aotBackend, final int threads) { this.main = main; this.graalOptions = graalOptions; this.compileQueue = new CompileQueue(threads); this.backend = aotBackend; }
*** 121,133 **** * Compile all methods in all classes passed. * * @param classes a list of class to compile * @throws InterruptedException */ ! public List<AOTCompiledClass> compileClasses(List<AOTCompiledClass> classes) throws InterruptedException { ! main.printlnInfo("Compiling with " + compileQueue.getCorePoolSize() + " threads"); ! main.printInfo("."); // Compilation progress indication. for (AOTCompiledClass c : classes) { for (ResolvedJavaMethod m : c.getMethods()) { enqueueMethod(c, m); } --- 121,133 ---- * Compile all methods in all classes passed. * * @param classes a list of class to compile * @throws InterruptedException */ ! List<AOTCompiledClass> compileClasses(List<AOTCompiledClass> classes) throws InterruptedException { ! main.printer.printlnInfo("Compiling with " + compileQueue.getCorePoolSize() + " threads"); ! main.printer.printInfo("."); // Compilation progress indication. for (AOTCompiledClass c : classes) { for (ResolvedJavaMethod m : c.getMethods()) { enqueueMethod(c, m); }
*** 158,167 **** } catch (RejectedExecutionException e) { e.printStackTrace(); } } ! public static void logCompilation(String methodName, String message) { ! Main.writeLog(message + " " + methodName); } } --- 158,167 ---- } catch (RejectedExecutionException e) { e.printStackTrace(); } } ! static void logCompilation(String methodName, String message) { ! LogPrinter.writeLog(message + " " + methodName); } }
src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTCompiler.java
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File