# HG changeset patch # User Thomas Wuerthinger # Date 1307532943 -7200 # Node ID 224412c2442616a7fd421ec15ea40709a7c98584 # Parent 0e10a9bce78e4883573fc612de7950c4d5f41c79 Changed C1X=>Graal and c1x=>graal in Java code. diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/C1XCompilation.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/C1XCompilation.java Wed Jun 08 13:19:56 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,310 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.max.graal.compiler; - -import java.util.*; - -import com.oracle.max.asm.*; -import com.oracle.max.graal.compiler.alloc.*; -import com.oracle.max.graal.compiler.asm.*; -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.gen.*; -import com.oracle.max.graal.compiler.gen.LIRGenerator.*; -import com.oracle.max.graal.compiler.graph.*; -import com.oracle.max.graal.compiler.lir.*; -import com.oracle.max.graal.compiler.observer.*; -import com.oracle.max.graal.compiler.value.*; -import com.sun.cri.ci.*; -import com.sun.cri.ri.*; - -/** - * This class encapsulates global information about the compilation of a particular method, - * including a reference to the runtime, statistics about the compiled code, etc. - */ -public final class C1XCompilation { - - private static ThreadLocal currentCompilation = new ThreadLocal(); - - public final C1XCompiler compiler; - public final CiTarget target; - public final RiRuntime runtime; - public final RiMethod method; - public final RiRegisterConfig registerConfig; - public final CiStatistics stats; - public final CiAssumptions assumptions = new CiAssumptions(); - public final FrameState placeholderState; - - public CompilerGraph graph = new CompilerGraph(); - - private boolean hasExceptionHandlers; - private final C1XCompilation parent; - - /** - * @see #setNotTypesafe() - * @see #isTypesafe() - */ - private boolean typesafe = true; - - private int nextID = 1; - - private FrameMap frameMap; - private TargetMethodAssembler assembler; - - private IR hir; - - private LIRGenerator lirGenerator; - - /** - * Creates a new compilation for the specified method and runtime. - * - * @param compiler the compiler - * @param method the method to be compiled or {@code null} if generating code for a stub - * @param osrBCI the bytecode index for on-stack replacement, if requested - * @param stats externally supplied statistics object to be used if not {@code null} - */ - public C1XCompilation(C1XCompiler compiler, RiMethod method, int osrBCI, CiStatistics stats) { - if (osrBCI != -1) { - throw new CiBailout("No OSR supported"); - } - this.parent = currentCompilation.get(); - currentCompilation.set(this); - this.compiler = compiler; - this.target = compiler.target; - this.runtime = compiler.runtime; - this.method = method; - this.stats = stats == null ? new CiStatistics() : stats; - this.registerConfig = method == null ? compiler.globalStubRegisterConfig : runtime.getRegisterConfig(method); - this.placeholderState = method != null && method.minimalDebugInfo() ? new FrameState(method, 0, 0, 0, 0, graph) : null; - - if (compiler.isObserved()) { - compiler.fireCompilationStarted(new CompilationEvent(this)); - } - } - - public void close() { - currentCompilation.set(parent); - } - - public IR hir() { - return hir; - } - - /** - * Records that this compilation has exception handlers. - */ - public void setHasExceptionHandlers() { - hasExceptionHandlers = true; - } - - /** - * Translates a given kind to a canonical architecture kind. - * This is an identity function for all but {@link CiKind#Word} - * which is translated to {@link CiKind#Int} or {@link CiKind#Long} - * depending on whether or not this is a {@linkplain #is64Bit() 64-bit} - * compilation. - */ - public CiKind archKind(CiKind kind) { - if (kind.isWord()) { - return target.arch.is64bit() ? CiKind.Long : CiKind.Int; - } - return kind; - } - - /** - * Determines if two given kinds are equal at the {@linkplain #archKind(CiKind) architecture} level. - */ - public boolean archKindsEqual(CiKind kind1, CiKind kind2) { - return archKind(kind1) == archKind(kind2); - } - - /** - * Records an assumption that the specified type has no finalizable subclasses. - * - * @param receiverType the type that is assumed to have no finalizable subclasses - * @return {@code true} if the assumption was recorded and can be assumed; {@code false} otherwise - */ - public boolean recordNoFinalizableSubclassAssumption(RiType receiverType) { - return false; - } - - /** - * Converts this compilation to a string. - * - * @return a string representation of this compilation - */ - @Override - public String toString() { - return "compile: " + method; - } - - /** - * Builds the block map for the specified method. - * - * @param method the method for which to build the block map - * @param osrBCI the OSR bytecode index; {@code -1} if this is not an OSR - * @return the block map for the specified method - */ - public BlockMap getBlockMap(RiMethod method) { - BlockMap map = new BlockMap(method); - map.build(); - if (compiler.isObserved()) { - String label = CiUtil.format("BlockListBuilder %f %r %H.%n(%p)", method, true); - compiler.fireCompilationEvent(new CompilationEvent(this, label, map, method.code().length)); - } - stats.bytecodeCount += method.code().length; - return map; - } - - /** - * Returns the frame map of this compilation. - * @return the frame map - */ - public FrameMap frameMap() { - return frameMap; - } - - public TargetMethodAssembler assembler() { - if (assembler == null) { - AbstractAssembler asm = compiler.backend.newAssembler(registerConfig); - assembler = new TargetMethodAssembler(asm); - assembler.setFrameSize(frameMap.frameSize()); - assembler.targetMethod.setCustomStackAreaOffset(frameMap.offsetToCustomArea()); - } - return assembler; - } - - public boolean hasExceptionHandlers() { - return hasExceptionHandlers; - } - - public CiResult compile() { - CiTargetMethod targetMethod; - try { - emitHIR(); - emitLIR(); - targetMethod = emitCode(); - - if (C1XOptions.PrintMetrics) { - C1XMetrics.BytecodesCompiled += method.code().length; - } - } catch (CiBailout b) { - return new CiResult(null, b, stats); - } catch (Throwable t) { - if (C1XOptions.BailoutOnException) { - return new CiResult(null, new CiBailout("Exception while compiling: " + method, t), stats); - } else { - throw new RuntimeException(t); - } - } finally { - if (compiler.isObserved()) { - compiler.fireCompilationFinished(new CompilationEvent(this)); - } - } - - return new CiResult(targetMethod, null, stats); - } - - public IR emitHIR() { - hir = new IR(this); - hir.build(); - return hir; - } - - public void initFrameMap(int numberOfLocks) { - frameMap = this.compiler.backend.newFrameMap(method, numberOfLocks); - } - - private void emitLIR() { - if (C1XOptions.GenLIR) { - if (C1XOptions.PrintTimers) { - C1XTimers.LIR_CREATE.start(); - } - - initFrameMap(hir.maxLocks()); - - lirGenerator = compiler.backend.newLIRGenerator(this); - - for (LIRBlock begin : hir.linearScanOrder()) { - lirGenerator.doBlock(begin); - } - - if (C1XOptions.PrintTimers) { - C1XTimers.LIR_CREATE.stop(); - } - - if (C1XOptions.PrintLIR && !TTY.isSuppressed()) { - LIRList.printLIR(hir.linearScanOrder()); - } - - new LinearScan(this, hir, lirGenerator, frameMap()).allocate(); - } - } - - private CiTargetMethod emitCode() { - if (C1XOptions.GenLIR && C1XOptions.GenCode) { - final LIRAssembler lirAssembler = compiler.backend.newLIRAssembler(this); - lirAssembler.emitCode(hir.linearScanOrder()); - - // generate code for slow cases - lirAssembler.emitLocalStubs(); - - // generate deoptimization stubs - ArrayList deoptimizationStubs = lirGenerator.deoptimizationStubs(); - if (deoptimizationStubs != null) { - for (DeoptimizationStub stub : deoptimizationStubs) { - lirAssembler.emitDeoptizationStub(stub); - } - } - - // generate traps at the end of the method - lirAssembler.emitTraps(); - - CiTargetMethod targetMethod = assembler().finishTargetMethod(method, runtime, lirAssembler.registerRestoreEpilogueOffset, false); - if (assumptions.count() > 0) { - targetMethod.setAssumptions(assumptions); - } - - if (compiler.isObserved()) { - compiler.fireCompilationEvent(new CompilationEvent(this, "After code generation", graph, false, true, targetMethod)); - } - - if (C1XOptions.PrintTimers) { - C1XTimers.CODE_CREATE.stop(); - } - return targetMethod; - } - - return null; - } - - public int nextID() { - return nextID++; - } - - public static C1XCompilation compilation() { - C1XCompilation compilation = currentCompilation.get(); - assert compilation != null; - return compilation; - } -} diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/C1XCompiler.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/C1XCompiler.java Wed Jun 08 13:19:56 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.max.graal.compiler; - -import java.util.*; - -import com.oracle.max.graal.compiler.debug.*; -import com.oracle.max.graal.compiler.globalstub.*; -import com.oracle.max.graal.compiler.observer.*; -import com.oracle.max.graal.compiler.target.*; -import com.sun.cri.ci.*; -import com.sun.cri.ri.*; -import com.sun.cri.xir.*; - -/** - * This class implements the compiler interface for C1X. - * - * @author Thomas Wuerthinger - * @author Ben L. Titzer - */ -public class C1XCompiler extends ObservableCompiler { - - public final Map stubs = new HashMap(); - - /** - * The target that this compiler has been configured for. - */ - public final CiTarget target; - - /** - * The runtime that this compiler has been configured for. - */ - public final RiRuntime runtime; - - /** - * The XIR generator that lowers Java operations to machine operations. - */ - public final RiXirGenerator xir; - - /** - * The backend that this compiler has been configured for. - */ - public final Backend backend; - - public final RiRegisterConfig globalStubRegisterConfig; - - public C1XCompiler(RiRuntime runtime, CiTarget target, RiXirGenerator xirGen, RiRegisterConfig globalStubRegisterConfig) { - this.runtime = runtime; - this.target = target; - this.xir = xirGen; - this.globalStubRegisterConfig = globalStubRegisterConfig; - this.backend = Backend.create(target.arch, this); - init(); - } - - public CiResult compileMethod(RiMethod method, int osrBCI, RiXirGenerator xirGenerator, CiStatistics stats) { - long startTime = 0; - int index = C1XMetrics.CompiledMethods++; - if (C1XOptions.PrintCompilation) { - TTY.print(String.format("C1X %4d %-70s %-45s | ", index, method.holder().name(), method.name())); - startTime = System.nanoTime(); - } - - CiResult result = null; - TTY.Filter filter = new TTY.Filter(C1XOptions.PrintFilter, method); - C1XCompilation compilation = new C1XCompilation(this, method, osrBCI, stats); - try { - result = compilation.compile(); - } finally { - filter.remove(); - compilation.close(); - if (C1XOptions.PrintCompilation && !TTY.isSuppressed()) { - long time = (System.nanoTime() - startTime) / 100000; - TTY.println(String.format("%3d.%dms", time / 10, time % 10)); - } - } - - return result; - } - - private void init() { - final List xirTemplateStubs = xir.buildTemplates(backend.newXirAssembler()); - final GlobalStubEmitter emitter = backend.newGlobalStubEmitter(); - - if (xirTemplateStubs != null) { - for (XirTemplate template : xirTemplateStubs) { - TTY.Filter filter = new TTY.Filter(C1XOptions.PrintFilter, template.name); - try { - stubs.put(template, emitter.emit(template, runtime)); - } finally { - filter.remove(); - } - } - } - - for (GlobalStub.Id id : GlobalStub.Id.values()) { - TTY.Filter suppressor = new TTY.Filter(C1XOptions.PrintFilter, id); - try { - stubs.put(id, emitter.emit(id, runtime)); - } finally { - suppressor.remove(); - } - } - - if (C1XOptions.PrintCFGToFile) { - addCompilationObserver(new CFGPrinterObserver()); - } - if (C1XOptions.PrintDOTGraphToFile) { - addCompilationObserver(new GraphvizPrinterObserver(false)); - } - if (C1XOptions.PrintDOTGraphToPdf) { - addCompilationObserver(new GraphvizPrinterObserver(true)); - } - if (C1XOptions.PrintIdealGraphLevel != 0) { - CompilationObserver observer; - if (C1XOptions.PrintIdealGraphFile) { - observer = new IdealGraphPrinterObserver(); - } else { - observer = new IdealGraphPrinterObserver(C1XOptions.PrintIdealGraphAddress, C1XOptions.PrintIdealGraphPort); - } - addCompilationObserver(observer); - } - } - - public GlobalStub lookupGlobalStub(GlobalStub.Id id) { - GlobalStub globalStub = stubs.get(id); - assert globalStub != null : "no stub for global stub id: " + id; - return globalStub; - } - - public GlobalStub lookupGlobalStub(XirTemplate template) { - GlobalStub globalStub = stubs.get(template); - assert globalStub != null : "no stub for XirTemplate: " + template; - return globalStub; - } - - public GlobalStub lookupGlobalStub(CiRuntimeCall runtimeCall) { - GlobalStub globalStub = stubs.get(runtimeCall); - if (globalStub == null) { - globalStub = backend.newGlobalStubEmitter().emit(runtimeCall, runtime); - stubs.put(runtimeCall, globalStub); - } - - assert globalStub != null : "could not find global stub for runtime call: " + runtimeCall; - return globalStub; - } -} diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/C1XMetrics.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/C1XMetrics.java Wed Jun 08 13:19:56 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.max.graal.compiler; - -import java.lang.reflect.*; -import java.util.*; - -import com.oracle.max.graal.compiler.debug.*; - - -/** - * This class contains a number of fields that collect metrics about compilation, particularly - * the number of times certain optimizations are performed. - */ -public class C1XMetrics { - public static int CompiledMethods; - public static int TargetMethods; - public static int LocalValueNumberHits; - public static int ValueMapResizes; - public static int InlinedFinalizerChecks; - public static int InlineForcedMethods; - public static int InlineForbiddenMethods; - public static int InlinedJsrs; - public static int BlocksDeleted; - public static int BytecodesCompiled; - public static int CodeBytesEmitted; - public static int SafepointsEmitted; - public static int ExceptionHandlersEmitted; - public static int DataPatches; - public static int DirectCallSitesEmitted; - public static int IndirectCallSitesEmitted; - public static int HIRInstructions; - public static int LiveHIRInstructions; - public static int LIRInstructions; - public static int LIRVariables; - public static int LIRXIRInstructions; - public static int LIRMoveInstructions; - public static int LSRAIntervalsCreated; - public static int LSRASpills; - public static int LoadConstantIterations; - public static int CodeBufferCopies; - public static int UniqueValueIdsAssigned; - public static int FrameStatesCreated; - public static int FrameStateValuesCreated; - public static int NodesCanonicalized; - - public static void print() { - printClassFields(C1XMetrics.class); - - } - - public static void printClassFields(Class javaClass) { - final String className = javaClass.getSimpleName(); - TTY.println(className + " {"); - for (final Field field : javaClass.getFields()) { - printField(field, false); - } - TTY.println("}"); - } - - public static void printField(final Field field, boolean tabbed) { - final String fieldName = String.format("%35s", field.getName()); - try { - String prefix = tabbed ? "" : " " + fieldName + " = "; - String postfix = tabbed ? "\t" : "\n"; - if (field.getType() == int.class) { - TTY.print(prefix + field.getInt(null) + postfix); - } else if (field.getType() == boolean.class) { - TTY.print(prefix + field.getBoolean(null) + postfix); - } else if (field.getType() == float.class) { - TTY.print(prefix + field.getFloat(null) + postfix); - } else if (field.getType() == String.class) { - TTY.print(prefix + field.get(null) + postfix); - } else if (field.getType() == Map.class) { - Map m = (Map) field.get(null); - TTY.print(prefix + printMap(m) + postfix); - } else { - TTY.print(prefix + field.get(null) + postfix); - } - } catch (IllegalAccessException e) { - // do nothing. - } - } - - private static String printMap(Map m) { - StringBuilder sb = new StringBuilder(); - - List keys = new ArrayList(); - for (Object key : m.keySet()) { - keys.add((String) key); - } - Collections.sort(keys); - - for (String key : keys) { - sb.append(key); - sb.append("\t"); - sb.append(m.get(key)); - sb.append("\n"); - } - - return sb.toString(); - } - - private static void printField(String fieldName, long value) { - TTY.print(" " + fieldName + " = " + value + "\n"); - } - - private static void printField(String fieldName, double value) { - TTY.print(" " + fieldName + " = " + value + "\n"); - } -} - diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/C1XOptions.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/C1XOptions.java Wed Jun 08 13:19:56 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.max.graal.compiler; - -import com.oracle.max.graal.compiler.debug.TTY.*; - -/** - * This class encapsulates options that control the behavior of the C1X compiler. - * The help message for each option is specified by a {@linkplain #helpMap help map}. - * - * (tw) WARNING: Fields of this class are treated as final by Graal. - * - * @author Ben L. Titzer - */ -public final class C1XOptions { - - // Checkstyle: stop - private static final boolean ____ = false; - // Checkstyle: resume - - // inlining settings - public static boolean Inline = ____; - public static int MaximumInstructionCount = 37000; - public static float MaximumInlineRatio = 0.90f; - public static int MaximumInlineSize = 35; - public static int MaximumTrivialSize = 6; - public static int MaximumInlineLevel = 9; - public static int MaximumRecursiveInlineLevel = 2; - public static int MaximumDesiredSize = 8000; - public static int MaximumShortLoopSize = 5; - - // debugging settings - public static boolean VerifyPointerMaps = ____; - public static int MethodEndBreakpointGuards = 0; - public static boolean ZapStackOnMethodEntry = ____; - public static boolean StressLinearScan = ____; - public static boolean BailoutOnException = ____; - - /** - * See {@link Filter#Filter(String, Object)}. - */ - public static String PrintFilter = null; - - // printing settings - public static boolean PrintLIR = ____; - public static boolean PrintCFGToFile = ____; - - // DOT output settings - public static boolean PrintDOTGraphToFile = ____; - public static boolean PrintDOTGraphToPdf = ____; - public static boolean OmitDOTFrameStates = ____; - - // Ideal graph visualizer output settings - public static int PrintIdealGraphLevel = 0; - public static boolean PrintIdealGraphFile = ____; - public static String PrintIdealGraphAddress = "127.0.0.1"; - public static int PrintIdealGraphPort = 4444; - - // Other printing settings - public static boolean PrintMetrics = ____; - public static boolean PrintTimers = ____; - public static boolean PrintCompilation = ____; - public static boolean PrintXirTemplates = ____; - public static boolean PrintIRWithLIR = ____; - public static boolean PrintAssembly = ____; - public static boolean PrintCodeBytes = ____; - public static int PrintAssemblyBytesPerLine = 16; - public static int TraceLinearScanLevel = 0; - public static int TraceLIRGeneratorLevel = 0; - public static boolean TraceRelocation = ____; - public static boolean TraceLIRVisit = ____; - public static boolean TraceAssembler = ____; - public static boolean TraceInlining = ____; - public static boolean TraceDeadCodeElimination = ____; - public static int TraceBytecodeParserLevel = 0; - public static boolean QuietBailout = ____; - - // state merging settings - public static boolean AssumeVerifiedBytecode = ____; - - // Linear scan settings - public static boolean CopyPointerStackArguments = true; - - // Code generator settings - public static boolean GenLIR = true; - public static boolean GenCode = true; - - public static boolean UseConstDirectCall = false; - - public static boolean GenSpecialDivChecks = ____; - public static boolean GenAssertionCode = ____; - public static boolean AlignCallsForPatching = true; - public static boolean NullCheckUniquePc = ____; - public static boolean InvokeSnippetAfterArguments = ____; - public static boolean ResolveClassBeforeStaticInvoke = true; - - // Translating tableswitch instructions - public static int SequentialSwitchLimit = 4; - public static int RangeTestsSwitchDensity = 5; - - public static boolean DetailedAsserts = ____; - - // Runtime settings - public static int ReadPrefetchInstr = 0; - public static int StackShadowPages = 2; - - // Assembler settings - public static boolean CommentedAssembly = ____; - public static boolean PrintLIRWithAssembly = ____; - - public static boolean OptCanonicalizer = true; -} diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/C1XTimers.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/C1XTimers.java Wed Jun 08 13:19:56 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2009, 2009, 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.max.graal.compiler; - -import com.oracle.max.graal.compiler.debug.*; - -/** - * This class contains timers that record the amount of time spent in various - * parts of the compiler. - * - * @author Christian Wimmer - */ -public enum C1XTimers { - HIR_CREATE("Create HIR"), - HIR_OPTIMIZE("Optimize HIR"), - NCE("Nullcheck elimination"), - LIR_CREATE("Create LIR"), - LIFETIME_ANALYSIS("Lifetime Analysis"), - LINEAR_SCAN("Linear Scan"), - RESOLUTION("Resolution"), - DEBUG_INFO("Create Debug Info"), - CODE_CREATE("Create Code"); - - private final String name; - private long start; - private long total; - - private C1XTimers(String name) { - this.name = name; - } - - public void start() { - start = System.nanoTime(); - } - - public void stop() { - total += System.nanoTime() - start; - } - - public static void reset() { - for (C1XTimers t : values()) { - t.total = 0; - } - } - - public static void print() { - long total = 0; - for (C1XTimers timer : C1XTimers.values()) { - total += timer.total; - } - if (total == 0) { - return; - } - - TTY.println(); - for (C1XTimers timer : C1XTimers.values()) { - TTY.println("%-20s: %7.4f s (%5.2f%%)", timer.name, timer.total / 1000000000.0, timer.total * 100.0 / total); - timer.total = 0; - } - TTY.println(); - } -} diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompilation.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompilation.java Wed Jun 08 13:35:43 2011 +0200 @@ -0,0 +1,310 @@ +/* + * Copyright (c) 2009, 2011, 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.max.graal.compiler; + +import java.util.*; + +import com.oracle.max.asm.*; +import com.oracle.max.graal.compiler.alloc.*; +import com.oracle.max.graal.compiler.asm.*; +import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.gen.*; +import com.oracle.max.graal.compiler.gen.LIRGenerator.*; +import com.oracle.max.graal.compiler.graph.*; +import com.oracle.max.graal.compiler.lir.*; +import com.oracle.max.graal.compiler.observer.*; +import com.oracle.max.graal.compiler.value.*; +import com.sun.cri.ci.*; +import com.sun.cri.ri.*; + +/** + * This class encapsulates global information about the compilation of a particular method, + * including a reference to the runtime, statistics about the compiled code, etc. + */ +public final class GraalCompilation { + + private static ThreadLocal currentCompilation = new ThreadLocal(); + + public final GraalCompiler compiler; + public final CiTarget target; + public final RiRuntime runtime; + public final RiMethod method; + public final RiRegisterConfig registerConfig; + public final CiStatistics stats; + public final CiAssumptions assumptions = new CiAssumptions(); + public final FrameState placeholderState; + + public CompilerGraph graph = new CompilerGraph(); + + private boolean hasExceptionHandlers; + private final GraalCompilation parent; + + /** + * @see #setNotTypesafe() + * @see #isTypesafe() + */ + private boolean typesafe = true; + + private int nextID = 1; + + private FrameMap frameMap; + private TargetMethodAssembler assembler; + + private IR hir; + + private LIRGenerator lirGenerator; + + /** + * Creates a new compilation for the specified method and runtime. + * + * @param compiler the compiler + * @param method the method to be compiled or {@code null} if generating code for a stub + * @param osrBCI the bytecode index for on-stack replacement, if requested + * @param stats externally supplied statistics object to be used if not {@code null} + */ + public GraalCompilation(GraalCompiler compiler, RiMethod method, int osrBCI, CiStatistics stats) { + if (osrBCI != -1) { + throw new CiBailout("No OSR supported"); + } + this.parent = currentCompilation.get(); + currentCompilation.set(this); + this.compiler = compiler; + this.target = compiler.target; + this.runtime = compiler.runtime; + this.method = method; + this.stats = stats == null ? new CiStatistics() : stats; + this.registerConfig = method == null ? compiler.globalStubRegisterConfig : runtime.getRegisterConfig(method); + this.placeholderState = method != null && method.minimalDebugInfo() ? new FrameState(method, 0, 0, 0, 0, graph) : null; + + if (compiler.isObserved()) { + compiler.fireCompilationStarted(new CompilationEvent(this)); + } + } + + public void close() { + currentCompilation.set(parent); + } + + public IR hir() { + return hir; + } + + /** + * Records that this compilation has exception handlers. + */ + public void setHasExceptionHandlers() { + hasExceptionHandlers = true; + } + + /** + * Translates a given kind to a canonical architecture kind. + * This is an identity function for all but {@link CiKind#Word} + * which is translated to {@link CiKind#Int} or {@link CiKind#Long} + * depending on whether or not this is a {@linkplain #is64Bit() 64-bit} + * compilation. + */ + public CiKind archKind(CiKind kind) { + if (kind.isWord()) { + return target.arch.is64bit() ? CiKind.Long : CiKind.Int; + } + return kind; + } + + /** + * Determines if two given kinds are equal at the {@linkplain #archKind(CiKind) architecture} level. + */ + public boolean archKindsEqual(CiKind kind1, CiKind kind2) { + return archKind(kind1) == archKind(kind2); + } + + /** + * Records an assumption that the specified type has no finalizable subclasses. + * + * @param receiverType the type that is assumed to have no finalizable subclasses + * @return {@code true} if the assumption was recorded and can be assumed; {@code false} otherwise + */ + public boolean recordNoFinalizableSubclassAssumption(RiType receiverType) { + return false; + } + + /** + * Converts this compilation to a string. + * + * @return a string representation of this compilation + */ + @Override + public String toString() { + return "compile: " + method; + } + + /** + * Builds the block map for the specified method. + * + * @param method the method for which to build the block map + * @param osrBCI the OSR bytecode index; {@code -1} if this is not an OSR + * @return the block map for the specified method + */ + public BlockMap getBlockMap(RiMethod method) { + BlockMap map = new BlockMap(method); + map.build(); + if (compiler.isObserved()) { + String label = CiUtil.format("BlockListBuilder %f %r %H.%n(%p)", method, true); + compiler.fireCompilationEvent(new CompilationEvent(this, label, map, method.code().length)); + } + stats.bytecodeCount += method.code().length; + return map; + } + + /** + * Returns the frame map of this compilation. + * @return the frame map + */ + public FrameMap frameMap() { + return frameMap; + } + + public TargetMethodAssembler assembler() { + if (assembler == null) { + AbstractAssembler asm = compiler.backend.newAssembler(registerConfig); + assembler = new TargetMethodAssembler(asm); + assembler.setFrameSize(frameMap.frameSize()); + assembler.targetMethod.setCustomStackAreaOffset(frameMap.offsetToCustomArea()); + } + return assembler; + } + + public boolean hasExceptionHandlers() { + return hasExceptionHandlers; + } + + public CiResult compile() { + CiTargetMethod targetMethod; + try { + emitHIR(); + emitLIR(); + targetMethod = emitCode(); + + if (GraalOptions.PrintMetrics) { + GraalMetrics.BytecodesCompiled += method.code().length; + } + } catch (CiBailout b) { + return new CiResult(null, b, stats); + } catch (Throwable t) { + if (GraalOptions.BailoutOnException) { + return new CiResult(null, new CiBailout("Exception while compiling: " + method, t), stats); + } else { + throw new RuntimeException(t); + } + } finally { + if (compiler.isObserved()) { + compiler.fireCompilationFinished(new CompilationEvent(this)); + } + } + + return new CiResult(targetMethod, null, stats); + } + + public IR emitHIR() { + hir = new IR(this); + hir.build(); + return hir; + } + + public void initFrameMap(int numberOfLocks) { + frameMap = this.compiler.backend.newFrameMap(method, numberOfLocks); + } + + private void emitLIR() { + if (GraalOptions.GenLIR) { + if (GraalOptions.PrintTimers) { + GraalTimers.LIR_CREATE.start(); + } + + initFrameMap(hir.maxLocks()); + + lirGenerator = compiler.backend.newLIRGenerator(this); + + for (LIRBlock begin : hir.linearScanOrder()) { + lirGenerator.doBlock(begin); + } + + if (GraalOptions.PrintTimers) { + GraalTimers.LIR_CREATE.stop(); + } + + if (GraalOptions.PrintLIR && !TTY.isSuppressed()) { + LIRList.printLIR(hir.linearScanOrder()); + } + + new LinearScan(this, hir, lirGenerator, frameMap()).allocate(); + } + } + + private CiTargetMethod emitCode() { + if (GraalOptions.GenLIR && GraalOptions.GenCode) { + final LIRAssembler lirAssembler = compiler.backend.newLIRAssembler(this); + lirAssembler.emitCode(hir.linearScanOrder()); + + // generate code for slow cases + lirAssembler.emitLocalStubs(); + + // generate deoptimization stubs + ArrayList deoptimizationStubs = lirGenerator.deoptimizationStubs(); + if (deoptimizationStubs != null) { + for (DeoptimizationStub stub : deoptimizationStubs) { + lirAssembler.emitDeoptizationStub(stub); + } + } + + // generate traps at the end of the method + lirAssembler.emitTraps(); + + CiTargetMethod targetMethod = assembler().finishTargetMethod(method, runtime, lirAssembler.registerRestoreEpilogueOffset, false); + if (assumptions.count() > 0) { + targetMethod.setAssumptions(assumptions); + } + + if (compiler.isObserved()) { + compiler.fireCompilationEvent(new CompilationEvent(this, "After code generation", graph, false, true, targetMethod)); + } + + if (GraalOptions.PrintTimers) { + GraalTimers.CODE_CREATE.stop(); + } + return targetMethod; + } + + return null; + } + + public int nextID() { + return nextID++; + } + + public static GraalCompilation compilation() { + GraalCompilation compilation = currentCompilation.get(); + assert compilation != null; + return compilation; + } +} diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java Wed Jun 08 13:35:43 2011 +0200 @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2009, 2011, 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.max.graal.compiler; + +import java.util.*; + +import com.oracle.max.graal.compiler.debug.*; +import com.oracle.max.graal.compiler.globalstub.*; +import com.oracle.max.graal.compiler.observer.*; +import com.oracle.max.graal.compiler.target.*; +import com.sun.cri.ci.*; +import com.sun.cri.ri.*; +import com.sun.cri.xir.*; + +public class GraalCompiler extends ObservableCompiler { + + public final Map stubs = new HashMap(); + + /** + * The target that this compiler has been configured for. + */ + public final CiTarget target; + + /** + * The runtime that this compiler has been configured for. + */ + public final RiRuntime runtime; + + /** + * The XIR generator that lowers Java operations to machine operations. + */ + public final RiXirGenerator xir; + + /** + * The backend that this compiler has been configured for. + */ + public final Backend backend; + + public final RiRegisterConfig globalStubRegisterConfig; + + public GraalCompiler(RiRuntime runtime, CiTarget target, RiXirGenerator xirGen, RiRegisterConfig globalStubRegisterConfig) { + this.runtime = runtime; + this.target = target; + this.xir = xirGen; + this.globalStubRegisterConfig = globalStubRegisterConfig; + this.backend = Backend.create(target.arch, this); + init(); + } + + public CiResult compileMethod(RiMethod method, int osrBCI, RiXirGenerator xirGenerator, CiStatistics stats) { + long startTime = 0; + int index = GraalMetrics.CompiledMethods++; + if (GraalOptions.PrintCompilation) { + TTY.print(String.format("Graal %4d %-70s %-45s | ", index, method.holder().name(), method.name())); + startTime = System.nanoTime(); + } + + CiResult result = null; + TTY.Filter filter = new TTY.Filter(GraalOptions.PrintFilter, method); + GraalCompilation compilation = new GraalCompilation(this, method, osrBCI, stats); + try { + result = compilation.compile(); + } finally { + filter.remove(); + compilation.close(); + if (GraalOptions.PrintCompilation && !TTY.isSuppressed()) { + long time = (System.nanoTime() - startTime) / 100000; + TTY.println(String.format("%3d.%dms", time / 10, time % 10)); + } + } + + return result; + } + + private void init() { + final List xirTemplateStubs = xir.buildTemplates(backend.newXirAssembler()); + final GlobalStubEmitter emitter = backend.newGlobalStubEmitter(); + + if (xirTemplateStubs != null) { + for (XirTemplate template : xirTemplateStubs) { + TTY.Filter filter = new TTY.Filter(GraalOptions.PrintFilter, template.name); + try { + stubs.put(template, emitter.emit(template, runtime)); + } finally { + filter.remove(); + } + } + } + + for (GlobalStub.Id id : GlobalStub.Id.values()) { + TTY.Filter suppressor = new TTY.Filter(GraalOptions.PrintFilter, id); + try { + stubs.put(id, emitter.emit(id, runtime)); + } finally { + suppressor.remove(); + } + } + + if (GraalOptions.PrintCFGToFile) { + addCompilationObserver(new CFGPrinterObserver()); + } + if (GraalOptions.PrintDOTGraphToFile) { + addCompilationObserver(new GraphvizPrinterObserver(false)); + } + if (GraalOptions.PrintDOTGraphToPdf) { + addCompilationObserver(new GraphvizPrinterObserver(true)); + } + if (GraalOptions.PrintIdealGraphLevel != 0) { + CompilationObserver observer; + if (GraalOptions.PrintIdealGraphFile) { + observer = new IdealGraphPrinterObserver(); + } else { + observer = new IdealGraphPrinterObserver(GraalOptions.PrintIdealGraphAddress, GraalOptions.PrintIdealGraphPort); + } + addCompilationObserver(observer); + } + } + + public GlobalStub lookupGlobalStub(GlobalStub.Id id) { + GlobalStub globalStub = stubs.get(id); + assert globalStub != null : "no stub for global stub id: " + id; + return globalStub; + } + + public GlobalStub lookupGlobalStub(XirTemplate template) { + GlobalStub globalStub = stubs.get(template); + assert globalStub != null : "no stub for XirTemplate: " + template; + return globalStub; + } + + public GlobalStub lookupGlobalStub(CiRuntimeCall runtimeCall) { + GlobalStub globalStub = stubs.get(runtimeCall); + if (globalStub == null) { + globalStub = backend.newGlobalStubEmitter().emit(runtimeCall, runtime); + stubs.put(runtimeCall, globalStub); + } + + assert globalStub != null : "could not find global stub for runtime call: " + runtimeCall; + return globalStub; + } +} diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalMetrics.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalMetrics.java Wed Jun 08 13:35:43 2011 +0200 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2009, 2011, 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.max.graal.compiler; + +import java.lang.reflect.*; +import java.util.*; + +import com.oracle.max.graal.compiler.debug.*; + + +/** + * This class contains a number of fields that collect metrics about compilation, particularly + * the number of times certain optimizations are performed. + */ +public class GraalMetrics { + public static int CompiledMethods; + public static int TargetMethods; + public static int LocalValueNumberHits; + public static int ValueMapResizes; + public static int InlinedFinalizerChecks; + public static int InlineForcedMethods; + public static int InlineForbiddenMethods; + public static int InlinedJsrs; + public static int BlocksDeleted; + public static int BytecodesCompiled; + public static int CodeBytesEmitted; + public static int SafepointsEmitted; + public static int ExceptionHandlersEmitted; + public static int DataPatches; + public static int DirectCallSitesEmitted; + public static int IndirectCallSitesEmitted; + public static int HIRInstructions; + public static int LiveHIRInstructions; + public static int LIRInstructions; + public static int LIRVariables; + public static int LIRXIRInstructions; + public static int LIRMoveInstructions; + public static int LSRAIntervalsCreated; + public static int LSRASpills; + public static int LoadConstantIterations; + public static int CodeBufferCopies; + public static int UniqueValueIdsAssigned; + public static int FrameStatesCreated; + public static int FrameStateValuesCreated; + public static int NodesCanonicalized; + + public static void print() { + printClassFields(GraalMetrics.class); + + } + + public static void printClassFields(Class javaClass) { + final String className = javaClass.getSimpleName(); + TTY.println(className + " {"); + for (final Field field : javaClass.getFields()) { + printField(field, false); + } + TTY.println("}"); + } + + public static void printField(final Field field, boolean tabbed) { + final String fieldName = String.format("%35s", field.getName()); + try { + String prefix = tabbed ? "" : " " + fieldName + " = "; + String postfix = tabbed ? "\t" : "\n"; + if (field.getType() == int.class) { + TTY.print(prefix + field.getInt(null) + postfix); + } else if (field.getType() == boolean.class) { + TTY.print(prefix + field.getBoolean(null) + postfix); + } else if (field.getType() == float.class) { + TTY.print(prefix + field.getFloat(null) + postfix); + } else if (field.getType() == String.class) { + TTY.print(prefix + field.get(null) + postfix); + } else if (field.getType() == Map.class) { + Map m = (Map) field.get(null); + TTY.print(prefix + printMap(m) + postfix); + } else { + TTY.print(prefix + field.get(null) + postfix); + } + } catch (IllegalAccessException e) { + // do nothing. + } + } + + private static String printMap(Map m) { + StringBuilder sb = new StringBuilder(); + + List keys = new ArrayList(); + for (Object key : m.keySet()) { + keys.add((String) key); + } + Collections.sort(keys); + + for (String key : keys) { + sb.append(key); + sb.append("\t"); + sb.append(m.get(key)); + sb.append("\n"); + } + + return sb.toString(); + } + + private static void printField(String fieldName, long value) { + TTY.print(" " + fieldName + " = " + value + "\n"); + } + + private static void printField(String fieldName, double value) { + TTY.print(" " + fieldName + " = " + value + "\n"); + } +} + diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalOptions.java Wed Jun 08 13:35:43 2011 +0200 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2009, 2011, 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.max.graal.compiler; + +import com.oracle.max.graal.compiler.debug.TTY.*; + +/** + * This class encapsulates options that control the behavior of the Graal compiler. + * The help message for each option is specified by a {@linkplain #helpMap help map}. + * + * (tw) WARNING: Fields of this class are treated as final by Graal. + * + * @author Ben L. Titzer + */ +public final class GraalOptions { + + // Checkstyle: stop + private static final boolean ____ = false; + // Checkstyle: resume + + // inlining settings + public static boolean Inline = ____; + public static int MaximumInstructionCount = 37000; + public static float MaximumInlineRatio = 0.90f; + public static int MaximumInlineSize = 35; + public static int MaximumTrivialSize = 6; + public static int MaximumInlineLevel = 9; + public static int MaximumRecursiveInlineLevel = 2; + public static int MaximumDesiredSize = 8000; + public static int MaximumShortLoopSize = 5; + + // debugging settings + public static boolean VerifyPointerMaps = ____; + public static int MethodEndBreakpointGuards = 0; + public static boolean ZapStackOnMethodEntry = ____; + public static boolean StressLinearScan = ____; + public static boolean BailoutOnException = ____; + + /** + * See {@link Filter#Filter(String, Object)}. + */ + public static String PrintFilter = null; + + // printing settings + public static boolean PrintLIR = ____; + public static boolean PrintCFGToFile = ____; + + // DOT output settings + public static boolean PrintDOTGraphToFile = ____; + public static boolean PrintDOTGraphToPdf = ____; + public static boolean OmitDOTFrameStates = ____; + + // Ideal graph visualizer output settings + public static int PrintIdealGraphLevel = 0; + public static boolean PrintIdealGraphFile = ____; + public static String PrintIdealGraphAddress = "127.0.0.1"; + public static int PrintIdealGraphPort = 4444; + + // Other printing settings + public static boolean PrintMetrics = ____; + public static boolean PrintTimers = ____; + public static boolean PrintCompilation = ____; + public static boolean PrintXirTemplates = ____; + public static boolean PrintIRWithLIR = ____; + public static boolean PrintAssembly = ____; + public static boolean PrintCodeBytes = ____; + public static int PrintAssemblyBytesPerLine = 16; + public static int TraceLinearScanLevel = 0; + public static int TraceLIRGeneratorLevel = 0; + public static boolean TraceRelocation = ____; + public static boolean TraceLIRVisit = ____; + public static boolean TraceAssembler = ____; + public static boolean TraceInlining = ____; + public static boolean TraceDeadCodeElimination = ____; + public static int TraceBytecodeParserLevel = 0; + public static boolean QuietBailout = ____; + + // state merging settings + public static boolean AssumeVerifiedBytecode = ____; + + // Linear scan settings + public static boolean CopyPointerStackArguments = true; + + // Code generator settings + public static boolean GenLIR = true; + public static boolean GenCode = true; + + public static boolean UseConstDirectCall = false; + + public static boolean GenSpecialDivChecks = ____; + public static boolean GenAssertionCode = ____; + public static boolean AlignCallsForPatching = true; + public static boolean NullCheckUniquePc = ____; + public static boolean InvokeSnippetAfterArguments = ____; + public static boolean ResolveClassBeforeStaticInvoke = true; + + // Translating tableswitch instructions + public static int SequentialSwitchLimit = 4; + public static int RangeTestsSwitchDensity = 5; + + public static boolean DetailedAsserts = ____; + + // Runtime settings + public static int ReadPrefetchInstr = 0; + public static int StackShadowPages = 2; + + // Assembler settings + public static boolean CommentedAssembly = ____; + public static boolean PrintLIRWithAssembly = ____; + + public static boolean OptCanonicalizer = true; +} diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalTimers.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalTimers.java Wed Jun 08 13:35:43 2011 +0200 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2009, 2009, 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.max.graal.compiler; + +import com.oracle.max.graal.compiler.debug.*; + +/** + * This class contains timers that record the amount of time spent in various + * parts of the compiler. + * + * @author Christian Wimmer + */ +public enum GraalTimers { + HIR_CREATE("Create HIR"), + HIR_OPTIMIZE("Optimize HIR"), + NCE("Nullcheck elimination"), + LIR_CREATE("Create LIR"), + LIFETIME_ANALYSIS("Lifetime Analysis"), + LINEAR_SCAN("Linear Scan"), + RESOLUTION("Resolution"), + DEBUG_INFO("Create Debug Info"), + CODE_CREATE("Create Code"); + + private final String name; + private long start; + private long total; + + private GraalTimers(String name) { + this.name = name; + } + + public void start() { + start = System.nanoTime(); + } + + public void stop() { + total += System.nanoTime() - start; + } + + public static void reset() { + for (GraalTimers t : values()) { + t.total = 0; + } + } + + public static void print() { + long total = 0; + for (GraalTimers timer : GraalTimers.values()) { + total += timer.total; + } + if (total == 0) { + return; + } + + TTY.println(); + for (GraalTimers timer : GraalTimers.values()) { + TTY.println("%-20s: %7.4f s (%5.2f%%)", timer.name, timer.total / 1000000000.0, timer.total * 100.0 / total); + timer.total = 0; + } + TTY.println(); + } +} diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ControlFlowOptimizer.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ControlFlowOptimizer.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ControlFlowOptimizer.java Wed Jun 08 13:35:43 2011 +0200 @@ -57,7 +57,7 @@ private void reorderShortLoop(List code, LIRBlock headerBlock, int headerIdx) { int i = headerIdx + 1; - int maxEnd = Math.min(headerIdx + C1XOptions.MaximumShortLoopSize, code.size()); + int maxEnd = Math.min(headerIdx + GraalOptions.MaximumShortLoopSize, code.size()); while (i < maxEnd && code.get(i).loopDepth() >= headerBlock.loopDepth()) { i++; } @@ -136,7 +136,7 @@ // adjust successor and predecessor lists block.replaceWith(newTarget); - C1XMetrics.BlocksDeleted++; + GraalMetrics.BlocksDeleted++; } else { // adjust position of this block in the block list if blocks before // have been deleted diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/EdgeMoveOptimizer.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/EdgeMoveOptimizer.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/EdgeMoveOptimizer.java Wed Jun 08 13:35:43 2011 +0200 @@ -211,7 +211,7 @@ // the instructions are inserted at the end of the block before these two branches int insertIdx = instructions.size() - 2; - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { for (int i = insertIdx - 1; i >= 0; i--) { LIRInstruction op = instructions.get(i); if ((op.code == LIROpcode.Branch || op.code == LIROpcode.CondFloatBranch) && ((LIRBranch) op).block() != null) { diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/Interval.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/Interval.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/Interval.java Wed Jun 08 13:35:43 2011 +0200 @@ -661,7 +661,7 @@ static final Interval EndMarker = new Interval(CiValue.IllegalValue, -1); Interval(CiValue operand, int operandNumber) { - C1XMetrics.LSRAIntervalsCreated++; + GraalMetrics.LSRAIntervalsCreated++; assert operand != null; this.operand = operand; this.operandNumber = operandNumber; @@ -910,7 +910,7 @@ // do not add use positions for precolored intervals because they are never used if (registerPriority != RegisterPriority.None && operand.isVariable()) { - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { for (int i = 0; i < usePosList.size(); i++) { assert pos <= usePosList.usePos(i) : "already added a use-position with lower position"; if (i > 0) { @@ -1014,7 +1014,7 @@ // split list of use positions result.usePosList = usePosList.splitAt(splitPos); - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { for (int i = 0; i < usePosList.size(); i++) { assert usePosList.usePos(i) < splitPos; } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/IntervalWalker.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/IntervalWalker.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/IntervalWalker.java Wed Jun 08 13:35:43 2011 +0200 @@ -32,7 +32,7 @@ */ public class IntervalWalker { - protected final C1XCompilation compilation; + protected final GraalCompilation compilation; protected final LinearScan allocator; /** @@ -206,7 +206,7 @@ boolean isActive = current.from() <= toOpId; int opId = isActive ? current.from() : toOpId; - if (C1XOptions.TraceLinearScanLevel >= 2 && !TTY.isSuppressed()) { + if (GraalOptions.TraceLinearScanLevel >= 2 && !TTY.isSuppressed()) { if (currentPosition < opId) { TTY.println(); TTY.println("walkTo(%d) *", opId); @@ -237,7 +237,7 @@ private void intervalMoved(Interval interval, RegisterBinding kind, State from, State to) { // intervalMoved() is called whenever an interval moves from one interval list to another. // In the implementation of this method it is prohibited to move the interval to any list. - if (C1XOptions.TraceLinearScanLevel >= 4 && !TTY.isSuppressed()) { + if (GraalOptions.TraceLinearScanLevel >= 4 && !TTY.isSuppressed()) { TTY.print(from.toString() + " to " + to.toString()); TTY.fillTo(23); TTY.out().println(interval.logString(allocator)); diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java Wed Jun 08 13:35:43 2011 +0200 @@ -54,7 +54,7 @@ */ public final class LinearScan { - final C1XCompilation compilation; + final GraalCompilation compilation; final IR ir; final LIRGenerator gen; final FrameMap frameMap; @@ -119,7 +119,7 @@ */ BitMap2D intervalInLoop; - public LinearScan(C1XCompilation compilation, IR ir, LIRGenerator gen, FrameMap frameMap) { + public LinearScan(GraalCompilation compilation, IR ir, LIRGenerator gen, FrameMap frameMap) { this.compilation = compilation; this.ir = ir; this.gen = gen; @@ -437,7 +437,7 @@ // called once before assignment of register numbers void eliminateSpillMoves() { - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println(" Eliminating unnecessary spill moves"); } @@ -445,7 +445,7 @@ // the list is sorted by Interval.spillDefinitionPos Interval interval; interval = createUnhandledLists(mustStoreAtDefinition, null).first; - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { checkIntervals(interval); } @@ -474,7 +474,7 @@ if (!curInterval.location().isRegister() && curInterval.alwaysInMemory()) { // move target is a stack slot that is always correct, so eliminate instruction - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("eliminating move from interval %d to %d", operandNumber(op1.operand()), operandNumber(op1.result())); } instructions.set(j, null); // null-instructions are deleted by assignRegNum @@ -500,7 +500,7 @@ insertionBuffer.move(j, fromLocation, toLocation, null); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { CiStackSlot slot = interval.spillSlot(); TTY.println("inserting move after definition of interval %d to stack slot %d%s at opId %d", interval.operandNumber, slot.index(), slot.inCallerFrame() ? " in caller frame" : "", opId); @@ -533,7 +533,7 @@ assert temp.spillDefinitionPos() >= temp.from() : "invalid order"; assert temp.spillDefinitionPos() <= temp.from() + 2 : "only intervals defined once at their start-pos can be optimized"; - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("interval %d (from %d to %d) must be stored at %d", temp.operandNumber, temp.from(), temp.to(), temp.spillDefinitionPos()); } @@ -615,7 +615,7 @@ int operandNum = operandNumber(operand); if (!liveKill.get(operandNum)) { liveGen.set(operandNum); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" Setting liveGen for operand %d at instruction %d", operandNum, op.id); } } @@ -624,7 +624,7 @@ } } - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { assert operand.isVariableOrRegister() : "visitor should only return register operands"; verifyInput(block, liveKill, operand); } @@ -640,7 +640,7 @@ int operandNum = operandNumber(operand); if (!liveKill.get(operandNum)) { liveGen.set(operandNum); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" Setting liveGen for value %s, LIR opId %d, operand %d because of state for " + op.toString(), Util.valueString(value), op.id, operandNum); } } @@ -666,7 +666,7 @@ } } - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { assert operand.isVariableOrRegister() : "visitor should only return register operands"; verifyTemp(liveKill, operand); } @@ -685,7 +685,7 @@ } } - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { assert operand.isVariableOrRegister() : "visitor should only return register operands"; // fixed intervals are never live at block boundaries, so // they need not be processed in live sets @@ -700,7 +700,7 @@ block.liveIn = new CiBitMap(liveSize); block.liveOut = new CiBitMap(liveSize); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("liveGen B%d %s", block.blockID(), block.liveGen); TTY.println("liveKill B%d %s", block.blockID(), block.liveKill); } @@ -788,7 +788,7 @@ liveIn.setUnion(block.liveGen); } - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { traceLiveness(changeOccurredInBlock, iterationCount, block); } } @@ -799,7 +799,7 @@ } } while (changeOccurred); - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { verifyLiveness(numBlocks); } @@ -807,7 +807,7 @@ LIRBlock startBlock = ir.startBlock; CiBitMap liveInArgs = new CiBitMap(startBlock.liveIn.size()); if (!startBlock.liveIn.isSame(liveInArgs)) { - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { reportFailure(numBlocks); } @@ -887,7 +887,7 @@ if (!isProcessed(operand)) { return null; } - if (C1XOptions.TraceLinearScanLevel >= 2 && kind == null) { + if (GraalOptions.TraceLinearScanLevel >= 2 && kind == null) { TTY.println(" use %s from %d to %d (%s)", operand, from, to, registerPriority.name()); } @@ -938,7 +938,7 @@ if (!isProcessed(operand)) { return; } - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println(" def %s defPos %d (%s)", operand, defPos, registerPriority.name()); } Interval interval = intervalFor(operand); @@ -960,7 +960,7 @@ // also add register priority for dead intervals interval.addRange(defPos, defPos + 1); interval.addUsePos(defPos, registerPriority); - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("Warning: def of operand %s at %d occurs without use", operand, defPos); } } @@ -975,7 +975,7 @@ interval.addRange(defPos, defPos + 1); interval.addUsePos(defPos, registerPriority); - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("Warning: dead value %s at %d in live intervals", operand, defPos); } } @@ -1099,21 +1099,21 @@ if (move.operand().isStackSlot()) { CiStackSlot slot = (CiStackSlot) move.operand(); - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { int argSlots = compilation.method.signature().argumentSlots(!isStatic(compilation.method.accessFlags())); assert slot.index() >= 0 && slot.index() < argSlots; assert move.id > 0 : "invalid id"; assert blockForId(move.id).numberOfPreds() == 0 : "move from stack must be in first block"; assert move.result().isVariable() : "result of move must be a variable"; - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("found move from stack slot %s to %s", slot, move.result()); } } Interval interval = intervalFor(move.result()); CiStackSlot copySlot = slot; - if (C1XOptions.CopyPointerStackArguments && slot.kind == CiKind.Object) { + if (GraalOptions.CopyPointerStackArguments && slot.kind == CiKind.Object) { copySlot = allocateSpillSlot(slot.kind); } interval.setSpillSlot(copySlot); @@ -1136,7 +1136,7 @@ Interval to = intervalFor(moveTo); if (from != null && to != null) { to.setLocationHint(from); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("operation at opId %d: added hint from interval %d to %d", move.id, from.operandNumber, to.operandNumber); } } @@ -1154,7 +1154,7 @@ Interval to = intervalFor(moveTo); if (from != null && to != null) { to.setLocationHint(from); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("operation at opId %d: added hint from interval %d to %d", cmove.id, from.operandNumber, to.operandNumber); } } @@ -1187,7 +1187,7 @@ for (int operandNum = live.nextSetBit(0); operandNum >= 0; operandNum = live.nextSetBit(operandNum + 1)) { assert live.get(operandNum) : "should not stop here otherwise"; CiValue operand = operands.operandFor(operandNum); - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("live in %s to %d", operand, blockTo + 2); } @@ -1217,7 +1217,7 @@ addTemp(r.asValue(), opId, RegisterPriority.None, CiKind.Illegal); } } - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("operation destroys all caller-save registers"); } } @@ -1239,7 +1239,7 @@ for (k = 0; k < n; k++) { CiValue operand = op.operandAt(LIRInstruction.OperandMode.Temp, k); assert operand.isVariableOrRegister(); - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println(" temp %s tempPos %d (%s)", operand, opId, RegisterPriority.MustHaveRegister.name()); } addTemp(operand, opId, RegisterPriority.MustHaveRegister, operand.kind.stackKind()); @@ -1312,7 +1312,7 @@ // could also consider not killing all xmm registers if we // assume that slow paths are uncommon but it's not clear that // would be a good idea. - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("killing XMMs for trig"); } int opId = op.id; @@ -1500,7 +1500,7 @@ Interval result = interval.getSplitChildAtOpId(opId, mode, this); if (result != null) { - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("Split child at pos " + opId + " of interval " + interval.toString() + " is " + result.toString()); } return result; @@ -1554,7 +1554,7 @@ void resolveFindInsertPos(LIRBlock fromBlock, LIRBlock toBlock, MoveResolver moveResolver) { if (fromBlock.numberOfSux() <= 1) { - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("inserting moves at end of fromBlock B%d", fromBlock.blockID()); } @@ -1570,11 +1570,11 @@ } } else { - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("inserting moves at beginning of toBlock B%d", toBlock.blockID()); } - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { assert fromBlock.lir().instructionsList().get(0) instanceof LIRLabel : "block does not start with a label"; // because the number of predecessor edges matches the number of @@ -1618,7 +1618,7 @@ // prevent optimization of two consecutive blocks if (!blockCompleted.get(pred.linearScanNumber()) && !blockCompleted.get(sux.linearScanNumber())) { - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println(" optimizing empty block B%d (pred: B%d, sux: B%d)", block.blockID(), pred.blockID(), sux.blockID()); } blockCompleted.set(block.linearScanNumber()); @@ -1645,7 +1645,7 @@ // check for duplicate edges between the same blocks (can happen with switch blocks) if (!alreadyResolved.get(toBlock.linearScanNumber())) { - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println(" processing edge between B%d and B%d", fromBlock.blockID(), toBlock.blockID()); } alreadyResolved.set(toBlock.linearScanNumber()); @@ -1727,7 +1727,7 @@ assert interval != null : "interval must exist"; if (opId != -1) { - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { LIRBlock block = blockForId(opId); if (block.numberOfSux() <= 1 && opId == block.lastLirInstructionId()) { // check if spill moves could have been appended at the end of this block, but @@ -1769,7 +1769,7 @@ } void computeOopMap(IntervalWalker iw, LIRInstruction op, LIRDebugInfo info, boolean isCallSite, CiBitMap frameRefMap, CiBitMap regRefMap) { - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("creating oop map at opId %d", op.id); } @@ -1940,14 +1940,14 @@ CiFrame frame = compilation.placeholderState != null ? null : computeFrame(info.state, op.id, frameRefMap); computeOopMap(iw, op, info, frameRefMap, regRefMap); info.debugInfo = new CiDebugInfo(frame, regRefMap, frameRefMap); - } else if (C1XOptions.DetailedAsserts) { + } else if (GraalOptions.DetailedAsserts) { assert info.debugInfo.frame().equals(computeFrame(info.state, op.id, new CiBitMap(info.debugInfo.frameRefMap.size()))); } } } CiFrame computeFrame(FrameState state, int opId, CiBitMap frameRefMap) { - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("creating debug information at opId %d", opId); } return computeFrameForState(state, opId, frameRefMap); @@ -2019,8 +2019,8 @@ } public void allocate() { - if (C1XOptions.PrintTimers) { - C1XTimers.LIFETIME_ANALYSIS.start(); + if (GraalOptions.PrintTimers) { + GraalTimers.LIFETIME_ANALYSIS.start(); } numberInstructions(); @@ -2033,28 +2033,28 @@ buildIntervals(); sortIntervalsBeforeAllocation(); - if (C1XOptions.PrintTimers) { - C1XTimers.LIFETIME_ANALYSIS.stop(); - C1XTimers.LINEAR_SCAN.start(); + if (GraalOptions.PrintTimers) { + GraalTimers.LIFETIME_ANALYSIS.stop(); + GraalTimers.LINEAR_SCAN.start(); } printIntervals("Before register allocation"); allocateRegisters(); - if (C1XOptions.PrintTimers) { - C1XTimers.LINEAR_SCAN.stop(); - C1XTimers.RESOLUTION.start(); + if (GraalOptions.PrintTimers) { + GraalTimers.LINEAR_SCAN.stop(); + GraalTimers.RESOLUTION.start(); } resolveDataFlow(); - if (C1XOptions.PrintTimers) { - C1XTimers.RESOLUTION.stop(); - C1XTimers.DEBUG_INFO.start(); + if (GraalOptions.PrintTimers) { + GraalTimers.RESOLUTION.stop(); + GraalTimers.DEBUG_INFO.start(); } - C1XMetrics.LSRASpills += (maxSpills - frameMap.initialSpillSlot()); + GraalMetrics.LSRASpills += (maxSpills - frameMap.initialSpillSlot()); // fill in number of spill slots into frameMap frameMap.finalizeFrame(maxSpills); @@ -2064,20 +2064,20 @@ sortIntervalsAfterAllocation(); - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { verify(); } eliminateSpillMoves(); assignLocations(); - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { verifyIntervals(); } - if (C1XOptions.PrintTimers) { - C1XTimers.DEBUG_INFO.stop(); - C1XTimers.CODE_CREATE.start(); + if (GraalOptions.PrintTimers) { + GraalTimers.DEBUG_INFO.stop(); + GraalTimers.CODE_CREATE.start(); } printLir("After register number assignment", true); @@ -2087,7 +2087,7 @@ } void printIntervals(String label) { - if (C1XOptions.TraceLinearScanLevel >= 1) { + if (GraalOptions.TraceLinearScanLevel >= 1) { int i; TTY.println(); TTY.println(label); @@ -2114,7 +2114,7 @@ } void printLir(String label, boolean hirValid) { - if (C1XOptions.TraceLinearScanLevel >= 1 && !TTY.isSuppressed()) { + if (GraalOptions.TraceLinearScanLevel >= 1 && !TTY.isSuppressed()) { TTY.println(); TTY.println(label); LIRList.printLIR(ir.linearScanOrder()); @@ -2128,27 +2128,27 @@ boolean verify() { // (check that all intervals have a correct register and that no registers are overwritten) - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println(" verifying intervals *"); } verifyIntervals(); - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println(" verifying that no oops are in fixed intervals *"); } //verifyNoOopsInFixedIntervals(); - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println(" verifying that unpinned constants are not alive across block boundaries"); } verifyConstants(); - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println(" verifying register allocation *"); } verifyRegisters(); - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println(" no errors found *"); } @@ -2226,7 +2226,7 @@ CiValue l1 = i1.location(); CiValue l2 = i2.location(); if (i1.intersects(i2) && (l1.equals(l2))) { - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { TTY.println("Intervals %d and %d overlap and have the same register assigned", i1.operandNumber, i2.operandNumber); TTY.println(i1.logString(this)); TTY.println(i2.logString(this)); @@ -2298,7 +2298,7 @@ // visit all operands where the liveAtEdge bit is set for (int operandNum = liveAtEdge.nextSetBit(0); operandNum >= 0; operandNum = liveAtEdge.nextSetBit(operandNum + 1)) { - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("checking interval %d of block B%d", operandNum, block.blockID()); } CiValue operand = operands.operandFor(operandNum); diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScanWalker.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScanWalker.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScanWalker.java Wed Jun 08 13:35:43 2011 +0200 @@ -282,7 +282,7 @@ int optimalSplitPos = -1; if (minSplitPos == maxSplitPos) { // trivial case, no optimization of split position possible - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" min-pos and max-pos are equal, no optimization possible"); } optimalSplitPos = minSplitPos; @@ -305,7 +305,7 @@ assert minBlock.linearScanNumber() <= maxBlock.linearScanNumber() : "invalid order"; if (minBlock == maxBlock) { // split position cannot be moved to block boundary : so split as late as possible - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" cannot move split pos to block boundary because minPos and maxPos are in same block"); } optimalSplitPos = maxSplitPos; @@ -316,14 +316,14 @@ // Intervals resulting from Phi-Functions have more than one definition (marked // as mustHaveRegister) with a hole before each definition. When the register is needed // for the second definition : an earlier reloading is unnecessary. - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" interval has hole just before maxSplitPos, so splitting at maxSplitPos"); } optimalSplitPos = maxSplitPos; } else { // seach optimal block boundary between minSplitPos and maxSplitPos - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" moving split pos to optimal block boundary between block B%d and B%d", minBlock.blockID(), maxBlock.blockID()); } @@ -331,7 +331,7 @@ // Loop optimization: if a loop-end marker is found between min- and max-position : // then split before this loop int loopEndPos = interval.nextUsageExact(RegisterPriority.LiveAtLoopEnd, minBlock.lastLirInstructionId() + 2); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" loop optimization: loop end found at pos %d", loopEndPos); } @@ -344,7 +344,7 @@ // of the interval (normally, only mustHaveRegister causes a reloading) LIRBlock loopBlock = allocator.blockForId(loopEndPos); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" interval is used in loop that ends in block B%d, so trying to move maxBlock back from B%d to B%d", loopBlock.blockID(), maxBlock.blockID(), loopBlock.blockID()); } assert loopBlock != minBlock : "loopBlock and minBlock must be different because block boundary is needed between"; @@ -352,11 +352,11 @@ optimalSplitPos = findOptimalSplitPos(minBlock, loopBlock, loopBlock.lastLirInstructionId() + 2); if (optimalSplitPos == loopBlock.lastLirInstructionId() + 2) { optimalSplitPos = -1; - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" loop optimization not necessary"); } } else { - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" loop optimization successful"); } } @@ -370,7 +370,7 @@ } } } - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" optimal split position: %d", optimalSplitPos); } @@ -382,13 +382,13 @@ // 1) the left part has already a location assigned // 2) the right part is sorted into to the unhandled-list void splitBeforeUsage(Interval interval, int minSplitPos, int maxSplitPos) { - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("----- splitting interval: "); } - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(interval.logString(allocator)); } - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println(" between %d and %d", minSplitPos, maxSplitPos); } @@ -406,7 +406,7 @@ if (optimalSplitPos == interval.to() && interval.nextUsage(RegisterPriority.MustHaveRegister, minSplitPos) == Integer.MAX_VALUE) { // the split position would be just before the end of the interval // . no split at all necessary - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" no split necessary because optimal split position is at end of interval"); } return; @@ -420,7 +420,7 @@ optimalSplitPos = (optimalSplitPos - 1) | 1; } - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" splitting at position %d", optimalSplitPos); } assert allocator.isBlockBegin(optimalSplitPos) || (optimalSplitPos % 2 == 1) : "split pos must be odd when not on block boundary"; @@ -434,10 +434,10 @@ assert splitPart.from() >= current.currentFrom() : "cannot append new interval before current walk position"; unhandledLists.addToListSortedByStartAndUsePositions(RegisterBinding.Any, splitPart); - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println(" split interval in two parts (insertMoveWhenActivated: %b)", moveNecessary); } - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.print(" "); TTY.println(interval.logString(allocator)); TTY.print(" "); @@ -455,7 +455,7 @@ int maxSplitPos = currentPosition; int minSplitPos = Math.max(interval.previousUsage(RegisterPriority.ShouldHaveRegister, maxSplitPos) + 1, interval.from()); - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.print("----- splitting and spilling interval: "); TTY.println(interval.logString(allocator)); TTY.println(" between %d and %d", minSplitPos, maxSplitPos); @@ -469,7 +469,7 @@ if (minSplitPos == interval.from()) { // the whole interval is never used, so spill it entirely to memory - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println(" spilling entire interval because split pos is at beginning of interval"); TTY.println(" use positions: " + interval.usePosList().size()); } @@ -488,7 +488,7 @@ if (parent.location().isRegister()) { if (parent.firstUsage(RegisterPriority.ShouldHaveRegister) == Integer.MAX_VALUE) { // parent is never used, so kick it out of its assigned register - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" kicking out interval %d out of its register because it is never used", parent.operandNumber); } allocator.assignSpillSlot(parent); @@ -512,7 +512,7 @@ optimalSplitPos = (optimalSplitPos - 1) | 1; } - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" splitting at position %d", optimalSplitPos); } assert allocator.isBlockBegin(optimalSplitPos) || (optimalSplitPos % 2 == 1) : "split pos must be odd when not on block boundary"; @@ -523,7 +523,7 @@ allocator.changeSpillState(spilledPart, optimalSplitPos); if (!allocator.isBlockBegin(optimalSplitPos)) { - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" inserting move from interval %d to %d", interval.operandNumber, spilledPart.operandNumber); } insertMove(optimalSplitPos, interval, spilledPart); @@ -533,7 +533,7 @@ assert spilledPart.currentSplitChild() == interval : "overwriting wrong currentSplitChild"; spilledPart.makeCurrentSplitChild(); - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println(" split interval in two parts"); TTY.print(" "); TTY.println(interval.logString(allocator)); @@ -582,7 +582,7 @@ } boolean allocFreeRegister(Interval interval) { - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("trying to find free register for " + interval.logString(allocator)); } @@ -597,7 +597,7 @@ // usePos contains the start of the next interval that has this register assigned // (either as a fixed register or a normal allocated register in the past) // only intervals overlapping with cur are processed, non-overlapping invervals can be ignored safely - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" state of registers:"); for (CiRegister register : availableRegs) { int i = register.number; @@ -609,7 +609,7 @@ Interval locationHint = interval.locationHint(true, allocator); if (locationHint != null && locationHint.location() != null && locationHint.location().isRegister()) { hint = locationHint.location().asRegister(); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" hint register %d from interval %s", hint.number, locationHint.logString(allocator)); } } @@ -653,7 +653,7 @@ splitPos = usePos[reg.number]; interval.assignLocation(reg.asValue(interval.kind())); - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("selected register %d", reg.number); } @@ -705,7 +705,7 @@ // Split an Interval and spill it to memory so that cur can be placed in a register void allocLockedRegister(Interval interval) { - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("need to split and spill to get register for " + interval.logString(allocator)); } @@ -718,7 +718,7 @@ spillCollectActiveAny(); spillCollectInactiveAny(interval); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" state of registers:"); for (CiRegister reg : availableRegs) { int i = reg.number; @@ -751,7 +751,7 @@ if (reg == null || usePos[reg.number] <= firstUsage) { // the first use of cur is later than the spilling position -> spill cur - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("able to spill current interval. firstUsage(register): %d, usePos: %d", firstUsage, reg == null ? 0 : usePos[reg.number]); } @@ -770,7 +770,7 @@ int splitPos = blockPos[reg.number]; - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("decided to use register %d", reg.number); } assert splitPos > 0 : "invalid splitPos"; @@ -799,7 +799,7 @@ if (isOdd(pos)) { // the current instruction is a call that blocks all registers if (pos < allocator.maxOpId() && allocator.hasCall(pos + 1) && interval.to() > pos + 1) { - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" free register cannot be available because all registers blocked by following call"); } @@ -900,11 +900,11 @@ Interval interval = current; boolean result = true; - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("+++++ activating interval " + interval.logString(allocator)); } - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" splitParent: %s, insertMoveWhenActivated: %b", interval.splitParent().operandNumber, interval.insertMoveWhenActivated()); } @@ -912,7 +912,7 @@ if (interval.location() != null && interval.location().isStackSlot()) { // activating an interval that has a stack slot assigned . split it at first use position // used for method parameters - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" interval has spill slot assigned (method parameter) . split it before first use"); } splitStackInterval(interval); @@ -926,7 +926,7 @@ if (!allocator.operands.mustStayInMemory((CiVariable) operand)) { // activating an interval that must start in a stack slot but may get a register later // used for lirRoundfp: rounding is done by store to stack and reload later - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" interval must start in stack slot . split it before first use"); } splitStackInterval(interval); @@ -936,7 +936,7 @@ } else if (interval.location() == null) { // interval has not assigned register . normal allocation // (this is the normal case for most intervals) - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" normal allocation of register"); } @@ -962,7 +962,7 @@ assert interval.isSplitChild(); assert interval.currentSplitChild() != null; assert interval.currentSplitChild().operand != operand : "cannot insert move between same interval"; - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("Inserting move from interval %d to %d because insertMoveWhenActivated is set", interval.currentSplitChild().operandNumber, interval.operandNumber); } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/MoveResolver.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/MoveResolver.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/MoveResolver.java Wed Jun 08 13:35:43 2011 +0200 @@ -204,7 +204,7 @@ insertionBuffer.move(insertIdx, fromOpr, toOpr, null); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("MoveResolver: inserted move from %d (%s) to %d (%s)", fromInterval.operandNumber, fromInterval.location(), toInterval.operandNumber, toInterval.location()); } } @@ -217,13 +217,12 @@ CiValue toOpr = toInterval.operand; insertionBuffer.move(insertIdx, fromOpr, toOpr, null); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.print("MoveResolver: inserted move from constant %s to %d (%s)", fromOpr, toInterval.operandNumber, toInterval.location()); } } private void resolveMappings() { - //if (C1XOptions.TraceLinearScanLevel >= 4) TTY.println("MoveResolver: resolving mappings for Block B%d, index %d", insertList.block() != null ? insertList.block().blockID : -1, insertIdx); assert verifyBeforeResolve(); // Block all registers that are used as input operands of a move. @@ -289,7 +288,7 @@ } spillInterval.assignLocation(spillSlot); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("created new Interval %s for spilling", spillInterval.operand); } @@ -308,7 +307,6 @@ } void setInsertPosition(LIRList insertList, int insertIdx) { - //if (C1XOptions.TraceLinearScanLevel >= 4) TTY.println("MoveResolver: setting insert position to Block B%d, index %d", insertList.block() != null ? insertList.block().blockID : -1, insertIdx); assert this.insertList == null && this.insertIdx == -1 : "use moveInsertPosition instead of setInsertPosition when data already set"; createInsertionBuffer(insertList); @@ -317,8 +315,6 @@ } void moveInsertPosition(LIRList insertList, int insertIdx) { - //if (C1XOptions.TraceLinearScanLevel >= 4) TTY.println("MoveResolver: moving insert position to Block B%d, index %d", (insertList != null && insertList.block() != null) ? insertList.block().blockID : -1, insertIdx); - if (this.insertList != null && (this.insertList != insertList || this.insertIdx != insertIdx)) { // insert position changed . resolve current mappings resolveMappings(); @@ -336,7 +332,7 @@ } void addMapping(Interval fromInterval, Interval toInterval) { - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("MoveResolver: adding mapping from interval %d (%s) to interval %d (%s)", fromInterval.operandNumber, fromInterval.location(), toInterval.operandNumber, toInterval.location()); } @@ -348,7 +344,7 @@ } void addMapping(CiValue fromOpr, Interval toInterval) { - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("MoveResolver: adding mapping from %s to %d (%s)", fromOpr, toInterval.operandNumber, toInterval.location()); } assert fromOpr.isConstant() : "only for constants"; diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/OperandPool.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/OperandPool.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/OperandPool.java Wed Jun 08 13:35:43 2011 +0200 @@ -59,7 +59,7 @@ /** * Map from a {@linkplain CiVariable#index variable index} to the instruction whose result is stored in the denoted variable. - * This map is only populated and used if {@link C1XOptions#DetailedAsserts} is {@code true}. + * This map is only populated and used if {@link GraalOptions#DetailedAsserts} is {@code true}. */ private final ArrayList variableDefs; @@ -137,7 +137,7 @@ this.firstVariableNumber = registers.length; this.registers = registers; variables = new ArrayList(INITIAL_VARIABLE_CAPACITY); - variableDefs = C1XOptions.DetailedAsserts ? new ArrayList(INITIAL_VARIABLE_CAPACITY) : null; + variableDefs = GraalOptions.DetailedAsserts ? new ArrayList(INITIAL_VARIABLE_CAPACITY) : null; } /** diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/RegisterVerifier.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/RegisterVerifier.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/RegisterVerifier.java Wed Jun 08 13:35:43 2011 +0200 @@ -41,7 +41,7 @@ ArrayMap savedStates; // saved information of previous check // simplified access to methods of LinearScan - C1XCompilation compilation() { + GraalCompilation compilation() { return allocator.compilation; } @@ -102,7 +102,7 @@ } private void processBlock(LIRBlock block) { - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println(); TTY.println("processBlock B%d", block.blockID()); } @@ -110,7 +110,7 @@ // must copy state because it is modified Interval[] inputState = copy(stateForBlock(block)); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("Input-State of intervals:"); TTY.print(" "); for (int i = 0; i < stateSize(); i++) { @@ -152,7 +152,7 @@ savedStateCorrect = false; savedState[i] = null; - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("processSuccessor B%d: invalidating slot %d", block.blockID(), i); } } @@ -161,12 +161,12 @@ if (savedStateCorrect) { // already processed block with correct inputState - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("processSuccessor B%d: previous visit already correct", block.blockID()); } } else { // must re-visit this block - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("processSuccessor B%d: must re-visit because input state changed", block.blockID()); } addToWorkList(block); @@ -174,7 +174,7 @@ } else { // block was not processed before, so set initial inputState - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("processSuccessor B%d: initial visit", block.blockID()); } @@ -192,11 +192,11 @@ CiRegister reg = location.asRegister(); int regNum = reg.number; if (interval != null) { - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" %s = %s", reg, interval.operand); } } else if (inputState[regNum] != null) { - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" %s = null", reg); } } @@ -219,7 +219,7 @@ for (int i = 0; i < ops.length(); i++) { LIRInstruction op = ops.at(i); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(op.toStringWithIdPrefix()); } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/asm/TargetMethodAssembler.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/asm/TargetMethodAssembler.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/asm/TargetMethodAssembler.java Wed Jun 08 13:35:43 2011 +0200 @@ -68,26 +68,26 @@ } } - if (C1XOptions.PrintMetrics) { - C1XMetrics.TargetMethods++; - C1XMetrics.CodeBytesEmitted += targetMethod.targetCodeSize(); - C1XMetrics.SafepointsEmitted += targetMethod.safepoints.size(); - C1XMetrics.DirectCallSitesEmitted += targetMethod.directCalls.size(); - C1XMetrics.IndirectCallSitesEmitted += targetMethod.indirectCalls.size(); - C1XMetrics.DataPatches += targetMethod.dataReferences.size(); - C1XMetrics.ExceptionHandlersEmitted += targetMethod.exceptionHandlers.size(); + if (GraalOptions.PrintMetrics) { + GraalMetrics.TargetMethods++; + GraalMetrics.CodeBytesEmitted += targetMethod.targetCodeSize(); + GraalMetrics.SafepointsEmitted += targetMethod.safepoints.size(); + GraalMetrics.DirectCallSitesEmitted += targetMethod.directCalls.size(); + GraalMetrics.IndirectCallSitesEmitted += targetMethod.indirectCalls.size(); + GraalMetrics.DataPatches += targetMethod.dataReferences.size(); + GraalMetrics.ExceptionHandlersEmitted += targetMethod.exceptionHandlers.size(); } - if (C1XOptions.PrintAssembly && !TTY.isSuppressed() && !isStub) { + if (GraalOptions.PrintAssembly && !TTY.isSuppressed() && !isStub) { Util.printSection("Target Method", Util.SECTION_CHARACTER); TTY.println("Name: " + name); TTY.println("Frame size: " + targetMethod.frameSize()); TTY.println("Register size: " + asm.target.arch.registerReferenceMapBitCount); - if (C1XOptions.PrintCodeBytes) { + if (GraalOptions.PrintCodeBytes) { Util.printSection("Code", Util.SUB_SECTION_CHARACTER); TTY.println("Code: %d bytes", targetMethod.targetCodeSize()); - Util.printBytes(0L, targetMethod.targetCode(), 0, targetMethod.targetCodeSize(), C1XOptions.PrintAssemblyBytesPerLine); + Util.printBytes(0L, targetMethod.targetCode(), 0, targetMethod.targetCodeSize(), GraalOptions.PrintAssemblyBytesPerLine); } Util.printSection("Disassembly", Util.SUB_SECTION_CHARACTER); @@ -186,7 +186,7 @@ int pos = asm.codeBuffer.position(); - if (C1XOptions.TraceRelocation) { + if (GraalOptions.TraceRelocation) { TTY.print("Data reference in code: pos = %d, data = %s", pos, data.toString()); } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinter.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinter.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinter.java Wed Jun 08 13:35:43 2011 +0200 @@ -41,7 +41,7 @@ import com.sun.cri.ri.*; /** - * Utility for printing the control flow graph of a method being compiled by C1X at various compilation phases. + * Utility for printing the control flow graph of a method being compiled by Graal at various compilation phases. * The output format matches that produced by HotSpot so that it can then be fed to the * C1 Visualizer. */ @@ -183,7 +183,7 @@ if (stackSize > 0) { begin("stack"); out.print("size ").println(stackSize); - out.print("method \"").print(CiUtil.toLocation(C1XCompilation.compilation().method, state.bci)).println('"'); + out.print("method \"").print(CiUtil.toLocation(GraalCompilation.compilation().method, state.bci)).println('"'); int i = 0; while (i < stackSize) { @@ -205,7 +205,7 @@ if (state.locksSize() > 0) { begin("locks"); out.print("size ").println(state.locksSize()); - out.print("method \"").print(CiUtil.toLocation(C1XCompilation.compilation().method, state.bci)).println('"'); + out.print("method \"").print(CiUtil.toLocation(GraalCompilation.compilation().method, state.bci)).println('"'); for (int i = 0; i < state.locksSize(); ++i) { Value value = state.lockAt(i); @@ -220,7 +220,7 @@ begin("locals"); out.print("size ").println(state.localsSize()); - out.print("method \"").print(CiUtil.toLocation(C1XCompilation.compilation().method, state.bci)).println('"'); + out.print("method \"").print(CiUtil.toLocation(GraalCompilation.compilation().method, state.bci)).println('"'); int i = 0; while (i < state.localsSize()) { Value value = state.localAt(i); @@ -249,7 +249,7 @@ } StringBuilder buf = new StringBuilder(); - buf.append(CiUtil.toLocation(C1XCompilation.compilation().method, state.bci)); + buf.append(CiUtil.toLocation(GraalCompilation.compilation().method, state.bci)); buf.append('\n'); if (state.stackSize() > 0) { int i = 0; @@ -320,7 +320,7 @@ if (info.hasRegisterRefMap()) { sb.append("reg-ref-map:"); - C1XCompilation compilation = C1XCompilation.compilation(); + GraalCompilation compilation = GraalCompilation.compilation(); CiArchitecture arch = compilation == null ? null : compilation.target.arch; for (int reg = info.registerRefMap.nextSetBit(0); reg >= 0; reg = info.registerRefMap.nextSetBit(reg + 1)) { sb.append(' ').append(arch == null ? "reg" + reg : arch.registers[reg]); diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinterObserver.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinterObserver.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinterObserver.java Wed Jun 08 13:35:43 2011 +0200 @@ -36,7 +36,7 @@ */ public class CFGPrinterObserver implements CompilationObserver { - private C1XCompilation currentCompilation; + private GraalCompilation currentCompilation; private CFGPrinter cfgPrinter; private ByteArrayOutputStream buffer = null; private final OutputStream stream; diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/GraphvizPrinterObserver.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/GraphvizPrinterObserver.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/GraphvizPrinterObserver.java Wed Jun 08 13:35:43 2011 +0200 @@ -95,7 +95,7 @@ private static void printGraph(Graph graph, String name, OutputStream buffer) { GraphvizPrinter printer = new GraphvizPrinter(buffer); - if (C1XOptions.OmitDOTFrameStates) { + if (GraalOptions.OmitDOTFrameStates) { printer.addOmittedClass(FrameState.class); } printer.addClassColor(StartNode.class, "snow3"); diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinterObserver.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinterObserver.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinterObserver.java Wed Jun 08 13:35:43 2011 +0200 @@ -87,7 +87,7 @@ try { stream = new FileOutputStream(filename); printer = new IdealGraphPrinter(stream); - if (C1XOptions.OmitDOTFrameStates) { + if (GraalOptions.OmitDOTFrameStates) { printer.addOmittedClass(FrameState.class); } printer.begin(); @@ -110,7 +110,7 @@ } printer = new IdealGraphPrinter(stream); - if (C1XOptions.OmitDOTFrameStates) { + if (GraalOptions.OmitDOTFrameStates) { printer.addOmittedClass(FrameState.class); } printer.begin(); diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/TTY.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/TTY.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/TTY.java Wed Jun 08 13:35:43 2011 +0200 @@ -84,12 +84,12 @@ } } - public static final String C1X_TTY_LOG_FILE_PROPERTY = "c1x.tty.file"; + public static final String GRAAL_TTY_LOG_FILE_PROPERTY = "graal.tty.file"; private static final LogStream log; static { PrintStream out = System.out; - String value = System.getProperty(C1X_TTY_LOG_FILE_PROPERTY); + String value = System.getProperty(GRAAL_TTY_LOG_FILE_PROPERTY); if (value != null) { try { out = new PrintStream(new FileOutputStream(value)); diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/package-info.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/package-info.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/package-info.java Wed Jun 08 13:35:43 2011 +0200 @@ -21,6 +21,6 @@ * questions. */ /** - * A collection of debugging aids for C1X development. + * A collection of debugging aids for Graal development. */ package com.oracle.max.graal.compiler.debug; diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java Wed Jun 08 13:35:43 2011 +0200 @@ -159,7 +159,7 @@ } } - protected final C1XCompilation compilation; + protected final GraalCompilation compilation; protected final IR ir; protected final XirSupport xirSupport; protected final RiXirGenerator xir; @@ -179,7 +179,7 @@ private ArrayList deoptimizationStubs; private FrameState lastState; - public LIRGenerator(C1XCompilation compilation) { + public LIRGenerator(GraalCompilation compilation) { this.compilation = compilation; this.ir = compilation.hir(); this.xir = compilation.compiler.xir; @@ -217,7 +217,7 @@ blockDoProlog(block); this.currentBlock = block; - if (C1XOptions.TraceLIRGeneratorLevel >= 1) { + if (GraalOptions.TraceLIRGeneratorLevel >= 1) { TTY.println("BEGIN Generating LIR for block B" + block.blockID()); } @@ -236,9 +236,9 @@ } if (stateBefore != null) { lastState = stateBefore; - if (C1XOptions.TraceLIRGeneratorLevel >= 2) { + if (GraalOptions.TraceLIRGeneratorLevel >= 2) { TTY.println("STATE CHANGE (stateBefore)"); - if (C1XOptions.TraceLIRGeneratorLevel >= 3) { + if (GraalOptions.TraceLIRGeneratorLevel >= 3) { TTY.println(stateBefore.toString()); } } @@ -249,9 +249,9 @@ } if (stateAfter != null) { lastState = stateAfter; - if (C1XOptions.TraceLIRGeneratorLevel >= 2) { + if (GraalOptions.TraceLIRGeneratorLevel >= 2) { TTY.println("STATE CHANGE"); - if (C1XOptions.TraceLIRGeneratorLevel >= 3) { + if (GraalOptions.TraceLIRGeneratorLevel >= 3) { TTY.println(stateAfter.toString()); } } @@ -262,7 +262,7 @@ block.lir().jump(block.blockSuccessors().get(0)); } - if (C1XOptions.TraceLIRGeneratorLevel >= 1) { + if (GraalOptions.TraceLIRGeneratorLevel >= 1) { TTY.println("END Generating LIR for block B" + block.blockID()); } @@ -499,7 +499,7 @@ CiValue destinationAddress = null; // emitting the template earlier can ease pressure on register allocation, but the argument loading can destroy an // implicit calling convention between the XirSnippet and the call. - if (!C1XOptions.InvokeSnippetAfterArguments) { + if (!GraalOptions.InvokeSnippetAfterArguments) { destinationAddress = emitXir(snippet, x, info.copy(), x.target(), false); } @@ -508,7 +508,7 @@ List pointerSlots = new ArrayList(2); List argList = visitInvokeArguments(cc, x, pointerSlots); - if (C1XOptions.InvokeSnippetAfterArguments) { + if (GraalOptions.InvokeSnippetAfterArguments) { destinationAddress = emitXir(snippet, x, info.copy(), null, x.target(), false, pointerSlots); } @@ -590,7 +590,7 @@ CiValue tag = load(x.value()); setNoResult(x); - if (x.numberOfCases() == 0 || x.numberOfCases() < C1XOptions.SequentialSwitchLimit) { + if (x.numberOfCases() == 0 || x.numberOfCases() < GraalOptions.SequentialSwitchLimit) { int len = x.numberOfCases(); for (int i = 0; i < len; i++) { lir.cmp(Condition.EQ, tag, x.keyAt(i)); @@ -702,7 +702,7 @@ } protected CiValue emitXir(XirSnippet snippet, Value instruction, LIRDebugInfo info, LIRDebugInfo infoAfter, RiMethod method, boolean setInstructionResult, List pointerSlots) { - if (C1XOptions.PrintXirTemplates) { + if (GraalOptions.PrintXirTemplates) { TTY.println("Emit XIR template " + snippet.template.name); } @@ -725,7 +725,7 @@ assert operands[resultOperand.index] == null; } operands[resultOperand.index] = outputOperand; - if (C1XOptions.PrintXirTemplates) { + if (GraalOptions.PrintXirTemplates) { TTY.println("Output operand: " + outputOperand); } } @@ -761,7 +761,7 @@ operands[x.index] = op; operandArray[i] = op; operandIndicesArray[i] = x.index; - if (C1XOptions.PrintXirTemplates) { + if (GraalOptions.PrintXirTemplates) { TTY.println("Input operand: " + x); } } @@ -774,7 +774,7 @@ operands[x.index] = newOp; operandArray[i + inputOperands.length] = newOp; operandIndicesArray[i + inputOperands.length] = x.index; - if (C1XOptions.PrintXirTemplates) { + if (GraalOptions.PrintXirTemplates) { TTY.println("InputTemp operand: " + x); } } @@ -785,7 +785,7 @@ operands[x.index] = op; operandArray[i + inputOperands.length + inputTempOperands.length] = op; operandIndicesArray[i + inputOperands.length + inputTempOperands.length] = x.index; - if (C1XOptions.PrintXirTemplates) { + if (GraalOptions.PrintXirTemplates) { TTY.println("Temp operand: " + x); } } @@ -851,7 +851,7 @@ setNoResult(x); // TODO: tune the defaults for the controls used to determine what kind of translation to use - if (x.numberOfCases() == 0 || x.numberOfCases() <= C1XOptions.SequentialSwitchLimit) { + if (x.numberOfCases() == 0 || x.numberOfCases() <= GraalOptions.SequentialSwitchLimit) { int loKey = x.lowKey(); int len = x.numberOfCases(); for (int i = 0; i < len; i++) { @@ -862,7 +862,7 @@ } else { SwitchRange[] switchRanges = createLookupRanges(x); int rangeDensity = x.numberOfCases() / switchRanges.length; - if (rangeDensity >= C1XOptions.RangeTestsSwitchDensity) { + if (rangeDensity >= GraalOptions.RangeTestsSwitchDensity) { visitSwitchRanges(switchRanges, tag, getLIRBlock(x.defaultSuccessor())); } else { List nonDefaultSuccessors = x.blockSuccessors().subList(0, x.numberOfCases()); @@ -883,7 +883,7 @@ } private void blockDoEpilog() { - if (C1XOptions.PrintIRWithLIR) { + if (GraalOptions.PrintIRWithLIR) { TTY.println(); } @@ -893,7 +893,7 @@ } private void blockDoProlog(LIRBlock block) { - if (C1XOptions.PrintIRWithLIR) { + if (GraalOptions.PrintIRWithLIR) { TTY.print(block.toString()); } // set up the list of LIR instructions @@ -950,10 +950,10 @@ // XXX: linear search might be kind of slow for big basic blocks int index = constants.indexOf(c); if (index != -1) { - C1XMetrics.LoadConstantIterations += index; + GraalMetrics.LoadConstantIterations += index; return variablesForConstants.get(index); } - C1XMetrics.LoadConstantIterations += constants.size(); + GraalMetrics.LoadConstantIterations += constants.size(); CiVariable result = newVariable(kind); lir.move(c, result); @@ -1214,16 +1214,16 @@ } void doRoot(Value instr) { - if (C1XOptions.TraceLIRGeneratorLevel >= 2) { + if (GraalOptions.TraceLIRGeneratorLevel >= 2) { TTY.println("Emitting LIR for instruction " + instr); } currentInstruction = instr; - if (C1XOptions.TraceLIRVisit) { + if (GraalOptions.TraceLIRVisit) { TTY.println("Visiting " + instr); } instr.accept(this); - if (C1XOptions.TraceLIRVisit) { + if (GraalOptions.TraceLIRVisit) { TTY.println("Operand for " + instr + " = " + instr.operand()); } } @@ -1396,7 +1396,7 @@ protected CiValue setResult(Value x, CiVariable operand) { x.setOperand(operand); - if (C1XOptions.DetailedAsserts) { + if (GraalOptions.DetailedAsserts) { operands.recordResult(operand, x); } return operand; diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/IR.java Wed Jun 08 13:35:43 2011 +0200 @@ -42,7 +42,7 @@ /** * The compilation associated with this IR. */ - public final C1XCompilation compilation; + public final GraalCompilation compilation; /** * The start block of this IR. @@ -58,7 +58,7 @@ * Creates a new IR instance for the specified compilation. * @param compilation the compilation */ - public IR(C1XCompilation compilation) { + public IR(GraalCompilation compilation) { this.compilation = compilation; } @@ -68,26 +68,26 @@ * Builds the graph, optimizes it, and computes the linear scan block order. */ public void build() { - if (C1XOptions.PrintTimers) { - C1XTimers.HIR_CREATE.start(); + if (GraalOptions.PrintTimers) { + GraalTimers.HIR_CREATE.start(); } new GraphBuilderPhase(compilation, compilation.method, false).apply(compilation.graph); new DuplicationPhase().apply(compilation.graph); new DeadCodeEliminationPhase().apply(compilation.graph); - if (C1XOptions.Inline) { + if (GraalOptions.Inline) { new InliningPhase(compilation, this).apply(compilation.graph); } - if (C1XOptions.PrintTimers) { - C1XTimers.HIR_CREATE.stop(); - C1XTimers.HIR_OPTIMIZE.start(); + if (GraalOptions.PrintTimers) { + GraalTimers.HIR_CREATE.stop(); + GraalTimers.HIR_OPTIMIZE.start(); } Graph graph = compilation.graph; - if (C1XOptions.OptCanonicalizer) { + if (GraalOptions.OptCanonicalizer) { new CanonicalizerPhase().apply(graph); } @@ -140,8 +140,8 @@ verifyAndPrint("After linear scan order"); - if (C1XOptions.PrintTimers) { - C1XTimers.HIR_OPTIMIZE.stop(); + if (GraalOptions.PrintTimers) { + GraalTimers.HIR_OPTIMIZE.stop(); } } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/MemoryMap.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/MemoryMap.java Wed Jun 08 13:19:56 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2009, 2010, 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.max.graal.compiler.graph; - -import static java.lang.reflect.Modifier.*; - -import java.util.*; - -import com.oracle.max.graal.compiler.ir.*; -import com.sun.cri.ri.*; - -/** - * The {@code MemoryMap} class is an approximation of memory that is used redundant load and - * store elimination. In C1, tracking of fields of new objects' fields was precise, - * while tracking of other fields is managed at the offset granularity (i.e. a write of a field with offset - * {@code off} will "overwrite" all fields with the offset {@code off}. However, C1X distinguishes all - * loaded fields as separate locations. Static fields have just one location, while instance fields are - * tracked for at most one instance object. Loads or stores of unloaded fields kill all memory locations. - * An object is no longer "new" if it is stored into a field or array. - * - * @author Ben L. Titzer - */ -public class MemoryMap { - - private final HashMap objectMap = new HashMap(); - private final HashMap valueMap = new HashMap(); - private final IdentityHashMap newObjects = new IdentityHashMap(); - - /** - * Kills all memory locations. - */ - public void kill() { - objectMap.clear(); - valueMap.clear(); - newObjects.clear(); - } - - /** - * The specified instruction has just escaped, it can no longer be considered a "new object". - * @param x the instruction that just escaped - */ - public void storeValue(Value x) { - newObjects.remove(x); - } - - /** - * Record a newly allocated object. - * @param n the instruction generating the new object - */ - public void newInstance(NewInstance n) { - newObjects.put(n, n); - } - - /** - * Look up a load for load elimination, and put this load into the load elimination map. - * @param load the instruction representing the load - * @return a reference to the previous instruction that already loaded the value, if it is available; the - * {@code load} parameter otherwise - */ - public Value load(LoadField load) { - if (!load.isLoaded()) { - // the field is not loaded, kill everything, because it will need to be resolved - kill(); - return load; - } - RiField field = load.field(); - if (load.isStatic()) { - // the field is static, look in the static map - Value r = valueMap.get(field); - if (r != null) { - return r; - } - valueMap.put(field, load); - } else { - // see if the value for this object for this field is in the map - if (objectMap.get(field) == load.object()) { - return valueMap.get(field); - } - objectMap.put(field, load.object()); - valueMap.put(field, load); - } - - return load; // load cannot be eliminated - } - - /** - * Insert a new result for a load into the memory map. - * @param load the load instruction - * @param result the result that the load instruction should produce - */ - public void setResult(LoadField load, Value result) { - if (load.isLoaded()) { - RiField field = load.field(); - if (load.isStatic()) { - // the field is static, put it in the static map - valueMap.put(field, result); - } else { - // put the result for the loaded object into the map - objectMap.put(field, load.object()); - valueMap.put(field, result); - } - } - } - - /** - * Look up a store for store elimination, and put this store into the load elimination map. - * @param store the store instruction to put into the map - * @return {@code null} if the store operation is redundant; the {@code store} parameter - * otherwise - */ - public StoreField store(StoreField store) { - if (!store.isLoaded()) { - // the field is not loaded, kill everything, because it will need to be resolved - kill(); - return store; - } - RiField field = store.field(); - Value value = store.value(); - if (store.isStatic()) { - // the field is static, overwrite it into the static map - valueMap.put(field, value); - } else { - if (newObjects.containsKey(store.object())) { - // this is a store to a new object's field - if (fieldHasNoStores(field) && value.isConstant() && value.asConstant().isDefaultValue()) { - // this is a redundant initialization of a new object's field that has not been assigned to - return null; - } - } - Value obj = objectMap.get(field); - if (obj == store.object()) { - // is this a redundant store? - if (value == valueMap.get(field) && !isVolatile(field.accessFlags())) { - return null; - } - } - objectMap.put(field, store.object()); - valueMap.put(field, value); - } - storeValue(value); // the value stored just escaped - return store; // the store cannot be eliminated - } - - private boolean fieldHasNoStores(RiField field) { - return objectMap.get(field) == null; - } -} diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/package-info.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/package-info.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/package-info.java Wed Jun 08 13:35:43 2011 +0200 @@ -35,7 +35,7 @@ * * {@code IR.buildGraph} creates an {@link com.oracle.max.graal.compiler.ir.IRScope topScope} object, * that represents a context for inlining, and then invokes the constructor for the - * {@link com.oracle.max.graal.compiler.phases.GraphBuilderPhase} class, passing the {@link com.oracle.max.graal.compiler.C1XCompilation}, and {@code IR} + * {@link com.oracle.max.graal.compiler.phases.GraphBuilderPhase} class, passing the {@link com.oracle.max.graal.compiler.GraalCompilation}, and {@code IR} * instances, which are cached. The following support objects are created in the constructor: * *
    @@ -51,11 +51,11 @@ *
      *
    1. The {@link com.oracle.max.graal.compiler.graph.IR#startBlock} field of the cached {@link com.oracle.max.graal.compiler.graph.IR} instance is set to a newly created * {@link com.oracle.max.graal.compiler.ir.BlockBegin} node, with bytecode index 0 and then the {@link com.oracle.max.graal.compiler.graph.BlockMap} is - * constructed by calling {@link com.oracle.max.graal.compiler.C1XCompilation#getBlockMap}. This behaves slightly differently depending on + * constructed by calling {@link com.oracle.max.graal.compiler.GraalCompilation#getBlockMap}. This behaves slightly differently depending on * whether this is an OSR compilation. If so, a new {@link com.oracle.max.graal.compiler.ir.BlockBegin} node is added to the map at the OSR bytecode * index. The map is then built by the{@link com.oracle.max.graal.compiler.graph.BlockMap#build}, which takes a boolean argument that * controls whether a second pass is made over the bytecodes to compute stores in loops. This always false for an OSR - * compilation (why?). Otherwise, it is only true if enabled by the {@link com.oracle.max.graal.compiler.C1XOptions#PhiLoopStores} + * compilation (why?). Otherwise, it is only true if enabled by the {@link com.oracle.max.graal.compiler.GraalOptions#PhiLoopStores} * compilation option. FInally some unneeded state from the map is removed by the {@link com.oracle.max.graal.compiler.graph.BlockMap#cleanup} method, and * the statistics are updated. *
    2. @@ -68,7 +68,7 @@ * {@link com.oracle.max.graal.compiler.phases.GraphBuilderPhase#pushRootScope} initializes the {@link com.oracle.max.graal.compiler.phases.GraphBuilderPhase#scopeData} field with a * {@link com.oracle.max.graal.compiler.graph.ScopeData} instance, with null parent. The * {@link com.oracle.max.graal.compiler.phases.GraphBuilderPhase#compilation} instance is called to get an {@link com.sun.cri.ri.RiConstantPool} - * , which is C1X's interface to constant pool information. The {@link com.oracle.max.graal.compiler.phases.GraphBuilderPhase#curBlock} field is + * , which is Graal's interface to constant pool information. The {@link com.oracle.max.graal.compiler.phases.GraphBuilderPhase#curBlock} field is * set to the {@code startBlock}. *

      * @@ -99,8 +99,8 @@ * Then the {@link com.oracle.max.graal.compiler.ir.IRScope#lockStackSize} is computed. (TBD) * *

    3. - * Then the method is checked for being intrinsic, i.e., one that has a hard-wired implementation known to C1X. If so, - * and {@link com.oracle.max.graal.compiler.C1XOptions#OptIntrinsify} is set, an attempt is made to inline it (TBD). Otherwise, or if the + * Then the method is checked for being intrinsic, i.e., one that has a hard-wired implementation known to Graal. If so, + * and {@link com.oracle.max.graal.compiler.GraalOptions#OptIntrinsify} is set, an attempt is made to inline it (TBD). Otherwise, or if the * intrinsification fails, normal processing continues by adding the entry block to the * {@link com.oracle.max.graal.compiler.graph.ScopeData} work list (kept topologically sorted) and calling * {@link com.oracle.max.graal.compiler.phases.GraphBuilderPhase#iterateAllBlocks}. diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ComputeLinearScanOrder.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ComputeLinearScanOrder.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/ComputeLinearScanOrder.java Wed Jun 08 13:35:43 2011 +0200 @@ -147,12 +147,12 @@ * 4. Create a list with all loop end blocks. */ void countEdges(LIRBlock cur, LIRBlock parent) { - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("Counting edges for block B%d%s", cur.blockID(), parent == null ? "" : " coming from B" + parent.blockID()); } if (isActive(cur)) { - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("backward branch"); } assert isVisited(cur) : "block must be visited when block is active"; @@ -169,7 +169,7 @@ incForwardBranches(cur); if (isVisited(cur)) { - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("block already visited"); } return; @@ -194,7 +194,7 @@ // have returned. if (cur.isLinearScanLoopHeader()) { assert cur.loopIndex() == -1 : "cannot set loop-index twice"; - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("Block B%d is loop header of loop %d", cur.blockID(), numLoops); } @@ -202,13 +202,13 @@ numLoops++; } - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("Finished counting edges for block B%d", cur.blockID()); } } void markLoops() { - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("----- marking loops"); } @@ -219,7 +219,7 @@ LIRBlock loopStart = loopEnd.suxAt(0); int loopIdx = loopStart.loopIndex(); - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("Processing loop from B%d to B%d (loop %d):", loopStart.blockID(), loopEnd.blockID(), loopIdx); } assert loopEnd.isLinearScanLoopEnd() : "loop end flag must be set"; @@ -234,7 +234,7 @@ do { LIRBlock cur = workList.remove(workList.size() - 1); - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println(" processing B%d", cur.blockID()); } assert isBlockInLoop(loopIdx, cur) : "bit in loop map must be set when block is in work list"; @@ -246,7 +246,7 @@ if (!isBlockInLoop(loopIdx, pred)) { // this predecessor has not been processed yet, so add it to work list - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println(" pushing B%d", pred.blockID()); } workList.add(pred); @@ -266,7 +266,7 @@ if (isBlockInLoop(i, startBlock)) { // loop i contains the entry block of the method. // this is not a natural loop, so ignore it - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("Loop %d is non-natural, so it is ignored", i); } @@ -279,7 +279,7 @@ } void assignLoopDepth(LIRBlock startBlock) { - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("----- computing loop-depth and weight"); } initVisited(); @@ -292,7 +292,7 @@ if (!isVisited(cur)) { setVisited(cur); - if (C1XOptions.TraceLinearScanLevel >= 4) { + if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("Computing loop depth for block B%d", cur.blockID()); } @@ -393,7 +393,7 @@ // the linearScanNumber is used to cache the weight of a block cur.setLinearScanNumber(curWeight); - if (C1XOptions.StressLinearScan) { + if (GraalOptions.StressLinearScan) { workList.add(0, cur); return; } @@ -407,7 +407,7 @@ } workList.set(insertIdx, cur); - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("Sorted B%d into worklist. new worklist:", cur.blockID()); for (int i = 0; i < workList.size(); i++) { TTY.println(String.format("%8d B%02d weight:%6x", i, workList.get(i).blockID(), workList.get(i).linearScanNumber())); @@ -421,7 +421,7 @@ } void appendBlock(LIRBlock cur) { - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("appending block B%d (weight 0x%06x) to linear-scan order", cur.blockID(), cur.linearScanNumber()); } assert !linearScanOrder.contains(cur) : "cannot add the same block twice"; @@ -434,7 +434,7 @@ } void computeOrder(LIRBlock startBlock) { - if (C1XOptions.TraceLinearScanLevel >= 3) { + if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println("----- computing final block order"); } @@ -471,7 +471,7 @@ } public void printBlocks() { - if (C1XOptions.TraceLinearScanLevel >= 2) { + if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println("----- loop information:"); for (LIRBlock cur : linearScanOrder) { TTY.print(String.format("%4d: B%02d: ", cur.linearScanNumber(), cur.blockID())); @@ -482,7 +482,7 @@ } } - if (C1XOptions.TraceLinearScanLevel >= 1) { + if (GraalOptions.TraceLinearScanLevel >= 1) { TTY.println("----- linear-scan block order:"); for (LIRBlock cur : linearScanOrder) { TTY.print(String.format("%4d: B%02d loop: %2d depth: %2d", cur.linearScanNumber(), cur.blockID(), cur.loopIndex(), cur.loopDepth())); @@ -515,7 +515,7 @@ boolean verify() { /* assert linearScanOrder.size() == numBlocks : "wrong number of blocks in list"; - if (C1XOptions.StressLinearScan) { + if (GraalOptions.StressLinearScan) { // blocks are scrambled when StressLinearScan is used return true; } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Constant.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Constant.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Constant.java Wed Jun 08 13:35:43 2011 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.max.graal.compiler.ir; -import static com.oracle.max.graal.compiler.C1XCompilation.*; +import static com.oracle.max.graal.compiler.GraalCompilation.*; import com.oracle.max.graal.compiler.debug.*; import com.oracle.max.graal.graph.*; diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Instruction.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Instruction.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Instruction.java Wed Jun 08 13:35:43 2011 +0200 @@ -85,7 +85,7 @@ */ public Instruction(CiKind kind, int inputCount, int successorCount, Graph graph) { super(kind, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); - C1XMetrics.HIRInstructions++; + GraalMetrics.HIRInstructions++; } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/FrameMap.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/FrameMap.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/FrameMap.java Wed Jun 08 13:35:43 2011 +0200 @@ -81,7 +81,7 @@ */ public final class FrameMap { - private final C1XCompilation compilation; + private final GraalCompilation compilation; private final CiCallingConvention incomingArguments; /** @@ -123,7 +123,7 @@ * @param method the outermost method being compiled * @param monitors the number of monitors allocated on the stack for this method */ - public FrameMap(C1XCompilation compilation, RiMethod method, int monitors) { + public FrameMap(GraalCompilation compilation, RiMethod method, int monitors) { this.compilation = compilation; this.frameSize = -1; this.spillSlotCount = -2; diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRAssembler.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRAssembler.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRAssembler.java Wed Jun 08 13:35:43 2011 +0200 @@ -42,7 +42,7 @@ */ public abstract class LIRAssembler { - public final C1XCompilation compilation; + public final GraalCompilation compilation; public final TargetMethodAssembler tasm; public final AbstractAssembler asm; public final FrameMap frameMap; @@ -65,7 +65,7 @@ } } - public LIRAssembler(C1XCompilation compilation) { + public LIRAssembler(GraalCompilation compilation) { this.compilation = compilation; this.tasm = compilation.assembler(); this.asm = tasm.asm; @@ -97,7 +97,7 @@ public abstract void emitTraps(); public void emitCode(List hir) { - if (C1XOptions.PrintLIR && !TTY.isSuppressed()) { + if (GraalOptions.PrintLIR && !TTY.isSuppressed()) { LIRList.printLIR(hir); } @@ -112,12 +112,12 @@ block.setBlockEntryPco(codePos()); - if (C1XOptions.PrintLIRWithAssembly) { + if (GraalOptions.PrintLIRWithAssembly) { block.printWithoutPhis(TTY.out()); } assert block.lir() != null : "must have LIR"; - if (C1XOptions.CommentedAssembly) { + if (GraalOptions.CommentedAssembly) { String st = String.format(" block B%d", block.blockID()); tasm.blockComment(st); } @@ -129,13 +129,13 @@ doPeephole(list); for (LIRInstruction op : list.instructionsList()) { - if (C1XOptions.CommentedAssembly) { + if (GraalOptions.CommentedAssembly) { // Only print out branches if (op.code == LIROpcode.Branch) { tasm.blockComment(op.toStringWithIdPrefix()); } } - if (C1XOptions.PrintLIRWithAssembly && !TTY.isSuppressed()) { + if (GraalOptions.PrintLIRWithAssembly && !TTY.isSuppressed()) { // print out the LIR operation followed by the resulting assembly TTY.println(op.toStringWithIdPrefix()); TTY.println(); @@ -143,7 +143,7 @@ op.emitCode(this); - if (C1XOptions.PrintLIRWithAssembly) { + if (GraalOptions.PrintLIRWithAssembly) { printAssembly(asm); } } @@ -157,7 +157,7 @@ TTY.println(disasm); } else { TTY.println("Code [+%d]: %d bytes", lastDecodeStart, currentBytes.length); - Util.printBytes(lastDecodeStart, currentBytes, C1XOptions.PrintAssemblyBytesPerLine); + Util.printBytes(lastDecodeStart, currentBytes, GraalOptions.PrintAssemblyBytesPerLine); } } lastDecodeStart = asm.codeBuffer.position(); @@ -369,7 +369,7 @@ } public void verifyOopMap(LIRDebugInfo info) { - if (C1XOptions.VerifyPointerMaps) { + if (GraalOptions.VerifyPointerMaps) { // TODO: verify oops Util.shouldNotReachHere(); } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRDebugInfo.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRDebugInfo.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRDebugInfo.java Wed Jun 08 13:35:43 2011 +0200 @@ -62,7 +62,7 @@ return new LIRDebugInfo(this); } - public void setOop(CiValue location, C1XCompilation compilation, CiBitMap frameRefMap, CiBitMap regRefMap) { + public void setOop(CiValue location, GraalCompilation compilation, CiBitMap frameRefMap, CiBitMap regRefMap) { CiTarget target = compilation.target; if (location.isAddress()) { CiAddress stackLocation = (CiAddress) location; diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRInstruction.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRInstruction.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRInstruction.java Wed Jun 08 13:35:43 2011 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.max.graal.compiler.lir; -import static com.oracle.max.graal.compiler.C1XCompilation.*; +import static com.oracle.max.graal.compiler.GraalCompilation.*; import java.util.*; @@ -185,10 +185,10 @@ allocatorOperands = new ArrayList(operands.length + 3); this.result = initOutput(result); - C1XMetrics.LIRInstructions++; + GraalMetrics.LIRInstructions++; if (opcode == LIROpcode.Move) { - C1XMetrics.LIRMoveInstructions++; + GraalMetrics.LIRMoveInstructions++; } id = -1; this.operands = new LIROperand[operands.length]; diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRList.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRList.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRList.java Wed Jun 08 13:35:43 2011 +0200 @@ -49,17 +49,17 @@ private final LIROpcode runtimeCallOp; private LIROpcode directCallOp(RiMethod method) { - return C1XOptions.UseConstDirectCall && method.hasCompiledCode() ? LIROpcode.ConstDirectCall : LIROpcode.DirectCall; + return GraalOptions.UseConstDirectCall && method.hasCompiledCode() ? LIROpcode.ConstDirectCall : LIROpcode.DirectCall; } public LIRList(LIRGenerator generator) { this.generator = generator; this.operations = new ArrayList(8); - runtimeCallOp = C1XOptions.UseConstDirectCall ? LIROpcode.ConstDirectCall : LIROpcode.DirectCall; + runtimeCallOp = GraalOptions.UseConstDirectCall ? LIROpcode.ConstDirectCall : LIROpcode.DirectCall; } private void append(LIRInstruction op) { - if (C1XOptions.PrintIRWithLIR && !TTY.isSuppressed()) { + if (GraalOptions.PrintIRWithLIR && !TTY.isSuppressed()) { generator.maybePrintCurrentInstruction(); TTY.println(op.toStringWithIdPrefix()); TTY.println(); diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRXirInstruction.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRXirInstruction.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRXirInstruction.java Wed Jun 08 13:35:43 2011 +0200 @@ -68,7 +68,7 @@ this.tempCount = tempCount; this.inputCount = operands.length - inputTempCount - tempCount; - C1XMetrics.LIRXIRInstructions++; + GraalMetrics.LIRXIRInstructions++; } public CiValue[] getOperands() { diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/observer/CompilationEvent.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/observer/CompilationEvent.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/observer/CompilationEvent.java Wed Jun 08 13:35:43 2011 +0200 @@ -41,7 +41,7 @@ */ public class CompilationEvent { - private final C1XCompilation compilation; + private final GraalCompilation compilation; private final String label; private Graph graph; @@ -57,42 +57,42 @@ private int intervalsSize; private Interval[] intervalsCopy = null; - public CompilationEvent(C1XCompilation compilation) { + public CompilationEvent(GraalCompilation compilation) { this(compilation, null); } - private CompilationEvent(C1XCompilation compilation, String label) { + private CompilationEvent(GraalCompilation compilation, String label) { assert compilation != null; this.label = label; this.compilation = compilation; } - public CompilationEvent(C1XCompilation compilation, String label, Graph graph, boolean hirValid, boolean lirValid) { + public CompilationEvent(GraalCompilation compilation, String label, Graph graph, boolean hirValid, boolean lirValid) { this(compilation, label); this.graph = graph; this.hirValid = hirValid; this.lirValid = lirValid; } - public CompilationEvent(C1XCompilation compilation, String label, Graph graph, boolean hirValid, boolean lirValid, CiTargetMethod targetMethod) { + public CompilationEvent(GraalCompilation compilation, String label, Graph graph, boolean hirValid, boolean lirValid, CiTargetMethod targetMethod) { this(compilation, label, graph, hirValid, lirValid); this.targetMethod = targetMethod; } - public CompilationEvent(C1XCompilation compilation, String label, BlockMap blockMap, int codeSize) { + public CompilationEvent(GraalCompilation compilation, String label, BlockMap blockMap, int codeSize) { this(compilation, label); this.blockMap = blockMap; this.codeSize = codeSize; } - public CompilationEvent(C1XCompilation compilation, String label, LinearScan allocator, Interval[] intervals, int intervalsSize) { + public CompilationEvent(GraalCompilation compilation, String label, LinearScan allocator, Interval[] intervals, int intervalsSize) { this(compilation, label); this.allocator = allocator; this.intervals = intervals; this.intervalsSize = intervalsSize; } - public C1XCompilation getCompilation() { + public GraalCompilation getCompilation() { return compilation; } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/observer/CompilationObserver.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/observer/CompilationObserver.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/observer/CompilationObserver.java Wed Jun 08 13:35:43 2011 +0200 @@ -33,7 +33,7 @@ /** * Called when compilation of a method has started. This is always the first event raised for a particular - * {@link C1XCompilation}. + * {@link GraalCompilation}. * * @param event Information associated with the event and current state of the compilation. */ @@ -48,7 +48,7 @@ /** * Called when compilation of a method has completed (successfully or not). This is always the last event raised for - * a particular {@link C1XCompilation}. + * a particular {@link GraalCompilation}. * * @param event Information associated with the event and current state of the compilation. */ diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/package-info.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/package-info.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/package-info.java Wed Jun 08 13:35:43 2011 +0200 @@ -22,37 +22,37 @@ */ /** - * The top-level package in C1X containing options, metrics, timers and the main compiler class - * {@link com.oracle.max.graal.compiler.C1XCompiler}. + * The top-level package in Graal containing options, metrics, timers and the main compiler class + * {@link com.oracle.max.graal.compiler.GraalCompiler}. * - *

      {@code C1XCompiler} Overview

      + *

      {@code GraalCompiler} Overview

      * - * C1X is intended to be used with multiple JVM's so makes no use of or reference to classes for a specific JVM, for + * Graal is intended to be used with multiple JVM's so makes no use of or reference to classes for a specific JVM, for * example Maxine. * - * The compiler is represented by the class {@code C1XCompiler}. {@code C1XCompiler} binds a specific target + * The compiler is represented by the class {@code GraalCompiler}. {@code GraalCompiler} binds a specific target * architecture and JVM interface to produce a usable compiler object. There are * two variants of {@code compileMethod}, one of which is used when doing on stack replacement (OSR), discussed * later. The main variant takes {@link com.sun.cri.ri.RiMethod} and {@link com.sun.cri.xir.RiXirGenerator} arguments. - * {@code RiMethod} is C1X's representation of a Java method and {@code RiXirGenerator} represents the interface through + * {@code RiMethod} is Graal's representation of a Java method and {@code RiXirGenerator} represents the interface through * which the compiler requests the XIR for a given bytecode from the runtime system. * - *

      The C1X Compilation Process

      + *

      The Graal Compilation Process

      * - * {@link com.oracle.max.graal.compiler.C1XCompiler#compileMethod} creates a {@link C1XCompilation} instance and then returns the result of calling its - * {@link com.oracle.max.graal.compiler.C1XCompilation#compile} method. The {@code C1XCompilation} instance records whether {@code compileMethod} was invoked with + * {@link com.oracle.max.graal.compiler.GraalCompiler#compileMethod} creates a {@link GraalCompilation} instance and then returns the result of calling its + * {@link com.oracle.max.graal.compiler.GraalCompilation#compile} method. The {@code GraalCompilation} instance records whether {@code compileMethod} was invoked with * the OSR variant, which is used later in the IR generation. *

      - * While there is only one {@code C1XCompiler} instance, there may be several compilations proceeding concurrently, each of - * which is represented by a unique {@code C1XCompilation} instance. The static method {@link com.oracle.max.graal.compiler.C1XCompilation#current}} returns the - * {@code C1XCompilation} instance associated with the current thread, and is managed using a {@link java.lang.ThreadLocal} variable. It - * is used when assigning the unique id that is used for tracing output to an HIR node. Each {@code C1XCompilation} instance + * While there is only one {@code GraalCompiler} instance, there may be several compilations proceeding concurrently, each of + * which is represented by a unique {@code GraalCompilation} instance. The static method {@link com.oracle.max.graal.compiler.GraalCompilation#current}} returns the + * {@code GraalCompilation} instance associated with the current thread, and is managed using a {@link java.lang.ThreadLocal} variable. It + * is used when assigning the unique id that is used for tracing output to an HIR node. Each {@code GraalCompilation} instance * has an associated {@link com.sun.cri.ci.CiStatistics} object that accumulates information about the compilation process, but is also * used as a generator of, for example, basic block identifiers. *

      - * The compilation begins by calling {@link com.oracle.max.graal.compiler.C1XCompilation#emitHIR}, which creates the high-level intermediate representation (HIR) from the + * The compilation begins by calling {@link com.oracle.max.graal.compiler.GraalCompilation#emitHIR}, which creates the high-level intermediate representation (HIR) from the * bytecodes of the method. The HIR is managed by the {@link com.oracle.max.graal.compiler.graph.IR} class, an instance of which is created by - * {@code emitHR}, which then calls the {{@link com.oracle.max.graal.compiler.graph.IR#build}} method and returns the result. The {@code C1XCompilation} and {@code IR} + * {@code emitHR}, which then calls the {{@link com.oracle.max.graal.compiler.graph.IR#build}} method and returns the result. The {@code GraalCompilation} and {@code IR} * instances are are bi-directionally linked. * *

      Supported backends

      @@ -61,7 +61,7 @@ *
    4. AMD64/x64 with SSE2
    5. *
* - *

Notes and Todos

This is a collection of notes about the C1X compiler, including future directions, + *

Notes and Todos

This is a collection of notes about the Graal compiler, including future directions, * refactorings, missing features, broken features, etc. * * @@ -94,7 +94,7 @@ * *

Missing or incomplete features

* - * There are some features of C1 that were not ported forward or finished given the time constraints for the C1X port. A + * There are some features of C1 that were not ported forward or finished given the time constraints for the Graal port. A * list appears below. * *
    @@ -126,7 +126,7 @@ * backend ({@link com.oracle.max.graal.compiler.target.amd64.AMD64Backend}, {@link com.oracle.max.graal.compiler.target.amd64.AMD64LIRGenerator}, {@link com.oracle.max.graal.compiler.target.amd64.AMD64LIRAssembler}, etc). * *
  • - * XIR for safepoints. The C1X backend should use XIR to get the code for safepoints, but currently it still uses the + * XIR for safepoints. The Graal backend should use XIR to get the code for safepoints, but currently it still uses the * handwritten logic (currently only compatible with Maxine).
  • * *
@@ -136,28 +136,28 @@ *
    * *
  • - * Reference map for outgoing overflow arguments. If a C1X method calls another method that has overflow arguments, it + * Reference map for outgoing overflow arguments. If a Graal method calls another method that has overflow arguments, it * is not clear if the outgoing overflow argument area, which may contain references, has the appropriate bits set in - * the reference map for the C1X method's frame. Such arguments may be live in the called method.
  • + * the reference map for the Graal method's frame. Such arguments may be live in the called method. * *
  • * Although it should work, inlining synchronized methods or methods with exception handlers hasn't been tested.
  • *
  • - * On-stack replacement. C1X retains all of the special logic for performing an OSR compilation. This is basically a + * On-stack replacement. Graal retains all of the special logic for performing an OSR compilation. This is basically a * compilation with a second entrypoint for entry from the interpreter. However, the generation of a runtime-specific * entry sequence was never tested.
  • * *
  • - * {@link com.oracle.max.graal.compiler.C1XIntrinsic Intrinsification} is the mechanism by which the compiler recognizes calls to special JDK or - * runtime methods and replaces them with custom code. It is enabled by the {@link com.oracle.max.graal.compiler.C1XOptions#OptIntrinsify} compiler - * option. The C1X backend has never been tested with intrinsified arithmetic or floating point operations. For best + * {@link com.oracle.max.graal.compiler.GraalIntrinsic Intrinsification} is the mechanism by which the compiler recognizes calls to special JDK or + * runtime methods and replaces them with custom code. It is enabled by the {@link com.oracle.max.graal.compiler.GraalOptions#OptIntrinsify} compiler + * option. The Graal backend has never been tested with intrinsified arithmetic or floating point operations. For best * performance, it should generate specialized machine code for arithmetic and floating point, perhaps using global * stubs for complex floating point operations.
    * Note: Folding of special intrinsified methods is supported, tested, and working. The runtime system may * register methods to be folded by using the - * {@link com.oracle.max.graal.compiler.C1XIntrinsic#registerFoldableMethod(RiMethod, java.lang.reflect.Method)} call. When the compiler encounters a + * {@link com.oracle.max.graal.compiler.GraalIntrinsic#registerFoldableMethod(RiMethod, java.lang.reflect.Method)} call. When the compiler encounters a * call to such a registered method where the parameters are all constants, it invokes the supplied method with - * reflection. If the reflective call produces a value and does not throw an exception, C1X replaces the call to the + * reflection. If the reflective call produces a value and does not throw an exception, Graal replaces the call to the * method with the result.
  • *
* @@ -166,7 +166,7 @@ *
    *
  • * {@link com.oracle.max.graal.compiler.opt.LoopPeeler Loop peeling} was written by Marcelo Cintra near the end of his internship. It was never completed - * and should be considered broken. It only remains as a sketch of how loop peeling would be implemented in C1X, or in + * and should be considered broken. It only remains as a sketch of how loop peeling would be implemented in Graal, or in * case he would finish the implementation and test it.
  • * *
  • diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java Wed Jun 08 13:35:43 2011 +0200 @@ -60,7 +60,7 @@ Node canonical = op.canonical(n); if (canonical != n) { n.replace(canonical); - C1XMetrics.NodesCanonicalized++; + GraalMetrics.NodesCanonicalized++; } } } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/DeadCodeEliminationPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/DeadCodeEliminationPhase.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/DeadCodeEliminationPhase.java Wed Jun 08 13:35:43 2011 +0200 @@ -53,7 +53,7 @@ new PhiSimplifier(graph); - if (C1XOptions.TraceDeadCodeElimination) { + if (GraalOptions.TraceDeadCodeElimination) { System.out.printf("dead code elimination finished\n"); } } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java Wed Jun 08 13:35:43 2011 +0200 @@ -51,18 +51,18 @@ public final class GraphBuilderPhase extends Phase { /** - * The minimum value to which {@link C1XOptions#TraceBytecodeParserLevel} must be set to trace + * The minimum value to which {@link GraalOptions#TraceBytecodeParserLevel} must be set to trace * the bytecode instructions as they are parsed. */ public static final int TRACELEVEL_INSTRUCTIONS = 1; /** - * The minimum value to which {@link C1XOptions#TraceBytecodeParserLevel} must be set to trace + * The minimum value to which {@link GraalOptions#TraceBytecodeParserLevel} must be set to trace * the frame state before each bytecode instruction as it is parsed. */ public static final int TRACELEVEL_STATE = 2; - private final C1XCompilation compilation; + private final GraalCompilation compilation; private CompilerGraph graph; private final CiStatistics stats; @@ -108,13 +108,13 @@ * @param ir the IR to build the graph into * @param graph */ - public GraphBuilderPhase(C1XCompilation compilation, RiMethod method, boolean createUnwind) { + public GraphBuilderPhase(GraalCompilation compilation, RiMethod method, boolean createUnwind) { this.compilation = compilation; this.runtime = compilation.runtime; this.method = method; this.stats = compilation.stats; - this.log = C1XOptions.TraceBytecodeParserLevel > 0 ? new LogStream(TTY.out()) : null; + this.log = GraalOptions.TraceBytecodeParserLevel > 0 ? new LogStream(TTY.out()) : null; this.stream = new BytecodeStream(method.code()); this.constantPool = runtime.getConstantPool(method); @@ -292,7 +292,7 @@ ((StateSplit) first).setStateBefore(duplicate); } } else { - if (!C1XOptions.AssumeVerifiedBytecode && !existingState.isCompatibleWith(newState)) { + if (!GraalOptions.AssumeVerifiedBytecode && !existingState.isCompatibleWith(newState)) { // stacks or locks do not match--bytecodes would not verify TTY.println(existingState.toString()); TTY.println(newState.duplicate(0).toString()); @@ -847,7 +847,7 @@ private void genInvokeStatic(RiMethod target, int cpi, RiConstantPool constantPool) { RiType holder = target.holder(); boolean isInitialized = target.isResolved() && holder.isInitialized(); - if (!isInitialized && C1XOptions.ResolveClassBeforeStaticInvoke) { + if (!isInitialized && GraalOptions.ResolveClassBeforeStaticInvoke) { // Re-use the same resolution code as for accessing a static field. Even though // the result of resolution is not used by the invocation (only the side effect // of initialization is required), it can be commoned with static field accesses. @@ -967,7 +967,7 @@ if (needsCheck) { // append a call to the finalizer registration append(new RegisterFinalizer(frameState.loadLocal(0), frameState.create(bci()), graph)); - C1XMetrics.InlinedFinalizerChecks++; + GraalMetrics.InlinedFinalizerChecks++; } } @@ -1082,7 +1082,7 @@ lastInstr.setNext(x); lastInstr = x; - if (++stats.nodeCount >= C1XOptions.MaximumInstructionCount) { + if (++stats.nodeCount >= GraalOptions.MaximumInstructionCount) { // bailout if we've exceeded the maximum inlining size throw new CiBailout("Method and/or inlining is too large"); } @@ -1273,7 +1273,7 @@ } private void traceState() { - if (C1XOptions.TraceBytecodeParserLevel >= TRACELEVEL_STATE && !TTY.isSuppressed()) { + if (GraalOptions.TraceBytecodeParserLevel >= TRACELEVEL_STATE && !TTY.isSuppressed()) { log.println(String.format("| state [nr locals = %d, stack depth = %d, method = %s]", frameState.localsSize(), frameState.stackSize(), method)); for (int i = 0; i < frameState.localsSize(); ++i) { Value value = frameState.localAt(i); @@ -1504,7 +1504,7 @@ } private void traceInstruction(int bci, int opcode, boolean blockStart) { - if (C1XOptions.TraceBytecodeParserLevel >= TRACELEVEL_INSTRUCTIONS && !TTY.isSuppressed()) { + if (GraalOptions.TraceBytecodeParserLevel >= TRACELEVEL_INSTRUCTIONS && !TTY.isSuppressed()) { StringBuilder sb = new StringBuilder(40); sb.append(blockStart ? '+' : '|'); if (bci < 10) { diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Wed Jun 08 13:35:43 2011 +0200 @@ -36,14 +36,14 @@ public class InliningPhase extends Phase { - private final C1XCompilation compilation; + private final GraalCompilation compilation; private final IR ir; private final Queue invokes = new ArrayDeque(); private final Queue methods = new ArrayDeque(); private int inliningSize; - public InliningPhase(C1XCompilation compilation, IR ir) { + public InliningPhase(GraalCompilation compilation, IR ir) { this.compilation = compilation; this.ir = ir; } @@ -57,7 +57,7 @@ @Override protected void run(Graph graph) { inliningSize = compilation.method.code().length; - int iterations = C1XOptions.MaximumRecursiveInlineLevel; + int iterations = GraalOptions.MaximumRecursiveInlineLevel; do { for (Node node : graph.getNodes()) { if (node instanceof Invoke) { @@ -74,7 +74,7 @@ RiMethod concrete = invoke.target.holder().uniqueConcreteMethod(invoke.target); if (concrete != null && concrete.isResolved() && !Modifier.isNative(concrete.accessFlags())) { if (checkInliningConditions(concrete)) { - if (C1XOptions.TraceInlining) { + if (GraalOptions.TraceInlining) { System.out.println("registering concrete method assumption..."); } compilation.assumptions.recordConcreteMethod(invoke.target, concrete); @@ -82,7 +82,7 @@ } } } - if (inliningSize > C1XOptions.MaximumInstructionCount) { + if (inliningSize > GraalOptions.MaximumInstructionCount) { break; } } @@ -102,8 +102,8 @@ dce.apply(graph); ir.verifyAndPrint("After inlining iteration"); - if (inliningSize > C1XOptions.MaximumInstructionCount) { - if (C1XOptions.TraceInlining) { + if (inliningSize > GraalOptions.MaximumInstructionCount) { + if (GraalOptions.TraceInlining) { System.out.println("inlining stopped: MaximumInstructionCount reached"); } break; @@ -114,7 +114,7 @@ private boolean checkInliningConditions(Invoke invoke) { String name = invoke.id() + ": " + CiUtil.format("%H.%n(%p):%r", invoke.target, false); if (invoke.predecessors().size() == 0) { - if (C1XOptions.TraceInlining) { + if (GraalOptions.TraceInlining) { System.out.println("not inlining " + name + " because the invoke is dead code"); } return false; @@ -124,17 +124,17 @@ private boolean checkInliningConditions(RiMethod method) { String name = null; - if (C1XOptions.TraceInlining) { + if (GraalOptions.TraceInlining) { name = CiUtil.format("%H.%n(%p):%r", method, false) + " (" + method.code().length + " bytes)"; } - if (method.code().length > C1XOptions.MaximumInlineSize) { - if (C1XOptions.TraceInlining) { + if (method.code().length > GraalOptions.MaximumInlineSize) { + if (GraalOptions.TraceInlining) { System.out.println("not inlining " + name + " because of code size"); } return false; } if (!method.holder().isInitialized()) { - if (C1XOptions.TraceInlining) { + if (GraalOptions.TraceInlining) { System.out.println("not inlining " + name + " because of non-initialized class"); } return false; @@ -147,7 +147,7 @@ FrameState stateAfter = invoke.stateAfter(); Instruction exceptionEdge = invoke.exceptionEdge(); - if (C1XOptions.TraceInlining) { + if (GraalOptions.TraceInlining) { System.out.printf("Building graph for %s, locals: %d, stack: %d\n", name, method.maxLocals(), method.maxStackSize()); } @@ -193,7 +193,7 @@ } } - if (C1XOptions.TraceInlining) { + if (GraalOptions.TraceInlining) { ir.printGraph("Subgraph " + CiUtil.format("%H.%n(%p):%r", method, false), graph); System.out.println("inlining " + name + ": " + frameStates.size() + " frame states, " + nodes.size() + " nodes"); } @@ -275,7 +275,7 @@ } } - if (C1XOptions.TraceInlining) { + if (GraalOptions.TraceInlining) { ir.verifyAndPrint("After inlining " + CiUtil.format("%H.%n(%p):%r", method, false)); } } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/Backend.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/Backend.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/Backend.java Wed Jun 08 13:35:43 2011 +0200 @@ -34,22 +34,22 @@ import com.sun.cri.xir.*; /** - * The {@code Backend} class represents a compiler backend for C1X. + * The {@code Backend} class represents a compiler backend for Graal. * * @author Ben L. Titzer */ public abstract class Backend { - public final C1XCompiler compiler; + public final GraalCompiler compiler; - protected Backend(C1XCompiler compiler) { + protected Backend(GraalCompiler compiler) { this.compiler = compiler; } - public static Backend create(CiArchitecture arch, C1XCompiler compiler) { + public static Backend create(CiArchitecture arch, GraalCompiler compiler) { String className = arch.getClass().getName().replace("com.oracle.max.asm", "com.oracle.max.graal.compiler") + "Backend"; try { Class c = Class.forName(className); - Constructor cons = c.getDeclaredConstructor(C1XCompiler.class); + Constructor cons = c.getDeclaredConstructor(GraalCompiler.class); return (Backend) cons.newInstance(compiler); } catch (Exception e) { throw new Error("Could not instantiate " + className, e); @@ -57,8 +57,8 @@ } public abstract FrameMap newFrameMap(RiMethod method, int numberOfLocks); - public abstract LIRGenerator newLIRGenerator(C1XCompilation compilation); - public abstract LIRAssembler newLIRAssembler(C1XCompilation compilation); + public abstract LIRGenerator newLIRGenerator(GraalCompilation compilation); + public abstract LIRAssembler newLIRAssembler(GraalCompilation compilation); public abstract AbstractAssembler newAssembler(RiRegisterConfig registerConfig); public abstract GlobalStubEmitter newGlobalStubEmitter(); public abstract CiXirAssembler newXirAssembler(); diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Backend.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Backend.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Backend.java Wed Jun 08 13:35:43 2011 +0200 @@ -22,7 +22,7 @@ */ package com.oracle.max.graal.compiler.target.amd64; -import static com.oracle.max.graal.compiler.C1XCompilation.*; +import static com.oracle.max.graal.compiler.GraalCompilation.*; import com.oracle.max.asm.*; import com.oracle.max.asm.target.amd64.*; @@ -41,7 +41,7 @@ */ public class AMD64Backend extends Backend { - public AMD64Backend(C1XCompiler compiler) { + public AMD64Backend(GraalCompiler compiler) { super(compiler); } /** @@ -50,7 +50,7 @@ * @return an appropriate LIR generator instance */ @Override - public LIRGenerator newLIRGenerator(C1XCompilation compilation) { + public LIRGenerator newLIRGenerator(GraalCompilation compilation) { return new AMD64LIRGenerator(compilation); } @@ -60,7 +60,7 @@ * @return an appropriate LIR assembler instance */ @Override - public LIRAssembler newLIRAssembler(C1XCompilation compilation) { + public LIRAssembler newLIRAssembler(GraalCompilation compilation) { return new AMD64LIRAssembler(compilation); } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64GlobalStubEmitter.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64GlobalStubEmitter.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64GlobalStubEmitter.java Wed Jun 08 13:35:43 2011 +0200 @@ -59,12 +59,12 @@ private int registerRestoreEpilogueOffset; private RiRuntime runtime; - private C1XCompiler compiler; + private GraalCompiler compiler; private CiRegister[] registersSaved; private boolean savedAllRegisters; - public AMD64GlobalStubEmitter(C1XCompiler compiler) { + public AMD64GlobalStubEmitter(GraalCompiler compiler) { this.compiler = compiler; this.target = compiler.target; this.runtime = compiler.runtime; @@ -156,7 +156,7 @@ } public GlobalStub emit(XirTemplate template, RiRuntime runtime) { - C1XCompilation compilation = new C1XCompilation(compiler, null, -1, null); + GraalCompilation compilation = new GraalCompilation(compiler, null, -1, null); try { return emit(template, compilation); } finally { @@ -164,7 +164,7 @@ } } - public GlobalStub emit(XirTemplate template, C1XCompilation compilation) { + public GlobalStub emit(XirTemplate template, GraalCompilation compilation) { reset(template.resultOperand.kind, getArgumentKinds(template)); compilation.initFrameMap(0); compilation.frameMap().setFrameSize(frameSize()); diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRAssembler.java Wed Jun 08 13:35:43 2011 +0200 @@ -64,7 +64,7 @@ final int wordSize; final CiRegister rscratch1; - public AMD64LIRAssembler(C1XCompilation compilation) { + public AMD64LIRAssembler(GraalCompilation compilation) { super(compilation); masm = (AMD64MacroAssembler) asm; target = compilation.target; @@ -148,7 +148,7 @@ @Override public void emitTraps() { - for (int i = 0; i < C1XOptions.MethodEndBreakpointGuards; ++i) { + for (int i = 0; i < GraalOptions.MethodEndBreakpointGuards; ++i) { masm.int3(); } } @@ -411,7 +411,7 @@ protected void emitReadPrefetch(CiValue src) { CiAddress addr = (CiAddress) src; // Checkstyle: off - switch (C1XOptions.ReadPrefetchInstr) { + switch (GraalOptions.ReadPrefetchInstr) { case 0 : masm.prefetchnta(addr); break; case 1 : masm.prefetcht0(addr); break; case 2 : masm.prefetcht2(addr); break; @@ -1092,7 +1092,7 @@ Label continuation = new Label(); - if (C1XOptions.GenSpecialDivChecks) { + if (GraalOptions.GenSpecialDivChecks) { // check for special case of Integer.MIN_VALUE / -1 Label normalCase = new Label(); masm.cmpl(AMD64.rax, Integer.MIN_VALUE); @@ -1140,7 +1140,7 @@ Label continuation = new Label(); - if (C1XOptions.GenSpecialDivChecks) { + if (GraalOptions.GenSpecialDivChecks) { // check for special case of Long.MIN_VALUE / -1 Label normalCase = new Label(); masm.movq(AMD64.rdx, java.lang.Long.MIN_VALUE); @@ -1344,7 +1344,7 @@ @Override protected void emitCallAlignment(LIROpcode code) { - if (C1XOptions.AlignCallsForPatching) { + if (GraalOptions.AlignCallsForPatching) { // make sure that the displacement word of the call ends up word aligned int offset = masm.codeBuffer.position(); offset += compilation.target.arch.machineCodeCallDisplacementOffset; @@ -1541,7 +1541,7 @@ @Override protected void emitNullCheck(CiValue src, LIRDebugInfo info) { assert src.isRegister(); - if (C1XOptions.NullCheckUniquePc) { + if (GraalOptions.NullCheckUniquePc) { masm.nop(); } tasm.recordImplicitException(codePos(), info); @@ -1610,13 +1610,13 @@ @Override protected void emitSlowPath(SlowPath sp) { int start = -1; - if (C1XOptions.TraceAssembler) { + if (GraalOptions.TraceAssembler) { TTY.println("Emitting slow path for XIR instruction " + sp.instruction.snippet.template.name); start = masm.codeBuffer.position(); } emitXirInstructions(sp.instruction, sp.instruction.snippet.template.slowPath, sp.labels, sp.instruction.getOperands(), sp.marks); masm.nop(); - if (C1XOptions.TraceAssembler) { + if (GraalOptions.TraceAssembler) { TTY.println("From " + start + " to " + masm.codeBuffer.position()); } } @@ -1950,7 +1950,7 @@ int lastFramePage = frameSize / target.pageSize; // emit multiple stack bangs for methods with frames larger than a page for (int i = 0; i <= lastFramePage; i++) { - int offset = (i + C1XOptions.StackShadowPages) * target.pageSize; + int offset = (i + GraalOptions.StackShadowPages) * target.pageSize; // Deduct 'frameSize' to handle frames larger than the shadow bangStackWithOffset(offset - frameSize); } @@ -1959,7 +1959,7 @@ case PushFrame: { int frameSize = initialFrameSizeInBytes(); masm.decrementq(AMD64.rsp, frameSize); // does not emit code for frameSize == 0 - if (C1XOptions.ZapStackOnMethodEntry) { + if (GraalOptions.ZapStackOnMethodEntry) { final int intSize = 4; for (int i = 0; i < frameSize / intSize; ++i) { masm.movl(new CiAddress(CiKind.Int, AMD64.rsp.asValue(), i * intSize), 0xC1C1C1C1); @@ -2100,7 +2100,7 @@ } // Clear out parameters - if (C1XOptions.GenAssertionCode) { + if (GraalOptions.GenAssertionCode) { for (int i = 0; i < args.length; i++) { masm.movptr(new CiAddress(CiKind.Word, AMD64.RSP, stub.argOffsets[i]), 0); } @@ -2184,7 +2184,7 @@ } protected void stop(String msg) { - if (C1XOptions.GenAssertionCode) { + if (GraalOptions.GenAssertionCode) { // TODO: pass a pointer to the message directCall(CiRuntimeCall.Debug, null); masm.hlt(); diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java Wed Jun 08 13:35:43 2011 +0200 @@ -60,7 +60,7 @@ protected static final CiValue ILLEGAL = CiValue.IllegalValue; - public AMD64LIRGenerator(C1XCompilation compilation) { + public AMD64LIRGenerator(GraalCompilation compilation) { super(compilation); } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/Util.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/Util.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/Util.java Wed Jun 08 13:35:43 2011 +0200 @@ -367,7 +367,7 @@ /** * Determines if the kinds of two given IR nodes are equal at the {@linkplain #archKind(CiKind) architecture} - * level in the context of the {@linkplain C1XCompilation#compilation()} compilation. + * level in the context of the {@linkplain GraalCompilation#compilation()} compilation. */ public static boolean archKindsEqual(Value i, Value other) { return archKindsEqual(i.kind, other.kind); @@ -375,20 +375,20 @@ /** * Determines if two given kinds are equal at the {@linkplain #archKind(CiKind) architecture} level - * in the context of the {@linkplain C1XCompilation#compilation()} compilation. + * in the context of the {@linkplain GraalCompilation#compilation()} compilation. */ public static boolean archKindsEqual(CiKind k1, CiKind k2) { - C1XCompilation compilation = C1XCompilation.compilation(); + GraalCompilation compilation = GraalCompilation.compilation(); assert compilation != null : "missing compilation context"; return compilation.archKindsEqual(k1, k2); } /** - * Translates a given kind to a {@linkplain C1XCompilation#archKind(CiKind) canonical architecture} - * kind in the context of the {@linkplain C1XCompilation#compilation() current} compilation. + * Translates a given kind to a {@linkplain GraalCompilation#archKind(CiKind) canonical architecture} + * kind in the context of the {@linkplain GraalCompilation#compilation() current} compilation. */ public static CiKind archKind(CiKind kind) { - C1XCompilation compilation = C1XCompilation.compilation(); + GraalCompilation compilation = GraalCompilation.compilation(); assert compilation != null : "missing compilation context"; return compilation.archKind(kind); } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameState.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameState.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/FrameState.java Wed Jun 08 13:35:43 2011 +0200 @@ -97,8 +97,8 @@ this.localsSize = localsSize; this.stackSize = stackSize; this.locksSize = locksSize; - C1XMetrics.FrameStatesCreated++; - C1XMetrics.FrameStateValuesCreated += localsSize + stackSize + locksSize; + GraalMetrics.FrameStatesCreated++; + GraalMetrics.FrameStateValuesCreated += localsSize + stackSize + locksSize; } FrameState(RiMethod method, int bci, Value[] locals, Value[] stack, int stackSize, ArrayList locks, Graph graph) { diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java Wed Jun 08 13:35:43 2011 +0200 @@ -115,7 +115,7 @@ public boolean isDeleted() { return id == DeletedID; } - + public void forceDelete() { for (Node n : usages) { n.inputs.silentRemove(this); diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeArray.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeArray.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeArray.java Wed Jun 08 13:35:43 2011 +0200 @@ -44,7 +44,7 @@ private Node self() { return this.node; } - + Node silentSet(int index, Node node) { Node result = nodes[index]; nodes[index] = node; @@ -113,7 +113,7 @@ } return false; } - + public int remove(Node n) { return replace(n, null); } @@ -128,7 +128,7 @@ } return result; } - + int silentRemove(Node n) { return silentReplace(n, null); } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/Compiler.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/Compiler.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/Compiler.java Wed Jun 08 13:35:43 2011 +0200 @@ -28,6 +28,6 @@ VMEntries getVMEntries(); VMExits getVMExits(); - C1XCompiler getCompiler(); + GraalCompiler getCompiler(); } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/CompilerImpl.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/CompilerImpl.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/CompilerImpl.java Wed Jun 08 13:35:43 2011 +0200 @@ -35,7 +35,7 @@ import com.sun.cri.xir.*; /** - * Singleton class holding the instance of the C1XCompiler. + * Singleton class holding the instance of the GraalCompiler. */ public final class CompilerImpl implements Compiler, Remote { @@ -51,11 +51,11 @@ throw new IllegalStateException("Compiler already initialized"); } - String remote = System.getProperty("c1x.remote"); + String remote = System.getProperty("graal.remote"); if (remote != null) { // remote compilation (will not create a local Compiler) try { - System.out.println("C1X compiler started in client/server mode, server: " + remote); + System.out.println("Graal compiler started in client/server mode, server: " + remote); Socket socket = new Socket(remote, 1199); ReplacingStreams streams = new ReplacingStreams(socket.getOutputStream(), socket.getInputStream()); streams.getInvocation().sendResult(new VMEntriesNative()); @@ -87,11 +87,11 @@ @Override public void run() { VMExitsNative.compileMethods = false; - if (C1XOptions.PrintMetrics) { - C1XMetrics.print(); + if (GraalOptions.PrintMetrics) { + GraalMetrics.print(); } - if (C1XOptions.PrintTimers) { - C1XTimers.print(); + if (GraalOptions.PrintTimers) { + GraalTimers.print(); } if (PrintGCStats) { printGCStats(); @@ -121,7 +121,7 @@ private final VMEntries vmEntries; private final VMExits vmExits; - private C1XCompiler compiler; + private GraalCompiler compiler; private final HotSpotRuntime runtime; private final CiTarget target; @@ -152,15 +152,15 @@ vmEntries = entries; vmExits = exits; - // initialize compiler and C1XOptions + // initialize compiler and GraalOptions HotSpotVMConfig config = vmEntries.getConfiguration(); config.check(); - // these options are important - c1x4hotspot will not generate correct code without them - C1XOptions.GenSpecialDivChecks = true; - C1XOptions.NullCheckUniquePc = true; - C1XOptions.InvokeSnippetAfterArguments = true; - C1XOptions.StackShadowPages = config.stackShadowPages; + // these options are important - graal will not generate correct code without them + GraalOptions.GenSpecialDivChecks = true; + GraalOptions.NullCheckUniquePc = true; + GraalOptions.InvokeSnippetAfterArguments = true; + GraalOptions.StackShadowPages = config.stackShadowPages; runtime = new HotSpotRuntime(config, this); registerConfig = runtime.globalStubRegConfig; @@ -179,9 +179,9 @@ } @Override - public C1XCompiler getCompiler() { + public GraalCompiler getCompiler() { if (compiler == null) { - compiler = new C1XCompiler(runtime, target, generator, registerConfig); + compiler = new GraalCompiler(runtime, target, generator, registerConfig); } return compiler; } diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotField.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotField.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotField.java Wed Jun 08 13:35:43 2011 +0200 @@ -60,10 +60,10 @@ @Override public CiConstant constantValue(CiConstant receiver) { if (receiver == null) { - if (constant == null && holder.isResolved() && holder.isSubtypeOf(compiler.getVMEntries().getType(C1XOptions.class))) { + if (constant == null && holder.isResolved() && holder.isSubtypeOf(compiler.getVMEntries().getType(GraalOptions.class))) { Field f; try { - f = C1XOptions.class.getField(name); + f = GraalOptions.class.getField(name); } catch (SecurityException e1) { return null; } catch (NoSuchFieldException e1) { diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotOptions.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotOptions.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotOptions.java Wed Jun 08 13:35:43 2011 +0200 @@ -31,9 +31,9 @@ public class HotSpotOptions { public static void setDefaultOptions() { - C1XOptions.CommentedAssembly = false; - C1XOptions.MethodEndBreakpointGuards = 2; - C1XOptions.ResolveClassBeforeStaticInvoke = false; + GraalOptions.CommentedAssembly = false; + GraalOptions.MethodEndBreakpointGuards = 2; + GraalOptions.ResolveClassBeforeStaticInvoke = false; } public static boolean setOption(String option) { @@ -60,7 +60,7 @@ Field f; try { - f = C1XOptions.class.getField(fieldName); + f = GraalOptions.class.getField(fieldName); if (value == null) { if (f.getType() == Float.TYPE) { diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotProxy.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotProxy.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotProxy.java Wed Jun 08 13:35:43 2011 +0200 @@ -31,7 +31,7 @@ } private enum CompilerObjectType { - // this enum needs to have the same values as the one in c1x_Compiler.hpp + // this enum needs to have the same values as the one in graal_Compiler.hpp STUB(0x100000000000000L), METHOD(0x200000000000000L), CLASS(0x300000000000000L), diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotRegisterConfig.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotRegisterConfig.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotRegisterConfig.java Wed Jun 08 13:35:43 2011 +0200 @@ -35,7 +35,7 @@ public class HotSpotRegisterConfig implements RiRegisterConfig { - // be careful - the contents of this array are duplicated in c1x_CodeInstaller.cpp + // be careful - the contents of this array are duplicated in graal_CodeInstaller.cpp private final CiRegister[] allocatable = { rax, rbx, rcx, rdx, rsi, rdi, r8, r9, /* r10, */r11, r12, r13, r14, /*r15*/ xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotVMConfig.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotVMConfig.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotVMConfig.java Wed Jun 08 13:35:43 2011 +0200 @@ -25,7 +25,7 @@ import com.sun.cri.ci.*; /** - * Used to communicate configuration details, runtime offsets, etc. to c1x upon compileMethod. + * Used to communicate configuration details, runtime offsets, etc. to graal upon compileMethod. */ public final class HotSpotVMConfig extends CompilerObject { diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotXirGenerator.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotXirGenerator.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotXirGenerator.java Wed Jun 08 13:35:43 2011 +0200 @@ -40,7 +40,7 @@ public class HotSpotXirGenerator implements RiXirGenerator { - // this needs to correspond to c1x_CodeInstaller.hpp + // this needs to correspond to graal_CodeInstaller.hpp // @formatter:off private static final Integer MARK_VERIFIED_ENTRY = 0x0001; private static final Integer MARK_UNVERIFIED_ENTRY = 0x0002; diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/VMExitsNative.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/VMExitsNative.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/VMExitsNative.java Wed Jun 08 13:35:43 2011 +0200 @@ -85,7 +85,7 @@ if (result.bailout() != null) { Throwable cause = result.bailout().getCause(); - if (!C1XOptions.QuietBailout) { + if (!GraalOptions.QuietBailout) { StringWriter out = new StringWriter(); result.bailout().printStackTrace(new PrintWriter(out)); TTY.println("Bailout:\n" + out.toString()); diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/logging/CountingProxy.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/logging/CountingProxy.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/logging/CountingProxy.java Wed Jun 08 13:35:43 2011 +0200 @@ -33,7 +33,7 @@ */ public class CountingProxy implements InvocationHandler { - public static final boolean ENABLED = Boolean.valueOf(System.getProperty("c1x.countcalls")); + public static final boolean ENABLED = Boolean.valueOf(System.getProperty("graal.countcalls")); private T delegate; diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/logging/Logger.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/logging/Logger.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/logging/Logger.java Wed Jun 08 13:35:43 2011 +0200 @@ -31,7 +31,7 @@ */ public class Logger { - public static final boolean ENABLED = Boolean.valueOf(System.getProperty("c1x.debug")); + public static final boolean ENABLED = Boolean.valueOf(System.getProperty("graal.debug")); private static final int SPACING = 4; private static Deque openStack = new LinkedList(); private static boolean open = false; @@ -41,7 +41,7 @@ static { PrintStream ps = null; - String filename = System.getProperty("c1x.info_file"); + String filename = System.getProperty("graal.info_file"); if (filename != null && !"".equals(filename)) { try { ps = new PrintStream(new FileOutputStream(filename)); diff -r 0e10a9bce78e -r 224412c24426 graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/server/package-info.java --- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/server/package-info.java Wed Jun 08 13:19:56 2011 +0200 +++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/server/package-info.java Wed Jun 08 13:35:43 2011 +0200 @@ -21,9 +21,6 @@ * questions. */ /** - * Implementation of a compilation server socket that delegates incoming requests to C1X. - * - * @author Lukas Stadler - * @author Thomas Wuerthinger + * Implementation of a compilation server socket that delegates incoming requests to Graal. */ package com.oracle.max.graal.runtime.server;