changeset 14831:cbf616a24600

Added baseline path in runCompilation
author Niclas Adlertz <niclas.adlertz@oracle.com>
date Mon, 24 Mar 2014 12:10:17 +0000
parents 0361885370fb
children 4e784d4f5aea
files graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java mx/projects
diffstat 3 files changed, 37 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java	Mon Mar 24 10:42:27 2014 +0100
+++ b/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java	Mon Mar 24 12:10:17 2014 +0000
@@ -141,8 +141,6 @@
             }
         }
 
-        // calculate loops and dominators used for some steps..
-
         if (isSynchronized(method.getModifiers())) {
             throw GraalInternalError.unimplemented("Handle synchronized methods");
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Mon Mar 24 10:42:27 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Mon Mar 24 12:10:17 2014 +0000
@@ -39,6 +39,7 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.code.CallingConvention.Type;
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.baseline.*;
 import com.oracle.graal.compiler.CompilerThreadFactory.CompilerThread;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.Debug.Scope;
@@ -46,6 +47,7 @@
 import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.phases.*;
+import com.oracle.graal.java.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
@@ -237,34 +239,41 @@
             TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method);
             long start = System.currentTimeMillis();
             try (Scope s = Debug.scope("Compiling", new DebugDumpScope(String.valueOf(id), true))) {
-                Map<ResolvedJavaMethod, StructuredGraph> graphCache = null;
-                if (GraalOptions.CacheGraphs.getValue()) {
-                    graphCache = new HashMap<>();
-                }
+
+                if (UseBaselineCompiler.getValue() == true) {
+                    HotSpotProviders providers = backend.getProviders();
+                    BaselineCompiler baselineCompiler = new BaselineCompiler(GraphBuilderConfiguration.getDefault(), providers.getMetaAccess());
+                    result = baselineCompiler.generate(method, -1, backend, new CompilationResult(), method, CompilationResultBuilderFactory.Default);
+                } else {
+                    Map<ResolvedJavaMethod, StructuredGraph> graphCache = null;
+                    if (GraalOptions.CacheGraphs.getValue()) {
+                        graphCache = new HashMap<>();
+                    }
 
-                HotSpotProviders providers = backend.getProviders();
-                Replacements replacements = providers.getReplacements();
-                graph = replacements.getMethodSubstitution(method);
-                if (graph == null || entryBCI != INVOCATION_ENTRY_BCI) {
-                    graph = new StructuredGraph(method, entryBCI);
-                } else {
-                    // Compiling method substitution - must clone the graph
-                    graph = graph.copy();
+                    HotSpotProviders providers = backend.getProviders();
+                    Replacements replacements = providers.getReplacements();
+                    graph = replacements.getMethodSubstitution(method);
+                    if (graph == null || entryBCI != INVOCATION_ENTRY_BCI) {
+                        graph = new StructuredGraph(method, entryBCI);
+                    } else {
+                        // Compiling method substitution - must clone the graph
+                        graph = graph.copy();
+                    }
+                    InlinedBytecodes.add(method.getCodeSize());
+                    CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false);
+                    if (graph.getEntryBCI() != StructuredGraph.INVOCATION_ENTRY_BCI) {
+                        // for OSR, only a pointer is passed to the method.
+                        JavaType[] parameterTypes = new JavaType[]{providers.getMetaAccess().lookupJavaType(long.class)};
+                        CallingConvention tmp = providers.getCodeCache().getRegisterConfig().getCallingConvention(JavaCallee, providers.getMetaAccess().lookupJavaType(void.class), parameterTypes,
+                                        backend.getTarget(), false);
+                        cc = new CallingConvention(cc.getStackSize(), cc.getReturn(), tmp.getArgument(0));
+                    }
+                    Suites suites = getSuites(providers);
+                    ProfilingInfo profilingInfo = getProfilingInfo();
+                    OptimisticOptimizations optimisticOpts = getOptimisticOpts(profilingInfo);
+                    result = compileGraph(graph, null, cc, method, providers, backend, backend.getTarget(), graphCache, getGraphBuilderSuite(providers), optimisticOpts, profilingInfo,
+                                    method.getSpeculationLog(), suites, new CompilationResult(), CompilationResultBuilderFactory.Default);
                 }
-                InlinedBytecodes.add(method.getCodeSize());
-                CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false);
-                if (graph.getEntryBCI() != StructuredGraph.INVOCATION_ENTRY_BCI) {
-                    // for OSR, only a pointer is passed to the method.
-                    JavaType[] parameterTypes = new JavaType[]{providers.getMetaAccess().lookupJavaType(long.class)};
-                    CallingConvention tmp = providers.getCodeCache().getRegisterConfig().getCallingConvention(JavaCallee, providers.getMetaAccess().lookupJavaType(void.class), parameterTypes,
-                                    backend.getTarget(), false);
-                    cc = new CallingConvention(cc.getStackSize(), cc.getReturn(), tmp.getArgument(0));
-                }
-                Suites suites = getSuites(providers);
-                ProfilingInfo profilingInfo = getProfilingInfo();
-                OptimisticOptimizations optimisticOpts = getOptimisticOpts(profilingInfo);
-                result = compileGraph(graph, null, cc, method, providers, backend, backend.getTarget(), graphCache, getGraphBuilderSuite(providers), optimisticOpts, profilingInfo,
-                                method.getSpeculationLog(), suites, new CompilationResult(), CompilationResultBuilderFactory.Default);
                 result.setId(getId());
                 result.setEntryBCI(entryBCI);
             } catch (Throwable e) {
@@ -287,6 +296,7 @@
                 }
             }
             stats.finish(method, installedCode);
+
         } catch (BailoutException bailout) {
             BAILOUTS.increment();
             if (ExitVMOnBailout.getValue()) {
--- a/mx/projects	Mon Mar 24 10:42:27 2014 +0100
+++ b/mx/projects	Mon Mar 24 12:10:17 2014 +0000
@@ -141,7 +141,7 @@
 # graal.hotspot
 project@com.oracle.graal.hotspot@subDir=graal
 project@com.oracle.graal.hotspot@sourceDirs=src
-project@com.oracle.graal.hotspot@dependencies=com.oracle.graal.replacements,com.oracle.graal.runtime,com.oracle.graal.printer
+project@com.oracle.graal.hotspot@dependencies=com.oracle.graal.replacements,com.oracle.graal.runtime,com.oracle.graal.printer, com.oracle.graal.baseline
 project@com.oracle.graal.hotspot@checkstyle=com.oracle.graal.graph
 project@com.oracle.graal.hotspot@annotationProcessors=com.oracle.graal.replacements.verifier,com.oracle.graal.service.processor
 project@com.oracle.graal.hotspot@javaCompliance=1.7