Mercurial > hg > graal-jvmci-8
changeset 19584:f7c6b33489c9
Merge
line wrap: on
line diff
--- a/.hgtags Wed Feb 18 10:37:08 2015 -0800 +++ b/.hgtags Mon Feb 23 16:23:23 2015 -0800 @@ -525,3 +525,4 @@ ae5b662550836e851c39e4fbb5c80517fc62488f graal-0.5 3b60f720b955c466d913abb0113af9b38962950b graal-0.6 1b0ef9634252c422b6f9839fc62eebc112545486 gpu-0.1 +9a12234da10cfa6934617274c203672389a1bbdd baseline-0.1
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BailoutException.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BailoutException.java Mon Feb 23 16:23:23 2015 -0800 @@ -48,6 +48,17 @@ /** * Creates a new {@link BailoutException}. * + * + * @param args parameters to the formatter + */ + public BailoutException(Throwable cause, String format, Object... args) { + super(String.format(Locale.ENGLISH, format, args), cause); + this.permanent = true; + } + + /** + * Creates a new {@link BailoutException}. + * * @param permanent specifies whether this exception will occur again if compilation is retried * @param args parameters to the formatter */
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CalleeSaveLayout.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CalleeSaveLayout.java Mon Feb 23 16:23:23 2015 -0800 @@ -64,7 +64,7 @@ /** * Creates a CSA layout. - * + * * @param size size (in bytes) of the CSA. If this is {@code -1}, then the CSA size will be * computed from {@code registers}. * @param slotSize the size (in bytes) of an {@linkplain #registerAt(int) indexable} slot in the @@ -113,7 +113,7 @@ /** * Gets the offset of a given register in the CSA. - * + * * @return the offset (in bytes) of {@code reg} in the CSA * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA */ @@ -123,7 +123,7 @@ /** * Gets the index of a given register in the CSA. - * + * * @return the index of {@code reg} in the CSA * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA */ @@ -136,7 +136,7 @@ /** * Gets the offset of a given register in the CSA. - * + * * @return the offset (in bytes) of {@code reg} in the CSA * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA */ @@ -146,7 +146,7 @@ /** * Determines if the CSA includes a slot for a given register. - * + * * @param reg the register to test * @return true if the CSA contains a slot for {@code reg} */ @@ -156,7 +156,7 @@ /** * Gets the register whose slot in the CSA is at a given index. - * + * * @param index an index of a slot in the CSA * @return the register whose slot in the CSA is at {@code index} or {@code null} if * {@code index} does not denote a slot in the CSA aligned with a register
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java Mon Feb 23 16:23:23 2015 -0800 @@ -78,7 +78,7 @@ /** * Creates a description of the registers and stack locations used by a call. - * + * * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of * the call * @param returnLocation the location for the return value or {@link Value#ILLEGAL} if a void
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DisassemblerProvider.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DisassemblerProvider.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,7 +29,7 @@ /** * Gets a textual disassembly of some given installed code. - * + * * @return a non-zero length string containing a disassembly of {@code code} or null if * {@code code} is {@link InstalledCode#isValid() invalid} or it could not be * disassembled for some other reason
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ForeignCallLinkage.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ForeignCallLinkage.java Mon Feb 23 16:23:23 2015 -0800 @@ -57,7 +57,7 @@ /** * Determines if the foreign call target destroys all registers. - * + * * @return {@code true} if the register allocator must save all live registers around a call to * this target */
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MemoryBarriers.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MemoryBarriers.java Mon Feb 23 16:23:23 2015 -0800 @@ -24,7 +24,7 @@ /** * Constants and intrinsic definition for memory barriers. - * + * * The documentation for each constant is taken from Doug Lea's <a * href="http://gee.cs.oswego.edu/dl/jmm/cookbook.html">The JSR-133 Cookbook for Compiler * Writers</a>. @@ -32,14 +32,14 @@ * The {@code JMM_*} constants capture the memory barriers necessary to implement the Java Memory * Model with respect to volatile field accesses. Their values are explained by this comment from * templateTable_i486.cpp in the HotSpot source code: - * + * * <pre> * Volatile variables demand their effects be made known to all CPU's in * order. Store buffers on most chips allow reads & writes to reorder; the * JMM's ReadAfterWrite.java test fails in -Xint mode without some kind of * memory barrier (i.e., it's not sufficient that the interpreter does not * reorder volatile references, the hardware also must not reorder them). - * + * * According to the new Java Memory Model (JMM): * (1) All volatiles are serialized wrt to each other. * ALSO reads & writes act as acquire & release, so: @@ -50,7 +50,7 @@ * that happen BEFORE the write float down to after the write. It's OK for * non-volatile memory refs that happen after the volatile write to float up * before it. - * + * * We only put in barriers around volatile refs (they are expensive), not * _between_ memory refs (which would require us to track the flavor of the * previous memory refs). Requirements (2) and (3) require some barriers
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterAttributes.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterAttributes.java Mon Feb 23 16:23:23 2015 -0800 @@ -47,7 +47,7 @@ * Creates a map from register {@linkplain Register#number numbers} to register * {@linkplain RegisterAttributes attributes} for a given register configuration and set of * registers. - * + * * @param registerConfig a register configuration * @param registers a set of registers * @return an array whose length is the max register number in {@code registers} plus 1. An
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/SpeculationLog.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/SpeculationLog.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,7 +29,7 @@ /** * Manages a list of unique deoptimization reasons. - * + * */ public abstract class SpeculationLog { private volatile Object lastFailed;
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/BytecodeDisassemblerProvider.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/BytecodeDisassemblerProvider.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ /** * Gets a textual disassembly of the bytecode for a given method. In the absence of bytecode * rewriting, disassembling a method will produce the same result. - * + * * @return a non-zero length string containing a disassembly of {@code method}'s bytecode or * null if {@code method} has no bytecode (i.e., {@code method.getCodeSize() == 0}) */
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ /** * Creates a new exception handler with the specified ranges. - * + * * @param startBCI the start index of the protected range * @param endBCI the end index of the protected range * @param catchBCI the index of the handler @@ -83,7 +83,7 @@ /** * Checks whether this handler catches all exceptions. - * + * * @return {@code true} if this handler catches all exceptions */ public boolean isCatchAll() {
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java Mon Feb 23 16:23:23 2015 -0800 @@ -282,7 +282,7 @@ /** * Checks whether the method has a receiver parameter - i.e., whether it is not static. - * + * * @return whether the method has a receiver parameter */ default boolean hasReceiver() {
--- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Address.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Address.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ /** * Creates an {@link AMD64Address} with given base register, no scaling and no displacement. - * + * * @param base the base register */ public AMD64Address(Register base) { @@ -48,7 +48,7 @@ /** * Creates an {@link AMD64Address} with given base register, no scaling and a given * displacement. - * + * * @param base the base register * @param displacement the displacement */ @@ -59,7 +59,7 @@ /** * Creates an {@link AMD64Address} with given base and index registers, scaling and * displacement. This is the most general constructor. - * + * * @param base the base register * @param index the index register * @param scale the scaling factor
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeLookupSwitch.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeLookupSwitch.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ /** * Constructor for a {@link BytecodeStream}. - * + * * @param stream the {@code BytecodeStream} containing the switch instruction * @param bci the index in the stream of the switch instruction */
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeStream.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeStream.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ /** * Creates a new {@code BytecodeStream} for the specified bytecode. - * + * * @param code the array of bytes that contains the bytecode */ public BytecodeStream(byte[] code) { @@ -54,7 +54,7 @@ /** * Gets the next bytecode index (no side-effects). - * + * * @return the next bytecode index */ public int nextBCI() { @@ -63,7 +63,7 @@ /** * Gets the current bytecode index. - * + * * @return the current bytecode index */ public int currentBCI() { @@ -72,7 +72,7 @@ /** * Gets the bytecode index of the end of the code. - * + * * @return the index of the end of the code */ public int endBCI() { @@ -82,7 +82,7 @@ /** * Gets the current opcode. This method will never return the {@link Bytecodes#WIDE WIDE} * opcode, but will instead return the opcode that is modified by the {@code WIDE} opcode. - * + * * @return the current opcode; {@link Bytecodes#END} if at or beyond the end of the code */ public int currentBC() { @@ -96,7 +96,7 @@ /** * Reads the index of a local variable for one of the load or store instructions. The WIDE * modifier is handled internally. - * + * * @return the index of the local variable */ public int readLocalIndex() { @@ -109,7 +109,7 @@ /** * Read the delta for an {@link Bytecodes#IINC} bytecode. - * + * * @return the delta for the {@code IINC} */ public int readIncrement() { @@ -122,7 +122,7 @@ /** * Read the destination of a {@link Bytecodes#GOTO} or {@code IF} instructions. - * + * * @return the destination bytecode index */ public int readBranchDest() { @@ -136,7 +136,7 @@ /** * Read a signed 4-byte integer from the bytecode stream at the specified bytecode index. - * + * * @param bci the bytecode index * @return the integer value */ @@ -147,7 +147,7 @@ /** * Reads an unsigned, 1-byte value from the bytecode stream at the specified bytecode index. - * + * * @param bci the bytecode index * @return the byte */ @@ -157,7 +157,7 @@ /** * Reads a constant pool index for the current instruction. - * + * * @return the constant pool index */ public char readCPI() { @@ -169,7 +169,7 @@ /** * Reads a constant pool index for an invokedynamic instruction. - * + * * @return the constant pool index */ public int readCPI4() { @@ -179,7 +179,7 @@ /** * Reads a signed, 1-byte value for the current instruction (e.g. BIPUSH). - * + * * @return the byte */ public byte readByte() { @@ -188,7 +188,7 @@ /** * Reads a signed, 2-byte short for the current instruction (e.g. SIPUSH). - * + * * @return the short value */ public short readShort() { @@ -199,7 +199,7 @@ * Sets the bytecode index to the specified value. If {@code bci} is beyond the end of the * array, {@link #currentBC} will return {@link Bytecodes#END} and other methods may throw * {@link ArrayIndexOutOfBoundsException}. - * + * * @param bci the new bytecode index */ public void setBCI(int bci) {
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeSwitch.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeSwitch.java Mon Feb 23 16:23:23 2015 -0800 @@ -44,7 +44,7 @@ /** * Constructor for a {@link BytecodeStream}. - * + * * @param stream the {@code BytecodeStream} containing the switch instruction * @param bci the index in the stream of the switch instruction */ @@ -56,7 +56,7 @@ /** * Gets the current bytecode index. - * + * * @return the current bytecode index */ public int bci() { @@ -65,7 +65,7 @@ /** * Gets the index of the instruction denoted by the {@code i}'th switch target. - * + * * @param i index of the switch target * @return the index of the instruction denoted by the {@code i}'th switch target */ @@ -75,7 +75,7 @@ /** * Gets the index of the instruction for the default switch target. - * + * * @return the index of the instruction for the default switch target */ public int defaultTarget() { @@ -84,7 +84,7 @@ /** * Gets the offset from the start of the switch instruction to the default switch target. - * + * * @return the offset to the default switch target */ public int defaultOffset() { @@ -93,7 +93,7 @@ /** * Gets the key at {@code i}'th switch target index. - * + * * @param i the switch target index * @return the key at {@code i}'th switch target index */ @@ -101,7 +101,7 @@ /** * Gets the offset from the start of the switch instruction for the {@code i}'th switch target. - * + * * @param i the switch target index * @return the offset to the {@code i}'th switch target */ @@ -109,14 +109,14 @@ /** * Gets the number of switch targets. - * + * * @return the number of switch targets */ public abstract int numberOfCases(); /** * Gets the total size in bytes of the switch instruction. - * + * * @return the total size in bytes of the switch instruction */ public abstract int size();
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeTableSwitch.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeTableSwitch.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ /** * Constructor for a {@link BytecodeStream}. - * + * * @param stream the {@code BytecodeStream} containing the switch instruction * @param bci the index in the stream of the switch instruction */ @@ -44,7 +44,7 @@ /** * Gets the low key of the table switch. - * + * * @return the low key */ public int lowKey() { @@ -53,7 +53,7 @@ /** * Gets the high key of the table switch. - * + * * @return the high key */ public int highKey() {
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytes.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytes.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,7 +29,7 @@ /** * Gets a signed 1-byte value. - * + * * @param data the array containing the data * @param bci the start index of the value to retrieve * @return the signed 1-byte value at index {@code bci} in array {@code data} @@ -40,7 +40,7 @@ /** * Gets a signed 2-byte big-endian value. - * + * * @param data the array containing the data * @param bci the start index of the value to retrieve * @return the signed 2-byte, big-endian, value at index {@code bci} in array {@code data} @@ -51,7 +51,7 @@ /** * Gets an unsigned 1-byte value. - * + * * @param data the array containing the data * @param bci the start index of the value to retrieve * @return the unsigned 1-byte value at index {@code bci} in array {@code data} @@ -62,7 +62,7 @@ /** * Gets an unsigned 2-byte big-endian value. - * + * * @param data the array containing the data * @param bci the start index of the value to retrieve * @return the unsigned 2-byte, big-endian, value at index {@code bci} in array {@code data} @@ -73,7 +73,7 @@ /** * Gets a signed 4-byte big-endian value. - * + * * @param data the array containing the data * @param bci the start index of the value to retrieve * @return the signed 4-byte, big-endian, value at index {@code bci} in array {@code data} @@ -84,7 +84,7 @@ /** * Gets either a signed 2-byte or a signed 4-byte big-endian value. - * + * * @param data the array containing the data * @param bci the start index of the value to retrieve * @param fourByte if true, this method will return a 4-byte value
--- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Mon Feb 23 16:23:23 2015 -0800 @@ -81,7 +81,7 @@ private static final RegisterValue RCX_I = AMD64.rcx.asValue(LIRKind.value(Kind.Int)); - private class AMD64SpillMoveFactory implements LIR.SpillMoveFactory { + private class AMD64SpillMoveFactory implements LIRGeneratorTool.SpillMoveFactory { @Override public LIRInstruction createMove(AllocatableValue result, Value input) { @@ -91,7 +91,10 @@ public AMD64LIRGenerator(LIRKindTool lirKindTool, Providers providers, CallingConvention cc, LIRGenerationResult lirGenRes) { super(lirKindTool, providers, cc, lirGenRes); - lirGenRes.getLIR().setSpillMoveFactory(new AMD64SpillMoveFactory()); + } + + public SpillMoveFactory getSpillMoveFactory() { + return new AMD64SpillMoveFactory(); } @Override
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/FieldIntrospection.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/FieldIntrospection.java Mon Feb 23 16:23:23 2015 -0800 @@ -22,24 +22,20 @@ */ package com.oracle.graal.compiler.common; -import java.util.concurrent.*; - -public abstract class FieldIntrospection extends UnsafeAccess { +public abstract class FieldIntrospection<T> extends UnsafeAccess { - protected static final ConcurrentHashMap<Class<?>, FieldIntrospection> allClasses = new ConcurrentHashMap<>(); - - private final Class<?> clazz; + private final Class<T> clazz; /** * The set of fields in {@link #clazz} that do long belong to a more specific category. */ protected Fields data; - public FieldIntrospection(Class<?> clazz) { + public FieldIntrospection(Class<T> clazz) { this.clazz = clazz; } - public Class<?> getClazz() { + public Class<T> getClazz() { return clazz; }
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java Mon Feb 23 16:23:23 2015 -0800 @@ -201,7 +201,7 @@ public static final OptionValue<Boolean> PrintBailout = new OptionValue<>(false); @Option(help = "", type = OptionType.Debug) - public static final OptionValue<Boolean> TraceEscapeAnalysis = new OptionValue<>(false); + public static final StableOptionValue<Boolean> TraceEscapeAnalysis = new StableOptionValue<>(false); @Option(help = "", type = OptionType.Debug) public static final OptionValue<Boolean> ExitVMOnBailout = new OptionValue<>(false); @@ -334,6 +334,9 @@ @Option(help = "Max number of loop explosions per method.", type = OptionType.Debug) public static final OptionValue<Integer> MaximumLoopExplosionCount = new OptionValue<>(10000); + @Option(help = "Do not bail out but throw an exception on failed loop explosion.", type = OptionType.Debug) + public static final OptionValue<Boolean> FailedLoopExplosionIsFatal = new OptionValue<>(false); + /** * Counts the various paths taken through snippets. */
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/alloc/ComputeBlockOrder.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/alloc/ComputeBlockOrder.java Mon Feb 23 16:23:23 2015 -0800 @@ -66,7 +66,7 @@ * * @return sorted list of blocks */ - public static <T extends AbstractBlock<T>> List<T> computeLinearScanOrder(int blockCount, T startBlock) { + public static <T extends AbstractBlockBase<T>> List<T> computeLinearScanOrder(int blockCount, T startBlock) { List<T> order = new ArrayList<>(); BitSet visitedBlocks = new BitSet(blockCount); PriorityQueue<T> worklist = initializeWorklist(startBlock, visitedBlocks); @@ -80,7 +80,7 @@ * * @return sorted list of blocks */ - public static <T extends AbstractBlock<T>> List<T> computeCodeEmittingOrder(int blockCount, T startBlock) { + public static <T extends AbstractBlockBase<T>> List<T> computeCodeEmittingOrder(int blockCount, T startBlock) { List<T> order = new ArrayList<>(); BitSet visitedBlocks = new BitSet(blockCount); PriorityQueue<T> worklist = initializeWorklist(startBlock, visitedBlocks); @@ -92,7 +92,7 @@ /** * Iteratively adds paths to the code emission block order. */ - private static <T extends AbstractBlock<T>> void computeCodeEmittingOrder(List<T> order, PriorityQueue<T> worklist, BitSet visitedBlocks) { + private static <T extends AbstractBlockBase<T>> void computeCodeEmittingOrder(List<T> order, PriorityQueue<T> worklist, BitSet visitedBlocks) { while (!worklist.isEmpty()) { T nextImportantPath = worklist.poll(); addPathToCodeEmittingOrder(nextImportantPath, order, worklist, visitedBlocks); @@ -102,7 +102,7 @@ /** * Iteratively adds paths to the linear scan block order. */ - private static <T extends AbstractBlock<T>> void computeLinearScanOrder(List<T> order, PriorityQueue<T> worklist, BitSet visitedBlocks) { + private static <T extends AbstractBlockBase<T>> void computeLinearScanOrder(List<T> order, PriorityQueue<T> worklist, BitSet visitedBlocks) { while (!worklist.isEmpty()) { T nextImportantPath = worklist.poll(); addPathToLinearScanOrder(nextImportantPath, order, worklist, visitedBlocks); @@ -112,7 +112,7 @@ /** * Initializes the priority queue used for the work list of blocks and adds the start block. */ - private static <T extends AbstractBlock<T>> PriorityQueue<T> initializeWorklist(T startBlock, BitSet visitedBlocks) { + private static <T extends AbstractBlockBase<T>> PriorityQueue<T> initializeWorklist(T startBlock, BitSet visitedBlocks) { PriorityQueue<T> result = new PriorityQueue<>(INITIAL_WORKLIST_CAPACITY, new BlockOrderComparator<>()); result.add(startBlock); visitedBlocks.set(startBlock.getId()); @@ -122,7 +122,7 @@ /** * Add a linear path to the linear scan order greedily following the most likely successor. */ - private static <T extends AbstractBlock<T>> void addPathToLinearScanOrder(T block, List<T> order, PriorityQueue<T> worklist, BitSet visitedBlocks) { + private static <T extends AbstractBlockBase<T>> void addPathToLinearScanOrder(T block, List<T> order, PriorityQueue<T> worklist, BitSet visitedBlocks) { block.setLinearScanNumber(order.size()); order.add(block); T mostLikelySuccessor = findAndMarkMostLikelySuccessor(block, visitedBlocks); @@ -151,7 +151,7 @@ /** * Add a linear path to the code emission order greedily following the most likely successor. */ - private static <T extends AbstractBlock<T>> void addPathToCodeEmittingOrder(T initialBlock, List<T> order, PriorityQueue<T> worklist, BitSet visitedBlocks) { + private static <T extends AbstractBlockBase<T>> void addPathToCodeEmittingOrder(T initialBlock, List<T> order, PriorityQueue<T> worklist, BitSet visitedBlocks) { T block = initialBlock; while (block != null) { // Skip loop headers if there is only a single loop end block to @@ -191,7 +191,7 @@ /** * Adds a block to the ordering. */ - private static <T extends AbstractBlock<T>> void addBlock(T header, List<T> order) { + private static <T extends AbstractBlockBase<T>> void addBlock(T header, List<T> order) { assert !order.contains(header) : "Cannot insert block twice"; order.add(header); } @@ -199,7 +199,7 @@ /** * Find the highest likely unvisited successor block of a given block. */ - private static <T extends AbstractBlock<T>> T findAndMarkMostLikelySuccessor(T block, BitSet visitedBlocks) { + private static <T extends AbstractBlockBase<T>> T findAndMarkMostLikelySuccessor(T block, BitSet visitedBlocks) { T result = null; for (T successor : block.getSuccessors()) { assert successor.probability() >= 0.0 : "Probabilities must be positive"; @@ -216,7 +216,7 @@ /** * Add successor blocks into the given work list if they are not already marked as visited. */ - private static <T extends AbstractBlock<T>> void enqueueSuccessors(T block, PriorityQueue<T> worklist, BitSet visitedBlocks) { + private static <T extends AbstractBlockBase<T>> void enqueueSuccessors(T block, PriorityQueue<T> worklist, BitSet visitedBlocks) { for (T successor : block.getSuccessors()) { if (!visitedBlocks.get(successor.getId())) { visitedBlocks.set(successor.getId()); @@ -229,14 +229,14 @@ * Skip the loop header block if the loop consists of more than one block and it has only a * single loop end block. */ - private static <T extends AbstractBlock<T>> boolean skipLoopHeader(AbstractBlock<T> block) { + private static <T extends AbstractBlockBase<T>> boolean skipLoopHeader(AbstractBlockBase<T> block) { return (block.isLoopHeader() && !block.isLoopEnd() && block.getLoop().numBackedges() == 1); } /** * Checks that the ordering contains the expected number of blocks. */ - private static boolean checkOrder(List<? extends AbstractBlock<?>> order, int expectedBlockCount) { + private static boolean checkOrder(List<? extends AbstractBlockBase<?>> order, int expectedBlockCount) { assert order.size() == expectedBlockCount : String.format("Number of blocks in ordering (%d) does not match expected block count (%d)", order.size(), expectedBlockCount); return true; } @@ -244,7 +244,7 @@ /** * Comparator for sorting blocks based on loop depth and probability. */ - private static class BlockOrderComparator<T extends AbstractBlock<T>> implements Comparator<T> { + private static class BlockOrderComparator<T extends AbstractBlockBase<T>> implements Comparator<T> { @Override public int compare(T a, T b) {
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/AbstractBlock.java Wed Feb 18 10:37:08 2015 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.compiler.common.cfg; - -import java.util.*; - -public interface AbstractBlock<T extends AbstractBlock<T>> { - - int getId(); - - Loop<T> getLoop(); - - void setLoop(Loop<T> loop); - - int getLoopDepth(); - - boolean isLoopHeader(); - - boolean isLoopEnd(); - - boolean isExceptionEntry(); - - List<T> getPredecessors(); - - int getPredecessorCount(); - - List<T> getSuccessors(); - - int getSuccessorCount(); - - int getLinearScanNumber(); - - void setLinearScanNumber(int linearScanNumber); - - boolean isAligned(); - - void setAlign(boolean align); - - T getDominator(); - - void setDominator(T block); - - List<T> getDominated(); - - void setDominated(List<T> blocks); - - T getPostdominator(); - - double probability(); - -}
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/AbstractBlockBase.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/AbstractBlockBase.java Mon Feb 23 16:23:23 2015 -0800 @@ -24,9 +24,10 @@ import java.util.*; -public abstract class AbstractBlockBase<T extends AbstractBlock<T>> implements AbstractBlock<T> { +public abstract class AbstractBlockBase<T extends AbstractBlockBase<T>> { protected int id; + protected int domDepth; protected List<T> predecessors; protected List<T> successors; @@ -72,6 +73,11 @@ public void setDominator(T dominator) { this.dominator = dominator; + this.domDepth = dominator.domDepth + 1; + } + + public int getDominatorDepth() { + return domDepth; } public List<T> getDominated() { @@ -113,4 +119,20 @@ public void setAlign(boolean align) { this.align = align; } + + public abstract boolean isExceptionEntry(); + + public abstract Loop<T> getLoop(); + + public abstract int getLoopDepth(); + + public abstract boolean isLoopEnd(); + + public abstract boolean isLoopHeader(); + + public abstract T getPostdominator(); + + public abstract double probability(); + + public abstract T getDominator(int distance); }
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/AbstractControlFlowGraph.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/AbstractControlFlowGraph.java Mon Feb 23 16:23:23 2015 -0800 @@ -26,7 +26,7 @@ import com.oracle.graal.compiler.common.*; -public interface AbstractControlFlowGraph<T extends AbstractBlock<T>> { +public interface AbstractControlFlowGraph<T extends AbstractBlockBase<T>> { int BLOCK_ID_INITIAL = -1; int BLOCK_ID_VISITED = -2; @@ -48,7 +48,7 @@ /** * Computes the dominators of control flow graph. */ - static <T extends AbstractBlock<T>> void computeDominators(AbstractControlFlowGraph<T> cfg) { + static <T extends AbstractBlockBase<T>> void computeDominators(AbstractControlFlowGraph<T> cfg) { List<T> reversePostOrder = cfg.getBlocks(); assert reversePostOrder.get(0).getPredecessorCount() == 0 : "start block has no predecessor and therefore no dominator"; for (int i = 1; i < reversePostOrder.size(); i++) { @@ -72,9 +72,9 @@ /** * True if block {@code a} is dominated by block {@code b}. */ - static boolean isDominatedBy(AbstractBlock<?> a, AbstractBlock<?> b) { + static boolean isDominatedBy(AbstractBlockBase<?> a, AbstractBlockBase<?> b) { assert a != null; - AbstractBlock<?> dominator = a; + AbstractBlockBase<?> dominator = a; int i = 0; while (dominator != null) { if (i++ == Integer.MAX_VALUE) { // For safety @@ -91,7 +91,7 @@ /** * True if block {@code a} dominates block {@code b}. */ - static boolean dominates(AbstractBlock<?> a, AbstractBlock<?> b) { + static boolean dominates(AbstractBlockBase<?> a, AbstractBlockBase<?> b) { assert a != null; return isDominatedBy(b, a); } @@ -104,31 +104,36 @@ * @see #getBlocks() * @see CFGVerifier */ - static AbstractBlock<?> commonDominator(AbstractBlock<?> a, AbstractBlock<?> b) { + static AbstractBlockBase<?> commonDominator(AbstractBlockBase<?> a, AbstractBlockBase<?> b) { if (a == null) { return b; } if (b == null) { return a; } - AbstractBlock<?> iterA = a; - AbstractBlock<?> iterB = b; + + AbstractBlockBase<?> iterA = a; + AbstractBlockBase<?> iterB = b; + int aDomDepth = a.getDominatorDepth(); + int bDomDepth = b.getDominatorDepth(); + if (aDomDepth > bDomDepth) { + iterA = a.getDominator(aDomDepth - bDomDepth); + } else { + iterB = b.getDominator(bDomDepth - aDomDepth); + } + while (iterA != iterB) { - if (iterA.getId() > iterB.getId()) { - iterA = iterA.getDominator(); - } else { - assert iterB.getId() > iterA.getId(); - iterB = iterB.getDominator(); - } + iterA = iterA.getDominator(); + iterB = iterB.getDominator(); } return iterA; } /** - * @see AbstractControlFlowGraph#commonDominator(AbstractBlock, AbstractBlock) + * @see AbstractControlFlowGraph#commonDominator(AbstractBlockBase, AbstractBlockBase) */ @SuppressWarnings("unchecked") - static <T extends AbstractBlock<T>> T commonDominatorTyped(T a, T b) { + static <T extends AbstractBlockBase<T>> T commonDominatorTyped(T a, T b) { return (T) commonDominator(a, b); } }
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/BlockMap.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/BlockMap.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,11 +31,11 @@ data = (T[]) new Object[cfg.getBlocks().size()]; } - public T get(AbstractBlock<?> block) { + public T get(AbstractBlockBase<?> block) { return data[block.getId()]; } - public void put(AbstractBlock<?> block, T value) { + public void put(AbstractBlockBase<?> block, T value) { data[block.getId()] = value; } }
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/CFGVerifier.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/CFGVerifier.java Mon Feb 23 16:23:23 2015 -0800 @@ -26,7 +26,7 @@ public class CFGVerifier { - public static <T extends AbstractBlock<T>, C extends AbstractControlFlowGraph<T>> boolean verify(C cfg) { + public static <T extends AbstractBlockBase<T>, C extends AbstractControlFlowGraph<T>> boolean verify(C cfg) { for (T block : cfg.getBlocks()) { assert block.getId() >= 0; assert cfg.getBlocks().get(block.getId()) == block;
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/DominatorOptimizationProblem.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/DominatorOptimizationProblem.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ */ public abstract class DominatorOptimizationProblem<E extends Enum<E>, C> { - private List<? extends AbstractBlock<?>> blocks; + private List<? extends AbstractBlockBase<?>> blocks; private EnumMap<E, BitSet> flags; private BlockMap<C> costs; @@ -47,9 +47,9 @@ assert verify(blocks); } - private static boolean verify(List<? extends AbstractBlock<?>> blocks) { + private static boolean verify(List<? extends AbstractBlockBase<?>> blocks) { for (int i = 0; i < blocks.size(); i++) { - AbstractBlock<?> block = blocks.get(i); + AbstractBlockBase<?> block = blocks.get(i); if (i != block.getId()) { assert false : String.format("Id index mismatch @ %d vs. %s.getId()==%d", i, block, block.getId()); return false; @@ -58,12 +58,12 @@ return true; } - public final List<? extends AbstractBlock<?>> getBlocks() { + public final List<? extends AbstractBlockBase<?>> getBlocks() { return blocks; } - public final AbstractBlock<?> getBlockForId(int id) { - AbstractBlock<?> block = blocks.get(id); + public final AbstractBlockBase<?> getBlockForId(int id) { + AbstractBlockBase<?> block = blocks.get(id); assert block.getId() == id : "wrong block-to-id mapping"; return block; } @@ -71,7 +71,7 @@ /** * Sets a flag for a block. */ - public final void set(E flag, AbstractBlock<?> block) { + public final void set(E flag, AbstractBlockBase<?> block) { BitSet bitSet = flags.get(flag); if (bitSet == null) { bitSet = new BitSet(blocks.size()); @@ -83,7 +83,7 @@ /** * Checks whether a flag is set for a block. */ - public final boolean get(E flag, AbstractBlock<?> block) { + public final boolean get(E flag, AbstractBlockBase<?> block) { BitSet bitSet = flags.get(flag); return bitSet == null ? false : bitSet.get(block.getId()); } @@ -91,14 +91,14 @@ /** * Returns a {@linkplain Stream} of blocks for which {@code flag} is set. */ - public final Stream<? extends AbstractBlock<?>> stream(E flag) { + public final Stream<? extends AbstractBlockBase<?>> stream(E flag) { return getBlocks().stream().filter(block -> get(flag, block)); } /** * Returns the cost object associated with {@code block}. Might return {@code null} if not set. */ - public final C getCost(AbstractBlock<?> block) { + public final C getCost(AbstractBlockBase<?> block) { C cost = costs.get(block); return cost; } @@ -106,7 +106,7 @@ /** * Sets the cost for a {@code block}. */ - public final void setCost(AbstractBlock<?> block, C cost) { + public final void setCost(AbstractBlockBase<?> block, C cost) { costs.put(block, cost); } @@ -114,13 +114,13 @@ * Sets {@code flag} for all blocks along the dominator path from {@code block} to the root * until a block it finds a block where {@code flag} is already set. */ - public final void setDominatorPath(E flag, AbstractBlock<?> block) { + public final void setDominatorPath(E flag, AbstractBlockBase<?> block) { BitSet bitSet = flags.get(flag); if (bitSet == null) { bitSet = new BitSet(blocks.size()); flags.put(flag, bitSet); } - for (AbstractBlock<?> b = block; b != null && !bitSet.get(b.getId()); b = b.getDominator()) { + for (AbstractBlockBase<?> b = block; b != null && !bitSet.get(b.getId()); b = b.getDominator()) { // mark block bitSet.set(b.getId()); } @@ -129,7 +129,7 @@ /** * Returns a {@link Stream} of flags associated with {@code block}. */ - public final Stream<E> getFlagsForBlock(AbstractBlock<?> block) { + public final Stream<E> getFlagsForBlock(AbstractBlockBase<?> block) { return getFlags().stream().filter(flag -> get(flag, block)); }
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/Loop.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/Loop.java Mon Feb 23 16:23:23 2015 -0800 @@ -25,7 +25,7 @@ import java.util.*; -public abstract class Loop<T extends AbstractBlock<T>> { +public abstract class Loop<T extends AbstractBlockBase<T>> { private final Loop<T> parent; private final List<Loop<T>> children;
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/PrintableCFG.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/PrintableCFG.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ */ public interface PrintableCFG { - List<? extends AbstractBlock<?>> getBlocks(); + List<? extends AbstractBlockBase<?>> getBlocks(); /** * Applies {@code action} to all extra property pairs (name, value) of {@code block}. @@ -39,7 +39,7 @@ * @param block a block from {@link #getBlocks()}. * @param action a {@link BiConsumer consumer}. */ - default void forEachPropertyPair(AbstractBlock<?> block, BiConsumer<String, String> action) { + default void forEachPropertyPair(AbstractBlockBase<?> block, BiConsumer<String, String> action) { // no extra properties per default } }
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/PrintableDominatorOptimizationProblem.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/cfg/PrintableDominatorOptimizationProblem.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ super(keyType, cfg); } - public void forEachPropertyPair(AbstractBlock<?> block, BiConsumer<String, String> action) { + public void forEachPropertyPair(AbstractBlockBase<?> block, BiConsumer<String, String> action) { // for each flag getFlags().forEach(flag -> ((BiConsumer<String, Boolean>) (name, value) -> action.accept(name, value ? "true" : "false")).accept(getName(flag), get(flag, block))); // for each property
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/util/ArrayMap.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/util/ArrayMap.java Mon Feb 23 16:23:23 2015 -0800 @@ -45,7 +45,7 @@ /** * Constructs a new {@code ArrayMap} that initially covers the specified interval. Note that * this map will automatically expand if necessary later. - * + * * @param low the low index, inclusive * @param high the high index, exclusive */ @@ -56,7 +56,7 @@ /** * Puts a new value in the map at the specified index. - * + * * @param i the index at which to store the value * @param value the value to store at the specified index */ @@ -81,7 +81,7 @@ /** * Gets the value at the specified index in the map. - * + * * @param i the index * @return the value at the specified index; {@code null} if there is no value at the specified * index, or if the index is out of the currently stored range
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/util/IntList.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/util/IntList.java Mon Feb 23 16:23:23 2015 -0800 @@ -26,7 +26,7 @@ /** * An expandable and indexable list of {@code int}s. - * + * * This class avoids the boxing/unboxing incurred by {@code ArrayList<Integer>}. */ public final class IntList { @@ -36,7 +36,7 @@ /** * Creates an int list with a specified initial capacity. - * + * * @param initialCapacity */ public IntList(int initialCapacity) { @@ -45,7 +45,7 @@ /** * Creates an int list with a specified initial array. - * + * * @param array the initial array used for the list (no copy is made) * @param initialSize the initial {@linkplain #size() size} of the list (must be less than or * equal to {@code array.length} @@ -58,7 +58,7 @@ /** * Makes a new int list by copying a range from a given int list. - * + * * @param other the list from which a range of values is to be copied into the new list * @param startIndex the index in {@code other} at which to start copying * @param length the number of values to copy from {@code other} @@ -70,7 +70,7 @@ /** * Makes a new int list by copying a range from a given int list. - * + * * @param other the list from which a range of values is to be copied into the new list * @param startIndex the index in {@code other} at which to start copying * @param length the number of values to copy from {@code other} @@ -91,7 +91,7 @@ /** * Appends a value to the end of this list, increasing its {@linkplain #size() size} by 1. - * + * * @param value the value to append */ public void add(int value) { @@ -104,7 +104,7 @@ /** * Gets the value in this list at a given index. - * + * * @param index the index of the element to return * @throws IndexOutOfBoundsException if {@code index < 0 || index >= size()} */ @@ -124,7 +124,7 @@ /** * Sets a value at a given index in this list. - * + * * @param index the index of the element to update * @param value the new value of the element * @throws IndexOutOfBoundsException if {@code index < 0 || index >= size()} @@ -138,11 +138,11 @@ /** * Adjusts the {@linkplain #size() size} of this int list. - * + * * If {@code newSize < size()}, the size is changed to {@code newSize}. If * {@code newSize > size()}, sufficient 0 elements are {@linkplain #add(int) added} until * {@code size() == newSize}. - * + * * @param newSize the new size of this int list */ public void setSize(int newSize) {
--- a/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/SPARCAllocatorTest.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/SPARCAllocatorTest.java Mon Feb 23 16:23:23 2015 -0800 @@ -47,7 +47,7 @@ @Test public void test2() { - testAllocation("test2snippet", 2, 1, 0); + testAllocation("test2snippet", 1, 0, 0); } public static long test2snippet(long x) {
--- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Mon Feb 23 16:23:23 2015 -0800 @@ -70,7 +70,7 @@ private StackSlotValue tmpStackSlot; - private class SPARCSpillMoveFactory implements LIR.SpillMoveFactory { + private class SPARCSpillMoveFactory implements LIRGeneratorTool.SpillMoveFactory { @Override public LIRInstruction createMove(AllocatableValue result, Value input) { @@ -80,7 +80,10 @@ public SPARCLIRGenerator(LIRKindTool lirKindTool, Providers providers, CallingConvention cc, LIRGenerationResult lirGenRes) { super(lirKindTool, providers, cc, lirGenRes); - lirGenRes.getLIR().setSpillMoveFactory(new SPARCSpillMoveFactory()); + } + + public SpillMoveFactory getSpillMoveFactory() { + return new SPARCSpillMoveFactory(); } @Override
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java Mon Feb 23 16:23:23 2015 -0800 @@ -47,7 +47,6 @@ import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.*; import com.oracle.graal.phases.VerifyPhase.VerificationError; -import com.oracle.graal.phases.graph.*; import com.oracle.graal.phases.tiers.*; import com.oracle.graal.phases.util.*; import com.oracle.graal.phases.verify.*; @@ -199,7 +198,6 @@ * Checks the invariants for a single graph. */ private static void checkGraph(HighTierContext context, StructuredGraph graph, boolean verifyEquals) { - InferStamps.inferStamps(graph); if (verifyEquals) { new VerifyUsageWithEquals(Value.class).apply(graph, context); new VerifyUsageWithEquals(Register.class).apply(graph, context);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/NodePosIteratorTest.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/NodePosIteratorTest.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo static final class TestNode extends Node { - public static final NodeClass<TestNode> TYPE = NodeClass.get(TestNode.class); + public static final NodeClass<TestNode> TYPE = NodeClass.create(TestNode.class); @Successor Node s1; @Successor Node s2; @Successor NodeSuccessorList<Node> stail;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SimpleCFGTest.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SimpleCFGTest.java Mon Feb 23 16:23:23 2015 -0800 @@ -43,8 +43,8 @@ public void testImplies() { StructuredGraph graph = new StructuredGraph(AllowAssumptions.YES); - AbstractEndNode trueEnd = graph.add(new EndNode()); - AbstractEndNode falseEnd = graph.add(new EndNode()); + EndNode trueEnd = graph.add(new EndNode()); + EndNode falseEnd = graph.add(new EndNode()); AbstractBeginNode trueBegin = graph.add(new BeginNode()); trueBegin.setNext(trueEnd);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java Mon Feb 23 16:23:23 2015 -0800 @@ -64,7 +64,7 @@ public RegisterStats(LIR lir) { this.lir = lir; - for (AbstractBlock<?> block : lir.codeEmittingOrder()) { + for (AbstractBlockBase<?> block : lir.codeEmittingOrder()) { for (LIRInstruction instr : lir.getLIRforBlock(block)) { collectStats(instr); }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Mon Feb 23 16:23:23 2015 -0800 @@ -44,9 +44,9 @@ import com.oracle.graal.lir.framemap.*; import com.oracle.graal.lir.gen.*; import com.oracle.graal.lir.phases.*; -import com.oracle.graal.lir.phases.LIRHighTierPhase.LIRHighTierContext; -import com.oracle.graal.lir.phases.LIRLowTierPhase.LIRLowTierContext; -import com.oracle.graal.lir.phases.LIRMidTierPhase.LIRMidTierContext; +import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.PreAllocationOptimizationContext; +import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.PostAllocationOptimizationContext; +import com.oracle.graal.lir.phases.AllocationPhase.AllocationContext; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.spi.*; @@ -340,7 +340,7 @@ throw Debug.handle(e); } - try (Scope s = Debug.scope("LIRTier", nodeLirGen)) { + try (Scope s = Debug.scope("LIRStages", nodeLirGen)) { return emitLowLevel(target, codeEmittingOrder, linearScanOrder, lirGenRes, lirGen, lirSuites); } catch (Throwable e) { throw Debug.handle(e); @@ -350,16 +350,16 @@ } } - public static <T extends AbstractBlock<T>> LIRGenerationResult emitLowLevel(TargetDescription target, List<T> codeEmittingOrder, List<T> linearScanOrder, LIRGenerationResult lirGenRes, + public static <T extends AbstractBlockBase<T>> LIRGenerationResult emitLowLevel(TargetDescription target, List<T> codeEmittingOrder, List<T> linearScanOrder, LIRGenerationResult lirGenRes, LIRGeneratorTool lirGen, LIRSuites lirSuites) { - LIRHighTierContext highTierContext = new LIRHighTierContext(lirGen); - lirSuites.getHighTier().apply(target, lirGenRes, codeEmittingOrder, linearScanOrder, highTierContext); + PreAllocationOptimizationContext preAllocOptContext = new PreAllocationOptimizationContext(lirGen); + lirSuites.getPreAllocationOptimizationStage().apply(target, lirGenRes, codeEmittingOrder, linearScanOrder, preAllocOptContext); - LIRMidTierContext midTierContext = new LIRMidTierContext(); - lirSuites.getMidTier().apply(target, lirGenRes, codeEmittingOrder, linearScanOrder, midTierContext); + AllocationContext allocContext = new AllocationContext(lirGen.getSpillMoveFactory()); + lirSuites.getAllocationStage().apply(target, lirGenRes, codeEmittingOrder, linearScanOrder, allocContext); - LIRLowTierContext lowTierContext = new LIRLowTierContext(); - lirSuites.getLowTier().apply(target, lirGenRes, codeEmittingOrder, linearScanOrder, lowTierContext); + PostAllocationOptimizationContext postAllocOptContext = new PostAllocationOptimizationContext(); + lirSuites.getPostAllocationOptimizationStage().apply(target, lirGenRes, codeEmittingOrder, linearScanOrder, postAllocOptContext); return lirGenRes; }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Mon Feb 23 16:23:23 2015 -0800 @@ -98,7 +98,9 @@ } } if (pos != vobj.entryCount()) { - values = Arrays.copyOf(values, pos); + JavaValue[] newValues = new JavaValue[pos]; + System.arraycopy(values, 0, newValues, 0, pos); + values = newValues; } } entry.getValue().setValues(values);
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/InstructionPrinter.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/InstructionPrinter.java Mon Feb 23 16:23:23 2015 -0800 @@ -71,7 +71,7 @@ /** * Prints this column's label to a given stream after padding the stream with '_' characters * until its {@linkplain LogStream#position() position} is equal to this column's position. - * + * * @param out the print stream */ public void printLabel(LogStream out) { @@ -82,7 +82,7 @@ /** * Prints space characters to a given stream until its {@linkplain LogStream#position() * position} is equal to this column's position. - * + * * @param out the print stream */ public void advance(LogStream out) { @@ -116,7 +116,7 @@ /** * Prints an instruction listing on one line. The instruction listing is composed of the columns * specified by {@link InstructionLineColumn}. - * + * * @param instruction the instruction to print */ public void printInstructionListing(ValueNode instruction) {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java Mon Feb 23 16:23:23 2015 -0800 @@ -23,8 +23,6 @@ package com.oracle.graal.compiler.match; import static com.oracle.graal.compiler.GraalDebugConfig.*; -import static com.oracle.graal.graph.Edges.Type.*; - import java.util.*; import java.util.Map.Entry; @@ -50,7 +48,7 @@ public static Position[] findPositions(NodeClass<? extends ValueNode> nodeClass, String[] names) { Position[] result = new Position[names.length]; for (int i = 0; i < names.length; i++) { - Edges edges = nodeClass.getEdges(Inputs); + Edges edges = nodeClass.getInputEdges(); for (int e = 0; e < edges.getDirectCount(); e++) { if (names[i].equals(edges.getName(e))) { result[i] = new Position(edges, e, Node.NOT_ITERABLE);
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/BasicCompilerConfiguration.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/BasicCompilerConfiguration.java Mon Feb 23 16:23:23 2015 -0800 @@ -24,9 +24,9 @@ import com.oracle.graal.api.runtime.*; import com.oracle.graal.lir.phases.*; -import com.oracle.graal.lir.phases.LIRHighTierPhase.*; -import com.oracle.graal.lir.phases.LIRLowTierPhase.*; -import com.oracle.graal.lir.phases.LIRMidTierPhase.*; +import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.*; +import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.*; +import com.oracle.graal.lir.phases.AllocationPhase.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.tiers.*; @@ -45,16 +45,16 @@ return new LowTier(); } - public LIRPhaseSuite<LIRHighTierContext> createLIRHighTier() { - return new LIRHighTier(); + public LIRPhaseSuite<PreAllocationOptimizationContext> createPreAllocationOptimizationStage() { + return new PreAllocationOptimizationStage(); } - public LIRPhaseSuite<LIRMidTierContext> createLIRMidTier() { - return new LIRMidTier(); + public LIRPhaseSuite<AllocationContext> createAllocationStage() { + return new AllocationStage(); } - public LIRPhaseSuite<LIRLowTierContext> createLIRLowTier() { - return new LIRLowTier(); + public LIRPhaseSuite<PostAllocationOptimizationContext> createPostAllocationOptimizationStage() { + return new PostAllocationOptimizationStage(); } }
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfigScope.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfigScope.java Mon Feb 23 16:23:23 2015 -0800 @@ -27,7 +27,7 @@ /** * A utility for scoping a change to the current debug * {@linkplain DebugScope#setConfig(DebugConfig) configuration}. For example: - * + * * <pre> * DebugConfig config = ...; * try (DebugConfigScope s = new DebugConfigScope(config)) {
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/LogStream.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/LogStream.java Mon Feb 23 16:23:23 2015 -0800 @@ -26,20 +26,20 @@ /** * A utility for printing compiler debug and informational output to an output stream. - * + * * A {@link LogStream} instance maintains an internal buffer that is flushed to the underlying * output stream every time one of the {@code println} methods is invoked, or a newline character ( * {@code '\n'}) is written. - * + * * All of the {@code print} and {@code println} methods return the {code LogStream} instance on * which they were invoked. This allows chaining of these calls to mitigate use of String * concatenation by the caller. - * + * * A {@code LogStream} maintains a current {@linkplain #indentationLevel() indentation} level. Each * line of output written to this stream has {@code n} spaces prefixed to it where {@code n} is the * value that would be returned by {@link #indentationLevel()} when the first character of a new * line is written. - * + * * A {@code LogStream} maintains a current {@linkplain #position() position} for the current line * being written. This position can be advanced to a specified position by * {@linkplain #fillTo(int, char) filling} this stream with a given character. @@ -87,7 +87,7 @@ /** * Creates a new log stream. - * + * * @param os the underlying output stream to which prints are sent */ public LogStream(OutputStream os) { @@ -98,7 +98,7 @@ /** * Creates a new log stream that shares the same {@linkplain #ps output stream} as a given * {@link LogStream}. - * + * * @param log a LogStream whose output stream is shared with this one */ public LogStream(LogStream log) { @@ -147,7 +147,7 @@ /** * Gets the current column position of this log stream. - * + * * @return the current column position of this log stream */ public int position() { @@ -157,7 +157,7 @@ /** * Gets the current indentation level for this log stream. - * + * * @return the current indentation level for this log stream. */ public int indentationLevel() { @@ -166,7 +166,7 @@ /** * Adjusts the current indentation level of this log stream. - * + * * @param delta */ public void adjustIndentation(int delta) { @@ -202,7 +202,7 @@ /** * Advances this stream's {@linkplain #position() position} to a given position by repeatedly * appending a given character as necessary. - * + * * @param position the position to which this stream's position will be advanced * @param filler the character used to pad the stream */ @@ -218,7 +218,7 @@ /** * Writes a boolean value to this stream as {@code "true"} or {@code "false"}. - * + * * @param b the value to be printed * @return this {@link LogStream} instance */ @@ -233,7 +233,7 @@ /** * Writes a boolean value to this stream followed by a {@linkplain #LINE_SEPARATOR line * separator}. - * + * * @param b the value to be printed * @return this {@link LogStream} instance */ @@ -248,7 +248,7 @@ /** * Writes a character value to this stream. - * + * * @param c the value to be printed * @return this {@link LogStream} instance */ @@ -268,7 +268,7 @@ /** * Writes a character value to this stream followed by a {@linkplain #LINE_SEPARATOR line * separator}. - * + * * @param c the value to be printed * @return this {@link LogStream} instance */ @@ -283,7 +283,7 @@ /** * Prints an int value. - * + * * @param i the value to be printed * @return this {@link LogStream} instance */ @@ -297,7 +297,7 @@ /** * Writes an int value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}. - * + * * @param i the value to be printed * @return this {@link LogStream} instance */ @@ -312,7 +312,7 @@ /** * Writes a float value to this stream. - * + * * @param f the value to be printed * @return this {@link LogStream} instance */ @@ -327,7 +327,7 @@ /** * Writes a float value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator} * . - * + * * @param f the value to be printed * @return this {@link LogStream} instance */ @@ -342,7 +342,7 @@ /** * Writes a long value to this stream. - * + * * @param l the value to be printed * @return this {@link LogStream} instance */ @@ -356,7 +356,7 @@ /** * Writes a long value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}. - * + * * @param l the value to be printed * @return this {@link LogStream} instance */ @@ -371,7 +371,7 @@ /** * Writes a double value to this stream. - * + * * @param d the value to be printed * @return this {@link LogStream} instance */ @@ -386,7 +386,7 @@ /** * Writes a double value to this stream followed by a {@linkplain #LINE_SEPARATOR line * separator}. - * + * * @param d the value to be printed * @return this {@link LogStream} instance */ @@ -403,7 +403,7 @@ * Writes a {@code String} value to this stream. This method ensures that the * {@linkplain #position() position} of this stream is updated correctly with respect to any * {@linkplain #LINE_SEPARATOR line separators} present in {@code s}. - * + * * @param s the value to be printed * @return this {@link LogStream} instance */ @@ -436,7 +436,7 @@ /** * Writes a {@code String} value to this stream followed by a {@linkplain #LINE_SEPARATOR line * separator}. - * + * * @param s the value to be printed * @return this {@link LogStream} instance */ @@ -450,7 +450,7 @@ /** * Writes a formatted string to this stream. - * + * * @param format a format string as described in {@link String#format(String, Object...)} * @param args the arguments to be formatted * @return this {@link LogStream} instance @@ -464,7 +464,7 @@ /** * Writes a {@linkplain #LINE_SEPARATOR line separator} to this stream. - * + * * @return this {@code LogStream} instance */ public LogStream println() {
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/TTY.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/TTY.java Mon Feb 23 16:23:23 2015 -0800 @@ -46,7 +46,7 @@ * Creates an object that will suppress {@link TTY} for the current thread if the given * filter does not match the given object. To revert the suppression state to how it was * before this call, the {@link #remove()} method must be called on the suppression object. - * + * * @param filter the pattern for matching. If {@code null}, then the match is successful. If * it starts with "~", then a regular expression * {@linkplain Pattern#matches(String, CharSequence) match} is performed where
--- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/NodeMapTest.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/NodeMapTest.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo static final class TestNode extends Node { - public static final NodeClass<TestNode> TYPE = NodeClass.get(TestNode.class); + public static final NodeClass<TestNode> TYPE = NodeClass.create(TestNode.class); protected TestNode() { super(TYPE);
--- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/NodeUsagesTests.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/NodeUsagesTests.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo static final class Def extends Node { - public static final NodeClass<Def> TYPE = NodeClass.get(Def.class); + public static final NodeClass<Def> TYPE = NodeClass.create(Def.class); protected Def() { super(TYPE); @@ -44,7 +44,7 @@ @NodeInfo static final class Use extends Node { - public static final NodeClass<Use> TYPE = NodeClass.get(Use.class); + public static final NodeClass<Use> TYPE = NodeClass.create(Use.class); @Input Def in0; @Input Def in1; @Input Def in2;
--- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/TypedNodeIteratorTest.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/TypedNodeIteratorTest.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo static final class TestNode extends Node implements IterableNodeType, TestNodeInterface { - public static final NodeClass<TestNode> TYPE = NodeClass.get(TestNode.class); + public static final NodeClass<TestNode> TYPE = NodeClass.create(TestNode.class); protected final String name; public TestNode(String name) {
--- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/TypedNodeIteratorTest2.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/TypedNodeIteratorTest2.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,14 +34,14 @@ @NodeInfo static class NodeA extends Node implements TestNodeInterface { - public static final NodeClass<NodeA> TYPE = NodeClass.get(NodeA.class); + public static final NodeClass<NodeA> TYPE = NodeClass.create(NodeA.class); protected final String name; public NodeA(String name) { this(TYPE, name); } - protected NodeA(NodeClass<?> c, String name) { + protected NodeA(NodeClass<? extends NodeA> c, String name) { super(c); this.name = name; } @@ -53,13 +53,13 @@ @NodeInfo static class NodeB extends NodeA implements IterableNodeType { - public static final NodeClass<NodeB> TYPE = NodeClass.get(NodeB.class); + public static final NodeClass<NodeB> TYPE = NodeClass.create(NodeB.class); public NodeB(String name) { this(TYPE, name); } - protected NodeB(NodeClass<?> c, String name) { + protected NodeB(NodeClass<? extends NodeB> c, String name) { super(c, name); } @@ -67,13 +67,13 @@ @NodeInfo static class NodeC extends NodeB { - public static final NodeClass<NodeC> TYPE = NodeClass.get(NodeC.class); + public static final NodeClass<NodeC> TYPE = NodeClass.create(NodeC.class); public NodeC(String name) { this(TYPE, name); } - protected NodeC(NodeClass<?> c, String name) { + protected NodeC(NodeClass<? extends NodeC> c, String name) { super(c, name); } @@ -81,7 +81,7 @@ @NodeInfo static final class NodeD extends NodeC { - public static final NodeClass<NodeD> TYPE = NodeClass.get(NodeD.class); + public static final NodeClass<NodeD> TYPE = NodeClass.create(NodeD.class); public NodeD(String name) { super(TYPE, name);
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Edges.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Edges.java Mon Feb 23 16:23:23 2015 -0800 @@ -27,6 +27,7 @@ import static com.oracle.graal.graph.Node.*; import java.util.*; +import java.util.function.*; import com.oracle.graal.compiler.common.*; import com.oracle.graal.graph.NodeClass.EdgeInfo; @@ -493,4 +494,29 @@ public Type type() { return type; } + + public void accept(Node node, BiConsumer<Node, Node> consumer) { + int index = 0; + int curDirectCount = this.directCount; + while (index < curDirectCount) { + Node curNode = getNode(node, index); + if (curNode != null) { + consumer.accept(node, curNode); + } + index++; + } + int count = getCount(); + while (index < count) { + NodeList<Node> list = getNodeList(node, index); + if (list != null) { + for (int i = 0; i < list.size(); ++i) { + Node curNode = list.get(i); + if (curNode != null) { + consumer.accept(node, curNode); + } + } + } + index++; + } + } }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java Mon Feb 23 16:23:23 2015 -0800 @@ -519,7 +519,7 @@ } if (minCountNode != null) { for (Node usage : minCountNode.usages()) { - if (usage != node && nodeClass == usage.getNodeClass() && node.valueEquals(usage) && nodeClass.getEdges(Inputs).areEqualIn(node, usage) && + if (usage != node && nodeClass == usage.getNodeClass() && node.valueEquals(usage) && nodeClass.getInputEdges().areEqualIn(node, usage) && nodeClass.getEdges(Successors).areEqualIn(node, usage)) { return (T) usage; } @@ -629,7 +629,7 @@ @com.oracle.graal.nodeinfo.NodeInfo static final class PlaceHolderNode extends Node { - public static final NodeClass<PlaceHolderNode> TYPE = NodeClass.get(PlaceHolderNode.class); + public static final NodeClass<PlaceHolderNode> TYPE = NodeClass.create(PlaceHolderNode.class); public PlaceHolderNode() { super(TYPE); @@ -744,7 +744,9 @@ assert !isFrozen(); assert node.id() == Node.INITIAL_ID; if (nodes.length == nodesSize) { - nodes = Arrays.copyOf(nodes, (nodesSize * 2) + 1); + Node[] newNodes = new Node[(nodesSize * 2) + 1]; + System.arraycopy(nodes, 0, newNodes, 0, nodesSize); + nodes = newNodes; } int id = nodesSize; nodes[id] = node; @@ -826,8 +828,8 @@ return true; } - Node getNode(int i) { - return nodes[i]; + public Node getNode(int id) { + return nodes[id]; } /**
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Mon Feb 23 16:23:23 2015 -0800 @@ -27,6 +27,7 @@ import java.lang.annotation.*; import java.util.*; +import java.util.function.*; import sun.misc.*; @@ -202,12 +203,12 @@ int extraUsagesCount; private Node predecessor; - private NodeClass<?> nodeClass; + private NodeClass<? extends Node> nodeClass; public static final int NODE_LIST = -2; public static final int NOT_ITERABLE = -1; - public Node(NodeClass<?> c) { + public Node(NodeClass<? extends Node> c) { init(); assert c.getJavaClass() == this.getClass(); this.nodeClass = c; @@ -286,7 +287,16 @@ * @return an {@link NodeClassIterable iterable} for all non-null input edges. */ public NodeClassIterable inputs() { - return getNodeClass().getEdges(Inputs).getIterable(this); + return nodeClass.getInputEdges().getIterable(this); + } + + /** + * Applies the given consumer to all inputs of this node. + * + * @param consumer the consumer to be applied to the inputs + */ + public void acceptInputs(BiConsumer<Node, Node> consumer) { + nodeClass.getInputEdges().accept(this, consumer); } /** @@ -296,7 +306,16 @@ * @return an {@link NodeClassIterable iterable} for all non-null successor edges. */ public NodeClassIterable successors() { - return getNodeClass().getEdges(Successors).getIterable(this); + return nodeClass.getSuccessorEdges().getIterable(this); + } + + /** + * Applies the given consumer to all successors of this node. + * + * @param consumer the consumer to be applied to the inputs + */ + public void acceptSuccessors(BiConsumer<Node, Node> consumer) { + nodeClass.getSuccessorEdges().accept(this, consumer); } /** @@ -342,7 +361,9 @@ if (length == 0) { extraUsages = new Node[4]; } else if (extraUsagesCount == length) { - extraUsages = Arrays.copyOf(extraUsages, length * 2 + 1); + Node[] newExtraUsages = new Node[length * 2 + 1]; + System.arraycopy(extraUsages, 0, newExtraUsages, 0, length); + extraUsages = newExtraUsages; } extraUsages[extraUsagesCount++] = node; } @@ -381,7 +402,7 @@ * @param node the node to remove * @return whether or not {@code usage} was in the usage list */ - private boolean removeUsage(Node node) { + public boolean removeUsage(Node node) { assert node != null; // It is critical that this method maintains the invariant that // the usage list has no null element preceding a non-null element @@ -500,15 +521,11 @@ assert assertTrue(id == INITIAL_ID, "unexpected id: %d", id); this.graph = newGraph; newGraph.register(this); - for (Node input : inputs()) { - updateUsages(null, input); - } - for (Node successor : successors()) { - updatePredecessor(null, successor); - } + this.acceptInputs((n, i) -> n.updateUsages(null, i)); + this.acceptSuccessors((n, s) -> n.updatePredecessor(null, s)); } - public final NodeClass<?> getNodeClass() { + public final NodeClass<? extends Node> getNodeClass() { return nodeClass; } @@ -527,7 +544,7 @@ public void replaceAtUsages(Node other) { assert checkReplaceWith(other); for (Node usage : usages()) { - boolean result = usage.getNodeClass().getEdges(Inputs).replaceFirst(usage, this, other); + boolean result = usage.getNodeClass().getInputEdges().replaceFirst(usage, this, other); assert assertTrue(result, "not found in inputs, usage: %s", usage); if (other != null) { maybeNotifyInputChanged(usage); @@ -553,7 +570,7 @@ while (index < this.getUsageCount()) { Node usage = getUsageAt(index); if (usagePredicate.apply(usage)) { - boolean result = usage.getNodeClass().getEdges(Inputs).replaceFirst(usage, this, other); + boolean result = usage.getNodeClass().getInputEdges().replaceFirst(usage, this, other); assert assertTrue(result, "not found in inputs, usage: %s", usage); if (other != null) { maybeNotifyInputChanged(usage); @@ -596,7 +613,7 @@ if (graph != null) { assert !graph.isFrozen(); NodeEventListener listener = graph.nodeEventListener; - if (listener != null) { + if (listener != null && node.isAlive()) { listener.usagesDroppedToZero(node); } if (Fingerprint.ENABLED) { @@ -608,7 +625,7 @@ public void replaceAtPredecessor(Node other) { assert checkReplaceWith(other); if (predecessor != null) { - boolean result = predecessor.getNodeClass().getEdges(Successors).replaceFirst(predecessor, this, other); + boolean result = predecessor.getNodeClass().getSuccessorEdges().replaceFirst(predecessor, this, other); assert assertTrue(result, "not found in successors, predecessor: %s", predecessor); predecessor.updatePredecessor(this, other); } @@ -616,22 +633,22 @@ public void replaceAndDelete(Node other) { assert checkReplaceWith(other); - if (other != null) { - clearSuccessors(); - replaceAtUsages(other); - replaceAtPredecessor(other); - } + assert other != null; + clearInputs(); + clearSuccessors(); + replaceAtUsages(other); + replaceAtPredecessor(other); safeDelete(); } public void replaceFirstSuccessor(Node oldSuccessor, Node newSuccessor) { - if (getNodeClass().getEdges(Successors).replaceFirst(this, oldSuccessor, newSuccessor)) { + if (nodeClass.getSuccessorEdges().replaceFirst(this, oldSuccessor, newSuccessor)) { updatePredecessor(oldSuccessor, newSuccessor); } } public void replaceFirstInput(Node oldInput, Node newInput) { - if (getNodeClass().getEdges(Inputs).replaceFirst(this, oldInput, newInput)) { + if (nodeClass.getInputEdges().replaceFirst(this, oldInput, newInput)) { updateUsages(oldInput, newInput); } } @@ -649,7 +666,7 @@ assert assertFalse(isDeleted(), "cannot clear inputs of deleted node"); unregisterInputs(); - getNodeClass().getEdges(Inputs).clear(this); + getNodeClass().getInputEdges().clear(this); } private boolean removeThisFromUsages(Node n) { @@ -657,17 +674,14 @@ } private void unregisterSuccessors() { - for (Node successor : successors()) { - assert assertTrue(successor.predecessor == this, "wrong predecessor in old successor (%s): %s", successor, successor.predecessor); - successor.predecessor = null; - } + this.acceptSuccessors((n, successor) -> successor.predecessor = null); } public void clearSuccessors() { assert assertFalse(isDeleted(), "cannot clear successors of deleted node"); unregisterSuccessors(); - getNodeClass().getEdges(Successors).clear(this); + getNodeClass().getSuccessorEdges().clear(this); } private boolean checkDeletion() { @@ -684,6 +698,10 @@ assert checkDeletion(); unregisterInputs(); unregisterSuccessors(); + markDeleted(); + } + + public void markDeleted() { graph.unregister(this); id = DELETED_ID_START - id; assert isDeleted(); @@ -750,7 +768,7 @@ * @return the copy of this node */ final Node clone(Graph into, EnumSet<Edges.Type> edgesToCopy) { - final NodeClass<?> nodeClassTmp = getNodeClass(); + final NodeClass<? extends Node> nodeClassTmp = getNodeClass(); boolean useIntoLeafNodeCache = false; if (into != null) { if (nodeClassTmp.valueNumberable() && nodeClassTmp.isLeafNode()) {
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeBitMap.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeBitMap.java Mon Feb 23 16:23:23 2015 -0800 @@ -60,6 +60,10 @@ public boolean isMarked(Node node) { assert check(node, false); int id = nodeIdAccessor.getNodeId(node); + return isMarked(id); + } + + public boolean isMarked(int id) { return (bits[id >> SHIFT] & (1L << id)) != 0; } @@ -67,7 +71,7 @@ assert check(node, true); int id = nodeIdAccessor.getNodeId(node); checkGrow(id); - return (bits[id >> SHIFT] & (1L << id)) != 0; + return isMarked(id); } public void mark(Node node) {
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Mon Feb 23 16:23:23 2015 -0800 @@ -51,7 +51,7 @@ * <li>The identifier for an {@link IterableNodeType} class.</li> * </ul> */ -public final class NodeClass<T> extends FieldIntrospection { +public final class NodeClass<T> extends FieldIntrospection<T> { // Timers for creation of a NodeClass instance private static final DebugTimer Init_FieldScanning = Debug.timer("NodeClass.Init.FieldScanning"); @@ -71,23 +71,22 @@ /** * Gets the {@link NodeClass} associated with a given {@link Class}. */ - @SuppressWarnings({"unchecked", "rawtypes"}) - public static <T> NodeClass<T> get(Class<T> c) { - assert getNodeClassViaReflection(c) == null; - Class<?> superclass = c.getSuperclass(); - NodeClass nodeSuperclass = null; + public static <T> NodeClass<T> create(Class<T> c) { + assert get(c) == null; + Class<? super T> superclass = c.getSuperclass(); + NodeClass<? super T> nodeSuperclass = null; if (superclass != NODE_CLASS) { - nodeSuperclass = getNodeClassViaReflection(superclass); + nodeSuperclass = get(superclass); } - return new NodeClass(c, nodeSuperclass); + return new NodeClass<>(c, nodeSuperclass); } - @SuppressWarnings("rawtypes") - public static NodeClass<?> getNodeClassViaReflection(Class<?> superclass) { + @SuppressWarnings("unchecked") + public static <T> NodeClass<T> get(Class<T> superclass) { try { Field field = superclass.getDeclaredField("TYPE"); field.setAccessible(true); - return (NodeClass) field.get(null); + return (NodeClass<T>) field.get(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { throw new RuntimeException(e); } @@ -101,7 +100,7 @@ private final InputEdges inputs; private final SuccessorEdges successors; - private final NodeClass<?> superNodeClass; + private final NodeClass<? super T> superNodeClass; private final boolean canGVN; private final int startGVNNumber; @@ -124,11 +123,11 @@ private final boolean isSimplifiable; private final boolean isLeafNode; - public NodeClass(Class<?> clazz, NodeClass<?> superNodeClass) { + public NodeClass(Class<T> clazz, NodeClass<? super T> superNodeClass) { this(clazz, superNodeClass, new FieldsScanner.DefaultCalcOffset(), null, 0); } - public NodeClass(Class<?> clazz, NodeClass<?> superNodeClass, FieldsScanner.CalcOffset calcOffset, int[] presetIterableIds, int presetIterableId) { + public NodeClass(Class<T> clazz, NodeClass<? super T> superNodeClass, FieldsScanner.CalcOffset calcOffset, int[] presetIterableIds, int presetIterableId) { super(clazz); this.superNodeClass = superNodeClass; assert NODE_CLASS.isAssignableFrom(clazz); @@ -570,16 +569,18 @@ static void updateEdgesInPlace(Node node, InplaceUpdateClosure duplicationReplacement, Edges edges) { int index = 0; - while (index < edges.getDirectCount()) { + Type curType = edges.type(); + int directCount = edges.getDirectCount(); + while (index < directCount) { Node edge = edges.getNode(node, index); if (edge != null) { - Node newEdge = duplicationReplacement.replacement(edge, edges.type()); - if (edges.type() == Edges.Type.Inputs) { + Node newEdge = duplicationReplacement.replacement(edge, curType); + if (curType == Edges.Type.Inputs) { node.updateUsages(null, newEdge); } else { node.updatePredecessor(null, newEdge); } - assert newEdge == null || edges.getType(index).isAssignableFrom(newEdge.getClass()) : "Can not assign " + newEdge.getClass() + " to " + edges.getType(index) + " in " + node; + assert assertUpdateValid(node, edges, index, newEdge); edges.initializeNode(node, index, newEdge); } index++; @@ -588,12 +589,17 @@ while (index < edges.getCount()) { NodeList<Node> list = edges.getNodeList(node, index); if (list != null) { - edges.initializeList(node, index, updateEdgeListCopy(node, list, duplicationReplacement, edges.type())); + edges.initializeList(node, index, updateEdgeListCopy(node, list, duplicationReplacement, curType)); } index++; } } + private static boolean assertUpdateValid(Node node, Edges edges, int index, Node newEdge) { + assert newEdge == null || edges.getType(index).isAssignableFrom(newEdge.getClass()) : "Can not assign " + newEdge.getClass() + " to " + edges.getType(index) + " in " + node; + return true; + } + void updateInputSuccInPlace(Node node, InplaceUpdateClosure duplicationReplacement) { updateEdgesInPlace(node, duplicationReplacement, inputs); updateEdgesInPlace(node, duplicationReplacement, successors); @@ -619,6 +625,14 @@ return type == Edges.Type.Inputs ? inputs : successors; } + public Edges getInputEdges() { + return inputs; + } + + public Edges getSuccessorEdges() { + return successors; + } + /** * Initializes a fresh allocated node for which no constructor is called yet. Needed to * implement node factories in svm. @@ -638,7 +652,7 @@ } } - public Class<?> getJavaClass() { + public Class<T> getJavaClass() { return getClazz(); }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeFlood.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeFlood.java Mon Feb 23 16:23:23 2015 -0800 @@ -24,10 +24,11 @@ import java.util.*; -public class NodeFlood implements Iterable<Node> { +public final class NodeFlood implements Iterable<Node> { private final NodeBitMap visited; private final Queue<Node> worklist; + private int totalMarkedCount; public NodeFlood(Graph graph) { visited = graph.createNodeBitMap(); @@ -38,15 +39,24 @@ if (node != null && !visited.isMarked(node)) { visited.mark(node); worklist.add(node); + totalMarkedCount++; } } + public int getTotalMarkedCount() { + return totalMarkedCount; + } + public void addAll(Iterable<? extends Node> nodes) { for (Node node : nodes) { this.add(node); } } + public NodeBitMap getVisited() { + return visited; + } + public boolean isMarked(Node node) { return visited.isMarked(node); }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeIdAccessor.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeIdAccessor.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,7 +40,7 @@ /** * Verifies that node identifiers have not changed since this object was created. - * + * * @return true if the check succeeds * @throws VerificationError if the check fails */
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeList.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeList.java Mon Feb 23 16:23:23 2015 -0800 @@ -143,7 +143,9 @@ if (length == 0) { nodes = new Node[2]; } else if (size == length) { - nodes = Arrays.copyOf(nodes, nodes.length * 2 + 1); + Node[] newNodes = new Node[nodes.length * 2 + 1]; + System.arraycopy(nodes, 0, newNodes, 0, length); + nodes = newNodes; } nodes[size++] = node; update(null, (T) node); @@ -186,7 +188,9 @@ void copy(NodeList<? extends Node> other) { self.incModCount(); incModCount(); - nodes = Arrays.copyOf(other.nodes, other.size); + Node[] newNodes = new Node[other.size]; + System.arraycopy(other.nodes, 0, newNodes, 0, newNodes.length); + nodes = newNodes; size = other.size; }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeUnionFind.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeUnionFind.java Mon Feb 23 16:23:23 2015 -0800 @@ -73,12 +73,14 @@ private void union(int a, int b) { int aRoot = find(a); int bRoot = find(b); - if (rank[aRoot] < rank[bRoot]) { - parent[aRoot] = bRoot; - } else { - parent[bRoot] = aRoot; - if (rank[aRoot] == rank[bRoot]) { - rank[aRoot]++; + if (aRoot != bRoot) { + if (rank[aRoot] < rank[bRoot]) { + parent[aRoot] = bRoot; + } else { + parent[bRoot] = aRoot; + if (rank[aRoot] == rank[bRoot]) { + rank[aRoot]++; + } } } }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/VerificationError.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/VerificationError.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ * This constructor creates a {@link VerificationError} with a message assembled via * {@link String#format(String, Object...)}. It always uses the ENGLISH locale in order to * always generate the same output. - * + * * @param msg the message that will be associated with the error, in String.format syntax * @param args parameters to String.format - parameters that implement {@link Iterable} will be * expanded into a [x, x, ...] representation.
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/spi/Simplifiable.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/spi/Simplifiable.java Mon Feb 23 16:23:23 2015 -0800 @@ -25,7 +25,7 @@ /** * This interface allows nodes to perform more complicated simplifications, in contrast to * {@link Canonicalizable}, which supports only replacing the current node. - * + * * Implementors of this interface need to be aware that they need to call * {@link SimplifierTool#addToWorkList(com.oracle.graal.graph.Node)} for each node that might be * influenced (in terms of simplification and canonicalization) by the actions performed in
--- a/graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/DataPatchInConstantsTest.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/DataPatchInConstantsTest.java Mon Feb 23 16:23:23 2015 -0800 @@ -155,7 +155,7 @@ @NodeInfo private static final class LoadThroughPatchNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<LoadThroughPatchNode> TYPE = NodeClass.get(LoadThroughPatchNode.class); + public static final NodeClass<LoadThroughPatchNode> TYPE = NodeClass.create(LoadThroughPatchNode.class); @Input protected ValueNode input; @@ -178,13 +178,15 @@ public static native Object load(Object obj); } - private static class LoadThroughPatchOp extends LIRInstructionBase { + private static final class LoadThroughPatchOp extends LIRInstruction { + public static final LIRInstructionClass<LoadThroughPatchOp> TYPE = LIRInstructionClass.create(LoadThroughPatchOp.class); final Constant c; final boolean compressed; @Def({REG}) AllocatableValue result; LoadThroughPatchOp(Constant c, boolean compressed, AllocatableValue result) { + super(TYPE); this.c = c; this.compressed = compressed; this.result = result;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DeoptimizeOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DeoptimizeOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -32,10 +32,12 @@ @Opcode("DEOPT") final class AMD64DeoptimizeOp extends AMD64LIRInstruction implements BlockEndOp { + public static final LIRInstructionClass<AMD64DeoptimizeOp> TYPE = LIRInstructionClass.create(AMD64DeoptimizeOp.class); @State private LIRFrameState info; AMD64DeoptimizeOp(LIRFrameState info) { + super(TYPE); this.info = info; }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCRuntimeCallEpilogueOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCRuntimeCallEpilogueOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -30,12 +30,14 @@ @Opcode("CRUNTIME_CALL_EPILOGUE") final class AMD64HotSpotCRuntimeCallEpilogueOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64HotSpotCRuntimeCallEpilogueOp> TYPE = LIRInstructionClass.create(AMD64HotSpotCRuntimeCallEpilogueOp.class); private final int threadLastJavaSpOffset; private final int threadLastJavaFpOffset; private final Register thread; public AMD64HotSpotCRuntimeCallEpilogueOp(int threadLastJavaSpOffset, int threadLastJavaFpOffset, Register thread) { + super(TYPE); this.threadLastJavaSpOffset = threadLastJavaSpOffset; this.threadLastJavaFpOffset = threadLastJavaFpOffset; this.thread = thread;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCRuntimeCallPrologueOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCRuntimeCallPrologueOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,11 +32,13 @@ @Opcode final class AMD64HotSpotCRuntimeCallPrologueOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64HotSpotCRuntimeCallPrologueOp> TYPE = LIRInstructionClass.create(AMD64HotSpotCRuntimeCallPrologueOp.class); private final int threadLastJavaSpOffset; private final Register thread; public AMD64HotSpotCRuntimeCallPrologueOp(int threadLastJavaSpOffset, Register thread) { + super(TYPE); this.threadLastJavaSpOffset = threadLastJavaSpOffset; this.thread = thread; }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCardTableAddressOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCardTableAddressOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -26,15 +26,18 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.amd64.*; import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.*; +import com.oracle.graal.lir.*; import com.oracle.graal.lir.amd64.*; import com.oracle.graal.lir.asm.*; import com.oracle.graal.hotspot.HotSpotGraalRuntime; -public class AMD64HotSpotCardTableAddressOp extends AMD64LIRInstruction { +public final class AMD64HotSpotCardTableAddressOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64HotSpotCardTableAddressOp> TYPE = LIRInstructionClass.create(AMD64HotSpotCardTableAddressOp.class); @Def({OperandFlag.REG}) private AllocatableValue result; public AMD64HotSpotCardTableAddressOp(AllocatableValue result) { + super(TYPE); this.result = result; }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCardTableShiftOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCardTableShiftOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -26,15 +26,18 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.amd64.*; import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.*; +import com.oracle.graal.lir.*; import com.oracle.graal.lir.amd64.*; import com.oracle.graal.lir.asm.*; import com.oracle.graal.hotspot.HotSpotGraalRuntime; -public class AMD64HotSpotCardTableShiftOp extends AMD64LIRInstruction { +public final class AMD64HotSpotCardTableShiftOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64HotSpotCardTableShiftOp> TYPE = LIRInstructionClass.create(AMD64HotSpotCardTableShiftOp.class); @Def({OperandFlag.REG, OperandFlag.ILLEGAL}) private AllocatableValue result; public AMD64HotSpotCardTableShiftOp(AllocatableValue result) { + super(TYPE); this.result = result; }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCompare.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCompare.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -39,12 +39,14 @@ public class AMD64HotSpotCompare { @Opcode("CMP") - public static class HotSpotCompareConstantOp extends AMD64LIRInstruction { + public static final class HotSpotCompareConstantOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<HotSpotCompareConstantOp> TYPE = LIRInstructionClass.create(HotSpotCompareConstantOp.class); @Use({REG}) protected AllocatableValue x; protected JavaConstant y; public HotSpotCompareConstantOp(AllocatableValue x, JavaConstant y) { + super(TYPE); this.x = x; this.y = y; } @@ -100,12 +102,13 @@ } @Opcode("CMP") - public static class HotSpotCompareMemoryConstantOp extends MemOp { + public static final class HotSpotCompareMemoryConstantOp extends MemOp { + public static final LIRInstructionClass<HotSpotCompareMemoryConstantOp> TYPE = LIRInstructionClass.create(HotSpotCompareMemoryConstantOp.class); protected JavaConstant y; public HotSpotCompareMemoryConstantOp(Kind kind, AMD64AddressValue x, JavaConstant y, LIRFrameState state) { - super(kind, x, state); + super(TYPE, kind, x, state); this.y = y; }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotDeoptimizeCallerOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotDeoptimizeCallerOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,6 +36,12 @@ @Opcode("DEOPT_CALLER") final class AMD64HotSpotDeoptimizeCallerOp extends AMD64HotSpotEpilogueOp implements BlockEndOp { + public static final LIRInstructionClass<AMD64HotSpotDeoptimizeCallerOp> TYPE = LIRInstructionClass.create(AMD64HotSpotDeoptimizeCallerOp.class); + + protected AMD64HotSpotDeoptimizeCallerOp() { + super(TYPE); + } + @Override public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { leaveFrameAndRestoreRbp(crb, masm);
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotEnterUnpackFramesStackFrameOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotEnterUnpackFramesStackFrameOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -42,6 +42,7 @@ */ @Opcode("ENTER_UNPACK_FRAMES_STACK_FRAME") final class AMD64HotSpotEnterUnpackFramesStackFrameOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64HotSpotEnterUnpackFramesStackFrameOp> TYPE = LIRInstructionClass.create(AMD64HotSpotEnterUnpackFramesStackFrameOp.class); private final Register threadRegister; private final int threadLastJavaSpOffset; @@ -55,6 +56,7 @@ AMD64HotSpotEnterUnpackFramesStackFrameOp(Register threadRegister, int threadLastJavaSpOffset, int threadLastJavaPcOffset, int threadLastJavaFpOffset, AllocatableValue framePc, AllocatableValue senderSp, AllocatableValue senderFp, SaveRegistersOp saveRegisterOp) { + super(TYPE); this.threadRegister = threadRegister; this.threadLastJavaSpOffset = threadLastJavaSpOffset; this.threadLastJavaPcOffset = threadLastJavaPcOffset;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotEpilogueOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotEpilogueOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,6 +38,10 @@ */ abstract class AMD64HotSpotEpilogueOp extends AMD64LIRInstruction { + protected AMD64HotSpotEpilogueOp(LIRInstructionClass<? extends AMD64HotSpotEpilogueOp> c) { + super(c); + } + /** * The type of location (i.e., stack or register) in which RBP is saved is not known until * initial LIR generation is finished. Until then, we use a placeholder variable so that LIR
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java Mon Feb 23 16:23:23 2015 -0800 @@ -27,6 +27,7 @@ import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.api.meta.Value.*; import static com.oracle.graal.hotspot.HotSpotBackend.*; +import static com.oracle.graal.hotspot.HotSpotBackend.Options.*; import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.*; import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.*; import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.Transition.*; @@ -61,8 +62,10 @@ register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF_NOFP, null, exceptionCc, NOT_REEXECUTABLE, ANY_LOCATION)); register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF_NOFP, exceptionCc, null, NOT_REEXECUTABLE, ANY_LOCATION)); - link(new AMD64DeoptimizationStub(providers, target, config, registerStubCall(DEOPTIMIZATION_HANDLER, REEXECUTABLE, LEAF, NO_LOCATIONS))); - link(new AMD64UncommonTrapStub(providers, target, config, registerStubCall(UNCOMMON_TRAP_HANDLER, REEXECUTABLE, LEAF, NO_LOCATIONS))); + if (PreferGraalStubs.getValue()) { + link(new AMD64DeoptimizationStub(providers, target, config, registerStubCall(DEOPTIMIZATION_HANDLER, REEXECUTABLE, LEAF, NO_LOCATIONS))); + link(new AMD64UncommonTrapStub(providers, target, config, registerStubCall(UNCOMMON_TRAP_HANDLER, REEXECUTABLE, LEAF, NO_LOCATIONS))); + } if (config.useCRC32Intrinsics) { // This stub does callee saving
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotJumpToExceptionHandlerInCallerOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotJumpToExceptionHandlerInCallerOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,6 +41,8 @@ @Opcode("JUMP_TO_EXCEPTION_HANDLER_IN_CALLER") final class AMD64HotSpotJumpToExceptionHandlerInCallerOp extends AMD64HotSpotEpilogueOp implements BlockEndOp { + public static final LIRInstructionClass<AMD64HotSpotJumpToExceptionHandlerInCallerOp> TYPE = LIRInstructionClass.create(AMD64HotSpotJumpToExceptionHandlerInCallerOp.class); + @Use(REG) AllocatableValue handlerInCallerPc; @Use(REG) AllocatableValue exception; @Use(REG) AllocatableValue exceptionPc; @@ -48,6 +50,7 @@ private final int isMethodHandleReturnOffset; AMD64HotSpotJumpToExceptionHandlerInCallerOp(AllocatableValue handlerInCallerPc, AllocatableValue exception, AllocatableValue exceptionPc, int isMethodHandleReturnOffset, Register thread) { + super(TYPE); this.handlerInCallerPc = handlerInCallerPc; this.exception = exception; this.exceptionPc = exceptionPc;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLeaveCurrentStackFrameOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLeaveCurrentStackFrameOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,9 +39,12 @@ @Opcode("LEAVE_CURRENT_STACK_FRAME") final class AMD64HotSpotLeaveCurrentStackFrameOp extends AMD64HotSpotEpilogueOp { + public static final LIRInstructionClass<AMD64HotSpotLeaveCurrentStackFrameOp> TYPE = LIRInstructionClass.create(AMD64HotSpotLeaveCurrentStackFrameOp.class); + private final SaveRegistersOp saveRegisterOp; public AMD64HotSpotLeaveCurrentStackFrameOp(SaveRegistersOp saveRegisterOp) { + super(TYPE); this.saveRegisterOp = saveRegisterOp; }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLeaveDeoptimizedStackFrameOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLeaveDeoptimizedStackFrameOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,10 +38,12 @@ @Opcode("LEAVE_DEOPTIMIZED_STACK_FRAME") final class AMD64HotSpotLeaveDeoptimizedStackFrameOp extends AMD64HotSpotEpilogueOp { + public static final LIRInstructionClass<AMD64HotSpotLeaveDeoptimizedStackFrameOp> TYPE = LIRInstructionClass.create(AMD64HotSpotLeaveDeoptimizedStackFrameOp.class); @Use(REG) AllocatableValue frameSize; @Use(REG) AllocatableValue framePointer; public AMD64HotSpotLeaveDeoptimizedStackFrameOp(AllocatableValue frameSize, AllocatableValue initialInfo) { + super(TYPE); this.frameSize = frameSize; this.framePointer = initialInfo; }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLeaveUnpackFramesStackFrameOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLeaveUnpackFramesStackFrameOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -38,6 +38,7 @@ */ @Opcode("LEAVE_UNPACK_FRAMES_STACK_FRAME") final class AMD64HotSpotLeaveUnpackFramesStackFrameOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64HotSpotLeaveUnpackFramesStackFrameOp> TYPE = LIRInstructionClass.create(AMD64HotSpotLeaveUnpackFramesStackFrameOp.class); private final Register threadRegister; private final int threadLastJavaSpOffset; @@ -47,6 +48,7 @@ private final SaveRegistersOp saveRegisterOp; AMD64HotSpotLeaveUnpackFramesStackFrameOp(Register threadRegister, int threadLastJavaSpOffset, int threadLastJavaPcOffset, int threadLastJavaFpOffset, SaveRegistersOp saveRegisterOp) { + super(TYPE); this.threadRegister = threadRegister; this.threadLastJavaSpOffset = threadLastJavaSpOffset; this.threadLastJavaPcOffset = threadLastJavaPcOffset;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotMove.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotMove.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -43,12 +43,14 @@ public class AMD64HotSpotMove { - public static class HotSpotLoadConstantOp extends AMD64LIRInstruction implements MoveOp { + public static final class HotSpotLoadConstantOp extends AMD64LIRInstruction implements MoveOp { + public static final LIRInstructionClass<HotSpotLoadConstantOp> TYPE = LIRInstructionClass.create(HotSpotLoadConstantOp.class); @Def({REG, STACK}) private AllocatableValue result; private final JavaConstant input; public HotSpotLoadConstantOp(AllocatableValue result, JavaConstant input) { + super(TYPE); this.result = result; this.input = input; } @@ -145,9 +147,10 @@ } public static class HotSpotStoreConstantOp extends StoreConstantOp { + public static final LIRInstructionClass<HotSpotStoreConstantOp> TYPE = LIRInstructionClass.create(HotSpotStoreConstantOp.class); public HotSpotStoreConstantOp(Kind kind, AMD64AddressValue address, JavaConstant input, LIRFrameState state) { - super(kind, address, input, state); + super(TYPE, kind, address, input, state); } @Override @@ -181,7 +184,8 @@ } } - public static class CompressPointer extends AMD64LIRInstruction { + public static final class CompressPointer extends AMD64LIRInstruction { + public static final LIRInstructionClass<CompressPointer> TYPE = LIRInstructionClass.create(CompressPointer.class); private final CompressEncoding encoding; private final boolean nonNull; @@ -191,6 +195,7 @@ @Alive({REG, ILLEGAL}) protected AllocatableValue baseRegister; public CompressPointer(AllocatableValue result, AllocatableValue input, AllocatableValue baseRegister, CompressEncoding encoding, boolean nonNull) { + super(TYPE); this.result = result; this.input = input; this.baseRegister = baseRegister; @@ -218,7 +223,8 @@ } } - public static class UncompressPointer extends AMD64LIRInstruction { + public static final class UncompressPointer extends AMD64LIRInstruction { + public static final LIRInstructionClass<UncompressPointer> TYPE = LIRInstructionClass.create(UncompressPointer.class); private final CompressEncoding encoding; private final boolean nonNull; @@ -228,6 +234,7 @@ @Alive({REG, ILLEGAL}) protected AllocatableValue baseRegister; public UncompressPointer(AllocatableValue result, AllocatableValue input, AllocatableValue baseRegister, CompressEncoding encoding, boolean nonNull) { + super(TYPE); this.result = result; this.input = input; this.baseRegister = baseRegister; @@ -274,12 +281,14 @@ } } - public static class CompressedNullCheckOp extends AMD64LIRInstruction { + public static final class CompressedNullCheckOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<CompressedNullCheckOp> TYPE = LIRInstructionClass.create(CompressedNullCheckOp.class); @Use({COMPOSITE}) protected AMD64AddressValue address; @State protected LIRFrameState state; public CompressedNullCheckOp(AMD64AddressValue address, LIRFrameState state) { + super(TYPE); this.address = address; this.state = state; }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotPatchReturnAddressOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotPatchReturnAddressOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -37,10 +37,12 @@ */ @Opcode("PATCH_RETURN") final class AMD64HotSpotPatchReturnAddressOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64HotSpotPatchReturnAddressOp> TYPE = LIRInstructionClass.create(AMD64HotSpotPatchReturnAddressOp.class); @Use(REG) AllocatableValue address; AMD64HotSpotPatchReturnAddressOp(AllocatableValue address) { + super(TYPE); this.address = address; }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotPushInterpreterFrameOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotPushInterpreterFrameOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,6 +39,7 @@ */ @Opcode("PUSH_INTERPRETER_FRAME") final class AMD64HotSpotPushInterpreterFrameOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64HotSpotPushInterpreterFrameOp> TYPE = LIRInstructionClass.create(AMD64HotSpotPushInterpreterFrameOp.class); @Alive(REG) AllocatableValue frameSize; @Alive(REG) AllocatableValue framePc; @@ -47,6 +48,7 @@ private final HotSpotVMConfig config; AMD64HotSpotPushInterpreterFrameOp(AllocatableValue frameSize, AllocatableValue framePc, AllocatableValue senderSp, AllocatableValue initialInfo, HotSpotVMConfig config) { + super(TYPE); this.frameSize = frameSize; this.framePc = framePc; this.senderSp = senderSp;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotReturnOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotReturnOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,12 +38,14 @@ @Opcode("RETURN") final class AMD64HotSpotReturnOp extends AMD64HotSpotEpilogueOp implements BlockEndOp { + public static final LIRInstructionClass<AMD64HotSpotReturnOp> TYPE = LIRInstructionClass.create(AMD64HotSpotReturnOp.class); @Use({REG, ILLEGAL}) protected Value value; private final boolean isStub; private final Register scratchForSafepointOnReturn; private final HotSpotVMConfig config; AMD64HotSpotReturnOp(Value value, boolean isStub, Register scratchForSafepointOnReturn, HotSpotVMConfig config) { + super(TYPE); this.value = value; this.isStub = isStub; this.scratchForSafepointOnReturn = scratchForSafepointOnReturn;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotSafepointOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotSafepointOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -40,7 +40,8 @@ * Emits a safepoint poll. */ @Opcode("SAFEPOINT") -public class AMD64HotSpotSafepointOp extends AMD64LIRInstruction { +public final class AMD64HotSpotSafepointOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64HotSpotSafepointOp> TYPE = LIRInstructionClass.create(AMD64HotSpotSafepointOp.class); @State protected LIRFrameState state; @Temp({OperandFlag.REG, OperandFlag.ILLEGAL}) private AllocatableValue temp; @@ -48,6 +49,7 @@ private final HotSpotVMConfig config; public AMD64HotSpotSafepointOp(LIRFrameState state, HotSpotVMConfig config, NodeLIRBuilderTool tool) { + super(TYPE); this.state = state; this.config = config; if (isPollingPageFar(config) || ImmutableCode.getValue()) {
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotUnwindOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotUnwindOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,10 +40,12 @@ */ @Opcode("UNWIND") final class AMD64HotSpotUnwindOp extends AMD64HotSpotEpilogueOp implements BlockEndOp { + public static final LIRInstructionClass<AMD64HotSpotUnwindOp> TYPE = LIRInstructionClass.create(AMD64HotSpotUnwindOp.class); @Use({REG}) protected RegisterValue exception; AMD64HotSpotUnwindOp(RegisterValue exception) { + super(TYPE); this.exception = exception; }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -36,11 +36,12 @@ */ @Opcode("CALL_DIRECT") final class AMD64HotspotDirectStaticCallOp extends DirectCallOp { + public static final LIRInstructionClass<AMD64HotspotDirectStaticCallOp> TYPE = LIRInstructionClass.create(AMD64HotspotDirectStaticCallOp.class); private final InvokeKind invokeKind; AMD64HotspotDirectStaticCallOp(ResolvedJavaMethod target, Value result, Value[] parameters, Value[] temps, LIRFrameState state, InvokeKind invokeKind) { - super(target, result, parameters, temps, state); + super(TYPE, target, result, parameters, temps, state); assert invokeKind.isDirect(); this.invokeKind = invokeKind; }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectVirtualCallOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectVirtualCallOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -28,7 +28,7 @@ import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.meta.HotSpotCodeCacheProvider.MarkId; import com.oracle.graal.lir.*; -import com.oracle.graal.lir.amd64.AMD64Call.DirectCallOp; +import com.oracle.graal.lir.amd64.AMD64Call.*; import com.oracle.graal.lir.asm.*; import com.oracle.graal.nodes.CallTargetNode.InvokeKind; @@ -38,12 +38,13 @@ */ @Opcode("CALL_DIRECT") final class AMD64HotspotDirectVirtualCallOp extends DirectCallOp { + public static final LIRInstructionClass<AMD64HotspotDirectVirtualCallOp> TYPE = LIRInstructionClass.create(AMD64HotspotDirectVirtualCallOp.class); private final InvokeKind invokeKind; private final HotSpotVMConfig config; AMD64HotspotDirectVirtualCallOp(ResolvedJavaMethod target, Value result, Value[] parameters, Value[] temps, LIRFrameState state, InvokeKind invokeKind, HotSpotVMConfig config) { - super(target, result, parameters, temps, state); + super(TYPE, target, result, parameters, temps, state); this.invokeKind = invokeKind; this.config = config; assert invokeKind.isIndirect();
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64IndirectCallOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64IndirectCallOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -43,6 +43,7 @@ */ @Opcode("CALL_INDIRECT") final class AMD64IndirectCallOp extends IndirectCallOp { + public static final LIRInstructionClass<AMD64IndirectCallOp> TYPE = LIRInstructionClass.create(AMD64IndirectCallOp.class); /** * Vtable stubs expect the metaspace Method in RBX. @@ -52,7 +53,7 @@ @Use({REG}) protected Value metaspaceMethod; AMD64IndirectCallOp(ResolvedJavaMethod targetMethod, Value result, Value[] parameters, Value[] temps, Value metaspaceMethod, Value targetAddress, LIRFrameState state) { - super(targetMethod, result, parameters, temps, targetAddress, state); + super(TYPE, targetMethod, result, parameters, temps, targetAddress, state); this.metaspaceMethod = metaspaceMethod; }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64PrefetchOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64PrefetchOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -27,15 +27,18 @@ import com.oracle.graal.asm.amd64.*; import com.oracle.graal.compiler.common.*; +import com.oracle.graal.lir.*; import com.oracle.graal.lir.amd64.*; import com.oracle.graal.lir.asm.*; -public class AMD64PrefetchOp extends AMD64LIRInstruction { +public final class AMD64PrefetchOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64PrefetchOp> TYPE = LIRInstructionClass.create(AMD64PrefetchOp.class); private final int instr; // AllocatePrefetchInstr @Alive({COMPOSITE}) protected AMD64AddressValue address; public AMD64PrefetchOp(AMD64AddressValue address, int instr) { + super(TYPE); this.address = address; this.instr = instr; }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64RawNativeCallNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64RawNativeCallNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo public final class AMD64RawNativeCallNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<AMD64RawNativeCallNode> TYPE = NodeClass.get(AMD64RawNativeCallNode.class); + public static final NodeClass<AMD64RawNativeCallNode> TYPE = NodeClass.create(AMD64RawNativeCallNode.class); protected final JavaConstant functionPointer; @Input NodeInputList<ValueNode> args;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64TailcallOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64TailcallOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -36,12 +36,14 @@ * {@link InstalledCode} instance. */ @Opcode("TAILCALL") -public class AMD64TailcallOp extends AMD64LIRInstruction { +public final class AMD64TailcallOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64TailcallOp> TYPE = LIRInstructionClass.create(AMD64TailcallOp.class); @Use protected Value target; @Alive protected Value[] parameters; public AMD64TailcallOp(Value[] parameters, Value target) { + super(TYPE); this.target = target; this.parameters = parameters; }
--- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/InvocationSocket.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/InvocationSocket.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ /** * A collection of java.lang.reflect proxies that communicate over a socket connection. - * + * * Calling a method sends the method name and the parameters through the socket. Afterwards this * class waits for a result. While waiting for a result three types of objects can arrive through * the socket: a method invocation, a method result or an exception. Method invocation can thus be @@ -83,7 +83,7 @@ /** * Represents one invocation of a method that is transferred via the socket connection. - * + * */ private static class Invocation implements Serializable { @@ -102,7 +102,7 @@ /** * Represents the result of an invocation that is transferred via the socket connection. - * + * */ private static class Result implements Serializable { @@ -130,7 +130,7 @@ * Each instance of this class handles remote invocations for one instance of a Remote class. It * will forward all interface methods to the other end of the socket and cache the results of * calls to certain methods. - * + * */ public class Handler implements InvocationHandler {
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCDeoptimizeOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCDeoptimizeOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -32,10 +32,12 @@ @Opcode("DEOPT") final class SPARCDeoptimizeOp extends SPARCLIRInstruction implements BlockEndOp { + public static final LIRInstructionClass<SPARCDeoptimizeOp> TYPE = LIRInstructionClass.create(SPARCDeoptimizeOp.class); @State private LIRFrameState info; SPARCDeoptimizeOp(LIRFrameState info) { + super(TYPE); this.info = info; }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Mon Feb 23 16:23:23 2015 -0800 @@ -273,7 +273,7 @@ } private static void resetDelayedControlTransfers(LIR lir) { - for (AbstractBlock<?> block : lir.codeEmittingOrder()) { + for (AbstractBlockBase<?> block : lir.codeEmittingOrder()) { for (LIRInstruction inst : lir.getLIRforBlock(block)) { if (inst instanceof SPARCDelayedControlTransfer) { ((SPARCDelayedControlTransfer) inst).resetState(); @@ -285,11 +285,11 @@ /** * Fix-up over whole LIR. * - * @see #stuffDelayedControlTransfers(LIR, AbstractBlock) + * @see #stuffDelayedControlTransfers(LIR, AbstractBlockBase) * @param l */ private static void stuffDelayedControlTransfers(LIR l) { - for (AbstractBlock<?> b : l.codeEmittingOrder()) { + for (AbstractBlockBase<?> b : l.codeEmittingOrder()) { stuffDelayedControlTransfers(l, b); } } @@ -299,7 +299,7 @@ * it tries to move the DelayedLIRInstruction to the DelayedControlTransfer instruction, if * possible. */ - private static void stuffDelayedControlTransfers(LIR l, AbstractBlock<?> block) { + private static void stuffDelayedControlTransfers(LIR l, AbstractBlockBase<?> block) { List<LIRInstruction> instructions = l.getLIRforBlock(block); if (instructions.size() >= 2) { LIRDependencyAccumulator acc = new LIRDependencyAccumulator();
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java Mon Feb 23 16:23:23 2015 -0800 @@ -93,10 +93,14 @@ @SuppressWarnings("unused") private static Value[] createNativeABICallerSaveRegisters(HotSpotVMConfig config, RegisterConfig regConfig) { - CalleeSaveLayout csl = regConfig.getCalleeSaveLayout(); - Value[] nativeABICallerSaveRegisters = new Value[csl.registers.length]; - for (int i = 0; i < csl.registers.length; i++) { - nativeABICallerSaveRegisters[i] = csl.registers[i].asValue(); + List<Register> callerSaveRegisters = new ArrayList<>(); + Collections.addAll(callerSaveRegisters, regConfig.getCallerSaveRegisters()); + // TODO: Saving callee saved registers as well seems unneccessary, however as of now it does + // not work without; needs further investigation + Collections.addAll(callerSaveRegisters, regConfig.getCalleeSaveLayout().registers); + Value[] nativeABICallerSaveRegisters = new Value[callerSaveRegisters.size()]; + for (int i = 0; i < callerSaveRegisters.size(); i++) { + nativeABICallerSaveRegisters[i] = callerSaveRegisters.get(i).asValue(); } return nativeABICallerSaveRegisters; }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotCRuntimeCallEpilogueOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotCRuntimeCallEpilogueOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -36,6 +36,7 @@ @Opcode("CRUNTIME_CALL_EPILOGUE") final class SPARCHotSpotCRuntimeCallEpilogueOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<SPARCHotSpotCRuntimeCallEpilogueOp> TYPE = LIRInstructionClass.create(SPARCHotSpotCRuntimeCallEpilogueOp.class); private final int threadLastJavaSpOffset; private final int threadLastJavaPcOffset; @@ -44,6 +45,7 @@ @Use({REG, STACK}) protected Value threadTemp; public SPARCHotSpotCRuntimeCallEpilogueOp(int threadLastJavaSpOffset, int threadLastJavaPcOffset, int threadJavaFrameAnchorFlagsOffset, Register thread, Value threadTemp) { + super(TYPE); this.threadLastJavaSpOffset = threadLastJavaSpOffset; this.threadLastJavaPcOffset = threadLastJavaPcOffset; this.threadJavaFrameAnchorFlagsOffset = threadJavaFrameAnchorFlagsOffset;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotCRuntimeCallPrologueOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotCRuntimeCallPrologueOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,6 +36,7 @@ @Opcode("CRUNTIME_CALL_PROLOGUE") final class SPARCHotSpotCRuntimeCallPrologueOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<SPARCHotSpotCRuntimeCallPrologueOp> TYPE = LIRInstructionClass.create(SPARCHotSpotCRuntimeCallPrologueOp.class); private final int threadLastJavaSpOffset; private final Register thread; @@ -43,6 +44,7 @@ @Def({REG, STACK}) protected Value threadTemp; public SPARCHotSpotCRuntimeCallPrologueOp(int threadLastJavaSpOffset, Register thread, Register stackPointer, Value threadTemp) { + super(TYPE); this.threadLastJavaSpOffset = threadLastJavaSpOffset; this.thread = thread; this.stackPointer = stackPointer;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotDeoptimizeCallerOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotDeoptimizeCallerOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,6 +36,11 @@ */ @Opcode("DEOPT_CALLER") final class SPARCHotSpotDeoptimizeCallerOp extends SPARCHotSpotEpilogueOp { + public static final LIRInstructionClass<SPARCHotSpotDeoptimizeCallerOp> TYPE = LIRInstructionClass.create(SPARCHotSpotDeoptimizeCallerOp.class); + + protected SPARCHotSpotDeoptimizeCallerOp() { + super(TYPE); + } @Override public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotEnterUnpackFramesStackFrameOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotEnterUnpackFramesStackFrameOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -41,6 +41,7 @@ */ @Opcode("ENTER_UNPACK_FRAMES_STACK_FRAME") final class SPARCHotSpotEnterUnpackFramesStackFrameOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<SPARCHotSpotEnterUnpackFramesStackFrameOp> TYPE = LIRInstructionClass.create(SPARCHotSpotEnterUnpackFramesStackFrameOp.class); private final Register thread; private final int threadLastJavaSpOffset; @@ -50,6 +51,7 @@ @Temp(REG) AllocatableValue scratch; SPARCHotSpotEnterUnpackFramesStackFrameOp(Register thread, int threadLastJavaSpOffset, int threadLastJavaPcOffset, AllocatableValue framePc, AllocatableValue senderSp, AllocatableValue scratch) { + super(TYPE); this.thread = thread; this.threadLastJavaSpOffset = threadLastJavaSpOffset; this.threadLastJavaPcOffset = threadLastJavaPcOffset;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotEpilogueOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotEpilogueOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -22,6 +22,7 @@ */ package com.oracle.graal.hotspot.sparc; +import com.oracle.graal.lir.*; import com.oracle.graal.lir.StandardOp.BlockEndOp; import com.oracle.graal.lir.asm.*; import com.oracle.graal.lir.sparc.*; @@ -30,6 +31,11 @@ * Superclass for operations that leave a method's frame. */ abstract class SPARCHotSpotEpilogueOp extends SPARCLIRInstruction implements BlockEndOp { + public static final LIRInstructionClass<SPARCHotSpotEpilogueOp> TYPE = LIRInstructionClass.create(SPARCHotSpotEpilogueOp.class); + + protected SPARCHotSpotEpilogueOp(LIRInstructionClass<? extends LIRInstruction> c) { + super(c); + } protected void leaveFrame(CompilationResultBuilder crb) { crb.frameContext.leave(crb);
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java Mon Feb 23 16:23:23 2015 -0800 @@ -24,6 +24,8 @@ import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.api.meta.Value.*; +import static com.oracle.graal.hotspot.HotSpotBackend.*; +import static com.oracle.graal.hotspot.HotSpotBackend.Options.*; import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.*; import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.*; import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.Transition.*; @@ -61,8 +63,10 @@ register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF_NOFP, outgoingExceptionCc, incomingExceptionCc, NOT_REEXECUTABLE, ANY_LOCATION)); register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF_NOFP, outgoingExceptionCc, incomingExceptionCc, NOT_REEXECUTABLE, ANY_LOCATION)); - link(new SPARCDeoptimizationStub(providers, target, registerStubCall(DEOPTIMIZATION_HANDLER, REEXECUTABLE, LEAF, NO_LOCATIONS))); - link(new SPARCUncommonTrapStub(providers, target, registerStubCall(UNCOMMON_TRAP_HANDLER, REEXECUTABLE, LEAF, NO_LOCATIONS))); + if (PreferGraalStubs.getValue()) { + link(new SPARCDeoptimizationStub(providers, target, registerStubCall(DEOPTIMIZATION_HANDLER, REEXECUTABLE, LEAF, NO_LOCATIONS))); + link(new SPARCUncommonTrapStub(providers, target, registerStubCall(UNCOMMON_TRAP_HANDLER, REEXECUTABLE, LEAF, NO_LOCATIONS))); + } super.initialize(providers, config); }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotJumpToExceptionHandlerInCallerOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotJumpToExceptionHandlerInCallerOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -47,6 +47,8 @@ @Opcode("JUMP_TO_EXCEPTION_HANDLER_IN_CALLER") final class SPARCHotSpotJumpToExceptionHandlerInCallerOp extends SPARCHotSpotEpilogueOp { + public static final LIRInstructionClass<SPARCHotSpotJumpToExceptionHandlerInCallerOp> TYPE = LIRInstructionClass.create(SPARCHotSpotJumpToExceptionHandlerInCallerOp.class); + @Use(REG) AllocatableValue handlerInCallerPc; @Use(REG) AllocatableValue exception; @Use(REG) AllocatableValue exceptionPc; @@ -54,6 +56,7 @@ private final int isMethodHandleReturnOffset; SPARCHotSpotJumpToExceptionHandlerInCallerOp(AllocatableValue handlerInCallerPc, AllocatableValue exception, AllocatableValue exceptionPc, int isMethodHandleReturnOffset, Register thread) { + super(TYPE); this.handlerInCallerPc = handlerInCallerPc; this.exception = exception; this.exceptionPc = exceptionPc;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLeaveCurrentStackFrameOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLeaveCurrentStackFrameOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -35,8 +35,10 @@ */ @Opcode("LEAVE_CURRENT_STACK_FRAME") final class SPARCHotSpotLeaveCurrentStackFrameOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<SPARCHotSpotLeaveCurrentStackFrameOp> TYPE = LIRInstructionClass.create(SPARCHotSpotLeaveCurrentStackFrameOp.class); public SPARCHotSpotLeaveCurrentStackFrameOp() { + super(TYPE); } @Override
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLeaveDeoptimizedStackFrameOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLeaveDeoptimizedStackFrameOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -36,6 +36,12 @@ @Opcode("LEAVE_DEOPTIMIZED_STACK_FRAME") final class SPARCHotSpotLeaveDeoptimizedStackFrameOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<SPARCHotSpotLeaveDeoptimizedStackFrameOp> TYPE = LIRInstructionClass.create(SPARCHotSpotLeaveDeoptimizedStackFrameOp.class); + + protected SPARCHotSpotLeaveDeoptimizedStackFrameOp() { + super(TYPE); + } + @Override public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { // Save O registers over restore.
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLeaveUnpackFramesStackFrameOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLeaveUnpackFramesStackFrameOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -38,6 +38,7 @@ */ @Opcode("LEAVE_UNPACK_FRAMES_STACK_FRAME") final class SPARCHotSpotLeaveUnpackFramesStackFrameOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<SPARCHotSpotLeaveUnpackFramesStackFrameOp> TYPE = LIRInstructionClass.create(SPARCHotSpotLeaveUnpackFramesStackFrameOp.class); private final Register thread; private final int threadLastJavaSpOffset; @@ -45,6 +46,7 @@ private final int threadJavaFrameAnchorFlagsOffset; SPARCHotSpotLeaveUnpackFramesStackFrameOp(Register thread, int threadLastJavaSpOffset, int threadLastJavaPcOffset, int threadJavaFrameAnchorFlagsOffset) { + super(TYPE); this.thread = thread; this.threadLastJavaSpOffset = threadLastJavaSpOffset; this.threadLastJavaPcOffset = threadLastJavaPcOffset;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotPatchReturnAddressOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotPatchReturnAddressOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -39,10 +39,12 @@ */ @Opcode("PATCH_RETURN") final class SPARCHotSpotPatchReturnAddressOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<SPARCHotSpotPatchReturnAddressOp> TYPE = LIRInstructionClass.create(SPARCHotSpotPatchReturnAddressOp.class); @Use(REG) AllocatableValue address; SPARCHotSpotPatchReturnAddressOp(AllocatableValue address) { + super(TYPE); this.address = address; }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotPushInterpreterFrameOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotPushInterpreterFrameOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -39,6 +39,7 @@ */ @Opcode("PUSH_INTERPRETER_FRAME") final class SPARCHotSpotPushInterpreterFrameOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<SPARCHotSpotPushInterpreterFrameOp> TYPE = LIRInstructionClass.create(SPARCHotSpotPushInterpreterFrameOp.class); @Alive(REG) AllocatableValue frameSize; @Alive(REG) AllocatableValue framePc; @@ -46,6 +47,7 @@ @Alive(REG) AllocatableValue initialInfo; SPARCHotSpotPushInterpreterFrameOp(AllocatableValue frameSize, AllocatableValue framePc, AllocatableValue senderSp, AllocatableValue initialInfo) { + super(TYPE); this.frameSize = frameSize; this.framePc = framePc; this.senderSp = senderSp;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRegisterConfig.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRegisterConfig.java Mon Feb 23 16:23:23 2015 -0800 @@ -92,7 +92,8 @@ private final Register[] fpuParameterRegisters = {f0, f1, f2, f3, f4, f5, f6, f7}; // @formatter:off private final Register[] callerSaveRegisters = - {g1, g3, g4, g5, o0, o1, o2, o3, o4, o5, o7, + {g1, g2, g3, g4, g5, g6, g7, + o0, o1, o2, o3, o4, o5, o7, f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23,
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotReturnOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotReturnOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -37,12 +37,14 @@ */ @Opcode("RETURN") final class SPARCHotSpotReturnOp extends SPARCHotSpotEpilogueOp { + public static final LIRInstructionClass<SPARCHotSpotReturnOp> TYPE = LIRInstructionClass.create(SPARCHotSpotReturnOp.class); @Use({REG, ILLEGAL}) protected Value value; private final boolean isStub; private final HotSpotVMConfig config; SPARCHotSpotReturnOp(Value value, boolean isStub, HotSpotVMConfig config) { + super(TYPE); this.value = value; this.isStub = isStub; this.config = config;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotSafepointOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotSafepointOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -43,6 +43,7 @@ */ @Opcode("SAFEPOINT") public class SPARCHotSpotSafepointOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<SPARCHotSpotSafepointOp> TYPE = LIRInstructionClass.create(SPARCHotSpotSafepointOp.class); @State protected LIRFrameState state; @SuppressFBWarnings(value = "BC_IMPOSSIBLE_CAST", justification = "changed by the register allocator") @Temp({OperandFlag.REG}) private AllocatableValue temp; @@ -50,9 +51,10 @@ private final HotSpotVMConfig config; public SPARCHotSpotSafepointOp(LIRFrameState state, HotSpotVMConfig config, LIRGeneratorTool tool) { + super(TYPE); this.state = state; this.config = config; - temp = tool.newVariable(LIRKind.value(tool.target().wordKind)); + this.temp = tool.newVariable(LIRKind.value(tool.target().wordKind)); } @Override
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotUnwindOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotUnwindOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -41,10 +41,12 @@ */ @Opcode("UNWIND") final class SPARCHotSpotUnwindOp extends SPARCHotSpotEpilogueOp { + public static final LIRInstructionClass<SPARCHotSpotUnwindOp> TYPE = LIRInstructionClass.create(SPARCHotSpotUnwindOp.class); @Use({REG}) protected RegisterValue exception; SPARCHotSpotUnwindOp(RegisterValue exception) { + super(TYPE); this.exception = exception; }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectStaticCallOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectStaticCallOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -36,11 +36,12 @@ */ @Opcode("CALL_DIRECT") final class SPARCHotspotDirectStaticCallOp extends DirectCallOp { + public static final LIRInstructionClass<SPARCHotspotDirectStaticCallOp> TYPE = LIRInstructionClass.create(SPARCHotspotDirectStaticCallOp.class); private final InvokeKind invokeKind; SPARCHotspotDirectStaticCallOp(ResolvedJavaMethod target, Value result, Value[] parameters, Value[] temps, LIRFrameState state, InvokeKind invokeKind) { - super(target, result, parameters, temps, state); + super(TYPE, target, result, parameters, temps, state); assert invokeKind.isDirect(); this.invokeKind = invokeKind; }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectVirtualCallOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectVirtualCallOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -41,12 +41,13 @@ */ @Opcode("CALL_DIRECT") final class SPARCHotspotDirectVirtualCallOp extends DirectCallOp { + public static final LIRInstructionClass<SPARCHotspotDirectVirtualCallOp> TYPE = LIRInstructionClass.create(SPARCHotspotDirectVirtualCallOp.class); private final InvokeKind invokeKind; private final HotSpotVMConfig config; SPARCHotspotDirectVirtualCallOp(ResolvedJavaMethod target, Value result, Value[] parameters, Value[] temps, LIRFrameState state, InvokeKind invokeKind, HotSpotVMConfig config) { - super(target, result, parameters, temps, state); + super(TYPE, target, result, parameters, temps, state); this.invokeKind = invokeKind; this.config = config; assert invokeKind.isIndirect();
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCIndirectCallOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCIndirectCallOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -43,6 +43,7 @@ */ @Opcode("CALL_INDIRECT") final class SPARCIndirectCallOp extends IndirectCallOp { + public static final LIRInstructionClass<SPARCIndirectCallOp> TYPE = LIRInstructionClass.create(SPARCIndirectCallOp.class); /** * Vtable stubs expect the metaspace Method in g5. @@ -52,7 +53,7 @@ @Use({REG}) protected Value metaspaceMethod; SPARCIndirectCallOp(ResolvedJavaMethod targetMethod, Value result, Value[] parameters, Value[] temps, Value metaspaceMethod, Value targetAddress, LIRFrameState state) { - super(targetMethod, result, parameters, temps, targetAddress, state); + super(TYPE, targetMethod, result, parameters, temps, targetAddress, state); this.metaspaceMethod = metaspaceMethod; }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCPrefetchOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCPrefetchOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -27,15 +27,18 @@ import com.oracle.graal.asm.sparc.SPARCAssembler.Prefetch; import com.oracle.graal.asm.sparc.*; +import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; import com.oracle.graal.lir.sparc.*; -public class SPARCPrefetchOp extends SPARCLIRInstruction { +public final class SPARCPrefetchOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<SPARCPrefetchOp> TYPE = LIRInstructionClass.create(SPARCPrefetchOp.class); private final int instr; // AllocatePrefetchInstr @Alive({COMPOSITE}) protected SPARCAddressValue address; public SPARCPrefetchOp(SPARCAddressValue address, int instr) { + super(TYPE); this.address = address; this.instr = instr; }
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/DataPatchTest.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/DataPatchTest.java Mon Feb 23 16:23:23 2015 -0800 @@ -95,7 +95,7 @@ @NodeInfo private static final class ConstantFoldBarrier extends FloatingNode implements LIRLowerable { - public static final NodeClass<ConstantFoldBarrier> TYPE = NodeClass.get(ConstantFoldBarrier.class); + public static final NodeClass<ConstantFoldBarrier> TYPE = NodeClass.create(ConstantFoldBarrier.class); @Input protected ValueNode input; public ConstantFoldBarrier(ValueNode input) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Mon Feb 23 16:23:23 2015 -0800 @@ -42,6 +42,7 @@ import com.oracle.graal.lir.StandardOp.SaveRegistersOp; import com.oracle.graal.lir.framemap.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.options.*; import com.oracle.graal.phases.tiers.*; import com.oracle.graal.word.*; @@ -50,6 +51,13 @@ */ public abstract class HotSpotBackend extends Backend { + public static class Options { + // @formatter:off + @Option(help = "Use Graal stubs instead of HotSpot stubs where possible") + public static final OptionValue<Boolean> PreferGraalStubs = new OptionValue<>(false); + // @formatter:on + } + /** * Descriptor for {@link ExceptionHandlerStub}. This stub is called by the * {@linkplain HotSpotVMConfig#codeInstallerMarkIdExceptionHandlerEntry exception handler} in a @@ -164,7 +172,7 @@ } } }; - for (AbstractBlock<?> block : lir.codeEmittingOrder()) { + for (AbstractBlockBase<?> block : lir.codeEmittingOrder()) { for (LIRInstruction op : lir.getLIRforBlock(block)) { if (op instanceof LabelOp) { // Don't consider this as a definition
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,6 +33,7 @@ import com.oracle.graal.hotspot.stubs.*; import com.oracle.graal.java.*; import com.oracle.graal.nodes.spi.*; +import com.oracle.graal.replacements.*; /** * Common functionality of HotSpot host backends. @@ -40,12 +41,16 @@ public abstract class HotSpotHostBackend extends HotSpotBackend { /** - * Descriptor for {@link DeoptimizationStub#deoptimizationHandler}. + * Descriptor for {@code SharedRuntime::deopt_blob()->unpack()} or + * {@link DeoptimizationStub#deoptimizationHandler} depending on + * {@link HotSpotBackend.Options#PreferGraalStubs}. */ - public static final ForeignCallDescriptor DEOPTIMIZATION_HANDLER = new ForeignCallDescriptor("deoptimizationHandler", void.class); + public static final ForeignCallDescriptor DEOPTIMIZATION_HANDLER = new ForeignCallDescriptor("deoptHandler", void.class); /** - * Descriptor for {@link UncommonTrapStub#uncommonTrapHandler}. + * Descriptor for {@code SharedRuntime::deopt_blob()->uncommon_trap()} or + * {@link UncommonTrapStub#uncommonTrapHandler} depending on + * {@link HotSpotBackend.Options#PreferGraalStubs}. */ public static final ForeignCallDescriptor UNCOMMON_TRAP_HANDLER = new ForeignCallDescriptor("uncommonTrapHandler", void.class); @@ -69,7 +74,7 @@ try (InitTimer st = timer("graphBuilderPlugins.initialize")) { GraphBuilderPhase phase = (GraphBuilderPhase) providers.getSuites().getDefaultGraphBuilderSuite().findPhase(GraphBuilderPhase.class).previous(); InvocationPlugins plugins = phase.getGraphBuilderConfig().getInvocationPlugins(); - registerInvocationPlugins(providers.getMetaAccess(), plugins); + registerInvocationPlugins(providers, plugins); } try (InitTimer st = timer("foreignCalls.initialize")) { @@ -101,8 +106,8 @@ } } - protected void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { - StandardGraphBuilderPlugins.registerInvocationPlugins(metaAccess, plugins); - HotSpotGraphBuilderPlugins.registerInvocationPlugins(metaAccess, plugins); + protected void registerInvocationPlugins(HotSpotProviders providers, InvocationPlugins plugins) { + StandardGraphBuilderPlugins.registerInvocationPlugins(providers.getMetaAccess(), plugins); + HotSpotGraphBuilderPlugins.registerInvocationPlugins(providers, plugins); } }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Mon Feb 23 16:23:23 2015 -0800 @@ -1345,6 +1345,9 @@ @HotSpotVMField(name = "CodeBlob::_code_offset", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable private int codeBlobCodeOffsetOffset; @HotSpotVMField(name = "SharedRuntime::_ic_miss_blob", type = "RuntimeStub*", get = HotSpotVMField.Type.VALUE) @Stable private long inlineCacheMissBlob; + @HotSpotVMValue(expression = "SharedRuntime::deopt_blob()->unpack()", get = HotSpotVMValue.Type.ADDRESS) @Stable public long handleDeoptStub; + @HotSpotVMValue(expression = "SharedRuntime::deopt_blob()->uncommon_trap()", get = HotSpotVMValue.Type.ADDRESS) @Stable public long uncommonTrapStub; + private final long inlineCacheMissStub; public long inlineCacheMissStub() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Mon Feb 23 16:23:23 2015 -0800 @@ -390,7 +390,7 @@ @NodeInfo(nameTemplate = "CounterIndex") private static final class CounterIndexNode extends FloatingNode implements LIRLowerable { - public static final NodeClass<CounterIndexNode> TYPE = NodeClass.get(CounterIndexNode.class); + public static final NodeClass<CounterIndexNode> TYPE = NodeClass.create(CounterIndexNode.class); protected final Object counter; protected final int countersSize;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java Mon Feb 23 16:23:23 2015 -0800 @@ -22,28 +22,46 @@ */ package com.oracle.graal.hotspot.meta; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.java.GraphBuilderContext.*; +import static java.lang.Character.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.compiler.common.type.*; +import com.oracle.graal.hotspot.nodes.type.*; import com.oracle.graal.hotspot.replacements.*; +import com.oracle.graal.hotspot.word.*; import com.oracle.graal.java.*; import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin; import com.oracle.graal.java.InvocationPlugins.Registration; import com.oracle.graal.java.InvocationPlugins.Registration.Receiver; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.options.*; +import com.oracle.graal.word.*; +import com.oracle.graal.word.nodes.*; /** * Provides HotSpot specific {@link InvocationPlugin}s. */ public class HotSpotGraphBuilderPlugins { - public static void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { - // Object.class + public static void registerInvocationPlugins(HotSpotProviders providers, InvocationPlugins plugins) { + MetaAccessProvider metaAccess = providers.getMetaAccess(); + SnippetReflectionProvider snippetReflection = providers.getSnippetReflection(); + Kind wordKind = providers.getCodeCache().getTarget().wordKind; + + registerObjectPlugins(plugins, metaAccess); + registerClassPlugins(plugins, metaAccess); + registerStableOptionPlugins(plugins, metaAccess); + registerMetaspacePointerPlugins(plugins, metaAccess, snippetReflection, wordKind); + } + + private static void registerObjectPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess) { Registration r = new Registration(plugins, metaAccess, Object.class); r.register1("getClass", Receiver.class, new InvocationPlugin() { public boolean apply(GraphBuilderContext builder, ValueNode rcvr) { @@ -60,9 +78,10 @@ return true; } }); + } - // Class.class - r = new Registration(plugins, metaAccess, Class.class); + private static void registerClassPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess) { + Registration r = new Registration(plugins, metaAccess, Class.class); r.register2("cast", Receiver.class, Object.class, new InvocationPlugin() { public boolean apply(GraphBuilderContext builder, ValueNode rcvr, ValueNode object) { if (rcvr.isConstant() && !rcvr.isNullConstant()) { @@ -88,9 +107,10 @@ return false; } }); + } - // StableOptionValue.class - r = new Registration(plugins, metaAccess, StableOptionValue.class); + private static void registerStableOptionPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess) { + Registration r = new Registration(plugins, metaAccess, StableOptionValue.class); r.register1("getValue", Receiver.class, new InvocationPlugin() { public boolean apply(GraphBuilderContext builder, ValueNode rcvr) { if (rcvr.isConstant() && !rcvr.isNullConstant()) { @@ -104,4 +124,130 @@ } }); } + + private static void registerMetaspacePointerPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess, SnippetReflectionProvider snippetReflection, Kind wordKind) { + Registration r = new Registration(plugins, metaAccess, MetaspacePointer.class); + r.register1("isNull", Receiver.class, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode pointer) { + assert pointer.stamp() instanceof MetaspacePointerStamp; + IsNullNode isNull = builder.append(new IsNullNode(pointer)); + ConstantNode trueValue = builder.append(ConstantNode.forBoolean(true)); + ConstantNode falseValue = builder.append(ConstantNode.forBoolean(false)); + builder.push(Kind.Boolean.getStackKind(), builder.append(new ConditionalNode(isNull, trueValue, falseValue))); + return true; + } + }); + r.register1("asWord", Receiver.class, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode pointer) { + builder.append(new PointerCastNode(StampFactory.forKind(wordKind), pointer)); + return true; + } + }); + r.register2("readObject", Receiver.class, int.class, new ReadOp(snippetReflection, wordKind, Kind.Object, BarrierType.NONE, true)); + r.register3("readObject", Receiver.class, int.class, LocationIdentity.class, new ReadOp(snippetReflection, wordKind, Kind.Object, BarrierType.NONE, true)); + r.register3("readObject", Receiver.class, int.class, BarrierType.class, new ReadOp(snippetReflection, wordKind, Kind.Object, BarrierType.NONE, true)); + r.register2("readObject", Receiver.class, WordBase.class, new ReadOp(snippetReflection, wordKind, Kind.Object, BarrierType.NONE, true)); + r.register3("readObject", Receiver.class, WordBase.class, LocationIdentity.class, new ReadOp(snippetReflection, wordKind, Kind.Object, BarrierType.NONE, true)); + r.register3("readObject", Receiver.class, WordBase.class, BarrierType.class, new ReadOp(snippetReflection, wordKind, Kind.Object, BarrierType.NONE, true)); + + registerWordOpPlugins(r, snippetReflection, wordKind, Kind.Byte, Kind.Short, Kind.Char, Kind.Int, Kind.Float, Kind.Long, Kind.Double); + } + + private static void registerWordOpPlugins(Registration r, SnippetReflectionProvider snippetReflection, Kind wordKind, Kind... kinds) { + for (Kind kind : kinds) { + String kindName = kind.getJavaName(); + kindName = toUpperCase(kindName.charAt(0)) + kindName.substring(1); + String getName = "read" + kindName; + // String putName = "write" + kindName; + r.register2(getName, Receiver.class, int.class, new ReadOp(snippetReflection, wordKind, kind)); + r.register3(getName, Receiver.class, int.class, LocationIdentity.class, new ReadOp(snippetReflection, wordKind, kind)); + } + } + + static class ReadOp implements InvocationPlugin { + final SnippetReflectionProvider snippetReflection; + final Kind wordKind; + final Kind resultKind; + final BarrierType barrierType; + final boolean compressible; + + public ReadOp(SnippetReflectionProvider snippetReflection, Kind wordKind, Kind resultKind, BarrierType barrierType, boolean compressible) { + this.snippetReflection = snippetReflection; + this.wordKind = wordKind; + this.resultKind = resultKind; + this.barrierType = barrierType; + this.compressible = compressible; + } + + public ReadOp(SnippetReflectionProvider snippetReflection, Kind wordKind, Kind resultKind) { + this(snippetReflection, wordKind, resultKind, BarrierType.NONE, false); + } + + public boolean apply(GraphBuilderContext builder, ValueNode pointer, ValueNode offset) { + LocationNode location = makeLocation(builder, offset, ANY_LOCATION, wordKind); + builder.push(resultKind, builder.append(readOp(builder, resultKind, pointer, location, barrierType, compressible))); + return true; + } + + public boolean apply(GraphBuilderContext builder, ValueNode pointer, ValueNode offset, ValueNode locationIdentityArg) { + assert locationIdentityArg.isConstant(); + LocationIdentity locationIdentity = snippetReflection.asObject(LocationIdentity.class, locationIdentityArg.asJavaConstant()); + LocationNode location = makeLocation(builder, offset, locationIdentity, wordKind); + builder.push(resultKind, builder.append(readOp(builder, resultKind, pointer, location, barrierType, compressible))); + return true; + } + } + + public static ValueNode readOp(GraphBuilderContext builder, Kind readKind, ValueNode base, LocationNode location, BarrierType barrierType, boolean compressible) { + JavaReadNode read = builder.append(new JavaReadNode(readKind, base, location, barrierType, compressible)); + /* + * The read must not float outside its block otherwise it may float above an explicit zero + * check on its base address. + */ + read.setGuard(builder.getCurrentBlockGuard()); + return read; + } + + public static LocationNode makeLocation(GraphBuilderContext builder, ValueNode offset, LocationIdentity locationIdentity, Kind wordKind) { + return builder.append(new IndexedLocationNode(locationIdentity, 0, fromSigned(builder, offset, wordKind), 1)); + } + + public static LocationNode makeLocation(GraphBuilderContext builder, ValueNode offset, ValueNode locationIdentity, Kind wordKind) { + if (locationIdentity.isConstant()) { + return makeLocation(builder, offset, builder.getSnippetReflection().asObject(LocationIdentity.class, locationIdentity.asJavaConstant()), wordKind); + } + return builder.append(new SnippetLocationNode(builder.getSnippetReflection(), locationIdentity, builder.append(ConstantNode.forLong(0)), fromSigned(builder, offset, wordKind), + builder.append(ConstantNode.forInt(1)))); + } + + public static ValueNode fromUnsigned(GraphBuilderContext builder, ValueNode value, Kind wordKind) { + return convert(builder, value, wordKind, true); + } + + public static ValueNode fromSigned(GraphBuilderContext builder, ValueNode value, Kind wordKind) { + return convert(builder, value, wordKind, false); + } + + public static ValueNode toUnsigned(GraphBuilderContext builder, ValueNode value, Kind toKind) { + return convert(builder, value, toKind, true); + } + + public static ValueNode convert(GraphBuilderContext builder, ValueNode value, Kind toKind, boolean unsigned) { + if (value.getKind() == toKind) { + return value; + } + + if (toKind == Kind.Int) { + assert value.getKind() == Kind.Long; + return builder.append(new NarrowNode(value, 32)); + } else { + assert toKind == Kind.Long; + assert value.getKind().getStackKind() == Kind.Int; + if (unsigned) { + return builder.append(new ZeroExtendNode(value, 64)); + } else { + return builder.append(new SignExtendNode(value, 64)); + } + } + } }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostForeignCallsProvider.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostForeignCallsProvider.java Mon Feb 23 16:23:23 2015 -0800 @@ -25,8 +25,10 @@ import static com.oracle.graal.api.code.CallingConvention.Type.*; import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.hotspot.HotSpotBackend.*; +import static com.oracle.graal.hotspot.HotSpotBackend.Options.*; import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.*; import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.Transition.*; +import static com.oracle.graal.hotspot.HotSpotHostBackend.*; import static com.oracle.graal.hotspot.meta.DefaultHotSpotLoweringProvider.RuntimeCalls.*; import static com.oracle.graal.hotspot.replacements.AssertionSnippets.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; @@ -138,6 +140,10 @@ public void initialize(HotSpotProviders providers, HotSpotVMConfig c) { TargetDescription target = providers.getCodeCache().getTarget(); + if (!PreferGraalStubs.getValue()) { + registerForeignCall(DEOPTIMIZATION_HANDLER, c.handleDeoptStub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS); + registerForeignCall(UNCOMMON_TRAP_HANDLER, c.uncommonTrapStub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS); + } registerForeignCall(IC_MISS_HANDLER, c.inlineCacheMissStub(), NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS); registerForeignCall(JAVA_TIME_MILLIS, c.javaTimeMillisAddress, NativeCall, DESTROYS_REGISTERS, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstant.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstant.java Mon Feb 23 16:23:23 2015 -0800 @@ -87,7 +87,7 @@ JavaConstant getCallSiteTarget(Assumptions assumptions); /** - * Gets the result of {@link CompositeValueClass#get(Class)} for the {@link Class} object + * Gets the result of {@link CompositeValueClass#create(Class)} for the {@link Class} object * represented by this constant. * * @return {@code null} if this constant does not represent a {@link Class} object
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstantImpl.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstantImpl.java Mon Feb 23 16:23:23 2015 -0800 @@ -190,7 +190,7 @@ if (object instanceof Class) { Class<? extends CompositeValue> c = (Class<? extends CompositeValue>) object; assert CompositeValue.class.isAssignableFrom(c) : c; - return HotSpotObjectConstantImpl.forObject(CompositeValueClass.get(c)); + return HotSpotObjectConstantImpl.forObject(CompositeValueClass.create(c)); } return null; }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java Mon Feb 23 16:23:23 2015 -0800 @@ -22,14 +22,21 @@ */ package com.oracle.graal.hotspot.meta; +import static com.oracle.graal.api.meta.MetaUtil.*; import static com.oracle.graal.compiler.common.GraalOptions.*; +import static com.oracle.graal.replacements.NodeIntrinsificationPhase.*; + +import java.util.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.compiler.common.type.*; +import com.oracle.graal.graph.Node.NodeIntrinsic; import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.hotspot.phases.*; import com.oracle.graal.java.*; import com.oracle.graal.java.GraphBuilderConfiguration.DebugInfoMode; +import com.oracle.graal.java.GraphBuilderPlugin.AnnotatedInvocationPlugin; import com.oracle.graal.java.GraphBuilderPlugin.InlineInvokePlugin; import com.oracle.graal.java.GraphBuilderPlugin.LoadFieldPlugin; import com.oracle.graal.lir.phases.*; @@ -39,6 +46,7 @@ import com.oracle.graal.options.DerivedOptionValue.OptionSupplier; import com.oracle.graal.phases.*; import com.oracle.graal.phases.tiers.*; +import com.oracle.graal.replacements.*; /** * HotSpot implementation of {@link SuitesProvider}. @@ -104,6 +112,20 @@ return ret; } + NodeIntrinsificationPhase intrinsifier; + + NodeIntrinsificationPhase getIntrinsifier() { + if (intrinsifier == null) { + HotSpotProviders providers = runtime.getHostProviders(); + intrinsifier = new NodeIntrinsificationPhase(providers, providers.getSnippetReflection()); + } + return intrinsifier; + } + + MetaAccessProvider getMetaAccess() { + return runtime.getHostProviders().getMetaAccess(); + } + protected PhaseSuite<HighTierContext> createGraphBuilderSuite(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, Replacements replacements) { PhaseSuite<HighTierContext> suite = new PhaseSuite<>(); GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(); @@ -127,12 +149,57 @@ if (subst != null) { return subst; } + if (builder.parsingReplacement() && method.getAnnotation(NodeIntrinsic.class) == null) { + return method; + } if (method.hasBytecodes() && method.getCode().length <= TrivialInliningSize.getValue() && depth < InlineDuringParsingMaxDepth.getValue()) { return method; } return null; } }); + config.setAnnotatedInvocationPlugin(new AnnotatedInvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ResolvedJavaMethod method, ValueNode[] args) { + if (builder.parsingReplacement()) { + @SuppressWarnings("hiding") + NodeIntrinsificationPhase intrinsifier = getIntrinsifier(); + NodeIntrinsic intrinsic = intrinsifier.getIntrinsic(method); + if (intrinsic != null) { + Signature sig = method.getSignature(); + Kind returnKind = sig.getReturnKind(); + Stamp stamp = StampFactory.forKind(returnKind); + if (returnKind == Kind.Object) { + JavaType returnType = sig.getReturnType(method.getDeclaringClass()); + if (returnType instanceof ResolvedJavaType) { + stamp = StampFactory.declared((ResolvedJavaType) returnType); + } + } + + ValueNode res = intrinsifier.createIntrinsicNode(Arrays.asList(args), stamp, method, builder.getGraph(), intrinsic); + res = builder.append(res); + if (res.getKind().getStackKind() != Kind.Void) { + builder.push(returnKind.getStackKind(), res); + } + return true; + } else if (intrinsifier.isFoldable(method)) { + ResolvedJavaType[] parameterTypes = resolveJavaTypes(method.toParameterTypes(), method.getDeclaringClass()); + JavaConstant constant = intrinsifier.tryFold(Arrays.asList(args), parameterTypes, method); + if (!COULD_NOT_FOLD.equals(constant)) { + if (constant != null) { + // Replace the invoke with the result of the call + ConstantNode res = builder.append(ConstantNode.forConstant(constant, getMetaAccess())); + builder.push(res.getKind().getStackKind(), builder.append(res)); + } else { + // This must be a void invoke + assert method.getSignature().getReturnKind() == Kind.Void; + } + return true; + } + } + } + return false; + } + }); } suite.appendPhase(new GraphBuilderPhase(config)); return suite;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AllocaNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AllocaNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class AllocaNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<AllocaNode> TYPE = NodeClass.get(AllocaNode.class); + public static final NodeClass<AllocaNode> TYPE = NodeClass.create(AllocaNode.class); /** * The number of slots in block. */
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ArrayRangeWriteBarrier.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ArrayRangeWriteBarrier.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,11 +29,11 @@ @NodeInfo public abstract class ArrayRangeWriteBarrier extends WriteBarrier { - public static final NodeClass<ArrayRangeWriteBarrier> TYPE = NodeClass.get(ArrayRangeWriteBarrier.class); + public static final NodeClass<ArrayRangeWriteBarrier> TYPE = NodeClass.create(ArrayRangeWriteBarrier.class); @Input ValueNode startIndex; @Input ValueNode length; - protected ArrayRangeWriteBarrier(NodeClass<?> c, ValueNode object, ValueNode startIndex, ValueNode length) { + protected ArrayRangeWriteBarrier(NodeClass<? extends ArrayRangeWriteBarrier> c, ValueNode object, ValueNode startIndex, ValueNode length) { super(c, object, null, null, true); this.startIndex = startIndex; this.length = length;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,7 +41,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class BeginLockScopeNode extends AbstractMemoryCheckpoint implements LIRLowerable, MonitorEnter, MemoryCheckpoint.Single { - public static final NodeClass<BeginLockScopeNode> TYPE = NodeClass.get(BeginLockScopeNode.class); + public static final NodeClass<BeginLockScopeNode> TYPE = NodeClass.create(BeginLockScopeNode.class); protected int lockDepth; public BeginLockScopeNode(int lockDepth) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CStringNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CStringNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public final class CStringNode extends FloatingNode implements LIRLowerable { - public static final NodeClass<CStringNode> TYPE = NodeClass.get(CStringNode.class); + public static final NodeClass<CStringNode> TYPE = NodeClass.create(CStringNode.class); protected final String string; public CStringNode(String string) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassCastNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassCastNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class ClassCastNode extends MacroStateSplitNode implements Canonicalizable.Binary<ValueNode> { - public static final NodeClass<ClassCastNode> TYPE = NodeClass.get(ClassCastNode.class); + public static final NodeClass<ClassCastNode> TYPE = NodeClass.create(ClassCastNode.class); public ClassCastNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetClassLoader0Node.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetClassLoader0Node.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,7 +40,7 @@ @NodeInfo public final class ClassGetClassLoader0Node extends MacroStateSplitNode implements Canonicalizable { - public static final NodeClass<ClassGetClassLoader0Node> TYPE = NodeClass.get(ClassGetClassLoader0Node.class); + public static final NodeClass<ClassGetClassLoader0Node> TYPE = NodeClass.create(ClassGetClassLoader0Node.class); public ClassGetClassLoader0Node(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class ClassGetComponentTypeNode extends MacroNode implements Canonicalizable { - public static final NodeClass<ClassGetComponentTypeNode> TYPE = NodeClass.get(ClassGetComponentTypeNode.class); + public static final NodeClass<ClassGetComponentTypeNode> TYPE = NodeClass.create(ClassGetComponentTypeNode.class); public ClassGetComponentTypeNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetModifiersNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetModifiersNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ */ @NodeInfo public final class ClassGetModifiersNode extends MacroNode implements Canonicalizable { - public static final NodeClass<ClassGetModifiersNode> TYPE = NodeClass.get(ClassGetModifiersNode.class); + public static final NodeClass<ClassGetModifiersNode> TYPE = NodeClass.create(ClassGetModifiersNode.class); public ClassGetModifiersNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class ClassGetSuperclassNode extends MacroNode implements Canonicalizable { - public static final NodeClass<ClassGetSuperclassNode> TYPE = NodeClass.get(ClassGetSuperclassNode.class); + public static final NodeClass<ClassGetSuperclassNode> TYPE = NodeClass.create(ClassGetSuperclassNode.class); public ClassGetSuperclassNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsArrayNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsArrayNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo public final class ClassIsArrayNode extends MacroNode implements Canonicalizable { - public static final NodeClass<ClassIsArrayNode> TYPE = NodeClass.get(ClassIsArrayNode.class); + public static final NodeClass<ClassIsArrayNode> TYPE = NodeClass.create(ClassIsArrayNode.class); public ClassIsArrayNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInterfaceNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInterfaceNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo public final class ClassIsInterfaceNode extends MacroNode implements Canonicalizable { - public static final NodeClass<ClassIsInterfaceNode> TYPE = NodeClass.get(ClassIsInterfaceNode.class); + public static final NodeClass<ClassIsInterfaceNode> TYPE = NodeClass.create(ClassIsInterfaceNode.class); public ClassIsInterfaceNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsPrimitiveNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsPrimitiveNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo public final class ClassIsPrimitiveNode extends MacroNode implements Canonicalizable { - public static final NodeClass<ClassIsPrimitiveNode> TYPE = NodeClass.get(ClassIsPrimitiveNode.class); + public static final NodeClass<ClassIsPrimitiveNode> TYPE = NodeClass.create(ClassIsPrimitiveNode.class); public ClassIsPrimitiveNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -43,7 +43,7 @@ @NodeInfo(nameTemplate = "{p#op/s}") public final class CompressionNode extends UnaryNode implements ConvertNode, LIRLowerable { - public static final NodeClass<CompressionNode> TYPE = NodeClass.get(CompressionNode.class); + public static final NodeClass<CompressionNode> TYPE = NodeClass.create(CompressionNode.class); public enum CompressionOp { Compress,
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentJavaThreadNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentJavaThreadNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,7 +40,7 @@ */ @NodeInfo public final class CurrentJavaThreadNode extends FloatingNode implements LIRLowerable { - public static final NodeClass<CurrentJavaThreadNode> TYPE = NodeClass.get(CurrentJavaThreadNode.class); + public static final NodeClass<CurrentJavaThreadNode> TYPE = NodeClass.create(CurrentJavaThreadNode.class); protected LIRKind wordKind;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentLockNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentLockNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ */ @NodeInfo public final class CurrentLockNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<CurrentLockNode> TYPE = NodeClass.get(CurrentLockNode.class); + public static final NodeClass<CurrentLockNode> TYPE = NodeClass.create(CurrentLockNode.class); protected int lockDepth;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizationFetchUnrollInfoCallNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizationFetchUnrollInfoCallNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -42,7 +42,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class DeoptimizationFetchUnrollInfoCallNode extends FixedWithNextNode implements LIRLowerable, MemoryCheckpoint.Multi { - public static final NodeClass<DeoptimizationFetchUnrollInfoCallNode> TYPE = NodeClass.get(DeoptimizationFetchUnrollInfoCallNode.class); + public static final NodeClass<DeoptimizationFetchUnrollInfoCallNode> TYPE = NodeClass.create(DeoptimizationFetchUnrollInfoCallNode.class); @Input SaveAllRegistersNode registerSaver; protected final ForeignCallsProvider foreignCalls;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizeCallerNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizeCallerNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo(shortName = "DeoptCaller", nameTemplate = "DeoptCaller {p#reason/s}") public final class DeoptimizeCallerNode extends ControlSinkNode implements LIRLowerable { - public static final NodeClass<DeoptimizeCallerNode> TYPE = NodeClass.get(DeoptimizeCallerNode.class); + public static final NodeClass<DeoptimizeCallerNode> TYPE = NodeClass.create(DeoptimizeCallerNode.class); protected final DeoptimizationAction action; protected final DeoptimizationReason reason;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizingStubCall.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizingStubCall.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,9 +30,9 @@ @NodeInfo public abstract class DeoptimizingStubCall extends DeoptimizingFixedWithNextNode { - public static final NodeClass<DeoptimizingStubCall> TYPE = NodeClass.get(DeoptimizingStubCall.class); + public static final NodeClass<DeoptimizingStubCall> TYPE = NodeClass.create(DeoptimizingStubCall.class); - public DeoptimizingStubCall(NodeClass<?> c, Stamp stamp) { + public DeoptimizingStubCall(NodeClass<? extends DeoptimizingStubCall> c, Stamp stamp) { super(c, stamp); }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -42,7 +42,7 @@ @NodeInfo public final class DimensionsNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<DimensionsNode> TYPE = NodeClass.get(DimensionsNode.class); + public static final NodeClass<DimensionsNode> TYPE = NodeClass.create(DimensionsNode.class); protected final int rank; public DimensionsNode(int rank) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,7 +41,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class DirectCompareAndSwapNode extends FixedWithNextNode implements LIRLowerable, MemoryCheckpoint.Single { - public static final NodeClass<DirectCompareAndSwapNode> TYPE = NodeClass.get(DirectCompareAndSwapNode.class); + public static final NodeClass<DirectCompareAndSwapNode> TYPE = NodeClass.create(DirectCompareAndSwapNode.class); @Input ValueNode object; @Input ValueNode offset; @Input ValueNode expectedValue;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ */ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class EndLockScopeNode extends AbstractMemoryCheckpoint implements LIRLowerable, MonitorExit, MemoryCheckpoint.Single { - public static final NodeClass<EndLockScopeNode> TYPE = NodeClass.get(EndLockScopeNode.class); + public static final NodeClass<EndLockScopeNode> TYPE = NodeClass.create(EndLockScopeNode.class); public EndLockScopeNode() { super(TYPE, StampFactory.forVoid());
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EnterUnpackFramesStackFrameNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EnterUnpackFramesStackFrameNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ */ @NodeInfo public final class EnterUnpackFramesStackFrameNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<EnterUnpackFramesStackFrameNode> TYPE = NodeClass.get(EnterUnpackFramesStackFrameNode.class); + public static final NodeClass<EnterUnpackFramesStackFrameNode> TYPE = NodeClass.create(EnterUnpackFramesStackFrameNode.class); @Input ValueNode framePc; @Input ValueNode senderSp;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ArrayRangePostWriteBarrier.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ArrayRangePostWriteBarrier.java Mon Feb 23 16:23:23 2015 -0800 @@ -28,7 +28,7 @@ @NodeInfo public class G1ArrayRangePostWriteBarrier extends ArrayRangeWriteBarrier { - public static final NodeClass<G1ArrayRangePostWriteBarrier> TYPE = NodeClass.get(G1ArrayRangePostWriteBarrier.class); + public static final NodeClass<G1ArrayRangePostWriteBarrier> TYPE = NodeClass.create(G1ArrayRangePostWriteBarrier.class); public G1ArrayRangePostWriteBarrier(ValueNode object, ValueNode startIndex, ValueNode length) { super(TYPE, object, startIndex, length);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ArrayRangePreWriteBarrier.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ArrayRangePreWriteBarrier.java Mon Feb 23 16:23:23 2015 -0800 @@ -28,7 +28,7 @@ @NodeInfo public final class G1ArrayRangePreWriteBarrier extends ArrayRangeWriteBarrier { - public static final NodeClass<G1ArrayRangePreWriteBarrier> TYPE = NodeClass.get(G1ArrayRangePreWriteBarrier.class); + public static final NodeClass<G1ArrayRangePreWriteBarrier> TYPE = NodeClass.create(G1ArrayRangePreWriteBarrier.class); public G1ArrayRangePreWriteBarrier(ValueNode object, ValueNode startIndex, ValueNode length) { super(TYPE, object, startIndex, length);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PostWriteBarrier.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PostWriteBarrier.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,14 +30,14 @@ @NodeInfo public class G1PostWriteBarrier extends WriteBarrier { - public static final NodeClass<G1PostWriteBarrier> TYPE = NodeClass.get(G1PostWriteBarrier.class); + public static final NodeClass<G1PostWriteBarrier> TYPE = NodeClass.create(G1PostWriteBarrier.class); protected final boolean alwaysNull; public G1PostWriteBarrier(ValueNode object, ValueNode value, LocationNode location, boolean precise, boolean alwaysNull) { this(TYPE, object, value, location, precise, alwaysNull); } - protected G1PostWriteBarrier(NodeClass<?> c, ValueNode object, ValueNode value, LocationNode location, boolean precise, boolean alwaysNull) { + protected G1PostWriteBarrier(NodeClass<? extends G1PostWriteBarrier> c, ValueNode object, ValueNode value, LocationNode location, boolean precise, boolean alwaysNull) { super(c, object, value, location, precise); this.alwaysNull = alwaysNull; }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PreWriteBarrier.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PreWriteBarrier.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo public final class G1PreWriteBarrier extends WriteBarrier implements DeoptimizingNode.DeoptBefore { - public static final NodeClass<G1PreWriteBarrier> TYPE = NodeClass.get(G1PreWriteBarrier.class); + public static final NodeClass<G1PreWriteBarrier> TYPE = NodeClass.create(G1PreWriteBarrier.class); @OptionalInput(InputType.State) FrameState stateBefore; protected final boolean nullCheck;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ReferentFieldReadBarrier.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ReferentFieldReadBarrier.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ */ @NodeInfo public final class G1ReferentFieldReadBarrier extends WriteBarrier { - public static final NodeClass<G1ReferentFieldReadBarrier> TYPE = NodeClass.get(G1ReferentFieldReadBarrier.class); + public static final NodeClass<G1ReferentFieldReadBarrier> TYPE = NodeClass.create(G1ReferentFieldReadBarrier.class); protected final boolean doLoad;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ */ @NodeInfo public final class GetObjectAddressNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<GetObjectAddressNode> TYPE = NodeClass.get(GetObjectAddressNode.class); + public static final NodeClass<GetObjectAddressNode> TYPE = NodeClass.create(GetObjectAddressNode.class); @Input ValueNode object;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotDirectCallTargetNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotDirectCallTargetNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo public final class HotSpotDirectCallTargetNode extends DirectCallTargetNode { - public static final NodeClass<HotSpotDirectCallTargetNode> TYPE = NodeClass.get(HotSpotDirectCallTargetNode.class); + public static final NodeClass<HotSpotDirectCallTargetNode> TYPE = NodeClass.create(HotSpotDirectCallTargetNode.class); public HotSpotDirectCallTargetNode(List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, Type callType, InvokeKind invokeKind) { super(TYPE, arguments, returnStamp, signature, target, callType, invokeKind);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotIndirectCallTargetNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotIndirectCallTargetNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo public final class HotSpotIndirectCallTargetNode extends IndirectCallTargetNode { - public static final NodeClass<HotSpotIndirectCallTargetNode> TYPE = NodeClass.get(HotSpotIndirectCallTargetNode.class); + public static final NodeClass<HotSpotIndirectCallTargetNode> TYPE = NodeClass.create(HotSpotIndirectCallTargetNode.class); @Input ValueNode metaspaceMethod;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/JumpToExceptionHandlerInCallerNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/JumpToExceptionHandlerInCallerNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public final class JumpToExceptionHandlerInCallerNode extends ControlSinkNode implements LIRLowerable { - public static final NodeClass<JumpToExceptionHandlerInCallerNode> TYPE = NodeClass.get(JumpToExceptionHandlerInCallerNode.class); + public static final NodeClass<JumpToExceptionHandlerInCallerNode> TYPE = NodeClass.create(JumpToExceptionHandlerInCallerNode.class); @Input ValueNode handlerInCallerPc; @Input ValueNode exception; @Input ValueNode exceptionPc;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveCurrentStackFrameNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveCurrentStackFrameNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public final class LeaveCurrentStackFrameNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<LeaveCurrentStackFrameNode> TYPE = NodeClass.get(LeaveCurrentStackFrameNode.class); + public static final NodeClass<LeaveCurrentStackFrameNode> TYPE = NodeClass.create(LeaveCurrentStackFrameNode.class); @Input SaveAllRegistersNode registerSaver; public LeaveCurrentStackFrameNode(ValueNode registerSaver) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveDeoptimizedStackFrameNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveDeoptimizedStackFrameNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class LeaveDeoptimizedStackFrameNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<LeaveDeoptimizedStackFrameNode> TYPE = NodeClass.get(LeaveDeoptimizedStackFrameNode.class); + public static final NodeClass<LeaveDeoptimizedStackFrameNode> TYPE = NodeClass.create(LeaveDeoptimizedStackFrameNode.class); @Input ValueNode frameSize; @Input ValueNode initialInfo;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveUnpackFramesStackFrameNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveUnpackFramesStackFrameNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public final class LeaveUnpackFramesStackFrameNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<LeaveUnpackFramesStackFrameNode> TYPE = NodeClass.get(LeaveUnpackFramesStackFrameNode.class); + public static final NodeClass<LeaveUnpackFramesStackFrameNode> TYPE = NodeClass.create(LeaveUnpackFramesStackFrameNode.class); @Input SaveAllRegistersNode registerSaver; public LeaveUnpackFramesStackFrameNode(ValueNode registerSaver) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LoadIndexedPointerNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LoadIndexedPointerNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,7 @@ @NodeInfo public final class LoadIndexedPointerNode extends LoadIndexedNode { - public static final NodeClass<LoadIndexedPointerNode> TYPE = NodeClass.get(LoadIndexedPointerNode.class); + public static final NodeClass<LoadIndexedPointerNode> TYPE = NodeClass.create(LoadIndexedPointerNode.class); public LoadIndexedPointerNode(Stamp stamp, ValueNode array, ValueNode index) { super(TYPE, stamp, array, index, Kind.Illegal);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ */ @NodeInfo public final class MonitorCounterNode extends FloatingNode implements LIRLowerable { - public static final NodeClass<MonitorCounterNode> TYPE = NodeClass.get(MonitorCounterNode.class); + public static final NodeClass<MonitorCounterNode> TYPE = NodeClass.create(MonitorCounterNode.class); public MonitorCounterNode() { super(TYPE, null);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,7 +41,7 @@ @NodeInfo public final class NewArrayStubCall extends DeoptimizingStubCall implements LIRLowerable { - public static final NodeClass<NewArrayStubCall> TYPE = NodeClass.get(NewArrayStubCall.class); + public static final NodeClass<NewArrayStubCall> TYPE = NodeClass.create(NewArrayStubCall.class); private static final Stamp defaultStamp = StampFactory.objectNonNull(); @Input ValueNode hub;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,7 +41,7 @@ @NodeInfo public final class NewInstanceStubCall extends DeoptimizingStubCall implements LIRLowerable { - public static final NodeClass<NewInstanceStubCall> TYPE = NodeClass.get(NewInstanceStubCall.class); + public static final NodeClass<NewInstanceStubCall> TYPE = NodeClass.create(NewInstanceStubCall.class); private static final Stamp defaultStamp = StampFactory.objectNonNull(); @Input ValueNode hub;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,7 +41,7 @@ @NodeInfo public final class NewMultiArrayStubCall extends ForeignCallNode { - public static final NodeClass<NewMultiArrayStubCall> TYPE = NodeClass.get(NewMultiArrayStubCall.class); + public static final NodeClass<NewMultiArrayStubCall> TYPE = NodeClass.create(NewMultiArrayStubCall.class); private static final Stamp defaultStamp = StampFactory.objectNonNull(); @Input ValueNode hub;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PatchReturnAddressNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PatchReturnAddressNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo public final class PatchReturnAddressNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<PatchReturnAddressNode> TYPE = NodeClass.get(PatchReturnAddressNode.class); + public static final NodeClass<PatchReturnAddressNode> TYPE = NodeClass.create(PatchReturnAddressNode.class); @Input ValueNode address; public PatchReturnAddressNode(ValueNode address) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PrefetchAllocateNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PrefetchAllocateNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo public final class PrefetchAllocateNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<PrefetchAllocateNode> TYPE = NodeClass.get(PrefetchAllocateNode.class); + public static final NodeClass<PrefetchAllocateNode> TYPE = NodeClass.create(PrefetchAllocateNode.class); @Input ValueNode distance; @Input ValueNode address;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PushInterpreterFrameNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PushInterpreterFrameNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public final class PushInterpreterFrameNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<PushInterpreterFrameNode> TYPE = NodeClass.get(PushInterpreterFrameNode.class); + public static final NodeClass<PushInterpreterFrameNode> TYPE = NodeClass.create(PushInterpreterFrameNode.class); @Input ValueNode framePc; @Input ValueNode frameSize; @Input ValueNode senderSp;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SaveAllRegistersNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SaveAllRegistersNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class SaveAllRegistersNode extends FixedWithNextNode implements LIRLowerable, MemoryCheckpoint.Single { - public static final NodeClass<SaveAllRegistersNode> TYPE = NodeClass.get(SaveAllRegistersNode.class); + public static final NodeClass<SaveAllRegistersNode> TYPE = NodeClass.create(SaveAllRegistersNode.class); protected SaveRegistersOp saveRegistersOp; public SaveAllRegistersNode() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialArrayRangeWriteBarrier.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialArrayRangeWriteBarrier.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,7 +29,7 @@ @NodeInfo public final class SerialArrayRangeWriteBarrier extends ArrayRangeWriteBarrier { - public static final NodeClass<SerialArrayRangeWriteBarrier> TYPE = NodeClass.get(SerialArrayRangeWriteBarrier.class); + public static final NodeClass<SerialArrayRangeWriteBarrier> TYPE = NodeClass.create(SerialArrayRangeWriteBarrier.class); public SerialArrayRangeWriteBarrier(ValueNode object, ValueNode startIndex, ValueNode length) { super(TYPE, object, startIndex, length);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialWriteBarrier.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialWriteBarrier.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,14 +30,14 @@ @NodeInfo public class SerialWriteBarrier extends WriteBarrier { - public static final NodeClass<SerialWriteBarrier> TYPE = NodeClass.get(SerialWriteBarrier.class); + public static final NodeClass<SerialWriteBarrier> TYPE = NodeClass.create(SerialWriteBarrier.class); protected final boolean alwaysNull; public SerialWriteBarrier(ValueNode object, LocationNode location, boolean precise, boolean alwaysNull) { this(TYPE, object, location, precise, alwaysNull); } - protected SerialWriteBarrier(NodeClass<?> c, ValueNode object, LocationNode location, boolean precise, boolean alwaysNull) { + protected SerialWriteBarrier(NodeClass<? extends SerialWriteBarrier> c, ValueNode object, LocationNode location, boolean precise, boolean alwaysNull) { super(c, object, null, location, precise); this.alwaysNull = alwaysNull; }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SnippetAnchorNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SnippetAnchorNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Value, InputType.Anchor, InputType.Guard}) public final class SnippetAnchorNode extends FixedWithNextNode implements Simplifiable, GuardingNode { - public static final NodeClass<SnippetAnchorNode> TYPE = NodeClass.get(SnippetAnchorNode.class); + public static final NodeClass<SnippetAnchorNode> TYPE = NodeClass.create(SnippetAnchorNode.class); public SnippetAnchorNode() { super(TYPE, StampFactory.object());
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SnippetLocationProxyNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SnippetLocationProxyNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Association, InputType.Value}) public final class SnippetLocationProxyNode extends FloatingNode implements Canonicalizable { - public static final NodeClass<SnippetLocationProxyNode> TYPE = NodeClass.get(SnippetLocationProxyNode.class); + public static final NodeClass<SnippetLocationProxyNode> TYPE = NodeClass.create(SnippetLocationProxyNode.class); @Input(InputType.Unchecked) ValueNode location; public SnippetLocationProxyNode(ValueNode location) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,7 +40,7 @@ @NodeInfo(nameTemplate = "StubForeignCall#{p#descriptor/s}", allowedUsageTypes = {InputType.Memory}) public final class StubForeignCallNode extends FixedWithNextNode implements LIRLowerable, MemoryCheckpoint.Multi { - public static final NodeClass<StubForeignCallNode> TYPE = NodeClass.get(StubForeignCallNode.class); + public static final NodeClass<StubForeignCallNode> TYPE = NodeClass.create(StubForeignCallNode.class); @Input NodeInputList<ValueNode> arguments; protected final ForeignCallsProvider foreignCalls;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubStartNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubStartNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo public final class StubStartNode extends StartNode { - public static final NodeClass<StubStartNode> TYPE = NodeClass.get(StubStartNode.class); + public static final NodeClass<StubStartNode> TYPE = NodeClass.create(StubStartNode.class); protected final Stub stub; public StubStartNode(Stub stub) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/UncommonTrapCallNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/UncommonTrapCallNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -42,7 +42,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class UncommonTrapCallNode extends FixedWithNextNode implements LIRLowerable, MemoryCheckpoint.Multi { - public static final NodeClass<UncommonTrapCallNode> TYPE = NodeClass.get(UncommonTrapCallNode.class); + public static final NodeClass<UncommonTrapCallNode> TYPE = NodeClass.create(UncommonTrapCallNode.class); @Input ValueNode trapRequest; @Input SaveAllRegistersNode registerSaver; protected final ForeignCallsProvider foreignCalls;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,7 +41,7 @@ @NodeInfo public final class VMErrorNode extends DeoptimizingStubCall implements LIRLowerable { - public static final NodeClass<VMErrorNode> TYPE = NodeClass.get(VMErrorNode.class); + public static final NodeClass<VMErrorNode> TYPE = NodeClass.create(VMErrorNode.class); protected final String format; @Input ValueNode value;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,13 +32,13 @@ @NodeInfo public abstract class WriteBarrier extends FixedWithNextNode implements Lowerable { - public static final NodeClass<WriteBarrier> TYPE = NodeClass.get(WriteBarrier.class); + public static final NodeClass<WriteBarrier> TYPE = NodeClass.create(WriteBarrier.class); @Input protected ValueNode object; @OptionalInput protected ValueNode value; @OptionalInput(InputType.Association) protected LocationNode location; protected final boolean precise; - protected WriteBarrier(NodeClass<?> c, ValueNode object, ValueNode value, LocationNode location, boolean precise) { + protected WriteBarrier(NodeClass<? extends WriteBarrier> c, ValueNode object, ValueNode value, LocationNode location, boolean precise) { super(c, StampFactory.forVoid()); this.object = object; this.value = value;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteTargetNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteTargetNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo public final class CallSiteTargetNode extends MacroStateSplitNode implements Canonicalizable, Lowerable { - public static final NodeClass<CallSiteTargetNode> TYPE = NodeClass.get(CallSiteTargetNode.class); + public static final NodeClass<CallSiteTargetNode> TYPE = NodeClass.create(CallSiteTargetNode.class); public CallSiteTargetNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CardTableAddressNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CardTableAddressNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,7 @@ @NodeInfo public final class CardTableAddressNode extends FloatingNode implements LIRLowerable { - public static final NodeClass<CardTableAddressNode> TYPE = NodeClass.get(CardTableAddressNode.class); + public static final NodeClass<CardTableAddressNode> TYPE = NodeClass.create(CardTableAddressNode.class); public CardTableAddressNode() { super(TYPE, StampFactory.forKind(Kind.Long));
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CardTableShiftNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CardTableShiftNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,7 @@ @NodeInfo public final class CardTableShiftNode extends FloatingNode implements LIRLowerable { - public static final NodeClass<CardTableShiftNode> TYPE = NodeClass.get(CardTableShiftNode.class); + public static final NodeClass<CardTableShiftNode> TYPE = NodeClass.create(CardTableShiftNode.class); public CardTableShiftNode() { super(TYPE, StampFactory.intValue());
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassGetHubNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassGetHubNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -43,7 +43,7 @@ */ @NodeInfo public final class ClassGetHubNode extends FloatingGuardedNode implements Lowerable, Canonicalizable, ConvertNode { - public static final NodeClass<ClassGetHubNode> TYPE = NodeClass.get(ClassGetHubNode.class); + public static final NodeClass<ClassGetHubNode> TYPE = NodeClass.create(ClassGetHubNode.class); @Input protected ValueNode clazz; public ClassGetHubNode(ValueNode clazz) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompositeValueClassSubstitutions.java Wed Feb 18 10:37:08 2015 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.hotspot.replacements; - -import static com.oracle.graal.compiler.common.GraalOptions.*; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.replacements.*; -import com.oracle.graal.graph.*; -import com.oracle.graal.hotspot.meta.*; -import com.oracle.graal.lir.*; -import com.oracle.graal.nodeinfo.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.replacements.nodes.*; - -/** - * Substitutions for improving the performance of {@link CompositeValueClass#getClass()}. - */ -@ClassSubstitution(CompositeValueClass.class) -public class CompositeValueClassSubstitutions { - - /** - * A macro node for calls to {@link CompositeValueClass#get(Class)}. It can use the compiler's - * knowledge about node classes to replace itself with a constant value for a constant - * {@link Class} parameter. - */ - @NodeInfo - public static final class CompositeValueClassGetNode extends PureFunctionMacroNode { - - public static final NodeClass<CompositeValueClassGetNode> TYPE = NodeClass.get(CompositeValueClassGetNode.class); - - public CompositeValueClassGetNode(Invoke invoke) { - super(TYPE, invoke); - } - - @Override - protected JavaConstant evaluate(JavaConstant param, MetaAccessProvider metaAccess) { - if (param.isNull() || ImmutableCode.getValue()) { - return null; - } - HotSpotObjectConstant c = (HotSpotObjectConstant) param; - return c.getCompositeValueClass(); - } - } - - @MacroSubstitution(isStatic = true, forced = true, macro = CompositeValueClassGetNode.class) - private static native CompositeValueClass get(Class<?> c); -}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,6 @@ import com.oracle.graal.api.replacements.*; import com.oracle.graal.api.runtime.*; import com.oracle.graal.hotspot.bridge.*; -import com.oracle.graal.lir.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.replacements.*; @@ -62,7 +61,6 @@ replacements.registerSubstitutions(Class.class, HotSpotClassSubstitutions.class); replacements.registerSubstitutions(CRC32.class, CRC32Substitutions.class); replacements.registerSubstitutions(Reflection.class, ReflectionSubstitutions.class); - replacements.registerSubstitutions(CompositeValueClass.class, CompositeValueClassSubstitutions.class); replacements.registerSubstitutions(CompilerToVMImpl.class, CompilerToVMImplSubstitutions.class); replacements.registerSubstitutions(new NamedType("com.sun.crypto.provider.AESCrypt"), AESCryptSubstitutions.class); replacements.registerSubstitutions(new NamedType("com.sun.crypto.provider.CipherBlockChaining"), CipherBlockChainingSubstitutions.class);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HubGetClassNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HubGetClassNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ */ @NodeInfo public final class HubGetClassNode extends FloatingGuardedNode implements Lowerable, Canonicalizable, ConvertNode { - public static final NodeClass<HubGetClassNode> TYPE = NodeClass.get(HubGetClassNode.class); + public static final NodeClass<HubGetClassNode> TYPE = NodeClass.create(HubGetClassNode.class); @Input protected ValueNode hub; public HubGetClassNode(@InjectedNodeParameter MetaAccessProvider metaAccess, ValueNode hub) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/KlassLayoutHelperNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/KlassLayoutHelperNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,7 +40,7 @@ @NodeInfo public final class KlassLayoutHelperNode extends FloatingGuardedNode implements Canonicalizable, Lowerable { - public static final NodeClass<KlassLayoutHelperNode> TYPE = NodeClass.get(KlassLayoutHelperNode.class); + public static final NodeClass<KlassLayoutHelperNode> TYPE = NodeClass.create(KlassLayoutHelperNode.class); @Input protected ValueNode klass; protected final HotSpotVMConfig config;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MethodHandleNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MethodHandleNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -44,7 +44,7 @@ */ @NodeInfo public final class MethodHandleNode extends MacroStateSplitNode implements Simplifiable { - public static final NodeClass<MethodHandleNode> TYPE = NodeClass.get(MethodHandleNode.class); + public static final NodeClass<MethodHandleNode> TYPE = NodeClass.create(MethodHandleNode.class); // Replacement method data protected ResolvedJavaMethod replacementTargetMethod;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -42,7 +42,7 @@ @NodeInfo public final class ObjectCloneNode extends BasicObjectCloneNode implements VirtualizableAllocation, ArrayLengthProvider { - public static final NodeClass<ObjectCloneNode> TYPE = NodeClass.get(ObjectCloneNode.class); + public static final NodeClass<ObjectCloneNode> TYPE = NodeClass.create(ObjectCloneNode.class); public ObjectCloneNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public final class ReflectionGetCallerClassNode extends MacroStateSplitNode implements Canonicalizable, Lowerable { - public static final NodeClass<ReflectionGetCallerClassNode> TYPE = NodeClass.get(ReflectionGetCallerClassNode.class); + public static final NodeClass<ReflectionGetCallerClassNode> TYPE = NodeClass.create(ReflectionGetCallerClassNode.class); public ReflectionGetCallerClassNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/SystemIdentityHashCodeNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/SystemIdentityHashCodeNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo public final class SystemIdentityHashCodeNode extends PureFunctionMacroNode { - public static final NodeClass<SystemIdentityHashCodeNode> TYPE = NodeClass.get(SystemIdentityHashCodeNode.class); + public static final NodeClass<SystemIdentityHashCodeNode> TYPE = NodeClass.create(SystemIdentityHashCodeNode.class); public SystemIdentityHashCodeNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyCallNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyCallNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -42,7 +42,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class ArrayCopyCallNode extends AbstractMemoryCheckpoint implements Lowerable, MemoryCheckpoint.Single { - public static final NodeClass<ArrayCopyCallNode> TYPE = NodeClass.get(ArrayCopyCallNode.class); + public static final NodeClass<ArrayCopyCallNode> TYPE = NodeClass.create(ArrayCopyCallNode.class); @Input ValueNode src; @Input ValueNode srcPos; @Input ValueNode dest;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,7 +41,7 @@ @NodeInfo public final class ArrayCopyNode extends BasicArrayCopyNode implements Virtualizable, Lowerable { - public static final NodeClass<ArrayCopyNode> TYPE = NodeClass.get(ArrayCopyNode.class); + public static final NodeClass<ArrayCopyNode> TYPE = NodeClass.create(ArrayCopyNode.class); public ArrayCopyNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/CheckcastArrayCopyCallNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/CheckcastArrayCopyCallNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,7 +41,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory, InputType.Value}) public final class CheckcastArrayCopyCallNode extends AbstractMemoryCheckpoint implements Lowerable, MemoryCheckpoint.Single { - public static final NodeClass<CheckcastArrayCopyCallNode> TYPE = NodeClass.get(CheckcastArrayCopyCallNode.class); + public static final NodeClass<CheckcastArrayCopyCallNode> TYPE = NodeClass.create(CheckcastArrayCopyCallNode.class); @Input ValueNode src; @Input ValueNode srcPos; @Input ValueNode dest;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/UnsafeArrayCopyNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/UnsafeArrayCopyNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class UnsafeArrayCopyNode extends ArrayRangeWriteNode implements Lowerable, MemoryCheckpoint.Single { - public static final NodeClass<UnsafeArrayCopyNode> TYPE = NodeClass.get(UnsafeArrayCopyNode.class); + public static final NodeClass<UnsafeArrayCopyNode> TYPE = NodeClass.create(UnsafeArrayCopyNode.class); @Input ValueNode src; @Input ValueNode srcPos; @Input ValueNode dest;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/DeoptimizationStub.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/DeoptimizationStub.java Mon Feb 23 16:23:23 2015 -0800 @@ -23,8 +23,10 @@ package com.oracle.graal.hotspot.stubs; import static com.oracle.graal.hotspot.HotSpotBackend.*; +import static com.oracle.graal.hotspot.HotSpotBackend.Options.*; import static com.oracle.graal.hotspot.nodes.DeoptimizationFetchUnrollInfoCallNode.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; +import static com.oracle.graal.hotspot.stubs.UncommonTrapStub.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; @@ -84,6 +86,7 @@ public DeoptimizationStub(HotSpotProviders providers, TargetDescription target, HotSpotForeignCallLinkage linkage) { super(DeoptimizationStub.class, "deoptimizationHandler", providers, target, linkage); this.target = target; + assert PreferGraalStubs.getValue(); } @Override @@ -135,7 +138,7 @@ * Stack bang to make sure there's enough room for the interpreter frames. Bang stack for * total size of the interpreter frames plus shadow page size. Bang one page at a time * because large sizes can bang beyond yellow and red zones. - * + * * @deprecated This code should go away as soon as JDK-8032410 hits the Graal repository. */ final int totalFrameSizes = unrollBlock.readInt(deoptimizationUnrollBlockTotalFrameSizesOffset()); @@ -143,7 +146,7 @@ Word stackPointer = readRegister(stackPointerRegister); for (int i = 1; i < bangPages; i++) { - stackPointer.writeInt((-i * pageSize()) + stackBias(), 0, UncommonTrapStub.STACK_BANG_LOCATION); + stackPointer.writeInt((-i * pageSize()) + stackBias(), 0, STACK_BANG_LOCATION); } // Load number of interpreter frames.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UncommonTrapStub.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UncommonTrapStub.java Mon Feb 23 16:23:23 2015 -0800 @@ -22,8 +22,9 @@ */ package com.oracle.graal.hotspot.stubs; +import static com.oracle.graal.hotspot.HotSpotBackend.*; +import static com.oracle.graal.hotspot.HotSpotBackend.Options.*; import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; -import static com.oracle.graal.hotspot.stubs.StubUtil.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; @@ -85,6 +86,7 @@ public UncommonTrapStub(HotSpotProviders providers, TargetDescription target, HotSpotForeignCallLinkage linkage) { super(UncommonTrapStub.class, "uncommonTrapHandler", providers, target, linkage); this.target = target; + assert PreferGraalStubs.getValue(); } @Override @@ -147,7 +149,7 @@ * Stack bang to make sure there's enough room for the interpreter frames. Bang stack for * total size of the interpreter frames plus shadow page size. Bang one page at a time * because large sizes can bang beyond yellow and red zones. - * + * * @deprecated This code should go away as soon as JDK-8032410 hits the Graal repository. */ final int totalFrameSizes = unrollBlock.readInt(deoptimizationUnrollBlockTotalFrameSizesOffset()); @@ -284,8 +286,6 @@ return config().deoptimizationUnpackUncommonTrap; } - public static final ForeignCallDescriptor UNPACK_FRAMES = newDescriptor(UncommonTrapStub.class, "unpackFrames", int.class, Word.class, int.class); - @NodeIntrinsic(value = StubForeignCallNode.class, setStampFromReturnType = true) public static native int unpackFrames(@ConstantNodeParameter ForeignCallDescriptor unpackFrames, Word thread, int mode); }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/PointerCastNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/PointerCastNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public final class PointerCastNode extends FloatingNode implements LIRLowerable { - public static final NodeClass<PointerCastNode> TYPE = NodeClass.get(PointerCastNode.class); + public static final NodeClass<PointerCastNode> TYPE = NodeClass.create(PointerCastNode.class); @Input ValueNode input; public PointerCastNode(Stamp stamp, ValueNode input) {
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,13 +37,12 @@ import com.oracle.graal.compiler.common.calc.*; import com.oracle.graal.debug.*; import com.oracle.graal.java.BciBlockMapping.BciBlock; -import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin; import com.oracle.graal.java.GraphBuilderPlugin.LoadFieldPlugin; import com.oracle.graal.nodes.*; import com.oracle.graal.options.*; import com.oracle.graal.phases.*; -public abstract class AbstractBytecodeParser<T extends KindProvider, F extends AbstractFrameStateBuilder<T, F>> { +public abstract class AbstractBytecodeParser { static class Options { // @formatter:off @@ -64,7 +63,7 @@ */ public static final int TRACELEVEL_STATE = 2; - protected F frameState; + protected HIRFrameStateBuilder frameState; protected BciBlock currentBlock; protected final BytecodeStream stream; @@ -98,7 +97,7 @@ assert metaAccess != null; } - public void setCurrentFrameState(F frameState) { + public void setCurrentFrameState(HIRFrameStateBuilder frameState) { this.frameState = frameState; } @@ -115,11 +114,11 @@ } public void storeLocal(Kind kind, int index) { - T value; + ValueNode value; if (kind == Kind.Object) { value = frameState.xpop(); // astore and astore_<n> may be used to store a returnAddress (jsr) - assert value.getKind() == Kind.Object || value.getKind() == Kind.Int; + assert parsingReplacement || (value.getKind() == Kind.Object || value.getKind() == Kind.Int) : value + ":" + value.getKind(); } else { value = frameState.pop(kind); } @@ -135,13 +134,13 @@ * @param type the unresolved type of the type check * @param object the object value whose type is being checked against {@code type} */ - protected abstract void handleUnresolvedCheckCast(JavaType type, T object); + protected abstract void handleUnresolvedCheckCast(JavaType type, ValueNode object); /** * @param type the unresolved type of the type check * @param object the object value whose type is being checked against {@code type} */ - protected abstract void handleUnresolvedInstanceOf(JavaType type, T object); + protected abstract void handleUnresolvedInstanceOf(JavaType type, ValueNode object); /** * @param type the type being instantiated @@ -152,26 +151,26 @@ * @param type the type of the array being instantiated * @param length the length of the array */ - protected abstract void handleUnresolvedNewObjectArray(JavaType type, T length); + protected abstract void handleUnresolvedNewObjectArray(JavaType type, ValueNode length); /** * @param type the type being instantiated * @param dims the dimensions for the multi-array */ - protected abstract void handleUnresolvedNewMultiArray(JavaType type, List<T> dims); + protected abstract void handleUnresolvedNewMultiArray(JavaType type, List<ValueNode> dims); /** * @param field the unresolved field * @param receiver the object containing the field or {@code null} if {@code field} is static */ - protected abstract void handleUnresolvedLoadField(JavaField field, T receiver); + protected abstract void handleUnresolvedLoadField(JavaField field, ValueNode receiver); /** * @param field the unresolved field * @param value the value being stored to the field * @param receiver the object containing the field or {@code null} if {@code field} is static */ - protected abstract void handleUnresolvedStoreField(JavaField field, T value, T receiver); + protected abstract void handleUnresolvedStoreField(JavaField field, ValueNode value, ValueNode receiver); /** * @param type @@ -180,7 +179,7 @@ // protected abstract void handleUnresolvedInvoke(JavaMethod javaMethod, InvokeKind invokeKind); - // protected abstract DispatchBeginNode handleException(T exceptionObject, int bci); + // protected abstract DispatchBeginNode handleException(ValueNode exceptionObject, int bci); private void genLoadConstant(int cpi, int opcode) { Object con = lookupConstant(cpi, opcode); @@ -201,56 +200,41 @@ } } - protected abstract T genLoadIndexed(T index, T array, Kind kind); + protected abstract ValueNode genLoadIndexed(ValueNode index, ValueNode array, Kind kind); private void genLoadIndexed(Kind kind) { emitExplicitExceptions(frameState.peek(1), frameState.peek(0)); - T index = frameState.ipop(); - T array = frameState.apop(); + ValueNode index = frameState.ipop(); + ValueNode array = frameState.apop(); frameState.push(kind.getStackKind(), append(genLoadIndexed(array, index, kind))); } - protected abstract T genStoreIndexed(T array, T index, Kind kind, T value); + protected abstract ValueNode genStoreIndexed(ValueNode array, ValueNode index, Kind kind, ValueNode value); private void genStoreIndexed(Kind kind) { emitExplicitExceptions(frameState.peek(2), frameState.peek(1)); - T value = frameState.pop(kind.getStackKind()); - T index = frameState.ipop(); - T array = frameState.apop(); + ValueNode value = frameState.pop(kind.getStackKind()); + ValueNode index = frameState.ipop(); + ValueNode array = frameState.apop(); append(genStoreIndexed(array, index, kind, value)); } private void stackOp(int opcode) { switch (opcode) { - case POP: { - frameState.xpop(); - break; - } - case POP2: { - frameState.xpop(); - frameState.xpop(); - break; - } - case DUP: { - T w = frameState.xpop(); - frameState.xpush(w); - frameState.xpush(w); - break; - } case DUP_X1: { - T w1 = frameState.xpop(); - T w2 = frameState.xpop(); + ValueNode w1 = frameState.xpop(); + ValueNode w2 = frameState.xpop(); frameState.xpush(w1); frameState.xpush(w2); frameState.xpush(w1); break; } case DUP_X2: { - T w1 = frameState.xpop(); - T w2 = frameState.xpop(); - T w3 = frameState.xpop(); + ValueNode w1 = frameState.xpop(); + ValueNode w2 = frameState.xpop(); + ValueNode w3 = frameState.xpop(); frameState.xpush(w1); frameState.xpush(w3); frameState.xpush(w2); @@ -258,8 +242,8 @@ break; } case DUP2: { - T w1 = frameState.xpop(); - T w2 = frameState.xpop(); + ValueNode w1 = frameState.xpop(); + ValueNode w2 = frameState.xpop(); frameState.xpush(w2); frameState.xpush(w1); frameState.xpush(w2); @@ -267,9 +251,9 @@ break; } case DUP2_X1: { - T w1 = frameState.xpop(); - T w2 = frameState.xpop(); - T w3 = frameState.xpop(); + ValueNode w1 = frameState.xpop(); + ValueNode w2 = frameState.xpop(); + ValueNode w3 = frameState.xpop(); frameState.xpush(w2); frameState.xpush(w1); frameState.xpush(w3); @@ -278,10 +262,10 @@ break; } case DUP2_X2: { - T w1 = frameState.xpop(); - T w2 = frameState.xpop(); - T w3 = frameState.xpop(); - T w4 = frameState.xpop(); + ValueNode w1 = frameState.xpop(); + ValueNode w2 = frameState.xpop(); + ValueNode w3 = frameState.xpop(); + ValueNode w4 = frameState.xpop(); frameState.xpush(w2); frameState.xpush(w1); frameState.xpush(w4); @@ -291,8 +275,8 @@ break; } case SWAP: { - T w1 = frameState.xpop(); - T w2 = frameState.xpop(); + ValueNode w1 = frameState.xpop(); + ValueNode w2 = frameState.xpop(); frameState.xpush(w1); frameState.xpush(w2); break; @@ -302,27 +286,27 @@ } } - protected abstract T genIntegerAdd(Kind kind, T x, T y); + protected abstract ValueNode genIntegerAdd(Kind kind, ValueNode x, ValueNode y); - protected abstract T genIntegerSub(Kind kind, T x, T y); + protected abstract ValueNode genIntegerSub(Kind kind, ValueNode x, ValueNode y); - protected abstract T genIntegerMul(Kind kind, T x, T y); + protected abstract ValueNode genIntegerMul(Kind kind, ValueNode x, ValueNode y); - protected abstract T genFloatAdd(Kind kind, T x, T y, boolean isStrictFP); + protected abstract ValueNode genFloatAdd(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP); - protected abstract T genFloatSub(Kind kind, T x, T y, boolean isStrictFP); + protected abstract ValueNode genFloatSub(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP); - protected abstract T genFloatMul(Kind kind, T x, T y, boolean isStrictFP); + protected abstract ValueNode genFloatMul(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP); - protected abstract T genFloatDiv(Kind kind, T x, T y, boolean isStrictFP); + protected abstract ValueNode genFloatDiv(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP); - protected abstract T genFloatRem(Kind kind, T x, T y, boolean isStrictFP); + protected abstract ValueNode genFloatRem(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP); private void genArithmeticOp(Kind result, int opcode) { - T y = frameState.pop(result); - T x = frameState.pop(result); + ValueNode y = frameState.pop(result); + ValueNode x = frameState.pop(result); boolean isStrictFP = method.isStrict(); - T v; + ValueNode v; switch (opcode) { case IADD: case LADD: @@ -362,14 +346,14 @@ frameState.push(result, append(v)); } - protected abstract T genIntegerDiv(Kind kind, T x, T y); + protected abstract ValueNode genIntegerDiv(Kind kind, ValueNode x, ValueNode y); - protected abstract T genIntegerRem(Kind kind, T x, T y); + protected abstract ValueNode genIntegerRem(Kind kind, ValueNode x, ValueNode y); private void genIntegerDivOp(Kind result, int opcode) { - T y = frameState.pop(result); - T x = frameState.pop(result); - T v; + ValueNode y = frameState.pop(result); + ValueNode x = frameState.pop(result); + ValueNode v; switch (opcode) { case IDIV: case LDIV: @@ -385,22 +369,22 @@ frameState.push(result, append(v)); } - protected abstract T genNegateOp(T x); + protected abstract ValueNode genNegateOp(ValueNode x); private void genNegateOp(Kind kind) { frameState.push(kind, append(genNegateOp(frameState.pop(kind)))); } - protected abstract T genLeftShift(Kind kind, T x, T y); + protected abstract ValueNode genLeftShift(Kind kind, ValueNode x, ValueNode y); - protected abstract T genRightShift(Kind kind, T x, T y); + protected abstract ValueNode genRightShift(Kind kind, ValueNode x, ValueNode y); - protected abstract T genUnsignedRightShift(Kind kind, T x, T y); + protected abstract ValueNode genUnsignedRightShift(Kind kind, ValueNode x, ValueNode y); private void genShiftOp(Kind kind, int opcode) { - T s = frameState.ipop(); - T x = frameState.pop(kind); - T v; + ValueNode s = frameState.ipop(); + ValueNode x = frameState.pop(kind); + ValueNode v; switch (opcode) { case ISHL: case LSHL: @@ -420,16 +404,16 @@ frameState.push(kind, append(v)); } - protected abstract T genAnd(Kind kind, T x, T y); + protected abstract ValueNode genAnd(Kind kind, ValueNode x, ValueNode y); - protected abstract T genOr(Kind kind, T x, T y); + protected abstract ValueNode genOr(Kind kind, ValueNode x, ValueNode y); - protected abstract T genXor(Kind kind, T x, T y); + protected abstract ValueNode genXor(Kind kind, ValueNode x, ValueNode y); private void genLogicOp(Kind kind, int opcode) { - T y = frameState.pop(kind); - T x = frameState.pop(kind); - T v; + ValueNode y = frameState.pop(kind); + ValueNode x = frameState.pop(kind); + ValueNode v; switch (opcode) { case IAND: case LAND: @@ -449,29 +433,29 @@ frameState.push(kind, append(v)); } - protected abstract T genNormalizeCompare(T x, T y, boolean isUnorderedLess); + protected abstract ValueNode genNormalizeCompare(ValueNode x, ValueNode y, boolean isUnorderedLess); private void genCompareOp(Kind kind, boolean isUnorderedLess) { - T y = frameState.pop(kind); - T x = frameState.pop(kind); + ValueNode y = frameState.pop(kind); + ValueNode x = frameState.pop(kind); frameState.ipush(append(genNormalizeCompare(x, y, isUnorderedLess))); } - protected abstract T genFloatConvert(FloatConvert op, T input); + protected abstract ValueNode genFloatConvert(FloatConvert op, ValueNode input); private void genFloatConvert(FloatConvert op, Kind from, Kind to) { - T input = frameState.pop(from.getStackKind()); + ValueNode input = frameState.pop(from.getStackKind()); frameState.push(to.getStackKind(), append(genFloatConvert(op, input))); } - protected abstract T genNarrow(T input, int bitCount); + protected abstract ValueNode genNarrow(ValueNode input, int bitCount); - protected abstract T genSignExtend(T input, int bitCount); + protected abstract ValueNode genSignExtend(ValueNode input, int bitCount); - protected abstract T genZeroExtend(T input, int bitCount); + protected abstract ValueNode genZeroExtend(ValueNode input, int bitCount); private void genSignExtend(Kind from, Kind to) { - T input = frameState.pop(from.getStackKind()); + ValueNode input = frameState.pop(from.getStackKind()); if (from != from.getStackKind()) { input = append(genNarrow(input, from.getBitCount())); } @@ -479,7 +463,7 @@ } private void genZeroExtend(Kind from, Kind to) { - T input = frameState.pop(from.getStackKind()); + ValueNode input = frameState.pop(from.getStackKind()); if (from != from.getStackKind()) { input = append(genNarrow(input, from.getBitCount())); } @@ -487,45 +471,45 @@ } private void genNarrow(Kind from, Kind to) { - T input = frameState.pop(from.getStackKind()); + ValueNode input = frameState.pop(from.getStackKind()); frameState.push(to.getStackKind(), append(genNarrow(input, to.getBitCount()))); } private void genIncrement() { int index = getStream().readLocalIndex(); int delta = getStream().readIncrement(); - T x = frameState.loadLocal(index); - T y = appendConstant(JavaConstant.forInt(delta)); + ValueNode x = frameState.loadLocal(index); + ValueNode y = appendConstant(JavaConstant.forInt(delta)); frameState.storeLocal(index, append(genIntegerAdd(Kind.Int, x, y))); } protected abstract void genGoto(); - protected abstract T genObjectEquals(T x, T y); + protected abstract ValueNode genObjectEquals(ValueNode x, ValueNode y); - protected abstract T genIntegerEquals(T x, T y); + protected abstract ValueNode genIntegerEquals(ValueNode x, ValueNode y); - protected abstract T genIntegerLessThan(T x, T y); + protected abstract ValueNode genIntegerLessThan(ValueNode x, ValueNode y); - protected abstract T genUnique(T x); + protected abstract ValueNode genUnique(ValueNode x); - protected abstract void genIf(T x, Condition cond, T y); + protected abstract void genIf(ValueNode x, Condition cond, ValueNode y); private void genIfZero(Condition cond) { - T y = appendConstant(JavaConstant.INT_0); - T x = frameState.ipop(); + ValueNode y = appendConstant(JavaConstant.INT_0); + ValueNode x = frameState.ipop(); genIf(x, cond, y); } private void genIfNull(Condition cond) { - T y = appendConstant(JavaConstant.NULL_POINTER); - T x = frameState.apop(); + ValueNode y = appendConstant(JavaConstant.NULL_POINTER); + ValueNode x = frameState.apop(); genIf(x, cond, y); } private void genIfSame(Kind kind, Condition cond) { - T y = frameState.pop(kind); - T x = frameState.pop(kind); + ValueNode y = frameState.pop(kind); + ValueNode x = frameState.pop(kind); // assert !x.isDeleted() && !y.isDeleted(); genIf(x, cond, y); } @@ -573,48 +557,47 @@ } private JavaTypeProfile getProfileForTypeCheck(ResolvedJavaType type) { - if (profilingInfo == null || !optimisticOpts.useTypeCheckHints() || !canHaveSubtype(type)) { + if (parsingReplacement || profilingInfo == null || !optimisticOpts.useTypeCheckHints() || !canHaveSubtype(type)) { return null; } else { return profilingInfo.getTypeProfile(bci()); } } - protected abstract T createCheckCast(ResolvedJavaType type, T object, JavaTypeProfile profileForTypeCheck, boolean forStoreCheck); + protected abstract ValueNode createCheckCast(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck, boolean forStoreCheck); private void genCheckCast() { int cpi = getStream().readCPI(); JavaType type = lookupType(cpi, CHECKCAST); - T object = frameState.apop(); + ValueNode object = frameState.apop(); if (type instanceof ResolvedJavaType) { JavaTypeProfile profileForTypeCheck = getProfileForTypeCheck((ResolvedJavaType) type); - T checkCastNode = append(createCheckCast((ResolvedJavaType) type, object, profileForTypeCheck, false)); + ValueNode checkCastNode = append(createCheckCast((ResolvedJavaType) type, object, profileForTypeCheck, false)); frameState.apush(checkCastNode); } else { handleUnresolvedCheckCast(type, object); } } - protected abstract T createInstanceOf(ResolvedJavaType type, T object, JavaTypeProfile profileForTypeCheck); + protected abstract ValueNode createInstanceOf(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck); - protected abstract T genConditional(T x); + protected abstract ValueNode genConditional(ValueNode x); private void genInstanceOf() { int cpi = getStream().readCPI(); JavaType type = lookupType(cpi, INSTANCEOF); - T object = frameState.apop(); + ValueNode object = frameState.apop(); if (type instanceof ResolvedJavaType) { ResolvedJavaType resolvedType = (ResolvedJavaType) type; - T instanceOfNode = createInstanceOf((ResolvedJavaType) type, object, getProfileForTypeCheck(resolvedType)); + ValueNode instanceOfNode = createInstanceOf((ResolvedJavaType) type, object, getProfileForTypeCheck(resolvedType)); frameState.ipush(append(genConditional(genUnique(instanceOfNode)))); } else { handleUnresolvedInstanceOf(type, object); } } - protected abstract T createNewInstance(ResolvedJavaType type, boolean fillContents); + protected abstract ValueNode createNewInstance(ResolvedJavaType type, boolean fillContents); - @SuppressWarnings("unchecked") void genNewInstance(int cpi) { JavaType type = lookupType(cpi, NEW); if (type instanceof ResolvedJavaType && ((ResolvedJavaType) type).isInitialized()) { @@ -622,7 +605,7 @@ if (skippedExceptionTypes != null) { for (ResolvedJavaType exceptionType : skippedExceptionTypes) { if (exceptionType.isAssignableFrom((ResolvedJavaType) type)) { - append((T) new DeoptimizeNode(DeoptimizationAction.None, TransferToInterpreter)); + append(new DeoptimizeNode(DeoptimizationAction.None, TransferToInterpreter)); return; } } @@ -673,7 +656,7 @@ private void genNewObjectArray(int cpi) { JavaType type = lookupType(cpi, ANEWARRAY); - T length = frameState.ipop(); + ValueNode length = frameState.ipop(); if (type instanceof ResolvedJavaType) { frameState.apush(append(createNewArray((ResolvedJavaType) type, length, true))); } else { @@ -682,12 +665,12 @@ } - protected abstract T createNewArray(ResolvedJavaType elementType, T length, boolean fillContents); + protected abstract ValueNode createNewArray(ResolvedJavaType elementType, ValueNode length, boolean fillContents); private void genNewMultiArray(int cpi) { JavaType type = lookupType(cpi, MULTIANEWARRAY); int rank = getStream().readUByte(bci() + 3); - List<T> dims = new ArrayList<>(Collections.nCopies(rank, null)); + List<ValueNode> dims = new ArrayList<>(Collections.nCopies(rank, null)); for (int i = rank - 1; i >= 0; i--) { dims.set(i, frameState.ipop()); } @@ -698,18 +681,18 @@ } } - protected abstract T createNewMultiArray(ResolvedJavaType type, List<T> dims); + protected abstract ValueNode createNewMultiArray(ResolvedJavaType type, List<ValueNode> dims); - protected abstract T genLoadField(T receiver, ResolvedJavaField field); + protected abstract ValueNode genLoadField(ValueNode receiver, ResolvedJavaField field); private void genGetField(JavaField field) { emitExplicitExceptions(frameState.peek(0), null); Kind kind = field.getKind(); - T receiver = frameState.apop(); + ValueNode receiver = frameState.apop(); if ((field instanceof ResolvedJavaField) && ((ResolvedJavaField) field).getDeclaringClass().isInitialized()) { LoadFieldPlugin loadFieldPlugin = this.graphBuilderConfig.getLoadFieldPlugin(); - if (loadFieldPlugin == null || !loadFieldPlugin.apply((GraphBuilderContext) this, (ValueNode) receiver, (ResolvedJavaField) field)) { + if (loadFieldPlugin == null || !loadFieldPlugin.apply((GraphBuilderContext) this, receiver, (ResolvedJavaField) field)) { appendOptimizedLoadField(kind, genLoadField(receiver, (ResolvedJavaField) field)); } } else { @@ -717,15 +700,15 @@ } } - protected abstract void emitNullCheck(T receiver); + protected abstract void emitNullCheck(ValueNode receiver); - protected abstract void emitBoundsCheck(T index, T length); + protected abstract void emitBoundsCheck(ValueNode index, ValueNode length); private static final DebugMetric EXPLICIT_EXCEPTIONS = Debug.metric("ExplicitExceptions"); - protected abstract T genArrayLength(T x); + protected abstract ValueNode genArrayLength(ValueNode x); - protected void emitExplicitExceptions(T receiver, T outOfBoundsIndex) { + protected void emitExplicitExceptions(ValueNode receiver, ValueNode outOfBoundsIndex) { assert receiver != null; if (graphBuilderConfig.omitAllExceptionEdges() || profilingInfo == null || (optimisticOpts.useExceptionProbabilityForOperations() && profilingInfo.getExceptionSeen(bci()) == TriState.FALSE && !GraalOptions.StressExplicitExceptionCode.getValue())) { @@ -734,19 +717,19 @@ emitNullCheck(receiver); if (outOfBoundsIndex != null) { - T length = append(genArrayLength(receiver)); + ValueNode length = append(genArrayLength(receiver)); emitBoundsCheck(outOfBoundsIndex, length); } EXPLICIT_EXCEPTIONS.increment(); } - protected abstract T genStoreField(T receiver, ResolvedJavaField field, T value); + protected abstract ValueNode genStoreField(ValueNode receiver, ResolvedJavaField field, ValueNode value); private void genPutField(JavaField field) { emitExplicitExceptions(frameState.peek(1), null); - T value = frameState.pop(field.getKind().getStackKind()); - T receiver = frameState.apop(); + ValueNode value = frameState.pop(field.getKind().getStackKind()); + ValueNode receiver = frameState.apop(); if (field instanceof ResolvedJavaField && ((ResolvedJavaField) field).getDeclaringClass().isInitialized()) { appendOptimizedStoreField(genStoreField(receiver, (ResolvedJavaField) field, value)); } else { @@ -757,7 +740,7 @@ private void genGetStatic(JavaField field) { Kind kind = field.getKind(); if (field instanceof ResolvedJavaField && ((ResolvedJavaType) field.getDeclaringClass()).isInitialized()) { - InvocationPlugin.LoadFieldPlugin loadFieldPlugin = this.graphBuilderConfig.getLoadFieldPlugin(); + LoadFieldPlugin loadFieldPlugin = this.graphBuilderConfig.getLoadFieldPlugin(); if (loadFieldPlugin == null || !loadFieldPlugin.apply((GraphBuilderContext) this, (ResolvedJavaField) field)) { appendOptimizedLoadField(kind, genLoadField(null, (ResolvedJavaField) field)); } @@ -767,7 +750,7 @@ } private void genPutStatic(JavaField field) { - T value = frameState.pop(field.getKind().getStackKind()); + ValueNode value = frameState.pop(field.getKind().getStackKind()); if (field instanceof ResolvedJavaField && ((ResolvedJavaType) field.getDeclaringClass()).isInitialized()) { appendOptimizedStoreField(genStoreField(null, (ResolvedJavaField) field, value)); } else { @@ -775,13 +758,13 @@ } } - protected void appendOptimizedStoreField(T store) { + protected void appendOptimizedStoreField(ValueNode store) { append(store); } - protected void appendOptimizedLoadField(Kind kind, T load) { + protected void appendOptimizedLoadField(Kind kind, ValueNode load) { // append the load to the instruction - T optimized = append(load); + ValueNode optimized = append(load); frameState.push(kind.getStackKind(), optimized); } @@ -795,11 +778,11 @@ protected abstract void genInvokeSpecial(JavaMethod target); - protected abstract void genReturn(T x); + protected abstract void genReturn(ValueNode x); - protected abstract T genMonitorEnter(T x); + protected abstract ValueNode genMonitorEnter(ValueNode x); - protected abstract T genMonitorExit(T x, T returnValue); + protected abstract ValueNode genMonitorExit(ValueNode x, ValueNode returnValue); protected abstract void genJsr(int dest); @@ -844,7 +827,7 @@ private void genSwitch(BytecodeSwitch bs) { int bci = bci(); - T value = frameState.ipop(); + ValueNode value = frameState.ipop(); int nofCases = bs.numberOfCases(); double[] keyProbabilities = switchProbability(nofCases + 1, bci); @@ -862,12 +845,13 @@ int[] keySuccessors = new int[nofCases + 1]; int deoptSuccessorIndex = -1; int nextSuccessorIndex = 0; + boolean constantValue = value.isConstant(); for (int i = 0; i < nofCases + 1; i++) { if (i < nofCases) { keys[i] = bs.keyAt(i); } - if (isNeverExecutedCode(keyProbabilities[i])) { + if (!constantValue && isNeverExecutedCode(keyProbabilities[i])) { if (deoptSuccessorIndex < 0) { deoptSuccessorIndex = nextSuccessorIndex++; actualSuccessors.add(null); @@ -888,7 +872,7 @@ } - protected abstract void genIntegerSwitch(T value, ArrayList<BciBlock> actualSuccessors, int[] keys, double[] keyProbabilities, int[] keySuccessors); + protected abstract void genIntegerSwitch(ValueNode value, ArrayList<BciBlock> actualSuccessors, int[] keys, double[] keyProbabilities, int[] keySuccessors); private static class SuccessorInfo { @@ -901,9 +885,9 @@ } } - protected abstract T appendConstant(JavaConstant constant); + protected abstract ValueNode appendConstant(JavaConstant constant); - protected abstract T append(T v); + protected abstract ValueNode append(ValueNode v); protected boolean isNeverExecutedCode(double probability) { return probability == 0 && optimisticOpts.removeNeverExecutedCode(); @@ -1051,9 +1035,9 @@ case BASTORE : genStoreIndexed(Kind.Byte ); break; case CASTORE : genStoreIndexed(Kind.Char ); break; case SASTORE : genStoreIndexed(Kind.Short ); break; - case POP : // fall through - case POP2 : // fall through - case DUP : // fall through + case POP : frameState.xpop(); break; + case POP2 : frameState.xpop(); frameState.xpop(); break; + case DUP : frameState.xpush(frameState.xpeek()); break; case DUP_X1 : // fall through case DUP_X2 : // fall through case DUP2 : // fall through @@ -1182,7 +1166,7 @@ return method; } - public F getFrameState() { + public HIRFrameStateBuilder getFrameState() { return frameState; }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractFrameStateBuilder.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractFrameStateBuilder.java Mon Feb 23 16:23:23 2015 -0800 @@ -26,7 +26,6 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.java.BciBlockMapping.BciBlock; -import com.oracle.graal.java.BciBlockMapping.LocalLiveness; public abstract class AbstractFrameStateBuilder<T extends KindProvider, S extends AbstractFrameStateBuilder<T, S>> { @@ -37,15 +36,21 @@ protected T[] lockedObjects; /** + * Specifies if asserting type checks are enabled. + */ + protected final boolean checkTypes; + + /** * @see BytecodeFrame#rethrowException */ protected boolean rethrowException; - public AbstractFrameStateBuilder(ResolvedJavaMethod method) { + public AbstractFrameStateBuilder(ResolvedJavaMethod method, boolean checkTypes) { this.method = method; this.locals = allocateArray(method.getMaxLocals()); this.stack = allocateArray(Math.max(1, method.getMaxStackSize())); this.lockedObjects = allocateArray(0); + this.checkTypes = checkTypes; } protected AbstractFrameStateBuilder(S other) { @@ -55,6 +60,7 @@ this.stack = other.stack.clone(); this.lockedObjects = other.lockedObjects.length == 0 ? other.lockedObjects : other.lockedObjects.clone(); this.rethrowException = other.rethrowException; + this.checkTypes = other.checkTypes; assert locals.length == method.getMaxLocals(); assert stack.length == Math.max(1, method.getMaxStackSize()); @@ -172,8 +178,8 @@ public T loadLocal(int i) { T x = locals[i]; assert x != null : i; - assert x.getKind().getSlotCount() == 1 || locals[i + 1] == null; - assert i == 0 || locals[i - 1] == null || locals[i - 1].getKind().getSlotCount() == 1; + assert !checkTypes || (x.getKind().getSlotCount() == 1 || locals[i + 1] == null); + assert !checkTypes || (i == 0 || locals[i - 1] == null || locals[i - 1].getKind().getSlotCount() == 1); return x; } @@ -185,7 +191,7 @@ * @param x the instruction which produces the value for the local */ public void storeLocal(int i, T x) { - assert x == null || x.getKind() != Kind.Void && x.getKind() != Kind.Illegal : "unexpected value: " + x; + assert x == null || !checkTypes || (x.getKind() != Kind.Void && x.getKind() != Kind.Illegal) : "unexpected value: " + x; locals[i] = x; if (x != null && x.getKind().needsTwoSlots()) { // if this is a double word, then kill i+1 @@ -212,7 +218,7 @@ * @param x the instruction to push onto the stack */ public void push(Kind kind, T x) { - assert x.getKind() != Kind.Void && x.getKind() != Kind.Illegal; + assert !checkTypes || (x.getKind() != Kind.Void && x.getKind() != Kind.Illegal) : x; xpush(assertKind(kind, x)); if (kind.needsTwoSlots()) { xpush(null); @@ -225,7 +231,7 @@ * @param x the instruction to push onto the stack */ public void xpush(T x) { - assert x == null || (x.getKind() != Kind.Void && x.getKind() != Kind.Illegal); + assert !checkTypes || (x == null || (x.getKind() != Kind.Void && x.getKind() != Kind.Illegal)); stack[stackSize++] = x; } @@ -369,7 +375,7 @@ newStackSize--; assert stack[newStackSize].getKind().needsTwoSlots(); } else { - assert stack[newStackSize].getKind().getSlotCount() == 1; + assert !checkTypes || (stack[newStackSize].getKind().getSlotCount() == 1); } result[i] = stack[newStackSize]; } @@ -405,7 +411,7 @@ } private T assertKind(Kind kind, T x) { - assert x != null && x.getKind() == kind : "kind=" + kind + ", value=" + x + ((x == null) ? "" : ", value.kind=" + x.getKind()); + assert x != null && (!checkTypes || x.getKind() == kind) : "kind=" + kind + ", value=" + x + ((x == null) ? "" : ", value.kind=" + x.getKind()); return x; } @@ -425,7 +431,7 @@ } private T assertObject(T x) { - assert x != null && (x.getKind() == Kind.Object); + assert x != null && (!checkTypes || (x.getKind() == Kind.Object)); return x; }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, 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 @@ -32,8 +32,6 @@ import com.oracle.graal.bytecode.*; import com.oracle.graal.compiler.common.*; import com.oracle.graal.debug.*; -import com.oracle.graal.debug.Debug.Scope; -import com.oracle.graal.nodes.*; /** * Builds a mapping between bytecodes and basic blocks and builds a conservative control flow graph @@ -86,11 +84,6 @@ protected List<BciBlock> successors; private int predecessorCount; - private FixedWithNextNode firstInstruction; - private AbstractFrameStateBuilder<?, ?> entryState; - private FixedWithNextNode[] firstInstructionArray; - private AbstractFrameStateBuilder<?, ?>[] entryStateArray; - private boolean visited; private boolean active; public long loops; @@ -250,7 +243,7 @@ return jsrData; } - public void setEndsWithRet() { + void setEndsWithRet() { getOrCreateJSRData().endsWithRet = true; } @@ -270,7 +263,7 @@ } } - public void setRetSuccessor(BciBlock bciBlock) { + void setRetSuccessor(BciBlock bciBlock) { this.getOrCreateJSRData().retSuccessor = bciBlock; } @@ -313,78 +306,18 @@ } } - public void setJsrScope(JsrScope nextScope) { + void setJsrScope(JsrScope nextScope) { this.getOrCreateJSRData().jsrScope = nextScope; } - public void setJsrSuccessor(BciBlock clone) { + void setJsrSuccessor(BciBlock clone) { this.getOrCreateJSRData().jsrSuccessor = clone; } - public void setJsrReturnBci(int bci) { + void setJsrReturnBci(int bci) { this.getOrCreateJSRData().jsrReturnBci = bci; } - public FixedWithNextNode getFirstInstruction(int dimension) { - if (dimension == 0) { - return firstInstruction; - } else { - if (firstInstructionArray != null && dimension - 1 < firstInstructionArray.length) { - return firstInstructionArray[dimension - 1]; - } else { - return null; - } - } - } - - public void setFirstInstruction(int dimension, FixedWithNextNode firstInstruction) { - if (dimension == 0) { - this.firstInstruction = firstInstruction; - } else { - if (firstInstructionArray == null) { - firstInstructionArray = new FixedWithNextNode[4]; - } - if (dimension - 1 < firstInstructionArray.length) { - // We are within bounds. - } else { - // We are out of bounds. - firstInstructionArray = Arrays.copyOf(firstInstructionArray, Math.max(firstInstructionArray.length * 2, dimension)); - } - - firstInstructionArray[dimension - 1] = firstInstruction; - } - } - - public AbstractFrameStateBuilder<?, ?> getEntryState(int dimension) { - if (dimension == 0) { - return entryState; - } else { - if (entryStateArray != null && dimension - 1 < entryStateArray.length) { - return entryStateArray[dimension - 1]; - } else { - return null; - } - } - } - - public void setEntryState(int dimension, AbstractFrameStateBuilder<?, ?> entryState) { - if (dimension == 0) { - this.entryState = entryState; - } else { - if (entryStateArray == null) { - entryStateArray = new AbstractFrameStateBuilder<?, ?>[4]; - } - if (dimension - 1 < entryStateArray.length) { - // We are within bounds. - } else { - // We are out of bounds. - entryStateArray = Arrays.copyOf(entryStateArray, Math.max(entryStateArray.length * 2, dimension)); - } - - entryStateArray[dimension - 1] = entryState; - } - } - public int getSuccessorCount() { return successors.size(); } @@ -393,7 +326,7 @@ return successors; } - public void setId(int i) { + void setId(int i) { this.id = i; } @@ -424,35 +357,26 @@ private BciBlock[] blocks; public final ResolvedJavaMethod method; public boolean hasJsrBytecodes; - public BciBlock startBlock; - private final BytecodeStream stream; private final ExceptionHandler[] exceptionHandlers; - private BciBlock[] blockMap; + private BciBlock startBlock; private BciBlock[] loopHeaders; private static final int LOOP_HEADER_MAX_CAPACITY = Long.SIZE; private static final int LOOP_HEADER_INITIAL_CAPACITY = 4; - private final boolean doLivenessAnalysis; - public LocalLiveness liveness; private int blocksNotYetAssignedId; - private final boolean consecutiveLoopBlocks; public int returnCount; + private int returnBci; /** * Creates a new BlockMap instance from bytecode of the given method . * * @param method the compiler interface method containing the code */ - private BciBlockMapping(ResolvedJavaMethod method, boolean doLivenessAnalysis, boolean consecutiveLoopBlocks) { - this.doLivenessAnalysis = doLivenessAnalysis; - this.consecutiveLoopBlocks = consecutiveLoopBlocks; + private BciBlockMapping(ResolvedJavaMethod method) { this.method = method; this.exceptionHandlers = method.getExceptionHandlers(); - this.stream = new BytecodeStream(method.getCode()); - int codeSize = method.getCodeSize(); - this.blockMap = new BciBlock[codeSize]; } public BciBlock[] getBlocks() { @@ -466,37 +390,28 @@ /** * Builds the block map and conservative CFG and numbers blocks. */ - public void build() { - makeExceptionEntries(); - iterateOverBytecodes(); + public void build(BytecodeStream stream) { + int codeSize = method.getCodeSize(); + BciBlock[] blockMap = new BciBlock[codeSize]; + makeExceptionEntries(blockMap); + iterateOverBytecodes(blockMap, stream); if (hasJsrBytecodes) { if (!SupportJsrBytecodes.getValue()) { throw new JsrNotSupportedBailout("jsr/ret parsing disabled"); } - createJsrAlternatives(blockMap[0]); + createJsrAlternatives(blockMap, blockMap[0]); } if (Debug.isLogEnabled()) { - this.log("Before BlockOrder"); + this.log(blockMap, "Before BlockOrder"); } - computeBlockOrder(); - fixLoopBits(); - - startBlock = blockMap[0]; + computeBlockOrder(blockMap); + fixLoopBits(blockMap); assert verify(); - // Discard big arrays so that they can be GCed - blockMap = null; + startBlock = blockMap[0]; if (Debug.isLogEnabled()) { - this.log("Before LivenessAnalysis"); - } - if (doLivenessAnalysis) { - try (Scope s = Debug.scope("LivenessAnalysis")) { - liveness = method.getMaxLocals() <= 64 ? new SmallLocalLiveness() : new LargeLocalLiveness(); - liveness.computeLiveness(); - } catch (Throwable e) { - throw Debug.handle(e); - } + this.log(blockMap, "Before LivenessAnalysis"); } } @@ -515,15 +430,15 @@ return true; } - private void makeExceptionEntries() { + private void makeExceptionEntries(BciBlock[] blockMap) { // start basic blocks at all exception handler blocks and mark them as exception entries for (ExceptionHandler h : this.exceptionHandlers) { - BciBlock xhandler = makeBlock(h.getHandlerBCI()); + BciBlock xhandler = makeBlock(blockMap, h.getHandlerBCI()); xhandler.isExceptionEntry = true; } } - private void iterateOverBytecodes() { + private void iterateOverBytecodes(BciBlock[] blockMap, BytecodeStream stream) { // iterate over the bytecodes top to bottom. // mark the entrypoints of basic blocks and build lists of successors for // all bytecodes that end basic blocks (i.e. goto, ifs, switches, throw, jsr, returns, ret) @@ -533,9 +448,9 @@ int bci = stream.currentBCI(); if (current == null || blockMap[bci] != null) { - BciBlock b = makeBlock(bci); + BciBlock b = makeBlock(blockMap, bci); if (current != null) { - addSuccessor(current.endBci, b); + addSuccessor(blockMap, current.endBci, b); } current = b; } @@ -551,13 +466,14 @@ case RETURN: { returnCount++; current = null; + returnBci = bci; break; } case ATHROW: { current = null; - ExceptionDispatchBlock handler = handleExceptions(bci); + ExceptionDispatchBlock handler = handleExceptions(blockMap, bci); if (handler != null) { - addSuccessor(bci, handler); + addSuccessor(blockMap, bci, handler); } break; } @@ -578,24 +494,24 @@ case IFNULL: // fall through case IFNONNULL: { current = null; - addSuccessor(bci, makeBlock(stream.readBranchDest())); - addSuccessor(bci, makeBlock(stream.nextBCI())); + addSuccessor(blockMap, bci, makeBlock(blockMap, stream.readBranchDest())); + addSuccessor(blockMap, bci, makeBlock(blockMap, stream.nextBCI())); break; } case GOTO: case GOTO_W: { current = null; - addSuccessor(bci, makeBlock(stream.readBranchDest())); + addSuccessor(blockMap, bci, makeBlock(blockMap, stream.readBranchDest())); break; } case TABLESWITCH: { current = null; - addSwitchSuccessors(bci, new BytecodeTableSwitch(stream, bci)); + addSwitchSuccessors(blockMap, bci, new BytecodeTableSwitch(stream, bci)); break; } case LOOKUPSWITCH: { current = null; - addSwitchSuccessors(bci, new BytecodeLookupSwitch(stream, bci)); + addSwitchSuccessors(blockMap, bci, new BytecodeLookupSwitch(stream, bci)); break; } case JSR: @@ -605,11 +521,11 @@ if (target == 0) { throw new JsrNotSupportedBailout("jsr target bci 0 not allowed"); } - BciBlock b1 = makeBlock(target); + BciBlock b1 = makeBlock(blockMap, target); current.setJsrSuccessor(b1); current.setJsrReturnBci(stream.nextBCI()); current = null; - addSuccessor(bci, b1); + addSuccessor(blockMap, bci, b1); break; } case RET: { @@ -622,11 +538,11 @@ case INVOKESTATIC: case INVOKEVIRTUAL: case INVOKEDYNAMIC: { - ExceptionDispatchBlock handler = handleExceptions(bci); + ExceptionDispatchBlock handler = handleExceptions(blockMap, bci); if (handler != null) { current = null; - addSuccessor(bci, makeBlock(stream.nextBCI())); - addSuccessor(bci, handler); + addSuccessor(blockMap, bci, makeBlock(blockMap, stream.nextBCI())); + addSuccessor(blockMap, bci, handler); } break; } @@ -648,11 +564,11 @@ case SALOAD: case PUTFIELD: case GETFIELD: { - ExceptionDispatchBlock handler = handleExceptions(bci); + ExceptionDispatchBlock handler = handleExceptions(blockMap, bci); if (handler != null) { current = null; - addSuccessor(bci, makeBlock(stream.nextBCI())); - addSuccessor(bci, handler); + addSuccessor(blockMap, bci, makeBlock(blockMap, stream.nextBCI())); + addSuccessor(blockMap, bci, handler); } } } @@ -660,7 +576,7 @@ } } - private BciBlock makeBlock(int startBci) { + private BciBlock makeBlock(BciBlock[] blockMap, int startBci) { BciBlock oldBlock = blockMap[startBci]; if (oldBlock == null) { BciBlock newBlock = new BciBlock(); @@ -694,7 +610,7 @@ } } - private void addSwitchSuccessors(int predBci, BytecodeSwitch bswitch) { + private void addSwitchSuccessors(BciBlock[] blockMap, int predBci, BytecodeSwitch bswitch) { // adds distinct targets to the successor list Collection<Integer> targets = new TreeSet<>(); for (int i = 0; i < bswitch.numberOfCases(); i++) { @@ -702,11 +618,11 @@ } targets.add(bswitch.defaultTarget()); for (int targetBci : targets) { - addSuccessor(predBci, makeBlock(targetBci)); + addSuccessor(blockMap, predBci, makeBlock(blockMap, targetBci)); } } - private void addSuccessor(int predBci, BciBlock sux) { + private static void addSuccessor(BciBlock[] blockMap, int predBci, BciBlock sux) { BciBlock predecessor = blockMap[predBci]; if (sux.isExceptionEntry) { throw new BailoutException("Exception handler can be reached by both normal and exceptional control flow"); @@ -716,7 +632,7 @@ private final ArrayList<BciBlock> jsrVisited = new ArrayList<>(); - private void createJsrAlternatives(BciBlock block) { + private void createJsrAlternatives(BciBlock[] blockMap, BciBlock block) { jsrVisited.add(block); JsrScope scope = block.getJsrScope(); @@ -763,14 +679,14 @@ } for (BciBlock successor : block.getSuccessors()) { if (!jsrVisited.contains(successor)) { - createJsrAlternatives(successor); + createJsrAlternatives(blockMap, successor); } } } private HashMap<ExceptionHandler, ExceptionDispatchBlock> initialExceptionDispatch = CollectionsFactory.newMap(); - private ExceptionDispatchBlock handleExceptions(int bci) { + private ExceptionDispatchBlock handleExceptions(BciBlock[] blockMap, int bci) { ExceptionDispatchBlock lastHandler = null; for (int i = exceptionHandlers.length - 1; i >= 0; i--) { @@ -805,14 +721,14 @@ private boolean loopChanges; - private void fixLoopBits() { + private void fixLoopBits(BciBlock[] blockMap) { do { loopChanges = false; for (BciBlock b : blocks) { b.visited = false; } - long loop = fixLoopBits(blockMap[0]); + long loop = fixLoopBits(blockMap, blockMap[0]); if (loop != 0) { // There is a path from a loop end to the method entry that does not pass the loop @@ -825,7 +741,7 @@ } while (loopChanges); } - private void computeBlockOrder() { + private void computeBlockOrder(BciBlock[] blockMap) { int maxBlocks = blocksNotYetAssignedId; this.blocks = new BciBlock[blocksNotYetAssignedId]; long loop = computeBlockOrder(blockMap[0]); @@ -837,17 +753,9 @@ throw new BailoutException("Non-reducible loop"); } - if (blocks[0] != null && this.nextLoop == 0) { - // No unreached blocks and no loops - for (int i = 0; i < blocks.length; ++i) { - blocks[i].setId(i); - } - return; - } - // Purge null entries for unreached blocks and sort blocks such that loop bodies are always // consecutively in the array. - int blockCount = maxBlocks - blocksNotYetAssignedId; + int blockCount = maxBlocks - blocksNotYetAssignedId + 2; BciBlock[] newBlocks = new BciBlock[blockCount]; int next = 0; for (int i = 0; i < blocks.length; ++i) { @@ -855,11 +763,27 @@ if (b != null) { b.setId(next); newBlocks[next++] = b; - if (consecutiveLoopBlocks && b.isLoopHeader) { + if (b.isLoopHeader) { next = handleLoopHeader(newBlocks, next, i, b); } } } + + // Add return block. + BciBlock returnBlock = new BciBlock(); + returnBlock.startBci = returnBci; + returnBlock.endBci = returnBci; + returnBlock.setId(newBlocks.length - 2); + newBlocks[newBlocks.length - 2] = returnBlock; + + // Add unwind block. + ExceptionDispatchBlock unwindBlock = new ExceptionDispatchBlock(); + unwindBlock.startBci = -1; + unwindBlock.endBci = -1; + unwindBlock.deoptBci = method.isSynchronized() ? BytecodeFrame.UNWIND_BCI : BytecodeFrame.AFTER_EXCEPTION_BCI; + unwindBlock.setId(newBlocks.length - 1); + newBlocks[newBlocks.length - 1] = unwindBlock; + blocks = newBlocks; } @@ -882,7 +806,7 @@ return next; } - public void log(String name) { + public void log(BciBlock[] blockMap, String name) { if (Debug.isLogEnabled()) { String n = System.lineSeparator(); StringBuilder sb = new StringBuilder(Debug.currentScope()).append("BlockMap ").append(name).append(" :"); @@ -1018,7 +942,7 @@ return loops; } - private long fixLoopBits(BciBlock block) { + private long fixLoopBits(BciBlock[] blockMap, BciBlock block) { if (block.visited) { // Return cached loop information for this block. if (block.isLoopHeader) { @@ -1032,7 +956,7 @@ long loops = block.loops; for (BciBlock successor : block.getSuccessors()) { // Recursively process successors. - loops |= fixLoopBits(successor); + loops |= fixLoopBits(blockMap, successor); } if (block.loops != loops) { loopChanges = true; @@ -1047,241 +971,9 @@ return loops; } - /** - * Encapsulates the liveness calculation, so that subclasses for locals ≤ 64 and locals > - * 64 can be implemented. - */ - public abstract class LocalLiveness { - - private void computeLiveness() { - for (BciBlock block : blocks) { - computeLocalLiveness(block); - } - - boolean changed; - int iteration = 0; - do { - Debug.log("Iteration %d", iteration); - changed = false; - for (int i = blocks.length - 1; i >= 0; i--) { - BciBlock block = blocks[i]; - int blockID = block.getId(); - // log statements in IFs because debugLiveX creates a new String - if (Debug.isLogEnabled()) { - Debug.logv(" start B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.getId(), block.startBci, block.endBci, debugLiveIn(blockID), debugLiveOut(blockID), - debugLiveGen(blockID), debugLiveKill(blockID)); - } - - boolean blockChanged = (iteration == 0); - if (block.getSuccessorCount() > 0) { - int oldCardinality = liveOutCardinality(blockID); - for (BciBlock sux : block.getSuccessors()) { - if (Debug.isLogEnabled()) { - Debug.log(" Successor B%d: %s", sux.getId(), debugLiveIn(sux.getId())); - } - propagateLiveness(blockID, sux.getId()); - } - blockChanged |= (oldCardinality != liveOutCardinality(blockID)); - } - - if (blockChanged) { - updateLiveness(blockID); - if (Debug.isLogEnabled()) { - Debug.logv(" end B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.getId(), block.startBci, block.endBci, debugLiveIn(blockID), debugLiveOut(blockID), - debugLiveGen(blockID), debugLiveKill(blockID)); - } - } - changed |= blockChanged; - } - iteration++; - } while (changed); - } - - /** - * Returns whether the local is live at the beginning of the given block. - */ - public abstract boolean localIsLiveIn(BciBlock block, int local); - - /** - * Returns whether the local is set in the given loop. - */ - public abstract boolean localIsChangedInLoop(int loopId, int local); - - /** - * Returns whether the local is live at the end of the given block. - */ - public abstract boolean localIsLiveOut(BciBlock block, int local); - - /** - * Returns a string representation of the liveIn values of the given block. - */ - protected abstract String debugLiveIn(int blockID); - - /** - * Returns a string representation of the liveOut values of the given block. - */ - protected abstract String debugLiveOut(int blockID); - - /** - * Returns a string representation of the liveGen values of the given block. - */ - protected abstract String debugLiveGen(int blockID); - - /** - * Returns a string representation of the liveKill values of the given block. - */ - protected abstract String debugLiveKill(int blockID); - - /** - * Returns the number of live locals at the end of the given block. - */ - protected abstract int liveOutCardinality(int blockID); - - /** - * Adds all locals the are in the liveIn of the successor to the liveOut of the block. - */ - protected abstract void propagateLiveness(int blockID, int successorID); - - /** - * Calculates a new liveIn for the given block from liveOut, liveKill and liveGen. - */ - protected abstract void updateLiveness(int blockID); - - /** - * Adds the local to liveGen if it wasn't already killed in this block. - */ - protected abstract void loadOne(int blockID, int local); - - /** - * Add this local to liveKill if it wasn't already generated in this block. - */ - protected abstract void storeOne(int blockID, int local); - - private void computeLocalLiveness(BciBlock block) { - if (block.startBci < 0 || block.endBci < 0) { - return; - } - int blockID = block.getId(); - int localIndex; - stream.setBCI(block.startBci); - while (stream.currentBCI() <= block.endBci) { - switch (stream.currentBC()) { - case LLOAD: - case DLOAD: - loadTwo(blockID, stream.readLocalIndex()); - break; - case LLOAD_0: - case DLOAD_0: - loadTwo(blockID, 0); - break; - case LLOAD_1: - case DLOAD_1: - loadTwo(blockID, 1); - break; - case LLOAD_2: - case DLOAD_2: - loadTwo(blockID, 2); - break; - case LLOAD_3: - case DLOAD_3: - loadTwo(blockID, 3); - break; - case IINC: - localIndex = stream.readLocalIndex(); - loadOne(blockID, localIndex); - storeOne(blockID, localIndex); - break; - case ILOAD: - case FLOAD: - case ALOAD: - case RET: - loadOne(blockID, stream.readLocalIndex()); - break; - case ILOAD_0: - case FLOAD_0: - case ALOAD_0: - loadOne(blockID, 0); - break; - case ILOAD_1: - case FLOAD_1: - case ALOAD_1: - loadOne(blockID, 1); - break; - case ILOAD_2: - case FLOAD_2: - case ALOAD_2: - loadOne(blockID, 2); - break; - case ILOAD_3: - case FLOAD_3: - case ALOAD_3: - loadOne(blockID, 3); - break; - - case LSTORE: - case DSTORE: - storeTwo(blockID, stream.readLocalIndex()); - break; - case LSTORE_0: - case DSTORE_0: - storeTwo(blockID, 0); - break; - case LSTORE_1: - case DSTORE_1: - storeTwo(blockID, 1); - break; - case LSTORE_2: - case DSTORE_2: - storeTwo(blockID, 2); - break; - case LSTORE_3: - case DSTORE_3: - storeTwo(blockID, 3); - break; - case ISTORE: - case FSTORE: - case ASTORE: - storeOne(blockID, stream.readLocalIndex()); - break; - case ISTORE_0: - case FSTORE_0: - case ASTORE_0: - storeOne(blockID, 0); - break; - case ISTORE_1: - case FSTORE_1: - case ASTORE_1: - storeOne(blockID, 1); - break; - case ISTORE_2: - case FSTORE_2: - case ASTORE_2: - storeOne(blockID, 2); - break; - case ISTORE_3: - case FSTORE_3: - case ASTORE_3: - storeOne(blockID, 3); - break; - } - stream.next(); - } - } - - private void loadTwo(int blockID, int local) { - loadOne(blockID, local); - loadOne(blockID, local + 1); - } - - private void storeTwo(int blockID, int local) { - storeOne(blockID, local); - storeOne(blockID, local + 1); - } - } - - public static BciBlockMapping create(ResolvedJavaMethod method, boolean doLivenessAnalysis, boolean consecutiveLoopBlocks) { - BciBlockMapping map = new BciBlockMapping(method, doLivenessAnalysis, consecutiveLoopBlocks); - map.build(); + public static BciBlockMapping create(BytecodeStream stream, ResolvedJavaMethod method) { + BciBlockMapping map = new BciBlockMapping(method); + map.build(stream); if (Debug.isDumpEnabled()) { Debug.dump(map, method.format("After block building %f %R %H.%n(%P)")); } @@ -1289,228 +981,27 @@ return map; } - public final class SmallLocalLiveness extends LocalLiveness { - /* - * local n is represented by the bit accessible as (1 << n) - */ - - private final long[] localsLiveIn; - private final long[] localsLiveOut; - private final long[] localsLiveGen; - private final long[] localsLiveKill; - private final long[] localsChangedInLoop; - - public SmallLocalLiveness() { - int blockSize = blocks.length; - localsLiveIn = new long[blockSize]; - localsLiveOut = new long[blockSize]; - localsLiveGen = new long[blockSize]; - localsLiveKill = new long[blockSize]; - localsChangedInLoop = new long[BciBlockMapping.this.nextLoop]; - } - - private String debugString(long value) { - StringBuilder str = new StringBuilder("{"); - long current = value; - for (int i = 0; i < method.getMaxLocals(); i++) { - if ((current & 1L) == 1L) { - if (str.length() > 1) { - str.append(", "); - } - str.append(i); - } - current >>= 1; - } - return str.append('}').toString(); - } - - @Override - protected String debugLiveIn(int blockID) { - return debugString(localsLiveIn[blockID]); - } - - @Override - protected String debugLiveOut(int blockID) { - return debugString(localsLiveOut[blockID]); - } - - @Override - protected String debugLiveGen(int blockID) { - return debugString(localsLiveGen[blockID]); - } - - @Override - protected String debugLiveKill(int blockID) { - return debugString(localsLiveKill[blockID]); - } - - @Override - protected int liveOutCardinality(int blockID) { - return Long.bitCount(localsLiveOut[blockID]); - } - - @Override - protected void propagateLiveness(int blockID, int successorID) { - localsLiveOut[blockID] |= localsLiveIn[successorID]; - } - - @Override - protected void updateLiveness(int blockID) { - localsLiveIn[blockID] = (localsLiveOut[blockID] & ~localsLiveKill[blockID]) | localsLiveGen[blockID]; - } - - @Override - protected void loadOne(int blockID, int local) { - long bit = 1L << local; - if ((localsLiveKill[blockID] & bit) == 0L) { - localsLiveGen[blockID] |= bit; - } - } - - @Override - protected void storeOne(int blockID, int local) { - long bit = 1L << local; - if ((localsLiveGen[blockID] & bit) == 0L) { - localsLiveKill[blockID] |= bit; - } - - BciBlock block = blocks[blockID]; - long tmp = block.loops; - int pos = 0; - while (tmp != 0) { - if ((tmp & 1L) == 1L) { - this.localsChangedInLoop[pos] |= bit; - } - tmp >>= 1; - ++pos; - } - } - - @Override - public boolean localIsLiveIn(BciBlock block, int local) { - int blockID = block.getId(); - return blockID >= Integer.MAX_VALUE ? false : (localsLiveIn[blockID] & (1L << local)) != 0L; - } - - @Override - public boolean localIsLiveOut(BciBlock block, int local) { - int blockID = block.getId(); - return blockID >= Integer.MAX_VALUE ? false : (localsLiveOut[blockID] & (1L << local)) != 0L; - } - - @Override - public boolean localIsChangedInLoop(int loopId, int local) { - return (localsChangedInLoop[loopId] & (1L << local)) != 0L; - } - } - - public final class LargeLocalLiveness extends LocalLiveness { - private BitSet[] localsLiveIn; - private BitSet[] localsLiveOut; - private BitSet[] localsLiveGen; - private BitSet[] localsLiveKill; - private BitSet[] localsChangedInLoop; - - public LargeLocalLiveness() { - int blocksSize = blocks.length; - localsLiveIn = new BitSet[blocksSize]; - localsLiveOut = new BitSet[blocksSize]; - localsLiveGen = new BitSet[blocksSize]; - localsLiveKill = new BitSet[blocksSize]; - int maxLocals = method.getMaxLocals(); - for (int i = 0; i < blocksSize; i++) { - localsLiveIn[i] = new BitSet(maxLocals); - localsLiveOut[i] = new BitSet(maxLocals); - localsLiveGen[i] = new BitSet(maxLocals); - localsLiveKill[i] = new BitSet(maxLocals); - } - localsChangedInLoop = new BitSet[nextLoop]; - for (int i = 0; i < nextLoop; ++i) { - localsChangedInLoop[i] = new BitSet(maxLocals); - } - } - - @Override - protected String debugLiveIn(int blockID) { - return localsLiveIn[blockID].toString(); - } - - @Override - protected String debugLiveOut(int blockID) { - return localsLiveOut[blockID].toString(); - } - - @Override - protected String debugLiveGen(int blockID) { - return localsLiveGen[blockID].toString(); - } - - @Override - protected String debugLiveKill(int blockID) { - return localsLiveKill[blockID].toString(); - } - - @Override - protected int liveOutCardinality(int blockID) { - return localsLiveOut[blockID].cardinality(); - } - - @Override - protected void propagateLiveness(int blockID, int successorID) { - localsLiveOut[blockID].or(localsLiveIn[successorID]); - } - - @Override - protected void updateLiveness(int blockID) { - BitSet liveIn = localsLiveIn[blockID]; - liveIn.clear(); - liveIn.or(localsLiveOut[blockID]); - liveIn.andNot(localsLiveKill[blockID]); - liveIn.or(localsLiveGen[blockID]); - } - - @Override - protected void loadOne(int blockID, int local) { - if (!localsLiveKill[blockID].get(local)) { - localsLiveGen[blockID].set(local); - } - } - - @Override - protected void storeOne(int blockID, int local) { - if (!localsLiveGen[blockID].get(local)) { - localsLiveKill[blockID].set(local); - } - - BciBlock block = blocks[blockID]; - long tmp = block.loops; - int pos = 0; - while (tmp != 0) { - if ((tmp & 1L) == 1L) { - this.localsChangedInLoop[pos].set(local); - } - tmp >>= 1; - ++pos; - } - } - - @Override - public boolean localIsLiveIn(BciBlock block, int local) { - return block.getId() >= Integer.MAX_VALUE ? true : localsLiveIn[block.getId()].get(local); - } - - @Override - public boolean localIsLiveOut(BciBlock block, int local) { - return block.getId() >= Integer.MAX_VALUE ? true : localsLiveOut[block.getId()].get(local); - } - - @Override - public boolean localIsChangedInLoop(int loopId, int local) { - return localsChangedInLoop[loopId].get(local); - } - } - public BciBlock[] getLoopHeaders() { return loopHeaders; } + + public BciBlock getStartBlock() { + return startBlock; + } + + public BciBlock getReturnBlock() { + return blocks[blocks.length - 2]; + } + + public ExceptionDispatchBlock getUnwindBlock() { + return (ExceptionDispatchBlock) blocks[blocks.length - 1]; + } + + public int getLoopCount() { + return nextLoop; + } + + public int getBlockCount() { + return blocks.length; + } }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraalDirectivePlugins.java Wed Feb 18 10:37:08 2015 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.java; - -import com.oracle.graal.api.directives.*; -import com.oracle.graal.api.meta.*; -import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin; -import com.oracle.graal.java.InvocationPlugins.Registration; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.debug.*; -import com.oracle.graal.nodes.extended.*; - -public class GraalDirectivePlugins { - - public static void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { - Registration r = new Registration(plugins, metaAccess, GraalDirectives.class); - r.register0("deoptimize", new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder) { - builder.append(new DeoptimizeNode(DeoptimizationAction.None, DeoptimizationReason.TransferToInterpreter)); - return true; - } - }); - - r.register0("deoptimizeAndInvalidate", new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder) { - builder.append(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TransferToInterpreter)); - return true; - } - }); - - r.register0("inCompiledCode", new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder) { - builder.push(Kind.Int, builder.append(ConstantNode.forInt(1))); - return true; - } - }); - - r.register0("controlFlowAnchor", new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder) { - builder.append(new ControlFlowAnchorNode()); - return true; - } - }); - - r.register2("injectBranchProbability", double.class, boolean.class, new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder, ValueNode probability, ValueNode condition) { - builder.push(Kind.Int, builder.append(new BranchProbabilityNode(probability, condition))); - return true; - } - }); - - InvocationPlugin blackholePlugin = new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder, ValueNode value) { - builder.append(new BlackholeNode(value)); - return true; - } - }; - - for (Kind kind : Kind.values()) { - Class<?> cls = null; - switch (kind) { - case Object: - cls = Object.class; - break; - case Void: - case Illegal: - continue; - default: - cls = kind.toJavaClass(); - } - - r.register1("blackhole", cls, blackholePlugin); - - final Kind stackKind = kind.getStackKind(); - r.register1("opaque", cls, new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder, ValueNode value) { - builder.push(stackKind, builder.append(new OpaqueNode(value))); - return true; - } - }); - } - } -}
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderContext.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderContext.java Mon Feb 23 16:23:23 2015 -0800 @@ -27,6 +27,7 @@ import com.oracle.graal.api.replacements.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; +import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; /** @@ -56,6 +57,8 @@ void push(Kind kind, ValueNode value); + StructuredGraph getGraph(); + /** * Determines if the graph builder is parsing a snippet or method substitution. */ @@ -71,4 +74,8 @@ } return nonNullValue; } + + GuardingNode getCurrentBlockGuard(); + + BailoutException bailout(String string); }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -26,6 +26,7 @@ import static com.oracle.graal.api.meta.DeoptimizationReason.*; import static com.oracle.graal.bytecode.Bytecodes.*; import static com.oracle.graal.compiler.common.GraalOptions.*; +import static com.oracle.graal.graph.iterators.NodePredicates.*; import static com.oracle.graal.nodes.StructuredGraph.*; import static java.lang.String.*; @@ -40,13 +41,13 @@ import com.oracle.graal.compiler.common.calc.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.debug.*; +import com.oracle.graal.debug.Debug.*; import com.oracle.graal.graph.Graph.Mark; import com.oracle.graal.graph.*; import com.oracle.graal.graph.Node.ValueNumberable; import com.oracle.graal.graph.iterators.*; import com.oracle.graal.java.BciBlockMapping.BciBlock; import com.oracle.graal.java.BciBlockMapping.ExceptionDispatchBlock; -import com.oracle.graal.java.BciBlockMapping.LocalLiveness; import com.oracle.graal.java.GraphBuilderPlugin.AnnotatedInvocationPlugin; import com.oracle.graal.java.GraphBuilderPlugin.InlineInvokePlugin; import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin; @@ -126,7 +127,7 @@ int entryBCI = graph.getEntryBCI(); assert method.getCode() != null : "method must contain bytecodes: " + method; this.currentGraph = graph; - HIRFrameStateBuilder frameState = new HIRFrameStateBuilder(method, graph, null); + HIRFrameStateBuilder frameState = new HIRFrameStateBuilder(method, graph, true, null); frameState.initializeForMethodStart(graphBuilderConfig.eagerResolving(), this.graphBuilderConfig.getParameterPlugin()); TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method); try { @@ -171,9 +172,9 @@ private int peelIteration; } - public class BytecodeParser extends AbstractBytecodeParser<ValueNode, HIRFrameStateBuilder> implements GraphBuilderContext { + public class BytecodeParser extends AbstractBytecodeParser implements GraphBuilderContext { - private BciBlock[] loopHeaders; + private BciBlockMapping blockMap; private LocalLiveness liveness; protected final int entryBCI; private int currentDepth; @@ -183,8 +184,6 @@ private int currentLineNumber; private ValueNode methodSynchronizedObject; - private ExceptionDispatchBlock unwindBlock; - private BciBlock returnBlock; private ValueNode returnValue; private FixedWithNextNode beforeReturnNode; @@ -195,9 +194,13 @@ private final boolean explodeLoops; private Stack<ExplodedLoopContext> explodeLoopsContext; private int nextPeelIteration = 1; - private int returnCount; private boolean controlFlowSplit; + private FixedWithNextNode[] firstInstructionArray; + private HIRFrameStateBuilder[] entryStateArray; + private FixedWithNextNode[][] firstInstructionMatrix; + private HIRFrameStateBuilder[][] entryStateMatrix; + /** * @param isReplacement specifies if this object is being used to parse a method that * implements the semantics of another method (i.e., an intrinsic) or @@ -247,20 +250,31 @@ try (Indent indent = Debug.logAndIndent("build graph for %s", method)) { // compute the block map, setup exception handlers and get the entrypoint(s) - BciBlockMapping blockMap = BciBlockMapping.create(method, graphBuilderConfig.doLivenessAnalysis(), explodeLoops); - loopHeaders = blockMap.getLoopHeaders(); - liveness = blockMap.liveness; - returnCount = blockMap.getReturnCount(); + BciBlockMapping newMapping = BciBlockMapping.create(stream, method); + this.blockMap = newMapping; + this.firstInstructionArray = new FixedWithNextNode[blockMap.getBlockCount()]; + this.entryStateArray = new HIRFrameStateBuilder[blockMap.getBlockCount()]; + + if (graphBuilderConfig.doLivenessAnalysis()) { + try (Scope s = Debug.scope("LivenessAnalysis")) { + int maxLocals = method.getMaxLocals(); + liveness = LocalLiveness.compute(stream, blockMap.getBlocks(), maxLocals, blockMap.getLoopCount()); + } catch (Throwable e) { + throw Debug.handle(e); + } + } lastInstr = startInstruction; this.setCurrentFrameState(startFrameState); + stream.setBCI(0); + BciBlock startBlock = blockMap.getStartBlock(); if (startInstruction == currentGraph.start()) { StartNode startNode = currentGraph.start(); if (method.isSynchronized()) { startNode.setStateAfter(frameState.create(BytecodeFrame.BEFORE_BCI)); } else { - frameState.clearNonLiveLocals(blockMap.startBlock, liveness, true); + frameState.clearNonLiveLocals(startBlock, liveness, true); assert bci() == 0; startNode.setStateAfter(frameState.create(bci())); } @@ -270,7 +284,7 @@ // add a monitor enter to the start block methodSynchronizedObject = synchronizedObject(frameState, method); MonitorEnterNode monitorEnter = genMonitorEnter(methodSynchronizedObject); - frameState.clearNonLiveLocals(blockMap.startBlock, liveness, true); + frameState.clearNonLiveLocals(startBlock, liveness, true); assert bci() == 0; monitorEnter.setStateAfter(frameState.create(bci())); } @@ -279,12 +293,12 @@ append(createInfoPointNode(InfopointReason.METHOD_START)); } - currentBlock = blockMap.startBlock; - blockMap.startBlock.setEntryState(0, frameState); - if (blockMap.startBlock.isLoopHeader && !explodeLoops) { - appendGoto(blockMap.startBlock); + currentBlock = blockMap.getStartBlock(); + setEntryState(startBlock, 0, frameState); + if (startBlock.isLoopHeader && !explodeLoops) { + appendGoto(startBlock); } else { - blockMap.startBlock.setFirstInstruction(0, lastInstr); + setFirstInstruction(startBlock, 0, lastInstr); } int index = 0; @@ -293,8 +307,6 @@ BciBlock block = blocks[index]; index = iterateBlock(blocks, block); } - processBlock(this, returnBlock); - processBlock(this, unwindBlock); if (Debug.isDumpEnabled() && this.beforeReturnNode != startInstruction) { Debug.dump(currentGraph, "Bytecodes parsed: " + method.getDeclaringClass().getUnqualifiedName() + "." + method.getName()); @@ -344,27 +356,6 @@ return header.loopEnd + 1; } - private BciBlock returnBlock(int bci) { - if (returnBlock == null) { - returnBlock = new BciBlock(); - returnBlock.startBci = bci; - returnBlock.endBci = bci; - returnBlock.setId(Integer.MAX_VALUE); - } - return returnBlock; - } - - private BciBlock unwindBlock() { - if (unwindBlock == null) { - unwindBlock = new ExceptionDispatchBlock(); - unwindBlock.startBci = -1; - unwindBlock.endBci = -1; - unwindBlock.deoptBci = method.isSynchronized() ? BytecodeFrame.UNWIND_BCI : BytecodeFrame.AFTER_EXCEPTION_BCI; - unwindBlock.setId(Integer.MAX_VALUE); - } - return unwindBlock; - } - /** * @param type the unresolved type of the constant */ @@ -480,7 +471,7 @@ * unwind immediately. */ if (bci != currentBlock.endBci || dispatchBlock == null) { - dispatchBlock = unwindBlock(); + dispatchBlock = blockMap.getUnwindBlock(); } HIRFrameStateBuilder dispatchState = frameState.copy(); @@ -651,8 +642,8 @@ return (ValueNode) currentGraph.unique((Node & ValueNumberable) x); } - protected ValueNode genIfNode(ValueNode condition, ValueNode falseSuccessor, ValueNode trueSuccessor, double d) { - return new IfNode((LogicNode) condition, (FixedNode) falseSuccessor, (FixedNode) trueSuccessor, d); + protected ValueNode genIfNode(LogicNode condition, FixedNode falseSuccessor, FixedNode trueSuccessor, double d) { + return new IfNode(condition, falseSuccessor, trueSuccessor, d); } @Override @@ -899,7 +890,8 @@ Mark mark = needsNullCheck ? currentGraph.getMark() : null; if (InvocationPlugin.execute(this, plugin, args)) { assert beforeStackSize + resultType.getSlotCount() == frameState.stackSize : "plugin manipulated the stack incorrectly " + targetMethod; - assert !needsNullCheck || containsNullCheckOf(currentGraph.getNewNodes(mark), args[0]) : "plugin needs to null check the receiver of " + targetMethod + ": " + args[0]; + assert !needsNullCheck || args[0].usages().filter(isNotA(FrameState.class)).isEmpty() || containsNullCheckOf(currentGraph.getNewNodes(mark), args[0]) : "plugin needs to null check the receiver of " + + targetMethod + ": " + args[0]; return true; } assert nodeCount == currentGraph.getNodeCount() : "plugin that returns false must not create new nodes"; @@ -948,7 +940,13 @@ private void parseAndInlineCallee(ResolvedJavaMethod targetMethod, ValueNode[] args, boolean isReplacement) { BytecodeParser parser = new BytecodeParser(metaAccess, targetMethod, graphBuilderConfig, optimisticOpts, INVOCATION_ENTRY_BCI, isReplacement); final FrameState[] lazyFrameState = new FrameState[1]; - HIRFrameStateBuilder startFrameState = new HIRFrameStateBuilder(targetMethod, currentGraph, () -> { + + // Replacements often produce nodes with an illegal kind (e.g., pointer stamps) + // so the frame state builder should not check the types flowing through the frame + // since all such assertions are in terms of Java kinds. + boolean checkTypes = !isReplacement; + + HIRFrameStateBuilder startFrameState = new HIRFrameStateBuilder(targetMethod, currentGraph, checkTypes, () -> { if (lazyFrameState[0] == null) { lazyFrameState[0] = frameState.create(bci()); } @@ -1015,8 +1013,9 @@ beforeReturn(x); append(new ReturnNode(x)); } else { - if (returnCount == 1 || !controlFlowSplit) { + if (blockMap.getReturnCount() == 1 || !controlFlowSplit) { // There is only a single return. + beforeReturn(x); this.returnValue = x; this.beforeReturnNode = this.lastInstr; this.lastInstr = null; @@ -1026,8 +1025,8 @@ if (x != null) { frameState.push(x.getKind(), x); } - assert returnCount > 1; - appendGoto(returnBlock(bci())); + assert blockMap.getReturnCount() > 1; + appendGoto(blockMap.getReturnBlock()); } } } @@ -1039,7 +1038,7 @@ synchronizedEpilogue(BytecodeFrame.AFTER_BCI, x); if (frameState.lockDepth() != 0) { - throw new BailoutException("unbalanced monitors"); + throw bailout("unbalanced monitors"); } } @@ -1056,7 +1055,7 @@ MonitorIdNode monitorId = frameState.peekMonitorId(); ValueNode lockedObject = frameState.popLock(); if (GraphUtil.originalValue(lockedObject) != GraphUtil.originalValue(x)) { - throw new BailoutException("unbalanced monitors: mismatch at monitorexit, %s != %s", GraphUtil.originalValue(x), GraphUtil.originalValue(lockedObject)); + throw bailout(String.format("unbalanced monitors: mismatch at monitorexit, %s != %s", GraphUtil.originalValue(x), GraphUtil.originalValue(lockedObject))); } MonitorExitNode monitorExit = append(new MonitorExitNode(x, monitorId, escapedReturnValue)); return monitorExit; @@ -1104,11 +1103,23 @@ @Override protected void genIntegerSwitch(ValueNode value, ArrayList<BciBlock> actualSuccessors, int[] keys, double[] keyProbabilities, int[] keySuccessors) { - this.controlFlowSplit = true; - double[] successorProbabilities = successorProbabilites(actualSuccessors.size(), keySuccessors, keyProbabilities); - IntegerSwitchNode switchNode = append(new IntegerSwitchNode(value, actualSuccessors.size(), keys, keyProbabilities, keySuccessors)); - for (int i = 0; i < actualSuccessors.size(); i++) { - switchNode.setBlockSuccessor(i, createBlockTarget(successorProbabilities[i], actualSuccessors.get(i), frameState)); + if (value.isConstant()) { + JavaConstant constant = (JavaConstant) value.asConstant(); + int constantValue = constant.asInt(); + for (int i = 0; i < keys.length; ++i) { + if (keys[i] == constantValue) { + appendGoto(actualSuccessors.get(keySuccessors[i])); + return; + } + } + appendGoto(actualSuccessors.get(keySuccessors[keys.length])); + } else { + this.controlFlowSplit = true; + double[] successorProbabilities = successorProbabilites(actualSuccessors.size(), keySuccessors, keyProbabilities); + IntegerSwitchNode switchNode = append(new IntegerSwitchNode(value, actualSuccessors.size(), keys, keyProbabilities, keySuccessors)); + for (int i = 0; i < actualSuccessors.size(); i++) { + switchNode.setBlockSuccessor(i, createBlockTarget(successorProbabilities[i], actualSuccessors.get(i), frameState)); + } } } @@ -1187,7 +1198,7 @@ do { long lMask = 1L << pos; if ((exits & lMask) != 0) { - exitLoops.add(loopHeaders[pos]); + exitLoops.add(blockMap.getLoopHeader(pos)); exits &= ~lMask; } pos++; @@ -1207,7 +1218,7 @@ } HIRFrameStateBuilder newState = state.copy(); for (BciBlock loop : exitLoops) { - LoopBeginNode loopBegin = (LoopBeginNode) loop.getFirstInstruction(this.getCurrentDimension()); + LoopBeginNode loopBegin = (LoopBeginNode) getFirstInstruction(loop, this.getCurrentDimension()); LoopExitNode loopExit = currentGraph.add(new LoopExitNode(loopBegin)); if (lastLoopExit != null) { lastLoopExit.setNext(loopExit); @@ -1217,7 +1228,7 @@ } lastLoopExit = loopExit; Debug.log("Target %s Exits %s, scanning framestates...", targetBlock, loop); - newState.insertLoopProxies(loopExit, (HIRFrameStateBuilder) loop.getEntryState(this.getCurrentDimension())); + newState.insertLoopProxies(loopExit, getEntryState(loop, this.getCurrentDimension())); loopExit.setStateAfter(newState.create(bci)); } @@ -1228,6 +1239,98 @@ return new Target(target, state); } + private HIRFrameStateBuilder getEntryState(BciBlock block, int dimension) { + int id = block.id; + if (dimension == 0) { + return entryStateArray[id]; + } else { + return getEntryStateMultiDimension(dimension, id); + } + } + + private HIRFrameStateBuilder getEntryStateMultiDimension(int dimension, int id) { + if (entryStateMatrix != null && dimension - 1 < entryStateMatrix.length) { + HIRFrameStateBuilder[] entryStateArrayEntry = entryStateMatrix[dimension - 1]; + if (entryStateArrayEntry == null) { + return null; + } + return entryStateArrayEntry[id]; + } else { + return null; + } + } + + private void setEntryState(BciBlock block, int dimension, HIRFrameStateBuilder entryState) { + int id = block.id; + if (dimension == 0) { + this.entryStateArray[id] = entryState; + } else { + setEntryStateMultiDimension(dimension, entryState, id); + } + } + + private void setEntryStateMultiDimension(int dimension, HIRFrameStateBuilder entryState, int id) { + if (entryStateMatrix == null) { + entryStateMatrix = new HIRFrameStateBuilder[4][]; + } + if (dimension - 1 < entryStateMatrix.length) { + // We are within bounds. + } else { + // We are out of bounds. + entryStateMatrix = Arrays.copyOf(entryStateMatrix, Math.max(entryStateMatrix.length * 2, dimension)); + } + if (entryStateMatrix[dimension - 1] == null) { + entryStateMatrix[dimension - 1] = new HIRFrameStateBuilder[blockMap.getBlockCount()]; + } + entryStateMatrix[dimension - 1][id] = entryState; + } + + private void setFirstInstruction(BciBlock block, int dimension, FixedWithNextNode firstInstruction) { + int id = block.id; + if (dimension == 0) { + this.firstInstructionArray[id] = firstInstruction; + } else { + setFirstInstructionMultiDimension(dimension, firstInstruction, id); + } + } + + private void setFirstInstructionMultiDimension(int dimension, FixedWithNextNode firstInstruction, int id) { + if (firstInstructionMatrix == null) { + firstInstructionMatrix = new FixedWithNextNode[4][]; + } + if (dimension - 1 < firstInstructionMatrix.length) { + // We are within bounds. + } else { + // We are out of bounds. + firstInstructionMatrix = Arrays.copyOf(firstInstructionMatrix, Math.max(firstInstructionMatrix.length * 2, dimension)); + } + if (firstInstructionMatrix[dimension - 1] == null) { + firstInstructionMatrix[dimension - 1] = new FixedWithNextNode[blockMap.getBlockCount()]; + } + firstInstructionMatrix[dimension - 1][id] = firstInstruction; + } + + private FixedWithNextNode getFirstInstruction(BciBlock block, int dimension) { + int id = block.id; + if (dimension == 0) { + return firstInstructionArray[id]; + } else { + return getFirstInstructionMultiDimension(dimension, id); + } + } + + private FixedWithNextNode getFirstInstructionMultiDimension(int dimension, int id) { + if (firstInstructionMatrix != null && dimension - 1 < firstInstructionMatrix.length) { + FixedWithNextNode[] firstInstructionArrayEntry = firstInstructionMatrix[dimension - 1]; + if (firstInstructionArrayEntry == null) { + return null; + } + return firstInstructionArrayEntry[id]; + } else { + return null; + } + } + private FixedNode createTarget(double probability, BciBlock block, HIRFrameStateBuilder stateAfter) { assert probability >= 0 && probability <= 1.01 : probability; if (isNeverExecutedCode(probability)) { @@ -1239,103 +1342,71 @@ } private FixedNode createTarget(BciBlock block, HIRFrameStateBuilder state) { - return createTarget(block, state, false); + return createTarget(block, state, false, false); } - private FixedNode createTarget(BciBlock block, HIRFrameStateBuilder state, boolean isGoto) { + private FixedNode createTarget(BciBlock block, HIRFrameStateBuilder state, boolean canReuseInstruction, boolean canReuseState) { assert block != null && state != null; assert !block.isExceptionEntry || state.stackSize() == 1; - int operatingDimension = this.getCurrentDimension(); - if (this.explodeLoops && this.explodeLoopsContext != null && !this.explodeLoopsContext.isEmpty()) { - int i; - for (i = explodeLoopsContext.size() - 1; i >= 0; --i) { - ExplodedLoopContext context = explodeLoopsContext.elementAt(i); - if (context.header == block) { - - // We have a hit on our current explosion context loop begin. - if (context.targetPeelIteration == -1) { - // This is the first hit => allocate a new dimension and at the same - // time mark the context loop begin as hit during the current - // iteration. - context.targetPeelIteration = nextPeelIteration++; - if (nextPeelIteration > MaximumLoopExplosionCount.getValue()) { - throw new BailoutException("too many loop explosion interations - does the explosion not terminate?"); - } - } + int operatingDimension = findOperatingDimension(block); - // Operate on the target dimension. - operatingDimension = context.targetPeelIteration; - break; - } else if (block.getId() > context.header.getId() && block.getId() <= context.header.loopEnd) { - // We hit the range of this context. - operatingDimension = context.peelIteration; - break; - } - } - - if (i == -1) { - // I did not find a dimension. - operatingDimension = 0; - } - } - - if (block.getFirstInstruction(operatingDimension) == null) { + if (getFirstInstruction(block, operatingDimension) == null) { /* * This is the first time we see this block as a branch target. Create and * return a placeholder that later can be replaced with a MergeNode when we see * this block again. */ FixedNode targetNode; - if (isGoto && (block.getPredecessorCount() == 1 || !controlFlowSplit) && !block.isLoopHeader && (currentBlock.loops & ~block.loops) == 0) { - block.setFirstInstruction(operatingDimension, lastInstr); + if (canReuseInstruction && (block.getPredecessorCount() == 1 || !controlFlowSplit) && !block.isLoopHeader && (currentBlock.loops & ~block.loops) == 0) { + setFirstInstruction(block, operatingDimension, lastInstr); lastInstr = null; } else { - block.setFirstInstruction(operatingDimension, currentGraph.add(new BeginNode())); + setFirstInstruction(block, operatingDimension, currentGraph.add(new BeginNode())); } - targetNode = block.getFirstInstruction(operatingDimension); + targetNode = getFirstInstruction(block, operatingDimension); Target target = checkLoopExit(targetNode, block, state); FixedNode result = target.fixed; - AbstractFrameStateBuilder<?, ?> entryState = target.state == state ? state.copy() : target.state; - block.setEntryState(operatingDimension, entryState); - entryState.clearNonLiveLocals(block, liveness, true); + HIRFrameStateBuilder currentEntryState = target.state == state ? (canReuseState ? state : state.copy()) : target.state; + setEntryState(block, operatingDimension, currentEntryState); + currentEntryState.clearNonLiveLocals(block, liveness, true); Debug.log("createTarget %s: first visit, result: %s", block, targetNode); return result; } // We already saw this block before, so we have to merge states. - if (!((HIRFrameStateBuilder) block.getEntryState(operatingDimension)).isCompatibleWith(state)) { - throw new BailoutException("stacks do not match; bytecodes would not verify"); + if (!getEntryState(block, operatingDimension).isCompatibleWith(state)) { + throw bailout("stacks do not match; bytecodes would not verify"); } - if (block.getFirstInstruction(operatingDimension) instanceof LoopBeginNode) { + if (getFirstInstruction(block, operatingDimension) instanceof LoopBeginNode) { assert this.explodeLoops || (block.isLoopHeader && currentBlock.getId() >= block.getId()) : "must be backward branch"; /* * Backward loop edge. We need to create a special LoopEndNode and merge with * the loop begin node created before. */ - LoopBeginNode loopBegin = (LoopBeginNode) block.getFirstInstruction(operatingDimension); + LoopBeginNode loopBegin = (LoopBeginNode) getFirstInstruction(block, operatingDimension); Target target = checkLoopExit(currentGraph.add(new LoopEndNode(loopBegin)), block, state); FixedNode result = target.fixed; - ((HIRFrameStateBuilder) block.getEntryState(operatingDimension)).merge(loopBegin, target.state); + getEntryState(block, operatingDimension).merge(loopBegin, target.state); Debug.log("createTarget %s: merging backward branch to loop header %s, result: %s", block, loopBegin, result); return result; } assert currentBlock == null || currentBlock.getId() < block.getId() : "must not be backward branch"; - assert block.getFirstInstruction(operatingDimension).next() == null : "bytecodes already parsed for block"; + assert getFirstInstruction(block, operatingDimension).next() == null : "bytecodes already parsed for block"; - if (block.getFirstInstruction(operatingDimension) instanceof AbstractBeginNode && !(block.getFirstInstruction(operatingDimension) instanceof AbstractMergeNode)) { + if (getFirstInstruction(block, operatingDimension) instanceof AbstractBeginNode && !(getFirstInstruction(block, operatingDimension) instanceof AbstractMergeNode)) { /* * This is the second time we see this block. Create the actual MergeNode and * the End Node for the already existing edge. For simplicity, we leave the * placeholder in the graph and just append the new nodes after the placeholder. */ - AbstractBeginNode placeholder = (AbstractBeginNode) block.getFirstInstruction(operatingDimension); + AbstractBeginNode placeholder = (AbstractBeginNode) getFirstInstruction(block, operatingDimension); // The EndNode for the already existing edge. - AbstractEndNode end = currentGraph.add(new EndNode()); + EndNode end = currentGraph.add(new EndNode()); // The MergeNode that replaces the placeholder. AbstractMergeNode mergeNode = currentGraph.add(new MergeNode()); FixedNode next = placeholder.next(); @@ -1350,22 +1421,63 @@ mergeNode.addForwardEnd(end); mergeNode.setNext(next); - block.setFirstInstruction(operatingDimension, mergeNode); + setFirstInstruction(block, operatingDimension, mergeNode); } - AbstractMergeNode mergeNode = (AbstractMergeNode) block.getFirstInstruction(operatingDimension); + AbstractMergeNode mergeNode = (AbstractMergeNode) getFirstInstruction(block, operatingDimension); // The EndNode for the newly merged edge. - AbstractEndNode newEnd = currentGraph.add(new EndNode()); + EndNode newEnd = currentGraph.add(new EndNode()); Target target = checkLoopExit(newEnd, block, state); FixedNode result = target.fixed; - ((HIRFrameStateBuilder) block.getEntryState(operatingDimension)).merge(mergeNode, target.state); + getEntryState(block, operatingDimension).merge(mergeNode, target.state); mergeNode.addForwardEnd(newEnd); Debug.log("createTarget %s: merging state, result: %s", block, result); return result; } + private int findOperatingDimension(BciBlock block) { + if (this.explodeLoops && this.explodeLoopsContext != null && !this.explodeLoopsContext.isEmpty()) { + return findOperatingDimensionWithLoopExplosion(block); + } + return this.getCurrentDimension(); + } + + private int findOperatingDimensionWithLoopExplosion(BciBlock block) { + int i; + for (i = explodeLoopsContext.size() - 1; i >= 0; --i) { + ExplodedLoopContext context = explodeLoopsContext.elementAt(i); + if (context.header == block) { + + // We have a hit on our current explosion context loop begin. + if (context.targetPeelIteration == -1) { + // This is the first hit => allocate a new dimension and at the same + // time mark the context loop begin as hit during the current + // iteration. + context.targetPeelIteration = nextPeelIteration++; + if (nextPeelIteration > MaximumLoopExplosionCount.getValue()) { + String message = "too many loop explosion interations - does the explosion not terminate for method " + method + "?"; + if (FailedLoopExplosionIsFatal.getValue()) { + throw new RuntimeException(message); + } else { + throw bailout(message); + } + } + } + + // Operate on the target dimension. + return context.targetPeelIteration; + } else if (block.getId() > context.header.getId() && block.getId() <= context.header.loopEnd) { + // We hit the range of this context. + return context.peelIteration; + } + } + + // No dimension found. + return 0; + } + /** * Returns a block begin node with the specified state. If the specified probability is * 0, the block deoptimizes immediately. @@ -1389,45 +1501,27 @@ protected void processBlock(BytecodeParser parser, BciBlock block) { // Ignore blocks that have no predecessors by the time their bytecodes are parsed - if (block == null || block.getFirstInstruction(this.getCurrentDimension()) == null) { + int currentDimension = this.getCurrentDimension(); + FixedWithNextNode firstInstruction = getFirstInstruction(block, currentDimension); + if (firstInstruction == null) { Debug.log("Ignoring block %s", block); return; } - try (Indent indent = Debug.logAndIndent("Parsing block %s firstInstruction: %s loopHeader: %b", block, block.getFirstInstruction(this.getCurrentDimension()), block.isLoopHeader)) { + try (Indent indent = Debug.logAndIndent("Parsing block %s firstInstruction: %s loopHeader: %b", block, firstInstruction, block.isLoopHeader)) { - lastInstr = block.getFirstInstruction(this.getCurrentDimension()); - frameState = (HIRFrameStateBuilder) block.getEntryState(this.getCurrentDimension()); + lastInstr = firstInstruction; + frameState = getEntryState(block, currentDimension); parser.setCurrentFrameState(frameState); currentBlock = block; - if (lastInstr instanceof AbstractMergeNode) { - - AbstractMergeNode abstractMergeNode = (AbstractMergeNode) lastInstr; - if (abstractMergeNode.stateAfter() == null) { - int bci = block.startBci; - if (block instanceof ExceptionDispatchBlock) { - bci = ((ExceptionDispatchBlock) block).deoptBci; - } - abstractMergeNode.setStateAfter(frameState.create(bci)); - } + if (firstInstruction instanceof AbstractMergeNode) { + setMergeStateAfter(block, firstInstruction); } - if (block == returnBlock) { - Kind returnKind = method.getSignature().getReturnKind().getStackKind(); - ValueNode x = returnKind == Kind.Void ? null : frameState.pop(returnKind); - assert frameState.stackSize() == 0; - beforeReturn(x); - this.returnValue = x; - this.beforeReturnNode = this.lastInstr; - } else if (block == unwindBlock) { - if (currentDepth == 0) { - frameState.setRethrowException(false); - createUnwind(); - } else { - ValueNode exception = frameState.apop(); - this.unwindValue = exception; - this.beforeUnwindNode = this.lastInstr; - } + if (block == blockMap.getReturnBlock()) { + handleReturnBlock(); + } else if (block == blockMap.getUnwindBlock()) { + handleUnwindBlock(); } else if (block instanceof ExceptionDispatchBlock) { createExceptionDispatch((ExceptionDispatchBlock) block); } else { @@ -1437,6 +1531,37 @@ } } + private void handleUnwindBlock() { + if (currentDepth == 0) { + frameState.setRethrowException(false); + createUnwind(); + } else { + ValueNode exception = frameState.apop(); + this.unwindValue = exception; + this.beforeUnwindNode = this.lastInstr; + } + } + + private void handleReturnBlock() { + Kind returnKind = method.getSignature().getReturnKind().getStackKind(); + ValueNode x = returnKind == Kind.Void ? null : frameState.pop(returnKind); + assert frameState.stackSize() == 0; + beforeReturn(x); + this.returnValue = x; + this.beforeReturnNode = this.lastInstr; + } + + private void setMergeStateAfter(BciBlock block, FixedWithNextNode firstInstruction) { + AbstractMergeNode abstractMergeNode = (AbstractMergeNode) firstInstruction; + if (abstractMergeNode.stateAfter() == null) { + int bci = block.startBci; + if (block instanceof ExceptionDispatchBlock) { + bci = ((ExceptionDispatchBlock) block).deoptBci; + } + abstractMergeNode.setStateAfter(frameState.create(bci)); + } + } + /** * Remove loop header without loop ends. This can happen with degenerated loops like * this one: @@ -1496,7 +1621,7 @@ ResolvedJavaType resolvedCatchType = (ResolvedJavaType) catchType; for (ResolvedJavaType skippedType : graphBuilderConfig.getSkippedExceptionTypes()) { if (skippedType.isAssignableFrom(resolvedCatchType)) { - BciBlock nextBlock = block.getSuccessorCount() == 1 ? unwindBlock() : block.getSuccessor(1); + BciBlock nextBlock = block.getSuccessorCount() == 1 ? blockMap.getUnwindBlock() : block.getSuccessor(1); ValueNode exception = frameState.stackAt(0); FixedNode trueSuccessor = currentGraph.add(new DeoptimizeNode(InvalidateReprofile, UnreachedCode)); FixedNode nextDispatch = createTarget(nextBlock, frameState); @@ -1507,7 +1632,7 @@ } if (initialized) { - BciBlock nextBlock = block.getSuccessorCount() == 1 ? unwindBlock() : block.getSuccessor(1); + BciBlock nextBlock = block.getSuccessorCount() == 1 ? blockMap.getUnwindBlock() : block.getSuccessor(1); ValueNode exception = frameState.stackAt(0); CheckCastNode checkCast = currentGraph.add(new CheckCastNode((ResolvedJavaType) catchType, exception, null, false)); frameState.apop(); @@ -1524,7 +1649,7 @@ } private void appendGoto(BciBlock successor) { - FixedNode targetInstr = createTarget(successor, frameState, true); + FixedNode targetInstr = createTarget(successor, frameState, true, true); if (lastInstr != null && lastInstr != targetInstr) { lastInstr.setNext(targetInstr); } @@ -1540,7 +1665,7 @@ // Create the loop header block, which later will merge the backward branches of // the loop. controlFlowSplit = true; - AbstractEndNode preLoopEnd = currentGraph.add(new EndNode()); + EndNode preLoopEnd = currentGraph.add(new EndNode()); LoopBeginNode loopBegin = currentGraph.add(new LoopBeginNode()); lastInstr.setNext(preLoopEnd); // Add the single non-loop predecessor of the loop header. @@ -1556,12 +1681,12 @@ * merge to the loop header. This ensures that the loop header has exactly one * non-loop predecessor. */ - block.setFirstInstruction(this.getCurrentDimension(), loopBegin); + setFirstInstruction(block, this.getCurrentDimension(), loopBegin); /* * We need to preserve the frame state builder of the loop header so that we can * merge values for phi functions, so make a copy of it. */ - block.setEntryState(this.getCurrentDimension(), frameState.copy()); + setEntryState(block, this.getCurrentDimension(), frameState.copy()); Debug.log(" created loop header %s", loopBegin); } @@ -1676,17 +1801,107 @@ BciBlock trueBlock = currentBlock.getSuccessor(0); BciBlock falseBlock = currentBlock.getSuccessor(1); if (trueBlock == falseBlock) { + // The target block is the same independent of the condition. appendGoto(trueBlock); return; } - // the mirroring and negation operations get the condition into canonical form - boolean mirror = cond.canonicalMirror(); + ValueNode a = x; + ValueNode b = y; + + // Check whether the condition needs to mirror the operands. + if (cond.canonicalMirror()) { + a = y; + b = x; + } + + // Create the logic node for the condition. + LogicNode condition = createLogicNode(cond, a, b); + + // Check whether the condition needs to negate the result. boolean negate = cond.canonicalNegate(); - ValueNode a = mirror ? y : x; - ValueNode b = mirror ? x : y; + // Remove a logic negation node and fold it into the negate boolean. + if (condition instanceof LogicNegationNode) { + LogicNegationNode logicNegationNode = (LogicNegationNode) condition; + negate = !negate; + condition = logicNegationNode.getValue(); + } + + if (condition instanceof LogicConstantNode) { + genConstantTargetIf(trueBlock, falseBlock, negate, condition); + } else { + if (condition.graph() == null) { + condition = currentGraph.unique(condition); + } + + // Need to get probability based on current bci. + double probability = branchProbability(); + + if (negate) { + BciBlock tmpBlock = trueBlock; + trueBlock = falseBlock; + falseBlock = tmpBlock; + probability = 1 - probability; + } + + if (isNeverExecutedCode(probability)) { + append(new FixedGuardNode(condition, UnreachedCode, InvalidateReprofile, true)); + appendGoto(falseBlock); + return; + } else if (isNeverExecutedCode(1 - probability)) { + append(new FixedGuardNode(condition, UnreachedCode, InvalidateReprofile, false)); + appendGoto(trueBlock); + return; + } + int oldBci = stream.currentBCI(); + int trueBlockInt = checkPositiveIntConstantPushed(trueBlock); + if (trueBlockInt != -1) { + int falseBlockInt = checkPositiveIntConstantPushed(falseBlock); + if (falseBlockInt != -1) { + if (tryGenConditionalForIf(trueBlock, falseBlock, condition, oldBci, trueBlockInt, falseBlockInt)) { + return; + } + } + } + + this.controlFlowSplit = true; + FixedNode trueSuccessor = createTarget(trueBlock, frameState, false, false); + FixedNode falseSuccessor = createTarget(falseBlock, frameState, false, true); + ValueNode ifNode = genIfNode(condition, trueSuccessor, falseSuccessor, probability); + append(ifNode); + } + } + + private boolean tryGenConditionalForIf(BciBlock trueBlock, BciBlock falseBlock, LogicNode condition, int oldBci, int trueBlockInt, int falseBlockInt) { + if (gotoOrFallThroughAfterConstant(trueBlock) && gotoOrFallThroughAfterConstant(falseBlock) && trueBlock.getSuccessor(0) == falseBlock.getSuccessor(0)) { + genConditionalForIf(trueBlock, condition, oldBci, trueBlockInt, falseBlockInt, false); + return true; + } else if (this.currentDepth != 0 && returnAfterConstant(trueBlock) && returnAfterConstant(falseBlock)) { + genConditionalForIf(trueBlock, condition, oldBci, trueBlockInt, falseBlockInt, true); + return true; + } + return false; + } + + private void genConditionalForIf(BciBlock trueBlock, LogicNode condition, int oldBci, int trueBlockInt, int falseBlockInt, boolean genReturn) { + ConstantNode trueValue = currentGraph.unique(ConstantNode.forInt(trueBlockInt)); + ConstantNode falseValue = currentGraph.unique(ConstantNode.forInt(falseBlockInt)); + ValueNode conditionalNode = ConditionalNode.create(condition, trueValue, falseValue); + if (conditionalNode.graph() == null) { + conditionalNode = currentGraph.addOrUnique(conditionalNode); + } + if (genReturn) { + this.genReturn(conditionalNode); + } else { + frameState.push(Kind.Int, conditionalNode); + appendGoto(trueBlock.getSuccessor(0)); + stream.setBCI(oldBci); + } + } + + private LogicNode createLogicNode(Condition cond, ValueNode a, ValueNode b) { LogicNode condition; assert !a.getKind().isNumericFloat(); if (cond == Condition.EQ || cond == Condition.NE) { @@ -1699,80 +1914,20 @@ assert a.getKind() != Kind.Object && !cond.isUnsigned(); condition = genIntegerLessThan(a, b); } - - if (condition instanceof LogicNegationNode) { - LogicNegationNode logicNegationNode = (LogicNegationNode) condition; - negate = !negate; - condition = logicNegationNode.getValue(); - } - - if (condition instanceof LogicConstantNode) { - LogicConstantNode constantLogicNode = (LogicConstantNode) condition; - boolean value = constantLogicNode.getValue(); - if (negate) { - value = !value; - } - BciBlock nextBlock = falseBlock; - if (value) { - nextBlock = trueBlock; - } - appendGoto(nextBlock); - } else { - - if (condition.graph() == null) { - condition = currentGraph.unique(condition); - } - - // Need to get probability based on current bci. - double probability = branchProbability(); - - int oldBci = stream.currentBCI(); - int trueBlockInt = checkPositiveIntConstantPushed(trueBlock); - if (trueBlockInt != -1) { - int falseBlockInt = checkPositiveIntConstantPushed(falseBlock); - if (falseBlockInt != -1) { + return condition; + } - boolean genReturn = false; - boolean genConditional = false; - if (gotoOrFallThroughAfterConstant(trueBlock) && gotoOrFallThroughAfterConstant(falseBlock) && trueBlock.getSuccessor(0) == falseBlock.getSuccessor(0)) { - genConditional = true; - } else if (this.currentDepth != 0 && returnAfterConstant(trueBlock) && returnAfterConstant(falseBlock)) { - genReturn = true; - genConditional = true; - } - - if (genConditional) { - ConstantNode trueValue = currentGraph.unique(ConstantNode.forInt(trueBlockInt)); - ConstantNode falseValue = currentGraph.unique(ConstantNode.forInt(falseBlockInt)); - if (negate) { - ConstantNode tmp = falseValue; - falseValue = trueValue; - trueValue = tmp; - } - ValueNode conditionalNode = ConditionalNode.create(condition, trueValue, falseValue); - if (conditionalNode.graph() == null) { - conditionalNode = currentGraph.addOrUnique(conditionalNode); - } - if (genReturn) { - this.genReturn(conditionalNode); - } else { - frameState.push(Kind.Int, conditionalNode); - appendGoto(trueBlock.getSuccessor(0)); - stream.setBCI(oldBci); - } - return; - } - } - } - - this.controlFlowSplit = true; - - ValueNode trueSuccessor = createBlockTarget(probability, trueBlock, frameState); - ValueNode falseSuccessor = createBlockTarget(1 - probability, falseBlock, frameState); - - ValueNode ifNode = negate ? genIfNode(condition, falseSuccessor, trueSuccessor, 1 - probability) : genIfNode(condition, trueSuccessor, falseSuccessor, probability); - append(ifNode); + private void genConstantTargetIf(BciBlock trueBlock, BciBlock falseBlock, boolean negate, LogicNode condition) { + LogicConstantNode constantLogicNode = (LogicConstantNode) condition; + boolean value = constantLogicNode.getValue(); + if (negate) { + value = !value; } + BciBlock nextBlock = falseBlock; + if (value) { + nextBlock = trueBlock; + } + appendGoto(nextBlock); } private int checkPositiveIntConstantPushed(BciBlock block) { @@ -1837,6 +1992,26 @@ public boolean parsingReplacement() { return parsingReplacement; } + + public StructuredGraph getGraph() { + return currentGraph; + } + + public GuardingNode getCurrentBlockGuard() { + return (GuardingNode) getFirstInstruction(currentBlock, getCurrentDimension()); + } + + @Override + public String toString() { + return method.format("%H.%n(%p)@") + bci(); + } + + public BailoutException bailout(String string) { + FrameState currentFrameState = this.frameState.create(bci()); + StackTraceElement[] elements = GraphUtil.approxSourceStackTraceElement(currentFrameState); + BailoutException bailout = new BailoutException(string); + throw GraphUtil.createBailoutException(string, bailout, elements); + } } }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -31,7 +31,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.debug.*; -import com.oracle.graal.java.BciBlockMapping.LocalLiveness; +import com.oracle.graal.java.BciBlockMapping.*; import com.oracle.graal.java.GraphBuilderPlugin.ParameterPlugin; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; @@ -39,11 +39,27 @@ import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.util.*; -public class HIRFrameStateBuilder extends AbstractFrameStateBuilder<ValueNode, HIRFrameStateBuilder> { +public final class HIRFrameStateBuilder { private static final ValueNode[] EMPTY_ARRAY = new ValueNode[0]; private static final MonitorIdNode[] EMPTY_MONITOR_ARRAY = new MonitorIdNode[0]; + protected final ResolvedJavaMethod method; + protected int stackSize; + protected final ValueNode[] locals; + protected final ValueNode[] stack; + protected ValueNode[] lockedObjects; + + /** + * Specifies if asserting type checks are enabled. + */ + protected final boolean checkTypes; + + /** + * @see BytecodeFrame#rethrowException + */ + protected boolean rethrowException; + private MonitorIdNode[] monitorIds; private final StructuredGraph graph; private final Supplier<FrameState> outerFrameStateSupplier; @@ -54,8 +70,12 @@ * @param method the method whose frame is simulated * @param graph the target graph of Graal nodes created by the builder */ - public HIRFrameStateBuilder(ResolvedJavaMethod method, StructuredGraph graph, Supplier<FrameState> outerFrameStateSupplier) { - super(method); + public HIRFrameStateBuilder(ResolvedJavaMethod method, StructuredGraph graph, boolean checkTypes, Supplier<FrameState> outerFrameStateSupplier) { + this.method = method; + this.locals = allocateArray(method.getMaxLocals()); + this.stack = allocateArray(Math.max(1, method.getMaxStackSize())); + this.lockedObjects = allocateArray(0); + this.checkTypes = checkTypes; assert graph != null; @@ -64,7 +84,7 @@ this.outerFrameStateSupplier = outerFrameStateSupplier; } - public final void initializeFromArgumentsArray(ValueNode[] arguments) { + public void initializeFromArgumentsArray(ValueNode[] arguments) { int javaIndex = 0; int index = 0; @@ -83,7 +103,7 @@ } } - public final void initializeForMethodStart(boolean eagerResolve, ParameterPlugin parameterPlugin) { + public void initializeForMethodStart(boolean eagerResolve, ParameterPlugin parameterPlugin) { int javaIndex = 0; int index = 0; @@ -129,7 +149,17 @@ } private HIRFrameStateBuilder(HIRFrameStateBuilder other) { - super(other); + this.method = other.method; + this.stackSize = other.stackSize; + this.locals = other.locals.clone(); + this.stack = other.stack.clone(); + this.lockedObjects = other.lockedObjects.length == 0 ? other.lockedObjects : other.lockedObjects.clone(); + this.rethrowException = other.rethrowException; + this.checkTypes = other.checkTypes; + + assert locals.length == method.getMaxLocals(); + assert stack.length == Math.max(1, method.getMaxStackSize()); + assert other.graph != null; graph = other.graph; monitorIds = other.monitorIds.length == 0 ? other.monitorIds : other.monitorIds.clone(); @@ -140,8 +170,7 @@ assert lockedObjects.length == monitorIds.length; } - @Override - protected ValueNode[] allocateArray(int length) { + private static ValueNode[] allocateArray(int length) { return length == 0 ? EMPTY_ARRAY : new ValueNode[length]; } @@ -176,12 +205,10 @@ return graph.add(new FrameState(outerFrameState, method, bci, locals, stack, stackSize, lockedObjects, Arrays.asList(monitorIds), rethrowException, false)); } - @Override public HIRFrameStateBuilder copy() { return new HIRFrameStateBuilder(this); } - @Override public boolean isCompatibleWith(HIRFrameStateBuilder other) { assert method.equals(other.method) && graph == other.graph && localsSize() == other.localsSize() : "Can only compare frame states of the same method"; assert lockedObjects.length == monitorIds.length && other.lockedObjects.length == other.monitorIds.length : "mismatch between lockedObjects and monitorIds"; @@ -211,10 +238,18 @@ assert isCompatibleWith(other); for (int i = 0; i < localsSize(); i++) { - storeLocal(i, merge(localAt(i), other.localAt(i), block)); + ValueNode curLocal = localAt(i); + ValueNode mergedLocal = merge(curLocal, other.localAt(i), block); + if (curLocal != mergedLocal) { + storeLocal(i, mergedLocal); + } } for (int i = 0; i < stackSize(); i++) { - storeStack(i, merge(stackAt(i), other.stackAt(i), block)); + ValueNode curStack = stackAt(i); + ValueNode mergedStack = merge(curStack, other.stackAt(i), block); + if (curStack != mergedStack) { + storeStack(i, mergedStack); + } } for (int i = 0; i < lockedObjects.length; i++) { lockedObjects[i] = merge(lockedObjects[i], other.lockedObjects[i], block); @@ -225,7 +260,6 @@ private ValueNode merge(ValueNode currentValue, ValueNode otherValue, AbstractMergeNode block) { if (currentValue == null || currentValue.isDeleted()) { return null; - } else if (block.isPhiAtMerge(currentValue)) { if (otherValue == null || otherValue.isDeleted() || currentValue.getKind() != otherValue.getKind()) { propagateDelete((ValuePhiNode) currentValue); @@ -233,26 +267,27 @@ } ((PhiNode) currentValue).addInput(otherValue); return currentValue; - } else if (currentValue != otherValue) { assert !(block instanceof LoopBeginNode) : "Phi functions for loop headers are create eagerly for changed locals and all stack slots"; if (otherValue == null || otherValue.isDeleted() || currentValue.getKind() != otherValue.getKind()) { return null; } - - ValuePhiNode phi = graph.addWithoutUnique(new ValuePhiNode(currentValue.stamp().unrestricted(), block)); - for (int i = 0; i < block.phiPredecessorCount(); i++) { - phi.addInput(currentValue); - } - phi.addInput(otherValue); - assert phi.valueCount() == block.phiPredecessorCount() + 1 : "valueCount=" + phi.valueCount() + " predSize= " + block.phiPredecessorCount(); - return phi; - + return createValuePhi(currentValue, otherValue, block); } else { return currentValue; } } + private ValuePhiNode createValuePhi(ValueNode currentValue, ValueNode otherValue, AbstractMergeNode block) { + ValuePhiNode phi = graph.addWithoutUnique(new ValuePhiNode(currentValue.stamp().unrestricted(), block)); + for (int i = 0; i < block.phiPredecessorCount(); i++) { + phi.addInput(currentValue); + } + phi.addInput(otherValue); + assert phi.valueCount() == block.phiPredecessorCount() + 1; + return phi; + } + private void propagateDelete(FloatingNode node) { assert node instanceof ValuePhiNode || node instanceof ProxyNode; if (node.isDeleted()) { @@ -381,7 +416,6 @@ /** * @return the current lock depth */ - @Override public int lockDepth() { assert lockedObjects.length == monitorIds.length; return lockedObjects.length; @@ -406,4 +440,433 @@ } return false; } + + public void clearNonLiveLocals(BciBlock block, LocalLiveness liveness, boolean liveIn) { + /* + * (lstadler) if somebody is tempted to remove/disable this clearing code: it's possible to + * remove it for normal compilations, but not for OSR compilations - otherwise dead object + * slots at the OSR entry aren't cleared. it is also not enough to rely on PiNodes with + * Kind.Illegal, because the conflicting branch might not have been parsed. + */ + if (liveness == null) { + return; + } + if (liveIn) { + for (int i = 0; i < locals.length; i++) { + if (!liveness.localIsLiveIn(block, i)) { + locals[i] = null; + } + } + } else { + for (int i = 0; i < locals.length; i++) { + if (!liveness.localIsLiveOut(block, i)) { + locals[i] = null; + } + } + } + } + + /** + * @see BytecodeFrame#rethrowException + */ + public boolean rethrowException() { + return rethrowException; + } + + /** + * @see BytecodeFrame#rethrowException + */ + public void setRethrowException(boolean b) { + rethrowException = b; + } + + /** + * Returns the size of the local variables. + * + * @return the size of the local variables + */ + public int localsSize() { + return locals.length; + } + + /** + * Gets the current size (height) of the stack. + */ + public int stackSize() { + return stackSize; + } + + /** + * Gets the value in the local variables at the specified index, without any sanity checking. + * + * @param i the index into the locals + * @return the instruction that produced the value for the specified local + */ + public ValueNode localAt(int i) { + return locals[i]; + } + + /** + * Get the value on the stack at the specified stack index. + * + * @param i the index into the stack, with {@code 0} being the bottom of the stack + * @return the instruction at the specified position in the stack + */ + public ValueNode stackAt(int i) { + return stack[i]; + } + + /** + * Gets the value in the lock at the specified index, without any sanity checking. + * + * @param i the index into the lock + * @return the instruction that produced the value for the specified lock + */ + public ValueNode lockAt(int i) { + return lockedObjects[i]; + } + + public void storeLock(int i, ValueNode lock) { + lockedObjects[i] = lock; + } + + /** + * Loads the local variable at the specified index, checking that the returned value is non-null + * and that two-stack values are properly handled. + * + * @param i the index of the local variable to load + * @return the instruction that produced the specified local + */ + public ValueNode loadLocal(int i) { + ValueNode x = locals[i]; + assert assertLoadLocal(i, x); + return x; + } + + private boolean assertLoadLocal(int i, ValueNode x) { + assert x != null : i; + assert !checkTypes || (x.getKind().getSlotCount() == 1 || locals[i + 1] == null); + assert !checkTypes || (i == 0 || locals[i - 1] == null || locals[i - 1].getKind().getSlotCount() == 1); + return true; + } + + /** + * Stores a given local variable at the specified index. If the value occupies two slots, then + * the next local variable index is also overwritten. + * + * @param i the index at which to store + * @param x the instruction which produces the value for the local + */ + public void storeLocal(int i, ValueNode x) { + assert assertStoreLocal(x); + locals[i] = x; + if (x != null && x.getKind().needsTwoSlots()) { + // if this is a double word, then kill i+1 + locals[i + 1] = null; + } + if (x != null && i > 0) { + ValueNode p = locals[i - 1]; + if (p != null && p.getKind().needsTwoSlots()) { + // if there was a double word at i - 1, then kill it + locals[i - 1] = null; + } + } + } + + private boolean assertStoreLocal(ValueNode x) { + assert x == null || !checkTypes || (x.getKind() != Kind.Void && x.getKind() != Kind.Illegal) : "unexpected value: " + x; + return true; + } + + public void storeStack(int i, ValueNode x) { + assert assertStoreStack(i, x); + stack[i] = x; + } + + private boolean assertStoreStack(int i, ValueNode x) { + assert x == null || (stack[i] == null || x.getKind() == stack[i].getKind()) : "Method does not handle changes from one-slot to two-slot values or non-alive values"; + return true; + } + + /** + * Pushes an instruction onto the stack with the expected type. + * + * @param kind the type expected for this instruction + * @param x the instruction to push onto the stack + */ + public void push(Kind kind, ValueNode x) { + assert assertPush(kind, x); + xpush(x); + if (kind.needsTwoSlots()) { + xpush(null); + } + } + + private boolean assertPush(Kind kind, ValueNode x) { + assert !checkTypes || (x.getKind() != Kind.Void && x.getKind() != Kind.Illegal); + assert x != null && (!checkTypes || x.getKind() == kind); + return true; + } + + /** + * Pushes a value onto the stack without checking the type. + * + * @param x the instruction to push onto the stack + */ + public void xpush(ValueNode x) { + assert assertXpush(x); + stack[stackSize++] = x; + } + + private boolean assertXpush(ValueNode x) { + assert !checkTypes || (x == null || (x.getKind() != Kind.Void && x.getKind() != Kind.Illegal)); + return true; + } + + /** + * Pushes a value onto the stack and checks that it is an int. + * + * @param x the instruction to push onto the stack + */ + public void ipush(ValueNode x) { + assert assertInt(x); + xpush(x); + } + + /** + * Pushes a value onto the stack and checks that it is a float. + * + * @param x the instruction to push onto the stack + */ + public void fpush(ValueNode x) { + assert assertFloat(x); + xpush(x); + } + + /** + * Pushes a value onto the stack and checks that it is an object. + * + * @param x the instruction to push onto the stack + */ + public void apush(ValueNode x) { + assert assertObject(x); + xpush(x); + } + + /** + * Pushes a value onto the stack and checks that it is a long. + * + * @param x the instruction to push onto the stack + */ + public void lpush(ValueNode x) { + assert assertLong(x); + xpush(x); + xpush(null); + } + + /** + * Pushes a value onto the stack and checks that it is a double. + * + * @param x the instruction to push onto the stack + */ + public void dpush(ValueNode x) { + assert assertDouble(x); + xpush(x); + xpush(null); + } + + public void pushReturn(Kind kind, ValueNode x) { + if (kind != Kind.Void) { + push(kind.getStackKind(), x); + } + } + + /** + * Pops an instruction off the stack with the expected type. + * + * @param kind the expected type + * @return the instruction on the top of the stack + */ + public ValueNode pop(Kind kind) { + if (kind.needsTwoSlots()) { + xpop(); + } + assert assertPop(kind); + return xpop(); + } + + private boolean assertPop(Kind kind) { + assert kind != Kind.Void; + ValueNode x = xpeek(); + assert x != null && (!checkTypes || x.getKind() == kind); + return true; + } + + /** + * Pops a value off of the stack without checking the type. + * + * @return x the instruction popped off the stack + */ + public ValueNode xpop() { + return stack[--stackSize]; + } + + public ValueNode xpeek() { + return stack[stackSize - 1]; + } + + /** + * Pops a value off of the stack and checks that it is an int. + * + * @return x the instruction popped off the stack + */ + public ValueNode ipop() { + assert assertIntPeek(); + return xpop(); + } + + /** + * Pops a value off of the stack and checks that it is a float. + * + * @return x the instruction popped off the stack + */ + public ValueNode fpop() { + assert assertFloatPeek(); + return xpop(); + } + + /** + * Pops a value off of the stack and checks that it is an object. + * + * @return x the instruction popped off the stack + */ + public ValueNode apop() { + assert assertObjectPeek(); + return xpop(); + } + + /** + * Pops a value off of the stack and checks that it is a long. + * + * @return x the instruction popped off the stack + */ + public ValueNode lpop() { + assert assertHighPeek(); + xpop(); + assert assertLongPeek(); + return xpop(); + } + + /** + * Pops a value off of the stack and checks that it is a double. + * + * @return x the instruction popped off the stack + */ + public ValueNode dpop() { + assert assertHighPeek(); + xpop(); + assert assertDoublePeek(); + return xpop(); + } + + /** + * Pop the specified number of slots off of this stack and return them as an array of + * instructions. + * + * @return an array containing the arguments off of the stack + */ + public ValueNode[] popArguments(int argSize) { + ValueNode[] result = allocateArray(argSize); + int newStackSize = stackSize; + for (int i = argSize - 1; i >= 0; i--) { + newStackSize--; + if (stack[newStackSize] == null) { + /* Two-slot value. */ + newStackSize--; + assert stack[newStackSize].getKind().needsTwoSlots(); + } else { + assert !checkTypes || (stack[newStackSize].getKind().getSlotCount() == 1); + } + result[i] = stack[newStackSize]; + } + stackSize = newStackSize; + return result; + } + + /** + * Peeks an element from the operand stack. + * + * @param argumentNumber The number of the argument, relative from the top of the stack (0 = + * top). Long and double arguments only count as one argument, i.e., null-slots are + * ignored. + * @return The peeked argument. + */ + public ValueNode peek(int argumentNumber) { + int idx = stackSize() - 1; + for (int i = 0; i < argumentNumber; i++) { + if (stackAt(idx) == null) { + idx--; + assert stackAt(idx).getKind().needsTwoSlots(); + } + idx--; + } + return stackAt(idx); + } + + /** + * Clears all values on this stack. + */ + public void clearStack() { + stackSize = 0; + } + + private boolean assertLongPeek() { + return assertLong(xpeek()); + } + + private static boolean assertLong(ValueNode x) { + assert x != null && (x.getKind() == Kind.Long); + return true; + } + + private boolean assertIntPeek() { + return assertInt(xpeek()); + } + + private static boolean assertInt(ValueNode x) { + assert x != null && (x.getKind() == Kind.Int); + return true; + } + + private boolean assertFloatPeek() { + return assertFloat(xpeek()); + } + + private static boolean assertFloat(ValueNode x) { + assert x != null && (x.getKind() == Kind.Float); + return true; + } + + private boolean assertObjectPeek() { + return assertObject(xpeek()); + } + + private boolean assertObject(ValueNode x) { + assert x != null && (!checkTypes || (x.getKind() == Kind.Object)); + return true; + } + + private boolean assertDoublePeek() { + return assertDouble(xpeek()); + } + + private static boolean assertDouble(ValueNode x) { + assert x != null && (x.getKind() == Kind.Double); + return true; + } + + private boolean assertHighPeek() { + assert xpeek() == null; + return true; + } }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/InvocationPlugins.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/InvocationPlugins.java Mon Feb 23 16:23:23 2015 -0800 @@ -222,28 +222,15 @@ public static boolean check(ResolvedJavaMethod method, InvocationPlugin plugin) { int arguments = method.getSignature().getParameterCount(!method.isStatic()); assert arguments < SIGS.length : format("need to extend %s to support method with %d arguments: %s", InvocationPlugin.class.getSimpleName(), arguments, method.format("%H.%n(%p)")); - Method expected = null; for (Method m : plugin.getClass().getDeclaredMethods()) { if (m.getName().equals("apply")) { Class<?>[] parameterTypes = m.getParameterTypes(); - assert Arrays.equals(SIGS[arguments], parameterTypes) : format("graph builder plugin for %s has wrong signature%nexpected: (%s)%n actual: (%s)", method.format("%H.%n(%p)"), - sigString(SIGS[arguments]), sigString(m.getParameterTypes())); - expected = m; + if (Arrays.equals(SIGS[arguments], parameterTypes)) { + return true; + } } } - assert expected != null : format("graph builder plugin %s must define exactly one \"apply\" method, none found", plugin); - return true; - } - - protected static String sigString(Class<?>... sig) { - StringBuilder sb = new StringBuilder(); - for (Class<?> t : sig) { - if (sb.length() != 0) { - sb.append(", "); - } - sb.append(t.getSimpleName()); - } - return sb.toString(); + throw new AssertionError(format("graph builder plugin for %s not found", method.format("%H.%n(%p)"))); } } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/LargeLocalLiveness.java Mon Feb 23 16:23:23 2015 -0800 @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.java; + +import java.util.*; + +import com.oracle.graal.java.BciBlockMapping.*; + +public final class LargeLocalLiveness extends LocalLiveness { + private BitSet[] localsLiveIn; + private BitSet[] localsLiveOut; + private BitSet[] localsLiveGen; + private BitSet[] localsLiveKill; + private BitSet[] localsChangedInLoop; + + public LargeLocalLiveness(BciBlock[] blocks, int maxLocals, int loopCount) { + super(blocks); + int blocksSize = blocks.length; + localsLiveIn = new BitSet[blocksSize]; + localsLiveOut = new BitSet[blocksSize]; + localsLiveGen = new BitSet[blocksSize]; + localsLiveKill = new BitSet[blocksSize]; + for (int i = 0; i < blocksSize; i++) { + localsLiveIn[i] = new BitSet(maxLocals); + localsLiveOut[i] = new BitSet(maxLocals); + localsLiveGen[i] = new BitSet(maxLocals); + localsLiveKill[i] = new BitSet(maxLocals); + } + localsChangedInLoop = new BitSet[loopCount]; + for (int i = 0; i < loopCount; ++i) { + localsChangedInLoop[i] = new BitSet(maxLocals); + } + } + + @Override + protected String debugLiveIn(int blockID) { + return localsLiveIn[blockID].toString(); + } + + @Override + protected String debugLiveOut(int blockID) { + return localsLiveOut[blockID].toString(); + } + + @Override + protected String debugLiveGen(int blockID) { + return localsLiveGen[blockID].toString(); + } + + @Override + protected String debugLiveKill(int blockID) { + return localsLiveKill[blockID].toString(); + } + + @Override + protected int liveOutCardinality(int blockID) { + return localsLiveOut[blockID].cardinality(); + } + + @Override + protected void propagateLiveness(int blockID, int successorID) { + localsLiveOut[blockID].or(localsLiveIn[successorID]); + } + + @Override + protected void updateLiveness(int blockID) { + BitSet liveIn = localsLiveIn[blockID]; + liveIn.clear(); + liveIn.or(localsLiveOut[blockID]); + liveIn.andNot(localsLiveKill[blockID]); + liveIn.or(localsLiveGen[blockID]); + } + + @Override + protected void loadOne(int blockID, int local) { + if (!localsLiveKill[blockID].get(local)) { + localsLiveGen[blockID].set(local); + } + } + + @Override + protected void storeOne(int blockID, int local) { + if (!localsLiveGen[blockID].get(local)) { + localsLiveKill[blockID].set(local); + } + + BciBlock block = blocks[blockID]; + long tmp = block.loops; + int pos = 0; + while (tmp != 0) { + if ((tmp & 1L) == 1L) { + this.localsChangedInLoop[pos].set(local); + } + tmp >>= 1; + ++pos; + } + } + + @Override + public boolean localIsLiveIn(BciBlock block, int local) { + return block.getId() >= Integer.MAX_VALUE ? true : localsLiveIn[block.getId()].get(local); + } + + @Override + public boolean localIsLiveOut(BciBlock block, int local) { + return block.getId() >= Integer.MAX_VALUE ? true : localsLiveOut[block.getId()].get(local); + } + + @Override + public boolean localIsChangedInLoop(int loopId, int local) { + return localsChangedInLoop[loopId].get(local); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/LocalLiveness.java Mon Feb 23 16:23:23 2015 -0800 @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.java; + +import static com.oracle.graal.bytecode.Bytecodes.*; + +import com.oracle.graal.bytecode.*; +import com.oracle.graal.debug.*; +import com.oracle.graal.java.BciBlockMapping.*; + +/** + * Encapsulates the liveness calculation, so that subclasses for locals ≤ 64 and locals > 64 + * can be implemented. + */ +public abstract class LocalLiveness { + protected final BciBlock[] blocks; + + public static LocalLiveness compute(BytecodeStream stream, BciBlock[] blocks, int maxLocals, int loopCount) { + LocalLiveness liveness = maxLocals <= 64 ? new SmallLocalLiveness(blocks, maxLocals, loopCount) : new LargeLocalLiveness(blocks, maxLocals, loopCount); + liveness.computeLiveness(stream); + return liveness; + } + + protected LocalLiveness(BciBlock[] blocks) { + this.blocks = blocks; + } + + void computeLiveness(BytecodeStream stream) { + for (BciBlock block : blocks) { + computeLocalLiveness(stream, block); + } + + boolean changed; + int iteration = 0; + do { + Debug.log("Iteration %d", iteration); + changed = false; + for (int i = blocks.length - 1; i >= 0; i--) { + BciBlock block = blocks[i]; + int blockID = block.getId(); + // log statements in IFs because debugLiveX creates a new String + if (Debug.isLogEnabled()) { + Debug.logv(" start B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.getId(), block.startBci, block.endBci, debugLiveIn(blockID), debugLiveOut(blockID), + debugLiveGen(blockID), debugLiveKill(blockID)); + } + + boolean blockChanged = (iteration == 0); + if (block.getSuccessorCount() > 0) { + int oldCardinality = liveOutCardinality(blockID); + for (BciBlock sux : block.getSuccessors()) { + if (Debug.isLogEnabled()) { + Debug.log(" Successor B%d: %s", sux.getId(), debugLiveIn(sux.getId())); + } + propagateLiveness(blockID, sux.getId()); + } + blockChanged |= (oldCardinality != liveOutCardinality(blockID)); + } + + if (blockChanged) { + updateLiveness(blockID); + if (Debug.isLogEnabled()) { + Debug.logv(" end B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.getId(), block.startBci, block.endBci, debugLiveIn(blockID), debugLiveOut(blockID), + debugLiveGen(blockID), debugLiveKill(blockID)); + } + } + changed |= blockChanged; + } + iteration++; + } while (changed); + } + + /** + * Returns whether the local is live at the beginning of the given block. + */ + public abstract boolean localIsLiveIn(BciBlock block, int local); + + /** + * Returns whether the local is set in the given loop. + */ + public abstract boolean localIsChangedInLoop(int loopId, int local); + + /** + * Returns whether the local is live at the end of the given block. + */ + public abstract boolean localIsLiveOut(BciBlock block, int local); + + /** + * Returns a string representation of the liveIn values of the given block. + */ + protected abstract String debugLiveIn(int blockID); + + /** + * Returns a string representation of the liveOut values of the given block. + */ + protected abstract String debugLiveOut(int blockID); + + /** + * Returns a string representation of the liveGen values of the given block. + */ + protected abstract String debugLiveGen(int blockID); + + /** + * Returns a string representation of the liveKill values of the given block. + */ + protected abstract String debugLiveKill(int blockID); + + /** + * Returns the number of live locals at the end of the given block. + */ + protected abstract int liveOutCardinality(int blockID); + + /** + * Adds all locals the are in the liveIn of the successor to the liveOut of the block. + */ + protected abstract void propagateLiveness(int blockID, int successorID); + + /** + * Calculates a new liveIn for the given block from liveOut, liveKill and liveGen. + */ + protected abstract void updateLiveness(int blockID); + + /** + * Adds the local to liveGen if it wasn't already killed in this block. + */ + protected abstract void loadOne(int blockID, int local); + + /** + * Add this local to liveKill if it wasn't already generated in this block. + */ + protected abstract void storeOne(int blockID, int local); + + private void computeLocalLiveness(BytecodeStream stream, BciBlock block) { + if (block.startBci < 0 || block.endBci < 0) { + return; + } + int blockID = block.getId(); + int localIndex; + stream.setBCI(block.startBci); + while (stream.currentBCI() <= block.endBci) { + switch (stream.currentBC()) { + case LLOAD: + case DLOAD: + loadTwo(blockID, stream.readLocalIndex()); + break; + case LLOAD_0: + case DLOAD_0: + loadTwo(blockID, 0); + break; + case LLOAD_1: + case DLOAD_1: + loadTwo(blockID, 1); + break; + case LLOAD_2: + case DLOAD_2: + loadTwo(blockID, 2); + break; + case LLOAD_3: + case DLOAD_3: + loadTwo(blockID, 3); + break; + case IINC: + localIndex = stream.readLocalIndex(); + loadOne(blockID, localIndex); + storeOne(blockID, localIndex); + break; + case ILOAD: + case FLOAD: + case ALOAD: + case RET: + loadOne(blockID, stream.readLocalIndex()); + break; + case ILOAD_0: + case FLOAD_0: + case ALOAD_0: + loadOne(blockID, 0); + break; + case ILOAD_1: + case FLOAD_1: + case ALOAD_1: + loadOne(blockID, 1); + break; + case ILOAD_2: + case FLOAD_2: + case ALOAD_2: + loadOne(blockID, 2); + break; + case ILOAD_3: + case FLOAD_3: + case ALOAD_3: + loadOne(blockID, 3); + break; + + case LSTORE: + case DSTORE: + storeTwo(blockID, stream.readLocalIndex()); + break; + case LSTORE_0: + case DSTORE_0: + storeTwo(blockID, 0); + break; + case LSTORE_1: + case DSTORE_1: + storeTwo(blockID, 1); + break; + case LSTORE_2: + case DSTORE_2: + storeTwo(blockID, 2); + break; + case LSTORE_3: + case DSTORE_3: + storeTwo(blockID, 3); + break; + case ISTORE: + case FSTORE: + case ASTORE: + storeOne(blockID, stream.readLocalIndex()); + break; + case ISTORE_0: + case FSTORE_0: + case ASTORE_0: + storeOne(blockID, 0); + break; + case ISTORE_1: + case FSTORE_1: + case ASTORE_1: + storeOne(blockID, 1); + break; + case ISTORE_2: + case FSTORE_2: + case ASTORE_2: + storeOne(blockID, 2); + break; + case ISTORE_3: + case FSTORE_3: + case ASTORE_3: + storeOne(blockID, 3); + break; + } + stream.next(); + } + } + + private void loadTwo(int blockID, int local) { + loadOne(blockID, local); + loadOne(blockID, local + 1); + } + + private void storeTwo(int blockID, int local) { + storeOne(blockID, local); + storeOne(blockID, local + 1); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/SmallLocalLiveness.java Mon Feb 23 16:23:23 2015 -0800 @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.java; + +import com.oracle.graal.java.BciBlockMapping.*; + +public final class SmallLocalLiveness extends LocalLiveness { + /* + * local n is represented by the bit accessible as (1 << n) + */ + + private final long[] localsLiveIn; + private final long[] localsLiveOut; + private final long[] localsLiveGen; + private final long[] localsLiveKill; + private final long[] localsChangedInLoop; + private final int maxLocals; + + public SmallLocalLiveness(BciBlock[] blocks, int maxLocals, int loopCount) { + super(blocks); + this.maxLocals = maxLocals; + int blockSize = blocks.length; + localsLiveIn = new long[blockSize]; + localsLiveOut = new long[blockSize]; + localsLiveGen = new long[blockSize]; + localsLiveKill = new long[blockSize]; + localsChangedInLoop = new long[loopCount]; + } + + private String debugString(long value) { + StringBuilder str = new StringBuilder("{"); + long current = value; + for (int i = 0; i < maxLocals; i++) { + if ((current & 1L) == 1L) { + if (str.length() > 1) { + str.append(", "); + } + str.append(i); + } + current >>= 1; + } + return str.append('}').toString(); + } + + @Override + protected String debugLiveIn(int blockID) { + return debugString(localsLiveIn[blockID]); + } + + @Override + protected String debugLiveOut(int blockID) { + return debugString(localsLiveOut[blockID]); + } + + @Override + protected String debugLiveGen(int blockID) { + return debugString(localsLiveGen[blockID]); + } + + @Override + protected String debugLiveKill(int blockID) { + return debugString(localsLiveKill[blockID]); + } + + @Override + protected int liveOutCardinality(int blockID) { + return Long.bitCount(localsLiveOut[blockID]); + } + + @Override + protected void propagateLiveness(int blockID, int successorID) { + localsLiveOut[blockID] |= localsLiveIn[successorID]; + } + + @Override + protected void updateLiveness(int blockID) { + localsLiveIn[blockID] = (localsLiveOut[blockID] & ~localsLiveKill[blockID]) | localsLiveGen[blockID]; + } + + @Override + protected void loadOne(int blockID, int local) { + long bit = 1L << local; + if ((localsLiveKill[blockID] & bit) == 0L) { + localsLiveGen[blockID] |= bit; + } + } + + @Override + protected void storeOne(int blockID, int local) { + long bit = 1L << local; + if ((localsLiveGen[blockID] & bit) == 0L) { + localsLiveKill[blockID] |= bit; + } + + BciBlock block = blocks[blockID]; + long tmp = block.loops; + int pos = 0; + while (tmp != 0) { + if ((tmp & 1L) == 1L) { + this.localsChangedInLoop[pos] |= bit; + } + tmp >>= 1; + ++pos; + } + } + + @Override + public boolean localIsLiveIn(BciBlock block, int local) { + int blockID = block.getId(); + return blockID >= Integer.MAX_VALUE ? false : (localsLiveIn[blockID] & (1L << local)) != 0L; + } + + @Override + public boolean localIsLiveOut(BciBlock block, int local) { + int blockID = block.getId(); + return blockID >= Integer.MAX_VALUE ? false : (localsLiveOut[blockID] & (1L << local)) != 0L; + } + + @Override + public boolean localIsChangedInLoop(int loopId, int local) { + return (localsChangedInLoop[loopId] & (1L << local)) != 0L; + } +}
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/StandardGraphBuilderPlugins.java Wed Feb 18 10:37:08 2015 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.java; - -import static com.oracle.graal.java.GraphBuilderContext.*; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin; -import com.oracle.graal.java.InvocationPlugins.Registration; -import com.oracle.graal.java.InvocationPlugins.Registration.Receiver; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; -import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.java.*; - -/** - * Provides non-runtime specific {@link InvocationPlugin}s. - */ -public class StandardGraphBuilderPlugins { - public static void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { - Registration r = new Registration(plugins, metaAccess, Object.class); - r.register1("<init>", Receiver.class, new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder, ValueNode object) { - if (RegisterFinalizerNode.mayHaveFinalizer(object, builder.getAssumptions())) { - builder.append(new RegisterFinalizerNode(object)); - } - return true; - } - }); - - r = new Registration(plugins, metaAccess, Math.class); - r.register1("abs", Float.TYPE, new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder, ValueNode value) { - builder.push(Kind.Float, builder.append(new AbsNode(value))); - return true; - } - }); - r.register1("abs", Double.TYPE, new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder, ValueNode value) { - builder.push(Kind.Double, builder.append(new AbsNode(value))); - return true; - } - }); - r.register1("sqrt", Double.TYPE, new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder, ValueNode value) { - builder.push(Kind.Double, builder.append(new SqrtNode(value))); - return true; - } - }); - - for (Kind kind : Kind.values()) { - if (kind.isPrimitive() && kind != Kind.Void) { - new BoxPlugin(kind).register(metaAccess, plugins); - new UnboxPlugin(kind).register(metaAccess, plugins); - } - } - - GraalDirectivePlugins.registerInvocationPlugins(metaAccess, plugins); - } - - static class BoxPlugin implements InvocationPlugin { - - private final Kind kind; - - BoxPlugin(Kind kind) { - this.kind = kind; - } - - public boolean apply(GraphBuilderContext builder, ValueNode value) { - ResolvedJavaType resultType = builder.getMetaAccess().lookupJavaType(kind.toBoxedJavaClass()); - builder.push(Kind.Object, builder.append(new BoxNode(value, resultType, kind))); - return true; - } - - void register(MetaAccessProvider metaAccess, InvocationPlugins plugins) { - ResolvedJavaMethod method = Registration.resolve(metaAccess, kind.toBoxedJavaClass(), "valueOf", kind.toJavaClass()); - plugins.register(method, this); - } - } - - static class UnboxPlugin implements InvocationPlugin { - - private final Kind kind; - - UnboxPlugin(Kind kind) { - this.kind = kind; - } - - public boolean apply(GraphBuilderContext builder, ValueNode value) { - ValueNode valueNode = UnboxNode.create(builder.getMetaAccess(), builder.getConstantReflection(), nullCheckedValue(builder, value), kind); - builder.push(kind.getStackKind(), builder.append(valueNode)); - return true; - } - - void register(MetaAccessProvider metaAccess, InvocationPlugins plugins) { - String name = kind.toJavaClass().getSimpleName() + "Value"; - ResolvedJavaMethod method = Registration.resolve(metaAccess, kind.toBoxedJavaClass(), name); - plugins.register(method, this); - } - } -}
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/UntrustedInterfaces.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/UntrustedInterfaces.java Mon Feb 23 16:23:23 2015 -0800 @@ -45,20 +45,20 @@ * public void setField() { * field = new TestConstant(); * } - * + * * public void setStaticField() { * staticField = new TestConstant(); * } - * + * * public int callMe(CallBack callback) { * return callback.callBack(new TestConstant()); * } - * + * * public TestInterface get() { * return new TestConstant(); * } * } - * + * * private static final class TestConstant implements TestInterface { * public int method() { * return 42;
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6753639.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6753639.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ * @test * @bug 6753639 * @summary Strange optimisation in for loop with cyclic integer condition - * + * * @run main/othervm -Xbatch Test6753639 */ // @formatter:off
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/LongToSomethingArray01.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/LongToSomethingArray01.java Mon Feb 23 16:23:23 2015 -0800 @@ -28,7 +28,7 @@ /** * inspired by java.security.SecureRandom.longToByteArray(long). - * + * */ public class LongToSomethingArray01 extends JTTTest {
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64AddressValue.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64AddressValue.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,6 +33,7 @@ import com.oracle.graal.lir.LIRInstruction.OperandFlag; public final class AMD64AddressValue extends CompositeValue { + public static final CompositeValueClass<AMD64AddressValue> TYPE = CompositeValueClass.create(AMD64AddressValue.class); private static final long serialVersionUID = -4444600052487578694L; @@ -46,7 +47,7 @@ } public AMD64AddressValue(LIRKind kind, AllocatableValue base, AllocatableValue index, Scale scale, int displacement) { - super(kind); + super(TYPE, kind); this.base = base; this.index = index; this.scale = scale;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java Mon Feb 23 16:23:23 2015 -0800 @@ -63,13 +63,15 @@ /** * Unary operation with separate source and destination operand. */ - public static class Unary2Op extends AMD64LIRInstruction { + public static final class Unary2Op extends AMD64LIRInstruction { + public static final LIRInstructionClass<Unary2Op> TYPE = LIRInstructionClass.create(Unary2Op.class); @Opcode private final AMD64Arithmetic opcode; @Def({REG}) protected AllocatableValue result; @Use({REG, STACK}) protected AllocatableValue x; public Unary2Op(AMD64Arithmetic opcode, AllocatableValue result, AllocatableValue x) { + super(TYPE); this.opcode = opcode; this.result = result; this.x = x; @@ -84,13 +86,15 @@ /** * Unary operation with separate source and destination operand but register only. */ - public static class Unary2RegOp extends AMD64LIRInstruction { + public static final class Unary2RegOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<Unary2RegOp> TYPE = LIRInstructionClass.create(Unary2RegOp.class); @Opcode private final AMD64Arithmetic opcode; @Def({REG}) protected AllocatableValue result; @Use({REG}) protected AllocatableValue x; public Unary2RegOp(AMD64Arithmetic opcode, AllocatableValue result, AllocatableValue x) { + super(TYPE); this.opcode = opcode; this.result = result; this.x = x; @@ -106,12 +110,14 @@ * Unary operation with single operand for source and destination. */ public static class Unary1Op extends AMD64LIRInstruction { + public static final LIRInstructionClass<Unary1Op> TYPE = LIRInstructionClass.create(Unary1Op.class); @Opcode private final AMD64Arithmetic opcode; @Def({REG, HINT}) protected AllocatableValue result; @Use({REG, STACK}) protected AllocatableValue x; public Unary1Op(AMD64Arithmetic opcode, AllocatableValue result, AllocatableValue x) { + super(TYPE); this.opcode = opcode; this.result = result; this.x = x; @@ -127,13 +133,14 @@ /** * Unary operation with separate memory source and destination operand. */ - public static class Unary2MemoryOp extends MemOp { + public static final class Unary2MemoryOp extends MemOp { + public static final LIRInstructionClass<Unary2MemoryOp> TYPE = LIRInstructionClass.create(Unary2MemoryOp.class); @Opcode private final AMD64Arithmetic opcode; @Def({REG}) protected AllocatableValue result; public Unary2MemoryOp(AMD64Arithmetic opcode, AllocatableValue result, Kind kind, AMD64AddressValue address, LIRFrameState state) { - super(kind, address, state); + super(TYPE, kind, address, state); this.opcode = opcode; this.result = result; } @@ -149,6 +156,7 @@ * destination. The second source operand may be a stack slot. */ public static class BinaryRegStack extends AMD64LIRInstruction { + public static final LIRInstructionClass<BinaryRegStack> TYPE = LIRInstructionClass.create(BinaryRegStack.class); @Opcode private final AMD64Arithmetic opcode; @Def({REG, HINT}) protected AllocatableValue result; @@ -156,6 +164,7 @@ @Alive({REG, STACK}) protected AllocatableValue y; public BinaryRegStack(AMD64Arithmetic opcode, AllocatableValue result, AllocatableValue x, AllocatableValue y) { + super(TYPE); this.opcode = opcode; this.result = result; this.x = x; @@ -180,7 +189,8 @@ * Binary operation with two operands. The first source operand is combined with the * destination. The second source operand may be a stack slot. */ - public static class BinaryMemory extends AMD64LIRInstruction { + public static final class BinaryMemory extends AMD64LIRInstruction { + public static final LIRInstructionClass<BinaryMemory> TYPE = LIRInstructionClass.create(BinaryMemory.class); @Opcode private final AMD64Arithmetic opcode; @Def({REG, HINT}) protected AllocatableValue result; @@ -190,6 +200,7 @@ @State protected LIRFrameState state; public BinaryMemory(AMD64Arithmetic opcode, Kind kind, AllocatableValue result, AllocatableValue x, AMD64AddressValue location, LIRFrameState state) { + super(TYPE); this.opcode = opcode; this.result = result; this.x = x; @@ -219,7 +230,8 @@ * Binary operation with two operands. The first source operand is combined with the * destination. The second source operand must be a register. */ - public static class BinaryRegReg extends AMD64LIRInstruction { + public static final class BinaryRegReg extends AMD64LIRInstruction { + public static final LIRInstructionClass<BinaryRegReg> TYPE = LIRInstructionClass.create(BinaryRegReg.class); @Opcode private final AMD64Arithmetic opcode; @Def({REG, HINT}) protected AllocatableValue result; @@ -227,6 +239,7 @@ @Alive({REG}) protected AllocatableValue y; public BinaryRegReg(AMD64Arithmetic opcode, AllocatableValue result, AllocatableValue x, AllocatableValue y) { + super(TYPE); this.opcode = opcode; this.result = result; this.x = x; @@ -250,7 +263,8 @@ /** * Binary operation with single source/destination operand and one constant. */ - public static class BinaryRegConst extends AMD64LIRInstruction { + public static final class BinaryRegConst extends AMD64LIRInstruction { + public static final LIRInstructionClass<BinaryRegConst> TYPE = LIRInstructionClass.create(BinaryRegConst.class); @Opcode private final AMD64Arithmetic opcode; @Def({REG, HINT}) protected AllocatableValue result; @@ -258,6 +272,7 @@ protected JavaConstant y; public BinaryRegConst(AMD64Arithmetic opcode, AllocatableValue result, AllocatableValue x, JavaConstant y) { + super(TYPE); this.opcode = opcode; this.result = result; this.x = x; @@ -281,7 +296,8 @@ * Commutative binary operation with two operands. One of the operands is combined with the * result. */ - public static class BinaryCommutative extends AMD64LIRInstruction { + public static final class BinaryCommutative extends AMD64LIRInstruction { + public static final LIRInstructionClass<BinaryCommutative> TYPE = LIRInstructionClass.create(BinaryCommutative.class); @Opcode private final AMD64Arithmetic opcode; @Def({REG, HINT}) protected AllocatableValue result; @@ -289,6 +305,7 @@ @Use({REG, STACK}) protected AllocatableValue y; public BinaryCommutative(AMD64Arithmetic opcode, AllocatableValue result, AllocatableValue x, AllocatableValue y) { + super(TYPE); this.opcode = opcode; this.result = result; this.x = x; @@ -315,7 +332,8 @@ /** * Binary operation with separate source and destination and one constant operand. */ - public static class BinaryRegStackConst extends AMD64LIRInstruction { + public static final class BinaryRegStackConst extends AMD64LIRInstruction { + public static final LIRInstructionClass<BinaryRegStackConst> TYPE = LIRInstructionClass.create(BinaryRegStackConst.class); @Opcode private final AMD64Arithmetic opcode; @Def({REG}) protected AllocatableValue result; @@ -323,6 +341,7 @@ protected JavaConstant y; public BinaryRegStackConst(AMD64Arithmetic opcode, AllocatableValue result, AllocatableValue x, JavaConstant y) { + super(TYPE); this.opcode = opcode; this.result = result; this.x = x; @@ -364,7 +383,8 @@ } } - public static class MulHighOp extends AMD64LIRInstruction { + public static final class MulHighOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<MulHighOp> TYPE = LIRInstructionClass.create(MulHighOp.class); @Opcode private final AMD64Arithmetic opcode; @Def({REG}) public AllocatableValue lowResult; @@ -373,6 +393,7 @@ @Use({REG, STACK}) public AllocatableValue y; public MulHighOp(AMD64Arithmetic opcode, LIRKind kind, AllocatableValue y) { + super(TYPE); this.opcode = opcode; this.x = AMD64.rax.asValue(kind); this.y = y; @@ -420,7 +441,8 @@ } } - public static class DivRemOp extends AMD64LIRInstruction { + public static final class DivRemOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<DivRemOp> TYPE = LIRInstructionClass.create(DivRemOp.class); @Opcode private final AMD64Arithmetic opcode; @Def public AllocatableValue divResult; @@ -430,6 +452,7 @@ @State protected LIRFrameState state; public DivRemOp(AMD64Arithmetic opcode, AllocatableValue x, AllocatableValue y, LIRFrameState state) { + super(TYPE); this.opcode = opcode; this.divResult = AMD64.rax.asValue(LIRKind.derive(x, y)); this.remResult = AMD64.rdx.asValue(LIRKind.derive(x, y)); @@ -456,6 +479,7 @@ } public static class FPDivRemOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<FPDivRemOp> TYPE = LIRInstructionClass.create(FPDivRemOp.class); @Opcode private final AMD64Arithmetic opcode; @Def protected AllocatableValue result; @@ -464,6 +488,7 @@ @Temp protected AllocatableValue raxTemp; public FPDivRemOp(AMD64Arithmetic opcode, AllocatableValue result, AllocatableValue x, AllocatableValue y) { + super(TYPE); this.opcode = opcode; this.result = result; this.raxTemp = AMD64.rax.asValue(LIRKind.value(Kind.Int));
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ArrayEqualsOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ArrayEqualsOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -45,7 +45,8 @@ * instructions specialized code is emitted to leverage these instructions. */ @Opcode("ARRAY_EQUALS") -public class AMD64ArrayEqualsOp extends AMD64LIRInstruction { +public final class AMD64ArrayEqualsOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64ArrayEqualsOp> TYPE = LIRInstructionClass.create(AMD64ArrayEqualsOp.class); private final Kind kind; private final int arrayBaseOffset; @@ -63,6 +64,7 @@ @Temp({REG, ILLEGAL}) protected Value vectorTemp2; public AMD64ArrayEqualsOp(LIRGeneratorTool tool, Kind kind, Value result, Value array1, Value array2, Value length) { + super(TYPE); this.kind = kind; Class<?> arrayClass = Array.newInstance(kind.toJavaClass(), 0).getClass();
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BitManipulationOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BitManipulationOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -28,7 +28,8 @@ import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; -public class AMD64BitManipulationOp extends AMD64LIRInstruction { +public final class AMD64BitManipulationOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64BitManipulationOp> TYPE = LIRInstructionClass.create(AMD64BitManipulationOp.class); public enum IntrinsicOpcode { IPOPCNT, @@ -47,6 +48,7 @@ @Use({OperandFlag.REG, OperandFlag.STACK}) protected AllocatableValue input; public AMD64BitManipulationOp(IntrinsicOpcode opcode, AllocatableValue result, AllocatableValue input) { + super(TYPE); this.opcode = opcode; this.result = result; this.input = input;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BreakpointOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BreakpointOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -33,7 +33,8 @@ * Emits a breakpoint. */ @Opcode("BREAKPOINT") -public class AMD64BreakpointOp extends AMD64LIRInstruction { +public final class AMD64BreakpointOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64BreakpointOp> TYPE = LIRInstructionClass.create(AMD64BreakpointOp.class); /** * A set of values loaded into the Java ABI parameter locations (for inspection by a debugger). @@ -41,6 +42,7 @@ @Use({REG, STACK}) protected Value[] parameters; public AMD64BreakpointOp(Value[] parameters) { + super(TYPE); this.parameters = parameters; }
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ByteSwapOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ByteSwapOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -29,12 +29,14 @@ import com.oracle.graal.lir.asm.*; @Opcode("BSWAP") -public class AMD64ByteSwapOp extends AMD64LIRInstruction { +public final class AMD64ByteSwapOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64ByteSwapOp> TYPE = LIRInstructionClass.create(AMD64ByteSwapOp.class); @Def({OperandFlag.REG, OperandFlag.HINT}) protected Value result; @Use protected Value input; public AMD64ByteSwapOp(Value result, Value input) { + super(TYPE); this.result = result; this.input = input; }
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64CCall.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64CCall.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -27,9 +27,11 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.amd64.*; +import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; -public class AMD64CCall extends AMD64LIRInstruction { +public final class AMD64CCall extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64CCall> TYPE = LIRInstructionClass.create(AMD64CCall.class); @Def({REG, ILLEGAL}) protected Value result; @Use({REG, STACK}) protected Value[] parameters; @@ -37,6 +39,7 @@ @Use({REG}) protected Value numberOfFloatingPointArguments; public AMD64CCall(Value result, Value functionPtr, Value numberOfFloatingPointArguments, Value[] parameters) { + super(TYPE); this.result = result; this.functionPtr = functionPtr; this.parameters = parameters;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,13 +36,15 @@ public class AMD64Call { public abstract static class CallOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<CallOp> TYPE = LIRInstructionClass.create(CallOp.class); @Def({REG, ILLEGAL}) protected Value result; @Use({REG, STACK}) protected Value[] parameters; @Temp protected Value[] temps; @State protected LIRFrameState state; - public CallOp(Value result, Value[] parameters, Value[] temps, LIRFrameState state) { + protected CallOp(LIRInstructionClass<? extends CallOp> c, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { + super(c); this.result = result; this.parameters = parameters; this.state = state; @@ -57,21 +59,23 @@ } public abstract static class MethodCallOp extends CallOp { + public static final LIRInstructionClass<MethodCallOp> TYPE = LIRInstructionClass.create(MethodCallOp.class); protected final ResolvedJavaMethod callTarget; - public MethodCallOp(ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { - super(result, parameters, temps, state); + protected MethodCallOp(LIRInstructionClass<? extends MethodCallOp> c, ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { + super(c, result, parameters, temps, state); this.callTarget = callTarget; } } @Opcode("CALL_DIRECT") - public static class DirectCallOp extends MethodCallOp { + public abstract static class DirectCallOp extends MethodCallOp { + public static final LIRInstructionClass<DirectCallOp> TYPE = LIRInstructionClass.create(DirectCallOp.class); - public DirectCallOp(ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { - super(callTarget, result, parameters, temps, state); + protected DirectCallOp(LIRInstructionClass<? extends DirectCallOp> c, ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { + super(c, callTarget, result, parameters, temps, state); } @Override @@ -82,11 +86,17 @@ @Opcode("CALL_INDIRECT") public static class IndirectCallOp extends MethodCallOp { + public static final LIRInstructionClass<IndirectCallOp> TYPE = LIRInstructionClass.create(IndirectCallOp.class); @Use({REG}) protected Value targetAddress; public IndirectCallOp(ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, Value targetAddress, LIRFrameState state) { - super(callTarget, result, parameters, temps, state); + this(TYPE, callTarget, result, parameters, temps, targetAddress, state); + } + + protected IndirectCallOp(LIRInstructionClass<? extends IndirectCallOp> c, ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, Value targetAddress, + LIRFrameState state) { + super(c, callTarget, result, parameters, temps, state); this.targetAddress = targetAddress; } @@ -103,11 +113,12 @@ } public abstract static class ForeignCallOp extends CallOp { + public static final LIRInstructionClass<ForeignCallOp> TYPE = LIRInstructionClass.create(ForeignCallOp.class); protected final ForeignCallLinkage callTarget; - public ForeignCallOp(ForeignCallLinkage callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { - super(result, parameters, temps, state); + public ForeignCallOp(LIRInstructionClass<? extends ForeignCallOp> c, ForeignCallLinkage callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { + super(c, result, parameters, temps, state); this.callTarget = callTarget; } @@ -118,10 +129,11 @@ } @Opcode("NEAR_FOREIGN_CALL") - public static class DirectNearForeignCallOp extends ForeignCallOp { + public static final class DirectNearForeignCallOp extends ForeignCallOp { + public static final LIRInstructionClass<DirectNearForeignCallOp> TYPE = LIRInstructionClass.create(DirectNearForeignCallOp.class); public DirectNearForeignCallOp(ForeignCallLinkage linkage, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { - super(linkage, result, parameters, temps, state); + super(TYPE, linkage, result, parameters, temps, state); } @Override @@ -131,12 +143,13 @@ } @Opcode("FAR_FOREIGN_CALL") - public static class DirectFarForeignCallOp extends ForeignCallOp { + public static final class DirectFarForeignCallOp extends ForeignCallOp { + public static final LIRInstructionClass<DirectFarForeignCallOp> TYPE = LIRInstructionClass.create(DirectFarForeignCallOp.class); @Temp({REG}) protected AllocatableValue callTemp; public DirectFarForeignCallOp(ForeignCallLinkage callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { - super(callTarget, result, parameters, temps, state); + super(TYPE, callTarget, result, parameters, temps, state); /* * The register allocator does not support virtual registers that are used at the call * site, so use a fixed register.
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java Mon Feb 23 16:23:23 2015 -0800 @@ -42,12 +42,14 @@ FCMP, DCMP; - public static class CompareOp extends AMD64LIRInstruction { + public static final class CompareOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<CompareOp> TYPE = LIRInstructionClass.create(CompareOp.class); @Opcode private final AMD64Compare opcode; @Use({REG}) protected Value x; @Use({REG, STACK, CONST}) protected Value y; public CompareOp(AMD64Compare opcode, Value x, Value y) { + super(TYPE); this.opcode = opcode; this.x = x; this.y = y; @@ -70,7 +72,8 @@ } } - public static class CompareMemoryOp extends MemOp { + public static final class CompareMemoryOp extends MemOp { + public static final LIRInstructionClass<CompareMemoryOp> TYPE = LIRInstructionClass.create(CompareMemoryOp.class); @Opcode private final AMD64Compare opcode; @Use({REG, CONST}) protected Value y; @@ -78,7 +81,7 @@ * Compare memory, constant or register, memory. */ public CompareMemoryOp(AMD64Compare opcode, Kind kind, AMD64AddressValue address, Value y, LIRFrameState state) { - super(kind, address, state); + super(TYPE, kind, address, state); this.opcode = opcode; this.y = y; }
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,14 +38,17 @@ import com.oracle.graal.lir.*; import com.oracle.graal.lir.StandardOp.BlockEndOp; import com.oracle.graal.lir.SwitchStrategy.BaseSwitchClosure; +import com.oracle.graal.lir.amd64.AMD64Call.CallOp; import com.oracle.graal.lir.asm.*; public class AMD64ControlFlow { - public static class ReturnOp extends AMD64LIRInstruction implements BlockEndOp { + public static final class ReturnOp extends AMD64LIRInstruction implements BlockEndOp { + public static final LIRInstructionClass<CallOp> TYPE = LIRInstructionClass.create(CallOp.class); @Use({REG, ILLEGAL}) protected Value x; public ReturnOp(Value x) { + super(TYPE); this.x = x; } @@ -57,6 +60,7 @@ } public static class BranchOp extends AMD64LIRInstruction implements StandardOp.BranchOp { + public static final LIRInstructionClass<BranchOp> TYPE = LIRInstructionClass.create(BranchOp.class); protected final ConditionFlag condition; protected final LabelRef trueDestination; protected final LabelRef falseDestination; @@ -68,6 +72,11 @@ } public BranchOp(ConditionFlag condition, LabelRef trueDestination, LabelRef falseDestination, double trueDestinationProbability) { + this(TYPE, condition, trueDestination, falseDestination, trueDestinationProbability); + } + + protected BranchOp(LIRInstructionClass<? extends BranchOp> c, ConditionFlag condition, LabelRef trueDestination, LabelRef falseDestination, double trueDestinationProbability) { + super(c); this.condition = condition; this.trueDestination = trueDestination; this.falseDestination = falseDestination; @@ -102,11 +111,12 @@ } } - public static class FloatBranchOp extends BranchOp { + public static final class FloatBranchOp extends BranchOp { + public static final LIRInstructionClass<FloatBranchOp> TYPE = LIRInstructionClass.create(FloatBranchOp.class); protected boolean unorderedIsTrue; public FloatBranchOp(Condition condition, boolean unorderedIsTrue, LabelRef trueDestination, LabelRef falseDestination, double trueDestinationProbability) { - super(floatCond(condition), trueDestination, falseDestination, trueDestinationProbability); + super(TYPE, floatCond(condition), trueDestination, falseDestination, trueDestinationProbability); this.unorderedIsTrue = unorderedIsTrue; } @@ -116,7 +126,8 @@ } } - public static class StrategySwitchOp extends AMD64LIRInstruction implements BlockEndOp { + public static final class StrategySwitchOp extends AMD64LIRInstruction implements BlockEndOp { + public static final LIRInstructionClass<StrategySwitchOp> TYPE = LIRInstructionClass.create(StrategySwitchOp.class); @Use({CONST}) protected JavaConstant[] keyConstants; private final LabelRef[] keyTargets; private LabelRef defaultTarget; @@ -125,6 +136,7 @@ private final SwitchStrategy strategy; public StrategySwitchOp(SwitchStrategy strategy, LabelRef[] keyTargets, LabelRef defaultTarget, Value key, Value scratch) { + super(TYPE); this.strategy = strategy; this.keyConstants = strategy.keyConstants; this.keyTargets = keyTargets; @@ -170,7 +182,8 @@ } } - public static class TableSwitchOp extends AMD64LIRInstruction implements BlockEndOp { + public static final class TableSwitchOp extends AMD64LIRInstruction implements BlockEndOp { + public static final LIRInstructionClass<TableSwitchOp> TYPE = LIRInstructionClass.create(TableSwitchOp.class); private final int lowKey; private final LabelRef defaultTarget; private final LabelRef[] targets; @@ -179,6 +192,7 @@ @Temp protected Value scratch; public TableSwitchOp(final int lowKey, final LabelRef defaultTarget, final LabelRef[] targets, Value index, Variable scratch, Variable idxScratch) { + super(TYPE); this.lowKey = lowKey; this.defaultTarget = defaultTarget; this.targets = targets; @@ -254,13 +268,15 @@ } @Opcode("CMOVE") - public static class CondMoveOp extends AMD64LIRInstruction { + public static final class CondMoveOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<CondMoveOp> TYPE = LIRInstructionClass.create(CondMoveOp.class); @Def({REG, HINT}) protected Value result; @Alive({REG}) protected Value trueValue; @Use({REG, STACK, CONST}) protected Value falseValue; private final ConditionFlag condition; public CondMoveOp(Variable result, Condition condition, AllocatableValue trueValue, Value falseValue) { + super(TYPE); this.result = result; this.condition = intCond(condition); this.trueValue = trueValue; @@ -274,7 +290,8 @@ } @Opcode("CMOVE") - public static class FloatCondMoveOp extends AMD64LIRInstruction { + public static final class FloatCondMoveOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<FloatCondMoveOp> TYPE = LIRInstructionClass.create(FloatCondMoveOp.class); @Def({REG}) protected Value result; @Alive({REG}) protected Value trueValue; @Alive({REG}) protected Value falseValue; @@ -282,6 +299,7 @@ private final boolean unorderedIsTrue; public FloatCondMoveOp(Variable result, Condition condition, boolean unorderedIsTrue, Variable trueValue, Variable falseValue) { + super(TYPE); this.result = result; this.condition = floatCond(condition); this.unorderedIsTrue = unorderedIsTrue;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMap.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMap.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ * * <pre> * Base Contents - * + * * : : ----- * caller | incoming overflow argument n | ^ * frame : ... : | positive
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64LIRInstruction.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64LIRInstruction.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,7 +29,12 @@ /** * Convenience class to provide AMD64MacroAssembler for the {@link #emitCode} method. */ -public abstract class AMD64LIRInstruction extends LIRInstructionBase { +public abstract class AMD64LIRInstruction extends LIRInstruction { + public static final LIRInstructionClass<AMD64LIRInstruction> TYPE = LIRInstructionClass.create(AMD64LIRInstruction.class); + + protected AMD64LIRInstruction(LIRInstructionClass<? extends AMD64LIRInstruction> c) { + super(c); + } @Override public final void emitCode(CompilationResultBuilder crb) {
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64MathIntrinsicOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64MathIntrinsicOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -31,7 +31,8 @@ import com.oracle.graal.lir.asm.*; // @formatter:off -public class AMD64MathIntrinsicOp extends AMD64LIRInstruction { +public final class AMD64MathIntrinsicOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64MathIntrinsicOp> TYPE = LIRInstructionClass.create(AMD64MathIntrinsicOp.class); public enum IntrinsicOpcode { SIN, COS, TAN, LOG, LOG10 @@ -42,6 +43,7 @@ @Use protected Value input; public AMD64MathIntrinsicOp(IntrinsicOpcode opcode, Value result, Value input) { + super(TYPE); this.opcode = opcode; this.result = result; this.input = input;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -42,10 +42,12 @@ public class AMD64Move { private abstract static class AbstractMoveOp extends AMD64LIRInstruction implements MoveOp { + public static final LIRInstructionClass<AbstractMoveOp> TYPE = LIRInstructionClass.create(AbstractMoveOp.class); private Kind moveKind; - public AbstractMoveOp(Kind moveKind) { + protected AbstractMoveOp(LIRInstructionClass<? extends AbstractMoveOp> c, Kind moveKind) { + super(c); if (moveKind == Kind.Illegal) { // unknown operand size, conservatively move the whole register this.moveKind = Kind.Long; @@ -61,13 +63,14 @@ } @Opcode("MOVE") - public static class MoveToRegOp extends AbstractMoveOp { + public static final class MoveToRegOp extends AbstractMoveOp { + public static final LIRInstructionClass<MoveToRegOp> TYPE = LIRInstructionClass.create(MoveToRegOp.class); @Def({REG, HINT}) protected AllocatableValue result; @Use({REG, STACK, CONST}) protected Value input; public MoveToRegOp(Kind moveKind, AllocatableValue result, Value input) { - super(moveKind); + super(TYPE, moveKind); this.result = result; this.input = input; } @@ -84,13 +87,14 @@ } @Opcode("MOVE") - public static class MoveFromRegOp extends AbstractMoveOp { + public static final class MoveFromRegOp extends AbstractMoveOp { + public static final LIRInstructionClass<MoveFromRegOp> TYPE = LIRInstructionClass.create(MoveFromRegOp.class); @Def({REG, STACK}) protected AllocatableValue result; @Use({REG, CONST, HINT}) protected Value input; public MoveFromRegOp(Kind moveKind, AllocatableValue result, Value input) { - super(moveKind); + super(TYPE, moveKind); this.result = result; this.input = input; } @@ -107,12 +111,14 @@ } public abstract static class MemOp extends AMD64LIRInstruction implements ImplicitNullCheck { + public static final LIRInstructionClass<MemOp> TYPE = LIRInstructionClass.create(MemOp.class); protected final Kind kind; @Use({COMPOSITE}) protected AMD64AddressValue address; @State protected LIRFrameState state; - public MemOp(Kind kind, AMD64AddressValue address, LIRFrameState state) { + public MemOp(LIRInstructionClass<? extends MemOp> c, Kind kind, AMD64AddressValue address, LIRFrameState state) { + super(c); this.kind = kind; this.address = address; this.state = state; @@ -137,12 +143,13 @@ } } - public static class LoadOp extends MemOp { + public static final class LoadOp extends MemOp { + public static final LIRInstructionClass<LoadOp> TYPE = LIRInstructionClass.create(LoadOp.class); @Def({REG}) protected AllocatableValue result; public LoadOp(Kind kind, AllocatableValue result, AMD64AddressValue address, LIRFrameState state) { - super(kind, address, state); + super(TYPE, kind, address, state); this.result = result; } @@ -182,12 +189,13 @@ } } - public static class ZeroExtendLoadOp extends MemOp { + public static final class ZeroExtendLoadOp extends MemOp { + public static final LIRInstructionClass<ZeroExtendLoadOp> TYPE = LIRInstructionClass.create(ZeroExtendLoadOp.class); @Def({REG}) protected AllocatableValue result; public ZeroExtendLoadOp(Kind kind, AllocatableValue result, AMD64AddressValue address, LIRFrameState state) { - super(kind, address, state); + super(TYPE, kind, address, state); this.result = result; } @@ -214,12 +222,13 @@ } } - public static class StoreOp extends MemOp { + public static final class StoreOp extends MemOp { + public static final LIRInstructionClass<StoreOp> TYPE = LIRInstructionClass.create(StoreOp.class); @Use({REG}) protected AllocatableValue input; public StoreOp(Kind kind, AMD64AddressValue address, AllocatableValue input, LIRFrameState state) { - super(kind, address, state); + super(TYPE, kind, address, state); this.input = input; } @@ -256,12 +265,13 @@ } } - public static class StoreConstantOp extends MemOp { + public abstract static class StoreConstantOp extends MemOp { + public static final LIRInstructionClass<StoreConstantOp> TYPE = LIRInstructionClass.create(StoreConstantOp.class); protected final JavaConstant input; - public StoreConstantOp(Kind kind, AMD64AddressValue address, JavaConstant input, LIRFrameState state) { - super(kind, address, state); + protected StoreConstantOp(LIRInstructionClass<? extends StoreConstantOp> c, Kind kind, AMD64AddressValue address, JavaConstant input, LIRFrameState state) { + super(c, kind, address, state); this.input = input; } @@ -304,12 +314,14 @@ } } - public static class LeaOp extends AMD64LIRInstruction { + public static final class LeaOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<LeaOp> TYPE = LIRInstructionClass.create(LeaOp.class); @Def({REG}) protected AllocatableValue result; @Use({COMPOSITE, UNINITIALIZED}) protected AMD64AddressValue address; public LeaOp(AllocatableValue result, AMD64AddressValue address) { + super(TYPE); this.result = result; this.address = address; } @@ -320,12 +332,14 @@ } } - public static class LeaDataOp extends AMD64LIRInstruction { + public static final class LeaDataOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<LeaDataOp> TYPE = LIRInstructionClass.create(LeaDataOp.class); @Def({REG}) protected AllocatableValue result; private final byte[] data; public LeaDataOp(AllocatableValue result, byte[] data) { + super(TYPE); this.result = result; this.data = data; } @@ -336,12 +350,14 @@ } } - public static class StackLeaOp extends AMD64LIRInstruction { + public static final class StackLeaOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<StackLeaOp> TYPE = LIRInstructionClass.create(StackLeaOp.class); @Def({REG}) protected AllocatableValue result; @Use({STACK, UNINITIALIZED}) protected StackSlotValue slot; public StackLeaOp(AllocatableValue result, StackSlotValue slot) { + super(TYPE); assert isStackSlotValue(slot) : "Not a stack slot: " + slot; this.result = result; this.slot = slot; @@ -353,11 +369,13 @@ } } - public static class MembarOp extends AMD64LIRInstruction { + public static final class MembarOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<MembarOp> TYPE = LIRInstructionClass.create(MembarOp.class); private final int barriers; public MembarOp(final int barriers) { + super(TYPE); this.barriers = barriers; } @@ -367,12 +385,14 @@ } } - public static class NullCheckOp extends AMD64LIRInstruction implements NullCheck { + public static final class NullCheckOp extends AMD64LIRInstruction implements NullCheck { + public static final LIRInstructionClass<NullCheckOp> TYPE = LIRInstructionClass.create(NullCheckOp.class); @Use({REG}) protected AllocatableValue input; @State protected LIRFrameState state; public NullCheckOp(Variable input, LIRFrameState state) { + super(TYPE); this.input = input; this.state = state; } @@ -393,7 +413,8 @@ } @Opcode("CAS") - public static class CompareAndSwapOp extends AMD64LIRInstruction { + public static final class CompareAndSwapOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<CompareAndSwapOp> TYPE = LIRInstructionClass.create(CompareAndSwapOp.class); private final Kind accessKind; @@ -403,6 +424,7 @@ @Use protected AllocatableValue newValue; public CompareAndSwapOp(Kind accessKind, AllocatableValue result, AMD64AddressValue address, AllocatableValue cmpValue, AllocatableValue newValue) { + super(TYPE); this.accessKind = accessKind; this.result = result; this.address = address; @@ -432,7 +454,8 @@ } @Opcode("ATOMIC_READ_AND_ADD") - public static class AtomicReadAndAddOp extends AMD64LIRInstruction { + public static final class AtomicReadAndAddOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AtomicReadAndAddOp> TYPE = LIRInstructionClass.create(AtomicReadAndAddOp.class); private final Kind accessKind; @@ -441,6 +464,7 @@ @Use protected AllocatableValue delta; public AtomicReadAndAddOp(Kind accessKind, AllocatableValue result, AMD64AddressValue address, AllocatableValue delta) { + super(TYPE); this.accessKind = accessKind; this.result = result; this.address = address; @@ -467,7 +491,8 @@ } @Opcode("ATOMIC_READ_AND_WRITE") - public static class AtomicReadAndWriteOp extends AMD64LIRInstruction { + public static final class AtomicReadAndWriteOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AtomicReadAndWriteOp> TYPE = LIRInstructionClass.create(AtomicReadAndWriteOp.class); private final Kind accessKind; @@ -476,6 +501,7 @@ @Use protected AllocatableValue newValue; public AtomicReadAndWriteOp(Kind accessKind, AllocatableValue result, AMD64AddressValue address, AllocatableValue newValue) { + super(TYPE); this.accessKind = accessKind; this.result = result; this.address = address;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64RestoreRegistersOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64RestoreRegistersOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -37,6 +37,7 @@ */ @Opcode("RESTORE_REGISTER") public class AMD64RestoreRegistersOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64RestoreRegistersOp> TYPE = LIRInstructionClass.create(AMD64RestoreRegistersOp.class); /** * The slots from which the registers are restored. @@ -49,6 +50,11 @@ private final AMD64SaveRegistersOp save; public AMD64RestoreRegistersOp(StackSlotValue[] values, AMD64SaveRegistersOp save) { + this(TYPE, values, save); + } + + protected AMD64RestoreRegistersOp(LIRInstructionClass<? extends AMD64RestoreRegistersOp> c, StackSlotValue[] values, AMD64SaveRegistersOp save) { + super(c); assert Arrays.asList(values).stream().allMatch(ValueUtil::isVirtualStackSlot); this.slots = values; this.save = save;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64SaveRegistersOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64SaveRegistersOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -39,6 +39,7 @@ */ @Opcode("SAVE_REGISTER") public class AMD64SaveRegistersOp extends AMD64LIRInstruction implements SaveRegistersOp { + public static final LIRInstructionClass<AMD64SaveRegistersOp> TYPE = LIRInstructionClass.create(AMD64SaveRegistersOp.class); /** * The registers (potentially) saved by this operation. @@ -63,6 +64,11 @@ * @param supportsRemove determines if registers can be {@linkplain #remove(Set) pruned} */ public AMD64SaveRegistersOp(Register[] savedRegisters, StackSlotValue[] savedRegisterLocations, boolean supportsRemove) { + this(TYPE, savedRegisters, savedRegisterLocations, supportsRemove); + } + + public AMD64SaveRegistersOp(LIRInstructionClass<? extends AMD64SaveRegistersOp> c, Register[] savedRegisters, StackSlotValue[] savedRegisterLocations, boolean supportsRemove) { + super(c); assert Arrays.asList(savedRegisterLocations).stream().allMatch(ValueUtil::isVirtualStackSlot); this.savedRegisters = savedRegisters; this.slots = savedRegisterLocations;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64TestMemoryOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64TestMemoryOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -32,12 +32,13 @@ import com.oracle.graal.lir.amd64.AMD64Move.MemOp; import com.oracle.graal.lir.asm.*; -public class AMD64TestMemoryOp extends MemOp { +public final class AMD64TestMemoryOp extends MemOp { + public static final LIRInstructionClass<AMD64TestMemoryOp> TYPE = LIRInstructionClass.create(AMD64TestMemoryOp.class); @Use({REG, CONST}) protected Value y; public AMD64TestMemoryOp(Kind kind, AMD64AddressValue x, Value y, LIRFrameState state) { - super(kind, x, state); + super(TYPE, kind, x, state); this.y = y; this.state = state; }
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64TestOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64TestOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -28,14 +28,17 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.amd64.*; import com.oracle.graal.compiler.common.*; +import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; -public class AMD64TestOp extends AMD64LIRInstruction { +public final class AMD64TestOp extends AMD64LIRInstruction { + public static final LIRInstructionClass<AMD64TestOp> TYPE = LIRInstructionClass.create(AMD64TestOp.class); @Use({REG}) protected Value x; @Use({REG, STACK, CONST}) protected Value y; public AMD64TestOp(Value x, Value y) { + super(TYPE); this.x = x; this.y = y; }
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ZapRegistersOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ZapRegistersOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -40,6 +40,7 @@ */ @Opcode("ZAP_REGISTER") public final class AMD64ZapRegistersOp extends AMD64LIRInstruction implements SaveRegistersOp { + public static final LIRInstructionClass<AMD64ZapRegistersOp> TYPE = LIRInstructionClass.create(AMD64ZapRegistersOp.class); /** * The registers that are zapped. @@ -52,6 +53,7 @@ @Use({CONST}) protected JavaConstant[] zapValues; public AMD64ZapRegistersOp(Register[] zappedRegisters, JavaConstant[] zapValues) { + super(TYPE); this.zappedRegisters = zappedRegisters; this.zapValues = zapValues; }
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCAddressValue.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCAddressValue.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -31,7 +31,8 @@ import com.oracle.graal.lir.*; import com.oracle.graal.lir.LIRInstruction.OperandFlag; -public class SPARCAddressValue extends CompositeValue { +public final class SPARCAddressValue extends CompositeValue { + public static final CompositeValueClass<SPARCAddressValue> TYPE = CompositeValueClass.create(SPARCAddressValue.class); private static final long serialVersionUID = -3583286416638228207L; @@ -44,7 +45,7 @@ } public SPARCAddressValue(LIRKind kind, AllocatableValue base, AllocatableValue index, int displacement) { - super(kind); + super(TYPE, kind); assert isIllegal(index) || displacement == 0; this.base = base; this.index = index;
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArithmetic.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArithmetic.java Mon Feb 23 16:23:23 2015 -0800 @@ -56,13 +56,15 @@ /** * Unary operation with separate source and destination operand. */ - public static class Unary2Op extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final class Unary2Op extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<Unary2Op> TYPE = LIRInstructionClass.create(Unary2Op.class); @Opcode private final SPARCArithmetic opcode; @Def({REG, HINT}) protected AllocatableValue result; @Use({REG}) protected AllocatableValue x; public Unary2Op(SPARCArithmetic opcode, AllocatableValue result, AllocatableValue x) { + super(TYPE); this.opcode = opcode; this.result = result; this.x = x; @@ -78,7 +80,8 @@ * Binary operation with two operands. The first source operand is combined with the * destination. The second source operand must be a register. */ - public static class BinaryRegReg extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final class BinaryRegReg extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<BinaryRegReg> TYPE = LIRInstructionClass.create(BinaryRegReg.class); @Opcode private final SPARCArithmetic opcode; @Def({REG, HINT}) protected Value result; @@ -91,6 +94,7 @@ } public BinaryRegReg(SPARCArithmetic opcode, Value result, Value x, Value y, LIRFrameState state) { + super(TYPE); this.opcode = opcode; this.result = result; this.x = x; @@ -113,7 +117,8 @@ /** * Binary operation with single source/destination operand and one constant. */ - public static class BinaryRegConst extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final class BinaryRegConst extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<BinaryRegConst> TYPE = LIRInstructionClass.create(BinaryRegConst.class); @Opcode private final SPARCArithmetic opcode; @Def({REG, HINT}) protected AllocatableValue result; @@ -126,6 +131,7 @@ } public BinaryRegConst(SPARCArithmetic opcode, AllocatableValue result, Value x, JavaConstant y, LIRFrameState state) { + super(TYPE); this.opcode = opcode; this.result = result; this.x = x; @@ -148,7 +154,8 @@ /** * Special LIR instruction as it requires a bunch of scratch registers. */ - public static class RemOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final class RemOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<RemOp> TYPE = LIRInstructionClass.create(RemOp.class); @Opcode private final SPARCArithmetic opcode; @Def({REG}) protected Value result; @@ -159,6 +166,7 @@ @State protected LIRFrameState state; public RemOp(SPARCArithmetic opcode, Value result, Value x, Value y, LIRFrameState state, LIRGeneratorTool gen) { + super(TYPE); this.opcode = opcode; this.result = result; this.x = x; @@ -183,7 +191,8 @@ /** * Calculates the product and condition code for long multiplication of long values. */ - public static class SPARCLMulccOp extends SPARCLIRInstruction { + public static final class SPARCLMulccOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<SPARCLMulccOp> TYPE = LIRInstructionClass.create(SPARCLMulccOp.class); @Def({REG}) protected Value result; @Alive({REG}) protected Value x; @Alive({REG}) protected Value y; @@ -191,6 +200,7 @@ @Temp({REG}) protected Value scratch2; public SPARCLMulccOp(Value result, Value x, Value y, LIRGeneratorTool gen) { + super(TYPE); this.result = result; this.x = x; this.y = y; @@ -835,7 +845,8 @@ } } - public static class MulHighOp extends SPARCLIRInstruction { + public static final class MulHighOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<MulHighOp> TYPE = LIRInstructionClass.create(MulHighOp.class); @Opcode private final SPARCArithmetic opcode; @Def({REG}) public AllocatableValue result; @@ -844,6 +855,7 @@ @Temp({REG}) public AllocatableValue scratch; public MulHighOp(SPARCArithmetic opcode, AllocatableValue x, AllocatableValue y, AllocatableValue result, AllocatableValue scratch) { + super(TYPE); this.opcode = opcode; this.x = x; this.y = y;
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArrayEqualsOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArrayEqualsOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -46,7 +46,8 @@ * Emits code which compares two arrays of the same length. */ @Opcode("ARRAY_EQUALS") -public class SPARCArrayEqualsOp extends SPARCLIRInstruction { +public final class SPARCArrayEqualsOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<SPARCArrayEqualsOp> TYPE = LIRInstructionClass.create(SPARCArrayEqualsOp.class); private final Kind kind; private final int arrayBaseOffset; @@ -63,6 +64,7 @@ @Temp({REG}) protected Value temp5; public SPARCArrayEqualsOp(LIRGeneratorTool tool, Kind kind, Value result, Value array1, Value array2, Value length) { + super(TYPE); this.kind = kind; Class<?> arrayClass = Array.newInstance(kind.toJavaClass(), 0).getClass();
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,7 +41,8 @@ import com.oracle.graal.lir.asm.*; import com.oracle.graal.lir.gen.*; -public class SPARCBitManipulationOp extends SPARCLIRInstruction { +public final class SPARCBitManipulationOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<SPARCBitManipulationOp> TYPE = LIRInstructionClass.create(SPARCBitManipulationOp.class); public enum IntrinsicOpcode { IPOPCNT, @@ -57,6 +58,7 @@ @Temp({REG}) protected Value scratch; public SPARCBitManipulationOp(IntrinsicOpcode opcode, AllocatableValue result, AllocatableValue input, LIRGeneratorTool gen) { + super(TYPE); this.opcode = opcode; this.result = result; this.input = input;
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBreakpointOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBreakpointOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -34,7 +34,8 @@ * Emits a breakpoint. */ @Opcode("BREAKPOINT") -public class SPARCBreakpointOp extends SPARCLIRInstruction { +public final class SPARCBreakpointOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<SPARCBreakpointOp> TYPE = LIRInstructionClass.create(SPARCBreakpointOp.class); // historical - from hotspot src/cpu/sparc/vm // <sys/trap.h> promises that the system will not use traps 16-31 @@ -47,6 +48,7 @@ @Use({REG, STACK}) protected Value[] parameters; public SPARCBreakpointOp(Value[] parameters) { + super(TYPE); this.parameters = parameters; }
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCByteSwapOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCByteSwapOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -35,7 +35,8 @@ import com.oracle.graal.lir.gen.*; @Opcode("BSWAP") -public class SPARCByteSwapOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { +public final class SPARCByteSwapOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<SPARCByteSwapOp> TYPE = LIRInstructionClass.create(SPARCByteSwapOp.class); @Def({REG, HINT}) protected Value result; @Use({REG}) protected Value input; @@ -43,6 +44,7 @@ @Use({STACK}) protected StackSlotValue tmpSlot; public SPARCByteSwapOp(LIRGeneratorTool tool, Value result, Value input) { + super(TYPE); this.result = result; this.input = input; this.tmpSlot = tool.getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(Kind.Long));
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCall.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCall.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -41,13 +41,15 @@ public class SPARCCall { public abstract static class CallOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<CallOp> TYPE = LIRInstructionClass.create(CallOp.class); @Def({REG, ILLEGAL}) protected Value result; @Use({REG, STACK}) protected Value[] parameters; @Temp protected Value[] temps; @State protected LIRFrameState state; - public CallOp(Value result, Value[] parameters, Value[] temps, LIRFrameState state) { + protected CallOp(LIRInstructionClass<? extends CallOp> c, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { + super(c); this.result = result; this.parameters = parameters; this.state = state; @@ -62,27 +64,32 @@ } public abstract static class MethodCallOp extends CallOp { + public static final LIRInstructionClass<MethodCallOp> TYPE = LIRInstructionClass.create(MethodCallOp.class); protected final ResolvedJavaMethod callTarget; - public MethodCallOp(ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { - super(result, parameters, temps, state); + protected MethodCallOp(LIRInstructionClass<? extends MethodCallOp> c, ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { + super(c, result, parameters, temps, state); this.callTarget = callTarget; } } @Opcode("CALL_DIRECT") - public static class DirectCallOp extends MethodCallOp /* implements SPARCDelayedControlTransfer */{ + public abstract static class DirectCallOp extends MethodCallOp /* + * implements + * SPARCDelayedControlTransfer + */{ + public static final LIRInstructionClass<DirectCallOp> TYPE = LIRInstructionClass.create(DirectCallOp.class); private boolean emitted = false; private int before = -1; - public DirectCallOp(ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { - super(callTarget, result, parameters, temps, state); + public DirectCallOp(LIRInstructionClass<? extends DirectCallOp> c, ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { + super(c, callTarget, result, parameters, temps, state); } @Override - public final void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { + public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { if (!emitted) { emitCallPrefixCode(crb, masm); directCall(crb, masm, callTarget, null, true, state); @@ -122,12 +129,14 @@ } @Opcode("CALL_INDIRECT") - public static class IndirectCallOp extends MethodCallOp { + public abstract static class IndirectCallOp extends MethodCallOp { + public static final LIRInstructionClass<IndirectCallOp> TYPE = LIRInstructionClass.create(IndirectCallOp.class); @Use({REG}) protected Value targetAddress; - public IndirectCallOp(ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, Value targetAddress, LIRFrameState state) { - super(callTarget, result, parameters, temps, state); + protected IndirectCallOp(LIRInstructionClass<? extends IndirectCallOp> c, ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, Value targetAddress, + LIRFrameState state) { + super(c, callTarget, result, parameters, temps, state); this.targetAddress = targetAddress; } @@ -144,11 +153,12 @@ } public abstract static class ForeignCallOp extends CallOp { + public static final LIRInstructionClass<ForeignCallOp> TYPE = LIRInstructionClass.create(ForeignCallOp.class); protected final ForeignCallLinkage callTarget; - public ForeignCallOp(ForeignCallLinkage callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { - super(result, parameters, temps, state); + public ForeignCallOp(LIRInstructionClass<? extends ForeignCallOp> c, ForeignCallLinkage callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { + super(c, result, parameters, temps, state); this.callTarget = callTarget; } @@ -159,10 +169,11 @@ } @Opcode("NEAR_FOREIGN_CALL") - public static class DirectNearForeignCallOp extends ForeignCallOp { + public static final class DirectNearForeignCallOp extends ForeignCallOp { + public static final LIRInstructionClass<DirectNearForeignCallOp> TYPE = LIRInstructionClass.create(DirectNearForeignCallOp.class); public DirectNearForeignCallOp(ForeignCallLinkage linkage, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { - super(linkage, result, parameters, temps, state); + super(TYPE, linkage, result, parameters, temps, state); } @Override @@ -172,10 +183,11 @@ } @Opcode("FAR_FOREIGN_CALL") - public static class DirectFarForeignCallOp extends ForeignCallOp { + public static final class DirectFarForeignCallOp extends ForeignCallOp { + public static final LIRInstructionClass<DirectFarForeignCallOp> TYPE = LIRInstructionClass.create(DirectFarForeignCallOp.class); public DirectFarForeignCallOp(ForeignCallLinkage callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { - super(callTarget, result, parameters, temps, state); + super(TYPE, callTarget, result, parameters, temps, state); } @Override
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCompare.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCompare.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,13 +40,15 @@ FCMP, DCMP; - public static class CompareOp extends SPARCLIRInstruction { + public static final class CompareOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<CompareOp> TYPE = LIRInstructionClass.create(CompareOp.class); @Opcode private final SPARCCompare opcode; @Use({REG}) protected Value x; @Use({REG, CONST}) protected Value y; public CompareOp(SPARCCompare opcode, Value x, Value y) { + super(TYPE); this.opcode = opcode; this.x = x; this.y = y;
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -42,11 +42,13 @@ public class SPARCControlFlow { - public static class ReturnOp extends SPARCLIRInstruction implements BlockEndOp { + public static final class ReturnOp extends SPARCLIRInstruction implements BlockEndOp { + public static final LIRInstructionClass<ReturnOp> TYPE = LIRInstructionClass.create(ReturnOp.class); @Use({REG, ILLEGAL}) protected Value x; public ReturnOp(Value x) { + super(TYPE); this.x = x; } @@ -62,7 +64,8 @@ } } - public static class CompareBranchOp extends SPARCLIRInstruction implements BlockEndOp, SPARCDelayedControlTransfer { + public static final class CompareBranchOp extends SPARCLIRInstruction implements BlockEndOp, SPARCDelayedControlTransfer { + public static final LIRInstructionClass<CompareBranchOp> TYPE = LIRInstructionClass.create(CompareBranchOp.class); private final SPARCCompare opcode; @Use({REG}) protected Value x; @@ -83,6 +86,7 @@ public CompareBranchOp(SPARCCompare opcode, Value x, Value y, Condition condition, LabelRef trueDestination, LabelRef falseDestination, Kind kind, boolean unorderedIsTrue, double trueDestinationProbability) { + super(TYPE); this.opcode = opcode; this.x = x; this.y = y; @@ -348,7 +352,8 @@ } } - public static class BranchOp extends SPARCLIRInstruction implements StandardOp.BranchOp { + public static final class BranchOp extends SPARCLIRInstruction implements StandardOp.BranchOp { + public static final LIRInstructionClass<BranchOp> TYPE = LIRInstructionClass.create(BranchOp.class); // TODO: Condition code/flag handling needs to be improved; protected final Condition condition; protected final ConditionFlag conditionFlag; @@ -358,6 +363,7 @@ protected final boolean unorderedIsTrue; public BranchOp(ConditionFlag condition, LabelRef trueDestination, LabelRef falseDestination, Kind kind) { + super(TYPE); this.conditionFlag = condition; this.trueDestination = trueDestination; this.falseDestination = falseDestination; @@ -367,6 +373,7 @@ } public BranchOp(Condition condition, LabelRef trueDestination, LabelRef falseDestination, Kind kind) { + super(TYPE); this.condition = condition; this.trueDestination = trueDestination; this.falseDestination = falseDestination; @@ -376,6 +383,7 @@ } public BranchOp(Condition finalCondition, LabelRef trueDestination, LabelRef falseDestination, Kind kind, boolean unorderedIsTrue) { + super(TYPE); this.trueDestination = trueDestination; this.falseDestination = falseDestination; this.kind = kind; @@ -517,7 +525,8 @@ } } - public static class StrategySwitchOp extends SPARCLIRInstruction implements BlockEndOp { + public static final class StrategySwitchOp extends SPARCLIRInstruction implements BlockEndOp { + public static final LIRInstructionClass<StrategySwitchOp> TYPE = LIRInstructionClass.create(StrategySwitchOp.class); @Use({CONST}) protected JavaConstant[] keyConstants; private final LabelRef[] keyTargets; private LabelRef defaultTarget; @@ -526,6 +535,7 @@ private final SwitchStrategy strategy; public StrategySwitchOp(SwitchStrategy strategy, LabelRef[] keyTargets, LabelRef defaultTarget, Value key, Value scratch) { + super(TYPE); this.strategy = strategy; this.keyConstants = strategy.keyConstants; this.keyTargets = keyTargets; @@ -583,7 +593,8 @@ } } - public static class TableSwitchOp extends SPARCLIRInstruction implements BlockEndOp { + public static final class TableSwitchOp extends SPARCLIRInstruction implements BlockEndOp { + public static final LIRInstructionClass<TableSwitchOp> TYPE = LIRInstructionClass.create(TableSwitchOp.class); private final int lowKey; private final LabelRef defaultTarget; @@ -592,6 +603,7 @@ @Temp protected Value scratch; public TableSwitchOp(final int lowKey, final LabelRef defaultTarget, final LabelRef[] targets, Variable index, Variable scratch) { + super(TYPE); this.lowKey = lowKey; this.defaultTarget = defaultTarget; this.targets = targets; @@ -655,7 +667,8 @@ } @Opcode("CMOVE") - public static class CondMoveOp extends SPARCLIRInstruction { + public static final class CondMoveOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<CondMoveOp> TYPE = LIRInstructionClass.create(CondMoveOp.class); private final Kind kind; @@ -667,6 +680,7 @@ private final CC cc; public CondMoveOp(Kind kind, Variable result, CC cc, ConditionFlag condition, Value trueValue, Value falseValue) { + super(TYPE); this.kind = kind; this.result = result; this.condition = condition;
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMap.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMap.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ * * <pre> * Base Contents - * + * * : : ----- * caller | incoming overflow argument n | ^ * frame : ... : | positive
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCJumpOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCJumpOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -29,12 +29,13 @@ import com.oracle.graal.lir.StandardOp.JumpOp; import com.oracle.graal.lir.asm.*; -public class SPARCJumpOp extends JumpOp implements SPARCDelayedControlTransfer { +public final class SPARCJumpOp extends JumpOp implements SPARCDelayedControlTransfer { + public static final LIRInstructionClass<SPARCJumpOp> TYPE = LIRInstructionClass.create(SPARCJumpOp.class); private boolean emitDone = false; private int delaySlotPosition = -1; public SPARCJumpOp(LabelRef destination) { - super(destination); + super(TYPE, destination); } public void emitControlTransfer(CompilationResultBuilder crb, SPARCMacroAssembler masm) {
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCLIRInstruction.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCLIRInstruction.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -29,7 +29,13 @@ /** * Convenience class to provide SPARCMacroAssembler for the {@link #emitCode} method. */ -public abstract class SPARCLIRInstruction extends LIRInstructionBase { +public abstract class SPARCLIRInstruction extends LIRInstruction { + public static final LIRInstructionClass<SPARCLIRInstruction> TYPE = LIRInstructionClass.create(SPARCLIRInstruction.class); + + protected SPARCLIRInstruction(LIRInstructionClass<? extends LIRInstruction> c) { + super(c); + } + protected SPARCDelayedControlTransfer delayedControlTransfer = SPARCDelayedControlTransfer.DUMMY; @Override
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMathIntrinsicOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMathIntrinsicOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -31,7 +31,8 @@ import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; -public class SPARCMathIntrinsicOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { +public final class SPARCMathIntrinsicOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<SPARCMathIntrinsicOp> TYPE = LIRInstructionClass.create(SPARCMathIntrinsicOp.class); public enum IntrinsicOpcode { SQRT, @@ -48,6 +49,7 @@ @Use protected Value input; public SPARCMathIntrinsicOp(IntrinsicOpcode opcode, Value result, Value input) { + super(TYPE); this.opcode = opcode; this.result = result; this.input = input;
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -74,11 +74,13 @@ @Opcode("MOVE_TOREG") public static class MoveToRegOp extends SPARCLIRInstruction implements MoveOp, SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<MoveToRegOp> TYPE = LIRInstructionClass.create(MoveToRegOp.class); @Def({REG, HINT}) protected AllocatableValue result; @Use({REG, STACK, CONST}) protected Value input; public MoveToRegOp(AllocatableValue result, Value input) { + super(TYPE); this.result = result; this.input = input; } @@ -100,12 +102,14 @@ } @Opcode("MOVE_FROMREG") - public static class MoveFromRegOp extends SPARCLIRInstruction implements MoveOp, SPARCTailDelayedLIRInstruction { + public static final class MoveFromRegOp extends SPARCLIRInstruction implements MoveOp, SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<MoveFromRegOp> TYPE = LIRInstructionClass.create(MoveFromRegOp.class); @Def({REG, STACK}) protected AllocatableValue result; @Use({REG, CONST, HINT}) protected Value input; public MoveFromRegOp(AllocatableValue result, Value input) { + super(TYPE); this.result = result; this.input = input; } @@ -130,14 +134,15 @@ * Move between floating-point and general purpose register domain (WITHOUT VIS3). */ @Opcode("MOVE") - public static class MoveFpGp extends SPARCLIRInstruction implements MoveOp, SPARCTailDelayedLIRInstruction { + public static final class MoveFpGp extends SPARCLIRInstruction implements MoveOp, SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<MoveFpGp> TYPE = LIRInstructionClass.create(MoveFpGp.class); @Def({REG}) protected AllocatableValue result; @Use({REG}) protected AllocatableValue input; @Use({STACK}) protected StackSlotValue temp; public MoveFpGp(AllocatableValue result, AllocatableValue input, StackSlotValue temp) { - super(); + super(TYPE); this.result = result; this.input = input; this.temp = temp; @@ -224,13 +229,14 @@ * Move between floating-point and general purpose register domain (WITH VIS3). */ @Opcode("MOVE") - public static class MoveFpGpVIS3 extends SPARCLIRInstruction implements MoveOp, SPARCTailDelayedLIRInstruction { + public static final class MoveFpGpVIS3 extends SPARCLIRInstruction implements MoveOp, SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<MoveFpGpVIS3> TYPE = LIRInstructionClass.create(MoveFpGpVIS3.class); @Def({REG}) protected AllocatableValue result; @Use({REG}) protected AllocatableValue input; public MoveFpGpVIS3(AllocatableValue result, AllocatableValue input) { - super(); + super(TYPE); this.result = result; this.input = input; } @@ -277,12 +283,14 @@ } public abstract static class MemOp extends SPARCLIRInstruction implements ImplicitNullCheck { + public static final LIRInstructionClass<MemOp> TYPE = LIRInstructionClass.create(MemOp.class); protected final Kind kind; @Use({COMPOSITE}) protected SPARCAddressValue address; @State protected LIRFrameState state; - public MemOp(Kind kind, SPARCAddressValue address, LIRFrameState state) { + public MemOp(LIRInstructionClass<? extends MemOp> c, Kind kind, SPARCAddressValue address, LIRFrameState state) { + super(c); this.kind = kind; this.address = address; this.state = state; @@ -304,12 +312,13 @@ } } - public static class LoadOp extends MemOp implements SPARCTailDelayedLIRInstruction { + public static final class LoadOp extends MemOp implements SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<LoadOp> TYPE = LIRInstructionClass.create(LoadOp.class); @Def({REG}) protected AllocatableValue result; public LoadOp(Kind kind, AllocatableValue result, SPARCAddressValue address, LIRFrameState state) { - super(kind, address, state); + super(TYPE, kind, address, state); this.result = result; } @@ -356,12 +365,14 @@ } } - public static class LoadAddressOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final class LoadAddressOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<LoadAddressOp> TYPE = LIRInstructionClass.create(LoadAddressOp.class); @Def({REG}) protected AllocatableValue result; @Use({COMPOSITE, UNINITIALIZED}) protected SPARCAddressValue addressValue; public LoadAddressOp(AllocatableValue result, SPARCAddressValue address) { + super(TYPE); this.result = result; this.addressValue = address; } @@ -373,12 +384,14 @@ } } - public static class LoadDataAddressOp extends SPARCLIRInstruction { + public static final class LoadDataAddressOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<LoadDataAddressOp> TYPE = LIRInstructionClass.create(LoadDataAddressOp.class); @Def({REG}) protected AllocatableValue result; private final byte[] data; public LoadDataAddressOp(AllocatableValue result, byte[] data) { + super(TYPE); this.result = result; this.data = data; } @@ -393,11 +406,13 @@ } } - public static class MembarOp extends SPARCLIRInstruction { + public static final class MembarOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<MembarOp> TYPE = LIRInstructionClass.create(MembarOp.class); private final int barriers; public MembarOp(final int barriers) { + super(TYPE); this.barriers = barriers; } @@ -407,12 +422,14 @@ } } - public static class NullCheckOp extends SPARCLIRInstruction implements NullCheck, SPARCTailDelayedLIRInstruction { + public static final class NullCheckOp extends SPARCLIRInstruction implements NullCheck, SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<NullCheckOp> TYPE = LIRInstructionClass.create(NullCheckOp.class); @Use({REG}) protected AllocatableValue input; @State protected LIRFrameState state; public NullCheckOp(Variable input, LIRFrameState state) { + super(TYPE); this.input = input; this.state = state; } @@ -434,7 +451,8 @@ } @Opcode("CAS") - public static class CompareAndSwapOp extends SPARCLIRInstruction { + public static final class CompareAndSwapOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<CompareAndSwapOp> TYPE = LIRInstructionClass.create(CompareAndSwapOp.class); @Def({REG, HINT}) protected AllocatableValue result; @Alive({REG}) protected AllocatableValue address; @@ -442,6 +460,7 @@ @Use({REG}) protected AllocatableValue newValue; public CompareAndSwapOp(AllocatableValue result, AllocatableValue address, AllocatableValue cmpValue, AllocatableValue newValue) { + super(TYPE); this.result = result; this.address = address; this.cmpValue = cmpValue; @@ -455,12 +474,14 @@ } } - public static class StackLoadAddressOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final class StackLoadAddressOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<StackLoadAddressOp> TYPE = LIRInstructionClass.create(StackLoadAddressOp.class); @Def({REG}) protected AllocatableValue result; @Use({STACK, UNINITIALIZED}) protected StackSlotValue slot; public StackLoadAddressOp(AllocatableValue result, StackSlotValue address) { + super(TYPE); this.result = result; this.slot = address; } @@ -491,11 +512,12 @@ } public static class StoreOp extends MemOp implements SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<StoreOp> TYPE = LIRInstructionClass.create(StoreOp.class); @Use({REG}) protected AllocatableValue input; public StoreOp(Kind kind, SPARCAddressValue address, AllocatableValue input, LIRFrameState state) { - super(kind, address, state); + super(TYPE, kind, address, state); this.input = input; } @@ -540,12 +562,13 @@ } } - public static class StoreConstantOp extends MemOp implements SPARCTailDelayedLIRInstruction { + public static final class StoreConstantOp extends MemOp implements SPARCTailDelayedLIRInstruction { + public static final LIRInstructionClass<StoreConstantOp> TYPE = LIRInstructionClass.create(StoreConstantOp.class); protected final JavaConstant input; public StoreConstantOp(Kind kind, SPARCAddressValue address, JavaConstant input, LIRFrameState state) { - super(kind, address, state); + super(TYPE, kind, address, state); this.input = input; if (!input.isDefaultForKind()) { throw GraalInternalError.shouldNotReachHere("Can only store null constants to memory");
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCSaveRegistersOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCSaveRegistersOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -42,6 +42,7 @@ */ @Opcode("SAVE_REGISTER") public class SPARCSaveRegistersOp extends SPARCLIRInstruction implements SaveRegistersOp { + public static final LIRInstructionClass<SPARCSaveRegistersOp> TYPE = LIRInstructionClass.create(SPARCSaveRegistersOp.class); public static final Register RETURN_REGISTER_STORAGE = SPARC.d62; /** * The registers (potentially) saved by this operation. @@ -66,6 +67,7 @@ * @param supportsRemove determines if registers can be {@linkplain #remove(Set) pruned} */ public SPARCSaveRegistersOp(Register[] savedRegisters, StackSlotValue[] savedRegisterLocations, boolean supportsRemove) { + super(TYPE); assert Arrays.asList(savedRegisterLocations).stream().allMatch(ValueUtil::isVirtualStackSlot); this.savedRegisters = savedRegisters; this.slots = savedRegisterLocations;
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCTestOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCTestOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -30,14 +30,17 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.sparc.*; import com.oracle.graal.compiler.common.*; +import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; public class SPARCTestOp extends SPARCLIRInstruction { + public static final LIRInstructionClass<SPARCTestOp> TYPE = LIRInstructionClass.create(SPARCTestOp.class); @Use({REG}) protected Value x; @Use({REG, CONST}) protected Value y; public SPARCTestOp(Value x, Value y) { + super(TYPE); this.x = x; this.y = y; }
--- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest1.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest1.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -39,12 +39,13 @@ public class CompositeValueReplacementTest1 { private static class NestedCompositeValue extends CompositeValue { + public static final CompositeValueClass<NestedCompositeValue> TYPE = CompositeValueClass.create(NestedCompositeValue.class); private static final long serialVersionUID = -8804214200173503527L; @Component({REG, OperandFlag.ILLEGAL}) protected Value value; public NestedCompositeValue(Value value) { - super(LIRKind.Illegal); + super(TYPE, LIRKind.Illegal); this.value = value; } @@ -94,11 +95,13 @@ } - private static class TestOp extends LIRInstructionBase { + private static final class TestOp extends LIRInstruction { + public static final LIRInstructionClass<TestOp> TYPE = LIRInstructionClass.create(TestOp.class); @Use({COMPOSITE}) protected NestedCompositeValue compValue; public TestOp(NestedCompositeValue compValue) { + super(TYPE); this.compValue = compValue; }
--- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest2.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest2.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,12 +40,13 @@ public class CompositeValueReplacementTest2 { private static class NestedCompositeValue extends CompositeValue { + public static final CompositeValueClass<NestedCompositeValue> TYPE = CompositeValueClass.create(NestedCompositeValue.class); private static final long serialVersionUID = -8804214200173503527L; @Component({REG, OperandFlag.ILLEGAL}) protected Value[] values; public NestedCompositeValue(Value value) { - super(LIRKind.Illegal); + super(TYPE, LIRKind.Illegal); this.values = new Value[]{value}; } @@ -95,11 +96,13 @@ } - private static class TestOp extends LIRInstructionBase { + private static final class TestOp extends LIRInstruction { + public static final LIRInstructionClass<TestOp> TYPE = LIRInstructionClass.create(TestOp.class); @Use({COMPOSITE}) protected NestedCompositeValue compValue; public TestOp(NestedCompositeValue compValue) { + super(TYPE); this.compValue = compValue; }
--- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest3.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest3.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,12 +40,13 @@ public class CompositeValueReplacementTest3 { private static class NestedCompositeValue extends CompositeValue { + public static final CompositeValueClass<NestedCompositeValue> TYPE = CompositeValueClass.create(NestedCompositeValue.class); private static final long serialVersionUID = -8804214200173503527L; @Component({REG, OperandFlag.ILLEGAL}) protected Value value; public NestedCompositeValue(Value value) { - super(LIRKind.Illegal); + super(TYPE, LIRKind.Illegal); this.value = value; } @@ -95,11 +96,13 @@ } - private static class TestOp extends LIRInstructionBase { + private static final class TestOp extends LIRInstruction { + public static final LIRInstructionClass<TestOp> TYPE = LIRInstructionClass.create(TestOp.class); @Use({COMPOSITE}) protected NestedCompositeValue compValue; public TestOp(NestedCompositeValue compValue) { + super(TYPE); this.compValue = compValue; }
--- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest4.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest4.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,12 +40,13 @@ public class CompositeValueReplacementTest4 { private static class NestedCompositeValue extends CompositeValue { + public static final CompositeValueClass<NestedCompositeValue> TYPE = CompositeValueClass.create(NestedCompositeValue.class); private static final long serialVersionUID = -8804214200173503527L; @Component({REG, OperandFlag.ILLEGAL}) protected Value[] values; public NestedCompositeValue(Value value) { - super(LIRKind.Illegal); + super(TYPE, LIRKind.Illegal); this.values = new Value[]{value}; } @@ -95,11 +96,13 @@ } - private static class TestOp extends LIRInstructionBase { + private static class TestOp extends LIRInstruction { + public static final LIRInstructionClass<TestOp> TYPE = LIRInstructionClass.create(TestOp.class); @Use({COMPOSITE}) protected NestedCompositeValue compValue; public TestOp(NestedCompositeValue compValue) { + super(TYPE); this.compValue = compValue; }
--- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest1.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest1.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -37,12 +37,13 @@ public class ValuePositionTest1 { private static class NestedCompositeValue extends CompositeValue { + public static final CompositeValueClass<NestedCompositeValue> TYPE = CompositeValueClass.create(NestedCompositeValue.class); private static final long serialVersionUID = -8804214200173503527L; @Component({REG, OperandFlag.ILLEGAL}) protected Value value; public NestedCompositeValue(Value value) { - super(LIRKind.Illegal); + super(TYPE, LIRKind.Illegal); this.value = value; } @@ -86,11 +87,13 @@ } } - private static class TestOp extends LIRInstructionBase { + private static final class TestOp extends LIRInstruction { + public static final LIRInstructionClass<TestOp> TYPE = LIRInstructionClass.create(TestOp.class); @Use({COMPOSITE}) protected NestedCompositeValue compValue; public TestOp(NestedCompositeValue compValue) { + super(TYPE); this.compValue = compValue; }
--- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest2.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest2.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -37,13 +37,14 @@ public class ValuePositionTest2 { private static class NestedCompositeValue extends CompositeValue { + public static final CompositeValueClass<NestedCompositeValue> TYPE = CompositeValueClass.create(NestedCompositeValue.class); private static final long serialVersionUID = -2243948303328857965L; @Component({REG, OperandFlag.ILLEGAL}) protected Value value1; @Component({REG, OperandFlag.ILLEGAL}) protected Value value2; public NestedCompositeValue(Value value1, Value value2) { - super(LIRKind.Illegal); + super(TYPE, LIRKind.Illegal); this.value1 = value1; this.value2 = value2; } @@ -88,11 +89,13 @@ } } - private static class TestOp extends LIRInstructionBase { + private static class TestOp extends LIRInstruction { + public static final LIRInstructionClass<TestOp> TYPE = LIRInstructionClass.create(TestOp.class); @Use({COMPOSITE}) protected NestedCompositeValue compValue; public TestOp(NestedCompositeValue compValue) { + super(TYPE); this.compValue = compValue; }
--- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest3.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/ValuePositionTest3.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -38,6 +38,7 @@ public class ValuePositionTest3 { public static final class TestAddressValue extends CompositeValue { + public static final CompositeValueClass<TestAddressValue> TYPE = CompositeValueClass.create(TestAddressValue.class); private static final long serialVersionUID = -2679790860680123026L; @@ -49,7 +50,7 @@ } public TestAddressValue(LIRKind kind, AllocatableValue base, AllocatableValue index) { - super(kind); + super(TYPE, kind); this.base = base; this.index = index; } @@ -99,11 +100,13 @@ } - private static class TestOp extends LIRInstructionBase { + private static class TestOp extends LIRInstruction { + public static final LIRInstructionClass<TestOp> TYPE = LIRInstructionClass.create(TestOp.class); @Use({COMPOSITE}) protected Value value; public TestOp(Value value) { + super(TYPE); this.value = value; }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValue.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValue.java Mon Feb 23 16:23:23 2015 -0800 @@ -44,14 +44,15 @@ OperandFlag[] value() default OperandFlag.REG; } - private final CompositeValueClass valueClass; + private final CompositeValueClass<?> valueClass; private static final DebugMetric COMPOSITE_VALUE_COUNT = Debug.metric("CompositeValues"); - public CompositeValue(LIRKind kind) { + public CompositeValue(CompositeValueClass<? extends CompositeValue> c, LIRKind kind) { super(kind); COMPOSITE_VALUE_COUNT.increment(); - valueClass = CompositeValueClass.get(getClass()); + valueClass = c; + assert c.getClazz() == this.getClass(); } final CompositeValue forEachComponent(LIRInstruction inst, OperandMode mode, InstructionValueProcedure proc) { @@ -81,7 +82,7 @@ return false; } - CompositeValueClass getValueClass() { + CompositeValueClass<?> getValueClass() { return valueClass; }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,30 +38,17 @@ * such fields.</li> * </ul> */ -public class CompositeValueClass extends LIRIntrospection { - - public static final CompositeValueClass get(Class<? extends CompositeValue> c) { - CompositeValueClass clazz = (CompositeValueClass) allClasses.get(c); - if (clazz != null) { - return clazz; - } +public class CompositeValueClass<T> extends LIRIntrospection<T> { - // We can have a race of multiple threads creating the LIRInstructionClass at the same time. - // However, only one will be put into the map, and this is the one returned by all threads. - clazz = new CompositeValueClass(c); - CompositeValueClass oldClazz = (CompositeValueClass) allClasses.putIfAbsent(c, clazz); - if (oldClazz != null) { - return oldClazz; - } else { - return clazz; - } + public static final <T extends CompositeValue> CompositeValueClass<T> create(Class<T> c) { + return new CompositeValueClass<>(c); } - public CompositeValueClass(Class<? extends CompositeValue> clazz) { + public CompositeValueClass(Class<T> clazz) { this(clazz, new FieldsScanner.DefaultCalcOffset()); } - public CompositeValueClass(Class<? extends CompositeValue> clazz, FieldsScanner.CalcOffset calcOffset) { + public CompositeValueClass(Class<T> clazz, FieldsScanner.CalcOffset calcOffset) { super(clazz); CompositeValueFieldsScanner vfs = new CompositeValueFieldsScanner(calcOffset);
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,18 +35,18 @@ /** * This class performs basic optimizations on the control flow graph after LIR generation. */ -public final class ControlFlowOptimizer extends LIRLowTierPhase { +public final class ControlFlowOptimizer extends PostAllocationOptimizationPhase { /** * Performs control flow optimizations on the given LIR graph. */ @Override - protected <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder) { LIR lir = lirGenRes.getLIR(); new Optimizer<B>(lir).deleteEmptyBlocks(codeEmittingOrder); } - private static final class Optimizer<B extends AbstractBlock<B>> { + private static final class Optimizer<B extends AbstractBlockBase<B>> { private final LIR lir; @@ -97,7 +97,7 @@ if (canDeleteBlock(block)) { // adjust successor and predecessor lists B other = block.getSuccessors().iterator().next(); - for (AbstractBlock<B> pred : block.getPredecessors()) { + for (AbstractBlockBase<B> pred : block.getPredecessors()) { Collections.replaceAll(pred.getSuccessors(), block, other); } for (int i = 0; i < other.getPredecessorCount(); i++) {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java Mon Feb 23 16:23:23 2015 -0800 @@ -48,17 +48,17 @@ * Because this optimization works best when a block contains only a few moves, it has a huge impact * on the number of blocks that are totally empty. */ -public final class EdgeMoveOptimizer extends LIRLowTierPhase { +public final class EdgeMoveOptimizer extends PostAllocationOptimizationPhase { @Override - protected <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder) { LIR ir = lirGenRes.getLIR(); Optimizer optimizer = new Optimizer(ir); - List<? extends AbstractBlock<?>> blockList = ir.linearScanOrder(); + List<? extends AbstractBlockBase<?>> blockList = ir.linearScanOrder(); // ignore the first block in the list (index 0 is not processed) for (int i = blockList.size() - 1; i >= 1; i--) { - AbstractBlock<?> block = blockList.get(i); + AbstractBlockBase<?> block = blockList.get(i); if (block.getPredecessorCount() > 1) { optimizer.optimizeMovesAtBlockEnd(block); @@ -106,8 +106,8 @@ * Moves the longest {@linkplain #same common} subsequence at the end all predecessors of * {@code block} to the start of {@code block}. */ - private void optimizeMovesAtBlockEnd(AbstractBlock<?> block) { - for (AbstractBlock<?> pred : block.getPredecessors()) { + private void optimizeMovesAtBlockEnd(AbstractBlockBase<?> block) { + for (AbstractBlockBase<?> pred : block.getPredecessors()) { if (pred == block) { // currently we can't handle this correctly. return; @@ -121,7 +121,7 @@ assert numPreds > 1 : "do not call otherwise"; // setup a list with the LIR instructions of all predecessors - for (AbstractBlock<?> pred : block.getPredecessors()) { + for (AbstractBlockBase<?> pred : block.getPredecessors()) { assert pred != null; assert ir.getLIRforBlock(pred) != null; List<LIRInstruction> predInstructions = ir.getLIRforBlock(pred); @@ -176,7 +176,7 @@ * {@code block} to the end of {@code block} just prior to the branch instruction ending * {@code block}. */ - private void optimizeMovesAtBlockBegin(AbstractBlock<?> block) { + private void optimizeMovesAtBlockBegin(AbstractBlockBase<?> block) { edgeInstructionSeqences.clear(); int numSux = block.getSuccessorCount(); @@ -206,7 +206,7 @@ int insertIdx = instructions.size() - 1; // setup a list with the lir-instructions of all successors - for (AbstractBlock<?> sux : block.getSuccessors()) { + for (AbstractBlockBase<?> sux : block.getSuccessors()) { List<LIRInstruction> suxInstructions = ir.getLIRforBlock(sux); assert suxInstructions.get(0) instanceof StandardOp.LabelOp : "block must start with label";
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FullInfopointOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FullInfopointOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,13 +29,15 @@ * Emits an infopoint (only mark the position). */ @Opcode("INFOPOINT") -public class FullInfopointOp extends LIRInstructionBase { +public final class FullInfopointOp extends LIRInstruction { + public static final LIRInstructionClass<FullInfopointOp> TYPE = LIRInstructionClass.create(FullInfopointOp.class); @State protected LIRFrameState state; private final InfopointReason reason; public FullInfopointOp(LIRFrameState state, InfopointReason reason) { + super(TYPE); this.state = state; this.reason = reason; }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java Mon Feb 23 16:23:23 2015 -0800 @@ -24,7 +24,6 @@ import java.util.*; -import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.lir.StandardOp.BlockEndOp; import com.oracle.graal.lir.StandardOp.LabelOp; @@ -40,32 +39,25 @@ /** * The linear-scan ordered list of blocks. */ - private final List<? extends AbstractBlock<?>> linearScanOrder; + private final List<? extends AbstractBlockBase<?>> linearScanOrder; /** * The order in which the code is emitted. */ - private final List<? extends AbstractBlock<?>> codeEmittingOrder; + private final List<? extends AbstractBlockBase<?>> codeEmittingOrder; private int firstVariableNumber; private int numVariables; - private SpillMoveFactory spillMoveFactory; - private final BlockMap<List<LIRInstruction>> lirInstructions; - public interface SpillMoveFactory { - - LIRInstruction createMove(AllocatableValue result, Value input); - } - private boolean hasArgInCallerFrame; /** * Creates a new LIR instance for the specified compilation. */ - public LIR(AbstractControlFlowGraph<?> cfg, List<? extends AbstractBlock<?>> linearScanOrder, List<? extends AbstractBlock<?>> codeEmittingOrder) { + public LIR(AbstractControlFlowGraph<?> cfg, List<? extends AbstractBlockBase<?>> linearScanOrder, List<? extends AbstractBlockBase<?>> codeEmittingOrder) { this.cfg = cfg; this.codeEmittingOrder = codeEmittingOrder; this.linearScanOrder = linearScanOrder; @@ -80,7 +72,7 @@ * Determines if any instruction in the LIR has debug info associated with it. */ public boolean hasDebugInfo() { - for (AbstractBlock<?> b : linearScanOrder()) { + for (AbstractBlockBase<?> b : linearScanOrder()) { for (LIRInstruction op : getLIRforBlock(b)) { if (op.hasState()) { return true; @@ -90,15 +82,11 @@ return false; } - public SpillMoveFactory getSpillMoveFactory() { - return spillMoveFactory; - } - - public List<LIRInstruction> getLIRforBlock(AbstractBlock<?> block) { + public List<LIRInstruction> getLIRforBlock(AbstractBlockBase<?> block) { return lirInstructions.get(block); } - public void setLIRforBlock(AbstractBlock<?> block, List<LIRInstruction> list) { + public void setLIRforBlock(AbstractBlockBase<?> block, List<LIRInstruction> list) { assert getLIRforBlock(block) == null : "lir instruction list should only be initialized once"; lirInstructions.put(block, list); } @@ -108,11 +96,11 @@ * * @return the blocks in linear scan order */ - public List<? extends AbstractBlock<?>> linearScanOrder() { + public List<? extends AbstractBlockBase<?>> linearScanOrder() { return linearScanOrder; } - public List<? extends AbstractBlock<?>> codeEmittingOrder() { + public List<? extends AbstractBlockBase<?>> codeEmittingOrder() { return codeEmittingOrder; } @@ -166,7 +154,7 @@ */ public static final int MAX_EXCEPTION_EDGE_OP_DISTANCE_FROM_END = 3; - public static boolean verifyBlock(LIR lir, AbstractBlock<?> block) { + public static boolean verifyBlock(LIR lir, AbstractBlockBase<?> block) { List<LIRInstruction> ops = lir.getLIRforBlock(block); if (ops.size() == 0) { return false; @@ -190,12 +178,12 @@ return true; } - public static boolean verifyBlocks(LIR lir, List<? extends AbstractBlock<?>> blocks) { - for (AbstractBlock<?> block : blocks) { - for (AbstractBlock<?> sux : block.getSuccessors()) { + public static boolean verifyBlocks(LIR lir, List<? extends AbstractBlockBase<?>> blocks) { + for (AbstractBlockBase<?> block : blocks) { + for (AbstractBlockBase<?> sux : block.getSuccessors()) { assert blocks.contains(sux) : "missing successor from: " + block + "to: " + sux; } - for (AbstractBlock<?> pred : block.getPredecessors()) { + for (AbstractBlockBase<?> pred : block.getPredecessors()) { assert blocks.contains(pred) : "missing predecessor from: " + block + "to: " + pred; } if (!verifyBlock(lir, block)) { @@ -205,13 +193,9 @@ return true; } - public void setSpillMoveFactory(SpillMoveFactory spillMoveFactory) { - this.spillMoveFactory = spillMoveFactory; - } - public void resetLabels() { - for (AbstractBlock<?> block : codeEmittingOrder()) { + for (AbstractBlockBase<?> block : codeEmittingOrder()) { for (LIRInstruction inst : lirInstructions.get(block)) { if (inst instanceof LabelOp) { ((LabelOp) inst).getLabel().reset();
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, 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 @@ -22,24 +22,27 @@ */ package com.oracle.graal.lir; -import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; +import java.lang.annotation.*; +import java.util.*; -import java.lang.annotation.*; +import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; +import static com.oracle.graal.lir.LIRInstruction.OperandMode.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.debug.*; import com.oracle.graal.lir.asm.*; /** - * The {@code LIRInstruction} interface definition. + * The base class for an {@code LIRInstruction}. */ -public interface LIRInstruction { - Value[] NO_OPERANDS = {}; +public abstract class LIRInstruction { + public static final Value[] NO_OPERANDS = {}; /** * Constants denoting how a LIR instruction uses an operand. */ - enum OperandMode { + public enum OperandMode { /** * The value must have been defined before. It is alive before the instruction until the * beginning of the instruction, but not necessarily throughout the instruction. A register @@ -72,41 +75,41 @@ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) - static @interface Use { + public static @interface Use { - OperandFlag[] value() default REG; + OperandFlag[] value() default OperandFlag.REG; } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) - static @interface Alive { + public static @interface Alive { - OperandFlag[] value() default REG; + OperandFlag[] value() default OperandFlag.REG; } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) - static @interface Temp { + public static @interface Temp { - OperandFlag[] value() default REG; + OperandFlag[] value() default OperandFlag.REG; } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) - static @interface Def { + public static @interface Def { - OperandFlag[] value() default REG; + OperandFlag[] value() default OperandFlag.REG; } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) - static @interface State { + public static @interface State { } /** * Flags for an operand. */ - enum OperandFlag { + public enum OperandFlag { /** * The value can be a {@link RegisterValue}. */ @@ -145,115 +148,205 @@ UNINITIALIZED, } - void emitCode(CompilationResultBuilder crb); + /** + * For validity checking of the operand flags defined by instruction subclasses. + */ + protected static final EnumMap<OperandMode, EnumSet<OperandFlag>> ALLOWED_FLAGS; + + static { + ALLOWED_FLAGS = new EnumMap<>(OperandMode.class); + ALLOWED_FLAGS.put(OperandMode.USE, EnumSet.of(REG, STACK, COMPOSITE, CONST, ILLEGAL, HINT, UNINITIALIZED)); + ALLOWED_FLAGS.put(ALIVE, EnumSet.of(REG, STACK, COMPOSITE, CONST, ILLEGAL, HINT, UNINITIALIZED)); + ALLOWED_FLAGS.put(TEMP, EnumSet.of(REG, COMPOSITE, CONST, ILLEGAL, HINT)); + ALLOWED_FLAGS.put(DEF, EnumSet.of(REG, STACK, COMPOSITE, ILLEGAL, HINT)); + } - int id(); + /** + * The flags of the base and index value of an address. + */ + protected static final EnumSet<OperandFlag> ADDRESS_FLAGS = EnumSet.of(REG, ILLEGAL); + + private final LIRInstructionClass<?> instructionClass; - void setId(int id); + /** + * Instruction id for register allocation. + */ + private int id; + + private static final DebugMetric LIR_NODE_COUNT = Debug.metric("LIRNodes"); /** - * Gets the instruction name. + * Constructs a new LIR instruction. */ - String name(); + public LIRInstruction(LIRInstructionClass<? extends LIRInstruction> c) { + LIR_NODE_COUNT.increment(); + instructionClass = c; + assert c.getClazz() == this.getClass(); + id = -1; + } - boolean hasOperands(); + public abstract void emitCode(CompilationResultBuilder crb); + + public final int id() { + return id; + } - boolean hasState(); + public final void setId(int id) { + this.id = id; + } + + public final String name() { + return instructionClass.getOpcode(this); + } - /** - * Determines if this instruction destroys all caller-saved registers.. - */ - boolean destroysCallerSavedRegisters(); + public final boolean hasOperands() { + return instructionClass.hasOperands() || hasState() || destroysCallerSavedRegisters(); + } + + public final boolean hasState() { + return instructionClass.hasState(this); + } + + public boolean destroysCallerSavedRegisters() { + return false; + } // ValuePositionProcedures - void forEachInputPos(ValuePositionProcedure proc); + public final void forEachInputPos(ValuePositionProcedure proc) { + instructionClass.forEachUsePos(this, proc); + } - void forEachAlivePos(ValuePositionProcedure proc); + public final void forEachAlivePos(ValuePositionProcedure proc) { + instructionClass.forEachAlivePos(this, proc); + } - void forEachTempPos(ValuePositionProcedure proc); + public final void forEachTempPos(ValuePositionProcedure proc) { + instructionClass.forEachTempPos(this, proc); + } - void forEachOutputPos(ValuePositionProcedure proc); + public final void forEachOutputPos(ValuePositionProcedure proc) { + instructionClass.forEachDefPos(this, proc); + } // InstructionValueProcedures - void forEachInput(InstructionValueProcedure proc); + public final void forEachInput(InstructionValueProcedure proc) { + instructionClass.forEachUse(this, proc); + } - void forEachAlive(InstructionValueProcedure proc); + public final void forEachAlive(InstructionValueProcedure proc) { + instructionClass.forEachAlive(this, proc); + } - void forEachTemp(InstructionValueProcedure proc); + public final void forEachTemp(InstructionValueProcedure proc) { + instructionClass.forEachTemp(this, proc); + } - void forEachOutput(InstructionValueProcedure proc); + public final void forEachOutput(InstructionValueProcedure proc) { + instructionClass.forEachDef(this, proc); + } - void forEachState(InstructionValueProcedure proc); + public final void forEachState(InstructionValueProcedure proc) { + instructionClass.forEachState(this, proc); + } // ValueProcedures - void forEachInput(ValueProcedure proc); + public final void forEachInput(ValueProcedure proc) { + instructionClass.forEachUse(this, proc); + } - void forEachAlive(ValueProcedure proc); + public final void forEachAlive(ValueProcedure proc) { + instructionClass.forEachAlive(this, proc); + } - void forEachTemp(ValueProcedure proc); + public final void forEachTemp(ValueProcedure proc) { + instructionClass.forEachTemp(this, proc); + } - void forEachOutput(ValueProcedure proc); + public final void forEachOutput(ValueProcedure proc) { + instructionClass.forEachDef(this, proc); + } - void forEachState(ValueProcedure proc); + public final void forEachState(ValueProcedure proc) { + instructionClass.forEachState(this, proc); + } // States - void forEachState(InstructionStateProcedure proc); + public final void forEachState(InstructionStateProcedure proc) { + instructionClass.forEachState(this, proc); + } - void forEachState(StateProcedure proc); + public final void forEachState(StateProcedure proc) { + instructionClass.forEachState(this, proc); + } // InstructionValueConsumers - void visitEachInput(InstructionValueConsumer proc); + public final void visitEachInput(InstructionValueConsumer proc) { + instructionClass.forEachUse(this, proc); + } - void visitEachAlive(InstructionValueConsumer proc); + public final void visitEachAlive(InstructionValueConsumer proc) { + instructionClass.forEachAlive(this, proc); + } - void visitEachTemp(InstructionValueConsumer proc); + public final void visitEachTemp(InstructionValueConsumer proc) { + instructionClass.forEachTemp(this, proc); + } - void visitEachOutput(InstructionValueConsumer proc); + public final void visitEachOutput(InstructionValueConsumer proc) { + instructionClass.forEachDef(this, proc); + } - void visitEachState(InstructionValueConsumer proc); + public final void visitEachState(InstructionValueConsumer proc) { + instructionClass.forEachState(this, proc); + } // ValueConsumers - void visitEachInput(ValueConsumer proc); + public final void visitEachInput(ValueConsumer proc) { + instructionClass.forEachUse(this, proc); + } - void visitEachAlive(ValueConsumer proc); + public final void visitEachAlive(ValueConsumer proc) { + instructionClass.forEachAlive(this, proc); + } + + public final void visitEachTemp(ValueConsumer proc) { + instructionClass.forEachTemp(this, proc); + } - void visitEachTemp(ValueConsumer proc); + public final void visitEachOutput(ValueConsumer proc) { + instructionClass.forEachDef(this, proc); + } - void visitEachOutput(ValueConsumer proc); + public final void visitEachState(ValueConsumer proc) { + instructionClass.forEachState(this, proc); + } - void visitEachState(ValueConsumer proc); + @SuppressWarnings("unused") + public final Value forEachRegisterHint(Value value, OperandMode mode, InstructionValueProcedure proc) { + return instructionClass.forEachRegisterHint(this, mode, proc); + } - /** - * Iterates all register hints for the specified value, i.e., all preferred candidates for the - * register to be assigned to the value. - * <p> - * Subclasses can override this method. The default implementation processes all Input operands - * as the hints for an Output operand, and all Output operands as the hints for an Input - * operand. - * - * @param value The value the hints are needed for. - * @param mode The operand mode of the value. - * @param proc The procedure invoked for all the hints. If the procedure returns a non-null - * value, the iteration is stopped and the value is returned by this method, i.e., - * clients can stop the iteration once a suitable hint has been found. - * @return The non-null value returned by the procedure, or null. - */ - Value forEachRegisterHint(Value value, OperandMode mode, InstructionValueProcedure proc); + @SuppressWarnings("unused") + public final Value forEachRegisterHint(Value value, OperandMode mode, ValueProcedure proc) { + return instructionClass.forEachRegisterHint(this, mode, proc); + } + + public void verify() { + } - /** - * @see #forEachRegisterHint(Value, OperandMode, InstructionValueProcedure) - * @param value The value the hints are needed for. - * @param mode The operand mode of the value. - * @param proc The procedure invoked for all the hints. If the procedure returns a non-null - * value, the iteration is stopped and the value is returned by this method, i.e., - * clients can stop the iteration once a suitable hint has been found. - * @return The non-null value returned by the procedure, or null. - */ - Value forEachRegisterHint(Value value, OperandMode mode, ValueProcedure proc); + public final String toStringWithIdPrefix() { + if (id != -1) { + return String.format("%4d %s", id, toString()); + } + return " " + toString(); + } - String toStringWithIdPrefix(); + @Override + public String toString() { + return instructionClass.toString(this); + } - void verify(); - - LIRInstructionClass getLIRInstructionClass(); + public LIRInstructionClass<?> getLIRInstructionClass() { + return instructionClass; + } }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionBase.java Wed Feb 18 10:37:08 2015 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir; - -import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; -import static com.oracle.graal.lir.LIRInstruction.OperandMode.*; - -import java.util.*; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.debug.*; -import com.oracle.graal.lir.asm.*; - -/** - * The base class for an {@code LIRInstruction}. - */ -public abstract class LIRInstructionBase implements LIRInstruction { - - /** - * For validity checking of the operand flags defined by instruction subclasses. - */ - protected static final EnumMap<OperandMode, EnumSet<OperandFlag>> ALLOWED_FLAGS; - - static { - ALLOWED_FLAGS = new EnumMap<>(OperandMode.class); - ALLOWED_FLAGS.put(USE, EnumSet.of(REG, STACK, COMPOSITE, CONST, ILLEGAL, HINT, UNINITIALIZED)); - ALLOWED_FLAGS.put(ALIVE, EnumSet.of(REG, STACK, COMPOSITE, CONST, ILLEGAL, HINT, UNINITIALIZED)); - ALLOWED_FLAGS.put(TEMP, EnumSet.of(REG, COMPOSITE, CONST, ILLEGAL, HINT)); - ALLOWED_FLAGS.put(DEF, EnumSet.of(REG, STACK, COMPOSITE, ILLEGAL, HINT)); - } - - /** - * The flags of the base and index value of an address. - */ - protected static final EnumSet<OperandFlag> ADDRESS_FLAGS = EnumSet.of(REG, ILLEGAL); - - private final LIRInstructionClass instructionClass; - - /** - * Instruction id for register allocation. - */ - private int id; - - private static final DebugMetric LIR_NODE_COUNT = Debug.metric("LIRNodes"); - - /** - * Constructs a new LIR instruction. - */ - public LIRInstructionBase() { - LIR_NODE_COUNT.increment(); - instructionClass = LIRInstructionClass.get(getClass()); - id = -1; - } - - public abstract void emitCode(CompilationResultBuilder crb); - - public final int id() { - return id; - } - - public final void setId(int id) { - this.id = id; - } - - public final String name() { - return instructionClass.getOpcode(this); - } - - public final boolean hasOperands() { - return instructionClass.hasOperands() || hasState() || destroysCallerSavedRegisters(); - } - - public final boolean hasState() { - return instructionClass.hasState(this); - } - - public boolean destroysCallerSavedRegisters() { - return false; - } - - // ValuePositionProcedures - public final void forEachInputPos(ValuePositionProcedure proc) { - instructionClass.forEachUsePos(this, proc); - } - - public final void forEachAlivePos(ValuePositionProcedure proc) { - instructionClass.forEachAlivePos(this, proc); - } - - public final void forEachTempPos(ValuePositionProcedure proc) { - instructionClass.forEachTempPos(this, proc); - } - - public final void forEachOutputPos(ValuePositionProcedure proc) { - instructionClass.forEachDefPos(this, proc); - } - - // InstructionValueProcedures - public final void forEachInput(InstructionValueProcedure proc) { - instructionClass.forEachUse(this, proc); - } - - public final void forEachAlive(InstructionValueProcedure proc) { - instructionClass.forEachAlive(this, proc); - } - - public final void forEachTemp(InstructionValueProcedure proc) { - instructionClass.forEachTemp(this, proc); - } - - public final void forEachOutput(InstructionValueProcedure proc) { - instructionClass.forEachDef(this, proc); - } - - public final void forEachState(InstructionValueProcedure proc) { - instructionClass.forEachState(this, proc); - } - - // ValueProcedures - public final void forEachInput(ValueProcedure proc) { - instructionClass.forEachUse(this, proc); - } - - public final void forEachAlive(ValueProcedure proc) { - instructionClass.forEachAlive(this, proc); - } - - public final void forEachTemp(ValueProcedure proc) { - instructionClass.forEachTemp(this, proc); - } - - public final void forEachOutput(ValueProcedure proc) { - instructionClass.forEachDef(this, proc); - } - - public final void forEachState(ValueProcedure proc) { - instructionClass.forEachState(this, proc); - } - - // States - public final void forEachState(InstructionStateProcedure proc) { - instructionClass.forEachState(this, proc); - } - - public final void forEachState(StateProcedure proc) { - instructionClass.forEachState(this, proc); - } - - // InstructionValueConsumers - public final void visitEachInput(InstructionValueConsumer proc) { - instructionClass.forEachUse(this, proc); - } - - public final void visitEachAlive(InstructionValueConsumer proc) { - instructionClass.forEachAlive(this, proc); - } - - public final void visitEachTemp(InstructionValueConsumer proc) { - instructionClass.forEachTemp(this, proc); - } - - public final void visitEachOutput(InstructionValueConsumer proc) { - instructionClass.forEachDef(this, proc); - } - - public final void visitEachState(InstructionValueConsumer proc) { - instructionClass.forEachState(this, proc); - } - - // ValueConsumers - public final void visitEachInput(ValueConsumer proc) { - instructionClass.forEachUse(this, proc); - } - - public final void visitEachAlive(ValueConsumer proc) { - instructionClass.forEachAlive(this, proc); - } - - public final void visitEachTemp(ValueConsumer proc) { - instructionClass.forEachTemp(this, proc); - } - - public final void visitEachOutput(ValueConsumer proc) { - instructionClass.forEachDef(this, proc); - } - - public final void visitEachState(ValueConsumer proc) { - instructionClass.forEachState(this, proc); - } - - public Value forEachRegisterHint(Value value, OperandMode mode, InstructionValueProcedure proc) { - return instructionClass.forEachRegisterHint(this, mode, proc); - } - - public Value forEachRegisterHint(Value value, OperandMode mode, ValueProcedure proc) { - return instructionClass.forEachRegisterHint(this, mode, proc); - } - - public void verify() { - } - - public final String toStringWithIdPrefix() { - if (id != -1) { - return String.format("%4d %s", id, toString()); - } - return " " + toString(); - } - - @Override - public String toString() { - return instructionClass.toString(this); - } - - public LIRInstructionClass getLIRInstructionClass() { - return instructionClass; - } -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,23 +31,10 @@ import com.oracle.graal.lir.LIRInstruction.OperandFlag; import com.oracle.graal.lir.LIRInstruction.OperandMode; -public class LIRInstructionClass extends LIRIntrospection { - - public static final LIRInstructionClass get(Class<? extends LIRInstruction> c) { - LIRInstructionClass clazz = (LIRInstructionClass) allClasses.get(c); - if (clazz != null) { - return clazz; - } +public class LIRInstructionClass<T> extends LIRIntrospection<T> { - // We can have a race of multiple threads creating the LIRInstructionClass at the same time. - // However, only one will be put into the map, and this is the one returned by all threads. - clazz = new LIRInstructionClass(c); - LIRInstructionClass oldClazz = (LIRInstructionClass) allClasses.putIfAbsent(c, clazz); - if (oldClazz != null) { - return oldClazz; - } else { - return clazz; - } + public static final <T extends LIRInstruction> LIRInstructionClass<T> create(Class<T> c) { + return new LIRInstructionClass<>(c); } private static final Class<LIRInstruction> INSTRUCTION_CLASS = LIRInstruction.class; @@ -62,11 +49,11 @@ private String opcodeConstant; private int opcodeIndex; - private LIRInstructionClass(Class<? extends LIRInstruction> clazz) { + private LIRInstructionClass(Class<T> clazz) { this(clazz, new FieldsScanner.DefaultCalcOffset()); } - public LIRInstructionClass(Class<? extends LIRInstruction> clazz, FieldsScanner.CalcOffset calcOffset) { + public LIRInstructionClass(Class<T> clazz, FieldsScanner.CalcOffset calcOffset) { super(clazz); assert INSTRUCTION_CLASS.isAssignableFrom(clazz); @@ -134,7 +121,7 @@ } opcodeField = null; - super.scan(clazz, LIRInstructionBase.class, false); + super.scan(clazz, LIRInstruction.class, false); if (opcodeConstant == null && opcodeField == null) { opcodeConstant = clazz.getSimpleName();
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ import com.oracle.graal.lir.LIRInstruction.OperandFlag; import com.oracle.graal.lir.LIRInstruction.OperandMode; -abstract class LIRIntrospection extends FieldIntrospection { +abstract class LIRIntrospection<T> extends FieldIntrospection<T> { private static final Class<Value> VALUE_CLASS = Value.class; private static final Class<JavaConstant> CONSTANT_CLASS = JavaConstant.class; @@ -44,7 +44,7 @@ private static final Class<StackSlot> STACK_SLOT_CLASS = StackSlot.class; private static final Class<Value[]> VALUE_ARRAY_CLASS = Value[].class; - public LIRIntrospection(Class<?> clazz) { + public LIRIntrospection(Class<T> clazz) { super(clazz); } @@ -202,7 +202,7 @@ protected static void forEach(LIRInstruction inst, Values values, OperandMode mode, InstructionValueProcedure proc) { for (int i = 0; i < values.getCount(); i++) { - assert LIRInstructionBase.ALLOWED_FLAGS.get(mode).containsAll(values.getFlags(i)); + assert LIRInstruction.ALLOWED_FLAGS.get(mode).containsAll(values.getFlags(i)); if (i < values.getDirectCount()) { Value value = values.getValue(inst, i); @@ -238,7 +238,7 @@ protected static CompositeValue forEachComponent(LIRInstruction inst, CompositeValue obj, Values values, OperandMode mode, InstructionValueProcedure proc) { CompositeValue newCompValue = null; for (int i = 0; i < values.getCount(); i++) { - assert LIRInstructionBase.ALLOWED_FLAGS.get(mode).containsAll(values.getFlags(i)); + assert LIRInstruction.ALLOWED_FLAGS.get(mode).containsAll(values.getFlags(i)); if (i < values.getDirectCount()) { Value value = values.getValue(obj, i); @@ -286,7 +286,7 @@ protected static void forEach(LIRInstruction inst, Object obj, Values values, OperandMode mode, ValuePositionProcedure proc, ValuePosition outerPosition) { for (int i = 0; i < values.getCount(); i++) { - assert LIRInstructionBase.ALLOWED_FLAGS.get(mode).containsAll(values.getFlags(i)); + assert LIRInstruction.ALLOWED_FLAGS.get(mode).containsAll(values.getFlags(i)); if (i < values.getDirectCount()) { Value value = values.getValue(obj, i);
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java Mon Feb 23 16:23:23 2015 -0800 @@ -46,11 +46,11 @@ private final BitSet[] blockLiveOut; private final Object[] variableDefinitions; - private BitSet liveOutFor(AbstractBlock<?> block) { + private BitSet liveOutFor(AbstractBlockBase<?> block) { return blockLiveOut[block.getId()]; } - private void setLiveOutFor(AbstractBlock<?> block, BitSet liveOut) { + private void setLiveOutFor(AbstractBlockBase<?> block, BitSet liveOut) { blockLiveOut[block.getId()] = liveOut; } @@ -91,7 +91,7 @@ private BitSet curVariablesLive; private Value[] curRegistersLive; - private AbstractBlock<?> curBlock; + private AbstractBlockBase<?> curBlock; private Object curInstruction; private BitSet curRegistersDefined; @@ -113,7 +113,7 @@ int maxRegisterNum = maxRegisterNum(); curRegistersDefined = new BitSet(); - for (AbstractBlock<?> block : lir.linearScanOrder()) { + for (AbstractBlockBase<?> block : lir.linearScanOrder()) { curBlock = block; curVariablesLive = new BitSet(); curRegistersLive = new Value[maxRegisterNum];
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LabelRef.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LabelRef.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,16 +29,17 @@ /** * LIR instructions such as {@link JumpOp} and {@link BranchOp} need to reference their target - * {@link AbstractBlock}. However, direct references are not possible since the control flow graph - * (and therefore successors lists) can be changed by optimizations - and fixing the instructions is - * error prone. Therefore, we represent an edge to block B from block A via the tuple {@code (A, + * {@link AbstractBlockBase}. However, direct references are not possible since the control flow + * graph (and therefore successors lists) can be changed by optimizations - and fixing the + * instructions is error prone. Therefore, we represent an edge to block B from block A via the + * tuple {@code (A, * successor-index-of-B)}. That is, indirectly by storing the index into the successor list of A. * Note therefore that the successor list cannot be re-ordered. */ public final class LabelRef { private final LIR lir; - private final AbstractBlock<?> block; + private final AbstractBlockBase<?> block; private final int suxIndex; /** @@ -48,7 +49,7 @@ * @param suxIndex The index of the successor. * @return The newly created label reference. */ - public static LabelRef forSuccessor(final LIR lir, final AbstractBlock<?> block, final int suxIndex) { + public static LabelRef forSuccessor(final LIR lir, final AbstractBlockBase<?> block, final int suxIndex) { return new LabelRef(lir, block, suxIndex); } @@ -58,17 +59,17 @@ * @param block The base block that contains the successor list. * @param suxIndex The index of the successor. */ - private LabelRef(final LIR lir, final AbstractBlock<?> block, final int suxIndex) { + private LabelRef(final LIR lir, final AbstractBlockBase<?> block, final int suxIndex) { this.lir = lir; this.block = block; this.suxIndex = suxIndex; } - public AbstractBlock<?> getSourceBlock() { + public AbstractBlockBase<?> getSourceBlock() { return block; } - public AbstractBlock<?> getTargetBlock() { + public AbstractBlockBase<?> getTargetBlock() { return block.getSuccessors().get(suxIndex); }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/NullCheckOptimizer.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/NullCheckOptimizer.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,17 +31,17 @@ import com.oracle.graal.lir.gen.*; import com.oracle.graal.lir.phases.*; -public final class NullCheckOptimizer extends LIRLowTierPhase { +public final class NullCheckOptimizer extends PostAllocationOptimizationPhase { @Override - protected <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder) { LIR ir = lirGenRes.getLIR(); - List<? extends AbstractBlock<?>> blocks = ir.codeEmittingOrder(); + List<? extends AbstractBlockBase<?>> blocks = ir.codeEmittingOrder(); NullCheckOptimizer.foldNullChecks(ir, blocks, target.implicitNullCheckLimit); } - private static void foldNullChecks(LIR ir, List<? extends AbstractBlock<?>> blocks, int implicitNullCheckLimit) { - for (AbstractBlock<?> block : blocks) { + private static void foldNullChecks(LIR ir, List<? extends AbstractBlockBase<?>> blocks, int implicitNullCheckLimit) { + for (AbstractBlockBase<?> block : blocks) { List<LIRInstruction> list = ir.getLIRforBlock(block); if (!list.isEmpty()) {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/RedundantMoveElimination.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/RedundantMoveElimination.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,10 +41,10 @@ /** * Removes move instructions, where the destination value is already in place. */ -public final class RedundantMoveElimination extends LIRLowTierPhase { +public final class RedundantMoveElimination extends PostAllocationOptimizationPhase { @Override - protected <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder) { Optimization redundantMoveElimination = new Optimization(); redundantMoveElimination.doOptimize(lirGenRes.getLIR(), lirGenRes.getFrameMap()); } @@ -87,7 +87,7 @@ private static final class Optimization { - Map<AbstractBlock<?>, BlockData> blockData = CollectionsFactory.newMap(); + Map<AbstractBlockBase<?>, BlockData> blockData = CollectionsFactory.newMap(); Register[] callerSaveRegs; @@ -142,7 +142,7 @@ private void initBlockData(LIR lir) { - List<? extends AbstractBlock<?>> blocks = lir.linearScanOrder(); + List<? extends AbstractBlockBase<?>> blocks = lir.linearScanOrder(); numRegs = 0; int maxStackLocations = COMPLEXITY_LIMIT / blocks.size(); @@ -151,7 +151,7 @@ * Search for relevant locations which can be optimized. These are register or stack * slots which occur as destinations of move instructions. */ - for (AbstractBlock<?> block : blocks) { + for (AbstractBlockBase<?> block : blocks) { List<LIRInstruction> instructions = lir.getLIRforBlock(block); for (LIRInstruction op : instructions) { if (isEligibleMove(op)) { @@ -176,7 +176,7 @@ */ int numLocations = numRegs + stackIndices.size(); Debug.log("num locations = %d (regs = %d, stack = %d)", numLocations, numRegs, stackIndices.size()); - for (AbstractBlock<?> block : blocks) { + for (AbstractBlockBase<?> block : blocks) { BlockData data = new BlockData(numLocations); blockData.put(block, data); } @@ -191,7 +191,7 @@ try (Indent indent = Debug.logAndIndent("solve data flow")) { - List<? extends AbstractBlock<?>> blocks = lir.linearScanOrder(); + List<? extends AbstractBlockBase<?>> blocks = lir.linearScanOrder(); int numIter = 0; @@ -205,7 +205,7 @@ changed = false; try (Indent indent2 = Debug.logAndIndent("new iteration")) { - for (AbstractBlock<?> block : blocks) { + for (AbstractBlockBase<?> block : blocks) { BlockData data = blockData.get(block); /* @@ -235,7 +235,7 @@ /* * Merge the states of predecessor blocks */ - for (AbstractBlock<?> predecessor : block.getPredecessors()) { + for (AbstractBlockBase<?> predecessor : block.getPredecessors()) { BlockData predData = blockData.get(predecessor); newState |= mergeState(data.entryState, predData.exitState, valueNum); } @@ -291,9 +291,9 @@ try (Indent indent = Debug.logAndIndent("eliminate moves")) { - List<? extends AbstractBlock<?>> blocks = lir.linearScanOrder(); + List<? extends AbstractBlockBase<?>> blocks = lir.linearScanOrder(); - for (AbstractBlock<?> block : blocks) { + for (AbstractBlockBase<?> block : blocks) { try (Indent indent2 = Debug.logAndIndent("eliminate moves in block %d", block.getId())) {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SimpleInfopointOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SimpleInfopointOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -26,11 +26,13 @@ import com.oracle.graal.lir.asm.*; @Opcode("SIMPLE_INFOPOINT") -public class SimpleInfopointOp extends LIRInstructionBase { +public final class SimpleInfopointOp extends LIRInstruction { + public static final LIRInstructionClass<SimpleInfopointOp> TYPE = LIRInstructionClass.create(SimpleInfopointOp.class); private final InfopointReason reason; private final BytecodePosition position; public SimpleInfopointOp(InfopointReason reason, BytecodePosition position) { + super(TYPE); this.reason = reason; this.position = position; }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java Mon Feb 23 16:23:23 2015 -0800 @@ -44,23 +44,24 @@ * A block delimiter. Every well formed block must contain exactly one such operation and it * must be the last operation in the block. */ - public interface BlockEndOp extends LIRInstruction { + public interface BlockEndOp { } - public interface NullCheck extends LIRInstruction { + public interface NullCheck { Value getCheckedValue(); LIRFrameState getState(); } - public interface ImplicitNullCheck extends LIRInstruction { + public interface ImplicitNullCheck { boolean makeNullCheckFor(Value value, LIRFrameState nullCheckState, int implicitNullCheckLimit); } /** * LIR operation that defines the position of a label. */ - public static class LabelOp extends LIRInstructionBase { + public static final class LabelOp extends LIRInstruction { + public static final LIRInstructionClass<LabelOp> TYPE = LIRInstructionClass.create(LabelOp.class); private static final Value[] NO_VALUES = new Value[0]; @@ -78,6 +79,7 @@ private final boolean align; public LabelOp(Label label, boolean align) { + super(TYPE); this.label = label; this.align = align; this.incomingValues = NO_VALUES; @@ -104,11 +106,17 @@ /** * LIR operation that is an unconditional jump to a {@link #destination()}. */ - public static class JumpOp extends LIRInstructionBase implements BlockEndOp { + public static class JumpOp extends LIRInstruction implements BlockEndOp { + public static final LIRInstructionClass<JumpOp> TYPE = LIRInstructionClass.create(JumpOp.class); private final LabelRef destination; public JumpOp(LabelRef destination) { + this(TYPE, destination); + } + + protected JumpOp(LIRInstructionClass<? extends JumpOp> c, LabelRef destination) { + super(c); this.destination = destination; } @@ -134,7 +142,7 @@ * Marker interface for a LIR operation that moves a value from {@link #getInput()} to * {@link #getResult()}. */ - public interface MoveOp extends LIRInstruction { + public interface MoveOp { Value getInput(); @@ -146,7 +154,7 @@ * {@linkplain #remove(Set) pruned} and a mapping from registers to the frame slots in which * they are saved can be {@linkplain #getMap(FrameMap) retrieved}. */ - public interface SaveRegistersOp extends LIRInstruction { + public interface SaveRegistersOp { /** * Determines if the {@link #remove(Set)} operation is supported for this object. @@ -178,19 +186,21 @@ * A LIR operation that does nothing. If the operation records its position, it can be * subsequently {@linkplain #replace(LIR, LIRInstruction) replaced}. */ - public static class NoOp extends LIRInstructionBase { + public static final class NoOp extends LIRInstruction { + public static final LIRInstructionClass<NoOp> TYPE = LIRInstructionClass.create(NoOp.class); /** * The block in which this instruction is located. */ - final AbstractBlock<?> block; + final AbstractBlockBase<?> block; /** * The block index of this instruction. */ final int index; - public NoOp(AbstractBlock<?> block, int index) { + public NoOp(AbstractBlockBase<?> block, int index) { + super(TYPE); this.block = block; this.index = index; } @@ -208,11 +218,13 @@ } @Opcode("BLACKHOLE") - public static class BlackholeOp extends LIRInstructionBase { + public static final class BlackholeOp extends LIRInstruction { + public static final LIRInstructionClass<BlackholeOp> TYPE = LIRInstructionClass.create(BlackholeOp.class); @Use({REG, STACK}) private Value value; public BlackholeOp(Value value) { + super(TYPE); this.value = value; }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SwitchStrategy.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SwitchStrategy.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ /** * This class encapsulates different strategies on how to generate code for switch instructions. - * + * * The {@link #getBestStrategy(double[], JavaConstant[], LabelRef[])} method can be used to get * strategy with the smallest average effort (average number of comparisons until a decision is * reached). The strategy returned by this method will have its averageEffort set, while a strategy @@ -43,7 +43,7 @@ /** * Generates a conditional or unconditional jump. The jump will be unconditional if * condition is null. If defaultTarget is true, then the jump will go the the default. - * + * * @param index Index of the value and the jump target (only used if defaultTarget == false) * @param condition The condition on which to jump (can be null) * @param defaultTarget true if the jump should go to the default target, false if index @@ -54,7 +54,7 @@ /** * Generates a conditional jump to the target with the specified index. The fall through * should go to the default target. - * + * * @param index Index of the value and the jump target * @param condition The condition on which to jump * @param canFallThrough true if this is the last instruction in the switch statement, to @@ -64,7 +64,7 @@ /** * Create a new label and generate a conditional jump to it. - * + * * @param index Index of the value and the jump target * @param condition The condition on which to jump * @return a new Label
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/IntervalWalker.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/IntervalWalker.java Mon Feb 23 16:23:23 2015 -0800 @@ -104,63 +104,65 @@ private void walkTo(State state, int from) { assert state == State.Active || state == State.Inactive : "wrong state"; for (RegisterBinding binding : RegisterBinding.VALUES) { - Interval prevprev = null; - Interval prev = (state == State.Active) ? activeLists.get(binding) : inactiveLists.get(binding); - Interval next = prev; - while (next.currentFrom() <= from) { - Interval cur = next; - next = cur.next; + walkTo(state, from, binding); + } + } - boolean rangeHasChanged = false; - while (cur.currentTo() <= from) { - cur.nextRange(); - rangeHasChanged = true; - } + private void walkTo(State state, int from, RegisterBinding binding) { + Interval prevprev = null; + Interval prev = (state == State.Active) ? activeLists.get(binding) : inactiveLists.get(binding); + Interval next = prev; + while (next.currentFrom() <= from) { + Interval cur = next; + next = cur.next; - // also handle move from inactive list to active list - rangeHasChanged = rangeHasChanged || (state == State.Inactive && cur.currentFrom() <= from); + boolean rangeHasChanged = false; + while (cur.currentTo() <= from) { + cur.nextRange(); + rangeHasChanged = true; + } - if (rangeHasChanged) { - // remove cur from list - if (prevprev == null) { - if (state == State.Active) { - activeLists.set(binding, next); - } else { - inactiveLists.set(binding, next); - } + // also handle move from inactive list to active list + rangeHasChanged = rangeHasChanged || (state == State.Inactive && cur.currentFrom() <= from); + + if (rangeHasChanged) { + // remove cur from list + if (prevprev == null) { + if (state == State.Active) { + activeLists.set(binding, next); } else { - prevprev.next = next; + inactiveLists.set(binding, next); } - prev = next; - if (cur.currentAtEnd()) { - // move to handled state (not maintained as a list) - cur.state = State.Handled; - intervalMoved(cur, state, State.Handled); - } else if (cur.currentFrom() <= from) { + } else { + prevprev.next = next; + } + prev = next; + Interval.State newState; + if (cur.currentAtEnd()) { + // move to handled state (not maintained as a list) + newState = State.Handled; + cur.state = newState; + } else { + if (cur.currentFrom() <= from) { // sort into active list activeLists.addToListSortedByCurrentFromPositions(binding, cur); - cur.state = State.Active; - if (prev == cur) { - assert state == State.Active : "check"; - prevprev = prev; - prev = cur.next; - } - intervalMoved(cur, state, State.Active); + newState = State.Active; } else { // sort into inactive list inactiveLists.addToListSortedByCurrentFromPositions(binding, cur); - cur.state = State.Inactive; - if (prev == cur) { - assert state == State.Inactive : "check"; - prevprev = prev; - prev = cur.next; - } - intervalMoved(cur, state, State.Inactive); + newState = State.Inactive; } - } else { - prevprev = prev; - prev = cur.next; + cur.state = newState; + if (prev == cur) { + assert state == newState; + prevprev = prev; + prev = cur.next; + } } + intervalMoved(cur, state, newState); + } else { + prevprev = prev; + prev = cur.next; } } }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java Mon Feb 23 16:23:23 2015 -0800 @@ -48,6 +48,7 @@ import com.oracle.graal.lir.alloc.lsra.Interval.SpillState; import com.oracle.graal.lir.framemap.*; import com.oracle.graal.lir.gen.*; +import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; import com.oracle.graal.options.*; /** @@ -62,6 +63,7 @@ final LIRGenerationResult res; final LIR ir; final FrameMapBuilder frameMapBuilder; + final SpillMoveFactory spillMoveFactory; final RegisterAttributes[] registerAttributes; final Register[] registers; @@ -114,7 +116,7 @@ /** * List of blocks in linear-scan order. This is only correct as long as the CFG does not change. */ - final List<? extends AbstractBlock<?>> sortedBlocks; + final List<? extends AbstractBlockBase<?>> sortedBlocks; /** * Map from {@linkplain #operandNumber(Value) operand numbers} to intervals. @@ -145,11 +147,11 @@ LIRInstruction[] opIdToInstructionMap; /** - * Map from an instruction {@linkplain LIRInstruction#id id} to the {@linkplain AbstractBlock - * block} containing the instruction. Entries should be retrieved with {@link #blockForId(int)} - * as the id is not simply an index into this array. + * Map from an instruction {@linkplain LIRInstruction#id id} to the + * {@linkplain AbstractBlockBase block} containing the instruction. Entries should be retrieved + * with {@link #blockForId(int)} as the id is not simply an index into this array. */ - AbstractBlock<?>[] opIdToBlockMap; + AbstractBlockBase<?>[] opIdToBlockMap; /** * Bit set for each variable that is contained in each loop. @@ -161,10 +163,11 @@ */ private final int firstVariableNumber; - LinearScan(TargetDescription target, LIRGenerationResult res) { + LinearScan(TargetDescription target, LIRGenerationResult res, SpillMoveFactory spillMoveFactory) { this.target = target; this.res = res; this.ir = res.getLIR(); + this.spillMoveFactory = spillMoveFactory; this.frameMapBuilder = res.getFrameMapBuilder(); this.sortedBlocks = ir.linearScanOrder(); this.registerAttributes = frameMapBuilder.getRegisterConfig().getAttributesMap(); @@ -178,19 +181,23 @@ this.callKillsRegisters = this.frameMapBuilder.getRegisterConfig().areAllAllocatableRegistersCallerSaved(); } - int getFirstLirInstructionId(AbstractBlock<?> block) { + int getFirstLirInstructionId(AbstractBlockBase<?> block) { int result = ir.getLIRforBlock(block).get(0).id(); assert result >= 0; return result; } - int getLastLirInstructionId(AbstractBlock<?> block) { + int getLastLirInstructionId(AbstractBlockBase<?> block) { List<LIRInstruction> instructions = ir.getLIRforBlock(block); int result = instructions.get(instructions.size() - 1).id(); assert result >= 0; return result; } + SpillMoveFactory getSpillMoveFactory() { + return spillMoveFactory; + } + public static boolean isVariableOrRegister(Value value) { return isVariable(value) || isRegister(value); } @@ -312,7 +319,7 @@ return sortedBlocks.size(); } - AbstractBlock<?> blockAt(int index) { + AbstractBlockBase<?> blockAt(int index) { return sortedBlocks.get(index); } @@ -388,7 +395,7 @@ * @param opId an instruction {@linkplain LIRInstruction#id id} * @return the block containing the instruction denoted by {@code opId} */ - AbstractBlock<?> blockForId(int opId) { + AbstractBlockBase<?> blockForId(int opId) { assert opIdToBlockMap.length > 0 && opId >= 0 && opId <= maxOpId() + 1 : "opId out of range"; return opIdToBlockMap[opIdToIndex(opId)]; } @@ -522,7 +529,7 @@ } LIRInsertionBuffer insertionBuffer = new LIRInsertionBuffer(); - for (AbstractBlock<?> block : sortedBlocks) { + for (AbstractBlockBase<?> block : sortedBlocks) { List<LIRInstruction> instructions = ir.getLIRforBlock(block); int numInst = instructions.size(); @@ -571,7 +578,7 @@ assert isRegister(fromLocation) : "from operand must be a register but is: " + fromLocation + " toLocation=" + toLocation + " spillState=" + interval.spillState(); assert isStackSlotValue(toLocation) : "to operand must be a stack slot"; - insertionBuffer.append(j + 1, ir.getSpillMoveFactory().createMove(toLocation, fromLocation)); + insertionBuffer.append(j + 1, getSpillMoveFactory().createMove(toLocation, fromLocation)); Debug.log("inserting move after definition of interval %d to stack slot %s at opId %d", interval.operandNumber, interval.spillSlot(), opId); } @@ -627,17 +634,17 @@ // Assign IDs to LIR nodes and build a mapping, lirOps, from ID to LIRInstruction node. int numInstructions = 0; - for (AbstractBlock<?> block : sortedBlocks) { + for (AbstractBlockBase<?> block : sortedBlocks) { numInstructions += ir.getLIRforBlock(block).size(); } // initialize with correct length opIdToInstructionMap = new LIRInstruction[numInstructions]; - opIdToBlockMap = new AbstractBlock<?>[numInstructions]; + opIdToBlockMap = new AbstractBlockBase<?>[numInstructions]; int opId = 0; int index = 0; - for (AbstractBlock<?> block : sortedBlocks) { + for (AbstractBlockBase<?> block : sortedBlocks) { blockData.put(block, new BlockData()); List<LIRInstruction> instructions = ir.getLIRforBlock(block); @@ -672,7 +679,7 @@ intervalInLoop = new BitMap2D(operandSize(), numLoops()); // iterate all blocks - for (final AbstractBlock<?> block : sortedBlocks) { + for (final AbstractBlockBase<?> block : sortedBlocks) { try (Indent indent = Debug.logAndIndent("compute local live sets for block %d", block.getId())) { final BitSet liveGen = new BitSet(liveSize); @@ -763,7 +770,7 @@ } } - private void verifyInput(AbstractBlock<?> block, BitSet liveKill, Value operand) { + private void verifyInput(AbstractBlockBase<?> block, BitSet liveKill, Value operand) { // fixed intervals are never live at block boundaries, so // they need not be processed in live sets. // this is checked by these assertions to be sure about it. @@ -797,7 +804,7 @@ // iterate all blocks in reverse order for (int i = numBlocks - 1; i >= 0; i--) { - AbstractBlock<?> block = blockAt(i); + AbstractBlockBase<?> block = blockAt(i); BlockData blockSets = blockData.get(block); changeOccurredInBlock = false; @@ -808,7 +815,7 @@ liveOut.clear(); // block has successors if (n > 0) { - for (AbstractBlock<?> successor : block.getSuccessors()) { + for (AbstractBlockBase<?> successor : block.getSuccessors()) { liveOut.or(blockData.get(successor).liveIn); } } @@ -852,7 +859,7 @@ } // check that the liveIn set of the first block is empty - AbstractBlock<?> startBlock = ir.getControlFlowGraph().getStartBlock(); + AbstractBlockBase<?> startBlock = ir.getControlFlowGraph().getStartBlock(); if (blockData.get(startBlock).liveIn.cardinality() != 0) { if (DetailedAsserts.getValue()) { reportFailure(numBlocks); @@ -891,9 +898,9 @@ } try (Indent indent2 = Debug.logAndIndent("---- Detailed information for var %d; operand=%s; node=%s ----", operandNum, operand, valueForOperandFromDebugContext)) { - Deque<AbstractBlock<?>> definedIn = new ArrayDeque<>(); - HashSet<AbstractBlock<?>> usedIn = new HashSet<>(); - for (AbstractBlock<?> block : sortedBlocks) { + Deque<AbstractBlockBase<?>> definedIn = new ArrayDeque<>(); + HashSet<AbstractBlockBase<?>> usedIn = new HashSet<>(); + for (AbstractBlockBase<?> block : sortedBlocks) { if (blockData.get(block).liveGen.get(operandNum)) { usedIn.add(block); try (Indent indent3 = Debug.logAndIndent("used in block B%d", block.getId())) { @@ -920,9 +927,9 @@ int[] hitCount = new int[numBlocks]; while (!definedIn.isEmpty()) { - AbstractBlock<?> block = definedIn.removeFirst(); + AbstractBlockBase<?> block = definedIn.removeFirst(); usedIn.remove(block); - for (AbstractBlock<?> successor : block.getSuccessors()) { + for (AbstractBlockBase<?> successor : block.getSuccessors()) { if (successor.isLoopHeader()) { if (!block.isLoopEnd()) { definedIn.add(successor); @@ -935,7 +942,7 @@ } } try (Indent indent3 = Debug.logAndIndent("**** offending usages are in: ")) { - for (AbstractBlock<?> block : usedIn) { + for (AbstractBlockBase<?> block : usedIn) { Debug.log("B%d", block.getId()); } } @@ -950,7 +957,7 @@ private void verifyLiveness() { // check that fixed intervals are not live at block boundaries // (live set must be empty at fixed intervals) - for (AbstractBlock<?> block : sortedBlocks) { + for (AbstractBlockBase<?> block : sortedBlocks) { for (int j = 0; j <= maxRegisterNumber(); j++) { assert !blockData.get(block).liveIn.get(j) : "liveIn set of fixed register must be empty"; assert !blockData.get(block).liveOut.get(j) : "liveOut set of fixed register must be empty"; @@ -1167,7 +1174,7 @@ // iterate all blocks in reverse order for (int i = blockCount() - 1; i >= 0; i--) { - AbstractBlock<?> block = blockAt(i); + AbstractBlockBase<?> block = blockAt(i); try (Indent indent2 = Debug.logAndIndent("handle block %d", block.getId())) { List<LIRInstruction> instructions = ir.getLIRforBlock(block); @@ -1411,15 +1418,15 @@ throw new BailoutException("LinearScan: interval is null"); } - Interval intervalAtBlockBegin(AbstractBlock<?> block, int operandNumber) { + Interval intervalAtBlockBegin(AbstractBlockBase<?> block, int operandNumber) { return splitChildAtOpId(intervalFor(operandNumber), getFirstLirInstructionId(block), LIRInstruction.OperandMode.DEF); } - Interval intervalAtBlockEnd(AbstractBlock<?> block, int operandNumber) { + Interval intervalAtBlockEnd(AbstractBlockBase<?> block, int operandNumber) { return splitChildAtOpId(intervalFor(operandNumber), getLastLirInstructionId(block) + 1, LIRInstruction.OperandMode.DEF); } - void resolveCollectMappings(AbstractBlock<?> fromBlock, AbstractBlock<?> toBlock, MoveResolver moveResolver) { + void resolveCollectMappings(AbstractBlockBase<?> fromBlock, AbstractBlockBase<?> toBlock, MoveResolver moveResolver) { assert moveResolver.checkEmpty(); int numOperands = operandSize(); @@ -1440,7 +1447,7 @@ } } - void resolveFindInsertPos(AbstractBlock<?> fromBlock, AbstractBlock<?> toBlock, MoveResolver moveResolver) { + void resolveFindInsertPos(AbstractBlockBase<?> fromBlock, AbstractBlockBase<?> toBlock, MoveResolver moveResolver) { if (fromBlock.getSuccessorCount() <= 1) { Debug.log("inserting moves at end of fromBlock B%d", fromBlock.getId()); @@ -1463,7 +1470,7 @@ // successor edges, blocks which are reached by switch statements // may have be more than one predecessor but it will be guaranteed // that all predecessors will be the same. - for (AbstractBlock<?> predecessor : toBlock.getPredecessors()) { + for (AbstractBlockBase<?> predecessor : toBlock.getPredecessors()) { assert fromBlock == predecessor : "all critical edges must be broken"; } } @@ -1484,7 +1491,7 @@ BitSet blockCompleted = new BitSet(numBlocks); BitSet alreadyResolved = new BitSet(numBlocks); - for (AbstractBlock<?> block : sortedBlocks) { + for (AbstractBlockBase<?> block : sortedBlocks) { // check if block has only one predecessor and only one successor if (block.getPredecessorCount() == 1 && block.getSuccessorCount() == 1) { @@ -1494,8 +1501,8 @@ // check if block is empty (only label and branch) if (instructions.size() == 2) { - AbstractBlock<?> pred = block.getPredecessors().iterator().next(); - AbstractBlock<?> sux = block.getSuccessors().iterator().next(); + AbstractBlockBase<?> pred = block.getPredecessors().iterator().next(); + AbstractBlockBase<?> sux = block.getSuccessors().iterator().next(); // prevent optimization of two consecutive blocks if (!blockCompleted.get(pred.getLinearScanNumber()) && !blockCompleted.get(sux.getLinearScanNumber())) { @@ -1516,12 +1523,12 @@ } } - for (AbstractBlock<?> fromBlock : sortedBlocks) { + for (AbstractBlockBase<?> fromBlock : sortedBlocks) { if (!blockCompleted.get(fromBlock.getLinearScanNumber())) { alreadyResolved.clear(); alreadyResolved.or(blockCompleted); - for (AbstractBlock<?> toBlock : fromBlock.getSuccessors()) { + for (AbstractBlockBase<?> toBlock : fromBlock.getSuccessors()) { // check for duplicate edges between the same blocks (can happen with switch // blocks) @@ -1566,7 +1573,7 @@ if (opId != -1) { if (DetailedAsserts.getValue()) { - AbstractBlock<?> block = blockForId(opId); + AbstractBlockBase<?> block = blockForId(opId); if (block.getSuccessorCount() <= 1 && opId == getLastLirInstructionId(block)) { // check if spill moves could have been appended at the end of this block, but // before the branch instruction. So the split child information for this branch @@ -1639,7 +1646,7 @@ } int tempOpId = op.id(); OperandMode mode = OperandMode.USE; - AbstractBlock<?> block = blockForId(tempOpId); + AbstractBlockBase<?> block = blockForId(tempOpId); if (block.getSuccessorCount() == 1 && tempOpId == getLastLirInstructionId(block)) { // generating debug information for the last instruction of a block. // if this instruction is a branch, spill moves are inserted before this branch @@ -1723,7 +1730,7 @@ private void assignLocations() { try (Indent indent = Debug.logAndIndent("assign locations")) { - for (AbstractBlock<?> block : sortedBlocks) { + for (AbstractBlockBase<?> block : sortedBlocks) { try (Indent indent2 = Debug.logAndIndent("assign locations in block B%d", block.getId())) { assignLocations(ir.getLIRforBlock(block)); } @@ -1811,8 +1818,8 @@ LIRInsertionBuffer[] insertionBuffers = new LIRInsertionBuffer[ir.linearScanOrder().size()]; for (Interval interval : intervals) { if (interval != null && interval.isSplitParent() && interval.spillState() == SpillState.SpillInDominator) { - AbstractBlock<?> defBlock = blockForId(interval.spillDefinitionPos()); - AbstractBlock<?> spillBlock = null; + AbstractBlockBase<?> defBlock = blockForId(interval.spillDefinitionPos()); + AbstractBlockBase<?> spillBlock = null; Interval firstSpillChild = null; try (Indent indent = Debug.logAndIndent("interval %s (%s)", interval, defBlock)) { for (Interval splitChild : interval.getSplitChildren()) { @@ -1823,7 +1830,7 @@ assert firstSpillChild.from() < splitChild.from(); } // iterate all blocks where the interval has use positions - for (AbstractBlock<?> splitBlock : blocksForInterval(splitChild)) { + for (AbstractBlockBase<?> splitBlock : blocksForInterval(splitChild)) { if (dominates(defBlock, splitBlock)) { Debug.log("Split interval %s, block %s", splitChild, splitBlock); if (spillBlock == null) { @@ -1851,7 +1858,7 @@ */ assert firstSpillChild != null; if (!defBlock.equals(spillBlock) && spillBlock.equals(blockForId(firstSpillChild.from()))) { - AbstractBlock<?> dom = spillBlock.getDominator(); + AbstractBlockBase<?> dom = spillBlock.getDominator(); Debug.log("Spill block (%s) is the beginning of a spill child -> use dominator (%s)", spillBlock, dom); spillBlock = dom; } @@ -1875,7 +1882,7 @@ // insert spill move AllocatableValue fromLocation = interval.getSplitChildAtOpId(spillOpId, OperandMode.DEF, this).location(); AllocatableValue toLocation = canonicalSpillOpr(interval); - LIRInstruction move = ir.getSpillMoveFactory().createMove(toLocation, fromLocation); + LIRInstruction move = getSpillMoveFactory().createMove(toLocation, fromLocation); move.setId(DOMINATOR_SPILL_MOVE_ID); /* * We can use the insertion buffer directly because we always insert @@ -1903,20 +1910,20 @@ } /** - * Iterate over all {@link AbstractBlock blocks} of an interval. + * Iterate over all {@link AbstractBlockBase blocks} of an interval. */ - private class IntervalBlockIterator implements Iterator<AbstractBlock<?>> { + private class IntervalBlockIterator implements Iterator<AbstractBlockBase<?>> { Range range; - AbstractBlock<?> block; + AbstractBlockBase<?> block; public IntervalBlockIterator(Interval interval) { range = interval.first(); block = blockForId(range.from); } - public AbstractBlock<?> next() { - AbstractBlock<?> currentBlock = block; + public AbstractBlockBase<?> next() { + AbstractBlockBase<?> currentBlock = block; int nextBlockIndex = block.getLinearScanNumber() + 1; if (nextBlockIndex < sortedBlocks.size()) { block = sortedBlocks.get(nextBlockIndex); @@ -1939,17 +1946,17 @@ } } - private Iterable<AbstractBlock<?>> blocksForInterval(Interval interval) { - return new Iterable<AbstractBlock<?>>() { - public Iterator<AbstractBlock<?>> iterator() { + private Iterable<AbstractBlockBase<?>> blocksForInterval(Interval interval) { + return new Iterable<AbstractBlockBase<?>>() { + public Iterator<AbstractBlockBase<?>> iterator() { return new IntervalBlockIterator(interval); } }; } - private static AbstractBlock<?> moveSpillOutOfLoop(AbstractBlock<?> defBlock, AbstractBlock<?> spillBlock) { + private static AbstractBlockBase<?> moveSpillOutOfLoop(AbstractBlockBase<?> defBlock, AbstractBlockBase<?> spillBlock) { int defLoopDepth = defBlock.getLoopDepth(); - for (AbstractBlock<?> block = spillBlock.getDominator(); !defBlock.equals(block); block = block.getDominator()) { + for (AbstractBlockBase<?> block = spillBlock.getDominator(); !defBlock.equals(block); block = block.getDominator()) { assert block != null : "spill block not dominated by definition block?"; if (block.getLoopDepth() <= defLoopDepth) { assert block.getLoopDepth() == defLoopDepth : "Cannot spill an interval outside of the loop where it is defined!"; @@ -1970,7 +1977,7 @@ try (Indent indent2 = Debug.logAndIndent("Basic Blocks")) { for (int i = 0; i < blockCount(); i++) { - AbstractBlock<?> block = blockAt(i); + AbstractBlockBase<?> block = blockAt(i); Debug.log("B%d [%d, %d, %s] ", block.getId(), getFirstLirInstructionId(block), getLastLirInstructionId(block), block.getLoop()); } } @@ -2103,7 +2110,7 @@ otherIntervals.addRange(Integer.MAX_VALUE - 2, Integer.MAX_VALUE - 1); IntervalWalker iw = new IntervalWalker(this, fixedIntervals, otherIntervals); - for (AbstractBlock<?> block : sortedBlocks) { + for (AbstractBlockBase<?> block : sortedBlocks) { List<LIRInstruction> instructions = ir.getLIRforBlock(block); for (int j = 0; j < instructions.size(); j++) {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -27,13 +27,14 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.lir.gen.*; +import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; import com.oracle.graal.lir.phases.*; -public final class LinearScanPhase extends LIRMidTierPhase { +public final class LinearScanPhase extends AllocationPhase { @Override - protected <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder) { - new LinearScan(target, lirGenRes).allocate(); + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { + new LinearScan(target, lirGenRes, spillMoveFactory).allocate(); } }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java Mon Feb 23 16:23:23 2015 -0800 @@ -63,11 +63,11 @@ return allocator.blockCount(); } - AbstractBlock<?> blockAt(int idx) { + AbstractBlockBase<?> blockAt(int idx) { return allocator.blockAt(idx); } - AbstractBlock<?> blockOfOpWithId(int opId) { + AbstractBlockBase<?> blockOfOpWithId(int opId) { return allocator.blockForId(opId); } @@ -239,7 +239,7 @@ // optimized away later in assignRegNums int opId = (operandId + 1) & ~1; - AbstractBlock<?> opBlock = allocator.blockForId(opId); + AbstractBlockBase<?> opBlock = allocator.blockForId(opId); assert opId > 0 && allocator.blockForId(opId - 2) == opBlock : "cannot insert move at block boundary"; // calculate index of instruction inside instruction list of current block @@ -263,7 +263,7 @@ moveResolver.addMapping(srcIt, dstIt); } - int findOptimalSplitPos(AbstractBlock<?> minBlock, AbstractBlock<?> maxBlock, int maxSplitPos) { + int findOptimalSplitPos(AbstractBlockBase<?> minBlock, AbstractBlockBase<?> maxBlock, int maxSplitPos) { int fromBlockNr = minBlock.getLinearScanNumber(); int toBlockNr = maxBlock.getLinearScanNumber(); @@ -280,7 +280,7 @@ int minLoopDepth = maxBlock.getLoopDepth(); for (int i = toBlockNr - 1; i >= fromBlockNr; i--) { - AbstractBlock<?> cur = blockAt(i); + AbstractBlockBase<?> cur = blockAt(i); if (cur.getLoopDepth() < minLoopDepth) { // block with lower loop-depth found . split at the end of this block @@ -308,13 +308,13 @@ // beginning of a block, then minSplitPos is also a possible split position. // Use the block before as minBlock, because then minBlock.lastLirInstructionId() + 2 == // minSplitPos - AbstractBlock<?> minBlock = allocator.blockForId(minSplitPos - 1); + AbstractBlockBase<?> minBlock = allocator.blockForId(minSplitPos - 1); // reason for using maxSplitPos - 1: otherwise there would be an assert on failure // when an interval ends at the end of the last block of the method // (in this case, maxSplitPos == allocator().maxLirOpId() + 2, and there is no // block at this opId) - AbstractBlock<?> maxBlock = allocator.blockForId(maxSplitPos - 1); + AbstractBlockBase<?> maxBlock = allocator.blockForId(maxSplitPos - 1); assert minBlock.getLinearScanNumber() <= maxBlock.getLinearScanNumber() : "invalid order"; if (minBlock == maxBlock) { @@ -352,7 +352,7 @@ // Desired result: uses tagged as shouldHaveRegister inside a loop cause // a reloading // of the interval (normally, only mustHaveRegister causes a reloading) - AbstractBlock<?> loopBlock = allocator.blockForId(loopEndPos); + AbstractBlockBase<?> loopBlock = allocator.blockForId(loopEndPos); Debug.log("interval is used in loop that ends in block B%d, so trying to move maxBlock back from B%d to B%d", loopBlock.getId(), maxBlock.getId(), loopBlock.getId()); assert loopBlock != minBlock : "loopBlock and minBlock must be different because block boundary is needed between";
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LocationMarker.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LocationMarker.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,6 +35,7 @@ import com.oracle.graal.lir.LIRInstruction.OperandMode; import com.oracle.graal.lir.framemap.*; import com.oracle.graal.lir.gen.*; +import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; import com.oracle.graal.lir.phases.*; import com.oracle.graal.options.*; @@ -42,7 +43,7 @@ * Mark all live references for a frame state. The frame state use this information to build the OOP * maps. */ -public final class LocationMarker extends LIRMidTierPhase { +public final class LocationMarker extends AllocationPhase { public static class Options { // @formatter:off @@ -52,7 +53,7 @@ } @Override - protected <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { new Marker(lirGenRes.getLIR(), lirGenRes.getFrameMap()).build(); } @@ -72,19 +73,19 @@ } private void build() { - Deque<AbstractBlock<?>> worklist = new ArrayDeque<>(); + Deque<AbstractBlockBase<?>> worklist = new ArrayDeque<>(); for (int i = lir.getControlFlowGraph().getBlocks().size() - 1; i >= 0; i--) { worklist.add(lir.getControlFlowGraph().getBlocks().get(i)); } - for (AbstractBlock<?> block : lir.getControlFlowGraph().getBlocks()) { + for (AbstractBlockBase<?> block : lir.getControlFlowGraph().getBlocks()) { liveInMap.put(block, frameMap.initReferenceMap(true)); } while (!worklist.isEmpty()) { - AbstractBlock<?> block = worklist.poll(); + AbstractBlockBase<?> block = worklist.poll(); processBlock(block, worklist); } // finish states - for (AbstractBlock<?> block : lir.getControlFlowGraph().getBlocks()) { + for (AbstractBlockBase<?> block : lir.getControlFlowGraph().getBlocks()) { List<LIRInstruction> instructions = lir.getLIRforBlock(block); for (int i = instructions.size() - 1; i >= 0; i--) { LIRInstruction inst = instructions.get(i); @@ -97,7 +98,7 @@ /** * Merge outSet with in-set of successors. */ - private boolean updateOutBlock(AbstractBlock<?> block) { + private boolean updateOutBlock(AbstractBlockBase<?> block) { ReferenceMap union = frameMap.initReferenceMap(true); block.getSuccessors().forEach(succ -> union.updateUnion(liveInMap.get(succ))); ReferenceMap outSet = liveOutMap.get(block); @@ -109,7 +110,7 @@ return false; } - private void processBlock(AbstractBlock<?> block, Deque<AbstractBlock<?>> worklist) { + private void processBlock(AbstractBlockBase<?> block, Deque<AbstractBlockBase<?>> worklist) { if (updateOutBlock(block)) { try (Indent indent = Debug.logAndIndent("handle block %s", block)) { BlockClosure closure = new BlockClosure(liveOutMap.get(block).clone());
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/MoveResolver.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/MoveResolver.java Mon Feb 23 16:23:23 2015 -0800 @@ -203,7 +203,7 @@ AllocatableValue fromOpr = fromInterval.operand; AllocatableValue toOpr = toInterval.operand; - insertionBuffer.append(insertIdx, allocator.ir.getSpillMoveFactory().createMove(toOpr, fromOpr)); + insertionBuffer.append(insertIdx, allocator.getSpillMoveFactory().createMove(toOpr, fromOpr)); Debug.log("insert move from %s to %s at %d", fromInterval, toInterval, insertIdx); } @@ -213,7 +213,7 @@ assert insertIdx != -1 : "must setup insert position first"; AllocatableValue toOpr = toInterval.operand; - insertionBuffer.append(insertIdx, allocator.ir.getSpillMoveFactory().createMove(toOpr, fromOpr)); + insertionBuffer.append(insertIdx, allocator.getSpillMoveFactory().createMove(toOpr, fromOpr)); Debug.log("insert move from value %s to %s at %d", fromOpr, toInterval, insertIdx); }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/OptimizingLinearScanWalker.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/OptimizingLinearScanWalker.java Mon Feb 23 16:23:23 2015 -0800 @@ -71,14 +71,14 @@ @Override void walk() { try (Scope s = Debug.scope("OptimizingLinearScanWalker")) { - for (AbstractBlock<?> block : allocator.sortedBlocks) { + for (AbstractBlockBase<?> block : allocator.sortedBlocks) { optimizeBlock(block); } } super.walk(); } - private void optimizeBlock(AbstractBlock<?> block) { + private void optimizeBlock(AbstractBlockBase<?> block) { if (block.getPredecessorCount() == 1) { int nextBlock = allocator.getFirstLirInstructionId(block); try (Scope s1 = Debug.scope("LSRAOptimization")) { @@ -114,7 +114,7 @@ } } - private boolean optimize(int currentPos, AbstractBlock<?> currentBlock, Interval currentInterval, RegisterBinding binding) { + private boolean optimize(int currentPos, AbstractBlockBase<?> currentBlock, Interval currentInterval, RegisterBinding binding) { // BEGIN initialize and sanity checks assert currentBlock != null : "block must not be null"; assert currentInterval != null : "interval must not be null"; @@ -136,7 +136,7 @@ assert currentLocation != null : "active intervals must have a location assigned!"; // get predecessor stuff - AbstractBlock<?> predecessorBlock = currentBlock.getPredecessors().get(0); + AbstractBlockBase<?> predecessorBlock = currentBlock.getPredecessors().get(0); int predEndId = allocator.getLastLirInstructionId(predecessorBlock); Interval predecessorInterval = currentInterval.getIntervalCoveringOpId(predEndId); assert predecessorInterval != null : "variable not live at the end of the only predecessor! " + predecessorBlock + " -> " + currentBlock + " interval: " + currentInterval;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/Range.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/Range.java Mon Feb 23 16:23:23 2015 -0800 @@ -50,7 +50,7 @@ /** * Creates a new range. - * + * * @param from the start of the range, inclusive * @param to the end of the range, exclusive * @param next link to the next range in a linked list
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/RegisterVerifier.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/RegisterVerifier.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,7 +41,7 @@ final class RegisterVerifier { LinearScan allocator; - List<AbstractBlock<?>> workList; // all blocks that must be processed + List<AbstractBlockBase<?>> workList; // all blocks that must be processed ArrayMap<Interval[]> savedStates; // saved information of previous check // simplified access to methods of LinearScan @@ -55,15 +55,15 @@ } // accessors - Interval[] stateForBlock(AbstractBlock<?> block) { + Interval[] stateForBlock(AbstractBlockBase<?> block) { return savedStates.get(block.getId()); } - void setStateForBlock(AbstractBlock<?> block, Interval[] savedState) { + void setStateForBlock(AbstractBlockBase<?> block, Interval[] savedState) { savedStates.put(block.getId(), savedState); } - void addToWorkList(AbstractBlock<?> block) { + void addToWorkList(AbstractBlockBase<?> block) { if (!workList.contains(block)) { workList.add(block); } @@ -76,7 +76,7 @@ } - void verify(AbstractBlock<?> start) { + void verify(AbstractBlockBase<?> start) { // setup input registers (method arguments) for first block Interval[] inputState = new Interval[stateSize()]; setStateForBlock(start, inputState); @@ -84,14 +84,14 @@ // main loop for verification do { - AbstractBlock<?> block = workList.get(0); + AbstractBlockBase<?> block = workList.get(0); workList.remove(0); processBlock(block); } while (!workList.isEmpty()); } - private void processBlock(AbstractBlock<?> block) { + private void processBlock(AbstractBlockBase<?> block) { try (Indent indent = Debug.logAndIndent("processBlock B%d", block.getId())) { // must copy state because it is modified Interval[] inputState = copy(stateForBlock(block)); @@ -110,13 +110,13 @@ processOperations(allocator.ir.getLIRforBlock(block), inputState); // iterate all successors - for (AbstractBlock<?> succ : block.getSuccessors()) { + for (AbstractBlockBase<?> succ : block.getSuccessors()) { processSuccessor(succ, inputState); } } } - private void processSuccessor(AbstractBlock<?> block, Interval[] inputState) { + private void processSuccessor(AbstractBlockBase<?> block, Interval[] inputState) { Interval[] savedState = stateForBlock(block); if (savedState != null) {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/CompilationResultBuilder.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/CompilationResultBuilder.java Mon Feb 23 16:23:23 2015 -0800 @@ -330,7 +330,7 @@ */ public boolean isSuccessorEdge(LabelRef edge) { assert lir != null; - List<? extends AbstractBlock<?>> order = lir.codeEmittingOrder(); + List<? extends AbstractBlockBase<?>> order = lir.codeEmittingOrder(); assert order.get(currentBlockIndex) == edge.getSourceBlock(); return currentBlockIndex < order.size() - 1 && order.get(currentBlockIndex + 1) == edge.getTargetBlock(); } @@ -344,7 +344,7 @@ this.lir = lir; this.currentBlockIndex = 0; frameContext.enter(this); - for (AbstractBlock<?> b : lir.codeEmittingOrder()) { + for (AbstractBlockBase<?> b : lir.codeEmittingOrder()) { emitBlock(b); currentBlockIndex++; } @@ -352,7 +352,7 @@ this.currentBlockIndex = 0; } - private void emitBlock(AbstractBlock<?> block) { + private void emitBlock(AbstractBlockBase<?> block) { if (Debug.isDumpEnabled()) { blockComment(String.format("block B%d %s", block.getId(), block.getLoop())); }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/ConstantLoadOptimization.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/ConstantLoadOptimization.java Mon Feb 23 16:23:23 2015 -0800 @@ -47,7 +47,7 @@ * a constant, which is potentially scheduled into a block with high probability, with one or more * definitions in blocks with a lower probability. */ -public final class ConstantLoadOptimization extends LIRHighTierPhase { +public final class ConstantLoadOptimization extends PreAllocationOptimizationPhase { public static class Options { // @formatter:off @@ -57,7 +57,7 @@ } @Override - protected <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, LIRGeneratorTool lirGen) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, LIRGeneratorTool lirGen) { new Optimization(lirGenRes.getLIR(), lirGen).apply(); } @@ -135,7 +135,7 @@ assert !operand.equals(var) : "constant usage through variable in frame state " + var; } }; - for (AbstractBlock<?> block : lir.getControlFlowGraph().getBlocks()) { + for (AbstractBlockBase<?> block : lir.getControlFlowGraph().getBlocks()) { for (LIRInstruction inst : lir.getLIRforBlock(block)) { // set instruction id to the index in the lir instruction list inst.visitEachState(stateConsumer); @@ -152,7 +152,7 @@ } private void addUsageToBlockMap(UseEntry entry) { - AbstractBlock<?> block = entry.getBlock(); + AbstractBlockBase<?> block = entry.getBlock(); List<UseEntry> list = blockMap.get(block); if (list == null) { list = new ArrayList<>(); @@ -164,7 +164,7 @@ /** * Collects def-use information for a {@code block}. */ - private void analyzeBlock(AbstractBlock<?> block) { + private void analyzeBlock(AbstractBlockBase<?> block) { try (Indent indent = Debug.logAndIndent("Block: %s", block)) { InstructionValueConsumer loadConsumer = (instruction, value, mode, flags) -> { @@ -267,17 +267,17 @@ Debug.dump(constTree, "ConstantTree for " + tree.getVariable()); } - private void createLoads(DefUseTree tree, ConstantTree constTree, AbstractBlock<?> startBlock) { - Deque<AbstractBlock<?>> worklist = new ArrayDeque<>(); + private void createLoads(DefUseTree tree, ConstantTree constTree, AbstractBlockBase<?> startBlock) { + Deque<AbstractBlockBase<?>> worklist = new ArrayDeque<>(); worklist.add(startBlock); while (!worklist.isEmpty()) { - AbstractBlock<?> block = worklist.pollLast(); + AbstractBlockBase<?> block = worklist.pollLast(); if (constTree.get(Flags.CANDIDATE, block)) { constTree.set(Flags.MATERIALIZE, block); // create and insert load insertLoad(tree.getConstant(), tree.getVariable().getLIRKind(), block, constTree.getCost(block).getUsages()); } else { - for (AbstractBlock<?> dominated : block.getDominated()) { + for (AbstractBlockBase<?> dominated : block.getDominated()) { if (constTree.isMarked(dominated)) { worklist.addLast(dominated); } @@ -286,12 +286,12 @@ } } - private void insertLoad(JavaConstant constant, LIRKind kind, AbstractBlock<?> block, List<UseEntry> usages) { + private void insertLoad(JavaConstant constant, LIRKind kind, AbstractBlockBase<?> block, List<UseEntry> usages) { assert usages != null && usages.size() > 0 : String.format("No usages %s %s %s", constant, block, usages); // create variable Variable variable = lirGen.newVariable(kind); // create move - LIRInstruction move = lir.getSpillMoveFactory().createMove(variable, constant); + LIRInstruction move = lirGen.getSpillMoveFactory().createMove(variable, constant); // insert instruction getInsertionBuffer(block).append(1, move); Debug.log("new move (%s) and inserted in block %s", move, block); @@ -306,7 +306,7 @@ * Inserts the constant loads created in {@link #createConstantTree} and deletes the * original definition. */ - private void rewriteBlock(AbstractBlock<?> block) { + private void rewriteBlock(AbstractBlockBase<?> block) { // insert moves LIRInsertionBuffer buffer = insertionBuffers.get(block); if (buffer != null) { @@ -331,13 +331,13 @@ } private void deleteInstruction(DefUseTree tree) { - AbstractBlock<?> block = tree.getBlock(); + AbstractBlockBase<?> block = tree.getBlock(); LIRInstruction instruction = tree.getInstruction(); Debug.log("deleting instruction %s from block %s", instruction, block); lir.getLIRforBlock(block).set(instruction.id(), null); } - private LIRInsertionBuffer getInsertionBuffer(AbstractBlock<?> block) { + private LIRInsertionBuffer getInsertionBuffer(AbstractBlockBase<?> block) { LIRInsertionBuffer insertionBuffer = insertionBuffers.get(block); if (insertionBuffer == null) { insertionBuffer = new LIRInsertionBuffer();
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/ConstantTree.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/ConstantTree.java Mon Feb 23 16:23:23 2015 -0800 @@ -99,7 +99,7 @@ tree.forEach(u -> getOrInitList(u.getBlock()).add(u)); } - private List<UseEntry> getOrInitList(AbstractBlock<?> block) { + private List<UseEntry> getOrInitList(AbstractBlockBase<?> block) { List<UseEntry> list = blockMap.get(block); if (list == null) { list = new ArrayList<>(); @@ -108,7 +108,7 @@ return list; } - public List<UseEntry> getUsages(AbstractBlock<?> block) { + public List<UseEntry> getUsages(AbstractBlockBase<?> block) { List<UseEntry> list = blockMap.get(block); if (list == null) { return Collections.emptyList(); @@ -120,7 +120,7 @@ * Returns the cost object associated with {@code block}. If there is none, a new cost object is * created. */ - NodeCost getOrInitCost(AbstractBlock<?> block) { + NodeCost getOrInitCost(AbstractBlockBase<?> block) { NodeCost cost = getCost(block); if (cost == null) { cost = new NodeCost(block.probability(), blockMap.get(block), 1); @@ -145,7 +145,7 @@ } @Override - public void forEachPropertyPair(AbstractBlock<?> block, BiConsumer<String, String> action) { + public void forEachPropertyPair(AbstractBlockBase<?> block, BiConsumer<String, String> action) { if (get(Flags.SUBTREE, block) && (block.getDominator() == null || !get(Flags.SUBTREE, block.getDominator()))) { action.accept("hasDefinition", "true"); } @@ -156,7 +156,7 @@ return stream(Flags.SUBTREE).count(); } - public AbstractBlock<?> getStartBlock() { + public AbstractBlockBase<?> getStartBlock() { return stream(Flags.SUBTREE).findFirst().get(); } @@ -164,15 +164,15 @@ stream(Flags.USAGE).forEach(block -> setDominatorPath(Flags.SUBTREE, block)); } - public boolean isMarked(AbstractBlock<?> block) { + public boolean isMarked(AbstractBlockBase<?> block) { return get(Flags.SUBTREE, block); } - public boolean isLeafBlock(AbstractBlock<?> block) { + public boolean isLeafBlock(AbstractBlockBase<?> block) { return block.getDominated().stream().noneMatch(this::isMarked); } - public void setSolution(AbstractBlock<?> block) { + public void setSolution(AbstractBlockBase<?> block) { set(Flags.MATERIALIZE, block); } @@ -180,7 +180,7 @@ return getBlocks().size(); } - public void traverseTreeWhileTrue(AbstractBlock<?> block, Predicate<AbstractBlock<?>> action) { + public void traverseTreeWhileTrue(AbstractBlockBase<?> block, Predicate<AbstractBlockBase<?>> action) { assert block != null : "block must not be null!"; if (action.test(block)) { block.getDominated().stream().filter(this::isMarked).forEach(dominated -> traverseTreeWhileTrue(dominated, action));
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/ConstantTreeAnalyzer.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/ConstantTreeAnalyzer.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ private final ConstantTree tree; private final BitSet visited; - public static NodeCost analyze(ConstantTree tree, AbstractBlock<?> startBlock) { + public static NodeCost analyze(ConstantTree tree, AbstractBlockBase<?> startBlock) { try (Scope s = Debug.scope("ConstantTreeAnalyzer")) { ConstantTreeAnalyzer analyzer = new ConstantTreeAnalyzer(tree); analyzer.analyzeBlocks(startBlock); @@ -60,11 +60,11 @@ * * @param startBlock The start block of the dominator subtree. */ - private void analyzeBlocks(AbstractBlock<?> startBlock) { - Deque<AbstractBlock<?>> worklist = new ArrayDeque<>(); + private void analyzeBlocks(AbstractBlockBase<?> startBlock) { + Deque<AbstractBlockBase<?>> worklist = new ArrayDeque<>(); worklist.offerLast(startBlock); while (!worklist.isEmpty()) { - AbstractBlock<?> block = worklist.pollLast(); + AbstractBlockBase<?> block = worklist.pollLast(); try (Indent i = Debug.logAndIndent(3, "analyze: %s", block)) { assert block != null : "worklist is empty!"; assert isMarked(block) : "Block not part of the dominator tree: " + block; @@ -79,7 +79,7 @@ // if not yet visited (and not a leaf block) process all children first! Debug.log(3, "not marked"); worklist.offerLast(block); - List<? extends AbstractBlock<?>> children = block.getDominated(); + List<? extends AbstractBlockBase<?>> children = block.getDominated(); children.forEach(child -> filteredPush(worklist, child)); visited.set(block.getId()); } else { @@ -97,15 +97,15 @@ * * @param block The block to be processed. */ - private void process(AbstractBlock<?> block) { + private void process(AbstractBlockBase<?> block) { List<UseEntry> usages = new ArrayList<>(); double bestCost = 0; int numMat = 0; - List<? extends AbstractBlock<?>> children = block.getDominated(); + List<? extends AbstractBlockBase<?>> children = block.getDominated(); assert children.stream().anyMatch(this::isMarked) : "no children? should have called leafCost(): " + block; // collect children costs - for (AbstractBlock<?> child : children) { + for (AbstractBlockBase<?> child : children) { if (isMarked(child)) { NodeCost childCost = tree.getCost(child); assert childCost != null : "Child with null cost? block: " + child; @@ -151,23 +151,23 @@ return probabilityBlock * Math.pow(0.9, numMat - 1) < probabilityChildren; } - private void filteredPush(Deque<AbstractBlock<?>> worklist, AbstractBlock<?> block) { + private void filteredPush(Deque<AbstractBlockBase<?>> worklist, AbstractBlockBase<?> block) { if (isMarked(block)) { Debug.log(3, "adding %s to the worklist", block); worklist.offerLast(block); } } - private void leafCost(AbstractBlock<?> block) { + private void leafCost(AbstractBlockBase<?> block) { tree.set(Flags.CANDIDATE, block); tree.getOrInitCost(block); } - private boolean isMarked(AbstractBlock<?> block) { + private boolean isMarked(AbstractBlockBase<?> block) { return tree.isMarked(block); } - private boolean isLeafBlock(AbstractBlock<?> block) { + private boolean isLeafBlock(AbstractBlockBase<?> block) { return tree.isLeafBlock(block); }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/DefUseTree.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/DefUseTree.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,10 +35,10 @@ */ class DefUseTree { private final LIRInstruction instruction; - private final AbstractBlock<?> block; + private final AbstractBlockBase<?> block; private final List<UseEntry> uses; - public DefUseTree(LIRInstruction instruction, AbstractBlock<?> block) { + public DefUseTree(LIRInstruction instruction, AbstractBlockBase<?> block) { assert instruction instanceof MoveOp : "Not a MoveOp: " + instruction; this.instruction = instruction; this.block = block; @@ -57,7 +57,7 @@ return instruction; } - public AbstractBlock<?> getBlock() { + public AbstractBlockBase<?> getBlock() { return block; } @@ -66,7 +66,7 @@ return "DefUseTree [" + instruction + "|" + block + "," + uses + "]"; } - public void addUsage(AbstractBlock<?> b, LIRInstruction inst, ValuePosition position) { + public void addUsage(AbstractBlockBase<?> b, LIRInstruction inst, ValuePosition position) { uses.add(new UseEntry(b, inst, position)); }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/UseEntry.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/UseEntry.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,11 +31,11 @@ */ class UseEntry { - private final AbstractBlock<?> block; + private final AbstractBlockBase<?> block; private final LIRInstruction instruction; private final ValuePosition position; - public UseEntry(AbstractBlock<?> block, LIRInstruction instruction, ValuePosition position) { + public UseEntry(AbstractBlockBase<?> block, LIRInstruction instruction, ValuePosition position) { this.block = block; this.instruction = instruction; this.position = position; @@ -45,7 +45,7 @@ return instruction; } - public AbstractBlock<?> getBlock() { + public AbstractBlockBase<?> getBlock() { return block; }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilderImpl.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilderImpl.java Mon Feb 23 16:23:23 2015 -0800 @@ -117,7 +117,7 @@ InstructionValueConsumer verifySlots = (LIRInstruction op, Value value, OperandMode mode, EnumSet<OperandFlag> flags) -> { assert !isVirtualStackSlot(value) : String.format("Instruction %s contains a virtual stack slot %s", op, value); }; - for (AbstractBlock<?> block : lir.getControlFlowGraph().getBlocks()) { + for (AbstractBlockBase<?> block : lir.getControlFlowGraph().getBlocks()) { lir.getLIRforBlock(block).forEach(op -> { op.visitEachInput(verifySlots); op.visitEachAlive(verifySlots);
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java Mon Feb 23 16:23:23 2015 -0800 @@ -60,7 +60,7 @@ private final CodeGenProviders providers; private final CallingConvention cc; - private AbstractBlock<?> currentBlock; + private AbstractBlockBase<?> currentBlock; private LIRGenerationResult res; @@ -186,7 +186,7 @@ res.getLIR().getLIRforBlock(currentBlock).add(op); } - public boolean hasBlockEnd(AbstractBlock<?> block) { + public boolean hasBlockEnd(AbstractBlockBase<?> block) { List<LIRInstruction> ops = getResult().getLIR().getLIRforBlock(block); if (ops.size() == 0) { return false; @@ -194,7 +194,7 @@ return ops.get(ops.size() - 1) instanceof BlockEndOp; } - public final void doBlockStart(AbstractBlock<?> block) { + public final void doBlockStart(AbstractBlockBase<?> block) { if (Options.PrintIRWithLIR.getValue()) { TTY.print(block.toString()); } @@ -212,7 +212,7 @@ } } - public final void doBlockEnd(AbstractBlock<?> block) { + public final void doBlockEnd(AbstractBlockBase<?> block) { if (Options.TraceLIRGeneratorLevel.getValue() >= 1) { TTY.println("END Generating LIR for block B" + block.getId()); @@ -226,7 +226,7 @@ } public void emitIncomingValues(Value[] params) { - ((LabelOp) res.getLIR().getLIRforBlock(currentBlock).get(0)).setIncomingValues(params); + ((LabelOp) res.getLIR().getLIRforBlock(getCurrentBlock()).get(0)).setIncomingValues(params); } public abstract void emitJump(LabelRef label); @@ -379,14 +379,10 @@ } } - public AbstractBlock<?> getCurrentBlock() { + public AbstractBlockBase<?> getCurrentBlock() { return currentBlock; } - void setCurrentBlock(AbstractBlock<?> block) { - currentBlock = block; - } - public LIRGenerationResult getResult() { return res; }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGeneratorTool.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGeneratorTool.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,6 +32,11 @@ public interface LIRGeneratorTool extends ArithmeticLIRGenerator { + public interface SpillMoveFactory { + + LIRInstruction createMove(AllocatableValue result, Value input); + } + CodeGenProviders getProviders(); TargetDescription target(); @@ -42,15 +47,17 @@ ForeignCallsProvider getForeignCalls(); - AbstractBlock<?> getCurrentBlock(); + AbstractBlockBase<?> getCurrentBlock(); LIRGenerationResult getResult(); - boolean hasBlockEnd(AbstractBlock<?> block); + boolean hasBlockEnd(AbstractBlockBase<?> block); + + SpillMoveFactory getSpillMoveFactory(); - void doBlockStart(AbstractBlock<?> block); + void doBlockStart(AbstractBlockBase<?> block); - void doBlockEnd(AbstractBlock<?> block); + void doBlockEnd(AbstractBlockBase<?> block); Value emitLoadConstant(LIRKind kind, Constant constant);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/AllocationPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.lir.phases; + +import java.util.*; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.compiler.common.cfg.*; +import com.oracle.graal.lir.gen.*; +import com.oracle.graal.lir.gen.LIRGeneratorTool.*; + +public abstract class AllocationPhase extends LIRPhase<AllocationPhase.AllocationContext> { + + public static final class AllocationContext { + private final SpillMoveFactory spillMoveFactory; + + public AllocationContext(SpillMoveFactory spillMoveFactory) { + this.spillMoveFactory = spillMoveFactory; + } + } + + @Override + protected final <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, AllocationContext context) { + run(target, lirGenRes, codeEmittingOrder, linearScanOrder, context.spillMoveFactory); + } + + protected abstract <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, + SpillMoveFactory spillMoveFactory); + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/AllocationStage.java Mon Feb 23 16:23:23 2015 -0800 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.lir.phases; + +import com.oracle.graal.lir.alloc.lsra.*; +import com.oracle.graal.lir.phases.AllocationPhase.*; +import com.oracle.graal.lir.stackslotalloc.*; + +public class AllocationStage extends LIRPhaseSuite<AllocationContext> { + public AllocationStage() { + appendPhase(new LinearScanPhase()); + + // build frame map + if (LSStackSlotAllocator.Options.LIROptLSStackSlotAllocator.getValue()) { + appendPhase(new LSStackSlotAllocator()); + } else { + appendPhase(new SimpleStackSlotAllocator()); + } + // currently we mark locations only if we do register allocation + appendPhase(new LocationMarker()); + } +}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRHighTier.java Wed Feb 18 10:37:08 2015 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.phases; - -import com.oracle.graal.lir.constopt.*; -import com.oracle.graal.lir.phases.LIRHighTierPhase.*; - -public class LIRHighTier extends LIRPhaseSuite<LIRHighTierContext> { - public LIRHighTier() { - if (ConstantLoadOptimization.Options.LIROptConstantLoadOptimization.getValue()) { - appendPhase(new ConstantLoadOptimization()); - } - } -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRHighTierPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.phases; - -import java.util.*; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.compiler.common.cfg.*; -import com.oracle.graal.lir.gen.*; - -public abstract class LIRHighTierPhase extends LIRPhase<LIRHighTierPhase.LIRHighTierContext> { - - public static final class LIRHighTierContext { - private final LIRGeneratorTool lirGen; - - public LIRHighTierContext(LIRGeneratorTool lirGen) { - this.lirGen = lirGen; - } - - } - - @Override - protected final <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, LIRHighTierContext context) { - run(target, lirGenRes, codeEmittingOrder, linearScanOrder, context.lirGen); - } - - protected abstract <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, LIRGeneratorTool lirGen); - -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRLowTier.java Wed Feb 18 10:37:08 2015 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.phases; - -import com.oracle.graal.lir.*; -import com.oracle.graal.lir.phases.LIRLowTierPhase.*; -import com.oracle.graal.options.*; - -public class LIRLowTier extends LIRPhaseSuite<LIRLowTierContext> { - public static class Options { - // @formatter:off - @Option(help = "", type = OptionType.Debug) - public static final OptionValue<Boolean> LIROptEdgeMoveOptimizer = new OptionValue<>(true); - @Option(help = "", type = OptionType.Debug) - public static final OptionValue<Boolean> LIROptControlFlowOptmizer = new OptionValue<>(true); - @Option(help = "", type = OptionType.Debug) - public static final OptionValue<Boolean> LIROptRedundantMoveElimination = new OptionValue<>(true); - @Option(help = "", type = OptionType.Debug) - public static final OptionValue<Boolean> LIROptNullCheckOptimizer = new OptionValue<>(true); - // @formatter:on - } - - public LIRLowTier() { - if (Options.LIROptEdgeMoveOptimizer.getValue()) { - appendPhase(new EdgeMoveOptimizer()); - } - if (Options.LIROptControlFlowOptmizer.getValue()) { - appendPhase(new ControlFlowOptimizer()); - } - if (Options.LIROptRedundantMoveElimination.getValue()) { - appendPhase(new RedundantMoveElimination()); - } - if (Options.LIROptNullCheckOptimizer.getValue()) { - appendPhase(new NullCheckOptimizer()); - } - } -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRLowTierPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.phases; - -import java.util.*; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.compiler.common.cfg.*; -import com.oracle.graal.lir.gen.*; - -public abstract class LIRLowTierPhase extends LIRPhase<LIRLowTierPhase.LIRLowTierContext> { - - public static final class LIRLowTierContext { - } - - @Override - protected final <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, LIRLowTierContext context) { - run(target, lirGenRes, codeEmittingOrder, linearScanOrder); - } - - protected abstract <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder); - -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRMidTier.java Wed Feb 18 10:37:08 2015 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.phases; - -import com.oracle.graal.lir.alloc.lsra.*; -import com.oracle.graal.lir.phases.LIRMidTierPhase.*; -import com.oracle.graal.lir.stackslotalloc.*; - -public class LIRMidTier extends LIRPhaseSuite<LIRMidTierContext> { - public LIRMidTier() { - appendPhase(new LinearScanPhase()); - - // build frame map - if (LSStackSlotAllocator.Options.LIROptLSStackSlotAllocator.getValue()) { - appendPhase(new LSStackSlotAllocator()); - } else { - appendPhase(new SimpleStackSlotAllocator()); - } - // currently we mark locations only if we do register allocation - appendPhase(new LocationMarker()); - } -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRMidTierPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.lir.phases; - -import java.util.*; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.compiler.common.cfg.*; -import com.oracle.graal.lir.gen.*; - -public abstract class LIRMidTierPhase extends LIRPhase<LIRMidTierPhase.LIRMidTierContext> { - - public static final class LIRMidTierContext { - } - - @Override - protected final <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, LIRMidTierContext context) { - run(target, lirGenRes, codeEmittingOrder, linearScanOrder); - } - - protected abstract <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder); - -}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -73,11 +73,11 @@ memUseTracker = Debug.memUseTracker("LIRPhaseMemUse_%s", getClass()); } - public final <B extends AbstractBlock<B>> void apply(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, C context) { + public final <B extends AbstractBlockBase<B>> void apply(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, C context) { apply(target, lirGenRes, codeEmittingOrder, linearScanOrder, context, true); } - public final <B extends AbstractBlock<B>> void apply(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, C context, boolean dumpLIR) { + public final <B extends AbstractBlockBase<B>> void apply(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, C context, boolean dumpLIR) { try (TimerCloseable a = timer.start(); Scope s = Debug.scope(getName(), this); Closeable c = memUseTracker.start()) { run(target, lirGenRes, codeEmittingOrder, linearScanOrder, context); if (dumpLIR && Debug.isDumpEnabled(PHASE_DUMP_LEVEL)) { @@ -88,7 +88,7 @@ } } - protected abstract <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, C context); + protected abstract <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, C context); protected CharSequence createName() { String className = LIRPhase.this.getClass().getName();
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRPhaseSuite.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRPhaseSuite.java Mon Feb 23 16:23:23 2015 -0800 @@ -69,7 +69,7 @@ } @Override - protected <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, C context) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, C context) { for (LIRPhase<C> phase : phases) { phase.apply(target, lirGenRes, codeEmittingOrder, linearScanOrder, context); }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRSuites.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRSuites.java Mon Feb 23 16:23:23 2015 -0800 @@ -25,54 +25,54 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.gen.*; -import com.oracle.graal.lir.phases.LIRHighTierPhase.LIRHighTierContext; -import com.oracle.graal.lir.phases.LIRLowTierPhase.LIRLowTierContext; -import com.oracle.graal.lir.phases.LIRMidTierPhase.LIRMidTierContext; +import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.PreAllocationOptimizationContext; +import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.PostAllocationOptimizationContext; +import com.oracle.graal.lir.phases.AllocationPhase.AllocationContext; public class LIRSuites { - private final LIRPhaseSuite<LIRHighTierContext> highTier; - private final LIRPhaseSuite<LIRMidTierContext> midTier; - private final LIRPhaseSuite<LIRLowTierContext> lowTier; + private final LIRPhaseSuite<PreAllocationOptimizationContext> preAllocOptStage; + private final LIRPhaseSuite<AllocationContext> allocStage; + private final LIRPhaseSuite<PostAllocationOptimizationContext> postAllocStage; - public LIRSuites(LIRPhaseSuite<LIRHighTierContext> highTier, LIRPhaseSuite<LIRMidTierContext> midTier, LIRPhaseSuite<LIRLowTierContext> lowTier) { - this.highTier = highTier; - this.midTier = midTier; - this.lowTier = lowTier; + public LIRSuites(LIRPhaseSuite<PreAllocationOptimizationContext> preAllocOptStage, LIRPhaseSuite<AllocationContext> allocStage, LIRPhaseSuite<PostAllocationOptimizationContext> postAllocStage) { + this.preAllocOptStage = preAllocOptStage; + this.allocStage = allocStage; + this.postAllocStage = postAllocStage; } /** - * {@link LIRHighTierPhase}s are executed between {@link LIR} generation and register - * allocation. + * {@link PreAllocationOptimizationPhase}s are executed between {@link LIR} generation and + * register allocation. * <p> - * {@link LIRHighTierPhase Implementers} can create new {@link LIRGeneratorTool#newVariable - * variables}, {@link LIRGenerationResult#getFrameMap stack slots} and - * {@link LIRGenerationResult#getFrameMapBuilder virtual stack slots}. + * {@link PreAllocationOptimizationPhase Implementers} can create new + * {@link LIRGeneratorTool#newVariable variables}, {@link LIRGenerationResult#getFrameMap stack + * slots} and {@link LIRGenerationResult#getFrameMapBuilder virtual stack slots}. */ - public LIRPhaseSuite<LIRHighTierContext> getHighTier() { - return highTier; + public LIRPhaseSuite<PreAllocationOptimizationContext> getPreAllocationOptimizationStage() { + return preAllocOptStage; } /** - * {@link LIRMidTierPhase}s are responsible for register allocation and translating + * {@link AllocationPhase}s are responsible for register allocation and translating * {@link VirtualStackSlot}s into {@link StackSlot}s. * <p> - * After the {@link LIRMidTier} there should be no more {@link Variable}s and + * After the {@link AllocationStage} there should be no more {@link Variable}s and * {@link VirtualStackSlot}s. */ - public LIRPhaseSuite<LIRMidTierContext> getMidTier() { - return midTier; + public LIRPhaseSuite<AllocationContext> getAllocationStage() { + return allocStage; } /** - * {@link LIRLowTierPhase}s are executed after register allocation and before machine code - * generation. + * {@link PostAllocationOptimizationPhase}s are executed after register allocation and before + * machine code generation. * <p> - * A {@link LIRLowTierPhase} must not introduce new {@link Variable}s, {@link VirtualStackSlot}s - * or {@link StackSlot}s. + * A {@link PostAllocationOptimizationPhase} must not introduce new {@link Variable}s, + * {@link VirtualStackSlot}s or {@link StackSlot}s. */ - public LIRPhaseSuite<LIRLowTierContext> getLowTier() { - return lowTier; + public LIRPhaseSuite<PostAllocationOptimizationContext> getPostAllocationOptimizationStage() { + return postAllocStage; } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/PostAllocationOptimizationPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.lir.phases; + +import java.util.*; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.compiler.common.cfg.*; +import com.oracle.graal.lir.gen.*; + +public abstract class PostAllocationOptimizationPhase extends LIRPhase<PostAllocationOptimizationPhase.PostAllocationOptimizationContext> { + + public static final class PostAllocationOptimizationContext { + } + + @Override + protected final <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, + PostAllocationOptimizationContext context) { + run(target, lirGenRes, codeEmittingOrder, linearScanOrder); + } + + protected abstract <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder); + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/PostAllocationOptimizationStage.java Mon Feb 23 16:23:23 2015 -0800 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.lir.phases; + +import com.oracle.graal.lir.*; +import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.*; +import com.oracle.graal.options.*; + +public class PostAllocationOptimizationStage extends LIRPhaseSuite<PostAllocationOptimizationContext> { + public static class Options { + // @formatter:off + @Option(help = "", type = OptionType.Debug) + public static final OptionValue<Boolean> LIROptEdgeMoveOptimizer = new OptionValue<>(true); + @Option(help = "", type = OptionType.Debug) + public static final OptionValue<Boolean> LIROptControlFlowOptmizer = new OptionValue<>(true); + @Option(help = "", type = OptionType.Debug) + public static final OptionValue<Boolean> LIROptRedundantMoveElimination = new OptionValue<>(true); + @Option(help = "", type = OptionType.Debug) + public static final OptionValue<Boolean> LIROptNullCheckOptimizer = new OptionValue<>(true); + // @formatter:on + } + + public PostAllocationOptimizationStage() { + if (Options.LIROptEdgeMoveOptimizer.getValue()) { + appendPhase(new EdgeMoveOptimizer()); + } + if (Options.LIROptControlFlowOptmizer.getValue()) { + appendPhase(new ControlFlowOptimizer()); + } + if (Options.LIROptRedundantMoveElimination.getValue()) { + appendPhase(new RedundantMoveElimination()); + } + if (Options.LIROptNullCheckOptimizer.getValue()) { + appendPhase(new NullCheckOptimizer()); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/PreAllocationOptimizationPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.lir.phases; + +import java.util.*; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.compiler.common.cfg.*; +import com.oracle.graal.lir.gen.*; + +public abstract class PreAllocationOptimizationPhase extends LIRPhase<PreAllocationOptimizationPhase.PreAllocationOptimizationContext> { + + public static final class PreAllocationOptimizationContext { + private final LIRGeneratorTool lirGen; + + public PreAllocationOptimizationContext(LIRGeneratorTool lirGen) { + this.lirGen = lirGen; + } + + } + + @Override + protected final <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, + PreAllocationOptimizationContext context) { + run(target, lirGenRes, codeEmittingOrder, linearScanOrder, context.lirGen); + } + + protected abstract <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, LIRGeneratorTool lirGen); + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/PreAllocationOptimizationStage.java Mon Feb 23 16:23:23 2015 -0800 @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.lir.phases; + +import com.oracle.graal.lir.constopt.*; +import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.*; + +public class PreAllocationOptimizationStage extends LIRPhaseSuite<PreAllocationOptimizationContext> { + public PreAllocationOptimizationStage() { + if (ConstantLoadOptimization.Options.LIROptConstantLoadOptimization.getValue()) { + appendPhase(new ConstantLoadOptimization()); + } + } +}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/FixPointIntervalBuilder.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/FixPointIntervalBuilder.java Mon Feb 23 16:23:23 2015 -0800 @@ -65,15 +65,15 @@ * virtual stack slots. */ Set<LIRInstruction> build() { - Deque<AbstractBlock<?>> worklist = new ArrayDeque<>(); + Deque<AbstractBlockBase<?>> worklist = new ArrayDeque<>(); for (int i = lir.getControlFlowGraph().getBlocks().size() - 1; i >= 0; i--) { worklist.add(lir.getControlFlowGraph().getBlocks().get(i)); } - for (AbstractBlock<?> block : lir.getControlFlowGraph().getBlocks()) { + for (AbstractBlockBase<?> block : lir.getControlFlowGraph().getBlocks()) { liveInMap.put(block, new BitSet(stackSlotMap.length)); } while (!worklist.isEmpty()) { - AbstractBlock<?> block = worklist.poll(); + AbstractBlockBase<?> block = worklist.poll(); processBlock(block, worklist); } return usePos; @@ -82,7 +82,7 @@ /** * Merge outSet with in-set of successors. */ - private boolean updateOutBlock(AbstractBlock<?> block) { + private boolean updateOutBlock(AbstractBlockBase<?> block) { BitSet union = new BitSet(stackSlotMap.length); block.getSuccessors().forEach(succ -> union.or(liveInMap.get(succ))); BitSet outSet = liveOutMap.get(block); @@ -94,7 +94,7 @@ return false; } - private void processBlock(AbstractBlock<?> block, Deque<AbstractBlock<?>> worklist) { + private void processBlock(AbstractBlockBase<?> block, Deque<AbstractBlockBase<?>> worklist) { if (updateOutBlock(block)) { try (Indent indent = Debug.logAndIndent("handle block %s", block)) { List<LIRInstruction> instructions = lir.getLIRforBlock(block);
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,6 +38,7 @@ import com.oracle.graal.lir.LIRInstruction.OperandMode; import com.oracle.graal.lir.framemap.*; import com.oracle.graal.lir.gen.*; +import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; import com.oracle.graal.lir.phases.*; import com.oracle.graal.options.*; @@ -51,7 +52,7 @@ * {@link OperandFlag#UNINITIALIZED}. Otherwise the stack slot might be reused and its content * destroyed. */ -public final class LSStackSlotAllocator extends LIRMidTierPhase implements StackSlotAllocator { +public final class LSStackSlotAllocator extends AllocationPhase implements StackSlotAllocator { public static class Options { // @formatter:off @@ -68,7 +69,7 @@ private static final DebugTimer AssignSlotsTimer = Debug.timer("LSStackSlotAllocator[AssignSlots]"); @Override - protected <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { lirGenRes.buildFrameMap(this); } @@ -84,7 +85,7 @@ private final StackInterval[] stackSlotMap; private final PriorityQueue<StackInterval> unhandled; private final PriorityQueue<StackInterval> active; - private final List<? extends AbstractBlock<?>> sortedBlocks; + private final List<? extends AbstractBlockBase<?>> sortedBlocks; private final int maxOpId; private Allocator(LIR lir, FrameMapBuilderTool frameMapBuilder) { @@ -149,10 +150,10 @@ * * @return The id of the last operation. */ - private static int numberInstructions(LIR lir, List<? extends AbstractBlock<?>> sortedBlocks) { + private static int numberInstructions(LIR lir, List<? extends AbstractBlockBase<?>> sortedBlocks) { int opId = 0; int index = 0; - for (AbstractBlock<?> block : sortedBlocks) { + for (AbstractBlockBase<?> block : sortedBlocks) { List<LIRInstruction> instructions = lir.getLIRforBlock(block);
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/SimpleStackSlotAllocator.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/SimpleStackSlotAllocator.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,12 +34,13 @@ import com.oracle.graal.lir.*; import com.oracle.graal.lir.framemap.*; import com.oracle.graal.lir.gen.*; +import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory; import com.oracle.graal.lir.phases.*; -public class SimpleStackSlotAllocator extends LIRMidTierPhase implements StackSlotAllocator { +public class SimpleStackSlotAllocator extends AllocationPhase implements StackSlotAllocator { @Override - protected <B extends AbstractBlock<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder) { + protected <B extends AbstractBlockBase<B>> void run(TargetDescription target, LIRGenerationResult lirGenRes, List<B> codeEmittingOrder, List<B> linearScanOrder, SpillMoveFactory spillMoveFactory) { lirGenRes.buildFrameMap(this); } @@ -75,7 +76,7 @@ } return value; }; - for (AbstractBlock<?> block : res.getLIR().getControlFlowGraph().getBlocks()) { + for (AbstractBlockBase<?> block : res.getLIR().getControlFlowGraph().getBlocks()) { try (Indent indent0 = Debug.logAndIndent("block: %s", block)) { for (LIRInstruction inst : res.getLIR().getLIRforBlock(block)) { try (Indent indent1 = Debug.logAndIndent("Inst: %d: %s", inst.id(), inst)) {
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Mon Feb 23 16:23:23 2015 -0800 @@ -312,9 +312,9 @@ if (newEarlyExit == null) { continue; } - AbstractMergeNode merge = graph.add(new MergeNode()); - AbstractEndNode originalEnd = graph.add(new EndNode()); - AbstractEndNode newEnd = graph.add(new EndNode()); + MergeNode merge = graph.add(new MergeNode()); + EndNode originalEnd = graph.add(new EndNode()); + EndNode newEnd = graph.add(new EndNode()); merge.addForwardEnd(originalEnd); merge.addForwardEnd(newEnd); loopEarlyExit.setNext(originalEnd); @@ -332,7 +332,7 @@ * VirtualState nodes contained in the old exit's state may be shared by other * dominated VirtualStates. Those dominated virtual states need to see the * proxy->phi update that are applied below. - * + * * We now update the original fragment's nodes accordingly: */ originalExitState.applyToVirtual(node -> original.nodes.clearAndGrow(node));
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java Mon Feb 23 16:23:23 2015 -0800 @@ -293,14 +293,14 @@ private AbstractBeginNode mergeEnds() { assert isDuplicate(); - List<AbstractEndNode> endsToMerge = new LinkedList<>(); + List<EndNode> endsToMerge = new LinkedList<>(); // map peel exits to the corresponding loop exits Map<AbstractEndNode, LoopEndNode> reverseEnds = CollectionsFactory.newMap(); LoopBeginNode loopBegin = original().loop().loopBegin(); for (LoopEndNode le : loopBegin.loopEnds()) { AbstractEndNode duplicate = getDuplicatedNode(le); if (duplicate != null) { - endsToMerge.add(duplicate); + endsToMerge.add((EndNode) duplicate); reverseEnds.put(duplicate, le); } } @@ -323,7 +323,7 @@ duplicateState = state.duplicateWithVirtualState(); newExitMerge.setStateAfter(duplicateState); } - for (AbstractEndNode end : endsToMerge) { + for (EndNode end : endsToMerge) { newExitMerge.addForwardEnd(end); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractBeginNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractBeginNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,18 +33,17 @@ import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.util.*; @NodeInfo(allowedUsageTypes = {InputType.Guard, InputType.Anchor}) public abstract class AbstractBeginNode extends FixedWithNextNode implements LIRLowerable, Simplifiable, GuardingNode, AnchoringNode, IterableNodeType { - public static final NodeClass<AbstractBeginNode> TYPE = NodeClass.get(AbstractBeginNode.class); + public static final NodeClass<AbstractBeginNode> TYPE = NodeClass.create(AbstractBeginNode.class); - protected AbstractBeginNode(NodeClass<?> c) { + protected AbstractBeginNode(NodeClass<? extends AbstractBeginNode> c) { this(c, StampFactory.forVoid()); } - protected AbstractBeginNode(NodeClass<?> c, Stamp stamp) { + protected AbstractBeginNode(NodeClass<? extends AbstractBeginNode> c, Stamp stamp) { super(c, stamp); } @@ -64,8 +63,13 @@ } public static AbstractBeginNode prevBegin(FixedNode from) { - for (AbstractBeginNode begin : GraphUtil.predecessorIterable(from).filter(AbstractBeginNode.class)) { - return begin; + Node next = from; + while (next != null) { + if (next instanceof AbstractBeginNode) { + AbstractBeginNode begin = (AbstractBeginNode) next; + return begin; + } + next = next.predecessor(); } return null; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractDeoptimizeNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractDeoptimizeNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,10 +36,10 @@ @NodeInfo public abstract class AbstractDeoptimizeNode extends ControlSinkNode implements IterableNodeType, DeoptimizingNode.DeoptBefore { - public static final NodeClass<AbstractDeoptimizeNode> TYPE = NodeClass.get(AbstractDeoptimizeNode.class); + public static final NodeClass<AbstractDeoptimizeNode> TYPE = NodeClass.create(AbstractDeoptimizeNode.class); @OptionalInput(InputType.State) FrameState stateBefore; - protected AbstractDeoptimizeNode(NodeClass<?> c, FrameState stateBefore) { + protected AbstractDeoptimizeNode(NodeClass<? extends AbstractDeoptimizeNode> c, FrameState stateBefore) { super(c, StampFactory.forVoid()); this.stateBefore = stateBefore; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractEndNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractEndNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,9 +32,9 @@ @NodeInfo public abstract class AbstractEndNode extends FixedNode implements IterableNodeType, LIRLowerable { - public static final NodeClass<AbstractEndNode> TYPE = NodeClass.get(AbstractEndNode.class); + public static final NodeClass<AbstractEndNode> TYPE = NodeClass.create(AbstractEndNode.class); - protected AbstractEndNode(NodeClass<?> c) { + protected AbstractEndNode(NodeClass<? extends AbstractEndNode> c) { super(c, StampFactory.forVoid()); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractFixedGuardNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractFixedGuardNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo public abstract class AbstractFixedGuardNode extends DeoptimizingFixedWithNextNode implements Simplifiable, GuardingNode { - public static final NodeClass<AbstractFixedGuardNode> TYPE = NodeClass.get(AbstractFixedGuardNode.class); + public static final NodeClass<AbstractFixedGuardNode> TYPE = NodeClass.create(AbstractFixedGuardNode.class); @Input(InputType.Condition) protected LogicNode condition; protected final DeoptimizationReason reason; protected final DeoptimizationAction action; @@ -48,7 +48,7 @@ condition = x; } - protected AbstractFixedGuardNode(NodeClass<?> c, LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action, boolean negated) { + protected AbstractFixedGuardNode(NodeClass<? extends AbstractFixedGuardNode> c, LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action, boolean negated) { super(c, StampFactory.forVoid()); this.action = action; this.negated = negated;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractLocalNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractLocalNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,10 +30,10 @@ @NodeInfo public abstract class AbstractLocalNode extends FloatingNode { - public static final NodeClass<AbstractLocalNode> TYPE = NodeClass.get(AbstractLocalNode.class); + public static final NodeClass<AbstractLocalNode> TYPE = NodeClass.create(AbstractLocalNode.class); protected final int index; - protected AbstractLocalNode(NodeClass<?> c, int index, Stamp stamp) { + protected AbstractLocalNode(NodeClass<? extends AbstractLocalNode> c, int index, Stamp stamp) { super(c, stamp); this.index = index; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractMemoryCheckpoint.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractMemoryCheckpoint.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,13 +33,13 @@ @NodeInfo public abstract class AbstractMemoryCheckpoint extends AbstractStateSplit implements MemoryCheckpoint { - public static final NodeClass<AbstractMemoryCheckpoint> TYPE = NodeClass.get(AbstractMemoryCheckpoint.class); + public static final NodeClass<AbstractMemoryCheckpoint> TYPE = NodeClass.create(AbstractMemoryCheckpoint.class); - protected AbstractMemoryCheckpoint(NodeClass<?> c, Stamp stamp) { + protected AbstractMemoryCheckpoint(NodeClass<? extends AbstractMemoryCheckpoint> c, Stamp stamp) { this(c, stamp, null); } - protected AbstractMemoryCheckpoint(NodeClass<?> c, Stamp stamp, FrameState stateAfter) { + protected AbstractMemoryCheckpoint(NodeClass<? extends AbstractMemoryCheckpoint> c, Stamp stamp, FrameState stateAfter) { super(c, stamp, stateAfter); } }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractMergeNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractMergeNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,24 +39,24 @@ */ @NodeInfo(allowedUsageTypes = {InputType.Association}) public abstract class AbstractMergeNode extends BeginStateSplitNode implements IterableNodeType, LIRLowerable { - public static final NodeClass<AbstractMergeNode> TYPE = NodeClass.get(AbstractMergeNode.class); + public static final NodeClass<AbstractMergeNode> TYPE = NodeClass.create(AbstractMergeNode.class); - protected AbstractMergeNode(NodeClass<?> c) { + protected AbstractMergeNode(NodeClass<? extends AbstractMergeNode> c) { super(c); } - @Input(InputType.Association) protected NodeInputList<AbstractEndNode> ends = new NodeInputList<>(this); + @Input(InputType.Association) protected NodeInputList<EndNode> ends = new NodeInputList<>(this); @Override public void generate(NodeLIRBuilderTool gen) { gen.visitMerge(this); } - public int forwardEndIndex(AbstractEndNode end) { + public int forwardEndIndex(EndNode end) { return ends.indexOf(end); } - public void addForwardEnd(AbstractEndNode end) { + public void addForwardEnd(EndNode end) { ends.add(end); } @@ -64,12 +64,12 @@ return ends.size(); } - public AbstractEndNode forwardEndAt(int index) { + public EndNode forwardEndAt(int index) { return ends.get(index); } @Override - public NodeIterable<AbstractEndNode> cfgPredecessors() { + public NodeIterable<EndNode> cfgPredecessors() { return ends; } @@ -113,7 +113,7 @@ ends.clear(); } - public NodeInputList<AbstractEndNode> forwardEnds() { + public NodeInputList<EndNode> forwardEnds() { return ends; } @@ -122,7 +122,7 @@ } public int phiPredecessorIndex(AbstractEndNode pred) { - return forwardEndIndex(pred); + return forwardEndIndex((EndNode) pred); } public AbstractEndNode phiPredecessorAt(int index) { @@ -176,8 +176,9 @@ if (merge instanceof LoopBeginNode) { newEnd = graph().add(new LoopEndNode((LoopBeginNode) merge)); } else { - newEnd = graph().add(new EndNode()); - merge.addForwardEnd(newEnd); + EndNode tmpEnd = graph().add(new EndNode()); + merge.addForwardEnd(tmpEnd); + newEnd = tmpEnd; } for (PhiNode phi : merge.phis()) { ValueNode v = phi.valueAt(origLoopEnd); @@ -213,8 +214,8 @@ } ValuePhiNode returnValuePhi = returnNode.result() == null || !isPhiAtMerge(returnNode.result()) ? null : (ValuePhiNode) returnNode.result(); - List<AbstractEndNode> endNodes = forwardEnds().snapshot(); - for (AbstractEndNode end : endNodes) { + List<EndNode> endNodes = forwardEnds().snapshot(); + for (EndNode end : endNodes) { ReturnNode newReturn = graph().add(new ReturnNode(returnValuePhi == null ? returnNode.result() : returnValuePhi.valueAt(end))); if (tool != null) { tool.addToWorkList(end.predecessor()); @@ -222,7 +223,7 @@ end.replaceAtPredecessor(newReturn); } GraphUtil.killCFG(this); - for (AbstractEndNode end : endNodes) { + for (EndNode end : endNodes) { end.safeDelete(); } for (PhiNode phi : phis) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractStateSplit.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractStateSplit.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,7 @@ @NodeInfo public abstract class AbstractStateSplit extends FixedWithNextNode implements StateSplit { - public static final NodeClass<AbstractStateSplit> TYPE = NodeClass.get(AbstractStateSplit.class); + public static final NodeClass<AbstractStateSplit> TYPE = NodeClass.create(AbstractStateSplit.class); @OptionalInput(InputType.State) protected FrameState stateAfter; public FrameState stateAfter() { @@ -49,11 +49,11 @@ return true; } - protected AbstractStateSplit(NodeClass<?> c, Stamp stamp) { + protected AbstractStateSplit(NodeClass<? extends AbstractStateSplit> c, Stamp stamp) { this(c, stamp, null); } - protected AbstractStateSplit(NodeClass<?> c, Stamp stamp, FrameState stateAfter) { + protected AbstractStateSplit(NodeClass<? extends AbstractStateSplit> c, Stamp stamp, FrameState stateAfter) { super(c, stamp); this.stateAfter = stateAfter; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,7 +29,7 @@ @NodeInfo public final class BeginNode extends AbstractBeginNode { - public static final NodeClass<BeginNode> TYPE = NodeClass.get(BeginNode.class); + public static final NodeClass<BeginNode> TYPE = NodeClass.create(BeginNode.class); public BeginNode() { super(TYPE, StampFactory.forVoid());
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginStateSplitNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginStateSplitNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,14 +36,14 @@ @NodeInfo public abstract class BeginStateSplitNode extends AbstractBeginNode implements StateSplit { - public static final NodeClass<BeginStateSplitNode> TYPE = NodeClass.get(BeginStateSplitNode.class); + public static final NodeClass<BeginStateSplitNode> TYPE = NodeClass.create(BeginStateSplitNode.class); @OptionalInput(InputType.State) protected FrameState stateAfter; - protected BeginStateSplitNode(NodeClass<?> c) { + protected BeginStateSplitNode(NodeClass<? extends BeginStateSplitNode> c) { super(c); } - protected BeginStateSplitNode(NodeClass<?> c, Stamp stamp) { + protected BeginStateSplitNode(NodeClass<? extends BeginStateSplitNode> c, Stamp stamp) { super(c, stamp); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BinaryOpLogicNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BinaryOpLogicNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo public abstract class BinaryOpLogicNode extends LogicNode implements LIRLowerable, Canonicalizable.Binary<ValueNode> { - public static final NodeClass<BinaryOpLogicNode> TYPE = NodeClass.get(BinaryOpLogicNode.class); + public static final NodeClass<BinaryOpLogicNode> TYPE = NodeClass.create(BinaryOpLogicNode.class); @Input protected ValueNode x; @Input protected ValueNode y; @@ -42,7 +42,7 @@ return y; } - public BinaryOpLogicNode(NodeClass<?> c, ValueNode x, ValueNode y) { + public BinaryOpLogicNode(NodeClass<? extends BinaryOpLogicNode> c, ValueNode x, ValueNode y) { super(c); assert x != null && y != null && x.getKind() == y.getKind(); this.x = x;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -48,7 +48,7 @@ @NodeInfo public final class BreakpointNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<BreakpointNode> TYPE = NodeClass.get(BreakpointNode.class); + public static final NodeClass<BreakpointNode> TYPE = NodeClass.create(BreakpointNode.class); @Input NodeInputList<ValueNode> arguments; public BreakpointNode(ValueNode[] arguments) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/CallTargetNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/CallTargetNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Extension}) public abstract class CallTargetNode extends ValueNode implements LIRLowerable { - public static final NodeClass<CallTargetNode> TYPE = NodeClass.get(CallTargetNode.class); + public static final NodeClass<CallTargetNode> TYPE = NodeClass.create(CallTargetNode.class); public enum InvokeKind { Interface(false), @@ -67,14 +67,14 @@ protected ResolvedJavaMethod targetMethod; protected InvokeKind invokeKind; - protected CallTargetNode(NodeClass<?> c, ValueNode[] arguments, ResolvedJavaMethod targetMethod, InvokeKind invokeKind) { + protected CallTargetNode(NodeClass<? extends CallTargetNode> c, ValueNode[] arguments, ResolvedJavaMethod targetMethod, InvokeKind invokeKind) { super(c, StampFactory.forVoid()); this.targetMethod = targetMethod; this.invokeKind = invokeKind; this.arguments = new NodeInputList<>(this, arguments); } - protected CallTargetNode(NodeClass<?> c, List<ValueNode> arguments, ResolvedJavaMethod targetMethod, InvokeKind invokeKind) { + protected CallTargetNode(NodeClass<? extends CallTargetNode> c, List<ValueNode> arguments, ResolvedJavaMethod targetMethod, InvokeKind invokeKind) { super(c, StampFactory.forVoid()); this.targetMethod = targetMethod; this.invokeKind = invokeKind;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConditionAnchorNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConditionAnchorNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,7 @@ @NodeInfo(nameTemplate = "ConditionAnchor(!={p#negated})", allowedUsageTypes = {InputType.Guard}) public final class ConditionAnchorNode extends FixedWithNextNode implements Canonicalizable.Unary<Node>, Lowerable, GuardingNode { - public static final NodeClass<ConditionAnchorNode> TYPE = NodeClass.get(ConditionAnchorNode.class); + public static final NodeClass<ConditionAnchorNode> TYPE = NodeClass.create(ConditionAnchorNode.class); @Input(InputType.Condition) LogicNode condition; protected boolean negated;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,7 +41,7 @@ @NodeInfo(shortName = "Const", nameTemplate = "Const({p#rawvalue})") public final class ConstantNode extends FloatingNode implements LIRLowerable { - public static final NodeClass<ConstantNode> TYPE = NodeClass.get(ConstantNode.class); + public static final NodeClass<ConstantNode> TYPE = NodeClass.create(ConstantNode.class); private static final DebugMetric ConstantNodes = Debug.metric("ConstantNodes"); protected final Constant value;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ControlSinkNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ControlSinkNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -28,9 +28,9 @@ @NodeInfo public abstract class ControlSinkNode extends FixedNode { - public static final NodeClass<ControlSinkNode> TYPE = NodeClass.get(ControlSinkNode.class); + public static final NodeClass<ControlSinkNode> TYPE = NodeClass.create(ControlSinkNode.class); - protected ControlSinkNode(NodeClass<?> c, Stamp stamp) { + protected ControlSinkNode(NodeClass<? extends ControlSinkNode> c, Stamp stamp) { super(c, stamp); } }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ControlSplitNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ControlSplitNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,9 +32,9 @@ */ @NodeInfo public abstract class ControlSplitNode extends FixedNode implements IterableNodeType { - public static final NodeClass<ControlSplitNode> TYPE = NodeClass.get(ControlSplitNode.class); + public static final NodeClass<ControlSplitNode> TYPE = NodeClass.create(ControlSplitNode.class); - protected ControlSplitNode(NodeClass<?> c, Stamp stamp) { + protected ControlSplitNode(NodeClass<? extends ControlSplitNode> c, Stamp stamp) { super(c, stamp); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo(shortName = "Deopt", nameTemplate = "Deopt {p#reason/s}") public final class DeoptimizeNode extends AbstractDeoptimizeNode implements Lowerable, LIRLowerable { - public static final NodeClass<DeoptimizeNode> TYPE = NodeClass.get(DeoptimizeNode.class); + public static final NodeClass<DeoptimizeNode> TYPE = NodeClass.create(DeoptimizeNode.class); protected final DeoptimizationAction action; protected final DeoptimizationReason reason; protected final int debugId;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizingFixedWithNextNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizingFixedWithNextNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,14 +29,14 @@ @NodeInfo public abstract class DeoptimizingFixedWithNextNode extends FixedWithNextNode implements DeoptimizingNode.DeoptBefore { - public static final NodeClass<DeoptimizingFixedWithNextNode> TYPE = NodeClass.get(DeoptimizingFixedWithNextNode.class); + public static final NodeClass<DeoptimizingFixedWithNextNode> TYPE = NodeClass.create(DeoptimizingFixedWithNextNode.class); @OptionalInput(InputType.State) protected FrameState stateBefore; - protected DeoptimizingFixedWithNextNode(NodeClass<?> c, Stamp stamp) { + protected DeoptimizingFixedWithNextNode(NodeClass<? extends DeoptimizingFixedWithNextNode> c, Stamp stamp) { super(c, stamp); } - protected DeoptimizingFixedWithNextNode(NodeClass<?> c, Stamp stamp, FrameState stateBefore) { + protected DeoptimizingFixedWithNextNode(NodeClass<? extends DeoptimizingFixedWithNextNode> c, Stamp stamp, FrameState stateBefore) { super(c, stamp); this.stateBefore = stateBefore; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DirectCallTargetNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DirectCallTargetNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,9 +33,10 @@ @NodeInfo public abstract class DirectCallTargetNode extends LoweredCallTargetNode { - public static final NodeClass<DirectCallTargetNode> TYPE = NodeClass.get(DirectCallTargetNode.class); + public static final NodeClass<DirectCallTargetNode> TYPE = NodeClass.create(DirectCallTargetNode.class); - protected DirectCallTargetNode(NodeClass<?> c, List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, CallingConvention.Type callType, InvokeKind invokeKind) { + protected DirectCallTargetNode(NodeClass<? extends DirectCallTargetNode> c, List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, + CallingConvention.Type callType, InvokeKind invokeKind) { super(c, arguments, returnStamp, signature, target, callType, invokeKind); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DispatchBeginNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DispatchBeginNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,13 +32,13 @@ @NodeInfo public class DispatchBeginNode extends BeginStateSplitNode { - public static final NodeClass<DispatchBeginNode> TYPE = NodeClass.get(DispatchBeginNode.class); + public static final NodeClass<DispatchBeginNode> TYPE = NodeClass.create(DispatchBeginNode.class); public DispatchBeginNode() { super(TYPE); } - protected DispatchBeginNode(NodeClass<?> c, Stamp stamp) { + protected DispatchBeginNode(NodeClass<? extends DispatchBeginNode> c, Stamp stamp) { super(c, stamp); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DynamicDeoptimizeNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DynamicDeoptimizeNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo public final class DynamicDeoptimizeNode extends AbstractDeoptimizeNode implements LIRLowerable, Lowerable, Canonicalizable { - public static final NodeClass<DynamicDeoptimizeNode> TYPE = NodeClass.get(DynamicDeoptimizeNode.class); + public static final NodeClass<DynamicDeoptimizeNode> TYPE = NodeClass.create(DynamicDeoptimizeNode.class); @Input ValueNode actionAndReason; @Input ValueNode speculation;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EndNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EndNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -27,7 +27,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Association}) public final class EndNode extends AbstractEndNode { - public static final NodeClass<EndNode> TYPE = NodeClass.get(EndNode.class); + public static final NodeClass<EndNode> TYPE = NodeClass.create(EndNode.class); public EndNode() { super(TYPE);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryMarkerNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryMarkerNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ */ @NodeInfo(allowedUsageTypes = {InputType.Association}) public final class EntryMarkerNode extends BeginStateSplitNode implements IterableNodeType, Simplifiable, LIRLowerable { - public static final NodeClass<EntryMarkerNode> TYPE = NodeClass.get(EntryMarkerNode.class); + public static final NodeClass<EntryMarkerNode> TYPE = NodeClass.create(EntryMarkerNode.class); public EntryMarkerNode() { super(TYPE);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo(nameTemplate = "FixedGuard(!={p#negated}) {p#reason/s}", allowedUsageTypes = {InputType.Guard}) public final class FixedGuardNode extends AbstractFixedGuardNode implements Lowerable, IterableNodeType { - public static final NodeClass<FixedGuardNode> TYPE = NodeClass.get(FixedGuardNode.class); + public static final NodeClass<FixedGuardNode> TYPE = NodeClass.create(FixedGuardNode.class); public FixedGuardNode(LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action) { this(condition, deoptReason, action, false);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -28,9 +28,9 @@ @NodeInfo public abstract class FixedNode extends ValueNode { - public static final NodeClass<FixedNode> TYPE = NodeClass.get(FixedNode.class); + public static final NodeClass<FixedNode> TYPE = NodeClass.create(FixedNode.class); - protected FixedNode(NodeClass<?> c, Stamp stamp) { + protected FixedNode(NodeClass<? extends FixedNode> c, Stamp stamp) { super(c, stamp); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedWithNextNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedWithNextNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,7 @@ */ @NodeInfo public abstract class FixedWithNextNode extends FixedNode { - public static final NodeClass<FixedWithNextNode> TYPE = NodeClass.get(FixedWithNextNode.class); + public static final NodeClass<FixedWithNextNode> TYPE = NodeClass.create(FixedWithNextNode.class); @Successor protected FixedNode next; @@ -45,7 +45,7 @@ next = x; } - public FixedWithNextNode(NodeClass<?> c, Stamp stamp) { + public FixedWithNextNode(NodeClass<? extends FixedWithNextNode> c, Stamp stamp) { super(c, stamp); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FloatingAnchoredNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FloatingAnchoredNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,15 +30,15 @@ @NodeInfo public abstract class FloatingAnchoredNode extends FloatingNode { - public static final NodeClass<FloatingAnchoredNode> TYPE = NodeClass.get(FloatingAnchoredNode.class); + public static final NodeClass<FloatingAnchoredNode> TYPE = NodeClass.create(FloatingAnchoredNode.class); @Input(InputType.Anchor) protected AnchoringNode anchor; - public FloatingAnchoredNode(NodeClass<?> c, Stamp stamp) { + public FloatingAnchoredNode(NodeClass<? extends FloatingAnchoredNode> c, Stamp stamp) { super(c, stamp); } - public FloatingAnchoredNode(NodeClass<?> c, Stamp stamp, AnchoringNode anchor) { + public FloatingAnchoredNode(NodeClass<? extends FloatingAnchoredNode> c, Stamp stamp, AnchoringNode anchor) { super(c, stamp); this.anchor = anchor; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FloatingGuardedNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FloatingGuardedNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,15 +30,15 @@ @NodeInfo public abstract class FloatingGuardedNode extends FloatingNode implements GuardedNode { - public static final NodeClass<FloatingGuardedNode> TYPE = NodeClass.get(FloatingGuardedNode.class); + public static final NodeClass<FloatingGuardedNode> TYPE = NodeClass.create(FloatingGuardedNode.class); @OptionalInput(InputType.Guard) protected GuardingNode guard; - protected FloatingGuardedNode(NodeClass<?> c, Stamp stamp) { + protected FloatingGuardedNode(NodeClass<? extends FloatingGuardedNode> c, Stamp stamp) { super(c, stamp); } - protected FloatingGuardedNode(NodeClass<?> c, Stamp stamp, GuardingNode guard) { + protected FloatingGuardedNode(NodeClass<? extends FloatingGuardedNode> c, Stamp stamp, GuardingNode guard) { super(c, stamp); this.guard = guard; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java Mon Feb 23 16:23:23 2015 -0800 @@ -42,7 +42,7 @@ */ @NodeInfo(nameTemplate = "FrameState@{p#method/s}:{p#bci}") public final class FrameState extends VirtualState implements IterableNodeType { - public static final NodeClass<FrameState> TYPE = NodeClass.get(FrameState.class); + public static final NodeClass<FrameState> TYPE = NodeClass.create(FrameState.class); private static final DebugMetric METRIC_FRAMESTATE_COUNT = Debug.metric("FrameStateCount");
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FullInfopointNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FullInfopointNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,7 @@ */ @NodeInfo public final class FullInfopointNode extends InfopointNode implements LIRLowerable, NodeWithState { - public static final NodeClass<FullInfopointNode> TYPE = NodeClass.get(FullInfopointNode.class); + public static final NodeClass<FullInfopointNode> TYPE = NodeClass.create(FullInfopointNode.class); @Input(InputType.State) FrameState state; public FullInfopointNode(InfopointReason reason, FrameState state) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -44,7 +44,7 @@ @NodeInfo(nameTemplate = "Guard(!={p#negated}) {p#reason/s}", allowedUsageTypes = {InputType.Guard}) public class GuardNode extends FloatingAnchoredNode implements Canonicalizable, GuardingNode { - public static final NodeClass<GuardNode> TYPE = NodeClass.get(GuardNode.class); + public static final NodeClass<GuardNode> TYPE = NodeClass.create(GuardNode.class); @Input(InputType.Condition) protected LogicNode condition; protected final DeoptimizationReason reason; protected JavaConstant speculation; @@ -55,7 +55,7 @@ this(TYPE, condition, anchor, reason, action, negated, speculation); } - protected GuardNode(NodeClass<?> c, LogicNode condition, AnchoringNode anchor, DeoptimizationReason reason, DeoptimizationAction action, boolean negated, JavaConstant speculation) { + protected GuardNode(NodeClass<? extends GuardNode> c, LogicNode condition, AnchoringNode anchor, DeoptimizationReason reason, DeoptimizationAction action, boolean negated, JavaConstant speculation) { super(c, StampFactory.forVoid(), anchor); this.condition = condition; this.reason = reason;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardPhiNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardPhiNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo(nameTemplate = "GuardPhi({i#values})", allowedUsageTypes = {InputType.Guard}) public final class GuardPhiNode extends PhiNode implements GuardingNode { - public static final NodeClass<GuardPhiNode> TYPE = NodeClass.get(GuardPhiNode.class); + public static final NodeClass<GuardPhiNode> TYPE = NodeClass.create(GuardPhiNode.class); @OptionalInput(InputType.Guard) NodeInputList<ValueNode> values; public GuardPhiNode(AbstractMergeNode merge) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardProxyNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardProxyNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Guard}) public final class GuardProxyNode extends ProxyNode implements GuardingNode, Proxy, LIRLowerable { - public static final NodeClass<GuardProxyNode> TYPE = NodeClass.get(GuardProxyNode.class); + public static final NodeClass<GuardProxyNode> TYPE = NodeClass.create(GuardProxyNode.class); @Input(InputType.Guard) GuardingNode value; public GuardProxyNode(GuardingNode value, AbstractBeginNode proxyPoint) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardedValueNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardedValueNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class GuardedValueNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, IterableNodeType, Canonicalizable, ValueProxy { - public static final NodeClass<GuardedValueNode> TYPE = NodeClass.get(GuardedValueNode.class); + public static final NodeClass<GuardedValueNode> TYPE = NodeClass.create(GuardedValueNode.class); @Input ValueNode object; protected final Stamp piStamp;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -42,7 +42,7 @@ @NodeInfo(nameTemplate = "GuardingPi(!={p#negated}) {p#reason/s}") public final class GuardingPiNode extends FixedWithNextNode implements Lowerable, Virtualizable, Canonicalizable, ValueProxy { - public static final NodeClass<GuardingPiNode> TYPE = NodeClass.get(GuardingPiNode.class); + public static final NodeClass<GuardingPiNode> TYPE = NodeClass.create(GuardingPiNode.class); @Input ValueNode object; @Input(InputType.Condition) LogicNode condition; protected final DeoptimizationReason reason;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -22,8 +22,6 @@ */ package com.oracle.graal.nodes; -import static com.oracle.graal.graph.Edges.Type.*; - import java.util.*; import com.oracle.graal.api.meta.*; @@ -48,7 +46,7 @@ */ @NodeInfo public final class IfNode extends ControlSplitNode implements Simplifiable, LIRLowerable { - public static final NodeClass<IfNode> TYPE = NodeClass.get(IfNode.class); + public static final NodeClass<IfNode> TYPE = NodeClass.create(IfNode.class); private static final DebugMetric CORRECTED_PROBABILITIES = Debug.metric("CorrectedProbabilities"); @@ -237,7 +235,7 @@ FixedWithNextNode falseNext = (FixedWithNextNode) falseSucc.next(); NodeClass<?> nodeClass = trueNext.getNodeClass(); if (trueNext.getClass() == falseNext.getClass()) { - if (nodeClass.getEdges(Inputs).areEqualIn(trueNext, falseNext) && trueNext.valueEquals(falseNext)) { + if (nodeClass.getInputEdges().areEqualIn(trueNext, falseNext) && trueNext.valueEquals(falseNext)) { falseNext.replaceAtUsages(trueNext); graph().removeFixed(falseNext); GraphUtil.unlinkFixedNode(trueNext); @@ -601,7 +599,6 @@ * Multiple phis but merging same values for true and false, so simply delete * the path */ - tool.addToWorkList(condition()); removeThroughFalseBranch(tool); return true; } else if (distinct == 1) { @@ -644,6 +641,9 @@ AbstractBeginNode trueBegin = trueSuccessor(); graph().removeSplitPropagate(this, trueBegin, tool); tool.addToWorkList(trueBegin); + if (condition().isAlive() && condition().hasNoUsages()) { + GraphUtil.killWithUnusedFloatingInputs(condition()); + } } private ConditionalNode canonicalizeConditionalCascade(ValueNode trueValue, ValueNode falseValue) { @@ -748,7 +748,7 @@ MergeNode falseMerge = null; assert merge.stateAfter() == null; - for (AbstractEndNode end : merge.forwardEnds().snapshot()) { + for (EndNode end : merge.forwardEnds().snapshot()) { Node value = phi.valueAt(end); Node result = null; if (condition() instanceof Canonicalizable.Binary<?>) { @@ -904,7 +904,7 @@ } } - List<AbstractEndNode> mergePredecessors = merge.cfgPredecessors().snapshot(); + List<EndNode> mergePredecessors = merge.cfgPredecessors().snapshot(); assert phi.valueCount() == merge.forwardEndCount(); Constant[] xs = constantValues(compare.getX(), merge, false); @@ -918,8 +918,8 @@ return false; } - List<AbstractEndNode> falseEnds = new ArrayList<>(mergePredecessors.size()); - List<AbstractEndNode> trueEnds = new ArrayList<>(mergePredecessors.size()); + List<EndNode> falseEnds = new ArrayList<>(mergePredecessors.size()); + List<EndNode> trueEnds = new ArrayList<>(mergePredecessors.size()); Map<AbstractEndNode, ValueNode> phiValues = CollectionsFactory.newMap(mergePredecessors.size()); AbstractBeginNode oldFalseSuccessor = falseSuccessor(); @@ -928,9 +928,9 @@ setFalseSuccessor(null); setTrueSuccessor(null); - Iterator<AbstractEndNode> ends = mergePredecessors.iterator(); + Iterator<EndNode> ends = mergePredecessors.iterator(); for (int i = 0; i < xs.length; i++) { - AbstractEndNode end = ends.next(); + EndNode end = ends.next(); phiValues.put(end, phi.valueAt(end)); if (compare.condition().foldCondition(xs[i], ys[i], tool.getConstantReflection(), compare.unorderedIsTrue())) { trueEnds.add(end); @@ -1060,7 +1060,7 @@ * @param oldMerge the merge being removed * @param phiValues the values of the phi at the merge, keyed by the merge ends */ - private void connectEnds(List<AbstractEndNode> ends, Map<AbstractEndNode, ValueNode> phiValues, AbstractBeginNode successor, AbstractMergeNode oldMerge, SimplifierTool tool) { + private void connectEnds(List<EndNode> ends, Map<AbstractEndNode, ValueNode> phiValues, AbstractBeginNode successor, AbstractMergeNode oldMerge, SimplifierTool tool) { if (!ends.isEmpty()) { if (ends.size() == 1) { AbstractEndNode end = ends.get(0); @@ -1074,7 +1074,7 @@ PhiNode oldPhi = (PhiNode) oldMerge.usages().first(); PhiNode newPhi = graph().addWithoutUnique(new ValuePhiNode(oldPhi.stamp(), newMerge)); - for (AbstractEndNode end : ends) { + for (EndNode end : ends) { newPhi.addInput(phiValues.get(end)); newMerge.addForwardEnd(end); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IndirectCallTargetNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IndirectCallTargetNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,12 +32,12 @@ @NodeInfo public abstract class IndirectCallTargetNode extends LoweredCallTargetNode { - public static final NodeClass<IndirectCallTargetNode> TYPE = NodeClass.get(IndirectCallTargetNode.class); + public static final NodeClass<IndirectCallTargetNode> TYPE = NodeClass.create(IndirectCallTargetNode.class); @Input protected ValueNode computedAddress; - protected IndirectCallTargetNode(NodeClass<?> c, ValueNode computedAddress, List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, - CallingConvention.Type callType, InvokeKind invokeKind) { + protected IndirectCallTargetNode(NodeClass<? extends IndirectCallTargetNode> c, ValueNode computedAddress, List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, + ResolvedJavaMethod target, CallingConvention.Type callType, InvokeKind invokeKind) { super(c, arguments, returnStamp, signature, target, callType, invokeKind); this.computedAddress = computedAddress; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InfopointNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InfopointNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,10 +29,10 @@ @NodeInfo public abstract class InfopointNode extends FixedWithNextNode { - public static final NodeClass<InfopointNode> TYPE = NodeClass.get(InfopointNode.class); + public static final NodeClass<InfopointNode> TYPE = NodeClass.create(InfopointNode.class); protected final InfopointReason reason; - public InfopointNode(NodeClass<?> c, InfopointReason reason) { + public InfopointNode(NodeClass<? extends InfopointNode> c, InfopointReason reason) { super(c, StampFactory.forVoid()); this.reason = reason; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ */ @NodeInfo(nameTemplate = "Invoke#{p#targetMethod/s}", allowedUsageTypes = {InputType.Memory}) public final class InvokeNode extends AbstractMemoryCheckpoint implements Invoke, LIRLowerable, MemoryCheckpoint.Single { - public static final NodeClass<InvokeNode> TYPE = NodeClass.get(InvokeNode.class); + public static final NodeClass<InvokeNode> TYPE = NodeClass.create(InvokeNode.class); @Input(InputType.Extension) CallTargetNode callTarget; @OptionalInput(InputType.State) FrameState stateDuring;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo(nameTemplate = "Invoke!#{p#targetMethod/s}", allowedUsageTypes = {InputType.Memory}) public final class InvokeWithExceptionNode extends ControlSplitNode implements Invoke, MemoryCheckpoint.Single, LIRLowerable { - public static final NodeClass<InvokeWithExceptionNode> TYPE = NodeClass.get(InvokeWithExceptionNode.class); + public static final NodeClass<InvokeWithExceptionNode> TYPE = NodeClass.create(InvokeWithExceptionNode.class); private static final double EXCEPTION_PROBA = 1e-5;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/KillingBeginNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/KillingBeginNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class KillingBeginNode extends AbstractBeginNode implements MemoryCheckpoint.Single { - public static final NodeClass<KillingBeginNode> TYPE = NodeClass.get(KillingBeginNode.class); + public static final NodeClass<KillingBeginNode> TYPE = NodeClass.create(KillingBeginNode.class); protected LocationIdentity locationIdentity; public KillingBeginNode(LocationIdentity locationIdentity) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicConstantNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicConstantNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,7 @@ @NodeInfo(nameTemplate = "{p#value}") public final class LogicConstantNode extends LogicNode implements LIRLowerable { - public static final NodeClass<LogicConstantNode> TYPE = NodeClass.get(LogicConstantNode.class); + public static final NodeClass<LogicConstantNode> TYPE = NodeClass.create(LogicConstantNode.class); protected final boolean value; public LogicConstantNode(boolean value) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNegationNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNegationNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,7 @@ @NodeInfo public final class LogicNegationNode extends LogicNode implements Canonicalizable.Unary<LogicNode> { - public static final NodeClass<LogicNegationNode> TYPE = NodeClass.get(LogicNegationNode.class); + public static final NodeClass<LogicNegationNode> TYPE = NodeClass.create(LogicNegationNode.class); @Input(InputType.Condition) LogicNode value; public LogicNegationNode(LogicNode value) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,9 +32,9 @@ @NodeInfo(allowedUsageTypes = {Condition}) public abstract class LogicNode extends FloatingNode { - public static final NodeClass<LogicNode> TYPE = NodeClass.get(LogicNode.class); + public static final NodeClass<LogicNode> TYPE = NodeClass.create(LogicNode.class); - public LogicNode(NodeClass<?> c) { + public LogicNode(NodeClass<? extends LogicNode> c) { super(c, StampFactory.forVoid()); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class LoopBeginNode extends AbstractMergeNode implements IterableNodeType, LIRLowerable { - public static final NodeClass<LoopBeginNode> TYPE = NodeClass.get(LoopBeginNode.class); + public static final NodeClass<LoopBeginNode> TYPE = NodeClass.create(LoopBeginNode.class); protected double loopFrequency; protected int nextEndIndex; protected int unswitches; @@ -98,16 +98,12 @@ * * @return the set of {@code LoopEndNode} that correspond to back-edges for this loop */ - public List<LoopEndNode> orderedLoopEnds() { - List<LoopEndNode> snapshot = loopEnds().snapshot(); - Collections.sort(snapshot, new Comparator<LoopEndNode>() { - - @Override - public int compare(LoopEndNode o1, LoopEndNode o2) { - return o1.endIndex() - o2.endIndex(); - } - }); - return snapshot; + public LoopEndNode[] orderedLoopEnds() { + LoopEndNode[] result = new LoopEndNode[this.getLoopEndCount()]; + for (LoopEndNode end : loopEnds()) { + result[end.endIndex()] = end; + } + return result; } public AbstractEndNode forwardEnd() { @@ -153,7 +149,7 @@ return loopEnd.endIndex() + forwardEndCount(); } } else { - return super.forwardEndIndex(pred); + return super.forwardEndIndex((EndNode) pred); } throw ValueNodeUtil.shouldNotReachHere("unknown pred : " + pred); } @@ -183,6 +179,10 @@ return nextEndIndex++; } + public int getLoopEndCount() { + return nextEndIndex; + } + public int unswitches() { return unswitches; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopEndNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopEndNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public final class LoopEndNode extends AbstractEndNode { - public static final NodeClass<LoopEndNode> TYPE = NodeClass.get(LoopEndNode.class); + public static final NodeClass<LoopEndNode> TYPE = NodeClass.create(LoopEndNode.class); @Input(InputType.Association) LoopBeginNode loopBegin; protected boolean canSafepoint; protected int endIndex;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopExitNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopExitNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,7 +29,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Association}) public final class LoopExitNode extends BeginStateSplitNode implements IterableNodeType { - public static final NodeClass<LoopExitNode> TYPE = NodeClass.get(LoopExitNode.class); + public static final NodeClass<LoopExitNode> TYPE = NodeClass.create(LoopExitNode.class); @Input(InputType.Association) LoopBeginNode loopBegin; public LoopExitNode(LoopBeginNode loop) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoweredCallTargetNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoweredCallTargetNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,13 +33,13 @@ @NodeInfo public abstract class LoweredCallTargetNode extends CallTargetNode { - public static final NodeClass<LoweredCallTargetNode> TYPE = NodeClass.get(LoweredCallTargetNode.class); + public static final NodeClass<LoweredCallTargetNode> TYPE = NodeClass.create(LoweredCallTargetNode.class); protected final Stamp returnStamp; protected final JavaType[] signature; protected final CallingConvention.Type callType; - protected LoweredCallTargetNode(NodeClass<?> c, List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, CallingConvention.Type callType, - InvokeKind invokeKind) { + protected LoweredCallTargetNode(NodeClass<? extends LoweredCallTargetNode> c, List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, + CallingConvention.Type callType, InvokeKind invokeKind) { super(c, arguments, target, invokeKind); this.returnStamp = returnStamp; this.signature = signature;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryMapNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryMapNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Extension}) public final class MemoryMapNode extends FloatingNode implements MemoryMap, LIRLowerable { - public static final NodeClass<MemoryMapNode> TYPE = NodeClass.get(MemoryMapNode.class); + public static final NodeClass<MemoryMapNode> TYPE = NodeClass.create(MemoryMapNode.class); protected final List<LocationIdentity> locationIdentities; @Input(InputType.Memory) NodeInputList<ValueNode> nodes;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryPhiNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryPhiNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo(nameTemplate = "MemoryPhi({i#values}) {p#locationIdentity/s}", allowedUsageTypes = {InputType.Memory}) public final class MemoryPhiNode extends PhiNode implements MemoryNode { - public static final NodeClass<MemoryPhiNode> TYPE = NodeClass.get(MemoryPhiNode.class); + public static final NodeClass<MemoryPhiNode> TYPE = NodeClass.create(MemoryPhiNode.class); @Input(InputType.Memory) NodeInputList<ValueNode> values; protected final LocationIdentity locationIdentity;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo public final class MergeNode extends AbstractMergeNode { - public static final NodeClass<MergeNode> TYPE = NodeClass.get(MergeNode.class); + public static final NodeClass<MergeNode> TYPE = NodeClass.create(MergeNode.class); public MergeNode() { super(TYPE);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ParameterNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ParameterNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo(nameTemplate = "Param({p#index})") public final class ParameterNode extends AbstractLocalNode implements IterableNodeType, UncheckedInterfaceProvider { - public static final NodeClass<ParameterNode> TYPE = NodeClass.get(ParameterNode.class); + public static final NodeClass<ParameterNode> TYPE = NodeClass.create(ParameterNode.class); public ParameterNode(int index, Stamp stamp) { super(TYPE, index, stamp);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,10 +41,10 @@ @NodeInfo public abstract class PhiNode extends FloatingNode implements Simplifiable { - public static final NodeClass<PhiNode> TYPE = NodeClass.get(PhiNode.class); + public static final NodeClass<PhiNode> TYPE = NodeClass.create(PhiNode.class); @Input(InputType.Association) protected AbstractMergeNode merge; - protected PhiNode(NodeClass<?> c, Stamp stamp, AbstractMergeNode merge) { + protected PhiNode(NodeClass<? extends PhiNode> c, Stamp stamp, AbstractMergeNode merge) { super(c, stamp); this.merge = merge; } @@ -145,7 +145,7 @@ @NodeInfo static final class MultipleValuesNode extends ValueNode { - public static final NodeClass<MultipleValuesNode> TYPE = NodeClass.get(MultipleValuesNode.class); + public static final NodeClass<MultipleValuesNode> TYPE = NodeClass.create(MultipleValuesNode.class); public MultipleValuesNode() { super(TYPE, null);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiArrayNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiArrayNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo public final class PiArrayNode extends PiNode implements ArrayLengthProvider { - public static final NodeClass<PiArrayNode> TYPE = NodeClass.get(PiArrayNode.class); + public static final NodeClass<PiArrayNode> TYPE = NodeClass.create(PiArrayNode.class); @Input ValueNode length; public ValueNode length() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -44,7 +44,7 @@ @NodeInfo public class PiNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, IterableNodeType, Canonicalizable, ValueProxy { - public static final NodeClass<PiNode> TYPE = NodeClass.get(PiNode.class); + public static final NodeClass<PiNode> TYPE = NodeClass.create(PiNode.class); @Input ValueNode object; protected final Stamp piStamp; @@ -52,7 +52,7 @@ return object; } - protected PiNode(NodeClass<?> c, ValueNode object, Stamp stamp) { + protected PiNode(NodeClass<? extends PiNode> c, ValueNode object, Stamp stamp) { super(c, stamp, null); this.object = object; this.piStamp = stamp;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,10 +36,10 @@ @NodeInfo public abstract class ProxyNode extends FloatingNode implements IterableNodeType, ValueNumberable { - public static final NodeClass<ProxyNode> TYPE = NodeClass.get(ProxyNode.class); + public static final NodeClass<ProxyNode> TYPE = NodeClass.create(ProxyNode.class); @Input(InputType.Association) AbstractBeginNode proxyPoint; - protected ProxyNode(NodeClass<?> c, Stamp stamp, AbstractBeginNode proxyPoint) { + protected ProxyNode(NodeClass<? extends ProxyNode> c, Stamp stamp, AbstractBeginNode proxyPoint) { super(c, stamp); assert proxyPoint != null; this.proxyPoint = proxyPoint;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ReturnNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ReturnNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo public final class ReturnNode extends ControlSinkNode implements LIRLowerable, IterableNodeType { - public static final NodeClass<ReturnNode> TYPE = NodeClass.get(ReturnNode.class); + public static final NodeClass<ReturnNode> TYPE = NodeClass.create(ReturnNode.class); @OptionalInput ValueNode result; @OptionalInput(InputType.Extension) MemoryMapNode memoryMap;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SafepointNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SafepointNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo public final class SafepointNode extends DeoptimizingFixedWithNextNode implements LIRLowerable { - public static final NodeClass<SafepointNode> TYPE = NodeClass.get(SafepointNode.class); + public static final NodeClass<SafepointNode> TYPE = NodeClass.create(SafepointNode.class); public SafepointNode() { super(TYPE, StampFactory.forVoid());
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ShortCircuitOrNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ShortCircuitOrNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,7 +29,7 @@ @NodeInfo public final class ShortCircuitOrNode extends LogicNode implements IterableNodeType, Canonicalizable.Binary<LogicNode> { - public static final NodeClass<ShortCircuitOrNode> TYPE = NodeClass.get(ShortCircuitOrNode.class); + public static final NodeClass<ShortCircuitOrNode> TYPE = NodeClass.create(ShortCircuitOrNode.class); @Input(InputType.Condition) LogicNode x; @Input(InputType.Condition) LogicNode y; protected boolean xNegated;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimpleInfopointNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimpleInfopointNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo public final class SimpleInfopointNode extends InfopointNode implements LIRLowerable, IterableNodeType, Simplifiable { - public static final NodeClass<SimpleInfopointNode> TYPE = NodeClass.get(SimpleInfopointNode.class); + public static final NodeClass<SimpleInfopointNode> TYPE = NodeClass.create(SimpleInfopointNode.class); protected BytecodePosition position; public SimpleInfopointNode(InfopointReason reason, BytecodePosition position) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,9 +32,9 @@ */ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public class StartNode extends BeginStateSplitNode implements MemoryCheckpoint.Single { - public static final NodeClass<StartNode> TYPE = NodeClass.get(StartNode.class); + public static final NodeClass<StartNode> TYPE = NodeClass.create(StartNode.class); - protected StartNode(NodeClass<?> c) { + protected StartNode(NodeClass<? extends StartNode> c) { super(c); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class TypeProfileProxyNode extends UnaryNode implements IterableNodeType, ValueProxy { - public static final NodeClass<TypeProfileProxyNode> TYPE = NodeClass.get(TypeProfileProxyNode.class); + public static final NodeClass<TypeProfileProxyNode> TYPE = NodeClass.create(TypeProfileProxyNode.class); protected final JavaTypeProfile profile; protected transient ResolvedJavaType lastCheckedType; protected transient JavaTypeProfile lastCheckedProfile;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnaryOpLogicNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnaryOpLogicNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,14 +30,14 @@ @NodeInfo public abstract class UnaryOpLogicNode extends LogicNode implements LIRLowerable, Canonicalizable.Unary<ValueNode> { - public static final NodeClass<UnaryOpLogicNode> TYPE = NodeClass.get(UnaryOpLogicNode.class); + public static final NodeClass<UnaryOpLogicNode> TYPE = NodeClass.create(UnaryOpLogicNode.class); @Input protected ValueNode value; public ValueNode getValue() { return value; } - public UnaryOpLogicNode(NodeClass<?> c, ValueNode value) { + public UnaryOpLogicNode(NodeClass<? extends UnaryOpLogicNode> c, ValueNode value) { super(c); assert value != null; this.value = value;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo public final class UnwindNode extends ControlSinkNode implements Lowerable, LIRLowerable { - public static final NodeClass<UnwindNode> TYPE = NodeClass.get(UnwindNode.class); + public static final NodeClass<UnwindNode> TYPE = NodeClass.create(UnwindNode.class); @Input ValueNode exception; public ValueNode exception() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,14 +35,14 @@ @NodeInfo public abstract class ValueNode extends com.oracle.graal.graph.Node implements KindProvider { - public static final NodeClass<ValueNode> TYPE = NodeClass.get(ValueNode.class); + public static final NodeClass<ValueNode> TYPE = NodeClass.create(ValueNode.class); /** * The kind of this value. This is {@link Kind#Void} for instructions that produce no value. * This kind is guaranteed to be a {@linkplain Kind#getStackKind() stack kind}. */ protected Stamp stamp; - public ValueNode(NodeClass<?> c, Stamp stamp) { + public ValueNode(NodeClass<? extends ValueNode> c, Stamp stamp) { super(c); this.stamp = stamp; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNodeUtil.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNodeUtil.java Mon Feb 23 16:23:23 2015 -0800 @@ -88,7 +88,7 @@ * Converts a given instruction to a value string. The representation of an node as a value is * formed by concatenating the {@linkplain com.oracle.graal.api.meta.Kind#getTypeChar character} * denoting its {@linkplain ValueNode#getKind kind} and its id. For example, {@code "i13"}. - * + * * @param value the instruction to convert to a value string. If {@code value == null}, then "-" * is returned. * @return the instruction representation as a string
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValuePhiNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValuePhiNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,14 +33,14 @@ @NodeInfo(nameTemplate = "ValuePhi({i#values})") public class ValuePhiNode extends PhiNode { - public static final NodeClass<ValuePhiNode> TYPE = NodeClass.get(ValuePhiNode.class); + public static final NodeClass<ValuePhiNode> TYPE = NodeClass.create(ValuePhiNode.class); @Input protected NodeInputList<ValueNode> values; public ValuePhiNode(Stamp stamp, AbstractMergeNode merge) { this(TYPE, stamp, merge); } - protected ValuePhiNode(NodeClass<?> c, Stamp stamp, AbstractMergeNode merge) { + protected ValuePhiNode(NodeClass<? extends ValuePhiNode> c, Stamp stamp, AbstractMergeNode merge) { super(c, stamp, merge); assert stamp != StampFactory.forVoid(); values = new NodeInputList<>(this);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo public final class ValueProxyNode extends ProxyNode implements Canonicalizable, Virtualizable, ValueProxy { - public static final NodeClass<ValueProxyNode> TYPE = NodeClass.get(ValueProxyNode.class); + public static final NodeClass<ValueProxyNode> TYPE = NodeClass.create(ValueProxyNode.class); @Input ValueNode value; public ValueProxyNode(ValueNode value, AbstractBeginNode proxyPoint) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/VirtualState.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/VirtualState.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,11 +32,11 @@ @NodeInfo(allowedUsageTypes = {InputType.State}) public abstract class VirtualState extends Node { - protected VirtualState(NodeClass<?> c) { + protected VirtualState(NodeClass<? extends VirtualState> c) { super(c); } - public static final NodeClass<VirtualState> TYPE = NodeClass.get(VirtualState.class); + public static final NodeClass<VirtualState> TYPE = NodeClass.create(VirtualState.class); public abstract static class NodeClosure<T extends Node> {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AbsNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AbsNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ */ @NodeInfo public final class AbsNode extends UnaryArithmeticNode<Abs> implements ArithmeticLIRLowerable, NarrowableArithmeticNode { - public static final NodeClass<AbsNode> TYPE = NodeClass.get(AbsNode.class); + public static final NodeClass<AbsNode> TYPE = NodeClass.create(AbsNode.class); public AbsNode(ValueNode x) { super(TYPE, ArithmeticOpTable::getAbs, x);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AddNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AddNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,13 +36,13 @@ @NodeInfo(shortName = "+") public class AddNode extends BinaryArithmeticNode<Add> implements NarrowableArithmeticNode { - public static final NodeClass<AddNode> TYPE = NodeClass.get(AddNode.class); + public static final NodeClass<AddNode> TYPE = NodeClass.create(AddNode.class); public AddNode(ValueNode x, ValueNode y) { this(TYPE, x, y); } - protected AddNode(NodeClass<?> c, ValueNode x, ValueNode y) { + protected AddNode(NodeClass<? extends AddNode> c, ValueNode x, ValueNode y) { super(c, ArithmeticOpTable::getAdd, x, y); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo(shortName = "&") public final class AndNode extends BinaryArithmeticNode<And> implements NarrowableArithmeticNode { - public static final NodeClass<AndNode> TYPE = NodeClass.get(AndNode.class); + public static final NodeClass<AndNode> TYPE = NodeClass.create(AndNode.class); public AndNode(ValueNode x, ValueNode y) { super(TYPE, ArithmeticOpTable::getAnd, x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryArithmeticNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryArithmeticNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,14 +39,14 @@ @NodeInfo public abstract class BinaryArithmeticNode<OP> extends BinaryNode implements ArithmeticLIRLowerable { - @SuppressWarnings("rawtypes") public static final NodeClass<BinaryArithmeticNode> TYPE = NodeClass.get(BinaryArithmeticNode.class); + @SuppressWarnings("rawtypes") public static final NodeClass<BinaryArithmeticNode> TYPE = NodeClass.create(BinaryArithmeticNode.class); protected interface SerializableBinaryFunction<T> extends Function<ArithmeticOpTable, BinaryOp<T>>, Serializable { } protected final SerializableBinaryFunction<OP> getOp; - protected BinaryArithmeticNode(NodeClass<?> c, SerializableBinaryFunction<OP> getOp, ValueNode x, ValueNode y) { + protected BinaryArithmeticNode(NodeClass<? extends BinaryArithmeticNode<OP>> c, SerializableBinaryFunction<OP> getOp, ValueNode x, ValueNode y) { super(c, getOp.apply(ArithmeticOpTable.forStamp(x.stamp())).foldStamp(x.stamp(), y.stamp()), x, y); this.getOp = getOp; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo public abstract class BinaryNode extends FloatingNode implements Canonicalizable.Binary<ValueNode> { - public static final NodeClass<BinaryNode> TYPE = NodeClass.get(BinaryNode.class); + public static final NodeClass<BinaryNode> TYPE = NodeClass.create(BinaryNode.class); @Input protected ValueNode x; @Input protected ValueNode y; @@ -63,7 +63,7 @@ * @param x the first input instruction * @param y the second input instruction */ - protected BinaryNode(NodeClass<?> c, Stamp stamp, ValueNode x, ValueNode y) { + protected BinaryNode(NodeClass<? extends BinaryNode> c, Stamp stamp, ValueNode x, ValueNode y) { super(c, stamp); this.x = x; this.y = y;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,7 +40,7 @@ @NodeInfo public abstract class CompareNode extends BinaryOpLogicNode { - public static final NodeClass<CompareNode> TYPE = NodeClass.get(CompareNode.class); + public static final NodeClass<CompareNode> TYPE = NodeClass.create(CompareNode.class); protected final Condition condition; protected final boolean unorderedIsTrue; @@ -50,7 +50,7 @@ * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction */ - protected CompareNode(NodeClass<?> c, Condition condition, boolean unorderedIsTrue, ValueNode x, ValueNode y) { + protected CompareNode(NodeClass<? extends CompareNode> c, Condition condition, boolean unorderedIsTrue, ValueNode x, ValueNode y) { super(c, x, y); this.condition = condition; this.unorderedIsTrue = unorderedIsTrue;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,7 +41,7 @@ @NodeInfo public final class ConditionalNode extends FloatingNode implements Canonicalizable, LIRLowerable { - public static final NodeClass<ConditionalNode> TYPE = NodeClass.get(ConditionalNode.class); + public static final NodeClass<ConditionalNode> TYPE = NodeClass.create(ConditionalNode.class); @Input(InputType.Condition) LogicNode condition; @Input ValueNode trueValue; @Input ValueNode falseValue;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/DivNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/DivNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo(shortName = "/") public final class DivNode extends BinaryArithmeticNode<Div> { - public static final NodeClass<DivNode> TYPE = NodeClass.get(DivNode.class); + public static final NodeClass<DivNode> TYPE = NodeClass.create(DivNode.class); public DivNode(ValueNode x, ValueNode y) { super(TYPE, ArithmeticOpTable::getDiv, x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FixedBinaryNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FixedBinaryNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,12 +30,12 @@ @NodeInfo public abstract class FixedBinaryNode extends DeoptimizingFixedWithNextNode implements Canonicalizable.Binary<ValueNode> { - public static final NodeClass<FixedBinaryNode> TYPE = NodeClass.get(FixedBinaryNode.class); + public static final NodeClass<FixedBinaryNode> TYPE = NodeClass.create(FixedBinaryNode.class); @Input protected ValueNode x; @Input protected ValueNode y; - public FixedBinaryNode(NodeClass<?> c, Stamp stamp, ValueNode x, ValueNode y) { + public FixedBinaryNode(NodeClass<? extends FixedBinaryNode> c, Stamp stamp, ValueNode x, ValueNode y) { super(c, stamp); this.x = x; this.y = y;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatConvertNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatConvertNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ */ @NodeInfo public final class FloatConvertNode extends UnaryArithmeticNode<FloatConvertOp> implements ConvertNode, Lowerable, ArithmeticLIRLowerable { - public static final NodeClass<FloatConvertNode> TYPE = NodeClass.get(FloatConvertNode.class); + public static final NodeClass<FloatConvertNode> TYPE = NodeClass.create(FloatConvertNode.class); protected final FloatConvert op;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo(shortName = "==") public final class FloatEqualsNode extends CompareNode { - public static final NodeClass<FloatEqualsNode> TYPE = NodeClass.get(FloatEqualsNode.class); + public static final NodeClass<FloatEqualsNode> TYPE = NodeClass.create(FloatEqualsNode.class); public FloatEqualsNode(ValueNode x, ValueNode y) { super(TYPE, Condition.EQ, false, x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatLessThanNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatLessThanNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo(shortName = "<") public final class FloatLessThanNode extends CompareNode { - public static final NodeClass<FloatLessThanNode> TYPE = NodeClass.get(FloatLessThanNode.class); + public static final NodeClass<FloatLessThanNode> TYPE = NodeClass.create(FloatLessThanNode.class); public FloatLessThanNode(ValueNode x, ValueNode y, boolean unorderedIsTrue) { super(TYPE, Condition.LT, unorderedIsTrue, x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatingNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatingNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,9 +29,9 @@ @NodeInfo public abstract class FloatingNode extends ValueNode implements Node.ValueNumberable { - public static final NodeClass<FloatingNode> TYPE = NodeClass.get(FloatingNode.class); + public static final NodeClass<FloatingNode> TYPE = NodeClass.create(FloatingNode.class); - public FloatingNode(NodeClass<?> c, Stamp stamp) { + public FloatingNode(NodeClass<? extends FloatingNode> c, Stamp stamp) { super(c, stamp); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo(shortName = "|<|") public final class IntegerBelowNode extends CompareNode { - public static final NodeClass<IntegerBelowNode> TYPE = NodeClass.get(IntegerBelowNode.class); + public static final NodeClass<IntegerBelowNode> TYPE = NodeClass.create(IntegerBelowNode.class); public IntegerBelowNode(ValueNode x, ValueNode y) { super(TYPE, Condition.BT, false, x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerConvertNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerConvertNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ */ @NodeInfo public abstract class IntegerConvertNode<OP, REV> extends UnaryNode implements ConvertNode, ArithmeticLIRLowerable { - @SuppressWarnings("rawtypes") public static final NodeClass<IntegerConvertNode> TYPE = NodeClass.get(IntegerConvertNode.class); + @SuppressWarnings("rawtypes") public static final NodeClass<IntegerConvertNode> TYPE = NodeClass.create(IntegerConvertNode.class); protected final SerializableIntegerConvertFunction<OP> getOp; protected final SerializableIntegerConvertFunction<REV> getReverseOp; @@ -50,7 +50,8 @@ protected interface SerializableIntegerConvertFunction<T> extends Function<ArithmeticOpTable, IntegerConvertOp<T>>, Serializable { } - protected IntegerConvertNode(NodeClass<?> c, SerializableIntegerConvertFunction<OP> getOp, SerializableIntegerConvertFunction<REV> getReverseOp, int inputBits, int resultBits, ValueNode input) { + protected IntegerConvertNode(NodeClass<? extends IntegerConvertNode<OP, REV>> c, SerializableIntegerConvertFunction<OP> getOp, SerializableIntegerConvertFunction<REV> getReverseOp, int inputBits, + int resultBits, ValueNode input) { super(c, getOp.apply(ArithmeticOpTable.forStamp(input.stamp())).foldStamp(inputBits, resultBits, input.stamp()), input); this.getOp = getOp; this.getReverseOp = getReverseOp;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -22,8 +22,6 @@ */ package com.oracle.graal.nodes.calc; -import static com.oracle.graal.graph.Edges.Type.*; - import com.oracle.graal.api.code.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; @@ -34,7 +32,7 @@ @NodeInfo(shortName = "/") public final class IntegerDivNode extends FixedBinaryNode implements Lowerable, LIRLowerable { - public static final NodeClass<IntegerDivNode> TYPE = NodeClass.get(IntegerDivNode.class); + public static final NodeClass<IntegerDivNode> TYPE = NodeClass.create(IntegerDivNode.class); public IntegerDivNode(ValueNode x, ValueNode y) { super(TYPE, IntegerStamp.OPS.getDiv().foldStamp(x.stamp(), y.stamp()), x, y); @@ -96,7 +94,7 @@ if (next() instanceof IntegerDivNode) { NodeClass<?> nodeClass = getNodeClass(); - if (next().getClass() == this.getClass() && nodeClass.getEdges(Inputs).areEqualIn(this, next()) && valueEquals(next())) { + if (next().getClass() == this.getClass() && nodeClass.getInputEdges().areEqualIn(this, next()) && valueEquals(next())) { return next(); } }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo(shortName = "==") public final class IntegerEqualsNode extends CompareNode { - public static final NodeClass<IntegerEqualsNode> TYPE = NodeClass.get(IntegerEqualsNode.class); + public static final NodeClass<IntegerEqualsNode> TYPE = NodeClass.create(IntegerEqualsNode.class); public IntegerEqualsNode(ValueNode x, ValueNode y) { super(TYPE, Condition.EQ, false, x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo(shortName = "<") public final class IntegerLessThanNode extends CompareNode { - public static final NodeClass<IntegerLessThanNode> TYPE = NodeClass.get(IntegerLessThanNode.class); + public static final NodeClass<IntegerLessThanNode> TYPE = NodeClass.create(IntegerLessThanNode.class); public IntegerLessThanNode(ValueNode x, ValueNode y) { super(TYPE, Condition.LT, false, x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,7 @@ @NodeInfo(shortName = "%") public final class IntegerRemNode extends FixedBinaryNode implements Lowerable, LIRLowerable { - public static final NodeClass<IntegerRemNode> TYPE = NodeClass.get(IntegerRemNode.class); + public static final NodeClass<IntegerRemNode> TYPE = NodeClass.create(IntegerRemNode.class); public IntegerRemNode(ValueNode x, ValueNode y) { super(TYPE, IntegerStamp.OPS.getRem().foldStamp(x.stamp(), y.stamp()), x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerTestNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerTestNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ */ @NodeInfo public final class IntegerTestNode extends BinaryOpLogicNode { - public static final NodeClass<IntegerTestNode> TYPE = NodeClass.get(IntegerTestNode.class); + public static final NodeClass<IntegerTestNode> TYPE = NodeClass.create(IntegerTestNode.class); public IntegerTestNode(ValueNode x, ValueNode y) { super(TYPE, x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo public final class IsNullNode extends UnaryOpLogicNode implements LIRLowerable, Virtualizable, PiPushable { - public static final NodeClass<IsNullNode> TYPE = NodeClass.get(IsNullNode.class); + public static final NodeClass<IsNullNode> TYPE = NodeClass.create(IsNullNode.class); public IsNullNode(ValueNode object) { super(TYPE, object);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LeftShiftNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LeftShiftNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo(shortName = "<<") public final class LeftShiftNode extends ShiftNode<Shl> { - public static final NodeClass<LeftShiftNode> TYPE = NodeClass.get(LeftShiftNode.class); + public static final NodeClass<LeftShiftNode> TYPE = NodeClass.create(LeftShiftNode.class); public LeftShiftNode(ValueNode x, ValueNode y) { super(TYPE, ArithmeticOpTable::getShl, x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/MulNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/MulNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,13 +37,13 @@ @NodeInfo(shortName = "*") public class MulNode extends BinaryArithmeticNode<Mul> implements NarrowableArithmeticNode { - public static final NodeClass<MulNode> TYPE = NodeClass.get(MulNode.class); + public static final NodeClass<MulNode> TYPE = NodeClass.create(MulNode.class); public MulNode(ValueNode x, ValueNode y) { this(TYPE, x, y); } - protected MulNode(NodeClass<?> c, ValueNode x, ValueNode y) { + protected MulNode(NodeClass<? extends MulNode> c, ValueNode x, ValueNode y) { super(c, ArithmeticOpTable::getMul, x, y); } @@ -77,33 +77,8 @@ if (c instanceof PrimitiveConstant && ((PrimitiveConstant) c).getKind().isNumericInteger()) { long i = ((PrimitiveConstant) c).asLong(); - boolean signFlip = false; - if (i < 0) { - i = -i; - signFlip = true; - } - if (i > 0) { - ValueNode mulResult = null; - long bit1 = i & -i; - long bit2 = i - bit1; - bit2 = bit2 & -bit2; // Extract 2nd bit - if (CodeUtil.isPowerOf2(i)) { // - mulResult = new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(i))); - } else if (bit2 + bit1 == i) { // We can work with two shifts and add - ValueNode shift1 = new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(bit1))); - ValueNode shift2 = new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(bit2))); - mulResult = new AddNode(shift1, shift2); - } else if (CodeUtil.isPowerOf2(i + 1)) { // shift and subtract - ValueNode shift1 = new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(i + 1))); - mulResult = new SubNode(shift1, forX); - } - if (mulResult != null) { - if (signFlip) { - return new NegateNode(mulResult); - } else { - return mulResult; - } - } + if (i > 0 && CodeUtil.isPowerOf2(i)) { + return new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(i))); } }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NarrowNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NarrowNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class NarrowNode extends IntegerConvertNode<Narrow, SignExtend> { - public static final NodeClass<NarrowNode> TYPE = NodeClass.get(NarrowNode.class); + public static final NodeClass<NarrowNode> TYPE = NodeClass.create(NarrowNode.class); public NarrowNode(ValueNode input, int resultBits) { this(input, PrimitiveStamp.getBits(input.stamp()), resultBits);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NegateNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NegateNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public final class NegateNode extends UnaryArithmeticNode<Neg> implements NarrowableArithmeticNode { - public static final NodeClass<NegateNode> TYPE = NodeClass.get(NegateNode.class); + public static final NodeClass<NegateNode> TYPE = NodeClass.create(NegateNode.class); public NegateNode(ValueNode value) { super(TYPE, ArithmeticOpTable::getNeg, value);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class NormalizeCompareNode extends BinaryNode implements Lowerable { - public static final NodeClass<NormalizeCompareNode> TYPE = NodeClass.get(NormalizeCompareNode.class); + public static final NodeClass<NormalizeCompareNode> TYPE = NodeClass.create(NormalizeCompareNode.class); protected final boolean isUnorderedLess; public NormalizeCompareNode(ValueNode x, ValueNode y, boolean isUnorderedLess) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NotNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NotNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public final class NotNode extends UnaryArithmeticNode<Not> implements ArithmeticLIRLowerable, NarrowableArithmeticNode { - public static final NodeClass<NotNode> TYPE = NodeClass.get(NotNode.class); + public static final NodeClass<NotNode> TYPE = NodeClass.create(NotNode.class); public NotNode(ValueNode x) { super(TYPE, ArithmeticOpTable::getNot, x);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo(shortName = "==") public final class ObjectEqualsNode extends PointerEqualsNode implements Virtualizable { - public static final NodeClass<ObjectEqualsNode> TYPE = NodeClass.get(ObjectEqualsNode.class); + public static final NodeClass<ObjectEqualsNode> TYPE = NodeClass.create(ObjectEqualsNode.class); public ObjectEqualsNode(ValueNode x, ValueNode y) { super(TYPE, x, y); @@ -92,7 +92,7 @@ /* * One of the two objects has identity, the other doesn't. In code, this looks like * "Integer.valueOf(a) == new Integer(b)", which is always false. - * + * * In other words: an object created via valueOf can never be equal to one created * by new in the same compilation unit. */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/OrNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/OrNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo(shortName = "|") public final class OrNode extends BinaryArithmeticNode<Or> { - public static final NodeClass<OrNode> TYPE = NodeClass.get(OrNode.class); + public static final NodeClass<OrNode> TYPE = NodeClass.create(OrNode.class); public OrNode(ValueNode x, ValueNode y) { super(TYPE, ArithmeticOpTable::getOr, x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/PointerEqualsNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/PointerEqualsNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,13 +33,13 @@ @NodeInfo(shortName = "==") public class PointerEqualsNode extends CompareNode { - public static final NodeClass<PointerEqualsNode> TYPE = NodeClass.get(PointerEqualsNode.class); + public static final NodeClass<PointerEqualsNode> TYPE = NodeClass.create(PointerEqualsNode.class); public PointerEqualsNode(ValueNode x, ValueNode y) { this(TYPE, x, y); } - protected PointerEqualsNode(NodeClass<?> c, ValueNode x, ValueNode y) { + protected PointerEqualsNode(NodeClass<? extends PointerEqualsNode> c, ValueNode x, ValueNode y) { super(c, Condition.EQ, false, x, y); assert x.stamp() instanceof AbstractPointerStamp; assert y.stamp() instanceof AbstractPointerStamp;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ReinterpretNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ReinterpretNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,7 +41,7 @@ @NodeInfo public final class ReinterpretNode extends UnaryNode implements ArithmeticLIRLowerable { - public static final NodeClass<ReinterpretNode> TYPE = NodeClass.get(ReinterpretNode.class); + public static final NodeClass<ReinterpretNode> TYPE = NodeClass.create(ReinterpretNode.class); public ReinterpretNode(Kind to, ValueNode value) { this(StampFactory.forKind(to), value);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RemNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RemNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo(shortName = "%") public final class RemNode extends BinaryArithmeticNode<Rem> implements Lowerable { - public static final NodeClass<RemNode> TYPE = NodeClass.get(RemNode.class); + public static final NodeClass<RemNode> TYPE = NodeClass.create(RemNode.class); public RemNode(ValueNode x, ValueNode y) { super(TYPE, ArithmeticOpTable::getRem, x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RightShiftNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RightShiftNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo(shortName = ">>") public final class RightShiftNode extends ShiftNode<Shr> { - public static final NodeClass<RightShiftNode> TYPE = NodeClass.get(RightShiftNode.class); + public static final NodeClass<RightShiftNode> TYPE = NodeClass.create(RightShiftNode.class); public RightShiftNode(ValueNode x, ValueNode y) { super(TYPE, ArithmeticOpTable::getShr, x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ShiftNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ShiftNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,7 +40,7 @@ @NodeInfo public abstract class ShiftNode<OP> extends BinaryNode implements ArithmeticLIRLowerable { - @SuppressWarnings("rawtypes") public static final NodeClass<ShiftNode> TYPE = NodeClass.get(ShiftNode.class); + @SuppressWarnings("rawtypes") public static final NodeClass<ShiftNode> TYPE = NodeClass.create(ShiftNode.class); protected interface SerializableShiftFunction<T> extends Function<ArithmeticOpTable, ShiftOp<T>>, Serializable { } @@ -53,7 +53,7 @@ * @param x the first input value * @param s the second input value */ - protected ShiftNode(NodeClass<?> c, SerializableShiftFunction<OP> getOp, ValueNode x, ValueNode s) { + protected ShiftNode(NodeClass<? extends ShiftNode<OP>> c, SerializableShiftFunction<OP> getOp, ValueNode x, ValueNode s) { super(c, getOp.apply(ArithmeticOpTable.forStamp(x.stamp())).foldStamp(x.stamp(), (IntegerStamp) s.stamp()), x, s); assert ((IntegerStamp) s.stamp()).getBits() == 32; this.getOp = getOp;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/SignExtendNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/SignExtendNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class SignExtendNode extends IntegerConvertNode<SignExtend, Narrow> { - public static final NodeClass<SignExtendNode> TYPE = NodeClass.get(SignExtendNode.class); + public static final NodeClass<SignExtendNode> TYPE = NodeClass.create(SignExtendNode.class); public SignExtendNode(ValueNode input, int resultBits) { this(input, PrimitiveStamp.getBits(input.stamp()), resultBits);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/SqrtNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/SqrtNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo public final class SqrtNode extends UnaryArithmeticNode<Sqrt> implements ArithmeticLIRLowerable, NarrowableArithmeticNode { - public static final NodeClass<SqrtNode> TYPE = NodeClass.get(SqrtNode.class); + public static final NodeClass<SqrtNode> TYPE = NodeClass.create(SqrtNode.class); public SqrtNode(ValueNode x) { super(TYPE, ArithmeticOpTable::getSqrt, x);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/SubNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/SubNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,13 +37,13 @@ @NodeInfo(shortName = "-") public class SubNode extends BinaryArithmeticNode<Sub> implements NarrowableArithmeticNode { - public static final NodeClass<SubNode> TYPE = NodeClass.get(SubNode.class); + public static final NodeClass<SubNode> TYPE = NodeClass.create(SubNode.class); public SubNode(ValueNode x, ValueNode y) { this(TYPE, x, y); } - protected SubNode(NodeClass<?> c, ValueNode x, ValueNode y) { + protected SubNode(NodeClass<? extends SubNode> c, ValueNode x, ValueNode y) { super(c, ArithmeticOpTable::getSub, x, y); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnaryArithmeticNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnaryArithmeticNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,14 +36,14 @@ @NodeInfo public abstract class UnaryArithmeticNode<OP> extends UnaryNode implements ArithmeticLIRLowerable { - @SuppressWarnings("rawtypes") public static final NodeClass<UnaryArithmeticNode> TYPE = NodeClass.get(UnaryArithmeticNode.class); + @SuppressWarnings("rawtypes") public static final NodeClass<UnaryArithmeticNode> TYPE = NodeClass.create(UnaryArithmeticNode.class); protected interface SerializableUnaryFunction<T> extends Function<ArithmeticOpTable, UnaryOp<T>>, Serializable { } protected final SerializableUnaryFunction<OP> getOp; - protected UnaryArithmeticNode(NodeClass<?> c, SerializableUnaryFunction<OP> getOp, ValueNode value) { + protected UnaryArithmeticNode(NodeClass<? extends UnaryArithmeticNode<OP>> c, SerializableUnaryFunction<OP> getOp, ValueNode value) { super(c, getOp.apply(ArithmeticOpTable.forStamp(value.stamp())).foldStamp(value.stamp()), value); this.getOp = getOp; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnaryNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnaryNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public abstract class UnaryNode extends FloatingNode implements Canonicalizable.Unary<ValueNode> { - public static final NodeClass<UnaryNode> TYPE = NodeClass.get(UnaryNode.class); + public static final NodeClass<UnaryNode> TYPE = NodeClass.create(UnaryNode.class); @Input protected ValueNode value; public ValueNode getValue() { @@ -48,7 +48,7 @@ * @param stamp the result type of this instruction * @param value the input instruction */ - protected UnaryNode(NodeClass<?> c, Stamp stamp, ValueNode value) { + protected UnaryNode(NodeClass<? extends UnaryNode> c, Stamp stamp, ValueNode value) { super(c, stamp); this.value = value; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo(shortName = "|/|") public final class UnsignedDivNode extends FixedBinaryNode implements Lowerable, LIRLowerable { - public static final NodeClass<UnsignedDivNode> TYPE = NodeClass.get(UnsignedDivNode.class); + public static final NodeClass<UnsignedDivNode> TYPE = NodeClass.create(UnsignedDivNode.class); public UnsignedDivNode(ValueNode x, ValueNode y) { super(TYPE, x.stamp().unrestricted(), x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo(shortName = "|%|") public final class UnsignedRemNode extends FixedBinaryNode implements Lowerable, LIRLowerable { - public static final NodeClass<UnsignedRemNode> TYPE = NodeClass.get(UnsignedRemNode.class); + public static final NodeClass<UnsignedRemNode> TYPE = NodeClass.create(UnsignedRemNode.class); public UnsignedRemNode(ValueNode x, ValueNode y) { super(TYPE, x.stamp().unrestricted(), x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRightShiftNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRightShiftNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo(shortName = ">>>") public final class UnsignedRightShiftNode extends ShiftNode<UShr> { - public static final NodeClass<UnsignedRightShiftNode> TYPE = NodeClass.get(UnsignedRightShiftNode.class); + public static final NodeClass<UnsignedRightShiftNode> TYPE = NodeClass.create(UnsignedRightShiftNode.class); public UnsignedRightShiftNode(ValueNode x, ValueNode y) { super(TYPE, ArithmeticOpTable::getUShr, x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/XorNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/XorNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo(shortName = "^") public final class XorNode extends BinaryArithmeticNode<Xor> { - public static final NodeClass<XorNode> TYPE = NodeClass.get(XorNode.class); + public static final NodeClass<XorNode> TYPE = NodeClass.create(XorNode.class); public XorNode(ValueNode x, ValueNode y) { super(TYPE, ArithmeticOpTable::getXor, x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ZeroExtendNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ZeroExtendNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,7 +40,7 @@ @NodeInfo public final class ZeroExtendNode extends IntegerConvertNode<ZeroExtend, Narrow> { - public static final NodeClass<ZeroExtendNode> TYPE = NodeClass.get(ZeroExtendNode.class); + public static final NodeClass<ZeroExtendNode> TYPE = NodeClass.create(ZeroExtendNode.class); public ZeroExtendNode(ValueNode input, int resultBits) { this(input, PrimitiveStamp.getBits(input.stamp()), resultBits);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,6 +30,7 @@ public final class Block extends AbstractBlockBase<Block> { + public static final int DISTANCED_DOMINATOR_CACHE = 5; protected final AbstractBeginNode beginNode; protected FixedNode endNode; @@ -38,6 +39,7 @@ protected Loop<Block> loop; protected Block postdominator; + protected Block distancedDominatorCache; protected Block(AbstractBeginNode node) { this.beginNode = node; @@ -51,6 +53,7 @@ return endNode; } + @Override public Loop<Block> getLoop() { return loop; } @@ -59,18 +62,22 @@ this.loop = loop; } + @Override public int getLoopDepth() { return loop == null ? 0 : loop.getDepth(); } + @Override public boolean isLoopHeader() { return getBeginNode() instanceof LoopBeginNode; } + @Override public boolean isLoopEnd() { return getEndNode() instanceof LoopEndNode; } + @Override public boolean isExceptionEntry() { Node predecessor = getBeginNode().predecessor(); return predecessor != null && predecessor instanceof InvokeWithExceptionNode && getBeginNode() == ((InvokeWithExceptionNode) predecessor).exceptionEdge(); @@ -97,6 +104,7 @@ return b; } + @Override public Block getPostdominator() { return postdominator; } @@ -159,6 +167,7 @@ return "B" + id; } + @Override public double probability() { return probability; } @@ -167,4 +176,31 @@ assert probability >= 0 && Double.isFinite(probability); this.probability = probability; } + + public Block getDistancedDominatorCache() { + Block result = this.distancedDominatorCache; + if (result == null) { + Block current = this; + for (int i = 0; i < DISTANCED_DOMINATOR_CACHE; ++i) { + current = current.getDominator(); + } + distancedDominatorCache = current; + return current; + } else { + return result; + } + } + + @Override + public Block getDominator(int distance) { + Block result = this; + int i = 0; + for (; i < distance - (DISTANCED_DOMINATOR_CACHE - 1); i += DISTANCED_DOMINATOR_CACHE) { + result = result.getDistancedDominatorCache(); + } + for (; i < distance; ++i) { + result = result.getDominator(); + } + return result; + } }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java Mon Feb 23 16:23:23 2015 -0800 @@ -200,14 +200,19 @@ } // Connect blocks (including loop backward edges), but ignoring dead code (blocks with id < 0). + // Predecessors need to be in the order expected when iterating phi inputs. private void connectBlocks() { for (Block block : reversePostOrder) { - List<Block> predecessors = new ArrayList<>(4); + List<Block> predecessors = new ArrayList<>(1); double probability = block.getBeginNode() instanceof StartNode ? 1D : 0D; for (Node predNode : block.getBeginNode().cfgPredecessors()) { Block predBlock = nodeToBlock.get(predNode); if (predBlock.getId() >= 0) { predecessors.add(predBlock); + if (predBlock.getSuccessors() == null) { + predBlock.setSuccessors(new ArrayList<>(1)); + } + predBlock.getSuccessors().add(block); probability += predBlock.probability; } } @@ -222,6 +227,10 @@ assert predBlock != null : predNode; if (predBlock.getId() >= 0) { predecessors.add(predBlock); + if (predBlock.getSuccessors() == null) { + predBlock.setSuccessors(new ArrayList<>(1)); + } + predBlock.getSuccessors().add(block); } } } @@ -230,19 +239,9 @@ } block.setPredecessors(predecessors); block.setProbability(probability); - - List<Block> successors = new ArrayList<>(4); - for (Node suxNode : block.getEndNode().cfgSuccessors()) { - Block suxBlock = nodeToBlock.get(suxNode); - assert suxBlock.getId() >= 0; - successors.add(suxBlock); + if (block.getSuccessors() == null) { + block.setSuccessors(new ArrayList<>(1)); } - if (block.getEndNode() instanceof LoopEndNode) { - Block suxBlock = nodeToBlock.get(((LoopEndNode) block.getEndNode()).loopBegin()); - assert suxBlock.getId() >= 0; - successors.add(suxBlock); - } - block.setSuccessors(successors); } } @@ -266,29 +265,30 @@ computeLoopBlocks(exitBlock.getFirstPredecessor(), loop); loop.getExits().add(exitBlock); } - List<Block> unexpected = new LinkedList<>(); - for (Block b : loop.getBlocks()) { + + // The following loop can add new blocks to the end of the loop's block list. + int size = loop.getBlocks().size(); + for (int i = 0; i < size; ++i) { + Block b = loop.getBlocks().get(i); for (Block sux : b.getSuccessors()) { if (sux.loop != loop) { AbstractBeginNode begin = sux.getBeginNode(); if (!(begin instanceof LoopExitNode && ((LoopExitNode) begin).loopBegin() == loopBegin)) { Debug.log(3, "Unexpected loop exit with %s, including whole branch in the loop", sux); - unexpected.add(sux); + addBranchToLoop(loop, sux); } } } } - for (Block b : unexpected) { - addBranchToLoop(loop, b); - } } } } private static void addBranchToLoop(Loop<Block> l, Block b) { - if (l.getBlocks().contains(b)) { + if (b.loop == l) { return; } + assert !(l.getBlocks().contains(b)); l.getBlocks().add(b); b.loop = l; for (Block sux : b.getSuccessors()) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/BlackholeNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/BlackholeNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo public final class BlackholeNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<BlackholeNode> TYPE = NodeClass.get(BlackholeNode.class); + public static final NodeClass<BlackholeNode> TYPE = NodeClass.create(BlackholeNode.class); @Input ValueNode value; public BlackholeNode(ValueNode value) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/ControlFlowAnchorNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/ControlFlowAnchorNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public final class ControlFlowAnchorNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<ControlFlowAnchorNode> TYPE = NodeClass.get(ControlFlowAnchorNode.class); + public static final NodeClass<ControlFlowAnchorNode> TYPE = NodeClass.create(ControlFlowAnchorNode.class); private static class Unique { }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public class DynamicCounterNode extends FixedWithNextNode implements Lowerable { - public static final NodeClass<DynamicCounterNode> TYPE = NodeClass.get(DynamicCounterNode.class); + public static final NodeClass<DynamicCounterNode> TYPE = NodeClass.create(DynamicCounterNode.class); @Input ValueNode increment; protected final String name; @@ -50,7 +50,7 @@ this(TYPE, name, group, increment, withContext); } - protected DynamicCounterNode(NodeClass<?> c, String name, String group, ValueNode increment, boolean withContext) { + protected DynamicCounterNode(NodeClass<? extends DynamicCounterNode> c, String name, String group, ValueNode increment, boolean withContext) { super(c, StampFactory.forVoid()); this.name = name; this.group = group;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/OpaqueNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/OpaqueNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo public final class OpaqueNode extends FloatingNode implements LIRLowerable { - public static final NodeClass<OpaqueNode> TYPE = NodeClass.get(OpaqueNode.class); + public static final NodeClass<OpaqueNode> TYPE = NodeClass.create(OpaqueNode.class); @Input ValueNode value; public OpaqueNode(ValueNode value) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/VerifyHeapNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/VerifyHeapNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public final class VerifyHeapNode extends FixedWithNextNode implements Lowerable { - public static final NodeClass<VerifyHeapNode> TYPE = NodeClass.get(VerifyHeapNode.class); + public static final NodeClass<VerifyHeapNode> TYPE = NodeClass.create(VerifyHeapNode.class); public VerifyHeapNode() { super(TYPE, StampFactory.forVoid());
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/WeakCounterNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/WeakCounterNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public final class WeakCounterNode extends DynamicCounterNode implements Simplifiable, Virtualizable { - public static final NodeClass<WeakCounterNode> TYPE = NodeClass.get(WeakCounterNode.class); + public static final NodeClass<WeakCounterNode> TYPE = NodeClass.create(WeakCounterNode.class); @Input ValueNode checkedValue; public WeakCounterNode(String group, String name, ValueNode increment, boolean addContext, ValueNode checkedValue) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AbstractWriteNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AbstractWriteNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public abstract class AbstractWriteNode extends FixedAccessNode implements StateSplit, MemoryCheckpoint.Single, MemoryAccess, GuardingNode { - public static final NodeClass<AbstractWriteNode> TYPE = NodeClass.get(AbstractWriteNode.class); + public static final NodeClass<AbstractWriteNode> TYPE = NodeClass.create(AbstractWriteNode.class); @Input ValueNode value; @OptionalInput(InputType.State) FrameState stateAfter; @OptionalInput(InputType.Memory) Node lastLocationAccess; @@ -65,17 +65,17 @@ return initialization; } - protected AbstractWriteNode(NodeClass<?> c, ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType) { + protected AbstractWriteNode(NodeClass<? extends AbstractWriteNode> c, ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType) { this(c, object, value, location, barrierType, false); } - protected AbstractWriteNode(NodeClass<?> c, ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean initialization) { + protected AbstractWriteNode(NodeClass<? extends AbstractWriteNode> c, ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean initialization) { super(c, object, location, StampFactory.forVoid(), barrierType); this.value = value; this.initialization = initialization; } - protected AbstractWriteNode(NodeClass<?> c, ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, GuardingNode guard, boolean initialization) { + protected AbstractWriteNode(NodeClass<? extends AbstractWriteNode> c, ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, GuardingNode guard, boolean initialization) { super(c, object, location, StampFactory.forVoid(), guard, barrierType, false, null); this.value = value; this.initialization = initialization;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo(nameTemplate = "AddLoc {p#locationIdentity/s}") public final class AddLocationNode extends LocationNode implements Canonicalizable.Binary<LocationNode> { - public static final NodeClass<AddLocationNode> TYPE = NodeClass.get(AddLocationNode.class); + public static final NodeClass<AddLocationNode> TYPE = NodeClass.create(AddLocationNode.class); @Input(InputType.Association) ValueNode x; @Input(InputType.Association) ValueNode y;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ArrayRangeWriteNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ArrayRangeWriteNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,9 +33,9 @@ @NodeInfo public abstract class ArrayRangeWriteNode extends AbstractMemoryCheckpoint { - public static final NodeClass<ArrayRangeWriteNode> TYPE = NodeClass.get(ArrayRangeWriteNode.class); + public static final NodeClass<ArrayRangeWriteNode> TYPE = NodeClass.create(ArrayRangeWriteNode.class); - protected ArrayRangeWriteNode(NodeClass<?> c, Stamp stamp) { + protected ArrayRangeWriteNode(NodeClass<? extends ArrayRangeWriteNode> c, Stamp stamp) { super(c, stamp); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -43,7 +43,7 @@ @NodeInfo public final class BoxNode extends UnaryNode implements VirtualizableAllocation, Lowerable { - public static final NodeClass<BoxNode> TYPE = NodeClass.get(BoxNode.class); + public static final NodeClass<BoxNode> TYPE = NodeClass.create(BoxNode.class); protected final Kind boxingKind; public BoxNode(ValueNode value, ResolvedJavaType resultType, Kind boxingKind) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class BranchProbabilityNode extends FloatingNode implements Simplifiable, Lowerable { - public static final NodeClass<BranchProbabilityNode> TYPE = NodeClass.get(BranchProbabilityNode.class); + public static final NodeClass<BranchProbabilityNode> TYPE = NodeClass.create(BranchProbabilityNode.class); public static final double LIKELY_PROBABILITY = 0.6; public static final double NOT_LIKELY_PROBABILITY = 1 - LIKELY_PROBABILITY; @@ -100,12 +100,17 @@ couldSet = true; ifNodeUsages.setTrueSuccessorProbability(probabilityToSet); } + + if (!couldSet && node.usages().filter(FixedGuardNode.class).isNotEmpty()) { + couldSet = true; + } } } } if (couldSet) { - replaceAndDelete(condition); - tool.addToWorkList(condition.usages()); + ValueNode currentCondition = condition; + replaceAndDelete(currentCondition); + tool.addToWorkList(currentCondition.usages()); } else { if (!isSubstitutionGraph()) { throw new GraalInternalError("Wrong usage of branch probability injection!");
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BytecodeExceptionNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BytecodeExceptionNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo public final class BytecodeExceptionNode extends AbstractMemoryCheckpoint implements Lowerable, MemoryCheckpoint.Single { - public static final NodeClass<BytecodeExceptionNode> TYPE = NodeClass.get(BytecodeExceptionNode.class); + public static final NodeClass<BytecodeExceptionNode> TYPE = NodeClass.create(BytecodeExceptionNode.class); protected final Class<? extends Throwable> exceptionClass; @Input NodeInputList<ValueNode> arguments;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ComputeAddressNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ComputeAddressNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo public final class ComputeAddressNode extends FloatingNode implements LIRLowerable { - public static final NodeClass<ComputeAddressNode> TYPE = NodeClass.get(ComputeAddressNode.class); + public static final NodeClass<ComputeAddressNode> TYPE = NodeClass.create(ComputeAddressNode.class); @Input ValueNode object; @Input(InputType.Association) ValueNode location;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ConstantLocationNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ConstantLocationNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo(nameTemplate = "Loc {p#locationIdentity/s}") public final class ConstantLocationNode extends LocationNode { - public static final NodeClass<ConstantLocationNode> TYPE = NodeClass.get(ConstantLocationNode.class); + public static final NodeClass<ConstantLocationNode> TYPE = NodeClass.create(ConstantLocationNode.class); protected final LocationIdentity locationIdentity; protected final long displacement;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FixedAccessNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FixedAccessNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ */ @NodeInfo public abstract class FixedAccessNode extends DeoptimizingFixedWithNextNode implements Access { - public static final NodeClass<FixedAccessNode> TYPE = NodeClass.get(FixedAccessNode.class); + public static final NodeClass<FixedAccessNode> TYPE = NodeClass.create(FixedAccessNode.class); @OptionalInput(InputType.Guard) protected GuardingNode guard; @Input protected ValueNode object; @@ -66,15 +66,16 @@ this.nullCheck = check; } - protected FixedAccessNode(NodeClass<?> c, ValueNode object, ValueNode location, Stamp stamp) { + protected FixedAccessNode(NodeClass<? extends FixedAccessNode> c, ValueNode object, ValueNode location, Stamp stamp) { this(c, object, location, stamp, BarrierType.NONE); } - protected FixedAccessNode(NodeClass<?> c, ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType) { + protected FixedAccessNode(NodeClass<? extends FixedAccessNode> c, ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType) { this(c, object, location, stamp, null, barrierType, false, null); } - protected FixedAccessNode(NodeClass<?> c, ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck, FrameState stateBefore) { + protected FixedAccessNode(NodeClass<? extends FixedAccessNode> c, ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck, + FrameState stateBefore) { super(c, stamp, stateBefore); this.object = object; this.location = location;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FixedValueAnchorNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FixedValueAnchorNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo public final class FixedValueAnchorNode extends FixedWithNextNode implements LIRLowerable, ValueProxy { - public static final NodeClass<FixedValueAnchorNode> TYPE = NodeClass.get(FixedValueAnchorNode.class); + public static final NodeClass<FixedValueAnchorNode> TYPE = NodeClass.create(FixedValueAnchorNode.class); @Input ValueNode object;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatableAccessNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatableAccessNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,17 +33,18 @@ */ @NodeInfo public abstract class FloatableAccessNode extends FixedAccessNode { - public static final NodeClass<FloatableAccessNode> TYPE = NodeClass.get(FloatableAccessNode.class); + public static final NodeClass<FloatableAccessNode> TYPE = NodeClass.create(FloatableAccessNode.class); - protected FloatableAccessNode(NodeClass<?> c, ValueNode object, ValueNode location, Stamp stamp) { + protected FloatableAccessNode(NodeClass<? extends FloatableAccessNode> c, ValueNode object, ValueNode location, Stamp stamp) { super(c, object, location, stamp); } - protected FloatableAccessNode(NodeClass<?> c, ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType) { + protected FloatableAccessNode(NodeClass<? extends FloatableAccessNode> c, ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType) { super(c, object, location, stamp, guard, barrierType, false, null); } - protected FloatableAccessNode(NodeClass<?> c, ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck, FrameState stateBefore) { + protected FloatableAccessNode(NodeClass<? extends FloatableAccessNode> c, ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck, + FrameState stateBefore) { super(c, object, location, stamp, guard, barrierType, nullCheck, stateBefore); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingAccessNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingAccessNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo public abstract class FloatingAccessNode extends FloatingGuardedNode implements Access, MemoryAccess { - public static final NodeClass<FloatingAccessNode> TYPE = NodeClass.get(FloatingAccessNode.class); + public static final NodeClass<FloatingAccessNode> TYPE = NodeClass.create(FloatingAccessNode.class); @Input ValueNode object; @Input(InputType.Association) LocationNode location; @@ -52,13 +52,13 @@ return location.getLocationIdentity(); } - protected FloatingAccessNode(NodeClass<?> c, ValueNode object, LocationNode location, Stamp stamp) { + protected FloatingAccessNode(NodeClass<? extends FloatingAccessNode> c, ValueNode object, LocationNode location, Stamp stamp) { super(c, stamp); this.object = object; this.location = location; } - protected FloatingAccessNode(NodeClass<?> c, ValueNode object, LocationNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType) { + protected FloatingAccessNode(NodeClass<? extends FloatingAccessNode> c, ValueNode object, LocationNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType) { super(c, stamp, guard); this.object = object; this.location = location;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ */ @NodeInfo public final class FloatingReadNode extends FloatingAccessNode implements LIRLowerable, Canonicalizable { - public static final NodeClass<FloatingReadNode> TYPE = NodeClass.get(FloatingReadNode.class); + public static final NodeClass<FloatingReadNode> TYPE = NodeClass.create(FloatingReadNode.class); @OptionalInput(InputType.Memory) MemoryNode lastLocationAccess;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ */ @NodeInfo(nameTemplate = "ForeignCall#{p#descriptor/s}", allowedUsageTypes = {InputType.Memory}) public class ForeignCallNode extends AbstractMemoryCheckpoint implements LIRLowerable, DeoptimizingNode.DeoptDuring, MemoryCheckpoint.Multi { - public static final NodeClass<ForeignCallNode> TYPE = NodeClass.get(ForeignCallNode.class); + public static final NodeClass<ForeignCallNode> TYPE = NodeClass.create(ForeignCallNode.class); @Input protected NodeInputList<ValueNode> arguments; @OptionalInput(InputType.State) protected FrameState stateDuring; @@ -64,7 +64,7 @@ this.foreignCalls = foreignCalls; } - protected ForeignCallNode(NodeClass<?> c, ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, Stamp stamp) { + protected ForeignCallNode(NodeClass<? extends ForeignCallNode> c, ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, Stamp stamp) { super(c, stamp); this.arguments = new NodeInputList<>(this); this.descriptor = descriptor;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ */ @NodeInfo(nameTemplate = "IdxLoc {p#locationIdentity/s}") public final class IndexedLocationNode extends LocationNode implements Canonicalizable { - public static final NodeClass<IndexedLocationNode> TYPE = NodeClass.get(IndexedLocationNode.class); + public static final NodeClass<IndexedLocationNode> TYPE = NodeClass.create(IndexedLocationNode.class); protected final LocationIdentity locationIdentity; protected final long displacement;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ */ @NodeInfo public final class IntegerSwitchNode extends SwitchNode implements LIRLowerable, Simplifiable { - public static final NodeClass<IntegerSwitchNode> TYPE = NodeClass.get(IntegerSwitchNode.class); + public static final NodeClass<IntegerSwitchNode> TYPE = NodeClass.create(IntegerSwitchNode.class); protected final int[] keys;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaReadNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaReadNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public final class JavaReadNode extends FixedAccessNode implements Lowerable, GuardingNode, Canonicalizable { - public static final NodeClass<JavaReadNode> TYPE = NodeClass.get(JavaReadNode.class); + public static final NodeClass<JavaReadNode> TYPE = NodeClass.create(JavaReadNode.class); protected final Kind readKind; protected final boolean compressible;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaWriteNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaWriteNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public final class JavaWriteNode extends AbstractWriteNode implements Lowerable, StateSplit, MemoryAccess, MemoryCheckpoint.Single { - public static final NodeClass<JavaWriteNode> TYPE = NodeClass.get(JavaWriteNode.class); + public static final NodeClass<JavaWriteNode> TYPE = NodeClass.create(JavaWriteNode.class); protected final Kind writeKind; protected final boolean compressible;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo public final class LoadHubNode extends FloatingGuardedNode implements Lowerable, Canonicalizable, Virtualizable { - public static final NodeClass<LoadHubNode> TYPE = NodeClass.get(LoadHubNode.class); + public static final NodeClass<LoadHubNode> TYPE = NodeClass.create(LoadHubNode.class); @Input ValueNode value; public ValueNode getValue() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo public final class LoadMethodNode extends FixedWithNextNode implements Lowerable, Canonicalizable { - public static final NodeClass<LoadMethodNode> TYPE = NodeClass.get(LoadMethodNode.class); + public static final NodeClass<LoadMethodNode> TYPE = NodeClass.create(LoadMethodNode.class); @Input ValueNode hub; protected final ResolvedJavaMethod method; protected final ResolvedJavaType receiverType;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Association}) public abstract class LocationNode extends FloatingNode implements LIRLowerable, ValueNumberable { - public static final NodeClass<LocationNode> TYPE = NodeClass.get(LocationNode.class); + public static final NodeClass<LocationNode> TYPE = NodeClass.create(LocationNode.class); /** * Marker interface for locations in snippets. @@ -47,7 +47,7 @@ public interface Location { } - protected LocationNode(NodeClass<?> c, Stamp stamp) { + protected LocationNode(NodeClass<? extends LocationNode> c, Stamp stamp) { super(c, stamp); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MembarNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MembarNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -42,7 +42,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class MembarNode extends FixedWithNextNode implements LIRLowerable, MemoryCheckpoint.Single { - public static final NodeClass<MembarNode> TYPE = NodeClass.get(MembarNode.class); + public static final NodeClass<MembarNode> TYPE = NodeClass.create(MembarNode.class); protected final int barriers; public MembarNode(int barriers) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/NullCheckNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/NullCheckNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Guard}) public final class NullCheckNode extends DeoptimizingFixedWithNextNode implements LIRLowerable, GuardingNode { - public static final NodeClass<NullCheckNode> TYPE = NodeClass.get(NullCheckNode.class); + public static final NodeClass<NullCheckNode> TYPE = NodeClass.create(NullCheckNode.class); @Input ValueNode object; public NullCheckNode(ValueNode object) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRLocalNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRLocalNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo(nameTemplate = "OSRLocal({p#index})") public final class OSRLocalNode extends AbstractLocalNode implements IterableNodeType { - public static final NodeClass<OSRLocalNode> TYPE = NodeClass.get(OSRLocalNode.class); + public static final NodeClass<OSRLocalNode> TYPE = NodeClass.create(OSRLocalNode.class); public OSRLocalNode(int index, Stamp stamp) { super(TYPE, index, stamp);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRStartNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRStartNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo public final class OSRStartNode extends StartNode implements Lowerable { - public static final NodeClass<OSRStartNode> TYPE = NodeClass.get(OSRStartNode.class); + public static final NodeClass<OSRStartNode> TYPE = NodeClass.create(OSRStartNode.class); public OSRStartNode() { super(TYPE);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class ReadNode extends FloatableAccessNode implements LIRLowerable, Canonicalizable, PiPushable, Virtualizable, GuardingNode { - public static final NodeClass<ReadNode> TYPE = NodeClass.get(ReadNode.class); + public static final NodeClass<ReadNode> TYPE = NodeClass.create(ReadNode.class); public ReadNode(ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType) { super(TYPE, object, location, stamp, null, barrierType);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/StoreHubNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/StoreHubNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo public final class StoreHubNode extends FixedWithNextNode implements Lowerable { - public static final NodeClass<StoreHubNode> TYPE = NodeClass.get(StoreHubNode.class); + public static final NodeClass<StoreHubNode> TYPE = NodeClass.create(StoreHubNode.class); @Input ValueNode value; @Input ValueNode object;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public abstract class SwitchNode extends ControlSplitNode { - public static final NodeClass<SwitchNode> TYPE = NodeClass.get(SwitchNode.class); + public static final NodeClass<SwitchNode> TYPE = NodeClass.create(SwitchNode.class); @Successor protected NodeSuccessorList<AbstractBeginNode> successors; @Input protected ValueNode value; @@ -51,7 +51,7 @@ * @param value the instruction that provides the value to be switched over * @param successors the list of successors of this switch */ - protected SwitchNode(NodeClass<?> c, ValueNode value, AbstractBeginNode[] successors, int[] keySuccessors, double[] keyProbabilities) { + protected SwitchNode(NodeClass<? extends SwitchNode> c, ValueNode value, AbstractBeginNode[] successors, int[] keySuccessors, double[] keyProbabilities) { super(c, StampFactory.forVoid()); assert value.stamp().getStackKind().isNumericInteger() || value.stamp() instanceof AbstractPointerStamp : value.stamp() + " key not supported by SwitchNode"; assert keySuccessors.length == keyProbabilities.length;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,7 +34,7 @@ @NodeInfo public final class UnboxNode extends UnaryNode implements Virtualizable, Lowerable { - public static final NodeClass<UnboxNode> TYPE = NodeClass.get(UnboxNode.class); + public static final NodeClass<UnboxNode> TYPE = NodeClass.create(UnboxNode.class); protected final Kind boxingKind; protected UnboxNode(ValueNode value, Kind boxingKind) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeAccessNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeAccessNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,13 +33,13 @@ @NodeInfo public abstract class UnsafeAccessNode extends FixedWithNextNode implements Canonicalizable { - public static final NodeClass<UnsafeAccessNode> TYPE = NodeClass.get(UnsafeAccessNode.class); + public static final NodeClass<UnsafeAccessNode> TYPE = NodeClass.create(UnsafeAccessNode.class); @Input ValueNode object; @Input ValueNode offset; protected final Kind accessKind; protected final LocationIdentity locationIdentity; - protected UnsafeAccessNode(NodeClass<?> c, Stamp stamp, ValueNode object, ValueNode offset, Kind accessKind, LocationIdentity locationIdentity) { + protected UnsafeAccessNode(NodeClass<? extends UnsafeAccessNode> c, Stamp stamp, ValueNode object, ValueNode offset, Kind accessKind, LocationIdentity locationIdentity) { super(c, stamp); assert accessKind != null; this.object = object;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,7 +40,7 @@ @NodeInfo public final class UnsafeCastNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, GuardingNode, IterableNodeType, Canonicalizable, ValueProxy { - public static final NodeClass<UnsafeCastNode> TYPE = NodeClass.get(UnsafeCastNode.class); + public static final NodeClass<UnsafeCastNode> TYPE = NodeClass.create(UnsafeCastNode.class); @Input ValueNode object; public UnsafeCastNode(ValueNode object, Stamp stamp) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ */ @NodeInfo public final class UnsafeLoadNode extends UnsafeAccessNode implements Lowerable, Virtualizable { - public static final NodeClass<UnsafeLoadNode> TYPE = NodeClass.get(UnsafeLoadNode.class); + public static final NodeClass<UnsafeLoadNode> TYPE = NodeClass.create(UnsafeLoadNode.class); @OptionalInput(InputType.Condition) LogicNode guardingCondition; public UnsafeLoadNode(ValueNode object, ValueNode offset, Kind accessKind, LocationIdentity locationIdentity) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class UnsafeStoreNode extends UnsafeAccessNode implements StateSplit, Lowerable, Virtualizable, MemoryCheckpoint.Single { - public static final NodeClass<UnsafeStoreNode> TYPE = NodeClass.get(UnsafeStoreNode.class); + public static final NodeClass<UnsafeStoreNode> TYPE = NodeClass.create(UnsafeStoreNode.class); @Input ValueNode value; @OptionalInput(InputType.State) FrameState stateAfter;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Anchor, InputType.Guard}) public final class ValueAnchorNode extends FixedWithNextNode implements LIRLowerable, Simplifiable, Virtualizable, AnchoringNode, GuardingNode { - public static final NodeClass<ValueAnchorNode> TYPE = NodeClass.get(ValueAnchorNode.class); + public static final NodeClass<ValueAnchorNode> TYPE = NodeClass.create(ValueAnchorNode.class); @OptionalInput(InputType.Guard) ValueNode anchored; public ValueAnchorNode(ValueNode value) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public final class WriteNode extends AbstractWriteNode implements LIRLowerable, Simplifiable, Virtualizable { - public static final NodeClass<WriteNode> TYPE = NodeClass.get(WriteNode.class); + public static final NodeClass<WriteNode> TYPE = NodeClass.create(WriteNode.class); public WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType) { super(TYPE, object, value, location, barrierType);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewArrayNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewArrayNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public abstract class AbstractNewArrayNode extends AbstractNewObjectNode implements ArrayLengthProvider { - public static final NodeClass<AbstractNewArrayNode> TYPE = NodeClass.get(AbstractNewArrayNode.class); + public static final NodeClass<AbstractNewArrayNode> TYPE = NodeClass.create(AbstractNewArrayNode.class); @Input protected ValueNode length; @Override @@ -43,7 +43,7 @@ return length; } - public AbstractNewArrayNode(NodeClass<?> c, Stamp stamp, ValueNode length, boolean fillContents) { + public AbstractNewArrayNode(NodeClass<? extends AbstractNewArrayNode> c, Stamp stamp, ValueNode length, boolean fillContents) { super(c, stamp, fillContents); this.length = length; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewObjectNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewObjectNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,10 +38,10 @@ @NodeInfo public abstract class AbstractNewObjectNode extends DeoptimizingFixedWithNextNode implements Simplifiable, Lowerable { - public static final NodeClass<AbstractNewObjectNode> TYPE = NodeClass.get(AbstractNewObjectNode.class); + public static final NodeClass<AbstractNewObjectNode> TYPE = NodeClass.create(AbstractNewObjectNode.class); protected final boolean fillContents; - public AbstractNewObjectNode(NodeClass<?> c, Stamp stamp, boolean fillContents) { + public AbstractNewObjectNode(NodeClass<? extends AbstractNewObjectNode> c, Stamp stamp, boolean fillContents) { super(c, stamp); this.fillContents = fillContents; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessArrayNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessArrayNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo public abstract class AccessArrayNode extends FixedWithNextNode { - public static final NodeClass<AccessArrayNode> TYPE = NodeClass.get(AccessArrayNode.class); + public static final NodeClass<AccessArrayNode> TYPE = NodeClass.create(AccessArrayNode.class); @Input protected ValueNode array; public ValueNode array() { @@ -45,7 +45,7 @@ * * @param array the instruction that produces the array object value */ - public AccessArrayNode(NodeClass<?> c, Stamp stamp, ValueNode array) { + public AccessArrayNode(NodeClass<? extends AccessArrayNode> c, Stamp stamp, ValueNode array) { super(c, stamp); this.array = array; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public abstract class AccessFieldNode extends FixedWithNextNode implements Lowerable { - public static final NodeClass<AccessFieldNode> TYPE = NodeClass.get(AccessFieldNode.class); + public static final NodeClass<AccessFieldNode> TYPE = NodeClass.create(AccessFieldNode.class); @OptionalInput ValueNode object; protected final ResolvedJavaField field; @@ -50,7 +50,7 @@ * @param object the instruction producing the receiver object * @param field the compiler interface representation of the field */ - public AccessFieldNode(NodeClass<?> c, Stamp stamp, ValueNode object, ResolvedJavaField field) { + public AccessFieldNode(NodeClass<? extends AccessFieldNode> c, Stamp stamp, ValueNode object, ResolvedJavaField field) { super(c, stamp); this.object = object; this.field = field;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo public abstract class AccessIndexedNode extends AccessArrayNode implements Lowerable { - public static final NodeClass<AccessIndexedNode> TYPE = NodeClass.get(AccessIndexedNode.class); + public static final NodeClass<AccessIndexedNode> TYPE = NodeClass.create(AccessIndexedNode.class); @Input protected ValueNode index; protected final Kind elementKind; @@ -52,7 +52,7 @@ * @param index the instruction producing the index * @param elementKind the kind of the elements of the array */ - protected AccessIndexedNode(NodeClass<?> c, Stamp stamp, ValueNode array, ValueNode index, Kind elementKind) { + protected AccessIndexedNode(NodeClass<? extends AccessIndexedNode> c, Stamp stamp, ValueNode array, ValueNode index, Kind elementKind) { super(c, stamp, array); this.index = index; this.elementKind = elementKind;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessMonitorNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessMonitorNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public abstract class AccessMonitorNode extends AbstractMemoryCheckpoint implements MemoryCheckpoint, DeoptimizingNode.DeoptBefore, DeoptimizingNode.DeoptAfter { - public static final NodeClass<AccessMonitorNode> TYPE = NodeClass.get(AccessMonitorNode.class); + public static final NodeClass<AccessMonitorNode> TYPE = NodeClass.create(AccessMonitorNode.class); @OptionalInput(InputType.State) FrameState stateBefore; @Input ValueNode object; @Input(InputType.Association) MonitorIdNode monitorId; @@ -71,7 +71,7 @@ * * @param object the instruction producing the object */ - protected AccessMonitorNode(NodeClass<?> c, ValueNode object, MonitorIdNode monitorId) { + protected AccessMonitorNode(NodeClass<? extends AccessMonitorNode> c, ValueNode object, MonitorIdNode monitorId) { super(c, StampFactory.forVoid()); this.object = object; this.monitorId = monitorId;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public final class ArrayLengthNode extends FixedWithNextNode implements Canonicalizable.Unary<ValueNode>, Lowerable, Virtualizable { - public static final NodeClass<ArrayLengthNode> TYPE = NodeClass.get(ArrayLengthNode.class); + public static final NodeClass<ArrayLengthNode> TYPE = NodeClass.create(ArrayLengthNode.class); @Input ValueNode array; public ValueNode array() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndAddNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndAddNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class AtomicReadAndAddNode extends AbstractMemoryCheckpoint implements LIRLowerable, MemoryCheckpoint.Single { - public static final NodeClass<AtomicReadAndAddNode> TYPE = NodeClass.get(AtomicReadAndAddNode.class); + public static final NodeClass<AtomicReadAndAddNode> TYPE = NodeClass.create(AtomicReadAndAddNode.class); @Input ValueNode object; @Input ValueNode offset; @Input ValueNode delta;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndWriteNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndWriteNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,7 +40,7 @@ @NodeInfo public final class AtomicReadAndWriteNode extends AbstractMemoryCheckpoint implements Lowerable, MemoryCheckpoint.Single { - public static final NodeClass<AtomicReadAndWriteNode> TYPE = NodeClass.get(AtomicReadAndWriteNode.class); + public static final NodeClass<AtomicReadAndWriteNode> TYPE = NodeClass.create(AtomicReadAndWriteNode.class); @Input ValueNode object; @Input ValueNode offset; @Input ValueNode newValue;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public final class CheckCastDynamicNode extends FixedWithNextNode implements Canonicalizable.Binary<ValueNode>, Lowerable { - public static final NodeClass<CheckCastDynamicNode> TYPE = NodeClass.get(CheckCastDynamicNode.class); + public static final NodeClass<CheckCastDynamicNode> TYPE = NodeClass.create(CheckCastDynamicNode.class); @Input ValueNode object; @Input ValueNode hub;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -44,7 +44,7 @@ @NodeInfo public final class CheckCastNode extends FixedWithNextNode implements Canonicalizable, Simplifiable, Lowerable, Virtualizable, ValueProxy { - public static final NodeClass<CheckCastNode> TYPE = NodeClass.get(CheckCastNode.class); + public static final NodeClass<CheckCastNode> TYPE = NodeClass.create(CheckCastNode.class); @Input protected ValueNode object; protected final ResolvedJavaType type; protected final JavaTypeProfile profile;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ClassIsAssignableFromNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ClassIsAssignableFromNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public final class ClassIsAssignableFromNode extends LogicNode implements Canonicalizable.Binary<ValueNode>, Lowerable { - public static final NodeClass<ClassIsAssignableFromNode> TYPE = NodeClass.get(ClassIsAssignableFromNode.class); + public static final NodeClass<ClassIsAssignableFromNode> TYPE = NodeClass.create(ClassIsAssignableFromNode.class); @Input ValueNode thisClass; @Input ValueNode otherClass;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class CompareAndSwapNode extends AbstractMemoryCheckpoint implements Lowerable, MemoryCheckpoint.Single { - public static final NodeClass<CompareAndSwapNode> TYPE = NodeClass.get(CompareAndSwapNode.class); + public static final NodeClass<CompareAndSwapNode> TYPE = NodeClass.create(CompareAndSwapNode.class); @Input ValueNode object; @Input ValueNode offset; @Input ValueNode expected;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ */ @NodeInfo public class DynamicNewArrayNode extends AbstractNewArrayNode { - public static final NodeClass<DynamicNewArrayNode> TYPE = NodeClass.get(DynamicNewArrayNode.class); + public static final NodeClass<DynamicNewArrayNode> TYPE = NodeClass.create(DynamicNewArrayNode.class); @Input ValueNode elementType; @@ -57,7 +57,7 @@ this(TYPE, elementType, length, fillContents, knownElementKind); } - protected DynamicNewArrayNode(NodeClass<?> c, ValueNode elementType, ValueNode length, boolean fillContents, Kind knownElementKind) { + protected DynamicNewArrayNode(NodeClass<? extends DynamicNewArrayNode> c, ValueNode elementType, ValueNode length, boolean fillContents, Kind knownElementKind) { super(c, StampFactory.objectNonNull(), length, fillContents); this.elementType = elementType; this.knownElementKind = knownElementKind;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewInstanceNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewInstanceNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo public final class DynamicNewInstanceNode extends AbstractNewObjectNode implements Canonicalizable { - public static final NodeClass<DynamicNewInstanceNode> TYPE = NodeClass.get(DynamicNewInstanceNode.class); + public static final NodeClass<DynamicNewInstanceNode> TYPE = NodeClass.create(DynamicNewInstanceNode.class); @Input ValueNode clazz;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ */ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class ExceptionObjectNode extends DispatchBeginNode implements Lowerable, MemoryCheckpoint.Single { - public static final NodeClass<ExceptionObjectNode> TYPE = NodeClass.get(ExceptionObjectNode.class); + public static final NodeClass<ExceptionObjectNode> TYPE = NodeClass.create(ExceptionObjectNode.class); public ExceptionObjectNode(MetaAccessProvider metaAccess) { super(TYPE, StampFactory.declaredNonNull(metaAccess.lookupJavaType(Throwable.class)));
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ */ @NodeInfo public class InstanceOfDynamicNode extends LogicNode implements Canonicalizable.Binary<ValueNode>, Lowerable { - public static final NodeClass<InstanceOfDynamicNode> TYPE = NodeClass.get(InstanceOfDynamicNode.class); + public static final NodeClass<InstanceOfDynamicNode> TYPE = NodeClass.create(InstanceOfDynamicNode.class); @Input ValueNode object; @Input ValueNode mirror;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ */ @NodeInfo public final class InstanceOfNode extends UnaryOpLogicNode implements Lowerable, Virtualizable { - public static final NodeClass<InstanceOfNode> TYPE = NodeClass.get(InstanceOfNode.class); + public static final NodeClass<InstanceOfNode> TYPE = NodeClass.create(InstanceOfNode.class); protected final ResolvedJavaType type; protected JavaTypeProfile profile;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadExceptionObjectNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadExceptionObjectNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo public final class LoadExceptionObjectNode extends AbstractStateSplit implements Lowerable { - public static final NodeClass<LoadExceptionObjectNode> TYPE = NodeClass.get(LoadExceptionObjectNode.class); + public static final NodeClass<LoadExceptionObjectNode> TYPE = NodeClass.create(LoadExceptionObjectNode.class); public LoadExceptionObjectNode(Stamp stamp) { super(TYPE, stamp);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,7 +40,7 @@ @NodeInfo(nameTemplate = "LoadField#{p#field/s}") public final class LoadFieldNode extends AccessFieldNode implements Canonicalizable.Unary<ValueNode>, VirtualizableRoot, UncheckedInterfaceProvider { - public static final NodeClass<LoadFieldNode> TYPE = NodeClass.get(LoadFieldNode.class); + public static final NodeClass<LoadFieldNode> TYPE = NodeClass.create(LoadFieldNode.class); public LoadFieldNode(ValueNode object, ResolvedJavaField field) { super(TYPE, createStamp(field), object, field);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo public class LoadIndexedNode extends AccessIndexedNode implements Virtualizable, Canonicalizable { - public static final NodeClass<LoadIndexedNode> TYPE = NodeClass.get(LoadIndexedNode.class); + public static final NodeClass<LoadIndexedNode> TYPE = NodeClass.create(LoadIndexedNode.class); /** * Creates a new LoadIndexedNode. @@ -58,7 +58,7 @@ return new LoadIndexedNode(array, index, elementKind); } - protected LoadIndexedNode(NodeClass<?> c, Stamp stamp, ValueNode array, ValueNode index, Kind elementKind) { + protected LoadIndexedNode(NodeClass<? extends LoadIndexedNode> c, Stamp stamp, ValueNode array, ValueNode index, Kind elementKind) { super(c, stamp, array, index, elementKind); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredAtomicReadAndWriteNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredAtomicReadAndWriteNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class LoweredAtomicReadAndWriteNode extends FixedAccessNode implements StateSplit, LIRLowerable, MemoryCheckpoint.Single { - public static final NodeClass<LoweredAtomicReadAndWriteNode> TYPE = NodeClass.get(LoweredAtomicReadAndWriteNode.class); + public static final NodeClass<LoweredAtomicReadAndWriteNode> TYPE = NodeClass.create(LoweredAtomicReadAndWriteNode.class); @Input ValueNode newValue; @OptionalInput(InputType.State) FrameState stateAfter;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredCompareAndSwapNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredCompareAndSwapNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Value, InputType.Memory}) public final class LoweredCompareAndSwapNode extends FixedAccessNode implements StateSplit, LIRLowerable, MemoryCheckpoint.Single { - public static final NodeClass<LoweredCompareAndSwapNode> TYPE = NodeClass.get(LoweredCompareAndSwapNode.class); + public static final NodeClass<LoweredCompareAndSwapNode> TYPE = NodeClass.create(LoweredCompareAndSwapNode.class); @Input ValueNode expectedValue; @Input ValueNode newValue; @OptionalInput(InputType.State) FrameState stateAfter;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,14 +34,14 @@ @NodeInfo public class MethodCallTargetNode extends CallTargetNode implements IterableNodeType, Simplifiable { - public static final NodeClass<MethodCallTargetNode> TYPE = NodeClass.get(MethodCallTargetNode.class); + public static final NodeClass<MethodCallTargetNode> TYPE = NodeClass.create(MethodCallTargetNode.class); protected final JavaType returnType; public MethodCallTargetNode(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] arguments, JavaType returnType) { this(TYPE, invokeKind, targetMethod, arguments, returnType); } - protected MethodCallTargetNode(NodeClass<?> c, InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] arguments, JavaType returnType) { + protected MethodCallTargetNode(NodeClass<? extends MethodCallTargetNode> c, InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] arguments, JavaType returnType) { super(c, arguments, targetMethod, invokeKind); this.returnType = returnType; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public final class MonitorEnterNode extends AccessMonitorNode implements Virtualizable, Lowerable, IterableNodeType, MonitorEnter, MemoryCheckpoint.Single { - public static final NodeClass<MonitorEnterNode> TYPE = NodeClass.get(MonitorEnterNode.class); + public static final NodeClass<MonitorEnterNode> TYPE = NodeClass.create(MonitorEnterNode.class); public MonitorEnterNode(ValueNode object, MonitorIdNode monitorId) { super(TYPE, object, monitorId);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class MonitorExitNode extends AccessMonitorNode implements Virtualizable, Simplifiable, Lowerable, IterableNodeType, MonitorExit, MemoryCheckpoint.Single { - public static final NodeClass<MonitorExitNode> TYPE = NodeClass.get(MonitorExitNode.class); + public static final NodeClass<MonitorExitNode> TYPE = NodeClass.create(MonitorExitNode.class); @OptionalInput ValueNode escapedReturnValue; public MonitorExitNode(ValueNode object, MonitorIdNode monitorId, ValueNode escapedReturnValue) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorIdNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorIdNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,14 +36,14 @@ @NodeInfo(allowedUsageTypes = {InputType.Association}) public class MonitorIdNode extends ValueNode implements IterableNodeType, LIRLowerable { - public static final NodeClass<MonitorIdNode> TYPE = NodeClass.get(MonitorIdNode.class); + public static final NodeClass<MonitorIdNode> TYPE = NodeClass.create(MonitorIdNode.class); protected int lockDepth; public MonitorIdNode(int lockDepth) { this(TYPE, lockDepth); } - protected MonitorIdNode(NodeClass<?> c, int lockDepth) { + protected MonitorIdNode(NodeClass<? extends MonitorIdNode> c, int lockDepth) { super(c, StampFactory.forVoid()); this.lockDepth = lockDepth; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,13 +41,13 @@ @NodeInfo public class NewArrayNode extends AbstractNewArrayNode implements VirtualizableAllocation { - public static final NodeClass<NewArrayNode> TYPE = NodeClass.get(NewArrayNode.class); + public static final NodeClass<NewArrayNode> TYPE = NodeClass.create(NewArrayNode.class); public NewArrayNode(ResolvedJavaType elementType, ValueNode length, boolean fillContents) { super(TYPE, StampFactory.exactNonNull(elementType.getArrayClass()), length, fillContents); } - protected NewArrayNode(NodeClass<?> c, ResolvedJavaType elementType, ValueNode length, boolean fillContents) { + protected NewArrayNode(NodeClass<? extends NewArrayNode> c, ResolvedJavaType elementType, ValueNode length, boolean fillContents) { super(c, StampFactory.exactNonNull(elementType.getArrayClass()), length, fillContents); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo(nameTemplate = "New {p#instanceClass/s}") public final class NewInstanceNode extends AbstractNewObjectNode implements VirtualizableAllocation { - public static final NodeClass<NewInstanceNode> TYPE = NodeClass.get(NewInstanceNode.class); + public static final NodeClass<NewInstanceNode> TYPE = NodeClass.create(NewInstanceNode.class); protected final ResolvedJavaType instanceClass; public NewInstanceNode(ResolvedJavaType type, boolean fillContents) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public final class NewMultiArrayNode extends DeoptimizingFixedWithNextNode implements Lowerable, ArrayLengthProvider { - public static final NodeClass<NewMultiArrayNode> TYPE = NodeClass.get(NewMultiArrayNode.class); + public static final NodeClass<NewMultiArrayNode> TYPE = NodeClass.create(NewMultiArrayNode.class); @Input protected NodeInputList<ValueNode> dimensions; protected final ResolvedJavaType type;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class RegisterFinalizerNode extends AbstractStateSplit implements Canonicalizable.Unary<ValueNode>, LIRLowerable, Virtualizable, DeoptimizingNode.DeoptAfter { - public static final NodeClass<RegisterFinalizerNode> TYPE = NodeClass.get(RegisterFinalizerNode.class); + public static final NodeClass<RegisterFinalizerNode> TYPE = NodeClass.create(RegisterFinalizerNode.class); @OptionalInput(InputType.State) FrameState deoptState; @Input ValueNode value;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/SelfReplacingMethodCallTargetNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/SelfReplacingMethodCallTargetNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class SelfReplacingMethodCallTargetNode extends MethodCallTargetNode implements Lowerable { - public static final NodeClass<SelfReplacingMethodCallTargetNode> TYPE = NodeClass.get(SelfReplacingMethodCallTargetNode.class); + public static final NodeClass<SelfReplacingMethodCallTargetNode> TYPE = NodeClass.create(SelfReplacingMethodCallTargetNode.class); // Replacement method data protected final ResolvedJavaMethod replacementTargetMethod; protected final JavaType replacementReturnType;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreFieldNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreFieldNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ */ @NodeInfo(nameTemplate = "StoreField#{p#field/s}") public final class StoreFieldNode extends AccessFieldNode implements StateSplit, VirtualizableRoot { - public static final NodeClass<StoreFieldNode> TYPE = NodeClass.get(StoreFieldNode.class); + public static final NodeClass<StoreFieldNode> TYPE = NodeClass.create(StoreFieldNode.class); @Input ValueNode value; @OptionalInput(InputType.State) FrameState stateAfter;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo public final class StoreIndexedNode extends AccessIndexedNode implements StateSplit, Lowerable, Virtualizable { - public static final NodeClass<StoreIndexedNode> TYPE = NodeClass.get(StoreIndexedNode.class); + public static final NodeClass<StoreIndexedNode> TYPE = NodeClass.create(StoreIndexedNode.class); @Input ValueNode value; @OptionalInput(InputType.State) FrameState stateAfter;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -41,7 +41,7 @@ @NodeInfo public final class TypeSwitchNode extends SwitchNode implements LIRLowerable, Simplifiable { - public static final NodeClass<TypeSwitchNode> TYPE = NodeClass.get(TypeSwitchNode.class); + public static final NodeClass<TypeSwitchNode> TYPE = NodeClass.create(TypeSwitchNode.class); protected final ResolvedJavaType[] keys; public TypeSwitchNode(ValueNode value, AbstractBeginNode[] successors, ResolvedJavaType[] keys, double[] keyProbabilities, int[] keySuccessors) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/PiPushable.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/PiPushable.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ public interface PiPushable { /** - * + * * @param parent PiNode * @return true if node was moved */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Virtualizable.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Virtualizable.java Mon Feb 23 16:23:23 2015 -0800 @@ -60,7 +60,7 @@ * tool, and not directly on the node, because by the time this method is called the * virtualized/non-virtualized state is still speculative and might not hold because of loops, * etc. - * + * * @param tool the tool used to describe the effects of this node */ void virtualize(VirtualizerTool tool);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizableAllocation.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizableAllocation.java Mon Feb 23 16:23:23 2015 -0800 @@ -25,7 +25,7 @@ /** * This interface allows a node to convey information about what its effect would be if some of its * inputs were virtualized. - * + * * The difference to {@link VirtualizableRoot} is that removing {@link VirtualizableAllocation} * nodes is not considered progress during the escape analysis iterations. */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizableRoot.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizableRoot.java Mon Feb 23 16:23:23 2015 -0800 @@ -25,12 +25,12 @@ /** * This interface allows a node to convey information about what its effect would be if some of its * inputs were virtualized. - * + * * The difference to {@link Virtualizable} is that the {@link #virtualize(VirtualizerTool)} method * will be called regardless of whether this node had any interaction with virtualized nodes. This * interface can therefore be used for object allocations, for which virtualization introduces new * virtualized objects. - * + * */ public interface VirtualizableRoot extends Virtualizable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java Mon Feb 23 16:23:23 2015 -0800 @@ -24,15 +24,14 @@ import java.util.*; +import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.iterators.*; import com.oracle.graal.graph.spi.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.virtual.*; public class GraphUtil { @@ -40,7 +39,7 @@ @Override public final boolean apply(Node n) { - return n instanceof FloatingNode || n instanceof VirtualState || n instanceof CallTargetNode || n instanceof VirtualObjectNode; + return !(n instanceof FixedNode); } }; @@ -50,7 +49,7 @@ // We reached a control flow end. AbstractEndNode end = (AbstractEndNode) node; killEnd(end, tool); - } else { + } else if (node instanceof FixedNode) { // Normal control flow node. /* * We do not take a successor snapshot because this iterator supports concurrent @@ -62,6 +61,7 @@ killCFG(successor, tool); } } + node.replaceAtPredecessor(null); propagateKill(node); } @@ -112,21 +112,36 @@ return FLOATING; } - public static void propagateKill(Node node) { + private static void propagateKill(Node node) { if (node != null && node.isAlive()) { - List<Node> usagesSnapshot = node.usages().filter(isFloatingNode()).snapshot(); + node.markDeleted(); + + node.acceptInputs((n, in) -> { + if (in.isAlive()) { + in.removeUsage(n); + if (in.hasNoUsages() && !(in instanceof FixedNode)) { + killWithUnusedFloatingInputs(in); + } + } + }); - // null out remaining usages - node.replaceAtUsages(null); - node.replaceAtPredecessor(null); - killWithUnusedFloatingInputs(node); - - for (Node usage : usagesSnapshot) { - if (!usage.isDeleted()) { - if (usage instanceof PhiNode) { - usage.replaceFirstInput(node, null); - } else { - propagateKill(usage); + ArrayList<Node> usageToKill = null; + for (Node usage : node.usages()) { + if (usage.isAlive() && !(usage instanceof FixedNode)) { + if (usageToKill == null) { + usageToKill = new ArrayList<>(); + } + usageToKill.add(usage); + } + } + if (usageToKill != null) { + for (Node usage : usageToKill) { + if (usage.isAlive()) { + if (usage instanceof PhiNode) { + usage.replaceFirstInput(node, null); + } else { + propagateKill(usage); + } } } } @@ -134,11 +149,9 @@ } public static void killWithUnusedFloatingInputs(Node node) { - List<Node> floatingInputs = node.inputs().filter(isFloatingNode()).snapshot(); node.safeDelete(); - - for (Node in : floatingInputs) { - if (in.isAlive() && in.hasNoUsages()) { + for (Node in : node.inputs()) { + if (in.isAlive() && in.hasNoUsages() && !(in instanceof FixedNode)) { killWithUnusedFloatingInputs(in); } } @@ -241,13 +254,7 @@ if (n instanceof StateSplit) { FrameState state = ((StateSplit) n).stateAfter(); - while (state != null) { - ResolvedJavaMethod method = state.method(); - if (method != null) { - elements.add(method.asStackTraceElement(state.bci - 1)); - } - state = state.outerFrameState(); - } + elements.addAll(Arrays.asList(approxSourceStackTraceElement(state))); break; } n = n.predecessor(); @@ -256,14 +263,63 @@ } /** + * Gets an approximate source code location for frame state. + * + * @return the StackTraceElements if an approximate source location is found, null otherwise + */ + public static StackTraceElement[] approxSourceStackTraceElement(FrameState frameState) { + ArrayList<StackTraceElement> elements = new ArrayList<>(); + FrameState state = frameState; + while (state != null) { + ResolvedJavaMethod method = state.method(); + if (method != null) { + elements.add(method.asStackTraceElement(state.bci - 1)); + } + state = state.outerFrameState(); + } + return elements.toArray(new StackTraceElement[0]); + } + + /** * Gets an approximate source code location for a node, encoded as an exception, if possible. * * @return the exception with the location */ public static RuntimeException approxSourceException(Node node, Throwable cause) { final StackTraceElement[] elements = approxSourceStackTraceElement(node); + return createBailoutException(cause == null ? "" : cause.getMessage(), cause, elements); + } + + /** + * Creates a bailout exception with the given stack trace elements and message. + * + * @param message the message of the exception + * @param elements the stack trace elements + * @return the exception + */ + public static BailoutException createBailoutException(String message, Throwable cause, StackTraceElement[] elements) { @SuppressWarnings("serial") - RuntimeException exception = new RuntimeException((cause == null) ? null : cause.getMessage(), cause) { + BailoutException exception = new BailoutException(cause, message) { + + @Override + public final synchronized Throwable fillInStackTrace() { + setStackTrace(elements); + return this; + } + }; + return exception; + } + + /** + * Creates a runtime exception with the given stack trace elements and message. + * + * @param message the message of the exception + * @param elements the stack trace elements + * @return the exception + */ + public static RuntimeException createRuntimeException(String message, Throwable cause, StackTraceElement[] elements) { + @SuppressWarnings("serial") + RuntimeException exception = new RuntimeException(message, cause) { @Override public final synchronized Throwable fillInStackTrace() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/AllocatedObjectNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/AllocatedObjectNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo public final class AllocatedObjectNode extends FloatingNode implements Virtualizable, ArrayLengthProvider { - public static final NodeClass<AllocatedObjectNode> TYPE = NodeClass.get(AllocatedObjectNode.class); + public static final NodeClass<AllocatedObjectNode> TYPE = NodeClass.create(AllocatedObjectNode.class); @Input VirtualObjectNode virtualObject; @Input(InputType.Extension) CommitAllocationNode commit;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo(nameTemplate = "Alloc {i#virtualObjects}", allowedUsageTypes = {InputType.Extension}) public final class CommitAllocationNode extends FixedWithNextNode implements VirtualizableAllocation, Lowerable, Simplifiable { - public static final NodeClass<CommitAllocationNode> TYPE = NodeClass.get(CommitAllocationNode.class); + public static final NodeClass<CommitAllocationNode> TYPE = NodeClass.create(CommitAllocationNode.class); @Input NodeInputList<VirtualObjectNode> virtualObjects = new NodeInputList<>(this); @Input NodeInputList<ValueNode> values = new NodeInputList<>(this); @Input(InputType.Association) NodeInputList<MonitorIdNode> locks = new NodeInputList<>(this);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EscapeObjectState.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EscapeObjectState.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,7 +29,7 @@ @NodeInfo public abstract class EscapeObjectState extends VirtualState implements ValueNumberable { - public static final NodeClass<EscapeObjectState> TYPE = NodeClass.get(EscapeObjectState.class); + public static final NodeClass<EscapeObjectState> TYPE = NodeClass.create(EscapeObjectState.class); @Input protected VirtualObjectNode object; @@ -37,7 +37,7 @@ return object; } - public EscapeObjectState(NodeClass<?> c, VirtualObjectNode object) { + public EscapeObjectState(NodeClass<? extends EscapeObjectState> c, VirtualObjectNode object) { super(c); this.object = object; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualArrayNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualArrayNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo(nameTemplate = "VirtualArray {p#componentType/s}[{p#length}]") public final class VirtualArrayNode extends VirtualObjectNode implements ArrayLengthProvider { - public static final NodeClass<VirtualArrayNode> TYPE = NodeClass.get(VirtualArrayNode.class); + public static final NodeClass<VirtualArrayNode> TYPE = NodeClass.create(VirtualArrayNode.class); protected final ResolvedJavaType componentType; protected final int length;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualBoxingNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualBoxingNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo public final class VirtualBoxingNode extends VirtualInstanceNode { - public static final NodeClass<VirtualBoxingNode> TYPE = NodeClass.get(VirtualBoxingNode.class); + public static final NodeClass<VirtualBoxingNode> TYPE = NodeClass.create(VirtualBoxingNode.class); protected final Kind boxingKind; public VirtualBoxingNode(ResolvedJavaType type, Kind boxingKind) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo(nameTemplate = "VirtualInstance {p#type/s}") public class VirtualInstanceNode extends VirtualObjectNode { - public static final NodeClass<VirtualInstanceNode> TYPE = NodeClass.get(VirtualInstanceNode.class); + public static final NodeClass<VirtualInstanceNode> TYPE = NodeClass.create(VirtualInstanceNode.class); protected final ResolvedJavaType type; protected final ResolvedJavaField[] fields; @@ -42,11 +42,11 @@ this(TYPE, type, fields, hasIdentity); } - protected VirtualInstanceNode(NodeClass<?> c, ResolvedJavaType type, boolean hasIdentity) { + protected VirtualInstanceNode(NodeClass<? extends VirtualInstanceNode> c, ResolvedJavaType type, boolean hasIdentity) { this(c, type, type.getInstanceFields(true), hasIdentity); } - protected VirtualInstanceNode(NodeClass<?> c, ResolvedJavaType type, ResolvedJavaField[] fields, boolean hasIdentity) { + protected VirtualInstanceNode(NodeClass<? extends VirtualInstanceNode> c, ResolvedJavaType type, ResolvedJavaField[] fields, boolean hasIdentity) { super(c, type, hasIdentity); this.type = type; this.fields = fields;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualObjectNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualObjectNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,10 +32,10 @@ @NodeInfo public abstract class VirtualObjectNode extends ValueNode implements LIRLowerable, IterableNodeType { - public static final NodeClass<VirtualObjectNode> TYPE = NodeClass.get(VirtualObjectNode.class); + public static final NodeClass<VirtualObjectNode> TYPE = NodeClass.create(VirtualObjectNode.class); protected boolean hasIdentity; - protected VirtualObjectNode(NodeClass<?> c, ResolvedJavaType type, boolean hasIdentity) { + protected VirtualObjectNode(NodeClass<? extends VirtualObjectNode> c, ResolvedJavaType type, boolean hasIdentity) { super(c, StampFactory.exactNonNull(type)); this.hasIdentity = hasIdentity; }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -311,9 +311,6 @@ if (canonical != null && !canonical.isAlive()) { assert !canonical.isDeleted(); canonical = graph.addOrUniqueWithInputs(canonical); - if (canonical == node) { - graph.addOrUniqueWithInputs(newCanonical); - } } if (node instanceof FloatingNode) { if (canonical == null) {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,6 +34,7 @@ import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.util.*; import com.oracle.graal.phases.*; +import com.oracle.graal.phases.tiers.*; /** * This phase will find branches which always end with a {@link DeoptimizeNode} and replace their @@ -48,7 +49,7 @@ * {@link DeoptimizeNode} as close to the {@link ControlSplitNode} as possible. * */ -public class ConvertDeoptimizeToGuardPhase extends Phase { +public class ConvertDeoptimizeToGuardPhase extends BasePhase<PhaseContext> { private SimplifierTool simplifierTool = GraphUtil.getDefaultSimplifier(null, null, false); private static AbstractBeginNode findBeginNode(FixedNode startNode) { @@ -56,7 +57,7 @@ } @Override - protected void run(final StructuredGraph graph) { + protected void run(final StructuredGraph graph, PhaseContext context) { assert graph.hasValueProxies() : "ConvertDeoptimizeToGuardPhase always creates proxies"; if (graph.getNodes(DeoptimizeNode.TYPE).isEmpty()) { return; @@ -66,46 +67,71 @@ visitDeoptBegin(AbstractBeginNode.prevBegin(d), d.action(), d.reason(), graph); } - for (FixedGuardNode fixedGuard : graph.getNodes(FixedGuardNode.TYPE)) { - - AbstractBeginNode pred = AbstractBeginNode.prevBegin(fixedGuard); - if (pred instanceof AbstractMergeNode) { - AbstractMergeNode merge = (AbstractMergeNode) pred; - if (fixedGuard.condition() instanceof CompareNode) { - CompareNode compare = (CompareNode) fixedGuard.condition(); - List<AbstractEndNode> mergePredecessors = merge.cfgPredecessors().snapshot(); - - Constant[] xs = IfNode.constantValues(compare.getX(), merge, true); - if (xs == null) { - continue; - } - Constant[] ys = IfNode.constantValues(compare.getY(), merge, true); - if (ys == null) { - continue; - } - for (int i = 0; i < mergePredecessors.size(); ++i) { - AbstractEndNode mergePredecessor = mergePredecessors.get(i); - if (!mergePredecessor.isAlive()) { - break; - } - if (xs[i] == null) { - continue; - } - if (ys[i] == null) { - continue; - } - if (xs[i] instanceof PrimitiveConstant && ys[i] instanceof PrimitiveConstant && - compare.condition().foldCondition(xs[i], ys[i], null, compare.unorderedIsTrue()) == fixedGuard.isNegated()) { - visitDeoptBegin(AbstractBeginNode.prevBegin(mergePredecessor), fixedGuard.getAction(), fixedGuard.getReason(), graph); - } - } - } + if (context != null) { + for (FixedGuardNode fixedGuard : graph.getNodes(FixedGuardNode.TYPE)) { + trySplitFixedGuard(fixedGuard, context); } } new DeadCodeEliminationPhase(Optional).apply(graph); } + private void trySplitFixedGuard(FixedGuardNode fixedGuard, PhaseContext context) { + LogicNode condition = fixedGuard.condition(); + if (condition instanceof CompareNode) { + CompareNode compare = (CompareNode) condition; + ValueNode x = compare.getX(); + ValuePhiNode xPhi = (x instanceof ValuePhiNode) ? (ValuePhiNode) x : null; + if (x instanceof ConstantNode || xPhi != null) { + ValueNode y = compare.getY(); + ValuePhiNode yPhi = (y instanceof ValuePhiNode) ? (ValuePhiNode) y : null; + if (y instanceof ConstantNode || yPhi != null) { + processFixedGuardAndPhis(fixedGuard, context, compare, x, xPhi, y, yPhi); + } + } + } + } + + private void processFixedGuardAndPhis(FixedGuardNode fixedGuard, PhaseContext context, CompareNode compare, ValueNode x, ValuePhiNode xPhi, ValueNode y, ValuePhiNode yPhi) { + AbstractBeginNode pred = AbstractBeginNode.prevBegin(fixedGuard); + if (pred instanceof AbstractMergeNode) { + AbstractMergeNode merge = (AbstractMergeNode) pred; + if (xPhi != null && xPhi.merge() != merge) { + return; + } + if (yPhi != null && yPhi.merge() != merge) { + return; + } + + processFixedGuardAndMerge(fixedGuard, context, compare, x, xPhi, y, yPhi, merge); + } + } + + private void processFixedGuardAndMerge(FixedGuardNode fixedGuard, PhaseContext context, CompareNode compare, ValueNode x, ValuePhiNode xPhi, ValueNode y, ValuePhiNode yPhi, AbstractMergeNode merge) { + List<EndNode> mergePredecessors = merge.cfgPredecessors().snapshot(); + for (int i = 0; i < mergePredecessors.size(); ++i) { + AbstractEndNode mergePredecessor = mergePredecessors.get(i); + if (!mergePredecessor.isAlive()) { + break; + } + Constant xs; + if (xPhi == null) { + xs = x.asConstant(); + } else { + xs = xPhi.valueAt(mergePredecessor).asConstant(); + } + Constant ys; + if (yPhi == null) { + ys = y.asConstant(); + } else { + ys = yPhi.valueAt(mergePredecessor).asConstant(); + } + if (xs != null && ys != null && compare.condition().foldCondition(xs, ys, context.getConstantReflection(), compare.unorderedIsTrue()) == fixedGuard.isNegated()) { + visitDeoptBegin(AbstractBeginNode.prevBegin(mergePredecessor), fixedGuard.getAction(), fixedGuard.getReason(), fixedGuard.graph()); + } + } + } + private void visitDeoptBegin(AbstractBeginNode deoptBegin, DeoptimizationAction deoptAction, DeoptimizationReason deoptReason, StructuredGraph graph) { if (deoptBegin instanceof AbstractMergeNode) { AbstractMergeNode mergeNode = (AbstractMergeNode) deoptBegin;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -24,6 +24,8 @@ import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Options.*; +import java.util.function.*; + import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; @@ -70,93 +72,51 @@ if (optional && ReduceDCE.getValue()) { return; } + NodeFlood flood = graph.createNodeFlood(); - + int totalNodeCount = graph.getNodeCount(); flood.add(graph.start()); - iterateSuccessors(flood); - disconnectCFGNodes(flood, graph); - iterateInputs(flood, graph); + iterateSuccessorsAndInputs(flood); + int totalMarkedCount = flood.getTotalMarkedCount(); + if (totalNodeCount == totalMarkedCount) { + // All nodes are live => nothing more to do. + return; + } else { + // Some nodes are not marked alive and therefore dead => proceed. + assert totalNodeCount > totalMarkedCount; + } + deleteNodes(flood, graph); - - // remove chained Merges - for (AbstractMergeNode merge : graph.getNodes(AbstractMergeNode.TYPE)) { - if (merge.forwardEndCount() == 1 && !(merge instanceof LoopBeginNode)) { - graph.reduceTrivialMerge(merge); - } - } } - private static void iterateSuccessors(NodeFlood flood) { + private static void iterateSuccessorsAndInputs(NodeFlood flood) { + BiConsumer<Node, Node> consumer = (n, succ) -> { + flood.add(succ); + }; for (Node current : flood) { if (current instanceof AbstractEndNode) { AbstractEndNode end = (AbstractEndNode) current; flood.add(end.merge()); } else { - for (Node successor : current.successors()) { - flood.add(successor); - } - } - } - } - - private static void disconnectCFGNodes(NodeFlood flood, StructuredGraph graph) { - for (AbstractEndNode node : graph.getNodes(AbstractEndNode.TYPE)) { - if (!flood.isMarked(node)) { - AbstractMergeNode merge = node.merge(); - if (merge != null && flood.isMarked(merge)) { - // We are a dead end node leading to a live merge. - merge.removeEnd(node); - } - } - } - for (LoopBeginNode loop : graph.getNodes(LoopBeginNode.TYPE)) { - if (flood.isMarked(loop)) { - boolean reachable = false; - for (LoopEndNode end : loop.loopEnds()) { - if (flood.isMarked(end)) { - reachable = true; - break; - } - } - if (!reachable) { - Debug.log("Removing loop with unreachable end: %s", loop); - for (LoopEndNode end : loop.loopEnds().snapshot()) { - loop.removeEnd(end); - } - graph.reduceDegenerateLoopBegin(loop); - } + current.acceptSuccessors(consumer); + current.acceptInputs(consumer); } } } private static void deleteNodes(NodeFlood flood, StructuredGraph graph) { + BiConsumer<Node, Node> consumer = (n, input) -> { + if (input.isAlive() && flood.isMarked(input)) { + input.removeUsage(n); + } + }; + for (Node node : graph.getNodes()) { if (!flood.isMarked(node)) { - node.clearInputs(); - node.clearSuccessors(); - } - } - for (Node node : graph.getNodes()) { - if (!flood.isMarked(node)) { + node.markDeleted(); + node.acceptInputs(consumer); metricNodesRemoved.increment(); - node.safeDelete(); } } } - - private static void iterateInputs(NodeFlood flood, StructuredGraph graph) { - for (Node node : graph.getNodes()) { - if (flood.isMarked(node)) { - for (Node input : node.inputs()) { - flood.add(input); - } - } - } - for (Node current : flood) { - for (Node input : current.inputs()) { - flood.add(input); - } - } - } - }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ExpandLogicPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ExpandLogicPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -60,9 +60,9 @@ double firstIfProbability = shortCircuitProbability; /* * P(Y | not(X)) = P(Y inter not(X)) / P(not(X)) = (P(X union Y) - P(X)) / (1 - P(X)) - * + * * P(X) = shortCircuitProbability - * + * * P(X union Y) = ifNode.probability(trueTarget) */ double secondIfProbability = (ifNode.probability(trueTarget) - shortCircuitProbability) / (1 - shortCircuitProbability);
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -45,7 +45,6 @@ private boolean createFloatingReads; private boolean createMemoryMapNodes; - private boolean updateExistingPhis; public static class MemoryMapImpl implements MemoryMap { @@ -90,7 +89,7 @@ } public FloatingReadPhase() { - this(true, false, false); + this(true, false); } /** @@ -99,13 +98,10 @@ * {@link FloatingReadNode}s) where possible * @param createMemoryMapNodes a {@link MemoryMapNode} will be created for each return if this * is true - * @param updateExistingPhis if true, then existing {@link MemoryPhiNode}s in the graph will be - * updated */ - public FloatingReadPhase(boolean createFloatingReads, boolean createMemoryMapNodes, boolean updateExistingPhis) { + public FloatingReadPhase(boolean createFloatingReads, boolean createMemoryMapNodes) { this.createFloatingReads = createFloatingReads; this.createMemoryMapNodes = createMemoryMapNodes; - this.updateExistingPhis = updateExistingPhis; } /** @@ -135,7 +131,7 @@ ReentrantNodeIterator.apply(new CollectMemoryCheckpointsClosure(modifiedInLoops), graph.start(), CollectionsFactory.newSet()); HashSetNodeEventListener listener = new HashSetNodeEventListener(EnumSet.of(NODE_ADDED, ZERO_USAGES)); try (NodeEventScope nes = graph.trackNodeEvents(listener)) { - ReentrantNodeIterator.apply(new FloatingReadClosure(modifiedInLoops, createFloatingReads, createMemoryMapNodes, updateExistingPhis), graph.start(), new MemoryMapImpl(graph.start())); + ReentrantNodeIterator.apply(new FloatingReadClosure(modifiedInLoops, createFloatingReads, createMemoryMapNodes), graph.start(), new MemoryMapImpl(graph.start())); } for (Node n : removeExternallyUsedNodes(listener.getNodes())) { @@ -150,7 +146,7 @@ } } - public static MemoryMapImpl mergeMemoryMaps(AbstractMergeNode merge, List<? extends MemoryMap> states, boolean updateExistingPhis) { + public static MemoryMapImpl mergeMemoryMaps(AbstractMergeNode merge, List<? extends MemoryMap> states) { MemoryMapImpl newState = new MemoryMapImpl(); Set<LocationIdentity> keys = CollectionsFactory.newSet(); @@ -159,17 +155,6 @@ } assert checkNoImmutableLocations(keys); - Map<LocationIdentity, MemoryPhiNode> existingPhis = null; - if (updateExistingPhis) { - for (MemoryPhiNode phi : merge.phis().filter(MemoryPhiNode.class)) { - if (existingPhis == null) { - existingPhis = CollectionsFactory.newMap(); - } - phi.values().clear(); - existingPhis.put(phi.getLocationIdentity(), phi); - } - } - for (LocationIdentity key : keys) { int mergedStatesCount = 0; boolean isPhi = false; @@ -184,10 +169,7 @@ } else if (merged == null) { merged = last; } else { - MemoryPhiNode phi = null; - if (existingPhis == null || (phi = existingPhis.remove(key)) == null) { - phi = merge.graph().addWithoutUnique(new MemoryPhiNode(merge, key)); - } + MemoryPhiNode phi = merge.graph().addWithoutUnique(new MemoryPhiNode(merge, key)); for (int j = 0; j < mergedStatesCount; j++) { phi.addInput(ValueNodeUtil.asNode(merged)); } @@ -200,11 +182,6 @@ } newState.lastMemorySnapshot.put(key, merged); } - if (existingPhis != null) { - for (Map.Entry<LocationIdentity, MemoryPhiNode> entry : existingPhis.entrySet()) { - entry.getValue().replaceAndDelete(newState.getLastLocationAccess(entry.getKey()).asNode()); - } - } return newState; } @@ -273,13 +250,11 @@ private final Map<LoopBeginNode, Set<LocationIdentity>> modifiedInLoops; private boolean createFloatingReads; private boolean createMemoryMapNodes; - private boolean updateExistingPhis; - public FloatingReadClosure(Map<LoopBeginNode, Set<LocationIdentity>> modifiedInLoops, boolean createFloatingReads, boolean createMemoryMapNodes, boolean updateExistingPhis) { + public FloatingReadClosure(Map<LoopBeginNode, Set<LocationIdentity>> modifiedInLoops, boolean createFloatingReads, boolean createMemoryMapNodes) { this.modifiedInLoops = modifiedInLoops; this.createFloatingReads = createFloatingReads; this.createMemoryMapNodes = createMemoryMapNodes; - this.updateExistingPhis = updateExistingPhis; } @Override @@ -347,7 +322,7 @@ @Override protected MemoryMapImpl merge(AbstractMergeNode merge, List<MemoryMapImpl> states) { - return mergeMemoryMaps(merge, states, updateExistingPhis); + return mergeMemoryMaps(merge, states); } @Override @@ -378,24 +353,10 @@ Map<LocationIdentity, MemoryPhiNode> phis = CollectionsFactory.newMap(); - if (updateExistingPhis) { - for (MemoryPhiNode phi : loop.phis().filter(MemoryPhiNode.class).snapshot()) { - if (modifiedLocations.contains(phi.getLocationIdentity())) { - phi.values().clear(); - phi.addInput(ValueNodeUtil.asNode(initialState.getLastLocationAccess(phi.getLocationIdentity()))); - phis.put(phi.getLocationIdentity(), phi); - } else { - phi.replaceAndDelete(initialState.getLastLocationAccess(phi.getLocationIdentity()).asNode()); - } - } - } - for (LocationIdentity location : modifiedLocations) { - if (!updateExistingPhis || !phis.containsKey(location)) { - MemoryPhiNode phi = loop.graph().addWithoutUnique(new MemoryPhiNode(loop, location)); - phi.addInput(ValueNodeUtil.asNode(initialState.getLastLocationAccess(location))); - phis.put(location, phi); - } + MemoryPhiNode phi = loop.graph().addWithoutUnique(new MemoryPhiNode(loop, location)); + phi.addInput(ValueNodeUtil.asNode(initialState.getLastLocationAccess(location))); + phis.put(location, phi); } for (Map.Entry<LocationIdentity, MemoryPhiNode> entry : phis.entrySet()) { initialState.lastMemorySnapshot.put(entry.getKey(), entry.getValue());
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -48,7 +48,7 @@ @NodeInfo static final class DummyGuardHandle extends ValueNode implements GuardedNode { - public static final NodeClass<DummyGuardHandle> TYPE = NodeClass.get(DummyGuardHandle.class); + public static final NodeClass<DummyGuardHandle> TYPE = NodeClass.create(DummyGuardHandle.class); @Input(InputType.Guard) GuardingNode guard; public DummyGuardHandle(GuardingNode guard) {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -63,7 +63,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Guard, InputType.Anchor}) static final class DummyAnchorNode extends FixedWithNextNode implements GuardingNode, AnchoringNode { - public static final NodeClass<DummyAnchorNode> TYPE = NodeClass.get(DummyAnchorNode.class); + public static final NodeClass<DummyAnchorNode> TYPE = NodeClass.create(DummyAnchorNode.class); public DummyAnchorNode() { super(TYPE, StampFactory.forVoid()); @@ -280,11 +280,11 @@ mergeAfter.clearEnds(); expandDuplicated(duplicatedNodes, mergeAfter); - List<AbstractEndNode> endSnapshot = merge.forwardEnds().snapshot(); + List<EndNode> endSnapshot = merge.forwardEnds().snapshot(); List<PhiNode> phiSnapshot = merge.phis().snapshot(); int endIndex = 0; - for (final AbstractEndNode forwardEnd : merge.forwardEnds()) { + for (final EndNode forwardEnd : merge.forwardEnds()) { Map<Node, Node> duplicates; if (replacements == null || replacements.get(endIndex) == null) { duplicates = graph.addDuplicates(duplicatedNodes, graph, duplicatedNodes.size(), (DuplicationReplacement) null); @@ -296,7 +296,7 @@ for (Map.Entry<ValueNode, PhiNode> phi : bottomPhis.entrySet()) { phi.getValue().initializeValueAt(merge.forwardEndIndex(forwardEnd), (ValueNode) duplicates.get(phi.getKey())); } - mergeAfter.addForwardEnd((AbstractEndNode) duplicates.get(endAfter)); + mergeAfter.addForwardEnd((EndNode) duplicates.get(endAfter)); // re-wire the duplicated ValueAnchorNode to the predecessor of the corresponding // EndNode @@ -452,8 +452,8 @@ * @return The newly created end node. */ private AbstractEndNode createNewMerge(FixedNode successor, FrameState stateAfterMerge) { - AbstractMergeNode newBottomMerge = graph.add(new MergeNode()); - AbstractEndNode newBottomEnd = graph.add(new EndNode()); + MergeNode newBottomMerge = graph.add(new MergeNode()); + EndNode newBottomEnd = graph.add(new EndNode()); newBottomMerge.addForwardEnd(newBottomEnd); newBottomMerge.setStateAfter(stateAfterMerge); ((FixedWithNextNode) successor.predecessor()).setNext(newBottomEnd);
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java Mon Feb 23 16:23:23 2015 -0800 @@ -226,8 +226,10 @@ assert invoke.next() == continuation; invoke.setNext(null); returnMerge.setNext(continuation); - invoke.asNode().replaceAtUsages(returnValuePhi); - invoke.asNode().replaceAndDelete(null); + if (returnValuePhi != null) { + invoke.asNode().replaceAtUsages(returnValuePhi); + } + invoke.asNode().safeDelete(); ArrayList<GuardedValueNode> replacementNodes = new ArrayList<>(); @@ -464,7 +466,7 @@ AbstractBeginNode calleeEntryNode = graph.add(new BeginNode()); calleeEntryNode.setNext(duplicatedInvoke.asNode()); - AbstractEndNode endNode = graph.add(new EndNode()); + EndNode endNode = graph.add(new EndNode()); duplicatedInvoke.setNext(endNode); returnMerge.addForwardEnd(endNode); @@ -499,7 +501,7 @@ // set new state (pop old exception object, push new one) newExceptionEdge.setStateAfter(stateAfterException.duplicateModified(Kind.Object, newExceptionEdge)); - AbstractEndNode endNode = graph.add(new EndNode()); + EndNode endNode = graph.add(new EndNode()); newExceptionEdge.setNext(endNode); exceptionMerge.addForwardEnd(endNode); exceptionObjectPhi.addInput(newExceptionEdge);
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/VerifyPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/VerifyPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -54,7 +54,7 @@ /** * Performs the actual verification. - * + * * @throws VerificationError if the verification fails */ protected abstract boolean verify(StructuredGraph graph, C context);
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/FixedNodeProbabilityCache.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/FixedNodeProbabilityCache.java Mon Feb 23 16:23:23 2015 -0800 @@ -101,7 +101,7 @@ if (current.predecessor() == null) { if (current instanceof AbstractMergeNode) { AbstractMergeNode currentMerge = (AbstractMergeNode) current; - NodeInputList<AbstractEndNode> currentForwardEnds = currentMerge.forwardEnds(); + NodeInputList<EndNode> currentForwardEnds = currentMerge.forwardEnds(); /* * Use simple iteration instead of streams, since the stream infrastructure adds * many frames which causes the recursion to overflow the stack earlier than it
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/InferStamps.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/InferStamps.java Mon Feb 23 16:23:23 2015 -0800 @@ -56,6 +56,8 @@ } boolean stampChanged; + // The algorithm is not guaranteed to reach a stable state. + int z = 0; do { stampChanged = false; /* @@ -72,7 +74,8 @@ } } } - } while (stampChanged); + ++z; + } while (stampChanged && z < 10000); /* * Check that all the illegal stamps we introduced above are correctly replaced with real
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ScheduledNodeIterator.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ScheduledNodeIterator.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,7 @@ /** * Iterates over a list of nodes, which usually comes from * {@link SchedulePhase#getBlockToNodesMap()}. - * + * * While iterating, it is possible to {@link #insert(FixedNode, FixedWithNextNode) insert} and * {@link #replaceCurrent(FixedWithNextNode) replace} nodes. */
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -621,42 +621,23 @@ * @param earliestBlock */ private Block latestBlock(ValueNode node, SchedulingStrategy strategy, Block earliestBlock) { - CommonDominatorBlockClosure cdbc = new CommonDominatorBlockClosure(null); - ensureScheduledUsages(node, strategy); + Block block = null; for (Node usage : node.usages()) { - blocksForUsage(node, usage, cdbc, strategy); - if (cdbc.block == earliestBlock) { + block = blocksForUsage(node, usage, block, earliestBlock, strategy); + if (block == earliestBlock) { break; } } - assert assertLatestBlockResult(node, cdbc); - return cdbc.block; - } - - private boolean assertLatestBlockResult(ValueNode node, CommonDominatorBlockClosure cdbc) throws SchedulingError { - if (cdbc.block != null && !dominates(earliestBlock(node), cdbc.block)) { - throw new SchedulingError("failed to find correct latest schedule for %s. cdbc: %s, earliest: %s", node, cdbc.block, earliestBlock(node)); - } - return true; + assert assertLatestBlockResult(node, block); + return block; } - /** - * A closure that will calculate the common dominator of all blocks passed to its - * {@link #apply(Block)} method. - */ - private static class CommonDominatorBlockClosure implements BlockClosure { - - public Block block; - - public CommonDominatorBlockClosure(Block block) { - this.block = block; + private boolean assertLatestBlockResult(ValueNode node, Block block) throws SchedulingError { + if (block != null && !dominates(earliestBlock(node), block)) { + throw new SchedulingError("failed to find correct latest schedule for %s. cdbc: %s, earliest: %s", node, block, earliestBlock(node)); } - - @Override - public void apply(Block newBlock) { - this.block = commonDominatorTyped(this.block, newBlock); - } + return true; } /** @@ -671,41 +652,32 @@ if (earliest != null) { return earliest; } + return earliestBlockHelper(node, earliest); + } + + private Block earliestBlockHelper(Node node, Block earliestStart) throws SchedulingError { /* * All inputs must be in a dominating block, otherwise the graph cannot be scheduled. This * implies that the inputs' blocks have a total ordering via their dominance relation. So in * order to find the earliest block placement for this node we need to find the input block * that is dominated by all other input blocks. */ + Block earliest = earliestStart; if (node.predecessor() != null) { throw new SchedulingError(); } - for (Node input : node.inputs().nonNull()) { - assert input instanceof ValueNode; - Block inputEarliest; - if (input instanceof InvokeWithExceptionNode) { - inputEarliest = cfg.getNodeToBlock().get(((InvokeWithExceptionNode) input).next()); - } else { - inputEarliest = earliestBlock(input); - } - if (earliest == null) { - earliest = inputEarliest; - } else if (earliest != inputEarliest) { - // Find out whether earliest or inputEarliest is earlier. - Block a = earliest.getDominator(); - Block b = inputEarliest; - while (true) { - if (a == inputEarliest || b == null) { - // Nothing to change, the previous earliest block is still earliest. - break; - } else if (b == earliest || a == null) { - // New earliest is the earliest. - earliest = inputEarliest; - break; - } - a = a.getDominator(); - b = b.getDominator(); + for (Node input : node.inputs()) { + if (input != null) { + assert input instanceof ValueNode; + Block inputEarliest; + if (input instanceof InvokeWithExceptionNode) { + inputEarliest = cfg.getNodeToBlock().get(((InvokeWithExceptionNode) input).next()); + } else { + inputEarliest = earliestBlock(input); + } + if (earliest == null || earliest.getDominatorDepth() < inputEarliest.getDominatorDepth()) { + earliest = inputEarliest; } } } @@ -748,11 +720,11 @@ * * @param node the node that needs to be scheduled * @param usage the usage whose blocks need to be considered - * @param closure the closure that will be called for each block + * @param earliestBlock */ - private void blocksForUsage(ValueNode node, Node usage, CommonDominatorBlockClosure closure, SchedulingStrategy strategy) { + private Block blocksForUsage(ValueNode node, Node usage, Block startCurrentBlock, Block earliestBlock, SchedulingStrategy strategy) { assert !(node instanceof PhiNode); - + Block currentBlock = startCurrentBlock; if (usage instanceof PhiNode) { // An input to a PhiNode is used at the end of the predecessor block that corresponds to // the PhiNode input. @@ -763,7 +735,10 @@ Block mergeBlock = cfg.getNodeToBlock().get(merge); for (int i = 0; i < phi.valueCount(); ++i) { if (phi.valueAt(i) == node) { - closure.apply(mergeBlock.getPredecessors().get(i)); + currentBlock = AbstractControlFlowGraph.commonDominatorTyped(currentBlock, mergeBlock.getPredecessors().get(i)); + if (currentBlock == earliestBlock) { + break; + } } } } else if (usage instanceof VirtualState) { @@ -773,19 +748,19 @@ if (unscheduledUsage instanceof VirtualState) { // If a FrameState is an outer FrameState this method behaves as if the inner // FrameState was the actual usage, by recursing. - blocksForUsage(node, unscheduledUsage, closure, strategy); + currentBlock = blocksForUsage(node, unscheduledUsage, currentBlock, earliestBlock, strategy); } else if (unscheduledUsage instanceof AbstractBeginNode) { // Only FrameStates can be connected to BeginNodes. if (!(usage instanceof FrameState)) { throw new SchedulingError(usage.toString()); } if (unscheduledUsage instanceof StartNode) { - closure.apply(cfg.getNodeToBlock().get(unscheduledUsage)); + currentBlock = AbstractControlFlowGraph.commonDominatorTyped(currentBlock, cfg.getNodeToBlock().get(unscheduledUsage)); } else { // If a FrameState belongs to a BeginNode then it's inputs will be placed at // the common dominator of all EndNodes. for (Node pred : unscheduledUsage.cfgPredecessors()) { - closure.apply(cfg.getNodeToBlock().get(pred)); + currentBlock = AbstractControlFlowGraph.commonDominatorTyped(currentBlock, cfg.getNodeToBlock().get(pred)); } } } else { @@ -798,21 +773,18 @@ } // Otherwise: Put the input into the same block as the usage. assignBlockToNode((ValueNode) unscheduledUsage, strategy); - closure.apply(cfg.getNodeToBlock().get(unscheduledUsage)); + currentBlock = AbstractControlFlowGraph.commonDominatorTyped(currentBlock, cfg.getNodeToBlock().get(unscheduledUsage)); + } + if (currentBlock == earliestBlock) { + break; } } } else { // All other types of usages: Put the input into the same block as the usage. assignBlockToNode((ValueNode) usage, strategy); - closure.apply(cfg.getNodeToBlock().get(usage)); + currentBlock = AbstractControlFlowGraph.commonDominatorTyped(currentBlock, cfg.getNodeToBlock().get(usage)); } - } - - private void ensureScheduledUsages(Node node, SchedulingStrategy strategy) { - for (Node usage : node.usages().filter(ValueNode.class)) { - assignBlockToNode((ValueNode) usage, strategy); - } - // now true usages are ready + return currentBlock; } private void sortNodesWithinBlocks(StructuredGraph graph, SchedulingStrategy strategy) { @@ -1071,20 +1043,16 @@ return; } + addToLatestSortingHelper(i, state); + } + + private void addToLatestSortingHelper(ValueNode i, SortState state) { FrameState stateAfter = null; if (i instanceof StateSplit) { stateAfter = ((StateSplit) i).stateAfter(); } - for (Node input : i.inputs()) { - if (input instanceof FrameState) { - if (input != stateAfter) { - addUnscheduledToLatestSorting((FrameState) input, state); - } - } else { - addToLatestSorting((ValueNode) input, state); - } - } + addInputsToLatestSorting(i, state, stateAfter); if (state.readsSize() != 0) { if (i instanceof MemoryCheckpoint.Single) { @@ -1112,6 +1080,18 @@ } } + private void addInputsToLatestSorting(ValueNode i, SortState state, FrameState stateAfter) { + for (Node input : i.inputs()) { + if (input instanceof FrameState) { + if (input != stateAfter) { + addUnscheduledToLatestSorting((FrameState) input, state); + } + } else { + addToLatestSorting((ValueNode) input, state); + } + } + } + /** * Sorts the nodes within a block by adding the nodes to a list in a post-order iteration over * all usages. The resulting list is reversed to create an earliest-possible scheduling of
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/CompilerConfiguration.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/CompilerConfiguration.java Mon Feb 23 16:23:23 2015 -0800 @@ -24,9 +24,9 @@ import com.oracle.graal.api.runtime.*; import com.oracle.graal.lir.phases.*; -import com.oracle.graal.lir.phases.LIRHighTierPhase.*; -import com.oracle.graal.lir.phases.LIRLowTierPhase.*; -import com.oracle.graal.lir.phases.LIRMidTierPhase.*; +import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.*; +import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.*; +import com.oracle.graal.lir.phases.AllocationPhase.*; import com.oracle.graal.phases.*; public interface CompilerConfiguration extends Service { @@ -37,9 +37,9 @@ PhaseSuite<LowTierContext> createLowTier(); - LIRPhaseSuite<LIRHighTierContext> createLIRHighTier(); + LIRPhaseSuite<PreAllocationOptimizationContext> createPreAllocationOptimizationStage(); - LIRPhaseSuite<LIRMidTierContext> createLIRMidTier(); + LIRPhaseSuite<AllocationContext> createAllocationStage(); - LIRPhaseSuite<LIRLowTierContext> createLIRLowTier(); + LIRPhaseSuite<PostAllocationOptimizationContext> createPostAllocationOptimizationStage(); }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java Mon Feb 23 16:23:23 2015 -0800 @@ -133,7 +133,8 @@ public static LIRSuites createDefaultLIRSuites() { String selected = CompilerConfiguration.getValue(); if (selected.equals("")) { - return new LIRSuites(defaultConfiguration.createLIRHighTier(), defaultConfiguration.createLIRMidTier(), defaultConfiguration.createLIRLowTier()); + return new LIRSuites(defaultConfiguration.createPreAllocationOptimizationStage(), defaultConfiguration.createAllocationStage(), + defaultConfiguration.createPostAllocationOptimizationStage()); } else { return createLIRSuites(selected); } @@ -144,7 +145,7 @@ if (config == null) { throw new GraalInternalError("unknown compiler configuration: " + name); } - return new LIRSuites(config.createLIRHighTier(), config.createLIRMidTier(), config.createLIRLowTier()); + return new LIRSuites(config.createPreAllocationOptimizationStage(), config.createAllocationStage(), config.createPostAllocationOptimizationStage()); } }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/BlockWorkList.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/BlockWorkList.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ /** * Adds a block to this list in an unsorted fashion, like a stack. - * + * * @param block the block to add */ public void add(AbstractMergeNode block) { @@ -55,7 +55,7 @@ /** * Adds a block to this list, sorted by the supplied number. The block with the lowest number is * returned upon subsequent removes. - * + * * @param block the block to add * @param number the number used to sort the block */ @@ -89,7 +89,7 @@ * Removes the next block from this work list. If the blocks have been added in a sorted order, * then the block with the lowest number is returned. Otherwise, the last block added is * returned. - * + * * @return the next block in the list */ public AbstractMergeNode removeFromWorkList() { @@ -101,7 +101,7 @@ /** * Checks whether the list is empty. - * + * * @return {@code true} if this list is empty */ public boolean isEmpty() {
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,6 @@ import com.oracle.graal.compiler.gen.*; import com.oracle.graal.graph.*; import com.oracle.graal.java.*; -import com.oracle.graal.java.BciBlockMapping.BciBlock; import com.oracle.graal.lir.*; import com.oracle.graal.lir.alloc.lsra.*; import com.oracle.graal.lir.alloc.lsra.Interval.*; @@ -131,10 +130,10 @@ * @param label A label describing the compilation phase that produced the control flow graph. * @param blocks The list of blocks to be printed. */ - public void printCFG(String label, List<? extends AbstractBlock<?>> blocks, boolean printNodes) { + public void printCFG(String label, List<? extends AbstractBlockBase<?>> blocks, boolean printNodes) { if (lir == null) { latestScheduling = new NodeMap<>(cfg.getNodeToBlock()); - for (AbstractBlock<?> abstractBlock : blocks) { + for (AbstractBlockBase<?> abstractBlock : blocks) { Block block = (Block) abstractBlock; Node cur = block.getBeginNode(); while (true) { @@ -152,7 +151,7 @@ begin("cfg"); out.print("name \"").print(label).println('"'); - for (AbstractBlock<?> block : blocks) { + for (AbstractBlockBase<?> block : blocks) { printBlock(block, printNodes); } end("cfg"); @@ -194,7 +193,7 @@ } } - private void printBlock(AbstractBlock<?> block, boolean printNodes) { + private void printBlock(AbstractBlockBase<?> block, boolean printNodes) { printBlockProlog(block); if (printNodes) { assert block instanceof Block; @@ -203,31 +202,24 @@ printBlockEpilog(block); } - private void printBlockEpilog(AbstractBlock<?> block) { + private void printBlockEpilog(AbstractBlockBase<?> block) { printLIR(block); end("block"); } - private void printBlockProlog(AbstractBlock<?> block) { + private void printBlockProlog(AbstractBlockBase<?> block) { begin("block"); out.print("name \"").print(blockToString(block)).println('"'); - if (block instanceof BciBlock) { - out.print("from_bci ").println(((BciBlock) block).startBci); - out.print("to_bci ").println(((BciBlock) block).endBci); - } else { - out.println("from_bci -1"); - out.println("to_bci -1"); - } out.print("predecessors "); - for (AbstractBlock<?> pred : block.getPredecessors()) { + for (AbstractBlockBase<?> pred : block.getPredecessors()) { out.print("\"").print(blockToString(pred)).print("\" "); } out.println(); out.print("successors "); - for (AbstractBlock<?> succ : block.getSuccessors()) { + for (AbstractBlockBase<?> succ : block.getSuccessors()) { if (!succ.isExceptionEntry()) { out.print("\"").print(blockToString(succ)).print("\" "); } @@ -235,7 +227,7 @@ out.println(); out.print("xhandlers"); - for (AbstractBlock<?> succ : block.getSuccessors()) { + for (AbstractBlockBase<?> succ : block.getSuccessors()) { if (succ.isExceptionEntry()) { out.print("\"").print(blockToString(succ)).print("\" "); } @@ -437,7 +429,7 @@ * * @param block the block to print */ - private void printLIR(AbstractBlock<?> block) { + private void printLIR(AbstractBlockBase<?> block) { if (lir == null) { return; } @@ -500,7 +492,7 @@ return prefix + node.toString(Verbosity.Id); } - private String blockToString(AbstractBlock<?> block) { + private String blockToString(AbstractBlockBase<?> block) { if (lir == null && schedule == null && block instanceof Block) { // During all the front-end phases, the block schedule is built only for the debug // output.
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/HexCodeFile.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/HexCodeFile.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,23 +39,23 @@ * * <pre> * HexCodeFile ::= Platform Delim HexCode Delim (OptionalSection Delim)* - * + * * OptionalSection ::= Comment | OperandComment | JumpTable | LookupTable - * + * * Platform ::= "Platform" ISA WordWidth - * + * * HexCode ::= "HexCode" StartAddress HexDigits - * + * * Comment ::= "Comment" Position String - * + * * OperandComment ::= "OperandComment" Position String - * + * * JumpTable ::= "JumpTable" Position EntrySize Low High - * + * * LookupTable ::= "LookupTable" Position NPairs KeySize OffsetSize - * + * * Position, EntrySize, Low, High, NPairs KeySize OffsetSize ::= int - * + * * Delim := "<||@" * </pre> *
--- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64CountLeadingZerosNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64CountLeadingZerosNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ */ @NodeInfo public final class AMD64CountLeadingZerosNode extends UnaryNode implements LIRLowerable { - public static final NodeClass<AMD64CountLeadingZerosNode> TYPE = NodeClass.get(AMD64CountLeadingZerosNode.class); + public static final NodeClass<AMD64CountLeadingZerosNode> TYPE = NodeClass.create(AMD64CountLeadingZerosNode.class); public AMD64CountLeadingZerosNode(ValueNode value) { super(TYPE, StampFactory.forInteger(Kind.Int, 0, ((PrimitiveStamp) value.stamp()).getBits()), value);
--- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64CountTrailingZerosNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64CountTrailingZerosNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ */ @NodeInfo public final class AMD64CountTrailingZerosNode extends UnaryNode implements LIRLowerable { - public static final NodeClass<AMD64CountTrailingZerosNode> TYPE = NodeClass.get(AMD64CountTrailingZerosNode.class); + public static final NodeClass<AMD64CountTrailingZerosNode> TYPE = NodeClass.create(AMD64CountTrailingZerosNode.class); public AMD64CountTrailingZerosNode(ValueNode value) { super(TYPE, StampFactory.forInteger(Kind.Int, 0, ((PrimitiveStamp) value.stamp()).getBits()), value);
--- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64FloatConvertNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64FloatConvertNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ */ @NodeInfo public final class AMD64FloatConvertNode extends UnaryArithmeticNode<FloatConvertOp> implements ArithmeticLIRLowerable { - public static final NodeClass<AMD64FloatConvertNode> TYPE = NodeClass.get(AMD64FloatConvertNode.class); + public static final NodeClass<AMD64FloatConvertNode> TYPE = NodeClass.create(AMD64FloatConvertNode.class); protected final FloatConvert op;
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/EdgesTest.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/EdgesTest.java Mon Feb 23 16:23:23 2015 -0800 @@ -29,7 +29,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.graph.*; -import com.oracle.graal.graph.Edges.Type; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; @@ -45,7 +44,7 @@ @NodeInfo static final class TestNode extends Node { - public static final NodeClass<TestNode> TYPE = NodeClass.get(TestNode.class); + public static final NodeClass<TestNode> TYPE = NodeClass.create(TestNode.class); @Input NodeInputList<ValueNode> itail; @Input ConstantNode i1; @Input FloatingNode i2; @@ -74,7 +73,7 @@ node.i1 = i1; node.i2 = i2; graph.add(node); - inputs = node.getNodeClass().getEdges(Type.Inputs); + inputs = node.getNodeClass().getInputEdges(); } /**
--- a/graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/APHotSpotSignature.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/APHotSpotSignature.java Mon Feb 23 16:23:23 2015 -0800 @@ -149,7 +149,7 @@ /** * Returns the kind from the character describing a primitive or void. - * + * * @param ch the character * @return the kind */
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/Log.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/Log.java Mon Feb 23 16:23:23 2015 -0800 @@ -80,7 +80,7 @@ /** * Prints a formatted string to the log stream. - * + * * @param format a C style printf format value that can contain at most one conversion specifier * (i.e., a sequence of characters starting with '%'). * @param value the value associated with the conversion specifier
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java Mon Feb 23 16:23:23 2015 -0800 @@ -114,7 +114,7 @@ return true; } - @SuppressWarnings("serial") private static final JavaConstant COULD_NOT_FOLD = new PrimitiveConstant(Kind.Illegal, 100) { + @SuppressWarnings("serial") public static final JavaConstant COULD_NOT_FOLD = new PrimitiveConstant(Kind.Illegal, 100) { @Override public boolean equals(Object o) { return this == o; @@ -183,14 +183,14 @@ /** * Permits a subclass to override the default definition of "intrinsic". */ - protected NodeIntrinsic getIntrinsic(ResolvedJavaMethod method) { + public NodeIntrinsic getIntrinsic(ResolvedJavaMethod method) { return method.getAnnotation(Node.NodeIntrinsic.class); } /** * Permits a subclass to override the default definition of "foldable". */ - protected boolean isFoldable(ResolvedJavaMethod method) { + public boolean isFoldable(ResolvedJavaMethod method) { return method.getAnnotation(Fold.class) != null; }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Mon Feb 23 16:23:23 2015 -0800 @@ -539,7 +539,7 @@ } int sideEffectCount = 0; assert (sideEffectCount = graph.getNodes().filter(e -> hasSideEffect(e)).count()) >= 0; - new ConvertDeoptimizeToGuardPhase().apply(graph); + new ConvertDeoptimizeToGuardPhase().apply(graph, null); assert sideEffectCount == graph.getNodes().filter(e -> hasSideEffect(e)).count() : "deleted side effecting node"; switch (frameStateProcessing) {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Mon Feb 23 16:23:23 2015 -0800 @@ -395,7 +395,7 @@ @NodeInfo static final class VarargsPlaceholderNode extends FloatingNode implements ArrayLengthProvider { - public static final NodeClass<VarargsPlaceholderNode> TYPE = NodeClass.get(VarargsPlaceholderNode.class); + public static final NodeClass<VarargsPlaceholderNode> TYPE = NodeClass.create(VarargsPlaceholderNode.class); protected final Varargs varargs; public VarargsPlaceholderNode(Varargs varargs, MetaAccessProvider metaAccess) { @@ -723,7 +723,7 @@ assert checkAllVarargPlaceholdersAreDeleted(parameterCount, placeholders); - new FloatingReadPhase(false, true, false).apply(snippetCopy); + new FloatingReadPhase(false, true).apply(snippetCopy); MemoryAnchorNode memoryAnchor = snippetCopy.add(new MemoryAnchorNode()); snippetCopy.start().replaceAtUsages(InputType.Memory, memoryAnchor); @@ -748,7 +748,7 @@ List<MemoryMapNode> memMaps = returnNodes.stream().map(n -> n.getMemoryMap()).collect(Collectors.toList()); ValueNode returnValue = InliningUtil.mergeReturns(merge, returnNodes, null); this.returnNode = snippet.add(new ReturnNode(returnValue)); - MemoryMapImpl mmap = FloatingReadPhase.mergeMemoryMaps(merge, memMaps, false); + MemoryMapImpl mmap = FloatingReadPhase.mergeMemoryMaps(merge, memMaps); MemoryMapNode memoryMap = snippet.unique(new MemoryMapNode(mmap.getMap())); this.returnNode.setMemoryMap(memoryMap); for (MemoryMapNode mm : memMaps) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java Mon Feb 23 16:23:23 2015 -0800 @@ -0,0 +1,280 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.replacements; + +import static com.oracle.graal.api.code.MemoryBarriers.*; +import static com.oracle.graal.java.GraphBuilderContext.*; +import static java.lang.Character.*; +import sun.misc.*; + +import com.oracle.graal.api.directives.*; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.java.*; +import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin; +import com.oracle.graal.java.InvocationPlugins.Registration; +import com.oracle.graal.java.InvocationPlugins.Registration.Receiver; +import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.calc.*; +import com.oracle.graal.nodes.debug.*; +import com.oracle.graal.nodes.extended.*; +import com.oracle.graal.nodes.java.*; +import com.oracle.graal.replacements.nodes.*; + +/** + * Provides non-runtime specific {@link InvocationPlugin}s. + */ +public class StandardGraphBuilderPlugins { + + public static void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + registerObjectPlugins(metaAccess, plugins); + registerMathPlugins(metaAccess, plugins); + registerUnsafePlugins(metaAccess, plugins); + registerGraalDirectivesPlugins(metaAccess, plugins); + } + + public static void registerUnsafePlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, Unsafe.class); + for (Kind kind : Kind.values()) { + if ((kind.isPrimitive() && kind != Kind.Void) || kind == Kind.Object) { + String kindName = kind.getJavaName(); + kindName = toUpperCase(kindName.charAt(0)) + kindName.substring(1); + String getName = "get" + kindName; + String putName = "put" + kindName; + r.register3(getName, Receiver.class, Object.class, long.class, new UnsafeGetPlugin(kind, false)); + r.register4(putName, Receiver.class, Object.class, long.class, kind == Kind.Object ? Object.class : kind.toJavaClass(), new UnsafePutPlugin(kind, false)); + r.register3(getName + "Volatile", Receiver.class, Object.class, long.class, new UnsafeGetPlugin(kind, true)); + r.register4(putName + "Volatile", Receiver.class, Object.class, long.class, kind == Kind.Object ? Object.class : kind.toJavaClass(), new UnsafePutPlugin(kind, true)); + if (kind != Kind.Boolean && kind != Kind.Object) { + r.register2(getName, Receiver.class, long.class, new UnsafeGetPlugin(kind, false)); + r.register3(putName, Receiver.class, long.class, kind.toJavaClass(), new UnsafePutPlugin(kind, false)); + } + } + } + } + + public static void registerMathPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, Math.class); + r.register1("abs", Float.TYPE, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode value) { + builder.push(Kind.Float, builder.append(new AbsNode(value))); + return true; + } + }); + r.register1("abs", Double.TYPE, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode value) { + builder.push(Kind.Double, builder.append(new AbsNode(value))); + return true; + } + }); + r.register1("sqrt", Double.TYPE, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode value) { + builder.push(Kind.Double, builder.append(new SqrtNode(value))); + return true; + } + }); + + for (Kind kind : Kind.values()) { + if (kind.isPrimitive() && kind != Kind.Void) { + new BoxPlugin(kind).register(metaAccess, plugins); + new UnboxPlugin(kind).register(metaAccess, plugins); + } + } + } + + public static void registerObjectPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, Object.class); + r.register1("<init>", Receiver.class, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode object) { + if (RegisterFinalizerNode.mayHaveFinalizer(object, builder.getAssumptions())) { + builder.append(new RegisterFinalizerNode(object)); + } + return true; + } + }); + } + + static class BoxPlugin implements InvocationPlugin { + + private final Kind kind; + + BoxPlugin(Kind kind) { + this.kind = kind; + } + + public boolean apply(GraphBuilderContext builder, ValueNode value) { + ResolvedJavaType resultType = builder.getMetaAccess().lookupJavaType(kind.toBoxedJavaClass()); + builder.push(Kind.Object, builder.append(new BoxNode(value, resultType, kind))); + return true; + } + + void register(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + ResolvedJavaMethod method = Registration.resolve(metaAccess, kind.toBoxedJavaClass(), "valueOf", kind.toJavaClass()); + plugins.register(method, this); + } + } + + static class UnboxPlugin implements InvocationPlugin { + + private final Kind kind; + + UnboxPlugin(Kind kind) { + this.kind = kind; + } + + public boolean apply(GraphBuilderContext builder, ValueNode value) { + ValueNode valueNode = UnboxNode.create(builder.getMetaAccess(), builder.getConstantReflection(), nullCheckedValue(builder, value), kind); + builder.push(kind.getStackKind(), builder.append(valueNode)); + return true; + } + + void register(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + String name = kind.toJavaClass().getSimpleName() + "Value"; + ResolvedJavaMethod method = Registration.resolve(metaAccess, kind.toBoxedJavaClass(), name); + plugins.register(method, this); + } + } + + static class UnsafeGetPlugin implements InvocationPlugin { + + private final Kind returnKind; + private final boolean isVolatile; + + public UnsafeGetPlugin(Kind returnKind, boolean isVolatile) { + this.returnKind = returnKind; + this.isVolatile = isVolatile; + } + + public boolean apply(GraphBuilderContext builder, ValueNode ignoredUnsafe, ValueNode address) { + builder.push(returnKind.getStackKind(), builder.append(new DirectReadNode(address, returnKind))); + return true; + } + + public boolean apply(GraphBuilderContext builder, ValueNode ignoredUnsafe, ValueNode object, ValueNode offset) { + if (isVolatile) { + builder.append(new MembarNode(JMM_PRE_VOLATILE_READ)); + } + builder.push(returnKind.getStackKind(), builder.append(new UnsafeLoadNode(object, offset, returnKind, LocationIdentity.ANY_LOCATION))); + if (isVolatile) { + builder.append(new MembarNode(JMM_POST_VOLATILE_READ)); + } + return true; + } + } + + static class UnsafePutPlugin implements InvocationPlugin { + + private final Kind kind; + private final boolean isVolatile; + + public UnsafePutPlugin(Kind kind, boolean isVolatile) { + this.kind = kind; + this.isVolatile = isVolatile; + } + + public boolean apply(GraphBuilderContext builder, ValueNode ignoredUnsafe, ValueNode address, ValueNode value) { + builder.append(new DirectStoreNode(address, value, kind)); + return true; + } + + public boolean apply(GraphBuilderContext builder, ValueNode ignoredUnsafe, ValueNode object, ValueNode offset, ValueNode value) { + if (isVolatile) { + builder.append(new MembarNode(JMM_PRE_VOLATILE_WRITE)); + } + builder.append(new UnsafeStoreNode(object, offset, value, kind, LocationIdentity.ANY_LOCATION)); + if (isVolatile) { + builder.append(new MembarNode(JMM_PRE_VOLATILE_WRITE)); + } + return true; + } + } + + public static void registerGraalDirectivesPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, GraalDirectives.class); + r.register0("deoptimize", new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder) { + builder.append(new DeoptimizeNode(DeoptimizationAction.None, DeoptimizationReason.TransferToInterpreter)); + return true; + } + }); + + r.register0("deoptimizeAndInvalidate", new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder) { + builder.append(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TransferToInterpreter)); + return true; + } + }); + + r.register0("inCompiledCode", new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder) { + builder.push(Kind.Int, builder.append(ConstantNode.forInt(1))); + return true; + } + }); + + r.register0("controlFlowAnchor", new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder) { + builder.append(new ControlFlowAnchorNode()); + return true; + } + }); + + r.register2("injectBranchProbability", double.class, boolean.class, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode probability, ValueNode condition) { + builder.push(Kind.Int, builder.append(new BranchProbabilityNode(probability, condition))); + return true; + } + }); + + InvocationPlugin blackholePlugin = new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode value) { + builder.append(new BlackholeNode(value)); + return true; + } + }; + + for (Kind kind : Kind.values()) { + Class<?> cls = null; + switch (kind) { + case Object: + cls = Object.class; + break; + case Void: + case Illegal: + continue; + default: + cls = kind.toJavaClass(); + } + + r.register1("blackhole", cls, blackholePlugin); + + final Kind stackKind = kind.getStackKind(); + r.register1("opaque", cls, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode value) { + builder.push(stackKind, builder.append(new OpaqueNode(value))); + return true; + } + }); + } + } + +}
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ArrayEqualsNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ArrayEqualsNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo public final class ArrayEqualsNode extends FixedWithNextNode implements LIRLowerable, Canonicalizable, Virtualizable, MemoryAccess { - public static final NodeClass<ArrayEqualsNode> TYPE = NodeClass.get(ArrayEqualsNode.class); + public static final NodeClass<ArrayEqualsNode> TYPE = NodeClass.create(ArrayEqualsNode.class); /** {@link Kind} of the arrays to compare. */ protected final Kind kind; @@ -53,7 +53,8 @@ public ArrayEqualsNode(ValueNode array1, ValueNode array2, ValueNode length) { super(TYPE, StampFactory.forKind(Kind.Boolean)); - assert array1.stamp().equals(array2.stamp()); + // Ignore nullness in stamp equality test + assert array1.stamp().join(StampFactory.objectNonNull()).equals(array2.stamp().join(StampFactory.objectNonNull())); ObjectStamp array1Stamp = (ObjectStamp) array1.stamp(); ResolvedJavaType componentType = array1Stamp.type().getComponentType(); this.kind = componentType.getKind();
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/AssertionNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/AssertionNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo public final class AssertionNode extends FixedWithNextNode implements Lowerable, Canonicalizable, LIRLowerable { - public static final NodeClass<AssertionNode> TYPE = NodeClass.get(AssertionNode.class); + public static final NodeClass<AssertionNode> TYPE = NodeClass.create(AssertionNode.class); @Input ValueNode value; protected final boolean compileTimeAssertion;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BasicArrayCopyNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BasicArrayCopyNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,9 +34,9 @@ @NodeInfo public abstract class BasicArrayCopyNode extends MacroStateSplitNode implements Virtualizable { - public static final NodeClass<BasicArrayCopyNode> TYPE = NodeClass.get(BasicArrayCopyNode.class); + public static final NodeClass<BasicArrayCopyNode> TYPE = NodeClass.create(BasicArrayCopyNode.class); - public BasicArrayCopyNode(NodeClass<?> c, Invoke invoke) { + public BasicArrayCopyNode(NodeClass<? extends BasicArrayCopyNode> c, Invoke invoke) { super(c, invoke); }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BasicObjectCloneNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BasicObjectCloneNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,9 +38,9 @@ @NodeInfo public abstract class BasicObjectCloneNode extends MacroStateSplitNode implements VirtualizableAllocation, ArrayLengthProvider { - public static final NodeClass<BasicObjectCloneNode> TYPE = NodeClass.get(BasicObjectCloneNode.class); + public static final NodeClass<BasicObjectCloneNode> TYPE = NodeClass.create(BasicObjectCloneNode.class); - protected BasicObjectCloneNode(NodeClass<?> c, Invoke invoke) { + protected BasicObjectCloneNode(NodeClass<? extends BasicObjectCloneNode> c, Invoke invoke) { super(c, invoke); }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitCountNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitCountNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public final class BitCountNode extends UnaryNode implements LIRLowerable { - public static final NodeClass<BitCountNode> TYPE = NodeClass.get(BitCountNode.class); + public static final NodeClass<BitCountNode> TYPE = NodeClass.create(BitCountNode.class); public BitCountNode(ValueNode value) { super(TYPE, StampFactory.forInteger(Kind.Int, 0, ((PrimitiveStamp) value.stamp()).getBits()), value);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanForwardNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanForwardNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class BitScanForwardNode extends UnaryNode implements LIRLowerable { - public static final NodeClass<BitScanForwardNode> TYPE = NodeClass.get(BitScanForwardNode.class); + public static final NodeClass<BitScanForwardNode> TYPE = NodeClass.create(BitScanForwardNode.class); public BitScanForwardNode(ValueNode value) { super(TYPE, StampFactory.forInteger(Kind.Int, 0, ((PrimitiveStamp) value.stamp()).getBits()), value);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanReverseNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanReverseNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class BitScanReverseNode extends UnaryNode implements LIRLowerable { - public static final NodeClass<BitScanReverseNode> TYPE = NodeClass.get(BitScanReverseNode.class); + public static final NodeClass<BitScanReverseNode> TYPE = NodeClass.create(BitScanReverseNode.class); public BitScanReverseNode(ValueNode value) { super(TYPE, StampFactory.forInteger(Kind.Int, 0, ((PrimitiveStamp) value.stamp()).getBits()), value);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DeferredPiNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DeferredPiNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -40,7 +40,7 @@ */ @NodeInfo public final class DeferredPiNode extends FloatingNode implements Canonicalizable { - public static final NodeClass<DeferredPiNode> TYPE = NodeClass.get(DeferredPiNode.class); + public static final NodeClass<DeferredPiNode> TYPE = NodeClass.create(DeferredPiNode.class); @Input ValueNode object; @Input ValueNode type;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo public final class DirectObjectStoreNode extends FixedWithNextNode implements Lowerable { - public static final NodeClass<DirectObjectStoreNode> TYPE = NodeClass.get(DirectObjectStoreNode.class); + public static final NodeClass<DirectObjectStoreNode> TYPE = NodeClass.create(DirectObjectStoreNode.class); @Input ValueNode object; @Input ValueNode value; @Input ValueNode offset;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectReadNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectReadNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class DirectReadNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<DirectReadNode> TYPE = NodeClass.get(DirectReadNode.class); + public static final NodeClass<DirectReadNode> TYPE = NodeClass.create(DirectReadNode.class); @Input protected ValueNode address; protected final Kind readKind; @@ -54,9 +54,9 @@ } /** - * If we are sub it sizes, we try to sign/zero extend the value to at least int as it is done in - * the {@link com.oracle.graal.replacements.DefaultJavaLoweringProvider#implicitLoadConvert} and - * {@link com.oracle.graal.replacements.DefaultJavaLoweringProvider#createUnsafeRead}. + * If we are sub int sizes, we try to sign/zero extend the value to at least int as it is done + * in the {@link com.oracle.graal.replacements.DefaultJavaLoweringProvider#implicitLoadConvert} + * and {@link com.oracle.graal.replacements.DefaultJavaLoweringProvider#createUnsafeRead}. * * @see com.oracle.graal.replacements.DefaultJavaLoweringProvider#implicitLoadConvert * @see com.oracle.graal.replacements.DefaultJavaLoweringProvider#createUnsafeRead
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectStoreNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectStoreNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class DirectStoreNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<DirectStoreNode> TYPE = NodeClass.get(DirectStoreNode.class); + public static final NodeClass<DirectStoreNode> TYPE = NodeClass.create(DirectStoreNode.class); @Input protected ValueNode address; @Input protected ValueNode value; protected final Kind kind;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ExplodeLoopNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ExplodeLoopNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ */ @NodeInfo public final class ExplodeLoopNode extends FixedWithNextNode { - public static final NodeClass<ExplodeLoopNode> TYPE = NodeClass.get(ExplodeLoopNode.class); + public static final NodeClass<ExplodeLoopNode> TYPE = NodeClass.create(ExplodeLoopNode.class); public ExplodeLoopNode() { super(TYPE, StampFactory.forVoid());
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/LoadSnippetVarargParameterNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/LoadSnippetVarargParameterNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public final class LoadSnippetVarargParameterNode extends FixedWithNextNode implements Canonicalizable { - public static final NodeClass<LoadSnippetVarargParameterNode> TYPE = NodeClass.get(LoadSnippetVarargParameterNode.class); + public static final NodeClass<LoadSnippetVarargParameterNode> TYPE = NodeClass.create(LoadSnippetVarargParameterNode.class); @Input ValueNode index; @Input NodeInputList<ParameterNode> parameters;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -59,7 +59,7 @@ @NodeInfo public abstract class MacroNode extends FixedWithNextNode implements Lowerable { - public static final NodeClass<MacroNode> TYPE = NodeClass.get(MacroNode.class); + public static final NodeClass<MacroNode> TYPE = NodeClass.create(MacroNode.class); @Input protected NodeInputList<ValueNode> arguments; protected final int bci; @@ -67,7 +67,7 @@ protected final JavaType returnType; protected final InvokeKind invokeKind; - protected MacroNode(NodeClass<?> c, Invoke invoke) { + protected MacroNode(NodeClass<? extends MacroNode> c, Invoke invoke) { super(c, StampFactory.forKind(((MethodCallTargetNode) invoke.callTarget()).targetMethod().getSignature().getReturnKind())); MethodCallTargetNode methodCallTarget = (MethodCallTargetNode) invoke.callTarget(); this.arguments = new NodeInputList<>(this, methodCallTarget.arguments()); @@ -171,7 +171,7 @@ InliningUtil.inline(invoke, replacementGraph, false, null); Debug.dump(graph(), "After inlining replacement %s", replacementGraph); } else { - if (stateAfter() == null) { + if (invoke.stateAfter() == null) { throw new GraalInternalError("cannot lower to invoke without state: %s", this); } invoke.lower(tool);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroStateSplitNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroStateSplitNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,10 +38,10 @@ @NodeInfo public abstract class MacroStateSplitNode extends MacroNode implements StateSplit, MemoryCheckpoint.Single { - public static final NodeClass<MacroStateSplitNode> TYPE = NodeClass.get(MacroStateSplitNode.class); + public static final NodeClass<MacroStateSplitNode> TYPE = NodeClass.create(MacroStateSplitNode.class); @OptionalInput(InputType.State) protected FrameState stateAfter; - public MacroStateSplitNode(NodeClass<?> c, Invoke invoke) { + public MacroStateSplitNode(NodeClass<? extends MacroStateSplitNode> c, Invoke invoke) { super(c, invoke); this.stateAfter = invoke.stateAfter(); }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MathIntrinsicNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MathIntrinsicNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo public final class MathIntrinsicNode extends UnaryNode implements ArithmeticLIRLowerable { - public static final NodeClass<MathIntrinsicNode> TYPE = NodeClass.get(MathIntrinsicNode.class); + public static final NodeClass<MathIntrinsicNode> TYPE = NodeClass.create(MathIntrinsicNode.class); protected final Operation operation; public enum Operation {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MathPowNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MathPowNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo public final class MathPowNode extends MacroStateSplitNode implements Canonicalizable.Binary<ValueNode> { - public static final NodeClass<MathPowNode> TYPE = NodeClass.get(MathPowNode.class); + public static final NodeClass<MathPowNode> TYPE = NodeClass.create(MathPowNode.class); public MathPowNode(Invoke i) { super(TYPE, i);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MemoryAnchorNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MemoryAnchorNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public final class MemoryAnchorNode extends FixedWithNextNode implements LIRLowerable, MemoryNode, Canonicalizable { - public static final NodeClass<MemoryAnchorNode> TYPE = NodeClass.get(MemoryAnchorNode.class); + public static final NodeClass<MemoryAnchorNode> TYPE = NodeClass.create(MemoryAnchorNode.class); public MemoryAnchorNode() { super(TYPE, StampFactory.forVoid());
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/PureFunctionMacroNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/PureFunctionMacroNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,9 +35,9 @@ @NodeInfo public abstract class PureFunctionMacroNode extends MacroStateSplitNode implements Canonicalizable { - public static final NodeClass<PureFunctionMacroNode> TYPE = NodeClass.get(PureFunctionMacroNode.class); + public static final NodeClass<PureFunctionMacroNode> TYPE = NodeClass.create(PureFunctionMacroNode.class); - protected PureFunctionMacroNode(NodeClass<?> c, Invoke invoke) { + protected PureFunctionMacroNode(NodeClass<? extends PureFunctionMacroNode> c, Invoke invoke) { super(c, invoke); }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReadRegisterNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReadRegisterNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo(nameTemplate = "ReadRegister %{p#register}") public final class ReadRegisterNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<ReadRegisterNode> TYPE = NodeClass.get(ReadRegisterNode.class); + public static final NodeClass<ReadRegisterNode> TYPE = NodeClass.create(ReadRegisterNode.class); /** * The fixed register to access. */
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReverseBytesNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReverseBytesNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public final class ReverseBytesNode extends UnaryNode implements LIRLowerable { - public static final NodeClass<ReverseBytesNode> TYPE = NodeClass.get(ReverseBytesNode.class); + public static final NodeClass<ReverseBytesNode> TYPE = NodeClass.create(ReverseBytesNode.class); public ReverseBytesNode(ValueNode value) { super(TYPE, StampFactory.forKind(value.getKind()), value);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/WriteRegisterNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/WriteRegisterNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,7 +36,7 @@ @NodeInfo(nameTemplate = "WriteRegister %{p#register}") public final class WriteRegisterNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<WriteRegisterNode> TYPE = NodeClass.get(WriteRegisterNode.class); + public static final NodeClass<WriteRegisterNode> TYPE = NodeClass.create(WriteRegisterNode.class); /** * The fixed register to access. */
--- a/graal/com.oracle.graal.runtime/src/com/oracle/graal/runtime/RuntimeProvider.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.runtime/src/com/oracle/graal/runtime/RuntimeProvider.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ /** * Gets the backend for a given architecture. - * + * * @param arch a specific architecture class */ <T extends Architecture> Backend getBackend(Class<T> arch);
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Mon Feb 23 16:23:23 2015 -0800 @@ -109,7 +109,7 @@ } } selectedProcessors = Math.max(1, selectedProcessors); - compileQueue = new ThreadPoolExecutor(2, 2, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), factory); + compileQueue = new ThreadPoolExecutor(selectedProcessors, selectedProcessors, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), factory); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/CompilerAssertsTest.java Mon Feb 23 16:23:23 2015 -0800 @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.truffle.test; + +import org.junit.*; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.truffle.test.nodes.*; +import com.oracle.truffle.api.*; +import com.oracle.truffle.api.frame.*; + +public class CompilerAssertsTest extends PartialEvaluationTest { + + public static class NeverPartOfCompilationTestNode extends AbstractTestNode { + + @Override + public int execute(VirtualFrame frame) { + CompilerAsserts.neverPartOfCompilation(); + return 0; + } + + } + + public static class CompilationConstantTestNode extends AbstractTestNode { + @Child private AbstractTestNode child; + + public CompilationConstantTestNode(AbstractTestNode child) { + this.child = child; + } + + @Override + public int execute(VirtualFrame frame) { + CompilerAsserts.compilationConstant(child.execute(frame)); + return 0; + } + + } + + @Test + public void neverPartOfCompilationTest() { + NeverPartOfCompilationTestNode result = new NeverPartOfCompilationTestNode(); + RootTestNode rootNode = new RootTestNode(new FrameDescriptor(), "neverPartOfCompilation", result); + try { + compileHelper("neverPartOfCompilation", rootNode, new Object[0]); + Assert.fail("Expected bailout exception due to never part of compilation"); + } catch (BailoutException e) { + // Bailout exception expected. + } + } + + @Test + public void compilationNonConstantTest() { + FrameDescriptor descriptor = new FrameDescriptor(); + CompilationConstantTestNode result = new CompilationConstantTestNode(new NonConstantTestNode(5)); + RootTestNode rootNode = new RootTestNode(descriptor, "compilationConstant", result); + try { + compileHelper("compilationConstant", rootNode, new Object[0]); + Assert.fail("Expected bailout exception because expression is not compilation constant"); + } catch (BailoutException e) { + // Bailout exception expected. + } + } + + @Test + public void compilationConstantTest() { + FrameDescriptor descriptor = new FrameDescriptor(); + CompilationConstantTestNode result = new CompilationConstantTestNode(new ConstantTestNode(5)); + RootTestNode rootNode = new RootTestNode(descriptor, "compilationConstant", result); + compileHelper("compilationConstant", rootNode, new Object[0]); + } +}
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/InstrumentationPartialEvaluationTest.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/InstrumentationPartialEvaluationTest.java Mon Feb 23 16:23:23 2015 -0800 @@ -25,9 +25,11 @@ import org.junit.*; import com.oracle.graal.truffle.test.nodes.*; +import com.oracle.truffle.api.*; import com.oracle.truffle.api.frame.*; import com.oracle.truffle.api.instrument.*; import com.oracle.truffle.api.instrument.impl.*; +import com.oracle.truffle.api.nodes.*; /** * Tests for a single simple PE test with various combinations of instrumentation attached. None of @@ -48,7 +50,6 @@ assertPartialEvalEquals("constant42", root); } - @Ignore @Test public void constantValueProbedNoInstruments() { FrameDescriptor fd = new FrameDescriptor(); @@ -59,7 +60,6 @@ assertPartialEvalEquals("constant42", root); } - @Ignore @Test public void constantValueProbedNullInstrument() { FrameDescriptor fd = new FrameDescriptor(); @@ -72,7 +72,6 @@ assertPartialEvalEquals("constant42", root); } - @Ignore @Test public void constantValueProbedNullInstrumentDisposed() { FrameDescriptor fd = new FrameDescriptor(); @@ -86,7 +85,6 @@ assertPartialEvalEquals("constant42", root); } - @Ignore @Test public void constantValueProbedTwoNullInstruments() { FrameDescriptor fd = new FrameDescriptor(); @@ -101,7 +99,6 @@ assertPartialEvalEquals("constant42", root); } - @Ignore @Test public void constantValueProbedThreeNullInstruments() { FrameDescriptor fd = new FrameDescriptor(); @@ -118,7 +115,6 @@ assertPartialEvalEquals("constant42", root); } - @Ignore @Test public void constantValueProbedThreeNullInstrumentsOneDisposed() { FrameDescriptor fd = new FrameDescriptor(); @@ -135,4 +131,57 @@ instrument2.dispose(); assertPartialEvalEquals("constant42", root); } + + @Test + public void instrumentDeopt() { + final FrameDescriptor fd = new FrameDescriptor(); + final AbstractTestNode result = new ConstantTestNode(42); + final RootTestNode root = new RootTestNode(fd, "constantValue", result); + final Probe[] probe = new Probe[1]; + final int[] count = {1}; + count[0] = 0; + // Register a "prober" that will get applied when CallTarget gets created. + Probe.registerASTProber(new ASTProber() { + + @Override + public void probeAST(Node node) { + node.accept(new NodeVisitor() { + + @Override + public boolean visit(Node visitedNode) { + if (visitedNode instanceof ConstantTestNode) { + probe[0] = visitedNode.probe(); + } + return true; + } + + }); + } + }); + final RootCallTarget callTarget = Truffle.getRuntime().createCallTarget(root); + + // The CallTarget has one Probe, attached to the ConstantTestNode, ready to run + Assert.assertEquals(42, callTarget.call()); // Correct result + Assert.assertEquals(0, count[0]); // Didn't count anything + + // Add a counting instrument; this changes the "Probe state" and should cause a deopt + final Instrument countingInstrument = Instrument.create(new DefaultEventListener() { + + @Override + public void enter(Node node, VirtualFrame frame) { + count[0] = count[0] + 1; + } + }); + probe[0].attach(countingInstrument); + + Assert.assertEquals(42, callTarget.call()); // Correct result + Assert.assertEquals(1, count[0]); // Counted the first call + + // Remove the counting instrument; this changes the "Probe state" and should cause a deopt + countingInstrument.dispose(); + + Assert.assertEquals(42, callTarget.call()); // Correct result + Assert.assertEquals(1, count[0]); // Didn't count this time + + } }
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/nodes/BlockTestNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/nodes/BlockTestNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @Children private final AbstractTestNode[] statements; - public BlockTestNode(AbstractTestNode[] statements) { + public BlockTestNode(AbstractTestNode... statements) { this.statements = statements; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/nodes/NonConstantTestNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.truffle.test.nodes; + +import com.oracle.truffle.api.frame.*; + +public class NonConstantTestNode extends AbstractTestNode { + + private int value; + + public NonConstantTestNode(int value) { + this.value = value; + } + + @Override + public int execute(VirtualFrame frame) { + return value; + } +}
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/nodes/RootTestNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/nodes/RootTestNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, 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 @@ -23,6 +23,7 @@ package com.oracle.graal.truffle.test.nodes; import com.oracle.truffle.api.frame.*; +import com.oracle.truffle.api.instrument.*; import com.oracle.truffle.api.nodes.*; @NodeInfo @@ -43,6 +44,11 @@ } @Override + public void applyInstrumentation() { + Probe.applyASTProbers(node); + } + + @Override public String toString() { return name; }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java Mon Feb 23 16:23:23 2015 -0800 @@ -113,7 +113,11 @@ @Override public MaterializedFrame createMaterializedFrame(Object[] arguments, FrameDescriptor frameDescriptor) { - return new FrameWithBoxing(frameDescriptor, arguments); + if (TruffleCompilerOptions.TruffleUseFrameWithoutBoxing.getValue()) { + return new FrameWithoutBoxing(frameDescriptor, arguments); + } else { + return new FrameWithBoxing(frameDescriptor, arguments); + } } @Override
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Mon Feb 23 16:23:23 2015 -0800 @@ -253,6 +253,9 @@ new GraphBuilderPhase.Instance(providers.getMetaAccess(), providers.getStampProvider(), this.snippetReflection, providers.getConstantReflection(), newConfig, TruffleCompilerImpl.Optimizations).apply(graph); Debug.dump(graph, "After FastPE"); + // Perform deoptimize to guard conversion. + new ConvertDeoptimizeToGuardPhase().apply(graph, tierContext); + for (MethodCallTargetNode methodCallTargetNode : graph.getNodes(MethodCallTargetNode.TYPE)) { Class<? extends FixedWithNextNode> macroSubstitution = providers.getReplacements().getMacroSubstitution(methodCallTargetNode.targetMethod()); if (macroSubstitution != null) { @@ -265,10 +268,12 @@ } } + // Perform dead code elimination. Dead nodes mainly come from parse time canonicalizations. + new DeadCodeEliminationPhase().apply(graph); + // Do single partial escape and canonicalization pass. try (Scope pe = Debug.scope("TrufflePartialEscape", graph)) { new PartialEscapePhase(true, canonicalizer).apply(graph, tierContext); - new PartialEscapePhase(true, canonicalizer).apply(graph, tierContext); new IncrementalCanonicalizerPhase<>(canonicalizer, new ConditionalEliminationPhase()).apply(graph, tierContext); } catch (Throwable t) { Debug.handle(t);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java Mon Feb 23 16:23:23 2015 -0800 @@ -147,7 +147,7 @@ new ReplaceIntrinsicsPhase(providers.getReplacements()).apply(graph); // Convert deopt to guards. - new ConvertDeoptimizeToGuardPhase().apply(graph); + new ConvertDeoptimizeToGuardPhase().apply(graph, phaseContext); PartialEscapePhase partialEscapePhase = new PartialEscapePhase(false, canonicalizer); @@ -175,7 +175,7 @@ } // Convert deopt to guards. - new ConvertDeoptimizeToGuardPhase().apply(graph); + new ConvertDeoptimizeToGuardPhase().apply(graph, phaseContext); new EarlyReadEliminationPhase(canonicalizer).apply(graph, phaseContext);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Mon Feb 23 16:23:23 2015 -0800 @@ -151,6 +151,7 @@ CompilationResult compilationResult = compileMethodHelper(graph, compilable.toString(), graphBuilderSuite, compilable.getSpeculationLog(), compilable); compilationNotify.notifyCompilationSuccess(compilable, graph, compilationResult); } catch (Throwable t) { + System.out.println("compilation failed!?"); compilationNotify.notifyCompilationFailed(compilable, graph, t); throw t; }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationFailureListener.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationFailureListener.java Mon Feb 23 16:23:23 2015 -0800 @@ -25,6 +25,7 @@ import java.util.*; import com.oracle.graal.api.code.*; +import com.oracle.graal.compiler.common.*; import com.oracle.graal.nodes.*; import com.oracle.graal.truffle.*; @@ -39,7 +40,7 @@ @Override public void notifyCompilationFailed(OptimizedCallTarget target, StructuredGraph graph, Throwable t) { - if (isPermanentBailout(t)) { + if (isPermanentBailout(t) || GraalOptions.PrintBailout.getValue()) { Map<String, Object> properties = new LinkedHashMap<>(); properties.put("Reason", t.toString()); log(0, "opt fail", target.toString(), properties);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/AssumptionNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/AssumptionNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ @NodeInfo public final class AssumptionNode extends MacroNode implements Simplifiable { - public static final NodeClass<AssumptionNode> TYPE = NodeClass.get(AssumptionNode.class); + public static final NodeClass<AssumptionNode> TYPE = NodeClass.create(AssumptionNode.class); public AssumptionNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/BailoutNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/BailoutNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo public final class BailoutNode extends MacroNode implements Canonicalizable { - public static final NodeClass<BailoutNode> TYPE = NodeClass.get(BailoutNode.class); + public static final NodeClass<BailoutNode> TYPE = NodeClass.create(BailoutNode.class); public BailoutNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/IsCompilationConstantNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/IsCompilationConstantNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public final class IsCompilationConstantNode extends FloatingNode implements Lowerable, Canonicalizable { - public static final NodeClass<IsCompilationConstantNode> TYPE = NodeClass.get(IsCompilationConstantNode.class); + public static final NodeClass<IsCompilationConstantNode> TYPE = NodeClass.create(IsCompilationConstantNode.class); @Input ValueNode value;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ */ @NodeInfo public final class IntegerAddExactNode extends AddNode implements IntegerExactArithmeticNode { - public static final NodeClass<IntegerAddExactNode> TYPE = NodeClass.get(IntegerAddExactNode.class); + public static final NodeClass<IntegerAddExactNode> TYPE = NodeClass.create(IntegerAddExactNode.class); public IntegerAddExactNode(ValueNode x, ValueNode y) { super(TYPE, x, y);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactSplitNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactSplitNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo public final class IntegerAddExactSplitNode extends IntegerExactArithmeticSplitNode { - public static final NodeClass<IntegerAddExactSplitNode> TYPE = NodeClass.get(IntegerAddExactSplitNode.class); + public static final NodeClass<IntegerAddExactSplitNode> TYPE = NodeClass.create(IntegerAddExactSplitNode.class); public IntegerAddExactSplitNode(Stamp stamp, ValueNode x, ValueNode y, AbstractBeginNode next, AbstractBeginNode overflowSuccessor) { super(TYPE, stamp, x, y, next, overflowSuccessor);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerExactArithmeticSplitNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerExactArithmeticSplitNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,14 +32,14 @@ @NodeInfo public abstract class IntegerExactArithmeticSplitNode extends ControlSplitNode implements LIRLowerable { - public static final NodeClass<IntegerExactArithmeticSplitNode> TYPE = NodeClass.get(IntegerExactArithmeticSplitNode.class); + public static final NodeClass<IntegerExactArithmeticSplitNode> TYPE = NodeClass.create(IntegerExactArithmeticSplitNode.class); @Successor AbstractBeginNode overflowSuccessor; @Successor AbstractBeginNode next; @Input ValueNode x; @Input ValueNode y; - protected IntegerExactArithmeticSplitNode(NodeClass<?> c, Stamp stamp, ValueNode x, ValueNode y, AbstractBeginNode next, AbstractBeginNode overflowSuccessor) { + protected IntegerExactArithmeticSplitNode(NodeClass<? extends IntegerExactArithmeticSplitNode> c, Stamp stamp, ValueNode x, ValueNode y, AbstractBeginNode next, AbstractBeginNode overflowSuccessor) { super(c, stamp); this.x = x; this.y = y;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ */ @NodeInfo public final class IntegerMulExactNode extends MulNode implements IntegerExactArithmeticNode { - public static final NodeClass<IntegerMulExactNode> TYPE = NodeClass.get(IntegerMulExactNode.class); + public static final NodeClass<IntegerMulExactNode> TYPE = NodeClass.create(IntegerMulExactNode.class); public IntegerMulExactNode(ValueNode x, ValueNode y) { super(TYPE, x, y);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactSplitNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactSplitNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo public final class IntegerMulExactSplitNode extends IntegerExactArithmeticSplitNode { - public static final NodeClass<IntegerMulExactSplitNode> TYPE = NodeClass.get(IntegerMulExactSplitNode.class); + public static final NodeClass<IntegerMulExactSplitNode> TYPE = NodeClass.create(IntegerMulExactSplitNode.class); public IntegerMulExactSplitNode(Stamp stamp, ValueNode x, ValueNode y, AbstractBeginNode next, AbstractBeginNode overflowSuccessor) { super(TYPE, stamp, x, y, next, overflowSuccessor);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulHighNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulHighNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ @NodeInfo(shortName = "*H") public final class IntegerMulHighNode extends BinaryNode implements ArithmeticLIRLowerable { - public static final NodeClass<IntegerMulHighNode> TYPE = NodeClass.get(IntegerMulHighNode.class); + public static final NodeClass<IntegerMulHighNode> TYPE = NodeClass.create(IntegerMulHighNode.class); public IntegerMulHighNode(ValueNode x, ValueNode y) { this((IntegerStamp) x.stamp().unrestricted(), x, y);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ */ @NodeInfo public final class IntegerSubExactNode extends SubNode implements IntegerExactArithmeticNode { - public static final NodeClass<IntegerSubExactNode> TYPE = NodeClass.get(IntegerSubExactNode.class); + public static final NodeClass<IntegerSubExactNode> TYPE = NodeClass.create(IntegerSubExactNode.class); public IntegerSubExactNode(ValueNode x, ValueNode y) { super(TYPE, x, y);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactSplitNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactSplitNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo public final class IntegerSubExactSplitNode extends IntegerExactArithmeticSplitNode { - public static final NodeClass<IntegerSubExactSplitNode> TYPE = NodeClass.get(IntegerSubExactSplitNode.class); + public static final NodeClass<IntegerSubExactSplitNode> TYPE = NodeClass.create(IntegerSubExactSplitNode.class); public IntegerSubExactSplitNode(Stamp stamp, ValueNode x, ValueNode y, AbstractBeginNode next, AbstractBeginNode overflowSuccessor) { super(TYPE, stamp, x, y, next, overflowSuccessor);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/UnsignedMulHighNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/UnsignedMulHighNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo(shortName = "|*H|") public final class UnsignedMulHighNode extends BinaryNode implements ArithmeticLIRLowerable { - public static final NodeClass<UnsignedMulHighNode> TYPE = NodeClass.get(UnsignedMulHighNode.class); + public static final NodeClass<UnsignedMulHighNode> TYPE = NodeClass.create(UnsignedMulHighNode.class); public UnsignedMulHighNode(ValueNode x, ValueNode y) { this((IntegerStamp) x.stamp().unrestricted(), x, y);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/CompilationConstantNode.java Wed Feb 18 10:37:08 2015 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.truffle.nodes.asserts; - -import com.oracle.graal.graph.*; -import com.oracle.graal.graph.spi.*; -import com.oracle.graal.nodeinfo.*; -import com.oracle.graal.nodes.*; - -@NodeInfo -public final class CompilationConstantNode extends NeverPartOfCompilationNode implements Canonicalizable { - - public static final NodeClass<CompilationConstantNode> TYPE = NodeClass.get(CompilationConstantNode.class); - - public CompilationConstantNode(Invoke invoke) { - super(TYPE, invoke, "The value could not be reduced to a compile time constant."); - assert arguments.size() == 1; - } - - @Override - public Node canonical(CanonicalizerTool tool) { - if (arguments.get(0).isConstant()) { - return arguments.get(0); - } - return this; - } -}
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverInlineMacroNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverInlineMacroNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ @NodeInfo public final class NeverInlineMacroNode extends MacroStateSplitNode implements com.oracle.graal.graph.IterableNodeType { - public static final NodeClass<NeverInlineMacroNode> TYPE = NodeClass.get(NeverInlineMacroNode.class); + public static final NodeClass<NeverInlineMacroNode> TYPE = NodeClass.create(NeverInlineMacroNode.class); public NeverInlineMacroNode(Invoke invoke) { super(TYPE, invoke);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverPartOfCompilationNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverPartOfCompilationNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -22,29 +22,25 @@ */ package com.oracle.graal.truffle.nodes.asserts; +import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.util.*; -import com.oracle.graal.replacements.nodes.*; @NodeInfo -public class NeverPartOfCompilationNode extends MacroStateSplitNode implements IterableNodeType { +public final class NeverPartOfCompilationNode extends FixedWithNextNode implements IterableNodeType { - public static final NodeClass<NeverPartOfCompilationNode> TYPE = NodeClass.get(NeverPartOfCompilationNode.class); + public static final NodeClass<NeverPartOfCompilationNode> TYPE = NodeClass.create(NeverPartOfCompilationNode.class); protected final String message; - public NeverPartOfCompilationNode(Invoke invoke) { - this(TYPE, invoke, "This code path should never be part of a compilation."); - } - - protected NeverPartOfCompilationNode(NodeClass<?> c, Invoke invoke, String message) { - super(c, invoke); + public NeverPartOfCompilationNode(String message) { + super(TYPE, StampFactory.forVoid()); this.message = message; } - public final String getMessage() { - return message + " " + arguments.toString(); + public String getMessage() { + return message; } public static void verifyNotFoundIn(final StructuredGraph graph) { @@ -53,4 +49,7 @@ throw GraphUtil.approxSourceException(neverPartOfCompilationNode, exception); } } + + @NodeIntrinsic + public static native void apply(@ConstantNodeParameter String message); }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/ForceMaterializeNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/ForceMaterializeNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,7 +30,7 @@ @NodeInfo public final class ForceMaterializeNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass<ForceMaterializeNode> TYPE = NodeClass.get(ForceMaterializeNode.class); + public static final NodeClass<ForceMaterializeNode> TYPE = NodeClass.create(ForceMaterializeNode.class); @Input ValueNode object;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/MaterializeFrameNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/MaterializeFrameNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo(nameTemplate = "MaterializeFrame{p#frame/s}") public final class MaterializeFrameNode extends FixedWithNextNode implements IterableNodeType { - public static final NodeClass<MaterializeFrameNode> TYPE = NodeClass.get(MaterializeFrameNode.class); + public static final NodeClass<MaterializeFrameNode> TYPE = NodeClass.create(MaterializeFrameNode.class); @Input ValueNode frame; public MaterializeFrameNode(ValueNode frame) {
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -48,7 +48,7 @@ @NodeInfo public final class NewFrameNode extends FixedWithNextNode implements IterableNodeType, VirtualizableAllocation, Canonicalizable { - public static final NodeClass<NewFrameNode> TYPE = NodeClass.get(NewFrameNode.class); + public static final NodeClass<NewFrameNode> TYPE = NodeClass.create(NewFrameNode.class); @Input ValueNode descriptor; @Input ValueNode arguments; @@ -99,7 +99,7 @@ @NodeInfo public static final class VirtualOnlyInstanceNode extends VirtualInstanceNode { - public static final NodeClass<VirtualOnlyInstanceNode> TYPE = NodeClass.get(VirtualOnlyInstanceNode.class); + public static final NodeClass<VirtualOnlyInstanceNode> TYPE = NodeClass.create(VirtualOnlyInstanceNode.class); protected boolean allowMaterialization; public VirtualOnlyInstanceNode(ResolvedJavaType type, ResolvedJavaField[] fields) {
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeLoadMacroNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeLoadMacroNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,15 +30,15 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; +import com.oracle.graal.replacements.nodes.*; import com.oracle.graal.truffle.nodes.*; -import com.oracle.graal.truffle.nodes.asserts.*; /** * Macro node for CompilerDirectives#unsafeGetInt*. */ @NodeInfo -public final class CustomizedUnsafeLoadMacroNode extends NeverPartOfCompilationNode implements Canonicalizable { - public static final NodeClass<CustomizedUnsafeLoadMacroNode> TYPE = NodeClass.get(CustomizedUnsafeLoadMacroNode.class); +public final class CustomizedUnsafeLoadMacroNode extends MacroStateSplitNode implements Canonicalizable { + public static final NodeClass<CustomizedUnsafeLoadMacroNode> TYPE = NodeClass.create(CustomizedUnsafeLoadMacroNode.class); private static final int ARGUMENT_COUNT = 4; private static final int OBJECT_ARGUMENT_INDEX = 0; @@ -47,7 +47,7 @@ private static final int LOCATION_ARGUMENT_INDEX = 3; public CustomizedUnsafeLoadMacroNode(Invoke invoke) { - super(TYPE, invoke, "The location argument could not be resolved to a constant."); + super(TYPE, invoke); assert arguments.size() == ARGUMENT_COUNT; }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeStoreMacroNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeStoreMacroNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -28,15 +28,15 @@ import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; +import com.oracle.graal.replacements.nodes.*; import com.oracle.graal.truffle.nodes.*; -import com.oracle.graal.truffle.nodes.asserts.*; /** * Macro node for method CompilerDirectives#unsafePut*. */ @NodeInfo -public final class CustomizedUnsafeStoreMacroNode extends NeverPartOfCompilationNode implements Canonicalizable, StateSplit { - public static final NodeClass<CustomizedUnsafeStoreMacroNode> TYPE = NodeClass.get(CustomizedUnsafeStoreMacroNode.class); +public final class CustomizedUnsafeStoreMacroNode extends MacroStateSplitNode implements Canonicalizable, StateSplit { + public static final NodeClass<CustomizedUnsafeStoreMacroNode> TYPE = NodeClass.create(CustomizedUnsafeStoreMacroNode.class); private static final int ARGUMENT_COUNT = 4; private static final int OBJECT_ARGUMENT_INDEX = 0; private static final int OFFSET_ARGUMENT_INDEX = 1; @@ -44,7 +44,7 @@ private static final int LOCATION_ARGUMENT_INDEX = 3; public CustomizedUnsafeStoreMacroNode(Invoke invoke) { - super(TYPE, invoke, "The location argument could not be resolved to a constant."); + super(TYPE, invoke); assert arguments.size() == ARGUMENT_COUNT; }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/UnsafeTypeCastMacroNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/UnsafeTypeCastMacroNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,15 +31,15 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.util.*; -import com.oracle.graal.truffle.nodes.asserts.*; +import com.oracle.graal.replacements.nodes.*; /** * Macro node for method CompilerDirectives#unsafeCast. */ @NodeInfo -public final class UnsafeTypeCastMacroNode extends NeverPartOfCompilationNode implements Simplifiable { +public final class UnsafeTypeCastMacroNode extends MacroStateSplitNode implements Simplifiable { - public static final NodeClass<UnsafeTypeCastMacroNode> TYPE = NodeClass.get(UnsafeTypeCastMacroNode.class); + public static final NodeClass<UnsafeTypeCastMacroNode> TYPE = NodeClass.create(UnsafeTypeCastMacroNode.class); private static final int OBJECT_ARGUMENT_INDEX = 0; private static final int CLASS_ARGUMENT_INDEX = 1; private static final int CONDITION_ARGUMENT_INDEX = 2; @@ -47,7 +47,7 @@ private static final int ARGUMENT_COUNT = 4; public UnsafeTypeCastMacroNode(Invoke invoke) { - super(TYPE, invoke, "The class of the unsafe cast could not be reduced to a compile time constant."); + super(TYPE, invoke); assert arguments.size() == ARGUMENT_COUNT; }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/CompilerAssertsSubstitutions.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/CompilerAssertsSubstitutions.java Mon Feb 23 16:23:23 2015 -0800 @@ -23,43 +23,15 @@ package com.oracle.graal.truffle.substitutions; import com.oracle.graal.api.replacements.*; -import com.oracle.graal.nodes.spi.*; import com.oracle.graal.truffle.nodes.asserts.*; import com.oracle.truffle.api.*; @ClassSubstitution(CompilerAsserts.class) public class CompilerAssertsSubstitutions { - @MacroSubstitution(macro = NeverPartOfCompilationNode.class, isStatic = true) - public static native void neverPartOfCompilation(); - - @MacroSubstitution(macro = NeverPartOfCompilationNode.class, isStatic = true) - public static native void neverPartOfCompilation(String message); - - @MacroSubstitution(macro = CompilationConstantNode.class, isStatic = true) - public static native boolean compilationConstant(boolean value); - - @MacroSubstitution(macro = CompilationConstantNode.class, isStatic = true) - public static native byte compilationConstant(byte value); - - @MacroSubstitution(macro = CompilationConstantNode.class, isStatic = true) - public static native char compilationConstant(char value); + @MethodSubstitution + public static void neverPartOfCompilation(@SuppressWarnings("unused") String message) { + NeverPartOfCompilationNode.apply("Never part of compilation"); + } - @MacroSubstitution(macro = CompilationConstantNode.class, isStatic = true) - public static native short compilationConstant(short value); - - @MacroSubstitution(macro = CompilationConstantNode.class, isStatic = true) - public static native int compilationConstant(int value); - - @MacroSubstitution(macro = CompilationConstantNode.class, isStatic = true) - public static native long compilationConstant(long value); - - @MacroSubstitution(macro = CompilationConstantNode.class, isStatic = true) - public static native float compilationConstant(float value); - - @MacroSubstitution(macro = CompilationConstantNode.class, isStatic = true) - public static native double compilationConstant(double value); - - @MacroSubstitution(macro = CompilationConstantNode.class, isStatic = true) - public static native Object compilationConstant(Object value); }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java Mon Feb 23 16:23:23 2015 -0800 @@ -26,7 +26,6 @@ import java.util.concurrent.*; -import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.*; import com.oracle.graal.compiler.common.calc.*; @@ -52,7 +51,21 @@ public class TruffleGraphBuilderPlugins { public static void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { - // OptimizedAssumption.class + registerOptimizedAssumptionPlugins(metaAccess, plugins); + registerExactMathPlugins(metaAccess, plugins); + registerCompilerDirectivesPlugins(metaAccess, plugins); + registerOptimizedCallTargetPlugins(metaAccess, plugins); + registerUnsafeAccessImplPlugins(metaAccess, plugins); + + if (TruffleCompilerOptions.TruffleUseFrameWithoutBoxing.getValue()) { + registerFrameWithoutBoxingPlugins(metaAccess, plugins); + } else { + registerFrameWithBoxingPlugins(metaAccess, plugins); + } + + } + + public static void registerOptimizedAssumptionPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { Registration r = new Registration(plugins, metaAccess, OptimizedAssumption.class); r.register1("isValid", Receiver.class, new InvocationPlugin() { public boolean apply(GraphBuilderContext builder, ValueNode arg) { @@ -64,14 +77,15 @@ builder.getAssumptions().record(new AssumptionValidAssumption(assumption)); } } else { - throw new BailoutException("assumption could not be reduced to a constant"); + throw builder.bailout("assumption could not be reduced to a constant"); } return true; } }); + } - // ExactMath.class - r = new Registration(plugins, metaAccess, ExactMath.class); + public static void registerExactMathPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, ExactMath.class); r.register2("addExact", Integer.TYPE, Integer.TYPE, new InvocationPlugin() { public boolean apply(GraphBuilderContext builder, ValueNode x, ValueNode y) { builder.push(Kind.Int.getStackKind(), builder.append(new IntegerAddExactNode(x, y))); @@ -108,9 +122,10 @@ return true; } }); + } - // CompilerDirectives.class - r = new Registration(plugins, metaAccess, CompilerDirectives.class); + public static void registerCompilerDirectivesPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, CompilerDirectives.class); r.register0("inInterpreter", new InvocationPlugin() { public boolean apply(GraphBuilderContext builder) { builder.push(Kind.Boolean.getStackKind(), builder.append(ConstantNode.forBoolean(false))); @@ -154,9 +169,9 @@ r.register1("bailout", String.class, new InvocationPlugin() { public boolean apply(GraphBuilderContext builder, ValueNode message) { if (message.isConstant()) { - throw new BailoutException(message.asConstant().toValueString()); + throw builder.bailout(message.asConstant().toValueString()); } - throw new BailoutException("bailout (message is not compile-time constant, so no additional information is available)"); + throw builder.bailout("bailout (message is not compile-time constant, so no additional information is available)"); } }); r.register1("isCompilationConstant", Object.class, new InvocationPlugin() { @@ -171,13 +186,14 @@ }); r.register1("materialize", Object.class, new InvocationPlugin() { public boolean apply(GraphBuilderContext builder, ValueNode value) { - builder.push(Kind.Object, builder.append(new ForceMaterializeNode(value))); + builder.append(new ForceMaterializeNode(value)); return true; } }); + } - // OptimizedCallTarget.class - r = new Registration(plugins, metaAccess, OptimizedCallTarget.class); + public static void registerOptimizedCallTargetPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, OptimizedCallTarget.class); r.register2("createFrame", FrameDescriptor.class, Object[].class, new InvocationPlugin() { public boolean apply(GraphBuilderContext builder, ValueNode arg1, ValueNode arg2) { Class<?> frameClass = TruffleCompilerOptions.TruffleUseFrameWithoutBoxing.getValue() ? FrameWithoutBoxing.class : FrameWithBoxing.class; @@ -185,20 +201,23 @@ return true; } }); + } - // FrameWithoutBoxing.class - r = new Registration(plugins, metaAccess, FrameWithoutBoxing.class); + public static void registerFrameWithoutBoxingPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, FrameWithoutBoxing.class); registerMaterialize(r); registerUnsafeCast(r); registerUnsafeLoadStorePlugins(r, Kind.Int, Kind.Long, Kind.Float, Kind.Double, Kind.Object); + } - // FrameWithBoxing.class - r = new Registration(plugins, metaAccess, FrameWithBoxing.class); + public static void registerFrameWithBoxingPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, FrameWithBoxing.class); registerMaterialize(r); registerUnsafeCast(r); + } - // CompilerDirectives.class - r = new Registration(plugins, metaAccess, UnsafeAccessImpl.class); + public static void registerUnsafeAccessImplPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, UnsafeAccessImpl.class); registerUnsafeCast(r); registerUnsafeLoadStorePlugins(r, Kind.Boolean, Kind.Byte, Kind.Int, Kind.Short, Kind.Long, Kind.Float, Kind.Double, Kind.Object); }
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,7 +33,7 @@ @NodeInfo public final class MaterializedObjectState extends EscapeObjectState implements Node.ValueNumberable { - public static final NodeClass<MaterializedObjectState> TYPE = NodeClass.get(MaterializedObjectState.class); + public static final NodeClass<MaterializedObjectState> TYPE = NodeClass.create(MaterializedObjectState.class); @Input ValueNode materializedValue; public ValueNode materializedValue() {
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java Mon Feb 23 16:23:23 2015 -0800 @@ -35,7 +35,7 @@ @NodeInfo public final class VirtualObjectState extends EscapeObjectState implements Node.ValueNumberable { - public static final NodeClass<VirtualObjectState> TYPE = NodeClass.get(VirtualObjectState.class); + public static final NodeClass<VirtualObjectState> TYPE = NodeClass.create(VirtualObjectState.class); @Input NodeInputList<ValueNode> values; public NodeInputList<ValueNode> values() {
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectsClosure.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectsClosure.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,6 +32,7 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.cfg.*; +import com.oracle.graal.nodes.util.*; import com.oracle.graal.nodes.virtual.*; import com.oracle.graal.phases.graph.*; import com.oracle.graal.phases.graph.ReentrantBlockIterator.BlockIteratorClosure; @@ -111,6 +112,12 @@ }; ReentrantBlockIterator.apply(closure, cfg.getStartBlock()); assert VirtualUtil.assertNonReachable(graph, obsoleteNodes); + for (Node fixed : obsoleteNodes) { + if (fixed.isAlive()) { + fixed.replaceAtUsages(null); + GraphUtil.killWithUnusedFloatingInputs(fixed); + } + } } @Override
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/GraphEffectList.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/GraphEffectList.java Mon Feb 23 16:23:23 2015 -0800 @@ -130,23 +130,16 @@ * * @param node The fixed node that should be deleted. */ - public void deleteFixedNode(final FixedWithNextNode node) { + public void deleteNode(final Node node) { add("delete fixed node", (graph, obsoleteNodes) -> { - GraphUtil.unlinkFixedNode(node); - assert obsoleteNodes.add(node); + if (node instanceof FixedWithNextNode) { + GraphUtil.unlinkFixedNode((FixedWithNextNode) node); + } + obsoleteNodes.add(node); }); } /** - * Removes the given fixed node from the control flow. - * - * @param node The fixed node that should be deleted. - */ - public void unlinkFixedNode(final FixedWithNextNode node) { - add("unlink fixed node", graph -> GraphUtil.unlinkFixedNode(node)); - } - - /** * Replaces the given node at its usages without deleting it. If the current node is a fixed * node it will be disconnected from the control flow, so that it will be deleted by a * subsequent {@link DeadCodeEliminationPhase} @@ -165,11 +158,9 @@ } node.replaceAtUsages(replacement); if (node instanceof FixedWithNextNode) { - FixedNode next = ((FixedWithNextNode) node).next(); - ((FixedWithNextNode) node).setNext(null); - node.replaceAtPredecessor(next); - assert obsoleteNodes.add(node); + GraphUtil.unlinkFixedNode((FixedWithNextNode) node); } + GraphUtil.killWithUnusedFloatingInputs(node); }); } @@ -194,13 +185,4 @@ } }); } - - /** - * Performs a custom action. - * - * @param action The action that should be performed when the effects are applied. - */ - public void customAction(final Runnable action) { - add("customAction", graph -> action.run()); - } }
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationClosure.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationClosure.java Mon Feb 23 16:23:23 2015 -0800 @@ -94,7 +94,7 @@ ValueNode value = getScalarAlias(store.value()); boolean result = false; if (GraphUtil.unproxify(value) == GraphUtil.unproxify(cachedValue)) { - effects.deleteFixedNode(store); + effects.deleteNode(store); result = true; } state.killReadCache(store.field());
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java Mon Feb 23 16:23:23 2015 -0800 @@ -649,6 +649,7 @@ if (uniqueVirtualObject) { // all inputs refer to the same object: just make the phi node an alias addAndMarkAlias(objStates[0].virtual, phi); + mergeEffects.deleteNode(phi); return false; } else { // all inputs are virtual: check if they're compatible and without identity @@ -680,6 +681,7 @@ if (compatible) { VirtualObjectNode virtual = getValueObjectVirtual(phi, getObjectState(states.get(0), phi.valueAt(0)).virtual); mergeEffects.addFloatingNode(virtual, "valueObjectNode"); + mergeEffects.deleteNode(phi); boolean materialized = mergeObjectStates(virtual, objStates, states); addAndMarkAlias(virtual, virtual);
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationClosure.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationClosure.java Mon Feb 23 16:23:23 2015 -0800 @@ -75,7 +75,7 @@ StoreFieldNode store = (StoreFieldNode) node; ValueNode value = getScalarAlias(store.value()); if (GraphUtil.unproxify(value) == GraphUtil.unproxify(cachedValue)) { - effects.deleteFixedNode(store); + effects.deleteNode(store); deleted = true; } state.killReadCache(store.field()); @@ -108,7 +108,7 @@ ValueNode value = getScalarAlias(write.value()); if (GraphUtil.unproxify(value) == GraphUtil.unproxify(cachedValue)) { - effects.deleteFixedNode(write); + effects.deleteNode(write); deleted = true; } processIdentity(state, write.location().getLocationIdentity()); @@ -141,7 +141,7 @@ ValueNode value = getScalarAlias(write.value()); if (GraphUtil.unproxify(value) == GraphUtil.unproxify(cachedValue)) { - effects.deleteFixedNode(write); + effects.deleteNode(write); deleted = true; } processIdentity(state, write.getLocationIdentity());
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/VirtualUtil.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/VirtualUtil.java Mon Feb 23 16:23:23 2015 -0800 @@ -62,7 +62,7 @@ } for (Node node : obsoleteNodes) { - if (node instanceof FixedNode) { + if (node instanceof FixedNode && !node.isDeleted()) { assert !flood.isMarked(node) : node; } } @@ -87,7 +87,7 @@ } boolean success = true; for (Node node : obsoleteNodes) { - if (flood.isMarked(node)) { + if (!node.isDeleted() && flood.isMarked(node)) { TTY.println("offending node path:"); Node current = node; TTY.print(current.toString()); @@ -109,12 +109,24 @@ return success; } - public static void trace(String format, Object... obj) { - if (TraceEscapeAnalysis.getValue() && Debug.isLogEnabled()) { + public static void trace(String format, Object obj) { + if (Debug.isEnabled() && TraceEscapeAnalysis.getValue() && Debug.isLogEnabled()) { Debug.logv(format, obj); } } + public static void trace(String format, Object obj, Object obj2) { + if (Debug.isEnabled() && TraceEscapeAnalysis.getValue() && Debug.isLogEnabled()) { + Debug.logv(format, obj, obj2); + } + } + + public static void trace(String format, Object obj, Object obj2, Object obj3) { + if (Debug.isEnabled() && TraceEscapeAnalysis.getValue() && Debug.isLogEnabled()) { + Debug.logv(format, obj, obj2, obj3); + } + } + public static boolean matches(StructuredGraph graph, String filter) { if (filter != null) { return matchesHelper(graph, filter);
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/VirtualizerToolImpl.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/VirtualizerToolImpl.java Mon Feb 23 16:23:23 2015 -0800 @@ -117,9 +117,7 @@ @Override public void replaceWithVirtual(VirtualObjectNode virtual) { closure.addAndMarkAlias(virtual, current); - if (current instanceof FixedWithNextNode) { - effects.deleteFixedNode((FixedWithNextNode) current); - } + effects.deleteNode(current); deleted = true; } @@ -132,7 +130,7 @@ @Override public void delete() { - effects.deleteFixedNode((FixedWithNextNode) current); + effects.deleteNode(current); deleted = true; }
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Signed.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Signed.java Mon Feb 23 16:23:23 2015 -0800 @@ -26,7 +26,7 @@ /** * Returns a Signed whose value is {@code (this + val)}. - * + * * @param val value to be added to this Signed. * @return {@code this + val} */ @@ -34,7 +34,7 @@ /** * Returns a Signed whose value is {@code (this - val)}. - * + * * @param val value to be subtracted from this Signed. * @return {@code this - val} */ @@ -42,7 +42,7 @@ /** * Returns a Signed whose value is {@code (this * val)}. - * + * * @param val value to be multiplied by this Signed. * @return {@code this * val} */ @@ -50,7 +50,7 @@ /** * Returns a Signed whose value is {@code (this / val)}. - * + * * @param val value by which this Signed is to be divided. * @return {@code this / val} */ @@ -58,7 +58,7 @@ /** * Returns a Signed whose value is {@code (this % val)}. - * + * * @param val value by which this Signed is to be divided, and the remainder computed. * @return {@code this % val} */ @@ -66,7 +66,7 @@ /** * Returns a Signed whose value is {@code (this << n)}. - * + * * @param n shift distance, in bits. * @return {@code this << n} */ @@ -74,7 +74,7 @@ /** * Returns a Signed whose value is {@code (this >> n)}. Sign extension is performed. - * + * * @param n shift distance, in bits. * @return {@code this >> n} */ @@ -83,7 +83,7 @@ /** * Returns a Signed whose value is {@code (this & val)}. (This method returns a negative Signed * if and only if this and val are both negative.) - * + * * @param val value to be AND'ed with this Signed. * @return {@code this & val} */ @@ -92,7 +92,7 @@ /** * Returns a Signed whose value is {@code (this | val)}. (This method returns a negative Signed * if and only if either this or val is negative.) - * + * * @param val value to be OR'ed with this Signed. * @return {@code this | val} */ @@ -101,7 +101,7 @@ /** * Returns a Signed whose value is {@code (this ^ val)}. (This method returns a negative Signed * if and only if exactly one of this and val are negative.) - * + * * @param val value to be XOR'ed with this Signed. * @return {@code this ^ val} */ @@ -110,14 +110,14 @@ /** * Returns a Signed whose value is {@code (~this)}. (This method returns a negative value if and * only if this Signed is non-negative.) - * + * * @return {@code ~this} */ Signed not(); /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this == val} */ @@ -125,7 +125,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this != val} */ @@ -133,7 +133,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this < val} */ @@ -141,7 +141,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this <= val} */ @@ -149,7 +149,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this > val} */ @@ -157,7 +157,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this >= val} */ @@ -165,7 +165,7 @@ /** * Returns a Signed whose value is {@code (this + val)}. - * + * * @param val value to be added to this Signed. * @return {@code this + val} */ @@ -173,7 +173,7 @@ /** * Returns a Signed whose value is {@code (this - val)}. - * + * * @param val value to be subtracted from this Signed. * @return {@code this - val} */ @@ -181,7 +181,7 @@ /** * Returns a Signed whose value is {@code (this * val)}. - * + * * @param val value to be multiplied by this Signed. * @return {@code this * val} */ @@ -189,7 +189,7 @@ /** * Returns a Signed whose value is {@code (this / val)}. - * + * * @param val value by which this Signed is to be divided. * @return {@code this / val} */ @@ -197,7 +197,7 @@ /** * Returns a Signed whose value is {@code (this % val)}. - * + * * @param val value by which this Signed is to be divided, and the remainder computed. * @return {@code this % val} */ @@ -205,7 +205,7 @@ /** * Returns a Signed whose value is {@code (this << n)}. - * + * * @param n shift distance, in bits. * @return {@code this << n} */ @@ -213,7 +213,7 @@ /** * Returns a Signed whose value is {@code (this >> n)}. Sign extension is performed. - * + * * @param n shift distance, in bits. * @return {@code this >> n} */ @@ -222,7 +222,7 @@ /** * Returns a Signed whose value is {@code (this & val)}. (This method returns a negative Signed * if and only if this and val are both negative.) - * + * * @param val value to be AND'ed with this Signed. * @return {@code this & val} */ @@ -231,7 +231,7 @@ /** * Returns a Signed whose value is {@code (this | val)}. (This method returns a negative Signed * if and only if either this or val is negative.) - * + * * @param val value to be OR'ed with this Signed. * @return {@code this | val} */ @@ -240,7 +240,7 @@ /** * Returns a Signed whose value is {@code (this ^ val)}. (This method returns a negative Signed * if and only if exactly one of this and val are negative.) - * + * * @param val value to be XOR'ed with this Signed. * @return {@code this ^ val} */ @@ -248,7 +248,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this == val} */ @@ -256,7 +256,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this != val} */ @@ -264,7 +264,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this < val} */ @@ -272,7 +272,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this <= val} */ @@ -280,7 +280,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this > val} */ @@ -288,7 +288,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this >= val} */
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Unsigned.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Unsigned.java Mon Feb 23 16:23:23 2015 -0800 @@ -26,7 +26,7 @@ /** * Returns a Unsigned whose value is {@code (this + val)}. - * + * * @param val value to be added to this Unsigned. * @return {@code this + val} */ @@ -34,7 +34,7 @@ /** * Returns a Unsigned whose value is {@code (this - val)}. - * + * * @param val value to be subtracted from this Unsigned. * @return {@code this - val} */ @@ -42,7 +42,7 @@ /** * Returns a Unsigned whose value is {@code (this * val)}. - * + * * @param val value to be multiplied by this Unsigned. * @return {@code this * val} */ @@ -50,7 +50,7 @@ /** * Returns a Unsigned whose value is {@code (this / val)}. - * + * * @param val value by which this Unsigned is to be divided. * @return {@code this / val} */ @@ -58,7 +58,7 @@ /** * Returns a Unsigned whose value is {@code (this % val)}. - * + * * @param val value by which this Unsigned is to be divided, and the remainder computed. * @return {@code this % val} */ @@ -66,7 +66,7 @@ /** * Returns a Unsigned whose value is {@code (this << n)}. - * + * * @param n shift distance, in bits. * @return {@code this << n} */ @@ -74,7 +74,7 @@ /** * Returns a Unsigned whose value is {@code (this >>> n)}. No sign extension is performed. - * + * * @param n shift distance, in bits. * @return {@code this >> n} */ @@ -82,7 +82,7 @@ /** * Returns a Unsigned whose value is {@code (this & val)}. - * + * * @param val value to be AND'ed with this Unsigned. * @return {@code this & val} */ @@ -90,7 +90,7 @@ /** * Returns a Unsigned whose value is {@code (this | val)}. - * + * * @param val value to be OR'ed with this Unsigned. * @return {@code this | val} */ @@ -98,7 +98,7 @@ /** * Returns a Unsigned whose value is {@code (this ^ val)}. - * + * * @param val value to be XOR'ed with this Unsigned. * @return {@code this ^ val} */ @@ -106,14 +106,14 @@ /** * Returns a Unsigned whose value is {@code (~this)}. - * + * * @return {@code ~this} */ Unsigned not(); /** * Compares this Unsigned with the specified value. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this == val} */ @@ -121,7 +121,7 @@ /** * Compares this Unsigned with the specified value. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this != val} */ @@ -129,7 +129,7 @@ /** * Compares this Unsigned with the specified value. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this < val} */ @@ -137,7 +137,7 @@ /** * Compares this Unsigned with the specified value. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this <= val} */ @@ -145,7 +145,7 @@ /** * Compares this Unsigned with the specified value. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this > val} */ @@ -153,7 +153,7 @@ /** * Compares this Unsigned with the specified value. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this >= val} */ @@ -164,7 +164,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to be added to this Unsigned. * @return {@code this + val} */ @@ -175,7 +175,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to be subtracted from this Unsigned. * @return {@code this - val} */ @@ -186,7 +186,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to be multiplied by this Unsigned. * @return {@code this * val} */ @@ -197,7 +197,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value by which this Unsigned is to be divided. * @return {@code this / val} */ @@ -208,7 +208,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value by which this Unsigned is to be divided, and the remainder computed. * @return {@code this % val} */ @@ -219,7 +219,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param n shift distance, in bits. * @return {@code this << n} */ @@ -230,7 +230,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param n shift distance, in bits. * @return {@code this >> n} */ @@ -241,7 +241,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to be AND'ed with this Unsigned. * @return {@code this & val} */ @@ -252,7 +252,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to be OR'ed with this Unsigned. * @return {@code this | val} */ @@ -263,7 +263,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to be XOR'ed with this Unsigned. * @return {@code this ^ val} */ @@ -274,7 +274,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this == val} */ @@ -285,7 +285,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this != val} */ @@ -296,7 +296,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this < val} */ @@ -307,7 +307,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this <= val} */ @@ -318,7 +318,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this > val} */ @@ -329,7 +329,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this >= val} */
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -45,7 +45,7 @@ */ @NodeInfo public final class SnippetLocationNode extends LocationNode implements Canonicalizable { - public static final NodeClass<SnippetLocationNode> TYPE = NodeClass.get(SnippetLocationNode.class); + public static final NodeClass<SnippetLocationNode> TYPE = NodeClass.create(SnippetLocationNode.class); protected final SnippetReflectionProvider snippetReflection;
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/WordCastNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/WordCastNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ @NodeInfo public final class WordCastNode extends FixedWithNextNode implements LIRLowerable, Canonicalizable { - public static final NodeClass<WordCastNode> TYPE = NodeClass.get(WordCastNode.class); + public static final NodeClass<WordCastNode> TYPE = NodeClass.create(WordCastNode.class); @Input ValueNode input; public static WordCastNode wordToObject(ValueNode input, Kind wordKind) {
--- a/graal/com.oracle.nfi/src/com/oracle/nfi/api/NativeFunctionPointer.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.nfi/src/com/oracle/nfi/api/NativeFunctionPointer.java Mon Feb 23 16:23:23 2015 -0800 @@ -33,14 +33,14 @@ /** * Returns the name of the function. - * + * * @return name of the function */ String getName(); /** * Returns the raw function pointer value. - * + * * @return raw function pointer value */ long getRawValue();
--- a/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/Implies.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/Implies.java Mon Feb 23 16:23:23 2015 -0800 @@ -28,7 +28,7 @@ /** * Experimental API. - * + * * @deprecated annotation has no effect anymore. */ @Retention(RetentionPolicy.CLASS)
--- a/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/TypeSystem.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/TypeSystem.java Mon Feb 23 16:23:23 2015 -0800 @@ -37,7 +37,7 @@ * concrete type is found first when searching the list sequentially for the type of a given generic * value. * </p> - * + * * <p> * Each {@link #value()} is represented as a java type. A type can specify two annotations: * {@link TypeCheck} and {@link TypeCast}. The {@link TypeCheck} checks whether a given generic @@ -51,30 +51,30 @@ * accept also {@link Integer} values, implicitly converting them to {@link Double} . This example * points out how we express implicit type conversions. * </p> - * + * * <p> * <b>Example:</b> The {@link TypeSystem} contains the types {@link Boolean}, {@link Integer}, and * {@link Double}. The type {@link Object} is always used implicitly as the generic type represent * all values. - * + * * <pre> - * + * * {@literal @}TypeSystem(types = {boolean.class, int.class, double.class}) * public abstract class ExampleTypeSystem { - * + * * {@literal @}TypeCheck * public boolean isInteger(Object value) { * return value instanceof Integer || value instanceof Double; * } - * + * * {@literal @}TypeCast * public double asInteger(Object value) { * return ((Number)value).doubleValue(); * } * } * </pre> - * - * + * + * * @see TypeCast * @see TypeCheck */
--- a/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/TypeSystemReference.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/TypeSystemReference.java Mon Feb 23 16:23:23 2015 -0800 @@ -31,7 +31,7 @@ /** * References a {@link TypeSystem} on a node. Must be applied on a {@link Node} class. At least one * {@link TypeSystem} must be referenced in a {@link Node}'s type hierarchy. - * + * * @see TypeSystem * @see Node */
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/OnAdoptTest.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/OnAdoptTest.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,13 +30,13 @@ /** * <h3>Inserting Extra Nodes into the AST Transparently</h3> - * + * * <p> * The {@link Node} class provides a callback that is invoked whenever a node is adopted in an AST * by insertion or replacement. Node classes can override the {@code onAdopt()} method to run extra * functionality upon adoption. * </p> - * + * * <p> * This test demonstrates how node instances of a specific class can be automatically wrapped in * extra nodes when they are inserted into the AST.
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReplaceTest.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReplaceTest.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,19 +34,19 @@ /** * <h3>Replacing Nodes at Run Time</h3> - * + * * <p> * The structure of the Truffle tree can be changed at run time by replacing nodes using the * {@link Node#replace(Node)} method. This method will automatically change the child pointer in the * parent of the node and replace it with a pointer to the new node. * </p> - * + * * <p> * Replacing nodes is a costly operation, so it should not happen too often. The convention is that * the implementation of the Truffle nodes should ensure that there are maximal a small (and * constant) number of node replacements per Truffle node. * </p> - * + * * <p> * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.CallTest}. * </p>
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/InstrumentationTest.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/InstrumentationTest.java Mon Feb 23 16:23:23 2015 -0800 @@ -439,7 +439,7 @@ } private abstract class TestLanguageNode extends Node { - public abstract Object execute(VirtualFrame frame); + public abstract Object execute(VirtualFrame vFrame); @Override public boolean isInstrumentable() { @@ -492,17 +492,17 @@ } @Override - public Object execute(VirtualFrame frame) { - probeNode.enter(child, frame); + public Object execute(VirtualFrame vFrame) { + probeNode.enter(child, vFrame); Object result; try { - result = child.execute(frame); - probeNode.returnValue(child, frame, result); + result = child.execute(vFrame); + probeNode.returnValue(child, vFrame, result); } catch (KillException e) { throw (e); } catch (Exception e) { - probeNode.returnExceptional(child, frame, e); + probeNode.returnExceptional(child, vFrame, e); throw (e); } @@ -521,7 +521,7 @@ } @Override - public Object execute(VirtualFrame frame) { + public Object execute(VirtualFrame vFrame) { return new Integer(this.value); } } @@ -539,8 +539,8 @@ } @Override - public Object execute(VirtualFrame frame) { - return new Integer(((Integer) leftChild.execute(frame)).intValue() + ((Integer) rightChild.execute(frame)).intValue()); + public Object execute(VirtualFrame vFrame) { + return new Integer(((Integer) leftChild.execute(vFrame)).intValue() + ((Integer) rightChild.execute(vFrame)).intValue()); } } @@ -563,8 +563,8 @@ } @Override - public Object execute(VirtualFrame frame) { - return body.execute(frame); + public Object execute(VirtualFrame vFrame) { + return body.execute(vFrame); } @Override @@ -591,12 +591,12 @@ instrument = Instrument.create(new SimpleEventListener() { @Override - public void enter(Node node, VirtualFrame frame) { + public void enter(Node node, VirtualFrame vFrame) { enterCount++; } @Override - public void returnAny(Node node, VirtualFrame frame) { + public void returnAny(Node node, VirtualFrame vFrame) { leaveCount++; } }, "Instrumentation Test Counter"); @@ -695,7 +695,7 @@ probe.attach(Instrument.create(new SimpleEventListener() { @Override - public void enter(Node node, VirtualFrame frame) { + public void enter(Node node, VirtualFrame vFrame) { count++; } }, "Instrumentation Test MultiCounter"));
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerAsserts.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerAsserts.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,6 @@ * */ public class CompilerAsserts { - /** * Assertion that this code position should never be reached during compilation. It can be used * for exceptional code paths or rare code paths that should never be included in a compilation @@ -40,98 +39,29 @@ * directive. */ public static void neverPartOfCompilation() { - } - - public static void neverPartOfCompilation(@SuppressWarnings("unused") String message) { - } - - /** - * Assertion that the corresponding value is reduced to a constant during compilation. - * - * @param value the value that must be constant during compilation - * @return the value given as parameter - */ - public static boolean compilationConstant(boolean value) { - return value; + neverPartOfCompilation(""); } /** - * Assertion that the corresponding value is reduced to a constant during compilation. + * Assertion that this code position should never be reached during compilation. It can be used + * for exceptional code paths or rare code paths that should never be included in a compilation + * unit. See {@link CompilerDirectives#transferToInterpreter()} for the corresponding compiler + * directive. * - * @param value the value that must be constant during compilation - * @return the value given as parameter + * @param message text associated with the bailout exception */ - public static byte compilationConstant(byte value) { - return value; - } - - /** - * Assertion that the corresponding value is reduced to a constant during compilation. - * - * @param value the value that must be constant during compilation - * @return the value given as parameter - */ - public static char compilationConstant(char value) { - return value; + public static void neverPartOfCompilation(String message) { + CompilerDirectives.bailout(message); } /** * Assertion that the corresponding value is reduced to a constant during compilation. * * @param value the value that must be constant during compilation - * @return the value given as parameter */ - public static short compilationConstant(short value) { - return value; - } - - /** - * Assertion that the corresponding value is reduced to a constant during compilation. - * - * @param value the value that must be constant during compilation - * @return the value given as parameter - */ - public static int compilationConstant(int value) { - return value; - } - - /** - * Assertion that the corresponding value is reduced to a constant during compilation. - * - * @param value the value that must be constant during compilation - * @return the value given as parameter - */ - public static long compilationConstant(long value) { - return value; - } - - /** - * Assertion that the corresponding value is reduced to a constant during compilation. - * - * @param value the value that must be constant during compilation - * @return the value given as parameter - */ - public static float compilationConstant(float value) { - return value; - } - - /** - * Assertion that the corresponding value is reduced to a constant during compilation. - * - * @param value the value that must be constant during compilation - * @return the value given as parameter - */ - public static double compilationConstant(double value) { - return value; - } - - /** - * Assertion that the corresponding value is reduced to a constant during compilation. - * - * @param value the value that must be constant during compilation - * @return the value given as parameter - */ - public static Object compilationConstant(Object value) { - return value; + public static <T> void compilationConstant(Object value) { + if (!CompilerDirectives.isCompilationConstant(value)) { + neverPartOfCompilation("Value is not compilation constant"); + } } }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java Mon Feb 23 16:23:23 2015 -0800 @@ -80,33 +80,20 @@ /** * Returns a boolean indicating whether or not a given value is seen as constant in optimized * code. If this method is called in the interpreter this method will always return - * <code>false</code>. This API may be used in combination with {@link #inCompiledCode()} to - * implement compilation constant assertions in the following way: - * - * <pre> - * <code> - * void assertCompilationConstant(Object value) { - * if (inCompiledCode()) { - * if (!isCompilationConstant(value)) { - * throw new AssertionError("Given value is not constant"); - * } - * } - * } - * </code> - * </pre> + * <code>true</code>. * * Note that optimizations that a compiler will apply to code that is conditional on * <code>isCompilationConstant</code> may be limited. For this reason * <code>isCompilationConstant</code> is not recommended for use to select between alternate * implementations of functionality depending on whether a value is constant. Instead, it is - * intended for use as a diagnostic mechanism, such as illustrated above. + * intended for use as a diagnostic mechanism. * * @param value * @return {@code true} when given value is seen as compilation constant, {@code false} if not * compilation constant. */ public static boolean isCompilationConstant(Object value) { - return false; + return CompilerDirectives.inInterpreter(); } /**
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameUtil.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameUtil.java Mon Feb 23 16:23:23 2015 -0800 @@ -28,7 +28,7 @@ /** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). - * + * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getObject(FrameSlot) @@ -44,7 +44,7 @@ /** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). - * + * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getByte(FrameSlot) @@ -60,7 +60,7 @@ /** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). - * + * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getBoolean(FrameSlot) @@ -76,7 +76,7 @@ /** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). - * + * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getInt(FrameSlot) @@ -92,7 +92,7 @@ /** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). - * + * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getLong(FrameSlot) @@ -108,7 +108,7 @@ /** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). - * + * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getDouble(FrameSlot) @@ -124,7 +124,7 @@ /** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). - * + * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getFloat(FrameSlot)
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Instrument.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Instrument.java Mon Feb 23 16:23:23 2015 -0800 @@ -286,31 +286,31 @@ return nextInstrument.removeFromChain(instrument); } - public void enter(Node node, VirtualFrame frame) { - Instrument.this.toolEventListener.enter(node, frame); + public void enter(Node node, VirtualFrame vFrame) { + Instrument.this.toolEventListener.enter(node, vFrame); if (nextInstrument != null) { - nextInstrument.enter(node, frame); + nextInstrument.enter(node, vFrame); } } - public void returnVoid(Node node, VirtualFrame frame) { - Instrument.this.toolEventListener.returnVoid(node, frame); + public void returnVoid(Node node, VirtualFrame vFrame) { + Instrument.this.toolEventListener.returnVoid(node, vFrame); if (nextInstrument != null) { - nextInstrument.returnVoid(node, frame); + nextInstrument.returnVoid(node, vFrame); } } - public void returnValue(Node node, VirtualFrame frame, Object result) { - Instrument.this.toolEventListener.returnValue(node, frame, result); + public void returnValue(Node node, VirtualFrame vFrame, Object result) { + Instrument.this.toolEventListener.returnValue(node, vFrame, result); if (nextInstrument != null) { - nextInstrument.returnValue(node, frame, result); + nextInstrument.returnValue(node, vFrame, result); } } - public void returnExceptional(Node node, VirtualFrame frame, Exception exception) { - Instrument.this.toolEventListener.returnExceptional(node, frame, exception); + public void returnExceptional(Node node, VirtualFrame vFrame, Exception exception) { + Instrument.this.toolEventListener.returnExceptional(node, vFrame, exception); if (nextInstrument != null) { - nextInstrument.returnExceptional(node, frame, exception); + nextInstrument.returnExceptional(node, vFrame, exception); } }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Probe.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/Probe.java Mon Feb 23 16:23:23 2015 -0800 @@ -28,6 +28,7 @@ import java.util.*; import com.oracle.truffle.api.*; +import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.nodes.*; import com.oracle.truffle.api.source.*; import com.oracle.truffle.api.utilities.*; @@ -80,6 +81,8 @@ */ private static final List<WeakReference<Probe>> probes = new ArrayList<>(); + @CompilationFinal private static SyntaxTagTrap tagTrap = null; + private static final class FindSourceVisitor implements NodeVisitor { Source source = null; @@ -105,12 +108,6 @@ } /** - * The tag trap is a global setting; it only affects {@linkplain Probe probes} with the - * {@linkplain SyntaxTag tag} specified . - */ - private static SyntaxTagTrap globalTagTrap = null; - - /** * Enables instrumentation at selected nodes in all subsequently constructed ASTs. */ public static void registerASTProber(ASTProber prober) { @@ -156,8 +153,8 @@ } /** - * Returns all {@link Probe}s holding a particular {@link SyntaxTag}, or the whole collection if - * the specified tag is {@code null}. + * Returns all {@link Probe}s holding a particular {@link SyntaxTag}, or the whole collection of + * probes if the specified tag is {@code null}. * * @return A collection of probes containing the given tag. */ @@ -175,46 +172,22 @@ } /** - * Sets the current "tag trap". This causes a callback to be triggered whenever execution - * reaches a {@link Probe} (either existing or subsequently created) with the specified tag. - * There can only be one tag trap set at a time. + * Sets the current "tag trap"; there can be no more than one set at a time. + * <ul> + * <li>A non-null trap sets a callback to be triggered whenever execution reaches a + * {@link Probe} (either existing or subsequently created) with the specified tag.</li> + * <li>Setting the trap to null clears the existing trap.</li> + * <li>Setting a non-null trap when one is already set will clear the previously set trap.</li> + * </ul> * * @param newTagTrap The {@link SyntaxTagTrap} to set. - * @throws IllegalStateException if a trap is currently set. */ - public static void setTagTrap(SyntaxTagTrap newTagTrap) throws IllegalStateException { - assert newTagTrap != null; - if (globalTagTrap != null) { - throw new IllegalStateException("trap already set"); - } - globalTagTrap = newTagTrap; - - final SyntaxTag newTag = newTagTrap.getTag(); + public static void setTagTrap(SyntaxTagTrap newTagTrap) { + tagTrap = newTagTrap; for (WeakReference<Probe> ref : probes) { final Probe probe = ref.get(); - if (probe != null && probe.tags.contains(newTag)) { - probe.trapActive = true; - probe.probeStateUnchanged.invalidate(); - } - } - } - - /** - * Clears the current {@link SyntaxTagTrap}. - * - * @throws IllegalStateException if no trap is currently set. - */ - public static void clearTagTrap() { - if (globalTagTrap == null) { - throw new IllegalStateException("no trap set"); - } - globalTagTrap = null; - - for (WeakReference<Probe> ref : probes) { - final Probe probe = ref.get(); - if (probe != null && probe.trapActive) { - probe.trapActive = false; - probe.probeStateUnchanged.invalidate(); + if (probe != null) { + probe.notifyTrapSet(); } } } @@ -222,12 +195,21 @@ private final SourceSection sourceSection; private final ArrayList<SyntaxTag> tags = new ArrayList<>(); private final List<WeakReference<ProbeNode>> probeNodeClones = new ArrayList<>(); - private final CyclicAssumption probeStateUnchanged = new CyclicAssumption("Probe state unchanged"); + + /* + * Invalidated whenever something changes in the Probe and its Instrument chain, so need deopt + */ + private final CyclicAssumption probeStateUnchangedCyclic = new CyclicAssumption("Probe state unchanged"); - /** - * {@code true} iff the global trap is set and this probe has the matching tag. + /* + * The assumption that nothing had changed in this probe, the last time anybody checked (when + * there may have been a deopt). Every time a check fails, gets replaced by a new unchanged + * assumption. */ - private boolean trapActive = false; + @CompilationFinal private Assumption probeStateUnchangedAssumption = probeStateUnchangedCyclic.getAssumption(); + + // Must invalidate whenever this changes. + @CompilationFinal private boolean isTrapActive = false; /** * Intended for use only by {@link ProbeNode}. @@ -261,10 +243,10 @@ for (ProbeListener listener : probeListeners) { listener.probeTaggedAs(this, tag, tagValue); } - if (globalTagTrap != null && tag == globalTagTrap.getTag()) { - this.trapActive = true; + if (tagTrap != null && tag == tagTrap.getTag()) { + this.isTrapActive = true; + invalidateProbeUnchanged(); } - probeStateUnchanged.invalidate(); } } @@ -288,7 +270,7 @@ probeNode.addInstrument(instrument); } } - probeStateUnchanged.invalidate(); + invalidateProbeUnchanged(); } /** @@ -305,29 +287,6 @@ } /** - * Receives notification that a new clone of the instrument chain associated with this - * {@link Probe} has been created as a side-effect of AST cloning. - */ - void registerProbeNodeClone(ProbeNode probeNode) { - probeNodeClones.add(new WeakReference<>(probeNode)); - } - - /** - * Gets the currently active {@linkplain SyntaxTagTrap tagTrap}; {@code null} if not set. - */ - SyntaxTagTrap getTrap() { - return trapActive ? globalTagTrap : null; - } - - /** - * Gets the {@link Assumption} that the instrumentation-related state of this {@link Probe} has - * not changed since this method was last called. - */ - Assumption getUnchangedAssumption() { - return probeStateUnchanged.getAssumption(); - } - - /** * Internal method for removing and rendering inert a specific instrument previously attached at * this Probe. * @@ -342,7 +301,46 @@ probeNode.removeInstrument(instrument); } } - probeStateUnchanged.invalidate(); + invalidateProbeUnchanged(); + } + + /** + * Receives notification that a new clone of the instrument chain associated with this + * {@link Probe} has been created as a side-effect of AST cloning. + */ + void registerProbeNodeClone(ProbeNode probeNode) { + probeNodeClones.add(new WeakReference<>(probeNode)); + } + + /** + * Gets the currently active {@linkplain SyntaxTagTrap tagTrap}; {@code null} if not set. + */ + SyntaxTagTrap getTrap() { + checkProbeUnchanged(); + return isTrapActive ? tagTrap : null; + } + + /** + * To be called wherever in the Probe/Instrument chain there are dependencies on the probe + * state's @CompilatonFinal fields. + */ + void checkProbeUnchanged() { + try { + probeStateUnchangedAssumption.check(); + } catch (InvalidAssumptionException ex) { + // Failure creates an implicit deoptimization + // Get the assumption associated with the new probe state + this.probeStateUnchangedAssumption = probeStateUnchangedCyclic.getAssumption(); + } + } + + private void invalidateProbeUnchanged() { + probeStateUnchangedCyclic.invalidate(); + } + + private void notifyTrapSet() { + this.isTrapActive = tagTrap != null && this.isTaggedAs(tagTrap.getTag()); + invalidateProbeUnchanged(); } private String getTagsDescription() {
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ProbeNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ProbeNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -24,7 +24,6 @@ */ package com.oracle.truffle.api.instrument; -import com.oracle.truffle.api.*; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.frame.*; @@ -176,13 +175,6 @@ // Never changed once set. @CompilationFinal private Probe probe = null; - /** - * An assumption that the state of the {@link Probe} with which this chain is associated has - * not changed since the last time checking such an assumption failed and a reference to a - * new assumption (associated with a new state of the {@link Probe} was retrieved. - */ - private Assumption probeUnchangedAssumption; - private ProbeFullNode() { this.firstInstrument = null; } @@ -201,17 +193,6 @@ private void setProbe(Probe probe) { this.probe = probe; - this.probeUnchangedAssumption = probe.getUnchangedAssumption(); - } - - private void checkProbeUnchangedAssumption() { - try { - probeUnchangedAssumption.check(); - } catch (InvalidAssumptionException ex) { - // Failure creates an implicit deoptimization - // Get the assumption associated with the new probe state - this.probeUnchangedAssumption = probe.getUnchangedAssumption(); - } } @Override @@ -235,43 +216,41 @@ } } - public void enter(Node node, VirtualFrame frame) { + public void enter(Node node, VirtualFrame vFrame) { + this.probe.checkProbeUnchanged(); final SyntaxTagTrap trap = probe.getTrap(); if (trap != null) { - checkProbeUnchangedAssumption(); - trap.tagTrappedAt(((WrapperNode) this.getParent()).getChild(), frame.materialize()); + trap.tagTrappedAt(((WrapperNode) this.getParent()).getChild(), vFrame.materialize()); } if (firstInstrument != null) { - checkProbeUnchangedAssumption(); - firstInstrument.enter(node, frame); + firstInstrument.enter(node, vFrame); } } - public void returnVoid(Node node, VirtualFrame frame) { + public void returnVoid(Node node, VirtualFrame vFrame) { + this.probe.checkProbeUnchanged(); if (firstInstrument != null) { - checkProbeUnchangedAssumption(); - firstInstrument.returnVoid(node, frame); + firstInstrument.returnVoid(node, vFrame); } } - public void returnValue(Node node, VirtualFrame frame, Object result) { + public void returnValue(Node node, VirtualFrame vFrame, Object result) { + this.probe.checkProbeUnchanged(); if (firstInstrument != null) { - checkProbeUnchangedAssumption(); - firstInstrument.returnValue(node, frame, result); + firstInstrument.returnValue(node, vFrame, result); } } - public void returnExceptional(Node node, VirtualFrame frame, Exception exception) { + public void returnExceptional(Node node, VirtualFrame vFrame, Exception exception) { + this.probe.checkProbeUnchanged(); if (firstInstrument != null) { - checkProbeUnchangedAssumption(); - firstInstrument.returnExceptional(node, frame, exception); + firstInstrument.returnExceptional(node, vFrame, exception); } } public String instrumentationInfo() { return "Standard probe"; } - } /** @@ -305,20 +284,20 @@ throw new IllegalStateException("Instruments may not be removed at a \"lite-probed\" location"); } - public void enter(Node node, VirtualFrame frame) { - eventListener.enter(node, frame); + public void enter(Node node, VirtualFrame vFrame) { + eventListener.enter(node, vFrame); } - public void returnVoid(Node node, VirtualFrame frame) { - eventListener.returnVoid(node, frame); + public void returnVoid(Node node, VirtualFrame vFrame) { + eventListener.returnVoid(node, vFrame); } - public void returnValue(Node node, VirtualFrame frame, Object result) { - eventListener.returnValue(node, frame, result); + public void returnValue(Node node, VirtualFrame vFrame, Object result) { + eventListener.returnValue(node, vFrame, result); } - public void returnExceptional(Node node, VirtualFrame frame, Exception exception) { - eventListener.returnExceptional(node, frame, exception); + public void returnExceptional(Node node, VirtualFrame vFrame, Exception exception) { + eventListener.returnExceptional(node, vFrame, exception); } public String instrumentationInfo() {
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/StandardSyntaxTag.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/StandardSyntaxTag.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,7 @@ * (for example for mostly expression-oriented languages) or even for specific languages. * <p> * <strong>Disclaimer:</strong> experimental interface under development. - * + * * @see Probe */ public enum StandardSyntaxTag implements SyntaxTag {
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/TruffleEventListener.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/TruffleEventListener.java Mon Feb 23 16:23:23 2015 -0800 @@ -36,22 +36,22 @@ /** * Receive notification that an AST node's execute method is about to be called. */ - void enter(Node node, VirtualFrame frame); + void enter(Node node, VirtualFrame vFrame); /** * Receive notification that an AST Node's {@code void}-valued execute method has just returned. */ - void returnVoid(Node node, VirtualFrame frame); + void returnVoid(Node node, VirtualFrame vFrame); /** * Receive notification that an AST Node'sexecute method has just returned a value (boxed if * primitive). */ - void returnValue(Node node, VirtualFrame frame, Object result); + void returnValue(Node node, VirtualFrame vFrame, Object result); /** * Receive notification that an AST Node's execute method has just thrown an exception. */ - void returnExceptional(Node node, VirtualFrame frame, Exception exception); + void returnExceptional(Node node, VirtualFrame vFrame, Exception exception); }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/DefaultEventListener.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/DefaultEventListener.java Mon Feb 23 16:23:23 2015 -0800 @@ -34,16 +34,16 @@ */ public class DefaultEventListener implements TruffleEventListener { - public void enter(Node node, VirtualFrame frame) { + public void enter(Node node, VirtualFrame vFrame) { } - public void returnVoid(Node node, VirtualFrame frame) { + public void returnVoid(Node node, VirtualFrame vFrame) { } - public void returnValue(Node node, VirtualFrame frame, Object result) { + public void returnValue(Node node, VirtualFrame vFrame, Object result) { } - public void returnExceptional(Node node, VirtualFrame frame, Exception exception) { + public void returnExceptional(Node node, VirtualFrame vFrame, Exception exception) { } }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/SimpleEventListener.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/impl/SimpleEventListener.java Mon Feb 23 16:23:23 2015 -0800 @@ -38,7 +38,7 @@ */ public abstract class SimpleEventListener implements TruffleEventListener { - public void enter(Node node, VirtualFrame frame) { + public void enter(Node node, VirtualFrame vFrame) { } /** @@ -46,21 +46,21 @@ * means: with or without a return value (ignored) or via exception (ignored). * * @param node - * @param frame + * @param vFrame */ - public void returnAny(Node node, VirtualFrame frame) { + public void returnAny(Node node, VirtualFrame vFrame) { } - public final void returnVoid(Node node, VirtualFrame frame) { - returnAny(node, frame); + public final void returnVoid(Node node, VirtualFrame vFrame) { + returnAny(node, vFrame); } - public final void returnValue(Node node, VirtualFrame frame, Object result) { - returnAny(node, frame); + public final void returnValue(Node node, VirtualFrame vFrame, Object result) { + returnAny(node, vFrame); } - public final void returnExceptional(Node node, VirtualFrame frame, Exception e) { - returnAny(node, frame); + public final void returnExceptional(Node node, VirtualFrame vFrame, Exception e) { + returnAny(node, vFrame); } }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeVisitor.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeVisitor.java Mon Feb 23 16:23:23 2015 -0800 @@ -32,7 +32,7 @@ /** * This visitor method is called for every node in the tree. Its return value determines if the * children of this node should be excluded in the iteration. - * + * * @param node the node that is currently visited * @return {@code true} if the children should be visited too, {@code false} otherwise */
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -72,7 +72,7 @@ * language specific implementations may want to return <code>true</code> here to indicate that * gathering call site specific profiling information might make sense for this {@link RootNode} * . - * + * * @return <code>true</code> if cloning is allowed else <code>false</code>. */ public boolean isCloningAllowed() { @@ -91,7 +91,7 @@ /** * Executes this function using the specified frame and returns the result value. - * + * * @param frame the frame of the currently executing guest language method * @return the value of the execution */ @@ -114,14 +114,14 @@ * the correct <code>ExecutionContext</code> to be determined for a <code>RootNode</code> (and * so also for a {@link RootCallTarget} and a {@link FrameInstance} obtained from the call * stack) without prior knowledge of the language it has come from. - * + * * Used for instance to determine the language of a <code>RootNode<code>: - * + * * <pre> * <code> * rootNode.getExecutionContext().getLanguageShortName(); * </code> </pre> - * + * * Returns <code>null</code> by default. */ public ExecutionContext getExecutionContext() { @@ -151,7 +151,7 @@ * <p> * Implementations should ensure that instrumentation is never applied more than once to an AST, * as this is not guaranteed to be error-free. - * + * * @see Probe#registerASTProber(com.oracle.truffle.api.instrument.ASTProber) */ public void applyInstrumentation() {
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ /** * Creates the exception with the alternative result that cannot be represented as a value of * the return type. - * + * * @param result the alternative result */ public UnexpectedResultException(Object result) {
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/serial/SerializerConstantPool.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/serial/SerializerConstantPool.java Mon Feb 23 16:23:23 2015 -0800 @@ -39,7 +39,7 @@ * additional types that are necessary to serialize a truffle AST for a specific truffle * implementation. If a type is not supported by this constant pool implementation a * {@link UnsupportedConstantPoolTypeException} should be thrown. - * + * * @param clazz the {@link Class} of the value * @param value the value to be stored. Must be at least a subclass of the given clazz. * @return the constant pool index @@ -54,7 +54,7 @@ * are necessary to serialize a truffle AST for a specific truffle implementation. If a type is * not supported by this constant pool implementation a * {@link UnsupportedConstantPoolTypeException} should be thrown. - * + * * @param clazz the {@link Class} of the value in the constant pool. * @param cpi the previously returned index * @return the value stored inside the constant pool @@ -66,7 +66,7 @@ /** * Stores a Class instance in the constant pool and returns the constant pool index. - * + * * @param value the class to store * @return the new or existing constant pool index of the Class */ @@ -74,7 +74,7 @@ /** * Returns the {@link Class} instance to the given constant pool index. - * + * * @param cpi the constant pool index * @return stored value * @throws IllegalArgumentException if the constant pool indes is invalid. @@ -83,7 +83,7 @@ /** * Stores an int value in the constant pool and returns the constant pool index. - * + * * @param value the value to store * @return the new or existing constant pool index of the value */ @@ -91,7 +91,7 @@ /** * Returns the stored int value to the given constant pool index from the constant pool. - * + * * @param cpi the constant pool index * @return stored value * @throws IllegalArgumentException if the constant pool index is invalid. @@ -100,7 +100,7 @@ /** * Stores a long value in the constant pool and returns the constant pool index. - * + * * @param value the value to store * @return the new or existing constant pool index of the value */ @@ -108,7 +108,7 @@ /** * Returns the stored long value to the given constant pool index from the constant pool. - * + * * @param cpi the constant pool index * @return the stored value * @throws IllegalArgumentException if the constant pool index is invalid. @@ -117,7 +117,7 @@ /** * Stores a double value in the constant pool and returns the constant pool index. - * + * * @param value the value to store * @return the new or existing constant pool index of the value */ @@ -125,7 +125,7 @@ /** * Returns the stored double value to the given constant pool index from the constant pool. - * + * * @param cpi the constant pool index * @return the stored value * @throws IllegalArgumentException if the constant pool index is invalid. @@ -134,7 +134,7 @@ /** * Stores a float value in the constant pool and returns the constant pool index. - * + * * @param value the value to store * @return the new or existing constant pool index of the value */ @@ -142,7 +142,7 @@ /** * Returns the stored float value to the given constant pool index from the constant pool. - * + * * @param cpi the constant pool index * @return the stored value * @throws IllegalArgumentException if the constant pool index is invalid.
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/tools/CoverageTracker.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/tools/CoverageTracker.java Mon Feb 23 16:23:23 2015 -0800 @@ -249,7 +249,7 @@ } @Override - public void enter(Node node, VirtualFrame frame) { + public void enter(Node node, VirtualFrame vFrame) { if (isEnabled()) { count.getAndIncrement(); }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/tools/NodeExecCounter.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/tools/NodeExecCounter.java Mon Feb 23 16:23:23 2015 -0800 @@ -97,7 +97,7 @@ */ private final TruffleEventListener eventListener = new DefaultEventListener() { @Override - public void enter(Node node, VirtualFrame frame) { + public void enter(Node node, VirtualFrame vFrame) { if (isEnabled()) { final Class<?> nodeClass = node.getClass(); /*
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ConditionProfile.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ConditionProfile.java Mon Feb 23 16:23:23 2015 -0800 @@ -30,24 +30,24 @@ /** * Abstract utility class to speculate on conditions. Condition profiles are intended to be used as * part of if conditions. - * + * * Example usage: - * + * * <pre> * private final ConditionProfile zero = ConditionProfile.createBinaryProfile(); - * + * * int value = ...; * if (zero.profile(value == 0)) { * return 0; * } else { * return value; * } - * + * * </pre> - * + * * All instances of {@code ConditionProfile} (and subclasses) must be held in {@code final} fields * for compiler optimizations to take effect. - * + * * @see #createCountingProfile() * @see #createBinaryProfile() */ @@ -62,7 +62,7 @@ * true and false. This information is reported to the underlying optimization system using * {@link CompilerDirectives#injectBranchProbability(double, boolean)}. Condition profiles are * intended to be used as part of if conditions. - * + * * @see ConditionProfile * @see #createBinaryProfile() */ @@ -73,7 +73,7 @@ /** * Returns a {@link ConditionProfile} that speculates on conditions to be never true or to be * never false. Condition profiles are intended to be used as part of if conditions. - * + * * @see ConditionProfile * @see ConditionProfile#createCountingProfile() */
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ValueProfile.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ValueProfile.java Mon Feb 23 16:23:23 2015 -0800 @@ -26,18 +26,18 @@ /** * Utility class to speculate on certain properties of values. - * + * * Example usage: - * + * * <pre> * private final ValueProfile classProfile = ValueProfile.createClassProfile(); - * + * * return classProfile.profile(value); * </pre> - * + * * All instances of {@code ValueProfile} (and subclasses) must be held in {@code final} fields for * compiler optimizations to take effect. - * + * * @see #createPrimitiveProfile() * @see #createIdentityProfile() * @see #createClassProfile()
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java Mon Feb 23 16:23:23 2015 -0800 @@ -275,8 +275,7 @@ */ @Override @TruffleBoundary - public final Property getProperty(Object key) { - // return this.propertyMap.get(propertyName); + public Property getProperty(Object key) { PropertyMap current = this.propertyMap; while (current.getLastProperty() != null) { if (current.getLastProperty().getKey().equals(key)) { @@ -284,7 +283,6 @@ } current = current.getParentMap(); } - return null; }
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/instrument/SLExpressionWrapperNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/instrument/SLExpressionWrapperNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -84,58 +84,58 @@ } @Override - public Object executeGeneric(VirtualFrame frame) { + public Object executeGeneric(VirtualFrame vFrame) { - probeNode.enter(child, frame); + probeNode.enter(child, vFrame); Object result; try { - result = child.executeGeneric(frame); - probeNode.returnValue(child, frame, result); + result = child.executeGeneric(vFrame); + probeNode.returnValue(child, vFrame, result); } catch (Exception e) { - probeNode.returnExceptional(child, frame, e); + probeNode.returnExceptional(child, vFrame, e); throw (e); } return result; } @Override - public long executeLong(VirtualFrame frame) throws UnexpectedResultException { - return SLTypesGen.expectLong(executeGeneric(frame)); + public long executeLong(VirtualFrame vFrame) throws UnexpectedResultException { + return SLTypesGen.expectLong(executeGeneric(vFrame)); } @Override - public BigInteger executeBigInteger(VirtualFrame frame) throws UnexpectedResultException { - return SLTypesGen.expectBigInteger(executeGeneric(frame)); + public BigInteger executeBigInteger(VirtualFrame vFrame) throws UnexpectedResultException { + return SLTypesGen.expectBigInteger(executeGeneric(vFrame)); } @Override - public boolean executeBoolean(VirtualFrame frame) throws UnexpectedResultException { - return SLTypesGen.expectBoolean(executeGeneric(frame)); + public boolean executeBoolean(VirtualFrame vFrame) throws UnexpectedResultException { + return SLTypesGen.expectBoolean(executeGeneric(vFrame)); } @Override - public String executeString(VirtualFrame frame) throws UnexpectedResultException { - return SLTypesGen.expectString(executeGeneric(frame)); + public String executeString(VirtualFrame vFrame) throws UnexpectedResultException { + return SLTypesGen.expectString(executeGeneric(vFrame)); } @Override - public SLFunction executeFunction(VirtualFrame frame) throws UnexpectedResultException { - probeNode.enter(child, frame); + public SLFunction executeFunction(VirtualFrame vFrame) throws UnexpectedResultException { + probeNode.enter(child, vFrame); SLFunction result; try { - result = child.executeFunction(frame); - probeNode.returnValue(child, frame, result); + result = child.executeFunction(vFrame); + probeNode.returnValue(child, vFrame, result); } catch (Exception e) { - probeNode.returnExceptional(child, frame, e); + probeNode.returnExceptional(child, vFrame, e); throw (e); } return result; } @Override - public SLNull executeNull(VirtualFrame frame) throws UnexpectedResultException { - return SLTypesGen.expectSLNull(executeGeneric(frame)); + public SLNull executeNull(VirtualFrame vFrame) throws UnexpectedResultException { + return SLTypesGen.expectSLNull(executeGeneric(vFrame)); } }
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/instrument/SLStatementWrapperNode.java Wed Feb 18 10:37:08 2015 -0800 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/instrument/SLStatementWrapperNode.java Mon Feb 23 16:23:23 2015 -0800 @@ -78,16 +78,16 @@ } @Override - public void executeVoid(VirtualFrame frame) { - probeNode.enter(child, frame); + public void executeVoid(VirtualFrame vFrame) { + probeNode.enter(child, vFrame); try { - child.executeVoid(frame); - probeNode.returnVoid(child, frame); + child.executeVoid(vFrame); + probeNode.returnVoid(child, vFrame); } catch (KillException e) { throw (e); } catch (Exception e) { - probeNode.returnExceptional(child, frame, e); + probeNode.returnExceptional(child, vFrame, e); throw (e); } }
--- a/mx/suite.py Wed Feb 18 10:37:08 2015 -0800 +++ b/mx/suite.py Mon Feb 23 16:23:23 2015 -0800 @@ -591,6 +591,7 @@ "dependencies" : [ "com.oracle.graal.compiler", "com.oracle.graal.java", + "com.oracle.graal.api.directives", "com.oracle.graal.word", ], "checkstyle" : "com.oracle.graal.graph", @@ -801,7 +802,6 @@ "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ - "com.oracle.graal.api.directives", "com.oracle.graal.phases", ], "checkstyle" : "com.oracle.graal.graph", @@ -851,6 +851,7 @@ "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ + "com.oracle.graal.api.directives", "com.oracle.graal.test", "com.oracle.graal.printer", "com.oracle.graal.runtime",
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Wed Feb 18 10:37:08 2015 -0800 +++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Mon Feb 23 16:23:23 2015 -0800 @@ -3521,6 +3521,9 @@ //__ add(G0, 0x321, O7); __ add(O7, -8, O7); //__ st_ptr(I7, SP, I7->sp_offset_in_saved_window()*wordSize + STACK_BIAS); + + int uncommon_trap_offset = __ offset() - start; + // Save everything in sight. masm->block_comment("save_live_regs"); (void) RegisterSaver::save_live_registers(masm, 0, &frame_size_words); @@ -3729,6 +3732,7 @@ _deopt_blob = DeoptimizationBlob::create(&buffer, oop_maps, 0, exception_offset, reexecute_offset, frame_size_words); _deopt_blob->set_unpack_with_exception_in_tls_offset(exception_in_tls_offset); #ifdef GRAAL + _deopt_blob->set_uncommon_trap_offset(uncommon_trap_offset); _deopt_blob->set_implicit_exception_uncommon_trap_offset(implicit_exception_uncommon_trap_offset); #endif }
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Wed Feb 18 10:37:08 2015 -0800 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Mon Feb 23 16:23:23 2015 -0800 @@ -3409,6 +3409,8 @@ __ pushptr(Address(r15_thread, in_bytes(JavaThread::graal_implicit_exception_pc_offset()))); + int uncommon_trap_offset = __ pc() - start; + // Save everything in sight. RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words); // fetch_unroll_info needs to call last_java_frame() @@ -3692,6 +3694,7 @@ _deopt_blob = DeoptimizationBlob::create(&buffer, oop_maps, 0, exception_offset, reexecute_offset, frame_size_in_words); _deopt_blob->set_unpack_with_exception_in_tls_offset(exception_in_tls_offset); #ifdef GRAAL + _deopt_blob->set_uncommon_trap_offset(uncommon_trap_offset); _deopt_blob->set_implicit_exception_uncommon_trap_offset(implicit_exception_uncommon_trap_offset); #endif }
--- a/src/share/vm/code/codeBlob.hpp Wed Feb 18 10:37:08 2015 -0800 +++ b/src/share/vm/code/codeBlob.hpp Mon Feb 23 16:23:23 2015 -0800 @@ -358,6 +358,8 @@ int _unpack_with_exception_in_tls; #ifdef GRAAL + // (thomaswue) Offset when Graal calls uncommon_trap. + int _uncommon_trap_offset; int _implicit_exception_uncommon_trap_offset; #endif @@ -415,6 +417,13 @@ address unpack_with_exception_in_tls() const { return code_begin() + _unpack_with_exception_in_tls; } #ifdef GRAAL + // (thomaswue) Offset when Graal calls uncommon_trap. + void set_uncommon_trap_offset(int offset) { + _uncommon_trap_offset = offset; + assert(contains(code_begin() + _uncommon_trap_offset), "must be PC inside codeblob"); + } + address uncommon_trap() const { return code_begin() + _uncommon_trap_offset; } + void set_implicit_exception_uncommon_trap_offset(int offset) { _implicit_exception_uncommon_trap_offset = offset; assert(contains(code_begin() + _implicit_exception_uncommon_trap_offset), "must be PC inside codeblob");
--- a/src/share/vm/graal/graalEnv.cpp Wed Feb 18 10:37:08 2015 -0800 +++ b/src/share/vm/graal/graalEnv.cpp Mon Feb 23 16:23:23 2015 -0800 @@ -421,12 +421,11 @@ // ------------------------------------------------------------------ // Check for changes to the system dictionary during compilation // class loads, evolution, breakpoints -bool GraalEnv::check_for_system_dictionary_modification(Dependencies* dependencies, Handle compiled_code, GraalEnv* env, TRAPS) { +bool GraalEnv::check_for_system_dictionary_modification(Dependencies* dependencies, Handle compiled_code, GraalEnv* env, char** failure_detail) { // If JVMTI capabilities were enabled during compile, the compilation is invalidated. if (env != NULL) { if (!env->_jvmti_can_hotswap_or_post_breakpoint && JvmtiExport::can_hotswap_or_post_breakpoint()) { - Handle message = java_lang_String::create_from_str("Hotswapping or breakpointing was enabled during compilation", THREAD); - HotSpotCompiledNmethod::set_installationFailureMessage(compiled_code, message()); + *failure_detail = (char*) "Hotswapping or breakpointing was enabled during compilation"; return false; } } @@ -443,11 +442,12 @@ for (Dependencies::DepStream deps(dependencies); deps.next(); ) { Klass* witness = deps.check_dependency(); if (witness != NULL) { - ResourceMark rm; - stringStream st; + // Use a fixed size buffer to prevent the string stream from + // resizing in the context of an inner resource mark. + char* buffer = NEW_RESOURCE_ARRAY(char, O_BUFLEN); + stringStream st(buffer, O_BUFLEN); deps.print_dependency(witness, true, &st); - Handle message = java_lang_String::create_from_str(st.as_string(), THREAD); - HotSpotCompiledNmethod::set_installationFailureMessage(compiled_code, message()); + *failure_detail = st.as_string(); return false; } if (LogCompilation) { @@ -482,6 +482,8 @@ NMethodSweeper::possibly_sweep(); nm = NULL; int comp_level = CompLevel_full_optimization; + char* failure_detail = NULL; + GraalEnv::CodeInstallResult result; { // To prevent compile queue updates. MutexLocker locker(MethodCompileQueue_lock, THREAD); @@ -494,7 +496,7 @@ dependencies->encode_content_bytes(); // Check for {class loads, evolution, breakpoints} during compilation - if (!check_for_system_dictionary_modification(dependencies, compiled_code, env, THREAD)) { + if (!check_for_system_dictionary_modification(dependencies, compiled_code, env, &failure_detail)) { // While not a true deoptimization, it is a preemptive decompile. MethodData* mdp = method()->method_data(); if (mdp != NULL) { @@ -511,83 +513,91 @@ // If the code buffer is created on each compile attempt // as in C2, then it must be freed. //code_buffer->free_blob(); - return GraalEnv::dependencies_failed; - } - ImplicitExceptionTable implicit_tbl; - nm = nmethod::new_nmethod(method, - compile_id, - entry_bci, - offsets, - orig_pc_offset, - debug_info, dependencies, code_buffer, - frame_words, oop_map_set, - handler_table, &implicit_tbl, - compiler, comp_level, installed_code, speculation_log); + result = GraalEnv::dependencies_failed; + } else { + ImplicitExceptionTable implicit_tbl; + nm = nmethod::new_nmethod(method, + compile_id, + entry_bci, + offsets, + orig_pc_offset, + debug_info, dependencies, code_buffer, + frame_words, oop_map_set, + handler_table, &implicit_tbl, + compiler, comp_level, installed_code, speculation_log); - // Free codeBlobs - //code_buffer->free_blob(); + // Free codeBlobs + //code_buffer->free_blob(); - if (nm == NULL) { - // The CodeCache is full. Print out warning and disable compilation. - { - MutexUnlocker ml(Compile_lock); - MutexUnlocker locker(MethodCompileQueue_lock); - CompileBroker::handle_full_code_cache(); - } - } else { - nm->set_has_unsafe_access(has_unsafe_access); + if (nm == NULL) { + // The CodeCache is full. Print out warning and disable compilation. + { + MutexUnlocker ml(Compile_lock); + MutexUnlocker locker(MethodCompileQueue_lock); + CompileBroker::handle_full_code_cache(); + } + } else { + nm->set_has_unsafe_access(has_unsafe_access); + + // Record successful registration. + // (Put nm into the task handle *before* publishing to the Java heap.) + CompileTask* task = env == NULL ? NULL : env->task(); + if (task != NULL) task->set_code(nm); - // Record successful registration. - // (Put nm into the task handle *before* publishing to the Java heap.) - CompileTask* task = env == NULL ? NULL : env->task(); - if (task != NULL) task->set_code(nm); - - if (installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(installed_code())) { - if (entry_bci == InvocationEntryBci) { - if (TieredCompilation) { - // If there is an old version we're done with it - nmethod* old = method->code(); - if (TraceMethodReplacement && old != NULL) { + if (installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(installed_code())) { + if (entry_bci == InvocationEntryBci) { + if (TieredCompilation) { + // If there is an old version we're done with it + nmethod* old = method->code(); + if (TraceMethodReplacement && old != NULL) { + ResourceMark rm; + char *method_name = method->name_and_sig_as_C_string(); + tty->print_cr("Replacing method %s", method_name); + } + if (old != NULL ) { + old->make_not_entrant(); + } + } + if (TraceNMethodInstalls) { ResourceMark rm; char *method_name = method->name_and_sig_as_C_string(); - tty->print_cr("Replacing method %s", method_name); - } - if (old != NULL ) { - old->make_not_entrant(); + ttyLocker ttyl; + tty->print_cr("Installing method (%d) %s [entry point: %p]", + comp_level, + method_name, nm->entry_point()); } - } - if (TraceNMethodInstalls) { - ResourceMark rm; - char *method_name = method->name_and_sig_as_C_string(); - ttyLocker ttyl; - tty->print_cr("Installing method (%d) %s [entry point: %p]", - comp_level, - method_name, nm->entry_point()); + // Allow the code to be executed + method->set_code(method, nm); + } else { + if (TraceNMethodInstalls ) { + ResourceMark rm; + char *method_name = method->name_and_sig_as_C_string(); + ttyLocker ttyl; + tty->print_cr("Installing osr method (%d) %s @ %d", + comp_level, + method_name, + entry_bci); + } + InstanceKlass::cast(method->method_holder())->add_osr_nmethod(nm); } - // Allow the code to be executed - method->set_code(method, nm); - } else { - if (TraceNMethodInstalls ) { - ResourceMark rm; - char *method_name = method->name_and_sig_as_C_string(); - ttyLocker ttyl; - tty->print_cr("Installing osr method (%d) %s @ %d", - comp_level, - method_name, - entry_bci); - } - InstanceKlass::cast(method->method_holder())->add_osr_nmethod(nm); - } } + result = nm != NULL ? GraalEnv::ok :GraalEnv::cache_full; } } + + // String creation must be done outside lock + if (failure_detail != NULL) { + // A failure to allocate the string is silently ignored. + Handle message = java_lang_String::create_from_str(failure_detail, THREAD); + HotSpotCompiledNmethod::set_installationFailureMessage(compiled_code, message()); + } + // JVMTI -- compiled method notification (must be done outside lock) if (nm != NULL) { nm->post_compiled_method_load_event(); - return GraalEnv::ok; } - return GraalEnv::cache_full; + return result; }
--- a/src/share/vm/graal/graalEnv.hpp Wed Feb 18 10:37:08 2015 -0800 +++ b/src/share/vm/graal/graalEnv.hpp Mon Feb 23 16:23:23 2015 -0800 @@ -133,7 +133,7 @@ // Helper routine for determining the validity of a compilation // with respect to concurrent class loading. - static bool check_for_system_dictionary_modification(Dependencies* target, Handle compiled_code, GraalEnv* env, TRAPS); + static bool check_for_system_dictionary_modification(Dependencies* target, Handle compiled_code, GraalEnv* env, char** failure_detail); public: CompileTask* task() { return _task; }