# HG changeset patch # User Josef Eisl # Date 1394652764 -3600 # Node ID 3518daf2f9bc1f862e724592ab3b49b5d3503194 # Parent 1596a21c4194fe033d17bb1bbf497211585a43e4 Add call to GraalCompiler.emitCode() from BaselineCompiler. diff -r 1596a21c4194 -r 3518daf2f9bc graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java --- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java Wed Mar 12 19:32:12 2014 +0100 +++ b/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java Wed Mar 12 20:32:44 2014 +0100 @@ -23,37 +23,29 @@ package com.oracle.graal.baseline; import static com.oracle.graal.api.code.TypeCheckHints.*; -import static com.oracle.graal.api.meta.DeoptimizationAction.*; -import static com.oracle.graal.api.meta.DeoptimizationReason.*; import static com.oracle.graal.bytecode.Bytecodes.*; import static com.oracle.graal.phases.GraalOptions.*; import static java.lang.reflect.Modifier.*; -import java.lang.reflect.*; -import java.util.*; - import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.meta.ProfilingInfo.TriState; import com.oracle.graal.api.meta.ResolvedJavaType.Representation; import com.oracle.graal.bytecode.*; +import com.oracle.graal.compiler.*; +import com.oracle.graal.compiler.gen.*; +import com.oracle.graal.compiler.target.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.java.*; import com.oracle.graal.java.BciBlockMapping.Block; import com.oracle.graal.java.BciBlockMapping.ExceptionDispatchBlock; -import com.oracle.graal.java.GraphBuilderPhase.*; import com.oracle.graal.lir.*; +import com.oracle.graal.lir.asm.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.calc.FloatConvertNode.FloatConvert; -import com.oracle.graal.nodes.extended.*; +import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind; import com.oracle.graal.nodes.java.*; -import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind; -import com.oracle.graal.nodes.type.*; -import com.oracle.graal.nodes.util.*; -import com.oracle.graal.phases.*; -import com.oracle.graal.phases.tiers.*; /** * The {@code GraphBuilder} class parses the bytecode of a method and builds the IR graph. @@ -90,7 +82,8 @@ return method; } - public LIR generate(ResolvedJavaMethod method, int entryBCI) { + public CompilationResult generate(ResolvedJavaMethod method, int entryBCI, Backend backend, CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner, + CompilationResultBuilderFactory factory) { this.method = method; this.entryBCI = entryBCI; profilingInfo = method.getProfilingInfo(); @@ -100,12 +93,21 @@ unwindBlock = null; methodSynchronizedObject = null; TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method); + + // build blocks try { build(); } finally { filter.remove(); } - return null; + // emitLIR + LIRBlock b = new LIRBlock(); + LIRGenerator lirGen = null; + // emitCode + Assumptions assumptions = new Assumptions(OptAssumptions.getValue()); + GraalCompiler.emitCode(backend, new long[0], assumptions, lirGen, compilationResult, installedCodeOwner, factory); + + return compilationResult; } protected void build() { @@ -131,9 +133,9 @@ throw GraalInternalError.unimplemented("Handle start block as loop header"); } - for (Block block : blockMap.blocks) { - processBlock(block); - } + /* + * for (Block block : blockMap.blocks) { processBlock(block); } + */ indent.outdent(); } diff -r 1596a21c4194 -r 3518daf2f9bc graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/LIRBlock.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/LIRBlock.java Wed Mar 12 20:32:44 2014 +0100 @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2014, 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.baseline; + +import java.util.*; + +import com.oracle.graal.graph.*; +import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.cfg.*; + +public class LIRBlock implements com.oracle.graal.nodes.cfg.AbstractBlock { + + public int getId() { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public AbstractBeginNode getBeginNode() { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public Loop getLoop() { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public int getLoopDepth() { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public boolean isLoopHeader() { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public boolean isLoopEnd() { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public boolean isExceptionEntry() { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public List getPredecessors() { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public int getPredecessorCount() { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public List getSuccessors() { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public int getSuccessorCount() { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public int getLinearScanNumber() { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public void setLinearScanNumber(int linearScanNumber) { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public boolean isAligned() { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public void setAlign(boolean align) { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + + public LIRBlock getDominator() { + // TODO Auto-generated method stub + throw GraalInternalError.unimplemented("Auto-generated method stub"); + } + +} diff -r 1596a21c4194 -r 3518daf2f9bc graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Wed Mar 12 19:32:12 2014 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Wed Mar 12 20:32:44 2014 +0100 @@ -500,8 +500,7 @@ private CompilationResult compileBaseline(ResolvedJavaMethod javaMethod) { try (Scope bds = Debug.scope("compileBaseline")) { BaselineCompiler baselineCompiler = new BaselineCompiler(GraphBuilderConfiguration.getDefault(), providers.getMetaAccess()); - baselineCompiler.generate(javaMethod, -1); - return null; + return baselineCompiler.generate(javaMethod, -1, getBackend(), new CompilationResult(), javaMethod, CompilationResultBuilderFactory.Default); } catch (Throwable e) { throw Debug.handle(e); } diff -r 1596a21c4194 -r 3518daf2f9bc mx/projects --- a/mx/projects Wed Mar 12 19:32:12 2014 +0100 +++ b/mx/projects Wed Mar 12 20:32:44 2014 +0100 @@ -479,7 +479,7 @@ # graal.baseline project@com.oracle.graal.baseline@subDir=graal project@com.oracle.graal.baseline@sourceDirs=src -project@com.oracle.graal.baseline@dependencies=com.oracle.graal.java,com.oracle.graal.lir +project@com.oracle.graal.baseline@dependencies=com.oracle.graal.java,com.oracle.graal.lir,com.oracle.graal.compiler project@com.oracle.graal.baseline@checkstyle=com.oracle.graal.graph project@com.oracle.graal.baseline@javaCompliance=1.7 project@com.oracle.graal.baseline@workingSets=Graal,Java