# HG changeset patch # User Doug Simon # Date 1358955297 -3600 # Node ID 5e3d1a68664ed6530dfba8e96af78859655b0d6b # Parent 4a11124a3563417855f118afd7eee1ed61b21d6d applied mx eclipseformat to all Java files diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java --- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,20 +28,24 @@ import com.oracle.graal.nodes.cfg.*; /** - * Computes an ordering of the block that can be used by the linear scan register allocator and the machine code - * generator. The machine code generation order will start with the first block and produce a straight sequence - * always following the most likely successor. Then it will continue with the most likely path that was left out during - * this process. The process iteratively continues until all blocks are scheduled. Additionally, it is guaranteed that - * all blocks of a loop are scheduled before any block following the loop is scheduled. - * - * The machine code generator order includes reordering of loop headers such that the backward jump is a conditional jump if there - * is only one loop end block. Additionally, the target of loop backward jumps are always marked as aligned. Aligning the target of conditional - * jumps does not bring a measurable benefit and is therefore avoided to keep the code size small. - * - * The linear scan register allocator order has an additional mechanism that prevents merge nodes from being scheduled if there is - * at least one highly likely predecessor still unscheduled. This increases the probability that the merge node and the corresponding - * predecessor are more closely together in the schedule thus decreasing the probability for inserted phi moves. Also, the algorithm sets - * the linear scan order number of the block that corresponds to its index in the linear scan order. + * Computes an ordering of the block that can be used by the linear scan register allocator and the + * machine code generator. The machine code generation order will start with the first block and + * produce a straight sequence always following the most likely successor. Then it will continue + * with the most likely path that was left out during this process. The process iteratively + * continues until all blocks are scheduled. Additionally, it is guaranteed that all blocks of a + * loop are scheduled before any block following the loop is scheduled. + * + * The machine code generator order includes reordering of loop headers such that the backward jump + * is a conditional jump if there is only one loop end block. Additionally, the target of loop + * backward jumps are always marked as aligned. Aligning the target of conditional jumps does not + * bring a measurable benefit and is therefore avoided to keep the code size small. + * + * The linear scan register allocator order has an additional mechanism that prevents merge nodes + * from being scheduled if there is at least one highly likely predecessor still unscheduled. This + * increases the probability that the merge node and the corresponding predecessor are more closely + * together in the schedule thus decreasing the probability for inserted phi moves. Also, the + * algorithm sets the linear scan order number of the block that corresponds to its index in the + * linear scan order. */ public final class ComputeBlockOrder { @@ -51,15 +55,15 @@ private static final int INITIAL_WORKLIST_CAPACITY = 10; /** - * Divisor used for degrading the probability of the current path versus unscheduled paths at a merge node when - * calculating the linear scan order. A high value means that predecessors of merge nodes are more likely to be - * scheduled before the merge node. + * Divisor used for degrading the probability of the current path versus unscheduled paths at a + * merge node when calculating the linear scan order. A high value means that predecessors of + * merge nodes are more likely to be scheduled before the merge node. */ private static final int PENALTY_VERSUS_UNSCHEDULED = 10; /** * Computes the block order used for the linear scan register allocator. - * + * * @return sorted list of blocks */ public static List computeLinearScanOrder(int blockCount, Block startBlock) { @@ -73,7 +77,7 @@ /** * Computes the block order used for code emission. - * + * * @return sorted list of blocks */ public static List computeCodeEmittingOrder(int blockCount, Block startBlock) { @@ -125,7 +129,8 @@ enqueueSuccessors(block, worklist, visitedBlocks); if (mostLikelySuccessor != null) { if (!mostLikelySuccessor.isLoopHeader() && mostLikelySuccessor.getPredecessorCount() > 1) { - // We are at a merge. Check probabilities of predecessors that are not yet scheduled. + // We are at a merge. Check probabilities of predecessors that are not yet + // scheduled. double unscheduledSum = 0.0; for (Block pred : mostLikelySuccessor.getPredecessors()) { if (!visitedBlocks.get(pred.getId())) { @@ -148,7 +153,8 @@ */ private static void addPathToCodeEmittingOrder(Block block, List order, PriorityQueue worklist, BitSet visitedBlocks) { - // Skip loop headers if there is only a single loop end block to make the backward jump be a conditional jump. + // Skip loop headers if there is only a single loop end block to make the backward jump be a + // conditional jump. if (!skipLoopHeader(block)) { // Align unskipped loop headers as they are the target of the backward jump. @@ -161,10 +167,12 @@ Loop loop = block.getLoop(); if (block.isLoopEnd() && skipLoopHeader(loop.header)) { - // This is the only loop end of a skipped loop header. Add the header immediately afterwards. + // This is the only loop end of a skipped loop header. Add the header immediately + // afterwards. addBlock(loop.header, order); - // Make sure the loop successors of the loop header are aligned as they are the target of the backward jump. + // Make sure the loop successors of the loop header are aligned as they are the target + // of the backward jump. for (Block successor : loop.header.getSuccessors()) { if (successor.getLoopDepth() == block.getLoopDepth()) { successor.setAlign(true); @@ -217,7 +225,8 @@ } /** - * Skip the loop header block if the loop consists of more than one block and it has only a single loop end block. + * 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 boolean skipLoopHeader(Block block) { return (block.isLoopHeader() && !block.isLoopEnd() && block.getLoop().loopBegin().loopEnds().count() == 1); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Address.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Address.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Address.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,15 +27,17 @@ import com.oracle.graal.api.meta.*; /** - * Represents an address in target machine memory, specified via some combination of a base register, an index register, - * a displacement and a scale. Note that the base and index registers may be a variable that will get a register assigned - * later by the register allocator. + * Represents an address in target machine memory, specified via some combination of a base + * register, an index register, a displacement and a scale. Note that the base and index registers + * may be a variable that will get a register assigned later by the register allocator. */ public final class Address extends Value { + private static final long serialVersionUID = -1003772042519945089L; /** - * A sentinel value used as a place holder in an instruction stream for an address that will be patched. + * A sentinel value used as a place holder in an instruction stream for an address that will be + * patched. */ public static final Address Placeholder = new Address(Kind.Illegal, Value.ILLEGAL); @@ -46,7 +48,7 @@ /** * Creates an {@link Address} with given base register, no scaling and no displacement. - * + * * @param kind the kind of the value being addressed * @param base the base register */ @@ -56,7 +58,7 @@ /** * Creates an {@link Address} with given base register, no scaling and a given displacement. - * + * * @param kind the kind of the value being addressed * @param base the base register * @param displacement the displacement @@ -68,7 +70,7 @@ /** * Creates an {@link Address} with given base and index registers, scaling and displacement. * This is the most general constructor. - * + * * @param kind the kind of the value being addressed * @param base the base register * @param index the index register @@ -90,10 +92,7 @@ * A scaling factor used in complex addressing modes such as those supported by x86 platforms. */ public enum Scale { - Times1(1, 0), - Times2(2, 1), - Times4(4, 2), - Times8(8, 3); + Times1(1, 0), Times2(2, 1), Times4(4, 2), Times8(8, 3); private Scale(int value, int log2) { this.value = value; @@ -112,11 +111,16 @@ public static Scale fromInt(int scale) { switch (scale) { - case 1: return Times1; - case 2: return Times2; - case 4: return Times4; - case 8: return Times8; - default: throw new IllegalArgumentException(String.valueOf(scale)); + case 1: + return Times1; + case 2: + return Times2; + case 4: + return Times4; + case 8: + return Times8; + default: + throw new IllegalArgumentException(String.valueOf(scale)); } } } @@ -151,7 +155,8 @@ public boolean equals(Object obj) { if (obj instanceof Address) { Address addr = (Address) obj; - return getKind() == addr.getKind() && getDisplacement() == addr.getDisplacement() && getBase().equals(addr.getBase()) && getScale() == addr.getScale() && getIndex().equals(addr.getIndex()); + return getKind() == addr.getKind() && getDisplacement() == addr.getDisplacement() && getBase().equals(addr.getBase()) && getScale() == addr.getScale() && + getIndex().equals(addr.getIndex()); } return false; } @@ -162,8 +167,8 @@ } /** - * @return Base register that defines the start of the address computation. - * If not present, is denoted by {@link Value#ILLEGAL}. + * @return Base register that defines the start of the address computation. If not present, is + * denoted by {@link Value#ILLEGAL}. */ public Value getBase() { return base; @@ -174,8 +179,8 @@ } /** - * @return Index register, the value of which (possibly scaled by {@link #scale}) is added to {@link #base}. - * If not present, is denoted by {@link Value#ILLEGAL}. + * @return Index register, the value of which (possibly scaled by {@link #scale}) is added to + * {@link #base}. If not present, is denoted by {@link Value#ILLEGAL}. */ public Value getIndex() { return index; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Architecture.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Architecture.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Architecture.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,10 +26,9 @@ import com.oracle.graal.api.code.Register.*; - /** - * Represents a CPU architecture, including information such as its endianness, CPU - * registers, word width, etc. + * Represents a CPU architecture, including information such as its endianness, CPU registers, word + * width, etc. */ public abstract class Architecture { @@ -37,18 +36,19 @@ * The endianness of the architecture. */ public static enum ByteOrder { - LittleEndian, - BigEndian + LittleEndian, BigEndian } /** - * The number of bits required in a bit map covering all the registers that may store references. - * The bit position of a register in the map is the register's {@linkplain Register#number number}. + * The number of bits required in a bit map covering all the registers that may store + * references. The bit position of a register in the map is the register's + * {@linkplain Register#number number}. */ private final int registerReferenceMapBitCount; /** - * Represents the natural size of words (typically registers and pointers) of this architecture, in bytes. + * Represents the natural size of words (typically registers and pointers) of this architecture, + * in bytes. */ private final int wordSize; @@ -69,8 +69,8 @@ private final ByteOrder byteOrder; /** - * Mask of the barrier constants denoting the barriers that - * are not required to be explicitly inserted under this architecture. + * Mask of the barrier constants denoting the barriers that are not required to be explicitly + * inserted under this architecture. */ private final int implicitMemoryBarriers; @@ -80,8 +80,8 @@ private final int machineCodeCallDisplacementOffset; /** - * The size of the return address pushed to the stack by a call instruction. - * A value of 0 denotes that call linkage uses registers instead (e.g. SPARC). + * The size of the return address pushed to the stack by a call instruction. A value of 0 + * denotes that call linkage uses registers instead (e.g. SPARC). */ private final int returnAddressSize; @@ -89,7 +89,7 @@ /** * Gets the register for a given {@linkplain Register#encoding encoding} and type. - * + * * @param encoding a register value as used in a machine instruction * @param type the type of the register */ @@ -101,13 +101,7 @@ return reg; } - protected Architecture(String name, - int wordSize, - ByteOrder byteOrder, - Register[] registers, - int implicitMemoryBarriers, - int nativeCallDisplacementOffset, - int registerReferenceMapBitCount, + protected Architecture(String name, int wordSize, ByteOrder byteOrder, Register[] registers, int implicitMemoryBarriers, int nativeCallDisplacementOffset, int registerReferenceMapBitCount, int returnAddressSize) { this.name = name; this.registers = registers; @@ -133,6 +127,7 @@ /** * Converts this architecture to a string. + * * @return the string representation of this architecture */ @Override @@ -145,7 +140,8 @@ } /** - * Gets the natural size of words (typically registers and pointers) of this architecture, in bytes. + * Gets the natural size of words (typically registers and pointers) of this architecture, in + * bytes. */ public int getWordSize() { return wordSize; @@ -159,8 +155,8 @@ } /** - * Gets an array of all available registers on this architecture. The index of each register in this - * array is equal to its {@linkplain Register#number number}. + * Gets an array of all available registers on this architecture. The index of each register in + * this array is equal to its {@linkplain Register#number number}. */ public Register[] getRegisters() { return registers.clone(); @@ -171,16 +167,16 @@ } /** - * Gets a mask of the barrier constants denoting the barriers that - * are not required to be explicitly inserted under this architecture. + * Gets a mask of the barrier constants denoting the barriers that are not required to be + * explicitly inserted under this architecture. */ public int getImplicitMemoryBarriers() { return implicitMemoryBarriers; } /** - * Gets the size of the return address pushed to the stack by a call instruction. - * A value of 0 denotes that call linkage uses registers instead. + * Gets the size of the return address pushed to the stack by a call instruction. A value of 0 + * denotes that call linkage uses registers instead. */ public int getReturnAddressSize() { return returnAddressSize; @@ -194,8 +190,9 @@ } /** - * Determines the barriers in a given barrier mask that are explicitly required on this architecture. - * + * Determines the barriers in a given barrier mask that are explicitly required on this + * architecture. + * * @param barriers a mask of the barrier constants * @return the value of {@code barriers} minus the barriers unnecessary on this architecture */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java Wed Jan 23 16:34:57 2013 +0100 @@ -99,8 +99,8 @@ private static final long serialVersionUID = -7636746737947390059L; /** - * A virtual (or interface) method whose unique implementation for the receiver type - * in {@link #context} is {@link #impl}. + * A virtual (or interface) method whose unique implementation for the receiver type in + * {@link #context} is {@link #impl}. */ public final ResolvedJavaMethod method; @@ -182,7 +182,8 @@ } /** - * Array with the assumptions. This field is directly accessed from C++ code in the Graal/HotSpot implementation. + * Array with the assumptions. This field is directly accessed from C++ code in the + * Graal/HotSpot implementation. */ private Assumption[] list; private boolean useOptimisticAssumptions; @@ -194,6 +195,7 @@ /** * Returns whether any assumptions have been registered. + * * @return {@code true} if at least one assumption has been registered, {@code false} otherwise. */ public boolean isEmpty() { @@ -207,16 +209,20 @@ @Override public Iterator iterator() { return new Iterator() { + int index; + public void remove() { throw new UnsupportedOperationException(); } + public Assumption next() { if (index >= count) { throw new NoSuchElementException(); } return list[index++]; } + public boolean hasNext() { return index < count; } @@ -225,9 +231,10 @@ /** * Records an assumption that the specified type has no finalizable subclasses. - * + * * @param receiverType the type that is assumed to have no finalizable subclasses - * @return {@code true} if the assumption was recorded and can be assumed; {@code false} otherwise + * @return {@code true} if the assumption was recorded and can be assumed; {@code false} + * otherwise */ public boolean recordNoFinalizableSubclassAssumption(ResolvedJavaType receiverType) { // TODO (thomaswue): Record that assumption correctly. @@ -236,7 +243,9 @@ } /** - * Records that {@code subtype} is the only concrete subtype in the class hierarchy below {@code context}. + * Records that {@code subtype} is the only concrete subtype in the class hierarchy below + * {@code context}. + * * @param context the root of the subtree of the class hierarchy that this assumptions is about * @param subtype the one concrete subtype */ @@ -248,7 +257,7 @@ /** * Records that {@code impl} is the only possible concrete target for a virtual call to * {@code method} with a receiver of type {@code context}. - * + * * @param method a method that is the target of a virtual call * @param context the receiver type of a call to {@code method} * @param impl the concrete method that is the only possible target for the virtual call @@ -260,7 +269,7 @@ /** * Records that {@code method} was used during the compilation. - * + * * @param method a method whose contents were used */ public void recordMethodContents(ResolvedJavaMethod method) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BailoutException.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BailoutException.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BailoutException.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,9 +25,9 @@ import java.util.*; /** - * Exception thrown when the compiler refuses to compile a method because of problems with the method. - * e.g. bytecode wouldn't verify, too big, JSR/ret too complicated, etc. This exception is not - * meant to indicate problems with the compiler itself. + * Exception thrown when the compiler refuses to compile a method because of problems with the + * method. e.g. bytecode wouldn't verify, too big, JSR/ret too complicated, etc. This exception is + * not meant to indicate problems with the compiler itself. */ public class BailoutException extends RuntimeException { @@ -35,7 +35,7 @@ /** * Creates a new {@link BailoutException}. - * + * * @param reason a message indicating the reason */ public BailoutException(String reason) { @@ -44,7 +44,7 @@ /** * Creates a new {@link BailoutException}. - * + * * @param args parameters to the formatter */ public BailoutException(String format, Object... args) { @@ -53,7 +53,7 @@ /** * Creates a new {@link BailoutException} due to an internal exception being thrown. - * + * * @param reason a message indicating the reason * @param cause the throwable that was the cause of the bailout */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,26 +27,43 @@ import com.oracle.graal.api.meta.*; /** - * Represents the Java bytecode frame state(s) at a given position - * including {@link Value locations} where to find the local variables, - * operand stack values and locked objects of the bytecode frame(s). + * Represents the Java bytecode frame state(s) at a given position including {@link Value locations} + * where to find the local variables, operand stack values and locked objects of the bytecode + * frame(s). */ public class BytecodeFrame extends BytecodePosition implements Serializable { + private static final long serialVersionUID = -345025397165977565L; /** - * An array of values representing how to reconstruct the state of the Java frame. - * This is array is partitioned as follows: + * An array of values representing how to reconstruct the state of the Java frame. This is array + * is partitioned as follows: *

* - * - * - * - * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * *
Start index (inclusive)End index (exclusive)Description
0 numLocals Local variables
numLocals numLocals + numStackOperand stack
numLocals + numStackvalues.length Locked objects
Start index (inclusive)End index (exclusive)Description
0numLocalsLocal variables
numLocalsnumLocals + numStackOperand stack
numLocals + numStackvalues.lengthLocked objects
*

- * Note that the number of locals and the number of stack slots may be smaller than the - * maximum number of locals and stack slots as specified in the compiled method. + * Note that the number of locals and the number of stack slots may be smaller than the maximum + * number of locals and stack slots as specified in the compiled method. */ public final Value[] values; @@ -66,8 +83,10 @@ public final int numLocks; /** - * In case this frame state belongs to a deoptimization, the leafGraphId will contain the StructuredGraph.graphId() of the graph that originally introduced this deoptimization point. - * This id is later on used by the runtime system to evict graphs from the graph cache when deoptimizations originating from them have been hit. + * In case this frame state belongs to a deoptimization, the leafGraphId will contain the + * StructuredGraph.graphId() of the graph that originally introduced this deoptimization point. + * This id is later on used by the runtime system to evict graphs from the graph cache when + * deoptimizations originating from them have been hit. */ public final long leafGraphId; @@ -77,17 +96,19 @@ /** * Creates a new frame object. - * + * * @param caller the caller frame (which may be {@code null}) * @param method the method * @param bci a BCI within the method - * @param rethrowException specifies if the VM should re-throw the pending exception when deopt'ing using this frame + * @param rethrowException specifies if the VM should re-throw the pending exception when + * deopt'ing using this frame * @param values the frame state {@link #values} * @param numLocals the number of local variables * @param numStack the depth of the stack * @param numLocks the number of locked objects */ - public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, Value[] values, int numLocals, int numStack, int numLocks, long leafGraphId) { + public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, Value[] values, int numLocals, int numStack, int numLocks, + long leafGraphId) { super(caller, method, bci); assert values != null; this.rethrowException = rethrowException; @@ -102,6 +123,7 @@ /** * Gets the value representing the specified local variable. + * * @param i the local variable index * @return the value that can be used to reconstruct the local's current value */ @@ -111,6 +133,7 @@ /** * Gets the value representing the specified stack slot. + * * @param i the stack index * @return the value that can be used to reconstruct the stack slot's current value */ @@ -120,6 +143,7 @@ /** * Gets the value representing the specified lock. + * * @param i the lock index * @return the value that can be used to reconstruct the lock's current value */ @@ -129,7 +153,7 @@ /** * Gets the caller of this frame. - * + * * @return {@code null} if this frame has no caller */ public BytecodeFrame caller() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodePosition.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodePosition.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodePosition.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,10 +27,10 @@ import com.oracle.graal.api.meta.*; /** - * Represents a code position, that is, a chain of inlined methods with bytecode - * locations, that is communicated from the compiler to the runtime system. A code position - * can be used by the runtime system to reconstruct a source-level stack trace - * for exceptions and to create {@linkplain BytecodeFrame frames} for deoptimization. + * Represents a code position, that is, a chain of inlined methods with bytecode locations, that is + * communicated from the compiler to the runtime system. A code position can be used by the runtime + * system to reconstruct a source-level stack trace for exceptions and to create + * {@linkplain BytecodeFrame frames} for deoptimization. */ public abstract class BytecodePosition implements Serializable { @@ -42,7 +42,7 @@ /** * Constructs a new object representing a given parent/caller, a given method, and a given BCI. - * + * * @param caller the parent position * @param method the method * @param bci a BCI within the method @@ -56,6 +56,7 @@ /** * Converts this code position to a string representation. + * * @return a string representation of this code position */ @Override @@ -89,9 +90,9 @@ } /** - * @return The location within the method, as a bytecode index. The constant - * {@code -1} may be used to indicate the location is unknown, for example - * within code synthesized by the compiler. + * @return The location within the method, as a bytecode index. The constant {@code -1} may be + * used to indicate the location is unknown, for example within code synthesized by the + * compiler. */ public int getBCI() { return bci; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CalleeSaveLayout.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CalleeSaveLayout.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CalleeSaveLayout.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,13 +24,11 @@ import java.util.*; - /** - * The callee save area (CSA) is a contiguous space in a stack frame - * used to save (and restore) the values of the caller's registers. - * This class describes the layout of a CSA in terms of its - * {@linkplain #size size}, {@linkplain #slotSize slot size} and - * the {@linkplain #registers callee save registers} covered by the CSA. + * The callee save area (CSA) is a contiguous space in a stack frame used to save (and restore) the + * values of the caller's registers. This class describes the layout of a CSA in terms of its + * {@linkplain #size size}, {@linkplain #slotSize slot size} and the {@linkplain #registers callee + * save registers} covered by the CSA. */ public class CalleeSaveLayout { @@ -57,16 +55,18 @@ public final Register[] registers; /** - * The offset from the frame pointer to the CSA. If this is not known, then this field - * will have the value {@link Integer#MAX_VALUE}. + * The offset from the frame pointer to the CSA. If this is not known, then this field will have + * the value {@link Integer#MAX_VALUE}. */ public final int frameOffsetToCSA; /** * 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 CSA + * + * @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 + * CSA * @param registers the registers that can be saved in the CSA */ public CalleeSaveLayout(int frameOffsetToCSA, int size, int slotSize, Register... registers) { @@ -109,7 +109,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 */ @@ -119,7 +119,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 */ @@ -132,7 +132,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 */ @@ -142,7 +142,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} */ @@ -152,10 +152,10 @@ /** * 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 + * @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 */ public Register registerAt(int index) { if (index < 0 || index >= indexToReg.length) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,10 +26,9 @@ import com.oracle.graal.api.meta.*; - /** - * A calling convention describes the locations in which the arguments for a call are placed, - * the location in which the return value is placed if the call is not void and any + * A calling convention describes the locations in which the arguments for a call are placed, the + * location in which the return value is placed if the call is not void and any * {@linkplain #getTemporaries() extra} locations used (and killed) by the call. */ public class CallingConvention { @@ -49,13 +48,14 @@ JavaCallee(false), /** - * A request for the outgoing argument locations at a call site to the runtime (which may be Java or native code). + * A request for the outgoing argument locations at a call site to the runtime (which may be + * Java or native code). */ RuntimeCall(true), /** - * A request for the outgoing argument locations at a call site to - * external native code that complies with the platform ABI. + * A request for the outgoing argument locations at a call site to external native code that + * complies with the platform ABI. */ NativeCall(true); @@ -90,9 +90,11 @@ /** * 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 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 + * call * @param argumentLocations the ordered locations in which the arguments are placed */ public CallingConvention(int stackSize, Value returnLocation, Value... argumentLocations) { @@ -101,10 +103,13 @@ /** * Creates a description of the registers and stack locations used by a call. - * - * @param temporaryLocations the locations used (and killed) by the call in addition to {@code arguments} - * @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 call + * + * @param temporaryLocations the locations used (and killed) by the call in addition to + * {@code arguments} + * @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 + * call * @param argumentLocations the ordered locations in which the arguments are placed */ public CallingConvention(Value[] temporaryLocations, int stackSize, Value returnLocation, Value... argumentLocations) { @@ -147,7 +152,8 @@ } /** - * Gets the locations used (and killed) by the call apart from the {@linkplain #getArgument(int) arguments}. + * Gets the locations used (and killed) by the call apart from the + * {@linkplain #getArgument(int) arguments}. */ public Value[] getTemporaries() { if (temporaryLocations.length == 0) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,14 +32,15 @@ public interface CodeCacheProvider extends MetaAccessProvider { /** - * Adds the given compilation result as an implementation of the given method without making it the default - * implementation. - * + * Adds the given compilation result as an implementation of the given method without making it + * the default implementation. + * * @param method a method to which the executable code is begin added * @param compResult the compilation result to be added - * @param info the object into which details of the installed code will be written. Ignored if null, otherwise the - * info is written to index 0 of this array. - * @return a reference to the compiled and ready-to-run code or null if the code installation failed + * @param info the object into which details of the installed code will be written. Ignored if + * null, otherwise the info is written to index 0 of this array. + * @return a reference to the compiled and ready-to-run code or null if the code installation + * failed */ InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult, CodeInfo[] info); @@ -50,30 +51,31 @@ /** * Returns a disassembly of the given installed code. - * + * * @param code the code that should be disassembled - * @return a disassembly. This will be of length 0 if the runtime does not support disassembling. + * @return a disassembly. This will be of length 0 if the runtime does not support + * disassembling. */ String disassemble(CodeInfo code, CompilationResult tm); /** * Gets the register configuration to use when compiling a given method. - * + * * @param method the top level method of a compilation */ RegisterConfig lookupRegisterConfig(ResolvedJavaMethod method); /** * Custom area on the stack of each compiled method that the VM can use for its own purposes. - * + * * @return the size of the custom area in bytes */ int getCustomStackAreaSize(); /** - * Minimum size of the stack area reserved for outgoing parameters. This area is reserved in all cases, even when - * the compiled method has no regular call instructions. - * + * Minimum size of the stack area reserved for outgoing parameters. This area is reserved in all + * cases, even when the compiled method has no regular call instructions. + * * @return the minimum size of the outgoing parameter area in bytes */ int getMinimumOutgoingSize(); @@ -90,15 +92,15 @@ /** * Encodes a deoptimization action and a deoptimization reason in an integer value. - * + * * @return the encoded value as an integer */ int encodeDeoptActionAndReason(DeoptimizationAction action, DeoptimizationReason reason); /** - * Determines if a {@link DataPatch} should be created for a given {@linkplain Constant#getPrimitiveAnnotation() annotated} - * primitive constant that part of a {@link CompilationResult}. A data patch is always - * created for an object constant. + * Determines if a {@link DataPatch} should be created for a given + * {@linkplain Constant#getPrimitiveAnnotation() annotated} primitive constant that part of a + * {@link CompilationResult}. A data patch is always created for an object constant. */ boolean needsDataPatch(Constant constant); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeInfo.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeInfo.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeInfo.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,9 +25,9 @@ import com.oracle.graal.api.meta.*; /** - * Represents some code installed in the code cache of the runtime. - * This encapsulated details are only for informational purposes. - * At any time, the runtime may invalidate the underlying code (e.g. due to deopt etc). + * Represents some code installed in the code cache of the runtime. This encapsulated details are + * only for informational purposes. At any time, the runtime may invalidate the underlying code + * (e.g. due to deopt etc). */ public interface CodeInfo { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeUtil.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeUtil.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeUtil.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,7 +27,8 @@ import com.oracle.graal.api.meta.*; /** - * Miscellaneous collection of utility methods used by {@code com.oracle.graal.api.code} and its clients. + * Miscellaneous collection of utility methods used by {@code com.oracle.graal.api.code} and its + * clients. */ public class CodeUtil { @@ -46,7 +47,7 @@ /** * Checks whether the specified integer is a power of two. - * + * * @param val the value to check * @return {@code true} if the value is a power of two; {@code false} otherwise */ @@ -56,7 +57,7 @@ /** * Checks whether the specified long is a power of two. - * + * * @param val the value to check * @return {@code true} if the value is a power of two; {@code false} otherwise */ @@ -65,9 +66,9 @@ } /** - * Computes the log (base 2) of the specified integer, rounding down. (E.g {@code log2(8) = 3}, {@code log2(21) = 4} - * ) - * + * Computes the log (base 2) of the specified integer, rounding down. (E.g {@code log2(8) = 3}, + * {@code log2(21) = 4} ) + * * @param val the value * @return the log base 2 of the value */ @@ -77,8 +78,9 @@ } /** - * Computes the log (base 2) of the specified long, rounding down. (E.g {@code log2(8) = 3}, {@code log2(21) = 4}) - * + * Computes the log (base 2) of the specified long, rounding down. (E.g {@code log2(8) = 3}, + * {@code log2(21) = 4}) + * * @param val the value * @return the log base 2 of the value */ @@ -89,7 +91,7 @@ /** * Formats the values in a frame as a tabulated string. - * + * * @param frame * @return the values in {@code frame} as a tabulated string */ @@ -127,8 +129,9 @@ } /** - * Formats a given table as a string. The value of each cell is produced by {@link String#valueOf(Object)}. - * + * Formats a given table as a string. The value of each cell is produced by + * {@link String#valueOf(Object)}. + * * @param cells the cells of the table in row-major order * @param cols the number of columns per row * @param lpad the number of space padding inserted before each formatted cell value @@ -176,7 +179,7 @@ /** * Appends a formatted code position to a {@link StringBuilder}. - * + * * @param sb the {@link StringBuilder} to append to * @param pos the code position to format and append to {@code sb} * @return the value of {@code sb} @@ -192,7 +195,7 @@ /** * Appends a formatted frame to a {@link StringBuilder}. - * + * * @param sb the {@link StringBuilder} to append to * @param frame the frame to format and append to {@code sb} * @return the value of {@code sb} @@ -243,8 +246,8 @@ private final Register[] registers; /** - * The offset (in bytes) from the slot pointed to by {@link #fp} to the slot corresponding to bit 0 in the frame - * reference map. + * The offset (in bytes) from the slot pointed to by {@link #fp} to the slot corresponding + * to bit 0 in the frame reference map. */ public final int refMapToFPOffset; @@ -272,7 +275,7 @@ /** * Appends a formatted debug info to a {@link StringBuilder}. - * + * * @param sb the {@link StringBuilder} to append to * @param info the debug info to format and append to {@code sb} * @return the value of {@code sb} diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,8 +28,8 @@ import com.oracle.graal.api.meta.*; /** - * Represents the output from compiling a method, including the compiled machine code, associated data and references, - * relocation information, deoptimization information, etc. + * Represents the output from compiling a method, including the compiled machine code, associated + * data and references, relocation information, deoptimization information, etc. */ public class CompilationResult implements Serializable { @@ -39,6 +39,7 @@ * Represents a code position with associated additional information. */ public abstract static class Site implements Serializable { + private static final long serialVersionUID = -8214214947651979102L; /** * The position (or offset) of this site with respect to the start of the target method. @@ -54,6 +55,7 @@ * Represents a safepoint with associated debug info. */ public static class Safepoint extends Site implements Comparable { + private static final long serialVersionUID = 2479806696381720162L; public final DebugInfo debugInfo; @@ -86,6 +88,7 @@ * Represents a call in the code. */ public static final class Call extends Safepoint { + private static final long serialVersionUID = 1440741241631046954L; /** @@ -99,9 +102,9 @@ public final int size; /** - * Specifies if this call is direct or indirect. A direct call has an immediate operand encoding - * the absolute or relative (to the call itself) address of the target. An indirect call has a - * register or memory operand specifying the target address of the call. + * Specifies if this call is direct or indirect. A direct call has an immediate operand + * encoding the absolute or relative (to the call itself) address of the target. An indirect + * call has a register or memory operand specifying the target address of the call. */ public final boolean direct; @@ -132,6 +135,7 @@ * Represents a reference to data from the code. The associated data can be any constant. */ public static final class DataPatch extends Site { + private static final long serialVersionUID = 5771730331604867476L; public final Constant constant; public final int alignment; @@ -155,10 +159,12 @@ } /** - * Provides extra information about instructions or data at specific positions in {@link CompilationResult#getTargetCode()}. - * This is optional information that can be used to enhance a disassembly of the code. + * Provides extra information about instructions or data at specific positions in + * {@link CompilationResult#getTargetCode()}. This is optional information that can be used to + * enhance a disassembly of the code. */ public abstract static class CodeAnnotation implements Serializable { + private static final long serialVersionUID = -7903959680749520748L; public final int position; @@ -171,11 +177,13 @@ * A string comment about one or more instructions at a specific position in the code. */ public static final class CodeComment extends CodeAnnotation { + /** * */ private static final long serialVersionUID = 6802287188701961401L; public final String value; + public CodeComment(int position, String comment) { super(position); this.value = comment; @@ -191,8 +199,10 @@ * Labels some inline data in the code. */ public static final class InlineData extends CodeAnnotation { + private static final long serialVersionUID = 305997507263827108L; public final int size; + public InlineData(int position, int size) { super(position); this.size = size; @@ -205,13 +215,16 @@ } /** - * Describes a table of signed offsets embedded in the code. The offsets are relative to the starting - * address of the table. This type of table maybe generated when translating a multi-way branch - * based on a key value from a dense value set (e.g. the {@code tableswitch} JVM instruction). - * - * The table is indexed by the contiguous range of integers from {@link #low} to {@link #high} inclusive. + * Describes a table of signed offsets embedded in the code. The offsets are relative to the + * starting address of the table. This type of table maybe generated when translating a + * multi-way branch based on a key value from a dense value set (e.g. the {@code tableswitch} + * JVM instruction). + * + * The table is indexed by the contiguous range of integers from {@link #low} to {@link #high} + * inclusive. */ public static final class JumpTable extends CodeAnnotation { + private static final long serialVersionUID = 2222194398353801831L; /** @@ -243,11 +256,12 @@ } /** - * Describes a table of key and offset pairs. The offset in each table entry is relative to the address of - * the table. This type of table maybe generated when translating a multi-way branch + * Describes a table of key and offset pairs. The offset in each table entry is relative to the + * address of the table. This type of table maybe generated when translating a multi-way branch * based on a key value from a sparse value set (e.g. the {@code lookupswitch} JVM instruction). */ public static final class LookupTable extends CodeAnnotation { + private static final long serialVersionUID = 8367952567559116160L; /** @@ -279,10 +293,11 @@ } /** - * Represents exception handler information for a specific code position. It includes the catch code position as - * well as the caught exception type. + * Represents exception handler information for a specific code position. It includes the catch + * code position as well as the caught exception type. */ public static final class ExceptionHandler extends Site { + private static final long serialVersionUID = 4897339464722665281L; public final int handlerPos; @@ -298,10 +313,11 @@ } /** - * Represents a mark in the machine code that can be used by the runtime for its own purposes. A mark - * can reference other marks. + * Represents a mark in the machine code that can be used by the runtime for its own purposes. A + * mark can reference other marks. */ public static final class Mark extends Site { + private static final long serialVersionUID = 3612943150662354844L; public final Object id; public final Mark[] references; @@ -358,9 +374,9 @@ } /** - * Sets the frame size in bytes. Does not include the return address pushed onto the - * stack, if any. - * + * Sets the frame size in bytes. Does not include the return address pushed onto the stack, if + * any. + * * @param size the size of the frame in bytes */ public void setFrameSize(int size) { @@ -369,7 +385,7 @@ /** * Sets the machine that has been generated by the compiler. - * + * * @param code the machine code generated * @param size the size of the machine code */ @@ -380,7 +396,7 @@ /** * Sets the info on callee-saved registers used by this method. - * + * * @param csl the register-saving info. */ public void setCalleeSaveLayout(CalleeSaveLayout csl) { @@ -388,11 +404,13 @@ } /** - * Records a reference to the data section in the code section (e.g. to load an integer or floating point constant). - * + * Records a reference to the data section in the code section (e.g. to load an integer or + * floating point constant). + * * @param codePos the position in the code where the data reference occurs * @param data the data that is referenced - * @param alignment the alignment requirement of the data or 0 if there is no alignment requirement + * @param alignment the alignment requirement of the data or 0 if there is no alignment + * requirement * @param inlined specifies if the data is encoded inline or is loaded from a separate data area */ public void recordDataReference(int codePos, Constant data, int alignment, boolean inlined) { @@ -402,7 +420,7 @@ /** * Records a call in the code array. - * + * * @param codePos the position of the call in the code array * @param size the size of the call instruction * @param target the {@link CodeCacheProvider#lookupCallTarget(Object) target} being called @@ -416,9 +434,9 @@ /** * Records an exception handler for this method. - * - * @param codePos the position in the code that is covered by the handler - * @param handlerPos the position of the handler + * + * @param codePos the position in the code that is covered by the handler + * @param handlerPos the position of the handler */ public void recordExceptionHandler(int codePos, int handlerPos) { getExceptionHandlers().add(new ExceptionHandler(codePos, handlerPos)); @@ -426,7 +444,7 @@ /** * Records a safepoint in the code array. - * + * * @param codePos the position of the safepoint in the code array * @param debugInfo the debug info for the safepoint */ @@ -445,7 +463,7 @@ /** * Records an instruction mark within this method. - * + * * @param codePos the position in the code that is covered by the handler * @param id the identifier for this mark * @param references an array of other marks that this mark references @@ -457,9 +475,10 @@ } /** - * Allows a method to specify the offset of the epilogue that restores the callee saved registers. Must be called - * iff the method is a callee saved method and stores callee registers on the stack. - * + * Allows a method to specify the offset of the epilogue that restores the callee saved + * registers. Must be called iff the method is a callee saved method and stores callee registers + * on the stack. + * * @param registerRestoreEpilogueOffset the offset in the machine code where the epilogue begins */ public void setRegisterRestoreEpilogueOffset(int registerRestoreEpilogueOffset) { @@ -469,7 +488,7 @@ /** * The frame size of the method in bytes. - * + * * @return the frame size */ public int getFrameSize() { @@ -478,8 +497,8 @@ } /** - * @return the code offset of the start of the epilogue that restores all callee saved registers, or -1 if this is - * not a callee saved method + * @return the code offset of the start of the epilogue that restores all callee saved + * registers, or -1 if this is not a callee saved method */ public int getRegisterRestoreEpilogueOffset() { return registerRestoreEpilogueOffset; @@ -487,6 +506,7 @@ /** * Offset in bytes for the custom stack area (relative to sp). + * * @return the offset in bytes */ public int getCustomStackAreaOffset() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DebugInfo.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DebugInfo.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DebugInfo.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,8 +26,8 @@ import java.util.*; /** - * Represents the debugging information for a particular place in the code, - * which includes the code position, a reference map, and deoptimization information. + * Represents the debugging information for a particular place in the code, which includes the code + * position, a reference map, and deoptimization information. */ public class DebugInfo implements Serializable { @@ -39,8 +39,9 @@ /** * Creates a new {@link DebugInfo} from the given values. - * - * @param codePos the {@linkplain BytecodePosition code position} or {@linkplain BytecodeFrame frame} info + * + * @param codePos the {@linkplain BytecodePosition code position} or {@linkplain BytecodeFrame + * frame} info * @param registerRefMap the register map * @param frameRefMap the reference map for {@code frame}, which may be {@code null} */ @@ -71,10 +72,9 @@ return getFrameRefMap() != null && getFrameRefMap().size() > 0; } - /** * Gets the deoptimization information for each inlined frame (if available). - * + * * @return {@code null} if no frame de-opt info is {@linkplain #hasFrame() available} */ public BytecodeFrame frame() { @@ -90,25 +90,26 @@ } /** - * @return The code position (including all inlined methods) of this debug info. - * If this is a {@link BytecodeFrame} instance, then it is also the deoptimization information for each inlined frame. + * @return The code position (including all inlined methods) of this debug info. If this is a + * {@link BytecodeFrame} instance, then it is also the deoptimization information for + * each inlined frame. */ public BytecodePosition getBytecodePosition() { return bytecodePosition; } /** - * @return The reference map for the registers at this point. The reference map is packed in that - * for bit {@code k} in byte {@code n}, it refers to the register whose - * {@linkplain Register#number number} is {@code (k + n * 8)}. + * @return The reference map for the registers at this point. The reference map is packed + * in that for bit {@code k} in byte {@code n}, it refers to the register whose + * {@linkplain Register#number number} is {@code (k + n * 8)}. */ public BitSet getRegisterRefMap() { return registerRefMap; } /** - * @return The reference map for the stack frame at this point. A set bit at {@code k} in the map - * represents stack slot number {@code k}. + * @return The reference map for the stack frame at this point. A set bit at {@code k} in the + * map represents stack slot number {@code k}. */ public BitSet getFrameRefMap() { return frameRefMap; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DeoptimizationAction.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DeoptimizationAction.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DeoptimizationAction.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,19 +23,20 @@ package com.oracle.graal.api.code; /** - * Specifies the action that should be taken by the runtime in case a certain deoptimization is triggered. + * Specifies the action that should be taken by the runtime in case a certain deoptimization is + * triggered. */ public enum DeoptimizationAction { /** - * Do not invalidate the machine code. - * This is typically used when deoptimizing at a point where it's highly likely - * nothing will change the likelihood of the deoptimization happening again. + * Do not invalidate the machine code. This is typically used when deoptimizing at a point where + * it's highly likely nothing will change the likelihood of the deoptimization happening again. * For example, a compiled array allocation where the size is negative. */ None, /** - * Do not invalidate the machine code, but schedule a recompilation if this deoptimization is triggered too often. + * Do not invalidate the machine code, but schedule a recompilation if this deoptimization is + * triggered too often. */ RecompileIfTooManyDeopts, @@ -45,10 +46,9 @@ InvalidateReprofile, /** - * Invalidate the machine code and immediately schedule a recompilation. - * This is typically used when deoptimizing to resolve an unresolved symbol in - * which case extra profiling is not required to determine that the deoptimization - * will not re-occur. + * Invalidate the machine code and immediately schedule a recompilation. This is typically used + * when deoptimizing to resolve an unresolved symbol in which case extra profiling is not + * required to determine that the deoptimization will not re-occur. */ InvalidateRecompile, diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,7 +25,8 @@ import com.oracle.graal.api.meta.*; /** - * Represents a compiled instance of a method. It may have been invalidated or removed in the meantime. + * Represents a compiled instance of a method. It may have been invalidated or removed in the + * meantime. */ public interface InstalledCode { @@ -43,12 +44,14 @@ ResolvedJavaMethod getMethod(); /** - * @return true if the code represented by this object is still valid, false otherwise (may happen due to deopt, etc.) + * @return true if the code represented by this object is still valid, false otherwise (may + * happen due to deopt, etc.) */ boolean isValid(); /** * Executes the installed code with three object arguments. + * * @param arg1 the first argument * @param arg2 the second argument * @param arg3 the third argument @@ -58,6 +61,7 @@ /** * Executes the installed code with a variable number of arguments. + * * @param args the array of object arguments * @return the value returned by the executed code */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MemoryBarriers.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MemoryBarriers.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MemoryBarriers.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,20 +24,22 @@ /** * Constants and intrinsic definition for memory barriers. - * - * The documentation for each constant is taken from Doug Lea's - * The JSR-133 Cookbook for Compiler Writers. + * + * The documentation for each constant is taken from Doug Lea's The JSR-133 Cookbook for Compiler + * Writers. *

- * 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: + * 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: + * *

  * 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:
@@ -48,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
@@ -61,40 +63,45 @@
 public class MemoryBarriers {
 
     /**
-     * The sequence {@code Load1; LoadLoad; Load2} ensures that {@code Load1}'s data are loaded before data accessed
-     * by {@code Load2} and all subsequent load instructions are loaded. In general, explicit {@code LoadLoad}
-     * barriers are needed on processors that perform speculative loads and/or out-of-order processing in which
-     * waiting load instructions can bypass waiting stores. On processors that guarantee to always preserve load
-     * ordering, these barriers amount to no-ops.
+     * The sequence {@code Load1; LoadLoad; Load2} ensures that {@code Load1}'s data are loaded
+     * before data accessed by {@code Load2} and all subsequent load instructions are loaded. In
+     * general, explicit {@code LoadLoad} barriers are needed on processors that perform speculative
+     * loads and/or out-of-order processing in which waiting load instructions can bypass waiting
+     * stores. On processors that guarantee to always preserve load ordering, these barriers amount
+     * to no-ops.
      */
-    public static final int LOAD_LOAD   = 0x0001;
+    public static final int LOAD_LOAD = 0x0001;
 
     /**
-     * The sequence {@code Load1; LoadStore; Store2} ensures that {@code Load1}'s data are loaded before all data
-     * associated with {@code Store2} and subsequent store instructions are flushed. {@code LoadStore} barriers are
-     * needed only on those out-of-order processors in which waiting store instructions can bypass loads.
+     * The sequence {@code Load1; LoadStore; Store2} ensures that {@code Load1}'s data are loaded
+     * before all data associated with {@code Store2} and subsequent store instructions are flushed.
+     * {@code LoadStore} barriers are needed only on those out-of-order processors in which waiting
+     * store instructions can bypass loads.
      */
-    public static final int LOAD_STORE  = 0x0002;
+    public static final int LOAD_STORE = 0x0002;
 
     /**
-     * The sequence {@code Store1; StoreLoad; Load2} ensures that {@code Store1}'s data are made visible to other
-     * processors (i.e., flushed to main memory) before data accessed by {@code Load2} and all subsequent load
-     * instructions are loaded. {@code StoreLoad} barriers protect against a subsequent load incorrectly using
-     * {@code Store1}'s data value rather than that from a more recent store to the same location performed by a
-     * different processor. Because of this, on the processors discussed below, a {@code StoreLoad} is strictly
-     * necessary only for separating stores from subsequent loads of the same location(s) as were stored before the
-     * barrier. {@code StoreLoad} barriers are needed on nearly all recent multiprocessors, and are usually the most
-     * expensive kind. Part of the reason they are expensive is that they must disable mechanisms that ordinarily
-     * bypass cache to satisfy loads from write-buffers. This might be implemented by letting the buffer fully
-     * flush, among other possible stalls.
+     * The sequence {@code Store1; StoreLoad; Load2} ensures that {@code Store1}'s data are made
+     * visible to other processors (i.e., flushed to main memory) before data accessed by
+     * {@code Load2} and all subsequent load instructions are loaded. {@code StoreLoad} barriers
+     * protect against a subsequent load incorrectly using {@code Store1}'s data value rather than
+     * that from a more recent store to the same location performed by a different processor.
+     * Because of this, on the processors discussed below, a {@code StoreLoad} is strictly necessary
+     * only for separating stores from subsequent loads of the same location(s) as were stored
+     * before the barrier. {@code StoreLoad} barriers are needed on nearly all recent
+     * multiprocessors, and are usually the most expensive kind. Part of the reason they are
+     * expensive is that they must disable mechanisms that ordinarily bypass cache to satisfy loads
+     * from write-buffers. This might be implemented by letting the buffer fully flush, among other
+     * possible stalls.
      */
-    public static final int STORE_LOAD  = 0x0004;
+    public static final int STORE_LOAD = 0x0004;
 
     /**
-     * The sequence {@code Store1; StoreStore; Store2} ensures that {@code Store1}'s data are visible to other
-     * processors (i.e., flushed to memory) before the data associated with {@code Store2} and all subsequent store
-     * instructions. In general, {@code StoreStore} barriers are needed on processors that do not otherwise
-     * guarantee strict ordering of flushes from write buffers and/or caches to other processors or main memory.
+     * The sequence {@code Store1; StoreStore; Store2} ensures that {@code Store1}'s data are
+     * visible to other processors (i.e., flushed to memory) before the data associated with
+     * {@code Store2} and all subsequent store instructions. In general, {@code StoreStore} barriers
+     * are needed on processors that do not otherwise guarantee strict ordering of flushes from
+     * write buffers and/or caches to other processors or main memory.
      */
     public static final int STORE_STORE = 0x0008;
 
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MonitorValue.java
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MonitorValue.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MonitorValue.java	Wed Jan 23 16:34:57 2013 +0100
@@ -28,6 +28,7 @@
  * Represents lock information in the debug information.
  */
 public final class MonitorValue extends Value {
+
     private static final long serialVersionUID = 8241681800464483691L;
 
     private Value owner;
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java	Wed Jan 23 16:34:57 2013 +0100
@@ -40,16 +40,16 @@
     public static final Register None = new Register(-1, -1, 0, "noreg");
 
     /**
-     * Frame pointer of the current method. All spill slots and outgoing stack-based arguments
-     * are addressed relative to this register.
+     * Frame pointer of the current method. All spill slots and outgoing stack-based arguments are
+     * addressed relative to this register.
      */
     public static final Register Frame = new Register(-2, -2, 0, "framereg", RegisterFlag.CPU);
 
     public static final Register CallerFrame = new Register(-3, -3, 0, "callerframereg", RegisterFlag.CPU);
 
     /**
-     * The identifier for this register that is unique across all the registers in a {@link Architecture}.
-     * A valid register has {@code number > 0}.
+     * The identifier for this register that is unique across all the registers in a
+     * {@link Architecture}. A valid register has {@code number > 0}.
      */
     public final int number;
 
@@ -59,8 +59,8 @@
     public final String name;
 
     /**
-     * The actual encoding in a target machine instruction for this register, which may or
-     * may not be the same as {@link #number}.
+     * The actual encoding in a target machine instruction for this register, which may or may not
+     * be the same as {@link #number}.
      */
     public final int encoding;
 
@@ -75,14 +75,14 @@
     private final int flags;
 
     /**
-     * An array of {@link RegisterValue} objects, for this register, with one entry
-     * per {@link Kind}, indexed by {@link Kind#ordinal}.
+     * An array of {@link RegisterValue} objects, for this register, with one entry per {@link Kind}
+     * , indexed by {@link Kind#ordinal}.
      */
     private final RegisterValue[] values;
 
     /**
      * Attributes that characterize a register in a useful way.
-     *
+     * 
      */
     public enum RegisterFlag {
         /**
@@ -105,7 +105,7 @@
 
     /**
      * Creates a {@link Register} instance.
-     *
+     * 
      * @param number unique identifier for the register
      * @param encoding the target machine encoding for the register
      * @param spillSlotSize the size of the stack slot used to spill the value of the register
@@ -139,6 +139,7 @@
 
     /**
      * Gets this register as a {@linkplain RegisterValue value} with a specified kind.
+     * 
      * @param kind the specified kind
      * @return the {@link RegisterValue}
      */
@@ -148,6 +149,7 @@
 
     /**
      * Gets this register as a {@linkplain RegisterValue value} with no particular kind.
+     * 
      * @return a {@link RegisterValue} with {@link Kind#Illegal} kind.
      */
     public RegisterValue asValue() {
@@ -156,6 +158,7 @@
 
     /**
      * Determines if this is a valid register.
+     * 
      * @return {@code true} iff this register is valid
      */
     public boolean isValid() {
@@ -178,6 +181,7 @@
 
     /**
      * Determines if this register has the {@link RegisterFlag#Byte} attribute set.
+     * 
      * @return {@code true} iff this register has the {@link RegisterFlag#Byte} attribute set.
      */
     public boolean isByte() {
@@ -186,10 +190,10 @@
 
     /**
      * Categorizes a set of registers by {@link RegisterFlag}.
-     *
+     * 
      * @param registers a list of registers to be categorized
-     * @return a map from each {@link RegisterFlag} constant to the list of registers for which the flag is
-     *         {@linkplain #isSet(RegisterFlag) set}
+     * @return a map from each {@link RegisterFlag} constant to the list of registers for which the
+     *         flag is {@linkplain #isSet(RegisterFlag) set}
      */
     public static EnumMap categorize(Register[] registers) {
         EnumMap result = new EnumMap<>(RegisterFlag.class);
@@ -207,7 +211,7 @@
 
     /**
      * Gets the maximum register {@linkplain #number number} in a given set of registers.
-     *
+     * 
      * @param registers the set of registers to process
      * @return the maximum register number for any register in {@code registers}
      */
@@ -223,7 +227,7 @@
 
     /**
      * Gets the maximum register {@linkplain #encoding encoding} in a given set of registers.
-     *
+     * 
      * @param registers the set of registers to process
      * @return the maximum register encoding for any register in {@code registers}
      */
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterAttributes.java
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterAttributes.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterAttributes.java	Wed Jan 23 16:34:57 2013 +0100
@@ -25,11 +25,12 @@
 import java.util.*;
 
 /**
- * A collection of register attributes. The specific attribute values for a register may be
- * local to a compilation context. For example, a {@link RegisterConfig} in use during
- * a compilation will determine which registers are callee saved.
+ * A collection of register attributes. The specific attribute values for a register may be local to
+ * a compilation context. For example, a {@link RegisterConfig} in use during a compilation will
+ * determine which registers are callee saved.
  */
 public class RegisterAttributes {
+
     private final boolean callerSave;
     private final boolean calleeSave;
     private final boolean allocatable;
@@ -46,21 +47,19 @@
      * 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 element at index i holds
-     *         the attributes of the register whose number is i.
+     * @return an array whose length is the max register number in {@code registers} plus 1. An
+     *         element at index i holds the attributes of the register whose number is i.
      */
     public static RegisterAttributes[] createMap(RegisterConfig registerConfig, Register[] registers) {
         RegisterAttributes[] map = new RegisterAttributes[registers.length];
         for (Register reg : registers) {
             if (reg != null) {
                 CalleeSaveLayout csl = registerConfig.getCalleeSaveLayout();
-                RegisterAttributes attr = new RegisterAttributes(
-                                Arrays.asList(registerConfig.getCallerSaveRegisters()).contains(reg),
-                                csl == null ? false : Arrays.asList(csl.registers).contains(reg),
-                                Arrays.asList(registerConfig.getAllocatableRegisters()).contains(reg));
+                RegisterAttributes attr = new RegisterAttributes(Arrays.asList(registerConfig.getCallerSaveRegisters()).contains(reg),
+                                csl == null ? false : Arrays.asList(csl.registers).contains(reg), Arrays.asList(registerConfig.getAllocatableRegisters()).contains(reg));
                 if (map.length <= reg.number) {
                     map = Arrays.copyOf(map, reg.number + 1);
                 }
@@ -83,14 +82,16 @@
     }
 
     /**
-     * @return Denotes a register whose value preservation (if required) across a call is the responsibility of the callee.
+     * @return Denotes a register whose value preservation (if required) across a call is the
+     *         responsibility of the callee.
      */
     public boolean isCalleeSave() {
         return calleeSave;
     }
 
     /**
-     * @return Denotes a register whose value preservation (if required) across a call is the responsibility of the caller.
+     * @return Denotes a register whose value preservation (if required) across a call is the
+     *         responsibility of the caller.
      */
     public boolean isCallerSave() {
         return callerSave;
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterConfig.java
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterConfig.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterConfig.java	Wed Jan 23 16:34:57 2013 +0100
@@ -29,8 +29,8 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * A register configuration binds roles and {@linkplain RegisterAttributes attributes}
- * to physical registers.
+ * A register configuration binds roles and {@linkplain RegisterAttributes attributes} to physical
+ * registers.
  */
 public interface RegisterConfig {
 
@@ -48,7 +48,7 @@
 
     /**
      * Gets the calling convention describing how arguments are passed.
-     *
+     * 
      * @param type the type of calling convention being requested
      * @param returnType the return type (can be null for methods returning {@code void})
      * @param parameterTypes the types of the arguments of the call
@@ -58,13 +58,14 @@
     CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription target, boolean stackOnly);
 
     /**
-     * Gets the ordered set of registers that are can be used to pass parameters
-     * according to a given calling convention.
-     *
+     * Gets the ordered set of registers that are can be used to pass parameters according to a
+     * given calling convention.
+     * 
      * @param type the type of calling convention
      * @param flag specifies whether registers for {@linkplain RegisterFlag#CPU integral} or
-     *             {@linkplain RegisterFlag#FPU floating point} parameters are being requested
-     * @return the ordered set of registers that may be used to pass parameters in a call conforming to {@code type}
+     *            {@linkplain RegisterFlag#FPU floating point} parameters are being requested
+     * @return the ordered set of registers that may be used to pass parameters in a call conforming
+     *         to {@code type}
      */
     Register[] getCallingConventionRegisters(Type type, RegisterFlag flag);
 
@@ -75,11 +76,13 @@
 
     /**
      * Gets the set of registers that can be used by the register allocator,
-     * {@linkplain Register#categorize(Register[]) categorized} by register {@linkplain RegisterFlag flags}.
-     *
-     * @return a map from each {@link RegisterFlag} constant to the list of {@linkplain #getAllocatableRegisters()
-     *         allocatable} registers for which the flag is set
-     *
+     * {@linkplain Register#categorize(Register[]) categorized} by register
+     * {@linkplain RegisterFlag flags}.
+     * 
+     * @return a map from each {@link RegisterFlag} constant to the list of
+     *         {@linkplain #getAllocatableRegisters() allocatable} registers for which the flag is
+     *         set
+     * 
      */
     EnumMap getCategorizedAllocatableRegisters();
 
@@ -90,7 +93,7 @@
 
     /**
      * Gets the layout of the callee save area of this register configuration.
-     *
+     * 
      * @return {@code null} if there is no callee save area
      */
     CalleeSaveLayout getCalleeSaveLayout();
@@ -98,15 +101,16 @@
     /**
      * Gets a map from register {@linkplain Register#number numbers} to register
      * {@linkplain RegisterAttributes attributes} for this register configuration.
-     *
-     * @return an array where an element at index i holds the attributes of the register whose number is i
+     * 
+     * @return an array where an element at index i holds the attributes of the register whose
+     *         number is i
      * @see Register#categorize(Register[])
      */
     RegisterAttributes[] getAttributesMap();
 
     /**
      * Gets the register corresponding to a runtime-defined role.
-     *
+     * 
      * @param id the identifier of a runtime-defined register role
      * @return the register playing the role specified by {@code id}
      */
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterValue.java
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterValue.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterValue.java	Wed Jan 23 16:34:57 2013 +0100
@@ -25,11 +25,13 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * Denotes a register that stores a value of a fixed kind. There is exactly one (canonical) instance of {@link
- * RegisterValue} for each ({@link Register}, {@link Kind}) pair. Use {@link Register#asValue(Kind)} to
- * retrieve the canonical {@link RegisterValue} instance for a given (register,kind) pair.
+ * Denotes a register that stores a value of a fixed kind. There is exactly one (canonical) instance
+ * of {@link RegisterValue} for each ({@link Register}, {@link Kind}) pair. Use
+ * {@link Register#asValue(Kind)} to retrieve the canonical {@link RegisterValue} instance for a
+ * given (register,kind) pair.
  */
 public final class RegisterValue extends Value {
+
     private static final long serialVersionUID = 7999341472196897163L;
 
     private final Register reg;
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RuntimeCallTarget.java
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RuntimeCallTarget.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RuntimeCallTarget.java	Wed Jan 23 16:34:57 2013 +0100
@@ -25,8 +25,8 @@
 import java.util.*;
 
 /**
- * The name, signature and calling convention of a call from compiled code to the runtime.
- * The target of such a call may be a leaf stub or a call into the runtime code proper.
+ * The name, signature and calling convention of a call from compiled code to the runtime. The
+ * target of such a call may be a leaf stub or a call into the runtime code proper.
  */
 public interface RuntimeCallTarget {
 
@@ -34,6 +34,7 @@
      * The name and signature of a runtime call.
      */
     public static class Descriptor {
+
         private final String name;
         private final boolean hasSideEffect;
         private final Class resultType;
@@ -54,9 +55,8 @@
         }
 
         /**
-         * Determines if this call changes state visible to other threads.
-         * Such calls denote boundaries across which deoptimization
-         * points cannot be moved.
+         * Determines if this call changes state visible to other threads. Such calls denote
+         * boundaries across which deoptimization points cannot be moved.
          */
         public boolean hasSideEffect() {
             return hasSideEffect;
@@ -105,8 +105,9 @@
     CallingConvention getCallingConvention();
 
     /**
-     * Returns the maximum absolute offset of PC relative call to this stub from any position in the code cache or -1
-     * when not applicable. Intended for determining the required size of address/offset fields.
+     * Returns the maximum absolute offset of PC relative call to this stub from any position in the
+     * code cache or -1 when not applicable. Intended for determining the required size of
+     * address/offset fields.
      */
     long getMaxCallTargetOffset();
 
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java	Wed Jan 23 16:34:57 2013 +0100
@@ -27,23 +27,24 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * Represents a compiler spill slot or an outgoing stack-based argument in a method's frame
- * or an incoming stack-based argument in a method's {@linkplain #isInCallerFrame() caller's frame}.
+ * Represents a compiler spill slot or an outgoing stack-based argument in a method's frame or an
+ * incoming stack-based argument in a method's {@linkplain #isInCallerFrame() caller's frame}.
  */
 public final class StackSlot extends Value {
+
     private static final long serialVersionUID = -7725071921307318433L;
 
     private final int offset;
     private final boolean addFrameSize;
 
     /**
-     * Gets a {@link StackSlot} instance representing a stack slot at a given index
-     * holding a value of a given kind.
-     *
+     * Gets a {@link StackSlot} instance representing a stack slot at a given index holding a value
+     * of a given kind.
+     * 
      * @param kind The kind of the value stored in the stack slot.
      * @param offset The offset of the stack slot (in bytes)
-     * @param addFrameSize Specifies if the offset is relative to the stack pointer,
-     *        or the beginning of the frame (stack pointer + total frame size).
+     * @param addFrameSize Specifies if the offset is relative to the stack pointer, or the
+     *            beginning of the frame (stack pointer + total frame size).
      */
     public static StackSlot get(Kind kind, int offset, boolean addFrameSize) {
         assert kind.getStackKind() == kind;
@@ -71,7 +72,8 @@
     }
 
     /**
-     * Private constructor to enforce use of {@link #get(Kind, int, boolean)} so that a cache can be used.
+     * Private constructor to enforce use of {@link #get(Kind, int, boolean)} so that a cache can be
+     * used.
      */
     private StackSlot(Kind kind, int offset, boolean addFrameSize) {
         super(kind);
@@ -81,6 +83,7 @@
 
     /**
      * Gets the offset of this stack slot, relative to the stack pointer.
+     * 
      * @return The offset of this slot (in bytes).
      */
     public int getOffset(int totalFrameSize) {
@@ -152,7 +155,6 @@
         return this;
     }
 
-
     private static final int CACHE_GRANULARITY = 8;
     private static final int SPILL_CACHE_PER_KIND_SIZE = 100;
     private static final int PARAM_CACHE_PER_KIND_SIZE = 10;
@@ -163,7 +165,7 @@
 
     private static StackSlot[][] makeCache(int cachePerKindSize, int sign, boolean addFrameSize) {
         StackSlot[][] cache = new StackSlot[Kind.values().length][];
-        for (Kind kind : new Kind[] {Illegal, Int, Long, Float, Double, Object, Jsr}) {
+        for (Kind kind : new Kind[]{Illegal, Int, Long, Float, Double, Object, Jsr}) {
             StackSlot[] slots = new StackSlot[cachePerKindSize];
             for (int i = 0; i < cachePerKindSize; i++) {
                 slots[i] = new StackSlot(kind, sign * i * CACHE_GRANULARITY, addFrameSize);
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TargetDescription.java
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TargetDescription.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TargetDescription.java	Wed Jan 23 16:34:57 2013 +0100
@@ -24,12 +24,12 @@
 
 import com.oracle.graal.api.meta.*;
 
-
 /**
- * Represents the target machine for a compiler, including the CPU architecture, the size of pointers and references,
- * alignment of stacks, caches, etc.
+ * Represents the target machine for a compiler, including the CPU architecture, the size of
+ * pointers and references, alignment of stacks, caches, etc.
  */
 public class TargetDescription {
+
     public final Architecture arch;
 
     /**
@@ -58,8 +58,10 @@
     public final Kind wordKind;
 
     /**
-     * The stack alignment requirement of the platform. For example,
-     * from Appendix D of Intel 64 and IA-32 Architectures Optimization Reference Manual:
+     * The stack alignment requirement of the platform. For example, from Appendix D of Intel 64 and IA-32 Architectures
+     * Optimization Reference Manual:
+     * 
      * 
      *     "It is important to ensure that the stack frame is aligned to a
      *      16-byte boundary upon function entry to keep local __m128 data,
@@ -80,24 +82,16 @@
     public final int cacheAlignment;
 
     /**
-     * Specifies how {@code long} and {@code double} constants are to be stored
-     * in {@linkplain BytecodeFrame frames}. This is useful for VMs such as HotSpot
-     * where convention the interpreter uses is that the second local
-     * holds the first raw word of the native long or double representation.
-     * This is actually reasonable, since locals and stack arrays
-     * grow downwards in all implementations.
-     * If, on some machine, the interpreter's Java locals or stack
+     * Specifies how {@code long} and {@code double} constants are to be stored in
+     * {@linkplain BytecodeFrame frames}. This is useful for VMs such as HotSpot where convention
+     * the interpreter uses is that the second local holds the first raw word of the native long or
+     * double representation. This is actually reasonable, since locals and stack arrays grow
+     * downwards in all implementations. If, on some machine, the interpreter's Java locals or stack
      * were to grow upwards, the embedded doubles would be word-swapped.)
      */
     public final boolean debugInfoDoubleWordsInSecondSlot;
 
-    public TargetDescription(Architecture arch,
-             boolean isMP,
-             int stackAlignment,
-             int pageSize,
-             int cacheAlignment,
-             boolean inlineObjects,
-             boolean debugInfoDoubleWordsInSecondSlot) {
+    public TargetDescription(Architecture arch, boolean isMP, int stackAlignment, int pageSize, int cacheAlignment, boolean inlineObjects, boolean debugInfoDoubleWordsInSecondSlot) {
         this.arch = arch;
         this.pageSize = pageSize;
         this.isMP = isMP;
@@ -116,31 +110,43 @@
 
     /**
      * Gets the size in bytes of the specified kind for this target.
-     *
+     * 
      * @param kind the kind for which to get the size
      * @return the size in bytes of {@code kind}
      */
     public int sizeInBytes(Kind kind) {
         // Checkstyle: stop
         switch (kind) {
-            case Boolean: return 1;
-            case Byte: return 1;
-            case Char: return 2;
-            case Short: return 2;
-            case Int: return 4;
-            case Long: return 8;
-            case Float: return 4;
-            case Double: return 8;
-            case Object: return wordSize;
-            case Jsr: return 4;
-            default: return 0;
+            case Boolean:
+                return 1;
+            case Byte:
+                return 1;
+            case Char:
+                return 2;
+            case Short:
+                return 2;
+            case Int:
+                return 4;
+            case Long:
+                return 8;
+            case Float:
+                return 4;
+            case Double:
+                return 8;
+            case Object:
+                return wordSize;
+            case Jsr:
+                return 4;
+            default:
+                return 0;
         }
         // Checkstyle: resume
     }
 
     /**
-     * Aligns the given frame size (without return instruction pointer) to the stack
-     * alignment size and return the aligned size (without return instruction pointer).
+     * Aligns the given frame size (without return instruction pointer) to the stack alignment size
+     * and return the aligned size (without return instruction pointer).
+     * 
      * @param frameSize the initial frame size to be aligned
      * @return the aligned frame size
      */
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java	Wed Jan 23 16:34:57 2013 +0100
@@ -31,8 +31,8 @@
 import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType;
 
 /**
- * Utility for deriving hint types for a type check instruction (e.g. checkcast or instanceof)
- * based on the target type of the check and any profiling information available for the instruction.
+ * Utility for deriving hint types for a type check instruction (e.g. checkcast or instanceof) based
+ * on the target type of the check and any profiling information available for the instruction.
  */
 public class TypeCheckHints {
 
@@ -40,7 +40,8 @@
 
     /**
      * If true, then {@link #types} contains the only possible type that could pass the type check
-     * because the target of the type check is a final class or has been speculated to be a final class.
+     * because the target of the type check is a final class or has been speculated to be a final
+     * class.
      */
     public final boolean exact;
 
@@ -51,22 +52,24 @@
 
     /**
      * Derives hint information for use when generating the code for a type check instruction.
-     *
+     * 
      * @param type the target type of the type check
      * @param profile the profiling information available for the instruction (if any)
-     * @param assumptions the object in which speculations are recorded. This is null if speculations are not supported.
-     * @param minHintHitProbability if the probability that the type check will hit one the profiled types (up to
-     *            {@code maxHints}) is below this value, then {@link #types} will be null
+     * @param assumptions the object in which speculations are recorded. This is null if
+     *            speculations are not supported.
+     * @param minHintHitProbability if the probability that the type check will hit one the profiled
+     *            types (up to {@code maxHints}) is below this value, then {@link #types} will be
+     *            null
      * @param maxHints the maximum length of {@link #types}
      */
     public TypeCheckHints(ResolvedJavaType type, JavaTypeProfile profile, Assumptions assumptions, double minHintHitProbability, int maxHints) {
         if (type != null && canHaveSubtype(type)) {
-            types = new ResolvedJavaType[] {type};
+            types = new ResolvedJavaType[]{type};
             exact = true;
         } else {
             ResolvedJavaType uniqueSubtype = type == null ? null : type.findUniqueConcreteSubtype();
             if (uniqueSubtype != null) {
-                types = new ResolvedJavaType[] {uniqueSubtype};
+                types = new ResolvedJavaType[]{uniqueSubtype};
                 if (assumptions.useOptimisticAssumptions()) {
                     assumptions.recordConcreteSubtype(type, uniqueSubtype);
                     exact = true;
@@ -107,9 +110,9 @@
     }
 
     /**
-     * Determines if a given type can have subtypes other than itself. This analysis is purely static; no
-     * assumptions are made.
-     *
+     * Determines if a given type can have subtypes other than itself. This analysis is purely
+     * static; no assumptions are made.
+     * 
      * @return true if {@code type} has no subtype(s)
      */
     public static boolean canHaveSubtype(ResolvedJavaType type) {
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/UnsignedMath.java
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/UnsignedMath.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/UnsignedMath.java	Wed Jan 23 16:34:57 2013 +0100
@@ -27,11 +27,11 @@
 //JaCoCo Exclude
 
 /**
- * Utilities for unsigned comparisons.
- * All methods have correct, but slow, standard Java implementations so that
- * they can be used with compilers not supporting the intrinsics.
+ * Utilities for unsigned comparisons. All methods have correct, but slow, standard Java
+ * implementations so that they can be used with compilers not supporting the intrinsics.
  */
 public class UnsignedMath {
+
     private static final long MASK = 0xffffffffL;
 
     /**
@@ -122,4 +122,3 @@
         return unsigned >= 0 ? BigInteger.valueOf(unsigned) : BigInteger.valueOf(unsigned & 0x7fffffffffffffffL).setBit(63);
     }
 }
-
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java	Wed Jan 23 16:34:57 2013 +0100
@@ -28,6 +28,7 @@
  * Utility class for working with the {@link Value} class and its subclasses.
  */
 public final class ValueUtil {
+
     public static boolean isIllegal(Value value) {
         assert value != null;
         return value == Value.ILLEGAL;
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java	Wed Jan 23 16:34:57 2013 +0100
@@ -28,9 +28,11 @@
 
 /**
  * An instance of this class represents an object whose allocation was removed by escape analysis.
- * The information stored in the {@link VirtualObject} is used during deoptimization to recreate the object.
+ * The information stored in the {@link VirtualObject} is used during deoptimization to recreate the
+ * object.
  */
 public final class VirtualObject extends Value {
+
     private static final long serialVersionUID = -2907197776426346021L;
 
     private final ResolvedJavaType type;
@@ -38,17 +40,18 @@
     private final int id;
 
     /**
-     * Creates a new {@link VirtualObject} for the given type, with the given fields.
-     * If {@code type} is an instance class then {@code values} provides the values for the fields
-     * returned by {@link ResolvedJavaType#getInstanceFields(boolean) getInstanceFields(true)}.
-     * If {@code type} is an array then the length of the values array determines
-     * the reallocated array length.
-     *
-     * @param type the type of the object whose allocation was removed during compilation. This can be either an
-     *            instance of an array type.
-     * @param values an array containing all the values to be stored into the object when it is recreated
-     * @param id a unique id that identifies the object within the debug information for one position in the compiled
-     *            code.
+     * Creates a new {@link VirtualObject} for the given type, with the given fields. If
+     * {@code type} is an instance class then {@code values} provides the values for the fields
+     * returned by {@link ResolvedJavaType#getInstanceFields(boolean) getInstanceFields(true)}. If
+     * {@code type} is an array then the length of the values array determines the reallocated array
+     * length.
+     * 
+     * @param type the type of the object whose allocation was removed during compilation. This can
+     *            be either an instance of an array type.
+     * @param values an array containing all the values to be stored into the object when it is
+     *            recreated
+     * @param id a unique id that identifies the object within the debug information for one
+     *            position in the compiled code.
      * @return a new {@link VirtualObject} instance.
      */
     public static VirtualObject get(ResolvedJavaType type, Value[] values, int id) {
@@ -90,7 +93,8 @@
     }
 
     /**
-     * Returns the type of the object whose allocation was removed during compilation. This can be either an instance of an array type.
+     * Returns the type of the object whose allocation was removed during compilation. This can be
+     * either an instance of an array type.
      */
     public ResolvedJavaType getType() {
         return type;
@@ -104,7 +108,8 @@
     }
 
     /**
-     * Returns the unique id that identifies the object within the debug information for one position in the compiled code.
+     * Returns the unique id that identifies the object within the debug information for one
+     * position in the compiled code.
      */
     public int getId() {
         return id;
@@ -133,8 +138,9 @@
 
     /**
      * Overwrites the current set of values with a new one.
-     *
-     * @param values an array containing all the values to be stored into the object when it is recreated.
+     * 
+     * @param values an array containing all the values to be stored into the object when it is
+     *            recreated.
      */
     public void setValues(Value[] values) {
         assert checkValues(type, values);
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/Interpreter.java
--- a/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/Interpreter.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/Interpreter.java	Wed Jan 23 16:34:57 2013 +0100
@@ -25,6 +25,8 @@
 import com.oracle.graal.api.meta.*;
 
 public interface Interpreter extends VirtualMachineComponent {
+
     boolean initialize(String args);
+
     Object execute(ResolvedJavaMethod method, Object... arguments) throws Throwable;
 }
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/RuntimeInterpreterInterface.java
--- a/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/RuntimeInterpreterInterface.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/RuntimeInterpreterInterface.java	Wed Jan 23 16:34:57 2013 +0100
@@ -25,10 +25,9 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * Please note: The parameters of the interface are currently in reversed order
- * since it was derived from the java ByteCodeInterpreter implementation. There
- * it was simpler to use the parameters in reversed order since they are popped from
- * the stack in reversed order.
+ * Please note: The parameters of the interface are currently in reversed order since it was derived
+ * from the java ByteCodeInterpreter implementation. There it was simpler to use the parameters in
+ * reversed order since they are popped from the stack in reversed order.
  */
 public interface RuntimeInterpreterInterface {
 
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/VirtualMachineComponent.java
--- a/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/VirtualMachineComponent.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/VirtualMachineComponent.java	Wed Jan 23 16:34:57 2013 +0100
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.api.interpreter;
 
+public interface VirtualMachineComponent {
 
-public interface VirtualMachineComponent {
     void setOption(String name, String value);
 }
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestMetaAccessProvider.java
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestMetaAccessProvider.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestMetaAccessProvider.java	Wed Jan 23 16:34:57 2013 +0100
@@ -66,7 +66,7 @@
     public static final Map, Class> arrayClasses = new HashMap<>();
 
     public static synchronized Class getArrayClass(Class componentType) {
-        Class< ? > arrayClass = arrayClasses.get(componentType);
+        Class arrayClass = arrayClasses.get(componentType);
         if (arrayClass == null) {
             arrayClass = Array.newInstance(componentType, 0).getClass();
             arrayClasses.put(componentType, arrayClass);
@@ -108,35 +108,9 @@
     }
 
     static {
-        Class[] initialClasses = {
-                        void.class,
-                        boolean.class,
-                        byte.class,
-                        short.class,
-                        char.class,
-                        int.class,
-                        float.class,
-                        long.class,
-                        double.class,
-                        Object.class,
-                        Class.class,
-                        ClassLoader.class,
-                        String.class,
-                        Serializable.class,
-                        Cloneable.class,
-                        Test.class,
-                        TestMetaAccessProvider.class,
-                        List.class,
-                        Collection.class,
-                        Map.class,
-                        Queue.class,
-                        HashMap.class,
-                        LinkedHashMap.class,
-                        IdentityHashMap.class,
-                        AbstractCollection.class,
-                        AbstractList.class,
-                        ArrayList.class
-        };
+        Class[] initialClasses = {void.class, boolean.class, byte.class, short.class, char.class, int.class, float.class, long.class, double.class, Object.class, Class.class, ClassLoader.class,
+                        String.class, Serializable.class, Cloneable.class, Test.class, TestMetaAccessProvider.class, List.class, Collection.class, Map.class, Queue.class, HashMap.class,
+                        LinkedHashMap.class, IdentityHashMap.class, AbstractCollection.class, AbstractList.class, ArrayList.class};
         for (Class c : initialClasses) {
             addClass(c);
         }
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaType.java
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaType.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaType.java	Wed Jan 23 16:34:57 2013 +0100
@@ -71,7 +71,6 @@
         }
     }
 
-
     @Test
     public void isInstanceClassTest() {
         for (Class c : classes) {
@@ -126,7 +125,7 @@
         for (Constant c : constants) {
             if (c.getKind() == Kind.Object && !c.isNull()) {
                 Object o = c.asObject();
-                Class< ? extends Object> cls = o.getClass();
+                Class cls = o.getClass();
                 while (cls != null) {
                     ResolvedJavaType type = runtime.lookupJavaType(cls);
                     boolean expected = cls.isInstance(o);
@@ -216,14 +215,14 @@
             Class c1 = c1Initial;
             Class c2 = c2Initial;
             while (true) {
-              if (c1.isAssignableFrom(c2)) {
-                  return c1;
-              }
-              if (c2.isAssignableFrom(c1)) {
-                  return c2;
-              }
-              c1 = getSupertype(c1);
-              c2 = getSupertype(c2);
+                if (c1.isAssignableFrom(c2)) {
+                    return c1;
+                }
+                if (c2.isAssignableFrom(c1)) {
+                    return c2;
+                }
+                c1 = getSupertype(c1);
+                c2 = getSupertype(c2);
             }
         }
     }
@@ -249,13 +248,26 @@
         }
     }
 
-    private static class Base {}
-    abstract static class Abstract1 extends Base {}
-    interface Interface1 {}
-    static class Concrete1 extends Abstract1 {}
-    static class Concrete2 extends Abstract1 implements Interface1 {}
-    static class Concrete3 extends Concrete2 {}
-    abstract static class Abstract4 extends Concrete3 {}
+    private static class Base {
+    }
+
+    abstract static class Abstract1 extends Base {
+    }
+
+    interface Interface1 {
+    }
+
+    static class Concrete1 extends Abstract1 {
+    }
+
+    static class Concrete2 extends Abstract1 implements Interface1 {
+    }
+
+    static class Concrete3 extends Concrete2 {
+    }
+
+    abstract static class Abstract4 extends Concrete3 {
+    }
 
     static void checkConcreteSubtype(ResolvedJavaType type, Class expected) {
         ResolvedJavaType subtype = type.findUniqueConcreteSubtype();
@@ -337,6 +349,7 @@
     }
 
     static class Declarations {
+
         final Method implementation;
         final Set declarations;
 
@@ -347,7 +360,8 @@
     }
 
     /**
-     * See Method overriding.
+     * See Method
+     * overriding.
      */
     static boolean isOverriderOf(Method impl, Method m) {
         if (!isPrivate(m.getModifiers()) && !isFinal(m.getModifiers())) {
@@ -371,6 +385,7 @@
     static final Map vtables = new HashMap<>();
 
     static class VTable {
+
         final Map methods = new HashMap<>();
     }
 
@@ -386,7 +401,7 @@
                 if (!isStatic(m.getModifiers()) && !isPrivate(m.getModifiers())) {
                     Method overridden = vtable.methods.put(new NameAndSignature(m), m);
                     if (overridden != null) {
-                        //System.out.println(m + " overrides " + overridden);
+                        // System.out.println(m + " overrides " + overridden);
                     }
                 }
             }
@@ -460,9 +475,8 @@
     }
 
     public static boolean fieldsEqual(Field f, ResolvedJavaField rjf) {
-        return rjf.getDeclaringClass().equals(runtime.lookupJavaType(f.getDeclaringClass())) &&
-               rjf.getName().equals(f.getName()) &&
-               rjf.getType().resolve(rjf.getDeclaringClass()).equals(runtime.lookupJavaType(f.getType()));
+        return rjf.getDeclaringClass().equals(runtime.lookupJavaType(f.getDeclaringClass())) && rjf.getName().equals(f.getName()) &&
+                        rjf.getType().resolve(rjf.getDeclaringClass()).equals(runtime.lookupJavaType(f.getType()));
     }
 
     public static ResolvedJavaField lookupField(ResolvedJavaField[] fields, Field key) {
@@ -499,7 +513,7 @@
     public void getInstanceFieldsTest() {
         for (Class c : classes) {
             ResolvedJavaType type = runtime.lookupJavaType(c);
-            for (boolean includeSuperclasses : new boolean[] {true, false}) {
+            for (boolean includeSuperclasses : new boolean[]{true, false}) {
                 Set expected = getInstanceFields(c, includeSuperclasses);
                 ResolvedJavaField[] actual = type.getInstanceFields(includeSuperclasses);
                 for (Field f : expected) {
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java	Wed Jan 23 16:34:57 2013 +0100
@@ -23,9 +23,10 @@
 package com.oracle.graal.api.meta;
 
 /**
- * Represents a constant (boxed) value, such as an integer, floating point number, or object reference, within the
- * compiler and across the compiler/runtime interface. Exports a set of {@code Constant} instances that represent
- * frequently used constant values, such as {@link #NULL_OBJECT}.
+ * Represents a constant (boxed) value, such as an integer, floating point number, or object
+ * reference, within the compiler and across the compiler/runtime interface. Exports a set of
+ * {@code Constant} instances that represent frequently used constant values, such as
+ * {@link #NULL_OBJECT}.
  */
 public final class Constant extends Value {
 
@@ -69,9 +70,10 @@
     private final Object object;
 
     /**
-     * The boxed primitive value as a {@code long}. This is ignored iff {@code kind.isObject()}. For {@code float} and
-     * {@code double} values, this value is the result of {@link Float#floatToRawIntBits(float)} and
-     * {@link Double#doubleToRawLongBits(double)} respectively.
+     * The boxed primitive value as a {@code long}. This is ignored iff {@code kind.isObject()}. For
+     * {@code float} and {@code double} values, this value is the result of
+     * {@link Float#floatToRawIntBits(float)} and {@link Double#doubleToRawLongBits(double)}
+     * respectively.
      */
     private final long primitive;
 
@@ -83,7 +85,7 @@
 
     /**
      * Checks whether this constant is non-null.
-     *
+     * 
      * @return {@code true} if this constant is a primitive, or an object constant that is not null
      */
     public boolean isNonNull() {
@@ -92,7 +94,7 @@
 
     /**
      * Checks whether this constant is null.
-     *
+     * 
      * @return {@code true} if this constant is the null constant
      */
     public boolean isNull() {
@@ -101,7 +103,7 @@
 
     /**
      * Checks whether this constant is the default value for its kind (null, 0, 0.0, false).
-     *
+     * 
      * @return {@code true} if this constant is the default value for its kind
      */
     public boolean isDefaultForKind() {
@@ -119,7 +121,7 @@
 
     /**
      * Returns the value of this constant as a boxed Java value.
-     *
+     * 
      * @return the value of this constant
      */
     public Object asBoxedValue() {
@@ -160,9 +162,9 @@
     }
 
     /**
-     * Returns the primitive int value this constant represents. The constant must have a {@link Kind#getStackKind()} of
-     * {@link Kind#Int}, or kind {@link Kind#Jsr}.
-     *
+     * Returns the primitive int value this constant represents. The constant must have a
+     * {@link Kind#getStackKind()} of {@link Kind#Int}, or kind {@link Kind#Jsr}.
+     * 
      * @return the constant value
      */
     public int asInt() {
@@ -171,8 +173,9 @@
     }
 
     /**
-     * Returns the primitive boolean value this constant represents. The constant must have kind {@link Kind#Boolean}.
-     *
+     * Returns the primitive boolean value this constant represents. The constant must have kind
+     * {@link Kind#Boolean}.
+     * 
      * @return the constant value
      */
     public boolean asBoolean() {
@@ -181,9 +184,10 @@
     }
 
     /**
-     * Returns the primitive long value this constant represents. The constant must have kind {@link Kind#Long}, a
-     * {@link Kind#getStackKind()} of {@link Kind#Int}, or kind {@link Kind#Jsr}.
-     *
+     * Returns the primitive long value this constant represents. The constant must have kind
+     * {@link Kind#Long}, a {@link Kind#getStackKind()} of {@link Kind#Int}, or kind
+     * {@link Kind#Jsr}.
+     * 
      * @return the constant value
      */
     public long asLong() {
@@ -192,8 +196,9 @@
     }
 
     /**
-     * Returns the primitive float value this constant represents. The constant must have kind {@link Kind#Float}.
-     *
+     * Returns the primitive float value this constant represents. The constant must have kind
+     * {@link Kind#Float}.
+     * 
      * @return the constant value
      */
     public float asFloat() {
@@ -202,8 +207,9 @@
     }
 
     /**
-     * Returns the primitive double value this constant represents. The constant must have kind {@link Kind#Double}.
-     *
+     * Returns the primitive double value this constant represents. The constant must have kind
+     * {@link Kind#Double}.
+     * 
      * @return the constant value
      */
     public double asDouble() {
@@ -212,8 +218,9 @@
     }
 
     /**
-     * Returns the object reference this constant represents. The constant must have kind {@link Kind#Object}.
-     *
+     * Returns the object reference this constant represents. The constant must have kind
+     * {@link Kind#Object}.
+     * 
      * @return the constant value
      */
     public Object asObject() {
@@ -223,7 +230,7 @@
 
     /**
      * Gets the annotation (if any) associated with this constant.
-     *
+     * 
      * @return null if this constant is not primitive or has no annotation
      */
     public Object getPrimitiveAnnotation() {
@@ -232,7 +239,7 @@
 
     /**
      * Computes the hashcode of this constant.
-     *
+     * 
      * @return a suitable hashcode for this constant
      */
     @Override
@@ -244,9 +251,10 @@
     }
 
     /**
-     * Checks whether this constant equals another object. This is only true if the other object is a constant that has
-     * the same {@linkplain #getKind() kind}, value and {@link #getPrimitiveAnnotation() annotation}.
-     *
+     * Checks whether this constant equals another object. This is only true if the other object is
+     * a constant that has the same {@linkplain #getKind() kind}, value and
+     * {@link #getPrimitiveAnnotation() annotation}.
+     * 
      * @param o the object to compare equality
      * @return {@code true} if this constant is equivalent to the specified object
      */
@@ -257,7 +265,7 @@
 
     /**
      * Creates a boxed double constant.
-     *
+     * 
      * @param d the double value to box
      * @return a boxed copy of {@code value}
      */
@@ -273,7 +281,7 @@
 
     /**
      * Creates a boxed float constant.
-     *
+     * 
      * @param f the float value to box
      * @return a boxed copy of {@code value}
      */
@@ -292,7 +300,7 @@
 
     /**
      * Creates a boxed long constant.
-     *
+     * 
      * @param i the long value to box
      * @return a boxed copy of {@code value}
      */
@@ -302,7 +310,7 @@
 
     /**
      * Creates a boxed integer constant.
-     *
+     * 
      * @param i the integer value to box
      * @return a boxed copy of {@code value}
      */
@@ -318,7 +326,7 @@
 
     /**
      * Creates a boxed byte constant.
-     *
+     * 
      * @param i the byte value to box
      * @return a boxed copy of {@code value}
      */
@@ -328,7 +336,7 @@
 
     /**
      * Creates a boxed boolean constant.
-     *
+     * 
      * @param i the boolean value to box
      * @return a boxed copy of {@code value}
      */
@@ -338,7 +346,7 @@
 
     /**
      * Creates a boxed char constant.
-     *
+     * 
      * @param i the char value to box
      * @return a boxed copy of {@code value}
      */
@@ -348,7 +356,7 @@
 
     /**
      * Creates a boxed short constant.
-     *
+     * 
      * @param i the short value to box
      * @return a boxed copy of {@code value}
      */
@@ -358,7 +366,7 @@
 
     /**
      * Creates a boxed address (jsr/ret address) constant.
-     *
+     * 
      * @param i the address value to box
      * @return a boxed copy of {@code value}
      */
@@ -368,7 +376,7 @@
 
     /**
      * Creates a boxed object constant.
-     *
+     * 
      * @param o the object value to box
      * @return a boxed copy of {@code value}
      */
@@ -380,10 +388,10 @@
     }
 
     /**
-     * Creates an annotated int or long constant. An annotation enables a client to associate some extra semantic or
-     * debugging information with a primitive. An annotated primitive constant is never {@linkplain #equals(Object)
-     * equal} to a non-annotated constant.
-     *
+     * Creates an annotated int or long constant. An annotation enables a client to associate some
+     * extra semantic or debugging information with a primitive. An annotated primitive constant is
+     * never {@linkplain #equals(Object) equal} to a non-annotated constant.
+     * 
      * @param kind the type of this constant
      * @param i the value of this constant
      * @param annotation an arbitrary non-null object
@@ -400,9 +408,9 @@
     }
 
     /**
-     * Creates a boxed constant for the given kind from an Object. The object needs to be of the Java boxed type
-     * corresponding to the kind.
-     *
+     * Creates a boxed constant for the given kind from an Object. The object needs to be of the
+     * Java boxed type corresponding to the kind.
+     * 
      * @param kind the kind of the constant to create
      * @param value the Java boxed value: a {@link Byte} instance for {@link Kind#Byte}, etc.
      * @return the boxed copy of {@code value}
@@ -436,7 +444,7 @@
      * Returns a constant with the default value for the given kind.
      */
     public static Constant defaultForKind(Kind kind) {
-        switch(kind) {
+        switch (kind) {
             case Boolean:
                 return FALSE;
             case Byte:
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ConstantPool.java
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ConstantPool.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ConstantPool.java	Wed Jan 23 16:34:57 2013 +0100
@@ -23,58 +23,63 @@
 package com.oracle.graal.api.meta;
 
 /**
- * Represents the runtime representation of the constant pool that is used by the compiler when parsing bytecode.
- * Provides methods to look up a constant pool entry without performing resolution. They are used during compilation.
+ * Represents the runtime representation of the constant pool that is used by the compiler when
+ * parsing bytecode. Provides methods to look up a constant pool entry without performing
+ * resolution. They are used during compilation.
  */
 public interface ConstantPool {
 
     /**
-     * Ensures that the type referenced by the specified constant pool entry is loaded and initialized. This can be
-     * used to compile time resolve a type. It works for field, method, or type constant pool entries.
-     *
+     * Ensures that the type referenced by the specified constant pool entry is loaded and
+     * initialized. This can be used to compile time resolve a type. It works for field, method, or
+     * type constant pool entries.
+     * 
      * @param cpi the index of the constant pool entry that references the type
      * @param opcode the opcode of the instruction that references the type
      */
     void loadReferencedType(int cpi, int opcode);
 
     /**
-     * Looks up a reference to a field. If {@code opcode} is non-negative, then resolution checks specific to the
-     * bytecode it denotes are performed if the field is already resolved. Should any of these checks fail, an
-     * unresolved field reference is returned.
-     *
+     * Looks up a reference to a field. If {@code opcode} is non-negative, then resolution checks
+     * specific to the bytecode it denotes are performed if the field is already resolved. Should
+     * any of these checks fail, an unresolved field reference is returned.
+     * 
      * @param cpi the constant pool index
-     * @param opcode the opcode of the instruction for which the lookup is being performed or {@code -1}
+     * @param opcode the opcode of the instruction for which the lookup is being performed or
+     *            {@code -1}
      * @return a reference to the field at {@code cpi} in this pool
      * @throws ClassFormatError if the entry at {@code cpi} is not a field
      */
     JavaField lookupField(int cpi, int opcode);
 
     /**
-     * Looks up a reference to a method. If {@code opcode} is non-negative, then resolution checks specific to the
-     * bytecode it denotes are performed if the method is already resolved. Should any of these checks fail, an
-     * unresolved method reference is returned.
-     *
+     * Looks up a reference to a method. If {@code opcode} is non-negative, then resolution checks
+     * specific to the bytecode it denotes are performed if the method is already resolved. Should
+     * any of these checks fail, an unresolved method reference is returned.
+     * 
      * @param cpi the constant pool index
-     * @param opcode the opcode of the instruction for which the lookup is being performed or {@code -1}
+     * @param opcode the opcode of the instruction for which the lookup is being performed or
+     *            {@code -1}
      * @return a reference to the method at {@code cpi} in this pool
      * @throws ClassFormatError if the entry at {@code cpi} is not a method
      */
     JavaMethod lookupMethod(int cpi, int opcode);
 
     /**
-     * Looks up a reference to a type. If {@code opcode} is non-negative, then resolution checks specific to the
-     * bytecode it denotes are performed if the type is already resolved. Should any of these checks fail, an unresolved
-     * type reference is returned.
-     *
+     * Looks up a reference to a type. If {@code opcode} is non-negative, then resolution checks
+     * specific to the bytecode it denotes are performed if the type is already resolved. Should any
+     * of these checks fail, an unresolved type reference is returned.
+     * 
      * @param cpi the constant pool index
-     * @param opcode the opcode of the instruction for which the lookup is being performed or {@code -1}
+     * @param opcode the opcode of the instruction for which the lookup is being performed or
+     *            {@code -1}
      * @return a reference to the compiler interface type
      */
     JavaType lookupType(int cpi, int opcode);
 
     /**
      * Looks up a method signature.
-     *
+     * 
      * @param cpi the constant pool index
      * @return the method signature at index {@code cpi} in this constant pool
      */
@@ -82,9 +87,10 @@
 
     /**
      * Looks up a constant at the specified index.
-     *
+     * 
      * @param cpi the constant pool index
-     * @return the {@code Constant} or {@code JavaType} instance representing the constant pool entry
+     * @return the {@code Constant} or {@code JavaType} instance representing the constant pool
+     *         entry
      */
     Object lookupConstant(int cpi);
 }
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java	Wed Jan 23 16:34:57 2013 +0100
@@ -23,7 +23,8 @@
 package com.oracle.graal.api.meta;
 
 /**
- * An implementation of {@link ProfilingInfo} that can used in the absence of real profile information.
+ * An implementation of {@link ProfilingInfo} that can used in the absence of real profile
+ * information.
  */
 public final class DefaultProfilingInfo implements ProfilingInfo {
 
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java	Wed Jan 23 16:34:57 2013 +0100
@@ -25,6 +25,7 @@
 /**
  * Enumeration of reasons for why a deoptimization is happening.
  */
+// @formatter:off
 public enum DeoptimizationReason {
     None,
     NullCheckException,
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java	Wed Jan 23 16:34:57 2013 +0100
@@ -72,7 +72,8 @@
     }
 
     /**
-     * Returns the index into the constant pool representing the type of exception caught by this handler.
+     * Returns the index into the constant pool representing the type of exception caught by this
+     * handler.
      */
     public int catchTypeCPI() {
         return catchTypeCPI;
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaField.java
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaField.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaField.java	Wed Jan 23 16:34:57 2013 +0100
@@ -23,8 +23,8 @@
 package com.oracle.graal.api.meta;
 
 /**
- * Represents a reference to a Java field, either resolved or unresolved fields. Fields, like methods and types, are
- * resolved through {@link ConstantPool constant pools}.
+ * Represents a reference to a Java field, either resolved or unresolved fields. Fields, like
+ * methods and types, are resolved through {@link ConstantPool constant pools}.
  */
 public interface JavaField {
 
@@ -39,12 +39,14 @@
     JavaType getType();
 
     /**
-     * Returns the kind of this field. This is the same as calling {@link #getType}.{@link JavaType#getKind getKind}.
+     * Returns the kind of this field. This is the same as calling {@link #getType}.
+     * {@link JavaType#getKind getKind}.
      */
     Kind getKind();
 
     /**
-     * Returns the {@link JavaType} object representing the class or interface that declares this field.
+     * Returns the {@link JavaType} object representing the class or interface that declares this
+     * field.
      */
     JavaType getDeclaringClass();
 }
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaMethod.java
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaMethod.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaMethod.java	Wed Jan 23 16:34:57 2013 +0100
@@ -23,8 +23,8 @@
 package com.oracle.graal.api.meta;
 
 /**
- * Represents a reference to a Java method, either resolved or unresolved. Methods, like fields and types, are resolved
- * through {@link ConstantPool constant pools}.
+ * Represents a reference to a Java method, either resolved or unresolved. Methods, like fields and
+ * types, are resolved through {@link ConstantPool constant pools}.
  */
 public interface JavaMethod {
 
@@ -34,7 +34,8 @@
     String getName();
 
     /**
-     * Returns the {@link JavaType} object representing the class or interface that declares this method.
+     * Returns the {@link JavaType} object representing the class or interface that declares this
+     * method.
      */
     JavaType getDeclaringClass();
 
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java	Wed Jan 23 16:34:57 2013 +0100
@@ -23,12 +23,14 @@
 package com.oracle.graal.api.meta;
 
 /**
- * Represents a resolved or unresolved type. Types include primitives, objects, {@code void}, and arrays thereof.
+ * Represents a resolved or unresolved type. Types include primitives, objects, {@code void}, and
+ * arrays thereof.
  */
 public interface JavaType {
 
     /**
-     * Returns the name of this type in internal form. The following are examples of strings returned by this method:
+     * Returns the name of this type in internal form. The following are examples of strings
+     * returned by this method:
      * 
      * 
      *     "Ljava/lang/Object;"
@@ -39,8 +41,8 @@
     String getName();
 
     /**
-     * For array types, gets the type of the components, or {@code null} if this is not an array type. This method is
-     * analogous to {@link Class#getComponentType()}.
+     * For array types, gets the type of the components, or {@code null} if this is not an array
+     * type. This method is analogous to {@link Class#getComponentType()}.
      */
     JavaType getComponentType();
 
@@ -55,8 +57,8 @@
     Kind getKind();
 
     /**
-     * Resolved this type and returns a {@link ResolvedJavaType}. If this type is already a {@link ResolvedJavaType}, it
-     * returns this type.
+     * Resolved this type and returns a {@link ResolvedJavaType}. If this type is already a
+     * {@link ResolvedJavaType}, it returns this type.
      * 
      * @param accessingClass the class that requests resolving this type
      * @return the resolved Java type
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java	Wed Jan 23 16:34:57 2013 +0100
@@ -25,17 +25,17 @@
 import java.io.*;
 
 /**
- * This profile object represents the type profile at a specific BCI. The precision of the supplied values may vary, but
- * a runtime that provides this information should be aware that it will be used to guide performance-critical decisions
- * like speculative inlining, etc.
+ * This profile object represents the type profile at a specific BCI. The precision of the supplied
+ * values may vary, but a runtime that provides this information should be aware that it will be
+ * used to guide performance-critical decisions like speculative inlining, etc.
  */
 public final class JavaTypeProfile implements Serializable {
 
     private static final long serialVersionUID = -6877016333706838441L;
 
     /**
-     * A profiled type that has a probability. Profiled types are naturally sorted in descending order of their
-     * probabilities.
+     * A profiled type that has a probability. Profiled types are naturally sorted in descending
+     * order of their probabilities.
      */
     public static final class ProfiledType implements Comparable, Serializable {
 
@@ -60,7 +60,7 @@
 
         /**
          * Returns the estimated probability of {@link #getType()}.
-         *
+         * 
          * @return double value >= 0.0 and <= 1.0
          */
         public double getProbability() {
@@ -82,7 +82,8 @@
     private final ProfiledType[] ptypes;
 
     /**
-     * Determines if an array of profiled types are sorted in descending order of their probabilities.
+     * Determines if an array of profiled types are sorted in descending order of their
+     * probabilities.
      */
     private static boolean isSorted(ProfiledType[] ptypes) {
         for (int i = 1; i < ptypes.length; i++) {
@@ -100,8 +101,9 @@
     }
 
     /**
-     * Returns the estimated probability of all types that could not be recorded due to profiling limitations.
-     *
+     * Returns the estimated probability of all types that could not be recorded due to profiling
+     * limitations.
+     * 
      * @return double value >= 0.0 and <= 1.0
      */
     public double getNotRecordedProbability() {
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java	Wed Jan 23 16:34:57 2013 +0100
@@ -25,9 +25,9 @@
 import java.lang.reflect.*;
 
 /**
- * Denotes the basic kinds of types in CRI, including the all the Java primitive types, for example, {@link Kind#Int}
- * for {@code int} and {@link Kind#Object} for all object types. A kind has a single character short name, a Java name,
- * and a set of flags further describing its behavior.
+ * Denotes the basic kinds of types in CRI, including the all the Java primitive types, for example,
+ * {@link Kind#Int} for {@code int} and {@link Kind#Object} for all object types. A kind has a
+ * single character short name, a Java name, and a set of flags further describing its behavior.
  */
 public enum Kind {
     /** The primitive boolean kind, represented as an int on the stack. */
@@ -98,9 +98,10 @@
 
     /**
      * Checks whether this type is a Java primitive type.
-     *
-     * @return {@code true} if this is {@link #Boolean}, {@link #Byte}, {@link #Char}, {@link #Short}, {@link #Int},
-     *         {@link #Long}, {@link #Float}, {@link #Double}, or {@link #Void}.
+     * 
+     * @return {@code true} if this is {@link #Boolean}, {@link #Byte}, {@link #Char},
+     *         {@link #Short}, {@link #Int}, {@link #Long}, {@link #Float}, {@link #Double}, or
+     *         {@link #Void}.
      */
     public boolean isPrimitive() {
         return primitiveJavaClass != null;
@@ -108,7 +109,7 @@
 
     /**
      * Returns the kind that represents this kind when on the Java operand stack.
-     *
+     * 
      * @return the kind used on the operand stack
      */
     public Kind getStackKind() {
@@ -120,7 +121,7 @@
 
     /**
      * Returns the kind corresponding to the Java type string.
-     *
+     * 
      * @param typeString the Java type string
      * @return the kind
      */
@@ -135,7 +136,7 @@
 
     /**
      * Returns the kind from the character describing a primitive or void.
-     *
+     * 
      * @param ch the character
      * @return the kind
      */
@@ -165,11 +166,11 @@
 
     /**
      * Returns the Kind representing the given Java class.
-     *
+     * 
      * @param klass the class
      * @return the kind
      */
-    public static Kind fromJavaClass(Class< ? > klass) {
+    public static Kind fromJavaClass(Class klass) {
         if (klass == Boolean.primitiveJavaClass) {
             return Boolean;
         } else if (klass == Byte.primitiveJavaClass) {
@@ -195,19 +196,19 @@
 
     /**
      * Returns the Java class representing this kind.
-     *
+     * 
      * @return the Java class
      */
-    public Class< ? > toJavaClass() {
+    public Class toJavaClass() {
         return primitiveJavaClass;
     }
 
     /**
      * Returns the Java class for instances of boxed values of this kind.
-     *
+     * 
      * @return the Java class
      */
-    public Class< ? > toBoxedJavaClass() {
+    public Class toBoxedJavaClass() {
         return boxedJavaClass;
     }
 
@@ -220,15 +221,15 @@
     }
 
     /**
-     * Marker interface for types that should be {@linkplain Kind#format(Object) formatted} with their
-     * {@link Object#toString()} value.
+     * Marker interface for types that should be {@linkplain Kind#format(Object) formatted} with
+     * their {@link Object#toString()} value.
      */
     public interface FormatWithToString {
     }
 
     /**
      * Gets a formatted string for a given value of this kind.
-     *
+     * 
      * @param value a value of this kind
      * @return a formatted string for {@code value} based on this kind
      */
@@ -248,8 +249,8 @@
                     return "JavaType:" + MetaUtil.toJavaName((JavaType) value);
                 } else if (value instanceof Enum || value instanceof FormatWithToString || value instanceof Number) {
                     return MetaUtil.getSimpleName(value.getClass(), true) + ":" + String.valueOf(value);
-                } else if (value instanceof Class< ? >) {
-                    return "Class:" + ((Class< ? >) value).getName();
+                } else if (value instanceof Class) {
+                    return "Class:" + ((Class) value).getName();
                 } else if (value.getClass().isArray()) {
                     return formatArray(value);
                 } else {
@@ -264,7 +265,7 @@
     private static final int MAX_FORMAT_ARRAY_LENGTH = 5;
 
     private static String formatArray(Object array) {
-        Class< ? > componentType = array.getClass().getComponentType();
+        Class componentType = array.getClass().getComponentType();
         assert componentType != null;
         int arrayLength = Array.getLength(array);
         StringBuilder buf = new StringBuilder(MetaUtil.getSimpleName(componentType, true)).append('[').append(arrayLength).append("]{");
@@ -289,7 +290,7 @@
 
     /**
      * The minimum value that can be represented as a value of this kind.
-     *
+     * 
      * @return the minimum value
      */
     public long getMinValue() {
@@ -314,7 +315,7 @@
 
     /**
      * The maximum value that can be represented as a value of this kind.
-     *
+     * 
      * @return the maximum value
      */
     public long getMaxValue() {
@@ -339,7 +340,7 @@
 
     /**
      * Number of bits that are necessary to represent a value of this kind.
-     *
+     * 
      * @return the number of bits
      */
     public int getBitCount() {
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LineNumberTable.java
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LineNumberTable.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LineNumberTable.java	Wed Jan 23 16:34:57 2013 +0100
@@ -22,9 +22,11 @@
  */
 package com.oracle.graal.api.meta;
 
+public interface LineNumberTable {
 
-public interface LineNumberTable {
     int[] getLineNumberEntries();
+
     int[] getBciEntries();
+
     int getLineNumber(int bci);
 }
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java	Wed Jan 23 16:34:57 2013 +0100
@@ -31,11 +31,11 @@
 
     /**
      * Returns the resolved Java type representing a given Java class.
-     *
+     * 
      * @param clazz the Java class object
      * @return the resolved Java type object
      */
-    ResolvedJavaType lookupJavaType(Class< ? > clazz);
+    ResolvedJavaType lookupJavaType(Class clazz);
 
     /**
      * Provides the {@link ResolvedJavaMethod} for a {@link Method} obtained via reflection.
@@ -54,32 +54,33 @@
 
     /**
      * Returns the resolved Java type of the given {@link Constant} object.
-     *
+     * 
      * @return {@code null} if {@code constant.isNull() || !constant.kind.isObject()}
      */
     ResolvedJavaType lookupJavaType(Constant constant);
 
     /**
-     * Parses a method
-     * descriptor into a {@link Signature}. The behavior of this method is undefined if
-     * the method descriptor is not well formed.
+     * Parses a method
+     * descriptor into a {@link Signature}. The behavior of this method is undefined if the
+     * method descriptor is not well formed.
      */
     Signature parseMethodDescriptor(String methodDescriptor);
 
     /**
-     * Compares two constants for equality.
-     * This is used instead of {@link Constant#equals(Object)} in case the runtime
-     * has an interpretation for object equality other than {@code x.asObject() == y.asObject()}.
-     * For primitive constants, this is equivalent to calling {@code x.equals(y)}.
-     * The equality relationship is symmetric.
-     *
-     * @return {@code true} if the two parameters represent the same runtime object, {@code false} otherwise
+     * Compares two constants for equality. This is used instead of {@link Constant#equals(Object)}
+     * in case the runtime has an interpretation for object equality other than
+     * {@code x.asObject() == y.asObject()}. For primitive constants, this is equivalent to calling
+     * {@code x.equals(y)}. The equality relationship is symmetric.
+     * 
+     * @return {@code true} if the two parameters represent the same runtime object, {@code false}
+     *         otherwise
      */
     boolean constantEquals(Constant x, Constant y);
 
     /**
      * Returns the length of an array that is wrapped in a {@link Constant} object.
-     *
+     * 
      * @throws IllegalArgumentException if {@code array} is not an array
      */
     int lookupArrayLength(Constant array);
diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java	Wed Jan 23 16:34:38 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java	Wed Jan 23 16:34:57 2013 +0100
@@ -32,7 +32,8 @@
 import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen;
 
 /**
- * Miscellaneous collection of utility methods used by {@code com.oracle.graal.api.meta} and its clients.
+ * Miscellaneous collection of utility methods used by {@code com.oracle.graal.api.meta} and its
+ * clients.
  */
 public class MetaUtil {
 
@@ -58,9 +59,10 @@
 
     /**
      * Gets the {@link Class} mirror for a given resolved type.
-     *
+     * 
      * @param type the type for which the Java mirror is requested
-     * @param loader class loader from which the class must be loaded (null means use the class loader of the {@link MetaUtil} class)
+     * @param loader class loader from which the class must be loaded (null means use the class
+     *            loader of the {@link MetaUtil} class)
      * @return the mirror for {@code type}
      * @throws NoClassDefFoundError if the mirror is not available
      */
@@ -89,9 +91,10 @@
 
     /**
      * Gets the {@link Class} mirror for a given resolved type.
-     *
+     * 
      * @param type the type for which the Java mirror is requested
-     * @param loader class loader from which the class must be loaded (null means use the class loader of the {@link MetaUtil} class)
+     * @param loader class loader from which the class must be loaded (null means use the class
+     *            loader of the {@link MetaUtil} class)
      * @return the mirror for {@code type} or null if it is not available
      */
     public static Class getMirror(ResolvedJavaType type, ClassLoader loader) {
@@ -103,10 +106,9 @@
     }
 
     /**
-     * Gets the elemental type for a given type.
-     * The elemental type of an array type is the corresponding zero dimensional (e.g.,
-     * the elemental type of {@code int[][][]} is {@code int}). A non-array type is its
-     * own elemental type.
+     * Gets the elemental type for a given type. The elemental type of an array type is the
+     * corresponding zero dimensional (e.g., the elemental type of {@code int[][][]} is {@code int}
+     * ). A non-array type is its own elemental type.
      */
     public static ResolvedJavaType getElementalType(ResolvedJavaType type) {
         ResolvedJavaType t = type;
@@ -117,21 +119,21 @@
     }
 
     /**
-     * Extends the functionality of {@link Class#getSimpleName()} to include a non-empty string for anonymous and local
-     * classes.
-     *
+     * Extends the functionality of {@link Class#getSimpleName()} to include a non-empty string for
+     * anonymous and local classes.
+     * 
      * @param clazz the class for which the simple name is being requested
-     * @param withEnclosingClass specifies if the returned name should be qualified with the name(s) of the enclosing
-     *            class/classes of {@code clazz} (if any). This option is ignored if {@code clazz} denotes an anonymous
-     *            or local class.
+     * @param withEnclosingClass specifies if the returned name should be qualified with the name(s)
+     *            of the enclosing class/classes of {@code clazz} (if any). This option is ignored
+     *            if {@code clazz} denotes an anonymous or local class.
      * @return the simple name
      */
-    public static String getSimpleName(Class< ? > clazz, boolean withEnclosingClass) {
+    public static String getSimpleName(Class clazz, boolean withEnclosingClass) {
         final String simpleName = clazz.getSimpleName();
         if (simpleName.length() != 0) {
             if (withEnclosingClass) {
                 String prefix = "";
-                Class< ? > enclosingClass = clazz;
+                Class enclosingClass = clazz;
                 while ((enclosingClass = enclosingClass.getEnclosingClass()) != null) {
                     prefix = prefix + enclosingClass.getSimpleName() + ".";
                 }
@@ -153,9 +155,9 @@
     }
 
     /**
-     * Converts a given type to its Java programming language name. The following are examples of strings returned by
-     * this method:
-     *
+     * Converts a given type to its Java programming language name. The following are examples of
+     * strings returned by this method:
+     * 
      * 
      *     qualified == true:
      *         java.lang.Object
@@ -166,9 +168,10 @@
      *         int
      *         boolean[][]
      * 
- * + * * @param type the type to be converted to a Java name - * @param qualified specifies if the package prefix of the type should be included in the returned name + * @param qualified specifies if the package prefix of the type should be included in the + * returned name * @return the Java name corresponding to {@code type} */ public static String toJavaName(JavaType type, boolean qualified) { @@ -180,15 +183,15 @@ } /** - * Converts a given type to its Java programming language name. The following are examples of strings returned by - * this method: - * + * Converts a given type to its Java programming language name. The following are examples of + * strings returned by this method: + * *
      *      java.lang.Object
      *      int
      *      boolean[][]
      * 
- * + * * @param type the type to be converted to a Java name * @return the Java name corresponding to {@code type} */ @@ -220,11 +223,12 @@ } /** - * Gets a string for a given method formatted according to a given format specification. A format specification is - * composed of characters that are to be copied verbatim to the result and specifiers that denote an attribute of - * the method that is to be copied to the result. A specifier is a single character preceded by a '%' character. The - * accepted specifiers and the method attributes they denote are described below: - * + * Gets a string for a given method formatted according to a given format specification. A + * format specification is composed of characters that are to be copied verbatim to the result + * and specifiers that denote an attribute of the method that is to be copied to the result. A + * specifier is a single character preceded by a '%' character. The accepted specifiers and the + * method attributes they denote are described below: + * *
      *     Specifier | Description                                          | Example(s)
      *     ----------+------------------------------------------------------------------------------------------
@@ -238,7 +242,7 @@
      *     'f'       | Indicator if method is unresolved, static or virtual | "unresolved" "static" "virtual"
      *     '%'       | A '%' character                                      | "%"
      * 
- * + * * @param format a format specification * @param method the method to be formatted * @return the result of formatting this method according to {@code format} @@ -313,11 +317,12 @@ } /** - * Gets a string for a given field formatted according to a given format specification. A format specification is - * composed of characters that are to be copied verbatim to the result and specifiers that denote an attribute of - * the field that is to be copied to the result. A specifier is a single character preceded by a '%' character. The - * accepted specifiers and the field attributes they denote are described below: - * + * Gets a string for a given field formatted according to a given format specification. A format + * specification is composed of characters that are to be copied verbatim to the result and + * specifiers that denote an attribute of the field that is to be copied to the result. A + * specifier is a single character preceded by a '%' character. The accepted specifiers and the + * field attributes they denote are described below: + * *
      *     Specifier | Description                                          | Example(s)
      *     ----------+------------------------------------------------------------------------------------------
@@ -329,7 +334,7 @@
      *     'f'       | Indicator if field is unresolved, static or instance | "unresolved" "static" "instance"
      *     '%'       | A '%' character                                      | "%"
      * 
- * + * * @param format a format specification * @param field the field to be formatted * @return the result of formatting this field according to {@code format} @@ -387,10 +392,11 @@ /** * Gets the annotations of a particular type for the formal parameters of a given method. - * + * * @param annotationClass the Class object corresponding to the annotation type * @param method the method for which a parameter annotations are being requested - * @return the annotation of type {@code annotationClass} (if any) for each formal parameter present + * @return the annotation of type {@code annotationClass} (if any) for each formal parameter + * present */ public static T[] getParameterAnnotations(Class annotationClass, ResolvedJavaMethod method) { Annotation[][] parameterAnnotations = method.getParameterAnnotations(); @@ -408,12 +414,14 @@ /** * Gets the annotation of a particular type for a formal parameter of a given method. - * + * * @param annotationClass the Class object corresponding to the annotation type * @param parameterIndex the index of a formal parameter of {@code method} * @param method the method for which a parameter annotation is being requested - * @return the annotation of type {@code annotationClass} for the formal parameter present, else null - * @throws IndexOutOfBoundsException if {@code parameterIndex} does not denote a formal parameter + * @return the annotation of type {@code annotationClass} for the formal parameter present, else + * null + * @throws IndexOutOfBoundsException if {@code parameterIndex} does not denote a formal + * parameter */ public static T getParameterAnnotation(Class annotationClass, int parameterIndex, ResolvedJavaMethod method) { if (parameterIndex >= 0) { @@ -428,8 +436,9 @@ } /** - * Convenient shortcut for calling {@link #appendLocation(StringBuilder, ResolvedJavaMethod, int)} without having to - * supply a a {@link StringBuilder} instance and convert the result to a string. + * Convenient shortcut for calling + * {@link #appendLocation(StringBuilder, ResolvedJavaMethod, int)} without having to supply a a + * {@link StringBuilder} instance and convert the result to a string. */ public static String toLocation(ResolvedJavaMethod method, int bci) { return appendLocation(new StringBuilder(), method, bci).toString(); @@ -437,22 +446,22 @@ /** * Appends a string representation of a location specified by a given method and bci to a given - * {@link StringBuilder}. If a stack trace element with a non-null file name and non-negative line number is - * {@linkplain ResolvedJavaMethod#asStackTraceElement(int) available} for the given method, then the string returned - * is the {@link StackTraceElement#toString()} value of the stack trace element, suffixed by the bci location. For - * example: - * + * {@link StringBuilder}. If a stack trace element with a non-null file name and non-negative + * line number is {@linkplain ResolvedJavaMethod#asStackTraceElement(int) available} for the + * given method, then the string returned is the {@link StackTraceElement#toString()} value of + * the stack trace element, suffixed by the bci location. For example: + * *
      *     java.lang.String.valueOf(String.java:2930) [bci: 12]
      * 
- * - * Otherwise, the string returned is the value of applying {@link #format(String, JavaMethod)} with the format - * string {@code "%H.%n(%p)"}, suffixed by the bci location. For example: - * + * + * Otherwise, the string returned is the value of applying {@link #format(String, JavaMethod)} + * with the format string {@code "%H.%n(%p)"}, suffixed by the bci location. For example: + * *
      *     java.lang.String.valueOf(int) [bci: 12]
      * 
- * + * * @param sb * @param method * @param bci @@ -495,7 +504,7 @@ /** * Formats some profiling information associated as a string. - * + * * @param info the profiling info to format * @param method an optional method that augments the profile string returned * @param sep the separator to use for each separate profile record @@ -562,7 +571,7 @@ /** * Converts a Java source-language class name into the internal form. - * + * * @param className the class name * @return the internal name form of the class name */ @@ -605,8 +614,8 @@ } /** - * Prepends the String {@code indentation} to every line in String {@code lines}, including a possibly non-empty - * line following the final newline. + * Prepends the String {@code indentation} to every line in String {@code lines}, including a + * possibly non-empty line following the final newline. */ public static String indent(String lines, String indentation) { if (lines.length() == 0) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ProfilingInfo.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ProfilingInfo.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ProfilingInfo.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,9 +23,10 @@ package com.oracle.graal.api.meta; /** - * Provides access to the profiling information of one specific method. Every accessor method returns the information - * that is available at the time of invocation. If a method is invoked multiple times, it may return significantly - * different results for every invocation as the profiling information may be changed by other Java threads at any time. + * Provides access to the profiling information of one specific method. Every accessor method + * returns the information that is available at the time of invocation. If a method is invoked + * multiple times, it may return significantly different results for every invocation as the + * profiling information may be changed by other Java threads at any time. */ public interface ProfilingInfo { @@ -47,50 +48,50 @@ /** * Returns an estimate of how often the branch at the given byte code was taken. - * - * @return The estimated probability, with 0.0 meaning never and 1.0 meaning always, or -1 if this information is - * not available. + * + * @return The estimated probability, with 0.0 meaning never and 1.0 meaning always, or -1 if + * this information is not available. */ double getBranchTakenProbability(int bci); /** - * Returns an estimate of how often the switch cases are taken at the given BCI. The default case is stored as the - * last entry. - * - * @return A double value that contains the estimated probabilities, with 0.0 meaning never and 1.0 meaning always, - * or -1 if this information is not available. + * Returns an estimate of how often the switch cases are taken at the given BCI. The default + * case is stored as the last entry. + * + * @return A double value that contains the estimated probabilities, with 0.0 meaning never and + * 1.0 meaning always, or -1 if this information is not available. */ double[] getSwitchProbabilities(int bci); /** * Returns the TypeProfile for the given BCI. - * + * * @return Returns an JavaTypeProfile object, or null if not available. */ JavaTypeProfile getTypeProfile(int bci); /** * Returns information if the given BCI did ever throw an exception. - * + * * @return {@link ExceptionSeen#TRUE} if the instruction has thrown an exception at least once, - * {@link ExceptionSeen#FALSE} if it never threw an exception, and {@link ExceptionSeen#NOT_SUPPORTED} if - * this information was not recorded. + * {@link ExceptionSeen#FALSE} if it never threw an exception, and + * {@link ExceptionSeen#NOT_SUPPORTED} if this information was not recorded. */ ExceptionSeen getExceptionSeen(int bci); /** - * Returns an estimate how often the current BCI was executed. Avoid comparing execution counts to each other, as - * the returned value highly depends on the time of invocation. - * + * Returns an estimate how often the current BCI was executed. Avoid comparing execution counts + * to each other, as the returned value highly depends on the time of invocation. + * * @return the estimated execution count or -1 if not available. */ int getExecutionCount(int bci); /** - * Returns how frequently a method was deoptimized for the given deoptimization reason. This only indicates how - * often the method did fall back to the interpreter for the execution and does not indicate how often it was - * recompiled. - * + * Returns how frequently a method was deoptimized for the given deoptimization reason. This + * only indicates how often the method did fall back to the interpreter for the execution and + * does not indicate how often it was recompiled. + * * @param reason the reason for which the number of deoptimizations should be queried * @return the number of times the compiled method deoptimized for the given reason. */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaField.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaField.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaField.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,52 +26,57 @@ import java.lang.reflect.*; /** - * Represents a reference to a resolved Java field. Fields, like methods and types, are resolved through - * {@link ConstantPool constant pools}. + * Represents a reference to a resolved Java field. Fields, like methods and types, are resolved + * through {@link ConstantPool constant pools}. */ public interface ResolvedJavaField extends JavaField { /** - * Returns the Java language modifiers for this field, as an integer. The {@link Modifier} class should be used to - * decode the modifiers. Only the {@linkplain Modifier#fieldModifiers() field flags} specified in the JVM - * specification will be included in the returned mask. + * Returns the Java language modifiers for this field, as an integer. The {@link Modifier} class + * should be used to decode the modifiers. Only the {@linkplain Modifier#fieldModifiers() field + * flags} specified in the JVM specification will be included in the returned mask. */ int getModifiers(); /** - * Determines if this field was injected by the VM. Such a field, for example, is not derived from a class file. + * Determines if this field was injected by the VM. Such a field, for example, is not derived + * from a class file. */ boolean isInternal(); /** * Gets the constant value of this field for a given object, if available. - * - * @param receiver object from which this field's value is to be read. This value is ignored if this field is - * static. - * @return the constant value of this field or {@code null} if the constant value is not available + * + * @param receiver object from which this field's value is to be read. This value is ignored if + * this field is static. + * @return the constant value of this field or {@code null} if the constant value is not + * available */ Constant readConstantValue(Constant receiver); /** * Gets the current value of this field for a given object, if available. - * - * @param receiver object from which this field's value is to be read. This value is ignored if this field is - * static. - * @return the value of this field or {@code null} if the value is not available (e.g., because the field holder is - * not yet initialized). + * + * @param receiver object from which this field's value is to be read. This value is ignored if + * this field is static. + * @return the value of this field or {@code null} if the value is not available (e.g., because + * the field holder is not yet initialized). */ Constant readValue(Constant receiver); /** - * Returns the {@link ResolvedJavaType} object representing the class or interface that declares this field. + * Returns the {@link ResolvedJavaType} object representing the class or interface that declares + * this field. */ ResolvedJavaType getDeclaringClass(); /** - * Returns the annotation for the specified type of this field, if such an annotation is present. - * + * Returns the annotation for the specified type of this field, if such an annotation is + * present. + * * @param annotationClass the Class object corresponding to the annotation type - * @return this element's annotation for the specified annotation type if present on this field, else {@code null} + * @return this element's annotation for the specified annotation type if present on this field, + * else {@code null} */ T getAnnotation(Class annotationClass); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,43 +28,44 @@ import java.util.*; /** - * Represents a resolved Java method. Methods, like fields and types, are resolved through {@link ConstantPool constant - * pools}. + * Represents a resolved Java method. Methods, like fields and types, are resolved through + * {@link ConstantPool constant pools}. */ public interface ResolvedJavaMethod extends JavaMethod { /** - * Returns the bytecodes of this method, if the method has code. The returned byte array does not contain - * breakpoints or non-Java bytecodes. - * + * Returns the bytecodes of this method, if the method has code. The returned byte array does + * not contain breakpoints or non-Java bytecodes. + * * @return the bytecodes of the method, or {@code null} if none is available */ byte[] getCode(); /** - * Returns the size of the bytecodes of this method, if the method has code. This is equivalent to - * {@link #getCode()}. {@code length} if the method has code. - * + * Returns the size of the bytecodes of this method, if the method has code. This is equivalent + * to {@link #getCode()}. {@code length} if the method has code. + * * @return the size of the bytecodes in bytes, or 0 if no bytecodes is available */ int getCodeSize(); /** * Returns the size of the compiled machine code of this method. - * + * * @return the size of the compiled machine code in bytes, or 0 if no compiled code exists. */ int getCompiledCodeSize(); /** * Returns an estimate how complex it is to compile this method. - * + * * @return A value >= 0, where higher means more complex. */ int getCompilationComplexity(); /** - * Returns the {@link ResolvedJavaType} object representing the class or interface that declares this method. + * Returns the {@link ResolvedJavaType} object representing the class or interface that declares + * this method. */ ResolvedJavaType getDeclaringClass(); @@ -79,30 +80,31 @@ int getMaxStackSize(); /** - * Returns the Java language modifiers for this method, as an integer. The {@link Modifier} class should be used to - * decode the modifiers. Only the {@linkplain Modifier#methodModifiers() method flags} specified in the JVM - * specification will be included in the returned mask. + * Returns the Java language modifiers for this method, as an integer. The {@link Modifier} + * class should be used to decode the modifiers. Only the + * {@linkplain Modifier#methodModifiers() method flags} specified in the JVM specification will + * be included in the returned mask. */ int getModifiers(); /** * Checks whether this method is a class initializer. - * + * * @return {@code true} if the method is a class initializer */ boolean isClassInitializer(); /** * Checks whether this method is a constructor. - * + * * @return {@code true} if the method is a constructor */ boolean isConstructor(); /** - * Checks whether this method can be statically bound (usually, that means it is final or private or static, but not - * abstract). - * + * Checks whether this method can be statically bound (usually, that means it is final or + * private or static, but not abstract). + * * @return {@code true} if this method can be statically bound */ boolean canBeStaticallyBound(); @@ -123,7 +125,8 @@ ProfilingInfo getProfilingInfo(); /** - * Returns a map that the compiler can use to store objects that should survive the current compilation. + * Returns a map that the compiler can use to store objects that should survive the current + * compilation. */ Map getCompilerStorage(); @@ -133,25 +136,27 @@ ConstantPool getConstantPool(); /** - * Returns the annotation for the specified type of this method, if such an annotation is present. - * + * Returns the annotation for the specified type of this method, if such an annotation is + * present. + * * @param annotationClass the Class object corresponding to the annotation type - * @return this element's annotation for the specified annotation type if present on this method, else {@code null} + * @return this element's annotation for the specified annotation type if present on this + * method, else {@code null} */ T getAnnotation(Class annotationClass); /** - * Returns an array of arrays that represent the annotations on the formal parameters, in declaration order, of this - * method. - * + * Returns an array of arrays that represent the annotations on the formal parameters, in + * declaration order, of this method. + * * @see Method#getParameterAnnotations() */ Annotation[][] getParameterAnnotations(); /** - * Returns an array of {@link Type} objects that represent the formal parameter types, in declaration order, of this - * method. - * + * Returns an array of {@link Type} objects that represent the formal parameter types, in + * declaration order, of this method. + * * @see Method#getGenericParameterTypes() */ Type[] getGenericParameterTypes(); @@ -161,7 +166,6 @@ */ boolean canBeInlined(); - /** * Returns the LineNumberTable of this method. */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,15 +26,16 @@ import java.lang.reflect.*; /** - * Represents a resolved Java types. Types include primitives, objects, {@code void}, and arrays thereof. Types, like - * fields and methods, are resolved through {@link ConstantPool constant pools}. + * Represents a resolved Java types. Types include primitives, objects, {@code void}, and arrays + * thereof. Types, like fields and methods, are resolved through {@link ConstantPool constant pools} + * . */ public interface ResolvedJavaType extends JavaType { /** - * Represents each of the several different parts of the runtime representation of a type which compiled code may - * need to reference individually. These may or may not be different objects or data structures, depending on the - * runtime system. + * Represents each of the several different parts of the runtime representation of a type which + * compiled code may need to reference individually. These may or may not be different objects + * or data structures, depending on the runtime system. */ public enum Representation { /** @@ -43,15 +44,16 @@ JavaClass, /** - * The runtime representation of the "hub" of this type--that is, the closest part of the type representation - * which is typically stored in the object header. + * The runtime representation of the "hub" of this type--that is, the closest part of the + * type representation which is typically stored in the object header. */ ObjectHub } /** - * Gets the encoding of (that is, a constant representing the value of) the specified part of this type. - * + * Gets the encoding of (that is, a constant representing the value of) the specified part of + * this type. + * * @param r the part of this type * @return a constant representing a reference to the specified part of this type */ @@ -59,57 +61,58 @@ /** * Checks whether this type has a finalizer method. - * + * * @return {@code true} if this class has a finalizer */ boolean hasFinalizer(); /** - * Checks whether this type has any finalizable subclasses so far. Any decisions based on this information require - * the registration of a dependency, since this information may change. - * + * Checks whether this type has any finalizable subclasses so far. Any decisions based on this + * information require the registration of a dependency, since this information may change. + * * @return {@code true} if this class has any subclasses with finalizers */ boolean hasFinalizableSubclass(); /** * Checks whether this type is an interface. - * + * * @return {@code true} if this type is an interface */ boolean isInterface(); /** * Checks whether this type is an instance class. - * + * * @return {@code true} if this type is an instance class */ boolean isInstanceClass(); /** * Checks whether this type is an array class. - * + * * @return {@code true} if this type is an array class */ boolean isArray(); /** * Checks whether this type is primitive. - * + * * @return {@code true} if this type is primitive */ boolean isPrimitive(); /** - * Returns the Java language modifiers for this type, as an integer. The {@link Modifier} class should be used to - * decode the modifiers. Only the flags specified in the JVM specification will be included in the returned mask. - * This method is identical to {@link Class#getModifiers()} in terms of the value return for this type. + * Returns the Java language modifiers for this type, as an integer. The {@link Modifier} class + * should be used to decode the modifiers. Only the flags specified in the JVM specification + * will be included in the returned mask. This method is identical to + * {@link Class#getModifiers()} in terms of the value return for this type. */ int getModifiers(); /** * Checks whether this type is initialized. - * + * * @return {@code true} if this type is initialized */ boolean isInitialized(); @@ -120,68 +123,68 @@ void initialize(); /** - * Determines if this type is either the same as, or is a superclass or superinterface of, the type represented by - * the specified parameter. This method is identical to {@link Class#isAssignableFrom(Class)} in terms of the value - * return for this type. + * Determines if this type is either the same as, or is a superclass or superinterface of, the + * type represented by the specified parameter. This method is identical to + * {@link Class#isAssignableFrom(Class)} in terms of the value return for this type. */ boolean isAssignableFrom(ResolvedJavaType other); /** * Checks whether the specified object is an instance of this type. - * + * * @param obj the object to test * @return {@code true} if the object is an instance of this type */ boolean isInstance(Constant obj); /** - * Returns this type if it is an exact type otherwise returns null. - * This type is exact if it is void, primitive, final, or an array of a final or primitive type. - * + * Returns this type if it is an exact type otherwise returns null. This type is exact if it is + * void, primitive, final, or an array of a final or primitive type. + * * @return this type if it is exact; {@code null} otherwise */ ResolvedJavaType asExactType(); /** - * Gets the super class of this type. - * If this type represents either the {@code Object} class, a primitive type, or void, then - * null is returned. If this object represents an array class or an interface then the - * type object representing the {@code Object} class is returned. + * Gets the super class of this type. If this type represents either the {@code Object} class, a + * primitive type, or void, then null is returned. If this object represents an array class or + * an interface then the type object representing the {@code Object} class is returned. */ ResolvedJavaType getSuperclass(); /** - * Gets the interfaces implemented or extended by this type. This method is analogous to {@link Class#getInterfaces()} - * and as such, only returns the interfaces directly implemented or extended by this type. + * Gets the interfaces implemented or extended by this type. This method is analogous to + * {@link Class#getInterfaces()} and as such, only returns the interfaces directly implemented + * or extended by this type. */ ResolvedJavaType[] getInterfaces(); /** - * Walks the class hierarchy upwards and returns the least common class that is a superclass of both the current and - * the given type. - * - * @return the least common type that is a super type of both the current and the given type, or {@code null} if - * primitive types are involved. + * Walks the class hierarchy upwards and returns the least common class that is a superclass of + * both the current and the given type. + * + * @return the least common type that is a super type of both the current and the given type, or + * {@code null} if primitive types are involved. */ ResolvedJavaType findLeastCommonAncestor(ResolvedJavaType otherType); /** * Attempts to get a unique concrete subclass of this type. *

- * For an {@linkplain #isArray() array} type A, the unique concrete subclass is A if - * the {@linkplain MetaUtil#getElementalType(ResolvedJavaType) elemental} type of A - * is final (which includes primitive types). Otherwise {@code null} is returned for A. + * For an {@linkplain #isArray() array} type A, the unique concrete subclass is A if the + * {@linkplain MetaUtil#getElementalType(ResolvedJavaType) elemental} type of A is final (which + * includes primitive types). Otherwise {@code null} is returned for A. *

* For a non-array type T, the result is the unique concrete type in the current hierarchy of T. *

- * A runtime may decide not to manage or walk a large hierarchy and so the result is conservative. - * That is, a non-null result is guaranteed to be the unique concrete class in T's hierarchy - * at the current point in time - * but a null result does not necessarily imply that there is no unique concrete class in T's hierarchy. + * A runtime may decide not to manage or walk a large hierarchy and so the result is + * conservative. That is, a non-null result is guaranteed to be the unique concrete class in T's + * hierarchy at the current point in time but a null result does not necessarily imply + * that there is no unique concrete class in T's hierarchy. *

- * If the compiler uses the result of this method for its compilation, it must register an assumption because - * dynamic class loading can invalidate the result of this method. - * + * If the compiler uses the result of this method for its compilation, it must register an + * assumption because dynamic class loading can invalidate the result of this method. + * * @return the unique concrete subclass for this type as described above */ ResolvedJavaType findUniqueConcreteSubtype(); @@ -192,51 +195,55 @@ /** * Resolves the method implementation for virtual dispatches on objects of this dynamic type. - * + * * @param method the method to select the implementation of * @return the method implementation that would be selected at runtime */ ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method); /** - * Given a {@link ResolvedJavaMethod} A, returns a concrete {@link ResolvedJavaMethod} B that is the only possible - * unique target for a virtual call on A(). Returns {@code null} if either no such concrete method or more than one - * such method exists. Returns the method A if A is a concrete method that is not overridden. + * Given a {@link ResolvedJavaMethod} A, returns a concrete {@link ResolvedJavaMethod} B that is + * the only possible unique target for a virtual call on A(). Returns {@code null} if either no + * such concrete method or more than one such method exists. Returns the method A if A is a + * concrete method that is not overridden. *

- * If the compiler uses the result of this method for its compilation, it must register an assumption because - * dynamic class loading can invalidate the result of this method. - * + * If the compiler uses the result of this method for its compilation, it must register an + * assumption because dynamic class loading can invalidate the result of this method. + * * @param method the method A for which a unique concrete target is searched - * @return the unique concrete target or {@code null} if no such target exists or assumptions are not supported by - * this runtime + * @return the unique concrete target or {@code null} if no such target exists or assumptions + * are not supported by this runtime */ ResolvedJavaMethod findUniqueConcreteMethod(ResolvedJavaMethod method); /** - * Returns the instance fields of this class, including {@linkplain ResolvedJavaField#isInternal() internal} fields. - * A zero-length array is returned for array and primitive types. The order of fields returned by this method is - * stable. That is, for a single JVM execution the same order is returned each time this method is called. It is - * also the "natural" order, which means that the JVM would expect the fields in this order if no specific order is - * given. - * - * @param includeSuperclasses if true, then instance fields for the complete hierarchy of this type are included in - * the result + * Returns the instance fields of this class, including + * {@linkplain ResolvedJavaField#isInternal() internal} fields. A zero-length array is returned + * for array and primitive types. The order of fields returned by this method is stable. That + * is, for a single JVM execution the same order is returned each time this method is called. It + * is also the "natural" order, which means that the JVM would expect the fields in this order + * if no specific order is given. + * + * @param includeSuperclasses if true, then instance fields for the complete hierarchy of this + * type are included in the result * @return an array of instance fields */ ResolvedJavaField[] getInstanceFields(boolean includeSuperclasses); /** - * Returns the annotation for the specified type of this class, if such an annotation is present. - * + * Returns the annotation for the specified type of this class, if such an annotation is + * present. + * * @param annotationClass the Class object corresponding to the annotation type - * @return this element's annotation for the specified annotation type if present on this class, else {@code null} + * @return this element's annotation for the specified annotation type if present on this class, + * else {@code null} */ T getAnnotation(Class annotationClass); /** - * Returns the instance field of this class (or one of its super classes) at the given - * offset, or {@code null} if there is no such field. - * + * Returns the instance field of this class (or one of its super classes) at the given offset, + * or {@code null} if there is no such field. + * * @param offset the offset of the field to look for * @return the field with the given offset, or {@code null} if there is no such field. */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,47 +24,50 @@ /** * Represents a method signature provided by the runtime. - * - * @see Method Descriptors + * + * @see Method + * Descriptors */ public interface Signature { /** * Returns the number of parameters in this signature, adding 1 for a receiver if requested. - * + * * @param receiver true if 1 is to be added to the result for a receiver * @return the number of parameters; + 1 iff {@code receiver == true} */ int getParameterCount(boolean receiver); /** - * Gets the parameter type at the specified position. This method returns a {@linkplain ResolvedJavaType resolved} - * type if possible but without triggering any class loading or resolution. - * + * Gets the parameter type at the specified position. This method returns a + * {@linkplain ResolvedJavaType resolved} type if possible but without triggering any class + * loading or resolution. + * * @param index the index into the parameters, with {@code 0} indicating the first parameter - * @param accessingClass the context of the type lookup. If accessing class is provided, its class loader is used to - * retrieve an existing resolved type. This value can be {@code null} if the caller does not care for a - * resolved type. + * @param accessingClass the context of the type lookup. If accessing class is provided, its + * class loader is used to retrieve an existing resolved type. This value can be + * {@code null} if the caller does not care for a resolved type. * @return the {@code index}'th parameter type */ JavaType getParameterType(int index, ResolvedJavaType accessingClass); /** - * Gets the parameter kind at the specified position. This is the same as calling {@link #getParameterType}. - * {@link JavaType#getKind getKind}. - * + * Gets the parameter kind at the specified position. This is the same as calling + * {@link #getParameterType}. {@link JavaType#getKind getKind}. + * * @param index the index into the parameters, with {@code 0} indicating the first parameter * @return the kind of the parameter at the specified position */ Kind getParameterKind(int index); /** - * Gets the return type of this signature. This method will return a {@linkplain ResolvedJavaType resolved} type if - * possible but without triggering any class loading or resolution. - * - * @param accessingClass the context of the type lookup. If accessing class is provided, its class loader is used to - * retrieve an existing resolved type. This value can be {@code null} if the caller does not care for a - * resolved type. + * Gets the return type of this signature. This method will return a + * {@linkplain ResolvedJavaType resolved} type if possible but without triggering any class + * loading or resolution. + * + * @param accessingClass the context of the type lookup. If accessing class is provided, its + * class loader is used to retrieve an existing resolved type. This value can be + * {@code null} if the caller does not care for a resolved type. * @return the return type */ JavaType getReturnType(ResolvedJavaType accessingClass); @@ -77,20 +80,24 @@ /** * Gets the size, in Java slots, of the parameters to this signature. - * - * @param withReceiver {@code true} if to add a slot for a receiver object; {@code false} not to include the - * receiver + * + * @param withReceiver {@code true} if to add a slot for a receiver object; {@code false} not to + * include the receiver * @return the size of the parameters in slots */ int getParameterSlots(boolean withReceiver); /** - * Gets the method - * descriptor corresponding to this signature. - * For example: - * - *

(ILjava/lang/String;D)V
. - * + * Gets the method + * descriptor corresponding to this signature. For example: + * + *
+     * (ILjava/lang/String;D)V
+     * 
+ * + * . + * * @return the signature as a string */ String getMethodDescriptor(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,8 +25,8 @@ import java.io.*; /** - * Abstract base class for values manipulated by the compiler. All values have a {@linkplain Kind kind} and are - * immutable. + * Abstract base class for values manipulated by the compiler. All values have a {@linkplain Kind + * kind} and are immutable. */ public abstract class Value implements Serializable { @@ -34,8 +34,7 @@ public static final Value[] NONE = {}; - @SuppressWarnings("serial") - public static final Value ILLEGAL = new Value(Kind.Illegal) { + @SuppressWarnings("serial") public static final Value ILLEGAL = new Value(Kind.Illegal) { @Override public String toString() { @@ -55,8 +54,8 @@ } /** - * Returns a String representation of the kind, which should be the end of all {@link #toString()} implementation of - * subclasses. + * Returns a String representation of the kind, which should be the end of all + * {@link #toString()} implementation of subclasses. */ protected final String getKindSuffix() { return "|" + getKind().getTypeChar(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java --- a/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java Wed Jan 23 16:34:57 2013 +0100 @@ -37,10 +37,12 @@ runtime = initializeRuntime(); } catch (UnsatisfiedLinkError e) { runtime = new GraalRuntime() { + @Override public String getName() { return ""; } + @Override public T getCapability(Class clazz) { return null; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/GraalRuntime.java --- a/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/GraalRuntime.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/GraalRuntime.java Wed Jan 23 16:34:57 2013 +0100 @@ -22,8 +22,9 @@ */ package com.oracle.graal.api.runtime; +public interface GraalRuntime { -public interface GraalRuntime { String getName(); + T getCapability(Class clazz); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.api.test/src/com/oracle/graal/api/test/GraalTest.java --- a/graal/com.oracle.graal.api.test/src/com/oracle/graal/api/test/GraalTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.api.test/src/com/oracle/graal/api/test/GraalTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,7 +28,6 @@ import com.oracle.graal.api.runtime.*; - public class GraalTest { @Test diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64AsmOptions.java --- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64AsmOptions.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64AsmOptions.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,10 +23,11 @@ package com.oracle.graal.asm.amd64; public class AMD64AsmOptions { - public static int Atomics = 0; - public static boolean UseNormalNop = false; - public static boolean UseAddressNop = true; - public static boolean UseIncDec = false; - public static boolean UseXmmLoadAndClearUpper = true; - public static boolean UseXmmRegToRegMoveAll = false; + + public static int Atomics = 0; + public static boolean UseNormalNop = false; + public static boolean UseAddressNop = true; + public static boolean UseIncDec = false; + public static boolean UseXmmLoadAndClearUpper = true; + public static boolean UseXmmRegToRegMoveAll = false; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Assembler.java --- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Assembler.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Assembler.java Wed Jan 23 16:34:57 2013 +0100 @@ -37,8 +37,10 @@ * This class implements an assembler that can encode most X86 instructions. */ public class AMD64Assembler extends AbstractAssembler { + /** - * The kind for pointers and raw registers. Since we know we are 64 bit here, we can hardcode it. + * The kind for pointers and raw registers. Since we know we are 64 bit here, we can hardcode + * it. */ private static final Kind Word = Kind.Long; @@ -48,26 +50,9 @@ * The x86 condition codes used for conditional jumps/moves. */ public enum ConditionFlag { - zero(0x4, "|zero|"), - notZero(0x5, "|nzero|"), - equal(0x4, "="), - notEqual(0x5, "!="), - less(0xc, "<"), - lessEqual(0xe, "<="), - greater(0xf, ">"), - greaterEqual(0xd, ">="), - below(0x2, "|<|"), - belowEqual(0x6, "|<=|"), - above(0x7, "|>|"), - aboveEqual(0x3, "|>=|"), - overflow(0x0, "|of|"), - noOverflow(0x1, "|nof|"), - carrySet(0x2, "|carry|"), - carryClear(0x3, "|ncarry|"), - negative(0x8, "|neg|"), - positive(0x9, "|pos|"), - parity(0xa, "|par|"), - noParity(0xb, "|npar|"); + zero(0x4, "|zero|"), notZero(0x5, "|nzero|"), equal(0x4, "="), notEqual(0x5, "!="), less(0xc, "<"), lessEqual(0xe, "<="), greater(0xf, ">"), greaterEqual(0xd, ">="), below(0x2, "|<|"), belowEqual( + 0x6, "|<=|"), above(0x7, "|>|"), aboveEqual(0x3, "|>=|"), overflow(0x0, "|of|"), noOverflow(0x1, "|nof|"), carrySet(0x2, "|carry|"), carryClear(0x3, "|ncarry|"), negative(0x8, + "|neg|"), positive(0x9, "|pos|"), parity(0xa, "|par|"), noParity(0xb, "|npar|"); public final int value; public final String operator; @@ -78,27 +63,47 @@ } public ConditionFlag negate() { - switch(this) { - case zero: return notZero; - case notZero: return zero; - case equal: return notEqual; - case notEqual: return equal; - case less: return greaterEqual; - case lessEqual: return greater; - case greater: return lessEqual; - case greaterEqual: return less; - case below: return aboveEqual; - case belowEqual: return above; - case above: return belowEqual; - case aboveEqual: return below; - case overflow: return noOverflow; - case noOverflow: return overflow; - case carrySet: return carryClear; - case carryClear: return carrySet; - case negative: return positive; - case positive: return negative; - case parity: return noParity; - case noParity: return parity; + switch (this) { + case zero: + return notZero; + case notZero: + return zero; + case equal: + return notEqual; + case notEqual: + return equal; + case less: + return greaterEqual; + case lessEqual: + return greater; + case greater: + return lessEqual; + case greaterEqual: + return less; + case below: + return aboveEqual; + case belowEqual: + return above; + case above: + return belowEqual; + case aboveEqual: + return below; + case overflow: + return noOverflow; + case noOverflow: + return overflow; + case carrySet: + return carryClear; + case carryClear: + return carrySet; + case negative: + return positive; + case positive: + return negative; + case parity: + return noParity; + case noParity: + return parity; } throw new IllegalArgumentException(); } @@ -108,6 +113,7 @@ * Constants for X86 prefix bytes. */ private static class Prefix { + private static final int REX = 0x40; private static final int REXB = 0x41; private static final int REXX = 0x42; @@ -133,10 +139,11 @@ /** * Constructs an assembler for the AMD64 architecture. - * + * * @param registerConfig the register configuration used to bind {@link Register#Frame} and - * {@link Register#CallerFrame} to physical registers. This value can be null if this assembler - * instance will not be used to assemble instructions using these logical registers. + * {@link Register#CallerFrame} to physical registers. This value can be null if this + * assembler instance will not be used to assemble instructions using these logical + * registers. */ public AMD64Assembler(TargetDescription target, RegisterConfig registerConfig) { super(target); @@ -204,10 +211,11 @@ if (base == Register.Frame) { assert frameRegister != null : "cannot use register " + Register.Frame + " in assembler with null register configuration"; base = frameRegister; -// } else if (base == Register.CallerFrame) { -// assert frameRegister != null : "cannot use register " + Register.Frame + " in assembler with null register configuration"; -// base = frameRegister; -// disp += targetMethod.frameSize() + 8; + // } else if (base == Register.CallerFrame) { + // assert frameRegister != null : "cannot use register " + Register.Frame + + // " in assembler with null register configuration"; + // base = frameRegister; + // disp += targetMethod.frameSize() + 8; } // Encode the registers as needed in the fields they are used in @@ -441,7 +449,6 @@ emitByte(0xC0 | encode); } - public final void bsrq(Register dst, Address src) { prefixq(src, dst); emitByte(0xBD); @@ -455,7 +462,6 @@ emitByte(0xC0 | encode); } - public final void bsrl(Register dst, Address src) { prefix(src, dst); emitByte(0xBD); @@ -1052,10 +1058,10 @@ } /** - * New CPUs require use of movsd and movss to avoid partial register stall - * when loading from memory. But for old Opteron use movlpd instead of movsd. - * The selection is done in {@link AMD64MacroAssembler#movdbl(Register, Address)} - * and {@link AMD64MacroAssembler#movflt(Register, Register)}. + * New CPUs require use of movsd and movss to avoid partial register stall when loading from + * memory. But for old Opteron use movlpd instead of movsd. The selection is done in + * {@link AMD64MacroAssembler#movdbl(Register, Address)} and + * {@link AMD64MacroAssembler#movflt(Register, Register)}. */ public final void movlpd(Register dst, Address src) { assert dst.isFpu(); @@ -1559,7 +1565,7 @@ emitByte(0x0F); emitByte(0xB8); emitOperandHelper(dst, src); - } + } public final void popcntl(Register dst, Register src) { emitByte(0xF3); @@ -1567,7 +1573,7 @@ emitByte(0x0F); emitByte(0xB8); emitByte(0xC0 | encode); - } + } public final void popcntq(Register dst, Address src) { emitByte(0xF3); @@ -2230,9 +2236,9 @@ } /** - * Creates prefix and the encoding of the lower 6 bits of the ModRM-Byte. It emits an operand prefix. If the given - * operands exceed 3 bits, the 4th bit is encoded in the prefix. - * + * Creates prefix and the encoding of the lower 6 bits of the ModRM-Byte. It emits an operand + * prefix. If the given operands exceed 3 bits, the 4th bit is encoded in the prefix. + * * @param regEncoding the encoding of the register part of the ModRM-Byte * @param rmEncoding the encoding of the r/m part of the ModRM-Byte * @return the lower 6 bits of the ModRM-Byte that should be emitted @@ -2269,7 +2275,6 @@ return isRegister(value) && asRegister(value).encoding >= MinEncodingNeedsRex; } - private void prefix(Address adr) { if (needsRex(adr.getBase())) { if (needsRex(adr.getIndex())) { @@ -2917,11 +2922,12 @@ protected final void patchJumpTarget(int branch, int branchTarget) { int op = codeBuffer.getByte(branch); assert op == 0xE8 // call - || op == 0x00 // jump table entry - || op == 0xE9 // jmp - || op == 0xEB // short jmp - || (op & 0xF0) == 0x70 // short jcc - || op == 0x0F && (codeBuffer.getByte(branch + 1) & 0xF0) == 0x80 // jcc + || + op == 0x00 // jump table entry + || op == 0xE9 // jmp + || op == 0xEB // short jmp + || (op & 0xF0) == 0x70 // short jcc + || op == 0x0F && (codeBuffer.getByte(branch + 1) & 0xF0) == 0x80 // jcc : "Invalid opcode at patch point branch=" + branch + ", branchTarget=" + branchTarget + ", op=" + op; if (op == 0x00) { @@ -2979,9 +2985,9 @@ } /** - * Emits a direct call instruction. Note that the actual call target is not specified, because all calls - * need patching anyway. Therefore, 0 is emitted as the call target, and the user is responsible - * to add the call address to the appropriate patching tables. + * Emits a direct call instruction. Note that the actual call target is not specified, because + * all calls need patching anyway. Therefore, 0 is emitted as the call target, and the user is + * responsible to add the call address to the appropriate patching tables. */ public final void call() { emitByte(0xE8); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64MacroAssembler.java --- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64MacroAssembler.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64MacroAssembler.java Wed Jan 23 16:34:57 2013 +0100 @@ -56,7 +56,6 @@ // 64 bit versions - public void decrementq(Register reg, int value) { if (value == Integer.MIN_VALUE) { subq(reg, value); @@ -304,8 +303,8 @@ } /** - * Non-atomic write of a 64-bit constant to memory. Do not use - * if the address might be a volatile field! + * Non-atomic write of a 64-bit constant to memory. Do not use if the address might be a + * volatile field! */ public void movlong(Address dst, long src) { Address high = new Address(dst.getKind(), dst.getBase(), dst.getIndex(), dst.getScale(), dst.getDisplacement() + 4); @@ -370,8 +369,9 @@ } /** - * Emit code to save a given set of callee save registers in the - * {@linkplain CalleeSaveLayout CSA} within the frame. + * Emit code to save a given set of callee save registers in the {@linkplain CalleeSaveLayout + * CSA} within the frame. + * * @param csl the description of the CSA * @param frameToCSA offset from the frame pointer to the CSA */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/X86InstructionDecoder.java --- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/X86InstructionDecoder.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/X86InstructionDecoder.java Wed Jan 23 16:34:57 2013 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.asm.amd64; - public final class X86InstructionDecoder { private boolean targetIs64Bit; @@ -98,7 +97,7 @@ againAfterPrefix = false; switch (0xFF & code[ip++]) { - // These convenience macros generate groups of "case" labels for the switch. + // These convenience macros generate groups of "case" labels for the switch. case Prefix.CSSegment: case Prefix.SSSegment: diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AbstractAssembler.java --- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AbstractAssembler.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AbstractAssembler.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,6 +29,7 @@ * The platform-independent base class for the assembler. */ public abstract class AbstractAssembler { + public final TargetDescription target; public final Buffer codeBuffer; @@ -55,9 +56,9 @@ protected abstract void patchJumpTarget(int branch, int jumpTarget); /** - * Emits instruction(s) that access an address specified by a given displacement from the stack pointer - * in the direction that the stack grows (which is down on most architectures). - * + * Emits instruction(s) that access an address specified by a given displacement from the stack + * pointer in the direction that the stack grows (which is down on most architectures). + * * @param disp the displacement from the stack pointer at which the stack should be accessed */ public abstract void bangStack(int disp); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AsmOptions.java --- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AsmOptions.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AsmOptions.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,5 +23,6 @@ package com.oracle.graal.asm; public class AsmOptions { - public static int InitialCodeBufferSize = 232; + + public static int InitialCodeBufferSize = 232; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Buffer.java --- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Buffer.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Buffer.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,9 +25,11 @@ import java.util.*; /** - * Code buffer management for the assembler. Support for little endian and big endian architectures is implemented using subclasses. + * Code buffer management for the assembler. Support for little endian and big endian architectures + * is implemented using subclasses. */ public abstract class Buffer { + protected byte[] data; protected int position; @@ -49,14 +51,11 @@ } /** - * Closes this buffer. No extra data can be written to this buffer after - * this call. - * - * @param trimmedCopy - * if {@code true}, then a copy of the underlying byte array up - * to (but not including) {@code position()} is returned - * @return the data in this buffer or a trimmed copy if {@code trimmedCopy} - * is {@code true} + * Closes this buffer. No extra data can be written to this buffer after this call. + * + * @param trimmedCopy if {@code true}, then a copy of the underlying byte array up to (but not + * including) {@code position()} is returned + * @return the data in this buffer or a trimmed copy if {@code trimmedCopy} is {@code true} */ public byte[] close(boolean trimmedCopy) { byte[] result = trimmedCopy ? Arrays.copyOf(data, position()) : data; @@ -70,13 +69,10 @@ /** * Copies the data from this buffer into a given array. - * - * @param dst - * the destination array - * @param off - * starting position in {@code dst} - * @param len - * number of bytes to copy + * + * @param dst the destination array + * @param off starting position in {@code dst} + * @param len number of bytes to copy */ public void copyInto(byte[] dst, int off, int len) { System.arraycopy(data, 0, dst, off, len); @@ -133,6 +129,7 @@ public abstract int getInt(int pos); public static final class BigEndian extends Buffer { + @Override public int emitShort(int b, int pos) { assert NumUtil.isUShort(b); @@ -171,22 +168,17 @@ @Override public int getShort(int pos) { - return - (data[pos + 0] & 0xff) << 8 | - (data[pos + 1] & 0xff) << 0; + return (data[pos + 0] & 0xff) << 8 | (data[pos + 1] & 0xff) << 0; } @Override public int getInt(int pos) { - return - (data[pos + 0] & 0xff) << 24 | - (data[pos + 1] & 0xff) << 16 | - (data[pos + 2] & 0xff) << 8 | - (data[pos + 3] & 0xff) << 0; + return (data[pos + 0] & 0xff) << 24 | (data[pos + 1] & 0xff) << 16 | (data[pos + 2] & 0xff) << 8 | (data[pos + 3] & 0xff) << 0; } } public static final class LittleEndian extends Buffer { + @Override public int emitShort(int b, int pos) { assert NumUtil.isUShort(b); @@ -225,18 +217,12 @@ @Override public int getShort(int pos) { - return - (data[pos + 1] & 0xff) << 8 | - (data[pos + 0] & 0xff) << 0; + return (data[pos + 1] & 0xff) << 8 | (data[pos + 0] & 0xff) << 0; } @Override public int getInt(int pos) { - return - (data[pos + 3] & 0xff) << 24 | - (data[pos + 2] & 0xff) << 16 | - (data[pos + 1] & 0xff) << 8 | - (data[pos + 0] & 0xff) << 0; + return (data[pos + 3] & 0xff) << 24 | (data[pos + 2] & 0xff) << 16 | (data[pos + 1] & 0xff) << 8 | (data[pos + 0] & 0xff) << 0; } } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Label.java --- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Label.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Label.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,17 +28,19 @@ * This class represents a label within assembly code. */ public final class Label { + private int position = -1; /** - * References to instructions that jump to this unresolved label. - * These instructions need to be patched when the label is bound - * using the {@link #patchInstructions(AbstractAssembler)} method. + * References to instructions that jump to this unresolved label. These instructions need to be + * patched when the label is bound using the {@link #patchInstructions(AbstractAssembler)} + * method. */ private ArrayList patchPositions = new ArrayList<>(4); /** * Returns the position of this label in the code buffer. + * * @return the position */ public int position() { @@ -51,6 +53,7 @@ /** * Binds the label to the specified position. + * * @param pos the position */ protected void bind(int pos) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.asm/src/com/oracle/graal/asm/NumUtil.java --- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/NumUtil.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/NumUtil.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,61 +26,55 @@ * A collection of static utility functions that check ranges of numbers. */ public class NumUtil { + public static boolean isShiftCount(int x) { return 0 <= x && x < 32; } /** - * Determines if a given {@code int} value is the range of unsigned byte - * values. + * Determines if a given {@code int} value is the range of unsigned byte values. */ public static boolean isUByte(int x) { return (x & 0xff) == x; } /** - * Determines if a given {@code int} value is the range of signed byte - * values. + * Determines if a given {@code int} value is the range of signed byte values. */ public static boolean isByte(int x) { return (byte) x == x; } /** - * Determines if a given {@code long} value is the range of unsigned byte - * values. + * Determines if a given {@code long} value is the range of unsigned byte values. */ public static boolean isUByte(long x) { return (x & 0xffL) == x; } /** - * Determines if a given {@code long} value is the range of signed byte - * values. + * Determines if a given {@code long} value is the range of signed byte values. */ public static boolean isByte(long l) { return (byte) l == l; } /** - * Determines if a given {@code long} value is the range of unsigned int - * values. + * Determines if a given {@code long} value is the range of unsigned int values. */ public static boolean isUInt(long x) { return (x & 0xffffffffL) == x; } /** - * Determines if a given {@code long} value is the range of signed int - * values. + * Determines if a given {@code long} value is the range of signed int values. */ public static boolean isInt(long l) { return (int) l == l; } /** - * Determines if a given {@code int} value is the range of signed short - * values. + * Determines if a given {@code int} value is the range of signed short values. */ public static boolean isShort(int x) { return (short) x == x; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeLookupSwitch.java --- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeLookupSwitch.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeLookupSwitch.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,6 +26,7 @@ * A utility for processing {@link Bytecodes#LOOKUPSWITCH} bytecodes. */ public class BytecodeLookupSwitch extends BytecodeSwitch { + private static final int OFFSET_TO_NUMBER_PAIRS = 4; private static final int OFFSET_TO_FIRST_PAIR_MATCH = 8; private static final int OFFSET_TO_FIRST_PAIR_OFFSET = 12; @@ -33,6 +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 */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeStream.java --- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeStream.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeStream.java Wed Jan 23 16:34:57 2013 +0100 @@ -22,11 +22,10 @@ */ package com.oracle.graal.bytecode; - /** - * A utility class that makes iterating over bytecodes and reading operands - * simpler and less error prone. For example, it handles the {@link Bytecodes#WIDE} instruction - * and wide variants of instructions internally. + * A utility class that makes iterating over bytecodes and reading operands simpler and less error + * prone. For example, it handles the {@link Bytecodes#WIDE} instruction and wide variants of + * instructions internally. */ public final class BytecodeStream { @@ -37,6 +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,6 +54,7 @@ /** * Gets the next bytecode index (no side-effects). + * * @return the next bytecode index */ public int nextBCI() { @@ -62,6 +63,7 @@ /** * Gets the current bytecode index. + * * @return the current bytecode index */ public int currentBCI() { @@ -70,6 +72,7 @@ /** * Gets the bytecode index of the end of the code. + * * @return the index of the end of the code */ public int endBCI() { @@ -77,9 +80,9 @@ } /** - * 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. + * 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() { @@ -91,8 +94,9 @@ } /** - * Reads the index of a local variable for one of the load or store instructions. - * The WIDE modifier is handled internally. + * 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() { @@ -105,6 +109,7 @@ /** * Read the delta for an {@link Bytecodes#IINC} bytecode. + * * @return the delta for the {@code IINC} */ public int readIncrement() { @@ -117,6 +122,7 @@ /** * Read the destination of a {@link Bytecodes#GOTO} or {@code IF} instructions. + * * @return the destination bytecode index */ public int readBranchDest() { @@ -130,6 +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 */ @@ -140,6 +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 */ @@ -149,6 +157,7 @@ /** * Reads a constant pool index for the current instruction. + * * @return the constant pool index */ public char readCPI() { @@ -160,6 +169,7 @@ /** * Reads a signed, 1-byte value for the current instruction (e.g. BIPUSH). + * * @return the byte */ public byte readByte() { @@ -168,6 +178,7 @@ /** * Reads a signed, 2-byte short for the current instruction (e.g. SIPUSH). + * * @return the short value */ public short readShort() { @@ -175,9 +186,10 @@ } /** - * 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}. + * 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) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeSwitch.java --- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeSwitch.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeSwitch.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,6 +27,7 @@ * and {@link Bytecodes#TABLESWITCH} instructions. */ public abstract class BytecodeSwitch { + /** * The {@link BytecodeStream} containing the bytecode array. */ @@ -36,12 +37,14 @@ */ protected final int bci; /** - * Index of the start of the additional data for the switch instruction, aligned to a multiple of four from the method start. + * Index of the start of the additional data for the switch instruction, aligned to a multiple + * of four from the method start. */ protected final int alignedBci; /** * 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 */ @@ -53,6 +56,7 @@ /** * Gets the current bytecode index. + * * @return the current bytecode index */ public int bci() { @@ -61,6 +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 */ @@ -70,6 +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() { @@ -78,6 +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() { @@ -86,6 +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 */ @@ -93,6 +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 */ @@ -100,12 +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(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeTableSwitch.java --- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeTableSwitch.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeTableSwitch.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,6 +26,7 @@ * A utility for processing {@link Bytecodes#TABLESWITCH} bytecodes. */ public class BytecodeTableSwitch extends BytecodeSwitch { + private static final int OFFSET_TO_LOW_KEY = 4; private static final int OFFSET_TO_HIGH_KEY = 8; private static final int OFFSET_TO_FIRST_JUMP_OFFSET = 12; @@ -33,6 +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 */ @@ -42,6 +44,7 @@ /** * Gets the low key of the table switch. + * * @return the low key */ public int lowKey() { @@ -50,6 +53,7 @@ /** * Gets the high key of the table switch. + * * @return the high key */ public int highKey() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytecodes.java --- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytecodes.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytecodes.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,19 +27,18 @@ import java.lang.reflect.*; /** - * The definitions of the bytecodes that are valid input to the compiler and - * related utility methods. This comprises two groups: the standard Java - * bytecodes defined by - * Java Virtual Machine Specification, and a set of extended - * bytecodes that support low-level programming, for example, memory barriers. - * - * The extended bytecodes are one or three bytes in size. The one-byte bytecodes - * follow the values in the standard set, with no gap. The three-byte extended - * bytecodes share a common first byte and carry additional instruction-specific - * information in the second and third bytes. + * The definitions of the bytecodes that are valid input to the compiler and related utility + * methods. This comprises two groups: the standard Java bytecodes defined by Java Virtual + * Machine Specification, and a set of extended bytecodes that support low-level + * programming, for example, memory barriers. + * + * The extended bytecodes are one or three bytes in size. The one-byte bytecodes follow the values + * in the standard set, with no gap. The three-byte extended bytecodes share a common first byte and + * carry additional instruction-specific information in the second and third bytes. */ public class Bytecodes { + // @formatter:off public static final int NOP = 0; // 0x00 public static final int ACONST_NULL = 1; // 0x01 @@ -251,10 +250,11 @@ /** * The last opcode defined by the JVM specification. To iterate over all JVM bytecodes: + * *
-     *     for (int opcode = 0; opcode <= Bytecodes.LAST_JVM_OPCODE; ++opcode) {
-     *         //
-     *     }
+     * for (int opcode = 0; opcode <= Bytecodes.LAST_JVM_OPCODE; ++opcode) {
+     *     //
+     * }
      * 
*/ public static final int LAST_JVM_OPCODE = JSR_W; @@ -265,19 +265,21 @@ static class Flags { /** - * Denotes an instruction that ends a basic block and does not let control flow fall through to its lexical successor. + * Denotes an instruction that ends a basic block and does not let control flow fall through + * to its lexical successor. */ static final int STOP = 0x00000001; /** - * Denotes an instruction that ends a basic block and may let control flow fall through to its lexical successor. - * In practice this means it is a conditional branch. + * Denotes an instruction that ends a basic block and may let control flow fall through to + * its lexical successor. In practice this means it is a conditional branch. */ static final int FALL_THROUGH = 0x00000002; /** - * Denotes an instruction that has a 2 or 4 byte operand that is an offset to another instruction in the same method. - * This does not include the {@link Bytecodes#TABLESWITCH} or {@link Bytecodes#LOOKUPSWITCH} instructions. + * Denotes an instruction that has a 2 or 4 byte operand that is an offset to another + * instruction in the same method. This does not include the {@link Bytecodes#TABLESWITCH} + * or {@link Bytecodes#LOOKUPSWITCH} instructions. */ static final int BRANCH = 0x00000004; @@ -294,7 +296,7 @@ /** * Denotes an instruction that can cause a trap. */ - static final int TRAP = 0x00000080; + static final int TRAP = 0x00000080; /** * Denotes an instruction that is commutative. */ @@ -306,15 +308,15 @@ /** * Denotes an instruction that loads an operand. */ - static final int LOAD = 0x00000400; + static final int LOAD = 0x00000400; /** * Denotes an instruction that stores an operand. */ - static final int STORE = 0x00000800; + static final int STORE = 0x00000800; /** * Denotes the 4 INVOKE* instructions. */ - static final int INVOKE = 0x00001000; + static final int INVOKE = 0x00001000; } // Performs a sanity check that none of the flags overlap. @@ -337,23 +339,27 @@ } /** - * An array that maps from a bytecode value to a {@link String} for the corresponding instruction mnemonic. - * This will include the root instruction for the three-byte extended instructions. + * An array that maps from a bytecode value to a {@link String} for the corresponding + * instruction mnemonic. This will include the root instruction for the three-byte extended + * instructions. */ private static final String[] nameArray = new String[256]; /** - * An array that maps from a bytecode value to the set of {@link Flags} for the corresponding instruction. + * An array that maps from a bytecode value to the set of {@link Flags} for the corresponding + * instruction. */ private static final int[] flagsArray = new int[256]; /** - * An array that maps from a bytecode value to the length in bytes for the corresponding instruction. + * An array that maps from a bytecode value to the length in bytes for the corresponding + * instruction. */ private static final int[] lengthArray = new int[256]; /** - * An array that maps from a bytecode value to the estimated complexity of the bytecode in terms of generated machine code. + * An array that maps from a bytecode value to the estimated complexity of the bytecode in terms + * of generated machine code. */ private static final int[] compilationComplexityArray = new int[256]; @@ -569,6 +575,7 @@ /** * Determines if an opcode is commutative. + * * @param opcode the opcode to check * @return {@code true} iff commutative */ @@ -578,10 +585,11 @@ /** * Gets the length of an instruction denoted by a given opcode. - * + * * @param opcode an instruction opcode - * @return the length of the instruction denoted by {@code opcode}. If {@code opcode} is an illegal instruction or denotes a - * variable length instruction (e.g. {@link #TABLESWITCH}), then 0 is returned. + * @return the length of the instruction denoted by {@code opcode}. If {@code opcode} is an + * illegal instruction or denotes a variable length instruction (e.g. + * {@link #TABLESWITCH}), then 0 is returned. */ public static int lengthOf(int opcode) { return lengthArray[opcode & 0xff]; @@ -589,6 +597,7 @@ /** * Gets the compilation complexity for a given opcode. + * * @param opcode an opcode * @return a value >= 0 */ @@ -598,9 +607,10 @@ /** * Gets the lower-case mnemonic for a given opcode. - * + * * @param opcode an opcode - * @return the mnemonic for {@code opcode} or {@code ""} if {@code opcode} is not a legal opcode + * @return the mnemonic for {@code opcode} or {@code ""} if + * {@code opcode} is not a legal opcode */ public static String nameOf(int opcode) throws IllegalArgumentException { String name = nameArray[opcode & 0xff]; @@ -612,8 +622,10 @@ /** * Allocation-free version of {@linkplain #nameOf(int)}. + * * @param opcode an opcode. - * @return the mnemonic for {@code opcode} or {@code ""} if {@code opcode} is not a legal opcode. + * @return the mnemonic for {@code opcode} or {@code ""} if {@code opcode} is + * not a legal opcode. */ public static String baseNameOf(int opcode) { String name = nameArray[opcode & 0xff]; @@ -625,7 +637,7 @@ /** * Gets the opcode corresponding to a given mnemonic. - * + * * @param name an opcode mnemonic * @return the opcode corresponding to {@code mnemonic} * @throws IllegalArgumentException if {@code name} does not denote a valid opcode @@ -641,28 +653,31 @@ /** * Determines if a given opcode denotes an instruction that can cause an implicit exception. - * + * * @param opcode an opcode to test - * @return {@code true} iff {@code opcode} can cause an implicit exception, {@code false} otherwise + * @return {@code true} iff {@code opcode} can cause an implicit exception, {@code false} + * otherwise */ public static boolean canTrap(int opcode) { return (flagsArray[opcode & 0xff] & TRAP) != 0; } /** - * Determines if a given opcode denotes an instruction that loads a local variable to the operand stack. - * + * Determines if a given opcode denotes an instruction that loads a local variable to the + * operand stack. + * * @param opcode an opcode to test - * @return {@code true} iff {@code opcode} loads a local variable to the operand stack, {@code false} otherwise + * @return {@code true} iff {@code opcode} loads a local variable to the operand stack, + * {@code false} otherwise */ public static boolean isLoad(int opcode) { return (flagsArray[opcode & 0xff] & LOAD) != 0; } /** - * Determines if a given opcode denotes an instruction that ends a basic block and does not let control flow fall - * through to its lexical successor. - * + * Determines if a given opcode denotes an instruction that ends a basic block and does not let + * control flow fall through to its lexical successor. + * * @param opcode an opcode to test * @return {@code true} iff {@code opcode} properly ends a basic block */ @@ -673,9 +688,10 @@ /** * Determines if a given opcode denotes an instruction that stores a value to a local variable * after popping it from the operand stack. - * + * * @param opcode an opcode to test - * @return {@code true} iff {@code opcode} stores a value to a local variable, {@code false} otherwise + * @return {@code true} iff {@code opcode} stores a value to a local variable, {@code false} + * otherwise */ public static boolean isInvoke(int opcode) { return (flagsArray[opcode & 0xff] & INVOKE) != 0; @@ -684,9 +700,10 @@ /** * Determines if a given opcode denotes an instruction that stores a value to a local variable * after popping it from the operand stack. - * + * * @param opcode an opcode to test - * @return {@code true} iff {@code opcode} stores a value to a local variable, {@code false} otherwise + * @return {@code true} iff {@code opcode} stores a value to a local variable, {@code false} + * otherwise */ public static boolean isStore(int opcode) { return (flagsArray[opcode & 0xff] & STORE) != 0; @@ -694,7 +711,7 @@ /** * Determines if a given opcode is an instruction that delimits a basic block. - * + * * @param opcode an opcode to test * @return {@code true} iff {@code opcode} delimits a basic block */ @@ -703,9 +720,10 @@ } /** - * Determines if a given opcode is an instruction that has a 2 or 4 byte operand that is an offset to another - * instruction in the same method. This does not include the {@linkplain #TABLESWITCH switch} instructions. - * + * Determines if a given opcode is an instruction that has a 2 or 4 byte operand that is an + * offset to another instruction in the same method. This does not include the + * {@linkplain #TABLESWITCH switch} instructions. + * * @param opcode an opcode to test * @return {@code true} iff {@code opcode} is a branch instruction with a single operand */ @@ -715,6 +733,7 @@ /** * Determines if a given opcode denotes a conditional branch. + * * @param opcode * @return {@code true} iff {@code opcode} is a conditional branch */ @@ -726,48 +745,59 @@ * Gets the arithmetic operator name for a given opcode. If {@code opcode} does not denote an * arithmetic instruction, then the {@linkplain #nameOf(int) name} of the opcode is returned * instead. - * + * * @param op an opcode * @return the arithmetic operator name */ public static String operator(int op) { // Checkstyle: stop switch (op) { - // arithmetic ops - case IADD : // fall through - case LADD : // fall through - case FADD : // fall through - case DADD : return "+"; - case ISUB : // fall through - case LSUB : // fall through - case FSUB : // fall through - case DSUB : return "-"; - case IMUL : // fall through - case LMUL : // fall through - case FMUL : // fall through - case DMUL : return "*"; - case IDIV : // fall through - case LDIV : // fall through - case FDIV : // fall through - case DDIV : return "/"; - case IREM : // fall through - case LREM : // fall through - case FREM : // fall through - case DREM : return "%"; - // shift ops - case ISHL : // fall through - case LSHL : return "<<"; - case ISHR : // fall through - case LSHR : return ">>"; + // arithmetic ops + case IADD: // fall through + case LADD: // fall through + case FADD: // fall through + case DADD: + return "+"; + case ISUB: // fall through + case LSUB: // fall through + case FSUB: // fall through + case DSUB: + return "-"; + case IMUL: // fall through + case LMUL: // fall through + case FMUL: // fall through + case DMUL: + return "*"; + case IDIV: // fall through + case LDIV: // fall through + case FDIV: // fall through + case DDIV: + return "/"; + case IREM: // fall through + case LREM: // fall through + case FREM: // fall through + case DREM: + return "%"; + // shift ops + case ISHL: // fall through + case LSHL: + return "<<"; + case ISHR: // fall through + case LSHR: + return ">>"; case IUSHR: // fall through - case LUSHR: return ">>>"; - // logic ops - case IAND : // fall through - case LAND : return "&"; - case IOR : // fall through - case LOR : return "|"; - case IXOR : // fall through - case LXOR : return "^"; + case LUSHR: + return ">>>"; + // logic ops + case IAND: // fall through + case LAND: + return "&"; + case IOR: // fall through + case LOR: + return "|"; + case IXOR: // fall through + case LXOR: + return "^"; } // Checkstyle: resume return nameOf(op); @@ -775,7 +805,7 @@ /** * Defines a bytecode by entering it into the arrays that record its name, length and flags. - * + * * @param name instruction name (should be lower case) * @param format encodes the length of the instruction */ @@ -785,7 +815,7 @@ /** * Defines a bytecode by entering it into the arrays that record its name, length and flags. - * + * * @param name instruction name (lower case) * @param format encodes the length of the instruction * @param flags the set of {@link Flags} associated with the instruction diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytes.java --- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytes.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytes.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,8 +26,10 @@ * A collection of utility methods for dealing with bytes, particularly in byte arrays. */ public class Bytes { + /** * 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} @@ -38,6 +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} @@ -48,6 +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} @@ -58,6 +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} @@ -68,6 +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} @@ -78,6 +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 diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Wed Jan 23 16:34:57 2013 +0100 @@ -88,6 +88,7 @@ private static final RegisterValue RCX_I = AMD64.rcx.asValue(Kind.Int); public static class AMD64SpillMoveFactory implements LIR.SpillMoveFactory { + @Override public LIRInstruction createMove(Value result, Value input) { return new SpillMoveOp(result, input); @@ -118,19 +119,26 @@ public boolean canStoreConstant(Constant c) { // there is no immediate move of 64-bit constants on Intel switch (c.getKind()) { - case Long: return Util.isInt(c.asLong()) && !runtime.needsDataPatch(c); - case Double: return false; - case Object: return c.isNull(); - default: return true; + case Long: + return Util.isInt(c.asLong()) && !runtime.needsDataPatch(c); + case Double: + return false; + case Object: + return c.isNull(); + default: + return true; } } @Override public boolean canInlineConstant(Constant c) { switch (c.getKind()) { - case Long: return NumUtil.isInt(c.asLong()) && !runtime.needsDataPatch(c); - case Object: return c.isNull(); - default: return true; + case Long: + return NumUtil.isInt(c.asLong()) && !runtime.needsDataPatch(c); + case Object: + return c.isNull(); + default: + return true; } } @@ -167,12 +175,14 @@ } if (isConstant(index)) { long newDisplacement = displacement + asConstant(index).asLong() * scale; - // only use the constant index if the resulting displacement fits into a 32 bit offset + // only use the constant index if the resulting displacement fits into a 32 bit + // offset if (NumUtil.isInt(newDisplacement)) { displacement = (int) newDisplacement; index = Value.ILLEGAL; } else { - // create a temporary variable for the index, the pointer load cannot handle a constant index + // create a temporary variable for the index, the pointer load cannot handle a + // constant index Value newIndex = newVariable(Kind.Long); emitMove(index, newIndex); index = newIndex; @@ -231,10 +241,15 @@ switch (left.getKind().getStackKind()) { case Int: case Long: - case Object: append(new BranchOp(finalCondition, label, info)); break; + case Object: + append(new BranchOp(finalCondition, label, info)); + break; case Float: - case Double: append(new FloatBranchOp(finalCondition, unorderedIsTrue, label, info)); break; - default: throw GraalInternalError.shouldNotReachHere("" + left.getKind()); + case Double: + append(new FloatBranchOp(finalCondition, unorderedIsTrue, label, info)); + break; + default: + throw GraalInternalError.shouldNotReachHere("" + left.getKind()); } } @@ -247,17 +262,22 @@ switch (left.getKind().getStackKind()) { case Int: case Long: - case Object: append(new CondMoveOp(result, finalCondition, load(trueValue), loadNonConst(falseValue))); break; + case Object: + append(new CondMoveOp(result, finalCondition, load(trueValue), loadNonConst(falseValue))); + break; case Float: - case Double: append(new FloatCondMoveOp(result, finalCondition, unorderedIsTrue, load(trueValue), load(falseValue))); break; + case Double: + append(new FloatCondMoveOp(result, finalCondition, unorderedIsTrue, load(trueValue), load(falseValue))); + break; } return result; } /** - * This method emits the compare instruction, and may reorder the operands. It returns true if it did so. - * + * This method emits the compare instruction, and may reorder the operands. It returns true if + * it did so. + * * @param a the left operand of the comparison * @param b the right operand of the comparison * @return true if the left and right operands were switched, false otherwise @@ -277,12 +297,23 @@ } switch (left.getKind().getStackKind()) { case Jsr: - case Int: append(new CompareOp(ICMP, left, right)); break; - case Long: append(new CompareOp(LCMP, left, right)); break; - case Object: append(new CompareOp(ACMP, left, right)); break; - case Float: append(new CompareOp(FCMP, left, right)); break; - case Double: append(new CompareOp(DCMP, left, right)); break; - default: throw GraalInternalError.shouldNotReachHere(); + case Int: + append(new CompareOp(ICMP, left, right)); + break; + case Long: + append(new CompareOp(LCMP, left, right)); + break; + case Object: + append(new CompareOp(ACMP, left, right)); + break; + case Float: + append(new CompareOp(FCMP, left, right)); + break; + case Double: + append(new CompareOp(DCMP, left, right)); + break; + default: + throw GraalInternalError.shouldNotReachHere(); } return mirrored; } @@ -291,11 +322,20 @@ public Variable emitNegate(Value input) { Variable result = newVariable(input.getKind()); switch (input.getKind()) { - case Int: append(new Op1Stack(INEG, result, input)); break; - case Long: append(new Op1Stack(LNEG, result, input)); break; - case Float: append(new Op2Reg(FXOR, result, input, Constant.forFloat(Float.intBitsToFloat(0x80000000)))); break; - case Double: append(new Op2Reg(DXOR, result, input, Constant.forDouble(Double.longBitsToDouble(0x8000000000000000L)))); break; - default: throw GraalInternalError.shouldNotReachHere(); + case Int: + append(new Op1Stack(INEG, result, input)); + break; + case Long: + append(new Op1Stack(LNEG, result, input)); + break; + case Float: + append(new Op2Reg(FXOR, result, input, Constant.forFloat(Float.intBitsToFloat(0x80000000)))); + break; + case Double: + append(new Op2Reg(DXOR, result, input, Constant.forDouble(Double.longBitsToDouble(0x8000000000000000L)))); + break; + default: + throw GraalInternalError.shouldNotReachHere(); } return result; } @@ -303,12 +343,21 @@ @Override public Variable emitAdd(Value a, Value b) { Variable result = newVariable(a.getKind()); - switch(a.getKind()) { - case Int: append(new Op2Stack(IADD, result, a, loadNonConst(b))); break; - case Long: append(new Op2Stack(LADD, result, a, loadNonConst(b))); break; - case Float: append(new Op2Stack(FADD, result, a, loadNonConst(b))); break; - case Double: append(new Op2Stack(DADD, result, a, loadNonConst(b))); break; - default: throw GraalInternalError.shouldNotReachHere(); + switch (a.getKind()) { + case Int: + append(new Op2Stack(IADD, result, a, loadNonConst(b))); + break; + case Long: + append(new Op2Stack(LADD, result, a, loadNonConst(b))); + break; + case Float: + append(new Op2Stack(FADD, result, a, loadNonConst(b))); + break; + case Double: + append(new Op2Stack(DADD, result, a, loadNonConst(b))); + break; + default: + throw GraalInternalError.shouldNotReachHere(); } return result; } @@ -316,12 +365,21 @@ @Override public Variable emitSub(Value a, Value b) { Variable result = newVariable(a.getKind()); - switch(a.getKind()) { - case Int: append(new Op2Stack(ISUB, result, a, loadNonConst(b))); break; - case Long: append(new Op2Stack(LSUB, result, a, loadNonConst(b))); break; - case Float: append(new Op2Stack(FSUB, result, a, loadNonConst(b))); break; - case Double: append(new Op2Stack(DSUB, result, a, loadNonConst(b))); break; - default: throw GraalInternalError.shouldNotReachHere(); + switch (a.getKind()) { + case Int: + append(new Op2Stack(ISUB, result, a, loadNonConst(b))); + break; + case Long: + append(new Op2Stack(LSUB, result, a, loadNonConst(b))); + break; + case Float: + append(new Op2Stack(FSUB, result, a, loadNonConst(b))); + break; + case Double: + append(new Op2Stack(DSUB, result, a, loadNonConst(b))); + break; + default: + throw GraalInternalError.shouldNotReachHere(); } return result; } @@ -329,12 +387,21 @@ @Override public Variable emitMul(Value a, Value b) { Variable result = newVariable(a.getKind()); - switch(a.getKind()) { - case Int: append(new Op2Reg(IMUL, result, a, loadNonConst(b))); break; - case Long: append(new Op2Reg(LMUL, result, a, loadNonConst(b))); break; - case Float: append(new Op2Stack(FMUL, result, a, loadNonConst(b))); break; - case Double: append(new Op2Stack(DMUL, result, a, loadNonConst(b))); break; - default: throw GraalInternalError.shouldNotReachHere(); + switch (a.getKind()) { + case Int: + append(new Op2Reg(IMUL, result, a, loadNonConst(b))); + break; + case Long: + append(new Op2Reg(LMUL, result, a, loadNonConst(b))); + break; + case Float: + append(new Op2Stack(FMUL, result, a, loadNonConst(b))); + break; + case Double: + append(new Op2Stack(DMUL, result, a, loadNonConst(b))); + break; + default: + throw GraalInternalError.shouldNotReachHere(); } return result; } @@ -367,7 +434,7 @@ } public Value[] emitIntegerDivRem(Value a, Value b) { - switch(a.getKind()) { + switch (a.getKind()) { case Int: emitMove(a, RAX_I); append(new DivRemOp(IDIVREM, RAX_I, load(b), state())); @@ -383,7 +450,7 @@ @Override public Value emitDiv(Value a, Value b) { - switch(a.getKind()) { + switch (a.getKind()) { case Int: emitMove(a, RAX_I); append(new DivOp(IDIV, RAX_I, RAX_I, load(b), state())); @@ -409,7 +476,7 @@ @Override public Value emitRem(Value a, Value b) { - switch(a.getKind()) { + switch (a.getKind()) { case Int: emitMove(a, RAX_I); append(new DivOp(IREM, RDX_I, RAX_I, load(b), state())); @@ -433,7 +500,7 @@ @Override public Variable emitUDiv(Value a, Value b) { - switch(a.getKind()) { + switch (a.getKind()) { case Int: emitMove(a, RAX_I); append(new DivOp(IUDIV, RAX_I, RAX_I, load(b), state())); @@ -449,7 +516,7 @@ @Override public Variable emitURem(Value a, Value b) { - switch(a.getKind()) { + switch (a.getKind()) { case Int: emitMove(a, RAX_I); append(new DivOp(IUREM, RDX_I, RAX_I, load(b), state())); @@ -463,14 +530,18 @@ } } - @Override public Variable emitAnd(Value a, Value b) { Variable result = newVariable(a.getKind()); - switch(a.getKind()) { - case Int: append(new Op2Stack(IAND, result, a, loadNonConst(b))); break; - case Long: append(new Op2Stack(LAND, result, a, loadNonConst(b))); break; - default: throw GraalInternalError.shouldNotReachHere(); + switch (a.getKind()) { + case Int: + append(new Op2Stack(IAND, result, a, loadNonConst(b))); + break; + case Long: + append(new Op2Stack(LAND, result, a, loadNonConst(b))); + break; + default: + throw GraalInternalError.shouldNotReachHere(); } return result; } @@ -478,10 +549,15 @@ @Override public Variable emitOr(Value a, Value b) { Variable result = newVariable(a.getKind()); - switch(a.getKind()) { - case Int: append(new Op2Stack(IOR, result, a, loadNonConst(b))); break; - case Long: append(new Op2Stack(LOR, result, a, loadNonConst(b))); break; - default: throw GraalInternalError.shouldNotReachHere(); + switch (a.getKind()) { + case Int: + append(new Op2Stack(IOR, result, a, loadNonConst(b))); + break; + case Long: + append(new Op2Stack(LOR, result, a, loadNonConst(b))); + break; + default: + throw GraalInternalError.shouldNotReachHere(); } return result; } @@ -489,22 +565,31 @@ @Override public Variable emitXor(Value a, Value b) { Variable result = newVariable(a.getKind()); - switch(a.getKind()) { - case Int: append(new Op2Stack(IXOR, result, a, loadNonConst(b))); break; - case Long: append(new Op2Stack(LXOR, result, a, loadNonConst(b))); break; - default: throw GraalInternalError.shouldNotReachHere(); + switch (a.getKind()) { + case Int: + append(new Op2Stack(IXOR, result, a, loadNonConst(b))); + break; + case Long: + append(new Op2Stack(LXOR, result, a, loadNonConst(b))); + break; + default: + throw GraalInternalError.shouldNotReachHere(); } return result; } - @Override public Variable emitShl(Value a, Value b) { Variable result = newVariable(a.getKind()); switch (a.getKind()) { - case Int: append(new ShiftOp(ISHL, result, a, loadShiftCount(b))); break; - case Long: append(new ShiftOp(LSHL, result, a, loadShiftCount(b))); break; - default: GraalInternalError.shouldNotReachHere(); + case Int: + append(new ShiftOp(ISHL, result, a, loadShiftCount(b))); + break; + case Long: + append(new ShiftOp(LSHL, result, a, loadShiftCount(b))); + break; + default: + GraalInternalError.shouldNotReachHere(); } return result; } @@ -513,9 +598,14 @@ public Variable emitShr(Value a, Value b) { Variable result = newVariable(a.getKind()); switch (a.getKind()) { - case Int: append(new ShiftOp(ISHR, result, a, loadShiftCount(b))); break; - case Long: append(new ShiftOp(LSHR, result, a, loadShiftCount(b))); break; - default: GraalInternalError.shouldNotReachHere(); + case Int: + append(new ShiftOp(ISHR, result, a, loadShiftCount(b))); + break; + case Long: + append(new ShiftOp(LSHR, result, a, loadShiftCount(b))); + break; + default: + GraalInternalError.shouldNotReachHere(); } return result; } @@ -524,9 +614,14 @@ public Variable emitUShr(Value a, Value b) { Variable result = newVariable(a.getKind()); switch (a.getKind()) { - case Int: append(new ShiftOp(IUSHR, result, a, loadShiftCount(b))); break; - case Long: append(new ShiftOp(LUSHR, result, a, loadShiftCount(b))); break; - default: GraalInternalError.shouldNotReachHere(); + case Int: + append(new ShiftOp(IUSHR, result, a, loadShiftCount(b))); + break; + case Long: + append(new ShiftOp(LUSHR, result, a, loadShiftCount(b))); + break; + default: + GraalInternalError.shouldNotReachHere(); } return result; } @@ -540,42 +635,80 @@ return RCX_I; } - @Override public Variable emitConvert(ConvertNode.Op opcode, Value inputVal) { Variable input = load(inputVal); Variable result = newVariable(opcode.to); switch (opcode) { - case I2L: append(new Op1Reg(I2L, result, input)); break; - case L2I: append(new Op1Stack(L2I, result, input)); break; - case I2B: append(new Op1Stack(I2B, result, input)); break; - case I2C: append(new Op1Stack(I2C, result, input)); break; - case I2S: append(new Op1Stack(I2S, result, input)); break; - case F2D: append(new Op1Reg(F2D, result, input)); break; - case D2F: append(new Op1Reg(D2F, result, input)); break; - case I2F: append(new Op1Reg(I2F, result, input)); break; - case I2D: append(new Op1Reg(I2D, result, input)); break; - case F2I: append(new Op1Reg(F2I, result, input)); break; - case D2I: append(new Op1Reg(D2I, result, input)); break; - case L2F: append(new Op1Reg(L2F, result, input)); break; - case L2D: append(new Op1Reg(L2D, result, input)); break; - case F2L: append(new Op1Reg(F2L, result, input)); break; - case D2L: append(new Op1Reg(D2L, result, input)); break; - case MOV_I2F: append(new Op1Reg(MOV_I2F, result, input)); break; - case MOV_L2D: append(new Op1Reg(MOV_L2D, result, input)); break; - case MOV_F2I: append(new Op1Reg(MOV_F2I, result, input)); break; - case MOV_D2L: append(new Op1Reg(MOV_D2L, result, input)); break; + case I2L: + append(new Op1Reg(I2L, result, input)); + break; + case L2I: + append(new Op1Stack(L2I, result, input)); + break; + case I2B: + append(new Op1Stack(I2B, result, input)); + break; + case I2C: + append(new Op1Stack(I2C, result, input)); + break; + case I2S: + append(new Op1Stack(I2S, result, input)); + break; + case F2D: + append(new Op1Reg(F2D, result, input)); + break; + case D2F: + append(new Op1Reg(D2F, result, input)); + break; + case I2F: + append(new Op1Reg(I2F, result, input)); + break; + case I2D: + append(new Op1Reg(I2D, result, input)); + break; + case F2I: + append(new Op1Reg(F2I, result, input)); + break; + case D2I: + append(new Op1Reg(D2I, result, input)); + break; + case L2F: + append(new Op1Reg(L2F, result, input)); + break; + case L2D: + append(new Op1Reg(L2D, result, input)); + break; + case F2L: + append(new Op1Reg(F2L, result, input)); + break; + case D2L: + append(new Op1Reg(D2L, result, input)); + break; + case MOV_I2F: + append(new Op1Reg(MOV_I2F, result, input)); + break; + case MOV_L2D: + append(new Op1Reg(MOV_L2D, result, input)); + break; + case MOV_F2I: + append(new Op1Reg(MOV_F2I, result, input)); + break; + case MOV_D2L: + append(new Op1Reg(MOV_D2L, result, input)); + break; case UNSIGNED_I2L: - // Instructions that move or generate 32-bit register values also set the upper 32 bits of the register to zero. + // Instructions that move or generate 32-bit register values also set the upper 32 + // bits of the register to zero. // Consequently, there is no need for a special zero-extension move. emitMove(input, result); break; - default: throw GraalInternalError.shouldNotReachHere(); + default: + throw GraalInternalError.shouldNotReachHere(); } return result; } - @Override public void emitDeoptimizeOnOverflow(DeoptimizationAction action, DeoptimizationReason reason, Object deoptInfo) { LIRFrameState info = state(); @@ -583,7 +716,6 @@ append(new BranchOp(ConditionFlag.overflow, stubEntry, info)); } - @Override public void emitDeoptimize(DeoptimizationAction action, DeoptimizationReason reason, Object deoptInfo, long leafGraphId) { LIRFrameState info = state(leafGraphId); @@ -606,7 +738,8 @@ @Override protected void emitIndirectCall(IndirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) { - // The current register allocator cannot handle variables at call sites, need a fixed register. + // The current register allocator cannot handle variables at call sites, need a fixed + // register. Value targetAddress = AMD64.rax.asValue(); emitMove(operand(callTarget.computedAddress()), targetAddress); append(new IndirectCallOp(callTarget.target(), result, parameters, temps, targetAddress, callState)); @@ -686,7 +819,8 @@ @Override protected void emitSequentialSwitch(Constant[] keyConstants, LabelRef[] keyTargets, LabelRef defaultTarget, Value key) { - // Making a copy of the switch value is necessary because jump table destroys the input value + // Making a copy of the switch value is necessary because jump table destroys the input + // value if (key.getKind() == Kind.Int || key.getKind() == Kind.Long) { append(new SequentialSwitchOp(keyConstants, keyTargets, defaultTarget, key, Value.ILLEGAL)); } else { @@ -702,7 +836,8 @@ @Override protected void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, Value key) { - // Making a copy of the switch value is necessary because jump table destroys the input value + // Making a copy of the switch value is necessary because jump table destroys the input + // value Variable tmp = emitMove(key); append(new TableSwitchOp(lowKey, defaultTarget, targets, tmp, newVariable(target.wordKind))); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -35,9 +35,9 @@ import com.oracle.graal.phases.common.*; /** - * In the following tests, the usages of local variable "a" are replaced with the integer constant 0. Then boxing - * elimination is applied and it is verified that the resulting graph is equal to the graph of the method that just has - * a "return 1" statement in it. + * In the following tests, the usages of local variable "a" are replaced with the integer constant + * 0. Then boxing elimination is applied and it is verified that the resulting graph is equal to the + * graph of the method that just has a "return 1" statement in it. */ public class BoxingEliminationTest extends GraalCompilerTest { @@ -111,6 +111,7 @@ private void test(final String snippet, final String referenceSnippet) { Debug.scope("BoxingEliminationTest", new DebugDumpScope(snippet), new Runnable() { + @Override public void run() { StructuredGraph graph = parse(snippet); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompiledMethodTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompiledMethodTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompiledMethodTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -36,9 +36,9 @@ import com.oracle.graal.phases.common.*; /** - * In the following tests, the usages of local variable "a" are replaced with the integer constant 0. Then - * canonicalization is applied and it is verified that the resulting graph is equal to the graph of the method that just - * has a "return 1" statement in it. + * In the following tests, the usages of local variable "a" are replaced with the integer constant + * 0. Then canonicalization is applied and it is verified that the resulting graph is equal to the + * graph of the method that just has a "return 1" statement in it. */ public class CompiledMethodTest extends GraalCompilerTest { @@ -47,6 +47,7 @@ } Object f1; + public Object testMethodVirtual(Object arg1, Object arg2, Object arg3) { return f1 + " " + arg1 + " " + arg2 + " " + arg3; } @@ -167,10 +168,12 @@ } public interface CompiledObject { + Object execute(ObjectCompiler context, String args); } public interface ObjectCompiler { + CompiledObject compile(CompilableObject node); } @@ -185,6 +188,7 @@ @Override public CompiledObject compile(final CompilableObject node) { return new CompiledObject() { + @Override public Object execute(ObjectCompiler compiler, String args) { return compiledMethod.execute(node, compiler, args); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,7 +31,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.calc.*; - public class ConditionTest { @Test diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,8 +30,8 @@ import com.oracle.graal.phases.common.*; /** - * In the following tests, the usages of local variable "a" are replaced with the integer constant 0. - * Then canonicalization is applied and it is verified that the resulting graph is equal to the + * In the following tests, the usages of local variable "a" are replaced with the integer constant + * 0. Then canonicalization is applied and it is verified that the resulting graph is equal to the * graph of the method that just has a "return 1" statement in it. */ public class DegeneratedLoopsTest extends GraalCompilerTest { @@ -49,6 +49,7 @@ } private static class UnresolvedException extends RuntimeException { + private static final long serialVersionUID = 5215434338750728440L; static { @@ -76,6 +77,7 @@ private void test(final String snippet) { Debug.scope("DegeneratedLoopsTest", new DebugDumpScope(snippet), new Runnable() { + public void run() { StructuredGraph graph = parse(snippet); Debug.dump(graph, "Graph"); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,6 +34,7 @@ public class FloatingReadTest extends GraphScheduleTest { public static class Container { + public int a; } @@ -53,6 +54,7 @@ private void test(final String snippet) { Debug.scope("FloatingReadTest", new DebugDumpScope(snippet), new Runnable() { + public void run() { StructuredGraph graph = parse(snippet); new LoweringPhase(runtime(), new Assumptions(false)).apply(graph); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -57,9 +57,9 @@ *

* See {@link InvokeHintsTest} as an example of a white box test. *

- * Black box tests use the {@link #test(String, Object...)} or {@link #testN(int, String, Object...)} - * to execute some method in the interpreter and compare its result against that produced - * by a Graal compiled version of the method. + * Black box tests use the {@link #test(String, Object...)} or + * {@link #testN(int, String, Object...)} to execute some method in the interpreter and compare its + * result against that produced by a Graal compiled version of the method. *

* These tests will be run by the {@code mx unittest} command. */ @@ -139,7 +139,7 @@ /** * Parses a Java method to produce a graph. - * + * * @param methodName the name of the method in {@code this.getClass()} to be parsed */ protected StructuredGraph parse(String methodName) { @@ -202,6 +202,7 @@ for (int i = 0; i < n; i++) { final int idx = i; Thread t = new Thread(i + ":" + name) { + @Override public void run() { try { @@ -234,8 +235,10 @@ } static class Result { + final Object returnValue; final Throwable exception; + public Result(Object returnValue, Throwable exception) { this.returnValue = returnValue; this.exception = exception; @@ -257,7 +260,8 @@ protected Result executeExpected(Method method, Object receiver, Object... args) { before(); try { - // This gives us both the expected return value as well as ensuring that the method to be compiled is fully resolved + // This gives us both the expected return value as well as ensuring that the method to + // be compiled is fully resolved return new Result(referenceInvoke(method, receiver, args), null); } catch (InvocationTargetException e) { return new Result(null, e.getTargetException()); @@ -284,7 +288,7 @@ /** * Prepends a non-null receiver argument to a given list or args. - * + * * @param receiver the receiver argument to prepend if it is non-null */ protected Object[] argsWithReceiver(Object receiver, Object... args) { @@ -315,7 +319,8 @@ Assert.assertTrue("expected " + expect.exception, actual.exception != null); Assert.assertEquals(expect.exception.getClass(), actual.exception.getClass()); } else { - //System.out.println(name + "(" + Arrays.toString(args) + "): expected=" + expect.returnValue + ", actual=" + actual.returnValue); + // System.out.println(name + "(" + Arrays.toString(args) + "): expected=" + + // expect.returnValue + ", actual=" + actual.returnValue); assertEquals(expect.returnValue, actual.returnValue); } } @@ -331,7 +336,7 @@ /** * Can be overridden to modify the compilation phases applied for a test. - * + * * @param method the method being compiled * @param graph the graph being compiled * @param phasePlan the phase plan to be edited @@ -341,8 +346,9 @@ /** * Gets installed code for a given method and graph, compiling it first if necessary. - * - * @param forceCompile specifies whether to ignore any previous code cached for the (method, key) pair + * + * @param forceCompile specifies whether to ignore any previous code cached for the (method, + * key) pair */ protected InstalledCode getCode(final ResolvedJavaMethod method, final StructuredGraph graph, boolean forceCompile) { if (!forceCompile) { @@ -351,7 +357,7 @@ if (cached.isValid()) { return cached; } else { - //System.out.println(cached.getMethod() + " was invalidated"); + // System.out.println(cached.getMethod() + " was invalidated"); } } @@ -360,6 +366,7 @@ final int id = compilationId++; InstalledCode installedCode = Debug.scope("Compiling", new DebugDumpScope(String.valueOf(id), true), new Callable() { + public InstalledCode call() throws Exception { final boolean printCompilation = GraalOptions.PrintCompilation && !TTY.isSuppressed(); if (printCompilation) { @@ -386,13 +393,14 @@ protected InstalledCode addMethod(final ResolvedJavaMethod method, final CompilationResult compResult) { assert graalCompiler != null; - return Debug.scope("CodeInstall", new Object[] {graalCompiler, method}, new Callable() { + return Debug.scope("CodeInstall", new Object[]{graalCompiler, method}, new Callable() { + @Override public InstalledCode call() throws Exception { final CodeInfo[] info = Debug.isDumpEnabled() ? new CodeInfo[1] : null; InstalledCode installedMethod = runtime.addMethod(method, compResult, info); if (info != null) { - Debug.dump(new Object[] {compResult, info[0]}, "After code installation"); + Debug.dump(new Object[]{compResult, info[0]}, "After code installation"); } return installedMethod; } @@ -401,7 +409,7 @@ /** * Parses a Java method to produce a graph. - * + * * @param methodName the name of the method in {@code this.getClass()} to be parsed */ protected StructuredGraph parseProfiled(String methodName) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraphScheduleTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraphScheduleTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraphScheduleTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,6 +32,7 @@ import com.oracle.graal.phases.schedule.*; public class GraphScheduleTest extends GraalCompilerTest { + protected void assertOrderedAfterSchedule(StructuredGraph graph, Node a, Node b) { SchedulePhase ibp = new SchedulePhase(); ibp.apply(graph); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfBoxingEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfBoxingEliminationTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfBoxingEliminationTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -73,6 +73,7 @@ private void test(final String snippet) { Debug.scope("IfBoxingEliminationTest", new DebugDumpScope(snippet), new Runnable() { + @Override public void run() { StructuredGraph graph = parse(snippet); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,8 +33,8 @@ import com.oracle.graal.phases.common.*; /** - * In the following tests, the usages of local variable "a" are replaced with the integer constant 0. - * Then canonicalization is applied and it is verified that the resulting graph is equal to the + * In the following tests, the usages of local variable "a" are replaced with the integer constant + * 0. Then canonicalization is applied and it is verified that the resulting graph is equal to the * graph of the method that just has a "return 1" statement in it. */ public class IfCanonicalizerTest extends GraalCompilerTest { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LoopUnswitchTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LoopUnswitchTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LoopUnswitchTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -47,7 +47,6 @@ return sum; } - public static int test1Snippet(int a) { int sum = 0; for (int i = 0; i < 1000; i++) { @@ -62,28 +61,28 @@ public static int referenceSnippet2(int a) { int sum = 0; - switch(a) { - case 0: - for (int i = 0; i < 1000; i++) { - sum += System.currentTimeMillis(); - } - break; - case 1: - for (int i = 0; i < 1000; i++) { - sum += 1; - sum += 5; - } - break; - case 55: - for (int i = 0; i < 1000; i++) { - sum += 5; - } - break; - default: - for (int i = 0; i < 1000; i++) { - //nothing - } - break; + switch (a) { + case 0: + for (int i = 0; i < 1000; i++) { + sum += System.currentTimeMillis(); + } + break; + case 1: + for (int i = 0; i < 1000; i++) { + sum += 1; + sum += 5; + } + break; + case 55: + for (int i = 0; i < 1000; i++) { + sum += 5; + } + break; + default: + for (int i = 0; i < 1000; i++) { + // nothing + } + break; } return sum; } @@ -91,7 +90,7 @@ public static int test2Snippet(int a) { int sum = 0; for (int i = 0; i < 1000; i++) { - switch(a) { + switch (a) { case 0: sum += System.currentTimeMillis(); break; @@ -102,7 +101,7 @@ sum += 5; break; default: - //nothing + // nothing break; } } @@ -137,6 +136,7 @@ new CanonicalizerPhase(null, runtime(), assumptions).apply(graph); new CanonicalizerPhase(null, runtime(), assumptions).apply(referenceGraph); Debug.scope("Test", new DebugDumpScope("Test:" + snippet), new Runnable() { + @Override public void run() { assertEquals(referenceGraph, graph); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -37,8 +37,8 @@ import com.oracle.graal.phases.common.*; /** - * In the following tests, the usages of local variable "a" are replaced with the integer constant 0. - * Then canonicalization is applied and it is verified that the resulting graph is equal to the + * In the following tests, the usages of local variable "a" are replaced with the integer constant + * 0. Then canonicalization is applied and it is verified that the resulting graph is equal to the * graph of the method that just has a "return 1" statement in it. */ public class MonitorGraphTest extends GraalCompilerTest { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReassociateAndCanonicalTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReassociateAndCanonicalTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReassociateAndCanonicalTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,6 +30,7 @@ import com.oracle.graal.phases.common.*; public class ReassociateAndCanonicalTest extends GraalCompilerTest { + public static int rnd = (int) (Math.random() * 100); @Test diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,7 +30,8 @@ import com.oracle.graal.phases.common.*; /** - * In the following tests, the scalar type system of the compiler should be complete enough to see the relation between the different conditions. + * In the following tests, the scalar type system of the compiler should be complete enough to see + * the relation between the different conditions. */ public class ScalarTypeSystemTest extends GraalCompilerTest { @@ -164,7 +165,7 @@ // No debug scope to reduce console noise for @Test(expected = ...) tests StructuredGraph graph = parse(snippet); Debug.dump(graph, "Graph"); -// TypeSystemTest.outputGraph(graph); + // TypeSystemTest.outputGraph(graph); Assumptions assumptions = new Assumptions(false); new CanonicalizerPhase(null, runtime(), assumptions).apply(graph); new ConditionalEliminationPhase().apply(graph); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StampCanonicalizerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StampCanonicalizerTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StampCanonicalizerTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,8 +30,8 @@ import com.oracle.graal.phases.common.*; /** - * This class tests some specific patterns the stamp system should be able to canonicalize away using - * {@link IntegerStamp#mask()}. + * This class tests some specific patterns the stamp system should be able to canonicalize away + * using {@link IntegerStamp#mask()}. */ public class StampCanonicalizerTest extends GraalCompilerTest { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -39,7 +39,8 @@ import com.oracle.graal.phases.schedule.*; /** - * In the following tests, the scalar type system of the compiler should be complete enough to see the relation between the different conditions. + * In the following tests, the scalar type system of the compiler should be complete enough to see + * the relation between the different conditions. */ public class TypeSystemTest extends GraalCompilerTest { @@ -205,13 +206,13 @@ @Override protected void assertEquals(StructuredGraph expected, StructuredGraph graph) { if (expected.getNodeCount() != graph.getNodeCount()) { -// Debug.dump(expected, "Node count not matching - expected"); -// Debug.dump(graph, "Node count not matching - actual"); -// System.out.println("================ expected"); -// outputGraph(expected); -// System.out.println("================ actual"); -// outputGraph(graph); -// new IdealGraphPrinterDumpHandler().dump(graph, "asdf"); + // Debug.dump(expected, "Node count not matching - expected"); + // Debug.dump(graph, "Node count not matching - actual"); + // System.out.println("================ expected"); + // outputGraph(expected); + // System.out.println("================ actual"); + // outputGraph(graph); + // new IdealGraphPrinterDumpHandler().dump(graph, "asdf"); Assert.fail("Graphs do not have the same number of nodes: " + expected.getNodeCount() + " vs. " + graph.getNodeCount()); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -37,8 +37,9 @@ import com.oracle.graal.virtual.phases.ea.*; /** - * In these test cases the probability of all invokes is set to a high value, such that an InliningPhase should inline them all. - * After that, the EscapeAnalysisPhase is expected to remove all allocations and return the correct values. + * In these test cases the probability of all invokes is set to a high value, such that an + * InliningPhase should inline them all. After that, the EscapeAnalysisPhase is expected to remove + * all allocations and return the correct values. */ public class EscapeAnalysisTest extends GraalCompilerTest { @@ -99,7 +100,8 @@ } /** - * This test case differs from the last one in that it requires inlining within a synchronized region. + * This test case differs from the last one in that it requires inlining within a synchronized + * region. */ public static int testMonitor2Snippet() { Integer x = new Integer(0); @@ -121,8 +123,10 @@ } public static class TestObject { + int x; int y; + public TestObject(int x, int y) { this.x = x; this.y = y; @@ -157,7 +161,9 @@ } public static class TestObject2 { + Object o; + public TestObject2(Object o) { this.o = o; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -38,9 +38,9 @@ import com.oracle.graal.virtual.phases.ea.*; /** - * In these test cases the probability of all invokes is set to a high value, such that an InliningPhase should inline - * them all. After that, the PartialEscapeAnalysisPhase is expected to remove all allocations and return the correct - * values. + * In these test cases the probability of all invokes is set to a high value, such that an + * InliningPhase should inline them all. After that, the PartialEscapeAnalysisPhase is expected to + * remove all allocations and return the correct values. */ public class PartialEscapeAnalysisTest extends GraalCompilerTest { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -39,6 +39,7 @@ // TODO (chaeubl): add more test cases @SuppressWarnings("unused") public class InliningTest extends GraalCompilerTest { + @Test public void testInvokeStaticInlining() { assertInlined(getGraph("invokeStaticSnippet")); @@ -49,12 +50,12 @@ public static Boolean invokeStaticSnippet(boolean value) { return Boolean.valueOf(value); } + @SuppressWarnings("all") public static Boolean invokeStaticOnInstanceSnippet(Boolean obj, boolean value) { return obj.valueOf(value); } - @Test public void testStaticBindableInlining() { assertInlined(getGraph("invokeConstructorSnippet")); @@ -66,32 +67,25 @@ public static Object invokeConstructorSnippet(int value) { return new SuperClass(value); } + @SuppressWarnings("all") public static int invokeFinalMethodSnippet(SuperClass superClass, SubClassA subClassA, FinalSubClass finalSubClass) { - return superClass.publicFinalMethod() + - subClassA.publicFinalMethod() + - finalSubClass.publicFinalMethod() + - superClass.protectedFinalMethod() + - subClassA.protectedFinalMethod() + - finalSubClass.protectedFinalMethod(); + return superClass.publicFinalMethod() + subClassA.publicFinalMethod() + finalSubClass.publicFinalMethod() + superClass.protectedFinalMethod() + subClassA.protectedFinalMethod() + + finalSubClass.protectedFinalMethod(); } + @SuppressWarnings("all") public static int invokeMethodOnFinalClassSnippet(FinalSubClass finalSubClass) { - return finalSubClass.publicFinalMethod() + - finalSubClass.publicNotOverriddenMethod() + - finalSubClass.publicOverriddenMethod() + - finalSubClass.protectedFinalMethod() + - finalSubClass.protectedNotOverriddenMethod() + - finalSubClass.protectedOverriddenMethod(); + return finalSubClass.publicFinalMethod() + finalSubClass.publicNotOverriddenMethod() + finalSubClass.publicOverriddenMethod() + finalSubClass.protectedFinalMethod() + + finalSubClass.protectedNotOverriddenMethod() + finalSubClass.protectedOverriddenMethod(); } - @Test public void testClassHierarchyAnalysis() { assertInlined(getGraph("invokeLeafClassMethodSnippet")); assertInlined(getGraph("invokeConcreteMethodSnippet")); assertInlined(getGraph("invokeSingleImplementorInterfaceSnippet")); -// assertInlined(getGraph("invokeConcreteInterfaceMethodSnippet")); + // assertInlined(getGraph("invokeConcreteInterfaceMethodSnippet")); assertNotInlined(getGraph("invokeOverriddenPublicMethodSnippet")); assertNotInlined(getGraph("invokeOverriddenProtectedMethodSnippet")); @@ -100,32 +94,34 @@ @SuppressWarnings("all") public static int invokeLeafClassMethodSnippet(SubClassA subClassA) { - return subClassA.publicFinalMethod() + - subClassA.publicNotOverriddenMethod() + - subClassA.publicOverriddenMethod(); + return subClassA.publicFinalMethod() + subClassA.publicNotOverriddenMethod() + subClassA.publicOverriddenMethod(); } + @SuppressWarnings("all") public static int invokeConcreteMethodSnippet(SuperClass superClass) { - return superClass.publicNotOverriddenMethod() + - superClass.protectedNotOverriddenMethod(); + return superClass.publicNotOverriddenMethod() + superClass.protectedNotOverriddenMethod(); } + @SuppressWarnings("all") public static int invokeSingleImplementorInterfaceSnippet(SingleImplementorInterface testInterface) { - return testInterface.publicNotOverriddenMethod() + - testInterface.publicOverriddenMethod(); + return testInterface.publicNotOverriddenMethod() + testInterface.publicOverriddenMethod(); } + @SuppressWarnings("all") public static int invokeConcreteInterfaceMethodSnippet(MultipleImplementorsInterface testInterface) { return testInterface.publicNotOverriddenMethod(); } + @SuppressWarnings("all") public static int invokeOverriddenInterfaceMethodSnippet(MultipleImplementorsInterface testInterface) { return testInterface.publicOverriddenMethod(); } + @SuppressWarnings("all") public static int invokeOverriddenPublicMethodSnippet(SuperClass superClass) { return superClass.publicOverriddenMethod(); } + @SuppressWarnings("all") public static int invokeOverriddenProtectedMethodSnippet(SuperClass superClass) { return superClass.protectedOverriddenMethod(); @@ -133,6 +129,7 @@ private StructuredGraph getGraph(final String snippet) { return Debug.scope("InliningTest", new DebugDumpScope(snippet), new Callable() { + @Override public StructuredGraph call() { StructuredGraph graph = parse(snippet); @@ -158,7 +155,7 @@ } private static StructuredGraph assertNotInGraph(StructuredGraph graph, Class clazz) { - for (Node node: graph.getNodes()) { + for (Node node : graph.getNodes()) { if (clazz.isInstance(node)) { fail(node.toString()); } @@ -167,7 +164,7 @@ } private static StructuredGraph assertInGraph(StructuredGraph graph, Class clazz) { - for (Node node: graph.getNodes()) { + for (Node node : graph.getNodes()) { if (clazz.isInstance(node)) { return graph; } @@ -176,19 +173,23 @@ return graph; } - // some interfaces and classes for testing private interface MultipleImplementorsInterface { + int publicNotOverriddenMethod(); + int publicOverriddenMethod(); } private interface SingleImplementorInterface { + int publicNotOverriddenMethod(); + int publicOverriddenMethod(); } private static class SuperClass implements MultipleImplementorsInterface { + protected int value; public SuperClass(int value) { @@ -221,6 +222,7 @@ } private static class SubClassA extends SuperClass implements SingleImplementorInterface { + public SubClassA(int value) { super(value); } @@ -237,6 +239,7 @@ } private static class SubClassB extends SuperClass { + public SubClassB(int value) { super(value); } @@ -253,6 +256,7 @@ } private static class SubClassC extends SuperClass { + public SubClassC(int value) { super(value); } @@ -269,6 +273,7 @@ } private static final class FinalSubClass extends SuperClass { + public FinalSubClass(int value) { super(value); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/DebugFilter.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/DebugFilter.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/DebugFilter.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,33 +30,56 @@ import com.oracle.graal.phases.*; /** - * Implements the filter specified by the {@link GraalOptions#Dump}, - * {@link GraalOptions#Log}, {@link GraalOptions#Meter} and {@link GraalOptions#Time} - * options. + * Implements the filter specified by the {@link GraalOptions#Dump}, {@link GraalOptions#Log}, + * {@link GraalOptions#Meter} and {@link GraalOptions#Time} options. *

- * These options enable the associated debug facility if their filter - * matches the {@linkplain DebugScope#getQualifiedName() name} of the - * {@linkplain Debug#currentScope() current scope}. + * These options enable the associated debug facility if their filter matches the + * {@linkplain DebugScope#getQualifiedName() name} of the {@linkplain Debug#currentScope() current + * scope}. *

- * A filter is a list of comma-separated terms. Each term is interpreted - * as a glob pattern if it contains a "*" or "?" character. Otherwise, it is - * interpreted as a substring. If a term starts with "~", then it is an - * positive term. An input is matched by a filter if any of its positive - * terms match the input (or it has no positive terms) AND none of its - * negative terms match the input (or it has no negative terms). + * A filter is a list of comma-separated terms. Each term is interpreted as a glob pattern if it + * contains a "*" or "?" character. Otherwise, it is interpreted as a substring. If a term starts + * with "~", then it is an positive term. An input is matched by a filter if any of its positive + * terms match the input (or it has no positive terms) AND none of its negative terms match the + * input (or it has no negative terms). *

* Examples of filters include: *

*

    - *
  • ""
    + *
  • + * + *
    + * ""
    + * 
    + * * Matches any scope.
  • - *
  • "*"
    + *
  • + * + *
    + * "*"
    + * 
    + * * Matches any scope.
  • - *
  • "CodeGen,CodeInstall"
    + *
  • + * + *
    + * "CodeGen,CodeInstall"
    + * 
    + * * Matches a scope whose name contains "CodeGen" or "CodeInstall".
  • - *
  • "Code*"
    + *
  • + * + *
    + * "Code*"
    + * 
    + * * Matches a scope whose name starts with "Code".
  • - *
  • "Code,~Dead"
    + *
  • + * + *
    + * "Code,˜Dead"
    + * 
    + * * Matches a scope whose name contains "Code" but does not contain "Dead".
  • *
*/ @@ -109,9 +132,9 @@ } } } -// if (match) { -// System.out.println(this + " matches " + input); -// } + // if (match) { + // System.out.println(this + " matches " + input); + // } return match; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Jan 23 16:34:57 2013 +0100 @@ -68,8 +68,7 @@ this.backend = backend; } - public CompilationResult compileMethod(final ResolvedJavaMethod method, final StructuredGraph graph, final GraphCache cache, final PhasePlan plan, - final OptimisticOptimizations optimisticOpts) { + public CompilationResult compileMethod(final ResolvedJavaMethod method, final StructuredGraph graph, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts) { assert (method.getModifiers() & Modifier.NATIVE) == 0 : "compiling native methods is not supported"; return Debug.scope("GraalCompiler", new Object[]{graph, method, this}, new Callable() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/MethodFilter.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/MethodFilter.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/MethodFilter.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,31 +28,58 @@ import com.oracle.graal.api.meta.*; /** - * This class implements a method filter that can filter based on class name, method name and parameters. - * The syntax for the source pattern that is passed to the constructor is as follows: - * + * This class implements a method filter that can filter based on class name, method name and + * parameters. The syntax for the source pattern that is passed to the constructor is as follows: + * *
  * SourcePattern = [ Class "." ] method [ "(" [ Parameter { ";" Parameter } ] ")" ] .
  * Parameter = Class | "int" | "long" | "float" | "double" | "short" | "char" | "boolean" .
  * Class = { package "." } class .
  * 
- * - * - * Glob pattern matching (*, ?) is allowed in all parts of the source pattern. Examples for valid filters are: - * + * + * + * Glob pattern matching (*, ?) is allowed in all parts of the source pattern. Examples for valid + * filters are: + * *
    - *
  • visit(Argument;BlockScope)
    - * Matches all methods named "visit", with the first parameter of type "Argument", and the second parameter of type "BlockScope". - * The packages of the parameter types are irrelevant.
  • - *
  • arraycopy(Object;;;;)
    - * Matches all methods named "arraycopy", with the first parameter of type "Object", and four more parameters of any type. - * The packages of the parameter types are irrelevant.
  • - *
  • com.oracle.graal.compiler.graph.PostOrderNodeIterator.*
    + *
  • + * + *
    + * visit(Argument;BlockScope)
    + * 
    + * + * Matches all methods named "visit", with the first parameter of type "Argument", and the second + * parameter of type "BlockScope". The packages of the parameter types are irrelevant.
  • + *
  • + * + *
    + * arraycopy(Object;;;;)
    + * 
    + * + * Matches all methods named "arraycopy", with the first parameter of type "Object", and four more + * parameters of any type. The packages of the parameter types are irrelevant.
  • + *
  • + * + *
    + * com.oracle.graal.compiler.graph.PostOrderNodeIterator.*
    + * 
    + * * Matches all methods in the class "com.oracle.graal.compiler.graph.PostOrderNodeIterator".
  • - *
  • *
    + *
  • + * + *
    + * *
    + * 
    + * * Matches all methods in all classes
  • - *
  • com.oracle.graal.compiler.graph.*.visit
    - * Matches all methods named "visit" in classes in the package "com.oracle.graal.compiler.graph".
+ *
  • + * + *
    + * com.oracle.graal.compiler.graph.*.visit
    + * 
    + * + * Matches all methods named "visit" in classes in the package + * "com.oracle.graal.compiler.graph".
  • * */ public class MethodFilter { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java Wed Jan 23 16:34:57 2013 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.compiler.alloc; - import java.util.*; import com.oracle.graal.api.code.*; @@ -45,8 +44,10 @@ * A pair of intervals. */ static final class Pair { + public final Interval first; public final Interval second; + public Pair(Interval first, Interval second) { this.first = first; this.second = second; @@ -75,7 +76,7 @@ /** * Gets the list for a specified binding. - * + * * @param binding specifies the list to be returned * @return the list of intervals whose binding is {@code binding} */ @@ -89,7 +90,7 @@ /** * Sets the list for a specified binding. - * + * * @param binding specifies the list to be replaced * @param list a list of intervals whose binding is {@code binding} */ @@ -104,8 +105,9 @@ } /** - * Adds an interval to a list sorted by {@linkplain Interval#currentFrom() current from} positions. - * + * Adds an interval to a list sorted by {@linkplain Interval#currentFrom() current from} + * positions. + * * @param binding specifies the list to be updated * @param interval the interval to add */ @@ -132,7 +134,7 @@ /** * Adds an interval to a list sorted by {@linkplain Interval#from() start} positions and * {@linkplain Interval#firstUsage(RegisterPriority) first usage} positions. - * + * * @param binding specifies the list to be updated * @param interval the interval to add */ @@ -155,7 +157,7 @@ /** * Removes an interval from a list. - * + * * @param binding specifies the list to be updated * @param i the interval to remove */ @@ -177,10 +179,9 @@ } /** - * Constants denoting the register usage priority for an interval. - * The constants are declared in increasing order of priority are - * are used to optimize spilling when multiple overlapping intervals - * compete for limited registers. + * Constants denoting the register usage priority for an interval. The constants are declared in + * increasing order of priority are are used to optimize spilling when multiple overlapping + * intervals compete for limited registers. */ enum RegisterPriority { /** @@ -221,8 +222,8 @@ } /** - * Constants denoting whether an interval is bound to a specific register. This models - * platform dependencies on register usage for certain instructions. + * Constants denoting whether an interval is bound to a specific register. This models platform + * dependencies on register usage for certain instructions. */ enum RegisterBinding { /** @@ -249,7 +250,8 @@ Unhandled, /** - * An interval that {@linkplain Interval#covers covers} {@code position} and has an assigned register. + * An interval that {@linkplain Interval#covers covers} {@code position} and has an assigned + * register. */ Active, @@ -276,8 +278,8 @@ /** * One definition has already been found. Two consecutive definitions are treated as one - * (e.g. a consecutive move and add because of two-operand LIR form). - * The position of this definition is given by {@link Interval#spillDefinitionPos()}. + * (e.g. a consecutive move and add because of two-operand LIR form). The position of this + * definition is given by {@link Interval#spillDefinitionPos()}. */ NoSpillStore, @@ -287,8 +289,8 @@ OneSpillStore, /** - * The interval should be stored immediately after its definition to prevent - * multiple redundant stores. + * The interval should be stored immediately after its definition to prevent multiple + * redundant stores. */ StoreAtDefinition, @@ -298,24 +300,25 @@ StartInMemory, /** - * The interval has more than one definition (e.g. resulting from phi moves), so stores - * to memory are not optimized. + * The interval has more than one definition (e.g. resulting from phi moves), so stores to + * memory are not optimized. */ NoOptimization } /** - * List of use positions. Each entry in the list records the use position and register - * priority associated with the use position. The entries in the list are in descending - * order of use position. - * + * List of use positions. Each entry in the list records the use position and register priority + * associated with the use position. The entries in the list are in descending order of use + * position. + * */ public static final class UsePosList { + private IntList list; /** * Creates a use list. - * + * * @param initialCapacity the initial capacity of the list in terms of entries */ public UsePosList(int initialCapacity) { @@ -327,12 +330,13 @@ } /** - * Splits this list around a given position. All entries in this list with a use position greater or equal than - * {@code splitPos} are removed from this list and added to the returned list. - * + * Splits this list around a given position. All entries in this list with a use position + * greater or equal than {@code splitPos} are removed from this list and added to the + * returned list. + * * @param splitPos the position for the split - * @return a use position list containing all entries removed from this list that have a use position greater or equal - * than {@code splitPos} + * @return a use position list containing all entries removed from this list that have a use + * position greater or equal than {@code splitPos} */ public UsePosList splitAt(int splitPos) { int i = size() - 1; @@ -351,7 +355,7 @@ /** * Gets the use position at a specified index in this list. - * + * * @param index the index of the entry for which the use position is returned * @return the use position of entry {@code index} in this list */ @@ -361,7 +365,7 @@ /** * Gets the register priority for the use position at a specified index in this list. - * + * * @param index the index of the entry for which the register priority is returned * @return the register priority of entry {@code index} in this list */ @@ -402,7 +406,8 @@ } /** - * The {@linkplain RegisterValue register} or {@linkplain Variable variable} for this interval prior to register allocation. + * The {@linkplain RegisterValue register} or {@linkplain Variable variable} for this interval + * prior to register allocation. */ public final Value operand; @@ -412,7 +417,8 @@ public final int operandNumber; /** - * The {@linkplain RegisterValue register}, {@linkplain StackSlot spill slot} or {@linkplain Address address} assigned to this interval. + * The {@linkplain RegisterValue register}, {@linkplain StackSlot spill slot} or + * {@linkplain Address address} assigned to this interval. */ private Value location; @@ -427,7 +433,8 @@ private Kind kind; /** - * The head of the list of ranges describing this interval. This list is sorted by {@linkplain LIRInstruction#id instruction ids}. + * The head of the list of ranges describing this interval. This list is sorted by + * {@linkplain LIRInstruction#id instruction ids}. */ private Range first; @@ -454,12 +461,14 @@ private int cachedTo; // cached value: to of last range (-1: not cached) /** - * The interval from which this one is derived. If this is a {@linkplain #isSplitParent() split parent}, it points to itself. + * The interval from which this one is derived. If this is a {@linkplain #isSplitParent() split + * parent}, it points to itself. */ private Interval splitParent; /** - * List of all intervals that are split off from this interval. This is only used if this is a {@linkplain #isSplitParent() split parent}. + * List of all intervals that are split off from this interval. This is only used if this is a + * {@linkplain #isSplitParent() split parent}. */ private List splitChildren = Collections.emptyList(); @@ -469,7 +478,8 @@ private Interval currentSplitChild; /** - * Specifies if move is inserted between currentSplitChild and this interval when interval gets active the first time. + * Specifies if move is inserted between currentSplitChild and this interval when interval gets + * active the first time. */ private boolean insertMoveWhenActivated; @@ -505,7 +515,8 @@ } /** - * Gets the {@linkplain RegisterValue register}, {@linkplain StackSlot spill slot} or {@linkplain Address address} assigned to this interval. + * Gets the {@linkplain RegisterValue register}, {@linkplain StackSlot spill slot} or + * {@linkplain Address address} assigned to this interval. */ public Value location() { return location; @@ -702,7 +713,7 @@ Interval i1 = splitChildren.get(i); assert i1.splitParent() == this : "not a split child of this interval"; - assert i1.kind() == kind() : "must be equal for all split children"; + assert i1.kind() == kind() : "must be equal for all split children"; assert i1.spillSlot() == spillSlot() : "must be equal for all split children"; for (int j = i + 1; j < splitChildren.size(); j++) { @@ -768,7 +779,8 @@ Interval cur = splitChildren.get(i); if (cur.from() <= opId && opId < cur.to() + toOffset) { if (i > 0) { - // exchange current split child to start of list (faster access for next call) + // exchange current split child to start of list (faster access for next + // call) Util.atPutGrow(splitChildren, i, splitChildren.get(0), null); Util.atPutGrow(splitChildren, 0, cur, null); } @@ -971,15 +983,15 @@ } /** - * Splits this interval at a specified position and returns the remainder as a new child interval - * of this interval's {@linkplain #splitParent() parent} interval. + * Splits this interval at a specified position and returns the remainder as a new child + * interval of this interval's {@linkplain #splitParent() parent} interval. *

    - * When an interval is split, a bi-directional link is established between the original parent - * interval and the children intervals that are split off this interval. - * When a split child is split again, the new created interval is a direct child - * of the original parent. That is, there is no tree of split children stored, just a flat list. - * All split children are spilled to the same {@linkplain #spillSlot spill slot}. - * + * When an interval is split, a bi-directional link is established between the original + * parent interval and the children intervals that are split off this interval. + * When a split child is split again, the new created interval is a direct child of the original + * parent. That is, there is no tree of split children stored, just a flat list. All split + * children are spilled to the same {@linkplain #spillSlot spill slot}. + * * @param splitPos the position at which to split this interval * @param allocator the register allocator context * @return the child interval split off from this interval @@ -1027,10 +1039,11 @@ } /** - * Splits this interval at a specified position and returns - * the head as a new interval (this interval is the tail). - * - * Currently, only the first range can be split, and the new interval must not have split positions + * Splits this interval at a specified position and returns the head as a new interval (this + * interval is the tail). + * + * Currently, only the first range can be split, and the new interval must not have split + * positions */ Interval splitFromStart(int splitPos, LinearScan allocator) { assert isVariable(operand) : "cannot split fixed intervals"; @@ -1128,7 +1141,7 @@ /** * Gets a single line string for logging the details of this interval to a log stream. - * + * * @param allocator the register allocator context */ public String logString(LinearScan allocator) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/IntervalWalker.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/IntervalWalker.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/IntervalWalker.java Wed Jan 23 16:34:57 2013 +0100 @@ -66,9 +66,11 @@ /** * Processes the {@linkplain #currentInterval} interval in an attempt to allocate a physical - * register to it and thus allow it to be moved to a list of {@linkplain #activeLists active} intervals. - * - * @return {@code true} if a register was allocated to the {@linkplain #currentInterval} interval + * register to it and thus allow it to be moved to a list of {@linkplain #activeLists active} + * intervals. + * + * @return {@code true} if a register was allocated to the {@linkplain #currentInterval} + * interval */ boolean activateCurrent() { return true; @@ -84,10 +86,12 @@ /** * Creates a new interval walker. - * + * * @param allocator the register allocator context - * @param unhandledFixed the list of unhandled {@linkplain RegisterBinding#Fixed fixed} intervals - * @param unhandledAny the list of unhandled {@linkplain RegisterBinding#Any non-fixed} intervals + * @param unhandledFixed the list of unhandled {@linkplain RegisterBinding#Fixed fixed} + * intervals + * @param unhandledAny the list of unhandled {@linkplain RegisterBinding#Any non-fixed} + * intervals */ IntervalWalker(LinearScan allocator, Interval unhandledFixed, Interval unhandledAny) { this.allocator = allocator; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Wed Jan 23 16:34:57 2013 +0100 @@ -48,9 +48,10 @@ import com.oracle.graal.phases.util.*; /** - * An implementation of the linear scan register allocator algorithm described - * in "Optimized Interval Splitting in a Linear Scan Register Allocator" - * by Christian Wimmer and Hanspeter Moessenboeck. + * An implementation of the linear scan register allocator algorithm described in "Optimized Interval Splitting in a Linear Scan Register Allocator" by Christian Wimmer and + * Hanspeter Moessenboeck. */ public final class LinearScan { @@ -65,32 +66,33 @@ private static final int INITIAL_SPLIT_INTERVALS_CAPACITY = 32; public static class BlockData { + /** - * Bit map specifying which operands are live upon entry to this block. - * These are values used in this block or any of its successors where such value are not defined - * in this block. - * The bit index of an operand is its {@linkplain LinearScan#operandNumber(Value) operand number}. + * Bit map specifying which operands are live upon entry to this block. These are values + * used in this block or any of its successors where such value are not defined in this + * block. The bit index of an operand is its {@linkplain LinearScan#operandNumber(Value) + * operand number}. */ public BitSet liveIn; /** - * Bit map specifying which operands are live upon exit from this block. - * These are values used in a successor block that are either defined in this block or were live - * upon entry to this block. - * The bit index of an operand is its {@linkplain LinearScan#operandNumber(Value) operand number}. + * Bit map specifying which operands are live upon exit from this block. These are values + * used in a successor block that are either defined in this block or were live upon entry + * to this block. The bit index of an operand is its + * {@linkplain LinearScan#operandNumber(Value) operand number}. */ public BitSet liveOut; /** - * Bit map specifying which operands are used (before being defined) in this block. - * That is, these are the values that are live upon entry to the block. - * The bit index of an operand is its {@linkplain LinearScan#operandNumber(Value) operand number}. + * Bit map specifying which operands are used (before being defined) in this block. That is, + * these are the values that are live upon entry to the block. The bit index of an operand + * is its {@linkplain LinearScan#operandNumber(Value) operand number}. */ public BitSet liveGen; /** - * Bit map specifying which operands are defined/overwritten in this block. - * The bit index of an operand is its {@linkplain LinearScan#operandNumber(Value) operand number}. + * Bit map specifying which operands are defined/overwritten in this block. The bit index of + * an operand is its {@linkplain LinearScan#operandNumber(Value) operand number}. */ public BitSet liveKill; } @@ -113,7 +115,8 @@ int intervalsSize; /** - * The index of the first entry in {@link #intervals} for a {@linkplain #createDerivedInterval(Interval) derived interval}. + * The index of the first entry in {@link #intervals} for a + * {@linkplain #createDerivedInterval(Interval) derived interval}. */ int firstDerivedIntervalIndex = -1; @@ -123,16 +126,16 @@ Interval[] sortedIntervals; /** - * Map from an instruction {@linkplain LIRInstruction#id id} to the instruction. - * Entries should be retrieved with {@link #instructionForId(int)} as the id is - * not simply an index into this array. + * Map from an instruction {@linkplain LIRInstruction#id id} to the instruction. Entries should + * be retrieved with {@link #instructionForId(int)} as the id is not simply an index into this + * array. */ LIRInstruction[] opIdToInstructionMap; /** - * Map from an instruction {@linkplain LIRInstruction#id id} to the {@linkplain - * Block 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 Block block} + * containing the instruction. Entries should be retrieved with {@link #blockForId(int)} as the + * id is not simply an index into this array. */ Block[] opIdToBlockMap; @@ -153,7 +156,6 @@ */ private final int firstVariableNumber; - public LinearScan(TargetDescription target, ResolvedJavaMethod method, LIR ir, LIRGenerator gen, FrameMap frameMap) { this.target = target; this.method = method; @@ -186,11 +188,10 @@ return isVariable(value) || isRegister(value); } - /** - * Converts an operand (variable or register) to an index in a flat address space covering all the - * {@linkplain Variable variables} and {@linkplain RegisterValue registers} being processed by this - * allocator. + * Converts an operand (variable or register) to an index in a flat address space covering all + * the {@linkplain Variable variables} and {@linkplain RegisterValue registers} being processed + * by this allocator. */ private int operandNumber(Value operand) { if (isRegister(operand)) { @@ -230,8 +231,8 @@ return firstVariableNumber - 1; } + static final IntervalPredicate IS_PRECOLORED_INTERVAL = new IntervalPredicate() { - static final IntervalPredicate IS_PRECOLORED_INTERVAL = new IntervalPredicate() { @Override public boolean apply(Interval i) { return isRegister(i.operand); @@ -239,6 +240,7 @@ }; static final IntervalPredicate IS_VARIABLE_INTERVAL = new IntervalPredicate() { + @Override public boolean apply(Interval i) { return isVariable(i.operand); @@ -246,14 +248,16 @@ }; static final IntervalPredicate IS_OOP_INTERVAL = new IntervalPredicate() { + @Override public boolean apply(Interval i) { - return !isRegister(i.operand) && i.kind() == Kind.Object; + return !isRegister(i.operand) && i.kind() == Kind.Object; } }; /** - * Gets an object describing the attributes of a given register according to this register configuration. + * Gets an object describing the attributes of a given register according to this register + * configuration. */ RegisterAttributes attributes(Register reg) { return registerAttributes[reg.number]; @@ -273,7 +277,7 @@ /** * Creates a new interval. - * + * * @param operand the operand for the interval * @return the created interval */ @@ -290,7 +294,7 @@ /** * Creates an interval as a result of splitting or spilling another interval. - * + * * @param source an interval being split of spilled * @return a new interval derived from {@code source} */ @@ -321,9 +325,9 @@ } /** - * Gets the size of the {@link BlockData#liveIn} and {@link BlockData#liveOut} sets for a basic block. These sets do - * not include any operands allocated as a result of creating {@linkplain #createDerivedInterval(Interval) derived - * intervals}. + * Gets the size of the {@link BlockData#liveIn} and {@link BlockData#liveOut} sets for a basic + * block. These sets do not include any operands allocated as a result of creating + * {@linkplain #createDerivedInterval(Interval) derived intervals}. */ int liveSetSize() { return firstDerivedIntervalIndex == -1 ? operandSize() : firstDerivedIntervalIndex; @@ -352,8 +356,8 @@ } /** - * Converts an {@linkplain LIRInstruction#id instruction id} to an instruction index. - * All LIR instructions in a method have an index one greater than their linear-scan order predecesor + * Converts an {@linkplain LIRInstruction#id instruction id} to an instruction index. All LIR + * instructions in a method have an index one greater than their linear-scan order predecesor * with the first instruction having an index of 0. */ static int opIdToIndex(int opId) { @@ -362,7 +366,7 @@ /** * Retrieves the {@link LIRInstruction} based on its {@linkplain LIRInstruction#id id}. - * + * * @param opId an instruction {@linkplain LIRInstruction#id id} * @return the instruction whose {@linkplain LIRInstruction#id} {@code == id} */ @@ -375,7 +379,7 @@ /** * Gets the block containing a given instruction. - * + * * @param opId an instruction {@linkplain LIRInstruction#id id} * @return the block containing the instruction denoted by {@code opId} */ @@ -394,9 +398,10 @@ /** * Determines if an {@link LIRInstruction} destroys all caller saved registers. - * + * * @param opId an instruction {@linkplain LIRInstruction#id id} - * @return {@code true} if the instruction denoted by {@code id} destroys all caller saved registers. + * @return {@code true} if the instruction denoted by {@code id} destroys all caller saved + * registers. */ boolean hasCall(int opId) { assert isEven(opId) : "opId not even"; @@ -476,10 +481,12 @@ } abstract static class IntervalPredicate { + abstract boolean apply(Interval i); } private static final IntervalPredicate mustStoreAtDefinition = new IntervalPredicate() { + @Override public boolean apply(Interval i) { return i.isSplitParent() && i.spillState() == SpillState.StoreAtDefinition; @@ -512,14 +519,16 @@ if (opId == -1) { MoveOp move = (MoveOp) op; - // remove move from register to stack if the stack slot is guaranteed to be correct. + // remove move from register to stack if the stack slot is guaranteed to be + // correct. // only moves that have been inserted by LinearScan can be removed. assert isVariable(move.getResult()) : "LinearScan inserts only moves to variables"; Interval curInterval = intervalFor(move.getResult()); if (!isRegister(curInterval.location()) && curInterval.alwaysInMemory()) { - // move target is a stack slot that is always correct, so eliminate instruction + // move target is a stack slot that is always correct, so eliminate + // instruction if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("eliminating move from interval %d to %d", operandNumber(move.getInput()), operandNumber(move.getResult())); } @@ -533,7 +542,8 @@ while (interval != Interval.EndMarker && interval.spillDefinitionPos() == opId) { if (!insertionBuffer.initialized()) { - // prepare insertion buffer (appended when all instructions of the block are processed) + // prepare insertion buffer (appended when all instructions of the block + // are processed) insertionBuffer.init(instructions); } @@ -547,8 +557,7 @@ if (GraalOptions.TraceLinearScanLevel >= 4) { StackSlot slot = interval.spillSlot(); - TTY.println("inserting move after definition of interval %d to stack slot %s at opId %d", - interval.operandNumber, slot, opId); + TTY.println("inserting move after definition of interval %d to stack slot %s at opId %d", interval.operandNumber, slot, opId); } interval = interval.next; @@ -588,10 +597,12 @@ } /** - * Numbers all instructions in all blocks. The numbering follows the {@linkplain ComputeBlockOrder linear scan order}. + * Numbers all instructions in all blocks. The numbering follows the + * {@linkplain ComputeBlockOrder linear scan order}. */ void numberInstructions() { ValueProcedure setVariableProc = new ValueProcedure() { + @Override public Value doValue(Value value) { if (isVariable(value)) { @@ -650,7 +661,8 @@ } /** - * Computes local live sets (i.e. {@link BlockData#liveGen} and {@link BlockData#liveKill}) separately for each block. + * Computes local live sets (i.e. {@link BlockData#liveGen} and {@link BlockData#liveKill}) + * separately for each block. */ void computeLocalLiveSets() { int liveSize = liveSetSize(); @@ -671,6 +683,7 @@ final LIRInstruction op = instructions.get(j); ValueProcedure useProc = new ValueProcedure() { + @Override protected Value doValue(Value operand) { if (isVariable(operand)) { @@ -693,6 +706,7 @@ } }; ValueProcedure stateProc = new ValueProcedure() { + @Override public Value doValue(Value operand) { int operandNum = operandNumber(operand); @@ -706,6 +720,7 @@ } }; ValueProcedure defProc = new ValueProcedure() { + @Override public Value doValue(Value operand) { if (isVariable(operand)) { @@ -728,7 +743,8 @@ op.forEachInput(useProc); op.forEachAlive(useProc); - // Add uses of live locals from interpreter's point of view for proper debug information generation + // Add uses of live locals from interpreter's point of view for proper debug + // information generation op.forEachState(stateProc); op.forEachTemp(defProc); op.forEachOutput(defProc); @@ -771,8 +787,8 @@ } /** - * Performs a backward dataflow analysis to compute global live sets (i.e. {@link BlockData#liveIn} and - * {@link BlockData#liveOut}) for each block. + * Performs a backward dataflow analysis to compute global live sets (i.e. + * {@link BlockData#liveIn} and {@link BlockData#liveOut}) for each block. */ void computeGlobalLiveSets() { int numBlocks = blockCount(); @@ -817,8 +833,10 @@ } if (iterationCount == 0 || changeOccurredInBlock) { - // liveIn(block) is the union of liveGen(block) with (liveOut(block) & !liveKill(block)) - // note: liveIn has to be computed only in first iteration or if liveOut has changed! + // liveIn(block) is the union of liveGen(block) with (liveOut(block) & + // !liveKill(block)) + // note: liveIn has to be computed only in first iteration or if liveOut has + // changed! BitSet liveIn = blockData.get(block).liveIn; liveIn.clear(); liveIn.or(blockData.get(block).liveOut); @@ -863,7 +881,6 @@ TTY.print("affected registers:"); TTY.println(blockData.get(ir.cfg.getStartBlock()).liveIn.toString()); - // print some additional information to simplify debugging for (int operandNum = 0; operandNum < blockData.get(ir.cfg.getStartBlock()).liveIn.size(); operandNum++) { if (blockData.get(ir.cfg.getStartBlock()).liveIn.get(operandNum)) { @@ -879,6 +896,7 @@ for (LIRInstruction ins : ir.lir(block)) { TTY.println(ins.id() + ": " + ins.toString()); ins.forEachState(new ValueProcedure() { + @Override public Value doValue(Value liveStateOperand) { TTY.println(" operand=" + liveStateOperand); @@ -1060,7 +1078,8 @@ } /** - * Determines the priority which with an instruction's input operand will be allocated a register. + * Determines the priority which with an instruction's input operand will be allocated a + * register. */ static RegisterPriority registerPriorityOfInputOperand(EnumSet flags) { if (flags.contains(OperandFlag.STACK)) { @@ -1071,10 +1090,8 @@ } /** - * Optimizes moves related to incoming stack based arguments. - * The interval for the destination of such moves is assigned - * the stack slot (which is in the caller's frame) as its - * spill slot. + * Optimizes moves related to incoming stack based arguments. The interval for the destination + * of such moves is assigned the stack slot (which is in the caller's frame) as its spill slot. */ void handleMethodArguments(LIRInstruction op) { if (op instanceof MoveOp) { @@ -1102,6 +1119,7 @@ if (flags.contains(OperandFlag.HINT) && isVariableOrRegister(targetValue)) { op.forEachRegisterHint(targetValue, mode, new ValueProcedure() { + @Override protected Value doValue(Value registerHint) { if (isVariableOrRegister(registerHint)) { @@ -1179,6 +1197,7 @@ } op.forEachOutput(new ValueProcedure() { + @Override public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { @@ -1189,6 +1208,7 @@ } }); op.forEachTemp(new ValueProcedure() { + @Override public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { @@ -1199,6 +1219,7 @@ } }); op.forEachAlive(new ValueProcedure() { + @Override public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { @@ -1210,6 +1231,7 @@ } }); op.forEachInput(new ValueProcedure() { + @Override public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { @@ -1226,6 +1248,7 @@ // Treat these operands as temp values (if the live range is extended // to a call site, the value would be in a register at the call otherwise) op.forEachState(new ValueProcedure() { + @Override public Value doValue(Value operand) { addUse(operand, blockFrom, opId + 1, RegisterPriority.None, operand.getKind().getStackKind()); @@ -1537,7 +1560,8 @@ } blockCompleted.set(block.getLinearScanNumber()); - // directly resolve between pred and sux (without looking at the empty block between) + // directly resolve between pred and sux (without looking at the empty block + // between) resolveCollectMappings(pred, sux, moveResolver); if (moveResolver.hasMappings()) { moveResolver.setInsertPosition(instructions, 1); @@ -1555,7 +1579,8 @@ for (Block toBlock : fromBlock.getSuccessors()) { - // check for duplicate edges between the same blocks (can happen with switch blocks) + // check for duplicate edges between the same blocks (can happen with switch + // blocks) if (!alreadyResolved.get(toBlock.getLinearScanNumber())) { if (GraalOptions.TraceLinearScanLevel >= 3) { TTY.println(" processing edge between B%d and B%d", fromBlock.getId(), toBlock.getId()); @@ -1584,7 +1609,7 @@ /** * Assigns the allocated location for an LIR instruction operand back into the instruction. - * + * * @param operand an LIR instruction operand * @param opId the id of the LIR instruction using {@code operand} * @param mode the usage mode for {@code operand} by the instruction @@ -1599,7 +1624,8 @@ Block 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 would + // before the branch instruction. So the split child information for this branch + // would // be incorrect. LIRInstruction instr = ir.lir(block).get(ir.lir(block).size() - 1); if (instr instanceof StandardOp.JumpOp) { @@ -1664,7 +1690,8 @@ frameMap.setReference(interval.location(), registerRefMap, frameRefMap); // Spill optimization: when the stack value is guaranteed to be always correct, - // then it must be added to the oop map even if the interval is currently in a register + // then it must be added to the oop map even if the interval is currently in a + // register if (interval.alwaysInMemory() && op.id() > interval.spillDefinitionPos() && !interval.location().equals(interval.spillSlot())) { assert interval.spillDefinitionPos() > 0 : "position not set correctly"; assert interval.spillSlot() != null : "no spill slot assigned"; @@ -1679,13 +1706,13 @@ return attributes(asRegister(operand)).isCallerSave(); } - private void computeDebugInfo(IntervalWalker iw, final LIRInstruction op, LIRFrameState info) { BitSet registerRefMap = op.hasCall() ? null : frameMap.initRegisterRefMap(); BitSet frameRefMap = frameMap.initFrameRefMap(); computeOopMap(iw, op, registerRefMap, frameRefMap); info.forEachState(new ValueProcedure() { + @Override public Value doValue(Value operand) { int tempOpId = op.id(); @@ -1694,7 +1721,8 @@ 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 - // and so the wrong operand would be returned (spill moves at block boundaries are not + // and so the wrong operand would be returned (spill moves at block boundaries + // are not // considered in the live ranges of intervals) // Solution: use the first opId of the branch target block instead. final LIRInstruction instr = ir.lir(block).get(ir.lir(block).size() - 1); @@ -1707,7 +1735,8 @@ } // Get current location of operand - // The operand must be live because debug information is considered when building the intervals + // The operand must be live because debug information is considered when building + // the intervals // if the interval is not live, colorLirOperand will cause an assert on failure Value result = colorLirOperand((Variable) operand, tempOpId, mode); assert !hasCall(tempOpId) || isStackSlot(result) || !isCallerSave(result) : "cannot have caller-save register operands at calls"; @@ -1730,6 +1759,7 @@ } ValueProcedure assignProc = new ValueProcedure() { + @Override public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (isVariable(operand)) { @@ -1746,6 +1776,7 @@ // compute reference map and debug information op.forEachState(new StateProcedure() { + @Override protected void doState(LIRFrameState state) { computeDebugInfo(iw, op, state); @@ -1798,6 +1829,7 @@ }); Debug.scope("ResolveDataFlow", new Runnable() { + public void run() { resolveDataFlow(); } @@ -1862,7 +1894,8 @@ Debug.dump(Arrays.copyOf(intervals, intervalsSize), label); } - void printLir(String label, @SuppressWarnings("unused") boolean hirValid) { + void printLir(String label, @SuppressWarnings("unused") + boolean hirValid) { Debug.dump(ir, label); } @@ -1876,7 +1909,7 @@ if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println(" verifying that no oops are in fixed intervals *"); } - //verifyNoOopsInFixedIntervals(); + // verifyNoOopsInFixedIntervals(); if (GraalOptions.TraceLinearScanLevel >= 2) { TTY.println(" verifying that unpinned constants are not alive across block boundaries"); @@ -1917,7 +1950,7 @@ throw new GraalInternalError(""); } - if (isVariable(i1.operand) && i1.kind() == Kind.Illegal) { + if (isVariable(i1.operand) && i1.kind() == Kind.Illegal) { TTY.println("Interval %d has no type assigned", i1.operandNumber); TTY.println(i1.logString(this)); throw new GraalInternalError(""); @@ -1978,6 +2011,7 @@ } class CheckProcedure extends ValueProcedure { + boolean ok; Interval curInterval; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java Wed Jan 23 16:34:57 2013 +0100 @@ -57,7 +57,6 @@ private MoveResolver moveResolver; // for ordering spill moves - // accessors mapped to same functions in class LinearScan int blockCount() { return allocator.blockCount(); @@ -74,7 +73,8 @@ LinearScanWalker(LinearScan allocator, Interval unhandledFixedFirst, Interval unhandledAnyFirst) { super(allocator, unhandledFixedFirst, unhandledAnyFirst); - // If all allocatable registers are caller saved, then no registers are live across a call site. + // If all allocatable registers are caller saved, then no registers are live across a call + // site. // The register allocator can save time not trying to find a register at a call site. HashSet registers = new HashSet<>(Arrays.asList(allocator.frameMap.registerConfig.getAllocatableRegisters())); registers.removeAll(Arrays.asList(allocator.frameMap.registerConfig.getCallerSaveRegisters())); @@ -309,7 +309,8 @@ // reason for using minSplitPos - 1: when the minimal split pos is exactly at the // beginning of a block, then minSplitPos is also a possible split position. - // Use the block before as minBlock, because then minBlock.lastLirInstructionId() + 2 == minSplitPos + // Use the block before as minBlock, because then minBlock.lastLirInstructionId() + 2 == + // minSplitPos Block minBlock = allocator.blockForId(minSplitPos - 1); // reason for using maxSplitPos - 1: otherwise there would be an assert on failure @@ -330,7 +331,8 @@ if (interval.hasHoleBetween(maxSplitPos - 1, maxSplitPos) && !allocator.isBlockBegin(maxSplitPos)) { // Do not move split position if the interval has a hole before maxSplitPos. // Intervals resulting from Phi-Functions have more than one definition (marked - // as mustHaveRegister) with a hole before each definition. When the register is needed + // as mustHaveRegister) with a hole before each definition. When the register is + // needed // for the second definition : an earlier reloading is unnecessary. if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" interval has hole just before maxSplitPos, so splitting at maxSplitPos"); @@ -344,7 +346,8 @@ } if (doLoopOptimization) { - // Loop optimization: if a loop-end marker is found between min- and max-position : + // Loop optimization: if a loop-end marker is found between min- and + // max-position : // then split before this loop int loopEndPos = interval.nextUsageExact(RegisterPriority.LiveAtLoopEnd, allocator.getLastLirInstructionId(minBlock) + 2); if (GraalOptions.TraceLinearScanLevel >= 4) { @@ -354,14 +357,17 @@ assert loopEndPos > minSplitPos : "invalid order"; if (loopEndPos < maxSplitPos) { // loop-end marker found between min- and max-position - // if it is not the end marker for the same loop as the min-position : then move + // if it is not the end marker for the same loop as the min-position : + // then move // the max-position to this loop block. - // Desired result: uses tagged as shouldHaveRegister inside a loop cause a reloading + // Desired result: uses tagged as shouldHaveRegister inside a loop cause + // a reloading // of the interval (normally, only mustHaveRegister causes a reloading) Block loopBlock = allocator.blockForId(loopEndPos); if (GraalOptions.TraceLinearScanLevel >= 4) { - TTY.println(" interval is used in loop that ends in block B%d, so trying to move maxBlock back from B%d to B%d", loopBlock.getId(), maxBlock.getId(), loopBlock.getId()); + TTY.println(" interval is used in loop that ends in block B%d, so trying to move maxBlock back from B%d to B%d", loopBlock.getId(), maxBlock.getId(), + loopBlock.getId()); } assert loopBlock != minBlock : "loopBlock and minBlock must be different because block boundary is needed between"; @@ -428,7 +434,8 @@ return; } - // must calculate this before the actual split is performed and before split position is moved to odd opId + // must calculate this before the actual split is performed and before split position is + // moved to odd opId boolean moveNecessary = !allocator.isBlockBegin(optimalSplitPos) && !interval.hasHoleBetween(optimalSplitPos - 1, optimalSplitPos); if (!allocator.isBlockBegin(optimalSplitPos)) { @@ -460,10 +467,10 @@ } } -// split an interval at the optimal position between minSplitPos and -// maxSplitPos in two parts: -// 1) the left part has already a location assigned -// 2) the right part is always on the stack and therefore ignored in further processing + // split an interval at the optimal position between minSplitPos and + // maxSplitPos in two parts: + // 1) the left part has already a location assigned + // 2) the right part is always on the stack and therefore ignored in further processing void splitForSpilling(Interval interval) { // calculate allowed range of splitting position @@ -508,7 +515,8 @@ } allocator.assignSpillSlot(parent); } else { - // do not go further back because the register is actually used by the interval + // do not go further back because the register is actually used by the + // interval parent = null; } } @@ -611,7 +619,8 @@ // usePos contains the start of the next interval that has this register assigned // (either as a fixed register or a normal allocated register in the past) - // only intervals overlapping with cur are processed, non-overlapping invervals can be ignored safely + // only intervals overlapping with cur are processed, non-overlapping invervals can be + // ignored safely if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" state of registers:"); for (Register register : availableRegs) { @@ -701,7 +710,7 @@ // collect current usage of registers initUseLists(false); spillExcludeActiveFixed(); - // spillBlockUnhandledFixed(cur); + // spillBlockUnhandledFixed(cur); assert unhandledLists.get(RegisterBinding.Fixed) == Interval.EndMarker : "must not have unhandled fixed intervals because all fixed intervals have a use at position 0"; spillBlockInactiveFixed(interval); spillCollectActiveAny(); @@ -767,7 +776,7 @@ interval.assignLocation(reg.asValue(interval.kind())); if (needSplit) { - // register not available for full interval : so split it + // register not available for full interval : so split it splitWhenPartialRegisterAvailable(interval, splitPos); } @@ -860,7 +869,8 @@ assert endHint.firstUsage(RegisterPriority.MustHaveRegister) == endPos : "must have use position at begin of interval because of move"; if (isRegister(beginHint.location())) { - // registerHint is not spilled at beginPos : so it would not be benefitial to immediately spill cur + // registerHint is not spilled at beginPos : so it would not be benefitial to + // immediately spill cur return; } assert registerHint.spillSlot() != null : "must be set when part of interval was spilled"; @@ -888,7 +898,8 @@ final Value operand = interval.operand; if (interval.location() != null && isStackSlot(interval.location())) { - // activating an interval that has a stack slot assigned . split it at first use position + // activating an interval that has a stack slot assigned . split it at first use + // position // used for method parameters if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println(" interval has spill slot assigned (method parameter) . split it before first use"); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java Wed Jan 23 16:34:57 2013 +0100 @@ -161,8 +161,8 @@ } /** - * Checks if the {@linkplain Interval#location() location} of {@code to} is not blocked - * or is only blocked by {@code from}. + * Checks if the {@linkplain Interval#location() location} of {@code to} is not blocked or is + * only blocked by {@code from}. */ private boolean safeToProcessMove(Interval from, Interval to) { Value fromReg = from != null ? from.location() : null; @@ -271,7 +271,8 @@ spillInterval.setKind(fromInterval.kind()); // add a dummy range because real position is difficult to calculate - // Note: this range is a special case when the integrity of the allocation is checked + // Note: this range is a special case when the integrity of the allocation is + // checked spillInterval.addRange(1, 2); // do not allocate a new spill slot for temporary interval, but diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Range.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Range.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Range.java Wed Jan 23 16:34:57 2013 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.compiler.alloc; - /** * Represents a range of integers from a start (inclusive) to an end (exclusive. */ @@ -49,10 +48,9 @@ return intersectsAt(r) != -1; } - /** * 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 diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java Wed Jan 23 16:34:57 2013 +0100 @@ -214,6 +214,7 @@ } ValueProcedure useProc = new ValueProcedure() { + @Override public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (LinearScan.isVariableOrRegister(operand) && allocator.isProcessed(operand)) { @@ -229,6 +230,7 @@ }; ValueProcedure defProc = new ValueProcedure() { + @Override public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (LinearScan.isVariableOrRegister(operand) && allocator.isProcessed(operand)) { @@ -252,7 +254,8 @@ } } op.forEachAlive(useProc); - // set temp operands (some operations use temp operands also as output operands, so can't set them null) + // set temp operands (some operations use temp operands also as output operands, so + // can't set them null) op.forEachTemp(defProc); // set output operands op.forEachOutput(defProc); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Wed Jan 23 16:34:57 2013 +0100 @@ -35,13 +35,13 @@ import com.oracle.graal.virtual.nodes.*; public class DebugInfoBuilder { + private final NodeMap nodeOperands; public DebugInfoBuilder(NodeMap nodeOperands) { this.nodeOperands = nodeOperands; } - private HashMap virtualObjects = new HashMap<>(); private IdentityHashMap objectStates = new IdentityHashMap<>(); @@ -70,7 +70,8 @@ VirtualObject[] virtualObjectsArray = null; if (virtualObjects.size() != 0) { // fill in the VirtualObject values: - // during this process new VirtualObjects might be discovered, so repeat until no more changes occur. + // during this process new VirtualObjects might be discovered, so repeat until no more + // changes occur. boolean changed; do { changed = false; @@ -118,7 +119,8 @@ values[numLocals + i] = toValue(state.stackAt(i)); } for (int i = 0; i < numLocks; i++) { - // frames are traversed from the outside in, so the locks for the current frame are at the end of the lockDataSlots list + // frames are traversed from the outside in, so the locks for the current frame are at + // the end of the lockDataSlots list StackSlot lockData = lockDataSlots.get(lockDataSlots.size() - numLocks + i); values[numLocals + numStack + i] = new MonitorValue(toValue(state.lockAt(i)), lockData, state.lockAt(i) instanceof VirtualObjectNode); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/InstructionPrinter.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/InstructionPrinter.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/InstructionPrinter.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,8 +28,8 @@ import com.oracle.graal.nodes.*; /** - * A utility for {@linkplain #printInstruction(ValueNode) printing} - * a node as an expression or statement. + * A utility for {@linkplain #printInstruction(ValueNode) printing} a node as an expression or + * statement. */ public class InstructionPrinter { @@ -71,6 +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) { @@ -79,8 +80,9 @@ } /** - * Prints space characters to a given stream until its {@linkplain LogStream#position() position} - * is equal to this column's position. + * 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) { @@ -99,7 +101,8 @@ } /** - * Prints a header for the tabulated data printed by {@link #printInstructionListing(ValueNode)}. + * Prints a header for the tabulated data printed by {@link #printInstructionListing(ValueNode)} + * . */ public void printInstructionListingHeader() { BCI.printLabel(out); @@ -111,20 +114,15 @@ } /** - * Prints an instruction listing on one line. The instruction listing is composed of the - * columns specified by {@link InstructionLineColumn}. - * + * 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) { int indentation = out.indentationLevel(); - out.fillTo(BCI.position + indentation, ' '). - print(0). - fillTo(USE.position + indentation, ' '). - print("0"). - fillTo(VALUE.position + indentation, ' '). - print(ValueNodeUtil.valueString(instruction)). - fillTo(INSTRUCTION.position + indentation, ' '); + out.fillTo(BCI.position + indentation, ' ').print(0).fillTo(USE.position + indentation, ' ').print("0").fillTo(VALUE.position + indentation, ' ').print(ValueNodeUtil.valueString(instruction)).fillTo( + INSTRUCTION.position + indentation, ' '); printInstruction(instruction); if (instruction instanceof StateSplit) { out.print(" [state: " + ((StateSplit) instruction).stateAfter() + "]"); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Wed Jan 23 16:34:57 2013 +0100 @@ -54,6 +54,7 @@ * This class traverses the HIR instructions and generates LIR instructions from them. */ public abstract class LIRGenerator extends LIRGeneratorTool { + protected final StructuredGraph graph; protected final CodeCacheProvider runtime; protected final TargetDescription target; @@ -85,7 +86,8 @@ private final BlockMap blockLastLockCount; /** - * Contains the lock data slot for each lock depth (so these may be reused within a compiled method). + * Contains the lock data slot for each lock depth (so these may be reused within a compiled + * method). */ private final ArrayList lockDataSlots; @@ -118,8 +120,9 @@ } /** - * Returns the operand that has been previously initialized by {@link #setResult(ValueNode, Value)} - * with the result of an instruction. + * Returns the operand that has been previously initialized by + * {@link #setResult(ValueNode, Value)} with the result of an instruction. + * * @param node A node that produces a result value. */ @Override @@ -141,6 +144,7 @@ /** * Creates a new {@linkplain Variable variable}. + * * @param kind The kind of the new variable. * @return a new variable */ @@ -168,9 +172,8 @@ @Override public Value setResult(ValueNode x, Value operand) { - assert (isVariable(operand) && x.kind() == operand.getKind()) || - (isRegister(operand) && !attributes(asRegister(operand)).isAllocatable()) || - (isConstant(operand) && x.kind() == operand.getKind().getStackKind()) : operand.getKind() + " for node " + x; + assert (isVariable(operand) && x.kind() == operand.getKind()) || (isRegister(operand) && !attributes(asRegister(operand)).isAllocatable()) || + (isConstant(operand) && x.kind() == operand.getKind().getStackKind()) : operand.getKind() + " for node " + x; assert operand(x) == null : "operand cannot be set twice"; assert operand != null && isLegal(operand) : "operand must be legal"; assert operand.getKind().getStackKind() == x.kind() : operand.getKind().getStackKind() + " must match " + x.kind(); @@ -246,9 +249,10 @@ /** * Gets the ABI specific operand used to return a value of a given kind from a method. - * + * * @param kind the kind of value being returned - * @return the operand representing the ABI defined location used return a value of kind {@code kind} + * @return the operand representing the ABI defined location used return a value of kind + * {@code kind} */ public Value resultOperandFor(Kind kind) { if (kind == Kind.Void) { @@ -257,7 +261,6 @@ return frameMap.registerConfig.getReturnRegister(kind).asValue(kind); } - public void append(LIRInstruction op) { assert LIRVerifier.verify(op); if (GraalOptions.PrintIRWithLIR && !TTY.isSuppressed()) { @@ -357,7 +360,7 @@ if (nextInstr instanceof Access) { Access access = (Access) nextInstr; if (isNullNode.object() == access.object() && canBeNullCheck(access.location())) { - //TTY.println("implicit null check"); + // TTY.println("implicit null check"); access.setNullCheck(true); continue; } @@ -386,7 +389,8 @@ } } } else { - // There can be cases in which the result of an instruction is already set before by other instructions. + // There can be cases in which the result of an instruction is already set + // before by other instructions. } } if (stateAfter != null) { @@ -434,7 +438,7 @@ assert operand(v) != null : "Value " + v + " in " + fs + " is not ready!"; } } - fs = fs.outerFrameState(); + fs = fs.outerFrameState(); } return true; } @@ -496,7 +500,8 @@ } /** - * Increases the number of currently locked monitors and makes sure that a lock data slot is available for the new lock. + * Increases the number of currently locked monitors and makes sure that a lock data slot is + * available for the new lock. */ public void lock() { if (lockDataSlots.size() == currentLockCount) { @@ -507,7 +512,7 @@ /** * Decreases the number of currently locked monitors. - * + * * @throws GraalInternalError if the number of currently locked monitors is already zero. */ public void unlock() { @@ -583,7 +588,7 @@ @Override public void emitIf(IfNode x) { - emitBranch(x.condition(), getLIRBlock(x.trueSuccessor()), getLIRBlock(x.falseSuccessor()), null); + emitBranch(x.condition(), getLIRBlock(x.trueSuccessor()), getLIRBlock(x.falseSuccessor()), null); } @Override @@ -679,9 +684,10 @@ return emitCMove(operand(compare.x()), operand(compare.y()), compare.condition(), compare.unorderedIsTrue(), trueValue, falseValue); } + public abstract void emitJump(LabelRef label, LIRFrameState info); - public abstract void emitJump(LabelRef label, LIRFrameState info); public abstract void emitBranch(Value left, Value right, Condition cond, boolean unorderedIsTrue, LabelRef label, LIRFrameState info); + public abstract Variable emitCMove(Value leftVal, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue); protected FrameState stateBeforeCallWithArguments(FrameState stateAfter, MethodCallTargetNode call, int bci) { @@ -707,7 +713,6 @@ return stack; } - public static int stackSlots(Kind kind) { return isTwoSlot(kind) ? 2 : 1; } @@ -753,7 +758,8 @@ private static Value toStackKind(Value value) { if (value.getKind().getStackKind() != value.getKind()) { - // We only have stack-kinds in the LIR, so convert the operand kind for values from the calling convention. + // We only have stack-kinds in the LIR, so convert the operand kind for values from the + // calling convention. if (isRegister(value)) { return asRegister(value).asValue(value.getKind().getStackKind()); } else if (isStackSlot(value)) { @@ -782,7 +788,6 @@ return result; } - protected abstract LabelRef createDeoptStub(DeoptimizationAction action, DeoptimizationReason reason, LIRFrameState info, Object deoptInfo); @Override @@ -819,22 +824,26 @@ LIRFrameState info = null; FrameState stateAfter = x.stateAfter(); if (stateAfter != null) { - // (cwimmer) I made the code that modifies the operand stack conditional. My scenario: runtime calls to, e.g., - // CreateNullPointerException have no equivalent in the bytecodes, so there is no invoke bytecode. - // Therefore, the result of the runtime call was never pushed to the stack, and we cannot pop it here. + // (cwimmer) I made the code that modifies the operand stack conditional. My scenario: + // runtime calls to, e.g., + // CreateNullPointerException have no equivalent in the bytecodes, so there is no invoke + // bytecode. + // Therefore, the result of the runtime call was never pushed to the stack, and we + // cannot pop it here. FrameState stateBeforeReturn = stateAfter; - if ((stateAfter.stackSize() > 0 && stateAfter.stackAt(stateAfter.stackSize() - 1) == x) || - (stateAfter.stackSize() > 1 && stateAfter.stackAt(stateAfter.stackSize() - 2) == x)) { + if ((stateAfter.stackSize() > 0 && stateAfter.stackAt(stateAfter.stackSize() - 1) == x) || (stateAfter.stackSize() > 1 && stateAfter.stackAt(stateAfter.stackSize() - 2) == x)) { stateBeforeReturn = stateAfter.duplicateModified(stateAfter.bci, stateAfter.rethrowException(), x.kind()); } - // TODO is it correct here that the pointerSlots are not passed to the oop map generation? + // TODO is it correct here that the pointerSlots are not passed to the oop map + // generation? info = stateFor(stateBeforeReturn, -1); } else { // Every runtime call needs an info - // TODO This is conservative. It's not needed for calls that are implemented purely in a stub - // that does not trash any registers and does not call into the runtime. + // TODO This is conservative. It's not needed for calls that are implemented purely in a + // stub + // that does not trash any registers and does not call into the runtime. info = state(); } @@ -846,10 +855,12 @@ } /** - * This method tries to create a switch implementation that is optimal for the given switch. - * It will either generate a sequential if/then/else cascade, a set of range tests or a table switch. - * - * If the given switch does not contain int keys, it will always create a sequential implementation. + * This method tries to create a switch implementation that is optimal for the given switch. It + * will either generate a sequential if/then/else cascade, a set of range tests or a table + * switch. + * + * If the given switch does not contain int keys, it will always create a sequential + * implementation. */ @Override public void emitSwitch(SwitchNode x) { @@ -891,6 +902,7 @@ private void emitSequentialSwitch(final SwitchNode x, Variable key, LabelRef defaultTarget) { int keyCount = x.keyCount(); Integer[] indexes = Util.createSortedPermutation(keyCount, new Comparator() { + @Override public int compare(Integer o1, Integer o2) { return x.keyProbability(o1) < x.keyProbability(o2) ? 1 : x.keyProbability(o1) > x.keyProbability(o2) ? -1 : 0; @@ -906,7 +918,9 @@ } protected abstract void emitSequentialSwitch(Constant[] keyConstants, LabelRef[] keyTargets, LabelRef defaultTarget, Value key); + protected abstract void emitSwitchRanges(int[] lowKeys, int[] highKeys, LabelRef[] targets, LabelRef defaultTarget, Value key); + protected abstract void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, Value key); private static int switchRangeCount(SwitchNode x) { @@ -967,14 +981,22 @@ } public abstract void emitBitCount(Variable result, Value operand); + public abstract void emitBitScanForward(Variable result, Value operand); + public abstract void emitBitScanReverse(Variable result, Value operand); public abstract void emitMathAbs(Variable result, Variable input); + public abstract void emitMathSqrt(Variable result, Variable input); + public abstract void emitMathLog(Variable result, Variable input, boolean base10); + public abstract void emitMathCos(Variable result, Variable input); + public abstract void emitMathSin(Variable result, Variable input); + public abstract void emitMathTan(Variable result, Variable input); + public abstract void emitByteSwap(Variable result, Value operand); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/PhiResolver.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/PhiResolver.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/PhiResolver.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,17 +33,18 @@ /** * Converts {@link PhiNode} instructions into moves. - * + * * Resolves cycles: + * *

    - *
    + * 
      *  r1 := r2  becomes  temp := r1
      *  r2 := r1           r1 := r2
      *                     r2 := temp
      * 
    - * + * * and orders moves: - * + * *
      *  r2 := r3  becomes  r1 := r2
      *  r1 := r2           r2 := r3
    @@ -52,12 +53,14 @@
     public class PhiResolver {
     
         /**
    -     * Tracks a data flow dependency between a source operand and any number of the destination operands.
    +     * Tracks a data flow dependency between a source operand and any number of the destination
    +     * operands.
          */
         static class PhiResolverNode {
     
             /**
    -         * A source operand whose value flows into the {@linkplain #destinations destination} operands.
    +         * A source operand whose value flows into the {@linkplain #destinations destination}
    +         * operands.
              */
             final Value operand;
     
    @@ -67,7 +70,8 @@
             final ArrayList destinations;
     
             /**
    -         * Denotes if a move instruction has already been emitted to initialize the value of {@link #operand}.
    +         * Denotes if a move instruction has already been emitted to initialize the value of
    +         * {@link #operand}.
              */
             boolean assigned;
     
    @@ -150,7 +154,7 @@
             PhiResolverNode srcNode = sourceNode(src);
             PhiResolverNode destNode = destinationNode(dest);
             srcNode.destinations.add(destNode);
    -      }
    +    }
     
         private PhiResolverNode createNode(Value operand, boolean source) {
             PhiResolverNode node;
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java
    --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -57,8 +57,9 @@
     
         /**
          * Emits code to do stack overflow checking.
    -     *
    -     * @param afterFrameInit specifies if the stack pointer has already been adjusted to allocate the current frame
    +     * 
    +     * @param afterFrameInit specifies if the stack pointer has already been adjusted to allocate
    +     *            the current frame
          */
         protected static void emitStackOverflowCheck(TargetMethodAssembler tasm, boolean afterFrameInit) {
             if (GraalOptions.StackShadowPages > 0) {
    @@ -80,10 +81,10 @@
     
         /**
          * Emits the code for a given method. This includes any architecture/runtime specific
    -     * prefix/suffix. A prefix typically contains the code for setting up the frame,
    -     * spilling callee-save registers, stack overflow checking, handling multiple entry
    -     * points etc. A suffix may contain out-of-line stubs and method end guard instructions.
    -     *
    +     * prefix/suffix. A prefix typically contains the code for setting up the frame, spilling
    +     * callee-save registers, stack overflow checking, handling multiple entry points etc. A suffix
    +     * may contain out-of-line stubs and method end guard instructions.
    +     * 
          * @param method the method associated with {@code lir}
          * @param lir the LIR of {@code method}
          */
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/LIRGenLowerable.java
    --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/LIRGenLowerable.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/LIRGenLowerable.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -27,8 +27,8 @@
     import com.oracle.graal.nodes.spi.*;
     
     /**
    - * An alternative to {@link LIRLowerable} for lowering that is tightly coupled
    - * to {@link LIRGenerator} and {@link LIRInstruction}.
    + * An alternative to {@link LIRLowerable} for lowering that is tightly coupled to
    + * {@link LIRGenerator} and {@link LIRInstruction}.
      */
     public interface LIRGenLowerable {
     
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java
    --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -93,7 +93,7 @@
         }
     
         public static void scope(String name, Object context, Runnable runnable) {
    -        scope(name, new Object[] {context}, runnable);
    +        scope(name, new Object[]{context}, runnable);
         }
     
         public static void scope(String name, Object[] context, Runnable runnable) {
    @@ -113,7 +113,7 @@
         }
     
         public static  T scope(String name, Object context, Callable callable) {
    -        return scope(name, new Object[] {context}, callable);
    +        return scope(name, new Object[]{context}, callable);
         }
     
         public static  T scope(String name, Object[] context, Callable callable) {
    @@ -160,8 +160,8 @@
         }
     
         /**
    -     * Searches the current debug scope, bottom up, for a context object that is an instance of a given type.
    -     * The first such object found is returned.
    +     * Searches the current debug scope, bottom up, for a context object that is an instance of a
    +     * given type. The first such object found is returned.
          */
         @SuppressWarnings("unchecked")
         public static  T contextLookup(Class clazz) {
    @@ -189,7 +189,8 @@
             }
         }
     
    -    public static DebugConfig fixedConfig(final boolean isLogEnabled, final boolean isDumpEnabled, final boolean isMeterEnabled, final boolean isTimerEnabled, final Collection dumpHandlers, final PrintStream output) {
    +    public static DebugConfig fixedConfig(final boolean isLogEnabled, final boolean isDumpEnabled, final boolean isMeterEnabled, final boolean isTimerEnabled,
    +                    final Collection dumpHandlers, final PrintStream output) {
             return new DebugConfig() {
     
                 @Override
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java
    --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -25,25 +25,28 @@
     import java.io.*;
     import java.util.*;
     
    +public interface DebugConfig {
     
    -public interface DebugConfig {
         /**
    -     * Determines if logging is enabled in the {@linkplain Debug#currentScope() current debug scope}.
    -     *
    +     * Determines if logging is enabled in the {@linkplain Debug#currentScope() current debug scope}
    +     * .
    +     * 
          * @see Debug#log(String, Object...)
          */
         boolean isLogEnabled();
     
         /**
    -     * Determines if metering is enabled in the {@linkplain Debug#currentScope() current debug scope}.
    -     *
    +     * Determines if metering is enabled in the {@linkplain Debug#currentScope() current debug
    +     * scope}.
    +     * 
          * @see Debug#metric(String)
          */
         boolean isMeterEnabled();
     
         /**
    -     * Determines if dumping is enabled in the {@linkplain Debug#currentScope() current debug scope}.
    -     *
    +     * Determines if dumping is enabled in the {@linkplain Debug#currentScope() current debug scope}
    +     * .
    +     * 
          * @see Debug#dump(Object, String, Object...)
          */
         boolean isDumpEnabled();
    @@ -55,7 +58,7 @@
     
         /**
          * Removes an object the context used by this configuration to do filtering.
    -     *
    +     * 
          * This should only removes extra context added by {@link #addToContext(Object)}.
          */
         void removeFromContext(Object o);
    @@ -67,9 +70,9 @@
     
         /**
          * Handles notification of an exception occurring within a debug scope.
    -     *
    -     * @return the exception object that is to be propagated to parent scope. A value of {@code null} indicates that
    -     *         {@code e} is to be propagated.
    +     * 
    +     * @return the exception object that is to be propagated to parent scope. A value of
    +     *         {@code null} indicates that {@code e} is to be propagated.
          */
         RuntimeException interceptException(Throwable e);
     
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugDumpHandler.java
    --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugDumpHandler.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugDumpHandler.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -25,6 +25,7 @@
     import java.io.*;
     
     public interface DebugDumpHandler extends Closeable {
    +
         void dump(Object object, String message);
     
         @Override
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugDumpScope.java
    --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugDumpScope.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugDumpScope.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -27,9 +27,9 @@
         public final String name;
     
         /**
    -     * Specifies if this scope decorates an inner scope.
    -     * A hierarchical or tree representation of nested scopes may choose to represent
    -     * a decorator scope at the same level as the scope it decorates.
    +     * Specifies if this scope decorates an inner scope. A hierarchical or tree representation of
    +     * nested scopes may choose to represent a decorator scope at the same level as the scope it
    +     * decorates.
          */
         public final boolean decorator;
     
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugMetric.java
    --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugMetric.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugMetric.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -23,6 +23,8 @@
     package com.oracle.graal.debug;
     
     public interface DebugMetric {
    +
         void increment();
    +
         void add(int value);
     }
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugTimer.java
    --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugTimer.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugTimer.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -25,5 +25,6 @@
     import com.oracle.graal.debug.internal.*;
     
     public interface DebugTimer {
    +
         TimerCloseable start();
     }
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.debug/src/com/oracle/graal/debug/LogStream.java
    --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/LogStream.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/LogStream.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -26,22 +26,22 @@
     
     /**
      * 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
    + * 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
    + * 
    + * 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.
      */
     public class LogStream {
    @@ -52,8 +52,10 @@
         public static final LogStream SINK = new LogStream();
     
         private static final PrintStream SINK_PS = new PrintStream(new OutputStream() {
    +
             @Override
    -        public void write(int b) throws IOException { }
    +        public void write(int b) throws IOException {
    +        }
         });
     
         private LogStream() {
    @@ -85,7 +87,7 @@
     
         /**
          * Creates a new log stream.
    -     *
    +     * 
          * @param os the underlying output stream to which prints are sent
          */
         public LogStream(OutputStream os) {
    @@ -94,8 +96,9 @@
         }
     
         /**
    -     * Creates a new log stream that shares the same {@linkplain #ps output stream} as a given {@link LogStream}.
    -     *
    +     * 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) {
    @@ -104,8 +107,8 @@
         }
     
         /**
    -     * Prepends {@link #indentation} to the current output line until its write position is equal to the
    -     * current {@linkplain #indentationLevel()} level.
    +     * Prepends {@link #indentation} to the current output line until its write position is equal to
    +     * the current {@linkplain #indentationLevel()} level.
          */
         private void indent() {
             if (ps != null) {
    @@ -144,7 +147,7 @@
     
         /**
          * Gets the current column position of this log stream.
    -     *
    +     * 
          * @return the current column position of this log stream
          */
         public int position() {
    @@ -154,7 +157,7 @@
     
         /**
          * Gets the current indentation level for this log stream.
    -     *
    +     * 
          * @return the current indentation level for this log stream.
          */
         public int indentationLevel() {
    @@ -163,7 +166,7 @@
     
         /**
          * Adjusts the current indentation level of this log stream.
    -     *
    +     * 
          * @param delta
          */
         public void adjustIndentation(int delta) {
    @@ -197,9 +200,9 @@
         }
     
         /**
    -     * Advances this stream's {@linkplain #position() position} to a given position by
    -     * repeatedly appending a given character as necessary.
    -     *
    +     * 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
          */
    @@ -215,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
          */
    @@ -228,8 +231,9 @@
         }
     
         /**
    -     * Writes a boolean value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
    -     *
    +     * 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
          */
    @@ -244,7 +248,7 @@
     
         /**
          * Writes a character value to this stream.
    -     *
    +     * 
          * @param c the value to be printed
          * @return this {@link LogStream} instance
          */
    @@ -262,8 +266,9 @@
         }
     
         /**
    -     * Writes a character value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
    -     *
    +     * 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
          */
    @@ -278,7 +283,7 @@
     
         /**
          * Prints an int value.
    -     *
    +     * 
          * @param i the value to be printed
          * @return this {@link LogStream} instance
          */
    @@ -292,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
          */
    @@ -307,7 +312,7 @@
     
         /**
          * Writes a float value to this stream.
    -     *
    +     * 
          * @param f the value to be printed
          * @return this {@link LogStream} instance
          */
    @@ -320,8 +325,9 @@
         }
     
         /**
    -     * Writes a float value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
    -     *
    +     * 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
          */
    @@ -336,7 +342,7 @@
     
         /**
          * Writes a long value to this stream.
    -     *
    +     * 
          * @param l the value to be printed
          * @return this {@link LogStream} instance
          */
    @@ -350,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
          */
    @@ -365,7 +371,7 @@
     
         /**
          * Writes a double value to this stream.
    -     *
    +     * 
          * @param d the value to be printed
          * @return this {@link LogStream} instance
          */
    @@ -378,8 +384,9 @@
         }
     
         /**
    -     * Writes a double value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
    -     *
    +     * 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
          */
    @@ -393,10 +400,10 @@
         }
     
         /**
    -     * 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}.
    -     *
    +     * 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
          */
    @@ -427,8 +434,9 @@
         }
     
         /**
    -     * Writes a {@code String} value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
    -     *
    +     * 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
          */
    @@ -442,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
    @@ -456,7 +464,7 @@
     
         /**
          * Writes a {@linkplain #LINE_SEPARATOR line separator} to this stream.
    -     *
    +     * 
          * @return this {@code LogStream} instance
          */
         public LogStream println() {
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.debug/src/com/oracle/graal/debug/TTY.java
    --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/TTY.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/TTY.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -28,8 +28,9 @@
     import java.util.regex.*;
     
     /**
    - * A collection of static methods for printing debug and informational output to a global {@link LogStream}.
    - * The output can be (temporarily) suppressed per thread through use of a {@linkplain Filter filter}.
    + * A collection of static methods for printing debug and informational output to a global
    + * {@link LogStream}. The output can be (temporarily) suppressed per thread through use of a
    + * {@linkplain Filter filter}.
      */
     public class TTY {
     
    @@ -37,20 +38,23 @@
          * Support for thread-local suppression of {@link TTY}.
          */
         public static class Filter {
    +
             private LogStream previous;
             private final Thread thread = Thread.currentThread();
     
             /**
    -         * 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
    +         * 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 the regular expression is specified by {@code filter} without the "~" prefix. Otherwise, a
    -         *            simple {@linkplain String#contains(CharSequence) substring} match is performed where {@code
    -         *            filter} is the substring used.
    -         * @param object an object whose {@linkplain Object#toString() string} value is matched against {@code filter}
    +         * 
    +         * @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
    +         *            the regular expression is specified by {@code filter} without the "~" prefix.
    +         *            Otherwise, a simple {@linkplain String#contains(CharSequence) substring} match
    +         *            is performed where {@code filter} is the substring used.
    +         * @param object an object whose {@linkplain Object#toString() string} value is matched
    +         *            against {@code filter}
              */
             public Filter(String filter, Object object) {
                 boolean suppressed = false;
    @@ -69,9 +73,9 @@
             }
     
             /**
    -         * Creates an object that will suppress {@link TTY} for the current thread.
    -         * To revert the suppression state to how it was before this call, the
    -         * {@link #remove()} method must be called on this filter object.
    +         * Creates an object that will suppress {@link TTY} for the current thread. To revert the
    +         * suppression state to how it was before this call, the {@link #remove()} method must be
    +         * called on this filter object.
              */
             public Filter() {
                 previous = out();
    @@ -79,7 +83,8 @@
             }
     
             /**
    -         * Reverts the suppression state of {@link TTY} to how it was before this object was constructed.
    +         * Reverts the suppression state of {@link TTY} to how it was before this object was
    +         * constructed.
              */
             public void remove() {
                 assert thread == Thread.currentThread();
    @@ -104,6 +109,7 @@
         }
     
         private static final ThreadLocal out = new ThreadLocal() {
    +
             @Override
             protected LogStream initialValue() {
                 return createLog();
    @@ -116,8 +122,9 @@
     
         /**
          * Gets the thread-local log stream to which the static methods of this class send their output.
    -     * This will either be a global log stream or the global {@linkplain LogStream#SINK sink} depending
    -     * on whether any suppression {@linkplain Filter filters} are in effect for the current thread.
    +     * This will either be a global log stream or the global {@linkplain LogStream#SINK sink}
    +     * depending on whether any suppression {@linkplain Filter filters} are in effect for the
    +     * current thread.
          */
         public static LogStream out() {
             return out.get();
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java
    --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -215,7 +215,7 @@
                             return new RuntimeException("Exception while intercepting exception", t);
                         }
                     }
    -            }, false, new Object[] {e});
    +            }, false, new Object[]{e});
             }
             return null;
         }
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValue.java
    --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValue.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValue.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -27,6 +27,7 @@
     public abstract class DebugValue {
     
         public static final Comparator ORDER_BY_NAME = new Comparator() {
    +
             @Override
             public int compare(DebugValue o1, DebugValue o2) {
                 // this keeps the "Runs" metric at the top of the list
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/KeyRegistry.java
    --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/KeyRegistry.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/KeyRegistry.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -25,6 +25,7 @@
     import java.util.*;
     
     public class KeyRegistry {
    +
         private static int keyCount;
         private static Map keyMap = new HashMap<>();
         private static List debugValues = new ArrayList<>();
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerCloseable.java
    --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerCloseable.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerCloseable.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -23,5 +23,6 @@
     package com.oracle.graal.debug.internal;
     
     public interface TimerCloseable extends AutoCloseable {
    +
         void close();
     }
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerImpl.java
    --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerImpl.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerImpl.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -27,9 +27,11 @@
     import com.oracle.graal.debug.*;
     
     public final class TimerImpl extends DebugValue implements DebugTimer {
    +
         private static final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
     
         public static final TimerCloseable VOID_CLOSEABLE = new TimerCloseable() {
    +
             @Override
             public void close() {
             }
    @@ -72,7 +74,8 @@
             return String.format("%d.%d ms", value / 1000000, (value / 100000) % 10);
         }
     
    -    private abstract class AbstractTimer  implements TimerCloseable {
    +    private abstract class AbstractTimer implements TimerCloseable {
    +
             private final long startTime;
             private final long previousValueToSubstract;
     
    @@ -93,6 +96,7 @@
         }
     
         private final class SystemNanosTimer extends AbstractTimer {
    +
             public SystemNanosTimer(long startTime, long previousValueToSubstract) {
                 super(startTime, previousValueToSubstract);
             }
    @@ -104,6 +108,7 @@
         }
     
         private final class CpuTimeTimer extends AbstractTimer {
    +
             public CpuTimeTimer(long startTime, long previousValueToSubstract) {
                 super(startTime, previousValueToSubstract);
             }
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TestNodeInterface.java
    --- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TestNodeInterface.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TestNodeInterface.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -22,7 +22,7 @@
      */
     package com.oracle.graal.graph;
     
    +public interface TestNodeInterface {
     
    -public interface TestNodeInterface {
         String getName();
     }
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TypedNodeIteratorTest.java
    --- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TypedNodeIteratorTest.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TypedNodeIteratorTest.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -21,21 +21,23 @@
      * questions.
      */
     package com.oracle.graal.graph;
    +
     import static org.junit.Assert.*;
     
     import java.util.*;
     
     import org.junit.*;
     
    -
    -
     public class TypedNodeIteratorTest {
     
         private static class TestNode extends Node implements Node.IterableNodeType, TestNodeInterface {
    +
             private final String name;
    +
             public TestNode(String name) {
                 this.name = name;
             }
    +
             public String getName() {
                 return name;
             }
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TypedNodeIteratorTest2.java
    --- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TypedNodeIteratorTest2.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TypedNodeIteratorTest2.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -26,32 +26,37 @@
     
     import org.junit.*;
     
    -
     public class TypedNodeIteratorTest2 {
     
         private static class NodeA extends Node implements TestNodeInterface {
    +
             private final String name;
    +
             public NodeA(String name) {
                 this.name = name;
             }
    +
             public String getName() {
                 return name;
             }
         }
     
         private static class NodeB extends NodeA implements Node.IterableNodeType {
    +
             public NodeB(String name) {
                 super(name);
             }
         }
     
         private static class NodeC extends NodeB {
    +
             public NodeC(String name) {
                 super(name);
             }
         }
     
         private static class NodeD extends NodeC {
    +
             public NodeD(String name) {
                 super(name);
             }
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/FieldIntrospection.java
    --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/FieldIntrospection.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/FieldIntrospection.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -21,6 +21,7 @@
      * questions.
      */
     package com.oracle.graal.graph;
    +
     import java.lang.reflect.*;
     import java.util.*;
     import java.util.concurrent.*;
    @@ -28,13 +29,16 @@
     public abstract class FieldIntrospection extends UnsafeAccess {
     
         /**
    -     * Interface used by {@link #rescanAllFieldOffsets(CalcOffset)} to determine the offset (in bytes) of a field.
    +     * Interface used by {@link #rescanAllFieldOffsets(CalcOffset)} to determine the offset (in
    +     * bytes) of a field.
          */
         public interface CalcOffset {
    +
             long getOffset(Field field);
         }
     
         public static class DefaultCalcOffset implements CalcOffset {
    +
             @Override
             public long getOffset(Field field) {
                 return unsafe.objectFieldOffset(field);
    @@ -61,6 +65,7 @@
         protected abstract void rescanFieldOffsets(CalcOffset calc);
     
         public abstract static class BaseFieldScanner {
    +
             private final CalcOffset calc;
     
             /** The offsets of fields that are not specially handled by subclasses. */
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraalInternalError.java
    --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraalInternalError.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraalInternalError.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -50,12 +50,14 @@
             throw new GraalInternalError("should not reach here: %s", msg);
         }
     
    -
         /**
    -     * This constructor creates a {@link GraalInternalError} with a message assembled via {@link String#format(String, Object...)}.
    -     * It always uses the ENGLISH locale in order to always generate the same output.
    +     * This constructor creates a {@link GraalInternalError} 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.
    +     * @param args parameters to String.format - parameters that implement {@link Iterable} will be
    +     *            expanded into a [x, x, ...] representation.
          */
         public GraalInternalError(String msg, Object... args) {
             super(format(msg, args));
    @@ -63,6 +65,7 @@
     
         /**
          * This constructor creates a {@link GraalInternalError} for a given causing Throwable instance.
    +     * 
          * @param cause the original exception that contains additional information on this error
          */
         public GraalInternalError(Throwable cause) {
    @@ -105,8 +108,11 @@
         }
     
         /**
    -     * Adds a graph to the context of this VerificationError. The first graph added via this method will be returned by {@link #graph()}.
    -     * @param newGraph the graph which is in a incorrect state, if the verification error was not caused by a specific node
    +     * Adds a graph to the context of this VerificationError. The first graph added via this method
    +     * will be returned by {@link #graph()}.
    +     * 
    +     * @param newGraph the graph which is in a incorrect state, if the verification error was not
    +     *            caused by a specific node
          */
         public GraalInternalError addContext(Graph newGraph) {
             if (newGraph != this.graph) {
    @@ -119,8 +125,11 @@
         }
     
         /**
    -     * Adds a node to the context of this VerificationError. The first node added via this method will be returned by {@link #node()}.
    -     * @param newNode the node which is in a incorrect state, if the verification error was caused by a node
    +     * Adds a node to the context of this VerificationError. The first node added via this method
    +     * will be returned by {@link #node()}.
    +     * 
    +     * @param newNode the node which is in a incorrect state, if the verification error was caused
    +     *            by a node
          */
         public GraalInternalError addContext(Node newNode) {
             if (newNode != this.node) {
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java
    --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -88,7 +88,7 @@
     
         /**
          * Creates an empty Graph with a given name.
    -     *
    +     * 
          * @param name the name of the graph, used for debugging purposes
          */
         public Graph(String name) {
    @@ -107,7 +107,7 @@
     
         /**
          * Creates a copy of this graph.
    -     *
    +     * 
          * @param newName the name of the copy, used for debugging purposes (can be null)
          */
         public Graph copy(String newName) {
    @@ -123,7 +123,9 @@
         }
     
         /**
    -     * Gets the number of live nodes in this graph. That is the number of nodes which have been added to the graph minus the number of deleted nodes.
    +     * Gets the number of live nodes in this graph. That is the number of nodes which have been
    +     * added to the graph minus the number of deleted nodes.
    +     * 
          * @return the number of live nodes in this graph
          */
         public int getNodeCount() {
    @@ -132,6 +134,7 @@
     
         /**
          * Gets the number of node which have been deleted from this graph.
    +     * 
          * @return the number of node which have been deleted from this graph
          */
         public int getDeletedNodeCount() {
    @@ -140,6 +143,7 @@
     
         /**
          * Adds a new node to the graph.
    +     * 
          * @param node the node to be added
          * @return the node which was added to the graph
          */
    @@ -149,6 +153,7 @@
         }
     
         public interface InputChangedListener {
    +
             void inputChanged(Node node);
         }
     
    @@ -161,9 +166,13 @@
         }
     
         /**
    -     * Adds a new node to the graph, if a similar node already exists in the graph, the provided node will not be added to the graph but the similar node will be returned instead.
    +     * Adds a new node to the graph, if a similar node already exists in the graph, the
    +     * provided node will not be added to the graph but the similar node will be returned
    +     * instead.
    +     * 
          * @param node
    -     * @return the node which was added to the graph or a similar which was already in the graph.
    +     * @return the node which was added to the graph or a similar which was already in the
    +     *         graph.
          */
         @SuppressWarnings("unchecked")
         public  T unique(T node) {
    @@ -231,6 +240,7 @@
         }
     
         private class NodeIterator implements Iterator {
    +
             private int index;
     
             public NodeIterator() {
    @@ -280,11 +290,13 @@
         }
     
         /**
    -     * Returns an {@link Iterable} providing all nodes added since the last {@link Graph#getMark() mark}.
    +     * Returns an {@link Iterable} providing all nodes added since the last {@link Graph#getMark()
    +     * mark}.
          */
         public NodeIterable getNewNodes(int mark) {
             final int index = mark;
             return new AbstractNodeIterable() {
    +
                 @Override
                 public Iterator iterator() {
                     return new NodeIterator(index);
    @@ -294,10 +306,12 @@
     
         /**
          * Returns an {@link Iterable} providing all the live nodes.
    +     * 
          * @return an {@link Iterable} providing all the live nodes.
          */
         public NodeIterable getNodes() {
             return new AbstractNodeIterable() {
    +
                 @Override
                 public Iterator iterator() {
                     return new NodeIterator();
    @@ -310,10 +324,13 @@
             };
         }
     
    -    private static class PlaceHolderNode extends Node {}
    +    private static class PlaceHolderNode extends Node {
    +    }
    +
         private static final PlaceHolderNode PLACE_HOLDER = new PlaceHolderNode();
     
         private class TypedNodeIterator implements Iterator {
    +
             private final int[] ids;
             private final Node[] current;
     
    @@ -412,13 +429,16 @@
         }
     
         /**
    -     * Returns an {@link Iterable} providing all the live nodes whose type is compatible with {@code type}.
    +     * Returns an {@link Iterable} providing all the live nodes whose type is compatible with
    +     * {@code type}.
    +     * 
          * @param type the type of node to return
          * @return an {@link Iterable} providing all the matching nodes.
          */
         public  NodeIterable getNodes(final Class type) {
             final NodeClass nodeClass = NodeClass.get(type);
             return new AbstractNodeIterable() {
    +
                 @Override
                 public Iterator iterator() {
                     return new TypedNodeIterator<>(nodeClass);
    @@ -428,6 +448,7 @@
     
         /**
          * Returns whether the graph contains at least one node of the given type.
    +     * 
          * @param type the type of node that is checked for occurrence
          * @return whether there is at least one such node
          */
    @@ -543,6 +564,7 @@
     
         /**
          * Returns the number of node ids generated so far.
    +     * 
          * @return the number of node ids generated so far
          */
         int nodeIdCount() {
    @@ -550,12 +572,12 @@
         }
     
         /**
    -     * Adds duplicates of the nodes in {@code nodes} to this graph.
    -     * This will recreate any edges between the duplicate nodes. The {@code replacement} map can be used to
    -     * replace a node from the source graph by a given node (which must already be in this graph).
    -     * Edges between duplicate and replacement nodes will also be recreated so care should be taken
    -     * regarding the matching of node types in the replacement map.
    -     *
    +     * Adds duplicates of the nodes in {@code nodes} to this graph. This will recreate any edges
    +     * between the duplicate nodes. The {@code replacement} map can be used to replace a node from
    +     * the source graph by a given node (which must already be in this graph). Edges between
    +     * duplicate and replacement nodes will also be recreated so care should be taken regarding the
    +     * matching of node types in the replacement map.
    +     * 
          * @param newNodes the nodes to be duplicated
          * @param replacementsMap the replacement map (can be null if no replacement is to be performed)
          * @return a map which associates the original nodes from {@code nodes} to their duplicates
    @@ -571,14 +593,18 @@
         }
     
         public interface DuplicationReplacement {
    +
             Node replacement(Node original);
         }
     
         private static final class MapReplacement implements DuplicationReplacement {
    +
             private final Map map;
    +
             public MapReplacement(Map map) {
                 this.map = map;
             }
    +
             @Override
             public Node replacement(Node original) {
                 Node replacement = map.get(original);
    @@ -588,6 +614,7 @@
         }
     
         private static final DuplicationReplacement NO_REPLACEMENT = new DuplicationReplacement() {
    +
             @Override
             public Node replacement(Node original) {
                 return original;
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraphEvent.java
    --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraphEvent.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraphEvent.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -22,7 +22,6 @@
      */
     package com.oracle.graal.graph;
     
    -
     public abstract class GraphEvent {
     
         private Exception exceptionContext;
    @@ -30,9 +29,7 @@
         public static class NodeEvent extends GraphEvent {
     
             public static enum Type {
    -            ADDED,
    -            DELETED,
    -            CHANGED
    +            ADDED, DELETED, CHANGED
             }
     
             public final Node node;
    @@ -55,8 +52,7 @@
         public static class EdgeEvent extends GraphEvent {
     
             public static enum Type {
    -            INPUT,
    -            SUCC
    +            INPUT, SUCC
             }
     
             public final Node node;
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraphEventLog.java
    --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraphEventLog.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraphEventLog.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -24,7 +24,6 @@
     
     import java.util.*;
     
    -
     public class GraphEventLog {
     
         private List events = new ArrayList<>();
    diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java
    --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Wed Jan 23 16:34:38 2013 +0100
    +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Wed Jan 23 16:34:57 2013 +0100
    @@ -29,21 +29,25 @@
     import com.oracle.graal.graph.NodeClass.*;
     import com.oracle.graal.graph.iterators.*;
     
    -
     /**
    - * This class is the base class for all nodes, it represent a node which can be inserted in a {@link Graph}.

    - * Once a node has been added to a graph, it has a graph-unique {@link #id()}. Edges in the subclasses are represented - * with annotated fields. There are two kind of edges : {@link Input} and {@link Successor}. If a field, of a type - * compatible with {@link Node}, annotated with either {@link Input} and {@link Successor} is not null, then there is an - * edge from this node to the node this field points to.

    + * This class is the base class for all nodes, it represent a node which can be inserted in a + * {@link Graph}. + *

    + * Once a node has been added to a graph, it has a graph-unique {@link #id()}. Edges in the + * subclasses are represented with annotated fields. There are two kind of edges : {@link Input} and + * {@link Successor}. If a field, of a type compatible with {@link Node}, annotated with either + * {@link Input} and {@link Successor} is not null, then there is an edge from this node to the node + * this field points to. + *

    * Nodes which are be value numberable should implement the {@link ValueNumberable} interface. - * + * *

    Assertions and Verification

    - * + * * The Node class supplies the {@link #assertTrue(boolean, String, Object...)} and - * {@link #assertFalse(boolean, String, Object...)} methods, which will check the supplied boolean and throw a - * VerificationError if it has the wrong value. Both methods will always either throw an exception or return true. - * They can thus be used within an assert statement, so that the check is only performed if assertions are enabled. + * {@link #assertFalse(boolean, String, Object...)} methods, which will check the supplied boolean + * and throw a VerificationError if it has the wrong value. Both methods will always either throw an + * exception or return true. They can thus be used within an assert statement, so that the check is + * only performed if assertions are enabled. */ public abstract class Node implements Cloneable, Formattable { @@ -52,64 +56,69 @@ static final int ALIVE_ID_START = 0; /** - * Denotes a node input. This should be applied to exactly the fields of a node that are of type {@link Node}. - * Nodes that update their inputs outside of their constructor should call {@link Node#updateUsages(Node, Node)} - * just prior to doing the update of the input. + * Denotes a node input. This should be applied to exactly the fields of a node that are of type + * {@link Node}. Nodes that update their inputs outside of their constructor should call + * {@link Node#updateUsages(Node, Node)} just prior to doing the update of the input. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public static @interface Input { + boolean notDataflow() default false; } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) - public static @interface Successor {} + public static @interface Successor { + } /** - * Denotes that a parameter of an {@linkplain NodeIntrinsic intrinsic} method - * must be a compile time constant at all call sites to the intrinic method. + * Denotes that a parameter of an {@linkplain NodeIntrinsic intrinsic} method must be a compile + * time constant at all call sites to the intrinic method. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.PARAMETER) - public static @interface ConstantNodeParameter {} + public static @interface ConstantNodeParameter { + } /** - * Annotates a method that can be replaced by a compiler intrinsic. - * A (resolved) call to the annotated method can be replaced - * with an instance of the node class denoted by {@link #value()}. - * For this reason, the signature of the annotated method must match - * the signature of a constructor in the node class. + * Annotates a method that can be replaced by a compiler intrinsic. A (resolved) call to the + * annotated method can be replaced with an instance of the node class denoted by + * {@link #value()}. For this reason, the signature of the annotated method must match the + * signature of a constructor in the node class. *

    - * All methods annotated with this annotation must be declared native - * to ensure they throw a {@link UnsatisfiedLinkError} if called by - * non-Graal compiled code. + * All methods annotated with this annotation must be declared native to ensure they throw a + * {@link UnsatisfiedLinkError} if called by non-Graal compiled code. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public static @interface NodeIntrinsic { + /** - * Gets the {@link Node} subclass instantiated when intrinsifying a call to the annotated method. - * If not specified, then the class in which the annotated method is declared is used - * (and is assumed to be a {@link Node} subclass). + * Gets the {@link Node} subclass instantiated when intrinsifying a call to the annotated + * method. If not specified, then the class in which the annotated method is declared is + * used (and is assumed to be a {@link Node} subclass). */ Class value() default NodeIntrinsic.class; /** - * Determines if the stamp of the instantiated intrinsic node has its stamp set - * from the return type of the annotated method. + * Determines if the stamp of the instantiated intrinsic node has its stamp set from the + * return type of the annotated method. */ boolean setStampFromReturnType() default false; } - public interface ValueNumberable {} + public interface ValueNumberable { + } - public interface IterableNodeType {} + public interface IterableNodeType { + } private Graph graph; int id; - // this next pointer is used in Graph to implement fast iteration over NodeClass types, it therefore points to the next Node of the same type. + // this next pointer is used in Graph to implement fast iteration over NodeClass types, it + // therefore points to the next Node of the same type. Node typeCacheNext; private NodeUsagesList usages; @@ -132,7 +141,9 @@ } /** - * Returns an {@link NodeClassIterable iterable} which can be used to traverse all non-null input edges of this node. + * Returns an {@link NodeClassIterable iterable} which can be used to traverse all non-null + * input edges of this node. + * * @return an {@link NodeClassIterable iterable} for all non-null input edges. */ public NodeClassIterable inputs() { @@ -140,7 +151,9 @@ } /** - * Returns an {@link NodeClassIterable iterable} which can be used to traverse all non-null successor edges of this node. + * Returns an {@link NodeClassIterable iterable} which can be used to traverse all non-null + * successor edges of this node. + * * @return an {@link NodeClassIterable iterable} for all non-null successor edges. */ public NodeClassIterable successors() { @@ -172,8 +185,8 @@ } /** - * Updates the usages sets of the given nodes after an input slot is changed from oldInput to newInput: - * removes this node from oldInput's usages and adds this node to newInput's usages. + * Updates the usages sets of the given nodes after an input slot is changed from oldInput to + * newInput: removes this node from oldInput's usages and adds this node to newInput's usages. */ protected void updateUsages(Node oldInput, Node newInput) { assert assertTrue(usages != null, "usages == null while adding %s to %s", newInput, this); @@ -193,8 +206,9 @@ } /** - * Updates the predecessor of the given nodes after a successor slot is changed from oldSuccessor to newSuccessor: - * removes this node from oldSuccessor's predecessors and adds this node to newSuccessor's predecessors. + * Updates the predecessor of the given nodes after a successor slot is changed from + * oldSuccessor to newSuccessor: removes this node from oldSuccessor's predecessors and adds + * this node to newSuccessor's predecessors. */ protected void updatePredecessor(Node oldSuccessor, Node newSuccessor) { assert assertTrue(usages != null, "usages == null while adding %s to %s", newSuccessor, this); @@ -231,7 +245,7 @@ private boolean checkReplaceWith(Node other) { assert assertFalse(other == this, "cannot replace a node with itself"); assert assertFalse(isDeleted(), "cannot replace deleted node"); -// assert assertTrue(other != null, "cannot replace with null node"); + // assert assertTrue(other != null, "cannot replace with null node"); assert assertTrue(other == null || !other.isDeleted(), "cannot replace with deleted node %s", other); assert assertTrue(other == null || other.graph() == graph, "cannot replace with node in different graph: %s", other == null ? null : other.graph()); return true; @@ -318,8 +332,8 @@ } /** - * Removes this node from its graph. - * This node must have no {@linkplain Node#usages() usages} and no {@linkplain #predecessor() predecessor}. + * Removes this node from its graph. This node must have no {@linkplain Node#usages() usages} + * and no {@linkplain #predecessor() predecessor}. */ public void safeDelete() { assert checkDeletion(); @@ -406,16 +420,18 @@ } /** - * Returns an iterator that will provide all control-flow successors of this node. Normally this will be the contents of all fields marked as NodeSuccessor, - * but some node classes (like EndNode) may return different nodes. - * Note that the iterator may generate null values if the fields contain them. + * Returns an iterator that will provide all control-flow successors of this node. Normally this + * will be the contents of all fields marked as NodeSuccessor, but some node classes (like + * EndNode) may return different nodes. Note that the iterator may generate null values if the + * fields contain them. */ public Iterable cfgSuccessors() { return successors(); } /** - * hashCode and equals should always rely on object identity alone, thus hashCode and equals are final. + * hashCode and equals should always rely on object identity alone, thus hashCode and equals are + * final. */ @Override public final int hashCode() { @@ -423,7 +439,8 @@ } /** - * hashCode and equals should always rely on object identity alone, thus hashCode and equals are final. + * hashCode and equals should always rely on object identity alone, thus hashCode and equals are + * final. */ @Override public final boolean equals(Object obj) { @@ -431,17 +448,18 @@ } /** - * Provides a {@link Map} of properties of this node for use in debugging (e.g., to view in the ideal graph - * visualizer). + * Provides a {@link Map} of properties of this node for use in debugging (e.g., to view in the + * ideal graph visualizer). */ public Map getDebugProperties() { return getDebugProperties(new HashMap<>()); } - /** - * Fills a {@link Map} with properties of this node for use in debugging (e.g., to view in the ideal graph - * visualizer). Subclasses overriding this method should also fill the map using their superclass. + * Fills a {@link Map} with properties of this node for use in debugging (e.g., to view in the + * ideal graph visualizer). Subclasses overriding this method should also fill the map using + * their superclass. + * * @param map */ public Map getDebugProperties(Map map) { @@ -463,7 +481,8 @@ */ Id, /** - * Only the name of the node, which may contain some more information for certain node types (constants, ...). + * Only the name of the node, which may contain some more information for certain node types + * (constants, ...). */ Name, /** @@ -512,7 +531,6 @@ } } - @Deprecated public int getId() { return id; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeBitMap.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeBitMap.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeBitMap.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,6 +27,7 @@ import com.oracle.graal.graph.iterators.*; public final class NodeBitMap extends AbstractNodeIterable { + private final boolean autoGrow; private final BitSet bitMap; private final Graph graph; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Wed Jan 23 16:34:57 2013 +0100 @@ -21,6 +21,7 @@ * questions. */ package com.oracle.graal.graph; + import java.lang.reflect.*; import java.util.*; import java.util.Map.Entry; @@ -67,7 +68,6 @@ private final int iterableId; private int[] iterableIds; - public NodeClass(Class clazz) { super(clazz); assert NODE_CLASS.isAssignableFrom(clazz); @@ -175,6 +175,7 @@ } protected static class FieldScanner extends BaseFieldScanner { + public final ArrayList inputOffsets = new ArrayList<>(); public final ArrayList inputListOffsets = new ArrayList<>(); public final ArrayList successorOffsets = new ArrayList<>(); @@ -213,7 +214,6 @@ } } - @Override public String toString() { StringBuilder str = new StringBuilder(); @@ -235,10 +235,12 @@ /** * Describes an edge slot for a {@link NodeClass}. + * * @see NodeClass#get(Node, Position) * @see NodeClass#getName(Position) */ public static final class Position { + public final boolean input; public final int index; public final int subIndex; @@ -319,14 +321,14 @@ } /** - * An iterator that will iterate over the fields given in {@link #offsets}. - * The first {@link #directCount} offsets are treated as fields of type {@link Node}, - * while the rest of the fields are treated as {@link NodeList}s. - * All elements of these NodeLists will be visited by the iterator as well. - * This iterator can be used to iterate over the inputs or successors of a node. - * - * An iterator of this type will not return null values, unless the field values are modified concurrently. - * Concurrent modifications are detected by an assertion on a best-effort basis. + * An iterator that will iterate over the fields given in {@link #offsets}. The first + * {@link #directCount} offsets are treated as fields of type {@link Node}, while the rest of + * the fields are treated as {@link NodeList}s. All elements of these NodeLists will be visited + * by the iterator as well. This iterator can be used to iterate over the inputs or successors + * of a node. + * + * An iterator of this type will not return null values, unless the field values are modified + * concurrently. Concurrent modifications are detected by an assertion on a best-effort basis. */ public static final class NodeClassIterator implements Iterator { @@ -339,9 +341,11 @@ /** * Creates an iterator that will iterate over fields in the given node. + * * @param node the node which contains the fields. * @param offsets the offsets of the fields. - * @param directCount the number of fields that should be treated as fields of type {@link Node}, the rest are treated as {@link NodeList}s. + * @param directCount the number of fields that should be treated as fields of type + * {@link Node}, the rest are treated as {@link NodeList}s. */ private NodeClassIterator(Node node, long[] offsets, int directCount) { this.node = node; @@ -382,7 +386,7 @@ private Node nextElement() { if (index < directCount) { return getNode(node, offsets[index]); - } else if (index < offsets.length) { + } else if (index < offsets.length) { NodeList list = getNodeList(node, offsets[index]); return list.get(subIndex); } @@ -432,7 +436,7 @@ if (canGVN) { number = startGVNNumber; for (int i = 0; i < dataOffsets.length; ++i) { - Class< ? > type = dataTypes[i]; + Class type = dataTypes[i]; if (type.isPrimitive()) { if (type == Integer.TYPE) { int intValue = unsafe.getInt(n, dataOffsets[i]); @@ -462,7 +466,7 @@ /** * Populates a given map with the names and values of all data fields. - * + * * @param node the node from which to take the values. * @param properties a map that will be populated. */ @@ -567,7 +571,7 @@ public void set(Node node, Position pos, Node x) { long offset = pos.input ? inputOffsets[pos.index] : successorOffsets[pos.index]; if (pos.subIndex == NOT_ITERABLE) { - Node old = getNode(node, offset); + Node old = getNode(node, offset); assert x == null || fieldTypes.get((pos.input ? inputOffsets : successorOffsets)[pos.index]).isAssignableFrom(x.getClass()) : this + ".set(node, pos, " + x + ")"; putNode(node, offset, x); if (pos.input) { @@ -607,6 +611,7 @@ public NodeClassIterable getSuccessorIterable(final Node node) { assert clazz.isInstance(node); return new NodeClassIterable() { + @Override public NodeClassIterator iterator() { return new NodeClassIterator(node, successorOffsets, directSuccessorCount); @@ -624,7 +629,8 @@ while (index < directInputCount) { Node input = getNode(node, inputOffsets[index]); if (input == old) { - assert other == null || fieldTypes.get(inputOffsets[index]).isAssignableFrom(other.getClass()) : "Can not assign " + other.getClass() + " to " + fieldTypes.get(inputOffsets[index]) + " in " + node; + assert other == null || fieldTypes.get(inputOffsets[index]).isAssignableFrom(other.getClass()) : "Can not assign " + other.getClass() + " to " + fieldTypes.get(inputOffsets[index]) + + " in " + node; putNode(node, inputOffsets[index], other); return true; } @@ -646,7 +652,12 @@ while (index < directSuccessorCount) { Node successor = getNode(node, successorOffsets[index]); if (successor == old) { - assert other == null || fieldTypes.get(successorOffsets[index]).isAssignableFrom(other.getClass()); // : successorTypes[index] + " is not compatible with " + other.getClass(); + assert other == null || fieldTypes.get(successorOffsets[index]).isAssignableFrom(other.getClass()); // : + // successorTypes[index] + // + + // " is not compatible with " + // + + // other.getClass(); putNode(node, successorOffsets[index], other); return true; } @@ -664,8 +675,10 @@ } /** - * Clear all inputs in the given node. This is accomplished by setting input fields to null and replacing input lists with new lists. - * (which is important so that this method can be used to clear the inputs of cloned nodes.) + * Clear all inputs in the given node. This is accomplished by setting input fields to null and + * replacing input lists with new lists. (which is important so that this method can be used to + * clear the inputs of cloned nodes.) + * * @param node the node to be cleared */ public void clearInputs(Node node) { @@ -682,8 +695,10 @@ } /** - * Clear all successors in the given node. This is accomplished by setting successor fields to null and replacing successor lists with new lists. - * (which is important so that this method can be used to clear the successors of cloned nodes.) + * Clear all successors in the given node. This is accomplished by setting successor fields to + * null and replacing successor lists with new lists. (which is important so that this method + * can be used to clear the successors of cloned nodes.) + * * @param node the node to be cleared */ public void clearSuccessors(Node node) { @@ -700,7 +715,9 @@ } /** - * Copies the inputs from node to newNode. The nodes are expected to be of the exact same NodeClass type. + * Copies the inputs from node to newNode. The nodes are expected to be of the exact same + * NodeClass type. + * * @param node the node from which the inputs should be copied. * @param newNode the node to which the inputs should be copied. */ @@ -720,7 +737,9 @@ } /** - * Copies the successors from node to newNode. The nodes are expected to be of the exact same NodeClass type. + * Copies the successors from node to newNode. The nodes are expected to be of the exact same + * NodeClass type. + * * @param node the node from which the successors should be copied. * @param newNode the node to which the successors should be copied. */ @@ -835,8 +854,8 @@ } /** - * The template used to build the {@link Verbosity#Name} version. - * Variable part are specified using {i#inputName} or {p#propertyName}. + * The template used to build the {@link Verbosity#Name} version. Variable part are specified + * using {i#inputName} or {p#propertyName}. */ public String getNameTemplate() { return nameTemplate; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClassIterable.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClassIterable.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClassIterable.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,9 +27,11 @@ import com.oracle.graal.graph.iterators.*; /** - * The iterator returned by this iterable can be used to access {@link Position Positions} during iteration using {@link NodeClassIterator#nextPosition()}. + * The iterator returned by this iterable can be used to access {@link Position Positions} during + * iteration using {@link NodeClassIterator#nextPosition()}. */ public abstract class NodeClassIterable extends AbstractNodeIterable { + @Override public abstract NodeClassIterator iterator(); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeFlood.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeFlood.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeFlood.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,8 +26,8 @@ import java.util.Iterator; import java.util.Queue; +public class NodeFlood implements Iterable { -public class NodeFlood implements Iterable { private final NodeBitMap visited; private final Queue worklist; @@ -58,6 +58,7 @@ } private static class QueueConsumingIterator implements Iterator { + private final Queue queue; public QueueConsumingIterator(Queue queue) { @@ -86,6 +87,7 @@ } private static class UnmarkedNodeIterator implements Iterator { + private final NodeBitMap visited; private Iterator nodes; private Node nextNode; @@ -128,6 +130,7 @@ public Iterable unmarkedNodes() { return new Iterable() { + @Override public Iterator iterator() { return new UnmarkedNodeIterator(visited, visited.graph().getNodes().iterator()); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeInfo.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeInfo.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeInfo.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,14 +29,15 @@ import com.oracle.graal.graph.Node.*; - @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface NodeInfo { + String shortName() default ""; + /** - * The template used to build the {@link Verbosity#Name} version. - * Variable part are specified using {i#inputName} or {p#propertyName}. + * The template used to build the {@link Verbosity#Name} version. Variable part are specified + * using {i#inputName} or {p#propertyName}. */ String nameTemplate() default ""; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeInputList.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeInputList.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeInputList.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,7 +24,6 @@ import java.util.*; - public final class NodeInputList extends NodeList { private final Node self; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeList.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeList.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeList.java Wed Jan 23 16:34:57 2013 +0100 @@ -21,6 +21,7 @@ * questions. */ package com.oracle.graal.graph; + import java.util.*; import com.oracle.graal.graph.iterators.*; @@ -215,6 +216,7 @@ @Override public Iterator iterator() { return new Iterator() { + private final int expectedModCount = NodeList.this.modCount; private int index = 0; @@ -306,19 +308,18 @@ return -1; } - @Override public boolean contains(Object o) { return indexOf(o) != -1; } @Override - public boolean containsAll(Collection< ? > c) { + public boolean containsAll(Collection c) { throw new UnsupportedOperationException("not implemented"); } @Override - public boolean addAll(Collection< ? extends T> c) { + public boolean addAll(Collection c) { for (T e : c) { add(e); } @@ -350,31 +351,38 @@ public NodeIterable until(final T u) { return new FilteredNodeIterable<>(this).until(u); } + @Override public NodeIterable until(final Class clazz) { return new FilteredNodeIterable<>(this).until(clazz); } + @Override @SuppressWarnings("unchecked") public NodeIterable filter(Class clazz) { return (NodeIterable) new FilteredNodeIterable<>(this).and(NodePredicates.isA(clazz)); } + @Override public NodeIterable filterInterface(Class iface) { return new FilteredNodeIterable<>(this).and(NodePredicates.isAInterface(iface)); } + @Override public FilteredNodeIterable filter(NodePredicate predicate) { return new FilteredNodeIterable<>(this).and(predicate); } + @Override public FilteredNodeIterable nonNull() { return new FilteredNodeIterable<>(this).and(NodePredicates.isNotNull()); } + @Override public NodeIterable distinct() { return new FilteredNodeIterable<>(this).distinct(); } + @Override public T first() { if (size() > 0) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeMap.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeMap.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeMap.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,8 +26,8 @@ import java.util.*; import java.util.Map.Entry; +public final class NodeMap { -public final class NodeMap { private final Graph graph; private Object[] values; private int size; @@ -83,10 +83,13 @@ public Iterable> entries() { return new Iterable>() { + @Override public Iterator> iterator() { return new Iterator>() { + int i = 0; + @Override public boolean hasNext() { forward(); @@ -101,8 +104,10 @@ T value = (T) NodeMap.this.values[pos]; i++; forward(); - return new SimpleEntry(key, value){ + return new SimpleEntry(key, value) { + private static final long serialVersionUID = 7813842391085737738L; + @Override public T setValue(T v) { T oldv = super.setValue(v); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeUsagesList.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeUsagesList.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeUsagesList.java Wed Jan 23 16:34:57 2013 +0100 @@ -62,6 +62,7 @@ @Override public Iterator iterator() { return new Iterator() { + private final int expectedModCount = NodeUsagesList.this.modCount; private int index = 0; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeWorkList.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeWorkList.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeWorkList.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,6 +28,7 @@ import java.util.Queue; public class NodeWorkList implements Iterable { + private final NodeBitMap visited; private final NodeBitMap inQueue; private final Queue worklist; @@ -139,6 +140,7 @@ } private class QueueConsumingIterator implements Iterator { + private final Queue queue; public QueueConsumingIterator(Queue queue) { @@ -184,6 +186,7 @@ } private static class UnmarkedNodeIterator implements Iterator { + private final NodeBitMap visited; private Iterator nodes; private Node nextNode; @@ -227,6 +230,7 @@ public Iterable unmarkedNodes() { return new Iterable() { + @Override public Iterator iterator() { return new UnmarkedNodeIterator(visited, visited.graph().getNodes().iterator()); @@ -235,10 +239,13 @@ } public static class InfiniteWorkException extends RuntimeException { + private static final long serialVersionUID = -5319329402219396658L; + public InfiniteWorkException() { super(); } + public InfiniteWorkException(String message) { super(message); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/VerificationError.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/VerificationError.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/VerificationError.java Wed Jan 23 16:34:57 2013 +0100 @@ -22,19 +22,22 @@ */ package com.oracle.graal.graph; - /** - * This error represents a failed verification of a node . It must only be used for conditions that should never occur during normal operation. + * This error represents a failed verification of a node . It must only be used for conditions that + * should never occur during normal operation. */ public class VerificationError extends GraalInternalError { private static final long serialVersionUID = 8459607567446819822L; /** - * 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. + * 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. + * @param args parameters to String.format - parameters that implement {@link Iterable} will be + * expanded into a [x, x, ...] representation. */ public VerificationError(String msg, Object... args) { super(msg, args); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/AbstractNodeIterable.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/AbstractNodeIterable.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/AbstractNodeIterable.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,35 +27,43 @@ import com.oracle.graal.graph.*; public abstract class AbstractNodeIterable implements NodeIterable { + @Override public NodeIterable until(final T u) { return new FilteredNodeIterable<>(this).until(u); } + @Override public NodeIterable until(final Class clazz) { return new FilteredNodeIterable<>(this).until(clazz); } + @Override @SuppressWarnings("unchecked") public NodeIterable filter(Class clazz) { return (NodeIterable) new FilteredNodeIterable<>(this).and(NodePredicates.isA(clazz)); } + @Override public NodeIterable filterInterface(Class iface) { return new FilteredNodeIterable<>(this).and(NodePredicates.isAInterface(iface)); } + @Override public FilteredNodeIterable filter(NodePredicate predicate) { return new FilteredNodeIterable<>(this).and(predicate); } + @Override public FilteredNodeIterable nonNull() { return new FilteredNodeIterable<>(this).and(NodePredicates.isNotNull()); } + @Override public NodeIterable distinct() { return new FilteredNodeIterable<>(this).distinct(); } + @Override public List snapshot() { ArrayList list = new ArrayList<>(); @@ -64,12 +72,14 @@ } return list; } + @Override public void snapshotTo(List to) { for (T n : this) { to.add(n); } } + @Override public T first() { Iterator iterator = iterator(); @@ -78,6 +88,7 @@ } return null; } + @Override public int count() { int count = 0; @@ -88,14 +99,17 @@ } return count; } + @Override public boolean isEmpty() { return !iterator().hasNext(); } + @Override public boolean isNotEmpty() { return iterator().hasNext(); } + @Override public boolean contains(T node) { return this.filter(NodePredicates.equals(node)).isNotEmpty(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/DistinctFilteredNodeIterable.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/DistinctFilteredNodeIterable.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/DistinctFilteredNodeIterable.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,7 +26,6 @@ import com.oracle.graal.graph.*; - public class DistinctFilteredNodeIterable extends FilteredNodeIterable { public DistinctFilteredNodeIterable(NodeIterable nodeIterable) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/DistinctPredicatedProxyNodeIterator.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/DistinctPredicatedProxyNodeIterator.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/DistinctPredicatedProxyNodeIterator.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,8 +26,8 @@ import com.oracle.graal.graph.*; +public class DistinctPredicatedProxyNodeIterator extends PredicatedProxyNodeIterator { -public class DistinctPredicatedProxyNodeIterator extends PredicatedProxyNodeIterator { private NodeBitMap visited; public DistinctPredicatedProxyNodeIterator(NodePredicate until, Iterator iterator, NodePredicate predicate) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/FilteredNodeIterable.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/FilteredNodeIterable.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/FilteredNodeIterable.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,35 +27,43 @@ import com.oracle.graal.graph.*; public class FilteredNodeIterable extends AbstractNodeIterable { + protected final NodeIterable nodeIterable; protected NodePredicate predicate = NodePredicates.alwaysTrue(); protected NodePredicate until = NodePredicates.isNull(); + public FilteredNodeIterable(NodeIterable nodeIterable) { this.nodeIterable = nodeIterable; } + public FilteredNodeIterable and(NodePredicate nodePredicate) { this.predicate = this.predicate.and(nodePredicate); return this; } + public FilteredNodeIterable or(NodePredicate nodePredicate) { this.predicate = this.predicate.or(nodePredicate); return this; } + @Override public NodeIterable until(final T u) { until = until.or(NodePredicates.equals(u)); return this; } + @Override public NodeIterable until(final Class clazz) { until = until.or(NodePredicates.isA(clazz)); return this; } + @Override public FilteredNodeIterable nonNull() { this.predicate = this.predicate.and(NodePredicates.isNotNull()); return this; } + @Override public DistinctFilteredNodeIterable distinct() { DistinctFilteredNodeIterable distinct = new DistinctFilteredNodeIterable<>(nodeIterable); @@ -63,6 +71,7 @@ distinct.until = until; return distinct; } + @Override public Iterator iterator() { return new PredicatedProxyNodeIterator<>(until, nodeIterable.iterator(), predicate); @@ -80,7 +89,7 @@ } @Override - public FilteredNodeIterable filterInterface(Class< ? > iface) { + public FilteredNodeIterable filterInterface(Class iface) { return this.and(NodePredicates.isAInterface(iface)); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodeIterable.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodeIterable.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodeIterable.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,11 +30,11 @@ NodeIterable until(T u); - NodeIterable until(Class< ? extends T> clazz); + NodeIterable until(Class clazz); NodeIterable filter(Class clazz); - NodeIterable filterInterface(Class< ? > iface); + NodeIterable filterInterface(Class iface); FilteredNodeIterable filter(NodePredicate predicate); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodeIterator.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodeIterator.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodeIterator.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,14 +26,18 @@ import com.oracle.graal.graph.*; -public abstract class NodeIterator implements Iterator{ +public abstract class NodeIterator implements Iterator { + protected T current; + protected abstract void forward(); + @Override public boolean hasNext() { forward(); return current != null; } + @Override public T next() { forward(); @@ -44,6 +48,7 @@ current = null; return ret; } + @Override public void remove() { throw new UnsupportedOperationException(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodePredicates.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodePredicates.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodePredicates.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,6 +25,7 @@ import com.oracle.graal.graph.*; public abstract class NodePredicates { + private static final TautologyPredicate TAUTOLOGY = new TautologyPredicate(); private static final FalsePredicate FALSE = new FalsePredicate(); private static final IsNullPredicate IS_NULL = new IsNullPredicate(); @@ -126,6 +127,7 @@ } private static final class TautologyPredicate extends NodePredicate { + @Override public boolean apply(Node n) { return true; @@ -133,6 +135,7 @@ } private static final class FalsePredicate extends NodePredicate { + @Override public boolean apply(Node n) { return false; @@ -140,12 +143,15 @@ } private static final class AndPredicate extends NodePredicate { + private final NodePredicate a; private final NodePredicate b; + private AndPredicate(NodePredicate a, NodePredicate b) { this.a = a; this.b = b; } + @Override public boolean apply(Node n) { return a.apply(n) && b.apply(n); @@ -153,10 +159,13 @@ } private static final class NotPredicate extends NodePredicate { + private final NodePredicate a; + private NotPredicate(NodePredicate n) { this.a = n; } + @Override public boolean apply(Node n) { return !a.apply(n); @@ -164,12 +173,15 @@ } private static final class OrPredicate extends NodePredicate { + private final NodePredicate a; private final NodePredicate b; + private OrPredicate(NodePredicate a, NodePredicate b) { this.a = a; this.b = b; } + @Override public boolean apply(Node n) { return a.apply(n) || b.apply(n); @@ -177,6 +189,7 @@ } private static final class IsNullPredicate extends NodePredicate { + @Override public boolean apply(Node n) { return n == null; @@ -184,6 +197,7 @@ } private static final class IsNotNullPredicate extends NodePredicate { + @Override public boolean apply(Node n) { return n != null; @@ -191,10 +205,13 @@ } private static final class EqualsPredicate extends NodePredicate { + private final Node u; + public EqualsPredicate(Node u) { this.u = u; } + @Override public boolean apply(Node n) { return u == n; @@ -202,10 +219,13 @@ } private static final class NotEqualsPredicate extends NodePredicate { + private final Node u; + public NotEqualsPredicate(Node u) { this.u = u; } + @Override public boolean apply(Node n) { return u != n; @@ -213,21 +233,26 @@ } public static final class PositiveTypePredicate extends NodePredicate { + private final Class type; private PositiveTypePredicate or; + public PositiveTypePredicate(Class type) { this.type = type; } + public PositiveTypePredicate(NegativeTypePredicate a) { type = a.type; if (a.nor != null) { or = new PositiveTypePredicate(a.nor); } } + @Override public boolean apply(Node n) { return type.isInstance(n) || (or != null && or.apply(n)); } + public PositiveTypePredicate or(Class clazz) { if (or == null) { or = new PositiveTypePredicate(clazz); @@ -239,21 +264,26 @@ } public static final class NegativeTypePredicate extends NodePredicate { + private final Class type; private NegativeTypePredicate nor; + public NegativeTypePredicate(Class type) { this.type = type; } + public NegativeTypePredicate(PositiveTypePredicate a) { type = a.type; if (a.or != null) { nor = new NegativeTypePredicate(a.or); } } + @Override public boolean apply(Node n) { return !type.isInstance(n) && (nor == null || nor.apply(n)); } + public NegativeTypePredicate nor(Class clazz) { if (nor == null) { nor = new NegativeTypePredicate(clazz); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/PredicatedProxyNodeIterator.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/PredicatedProxyNodeIterator.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/PredicatedProxyNodeIterator.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,14 +27,17 @@ import com.oracle.graal.graph.*; public class PredicatedProxyNodeIterator extends NodeIterator { + private final Iterator iterator; private final NodePredicate predicate; private final NodePredicate until; + public PredicatedProxyNodeIterator(NodePredicate until, Iterator iterator, NodePredicate predicate) { this.until = until; this.iterator = iterator; this.predicate = predicate; } + @Override protected void forward() { while ((current == null || !current.isAlive() || !predicate.apply(current)) && iterator.hasNext()) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DirectCallOp.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DirectCallOp.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DirectCallOp.java Wed Jan 23 16:34:57 2013 +0100 @@ -37,27 +37,25 @@ import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind; /** - * A direct call that complies with the conventions for such calls in HotSpot. - * In particular, for calls using an inline cache, a MOVE instruction is - * emitted just prior to the aligned direct call. This instruction - * (which moves 0L in RAX) is patched by the C++ Graal code to replace the - * 0L constant with Universe::non_oop_word(), a special sentinel - * used for the initial value of the Klass in an inline cache. + * A direct call that complies with the conventions for such calls in HotSpot. In particular, for + * calls using an inline cache, a MOVE instruction is emitted just prior to the aligned direct call. + * This instruction (which moves 0L in RAX) is patched by the C++ Graal code to replace the 0L + * constant with Universe::non_oop_word(), a special sentinel used for the initial value of the + * Klass in an inline cache. *

    - * For non-inline cache calls (i.e., INVOKESTATIC and INVOKESPECIAL), a static - * call stub is emitted. Initially, these calls go to the global static call - * resolution stub (i.e., SharedRuntime::get_resolve_static_call_stub()). - * Resolution will link the call to a compiled version of the callee if - * available otherwise to the interpreter. The interpreter expects to - * find the Method* for the callee in RBX. To achieve this, the static call - * is linked to a static call stub which initializes RBX and jumps to the - * interpreter. This pattern is shown below: + * For non-inline cache calls (i.e., INVOKESTATIC and INVOKESPECIAL), a static call stub is emitted. + * Initially, these calls go to the global static call resolution stub (i.e., + * SharedRuntime::get_resolve_static_call_stub()). Resolution will link the call to a compiled + * version of the callee if available otherwise to the interpreter. The interpreter expects to find + * the Method* for the callee in RBX. To achieve this, the static call is linked to a static call + * stub which initializes RBX and jumps to the interpreter. This pattern is shown below: + * *

      *       call L1
      *       nop
    - *
    + * 
      *       ...
    - *
    + * 
      *   L1: mov rbx [Method*]
      *       jmp [interpreter entry point]
      * 
    @@ -66,9 +64,9 @@ final class AMD64DirectCallOp extends DirectCallOp { /** - * The mark emitted at the position of the direct call instruction. - * This is only recorded for calls that have an associated static - * call stub (i.e., {@code invokeKind == Static || invokeKind == Special}). + * The mark emitted at the position of the direct call instruction. This is only recorded for + * calls that have an associated static call stub (i.e., + * {@code invokeKind == Static || invokeKind == Special}). */ Mark callsiteMark; @@ -80,16 +78,19 @@ if (invokeKind == Static || invokeKind == Special) { lir.stubs.add(new AMD64Code() { + public String description() { return "static call stub for Invoke" + AMD64DirectCallOp.this.invokeKind; } + @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { assert callsiteMark != null : "static call site has not yet been emitted"; tasm.recordMark(Marks.MARK_STATIC_CALL_STUB, callsiteMark); masm.movq(AMD64.rbx, 0L); int pos = masm.codeBuffer.position(); - // Create a jump-to-self as expected by CompiledStaticCall::set_to_interpreted() in compiledIC.cpp + // Create a jump-to-self as expected by CompiledStaticCall::set_to_interpreted() + // in compiledIC.cpp masm.jmp(pos, true); } }); @@ -103,7 +104,8 @@ tasm.recordMark(invokeKind == Static ? Marks.MARK_INVOKESTATIC : Marks.MARK_INVOKESPECIAL); } else { assert invokeKind == Virtual || invokeKind == Interface; - // The mark for an invocation that uses an inline cache must be placed at the instruction + // The mark for an invocation that uses an inline cache must be placed at the + // instruction // that loads the Klass from the inline cache so that the C++ code can find it // and replace the inline 0L value with Universe::non_oop_word() tasm.recordMark(invokeKind == Virtual ? Marks.MARK_INVOKEVIRTUAL : Marks.MARK_INVOKEINTERFACE); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Wed Jan 23 16:34:57 2013 +0100 @@ -231,15 +231,12 @@ @Override public TargetMethodAssembler newAssembler(FrameMap frameMap, LIR lir) { // Omit the frame if the method: - // - has no spill slots or other slots allocated during register allocation - // - has no callee-saved registers - // - has no incoming arguments passed on the stack - // - has no instructions with debug info - boolean omitFrame = GraalOptions.CanOmitFrame && - frameMap.frameSize() == frameMap.initialFrameSize && - frameMap.registerConfig.getCalleeSaveLayout().registers.length == 0 && - !lir.hasArgInCallerFrame() && - !lir.hasDebugInfo(); + // - has no spill slots or other slots allocated during register allocation + // - has no callee-saved registers + // - has no incoming arguments passed on the stack + // - has no instructions with debug info + boolean omitFrame = GraalOptions.CanOmitFrame && frameMap.frameSize() == frameMap.initialFrameSize && frameMap.registerConfig.getCalleeSaveLayout().registers.length == 0 && + !lir.hasArgInCallerFrame() && !lir.hasDebugInfo(); AbstractAssembler masm = new AMD64MacroAssembler(target, frameMap.registerConfig); HotSpotFrameContext frameContext = omitFrame ? null : new HotSpotFrameContext(); @@ -262,8 +259,9 @@ if (!isStatic) { tasm.recordMark(Marks.MARK_UNVERIFIED_ENTRY); - CallingConvention cc = regConfig.getCallingConvention(JavaCallee, null, new JavaType[] {runtime().lookupJavaType(Object.class)}, target, false); - Register inlineCacheKlass = rax; // see definition of IC_Klass in c1_LIRAssembler_x86.cpp + CallingConvention cc = regConfig.getCallingConvention(JavaCallee, null, new JavaType[]{runtime().lookupJavaType(Object.class)}, target, false); + Register inlineCacheKlass = rax; // see definition of IC_Klass in + // c1_LIRAssembler_x86.cpp Register receiver = asRegister(cc.getArgument(0)); Address src = new Address(target.wordKind, receiver.asValue(), config.hubOffset); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64IndirectCallOp.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64IndirectCallOp.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64IndirectCallOp.java Wed Jan 23 16:34:57 2013 +0100 @@ -37,10 +37,10 @@ import com.oracle.graal.lir.asm.*; /** - * A register indirect call that complies with the extra conventions for such calls in HotSpot. - * In particular, the metaspace Method of the callee must be in RBX for the case where a vtable entry's - * _from_compiled_entry is the address of an C2I adapter. Such adapters expect the target - * method to be in RBX. + * A register indirect call that complies with the extra conventions for such calls in HotSpot. In + * particular, the metaspace Method of the callee must be in RBX for the case where a vtable entry's + * _from_compiled_entry is the address of an C2I adapter. Such adapters expect the target method to + * be in RBX. */ @Opcode("CALL_INDIRECT") final class AMD64IndirectCallOp extends IndirectCallOp { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64SafepointOp.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64SafepointOp.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64SafepointOp.java Wed Jan 23 16:34:57 2013 +0100 @@ -39,6 +39,7 @@ */ @Opcode("SAFEPOINT") public class AMD64SafepointOp extends AMD64LIRInstruction { + @State protected LIRFrameState state; private final HotSpotVMConfig config; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64TailcallOp.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64TailcallOp.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64TailcallOp.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,10 +32,12 @@ import com.oracle.graal.lir.asm.*; /** - * Performs a hard-coded tail call to the specified target, which normally should be an {@link InstalledCode} instance. + * Performs a hard-coded tail call to the specified target, which normally should be an + * {@link InstalledCode} instance. */ @Opcode("TAILCALL") public class AMD64TailcallOp extends AMD64LIRInstruction { + @Use protected Value target; @Alive protected Value[] parameters; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java --- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,7 +33,8 @@ import com.oracle.graal.hotspot.logging.*; /** - * Server side of the client/server compilation model. The server listens for connections on the hardcoded port 1199. + * Server side of the client/server compilation model. The server listens for connections on the + * hardcoded port 1199. */ public class CompilationServer implements Runnable { @@ -52,11 +53,12 @@ private final ArrayList observers = new ArrayList<>(); /** - * Creates a new Compilation server. The server is activated by calling {@link #run()} directly or via a new - * {@link Thread}. - * - * @param multiple true if the server should server should serve an infinite amount of consecutive connections, - * false if it should terminate after the first connection ends. + * Creates a new Compilation server. The server is activated by calling {@link #run()} directly + * or via a new {@link Thread}. + * + * @param multiple true if the server should server should serve an infinite amount of + * consecutive connections, false if it should terminate after the first connection + * ends. */ public CompilationServer(boolean multiple) { this.multiple = multiple; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/InvocationSocket.java --- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/InvocationSocket.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/InvocationSocket.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,10 +30,11 @@ /** * 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 recursive. + * + * 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 + * recursive. */ public class InvocationSocket { @@ -64,6 +65,7 @@ if (COUNT_CALLS) { Runtime.getRuntime().addShutdownHook(new Thread() { + @Override public void run() { SortedMap sorted = new TreeMap<>(); @@ -80,7 +82,7 @@ /** * Represents one invocation of a method that is transferred via the socket connection. - * + * */ private static class Invocation implements Serializable { @@ -99,7 +101,7 @@ /** * Represents the result of an invocation that is transferred via the socket connection. - * + * */ private static class Result implements Serializable { @@ -124,9 +126,10 @@ } /** - * 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. - * + * 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 { @@ -181,8 +184,9 @@ } /** - * Waits for the result of a remote method invocation. Invocations that should be executed in this VM might arrive - * while waiting for the result, and these invocations will be executed before again waiting fort he result. + * Waits for the result of a remote method invocation. Invocations that should be executed in + * this VM might arrive while waiting for the result, and these invocations will be executed + * before again waiting fort he result. */ @SuppressWarnings("unused") public Object waitForResult(boolean eofExpected) throws IOException, ClassNotFoundException { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/Remote.java --- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/Remote.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/Remote.java Wed Jan 23 16:34:57 2013 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.hotspot.server; - public interface Remote { } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/ReplacingStreams.java --- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/ReplacingStreams.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/ReplacingStreams.java Wed Jan 23 16:34:57 2013 +0100 @@ -41,7 +41,8 @@ public ReplacingStreams(OutputStream outputStream, InputStream inputStream) throws IOException { output = new ReplacingOutputStream(new BufferedOutputStream(outputStream)); - // required, because creating an ObjectOutputStream writes a header, but doesn't flush the stream + // required, because creating an ObjectOutputStream writes a header, but doesn't flush the + // stream output.flush(); input = new ReplacingInputStream(new BufferedInputStream(inputStream)); invocation = new InvocationSocket(output, input); @@ -97,6 +98,7 @@ } public static class NewDummyPlaceholder implements Serializable { + private static final long serialVersionUID = 2692666726573532288L; } @@ -112,7 +114,8 @@ @Override protected Object resolveObject(Object obj) throws IOException { - // see ReplacingInputStream.replaceObject for details on when these types of objects are created + // see ReplacingInputStream.replaceObject for details on when these types of objects are + // created if (obj instanceof Placeholder) { Placeholder placeholder = (Placeholder) obj; @@ -191,7 +194,8 @@ } private Object createRemoteCallPlaceholder(Object obj) { - // collect all interfaces that this object's class implements (proxies only support interfaces) + // collect all interfaces that this object's class implements (proxies only support + // interfaces) objectMap.put(obj, new Placeholder(objectList.size())); objectList.add(obj); return new NewRemoteCallPlaceholder(ProxyUtil.getAllInterfaces(obj.getClass())); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/ArrayCopyIntrinsificationTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/ArrayCopyIntrinsificationTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/ArrayCopyIntrinsificationTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -35,7 +35,6 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; - /** * Tests intrinsification of {@link System#arraycopy(Object, int, Object, int, int)}. */ @@ -48,7 +47,7 @@ boolean graphWasProcessed = nodeCount != graph.getNodeCount(); if (graphWasProcessed) { if (mustIntrinsify) { - for (Node node: graph.getNodes()) { + for (Node node : graph.getNodes()) { if (node instanceof Invoke) { Invoke invoke = (Invoke) node; Assert.assertTrue(invoke.callTarget() instanceof DirectCallTargetNode); @@ -57,12 +56,12 @@ JavaMethod callee = (JavaMethod) directCall.target(); Assert.assertTrue(callee.getName().equals("")); Assert.assertTrue(runtime.lookupJavaType(ArrayIndexOutOfBoundsException.class).equals(callee.getDeclaringClass()) || - runtime.lookupJavaType(NullPointerException.class).equals(callee.getDeclaringClass())); + runtime.lookupJavaType(NullPointerException.class).equals(callee.getDeclaringClass())); } } } else { boolean found = false; - for (Node node: graph.getNodes()) { + for (Node node : graph.getNodes()) { if (node instanceof Invoke) { Invoke invoke = (Invoke) node; DirectCallTargetNode directCall = (DirectCallTargetNode) invoke.callTarget(); @@ -174,7 +173,7 @@ // Complete array copy test(name, src, 0, newArray(src, srcLength), 0, srcLength); - for (int length : new int[] {0, 1, srcLength - 1, srcLength}) { + for (int length : new int[]{0, 1, srcLength - 1, srcLength}) { // Partial array copying test(name, src, 0, newArray(src, length), 0, length); test(name, src, srcLength - length, newArray(src, length), 0, length); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java Wed Jan 23 16:34:57 2013 +0100 @@ -67,10 +67,8 @@ private final String holder; private final String name; private final String signature; - @AbsoluteTimeValue - private final long startTime; - @TimeValue - private long duration; + @AbsoluteTimeValue private final long startTime; + @TimeValue private long duration; private int startInvCount; private int endInvCount; private int bytecodeCount; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,11 +34,10 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.phases.*; - public final class CompilationTask implements Runnable, Comparable { + public static final ThreadLocal withinEnqueue = new ThreadLocal() { - public static final ThreadLocal withinEnqueue = new ThreadLocal() { @Override protected Boolean initialValue() { return Boolean.valueOf(Thread.currentThread() instanceof CompilerThread); @@ -118,7 +117,8 @@ try { final boolean printCompilation = GraalOptions.PrintCompilation && !TTY.isSuppressed(); if (printCompilation) { - TTY.println(String.format("%-6d Graal %-70s %-45s %-50s %s...", id, method.getDeclaringClass().getName(), method.getName(), method.getSignature(), entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI ? "" : "(OSR@" + entryBCI + ") ")); + TTY.println(String.format("%-6d Graal %-70s %-45s %-50s %s...", id, method.getDeclaringClass().getName(), method.getName(), method.getSignature(), + entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI ? "" : "(OSR@" + entryBCI + ") ")); } CompilationResult result = null; @@ -136,7 +136,7 @@ } else { // Compiling an intrinsic graph - must clone the graph graph = graph.copy(); - //System.out.println("compiling intrinsic " + method); + // System.out.println("compiling intrinsic " + method); } return graalRuntime.getCompiler().compileMethod(method, graph, graalRuntime.getCache(), plan, optimisticOpts); } @@ -169,13 +169,14 @@ } private void installMethod(final CompilationResult tm) { - Debug.scope("CodeInstall", new Object[] {new DebugDumpScope(String.valueOf(id), true), graalRuntime.getCompiler(), method}, new Runnable() { + Debug.scope("CodeInstall", new Object[]{new DebugDumpScope(String.valueOf(id), true), graalRuntime.getCompiler(), method}, new Runnable() { + @Override public void run() { final CodeInfo[] info = Debug.isDumpEnabled() ? new CodeInfo[1] : null; graalRuntime.getRuntime().installMethod(method, entryBCI, tm, info); if (info != null) { - Debug.dump(new Object[] {tm, info[0]}, "After code installation"); + Debug.dump(new Object[]{tm, info[0]}, "After code installation"); } } @@ -195,7 +196,6 @@ @Override public String toString() { - return "Compilation[id=" + id + ", prio=" + priority + " " + MetaUtil.format("%H.%n(%p)", method) + - (entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI ? "" : "@" + entryBCI) + "]"; + return "Compilation[id=" + id + ", prio=" + priority + " " + MetaUtil.format("%H.%n(%p)", method) + (entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI ? "" : "@" + entryBCI) + "]"; } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,10 +26,10 @@ import com.oracle.graal.api.meta.Kind.*; - /** * Parent class for all HotSpot types that need to be serialized. */ public abstract class CompilerObject implements Serializable, FormatWithToString { + private static final long serialVersionUID = -4551670987101214877L; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerThread.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerThread.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerThread.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,7 +30,6 @@ import com.oracle.graal.phases.*; import com.oracle.graal.printer.*; - public final class CompilerThread extends Thread { public static final ThreadFactory FACTORY = new ThreadFactory() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilationResult.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilationResult.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilationResult.java Wed Jan 23 16:34:57 2013 +0100 @@ -57,6 +57,7 @@ } static class SiteComparator implements Comparator { + public int compare(Site s1, Site s2) { if (s1.pcOffset == s2.pcOffset && (s1 instanceof Mark ^ s2 instanceof Mark)) { return s1 instanceof Mark ? -1 : 1; @@ -66,7 +67,7 @@ } private static Site[] getSortedSites(CompilationResult target) { - List[] lists = new List[] {target.getSafepoints(), target.getDataReferences(), target.getMarks()}; + List[] lists = new List[]{target.getSafepoints(), target.getDataReferences(), target.getMarks()}; int count = 0; for (List list : lists) { count += list.size(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Wed Jan 23 16:34:57 2013 +0100 @@ -41,9 +41,8 @@ /** * Singleton class holding the instance of the {@link GraalRuntime}. - * - * The platform specific subclass is created by a call from - * the C++ HotSpot code. + * + * The platform specific subclass is created by a call from the C++ HotSpot code. */ public abstract class HotSpotGraalRuntime implements GraalRuntime { @@ -107,8 +106,8 @@ return unsafe.getInt(address); } - protected /*final*/ CompilerToVM compilerToVm; - protected /*final*/ VMToCompiler vmToCompiler; + protected/* final */CompilerToVM compilerToVm; + protected/* final */VMToCompiler vmToCompiler; protected final HotSpotRuntime runtime; protected final GraalCompiler compiler; @@ -165,7 +164,9 @@ } protected abstract TargetDescription createTarget(); + protected abstract HotSpotBackend createBackend(); + protected abstract HotSpotRuntime createRuntime(); public HotSpotVMConfig getConfig() { @@ -196,7 +197,7 @@ if (name.length() == 1 && vmToCompiler instanceof VMToCompilerImpl) { VMToCompilerImpl impl = (VMToCompilerImpl) vmToCompiler; Kind kind = Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0)); - switch(kind) { + switch (kind) { case Boolean: return impl.typeBoolean; case Byte: diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRGenerator.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRGenerator.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRGenerator.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,14 +28,14 @@ import com.oracle.graal.nodes.spi.*; /** - * This interface defines the contract a HotSpot backend LIR generator needs to fulfill - * in addition to abstract methods from {@link LIRGenerator} and {@link LIRGeneratorTool}. + * This interface defines the contract a HotSpot backend LIR generator needs to fulfill in addition + * to abstract methods from {@link LIRGenerator} and {@link LIRGeneratorTool}. */ public interface HotSpotLIRGenerator { /** * Emits an operation to make a tail call. - * + * * @param args the arguments of the call * @param address the target address of the call */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java Wed Jan 23 16:34:57 2013 +0100 @@ -69,7 +69,7 @@ Field f; try { f = GraalOptions.class.getDeclaredField(fieldName); - Class< ? > fType = f.getType(); + Class fType = f.getType(); if (value == null) { if (fType == Boolean.TYPE) { @@ -101,7 +101,7 @@ if (value != null) { f.setAccessible(true); f.set(null, value); - //Logger.info("Set option " + fieldName + " to " + value); + // Logger.info("Set option " + fieldName + " to " + value); } else { Logger.info("Wrong value \"" + valueString + "\" for option " + fieldName); return false; @@ -127,6 +127,7 @@ Logger.info("[Graal flags]"); Field[] flags = GraalOptions.class.getDeclaredFields(); Arrays.sort(flags, new Comparator() { + public int compare(Field o1, Field o2) { return o1.getName().compareTo(o2.getName()); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotRuntimeInterpreterInterface.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotRuntimeInterpreterInterface.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotRuntimeInterpreterInterface.java Wed Jan 23 16:34:57 2013 +0100 @@ -40,7 +40,7 @@ this.metaProvider = metaProvider; } - public Class< ? > getMirror(ResolvedJavaType type) { + public Class getMirror(ResolvedJavaType type) { return ((HotSpotResolvedJavaType) type).mirror(); } @@ -159,7 +159,6 @@ } } - public void setFieldFloat(float value, Object base, ResolvedJavaField field) { long offset = resolveOffset(field); if (isVolatile(field)) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Wed Jan 23 16:34:57 2013 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.hotspot; - /** * Used to communicate configuration details, runtime offsets, etc. to Graal upon compileMethod. */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Wed Jan 23 16:34:57 2013 +0100 @@ -36,7 +36,7 @@ /** * Copies the original bytecode of a given method into a given byte array. - * + * * @param metaspaceMethod the metaspace Method object * @param code the array into which to copy the original bytecode * @return the value of {@code code} @@ -49,7 +49,7 @@ /** * Determines if a given metaspace Method object has balanced monitors. - * + * * @param metaspaceMethod the metaspace Method object to query * @return true if the method has balanced monitors */ @@ -63,9 +63,9 @@ *
  • the method may have a bytecode breakpoint set
  • *
  • the method may have other bytecode features that require special handling by the VM
  • * - * + * * A non-compilable method should not be inlined. - * + * * @param metaspaceMethod the metaspace Method object to query * @return true if the method is compilable */ @@ -73,24 +73,26 @@ /** * Used to implement {@link ResolvedJavaType#findUniqueConcreteMethod(ResolvedJavaMethod)}. - * + * * @param metaspaceMethod the metaspace Method on which to based the search * @param resultHolder the holder of the result is put in element 0 of this array - * @return the metaspace Method result or 0 is there is no unique concrete method for {@code metaspaceMethod} + * @return the metaspace Method result or 0 is there is no unique concrete method for + * {@code metaspaceMethod} */ long getUniqueConcreteMethod(long metaspaceMethod, HotSpotResolvedObjectType[] resultHolder); /** * Used to determine if an interface has exactly one implementor. - * + * * @param interfaceType interface for which the implementor should be returned - * @return the unique implementor of the interface or null if the interface has 0 or more than 1 implementor + * @return the unique implementor of the interface or null if the interface has 0 or more than 1 + * implementor */ ResolvedJavaType getUniqueImplementor(HotSpotResolvedObjectType interfaceType); /** * Gets the invocation count for a method. - * + * * @param metaspaceMethod the metaspace Method object to query * @return the invocation count for the method */ @@ -98,7 +100,7 @@ /** * Initializes a {@link HotSpotResolvedJavaMethod} object from a metaspace Method object. - * + * * @param metaspaceMethod the metaspace Method object * @param method address of a metaspace Method object */ @@ -106,7 +108,7 @@ /** * Initializes a {@link HotSpotMethodData} object from a metaspace MethodData object. - * + * * @param metaspaceMethodData the metaspace MethodData object * @param methodData the object to initialize from the metaspace object */ @@ -114,13 +116,13 @@ /** * Converts a name to a Java type. - * + * * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format * @param accessingClass the context of resolution (may be null) - * @param eagerResolve force resolution to a {@link ResolvedJavaType}. If true, this method will either return a - * {@link ResolvedJavaType} or throw an exception - * @return a Java type for {@code name} which is guaranteed to be of type {@link ResolvedJavaType} if - * {@code eagerResolve == true} + * @param eagerResolve force resolution to a {@link ResolvedJavaType}. If true, this method will + * either return a {@link ResolvedJavaType} or throw an exception + * @return a Java type for {@code name} which is guaranteed to be of type + * {@link ResolvedJavaType} if {@code eagerResolve == true} * @throws LinkageError if {@code eagerResolve == true} and the resolution failed */ JavaType lookupType(String name, HotSpotResolvedObjectType accessingClass, boolean eagerResolve); @@ -137,18 +139,17 @@ // Must be kept in sync with enum in graalEnv.hpp public enum CodeInstallResult { - OK, - DEPENDENCIES_FAILED, - CACHE_FULL + OK, DEPENDENCIES_FAILED, CACHE_FULL } /** * Installs the result of a compilation into the code cache. - * + * * @param compResult the result of a compilation - * @param code if not null, then the code is installed as the non-default compiled code for the associated method - * and the details of the installation are written to this object - * @param info additional information about the installation are written to this object if it is not null + * @param code if not null, then the code is installed as the non-default compiled code for the + * associated method and the details of the installation are written to this object + * @param info additional information about the installation are written to this object if it is + * not null * @return the outcome of the installation as a {@link CodeInstallResult}. */ CodeInstallResult installCode(HotSpotCompilationResult compResult, HotSpotInstalledCode code, HotSpotCodeInfo info); @@ -167,7 +168,7 @@ /** * Gets the compiled code size for a method. - * + * * @param metaspaceMethod the metaspace Method object to query * @return the compiled code size the method */ @@ -175,12 +176,13 @@ /** * Gets the metaspace Method object corresponding to a given reflection {@link Method} object. - * + * * @param reflectionMethod * @param resultHolder the holder of the result is put in element 0 of this array * @return the metaspace Method result for {@code reflectionMethod} */ long getMetaspaceMethod(Method reflectionMethod, HotSpotResolvedObjectType[] resultHolder); + long getMetaspaceConstructor(Constructor reflectionConstructor, HotSpotResolvedObjectType[] resultHolder); HotSpotResolvedJavaField getJavaField(Field reflectionField); @@ -201,9 +203,7 @@ String decodePC(long pc); - long[] getLineNumberTable(HotSpotResolvedJavaMethod method); - String getFileName(HotSpotResolvedJavaType method); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/Marks.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/Marks.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/Marks.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,9 +23,9 @@ package com.oracle.graal.hotspot.bridge; /** - * Constants used to mark special positions in code being installed into - * the code cache by Graal C++ code. These constants need to be kept in - * sync with those of the same name defined in graalCodeInstaller.hpp. + * Constants used to mark special positions in code being installed into the code cache by Graal C++ + * code. These constants need to be kept in sync with those of the same name defined in + * graalCodeInstaller.hpp. */ public interface Marks { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java Wed Jan 23 16:34:57 2013 +0100 @@ -55,22 +55,20 @@ /** * Creates a resolved Java type. - * + * * @param metaspaceKlass the metaspace Klass object for the type * @param name the {@linkplain JavaType#getName() name} of the type * @param simpleName a simple, unqualified name for the type * @param javaMirror the {@link Class} mirror * @param hasFinalizableSubclass specifies if the type has a finalizable subtype - * @param sizeOrSpecies the size of an instance of the type, or {@link HotSpotResolvedObjectType#INTERFACE_SPECIES_VALUE} or {@link HotSpotResolvedObjectType#ARRAY_SPECIES_VALUE} - * @return the resolved type associated with {@code javaMirror} which may not be the type instantiated by this call - * in the case of another thread racing to create the same type + * @param sizeOrSpecies the size of an instance of the type, or + * {@link HotSpotResolvedObjectType#INTERFACE_SPECIES_VALUE} or + * {@link HotSpotResolvedObjectType#ARRAY_SPECIES_VALUE} + * @return the resolved type associated with {@code javaMirror} which may not be the type + * instantiated by this call in the case of another thread racing to create the same + * type */ - ResolvedJavaType createResolvedJavaType(long metaspaceKlass, - String name, - String simpleName, - Class javaMirror, - boolean hasFinalizableSubclass, - int sizeOrSpecies); + ResolvedJavaType createResolvedJavaType(long metaspaceKlass, String name, String simpleName, Class javaMirror, boolean hasFinalizableSubclass, int sizeOrSpecies); Constant createConstant(Kind kind, long value); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Wed Jan 23 16:34:57 2013 +0100 @@ -91,7 +91,6 @@ assert unsafe.getObject(mirror, offset) == type; } - public void startCompiler() throws Throwable { long offset = HotSpotGraalRuntime.getInstance().getConfig().graalMirrorInClassOffset; @@ -133,11 +132,12 @@ GraalCompiler compiler = graalRuntime.getCompiler(); final HotSpotRuntime runtime = (HotSpotRuntime) compiler.runtime; if (GraalOptions.Intrinsify) { - Debug.scope("InstallSnippets", new Object[] {new DebugDumpScope("InstallSnippets"), compiler}, new Runnable() { + Debug.scope("InstallSnippets", new Object[]{new DebugDumpScope("InstallSnippets"), compiler}, new Runnable() { @Override public void run() { - // Snippets cannot have speculative optimizations since they have to be valid for the entire run of the VM. + // Snippets cannot have speculative optimizations since they have to be valid + // for the entire run of the VM. Assumptions assumptions = new Assumptions(false); SnippetInstaller installer = new HotSpotSnippetInstaller(runtime, assumptions, runtime.getGraalRuntime().getTarget()); GraalIntrinsics.installIntrinsics(installer); @@ -181,9 +181,9 @@ } /** - * This method is the first method compiled during bootstrapping. Put any code in there that warms up compiler paths - * that are otherwise not exercised during bootstrapping and lead to later deoptimization when application code is - * compiled. + * This method is the first method compiled during bootstrapping. Put any code in there that + * warms up compiler paths that are otherwise not exercised during bootstrapping and lead to + * later deoptimization when application code is compiled. */ @SuppressWarnings("unused") @Deprecated @@ -276,7 +276,6 @@ CompilationTask.withinEnqueue.set(Boolean.FALSE); } - if (Debug.isEnabled()) { List topLevelMaps = DebugValueMap.getTopLevelMaps(); List debugValues = KeyRegistry.getDebugValues(); @@ -378,13 +377,16 @@ /** * Compiles a method to machine code. - * @return true if the method is in the queue (either added to the queue or already in the queue) + * + * @return true if the method is in the queue (either added to the queue or already in the + * queue) */ public boolean compileMethod(final HotSpotResolvedJavaMethod method, final int entryBCI, boolean blocking, int priority) throws Throwable { CompilationTask current = method.currentTask(); boolean osrCompilation = entryBCI != StructuredGraph.INVOCATION_ENTRY_BCI; if (osrCompilation && bootstrapRunning) { - // no OSR compilations during bootstrap - the compiler is just too slow at this point, and we know that there are no endless loops + // no OSR compilations during bootstrap - the compiler is just too slow at this point, + // and we know that there are no endless loops return current != null; } @@ -401,15 +403,18 @@ if (!blocking && current != null) { if (current.isInProgress()) { if (current.getEntryBCI() == entryBCI) { - // a compilation with the correct bci is already in progress, so just return true + // a compilation with the correct bci is already in progress, so just return + // true return true; } } else { if (GraalOptions.PriorityCompileQueue) { - // normally compilation tasks will only be re-queued when they get a priority boost, so cancel the old task and add a new one + // normally compilation tasks will only be re-queued when they get a + // priority boost, so cancel the old task and add a new one current.cancel(); } else { - // without a prioritizing compile queue it makes no sense to re-queue the compilation task + // without a prioritizing compile queue it makes no sense to re-queue the + // compilation task return true; } } @@ -507,19 +512,8 @@ } @Override - public HotSpotResolvedObjectType createResolvedJavaType(long metaspaceKlass, - String name, - String simpleName, - Class javaMirror, - boolean hasFinalizableSubclass, - int sizeOrSpecies) { - HotSpotResolvedObjectType type = new HotSpotResolvedObjectType( - metaspaceKlass, - name, - simpleName, - javaMirror, - hasFinalizableSubclass, - sizeOrSpecies); + public HotSpotResolvedObjectType createResolvedJavaType(long metaspaceKlass, String name, String simpleName, Class javaMirror, boolean hasFinalizableSubclass, int sizeOrSpecies) { + HotSpotResolvedObjectType type = new HotSpotResolvedObjectType(metaspaceKlass, name, simpleName, javaMirror, hasFinalizableSubclass, sizeOrSpecies); long offset = HotSpotGraalRuntime.getInstance().getConfig().graalMirrorInClassOffset; if (!unsafe.compareAndSwapObject(javaMirror, offset, null, type)) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/LineNumberTableImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/LineNumberTableImpl.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/LineNumberTableImpl.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,8 +24,8 @@ import com.oracle.graal.api.meta.*; +public class LineNumberTableImpl implements LineNumberTable { -public class LineNumberTableImpl implements LineNumberTable { private final int[] lineNumbers; private final int[] bci; @@ -45,7 +45,8 @@ } @Override - public int getLineNumber(@SuppressWarnings("hiding") int bci) { + public int getLineNumber(@SuppressWarnings("hiding") + int bci) { for (int i = 0; i < this.bci.length - 1; i++) { if (this.bci[i] <= bci && bci < this.bci[i + 1]) { return lineNumbers[i]; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/CountingProxy.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/CountingProxy.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/CountingProxy.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,8 +28,8 @@ import java.util.concurrent.atomic.*; /** - * A java.lang.reflect proxy that hierarchically logs all method invocations along with their parameters and return - * values. + * A java.lang.reflect proxy that hierarchically logs all method invocations along with their + * parameters and return values. */ public class CountingProxy implements InvocationHandler { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/Logger.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/Logger.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/Logger.java Wed Jan 23 16:34:57 2013 +0100 @@ -44,6 +44,7 @@ static { if (ENABLED) { loggerTL = new ThreadLocal() { + @Override protected Logger initialValue() { return new Logger(); @@ -53,7 +54,6 @@ loggerTL = null; } - PrintStream ps = null; String filename = System.getProperty("graal.info_file"); if (filename != null && !"".equals(filename)) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/LoggingProxy.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/LoggingProxy.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/LoggingProxy.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,7 +25,8 @@ import java.lang.reflect.*; /** - * A java.lang.reflect proxy that hierarchically logs all method invocations along with their parameters and return values. + * A java.lang.reflect proxy that hierarchically logs all method invocations along with their + * parameters and return values. */ public class LoggingProxy implements InvocationHandler { @@ -65,7 +66,8 @@ } /** - * The object returned by this method will implement all interfaces that are implemented by delegate. + * The object returned by this method will implement all interfaces that are implemented by + * delegate. */ public static T getProxy(Class interf, T delegate) { Class[] interfaces = ProxyUtil.getAllInterfaces(delegate.getClass()); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/ProxyUtil.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/ProxyUtil.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/ProxyUtil.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,16 +24,16 @@ import java.util.*; +public final class ProxyUtil { -public final class ProxyUtil { public static Class[] getAllInterfaces(Class clazz) { - HashSet> interfaces = new HashSet<>(); + HashSet> interfaces = new HashSet<>(); getAllInterfaces(clazz, interfaces); return interfaces.toArray(new Class[interfaces.size()]); } private static void getAllInterfaces(Class clazz, HashSet> interfaces) { - for (Class< ? > iface : clazz.getInterfaces()) { + for (Class iface : clazz.getInterfaces()) { if (!interfaces.contains(iface)) { interfaces.add(iface); getAllInterfaces(iface, interfaces); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphCache.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphCache.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphCache.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,22 +34,24 @@ /** * This class implements the graph caching system for the HotSpot platform. - * - * This implementation does not use a map to store the actual cached graphs. The problem is that such maps keep the - * graph, and therefore the {@link ResolvedJavaMethod} referenced from the graph, alive. For some applications and benchmarks this - * is a problem, e.g., the DaCapoScala "scalatest" benchmark will quickly run out of perm gen because of this. - * - * This cannot be solved with a {@code WeakHashMap}, since the values within the map will keep the keys - * alive. In order for this to work we would require a weak map in which the "strongness" of the value references - * depends upon the reachability of the keys. - * - * Therefore the graph cache is implemented in such a way that it stores its cache entries within the {@link ResolvedJavaMethod}. - * It uses the {@link ResolvedJavaMethod#getCompilerStorage()} map with the HotSpotGraphCache instance as key. - * The cached graph will be kept alive as long as the {@link ResolvedJavaMethod} is alive, but does not prevent the method, and - * therefore the class, from being unloaded. - * - * The {@link #cachedGraphIds} map is used to find the graphs that should be removed because of deoptimization, and to - * enforce the graph cache size restriction. + * + * This implementation does not use a map to store the actual cached graphs. The problem is that + * such maps keep the graph, and therefore the {@link ResolvedJavaMethod} referenced from the graph, + * alive. For some applications and benchmarks this is a problem, e.g., the DaCapoScala "scalatest" + * benchmark will quickly run out of perm gen because of this. + * + * This cannot be solved with a {@code WeakHashMap}, since the values + * within the map will keep the keys alive. In order for this to work we would require a weak map in + * which the "strongness" of the value references depends upon the reachability of the keys. + * + * Therefore the graph cache is implemented in such a way that it stores its cache entries within + * the {@link ResolvedJavaMethod}. It uses the {@link ResolvedJavaMethod#getCompilerStorage()} map + * with the HotSpotGraphCache instance as key. The cached graph will be kept alive as long as the + * {@link ResolvedJavaMethod} is alive, but does not prevent the method, and therefore the class, + * from being unloaded. + * + * The {@link #cachedGraphIds} map is used to find the graphs that should be removed because of + * deoptimization, and to enforce the graph cache size restriction. */ public class HotSpotGraphCache implements GraphCache { @@ -62,8 +64,9 @@ private volatile long putCounter; /** - * An ordered hash map for looking up the methods corresponding to a specific graph id. It enforces the maximum - * graph cache size by removing the oldest (in insertion-order) element if the cache gets too big. + * An ordered hash map for looking up the methods corresponding to a specific graph id. It + * enforces the maximum graph cache size by removing the oldest (in insertion-order) element if + * the cache gets too big. */ private final class LRUCache extends LinkedHashMap> { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,9 +29,8 @@ import com.oracle.graal.hotspot.*; /** - * Implementation of {@link InstalledCode} for HotSpot. - * Stores a reference to the nmethod which contains the compiled code. - * The nmethod also stores a weak reference to the HotSpotCompiledMethod + * Implementation of {@link InstalledCode} for HotSpot. Stores a reference to the nmethod which + * contains the compiled code. The nmethod also stores a weak reference to the HotSpotCompiledMethod * instance which is necessary to keep the nmethod from being unloaded. */ public class HotSpotInstalledCode extends CompilerObject implements InstalledCode { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotJavaType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotJavaType.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotJavaType.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,6 +29,7 @@ * Common interface for all HotSpot {@link JavaType} implementations. */ public abstract class HotSpotJavaType extends CompilerObject implements JavaType { + private static final long serialVersionUID = -4252886265301910771L; private final String name; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java Wed Jan 23 16:34:57 2013 +0100 @@ -45,11 +45,8 @@ private static final HotSpotMethodDataAccessor NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR = new NoMethodData(ExceptionSeen.NOT_SUPPORTED); // sorted by tag - private static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = { - null, new BitData(), new CounterData(), new JumpData(), - new TypeCheckData(), new VirtualCallData(), new RetData(), - new BranchData(), new MultiBranchData(), new ArgInfoData() - }; + private static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = {null, new BitData(), new CounterData(), new JumpData(), new TypeCheckData(), new VirtualCallData(), new RetData(), + new BranchData(), new MultiBranchData(), new ArgInfoData()}; /** * Reference to the C++ MethodData object. @@ -164,6 +161,7 @@ } private abstract static class AbstractMethodData implements HotSpotMethodDataAccessor { + /** * Corresponds to DS_RECOMPILE_BIT defined in deoptimization.cpp. */ @@ -224,12 +222,15 @@ return data.readUnsignedByte(position, config.dataLayoutFlagsOffset); } - protected int getDynamicSize(@SuppressWarnings("unused") HotSpotMethodData data, @SuppressWarnings("unused") int position) { + protected int getDynamicSize(@SuppressWarnings("unused") + HotSpotMethodData data, @SuppressWarnings("unused") + int position) { return 0; } } private static class NoMethodData extends AbstractMethodData { + private static final int NO_DATA_TAG = 0; private static final int NO_DATA_SIZE = cellIndexToOffset(0); @@ -245,7 +246,6 @@ return -1; } - @Override public ExceptionSeen getExceptionSeen(HotSpotMethodData data, int position) { return exceptionSeen; @@ -253,6 +253,7 @@ } private static class BitData extends AbstractMethodData { + private static final int BIT_DATA_TAG = 1; private static final int BIT_DATA_SIZE = cellIndexToOffset(0); private static final int BIT_DATA_NULL_SEEN_FLAG = 0x01; @@ -272,6 +273,7 @@ } private static class CounterData extends BitData { + private static final int COUNTER_DATA_TAG = 2; private static final int COUNTER_DATA_SIZE = cellIndexToOffset(1); private static final int COUNTER_DATA_COUNT_OFFSET = cellIndexToOffset(0); @@ -295,6 +297,7 @@ } private static class JumpData extends AbstractMethodData { + private static final int JUMP_DATA_TAG = 3; private static final int JUMP_DATA_SIZE = cellIndexToOffset(2); protected static final int TAKEN_COUNT_OFFSET = cellIndexToOffset(0); @@ -325,6 +328,7 @@ } private abstract static class AbstractTypeData extends CounterData { + private static final int RECEIVER_TYPE_DATA_ROW_SIZE = cellsToBytes(2); private static final int RECEIVER_TYPE_DATA_SIZE = cellIndexToOffset(2) + RECEIVER_TYPE_DATA_ROW_SIZE * config.typeProfileWidth; protected static final int NONPROFILED_RECEIVER_COUNT_OFFSET = cellIndexToOffset(1); @@ -393,6 +397,7 @@ } private static class TypeCheckData extends AbstractTypeData { + private static final int RECEIVER_TYPE_DATA_TAG = 4; public TypeCheckData() { @@ -411,6 +416,7 @@ } private static class VirtualCallData extends AbstractTypeData { + private static final int VIRTUAL_CALL_DATA_TAG = 5; public VirtualCallData() { @@ -437,6 +443,7 @@ } private static class RetData extends CounterData { + private static final int RET_DATA_TAG = 6; private static final int RET_DATA_ROW_SIZE = cellsToBytes(3); private static final int RET_DATA_SIZE = cellIndexToOffset(1) + RET_DATA_ROW_SIZE * config.bciProfileWidth; @@ -447,6 +454,7 @@ } private static class BranchData extends JumpData { + private static final int BRANCH_DATA_TAG = 7; private static final int BRANCH_DATA_SIZE = cellIndexToOffset(3); private static final int NOT_TAKEN_COUNT_OFFSET = cellIndexToOffset(2); @@ -476,6 +484,7 @@ } private static class ArrayData extends AbstractMethodData { + private static final int ARRAY_DATA_LENGTH_OFFSET = cellIndexToOffset(0); protected static final int ARRAY_DATA_START_OFFSET = cellIndexToOffset(1); @@ -494,6 +503,7 @@ } private static class MultiBranchData extends ArrayData { + private static final int MULTI_BRANCH_DATA_TAG = 8; private static final int MULTI_BRANCH_DATA_SIZE = cellIndexToOffset(1); private static final int MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS = 2; @@ -571,6 +581,7 @@ } private static class ArgInfoData extends ArrayData { + private static final int ARG_INFO_DATA_TAG = 9; private static final int ARG_INFO_DATA_SIZE = cellIndexToOffset(1); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,32 +26,40 @@ import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen; /** - * Interface for accessor objects that encapsulate the logic for accessing the different kinds of data in a HotSpot methodDataOop. - * This interface is similar to the interface {@link ProfilingInfo}, but most methods require a MethodDataObject and the - * exact position within the methodData. + * Interface for accessor objects that encapsulate the logic for accessing the different kinds of + * data in a HotSpot methodDataOop. This interface is similar to the interface {@link ProfilingInfo} + * , but most methods require a MethodDataObject and the exact position within the methodData. */ public interface HotSpotMethodDataAccessor { + /** * Returns the tag stored in the LayoutData header. + * * @return An integer >= 0 or -1 if not supported. */ int getTag(); /** * Returns the BCI stored in the LayoutData header. + * * @return An integer >= 0 and <= Short.MAX_VALUE, or -1 if not supported. */ int getBCI(HotSpotMethodData data, int position); /** * Computes the size for the specific data at the given position. + * * @return An integer > 0. */ int getSize(HotSpotMethodData data, int position); JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position); + double getBranchTakenProbability(HotSpotMethodData data, int position); + double[] getSwitchProbabilities(HotSpotMethodData data, int position); + ExceptionSeen getExceptionSeen(HotSpotMethodData data, int position); + int getExecutionCount(HotSpotMethodData data, int position); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodUnresolved.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodUnresolved.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodUnresolved.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,6 +28,7 @@ * Implementation of {@link JavaMethod} for unresolved HotSpot methods. */ public final class HotSpotMethodUnresolved extends HotSpotMethod { + private static final long serialVersionUID = 5610263481791970079L; private final Signature signature; protected JavaType holder; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,7 +26,6 @@ import com.oracle.graal.debug.*; import com.oracle.graal.hotspot.*; - public final class HotSpotProfilingInfo extends CompilerObject implements ProfilingInfo { private static final long serialVersionUID = -8307682725047864875L; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Wed Jan 23 16:34:57 2013 +0100 @@ -36,7 +36,8 @@ */ public class HotSpotResolvedJavaField extends CompilerObject implements ResolvedJavaField { - // Must not conflict with any fields flags used by the VM - the assertion in the constructor checks this assumption + // Must not conflict with any fields flags used by the VM - the assertion in the constructor + // checks this assumption private static final int FIELD_INTERNAL_FLAG = 0x80000000; private static final long serialVersionUID = 7692985878836955683L; @@ -109,7 +110,7 @@ } } - private static boolean assumeStaticFieldsFinal(Class< ? > clazz) { + private static boolean assumeStaticFieldsFinal(Class clazz) { return clazz == GraalOptions.class; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Wed Jan 23 16:34:57 2013 +0100 @@ -50,8 +50,8 @@ final long metaspaceMethod; private final HotSpotResolvedObjectType holder; - private /*final*/ int codeSize; - private /*final*/ int exceptionHandlerCount; + private/* final */int codeSize; + private/* final */int exceptionHandlerCount; private Signature signature; private Boolean hasBalancedMonitors; private Map compilerStorage; @@ -210,7 +210,8 @@ } if (methodData == null || (!methodData.hasNormalData() && !methodData.hasExtraData())) { - // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in case of a deoptimization. + // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in + // case of a deoptimization. info = DefaultProfilingInfo.get(ExceptionSeen.FALSE); } else { info = new HotSpotProfilingInfo(methodData, codeSize); @@ -264,7 +265,7 @@ public Class[] signatureToTypes() { Signature sig = getSignature(); int count = sig.getParameterCount(false); - Class< ? >[] result = new Class< ? >[count]; + Class[] result = new Class[count]; for (int i = 0; i < result.length; ++i) { result[i] = ((HotSpotResolvedJavaType) sig.getParameterType(i, holder).resolve(holder)).mirror(); } @@ -308,8 +309,9 @@ } /** - * Returns the offset of this method into the v-table. - * If the holder is not initialized, returns -1 + * Returns the offset of this method into the v-table. If the holder is not initialized, returns + * -1 + * * @return the offset of this method into the v-table */ public int vtableEntryOffset() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,8 +25,8 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.hotspot.*; +public abstract class HotSpotResolvedJavaType extends HotSpotJavaType implements ResolvedJavaType { -public abstract class HotSpotResolvedJavaType extends HotSpotJavaType implements ResolvedJavaType { private static final long serialVersionUID = -6410840212023428347L; public HotSpotResolvedJavaType(String name) { @@ -37,6 +37,6 @@ @Override public String getSourceFileName() { - return HotSpotGraalRuntime.getInstance().getCompilerToVM().getFileName(this); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().getFileName(this); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Wed Jan 23 16:34:57 2013 +0100 @@ -42,14 +42,16 @@ private static final long serialVersionUID = 3481514353553840471L; /** - * Value for the {@code sizeOrSpecies} parameter in {@link HotSpotResolvedObjectType#HotSpotResolvedObjectType} - * denoting that the new type represents an interface class. + * Value for the {@code sizeOrSpecies} parameter in + * {@link HotSpotResolvedObjectType#HotSpotResolvedObjectType} denoting that the new type + * represents an interface class. */ public static final int INTERFACE_SPECIES_VALUE = Integer.MIN_VALUE; /** - * Value for the {@code sizeOrSpecies} parameter in {@link HotSpotResolvedObjectType#HotSpotResolvedObjectType} - * denoting that the new type represents an array class. + * Value for the {@code sizeOrSpecies} parameter in + * {@link HotSpotResolvedObjectType#HotSpotResolvedObjectType} denoting that the new type + * represents an array class. */ public static final int ARRAY_SPECIES_VALUE = Integer.MAX_VALUE; @@ -63,8 +65,9 @@ private final boolean hasFinalizableSubclass; /** - * The instance size (in bytes) for an instance type, {@link HotSpotResolvedObjectType#INTERFACE_SPECIES_VALUE} denoting - * an interface type or {@link HotSpotResolvedObjectType#ARRAY_SPECIES_VALUE} denoting an array type. + * The instance size (in bytes) for an instance type, + * {@link HotSpotResolvedObjectType#INTERFACE_SPECIES_VALUE} denoting an interface type or + * {@link HotSpotResolvedObjectType#ARRAY_SPECIES_VALUE} denoting an array type. */ private final int sizeOrSpecies; @@ -78,7 +81,7 @@ /** * Gets the Graal mirror from a HotSpot metaspace Klass native object. - * + * * @param metaspaceKlass a metaspace Klass object boxed in a {@link Constant} * @return the {@link ResolvedJavaType} corresponding to {@code klassConstant} */ @@ -89,7 +92,7 @@ /** * Gets the Graal mirror from a HotSpot metaspace Klass native object. - * + * * @param metaspaceKlass a metaspace Klass object * @return the {@link ResolvedJavaType} corresponding to {@code metaspaceKlass} */ @@ -102,7 +105,7 @@ /** * Gets the Graal mirror from a {@link Class} object. - * + * * @return the {@link HotSpotResolvedObjectType} corresponding to {@code javaClass} */ public static ResolvedJavaType fromClass(Class javaClass) { @@ -117,14 +120,11 @@ /** * @param hasFinalizableSubclass - * @param sizeOrSpecies the size of an instance of the type, or {@link HotSpotResolvedObjectType#INTERFACE_SPECIES_VALUE} or {@link HotSpotResolvedObjectType#ARRAY_SPECIES_VALUE} + * @param sizeOrSpecies the size of an instance of the type, or + * {@link HotSpotResolvedObjectType#INTERFACE_SPECIES_VALUE} or + * {@link HotSpotResolvedObjectType#ARRAY_SPECIES_VALUE} */ - public HotSpotResolvedObjectType(long metaspaceKlass, - String name, - String simpleName, - Class javaMirror, - boolean hasFinalizableSubclass, - int sizeOrSpecies) { + public HotSpotResolvedObjectType(long metaspaceKlass, String name, String simpleName, Class javaMirror, boolean hasFinalizableSubclass, int sizeOrSpecies) { super(name); this.metaspaceKlass = metaspaceKlass; this.javaMirror = javaMirror; @@ -134,7 +134,7 @@ assert name.charAt(0) != '[' || sizeOrSpecies == ARRAY_SPECIES_VALUE : name + " " + Long.toHexString(sizeOrSpecies); assert javaMirror.isArray() == isArray(); assert javaMirror.isInterface() == isInterface(); - //System.out.println("0x" + Long.toHexString(metaspaceKlass) + ": " + name); + // System.out.println("0x" + Long.toHexString(metaspaceKlass) + ": " + name); } @Override @@ -225,14 +225,14 @@ HotSpotResolvedObjectType t1 = this; HotSpotResolvedObjectType t2 = (HotSpotResolvedObjectType) otherType; while (true) { - if (t1.isAssignableFrom(t2)) { - return t1; - } - if (t2.isAssignableFrom(t1)) { - return t2; - } - t1 = t1.getSupertype(); - t2 = t2.getSupertype(); + if (t1.isAssignableFrom(t2)) { + return t1; + } + if (t2.isAssignableFrom(t1)) { + return t2; + } + t1 = t1.getSupertype(); + t2 = t2.getSupertype(); } } } @@ -346,9 +346,9 @@ } /** - * Gets the instance size of this type. If an instance of this type cannot - * be fast path allocated, then the returned value is negative (its absolute - * value gives the size). Must not be called if this is an array or interface type. + * Gets the instance size of this type. If an instance of this type cannot be fast path + * allocated, then the returned value is negative (its absolute value gives the size). Must not + * be called if this is an array or interface type. */ public int instanceSize() { assert !isArray(); @@ -375,7 +375,8 @@ long id = offset + ((long) flags << 32); - // (thomaswue) Must cache the fields, because the local load elimination only works if the objects from two field lookups are identical. + // (thomaswue) Must cache the fields, because the local load elimination only works if the + // objects from two field lookups are identical. if (fieldCache == null) { fieldCache = new HashMap<>(8); } else { @@ -399,6 +400,7 @@ } private static class OffsetComparator implements Comparator { + @Override public int compare(HotSpotResolvedJavaField o1, HotSpotResolvedJavaField o2) { return o1.offset() - o2.offset(); @@ -447,7 +449,7 @@ @Override public String getSourceFileName() { - return HotSpotGraalRuntime.getInstance().getCompilerToVM().getFileName(this); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().getFileName(this); } @Override diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java Wed Jan 23 16:34:57 2013 +0100 @@ -186,7 +186,7 @@ } @Override - public Class< ? > mirror() { + public Class mirror() { return javaMirror; } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Wed Jan 23 16:34:57 2013 +0100 @@ -74,6 +74,7 @@ * HotSpot implementation of {@link GraalCodeCacheProvider}. */ public abstract class HotSpotRuntime implements GraalCodeCacheProvider, SnippetProvider { + public final HotSpotVMConfig config; protected final RegisterConfig regConfig; @@ -92,16 +93,15 @@ private final Map stubs = new HashMap<>(); /** - * Holds onto objects that will be embedded in compiled code. HotSpot treats oops - * embedded in code as weak references so without an external strong root, such - * an embedded oop will quickly die. This in turn will cause the nmethod to - * be unloaded. + * Holds onto objects that will be embedded in compiled code. HotSpot treats oops embedded in + * code as weak references so without an external strong root, such an embedded oop will quickly + * die. This in turn will cause the nmethod to be unloaded. */ private final Map gcRoots = new HashMap<>(); /** * The offset from the origin of an array to the first element. - * + * * @return the offset in bytes */ public static int getArrayBaseOffset(Kind kind) { @@ -131,7 +131,7 @@ /** * The scale used for the index when accessing elements of an array of this kind. - * + * * @return the scale in order to convert the index into a byte offset */ public static int getArrayIndexScale(Kind kind) { @@ -276,10 +276,9 @@ // @formatter:on } - /** * Registers the details for linking a runtime call. - * + * * @param descriptor name and signature of the call * @param address target address of the call * @param tempRegs temporary registers used (and killed) by the call (null if none) @@ -314,7 +313,7 @@ /** * Binds a snippet-base {@link Stub} to a runtime call descriptor. - * + * * @return the linkage information for a call to the stub */ public HotSpotRuntimeCallTarget registerStub(Descriptor descriptor, Stub stub) { @@ -462,10 +461,7 @@ String nl = HexCodeFile.NEW_LINE; StringBuilder buf = new StringBuilder("------ Exception Handlers ------").append(nl); for (CompilationResult.ExceptionHandler e : tm.getExceptionHandlers()) { - buf.append(" "). - append(e.pcOffset).append(" -> "). - append(e.handlerPos). - append(nl); + buf.append(" ").append(e.pcOffset).append(" -> ").append(e.handlerPos).append(nl); hcf.addComment(e.pcOffset, "[exception -> " + e.handlerPos + "]"); hcf.addComment(e.handlerPos, "[exception handler for " + e.pcOffset + "]"); } @@ -508,7 +504,8 @@ } /** - * HotSpots needs an area suitable for storing a program counter for temporary use during the deoptimization process. + * HotSpots needs an area suitable for storing a program counter for temporary use during the + * deoptimization process. */ @Override public int getCustomStackAreaSize() { @@ -548,22 +545,23 @@ JavaType[] signature = MetaUtil.signatureToTypes(callTarget.targetMethod().getSignature(), callTarget.isStatic() ? null : callTarget.targetMethod().getDeclaringClass()); AbstractCallTargetNode loweredCallTarget = null; - if (callTarget.invokeKind() == InvokeKind.Virtual && - GraalOptions.InlineVTableStubs && - (GraalOptions.AlwaysInlineVTableStubs || invoke.isPolymorphic())) { + if (callTarget.invokeKind() == InvokeKind.Virtual && GraalOptions.InlineVTableStubs && (GraalOptions.AlwaysInlineVTableStubs || invoke.isPolymorphic())) { HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) callTarget.targetMethod(); if (!hsMethod.getDeclaringClass().isInterface()) { int vtableEntryOffset = hsMethod.vtableEntryOffset(); if (vtableEntryOffset > 0) { - // We use LocationNode.ANY_LOCATION for the reads that access the vtable entry and the compiled code entry + // We use LocationNode.ANY_LOCATION for the reads that access the vtable + // entry and the compiled code entry // as HotSpot does not guarantee they are final values. assert vtableEntryOffset > 0; LoadHubNode hub = graph.add(new LoadHubNode(receiver, wordKind)); ReadNode metaspaceMethod = graph.add(new ReadNode(hub, LocationNode.create(LocationNode.ANY_LOCATION, wordKind, vtableEntryOffset, graph), StampFactory.forKind(wordKind()))); - ReadNode compiledEntry = graph.add(new ReadNode(metaspaceMethod, LocationNode.create(LocationNode.ANY_LOCATION, wordKind, config.methodCompiledEntryOffset, graph), StampFactory.forKind(wordKind()))); + ReadNode compiledEntry = graph.add(new ReadNode(metaspaceMethod, LocationNode.create(LocationNode.ANY_LOCATION, wordKind, config.methodCompiledEntryOffset, graph), + StampFactory.forKind(wordKind()))); - loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(metaspaceMethod, compiledEntry, parameters, invoke.node().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall)); + loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(metaspaceMethod, compiledEntry, parameters, invoke.node().stamp(), signature, callTarget.targetMethod(), + CallingConvention.Type.JavaCall)); graph.addBeforeFixed(invoke.node(), hub); graph.addAfterFixed(hub, metaspaceMethod); @@ -573,7 +571,8 @@ } if (loweredCallTarget == null) { - loweredCallTarget = graph.add(new HotSpotDirectCallTargetNode(parameters, invoke.node().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall, callTarget.invokeKind())); + loweredCallTarget = graph.add(new HotSpotDirectCallTargetNode(parameters, invoke.node().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall, + callTarget.invokeKind())); } callTarget.replaceAndDelete(loweredCallTarget); } @@ -677,7 +676,8 @@ assert load.kind() != Kind.Illegal; IndexedLocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, load.accessKind(), load.displacement(), load.offset(), graph, false); ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, load.stamp())); - // An unsafe read must not floating outside its block as may float above an explicit null check on its object. + // An unsafe read must not floating outside its block as may float above an explicit + // null check on its object. memoryRead.dependencies().add(BeginNode.prevBegin(load)); graph.replaceFixedWithFixed(load, memoryRead); } else if (n instanceof UnsafeStoreNode) { @@ -738,7 +738,8 @@ } else if (n instanceof NewMultiArrayNode) { newObjectSnippets.lower((NewMultiArrayNode) n, tool); } else if (n instanceof IntegerDivNode || n instanceof IntegerRemNode || n instanceof UnsignedDivNode || n instanceof UnsignedRemNode) { - // Nothing to do for division nodes. The HotSpot signal handler catches divisions by zero and the MIN_VALUE / -1 cases. + // Nothing to do for division nodes. The HotSpot signal handler catches divisions by + // zero and the MIN_VALUE / -1 cases. } else { assert false : "Node implementing Lowerable not handled: " + n; throw GraalInternalError.shouldNotReachHere(); @@ -779,9 +780,9 @@ /** * Gets the stub corresponding to a given method. - * - * @return the stub {@linkplain Stub#getMethod() implemented} by {@code method} or null if {@code method} does not - * implement a stub + * + * @return the stub {@linkplain Stub#getMethod() implemented} by {@code method} or null if + * {@code method} does not implement a stub */ public Stub asStub(ResolvedJavaMethod method) { return stubs.get(method); @@ -849,32 +850,52 @@ } public int convertDeoptAction(DeoptimizationAction action) { - switch(action) { - case None: return config.deoptActionNone; - case RecompileIfTooManyDeopts: return config.deoptActionMaybeRecompile; - case InvalidateReprofile: return config.deoptActionReinterpret; - case InvalidateRecompile: return config.deoptActionMakeNotEntrant; - case InvalidateStopCompiling: return config.deoptActionMakeNotCompilable; - default: throw GraalInternalError.shouldNotReachHere(); + switch (action) { + case None: + return config.deoptActionNone; + case RecompileIfTooManyDeopts: + return config.deoptActionMaybeRecompile; + case InvalidateReprofile: + return config.deoptActionReinterpret; + case InvalidateRecompile: + return config.deoptActionMakeNotEntrant; + case InvalidateStopCompiling: + return config.deoptActionMakeNotCompilable; + default: + throw GraalInternalError.shouldNotReachHere(); } } public int convertDeoptReason(DeoptimizationReason reason) { - switch(reason) { - case None: return config.deoptReasonNone; - case NullCheckException: return config.deoptReasonNullCheck; - case BoundsCheckException: return config.deoptReasonRangeCheck; - case ClassCastException: return config.deoptReasonClassCheck; - case ArrayStoreException: return config.deoptReasonArrayCheck; - case UnreachedCode: return config.deoptReasonUnreached0; - case TypeCheckedInliningViolated: return config.deoptReasonTypeCheckInlining; - case OptimizedTypeCheckViolated: return config.deoptReasonOptimizedTypeCheck; - case NotCompiledExceptionHandler: return config.deoptReasonNotCompiledExceptionHandler; - case Unresolved: return config.deoptReasonUnresolved; - case JavaSubroutineMismatch: return config.deoptReasonJsrMismatch; - case ArithmeticException: return config.deoptReasonDiv0Check; - case RuntimeConstraint: return config.deoptReasonConstraint; - default: throw GraalInternalError.shouldNotReachHere(); + switch (reason) { + case None: + return config.deoptReasonNone; + case NullCheckException: + return config.deoptReasonNullCheck; + case BoundsCheckException: + return config.deoptReasonRangeCheck; + case ClassCastException: + return config.deoptReasonClassCheck; + case ArrayStoreException: + return config.deoptReasonArrayCheck; + case UnreachedCode: + return config.deoptReasonUnreached0; + case TypeCheckedInliningViolated: + return config.deoptReasonTypeCheckInlining; + case OptimizedTypeCheckViolated: + return config.deoptReasonOptimizedTypeCheck; + case NotCompiledExceptionHandler: + return config.deoptReasonNotCompiledExceptionHandler; + case Unresolved: + return config.deoptReasonUnresolved; + case JavaSubroutineMismatch: + return config.deoptReasonJsrMismatch; + case ArithmeticException: + return config.deoptReasonDiv0Check; + case RuntimeConstraint: + return config.deoptReasonConstraint; + default: + throw GraalInternalError.shouldNotReachHere(); } } @@ -883,9 +904,9 @@ } /** - * Registers an object created by the compiler and referenced by some generated code. - * HotSpot treats oops embedded in code as weak references so without an external strong root, such - * an embedded oop will quickly die. This in turn will cause the nmethod to be unloaded. + * Registers an object created by the compiler and referenced by some generated code. HotSpot + * treats oops embedded in code as weak references so without an external strong root, such an + * embedded oop will quickly die. This in turn will cause the nmethod to be unloaded. */ public synchronized Object registerGCRoot(Object object) { Object existing = gcRoots.get(object); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedField.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedField.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedField.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,7 +24,6 @@ import com.oracle.graal.api.meta.*; - /** * A implementation of {@link JavaField} for an unresolved field. */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,11 +32,10 @@ import com.oracle.graal.word.*; /** - * Intrinsic for opening a scope binding a stack-based lock with an object. - * A lock scope must be closed with an {@link EndLockScopeNode}. - * The frame state after this node denotes that the object is locked - * (ensuring the GC sees and updates the object) so it must come - * after any null pointer check on the object. + * Intrinsic for opening a scope binding a stack-based lock with an object. A lock scope must be + * closed with an {@link EndLockScopeNode}. The frame state after this node denotes that the object + * is locked (ensuring the GC sees and updates the object) so it must come after any null pointer + * check on the object. */ public final class BeginLockScopeNode extends AbstractStateSplit implements LIRGenLowerable, MonitorEnter { @@ -64,5 +63,6 @@ } @NodeIntrinsic - public static native Word beginLockScope(@ConstantNodeParameter boolean eliminated); + public static native Word beginLockScope(@ConstantNodeParameter + boolean eliminated); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,8 +31,8 @@ import com.oracle.graal.word.*; /** - * Intrinsic for allocating an on-stack array of integers to hold the dimensions - * of a multianewarray instruction. + * Intrinsic for allocating an on-stack array of integers to hold the dimensions of a multianewarray + * instruction. */ public final class DimensionsNode extends FixedWithNextNode implements LIRGenLowerable { @@ -52,5 +52,6 @@ } @NodeIntrinsic - public static native Word allocaDimsArray(@ConstantNodeParameter int rank); + public static native Word allocaDimsArray(@ConstantNodeParameter + int rank); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,9 +31,9 @@ import com.oracle.graal.word.*; /** - * A special purpose store node that differs from {@link CompareAndSwapNode} in that - * it is not a {@link StateSplit} and it {@linkplain #compareAndSwap(Object, long, Word, Word) returns} - * either the expected value or the compared against value instead of a boolean. + * A special purpose store node that differs from {@link CompareAndSwapNode} in that it is not a + * {@link StateSplit} and it {@linkplain #compareAndSwap(Object, long, Word, Word) returns} either + * the expected value or the compared against value instead of a boolean. */ public class DirectCompareAndSwapNode extends FixedWithNextNode implements LIRGenLowerable, MemoryCheckpoint { @@ -50,7 +50,6 @@ this.newValue = newValue; } - @Override public void generate(LIRGenerator gen) { ((HotSpotLIRGenerator) gen).visitDirectCompareAndSwap(this); @@ -73,11 +72,11 @@ } /** - * Compares an expected value with the actual value in a location denoted by an object and a given offset. - * Iff they are same, {@code newValue} is placed into the location and the {@code expectedValue} is returned. - * Otherwise, the actual value is returned. - * All of the above is performed in one atomic hardware transaction. - * + * Compares an expected value with the actual value in a location denoted by an object and a + * given offset. Iff they are same, {@code newValue} is placed into the location and the + * {@code expectedValue} is returned. Otherwise, the actual value is returned. All of the above + * is performed in one atomic hardware transaction. + * * @param object the object containing a field to be atomically tested and updated * @param offset offset from {@code object} of the field * @param expectedValue if this value is currently in the field, perform the swap diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,9 +28,9 @@ import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.type.*; - /** - * Intrinsic for closing a {@linkplain BeginLockScopeNode scope} binding a stack-based lock with an object. + * Intrinsic for closing a {@linkplain BeginLockScopeNode scope} binding a stack-based lock with an + * object. */ public final class EndLockScopeNode extends AbstractStateSplit implements LIRGenLowerable, MonitorExit { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,12 +28,12 @@ import com.oracle.graal.nodes.type.*; /** - * Intrinsification for getting the address of an object. - * The code path(s) between a call to {@link #get(Object)} and all uses - * of the returned value must be atomic. The only exception to this is - * if the usage is not an attempt to dereference the value. + * Intrinsification for getting the address of an object. The code path(s) between a call to + * {@link #get(Object)} and all uses of the returned value must be atomic. The only exception to + * this is if the usage is not an attempt to dereference the value. */ public class GetObjectAddressNode extends FixedWithNextNode implements LIRLowerable { + @Input private ValueNode object; public GetObjectAddressNode(ValueNode obj) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotCurrentRawThreadNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotCurrentRawThreadNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotCurrentRawThreadNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,8 +29,8 @@ import com.oracle.graal.nodes.type.*; import com.oracle.graal.word.*; +public class HotSpotCurrentRawThreadNode extends FloatingNode implements LIRLowerable { -public class HotSpotCurrentRawThreadNode extends FloatingNode implements LIRLowerable { public HotSpotCurrentRawThreadNode() { super(StampFactory.forWord()); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/IdentityHashCodeStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/IdentityHashCodeStubCall.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/IdentityHashCodeStubCall.java Wed Jan 23 16:34:57 2013 +0100 @@ -35,6 +35,7 @@ * Node implementing a call to HotSpot's {@code graal_identityhashcode} stub. */ public class IdentityHashCodeStubCall extends FixedWithNextNode implements LIRGenLowerable { + @Input private final ValueNode object; public static final Descriptor IDENTITY_HASHCODE = new Descriptor("identity_hashcode", false, int.class, Object.class); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeArrayNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeArrayNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeArrayNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,9 +28,8 @@ import com.oracle.graal.nodes.type.*; /** - * Initializes the header and body of an uninitialized array cell. - * This node calls out to a stub to do both the allocation and formatting - * if the memory address it is given is zero/null (e.g. due to + * Initializes the header and body of an uninitialized array cell. This node calls out to a stub to + * do both the allocation and formatting if the memory address it is given is zero/null (e.g. due to * {@linkplain TLABAllocateNode TLAB allocation} failing). */ public final class InitializeArrayNode extends FixedWithNextNode implements Lowerable, ArrayLengthProvider { @@ -86,5 +85,8 @@ } @NodeIntrinsic - public static native Object initialize(Object memory, int length, int allocationSize, @ConstantNodeParameter ResolvedJavaType type, @ConstantNodeParameter boolean fillContents, @ConstantNodeParameter boolean locked); + public static native Object initialize(Object memory, int length, int allocationSize, @ConstantNodeParameter + ResolvedJavaType type, @ConstantNodeParameter + boolean fillContents, @ConstantNodeParameter + boolean locked); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeObjectNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeObjectNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeObjectNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,9 +28,8 @@ import com.oracle.graal.nodes.type.*; /** - * Initializes the header and body of an uninitialized object cell. - * This node calls out to a stub to do both the allocation and formatting - * if the memory address it is given is zero/null (e.g. due to + * Initializes the header and body of an uninitialized object cell. This node calls out to a stub to + * do both the allocation and formatting if the memory address it is given is zero/null (e.g. due to * {@linkplain TLABAllocateNode TLAB allocation} failing). */ public final class InitializeObjectNode extends FixedWithNextNode implements Lowerable { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,8 +31,7 @@ import com.oracle.graal.word.*; /** - * Node that is used to maintain a stack based counter of how many locks - * are currently held. + * Node that is used to maintain a stack based counter of how many locks are currently held. */ public final class MonitorCounterNode extends FloatingNode implements LIRGenLowerable { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Wed Jan 23 16:34:57 2013 +0100 @@ -70,5 +70,6 @@ } @NodeIntrinsic - public static native Object call(Word hub, @ConstantNodeParameter int rank, Word dims); + public static native Object call(Word hub, @ConstantNodeParameter + int rank, Word dims); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TLABAllocateNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TLABAllocateNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TLABAllocateNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,8 +28,8 @@ import com.oracle.graal.word.*; /** - * Allocates some uninitialized area. This is used for TLAB allocation - * only. If allocation fails, zero/null is produced by this node. + * Allocates some uninitialized area. This is used for TLAB allocation only. If allocation fails, + * zero/null is produced by this node. */ public final class TLABAllocateNode extends FixedWithNextNode implements Lowerable { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -35,7 +35,8 @@ import com.oracle.graal.nodes.type.*; /** - * Performs a tail call to the specified target compiled method, with the parameter taken from the supplied FrameState. + * Performs a tail call to the specified target compiled method, with the parameter taken from the + * supplied FrameState. */ public class TailcallNode extends FixedWithNextNode implements LIRLowerable { @@ -44,6 +45,7 @@ /** * Creates a TailcallNode. + * * @param target points to the start of an nmethod * @param frameState the parameters will be taken from this FrameState */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ThreadIsInterruptedStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ThreadIsInterruptedStubCall.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ThreadIsInterruptedStubCall.java Wed Jan 23 16:34:57 2013 +0100 @@ -35,6 +35,7 @@ * Node implementing a call to HotSpot's ThreadIsInterrupted stub. */ public class ThreadIsInterruptedStubCall extends FixedWithNextNode implements LIRGenLowerable { + @Input private final ValueNode thread; @Input private final ValueNode clearIsInterrupted; public static final Descriptor THREAD_IS_INTERRUPTED = new Descriptor("thread_is_interrupted", false, int.class, Object.class, boolean.class); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,8 +34,8 @@ import com.oracle.graal.snippets.*; /** - * Causes the VM to exit with a description of the current Java location - * and an optional {@linkplain Log#printf(String, long) formatted} error message specified. + * Causes the VM to exit with a description of the current Java location and an optional + * {@linkplain Log#printf(String, long) formatted} error message specified. */ public final class VMErrorNode extends FixedWithNextNode implements LIRGenLowerable { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -46,7 +46,8 @@ @Override protected void run(StructuredGraph graph) { if (graph.getEntryBCI() == StructuredGraph.INVOCATION_ENTRY_BCI) { - // This happens during inlining in a OSR method, because the same phase plan will be used. + // This happens during inlining in a OSR method, because the same phase plan will be + // used. return; } Debug.dump(graph, "OnStackReplacement initial"); @@ -90,7 +91,6 @@ Debug.dump(graph, "OnStackReplacement loop peeling result"); } while (true); - LocalNode buffer = graph.unique(new LocalNode(0, StampFactory.forKind(wordKind()))); RuntimeCallNode migrationEnd = graph.add(new RuntimeCallNode(OSR_MIGRATION_END, buffer)); FrameState osrState = osr.stateAfter(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopyNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopyNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopyNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -75,7 +75,8 @@ } if (snippetMethod == null) { snippetMethod = tool.getRuntime().lookupJavaMethod(ArrayCopySnippets.increaseGenericCallCounterMethod); - // we will call the generic method. the generic snippet will only increase the counter, not call the actual + // we will call the generic method. the generic snippet will only increase the counter, + // not call the actual // method. therefore we create a second invoke here. ((StructuredGraph) graph()).addAfterFixed(this, createInvoke()); } else { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java Wed Jan 23 16:34:57 2013 +0100 @@ -21,6 +21,7 @@ * questions. */ package com.oracle.graal.hotspot.snippets; + import static com.oracle.graal.api.code.DeoptimizationAction.*; import static com.oracle.graal.api.meta.DeoptimizationReason.*; import static com.oracle.graal.hotspot.snippets.HotSpotSnippetUtils.*; @@ -44,9 +45,8 @@ import com.oracle.graal.snippets.Snippet.Fold; import com.oracle.graal.snippets.nodes.*; - @SuppressWarnings("unused") -public class ArrayCopySnippets implements SnippetsInterface{ +public class ArrayCopySnippets implements SnippetsInterface { private static final EnumMap arraycopyMethods = new EnumMap<>(Kind.class); public static final Method increaseGenericCallCounterMethod; @@ -79,7 +79,8 @@ private static final Kind VECTOR_KIND = Kind.Long; private static final long VECTOR_SIZE = arrayIndexScale(Kind.Long); - public static void vectorizedCopy(Object src, int srcPos, Object dest, int destPos, int length, @ConstantParameter("baseKind") Kind baseKind) { + public static void vectorizedCopy(Object src, int srcPos, Object dest, int destPos, int length, @ConstantParameter("baseKind") + Kind baseKind) { checkInputs(src, srcPos, dest, destPos, length); int header = arrayBaseOffset(baseKind); int elementSize = arrayIndexScale(baseKind); @@ -261,5 +262,4 @@ private static final SnippetCounter genericPrimitiveCallCounter = new SnippetCounter(counters, "genericPrimitive", "call to the generic, native arraycopy method"); private static final SnippetCounter genericObjectCallCounter = new SnippetCounter(counters, "genericObject", "call to the generic, native arraycopy method"); - } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java Wed Jan 23 16:34:57 2013 +0100 @@ -51,9 +51,10 @@ /** * Snippets used for implementing the type test of a checkcast instruction. - * - * The type tests implemented are described in the paper - * Fast subtype checking in the HotSpot JVM by Cliff Click and John Rose. + * + * The type tests implemented are described in the paper Fast subtype checking in the HotSpot JVM by + * Cliff Click and John Rose. */ public class CheckCastSnippets implements SnippetsInterface { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ClassSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ClassSubstitutions.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ClassSubstitutions.java Wed Jan 23 16:34:57 2013 +0100 @@ -37,6 +37,7 @@ */ @ClassSubstitution(java.lang.Class.class) public class ClassSubstitutions { + @MethodSubstitution(isStatic = false) public static int getModifiers(final Class thisObj) { Word klass = loadWordFromObject(thisObj, klassOffset()); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java Wed Jan 23 16:34:57 2013 +0100 @@ -146,12 +146,13 @@ /** * Mask for a biasable, locked or unlocked mark word. + * *
          * +----------------------------------+-+-+
          * |                                 1|1|1|
          * +----------------------------------+-+-+
          * 
    - * + * */ @Fold public static int biasedLockMaskInPlace() { @@ -165,12 +166,13 @@ /** * Pattern for a biasable, unlocked mark word. + * *
          * +----------------------------------+-+-+
          * |                                 1|0|1|
          * +----------------------------------+-+-+
          * 
    - * + * */ @Fold public static int biasedLockPattern() { @@ -290,138 +292,120 @@ } @NodeIntrinsic(value = RegisterNode.class, setStampFromReturnType = true) - public static native Word registerAsWord(@ConstantNodeParameter Register register); + public static native Word registerAsWord(@ConstantNodeParameter + Register register); @NodeIntrinsic(value = UnsafeLoadNode.class, setStampFromReturnType = true) - private static native Word loadWordFromObjectIntrinsic(Object object, @ConstantNodeParameter int displacement, long offset, @ConstantNodeParameter Kind wordKind); + private static native Word loadWordFromObjectIntrinsic(Object object, @ConstantNodeParameter + int displacement, long offset, @ConstantNodeParameter + Kind wordKind); @NodeIntrinsic(value = LoadHubNode.class, setStampFromReturnType = true) - static native Word loadHubIntrinsic(Object object, @ConstantNodeParameter Kind word); - + static native Word loadHubIntrinsic(Object object, @ConstantNodeParameter + Kind word); @Fold - public - static int log2WordSize() { + public static int log2WordSize() { return CodeUtil.log2(wordSize()); } @Fold - public - static int klassStateOffset() { + public static int klassStateOffset() { return config().klassStateOffset; } @Fold - public - static int klassModifierFlagsOffset() { + public static int klassModifierFlagsOffset() { return config().klassModifierFlagsOffset; } @Fold - public - static int klassOffset() { + public static int klassOffset() { return config().klassOffset; } @Fold - public - static int classMirrorOffset() { + public static int classMirrorOffset() { return config().classMirrorOffset; } @Fold - public - static int klassInstanceSizeOffset() { + public static int klassInstanceSizeOffset() { return config().klassInstanceSizeOffset; } @Fold - public - static long heapTopAddress() { + public static long heapTopAddress() { return config().heapTopAddress; } @Fold - public - static long heapEndAddress() { + public static long heapEndAddress() { return config().heapEndAddress; } @Fold - public - static int threadTlabStartOffset() { + public static int threadTlabStartOffset() { return config().threadTlabStartOffset; } @Fold - public - static long tlabIntArrayMarkWord() { + public static long tlabIntArrayMarkWord() { return config().tlabIntArrayMarkWord; } @Fold - public - static boolean inlineContiguousAllocationSupported() { + public static boolean inlineContiguousAllocationSupported() { return config().inlineContiguousAllocationSupported; } @Fold - public - static int tlabAlignmentReserveInHeapWords() { + public static int tlabAlignmentReserveInHeapWords() { return config().tlabAlignmentReserve; } @Fold - public - static int threadTlabSizeOffset() { + public static int threadTlabSizeOffset() { return config().threadTlabSizeOffset; } @Fold - public - static int threadAllocatedBytesOffset() { + public static int threadAllocatedBytesOffset() { return config().threadAllocatedBytesOffset; } @Fold - public - static int klassStateFullyInitialized() { + public static int klassStateFullyInitialized() { return config().klassStateFullyInitialized; } @Fold - public - static int tlabRefillWasteLimitOffset() { + public static int tlabRefillWasteLimitOffset() { return config().tlabRefillWasteLimitOffset; } @Fold - public - static int tlabNumberOfRefillsOffset() { + public static int tlabNumberOfRefillsOffset() { return config().tlabNumberOfRefillsOffset; } @Fold - public - static int tlabFastRefillWasteOffset() { + public static int tlabFastRefillWasteOffset() { return config().tlabFastRefillWasteOffset; } @Fold - public - static int tlabSlowAllocationsOffset() { + public static int tlabSlowAllocationsOffset() { return config().tlabSlowAllocationsOffset; } @Fold - public - static int tlabRefillWasteIncrement() { + public static int tlabRefillWasteIncrement() { return config().tlabRefillWasteIncrement; } @Fold - public - static boolean tlabStats() { + public static boolean tlabStats() { return config().tlabStats; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/InstanceOfSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/InstanceOfSnippets.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/InstanceOfSnippets.java Wed Jan 23 16:34:57 2013 +0100 @@ -47,12 +47,12 @@ import com.oracle.graal.word.*; /** - * Snippets used for implementing the type test of an instanceof instruction. - * Since instanceof is a floating node, it is lowered separately for each of - * its usages. - * - * The type tests implemented are described in the paper - * Fast subtype checking in the HotSpot JVM by Cliff Click and John Rose. + * Snippets used for implementing the type test of an instanceof instruction. Since instanceof is a + * floating node, it is lowered separately for each of its usages. + * + * The type tests implemented are described in the paper Fast subtype checking in the HotSpot JVM by + * Cliff Click and John Rose. */ public class InstanceOfSnippets implements SnippetsInterface { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/MonitorSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/MonitorSnippets.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/MonitorSnippets.java Wed Jan 23 16:34:57 2013 +0100 @@ -54,10 +54,11 @@ /** * Snippets used for implementing the monitorenter and monitorexit instructions. - * - * The locking algorithm used is described in the paper - * Eliminating synchronization-related atomic operations with biased locking and bulk rebiasing - * by Kenneth Russell and David Detlefs. + * + * The locking algorithm used is described in the paper Eliminating synchronization-related + * atomic operations with biased locking and bulk rebiasing by Kenneth Russell and David + * Detlefs. */ public class MonitorSnippets implements SnippetsInterface { @@ -67,14 +68,18 @@ private static final String TRACE_TYPE_FILTER = System.getProperty("graal.monitors.trace.typeFilter"); /** - * Monitor operations in methods whose fully qualified name contains this substring will be traced. + * Monitor operations in methods whose fully qualified name contains this substring will be + * traced. */ private static final String TRACE_METHOD_FILTER = System.getProperty("graal.monitors.trace.methodFilter"); public static final boolean CHECK_BALANCED_MONITORS = Boolean.getBoolean("graal.monitors.checkBalanced"); @Snippet - public static void monitorenter(@Parameter("object") Object object, @ConstantParameter("checkNull") boolean checkNull, @ConstantParameter("trace") boolean trace) { + public static void monitorenter(@Parameter("object") + Object object, @ConstantParameter("checkNull") + boolean checkNull, @ConstantParameter("trace") + boolean trace) { verifyOop(object); if (checkNull && object == null) { @@ -225,13 +230,13 @@ // by the current thread. The latter is true if the mark word // is a stack pointer into the current thread's stack, i.e.: // - // 1) (currentMark & aligned_mask) == 0 - // 2) rsp <= currentMark - // 3) currentMark <= rsp + page_size + // 1) (currentMark & aligned_mask) == 0 + // 2) rsp <= currentMark + // 3) currentMark <= rsp + page_size // // These 3 tests can be done by evaluating the following expression: // - // (currentMark - rsp) & (aligned_mask - page_size) + // (currentMark - rsp) & (aligned_mask - page_size) // // assuming both the stack pointer and page_size have their least // significant 2 bits cleared and page_size is a power of 2 @@ -263,7 +268,10 @@ * Calls straight out to the monitorenter stub. */ @Snippet - public static void monitorenterStub(@Parameter("object") Object object, @ConstantParameter("checkNull") boolean checkNull, @ConstantParameter("trace") boolean trace) { + public static void monitorenterStub(@Parameter("object") + Object object, @ConstantParameter("checkNull") + boolean checkNull, @ConstantParameter("trace") + boolean trace) { verifyOop(object); incCounter(); if (checkNull && object == null) { @@ -277,7 +285,9 @@ } @Snippet - public static void monitorexit(@Parameter("object") Object object, @ConstantParameter("trace") boolean trace) { + public static void monitorexit(@Parameter("object") + Object object, @ConstantParameter("trace") + boolean trace) { trace(trace, " object: 0x%016lx\n", Word.fromObject(object)); if (useBiasedLocking()) { // Check for biased locking unlock case, which is a no-op @@ -329,7 +339,9 @@ * Calls straight out to the monitorexit stub. */ @Snippet - public static void monitorexitStub(@Parameter("object") Object object, @ConstantParameter("trace") boolean trace) { + public static void monitorexitStub(@Parameter("object") + Object object, @ConstantParameter("trace") + boolean trace) { verifyOop(object); traceObject(trace, "-lock{stub}", object); MonitorExitStubCall.call(object); @@ -358,7 +370,8 @@ } /** - * Leaving the breakpoint code in to provide an example of how to use the {@link BreakpointNode} intrinsic. + * Leaving the breakpoint code in to provide an example of how to use the {@link BreakpointNode} + * intrinsic. */ private static final boolean ENABLE_BREAKPOINT = false; @@ -421,7 +434,8 @@ this.useFastLocking = useFastLocking; } - public void lower(MonitorEnterNode monitorenterNode, @SuppressWarnings("unused") LoweringTool tool) { + public void lower(MonitorEnterNode monitorenterNode, @SuppressWarnings("unused") + LoweringTool tool) { StructuredGraph graph = (StructuredGraph) monitorenterNode.graph(); checkBalancedMonitors(graph); @@ -435,9 +449,7 @@ key.add("checkNull", checkNull); } if (!eliminated) { - key.add("trace", isTracingEnabledForType(monitorenterNode.object()) || - isTracingEnabledForMethod(stateAfter.method()) || - isTracingEnabledForMethod(graph.method())); + key.add("trace", isTracingEnabledForType(monitorenterNode.object()) || isTracingEnabledForMethod(stateAfter.method()) || isTracingEnabledForMethod(graph.method())); } Arguments arguments = new Arguments(); @@ -454,16 +466,15 @@ } } - public void lower(MonitorExitNode monitorexitNode, @SuppressWarnings("unused") LoweringTool tool) { + public void lower(MonitorExitNode monitorexitNode, @SuppressWarnings("unused") + LoweringTool tool) { StructuredGraph graph = (StructuredGraph) monitorexitNode.graph(); FrameState stateAfter = monitorexitNode.stateAfter(); boolean eliminated = monitorexitNode.eliminated(); ResolvedJavaMethod method = eliminated ? monitorexitEliminated : useFastLocking ? monitorexit : monitorexitStub; Key key = new Key(method); if (!eliminated) { - key.add("trace", isTracingEnabledForType(monitorexitNode.object()) || - isTracingEnabledForMethod(stateAfter.method()) || - isTracingEnabledForMethod(graph.method())); + key.add("trace", isTracingEnabledForType(monitorexitNode.object()) || isTracingEnabledForMethod(stateAfter.method()) || isTracingEnabledForMethod(graph.method())); } Arguments arguments = new Arguments(); if (!eliminated) { @@ -509,9 +520,8 @@ } /** - * If balanced monitor checking is enabled then nodes are inserted at the start and - * all return points of the graph to initialize and check the monitor counter - * respectively. + * If balanced monitor checking is enabled then nodes are inserted at the start and all + * return points of the graph to initialize and check the monitor counter respectively. */ private void checkBalancedMonitors(StructuredGraph graph) { if (CHECK_BALANCED_MONITORS) { @@ -531,7 +541,7 @@ returnType = checkCounter.getSignature().getReturnType(checkCounter.getDeclaringClass()); Object msg = ((HotSpotRuntime) runtime).registerGCRoot("unbalanced monitors in " + MetaUtil.format("%H.%n(%p)", graph.method()) + ", count = %d"); ConstantNode errMsg = ConstantNode.forObject(msg, runtime, graph); - callTarget = graph.add(new MethodCallTargetNode(InvokeKind.Static, checkCounter, new ValueNode[] {errMsg}, returnType)); + callTarget = graph.add(new MethodCallTargetNode(InvokeKind.Static, checkCounter, new ValueNode[]{errMsg}, returnType)); invoke = graph.add(new InvokeNode(callTarget, 0, -1)); List stack = Collections.emptyList(); FrameState stateAfter = new FrameState(graph.method(), FrameState.AFTER_BCI, new ValueNode[0], stack, new ValueNode[0], false, false); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java Wed Jan 23 16:34:57 2013 +0100 @@ -293,7 +293,8 @@ int log2ElementSize = CodeUtil.log2(target.sizeInBytes(elementKind)); if (!useTLAB) { ConstantNode zero = ConstantNode.defaultForKind(target.wordKind, graph); - // value for 'size' doesn't matter as it isn't used since a stub call will be made anyway + // value for 'size' doesn't matter as it isn't used since a stub call will be made + // anyway // for both allocation and initialization - it just needs to be non-null ConstantNode size = ConstantNode.forInt(-1, graph); InitializeArrayNode initializeNode = graph.add(new InitializeArrayNode(zero, lengthNode, size, arrayType, newArrayNode.fillContents(), newArrayNode.locked())); @@ -307,11 +308,7 @@ InitializeArrayNode initializeNode = graph.add(new InitializeArrayNode(tlabAllocateNode, lengthNode, sizeNode, arrayType, newArrayNode.fillContents(), newArrayNode.locked())); graph.replaceFixedWithFixed(newArrayNode, initializeNode); } else { - Key key = new Key(allocateArrayAndInitialize). - add("alignment", alignment). - add("headerSize", headerSize). - add("log2ElementSize", log2ElementSize). - add("type", arrayType); + Key key = new Key(allocateArrayAndInitialize).add("alignment", alignment).add("headerSize", headerSize).add("log2ElementSize", log2ElementSize).add("type", arrayType); Arguments arguments = new Arguments().add("length", lengthNode); SnippetTemplate template = cache.get(key, assumptions); Debug.log("Lowering allocateArrayAndInitialize in %s: node=%s, template=%s, arguments=%s", graph, newArrayNode, template, arguments); @@ -358,7 +355,8 @@ final int headerSize = HotSpotRuntime.getArrayBaseOffset(elementKind); Key key = new Key(initializeArray).add("headerSize", headerSize).add("fillContents", initializeNode.fillContents()).add("locked", initializeNode.locked()); ValueNode memory = initializeNode.memory(); - Arguments arguments = arguments("memory", memory).add("hub", hub).add("prototypeMarkWord", type.prototypeMarkWord()).add("allocationSize", initializeNode.allocationSize()).add("length", initializeNode.length()); + Arguments arguments = arguments("memory", memory).add("hub", hub).add("prototypeMarkWord", type.prototypeMarkWord()).add("allocationSize", initializeNode.allocationSize()).add("length", + initializeNode.length()); SnippetTemplate template = cache.get(key, assumptions); Debug.log("Lowering initializeArray in %s: node=%s, template=%s, arguments=%s", graph, initializeNode, template, arguments); template.instantiate(runtime, initializeNode, DEFAULT_REPLACER, arguments); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ObjectSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ObjectSubstitutions.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ObjectSubstitutions.java Wed Jan 23 16:34:57 2013 +0100 @@ -38,7 +38,7 @@ public class ObjectSubstitutions { @MethodSubstitution(isStatic = false) - public static Class< ? > getClass(final Object thisObj) { + public static Class getClass(final Object thisObj) { Word hub = loadHub(thisObj); return unsafeCast(hub.readFinalObject(Word.signed(classMirrorOffset())), Class.class, true, true); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/SystemSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/SystemSubstitutions.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/SystemSubstitutions.java Wed Jan 23 16:34:57 2013 +0100 @@ -81,5 +81,6 @@ } @NodeIntrinsic(value = RuntimeCallNode.class, setStampFromReturnType = true) - public static native long callLong(@ConstantNodeParameter Descriptor descriptor); + public static native long callLong(@ConstantNodeParameter + Descriptor descriptor); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java Wed Jan 23 16:34:57 2013 +0100 @@ -38,11 +38,10 @@ import com.oracle.graal.word.*; /** - * Stub implementing the fast path for TLAB refill during instance class allocation. - * This stub is called from the {@linkplain NewObjectSnippets inline} allocation - * code when TLAB allocation fails. If this stub fails to refill the TLAB - * or allocate the object, it calls out to the HotSpot C++ runtime for - * to complete the allocation. + * Stub implementing the fast path for TLAB refill during instance class allocation. This stub is + * called from the {@linkplain NewObjectSnippets inline} allocation code when TLAB allocation fails. + * If this stub fails to refill the TLAB or allocate the object, it calls out to the HotSpot C++ + * runtime for to complete the allocation. */ public class NewArrayStub extends Stub { @@ -58,19 +57,20 @@ } /** - * Re-attempts allocation after an initial TLAB allocation failed or was skipped (e.g., due to -XX:-UseTLAB). - * + * Re-attempts allocation after an initial TLAB allocation failed or was skipped (e.g., due to + * -XX:-UseTLAB). + * * @param hub the hub of the object to be allocated * @param length the length of the array * @param intArrayHub the hub for {@code int[].class} * @param log specifies if logging is enabled */ @Snippet - private static Object newArray( - @Parameter("hub") Word hub, - @Parameter("length") int length, - @ConstantParameter("intArrayHub") Word intArrayHub, - @ConstantParameter("log") boolean log) { + private static Object newArray(@Parameter("hub") + Word hub, @Parameter("length") + int length, @ConstantParameter("intArrayHub") + Word intArrayHub, @ConstantParameter("log") + boolean log) { int layoutHelper = hub.readInt(layoutHelperOffset()); int log2ElementSize = (layoutHelper >> layoutHelperLog2ElementSizeShift()) & layoutHelperLog2ElementSizeMask(); int headerSize = (layoutHelper >> layoutHelperHeaderSizeShift()) & layoutHelperHeaderSizeMask(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java Wed Jan 23 16:34:57 2013 +0100 @@ -40,11 +40,10 @@ import com.oracle.graal.word.*; /** - * Stub implementing the fast path for TLAB refill during instance class allocation. - * This stub is called from the {@linkplain NewObjectSnippets inline} allocation - * code when TLAB allocation fails. If this stub fails to refill the TLAB - * or allocate the object, it calls out to the HotSpot C++ runtime for - * to complete the allocation. + * Stub implementing the fast path for TLAB refill during instance class allocation. This stub is + * called from the {@linkplain NewObjectSnippets inline} allocation code when TLAB allocation fails. + * If this stub fails to refill the TLAB or allocate the object, it calls out to the HotSpot C++ + * runtime for to complete the allocation. */ public class NewInstanceStub extends Stub { @@ -60,16 +59,17 @@ } /** - * Re-attempts allocation after an initial TLAB allocation failed or was skipped (e.g., due to -XX:-UseTLAB). - * + * Re-attempts allocation after an initial TLAB allocation failed or was skipped (e.g., due to + * -XX:-UseTLAB). + * * @param hub the hub of the object to be allocated * @param intArrayHub the hub for {@code int[].class} */ @Snippet - private static Object newInstance( - @Parameter("hub") Word hub, - @ConstantParameter("intArrayHub") Word intArrayHub, - @ConstantParameter("log") boolean log) { + private static Object newInstance(@Parameter("hub") + Word hub, @ConstantParameter("intArrayHub") + Word intArrayHub, @ConstantParameter("log") + boolean log) { int sizeInBytes = hub.readInt(klassInstanceSizeOffset()); if (!forceSlowPath() && inlineContiguousAllocationSupported()) { if (hub.readInt(klassStateOffset()) == klassStateFullyInitialized()) { @@ -90,11 +90,12 @@ /** * Attempts to refill the current thread's TLAB and retries the allocation. - * + * * @param intArrayHub the hub for {@code int[].class} * @param sizeInBytes the size of the allocation * @param log specifies if logging is enabled - * @return the newly allocated, uninitialized chunk of memory, or {@link Word#zero()} if the operation was unsuccessful + * @return the newly allocated, uninitialized chunk of memory, or {@link Word#zero()} if the + * operation was unsuccessful */ static Word refillAllocate(Word intArrayHub, int sizeInBytes, boolean log) { @@ -133,7 +134,8 @@ // fill [top, end + alignment_reserve) with array object if (top != Word.zero()) { int headerSize = arrayBaseOffset(Kind.Int); - // just like the HotSpot assembler stubs, assumes that tlabFreeSpaceInInts fits in an int + // just like the HotSpot assembler stubs, assumes that tlabFreeSpaceInInts fits in + // an int int tlabFreeSpaceInInts = (int) tlabFreeSpaceInBytes.rawValue() >>> 2; int length = ((alignmentReserveInBytes - headerSize) >>> 2) + tlabFreeSpaceInInts; NewObjectSnippets.formatArray(intArrayHub, -1, length, headerSize, top, intArrayMarkWord, false); @@ -175,7 +177,7 @@ /** * Attempts to allocate a chunk of memory from Eden space. - * + * * @param sizeInBytes the size of the chunk to allocate * @param log specifies if logging is enabled * @return the allocated chunk or {@link Word#zero()} if allocation fails @@ -212,26 +214,31 @@ Log.printf(format, value); } } + static void log(boolean enabled, String format, WordBase value) { if (enabled) { Log.printf(format, value.rawValue()); } } + static void log(boolean enabled, String format, long v1, long v2) { if (enabled) { Log.printf(format, v1, v2); } } + static void log(boolean enabled, String format, Word v1, long v2) { if (enabled) { Log.printf(format, v1.rawValue(), v2); } } + static void log(boolean enabled, String format, Word v1, Word v2) { if (enabled) { Log.printf(format, v1.rawValue(), v2.rawValue()); } } + static void log(boolean enabled, String format, long v1, long v2, long v3) { if (enabled) { Log.printf(format, v1, v2, v3); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Wed Jan 23 16:34:57 2013 +0100 @@ -45,8 +45,8 @@ import com.oracle.graal.snippets.SnippetTemplate.Key; /** - * Base class for implementing some low level code providing the out-of-line slow path for a snippet. - * A concrete stub is defined a subclass of this class. + * Base class for implementing some low level code providing the out-of-line slow path for a + * snippet. A concrete stub is defined a subclass of this class. *

    * Implementation detail: The stub classes re-use some of the functionality for {@link Snippet}s * purely for convenience (e.g., can re-use the {@link SnippetInstaller}). @@ -69,8 +69,9 @@ protected InstalledCode stubCode; /** - * Creates a new stub container. The new stub still needs to be {@linkplain #install(GraalCompiler) installed}. - * + * Creates a new stub container. The new stub still needs to be + * {@linkplain #install(GraalCompiler) installed}. + * * @param descriptor linkage details for a call to the stub */ @SuppressWarnings("unchecked") @@ -102,7 +103,8 @@ } /** - * Compiles the code for this stub, installs it and initializes the address used for calls to it. + * Compiles the code for this stub, installs it and initializes the address used for calls to + * it. */ public void install(GraalCompiler compiler) { StructuredGraph graph = (StructuredGraph) stubMethod.getCompilerStorage().get(Graph.class); @@ -118,13 +120,14 @@ final CompilationResult compResult = compiler.compileMethod(stubMethod, graph, null, phasePlan, OptimisticOptimizations.ALL); final CodeInfo[] info = new CodeInfo[1]; - stubCode = Debug.scope("CodeInstall", new Object[] {compiler, stubMethod}, new Callable() { + stubCode = Debug.scope("CodeInstall", new Object[]{compiler, stubMethod}, new Callable() { + @Override public InstalledCode call() { InstalledCode installedCode = runtime().addMethod(stubMethod, compResult, info); assert installedCode != null : "error installing stub " + stubMethod; if (Debug.isDumpEnabled()) { - Debug.dump(new Object[] {compResult, info[0]}, "After code installation"); + Debug.dump(new Object[]{compResult, info[0]}, "After code installation"); } return installedCode; } @@ -135,7 +138,8 @@ } /** - * Finds the static method annotated with {@link Snippet} in a given class of which there must be exactly one. + * Finds the static method annotated with {@link Snippet} in a given class of which there must + * be exactly one. */ private static HotSpotResolvedJavaMethod findStubMethod(HotSpotRuntime runtime, Class stubClass) { HotSpotResolvedJavaMethod m = null; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/BytecodeInterpreter.java --- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/BytecodeInterpreter.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/BytecodeInterpreter.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,8 +31,8 @@ import com.oracle.graal.bytecode.*; /** - * High-level bytecode interpreter that executes on top of Java. Java native methods - * are executed using the {@link com.oracle.graal.api.interpreter.RuntimeInterpreterInterface}. + * High-level bytecode interpreter that executes on top of Java. Java native methods are executed + * using the {@link com.oracle.graal.api.interpreter.RuntimeInterpreterInterface}. */ @SuppressWarnings("static-method") public final class BytecodeInterpreter implements Interpreter { @@ -1194,7 +1194,7 @@ return constantPool.lookupType(cpi, opcode).resolve(frame.getMethod().getDeclaringClass()); } - private ResolvedJavaType resolveType(InterpreterFrame frame, Class< ? > javaClass) { + private ResolvedJavaType resolveType(InterpreterFrame frame, Class javaClass) { return metaAccessProvider.lookupJavaType(javaClass).resolve(frame.getMethod().getDeclaringClass()); } @@ -1371,7 +1371,8 @@ traceCall(caller, "Delegate " + originalMethod); } - // current thread is low level and we also execute the target method in the low-level interpreter + // current thread is low level and we also execute the target method in the low-level + // interpreter Object[] originalCalleeParameters = popArgumentsAsObject(caller, originalMethod, hasReceiver); Object[] parameters = new Object[]{caller, originalMethod, originalCalleeParameters}; Object returnValue = redirectionInfo.getTargetMethod().invoke(redirectionInfo.getReceiver(), parameters); @@ -1609,7 +1610,7 @@ } } - private static Method findMethod(Class< ? > clazz, String name, Class< ? >... parameters) { + private static Method findMethod(Class clazz, String name, Class... parameters) { try { return clazz.getDeclaredMethod(name, parameters); } catch (Exception e) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterCallable.java --- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterCallable.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterCallable.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,8 +24,8 @@ import com.oracle.graal.api.meta.*; +public interface InterpreterCallable { -public interface InterpreterCallable { // static final fields String INTERPRETER_CALLABLE_INVOKE_NAME = "invoke"; Class[] INTERPRETER_CALLABLE_INVOKE_SIGNATURE = {InterpreterFrame.class, ResolvedJavaMethod.class, Object[].class}; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterException.java --- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterException.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterException.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,8 +23,8 @@ package com.oracle.graal.interpreter; /** - * Thrown if executed byte code caused an error in {@link BytecodeInterpreter}. The actual execution exception is - * accessible using {@link #getCause()} or {@link #getExecutionThrowable()}. + * Thrown if executed byte code caused an error in {@link BytecodeInterpreter}. The actual execution + * exception is accessible using {@link #getCause()} or {@link #getExecutionThrowable()}. */ public class InterpreterException extends RuntimeException { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterFrame.java --- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterFrame.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterFrame.java Wed Jan 23 16:34:57 2013 +0100 @@ -78,13 +78,10 @@ } private void copyArguments(InterpreterFrame dest, int length) { - System.arraycopy(locals, tosSingle(length - 1), dest.locals, - BASE_LENGTH, length); - System.arraycopy(primitiveLocals, tosSingle(length - 1), dest.primitiveLocals, - BASE_LENGTH, length); + System.arraycopy(locals, tosSingle(length - 1), dest.locals, BASE_LENGTH, length); + System.arraycopy(primitiveLocals, tosSingle(length - 1), dest.primitiveLocals, BASE_LENGTH, length); } - public Object peekReceiver(ResolvedJavaMethod method) { return getObject(tosSingle(method.getSignature().getParameterSlots(false))); } @@ -298,11 +295,9 @@ } public void pushTo(InterpreterFrame childFrame, int argumentSlots) { - System.arraycopy(locals, tos - argumentSlots, childFrame.locals, - InterpreterFrame.MIN_FRAME_SIZE, argumentSlots); + System.arraycopy(locals, tos - argumentSlots, childFrame.locals, InterpreterFrame.MIN_FRAME_SIZE, argumentSlots); - System.arraycopy(primitiveLocals, tos - argumentSlots, childFrame.primitiveLocals, - InterpreterFrame.MIN_FRAME_SIZE, argumentSlots); + System.arraycopy(primitiveLocals, tos - argumentSlots, childFrame.primitiveLocals, InterpreterFrame.MIN_FRAME_SIZE, argumentSlots); popVoid(argumentSlots); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,38 +34,46 @@ import com.oracle.graal.phases.*; /** - * Builds a mapping between bytecodes and basic blocks and builds a conservative control flow graph (CFG). - * It makes one linear passes over the bytecodes to build the CFG where it detects block headers and connects them. + * Builds a mapping between bytecodes and basic blocks and builds a conservative control flow graph + * (CFG). It makes one linear passes over the bytecodes to build the CFG where it detects block + * headers and connects them. *

    - * It also creates exception dispatch blocks for exception handling. These blocks are between a bytecode that might - * throw an exception, and the actual exception handler entries, and are later used to create the type checks with the - * exception handler catch types. If a bytecode is covered by an exception handler, this bytecode ends the basic block. - * This guarantees that a) control flow cannot be transferred to an exception dispatch block in the middle of a block, and - * b) that every block has at most one exception dispatch block (which is always the last entry in the successor list). + * It also creates exception dispatch blocks for exception handling. These blocks are between a + * bytecode that might throw an exception, and the actual exception handler entries, and are later + * used to create the type checks with the exception handler catch types. If a bytecode is covered + * by an exception handler, this bytecode ends the basic block. This guarantees that a) control flow + * cannot be transferred to an exception dispatch block in the middle of a block, and b) that every + * block has at most one exception dispatch block (which is always the last entry in the successor + * list). *

    - * If a bytecode is covered by multiple exception handlers, a chain of exception dispatch blocks is created so that - * multiple exception handler types can be checked. The chains are re-used if multiple bytecodes are covered by the same - * exception handlers. + * If a bytecode is covered by multiple exception handlers, a chain of exception dispatch blocks is + * created so that multiple exception handler types can be checked. The chains are re-used if + * multiple bytecodes are covered by the same exception handlers. *

    - * Note that exception unwinds, i.e., bytecodes that can throw an exception but the exception is not handled in this method, - * do not end a basic block. Not modeling the exception unwind block reduces the complexity of the CFG, and there is no - * algorithm yet where the exception unwind block would matter. + * Note that exception unwinds, i.e., bytecodes that can throw an exception but the exception is not + * handled in this method, do not end a basic block. Not modeling the exception unwind block reduces + * the complexity of the CFG, and there is no algorithm yet where the exception unwind block would + * matter. *

    - * The class also handles subroutines (jsr and ret bytecodes): subroutines are inlined by duplicating the subroutine blocks. - * This is limited to simple, structured subroutines with a maximum subroutine nesting of 4. Otherwise, a bailout is thrown. + * The class also handles subroutines (jsr and ret bytecodes): subroutines are inlined by + * duplicating the subroutine blocks. This is limited to simple, structured subroutines with a + * maximum subroutine nesting of 4. Otherwise, a bailout is thrown. *

    - * Loops in the methods are detected. If a method contains an irreducible loop (a loop with more than one entry), a bailout is - * thrown. This simplifies the compiler later on since only structured loops need to be supported. + * Loops in the methods are detected. If a method contains an irreducible loop (a loop with more + * than one entry), a bailout is thrown. This simplifies the compiler later on since only structured + * loops need to be supported. *

    - * A data flow analysis computes the live local variables from the point of view of the interpreter. The result is used later - * to prune frame states, i.e., remove local variable entries that are guaranteed to be never used again (even in the case of - * deoptimization). + * A data flow analysis computes the live local variables from the point of view of the interpreter. + * The result is used later to prune frame states, i.e., remove local variable entries that are + * guaranteed to be never used again (even in the case of deoptimization). *

    - * The algorithms and analysis in this class are conservative and do not use any assumptions or profiling information. + * The algorithms and analysis in this class are conservative and do not use any assumptions or + * profiling information. */ public final class BciBlockMapping { public static class Block implements Cloneable { + public int startBci; public int endBci; public boolean isExceptionEntry; @@ -103,7 +111,7 @@ } public int numNormalSuccessors() { - if (exceptionDispatchBlock() != null) { + if (exceptionDispatchBlock() != null) { return successors.size() - 1; } return successors.size(); @@ -138,6 +146,7 @@ } public static class ExceptionDispatchBlock extends Block { + private HashMap exceptionDispatch = new HashMap<>(); public ExceptionHandler handler; @@ -159,6 +168,7 @@ /** * Creates a new BlockMap instance from bytecode of the given method . + * * @param method the compiler interface method containing the code */ public BciBlockMapping(ResolvedJavaMethod method) { @@ -201,6 +211,7 @@ } if (GraalOptions.OptLivenessAnalysis) { Debug.scope("LivenessAnalysis", new Runnable() { + @Override public void run() { computeLiveness(); @@ -478,7 +489,6 @@ } } - private HashMap initialExceptionDispatch = new HashMap<>(); private ExceptionDispatchBlock handleExceptions(int bci) { @@ -488,7 +498,8 @@ ExceptionHandler h = exceptionHandlers[i]; if (h.getStartBCI() <= bci && bci < h.getEndBCI()) { if (h.isCatchAll()) { - // Discard all information about succeeding exception handlers, since they can never be reached. + // Discard all information about succeeding exception handlers, since they can + // never be reached. lastHandler = null; } @@ -524,9 +535,11 @@ long loop = fixLoopBits(blockMap[0]); if (loop != 0) { - // There is a path from a loop end to the method entry that does not pass the loop header. + // There is a path from a loop end to the method entry that does not pass the loop + // header. // Therefore, the loop is non reducible (has more than one entry). - // We don't want to compile such methods because the IR only supports structured loops. + // We don't want to compile such methods because the IR only supports structured + // loops. throw new BailoutException("Non-reducible loop: %016x", loop); } } while (loopChanges); @@ -536,7 +549,8 @@ long loop = computeBlockOrder(blockMap[0]); if (loop != 0) { - // There is a path from a loop end to the method entry that does not pass the loop header. + // There is a path from a loop end to the method entry that does not pass the loop + // header. // Therefore, the loop is non reducible (has more than one entry). // We don't want to compile such methods because the IR only supports structured loops. throw new BailoutException("Non-reducible loop"); @@ -610,21 +624,25 @@ private int nextLoop; /** - * Mark the block as a loop header, using the next available loop number. - * Also checks for corner cases that we don't want to compile. + * Mark the block as a loop header, using the next available loop number. Also checks for corner + * cases that we don't want to compile. */ private void makeLoopHeader(Block block) { if (!block.isLoopHeader) { block.isLoopHeader = true; if (block.isExceptionEntry) { - // Loops that are implicitly formed by an exception handler lead to all sorts of corner cases. - // Don't compile such methods for now, until we see a concrete case that allows checking for correctness. + // Loops that are implicitly formed by an exception handler lead to all sorts of + // corner cases. + // Don't compile such methods for now, until we see a concrete case that allows + // checking for correctness. throw new BailoutException("Loop formed by an exception handler"); } if (nextLoop >= Long.SIZE) { - // This restriction can be removed by using a fall-back to a BitSet in case we have more than 64 loops - // Don't compile such methods for now, until we see a concrete case that allows checking for correctness. + // This restriction can be removed by using a fall-back to a BitSet in case we have + // more than 64 loops + // Don't compile such methods for now, until we see a concrete case that allows + // checking for correctness. throw new BailoutException("Too many loops in method"); } @@ -639,9 +657,9 @@ } /** - * Depth-first traversal of the control flow graph. The flag {@linkplain Block#visited} is used to - * visit every block only once. The flag {@linkplain Block#active} is used to detect cycles (backward - * edges). + * Depth-first traversal of the control flow graph. The flag {@linkplain Block#visited} is used + * to visit every block only once. The flag {@linkplain Block#active} is used to detect cycles + * (backward edges). */ private long computeBlockOrder(Block block) { if (block.visited) { @@ -723,7 +741,8 @@ changed = false; for (int i = blocks.size() - 1; i >= 0; i--) { Block block = blocks.get(i); - Debug.log(" start B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.blockID, block.startBci, block.endBci, block.localsLiveIn, block.localsLiveOut, block.localsLiveGen, block.localsLiveKill); + Debug.log(" start B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.blockID, block.startBci, block.endBci, block.localsLiveIn, block.localsLiveOut, block.localsLiveGen, + block.localsLiveKill); boolean blockChanged = (iteration == 0); if (block.successors.size() > 0) { @@ -740,7 +759,8 @@ block.localsLiveIn.or(block.localsLiveOut); block.localsLiveIn.xor(block.localsLiveKill); block.localsLiveIn.or(block.localsLiveGen); - Debug.log(" end B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.blockID, block.startBci, block.endBci, block.localsLiveIn, block.localsLiveOut, block.localsLiveGen, block.localsLiveKill); + Debug.log(" end B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.blockID, block.startBci, block.endBci, block.localsLiveIn, block.localsLiveOut, block.localsLiveGen, + block.localsLiveKill); } changed |= blockChanged; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java Wed Jan 23 16:34:57 2013 +0100 @@ -47,7 +47,7 @@ /** * Disassembles the bytecode of a given method in a {@code javap}-like format. - * + * * @return {@code null} if {@code method} has no bytecode (e.g., it is native or abstract) */ public String disassemble(ResolvedJavaMethod method) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java Wed Jan 23 16:34:57 2013 +0100 @@ -207,7 +207,8 @@ if (node.isDeleted()) { return; } - // Collect all phi functions that use this phi so that we can delete them recursively (after we delete ourselves to avoid circles). + // Collect all phi functions that use this phi so that we can delete them recursively (after + // we delete ourselves to avoid circles). List propagateUsages = node.usages().filter(FloatingNode.class).filter(isA(PhiNode.class).or(ValueProxyNode.class)).snapshot(); // Remove the phi function from all FrameStates where it is used and then delete it. @@ -316,10 +317,9 @@ rethrowException = b; } - /** * Returns the size of the local variables. - * + * * @return the size of the local variables */ public int localsSize() { @@ -335,7 +335,7 @@ /** * 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 */ @@ -345,7 +345,7 @@ /** * 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 */ @@ -355,7 +355,7 @@ /** * Adds a locked monitor to this frame state. - * + * * @param object the object whose monitor will be locked. */ public void pushLock(ValueNode object) { @@ -365,7 +365,7 @@ /** * Removes a locked monitor from this frame state. - * + * * @return the object whose monitor was removed from the locks list. */ public ValueNode popLock() { @@ -386,7 +386,7 @@ /** * 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 */ @@ -399,9 +399,10 @@ } /** - * Stores a given local variable at the specified index. If the value occupies {@linkplain FrameStateBuilder#isTwoSlot(Kind) two slots}, - * then the next local variable index is also overwritten. - * + * Stores a given local variable at the specified index. If the value occupies + * {@linkplain FrameStateBuilder#isTwoSlot(Kind) 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 */ @@ -428,6 +429,7 @@ /** * 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 */ @@ -441,6 +443,7 @@ /** * Pushes a value onto the stack without checking the type. + * * @param x the instruction to push onto the stack */ public void xpush(ValueNode x) { @@ -450,6 +453,7 @@ /** * 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) { @@ -458,6 +462,7 @@ /** * 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) { @@ -466,6 +471,7 @@ /** * 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) { @@ -474,6 +480,7 @@ /** * Pushes a value onto the stack and checks that it is a JSR return address. + * * @param x the instruction to push onto the stack */ public void jpush(ValueNode x) { @@ -482,7 +489,7 @@ /** * 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) { @@ -492,6 +499,7 @@ /** * 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) { @@ -507,6 +515,7 @@ /** * Pops an instruction off the stack with the expected type. + * * @param kind the expected type * @return the instruction on the top of the stack */ @@ -520,6 +529,7 @@ /** * Pops a value off of the stack without checking the type. + * * @return x the instruction popped off the stack */ public ValueNode xpop() { @@ -530,6 +540,7 @@ /** * 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() { @@ -538,6 +549,7 @@ /** * 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() { @@ -546,6 +558,7 @@ /** * 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() { @@ -554,6 +567,7 @@ /** * Pops a value off of the stack and checks that it is a JSR return address. + * * @return x the instruction popped off the stack */ public ValueNode jpop() { @@ -562,6 +576,7 @@ /** * 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() { @@ -571,6 +586,7 @@ /** * 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() { @@ -579,7 +595,9 @@ } /** - * Pop the specified number of slots off of this stack and return them as an array of instructions. + * 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 slotSize, int argSize) { @@ -599,8 +617,10 @@ /** * 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. + * + * @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) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -57,7 +57,6 @@ public static final Descriptor CREATE_NULL_POINTER_EXCEPTION = new Descriptor("createNullPointerException", true, Object.class); public static final Descriptor CREATE_OUT_OF_BOUNDS_EXCEPTION = new Descriptor("createOutOfBoundsException", true, Object.class, int.class); - /** * The minimum value to which {@link GraalOptions#TraceBytecodeParserLevel} must be set to trace * the bytecode instructions as they are parsed. @@ -95,12 +94,13 @@ private long graphId; /** - * Node that marks the begin of block during bytecode parsing. When a block is identified the first - * time as a jump target, the placeholder is created and used as the successor for the jump. When the - * block is seen the second time, a MergeNode is created to correctly merge the now two different - * predecessor states. + * Node that marks the begin of block during bytecode parsing. When a block is identified the + * first time as a jump target, the placeholder is created and used as the successor for the + * jump. When the block is seen the second time, a MergeNode is created to correctly merge the + * now two different predecessor states. */ private static class BlockPlaceholderNode extends FixedWithNextNode implements Node.IterableNodeType { + public BlockPlaceholderNode() { super(StampFactory.forVoid()); } @@ -177,8 +177,10 @@ currentBlock = blockMap.startBlock; blockMap.startBlock.entryState = frameState; if (blockMap.startBlock.isLoopHeader) { - // TODO(lstadler,gduboscq) createTarget might not be safe at this position, since it expects currentBlock, - // etc. to be set up correctly. A better solution to this problem of start blocks that are loop headers + // TODO(lstadler,gduboscq) createTarget might not be safe at this position, since it + // expects currentBlock, + // etc. to be set up correctly. A better solution to this problem of start blocks that + // are loop headers // would be to create a dummy block in BciBlockMapping. appendGoto(createTarget(blockMap.startBlock, frameState)); } else { @@ -258,7 +260,8 @@ Debug.log("Creating exception dispatch edges at %d, exception object=%s, exception seen=%s", bci, exceptionObject, profilingInfo.getExceptionSeen(bci)); Block dispatchBlock = currentBlock.exceptionDispatchBlock(); - // The exception dispatch block is always for the last bytecode of a block, so if we are not at the endBci yet, + // The exception dispatch block is always for the last bytecode of a block, so if we are not + // at the endBci yet, // there is no exception handler for this bci and we can unwind immediately. if (bci != currentBlock.endBci || dispatchBlock == null) { dispatchBlock = unwindBlock(bci); @@ -414,23 +417,39 @@ ValueNode x = frameState.pop(result); boolean isStrictFP = isStrict(method.getModifiers()); ArithmeticNode v; - switch(opcode){ + switch (opcode) { case IADD: - case LADD: v = new IntegerAddNode(result, x, y); break; + case LADD: + v = new IntegerAddNode(result, x, y); + break; case FADD: - case DADD: v = new FloatAddNode(result, x, y, isStrictFP); break; + case DADD: + v = new FloatAddNode(result, x, y, isStrictFP); + break; case ISUB: - case LSUB: v = new IntegerSubNode(result, x, y); break; + case LSUB: + v = new IntegerSubNode(result, x, y); + break; case FSUB: - case DSUB: v = new FloatSubNode(result, x, y, isStrictFP); break; + case DSUB: + v = new FloatSubNode(result, x, y, isStrictFP); + break; case IMUL: - case LMUL: v = new IntegerMulNode(result, x, y); break; + case LMUL: + v = new IntegerMulNode(result, x, y); + break; case FMUL: - case DMUL: v = new FloatMulNode(result, x, y, isStrictFP); break; + case DMUL: + v = new FloatMulNode(result, x, y, isStrictFP); + break; case FDIV: - case DDIV: v = new FloatDivNode(result, x, y, isStrictFP); break; + case DDIV: + v = new FloatDivNode(result, x, y, isStrictFP); + break; case FREM: - case DREM: v = new FloatRemNode(result, x, y, isStrictFP); break; + case DREM: + v = new FloatRemNode(result, x, y, isStrictFP); + break; default: throw new GraalInternalError("should not reach"); } @@ -442,11 +461,15 @@ ValueNode y = frameState.pop(result); ValueNode x = frameState.pop(result); FixedWithNextNode v; - switch(opcode){ + switch (opcode) { case IDIV: - case LDIV: v = new IntegerDivNode(result, x, y); break; + case LDIV: + v = new IntegerDivNode(result, x, y); + break; case IREM: - case LREM: v = new IntegerRemNode(result, x, y); break; + case LREM: + v = new IntegerRemNode(result, x, y); + break; default: throw new GraalInternalError("should not reach"); } @@ -462,13 +485,19 @@ ValueNode s = frameState.ipop(); ValueNode x = frameState.pop(kind); ShiftNode v; - switch(opcode){ + switch (opcode) { case ISHL: - case LSHL: v = new LeftShiftNode(kind, x, s); break; + case LSHL: + v = new LeftShiftNode(kind, x, s); + break; case ISHR: - case LSHR: v = new RightShiftNode(kind, x, s); break; + case LSHR: + v = new RightShiftNode(kind, x, s); + break; case IUSHR: - case LUSHR: v = new UnsignedRightShiftNode(kind, x, s); break; + case LUSHR: + v = new UnsignedRightShiftNode(kind, x, s); + break; default: throw new GraalInternalError("should not reach"); } @@ -479,13 +508,19 @@ ValueNode y = frameState.pop(kind); ValueNode x = frameState.pop(kind); LogicNode v; - switch(opcode){ + switch (opcode) { case IAND: - case LAND: v = new AndNode(kind, x, y); break; + case LAND: + v = new AndNode(kind, x, y); + break; case IOR: - case LOR: v = new OrNode(kind, x, y); break; + case LOR: + v = new OrNode(kind, x, y); + break; case IXOR: - case LXOR: v = new XorNode(kind, x, y); break; + case LXOR: + v = new XorNode(kind, x, y); + break; default: throw new GraalInternalError("should not reach"); } @@ -586,7 +621,8 @@ private void genThrow() { ValueNode exception = frameState.apop(); - FixedGuardNode node = currentGraph.add(new FixedGuardNode(currentGraph.unique(new IsNullNode(exception)), DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile, true, graphId)); + FixedGuardNode node = currentGraph.add(new FixedGuardNode(currentGraph.unique(new IsNullNode(exception)), DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile, + true, graphId)); append(node); append(handleException(exception, bci())); } @@ -619,11 +655,11 @@ return result; } -// private void eagerResolving(int cpi, int bytecode) { -// if (graphBuilderConfig.eagerResolving()) { -// constantPool.loadReferencedType(cpi, bytecode); -// } -// } + // private void eagerResolving(int cpi, int bytecode) { + // if (graphBuilderConfig.eagerResolving()) { + // constantPool.loadReferencedType(cpi, bytecode); + // } + // } private void eagerResolvingForSnippets(int cpi, int bytecode) { if (graphBuilderConfig.eagerResolvingForSnippets()) { @@ -690,29 +726,39 @@ } /** - * Gets the kind of array elements for the array type code that appears - * in a {@link Bytecodes#NEWARRAY} bytecode. + * Gets the kind of array elements for the array type code that appears in a + * {@link Bytecodes#NEWARRAY} bytecode. + * * @param code the array type code * @return the kind from the array type code */ - public static Class< ? > arrayTypeCodeToClass(int code) { + public static Class arrayTypeCodeToClass(int code) { // Checkstyle: stop switch (code) { - case 4: return boolean.class; - case 5: return char.class; - case 6: return float.class; - case 7: return double.class; - case 8: return byte.class; - case 9: return short.class; - case 10: return int.class; - case 11: return long.class; - default: throw new IllegalArgumentException("unknown array type code: " + code); + case 4: + return boolean.class; + case 5: + return char.class; + case 6: + return float.class; + case 7: + return double.class; + case 8: + return byte.class; + case 9: + return short.class; + case 10: + return int.class; + case 11: + return long.class; + default: + throw new IllegalArgumentException("unknown array type code: " + code); } // Checkstyle: resume } private void genNewPrimitiveArray(int typeCode) { - Class< ? > clazz = arrayTypeCodeToClass(typeCode); + Class clazz = arrayTypeCodeToClass(typeCode); ResolvedJavaType elementType = runtime.lookupJavaType(clazz); NewPrimitiveArrayNode nta = currentGraph.add(new NewPrimitiveArrayNode(elementType, frameState.ipop(), true, false)); frameState.apush(append(nta)); @@ -801,7 +847,6 @@ cachedNullPointerException.setStackTrace(new StackTraceElement[0]); } - private void emitBoundsCheck(ValueNode index, ValueNode length) { BlockPlaceholderNode trueSucc = currentGraph.add(new BlockPlaceholderNode()); BlockPlaceholderNode falseSucc = currentGraph.add(new BlockPlaceholderNode()); @@ -991,7 +1036,8 @@ returnType = returnType.resolve(targetMethod.getDeclaringClass()); } MethodCallTargetNode callTarget = currentGraph.add(new MethodCallTargetNode(invokeKind, targetMethod, args, returnType)); - // be conservative if information was not recorded (could result in endless recompiles otherwise) + // be conservative if information was not recorded (could result in endless recompiles + // otherwise) if (optimisticOpts.useExceptionProbability() && profilingInfo.getExceptionSeen(bci()) == ExceptionSeen.FALSE) { ValueNode result = appendWithBCI(currentGraph.add(new InvokeNode(callTarget, bci(), graphId))); frameState.pushReturn(resultType, result); @@ -1060,7 +1106,8 @@ ValueNode local = frameState.loadLocal(localIndex); JsrScope scope = currentBlock.jsrScope; int retAddress = scope.nextReturnAddress(); - append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new IntegerEqualsNode(local, ConstantNode.forJsr(retAddress, currentGraph))), DeoptimizationReason.JavaSubroutineMismatch, DeoptimizationAction.InvalidateReprofile, graphId))); + append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new IntegerEqualsNode(local, ConstantNode.forJsr(retAddress, currentGraph))), DeoptimizationReason.JavaSubroutineMismatch, + DeoptimizationAction.InvalidateReprofile, graphId))); if (!successor.jsrScope.equals(scope.pop())) { throw new JsrNotSupportedBailout("unstructured control flow (ret leaves more than one scope)"); } @@ -1143,6 +1190,7 @@ } private static class SuccessorInfo { + int blockIndex; int actualIndex; @@ -1180,8 +1228,10 @@ } private static class Target { + FixedNode fixed; FrameStateBuilder state; + public Target(FixedNode fixed, FrameStateBuilder state) { this.fixed = fixed; this.state = state; @@ -1207,6 +1257,7 @@ } while (exits != 0); Collections.sort(exitLoops, new Comparator() { + @Override public int compare(Block o1, Block o2) { return Long.bitCount(o2.loops) - Long.bitCount(o1.loops); @@ -1260,7 +1311,8 @@ if (block.firstInstruction == 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. + // Create and return a placeholder that later can be replaced with a MergeNode when we + // see this block again. block.firstInstruction = currentGraph.add(new BlockPlaceholderNode()); Target target = checkLoopExit(block.firstInstruction, block, state); FixedNode result = target.fixed; @@ -1278,7 +1330,8 @@ if (block.firstInstruction instanceof LoopBeginNode) { assert block.isLoopHeader && currentBlock.blockID >= block.blockID : "must be backward branch"; - // Backward loop edge. We need to create a special LoopEndNode and merge with the loop begin node created before. + // Backward loop edge. We need to create a special LoopEndNode and merge with the loop + // begin node created before. LoopBeginNode loopBegin = (LoopBeginNode) block.firstInstruction; Target target = checkLoopExit(currentGraph.add(new LoopEndNode(loopBegin)), block, state); FixedNode result = target.fixed; @@ -1291,14 +1344,16 @@ assert block.firstInstruction.next() == null : "bytecodes already parsed for block"; if (block.firstInstruction instanceof BlockPlaceholderNode) { - // 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. + // 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. BlockPlaceholderNode placeholder = (BlockPlaceholderNode) block.firstInstruction; // The EndNode for the already existing edge. EndNode end = currentGraph.add(new EndNode()); // The MergeNode that replaces the placeholder. - MergeNode mergeNode = currentGraph.add(new MergeNode()); + MergeNode mergeNode = currentGraph.add(new MergeNode()); FixedNode next = placeholder.next(); placeholder.setNext(end); @@ -1322,15 +1377,15 @@ } /** - * Returns a block begin node with the specified state. If the specified probability is 0, the block - * deoptimizes immediately. + * Returns a block begin node with the specified state. If the specified probability is 0, the + * block deoptimizes immediately. */ private BeginNode createBlockTarget(double probability, Block block, FrameStateBuilder stateAfter) { FixedNode target = createTarget(probability, block, stateAfter); BeginNode begin = BeginNode.begin(target); - assert !(target instanceof DeoptimizeNode && begin.stateAfter() != null) : - "We are not allowed to set the stateAfter of the begin node, because we have to deoptimize to a bci _before_ the actual if, so that the interpreter can update the profiling information."; + assert !(target instanceof DeoptimizeNode && begin.stateAfter() != null) : "We are not allowed to set the stateAfter of the begin node, because we have to deoptimize " + + "to a bci _before_ the actual if, so that the interpreter can update the profiling information."; return begin; } @@ -1501,7 +1556,8 @@ private void iterateBytecodesForBlock(Block block) { if (block.isLoopHeader) { - // Create the loop header block, which later will merge the backward branches of the loop. + // Create the loop header block, which later will merge the backward branches of the + // loop. EndNode preLoopEnd = currentGraph.add(new EndNode()); LoopBeginNode loopBegin = currentGraph.add(new LoopBeginNode()); lastInstr.setNext(preLoopEnd); @@ -1513,10 +1569,12 @@ frameState.insertLoopPhis(loopBegin); loopBegin.setStateAfter(frameState.create(block.startBci)); - // We have seen all forward branches. All subsequent backward branches will merge to the loop header. + // We have seen all forward branches. All subsequent backward branches will merge to the + // loop header. // This ensures that the loop header has exactly one non-loop predecessor. block.firstInstruction = loopBegin; - // We need to preserve the frame state builder of the loop header so that we can merge values for + // 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.entryState = frameState.copy(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.java/src/com/oracle/graal/java/JsrNotSupportedBailout.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/JsrNotSupportedBailout.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/JsrNotSupportedBailout.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,8 +24,8 @@ import com.oracle.graal.api.code.*; +public class JsrNotSupportedBailout extends BailoutException { -public class JsrNotSupportedBailout extends BailoutException{ private static final long serialVersionUID = -7476925652727154272L; public JsrNotSupportedBailout(String reason) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/ConvertJTT.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/ConvertJTT.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/ConvertJTT.java Wed Jan 23 16:34:57 2013 +0100 @@ -135,7 +135,7 @@ } output.add(line); } else { -// line = line.replace(oldClassName, newClassName); + // line = line.replace(oldClassName, newClassName); line = line.replace(" jtt.", " com.oracle.graal.jtt."); output.add(line); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -37,9 +37,9 @@ /** * Base class for the JTT tests. *

    - * These tests are executed twice: once with arguments passed to the execution and - * once with the arguments bound to the test's parameters during compilation. - * The latter is a good test of canonicalization. + * These tests are executed twice: once with arguments passed to the execution and once with the + * arguments bound to the test's parameters during compilation. The latter is a good test of + * canonicalization. */ public class JTTTest extends GraalCompilerTest { @@ -89,7 +89,7 @@ } protected void runTest(String name, Object... args) { - //System.out.println(getClass().getSimpleName() + "." + name); + // System.out.println(getClass().getSimpleName() + "." + name); super.test(name, args); this.argsToBind = args; super.test(name, args); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_invokespecial.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_invokespecial.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_invokespecial.java Wed Jan 23 16:34:57 2013 +0100 @@ -35,8 +35,8 @@ return object.id(a); } - @SuppressWarnings("static-method") - private int id(int i) { + @SuppressWarnings("static-method") + private int id(int i) { return i; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_invokespecial2.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_invokespecial2.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_invokespecial2.java Wed Jan 23 16:34:57 2013 +0100 @@ -38,8 +38,8 @@ return 3 + object.id(a); } - @SuppressWarnings("static-method") - private int id(int i) { + @SuppressWarnings("static-method") + private int id(int i) { return 4 + i; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv2.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv2.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv2.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,6 +28,7 @@ /* */ public class BC_ldiv2 extends JTTTest { + public static long MIN = Long.MIN_VALUE; public static long MAX = Long.MAX_VALUE; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv3.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv3.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv3.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,6 +28,7 @@ /* */ public class BC_ldiv3 extends JTTTest { + public static long PLUS7 = 7; public static long PLUS3 = 3; public static long MIN7 = -7; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_scope02.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_scope02.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_scope02.java Wed Jan 23 16:34:57 2013 +0100 @@ -36,7 +36,8 @@ // by the guard bail-out. for (int i = 0; i < count; i++) { if (i > 20) { - break; // We need to write back either the original value of sum, or the previous iteration's value. + break; // We need to write back either the original value of sum, or the previous + // iteration's value. } sum = i; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_series.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_series.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_series.java Wed Jan 23 16:34:57 2013 +0100 @@ -98,12 +98,13 @@ return (0.0); } - /* This test is sensible to the implementation of Math.pow, cos and sin. - * Since for these functions, the specs says "The computed result must be within 1 ulp of the exact result", - * different implementation may return different results. - * The 11 ulp delta allowed for test(100) tries to account for that but is not guaranteed to work forever. + /* + * This test is sensible to the implementation of Math.pow, cos and sin. Since for these + * functions, the specs says "The computed result must be within 1 ulp of the exact result", + * different implementation may return different results. The 11 ulp delta allowed for test(100) + * tries to account for that but is not guaranteed to work forever. */ - //@Test + // @Test public void run0() throws Throwable { double expected = 0.6248571921291398d; runTestWithDelta(11 * Math.ulp(expected), "test", 100); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6196102.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6196102.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6196102.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,7 +29,7 @@ * @test * @bug 6196102 * @summary Integer seems to be greater than Integer.MAX_VALUE - * + * * @run main Test6196102 */ // @formatter:off diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6753639.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6753639.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6753639.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,7 +29,7 @@ * @test * @bug 6753639 * @summary Strange optimisation in for loop with cyclic integer condition - * + * * @run main/othervm -Xbatch Test6753639 */ // @formatter:off diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/IntegerBits.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/IntegerBits.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/IntegerBits.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,10 +25,9 @@ import com.oracle.graal.jtt.*; import org.junit.*; +public class IntegerBits extends JTTTest { -public class IntegerBits extends JTTTest { - @SuppressWarnings("unused") - private static int init = Integer.reverseBytes(42); + @SuppressWarnings("unused") private static int init = Integer.reverseBytes(42); private static int original = 0x01020304; private static int v = 0b1000; private static int zero = 0; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/LongBits.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/LongBits.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/LongBits.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,10 +25,9 @@ import com.oracle.graal.jtt.*; import org.junit.*; +public class LongBits extends JTTTest { -public class LongBits extends JTTTest { - @SuppressWarnings("unused") - private static long init = Long.reverseBytes(42); + @SuppressWarnings("unused") private static long init = Long.reverseBytes(42); private static long original = 0x0102030405060708L; private static long v = 0b1000L; private static long v2 = 0x0100000000L; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/UnsafeAccess01.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/UnsafeAccess01.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/UnsafeAccess01.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,8 +33,7 @@ */ public class UnsafeAccess01 extends JTTTest { - @SuppressWarnings("unused") - private int field = 42; + @SuppressWarnings("unused") private int field = 42; public static int test() throws SecurityException, NoSuchFieldException { final Unsafe unsafe = getUnsafe(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/Unsafe_compareAndSwap.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/Unsafe_compareAndSwap.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/Unsafe_compareAndSwap.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,12 +29,15 @@ import sun.misc.*; public class Unsafe_compareAndSwap extends JTTTest { + static final Unsafe unsafe = UnsafeAccess01.getUnsafe(); static final long valueOffset; static { try { valueOffset = unsafe.objectFieldOffset(Unsafe_compareAndSwap.class.getDeclaredField("value")); - } catch (Exception ex) { throw new Error(ex); } + } catch (Exception ex) { + throw new Error(ex); + } } public static String test(Unsafe_compareAndSwap u, Object o, String expected, String newValue) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getInterfaces01.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getInterfaces01.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getInterfaces01.java Wed Jan 23 16:34:57 2013 +0100 @@ -47,11 +47,11 @@ } } - private static String toString(Class< ? > klass) { - final Class< ? >[] classes = klass.getInterfaces(); + private static String toString(Class klass) { + final Class[] classes = klass.getInterfaces(); final StringBuilder sb = new StringBuilder(); boolean first = true; - for (Class< ? > c : classes) { + for (Class c : classes) { if (!first) { sb.append(' '); } else { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getModifiers01.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getModifiers01.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getModifiers01.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,11 +29,14 @@ public final class Class_getModifiers01 extends JTTTest { - private static class PrivateStatic {} + private static class PrivateStatic { + } - private static final class PrivateStaticFinal {} + private static final class PrivateStaticFinal { + } - private static class Private {} + private static class Private { + } public static int test(Class c) { return c.getModifiers(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/Loop16.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/Loop16.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/Loop16.java Wed Jan 23 16:34:57 2013 +0100 @@ -40,7 +40,7 @@ } public int run(int count) { - l1: for (int i = 0; i <= count; i++) { + l1: for (int i = 0; i <= count; i++) { if (i > 5) { for (int j = 0; j < i; j++) { a += i; @@ -51,7 +51,7 @@ } else if (i > 7) { b += i; } else { - c += i; + c += i; } } return a + b + c; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/Loop17.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/Loop17.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/Loop17.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,9 +32,11 @@ public class Loop17 extends JTTTest { private static class L { + public int a; public int b; public int c; + public L(int a, int b, int c) { this.a = a; this.b = b; @@ -42,12 +44,11 @@ } } - public static int test(int count) { int i = 0; L l; do { - l = new L(i, i+1, i+2); + l = new L(i, i + 1, i + 2); } while (++i < count); return l.a + l.b * 10 + l.c * 100; @@ -55,6 +56,6 @@ @Test public void run0() throws Throwable { - runTest("test", new L(4,4,4).a); + runTest("test", new L(4, 4, 4).a); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopEscape.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopEscape.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopEscape.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,12 +30,15 @@ * Test around an object that escapes directly from inside a loop (no virtual phi on the loop) */ public class LoopEscape extends JTTTest { + public static L ll = new L(0, 1, 2); private static class L { + public int a; public int b; public int c; + public L(int a, int b, int c) { this.a = a; this.b = b; @@ -43,7 +46,6 @@ } } - public static int test0(int count) { L l = new L(5, 5, 5); for (int i = 0; i < count; i++) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopLastIndexOf.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopLastIndexOf.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopLastIndexOf.java Wed Jan 23 16:34:57 2013 +0100 @@ -95,7 +95,8 @@ runTest("test", v1, 1, v1.length - 1, v3, 0, v3.length, 10); } - @Test//(expected = ArrayIndexOutOfBoundsException.class) + @Test + // (expected = ArrayIndexOutOfBoundsException.class) public void run4() throws Throwable { runTest("test", v1, 1, v1.length, v3, 0, v3.length, 10); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/FloatingReads.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/FloatingReads.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/FloatingReads.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,8 +24,8 @@ import com.oracle.graal.jtt.*; +public class FloatingReads extends JTTTest { -public class FloatingReads extends JTTTest { public static long init = Runtime.getRuntime().totalMemory(); private final int f = 10; private int a; @@ -61,22 +61,22 @@ return a + b + c; } - //@Test + // @Test public void run0() { runTest("test", 10); } - //@Test + // @Test public void run1() { runTest("test", 1000); } - //@Test + // @Test public void run2() { runTest("test", 1); } - //@Test + // @Test public void run3() { runTest("test", 0); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Conditional01.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Conditional01.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Conditional01.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,6 +31,7 @@ */ @SuppressWarnings("unused") public class Conditional01 extends JTTTest { + private static final int RAM_SIZE = 0x100; private static final int init = new Random().nextInt(); private static final int init1 = new Register().val; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Fold_Convert02.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Fold_Convert02.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Fold_Convert02.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,6 +29,7 @@ * Tests constant folding of integer operations. */ public class Fold_Convert02 extends JTTTest { + public static long test(long arg) { if (arg == 0) { return i2l(); @@ -39,20 +40,24 @@ if (arg == 2) { return d2l(); } - return 0; + return 0; } + public static long i2l() { int x = 0x80000000; return x; } + public static long f2l() { float x = -33.1f; return (long) x; } + public static long d2l() { double x = -78.1d; return (long) x; } + @Test public void run0() throws Throwable { runTest("test", 0L); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/ReassociateConstants.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/ReassociateConstants.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/ReassociateConstants.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,9 +24,10 @@ import org.junit.*; +public class ReassociateConstants { -public class ReassociateConstants { public static int rnd = (int) (Math.random() * 100); + @Test public void run0() throws Throwable { Assert.assertEquals(rnd + 3, 1 + (rnd + 2)); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance02.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance02.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance02.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,7 +32,7 @@ public class Array_newInstance02 extends JTTTest { public static boolean test(int i) { - Class< ? > javaClass; + Class javaClass; if (i == 2) { javaClass = void.class; } else if (i == 3) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance03.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance03.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance03.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,7 +32,7 @@ public class Array_newInstance03 extends JTTTest { public static boolean test(int i) { - Class< ? > javaClass; + Class javaClass; if (i == 2) { javaClass = int.class; } else if (i == 3) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance05.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance05.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance05.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,7 +33,7 @@ public static boolean test(int i, int j) { final int[] dims = {i, j}; - Class< ? > javaClass; + Class javaClass; if (i == 2) { javaClass = void.class; } else if (i == 3) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance06.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance06.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance06.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,7 +33,7 @@ public static boolean test(int i) { final int[] dims = {i, 3}; - Class< ? > javaClass; + Class javaClass; if (i == 2) { javaClass = int.class; } else if (i == 3) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BitManipulationOp.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BitManipulationOp.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BitManipulationOp.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,10 +28,9 @@ import com.oracle.graal.lir.asm.*; public class AMD64BitManipulationOp extends AMD64LIRInstruction { - public enum IntrinsicOpcode { - IPOPCNT, LPOPCNT, - IBSR, LBSR, - BSF; + + public enum IntrinsicOpcode { + IPOPCNT, LPOPCNT, IBSR, LBSR, BSF; } @Opcode private final IntrinsicOpcode opcode; @@ -49,7 +48,7 @@ Register dst = ValueUtil.asIntReg(result); if (ValueUtil.isAddress(input)) { Address src = ValueUtil.asAddress(input); - switch(opcode) { + switch (opcode) { case IPOPCNT: masm.popcntl(dst, src); break; @@ -68,7 +67,7 @@ } } else { Register src = ValueUtil.asRegister(input); - switch(opcode) { + switch (opcode) { case IPOPCNT: masm.popcntl(dst, src); break; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ByteSwapOp.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ByteSwapOp.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ByteSwapOp.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,6 +30,7 @@ @Opcode("BSWAP") public class AMD64ByteSwapOp extends AMD64LIRInstruction { + @Def({OperandFlag.REG, OperandFlag.HINT}) protected Value result; @Use protected Value input; @@ -41,7 +42,7 @@ @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { AMD64Move.move(tasm, masm, result, input); - switch(input.getKind()) { + switch (input.getKind()) { case Int: masm.bswapl(ValueUtil.asIntReg(result)); break; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java Wed Jan 23 16:34:57 2013 +0100 @@ -39,6 +39,7 @@ @Opcode("CALL_DIRECT") public static class DirectCallOp extends AMD64LIRInstruction implements StandardOp.CallOp { + @Def({REG, ILLEGAL}) protected Value result; @Use({REG, STACK}) protected Value[] parameters; @Temp protected Value[] temps; @@ -71,6 +72,7 @@ @Opcode("CALL_INDIRECT") public static class IndirectCallOp extends AMD64LIRInstruction implements StandardOp.CallOp { + @Def({REG, ILLEGAL}) protected Value result; @Use({REG, STACK}) protected Value[] parameters; @Use({REG}) protected Value targetAddress; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Code.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Code.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Code.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,6 +30,7 @@ * Convenience class to provide AMD64MacroAssembler for the {@link #emitCode} method. */ public abstract class AMD64Code implements LIR.Code { + @Override public final void emitCode(TargetMethodAssembler tasm) { emitCode(tasm, (AMD64MacroAssembler) tasm.asm); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64LIRInstruction.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64LIRInstruction.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64LIRInstruction.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,6 +30,7 @@ * Convenience class to provide AMD64MacroAssembler for the {@link #emitCode} method. */ public abstract class AMD64LIRInstruction extends LIRInstruction { + @Override public final void emitCode(TargetMethodAssembler tasm) { emitCode(tasm, (AMD64MacroAssembler) tasm.asm); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java Wed Jan 23 16:34:57 2013 +0100 @@ -47,13 +47,12 @@ /** * Checks whether a block can be deleted. Only blocks with exactly one successor and an * unconditional branch to this successor are eligable. + * * @param block the block checked for deletion * @return whether the block can be deleted */ private static boolean canDeleteBlock(LIR ir, Block block) { - if (block.getSuccessorCount() != 1 || - block.getPredecessorCount() == 0 || - block.getFirstSuccessor() == block) { + if (block.getSuccessorCount() != 1 || block.getPredecessorCount() == 0 || block.getFirstSuccessor() == block) { return false; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,23 +29,21 @@ /** * This class optimizes moves, particularly those that result from eliminating SSA form. - * - * When a block has more than one predecessor, and all predecessors end with - * the {@linkplain #same(LIRInstruction, LIRInstruction) same} sequence of - * {@linkplain MoveOp move} instructions, then these sequences - * can be replaced with a single copy of the sequence at the beginning of the block. - * - * Similarly, when a block has more than one successor, then same sequences of - * moves at the beginning of the successors can be placed once at the end of - * the block. But because the moves must be inserted before all branch - * instructions, this works only when there is exactly one conditional branch - * at the end of the block (because the moves must be inserted before all + * + * When a block has more than one predecessor, and all predecessors end with the + * {@linkplain #same(LIRInstruction, LIRInstruction) same} sequence of {@linkplain MoveOp move} + * instructions, then these sequences can be replaced with a single copy of the sequence at the + * beginning of the block. + * + * Similarly, when a block has more than one successor, then same sequences of moves at the + * beginning of the successors can be placed once at the end of the block. But because the moves + * must be inserted before all branch instructions, this works only when there is exactly one + * conditional branch at the end of the block (because the moves must be inserted before all * branches, but after all compares). - * - * This optimization affects all kind of moves (reg->reg, reg->stack and - * stack->reg). 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. + * + * This optimization affects all kind of moves (reg->reg, reg->stack and stack->reg). 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 { @@ -78,9 +76,10 @@ } /** - * Determines if two operations are both {@linkplain MoveOp moves} - * that have the same {@linkplain MoveOp#getInput() source} and {@linkplain MoveOp#getResult() destination} operands. - * + * Determines if two operations are both {@linkplain MoveOp moves} that have the same + * {@linkplain MoveOp#getInput() source} and {@linkplain MoveOp#getResult() destination} + * operands. + * * @param op1 the first instruction to compare * @param op2 the second instruction to compare * @return {@code true} if {@code op1} and {@code op2} are the same by the above algorithm @@ -101,8 +100,8 @@ } /** - * Moves the longest {@linkplain #same common} subsequence at the end all - * predecessors of {@code block} to the start of {@code block}. + * Moves the longest {@linkplain #same common} subsequence at the end all predecessors of + * {@code block} to the start of {@code block}. */ private void optimizeMovesAtBlockEnd(Block block) { for (Block pred : block.getPredecessors()) { @@ -170,9 +169,9 @@ } /** - * Moves the longest {@linkplain #same common} subsequence at the start of all - * successors of {@code block} to the end of {@code block} just prior to the - * branch instruction ending {@code block}. + * Moves the longest {@linkplain #same common} subsequence at the start of all successors of + * {@code block} to the end of {@code block} just prior to the branch instruction ending + * {@code block}. */ private void optimizeMovesAtBlockBegin(Block block) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,18 +31,18 @@ import com.oracle.graal.asm.*; /** - * This class is used to build the stack frame layout for a compiled method. - * A {@link StackSlot} is used to index slots of the frame relative to the stack pointer. - * The frame size is only fixed after register allocation when all spill slots have - * been allocated. Both the outgoing argument area and the spill are can grow until then. - * Therefore, outgoing arguments are indexed from the stack pointer, while spill slots - * are indexed from the beginning of the frame (and the total frame size has to be added - * to get the actual offset from the stack pointer). + * This class is used to build the stack frame layout for a compiled method. A {@link StackSlot} is + * used to index slots of the frame relative to the stack pointer. The frame size is only fixed + * after register allocation when all spill slots have been allocated. Both the outgoing argument + * area and the spill are can grow until then. Therefore, outgoing arguments are indexed from the + * stack pointer, while spill slots are indexed from the beginning of the frame (and the total frame + * size has to be added to get the actual offset from the stack pointer). *

    * This is the format of a stack frame: + * *

      *   Base       Contents
    - *
    + * 
      *            :                                :  -----
      *   caller   | incoming overflow argument n   |    ^
      *   frame    :     ...                        :    | positive
    @@ -64,34 +64,39 @@
      *            :     ...                        :    | positive   |      |
      *            | outgoing overflow argument 0   |    | offsets    v      v
      *    %sp-->  +--------------------------------+---------------------------
    - *
    + * 
      * 
    - * The spill slot area also includes stack allocated memory blocks (ALLOCA blocks). The size - * of such a block may be greater than the size of a normal spill slot or the word size. + * + * The spill slot area also includes stack allocated memory blocks (ALLOCA blocks). The size of such + * a block may be greater than the size of a normal spill slot or the word size. *

    - * A runtime has two ways to reserve space in the stack frame for its own use:

      - *
    • A memory block somewhere in the frame of size {@link CodeCacheProvider#getCustomStackAreaSize()}. The offset - * to this block is returned in {@link CompilationResult#getCustomStackAreaOffset()}. - *
    • At the beginning of the overflow argument area: The calling convention can specify that the first - * overflow stack argument is not at offset 0, but at a specified offset o. Use - * {@link CodeCacheProvider#getMinimumOutgoingSize()} to make sure that call-free methods also have this space - * reserved. Then the VM can use memory the memory at offset 0 relative to the stack pointer. + * A runtime has two ways to reserve space in the stack frame for its own use: + *
        + *
      • A memory block somewhere in the frame of size + * {@link CodeCacheProvider#getCustomStackAreaSize()}. The offset to this block is returned in + * {@link CompilationResult#getCustomStackAreaOffset()}. + *
      • At the beginning of the overflow argument area: The calling convention can specify that the + * first overflow stack argument is not at offset 0, but at a specified offset o. Use + * {@link CodeCacheProvider#getMinimumOutgoingSize()} to make sure that call-free methods also have + * this space reserved. Then the VM can use memory the memory at offset 0 relative to the stack + * pointer. *
      */ public final class FrameMap { + public final CodeCacheProvider runtime; public final TargetDescription target; public final RegisterConfig registerConfig; /** - * The initial frame size, not including the size of the return address. - * This is the constant space reserved by the runtime for all compiled methods. + * The initial frame size, not including the size of the return address. This is the constant + * space reserved by the runtime for all compiled methods. */ public final int initialFrameSize; /** - * The final frame size, not including the size of the return address. - * The value is only set after register allocation is complete, i.e., after all spill slots have been allocated. + * The final frame size, not including the size of the return address. The value is only set + * after register allocation is complete, i.e., after all spill slots have been allocated. */ private int frameSize; @@ -101,8 +106,8 @@ private int spillSize; /** - * Size of the area occupied by outgoing overflow arguments. - * This value is adjusted as calling conventions for outgoing calls are retrieved. + * Size of the area occupied by outgoing overflow arguments. This value is adjusted as calling + * conventions for outgoing calls are retrieved. */ private int outgoingSize; @@ -112,12 +117,14 @@ private final List objectStackBlocks; /** - * The stack area reserved for use by the VM, or {@code null} if the VM does not request stack space. + * The stack area reserved for use by the VM, or {@code null} if the VM does not request stack + * space. */ private final StackSlot customArea; /** - * Records whether an offset to an incoming stack argument was ever returned by {@link #offsetForStackSlot(StackSlot)}. + * Records whether an offset to an incoming stack argument was ever returned by + * {@link #offsetForStackSlot(StackSlot)}. */ private boolean accessesCallerFrame; @@ -146,7 +153,8 @@ } /** - * Determines if an offset to an incoming stack argument was ever returned by {@link #offsetForStackSlot(StackSlot)}. + * Determines if an offset to an incoming stack argument was ever returned by + * {@link #offsetForStackSlot(StackSlot)}. */ public boolean accessesCallerFrame() { return accessesCallerFrame; @@ -154,6 +162,7 @@ /** * Gets the frame size of the compiled frame, not including the size of the return address. + * * @return The size of the frame (in bytes). */ public int frameSize() { @@ -163,6 +172,7 @@ /** * Gets the total frame size of the compiled frame, including the size of the return address. + * * @return The total size of the frame (in bytes). */ public int totalFrameSize() { @@ -178,8 +188,9 @@ } /** - * Computes the final size of this frame. After this method has been called, methods that change the - * frame size cannot be called anymore, e.g., no more spill slots or outgoing arguments can be requested. + * Computes the final size of this frame. After this method has been called, methods that change + * the frame size cannot be called anymore, e.g., no more spill slots or outgoing arguments can + * be requested. */ public void finish() { assert this.frameSize == -1 : "must only be set once"; @@ -187,16 +198,15 @@ } /** - * Computes the offset of a stack slot relative to the frame register. - * This is also the bit index of stack slots in the reference map. - * + * Computes the offset of a stack slot relative to the frame register. This is also the bit + * index of stack slots in the reference map. + * * @param slot a stack slot * @return the offset of the stack slot */ public int offsetForStackSlot(StackSlot slot) { - assert (!slot.getRawAddFrameSize() && slot.getRawOffset() < outgoingSize) || - (slot.getRawAddFrameSize() && slot.getRawOffset() < 0 && -slot.getRawOffset() <= spillSize) || - (slot.getRawAddFrameSize() && slot.getRawOffset() >= 0); + assert (!slot.getRawAddFrameSize() && slot.getRawOffset() < outgoingSize) || (slot.getRawAddFrameSize() && slot.getRawOffset() < 0 && -slot.getRawOffset() <= spillSize) || + (slot.getRawAddFrameSize() && slot.getRawOffset() >= 0); if (slot.isInCallerFrame()) { accessesCallerFrame = true; } @@ -205,6 +215,7 @@ /** * Gets the offset to the stack area where callee-saved registers are stored. + * * @return The offset to the callee save area (in bytes). */ public int offsetToCalleeSaveArea() { @@ -212,7 +223,9 @@ } /** - * Gets the offset of the stack area stack block reserved for use by the VM, or -1 if the VM does not request stack space. + * Gets the offset of the stack area stack block reserved for use by the VM, or -1 if the VM + * does not request stack space. + * * @return The offset to the custom area (in bytes). */ public int offsetToCustomArea() { @@ -220,8 +233,9 @@ } /** - * Informs the frame map that the compiled code calls a particular method, which - * may need stack space for outgoing arguments. + * Informs the frame map that the compiled code calls a particular method, which may need stack + * space for outgoing arguments. + * * @param cc The calling convention for the called method. */ public void callsMethod(CallingConvention cc) { @@ -230,6 +244,7 @@ /** * Reserves space for stack-based outgoing arguments. + * * @param argsSize The amount of space (in bytes) to reserve for stack-based outgoing arguments. */ public void reserveOutgoing(int argsSize) { @@ -242,8 +257,9 @@ } /** - * Reserves a spill slot in the frame of the method being compiled. The returned slot is aligned on its natural alignment, - * i.e., an 8-byte spill slot is aligned at an 8-byte boundary. + * Reserves a spill slot in the frame of the method being compiled. The returned slot is aligned + * on its natural alignment, i.e., an 8-byte spill slot is aligned at an 8-byte boundary. + * * @param kind The kind of the spill slot to be reserved. * @return A spill slot denoting the reserved memory area. */ @@ -255,12 +271,13 @@ } /** - * Reserves a block of memory in the frame of the method being compiled. The returned block is aligned on a word boundary. - * If the requested size is 0, the method returns {@code null}. - * + * Reserves a block of memory in the frame of the method being compiled. The returned block is + * aligned on a word boundary. If the requested size is 0, the method returns {@code null}. + * * @param size The size to reserve (in bytes). - * @param refs Specifies if the block is all references. If true, the block will be in all reference maps for this method. - * The caller is responsible to initialize the memory block before the first instruction that uses a reference map. + * @param refs Specifies if the block is all references. If true, the block will be in all + * reference maps for this method. The caller is responsible to initialize the memory + * block before the first instruction that uses a reference map. * @return A stack slot describing the begin of the memory block. */ public StackSlot allocateStackBlock(int size, boolean refs) { @@ -284,7 +301,6 @@ } } - private int frameRefMapIndex(StackSlot slot) { assert offsetForStackSlot(slot) % target.wordSize == 0; return offsetForStackSlot(slot) / target.wordSize; @@ -298,9 +314,9 @@ } /** - * Initializes a reference map. Initially, the size is large enough to cover all the - * slots in the frame. If the method has incoming reference arguments on the stack, - * the reference map might grow later when such a reference is set. + * Initializes a reference map. Initially, the size is large enough to cover all the slots in + * the frame. If the method has incoming reference arguments on the stack, the reference map + * might grow later when such a reference is set. */ public BitSet initFrameRefMap() { BitSet frameRefMap = new BitSet(frameSize() / target.wordSize); @@ -314,7 +330,7 @@ * Marks the specified location as a reference in the reference map of the debug information. * The tracked location can be a {@link RegisterValue} or a {@link StackSlot}. Note that a * {@link Constant} is automatically tracked. - * + * * @param location The location to be added to the reference map. * @param registerRefMap A register reference map, as created by {@link #initRegisterRefMap()}. * @param frameRefMap A frame reference map, as created by {@link #initFrameRefMap()}. @@ -336,7 +352,7 @@ * Clears the specified location as a reference in the reference map of the debug information. * The tracked location can be a {@link RegisterValue} or a {@link StackSlot}. Note that a * {@link Constant} is automatically tracked. - * + * * @param location The location to be removed from the reference map. * @param registerRefMap A register reference map, as created by {@link #initRegisterRefMap()}. * @param frameRefMap A frame reference map, as created by {@link #initFrameRefMap()}. diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,16 +32,16 @@ import com.oracle.graal.nodes.cfg.*; /** - * This class implements the overall container for the LIR graph - * and directs its construction, optimization, and finalization. + * This class implements the overall container for the LIR graph and directs its construction, + * optimization, and finalization. */ public class LIR { public final ControlFlowGraph cfg; /** - * The nodes for the blocks. - * TODO: This should go away, we want all nodes connected with a next-pointer. + * The nodes for the blocks. TODO: This should go away, we want all nodes connected with a + * next-pointer. */ private final BlockMap> blockToNodesMap; @@ -56,8 +56,8 @@ private final List codeEmittingOrder; /** - * Various out-of-line stubs to be emitted near the end of the method - * after all other LIR code has been emitted. + * Various out-of-line stubs to be emitted near the end of the method after all other LIR code + * has been emitted. */ public final List stubs; @@ -68,7 +68,9 @@ public final BlockMap> lirInstructions; public interface SpillMoveFactory { + LIRInstruction createMove(Value result, Value input); + LIRInstruction createExchange(Value input1, Value input2); } @@ -78,7 +80,9 @@ * An opaque chunk of machine code. */ public interface Code { + void emitCode(TargetMethodAssembler tasm); + /** * A description of this code stub useful for commenting the code in a disassembly. */ @@ -130,6 +134,7 @@ /** * Gets the linear scan ordering of blocks as a list. + * * @return the blocks in linear scan order */ public List linearScanOrder() { @@ -203,8 +208,8 @@ } /** - * Determines if any of the parameters to the method are passed via the stack - * where the parameters are located in the caller's frame. + * Determines if any of the parameters to the method are passed via the stack where the + * parameters are located in the caller's frame. */ public boolean hasArgInCallerFrame() { return hasArgInCallerFrame; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,9 +33,11 @@ import com.oracle.graal.lir.LIRInstruction.ValueProcedure; /** - * This class represents garbage collection and deoptimization information attached to a LIR instruction. + * This class represents garbage collection and deoptimization information attached to a LIR + * instruction. */ public class LIRFrameState { + public final BytecodeFrame topFrame; private final VirtualObject[] virtualObjects; private final List pointerSlots; @@ -60,7 +62,7 @@ /** * Iterates the frame state and calls the {@link ValueProcedure} for every variable. - * + * * @param proc The procedure called for variables. */ public void forEachState(ValueProcedure proc) { @@ -75,7 +77,8 @@ } /** - * We filter out constant and illegal values ourself before calling the procedure, so {@link OperandFlag#CONST} and {@link OperandFlag#ILLEGAL} need not be set. + * We filter out constant and illegal values ourself before calling the procedure, so + * {@link OperandFlag#CONST} and {@link OperandFlag#ILLEGAL} need not be set. */ private static final EnumSet STATE_FLAGS = EnumSet.of(OperandFlag.REG, OperandFlag.STACK); @@ -109,7 +112,6 @@ } } - public void finish(BitSet registerRefMap, BitSet frameRefMap, FrameMap frameMap) { debugInfo = new DebugInfo(topFrame, registerRefMap, frameRefMap); @@ -121,7 +123,6 @@ } } - @Override public String toString() { return debugInfo != null ? debugInfo.toString() : topFrame.toString(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInsertionBuffer.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInsertionBuffer.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInsertionBuffer.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,13 +25,14 @@ import java.util.*; /** - * A buffer to enqueue updates to a list. This avoids frequent re-sizing of the list and copying of list elements - * when insertions are done at multiple positions of the list. Additionally, it ensures that the list is not modified - * while it is, e.g., iterated, and instead only modified once after the iteration is done. + * A buffer to enqueue updates to a list. This avoids frequent re-sizing of the list and copying of + * list elements when insertions are done at multiple positions of the list. Additionally, it + * ensures that the list is not modified while it is, e.g., iterated, and instead only modified once + * after the iteration is done. *

      - * The buffer uses internal data structures to store the enqueued updates. To avoid allocations, a buffer can be re-used. - * Call the methods in the following order: - * {@link #init}, {@link #append}, {@link #append}, ..., {@link #finish()}, {@link #init}, ... + * The buffer uses internal data structures to store the enqueued updates. To avoid allocations, a + * buffer can be re-used. Call the methods in the following order: {@link #init}, {@link #append}, + * {@link #append}, ..., {@link #finish()}, {@link #init}, ... *

      * Note: This class does not depend on LIRInstruction, so we could make it a generic utility class. */ @@ -43,9 +44,9 @@ private List lir; /** - * List of insertion points. index and count are stored alternately: - * indexAndCount[i * 2]: the index into lir list where "count" ops should be inserted - * indexAndCount[i * 2 + 1]: the number of ops to be inserted at index + * List of insertion points. index and count are stored alternately: indexAndCount[i * 2]: the + * index into lir list where "count" ops should be inserted indexAndCount[i * 2 + 1]: the number + * of ops to be inserted at index */ private final List indexAndCount; @@ -54,7 +55,6 @@ */ private final List ops; - public LIRInsertionBuffer() { indexAndCount = new ArrayList<>(8); ops = new ArrayList<>(8); @@ -78,10 +78,11 @@ } /** - * Enqueue a new instruction that will be appended to the instruction list when {@link #finish()} is called. - * The new instruction is added before the existing instruction with the given index. This method can only be called - * with increasing values of index, e.g., once an instruction was appended with index 4, subsequent instructions can - * only be appended with index 4 or higher. + * Enqueue a new instruction that will be appended to the instruction list when + * {@link #finish()} is called. The new instruction is added before the existing + * instruction with the given index. This method can only be called with increasing values of + * index, e.g., once an instruction was appended with index 4, subsequent instructions can only + * be appended with index 4 or higher. */ public void append(int index, LIRInstruction op) { int i = numberOfInsertionPoints() - 1; @@ -98,7 +99,8 @@ } /** - * Append all enqueued instructions to the instruction list. After that, {@link #init(List)} can be called again to re-use this buffer. + * Append all enqueued instructions to the instruction list. After that, {@link #init(List)} can + * be called again to re-use this buffer. */ public void finish() { if (ops.size() > 0) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java Wed Jan 23 16:34:57 2013 +0100 @@ -41,14 +41,16 @@ public static final Value[] NO_OPERANDS = {}; /** - * Iterator for iterating over a list of values. Subclasses must overwrite one of the doValue methods. - * Clients of the class must only call the doValue method that takes additional parameters. + * Iterator for iterating over a list of values. Subclasses must overwrite one of the doValue + * methods. Clients of the class must only call the doValue method that takes additional + * parameters. */ public abstract static class ValueProcedure { + /** - * Iterator method to be overwritten. This version of the iterator does not take additional parameters - * to keep the signature short. - * + * Iterator method to be overwritten. This version of the iterator does not take additional + * parameters to keep the signature short. + * * @param value The value that is iterated. * @return The new value to replace the value that was passed in. */ @@ -57,9 +59,9 @@ } /** - * Iterator method to be overwritten. This version of the iterator gets additional parameters about the - * processed value. - * + * Iterator method to be overwritten. This version of the iterator gets additional + * parameters about the processed value. + * * @param value The value that is iterated. * @param mode The operand mode for the value. * @param flags A set of flags for the value. @@ -70,40 +72,41 @@ } } + public abstract static class StateProcedure { - public abstract static class StateProcedure { protected abstract void doState(LIRFrameState state); } - /** * Constants denoting how a LIR instruction uses an operand. */ 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 assigned to it can also be assigend - * to a Temp or Output operand. The value can be used again after the instruction, so the instruction must not - * modify the register. + * 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 + * assigned to it can also be assigend to a Temp or Output operand. The value can be used + * again after the instruction, so the instruction must not modify the register. */ USE, /** - * The value must have been defined before. It is alive before the instruction and throughout the instruction. A - * register assigned to it cannot be assigned to a Temp or Output operand. The value can be used again after the - * instruction, so the instruction must not modify the register. + * The value must have been defined before. It is alive before the instruction and + * throughout the instruction. A register assigned to it cannot be assigned to a Temp or + * Output operand. The value can be used again after the instruction, so the instruction + * must not modify the register. */ ALIVE, /** - * The value must not have been defined before, and must not be used after the instruction. The instruction can - * do whatever it wants with the register assigned to it (or not use it at all). + * The value must not have been defined before, and must not be used after the instruction. + * The instruction can do whatever it wants with the register assigned to it (or not use it + * at all). */ TEMP, /** - * The value must not have been defined before. The instruction has to assign a value to the register. The - * value can (and most likely will) be used after the instruction. + * The value must not have been defined before. The instruction has to assign a value to the + * register. The value can (and most likely will) be used after the instruction. */ DEF, } @@ -111,24 +114,28 @@ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public static @interface Use { + OperandFlag[] value() default REG; } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public static @interface Alive { + OperandFlag[] value() default REG; } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public static @interface Temp { + OperandFlag[] value() default REG; } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public static @interface Def { + OperandFlag[] value() default REG; } @@ -140,10 +147,10 @@ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.FIELD}) public static @interface Opcode { + String value() default ""; } - /** * Flags for an operand. */ @@ -180,13 +187,12 @@ HINT, /** - * The value can be uninitialized, e.g., a stack slot that has not written to before. This is only - * used to avoid false positives in verification code. + * The value can be uninitialized, e.g., a stack slot that has not written to before. This + * is only used to avoid false positives in verification code. */ UNINITIALIZED, } - /** * For validity checking of the operand flags defined by instruction subclasses. */ @@ -196,7 +202,7 @@ ALLOWED_FLAGS = new EnumMap<>(OperandMode.class); ALLOWED_FLAGS.put(USE, EnumSet.of(REG, STACK, ADDR, CONST, ILLEGAL, HINT, UNINITIALIZED)); ALLOWED_FLAGS.put(ALIVE, EnumSet.of(REG, STACK, ADDR, CONST, ILLEGAL, HINT, UNINITIALIZED)); - ALLOWED_FLAGS.put(TEMP, EnumSet.of(REG, CONST, ILLEGAL, HINT)); + ALLOWED_FLAGS.put(TEMP, EnumSet.of(REG, CONST, ILLEGAL, HINT)); ALLOWED_FLAGS.put(DEF, EnumSet.of(REG, STACK, ILLEGAL, HINT)); } @@ -222,7 +228,6 @@ public abstract void emitCode(TargetMethodAssembler tasm); - public final int id() { return id; } @@ -247,13 +252,13 @@ } /** - * Returns true when this instruction is a call instruction that destroys all caller-saved registers. + * Returns true when this instruction is a call instruction that destroys all caller-saved + * registers. */ public final boolean hasCall() { return this instanceof StandardOp.CallOp; } - public final void forEachInput(ValueProcedure proc) { instructionClass.forEachUse(this, proc); } @@ -279,27 +284,27 @@ } /** - * Iterates all register hints for the specified value, i.e., all preferred candidates for the register to be - * assigned to the value. + * Iterates all register hints for the specified value, i.e., all preferred candidates for the + * register to be assigned to the value. *

      - * 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. - * + * 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. + * @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. */ public Value forEachRegisterHint(Value value, OperandMode mode, ValueProcedure proc) { return instructionClass.forEachRegisterHint(this, mode, proc); } - protected void verify() { } - public final String toStringWithIdPrefix() { if (id != -1) { return String.format("%4d %s", id, toString()); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java Wed Jan 23 16:34:57 2013 +0100 @@ -21,6 +21,7 @@ * questions. */ package com.oracle.graal.lir; + import static com.oracle.graal.api.code.ValueUtil.*; import java.lang.annotation.*; @@ -55,7 +56,6 @@ } } - private static final Class INSTRUCTION_CLASS = LIRInstruction.class; private static final Class VALUE_CLASS = Value.class; private static final Class VALUE_ARRAY_CLASS = Value[].class; @@ -143,14 +143,15 @@ opcodeOffset = scanner.opcodeOffset; } + private static class OperandModeAnnotation { - private static class OperandModeAnnotation { public final ArrayList scalarOffsets = new ArrayList<>(); public final ArrayList arrayOffsets = new ArrayList<>(); public final Map> flags = new HashMap<>(); } protected static class FieldScanner extends BaseFieldScanner { + public final Map, OperandModeAnnotation> valueAnnotations; public final ArrayList stateOffsets = new ArrayList<>(); @@ -161,15 +162,15 @@ super(calc); valueAnnotations = new HashMap<>(); - valueAnnotations.put(LIRInstruction.Use.class, new OperandModeAnnotation()); //LIRInstruction.Use.class)); - valueAnnotations.put(LIRInstruction.Alive.class, new OperandModeAnnotation()); //LIRInstruction.Alive.class)); - valueAnnotations.put(LIRInstruction.Temp.class, new OperandModeAnnotation()); //LIRInstruction.Temp.class)); - valueAnnotations.put(LIRInstruction.Def.class, new OperandModeAnnotation()); //LIRInstruction.Def.class)); + valueAnnotations.put(LIRInstruction.Use.class, new OperandModeAnnotation()); // LIRInstruction.Use.class)); + valueAnnotations.put(LIRInstruction.Alive.class, new OperandModeAnnotation()); // LIRInstruction.Alive.class)); + valueAnnotations.put(LIRInstruction.Temp.class, new OperandModeAnnotation()); // LIRInstruction.Temp.class)); + valueAnnotations.put(LIRInstruction.Def.class, new OperandModeAnnotation()); // LIRInstruction.Def.class)); } private OperandModeAnnotation getOperandModeAnnotation(Field field) { OperandModeAnnotation result = null; - for (Entry, OperandModeAnnotation> entry : valueAnnotations.entrySet()) { + for (Entry, OperandModeAnnotation> entry : valueAnnotations.entrySet()) { Annotation annotation = field.getAnnotation(entry.getKey()); if (annotation != null) { assert result == null : "Field has two operand mode annotations: " + field; @@ -181,8 +182,10 @@ private static EnumSet getFlags(Field field) { EnumSet result = EnumSet.noneOf(OperandFlag.class); - // Unfortunately, annotations cannot have class hierarchies or implement interfaces, so we have to duplicate the code for every operand mode. - // Unfortunately, annotations cannot have an EnumSet property, so we have to convert from arrays to EnumSet manually. + // Unfortunately, annotations cannot have class hierarchies or implement interfaces, so + // we have to duplicate the code for every operand mode. + // Unfortunately, annotations cannot have an EnumSet property, so we have to convert + // from arrays to EnumSet manually. if (field.isAnnotationPresent(LIRInstruction.Use.class)) { result.addAll(Arrays.asList(field.getAnnotation(LIRInstruction.Use.class).value())); } else if (field.isAnnotationPresent(LIRInstruction.Alive.class)) { @@ -217,7 +220,8 @@ @Override protected void scanField(Field field, Class type, long offset) { if (VALUE_CLASS.isAssignableFrom(type)) { - assert Modifier.isProtected(field.getModifiers()) && !Modifier.isFinal(field.getModifiers()) : "Value field must not be declared final or [package] private because it is modified by register allocator: " + field; + assert Modifier.isProtected(field.getModifiers()) && !Modifier.isFinal(field.getModifiers()) : "Value field must not be declared final or [package] private because it is modified by register allocator: " + + field; OperandModeAnnotation annotation = getOperandModeAnnotation(field); assert annotation != null : "Field must have operand mode annotation: " + field; annotation.scalarOffsets.add(offset); @@ -275,7 +279,6 @@ return str.toString(); } - public final String getOpcode(LIRInstruction obj) { if (opcodeConstant != null) { return opcodeConstant; @@ -412,14 +415,13 @@ return (LIRFrameState) unsafe.getObject(obj, offset); } - public String toString(LIRInstruction obj) { StringBuilder result = new StringBuilder(); - appendValues(result, obj, "", " = ", "(", ")", new String[] {""}, defOffsets); + appendValues(result, obj, "", " = ", "(", ")", new String[]{""}, defOffsets); result.append(getOpcode(obj).toUpperCase()); - appendValues(result, obj, " ", "", "(", ")", new String[] {"", "~"}, useOffsets, aliveOffsets); - appendValues(result, obj, " ", "", "{", "}", new String[] {""}, tempOffsets); + appendValues(result, obj, " ", "", "(", ")", new String[]{"", "~"}, useOffsets, aliveOffsets); + appendValues(result, obj, " ", "", "{", "}", new String[]{""}, tempOffsets); for (int i = 0; i < dataOffsets.length; i++) { if (dataOffsets[i] == opcodeOffset) { @@ -444,7 +446,7 @@ return result.toString(); } - private void appendValues(StringBuilder result, LIRInstruction obj, String start, String end, String startMultiple, String endMultiple, String[] prefix, long[]...moffsets) { + private void appendValues(StringBuilder result, LIRInstruction obj, String start, String end, String startMultiple, String endMultiple, String[] prefix, long[]... moffsets) { int total = 0; for (long[] offsets : moffsets) { total += offsets.length; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRValueUtil.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRValueUtil.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRValueUtil.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,6 +25,7 @@ import com.oracle.graal.api.meta.*; public final class LIRValueUtil { + public static boolean isVariable(Value value) { assert value != null; return value instanceof Variable; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java Wed Jan 23 16:34:57 2013 +0100 @@ -35,6 +35,7 @@ import com.oracle.graal.nodes.cfg.*; public final class LIRVerifier { + private final LIR lir; private final FrameMap frameMap; @@ -46,6 +47,7 @@ private BitSet liveOutFor(Block block) { return blockLiveOut[block.getId()]; } + private void setLiveOutFor(Block block, BitSet liveOut) { blockLiveOut[block.getId()] = liveOut; } @@ -60,7 +62,9 @@ public static boolean verify(final LIRInstruction op) { ValueProcedure allowedProc = new ValueProcedure() { - @Override public Value doValue(Value value, OperandMode mode, EnumSet flags) { + + @Override + public Value doValue(Value value, OperandMode mode, EnumSet flags) { return allowed(op, value, mode, flags); } }; @@ -81,7 +85,6 @@ return true; } - private LIRVerifier(boolean beforeRegisterAllocation, LIR lir, FrameMap frameMap) { this.beforeRegisterAllocation = beforeRegisterAllocation; this.lir = lir; @@ -98,8 +101,20 @@ private BitSet curRegistersDefined; private void verify() { - ValueProcedure useProc = new ValueProcedure() { @Override public Value doValue(Value value, OperandMode mode, EnumSet flags) { return use(value, mode, flags); } }; - ValueProcedure defProc = new ValueProcedure() { @Override public Value doValue(Value value, OperandMode mode, EnumSet flags) { return def(value, mode, flags); } }; + ValueProcedure useProc = new ValueProcedure() { + + @Override + public Value doValue(Value value, OperandMode mode, EnumSet flags) { + return use(value, mode, flags); + } + }; + ValueProcedure defProc = new ValueProcedure() { + + @Override + public Value doValue(Value value, OperandMode mode, EnumSet flags) { + return def(value, mode, flags); + } + }; int maxRegisterNum = maxRegisterNum(); curRegistersDefined = new BitSet(); @@ -216,11 +231,8 @@ } private static Value allowed(Object op, Value value, OperandMode mode, EnumSet flags) { - if ((isVariable(value) && flags.contains(OperandFlag.REG)) || - (isRegister(value) && flags.contains(OperandFlag.REG)) || - (isStackSlot(value) && flags.contains(OperandFlag.STACK)) || - (isConstant(value) && flags.contains(OperandFlag.CONST) && mode != OperandMode.DEF) || - (isIllegal(value) && flags.contains(OperandFlag.ILLEGAL))) { + if ((isVariable(value) && flags.contains(OperandFlag.REG)) || (isRegister(value) && flags.contains(OperandFlag.REG)) || (isStackSlot(value) && flags.contains(OperandFlag.STACK)) || + (isConstant(value) && flags.contains(OperandFlag.CONST) && mode != OperandMode.DEF) || (isIllegal(value) && flags.contains(OperandFlag.ILLEGAL))) { return value; } TTY.println("instruction %s", op); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LabelRef.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LabelRef.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LabelRef.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,14 +27,14 @@ /** * LIR instructions such as JUMP and BRANCH need to reference their target {@link Block}. 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 only reference of block B from block A only via the tuple (A, successor-index-of-B), i.e., - * indirectly by storing the index into the successor list of A. - * Note that therefore it is not allowed to reorder the successor list! - * - * Labels of out-of-line stubs can be referenced directly, therefore it is also possible to construct a - * LabelRef for a Label directly via {@link #forLabel}. + * 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 only + * reference of block B from block A only via the tuple (A, successor-index-of-B), i.e., indirectly + * by storing the index into the successor list of A. Note that therefore it is not allowed to + * reorder the successor list! + * + * Labels of out-of-line stubs can be referenced directly, therefore it is also possible to + * construct a LabelRef for a Label directly via {@link #forLabel}. */ public abstract class LabelRef { @@ -42,34 +42,37 @@ /** * Returns a new reference to a statically defined label. + * * @param label The label that is always returned. * @return The newly created label reference. */ public static LabelRef forLabel(final Label label) { - return new LabelRef() { - @Override - public Label label() { - return label; - } + return new LabelRef() { - @Override - public String toString() { - return label.toString(); - } - }; + @Override + public Label label() { + return label; + } + + @Override + public String toString() { + return label.toString(); + } + }; } /** - * Returns a new reference to a successor of the given block. - * This allows to reference the given successor even when the successor list - * is modified between the creation of the reference and the call to {@link #forLabel(Label)}. - * + * Returns a new reference to a successor of the given block. This allows to reference the given + * successor even when the successor list is modified between the creation of the reference and + * the call to {@link #forLabel(Label)}. + * * @param block The base block that contains the successor list. * @param suxIndex The index of the successor. * @return The newly created label reference. */ public static LabelRef forSuccessor(final LIR lir, final Block block, final int suxIndex) { return new LabelRef() { + @Override public Label label() { return ((StandardOp.LabelOp) lir.lir(block.getSuccessors().get(suxIndex)).get(0)).getLabel(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,27 +28,31 @@ import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; /** - * A collection of machine-independent LIR operations, as well as interfaces to be implemented for specific kinds or LIR - * operations. + * A collection of machine-independent LIR operations, as well as interfaces to be implemented for + * specific kinds or LIR operations. */ public class StandardOp { private static Value[] EMPTY = new Value[0]; /** - * Marker interface for LIR ops that can fall through to the next operation, like a switch statement. - * setFallThroughTarget(null) can be used to make the operation fall through to the next one. + * Marker interface for LIR ops that can fall through to the next operation, like a switch + * statement. setFallThroughTarget(null) can be used to make the operation fall through to the + * next one. */ public interface FallThroughOp { + LabelRef fallThroughTarget(); + void setFallThroughTarget(LabelRef target); } /** - * LIR operation that defines the position of a label. - * The first operation of every block must implement this interface. + * LIR operation that defines the position of a label. The first operation of every block must + * implement this interface. */ public static class LabelOp extends LIRInstruction { + private final Label label; private final boolean align; @@ -71,13 +75,14 @@ } /** - * LIR operation that is an unconditional jump to {@link #destination()}. - * When the LIR is constructed, the last operation of every block must implement this interface. After - * register allocation, unnecessary jumps can be deleted. - * + * LIR operation that is an unconditional jump to {@link #destination()}. When the LIR is + * constructed, the last operation of every block must implement this interface. After register + * allocation, unnecessary jumps can be deleted. + * * TODO (cwimmer) Currently, a block can also end with an XIR operation. */ public static class JumpOp extends LIRInstruction { + private final LabelRef destination; @State protected LIRFrameState state; @@ -97,6 +102,7 @@ } public static class PhiJumpOp extends JumpOp { + @Alive({REG, STACK, CONST}) protected Value[] phiInputs; public PhiJumpOp(LabelRef destination, Value[] phiInputs) { @@ -118,31 +124,37 @@ * Conditional jumps may be negated or optimized away after register allocation. */ public interface BranchOp { + LabelRef destination(); + void negate(LabelRef newDestination); } /** - * Marker interface for a LIR operation that moves a value from {@link #getInput()} to {@link #getResult()}. + * Marker interface for a LIR operation that moves a value from {@link #getInput()} to + * {@link #getResult()}. */ public interface MoveOp { + Value getInput(); + Value getResult(); } /** - * Marker interface for a LIR operation that calls a method, i.e., destroys all caller-saved registers. + * Marker interface for a LIR operation that calls a method, i.e., destroys all caller-saved + * registers. */ public interface CallOp { } - /** - * Meta-operation that defines the incoming method parameters. In the LIR, every register and variable must be - * defined before it is used. This operation is the definition point of method parameters, but is otherwise a no-op. - * In particular, it is not the actual method prologue. + * Meta-operation that defines the incoming method parameters. In the LIR, every register and + * variable must be defined before it is used. This operation is the definition point of method + * parameters, but is otherwise a no-op. In particular, it is not the actual method prologue. */ public static final class ParametersOp extends LIRInstruction { + @Def({REG, STACK}) protected Value[] params; public ParametersOp(Value[] params) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,10 +26,11 @@ import com.oracle.graal.api.meta.*; /** - * Represents a value that is yet to be bound to a machine location (such as - * a {@link RegisterValue} or {@link StackSlot}) by a register allocator. + * Represents a value that is yet to be bound to a machine location (such as a {@link RegisterValue} + * or {@link StackSlot}) by a register allocator. */ public final class Variable extends Value { + private static final long serialVersionUID = 4507578431686109809L; /** @@ -44,6 +45,7 @@ /** * Creates a new variable. + * * @param kind * @param index */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/FrameContext.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/FrameContext.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/FrameContext.java Wed Jan 23 16:34:57 2013 +0100 @@ -22,11 +22,11 @@ */ package com.oracle.graal.lir.asm; - /** * Code for managing a method's native frame. */ public interface FrameContext { + /** * Emits code common to all entry points of a method. This may include: *

        diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java Wed Jan 23 16:34:57 2013 +0100 @@ -37,6 +37,7 @@ public class TargetMethodAssembler { private static class ExceptionInfo { + public final int codeOffset; public final LabelRef exceptionEdge; @@ -58,8 +59,8 @@ public final List stubs; /** - * The object that emits code for managing a method's frame. - * If null, no frame is used by the method. + * The object that emits code for managing a method's frame. If null, no frame is used by the + * method. */ public final FrameContext frameContext; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/BasicInductionVariable.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/BasicInductionVariable.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/BasicInductionVariable.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,8 +27,8 @@ import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.type.*; +public class BasicInductionVariable extends InductionVariable { -public class BasicInductionVariable extends InductionVariable { private PhiNode phi; private ValueNode init; private ValueNode rawStride; @@ -51,7 +51,7 @@ if (integerStamp.isStrictlyPositive()) { dir = Direction.Up; } else if (integerStamp.isStrictlyNegative()) { - dir = Direction.Down; + dir = Direction.Down; } if (dir != null) { if (op instanceof IntegerAddNode) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,6 +27,7 @@ import com.oracle.graal.nodes.*; public class CountedLoopInfo { + private final LoopEx loop; private InductionVariable iv; private ValueNode end; @@ -40,9 +41,10 @@ } public ValueNode maxTripCountNode() { - //TODO (gd) stuarte and respect oneOff + // TODO (gd) stuarte and respect oneOff throw GraalInternalError.unimplemented("division is a fixed node that needs to be inserted into the control flow"); - // return IntegerArithmeticNode.div(IntegerArithmeticNode.sub(end, iv.initNode()), iv.strideNode()); + // return IntegerArithmeticNode.div(IntegerArithmeticNode.sub(end, iv.initNode()), + // iv.strideNode()); } public boolean isConstantMaxTripCount() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedOffsetInductionVariable.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedOffsetInductionVariable.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedOffsetInductionVariable.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,8 +26,8 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; +public class DerivedOffsetInductionVariable extends InductionVariable { -public class DerivedOffsetInductionVariable extends InductionVariable { private InductionVariable base; private ValueNode offset; private IntegerArithmeticNode value; @@ -117,7 +117,7 @@ private ValueNode op(ValueNode b, ValueNode o) { if (value instanceof IntegerAddNode) { - return IntegerArithmeticNode.add(b, o); + return IntegerArithmeticNode.add(b, o); } if (value instanceof IntegerSubNode) { if (base.valueNode() == value.x()) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedScaledInductionVariable.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedScaledInductionVariable.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedScaledInductionVariable.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,8 +26,8 @@ import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.type.*; +public class DerivedScaledInductionVariable extends InductionVariable { -public class DerivedScaledInductionVariable extends InductionVariable { private InductionVariable base; private ValueNode scale; private ValueNode value; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/InductionVariable.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/InductionVariable.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/InductionVariable.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,16 +25,19 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +public abstract class InductionVariable { -public abstract class InductionVariable { public enum Direction { - Up, - Down; + Up, Down; + public Direction opposite() { - switch(this) { - case Up: return Down; - case Down: return Up; - default: throw GraalInternalError.shouldNotReachHere(); + switch (this) { + case Up: + return Down; + case Down: + return Up; + default: + throw GraalInternalError.shouldNotReachHere(); } } } @@ -50,15 +53,20 @@ public abstract ValueNode valueNode(); public abstract ValueNode initNode(); + public abstract ValueNode strideNode(); public abstract boolean isConstantInit(); + public abstract boolean isConstantStride(); public abstract long constantInit(); + public abstract long constantStride(); public abstract ValueNode extremumNode(); + public abstract boolean isConstantExtremum(); + public abstract long constantExtremum(); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/InductionVariables.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/InductionVariables.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/InductionVariables.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,8 +28,8 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; +public class InductionVariables { -public class InductionVariables { private final LoopEx loop; private Map ivs; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,10 +33,11 @@ import com.oracle.graal.nodes.cfg.*; public class LoopEx { + private final Loop lirLoop; private LoopFragmentInside inside; private LoopFragmentWhole whole; - private CountedLoopInfo counted; //TODO (gd) detect + private CountedLoopInfo counted; // TODO (gd) detect private LoopsData data; LoopEx(Loop lirLoop, LoopsData data) { @@ -115,6 +116,7 @@ } private class InvariantPredicate extends NodePredicate { + @Override public boolean apply(Node n) { return isOutsideLoop(n); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,8 +34,8 @@ import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.type.*; +public abstract class LoopFragment { -public abstract class LoopFragment { private final LoopEx loop; private final LoopFragment original; protected NodeBitMap nodes; @@ -114,6 +114,7 @@ dr = cfgFix; } else if (cfgFix != null && dataFix != null) { dr = new DuplicationReplacement() { + @Override public Node replacement(Node o) { Node r1 = dataFix.replacement(o); @@ -130,6 +131,7 @@ }; } else { dr = new DuplicationReplacement() { + @Override public Node replacement(Node o) { return o; @@ -140,12 +142,12 @@ finishDuplication(); nodesReady = true; } else { - //TODO (gd) apply fix ? + // TODO (gd) apply fix ? } } protected static NodeBitMap computeNodes(Graph graph, Collection blocks) { - return computeNodes(graph, blocks, Collections.emptyList()); + return computeNodes(graph, blocks, Collections. emptyList()); } protected static NodeBitMap computeNodes(Graph graph, Collection blocks, Collection earlyExits) { @@ -169,6 +171,7 @@ if (stateAfter != null) { nodes.mark(stateAfter); stateAfter.applyToVirtual(new VirtualClosure() { + @Override public void apply(VirtualState node) { nodes.mark(node); @@ -230,7 +233,8 @@ } /** - * Merges the early exits (i.e. loop exits) that were duplicated as part of this fragment, with the original fragment's exits. + * Merges the early exits (i.e. loop exits) that were duplicated as part of this fragment, with + * the original fragment's exits. */ protected void mergeEarlyExits() { assert isDuplicate(); @@ -271,7 +275,8 @@ final ValueNode replaceWith; ValueProxyNode newVpn = getDuplicatedNode(vpn); if (newVpn != null) { - PhiNode phi = graph.add(vpn.type() == PhiType.Value ? vpn.stamp() == StampFactory.virtual() ? new PhiNode(vpn.stamp(), merge) : new PhiNode(vpn.kind(), merge) : new PhiNode(vpn.type(), merge)); + PhiNode phi = graph.add(vpn.type() == PhiType.Value ? vpn.stamp() == StampFactory.virtual() ? new PhiNode(vpn.stamp(), merge) : new PhiNode(vpn.kind(), merge) : new PhiNode( + vpn.type(), merge)); phi.addInput(vpn); phi.addInput(newVpn); replaceWith = phi; @@ -280,6 +285,7 @@ } if (state != null) { state.applyToNonVirtual(new NodeClosure() { + @Override public void apply(Node from, ValueNode node) { if (node == vpn) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,16 +33,18 @@ import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.util.*; +public class LoopFragmentInside extends LoopFragment { -public class LoopFragmentInside extends LoopFragment { - /** mergedInitializers. - * When an inside fragment's (loop)ends are merged to create a unique exit point, - * some phis must be created : they phis together all the back-values of the loop-phis - * These can then be used to update the loop-phis' forward edge value ('initializer') in the peeling case. - * In the unrolling case they will be used as the value that replace the loop-phis of the duplicated inside fragment + /** + * mergedInitializers. When an inside fragment's (loop)ends are merged to create a unique exit + * point, some phis must be created : they phis together all the back-values of the loop-phis + * These can then be used to update the loop-phis' forward edge value ('initializer') in the + * peeling case. In the unrolling case they will be used as the value that replace the loop-phis + * of the duplicated inside fragment */ private Map mergedInitializers; private final DuplicationReplacement dataFixBefore = new DuplicationReplacement() { + @Override public Node replacement(Node oriInput) { if (!(oriInput instanceof ValueNode)) { @@ -124,6 +126,7 @@ final LoopBeginNode loopBegin = loop().loopBegin(); final StructuredGraph graph = graph(); return new DuplicationReplacement() { + @Override public Node replacement(Node original) { if (original == loopBegin) { @@ -157,8 +160,10 @@ } else { first = peel.mergedInitializers.get(phi); } - // create a new phi (we don't patch the old one since some usages of the old one may still be valid) - PhiNode newPhi = graph.add(phi.type() == PhiType.Value ? phi.stamp() == StampFactory.virtual() ? new PhiNode(phi.stamp(), loopBegin) : new PhiNode(phi.kind(), loopBegin) : new PhiNode(phi.type(), loopBegin)); + // create a new phi (we don't patch the old one since some usages of the old one may + // still be valid) + PhiNode newPhi = graph.add(phi.type() == PhiType.Value ? phi.stamp() == StampFactory.virtual() ? new PhiNode(phi.stamp(), loopBegin) : new PhiNode(phi.kind(), loopBegin) : new PhiNode( + phi.type(), loopBegin)); newPhi.addInput(first); for (LoopEndNode end : loopBegin.orderedLoopEnds()) { newPhi.addInput(phi.valueAt(end)); @@ -166,12 +171,15 @@ peel.putDuplicatedNode(phi, newPhi); newPhis.add(newPhi); for (Node usage : phi.usages().snapshot()) { - if (peel.getDuplicatedNode(usage) != null) { // patch only usages that should use the new phi ie usages that were peeled + if (peel.getDuplicatedNode(usage) != null) { // patch only usages that should use + // the new phi ie usages that were + // peeled usage.replaceFirstInput(phi, newPhi); } } } - // check new phis to see if they have as input some old phis, replace those inputs with the new corresponding phis + // check new phis to see if they have as input some old phis, replace those inputs with the + // new corresponding phis for (PhiNode phi : newPhis) { for (int i = 0; i < phi.valueCount(); i++) { ValueNode v = phi.valueAt(i); @@ -187,7 +195,7 @@ /** * Gets the corresponding value in this fragment. - * + * * @param b original value * @return corresponding value in the peel */ @@ -211,7 +219,8 @@ private BeginNode mergeEnds() { assert isDuplicate(); List endsToMerge = new LinkedList<>(); - Map reverseEnds = new HashMap<>(); // map peel's exit to the corresponding loop exits + Map reverseEnds = new HashMap<>(); // map peel's exit to the + // corresponding loop exits LoopBeginNode loopBegin = original().loop().loopBegin(); for (LoopEndNode le : loopBegin.loopEnds()) { EndNode duplicate = getDuplicatedNode(le); @@ -244,7 +253,8 @@ } for (final PhiNode phi : loopBegin.phis().snapshot()) { - final PhiNode firstPhi = graph.add(phi.type() == PhiType.Value ? phi.stamp() == StampFactory.virtual() ? new PhiNode(phi.stamp(), newExitMerge) : new PhiNode(phi.kind(), newExitMerge) : new PhiNode(phi.type(), newExitMerge)); + final PhiNode firstPhi = graph.add(phi.type() == PhiType.Value ? phi.stamp() == StampFactory.virtual() ? new PhiNode(phi.stamp(), newExitMerge) : new PhiNode(phi.kind(), newExitMerge) + : new PhiNode(phi.type(), newExitMerge)); for (EndNode end : newExitMerge.forwardEnds()) { LoopEndNode loopEnd = reverseEnds.get(end); ValueNode prim = prim(phi.valueAt(loopEnd)); @@ -255,6 +265,7 @@ if (duplicateState != null) { // fix the merge's state after duplicateState.applyToNonVirtual(new NodeClosure() { + @Override public void apply(Node from, ValueNode node) { if (node == phi) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInsideBefore.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInsideBefore.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInsideBefore.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,8 +26,8 @@ import com.oracle.graal.graph.iterators.*; import com.oracle.graal.nodes.*; +public class LoopFragmentInsideBefore extends LoopFragmentInside { -public class LoopFragmentInsideBefore extends LoopFragmentInside { private final FixedNode point; public LoopFragmentInsideBefore(LoopEx loop, FixedNode point) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInsideFrom.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInsideFrom.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInsideFrom.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,8 +26,8 @@ import com.oracle.graal.graph.iterators.*; import com.oracle.graal.nodes.*; +public class LoopFragmentInsideFrom extends LoopFragmentInside { -public class LoopFragmentInsideFrom extends LoopFragmentInside { private final FixedNode point; public LoopFragmentInsideFrom(LoopEx loop, FixedNode point) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentWhole.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentWhole.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentWhole.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,7 +28,6 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.cfg.*; - public class LoopFragmentWhole extends LoopFragment { public LoopFragmentWhole(LoopEx loop) { @@ -68,6 +67,7 @@ final FixedNode entry = loop().entryPoint(); final Graph graph = this.graph(); return new DuplicationReplacement() { + @Override public Node replacement(Node o) { if (o == entry) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopPolicies.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopPolicies.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopPolicies.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,8 +28,8 @@ import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.phases.*; +public abstract class LoopPolicies { -public abstract class LoopPolicies { private LoopPolicies() { // does not need to be instantiated } @@ -65,7 +65,10 @@ double maxProbability = 0; for (Node successor : controlSplit.successors()) { BeginNode branch = (BeginNode) successor; - inBranchTotal += loop.nodesInLoopFrom(branch, postDom).cardinality(); //this may count twice because of fall-through in switches + inBranchTotal += loop.nodesInLoopFrom(branch, postDom).cardinality(); // this may count + // twice because + // of fall-through + // in switches double probability = controlSplit.probability(branch); if (probability > maxProbability) { maxProbability = probability; @@ -78,5 +81,4 @@ return netDiff <= maxDiff; } - } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,8 +32,8 @@ import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; +public abstract class LoopTransformations { -public abstract class LoopTransformations { private static final int UNROLL_LIMIT = GraalOptions.FullUnrollMaxNodes * 2; private LoopTransformations() { @@ -53,7 +53,7 @@ } public static void fullUnroll(LoopEx loop, MetaAccessProvider runtime, Assumptions assumptions) { - //assert loop.isCounted(); //TODO (gd) strenghten : counted with known trip count + // assert loop.isCounted(); //TODO (gd) strenghten : counted with known trip count int iterations = 0; LoopBeginNode loopBegin = loop.loopBegin(); StructuredGraph graph = (StructuredGraph) loopBegin.graph(); @@ -69,13 +69,13 @@ public static void unswitch(LoopEx loop, ControlSplitNode controlSplitNode) { LoopFragmentWhole originalLoop = loop.whole(); - //create new control split out of loop + // create new control split out of loop ControlSplitNode newControlSplit = (ControlSplitNode) controlSplitNode.copyWithInputs(); originalLoop.entryPoint().replaceAtPredecessor(newControlSplit); NodeClassIterator successors = controlSplitNode.successors().iterator(); assert successors.hasNext(); - //original loop is used as first successor + // original loop is used as first successor Position firstPosition = successors.nextPosition(); NodeClass controlSplitClass = controlSplitNode.getNodeClass(); controlSplitClass.set(newControlSplit, firstPosition, BeginNode.begin(originalLoop.entryPoint())); @@ -91,7 +91,7 @@ } // original loop is simplified last to avoid deleting controlSplitNode too early graph.removeSplitPropagate(controlSplitNode, (BeginNode) controlSplitClass.get(controlSplitNode, firstPosition)); - //TODO (gd) probabilities need some amount of fixup.. (probably also in other transforms) + // TODO (gd) probabilities need some amount of fixup.. (probably also in other transforms) } public static void unroll(LoopEx loop, int factor) { @@ -103,12 +103,12 @@ LoopFragmentWhole main = loop.whole(); LoopFragmentWhole prologue = main.duplicate(); prologue.insertBefore(loop); - //CountedLoopBeginNode counted = prologue.countedLoop(); - //StructuredGraph graph = (StructuredGraph) counted.graph(); - //ValueNode tripCountPrologue = counted.tripCount(); - //ValueNode tripCountMain = counted.tripCount(); - //graph.replaceFloating(tripCountPrologue, "tripCountPrologue % factor"); - //graph.replaceFloating(tripCountMain, "tripCountMain - (tripCountPrologue % factor)"); + // CountedLoopBeginNode counted = prologue.countedLoop(); + // StructuredGraph graph = (StructuredGraph) counted.graph(); + // ValueNode tripCountPrologue = counted.tripCount(); + // ValueNode tripCountMain = counted.tripCount(); + // graph.replaceFloating(tripCountPrologue, "tripCountPrologue % factor"); + // graph.replaceFloating(tripCountMain, "tripCountMain - (tripCountPrologue % factor)"); LoopFragmentInside inside = loop.inside(); for (int i = 0; i < factor; i++) { inside.duplicate().appendInside(loop); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopsData.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopsData.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopsData.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,6 +33,7 @@ import com.oracle.graal.nodes.cfg.*; public class LoopsData { + private Map lirLoopToEx = new IdentityHashMap<>(); private Map loopBeginToEx = new IdentityHashMap<>(); private ControlFlowGraph cfg; @@ -40,6 +41,7 @@ public LoopsData(final StructuredGraph graph) { cfg = Debug.scope("ControlFlowGraph", new Callable() { + @Override public ControlFlowGraph call() throws Exception { return ControlFlowGraph.compute(graph, true, true, true, true); @@ -67,6 +69,7 @@ public List outterFirst() { ArrayList loops = new ArrayList<>(loops()); Collections.sort(loops, new Comparator() { + @Override public int compare(LoopEx o1, LoopEx o2) { return o1.lirLoop().depth - o2.lirLoop().depth; @@ -145,7 +148,8 @@ continue; } break; - default: throw GraalInternalError.shouldNotReachHere(); + default: + throw GraalInternalError.shouldNotReachHere(); } loop.setCounted(new CountedLoopInfo(loop, iv, limit, oneOff)); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopFullUnrollPhase.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopFullUnrollPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopFullUnrollPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,8 +29,8 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.*; +public class LoopFullUnrollPhase extends Phase { -public class LoopFullUnrollPhase extends Phase { private static final DebugMetric FULLY_UNROLLED_LOOPS = Debug.metric("FullUnrolls"); private final GraalCodeCacheProvider runtime; private final Assumptions assumptions; @@ -58,7 +58,7 @@ break; } } - } while(peeled); + } while (peeled); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopTransformLowPhase.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopTransformLowPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopTransformLowPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,6 +29,7 @@ import com.oracle.graal.phases.*; public class LoopTransformLowPhase extends Phase { + private static final DebugMetric UNSWITCHED = Debug.metric("Unswitched"); @Override @@ -37,6 +38,7 @@ if (GraalOptions.ReassociateInvariants) { final LoopsData dataReassociate = new LoopsData(graph); Debug.scope("ReassociateInvariants", new Runnable() { + @Override public void run() { for (LoopEx loop : dataReassociate.loops()) { @@ -65,7 +67,7 @@ } } } - } while(unswitched); + } while (unswitched); } } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,6 +32,7 @@ import com.oracle.graal.nodes.type.*; public class BeginNode extends FixedWithNextNode implements StateSplit, LIRLowerable, Simplifiable, Node.IterableNodeType { + @Input(notDataflow = true) private FrameState stateAfter; public FrameState stateAfter() { @@ -56,7 +57,7 @@ if (with instanceof BeginNode) { return (BeginNode) with; } - BeginNode begin = with.graph().add(new BeginNode()); + BeginNode begin = with.graph().add(new BeginNode()); begin.setNext(with); return begin; } @@ -139,6 +140,7 @@ public NodeIterable getBlockNodes() { return new AbstractNodeIterable() { + @Override public Iterator iterator() { return new BlockNodeIterator(BeginNode.this); @@ -147,6 +149,7 @@ } private class BlockNodeIterator implements Iterator { + private FixedNode current; public BlockNodeIterator(FixedNode next) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginStateSplitNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginStateSplitNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginStateSplitNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,9 +23,9 @@ package com.oracle.graal.nodes; /** - * Base class for {@link BeginNode}s that are associated with a frame state. - * TODO (dnsimon) this not needed until {@link BeginNode} no longer implements {@link StateSplit} - * which is not possible until loop peeling works without requiring begin nodes to have frames states + * Base class for {@link BeginNode}s that are associated with a frame state. TODO (dnsimon) this not + * needed until {@link BeginNode} no longer implements {@link StateSplit} which is not possible + * until loop peeling works without requiring begin nodes to have frames states */ public abstract class BeginStateSplitNode extends BeginNode implements StateSplit { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BooleanNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BooleanNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BooleanNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,7 +27,6 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; - public abstract class BooleanNode extends FloatingNode { public BooleanNode(Stamp stamp) { @@ -39,7 +38,8 @@ } /** - * Tells all usages of this node to negate their effect. For example, IfNodes should switch their true and false successors. + * Tells all usages of this node to negate their effect. For example, IfNodes should switch + * their true and false successors. */ public void negateUsages() { for (Node n : usages().snapshot()) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,27 +27,26 @@ import com.oracle.graal.nodes.type.*; /** - * A node that results in a platform dependent breakpoint instruction being emitted. - * A number of arguments can be associated with such a node for placing values of - * interest in the Java ABI specified parameter locations corresponding to the - * kinds of the values. That is, the arguments are set up as if the breakpoint instruction - * was a call to a compiled Java method. + * A node that results in a platform dependent breakpoint instruction being emitted. A number of + * arguments can be associated with such a node for placing values of interest in the Java ABI + * specified parameter locations corresponding to the kinds of the values. That is, the arguments + * are set up as if the breakpoint instruction was a call to a compiled Java method. *

        * A breakpoint is usually place by defining a node intrinsic method as follows: + * *

          *     {@literal @}NodeIntrinsic(BreakpointNode.class)
          *     static void breakpoint(Object object, Word mark, Word value) {
          *          throw new GraalInternalError("");
          *     }
          * 
        - * - * Note that the signature is arbitrary. It's sole purpose is to capture values you - * may want to inspect in the native debugger when the breakpoint is hit. + * + * Note that the signature is arbitrary. It's sole purpose is to capture values you may want to + * inspect in the native debugger when the breakpoint is hit. */ public final class BreakpointNode extends FixedWithNextNode implements LIRLowerable { - @Input - public final NodeInputList arguments; + @Input public final NodeInputList arguments; public BreakpointNode(ValueNode... arguments) { super(StampFactory.forVoid()); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,8 +31,8 @@ import com.oracle.graal.nodes.type.*; /** - * The {@code ConstantNode} represents a constant such as an integer value, - * long, float, object reference, address, etc. + * The {@code ConstantNode} represents a constant such as an integer value, long, float, object + * reference, address, etc. */ @NodeInfo(shortName = "Const", nameTemplate = "Const({p#rawvalue})") public class ConstantNode extends BooleanNode implements LIRLowerable { @@ -46,6 +46,7 @@ /** * Constructs a new ConstantNode representing the specified constant. + * * @param value the constant */ protected ConstantNode(Constant value, MetaAccessProvider runtime) { @@ -76,6 +77,7 @@ /** * Returns a node for a double constant. + * * @param d the double value for which to create the instruction * @param graph * @return a node for a double constant @@ -86,6 +88,7 @@ /** * Returns a node for a float constant. + * * @param f the float value for which to create the instruction * @param graph * @return a node for a float constant @@ -96,6 +99,7 @@ /** * Returns a node for an long constant. + * * @param i the long value for which to create the instruction * @param graph * @return a node for an long constant @@ -106,6 +110,7 @@ /** * Returns a node for an integer constant. + * * @param i the integer value for which to create the instruction * @param graph * @return a node for an integer constant @@ -116,6 +121,7 @@ /** * Returns a node for a boolean constant. + * * @param i the boolean value for which to create the instruction * @param graph * @return a node representing the boolean @@ -126,6 +132,7 @@ /** * Returns a node for a byte constant. + * * @param i the byte value for which to create the instruction * @param graph * @return a node representing the byte @@ -136,6 +143,7 @@ /** * Returns a node for a char constant. + * * @param i the char value for which to create the instruction * @param graph * @return a node representing the char @@ -146,6 +154,7 @@ /** * Returns a node for a short constant. + * * @param i the short value for which to create the instruction * @param graph * @return a node representing the short @@ -156,6 +165,7 @@ /** * Returns a node for an address (jsr/ret address) constant. + * * @param i the address value for which to create the instruction * @param graph * @return a node representing the address @@ -166,6 +176,7 @@ /** * Returns a node for an object constant. + * * @param o the object value for which to create the instruction * @param graph * @return a node representing the object @@ -200,7 +211,7 @@ } public static ConstantNode defaultForKind(Kind kind, Graph graph) { - switch(kind) { + switch (kind) { case Boolean: return ConstantNode.forBoolean(false, graph); case Byte: diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ControlSplitNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ControlSplitNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ControlSplitNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,7 +25,8 @@ import com.oracle.graal.nodes.type.*; /** - * The {@code ControlSplitNode} is a base class for all instructions that split the control flow (ie. have more than one successor). + * The {@code ControlSplitNode} is a base class for all instructions that split the control flow + * (ie. have more than one successor). */ public abstract class ControlSplitNode extends FixedNode { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -36,7 +36,6 @@ private final DeoptimizationReason reason; private final long leafGraphId; - public DeoptimizeNode(DeoptimizationAction action, DeoptimizationReason reason) { this(action, reason, -1); } @@ -74,5 +73,7 @@ } @NodeIntrinsic - public static native void deopt(@ConstantNodeParameter DeoptimizationAction action, @ConstantNodeParameter DeoptimizationReason reason); + public static native void deopt(@ConstantNodeParameter + DeoptimizationAction action, @ConstantNodeParameter + DeoptimizationReason reason); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EndNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EndNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EndNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -50,7 +50,7 @@ } @Override - public Iterable< ? extends Node> cfgSuccessors() { + public Iterable cfgSuccessors() { return Arrays.asList(merge()); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryMarkerNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryMarkerNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryMarkerNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,7 +26,8 @@ import com.oracle.graal.nodes.spi.*; /** - * This node will be inserted at point specified by {@link StructuredGraph#getEntryBCI()}, usually by the graph builder. + * This node will be inserted at point specified by {@link StructuredGraph#getEntryBCI()}, usually + * by the graph builder. */ public class EntryMarkerNode extends BeginNode implements Node.IterableNodeType, Simplifiable, LIRLowerable { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedWithNextNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedWithNextNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedWithNextNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,7 +25,8 @@ import com.oracle.graal.nodes.type.*; /** - * Base class of all nodes that are fixed within the control flow graph and have an immediate successor. + * Base class of all nodes that are fixed within the control flow graph and have an immediate + * successor. */ public abstract class FixedWithNextNode extends FixedNode { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,8 +32,8 @@ import com.oracle.graal.nodes.virtual.*; /** - * The {@code FrameState} class encapsulates the frame state (i.e. local variables and - * operand stack) at a particular point in the abstract interpretation. + * The {@code FrameState} class encapsulates the frame state (i.e. local variables and operand + * stack) at a particular point in the abstract interpretation. */ @NodeInfo(nameTemplate = "FrameState@{p#method/s}:{p#bci}") public final class FrameState extends VirtualState implements Node.IterableNodeType, LIRLowerable { @@ -52,22 +52,20 @@ public static final int UNKNOWN_BCI = -4; /** - * When a node whose frame state has this BCI value is inlined, its frame state - * will be replaced with the frame state before the inlined invoke node. + * When a node whose frame state has this BCI value is inlined, its frame state will be replaced + * with the frame state before the inlined invoke node. */ public static final int BEFORE_BCI = -1; /** - * When a node whose frame state has this BCI value is inlined, its frame state - * will be replaced with the frame state {@linkplain Invoke#stateAfter() after} - * the inlined invoke node. + * When a node whose frame state has this BCI value is inlined, its frame state will be replaced + * with the frame state {@linkplain Invoke#stateAfter() after} the inlined invoke node. */ public static final int AFTER_BCI = -2; /** - * When a node whose frame state has this BCI value is inlined, its frame state - * will be replaced with the frame state at the exception edge of the inlined - * invoke node. + * When a node whose frame state has this BCI value is inlined, its frame state will be replaced + * with the frame state at the exception edge of the inlined invoke node. */ public static final int AFTER_EXCEPTION_BCI = -3; @@ -85,14 +83,17 @@ private final ResolvedJavaMethod method; /** - * Creates a {@code FrameState} for the given scope and maximum number of stack and local variables. - * + * Creates a {@code FrameState} for the given scope and maximum number of stack and local + * variables. + * * @param method the method for this frame state * @param bci the bytecode index of the frame state * @param stackSize size of the stack - * @param rethrowException if true the VM should re-throw the exception on top of the stack when deopt'ing using this framestate + * @param rethrowException if true the VM should re-throw the exception on top of the stack when + * deopt'ing using this framestate */ - public FrameState(ResolvedJavaMethod method, int bci, List values, int localsSize, int stackSize, boolean rethrowException, boolean duringCall, List virtualObjectMappings) { + public FrameState(ResolvedJavaMethod method, int bci, List values, int localsSize, int stackSize, boolean rethrowException, boolean duringCall, + List virtualObjectMappings) { assert stackSize >= 0; assert (bci >= 0 && method != null) || (bci < 0 && method == null && values.isEmpty()); this.method = method; @@ -108,10 +109,11 @@ /** * Simple constructor used to create marker FrameStates. + * * @param bci marker bci, needs to be < 0 */ public FrameState(int bci) { - this(null, bci, Collections.emptyList(), 0, 0, false, false, Collections.emptyList()); + this(null, bci, Collections. emptyList(), 0, 0, false, false, Collections. emptyList()); } public FrameState(ResolvedJavaMethod method, int bci, ValueNode[] locals, List stack, ValueNode[] locks, boolean rethrowException, boolean duringCall) { @@ -202,8 +204,8 @@ } /** - * Duplicates a FrameState, along with a deep copy of all connected VirtualState (outer FrameStates, - * VirtualObjectStates, ...). + * Duplicates a FrameState, along with a deep copy of all connected VirtualState (outer + * FrameStates, VirtualObjectStates, ...). */ @Override public FrameState duplicateWithVirtualState() { @@ -221,9 +223,9 @@ } /** - * Creates a copy of this frame state with one stack element of type popKind popped from the stack and the - * values in pushedValues pushed on the stack. The pushedValues are expected to be in slot encoding: a long - * or double is followed by a null slot. + * Creates a copy of this frame state with one stack element of type popKind popped from the + * stack and the values in pushedValues pushed on the stack. The pushedValues are expected to be + * in slot encoding: a long or double is followed by a null slot. */ public FrameState duplicateModified(int newBci, boolean newRethrowException, Kind popKind, ValueNode... pushedValues) { ArrayList copy = new ArrayList<>(values.subList(0, localsSize + stackSize)); @@ -267,7 +269,7 @@ /** * Gets the value in the local variables at the specified index. - * + * * @param i the index into the locals * @return the instruction that produced the value for the specified local */ @@ -278,7 +280,7 @@ /** * 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 */ @@ -289,7 +291,7 @@ /** * Get the monitor owner at the specified index. - * + * * @param i the index into the list of locked monitors. * @return the lock owner at the given index. */ @@ -346,7 +348,7 @@ public Map getDebugProperties(Map map) { Map properties = super.getDebugProperties(map); if (method != null) { - //properties.put("method", MetaUtil.format("%H.%n(%p):%r", method)); + // properties.put("method", MetaUtil.format("%H.%n(%p):%r", method)); StackTraceElement ste = method.asStackTraceElement(bci); if (ste.getFileName() != null && ste.getLineNumber() >= 0) { properties.put("sourceFile", ste.getFileName()); @@ -367,7 +369,7 @@ } @Override - public void applyToNonVirtual(NodeClosure< ? super ValueNode> closure) { + public void applyToNonVirtual(NodeClosure closure) { for (ValueNode value : values.nonNull()) { closure.apply(this, value); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,15 +30,16 @@ import com.oracle.graal.nodes.type.*; /** - * A guard is a node that deoptimizes based on a conditional expression. Guards are not attached to a certain frame - * state, they can move around freely and will always use the correct frame state when the nodes are scheduled (i.e., - * the last emitted frame state). The node that is guarded has a data dependency on the guard and the guard in turn has - * a data dependency on the condition. A guard may only be executed if it is guaranteed that the guarded node is - * executed too (if no exceptions are thrown). Therefore, an anchor is placed after a control - * flow split and the guard has a data dependency to the anchor. The anchor is the most distant node that is - * post-dominated by the guarded node and the guard can be scheduled anywhere between those two nodes. This ensures - * maximum flexibility for the guard node and guarantees that deoptimization occurs only if the control flow would have - * reached the guarded node (without taking exceptions into account). + * A guard is a node that deoptimizes based on a conditional expression. Guards are not attached to + * a certain frame state, they can move around freely and will always use the correct frame state + * when the nodes are scheduled (i.e., the last emitted frame state). The node that is guarded has a + * data dependency on the guard and the guard in turn has a data dependency on the condition. A + * guard may only be executed if it is guaranteed that the guarded node is executed too (if no + * exceptions are thrown). Therefore, an anchor is placed after a control flow split and the guard + * has a data dependency to the anchor. The anchor is the most distant node that is post-dominated + * by the guarded node and the guard can be scheduled anywhere between those two nodes. This ensures + * maximum flexibility for the guard node and guarantees that deoptimization occurs only if the + * control flow would have reached the guarded node (without taking exceptions into account). */ @NodeInfo(nameTemplate = "Guard(!={p#negated}) {p#reason/s}") public final class GuardNode extends FloatingNode implements Canonicalizable, LIRLowerable, Node.IterableNodeType, Negatable { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,10 +34,11 @@ import com.oracle.graal.nodes.util.*; /** - * The {@code IfNode} represents a branch that can go one of two directions depending on the outcome of a - * comparison. + * The {@code IfNode} represents a branch that can go one of two directions depending on the outcome + * of a comparison. */ public final class IfNode extends ControlSplitNode implements Simplifiable, LIRLowerable, Negatable { + private final long leafGraphId; @Successor private BeginNode trueSuccessor; @Successor private BeginNode falseSuccessor; @@ -73,7 +74,7 @@ /** * Gets the true successor. - * + * * @return the true successor */ public BeginNode trueSuccessor() { @@ -82,7 +83,7 @@ /** * Gets the false successor. - * + * * @return the false successor */ public BeginNode falseSuccessor() { @@ -101,7 +102,7 @@ /** * Gets the node corresponding to the specified outcome of the branch. - * + * * @param istrue {@code true} if the true successor is requested, {@code false} otherwise * @return the corresponding successor */ @@ -167,7 +168,7 @@ /** * Tries to remove an empty if construct or replace an if construct with a materialization. - * + * * @return true if a transformation was made, false otherwise */ private boolean removeOrMaterializeIf(SimplifierTool tool) { @@ -184,7 +185,8 @@ } else { PhiNode singlePhi = phis.next(); if (!phis.hasNext()) { - // one phi at the merge of an otherwise empty if construct: try to convert into a MaterializeNode + // one phi at the merge of an otherwise empty if construct: try to convert + // into a MaterializeNode boolean inverted = trueEnd == merge.forwardEndAt(1); ValueNode trueValue = singlePhi.valueAt(inverted ? 1 : 0); ValueNode falseValue = singlePhi.valueAt(inverted ? 0 : 1); @@ -208,9 +210,9 @@ } /** - * Tries to connect code that initializes a variable directly with the successors of an if construct - * that switches on the variable. For example, the pseudo code below: - * + * Tries to connect code that initializes a variable directly with the successors of an if + * construct that switches on the variable. For example, the pseudo code below: + * *
              * contains(list, e, yes, no) {
              *     if (list == null || e == null) {
        @@ -231,7 +233,9 @@
              *     }
              * }
              * 
        + * * will be transformed into: + * *
              * contains(list, e, yes, no) {
              *     if (list == null || e == null) {
        @@ -247,7 +251,7 @@
              *     }
              * }
              * 
        - * + * * @return true if a transformation was made, false otherwise */ private boolean removeIntermediateMaterialization(SimplifierTool tool) { @@ -269,7 +273,8 @@ return false; } - // Only consider merges with a single usage that is both a phi and an operand of the comparison + // Only consider merges with a single usage that is both a phi and an operand of the + // comparison NodeIterable mergeUsages = merge.usages(); if (mergeUsages.count() != 1) { return false; @@ -339,11 +344,11 @@ } /** - * Connects a set of ends to a given successor, inserting a merge node if - * there is more than one end. If {@code ends} is empty, then {@code successor} - * is {@linkplain GraphUtil#killCFG(FixedNode) killed} otherwise it is added to {@code tool}'s + * Connects a set of ends to a given successor, inserting a merge node if there is more than one + * end. If {@code ends} is empty, then {@code successor} is + * {@linkplain GraphUtil#killCFG(FixedNode) killed} otherwise it is added to {@code tool}'s * {@linkplain SimplifierTool#addToWorkList(com.oracle.graal.graph.Node) work list}. - * + * * @param oldMerge the merge being removed * @param phiValues the values of the phi at the merge, keyed by the merge ends */ @@ -357,7 +362,8 @@ oldMerge.removeEnd(end); GraphUtil.killCFG(end); } else { - // Need a new phi in case the frame state is used by more than the merge being removed + // Need a new phi in case the frame state is used by more than the merge being + // removed MergeNode newMerge = graph().add(new MergeNode()); PhiNode oldPhi = (PhiNode) oldMerge.usages().first(); PhiNode newPhi = graph().add(new PhiNode(oldPhi.stamp(), newMerge)); @@ -384,11 +390,12 @@ } /** - * Gets an array of constants derived from a node that is either a {@link ConstantNode} - * or a {@link PhiNode} whose input values are all constants. The length of the returned - * array is equal to the number of ends terminating in a given merge node. - * - * @return null if {@code node} is neither a {@link ConstantNode} nor a {@link PhiNode} whose input values are all constants + * Gets an array of constants derived from a node that is either a {@link ConstantNode} or a + * {@link PhiNode} whose input values are all constants. The length of the returned array is + * equal to the number of ends terminating in a given merge node. + * + * @return null if {@code node} is neither a {@link ConstantNode} nor a {@link PhiNode} whose + * input values are all constants */ private static Constant[] constantValues(ValueNode node, MergeNode merge) { if (node.isConstant()) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -35,7 +35,7 @@ * The {@code InvokeNode} represents all kinds of method calls. */ @NodeInfo(nameTemplate = "Invoke#{p#targetMethod/s}") -public final class InvokeNode extends AbstractStateSplit implements StateSplit, Node.IterableNodeType, Invoke, LIRLowerable, MemoryCheckpoint { +public final class InvokeNode extends AbstractStateSplit implements StateSplit, Node.IterableNodeType, Invoke, LIRLowerable, MemoryCheckpoint { @Input private final CallTargetNode callTarget; private final int bci; @@ -46,7 +46,7 @@ /** * Constructs a new Invoke instruction. - * + * * @param bci the bytecode index of the original invoke (used for debug infos) * @param callTarget the target method being called */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,6 +33,7 @@ @NodeInfo(nameTemplate = "Invoke!#{p#targetMethod/s}") public class InvokeWithExceptionNode extends ControlSplitNode implements Node.IterableNodeType, Invoke, MemoryCheckpoint, LIRLowerable { + @Successor private BeginNode next; @Successor private DispatchBeginNode exceptionEdge; @Input private final CallTargetNode callTarget; @@ -217,6 +218,7 @@ } private static final double EXCEPTION_PROBA = 1e-5; + @Override public double probability(BeginNode successor) { return successor == next ? 1 - EXCEPTION_PROBA : EXCEPTION_PROBA; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LocalNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LocalNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LocalNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,8 +27,7 @@ import com.oracle.graal.nodes.type.*; /** - * The {@code Local} instruction is a placeholder for an incoming argument - * to a function call. + * The {@code Local} instruction is a placeholder for an incoming argument to a function call. */ @NodeInfo(nameTemplate = "Local({p#index})") public final class LocalNode extends FloatingNode implements Node.IterableNodeType { @@ -42,6 +41,7 @@ /** * Gets the index of this local in the array of parameters. This is NOT the JVM local index. + * * @return the index */ public int index() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,8 +30,8 @@ import com.oracle.graal.graph.iterators.*; import com.oracle.graal.nodes.spi.*; +public class LoopBeginNode extends MergeNode implements Node.IterableNodeType, LIRLowerable { -public class LoopBeginNode extends MergeNode implements Node.IterableNodeType, LIRLowerable { private double loopFrequency; private int nextEndIndex; private int unswitches; @@ -49,8 +49,10 @@ } /** - * Returns the unordered set of {@link LoopEndNode} that correspond to back-edges for this loop. - * The order of the back-edges is unspecified, if you need to get an ordering compatible for {@link PhiNode} creation, use {@link #orderedLoopEnds()}. + * Returns the unordered set of {@link LoopEndNode} that correspond to back-edges for + * this loop. The order of the back-edges is unspecified, if you need to get an ordering + * compatible for {@link PhiNode} creation, use {@link #orderedLoopEnds()}. + * * @return the set of {@code LoopEndNode} that correspond to back-edges for this loop */ public NodeIterable loopEnds() { @@ -67,13 +69,16 @@ } /** - * Returns the set of {@link LoopEndNode} that correspond to back-edges for this loop, ordered in increasing {@link #phiPredecessorIndex}. - * This method is suited to create new loop {@link PhiNode}. + * Returns the set of {@link LoopEndNode} that correspond to back-edges for this loop, ordered + * in increasing {@link #phiPredecessorIndex}. This method is suited to create new loop + * {@link PhiNode}. + * * @return the set of {@code LoopEndNode} that correspond to back-edges for this loop */ public List orderedLoopEnds() { List snapshot = loopEnds().snapshot(); Collections.sort(snapshot, new Comparator() { + @Override public int compare(LoopEndNode o1, LoopEndNode o2) { return o1.endIndex() - o2.endIndex(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopEndNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopEndNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopEndNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,7 +27,6 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.spi.*; - public final class LoopEndNode extends EndNode { @Input(notDataflow = true) private LoopBeginNode loopBegin; @@ -56,7 +55,6 @@ this.loopBegin = x; } - public void disableSafepoint() { this.canSafepoint = false; } @@ -82,9 +80,10 @@ } /** - * Returns the 0-based index of this loop end. This is not the index into {@link PhiNode} values at the loop - * begin. Use {@link MergeNode#phiPredecessorIndex(EndNode)} for this purpose. - * + * Returns the 0-based index of this loop end. This is not the index into {@link PhiNode} + * values at the loop begin. Use {@link MergeNode#phiPredecessorIndex(EndNode)} for this + * purpose. + * * @return The 0-based index of this loop end. */ public int endIndex() { @@ -96,7 +95,7 @@ } @Override - public Iterable< ? extends Node> cfgSuccessors() { + public Iterable cfgSuccessors() { return Collections.emptyList(); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopExitNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopExitNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopExitNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,7 +25,9 @@ import com.oracle.graal.nodes.spi.*; public class LoopExitNode extends BeginStateSplitNode { + @Input(notDataflow = true) private LoopBeginNode loopBegin; + public LoopExitNode(LoopBeginNode loop) { assert loop != null; loopBegin = loop; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MaterializeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MaterializeNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MaterializeNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -54,10 +54,12 @@ } @NodeIntrinsic - public static native boolean materialize(@ConstantNodeParameter Condition condition, int x, int y); + public static native boolean materialize(@ConstantNodeParameter + Condition condition, int x, int y); @NodeIntrinsic - public static native boolean materialize(@ConstantNodeParameter Condition condition, long x, long y); + public static native boolean materialize(@ConstantNodeParameter + Condition condition, long x, long y); @NodeIntrinsic public static native boolean isInstance(Class mirror, Object object); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -65,7 +65,7 @@ /** * Determines if a given node is a phi whose {@linkplain PhiNode#merge() merge} is this node. - * + * * @param value the instruction to test * @return {@code true} if {@code value} is a phi and its merge is {@code this} */ @@ -74,7 +74,9 @@ } /** - * Removes the given end from the merge, along with the entries corresponding to this end in the phis connected to the merge. + * Removes the given end from the merge, along with the entries corresponding to this end in the + * phis connected to the merge. + * * @param pred the end to remove */ public void removeEnd(EndNode pred) { @@ -119,6 +121,7 @@ public NodeIterable phis() { return this.usages().filter(PhiNode.class).filter(new NodePredicate() { + @Override public boolean apply(Node n) { return ((PhiNode) n).merge() == MergeNode.this; @@ -129,6 +132,7 @@ @Override public NodeIterable anchored() { return super.anchored().filter(isNotA(PhiNode.class).or(new NodePredicate() { + @Override public boolean apply(Node n) { return ((PhiNode) n).merge() != MergeNode.this; @@ -145,7 +149,8 @@ if (merge instanceof LoopBeginNode && !(origLoopEnd instanceof LoopEndNode)) { return; } - // in order to move anchored values to the other merge we would need to check if the anchors are used by phis of the other merge + // in order to move anchored values to the other merge we would need to check if the + // anchors are used by phis of the other merge if (this.anchored().isNotEmpty()) { return; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,16 +29,15 @@ import com.oracle.graal.nodes.type.*; /** - * The {@code PhiNode} represents the merging of dataflow in the graph. It refers to a merge - * and a variable. + * The {@code PhiNode} represents the merging of dataflow in the graph. It refers to a merge and a + * variable. */ @NodeInfo(nameTemplate = "{p#type/s}Phi({i#values})") public final class PhiNode extends FloatingNode implements Canonicalizable, Node.IterableNodeType { public static enum PhiType { Value(null), // normal value phis - Guard(StampFactory.dependency()), - Memory(StampFactory.dependency()); + Guard(StampFactory.dependency()), Memory(StampFactory.dependency()); public final Stamp stamp; @@ -53,6 +52,7 @@ /** * Create a value phi ({@link PhiType#Value}) with the specified kind. + * * @param kind the kind of the value * @param merge the merge that the new phi belongs to */ @@ -69,6 +69,7 @@ /** * Create a non-value phi ({@link PhiType#Memory} with the specified kind. + * * @param type the type of the new phi * @param merge the merge that the new phi belongs to */ @@ -122,8 +123,9 @@ } /** - * Get the instruction that produces the value associated with the i'th predecessor of the merge. - * + * Get the instruction that produces the value associated with the i'th predecessor of the + * merge. + * * @param i the index of the predecessor * @return the instruction that produced the value in the i'th predecessor */ @@ -133,6 +135,7 @@ /** * Sets the value at the given index and makes sure that the values list is large enough. + * * @param i the index at which to set the value * @param x the new phi input value for the given location */ @@ -153,7 +156,7 @@ /** * Get the number of inputs to this phi (i.e. the number of predecessors to the merge). - * + * * @return the number of inputs in this phi */ public int valueCount() { @@ -185,7 +188,7 @@ } public void addInput(ValueNode x) { - assert !(x instanceof PhiNode) || ((PhiNode) x).merge() instanceof LoopBeginNode || ((PhiNode) x).merge() != this.merge(); + assert !(x instanceof PhiNode) || ((PhiNode) x).merge() instanceof LoopBeginNode || ((PhiNode) x).merge() != this.merge(); values.add(x); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,9 +27,8 @@ import com.oracle.graal.nodes.type.*; /** - * A node that changes the type of its input, usually narrowing it. - * For example, a PI node refines the type of a receiver during - * type-guarded inlining to be the type tested by the guard. + * A node that changes the type of its input, usually narrowing it. For example, a PI node refines + * the type of a receiver during type-guarded inlining to be the type tested by the guard. */ public class PiNode extends FloatingNode implements LIRLowerable, Virtualizable { @@ -58,7 +57,8 @@ @Override public boolean inferStamp() { if (object().objectStamp().alwaysNull() && objectStamp().nonNull()) { - // a null value flowing into a nonNull PiNode should be guarded by a type/isNull guard, but the + // a null value flowing into a nonNull PiNode should be guarded by a type/isNull guard, + // but the // compiler might see this situation before the branch is deleted return false; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ReturnNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ReturnNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ReturnNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -36,8 +36,9 @@ /** * Constructs a new Return instruction. - * - * @param result the instruction producing the result for this return; {@code null} if this is a void return + * + * @param result the instruction producing the result for this return; {@code null} if this is a + * void return */ public ReturnNode(ValueNode result) { super(StampFactory.forVoid()); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,6 +27,6 @@ /** * The start node of a graph. */ -public class StartNode extends BeginStateSplitNode implements MemoryCheckpoint{ +public class StartNode extends BeginStateSplitNode implements MemoryCheckpoint { } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StateSplit.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StateSplit.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StateSplit.java Wed Jan 23 16:34:57 2013 +0100 @@ -38,9 +38,9 @@ void setStateAfter(FrameState x); /** - * Determines if this node has a side-effect. Execution of such a node changes - * state visible to other threads. These nodes denote boundaries across which deoptimization - * points cannot be moved. + * Determines if this node has a side-effect. Execution of such a node changes state visible to + * other threads. These nodes denote boundaries across which deoptimization points cannot be + * moved. */ boolean hasSideEffect(); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,10 +31,9 @@ import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.util.*; - /** - * A graph that contains at least one distinguished node : the {@link #start() start} node. - * This node is the start of the control flow of the graph. + * A graph that contains at least one distinguished node : the {@link #start() start} node. This + * node is the start of the control flow of the graph. */ public class StructuredGraph extends Graph { @@ -140,6 +139,7 @@ public Iterable getInvokes() { final Iterator callTargets = getNodes(MethodCallTargetNode.class).iterator(); return new Iterable() { + private Invoke next; @Override @@ -196,9 +196,9 @@ } /** - * Unlinks a node from all its control flow neighbours and then removes it from its graph. - * The node must have no {@linkplain Node#usages() usages}. - * + * Unlinks a node from all its control flow neighbours and then removes it from its graph. The + * node must have no {@linkplain Node#usages() usages}. + * * @param node the node to be unlinked and removed */ public void removeFixed(FixedWithNextNode node) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,7 +30,8 @@ import com.oracle.graal.nodes.type.*; /** - * Unwind takes an exception object, destroys the current stack frame and passes the exception object to the system's exception dispatch code. + * Unwind takes an exception object, destroys the current stack frame and passes the exception + * object to the system's exception dispatch code. */ public final class UnwindNode extends FixedNode implements LIRLowerable, Node.IterableNodeType { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,8 +32,8 @@ import com.oracle.graal.nodes.util.*; /** - * This class represents a value within the graph, including local variables, phis, and - * all other instructions. + * This class represents a value within the graph, including local variables, phis, and all other + * instructions. */ public abstract class ValueNode extends ScheduledNode implements StampProvider { @@ -76,9 +76,10 @@ } /** - * Checks if the given stamp is different than the current one ({@code newStamp.equals(oldStamp) == false}). If it - * is different then the new stamp will become the current stamp for this node. - * + * Checks if the given stamp is different than the current one ( + * {@code newStamp.equals(oldStamp) == false}). If it is different then the new stamp will + * become the current stamp for this node. + * * @return true if the stamp has changed, false otherwise. */ protected final boolean updateStamp(Stamp newStamp) { @@ -91,10 +92,11 @@ } /** - * This method can be overridden by subclasses of {@link ValueNode} if they need to recompute their stamp if their - * inputs change. A typical implementation will compute the stamp and pass it to {@link #updateStamp(Stamp)}, whose - * return value can be used as the result of this method. - * + * This method can be overridden by subclasses of {@link ValueNode} if they need to recompute + * their stamp if their inputs change. A typical implementation will compute the stamp and pass + * it to {@link #updateStamp(Stamp)}, whose return value can be used as the result of this + * method. + * * @return true if the stamp has changed, false otherwise. */ public boolean inferStamp() { @@ -107,7 +109,7 @@ /** * Checks whether this value is a constant (i.e. it is of type {@link ConstantNode}. - * + * * @return {@code true} if this value is a constant */ public final boolean isConstant() { @@ -115,6 +117,7 @@ } private static final NodePredicate IS_CONSTANT = new NodePredicate() { + @Override public boolean apply(Node n) { return n instanceof ValueNode && ((ValueNode) n).isConstant(); @@ -127,7 +130,7 @@ /** * Checks whether this value represents the null constant. - * + * * @return {@code true} if this value represents the null constant */ public final boolean isNullConstant() { @@ -136,8 +139,9 @@ /** * Convert this value to a constant if it is a constant, otherwise return null. - * - * @return the {@link Constant} represented by this value if it is a constant; {@code null} otherwise + * + * @return the {@link Constant} represented by this value if it is a constant; {@code null} + * otherwise */ public final Constant asConstant() { if (this instanceof ConstantNode) { @@ -148,8 +152,8 @@ public boolean verifyStamp(Class stampClass) { assert stamp() != null; - assert stampClass.isInstance(stamp()) : this + " (" + GraphUtil.approxSourceLocation(this) + ") has unexpected stamp type: expected " + stampClass.getName() + - ", got " + stamp().getClass().getName() + ", usages=" + usages(); + assert stampClass.isInstance(stamp()) : this + " (" + GraphUtil.approxSourceLocation(this) + ") has unexpected stamp type: expected " + stampClass.getName() + ", got " + + stamp().getClass().getName() + ", usages=" + usages(); return true; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNodeUtil.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNodeUtil.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNodeUtil.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,7 +28,6 @@ import com.oracle.graal.graph.*; import com.oracle.graal.graph.Node.Verbosity; - public class ValueNodeUtil { public static ValueNode assertKind(Kind kind, ValueNode x) { @@ -82,7 +81,6 @@ return y == null || x == null || x.kind() != y.kind(); } - @SuppressWarnings("unchecked") public static Collection filter(Iterable nodes, Class clazz) { ArrayList phis = new ArrayList<>(); @@ -95,11 +93,12 @@ } /** - * 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#kind 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. + * 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#kind 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 */ public static String valueString(ValueNode value) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,11 +30,12 @@ import com.oracle.graal.nodes.type.*; /** - * A value proxy that is inserted in the frame state of a loop exit for any value that is - * created inside the loop (i.e. was not live on entry to the loop) and is (potentially) - * used after the loop. + * A value proxy that is inserted in the frame state of a loop exit for any value that is created + * inside the loop (i.e. was not live on entry to the loop) and is (potentially) used after the + * loop. */ public class ValueProxyNode extends FloatingNode implements Node.IterableNodeType, ValueNumberable, Canonicalizable, Virtualizable { + @Input(notDataflow = true) private BeginNode proxyPoint; @Input private ValueNode value; private final PhiType type; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/VirtualState.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/VirtualState.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/VirtualState.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,10 +31,12 @@ public abstract class VirtualState extends Node { public interface NodeClosure { + void apply(Node usage, T node); } public interface VirtualClosure { + void apply(VirtualState node); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ArithmeticNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ArithmeticNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ArithmeticNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,7 +26,8 @@ import com.oracle.graal.nodes.*; /** - * The {@code ArithmeticOp} class represents arithmetic operations such as addition, subtraction, etc. + * The {@code ArithmeticOp} class represents arithmetic operations such as addition, subtraction, + * etc. */ public abstract class ArithmeticNode extends BinaryNode { @@ -34,6 +35,7 @@ /** * Creates a new arithmetic operation. + * * @param kind the result kind of the operation * @param x the first input instruction * @param y the second input instruction @@ -46,6 +48,7 @@ /** * Checks whether this instruction has strict fp semantics. + * * @return {@code true} if this instruction has strict fp semantics */ public boolean isStrictFP() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -46,6 +46,7 @@ /** * Creates a new BinaryNode instance. + * * @param kind the result type of this instruction * @param x the first input instruction * @param y the second input instruction @@ -57,33 +58,33 @@ } public enum ReassociateMatch { - x, - y; + x, y; public ValueNode getValue(BinaryNode binary) { - switch(this) { + switch (this) { case x: return binary.x(); case y: return binary.y(); - default: throw GraalInternalError.shouldNotReachHere(); + default: + throw GraalInternalError.shouldNotReachHere(); } } public ValueNode getOtherValue(BinaryNode binary) { - switch(this) { + switch (this) { case x: return binary.y(); case y: return binary.x(); - default: throw GraalInternalError.shouldNotReachHere(); + default: + throw GraalInternalError.shouldNotReachHere(); } } } public static boolean canTryReassociate(BinaryNode node) { - return node instanceof IntegerAddNode || node instanceof IntegerSubNode || node instanceof IntegerMulNode - || node instanceof AndNode || node instanceof OrNode || node instanceof XorNode; + return node instanceof IntegerAddNode || node instanceof IntegerSubNode || node instanceof IntegerMulNode || node instanceof AndNode || node instanceof OrNode || node instanceof XorNode; } public static ReassociateMatch findReassociate(BinaryNode binary, NodePredicate criterion) { @@ -98,22 +99,19 @@ return null; } - /* In reassociate, complexity comes from the handling of IntegerSub (non commutative) which can be mixed with IntegerAdd. - * if first tries to find m1, m2 which match the criterion : - * (a o m2) o m1 - * (m2 o a) o m1 - * m1 o (a o m2) - * m1 o (m2 o a) - * It then produces 4 boolean for the -/+ case - * invertA : should the final expression be like *-a (rather than a+*) - * aSub : should the final expression be like a-* (rather than a+*) - * invertM1 : should the final expression contain -m1 - * invertM2 : should the final expression contain -m2 + /* + * In reassociate, complexity comes from the handling of IntegerSub (non commutative) which can + * be mixed with IntegerAdd. if first tries to find m1, m2 which match the criterion : (a o m2) + * o m1 (m2 o a) o m1 m1 o (a o m2) m1 o (m2 o a) It then produces 4 boolean for the -/+ case + * invertA : should the final expression be like *-a (rather than a+*) aSub : should the final + * expression be like a-* (rather than a+*) invertM1 : should the final expression contain -m1 + * invertM2 : should the final expression contain -m2 */ /** - * Tries to re-associate values which satisfy the criterion. - * For example with a constantness criterion : (a + 2) + 1 => a + (1 + 2)
        - * This method accepts only reassociable operations (see {@linkplain #canTryReassociate(BinaryNode)}) such as +, -, *, &, | and ^ + * Tries to re-associate values which satisfy the criterion. For example with a constantness + * criterion : (a + 2) + 1 => a + (1 + 2)
        + * This method accepts only reassociable operations (see + * {@linkplain #canTryReassociate(BinaryNode)}) such as +, -, *, &, | and ^ */ public static BinaryNode reassociate(BinaryNode node, NodePredicate criterion) { assert canTryReassociate(node); @@ -139,7 +137,7 @@ return node; } boolean invertA = false; - boolean aSub = false; + boolean aSub = false; boolean invertM1 = false; boolean invertM2 = false; if (addSub) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -49,7 +49,7 @@ /** * Constructs a new Compare instruction. - * + * * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction */ @@ -62,14 +62,14 @@ /** * Gets the condition (comparison operation) for this instruction. - * + * * @return the condition */ public abstract Condition condition(); /** * Checks whether unordered inputs mean true or false (only applies to float operations). - * + * * @return {@code true} if unordered inputs produce true */ public abstract boolean unorderedIsTrue(); @@ -78,7 +78,6 @@ public void generate(LIRGeneratorTool gen) { } - private ValueNode optimizeConditional(Constant constant, ConditionalNode conditionalNode, MetaAccessProvider runtime, Condition cond) { Constant trueConstant = conditionalNode.trueValue().asConstant(); Constant falseConstant = conditionalNode.falseValue().asConstant(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java Wed Jan 23 16:34:57 2013 +0100 @@ -88,97 +88,149 @@ public boolean check(int left, int right) { switch (this) { - case EQ: return left == right; - case NE: return left != right; - case LT: return left < right; - case LE: return left <= right; - case GT: return left > right; - case GE: return left >= right; - case AE: return UnsignedMath.aboveOrEqual(left, right); - case BE: return UnsignedMath.belowOrEqual(left, right); - case AT: return UnsignedMath.aboveThan(left, right); - case BT: return UnsignedMath.belowThan(left, right); - } - throw new IllegalArgumentException(this.toString()); - } - - /** - * Given a condition and its negation, this method returns true for one of the two and false for the other one. - * This can be used to keep comparisons in a canonical form. - * @return true if this condition is considered to be the canonical form, false otherwise. - */ - public boolean isCanonical() { - switch (this) { - case EQ: return true; - case NE: return false; - case LT: return true; - case LE: return false; - case GT: return false; - case GE: return false; - case BT: return true; - case BE: return false; - case AT: return false; - case AE: return false; + case EQ: + return left == right; + case NE: + return left != right; + case LT: + return left < right; + case LE: + return left <= right; + case GT: + return left > right; + case GE: + return left >= right; + case AE: + return UnsignedMath.aboveOrEqual(left, right); + case BE: + return UnsignedMath.belowOrEqual(left, right); + case AT: + return UnsignedMath.aboveThan(left, right); + case BT: + return UnsignedMath.belowThan(left, right); } throw new IllegalArgumentException(this.toString()); } /** - * Returns true if the condition needs to be mirrored to get to a canonical condition. - * The result of the mirroring operation might still need to be negated to achieve a canonical form. + * Given a condition and its negation, this method returns true for one of the two and false for + * the other one. This can be used to keep comparisons in a canonical form. + * + * @return true if this condition is considered to be the canonical form, false otherwise. */ - public boolean canonicalMirror() { + public boolean isCanonical() { switch (this) { - case EQ: return false; - case NE: return false; - case LT: return false; - case LE: return true; - case GT: return true; - case GE: return false; - case BT: return false; - case BE: return true; - case AT: return true; - case AE: return false; + case EQ: + return true; + case NE: + return false; + case LT: + return true; + case LE: + return false; + case GT: + return false; + case GE: + return false; + case BT: + return true; + case BE: + return false; + case AT: + return false; + case AE: + return false; } throw new IllegalArgumentException(this.toString()); } /** - * Returns true if the condition needs to be negated to get to a canonical condition. - * The result of the negation might still need to be mirrored to achieve a canonical form. + * Returns true if the condition needs to be mirrored to get to a canonical condition. The + * result of the mirroring operation might still need to be negated to achieve a canonical form. + */ + public boolean canonicalMirror() { + switch (this) { + case EQ: + return false; + case NE: + return false; + case LT: + return false; + case LE: + return true; + case GT: + return true; + case GE: + return false; + case BT: + return false; + case BE: + return true; + case AT: + return true; + case AE: + return false; + } + throw new IllegalArgumentException(this.toString()); + } + + /** + * Returns true if the condition needs to be negated to get to a canonical condition. The result + * of the negation might still need to be mirrored to achieve a canonical form. */ public boolean canonicalNegate() { switch (this) { - case EQ: return false; - case NE: return true; - case LT: return false; - case LE: return true; - case GT: return false; - case GE: return true; - case BT: return false; - case BE: return true; - case AT: return false; - case AE: return true; + case EQ: + return false; + case NE: + return true; + case LT: + return false; + case LE: + return true; + case GT: + return false; + case GE: + return true; + case BT: + return false; + case BE: + return true; + case AT: + return false; + case AE: + return true; } throw new IllegalArgumentException(this.toString()); } /** * Negate this conditional. + * * @return the condition that represents the negation */ public final Condition negate() { switch (this) { - case EQ: return NE; - case NE: return EQ; - case LT: return GE; - case LE: return GT; - case GT: return LE; - case GE: return LT; - case BT: return AE; - case BE: return AT; - case AT: return BE; - case AE: return BT; + case EQ: + return NE; + case NE: + return EQ; + case LT: + return GE; + case LE: + return GT; + case GT: + return LE; + case GE: + return LT; + case BT: + return AE; + case BE: + return AT; + case AT: + return BE; + case AE: + return BT; } throw new IllegalArgumentException(this.toString()); } @@ -188,42 +240,64 @@ return true; } switch (this) { - case EQ: return other == LE || other == GE || other == BE || other == AE; - case NE: return false; - case LT: return other == LE || other == NE; - case LE: return false; - case GT: return other == GE || other == NE; - case GE: return false; - case BT: return other == BE || other == NE; - case BE: return false; - case AT: return other == AE || other == NE; - case AE: return false; + case EQ: + return other == LE || other == GE || other == BE || other == AE; + case NE: + return false; + case LT: + return other == LE || other == NE; + case LE: + return false; + case GT: + return other == GE || other == NE; + case GE: + return false; + case BT: + return other == BE || other == NE; + case BE: + return false; + case AT: + return other == AE || other == NE; + case AE: + return false; } throw new IllegalArgumentException(this.toString()); } /** * Mirror this conditional (i.e. commute "a op b" to "b op' a") + * * @return the condition representing the equivalent commuted operation */ public final Condition mirror() { switch (this) { - case EQ: return EQ; - case NE: return NE; - case LT: return GT; - case LE: return GE; - case GT: return LT; - case GE: return LE; - case BT: return AT; - case BE: return AE; - case AT: return BT; - case AE: return BE; + case EQ: + return EQ; + case NE: + return NE; + case LT: + return GT; + case LE: + return GE; + case GT: + return LT; + case GE: + return LE; + case BT: + return AT; + case BE: + return AE; + case AT: + return BT; + case AE: + return BE; } throw new IllegalArgumentException(); } /** - * Returns true if this condition represents an unsigned comparison. EQ and NE are not considered to be unsigned. + * Returns true if this condition represents an unsigned comparison. EQ and NE are not + * considered to be unsigned. */ public final boolean isUnsigned() { return this == Condition.BT || this == Condition.BE || this == Condition.AT || this == Condition.AE; @@ -231,6 +305,7 @@ /** * Checks if this conditional operation is commutative. + * * @return {@code true} if this operation is commutative */ public final boolean isCommutative() { @@ -239,12 +314,12 @@ /** * Attempts to fold a comparison between two constants and return the result. - * + * * @param lt the constant on the left side of the comparison * @param rt the constant on the right side of the comparison * @param runtime needed to compare runtime-specific types - * @return {@link Boolean#TRUE} if the comparison is known to be true, - * {@link Boolean#FALSE} if the comparison is known to be false + * @return {@link Boolean#TRUE} if the comparison is known to be true, {@link Boolean#FALSE} if + * the comparison is known to be false */ public boolean foldCondition(Constant lt, Constant rt, CodeCacheProvider runtime) { assert lt.getKind() != Kind.Double && lt.getKind() != Kind.Float && rt.getKind() != Kind.Double && rt.getKind() != Kind.Float; @@ -253,12 +328,13 @@ /** * Attempts to fold a comparison between two constants and return the result. - * + * * @param lt the constant on the left side of the comparison * @param rt the constant on the right side of the comparison * @param runtime needed to compare runtime-specific types * @param unorderedIsTrue true if an undecided float comparison should result in "true" - * @return true if the comparison is known to be true, false if the comparison is known to be false + * @return true if the comparison is known to be true, false if the comparison is known to be + * false */ public boolean foldCondition(Constant lt, Constant rt, MetaAccessProvider runtime, boolean unorderedIsTrue) { switch (lt.getKind()) { @@ -271,41 +347,66 @@ int x = lt.asInt(); int y = rt.asInt(); switch (this) { - case EQ: return x == y; - case NE: return x != y; - case LT: return x < y; - case LE: return x <= y; - case GT: return x > y; - case GE: return x >= y; - case AE: return UnsignedMath.aboveOrEqual(x, y); - case BE: return UnsignedMath.belowOrEqual(x, y); - case AT: return UnsignedMath.aboveThan(x, y); - case BT: return UnsignedMath.belowThan(x, y); - default: throw new GraalInternalError("expected condition: %s", this); + case EQ: + return x == y; + case NE: + return x != y; + case LT: + return x < y; + case LE: + return x <= y; + case GT: + return x > y; + case GE: + return x >= y; + case AE: + return UnsignedMath.aboveOrEqual(x, y); + case BE: + return UnsignedMath.belowOrEqual(x, y); + case AT: + return UnsignedMath.aboveThan(x, y); + case BT: + return UnsignedMath.belowThan(x, y); + default: + throw new GraalInternalError("expected condition: %s", this); } } case Long: { long x = lt.asLong(); long y = rt.asLong(); switch (this) { - case EQ: return x == y; - case NE: return x != y; - case LT: return x < y; - case LE: return x <= y; - case GT: return x > y; - case GE: return x >= y; - case AE: return UnsignedMath.aboveOrEqual(x, y); - case BE: return UnsignedMath.belowOrEqual(x, y); - case AT: return UnsignedMath.aboveThan(x, y); - case BT: return UnsignedMath.belowThan(x, y); - default: throw new GraalInternalError("expected condition: %s", this); + case EQ: + return x == y; + case NE: + return x != y; + case LT: + return x < y; + case LE: + return x <= y; + case GT: + return x > y; + case GE: + return x >= y; + case AE: + return UnsignedMath.aboveOrEqual(x, y); + case BE: + return UnsignedMath.belowOrEqual(x, y); + case AT: + return UnsignedMath.aboveThan(x, y); + case BT: + return UnsignedMath.belowThan(x, y); + default: + throw new GraalInternalError("expected condition: %s", this); } } case Object: { switch (this) { - case EQ: return runtime.constantEquals(lt, rt); - case NE: return !runtime.constantEquals(lt, rt); - default: throw new GraalInternalError("expected condition: %s", this); + case EQ: + return runtime.constantEquals(lt, rt); + case NE: + return !runtime.constantEquals(lt, rt); + default: + throw new GraalInternalError("expected condition: %s", this); } } case Float: { @@ -315,13 +416,20 @@ return unorderedIsTrue; } switch (this) { - case EQ: return x == y; - case NE: return x != y; - case LT: return x < y; - case LE: return x <= y; - case GT: return x > y; - case GE: return x >= y; - default: throw new GraalInternalError("expected condition: %s", this); + case EQ: + return x == y; + case NE: + return x != y; + case LT: + return x < y; + case LE: + return x <= y; + case GT: + return x > y; + case GE: + return x >= y; + default: + throw new GraalInternalError("expected condition: %s", this); } } case Double: { @@ -331,16 +439,24 @@ return unorderedIsTrue; } switch (this) { - case EQ: return x == y; - case NE: return x != y; - case LT: return x < y; - case LE: return x <= y; - case GT: return x > y; - case GE: return x >= y; - default: throw new GraalInternalError("expected condition: %s", this); + case EQ: + return x == y; + case NE: + return x != y; + case LT: + return x < y; + case LE: + return x <= y; + case GT: + return x > y; + case GE: + return x >= y; + default: + throw new GraalInternalError("expected condition: %s", this); } } - default: throw new GraalInternalError("expected value kind %s while folding condition: %s", lt.getKind(), this); + default: + throw new GraalInternalError("expected value kind %s while folding condition: %s", lt.getKind(), this); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,8 +27,8 @@ import com.oracle.graal.nodes.spi.*; /** - * The {@code ConditionalNode} class represents a comparison that yields one of two values. Note that these nodes are not - * built directly from the bytecode but are introduced by canonicalization. + * The {@code ConditionalNode} class represents a comparison that yields one of two values. Note + * that these nodes are not built directly from the bytecode but are introduced by canonicalization. */ public class ConditionalNode extends BinaryNode implements Canonicalizable, LIRLowerable, Negatable { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -35,26 +35,9 @@ public final class ConvertNode extends FloatingNode implements Canonicalizable, LIRLowerable { public enum Op { - I2L(Int, Long), - L2I(Long, Int), - I2B(Int, Byte), - I2C(Int, Char), - I2S(Int, Short), - F2D(Float, Double), - D2F(Double, Float), - I2F(Int, Float), - I2D(Int, Double), - F2I(Float, Int), - D2I(Double, Int), - L2F(Long, Float), - L2D(Long, Double), - F2L(Float, Long), - D2L(Double, Long), - UNSIGNED_I2L(Int, Long), - MOV_I2F(Int, Float), - MOV_L2D(Long, Double), - MOV_F2I(Float, Int), - MOV_D2L(Double, Long); + I2L(Int, Long), L2I(Long, Int), I2B(Int, Byte), I2C(Int, Char), I2S(Int, Short), F2D(Float, Double), D2F(Double, Float), I2F(Int, Float), I2D(Int, Double), F2I(Float, Int), D2I(Double, Int), L2F( + Long, Float), L2D(Long, Double), F2L(Float, Long), D2L(Double, Long), UNSIGNED_I2L(Int, Long), MOV_I2F(Int, Float), MOV_L2D(Long, Double), MOV_F2I(Float, Int), MOV_D2L(Double, + Long); public final Kind from; public final Kind to; @@ -75,6 +58,7 @@ /** * Constructs a new Convert instance. + * * @param opcode the operation * @param value the instruction producing the input value */ @@ -90,26 +74,46 @@ if (value instanceof ConstantNode) { Constant c = ((ConstantNode) value).asConstant(); switch (opcode) { - case I2L: return ConstantNode.forLong(c.asInt(), graph()); - case L2I: return ConstantNode.forInt((int) c.asLong(), graph()); - case I2B: return ConstantNode.forByte((byte) c.asInt(), graph()); - case I2C: return ConstantNode.forChar((char) c.asInt(), graph()); - case I2S: return ConstantNode.forShort((short) c.asInt(), graph()); - case F2D: return ConstantNode.forDouble(c.asFloat(), graph()); - case D2F: return ConstantNode.forFloat((float) c.asDouble(), graph()); - case I2F: return ConstantNode.forFloat(c.asInt(), graph()); - case I2D: return ConstantNode.forDouble(c.asInt(), graph()); - case F2I: return ConstantNode.forInt((int) c.asFloat(), graph()); - case D2I: return ConstantNode.forInt((int) c.asDouble(), graph()); - case L2F: return ConstantNode.forFloat(c.asLong(), graph()); - case L2D: return ConstantNode.forDouble(c.asLong(), graph()); - case F2L: return ConstantNode.forLong((long) c.asFloat(), graph()); - case D2L: return ConstantNode.forLong((long) c.asDouble(), graph()); - case UNSIGNED_I2L: return ConstantNode.forLong(c.asInt() & 0xffffffffL, graph()); - case MOV_I2F: return ConstantNode.forFloat(java.lang.Float.intBitsToFloat(c.asInt()), graph()); - case MOV_L2D: return ConstantNode.forDouble(java.lang.Double.longBitsToDouble(c.asLong()), graph()); - case MOV_F2I: return ConstantNode.forInt(java.lang.Float.floatToRawIntBits(c.asFloat()), graph()); - case MOV_D2L: return ConstantNode.forLong(java.lang.Double.doubleToRawLongBits(c.asDouble()), graph()); + case I2L: + return ConstantNode.forLong(c.asInt(), graph()); + case L2I: + return ConstantNode.forInt((int) c.asLong(), graph()); + case I2B: + return ConstantNode.forByte((byte) c.asInt(), graph()); + case I2C: + return ConstantNode.forChar((char) c.asInt(), graph()); + case I2S: + return ConstantNode.forShort((short) c.asInt(), graph()); + case F2D: + return ConstantNode.forDouble(c.asFloat(), graph()); + case D2F: + return ConstantNode.forFloat((float) c.asDouble(), graph()); + case I2F: + return ConstantNode.forFloat(c.asInt(), graph()); + case I2D: + return ConstantNode.forDouble(c.asInt(), graph()); + case F2I: + return ConstantNode.forInt((int) c.asFloat(), graph()); + case D2I: + return ConstantNode.forInt((int) c.asDouble(), graph()); + case L2F: + return ConstantNode.forFloat(c.asLong(), graph()); + case L2D: + return ConstantNode.forDouble(c.asLong(), graph()); + case F2L: + return ConstantNode.forLong((long) c.asFloat(), graph()); + case D2L: + return ConstantNode.forLong((long) c.asDouble(), graph()); + case UNSIGNED_I2L: + return ConstantNode.forLong(c.asInt() & 0xffffffffL, graph()); + case MOV_I2F: + return ConstantNode.forFloat(java.lang.Float.intBitsToFloat(c.asInt()), graph()); + case MOV_L2D: + return ConstantNode.forDouble(java.lang.Double.longBitsToDouble(c.asLong()), graph()); + case MOV_F2I: + return ConstantNode.forInt(java.lang.Float.floatToRawIntBits(c.asFloat()), graph()); + case MOV_D2L: + return ConstantNode.forLong(java.lang.Double.doubleToRawLongBits(c.asDouble()), graph()); } } return this; @@ -119,12 +123,23 @@ public boolean inferStamp() { Stamp newStamp; switch (opcode) { - case I2L: newStamp = StampTool.intToLong(value().integerStamp()); break; - case L2I: newStamp = StampTool.longToInt(value().integerStamp()); break; - case I2B: newStamp = StampTool.intToByte(value().integerStamp()); break; - case I2C: newStamp = StampTool.intToChar(value().integerStamp()); break; - case I2S: newStamp = StampTool.intToShort(value().integerStamp()); break; - default: return false; + case I2L: + newStamp = StampTool.intToLong(value().integerStamp()); + break; + case L2I: + newStamp = StampTool.longToInt(value().integerStamp()); + break; + case I2B: + newStamp = StampTool.intToByte(value().integerStamp()); + break; + case I2C: + newStamp = StampTool.intToChar(value().integerStamp()); + break; + case I2S: + newStamp = StampTool.intToShort(value().integerStamp()); + break; + default: + return false; } return updateStamp(newStamp); } @@ -135,5 +150,6 @@ } @NodeIntrinsic - public static native S convert(@ConstantNodeParameter Op op, T value); + public static native S convert(@ConstantNodeParameter + Op op, T value); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,7 +31,7 @@ /** * Constructs a new floating point equality comparison node. - * + * * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatLessThanNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatLessThanNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatLessThanNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,10 +34,11 @@ /** * Constructs a new floating point comparison node. - * + * * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction - * @param unorderedIsTrue whether a comparison that is undecided (involving NaNs, etc.) leads to a "true" result + * @param unorderedIsTrue whether a comparison that is undecided (involving NaNs, etc.) leads to + * a "true" result */ public FloatLessThanNode(ValueNode x, ValueNode y, boolean unorderedIsTrue) { super(x, y); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,7 +26,6 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; - public abstract class IntegerArithmeticNode extends ArithmeticNode { public IntegerArithmeticNode(Kind kind, ValueNode x, ValueNode y) { @@ -37,7 +36,7 @@ public static IntegerAddNode add(ValueNode v1, ValueNode v2) { assert v1.kind() == v2.kind() && v1.graph() == v2.graph(); Graph graph = v1.graph(); - switch(v1.kind()) { + switch (v1.kind()) { case Int: return graph.unique(new IntegerAddNode(Kind.Int, v1, v2)); case Long: @@ -50,7 +49,7 @@ public static IntegerMulNode mul(ValueNode v1, ValueNode v2) { assert v1.kind() == v2.kind() && v1.graph() == v2.graph(); Graph graph = v1.graph(); - switch(v1.kind()) { + switch (v1.kind()) { case Int: return graph.unique(new IntegerMulNode(Kind.Int, v1, v2)); case Long: @@ -63,7 +62,7 @@ public static IntegerSubNode sub(ValueNode v1, ValueNode v2) { assert v1.kind() == v2.kind() && v1.graph() == v2.graph(); Graph graph = v1.graph(); - switch(v1.kind()) { + switch (v1.kind()) { case Int: return graph.unique(new IntegerSubNode(Kind.Int, v1, v2)); case Long: diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowThanNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowThanNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowThanNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,7 +33,7 @@ /** * Constructs a new unsigned integer comparison node. - * + * * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,7 +32,7 @@ /** * Constructs a new integer equality comparison node. - * + * * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,7 +33,7 @@ /** * Constructs a new integer comparison node. - * + * * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -74,7 +74,7 @@ if (c == 0) { return graph().unique(new NegateNode(y())); } - return BinaryNode.reassociate(this, ValueNode.isConstantPredicate()); + return BinaryNode.reassociate(this, ValueNode.isConstantPredicate()); } return this; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -40,7 +40,7 @@ /** * Constructs a new IsNullNode instruction. - * + * * @param object the instruction producing the object to check against null */ public IsNullNode(ValueNode object) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LogicNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LogicNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LogicNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,6 +33,7 @@ /** * Constructs a new logic operation node. + * * @param x the first input into this node * @param y the second input into this node */ @@ -44,7 +45,7 @@ public static LogicNode and(ValueNode v1, ValueNode v2) { assert v1.kind() == v2.kind() && v1.graph() == v2.graph(); Graph graph = v1.graph(); - switch(v1.kind()) { + switch (v1.kind()) { case Int: return graph.unique(new AndNode(Kind.Int, v1, v2)); case Long: @@ -57,7 +58,7 @@ public static LogicNode or(ValueNode v1, ValueNode v2) { assert v1.kind() == v2.kind() && v1.graph() == v2.graph(); Graph graph = v1.graph(); - switch(v1.kind()) { + switch (v1.kind()) { case Int: return graph.unique(new OrNode(Kind.Int, v1, v2)); case Long: @@ -70,7 +71,7 @@ public static LogicNode xor(ValueNode v1, ValueNode v2) { assert v1.kind() == v2.kind() && v1.graph() == v2.graph(); Graph graph = v1.graph(); - switch(v1.kind()) { + switch (v1.kind()) { case Int: return graph.unique(new XorNode(Kind.Int, v1, v2)); case Long: diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NegateNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NegateNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NegateNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -44,7 +44,7 @@ /** * Creates new NegateNode instance. - * + * * @param x the instruction producing the value that is input to this instruction */ public NegateNode(ValueNode x) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,17 +27,20 @@ import com.oracle.graal.nodes.spi.*; /** - * Returns -1, 0, or 1 if either x < y, x == y, or x > y. If the comparison is undecided (one of the inputs is NaN), the - * result is 1 if isUnorderedLess is false and -1 if isUnorderedLess is true. + * Returns -1, 0, or 1 if either x < y, x == y, or x > y. If the comparison is undecided (one of the + * inputs is NaN), the result is 1 if isUnorderedLess is false and -1 if isUnorderedLess is true. */ public final class NormalizeCompareNode extends BinaryNode implements Lowerable { + public final boolean isUnorderedLess; /** * Creates a new compare operation. + * * @param x the first input * @param y the second input - * @param isUnorderedLess true when an unordered floating point comparison is interpreted as less, false when greater. + * @param isUnorderedLess true when an unordered floating point comparison is interpreted as + * less, false when greater. */ public NormalizeCompareNode(ValueNode x, ValueNode y, boolean isUnorderedLess) { super(Kind.Int, x, y); @@ -59,7 +62,7 @@ } MaterializeNode equalValue = MaterializeNode.create(equalComp, ConstantNode.forInt(0, graph), ConstantNode.forInt(1, graph)); - MaterializeNode value = MaterializeNode.create(lessComp, ConstantNode.forInt(-1, graph), equalValue); + MaterializeNode value = MaterializeNode.create(lessComp, ConstantNode.forInt(-1, graph), equalValue); graph.replaceFloating(this, value); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,7 +32,7 @@ /** * Constructs a new object equality comparison node. - * + * * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ShiftNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ShiftNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ShiftNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,6 +32,7 @@ /** * Creates a new shift operation. + * * @param x the first input value * @param s the second input value */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java Wed Jan 23 16:34:57 2013 +0100 @@ -126,6 +126,7 @@ } private class NodeIterator implements Iterator { + private FixedNode cur; public NodeIterator() { @@ -157,6 +158,7 @@ public Iterable getNodes() { return new Iterable() { + @Override public Iterator iterator() { return new NodeIterator(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/BlockMap.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/BlockMap.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/BlockMap.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,6 +23,7 @@ package com.oracle.graal.nodes.cfg; public class BlockMap { + private final T[] data; @SuppressWarnings("unchecked") diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/CFGVerifier.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/CFGVerifier.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/CFGVerifier.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,6 +23,7 @@ package com.oracle.graal.nodes.cfg; public class CFGVerifier { + public static boolean verify(ControlFlowGraph cfg) { for (Block block : cfg.getBlocks()) { assert block.getId() >= 0; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java Wed Jan 23 16:34:57 2013 +0100 @@ -36,7 +36,6 @@ private Block[] reversePostOrder; private Loop[] loops; - public static ControlFlowGraph compute(StructuredGraph graph, boolean connectBlocks, boolean computeLoops, boolean computeDominators, boolean computePostdominators) { ControlFlowGraph cfg = new ControlFlowGraph(graph); cfg.identifyBlocks(); @@ -71,10 +70,13 @@ public Iterable postOrder() { return new Iterable() { + @Override public Iterator iterator() { return new Iterator() { + private int nextIndex = reversePostOrder.length - 1; + @Override public boolean hasNext() { return nextIndex >= 0; @@ -156,7 +158,8 @@ } block.id = BLOCK_ID_VISITED; } else if (block.id == BLOCK_ID_VISITED) { - // Second time we see this block: All successors have been processed, so add block to postorder list. + // Second time we see this block: All successors have been processed, so add block + // to postorder list. stack.remove(stack.size() - 1); postOrder.add(block); } else { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AbstractCallNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AbstractCallNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AbstractCallNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,8 +28,7 @@ public abstract class AbstractCallNode extends AbstractStateSplit implements StateSplit, MemoryCheckpoint { - @Input - protected final NodeInputList arguments; + @Input protected final NodeInputList arguments; public AbstractCallNode(Stamp stamp, ValueNode[] arguments) { super(stamp); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AccessNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AccessNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AccessNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,9 +27,8 @@ import com.oracle.graal.nodes.type.*; /** - * Accesses a value at an memory address specified by an {@linkplain #object object} - * and a {@linkplain #location() location}. The access does not include a null check - * on the object. + * Accesses a value at an memory address specified by an {@linkplain #object object} and a + * {@linkplain #location() location}. The access does not include a null check on the object. */ public abstract class AccessNode extends FixedWithNextNode implements Access { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,7 +30,6 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; - public final class BoxNode extends AbstractStateSplit implements StateSplit, Node.IterableNodeType, Canonicalizable { @Input private ValueNode source; @@ -49,14 +48,14 @@ return source; } - public Kind getSourceKind() { return sourceKind; } public void expand(BoxingMethodPool pool) { ResolvedJavaMethod boxingMethod = pool.getBoxingMethod(sourceKind); - MethodCallTargetNode callTarget = graph().add(new MethodCallTargetNode(InvokeKind.Static, boxingMethod, new ValueNode[]{source}, boxingMethod.getSignature().getReturnType(boxingMethod.getDeclaringClass()))); + MethodCallTargetNode callTarget = graph().add( + new MethodCallTargetNode(InvokeKind.Static, boxingMethod, new ValueNode[]{source}, boxingMethod.getSignature().getReturnType(boxingMethod.getDeclaringClass()))); InvokeNode invokeNode = graph().add(new InvokeNode(callTarget, bci, -1)); invokeNode.setProbability(this.probability()); invokeNode.setStateAfter(stateAfter()); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,8 +30,8 @@ import com.oracle.graal.nodes.type.*; /** - * A floating read of a value from memory specified in terms of an object base and an object relative location. - * This node does not null check the object. + * A floating read of a value from memory specified in terms of an object base and an object + * relative location. This node does not null check the object. */ public final class FloatingReadNode extends FloatingAccessNode implements Node.IterableNodeType, LIRLowerable, Canonicalizable { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,12 +28,14 @@ import com.oracle.graal.nodes.spi.*; /** - * Extension of a {@linkplain LocationNode location} to include a scaled index or an additional offset. + * Extension of a {@linkplain LocationNode location} to include a scaled index or an additional + * offset. */ public final class IndexedLocationNode extends LocationNode implements Canonicalizable { /** - * An offset or index depending on whether {@link #indexScalingEnabled} is true or false respectively. + * An offset or index depending on whether {@link #indexScalingEnabled} is true or false + * respectively. */ @Input private ValueNode index; private final boolean indexScalingEnabled; @@ -50,7 +52,8 @@ } /** - * @return whether scaling of the index by the value kind's size is enabled (the default) or disabled. + * @return whether scaling of the index by the value kind's size is enabled (the default) or + * disabled. */ public boolean indexScalingEnabled() { return indexScalingEnabled; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,17 +31,17 @@ import com.oracle.graal.nodes.util.*; /** - * The {@code IntegerSwitchNode} represents a switch on integer keys, with a sorted array of key values. - * The actual implementation of the switch will be decided by the backend. + * The {@code IntegerSwitchNode} represents a switch on integer keys, with a sorted array of key + * values. The actual implementation of the switch will be decided by the backend. */ public final class IntegerSwitchNode extends SwitchNode implements LIRLowerable, Simplifiable { private final int[] keys; /** - * Constructs a integer switch instruction. The keyProbabilities and keySuccessors array contain key.length + 1 - * entries, the last entry describes the default (fall through) case. - * + * Constructs a integer switch instruction. The keyProbabilities and keySuccessors array contain + * key.length + 1 entries, the last entry describes the default (fall through) case. + * * @param value the instruction producing the value being switched on * @param successors the list of successors * @param keys the sorted list of keys @@ -56,9 +56,9 @@ } /** - * Constructs a integer switch instruction. The keyProbabilities and keySuccessors array contain key.length + 1 - * entries, the last entry describes the default (fall through) case. - * + * Constructs a integer switch instruction. The keyProbabilities and keySuccessors array contain + * key.length + 1 entries, the last entry describes the default (fall through) case. + * * @param value the instruction producing the value being switched on * @param successorCount the number of successors * @param keys the sorted list of keys @@ -71,6 +71,7 @@ /** * Gets the key at the specified index. + * * @param i the index * @return the key at that index */ @@ -125,7 +126,7 @@ } else if (validKeys != keys.length) { ArrayList newSuccessors = new ArrayList<>(blockSuccessorCount()); int[] newKeys = new int[validKeys]; - int[] newKeySuccessors = new int [validKeys + 1]; + int[] newKeySuccessors = new int[validKeys + 1]; double[] newKeyProbabilities = new double[validKeys + 1]; double totalProbability = 0; int current = 0; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,6 +32,7 @@ * Loads an object's {@linkplain Representation#ObjectHub hub}, null-checking the object first. */ public final class LoadHubNode extends FixedWithNextNode implements Lowerable, Canonicalizable, Virtualizable { + @Input private ValueNode object; public ValueNode object() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,8 +30,8 @@ import com.oracle.graal.nodes.type.*; /** - * A location for a memory access in terms of the kind of value accessed and the displacement - * (in bytes) from a base object or address. + * A location for a memory access in terms of the kind of value accessed and the displacement (in + * bytes) from a base object or address. */ @NodeInfo(nameTemplate = "Loc {p#locationIdentity/s}") public class LocationNode extends FloatingNode implements LIRLowerable, ValueNumberable { @@ -41,10 +41,11 @@ private Object locationIdentity; /** - * Denotes any location. A write to such a location kills all values in a memory map - * during an analysis of memory accesses in a graph. + * Denotes any location. A write to such a location kills all values in a memory map during an + * analysis of memory accesses in a graph. */ public static final Object ANY_LOCATION = new Object() { + @Override public String toString() { return "ANY_LOCATION"; @@ -55,6 +56,7 @@ * Denotes the location of a value that is guaranteed to be final. */ public static final Object FINAL_LOCATION = new Object() { + @Override public String toString() { return "FINAL_LOCATION"; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MembarNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MembarNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MembarNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -48,5 +48,6 @@ } @NodeIntrinsic - public static native void memoryBarrier(@ConstantNodeParameter int barriers); + public static native void memoryBarrier(@ConstantNodeParameter + int barriers); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MemoryCheckpoint.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MemoryCheckpoint.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MemoryCheckpoint.java Wed Jan 23 16:34:57 2013 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.nodes.extended; - public interface MemoryCheckpoint { } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MonitorEnter.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MonitorEnter.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MonitorEnter.java Wed Jan 23 16:34:57 2013 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.nodes.extended; - /** * Denotes monitor locking transition. */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MonitorExit.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MonitorExit.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MonitorExit.java Wed Jan 23 16:34:57 2013 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.nodes.extended; - /** * Denotes monitor unlocking transition. */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -43,7 +43,8 @@ } private ReadNode(ValueNode object, ValueNode location) { - // Used by node intrinsics. Since the initial value for location is a parameter, i.e., a LocalNode, the + // Used by node intrinsics. Since the initial value for location is a parameter, i.e., a + // LocalNode, the // constructor cannot use the declared type LocationNode this(object, location, StampFactory.forNodeIntrinsic()); } @@ -60,7 +61,7 @@ /** * Utility function for reading a value of this kind using a base address and a displacement. - * + * * @param base the base address from which the value is read * @param displacement the displacement within the object in bytes * @return the read value encapsulated in a {@link Constant} object @@ -92,7 +93,12 @@ public static ValueNode canonicalizeRead(Access read, CanonicalizerTool tool) { MetaAccessProvider runtime = tool.runtime(); - if (runtime != null && read.object() != null && read.object().isConstant()/* && read.object().kind() == Kind.Object*/) { + if (runtime != null && read.object() != null && read.object().isConstant()/* + * && + * read.object() + * .kind() == + * Kind.Object + */) { if (read.location().locationIdentity() == LocationNode.FINAL_LOCATION && read.location().getClass() == LocationNode.class) { long displacement = read.location().displacement(); Kind kind = read.location().getValueKind(); @@ -116,7 +122,7 @@ /** * Reads a value from memory. - * + * * @param base the base pointer for the memory access * @param displacement the displacement of the access * @param locationIdentity the identity of the access @@ -124,5 +130,8 @@ * @return the value read from memory */ @NodeIntrinsic(setStampFromReturnType = true) - public static native T read(Object base, @ConstantNodeParameter int displacement, @ConstantNodeParameter Object locationIdentity, @ConstantNodeParameter Kind kind); + public static native T read(Object base, @ConstantNodeParameter + int displacement, @ConstantNodeParameter + Object locationIdentity, @ConstantNodeParameter + Kind kind); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeAccessNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeAccessNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeAccessNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,8 +26,8 @@ import com.oracle.graal.nodes.type.*; /** - * An analog to {@link AccessNode} with the additional semantics of null-checking - * the receiver object before the access. + * An analog to {@link AccessNode} with the additional semantics of null-checking the receiver + * object before the access. */ public abstract class SafeAccessNode extends FixedWithNextNode { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeReadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeReadNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeReadNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,8 +27,8 @@ import com.oracle.graal.nodes.type.*; /** - * An analog to {@link ReadNode} with the additional semantics of null-checking - * the receiver object before reading from it. + * An analog to {@link ReadNode} with the additional semantics of null-checking the receiver object + * before reading from it. */ public class SafeReadNode extends SafeAccessNode implements Lowerable { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeWriteNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeWriteNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeWriteNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,8 +27,8 @@ import com.oracle.graal.nodes.type.*; /** - * An analog to {@link WriteNode} with the additional semantics of null-checking - * the receiver object before writing to it. + * An analog to {@link WriteNode} with the additional semantics of null-checking the receiver object + * before writing to it. */ public class SafeWriteNode extends SafeAccessNode implements StateSplit, Lowerable { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,6 +33,7 @@ * The {@code SwitchNode} class is the base of both lookup and table switches. */ public abstract class SwitchNode extends ControlSplitNode { + @Successor protected final NodeSuccessorList successors; protected double[] successorProbabilities; @Input private ValueNode value; @@ -41,6 +42,7 @@ /** * Constructs a new Switch. + * * @param value the instruction that provides the value to be switched over * @param successors the list of successors of this switch */ @@ -121,6 +123,7 @@ /** * Gets the successor corresponding to the default (fall through) case. + * * @return the default successor */ public BeginNode defaultSuccessor() { @@ -132,6 +135,7 @@ /** * Helper function that sums up the probabilities of all keys that lead to a specific successor. + * * @return an array of size successorCount with the accumulated probability for each successor. */ public static double[] successorProbabilites(int successorCount, int[] keySuccessors, double[] keyProbabilities) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,7 +29,6 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; - public final class UnboxNode extends FixedWithNextNode implements Node.IterableNodeType, Canonicalizable { @Input private ValueNode source; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeAccessNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeAccessNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeAccessNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,8 +26,8 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.type.*; +public abstract class UnsafeAccessNode extends FixedWithNextNode { -public abstract class UnsafeAccessNode extends FixedWithNextNode { @Input private ValueNode object; @Input private ValueNode offset; private final int displacement; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeArrayCastNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeArrayCastNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeArrayCastNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,8 +31,7 @@ */ public final class UnsafeArrayCastNode extends UnsafeCastNode implements ArrayLengthProvider { - @Input - private ValueNode length; + @Input private ValueNode length; public ValueNode length() { return length; @@ -52,5 +51,6 @@ } @NodeIntrinsic - public static native T unsafeArrayCast(Object object, int length, @ConstantNodeParameter Stamp stamp); + public static native T unsafeArrayCast(Object object, int length, @ConstantNodeParameter + Stamp stamp); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,8 +33,7 @@ */ public class UnsafeCastNode extends FloatingNode implements Canonicalizable, LIRLowerable { - @Input - private ValueNode object; + @Input private ValueNode object; public ValueNode object() { return object; @@ -55,7 +54,8 @@ return false; } if (object().objectStamp().alwaysNull() && objectStamp().nonNull()) { - // a null value flowing into a nonNull UnsafeCastNode should be guarded by a type/isNull guard, but the + // a null value flowing into a nonNull UnsafeCastNode should be guarded by a type/isNull + // guard, but the // compiler might see this situation before the branch is deleted return false; } @@ -96,15 +96,20 @@ generator.emitMove(generator.operand(object), result); generator.setResult(this, result); } else { - // The LIR only cares about the kind of an operand, not the actual type of an object. So we do not have to + // The LIR only cares about the kind of an operand, not the actual type of an object. So + // we do not have to // introduce a new operand when the kind is the same. generator.setResult(this, generator.operand(object)); } } @NodeIntrinsic - public static native T unsafeCast(Object object, @ConstantNodeParameter Stamp stamp); + public static native T unsafeCast(Object object, @ConstantNodeParameter + Stamp stamp); @NodeIntrinsic - public static native T unsafeCast(Object object, @ConstantNodeParameter Class toType, @ConstantNodeParameter boolean exactType, @ConstantNodeParameter boolean nonNull); + public static native T unsafeCast(Object object, @ConstantNodeParameter + Class toType, @ConstantNodeParameter + boolean exactType, @ConstantNodeParameter + boolean nonNull); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,8 +30,8 @@ import com.oracle.graal.nodes.type.*; /** - * Load of a value from a location specified as an offset relative to an object. - * No null check is performed before the load. + * Load of a value from a location specified as an offset relative to an object. No null check is + * performed before the load. */ public class UnsafeLoadNode extends UnsafeAccessNode implements Lowerable, Virtualizable, Canonicalizable { @@ -77,7 +77,9 @@ Graph graph = this.graph(); return graph.add(new UnsafeLoadNode(this.stamp(), object(), intDisplacement, graph.unique(ConstantNode.forInt(0, graph)), accessKind())); } - } else if (object().stamp() instanceof ObjectStamp) { // TODO (gd) remove that once UnsafeAccess only have an object base + } else if (object().stamp() instanceof ObjectStamp) { // TODO (gd) remove that once + // UnsafeAccess only have an + // object base ObjectStamp receiverStamp = object().objectStamp(); if (receiverStamp.nonNull()) { ResolvedJavaType receiverType = receiverStamp.type(); @@ -92,5 +94,7 @@ } @NodeIntrinsic - public static native T load(Object object, @ConstantNodeParameter int displacement, long offset, @ConstantNodeParameter Kind kind); + public static native T load(Object object, @ConstantNodeParameter + int displacement, long offset, @ConstantNodeParameter + Kind kind); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,8 +30,8 @@ import com.oracle.graal.nodes.type.*; /** - * Store of a value at a location specified as an offset relative to an object. - * No null check is performed before the store. + * Store of a value at a location specified as an offset relative to an object. No null check is + * performed before the store. */ public class UnsafeStoreNode extends UnsafeAccessNode implements StateSplit, Lowerable, Virtualizable, Canonicalizable { @@ -97,7 +97,9 @@ Graph graph = this.graph(); return graph.add(new UnsafeStoreNode(this.stamp(), object(), intDisplacement, graph.unique(ConstantNode.forInt(0, graph)), value(), accessKind())); } - } else if (object().stamp() instanceof ObjectStamp) { // TODO (gd) remove that once UnsafeAccess only have an object base + } else if (object().stamp() instanceof ObjectStamp) { // TODO (gd) remove that once + // UnsafeAccess only have an + // object base ObjectStamp receiverStamp = object().objectStamp(); if (receiverStamp.nonNull()) { ResolvedJavaType receiverType = receiverStamp.type(); @@ -113,30 +115,48 @@ // specialized on value type until boxing/unboxing is sorted out in intrinsification @NodeIntrinsic - public static native void store(Object object, @ConstantNodeParameter int displacement, long offset, Object value, @ConstantNodeParameter Kind kind); + public static native void store(Object object, @ConstantNodeParameter + int displacement, long offset, Object value, @ConstantNodeParameter + Kind kind); @NodeIntrinsic - public static native void store(Object object, @ConstantNodeParameter int displacement, long offset, boolean value, @ConstantNodeParameter Kind kind); + public static native void store(Object object, @ConstantNodeParameter + int displacement, long offset, boolean value, @ConstantNodeParameter + Kind kind); @NodeIntrinsic - public static native void store(Object object, @ConstantNodeParameter int displacement, long offset, byte value, @ConstantNodeParameter Kind kind); + public static native void store(Object object, @ConstantNodeParameter + int displacement, long offset, byte value, @ConstantNodeParameter + Kind kind); @NodeIntrinsic - public static native void store(Object object, @ConstantNodeParameter int displacement, long offset, char value, @ConstantNodeParameter Kind kind); + public static native void store(Object object, @ConstantNodeParameter + int displacement, long offset, char value, @ConstantNodeParameter + Kind kind); @NodeIntrinsic - public static native void store(Object object, @ConstantNodeParameter int displacement, long offset, double value, @ConstantNodeParameter Kind kind); + public static native void store(Object object, @ConstantNodeParameter + int displacement, long offset, double value, @ConstantNodeParameter + Kind kind); @NodeIntrinsic - public static native void store(Object object, @ConstantNodeParameter int displacement, long offset, float value, @ConstantNodeParameter Kind kind); + public static native void store(Object object, @ConstantNodeParameter + int displacement, long offset, float value, @ConstantNodeParameter + Kind kind); @NodeIntrinsic - public static native void store(Object object, @ConstantNodeParameter int displacement, long offset, int value, @ConstantNodeParameter Kind kind); + public static native void store(Object object, @ConstantNodeParameter + int displacement, long offset, int value, @ConstantNodeParameter + Kind kind); @NodeIntrinsic - public static native void store(Object object, @ConstantNodeParameter int displacement, long offset, long value, @ConstantNodeParameter Kind kind); + public static native void store(Object object, @ConstantNodeParameter + int displacement, long offset, long value, @ConstantNodeParameter + Kind kind); @NodeIntrinsic - public static native void store(Object object, @ConstantNodeParameter int displacement, long offset, short value, @ConstantNodeParameter Kind kind); + public static native void store(Object object, @ConstantNodeParameter + int displacement, long offset, short value, @ConstantNodeParameter + Kind kind); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteMemoryCheckpointNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteMemoryCheckpointNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteMemoryCheckpointNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,7 +26,6 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; - public final class WriteMemoryCheckpointNode extends AbstractStateSplit implements StateSplit, LIRLowerable, MemoryCheckpoint { public WriteMemoryCheckpointNode() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,11 +26,11 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; - /** * Writes a given {@linkplain #value() value} a {@linkplain AccessNode memory location}. */ public final class WriteNode extends AccessNode implements StateSplit, LIRLowerable { + @Input private ValueNode value; @Input(notDataflow = true) private FrameState stateAfter; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessArrayNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessArrayNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -38,6 +38,7 @@ /** * Creates a new AccessArrayNode. + * * @param array the instruction that produces the array object value */ public AccessArrayNode(Stamp stamp, ValueNode array) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -45,6 +45,7 @@ /** * Constructs a new access field object. + * * @param object the instruction producing the receiver object * @param field the compiler interface representation of the field */ @@ -58,6 +59,7 @@ /** * Gets the compiler interface field for this field access. + * * @return the compiler interface field for this field access */ public ResolvedJavaField field() { @@ -70,6 +72,7 @@ /** * Checks whether this field access is an access to a static field. + * * @return {@code true} if this field access is to a static field */ public boolean isStatic() { @@ -78,6 +81,7 @@ /** * Checks whether this field is declared volatile. + * * @return {@code true} if the field is resolved and declared volatile */ public boolean isVolatile() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,8 +28,8 @@ import com.oracle.graal.nodes.type.*; /** - * The {@code AccessIndexedNode} class is the base class of instructions that read or write - * elements of an array. + * The {@code AccessIndexedNode} class is the base class of instructions that read or write elements + * of an array. */ public abstract class AccessIndexedNode extends AccessArrayNode implements Lowerable { @@ -43,6 +43,7 @@ /** * Create an new AccessIndexedNode. + * * @param stamp the result kind of the access * @param array the instruction producing the array * @param index the instruction producing the index @@ -57,6 +58,7 @@ /** * Gets the element type of the array. + * * @return the element type */ public Kind elementKind() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessMonitorNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessMonitorNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessMonitorNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,13 +34,13 @@ *

        * The VM needs information about monitors in the debug information. This information is built from * the nesting level of {@link MonitorEnterNode} when the LIR is constructed. Therefore, monitor - * nodes must not be removed from the graph unless it is guaranteed that the nesting level does not change. - * For example, you must not remove a {@link MonitorEnterNode} for a thread-local object or for a recursive locking. - * Instead, mark the node as {@link #eliminated}. This makes sure that the meta data still contains the complete - * locking hierarchy. + * nodes must not be removed from the graph unless it is guaranteed that the nesting level does not + * change. For example, you must not remove a {@link MonitorEnterNode} for a thread-local object or + * for a recursive locking. Instead, mark the node as {@link #eliminated}. This makes sure that the + * meta data still contains the complete locking hierarchy. *

        - * The Java bytecode specification allows non-balanced locking. Graal does not handle such cases and throws a - * {@link BailoutException} instead during graph building. + * The Java bytecode specification allows non-balanced locking. Graal does not handle such cases and + * throws a {@link BailoutException} instead during graph building. */ public abstract class AccessMonitorNode extends AbstractStateSplit implements StateSplit, MemoryCheckpoint, Virtualizable { @@ -61,7 +61,7 @@ /** * Creates a new AccessMonitor instruction. - * + * * @param object the instruction producing the object */ public AccessMonitorNode(ValueNode object) { @@ -78,6 +78,7 @@ state.setLockCount(newLockCount); tool.replaceFirstInput(object(), state.getVirtualObject()); tool.customAction(new Runnable() { + @Override public void run() { eliminate(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,8 +28,8 @@ import com.oracle.graal.nodes.type.*; /** - * Implements a type check where the type being checked is loaded at runtime. - * This is used, for instance, to implement an object array store check. + * Implements a type check where the type being checked is loaded at runtime. This is used, for + * instance, to implement an object array store check. */ public final class CheckCastDynamicNode extends FixedWithNextNode implements Canonicalizable, Lowerable, Node.IterableNodeType { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -39,7 +39,7 @@ /** * Creates a new CheckCast instruction. - * + * * @param type the type being cast to * @param object the instruction producing the object */ @@ -71,7 +71,8 @@ if (type != null) { ResolvedJavaType objectType = object().objectStamp().type(); if (objectType != null && type.isAssignableFrom(objectType)) { - // we don't have to check for null types here because they will also pass the checkcast. + // we don't have to check for null types here because they will also pass the + // checkcast. return object(); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,8 +29,8 @@ import com.oracle.graal.nodes.type.*; /** - * Represents an atomic compare-and-swap operation - * The result is a boolean that contains whether the value matched the expected value. + * Represents an atomic compare-and-swap operation The result is a boolean that contains whether the + * value matched the expected value. */ public class CompareAndSwapNode extends AbstractStateSplit implements StateSplit, LIRLowerable, Lowerable, MemoryCheckpoint { @@ -82,11 +82,14 @@ // specialized on value type until boxing/unboxing is sorted out in intrinsification @NodeIntrinsic - public static native boolean compareAndSwap(Object object, @ConstantNodeParameter int displacement, long offset, Object expected, Object newValue); + public static native boolean compareAndSwap(Object object, @ConstantNodeParameter + int displacement, long offset, Object expected, Object newValue); @NodeIntrinsic - public static native boolean compareAndSwap(Object object, @ConstantNodeParameter int displacement, long offset, long expected, long newValue); + public static native boolean compareAndSwap(Object object, @ConstantNodeParameter + int displacement, long offset, long expected, long newValue); @NodeIntrinsic - public static native boolean compareAndSwap(Object object, @ConstantNodeParameter int displacement, long offset, int expected, int newValue); + public static native boolean compareAndSwap(Object object, @ConstantNodeParameter + int displacement, long offset, int expected, int newValue); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,7 +29,8 @@ import com.oracle.graal.nodes.type.*; /** - * The {@code ExceptionObject} instruction represents the incoming exception object to an exception handler. + * The {@code ExceptionObject} instruction represents the incoming exception object to an exception + * handler. */ public class ExceptionObjectNode extends AbstractStateSplit implements StateSplit, LIRLowerable, MemoryCheckpoint { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,9 +30,9 @@ import com.oracle.graal.nodes.type.*; /** - * The {@code InstanceOfDynamicNode} represents a type check where the type being checked - * is not known at compile time. - * This is used, for instance, to intrinsify {@link Class#isInstance(Object)}. + * The {@code InstanceOfDynamicNode} represents a type check where the type being checked is not + * known at compile time. This is used, for instance, to intrinsify {@link Class#isInstance(Object)} + * . */ public final class InstanceOfDynamicNode extends BooleanNode implements Canonicalizable, Lowerable { @@ -41,8 +41,9 @@ /** * Constructs a new InstanceOfNode. - * - * @param mirror the {@link Class} value representing the target target type of the instanceof check + * + * @param mirror the {@link Class} value representing the target target type of the instanceof + * check * @param object the object being tested by the instanceof */ public InstanceOfDynamicNode(ValueNode mirror, ValueNode object) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -40,7 +40,7 @@ /** * Constructs a new InstanceOfNode. - * + * * @param type the target type of the instanceof check * @param object the object being tested by the instanceof */ @@ -72,12 +72,14 @@ // the instanceOf matches, so return true return ConstantNode.forBoolean(true, graph()); } else { - // the instanceof matches if the object is non-null, so return true depending on the null-ness. + // the instanceof matches if the object is non-null, so return true depending on + // the null-ness. negateUsages(); return graph().unique(new IsNullNode(object())); } } else { - // since this type check failed for an exact type we know that it can never succeed at run time. + // since this type check failed for an exact type we know that it can never succeed + // at run time. // we also don't care about null values, since they will also make the check fail. return ConstantNode.forBoolean(false, graph()); } @@ -89,12 +91,14 @@ // the instanceOf matches, so return true return ConstantNode.forBoolean(true, graph()); } else { - // the instanceof matches if the object is non-null, so return true depending on the null-ness. + // the instanceof matches if the object is non-null, so return true depending on + // the null-ness. negateUsages(); return graph().unique(new IsNullNode(object())); } } else { - // since the subtype comparison was only performed on a declared type we don't really know if it might be true at run time... + // since the subtype comparison was only performed on a declared type we don't + // really know if it might be true at run time... } } if (object().objectStamp().alwaysNull()) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -37,7 +37,7 @@ /** * Creates a new LoadFieldNode instance. - * + * * @param object the receiver object * @param field the compiler interface field */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -35,6 +35,7 @@ /** * Creates a new LoadIndexedNode. + * * @param array the instruction producing the array * @param index the instruction producing the index * @param elementKind the element type diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,11 +29,9 @@ import com.oracle.graal.nodes.type.*; public class MethodCallTargetNode extends CallTargetNode implements Node.IterableNodeType, Canonicalizable { + public enum InvokeKind { - Interface, - Special, - Static, - Virtual + Interface, Special, Static, Virtual } private final JavaType returnType; @@ -52,6 +50,7 @@ /** * Gets the target method for this invocation instruction. + * * @return the target method */ public ResolvedJavaMethod targetMethod() { @@ -72,8 +71,9 @@ /** * Gets the instruction that produces the receiver object for this invocation, if any. - * @return the instruction that produces the receiver object for this invocation if any, {@code null} if this - * invocation does not take a receiver object + * + * @return the instruction that produces the receiver object for this invocation if any, + * {@code null} if this invocation does not take a receiver object */ public ValueNode receiver() { return isStatic() ? null : arguments().get(0); @@ -81,6 +81,7 @@ /** * Checks whether this is an invocation of a static method. + * * @return {@code true} if the invocation is a static invocation */ public boolean isStatic() { @@ -95,7 +96,6 @@ return (Invoke) this.usages().first(); } - @Override public boolean verify() { assert usages().count() <= 1 : "call target may only be used by a single invoke"; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,7 +33,7 @@ /** * Creates a new MonitorEnterNode. - * + * * @param object the instruction producing the object */ public MonitorEnterNode(ValueNode object) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,7 +34,7 @@ /** * Creates a new MonitorExitNode. - * + * * @param object the instruction produces the object value */ public MonitorExitNode(ValueNode object) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -46,8 +46,9 @@ /** * Constructs a new NewArrayNode. - * - * @param elementType the the type of the elements of the newly created array (not the type of the array itself). + * + * @param elementType the the type of the elements of the newly created array (not the type of + * the array itself). * @param length the node that produces the length for this allocation. * @param fillContents determines whether the array elements should be initialized to zero/null. * @param locked determines whether the array should be locked immediately. @@ -84,7 +85,7 @@ /** * Gets the element type of the array. - * + * * @return the element type of the array */ public ResolvedJavaType elementType() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -41,9 +41,10 @@ /** * Constructs a NewInstanceNode. - * + * * @param type the class being allocated - * @param fillContents determines whether the new object's fields should be initialized to zero/null. + * @param fillContents determines whether the new object's fields should be initialized to + * zero/null. * @param locked determines whether the new object should be locked immediately. */ public NewInstanceNode(ResolvedJavaType type, boolean fillContents, boolean locked) { @@ -55,7 +56,7 @@ /** * Gets the instance class being allocated by this node. - * + * * @return the instance class allocated */ public ResolvedJavaType instanceClass() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,8 +29,7 @@ import com.oracle.graal.nodes.type.*; /** - * The {@code NewMultiArrayNode} represents an allocation of a multi-dimensional object - * array. + * The {@code NewMultiArrayNode} represents an allocation of a multi-dimensional object array. */ public final class NewMultiArrayNode extends FixedWithNextNode implements Lowerable { @@ -51,6 +50,7 @@ /** * Constructs a new NewMultiArrayNode. + * * @param type the element type of the array * @param dimensions the node which produce the dimensions for this array */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewObjectArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewObjectArrayNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewObjectArrayNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,6 +34,7 @@ /** * Constructs a new NewObjectArrayNode. + * * @param elementClass the class of elements in this array * @param length the node producing the length of the array * @param fillContents determines whether the array elements should be initialized to null. diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewPrimitiveArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewPrimitiveArrayNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewPrimitiveArrayNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,6 +34,7 @@ /** * Constructs a new NewPrimitiveArrayNode. + * * @param elementType the type of elements in this array * @param length the node producing the length of the array * @param fillContents determines whether the array elements should be initialized to zero. diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,7 +29,8 @@ import com.oracle.graal.nodes.type.*; /** - * This node is used to perform the finalizer registration at the end of the java.lang.Object constructor. + * This node is used to perform the finalizer registration at the end of the java.lang.Object + * constructor. */ public final class RegisterFinalizerNode extends AbstractStateSplit implements StateSplit, Canonicalizable, LIRLowerable { @@ -60,7 +61,8 @@ if (stamp.isExactType()) { needsCheck = stamp.type().hasFinalizer(); } else if (stamp.type() != null && !stamp.type().hasFinalizableSubclass()) { - // if either the declared type of receiver or the holder can be assumed to have no finalizers + // if either the declared type of receiver or the holder can be assumed to have no + // finalizers if (tool.assumptions().useOptimisticAssumptions() && tool.assumptions().recordNoFinalizableSubclassAssumption(stamp.type())) { needsCheck = false; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreFieldNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreFieldNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreFieldNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -58,6 +58,7 @@ /** * Creates a new StoreFieldNode. + * * @param object the receiver object * @param field the compiler interface field * @param value the node representing the value to store to the field diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -55,6 +55,7 @@ /** * Creates a new StoreIndexedNode. + * * @param array the node producing the array * @param index the node producing the index * @param elementKind the element type diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,8 +33,8 @@ import com.oracle.graal.nodes.util.*; /** - * The {@code TypeSwitchNode} performs a lookup based on the type of the input value. - * The type comparison is an exact type comparison, not an instanceof. + * The {@code TypeSwitchNode} performs a lookup based on the type of the input value. The type + * comparison is an exact type comparison, not an instanceof. */ public final class TypeSwitchNode extends SwitchNode implements LIRLowerable, Simplifiable { @@ -43,7 +43,7 @@ /** * Constructs a type switch instruction. The keyProbabilities array contain key.length + 1 * entries. The last entry in every array describes the default case. - * + * * @param value the instruction producing the value being switched on * @param successors the list of successors * @param keys the list of types @@ -108,7 +108,7 @@ } else if (validKeys != keys.length) { ArrayList newSuccessors = new ArrayList<>(blockSuccessorCount()); ResolvedJavaType[] newKeys = new ResolvedJavaType[validKeys]; - int[] newKeySuccessors = new int [validKeys + 1]; + int[] newKeySuccessors = new int[validKeys + 1]; double[] newKeyProbabilities = new double[validKeys + 1]; double totalProbability = 0; int current = 0; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,10 +26,13 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; +public interface CanonicalizerTool { -public interface CanonicalizerTool { TargetDescription target(); + Assumptions assumptions(); + MetaAccessProvider runtime(); + void removeIfUnused(Node node); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/GraphCache.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/GraphCache.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/GraphCache.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,7 +25,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.*; - public interface GraphCache { void put(StructuredGraph graph); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,82 +30,116 @@ import com.oracle.graal.nodes.java.*; public abstract class LIRGeneratorTool { + public abstract TargetDescription target(); public abstract CodeCacheProvider getRuntime(); /** - * Checks whether the supplied constant can be used without loading it into a register - * for most operations, i.e., for commonly used arithmetic, logical, and comparison operations. + * Checks whether the supplied constant can be used without loading it into a register for most + * operations, i.e., for commonly used arithmetic, logical, and comparison operations. + * * @param c The constant to check. - * @return True if the constant can be used directly, false if the constant needs to be in a register. + * @return True if the constant can be used directly, false if the constant needs to be in a + * register. */ public abstract boolean canInlineConstant(Constant c); /** - * Checks whether the supplied constant can be used without loading it into a register - * for store operations, i.e., on the right hand side of a memory access. + * Checks whether the supplied constant can be used without loading it into a register for store + * operations, i.e., on the right hand side of a memory access. + * * @param c The constant to check. - * @return True if the constant can be used directly, false if the constant needs to be in a register. + * @return True if the constant can be used directly, false if the constant needs to be in a + * register. */ public abstract boolean canStoreConstant(Constant c); public abstract RegisterAttributes attributes(Register register); public abstract Value operand(ValueNode object); + public abstract Value newVariable(Kind kind); + public abstract Value setResult(ValueNode x, Value operand); public abstract Address makeAddress(LocationNode location, ValueNode object); public abstract Value emitMove(Value input); + public abstract void emitMove(Value src, Value dst); + public abstract Value emitLoad(Value loadAddress, boolean canTrap); + public abstract void emitStore(Value storeAddress, Value input, boolean canTrap); + public abstract Value emitLea(Value address); public abstract Value emitNegate(Value input); + public abstract Value emitAdd(Value a, Value b); + public abstract Value emitSub(Value a, Value b); + public abstract Value emitMul(Value a, Value b); + public abstract Value emitDiv(Value a, Value b); + public abstract Value emitRem(Value a, Value b); + public abstract Value emitUDiv(Value a, Value b); + public abstract Value emitURem(Value a, Value b); public abstract Value emitAnd(Value a, Value b); + public abstract Value emitOr(Value a, Value b); + public abstract Value emitXor(Value a, Value b); public abstract Value emitShl(Value a, Value b); + public abstract Value emitShr(Value a, Value b); + public abstract Value emitUShr(Value a, Value b); public abstract Value emitConvert(ConvertNode.Op opcode, Value inputVal); + public abstract void emitMembar(int barriers); + public abstract void emitDeoptimizeOnOverflow(DeoptimizationAction action, DeoptimizationReason reason, Object deoptInfo); + public abstract void emitDeoptimize(DeoptimizationAction action, DeoptimizationReason reason, Object deoptInfo, long leafGraphId); + public abstract Value emitCall(RuntimeCallTarget callTarget, CallingConvention cc, boolean canTrap, Value... args); public abstract void emitIf(IfNode i); + public abstract void emitConditional(ConditionalNode i); + public abstract void emitGuardCheck(BooleanNode comp, DeoptimizationReason deoptReason, DeoptimizationAction deoptAction, boolean negated, long leafGraphId); public abstract void emitSwitch(SwitchNode i); public abstract void emitInvoke(Invoke i); + public abstract void visitRuntimeCall(RuntimeCallNode i); // Handling of block-end nodes still needs to be unified in the LIRGenerator. public abstract void visitMerge(MergeNode i); + public abstract void visitEndNode(EndNode i); + public abstract void visitLoopEnd(LoopEndNode i); public abstract void visitCompareAndSwap(CompareAndSwapNode i); // These methods define the contract a runtime specific backend must provide. public abstract void visitExceptionObject(ExceptionObjectNode i); + public abstract void visitReturn(ReturnNode i); + public abstract void visitSafepointNode(SafepointNode i); + public abstract void visitBreakpointNode(BreakpointNode i); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,10 +29,15 @@ import com.oracle.graal.nodes.cfg.*; public interface LoweringTool { + GraalCodeCacheProvider getRuntime(); + ValueNode createNullCheckGuard(ValueNode object, long leafGraphId); + ValueNode createGuard(BooleanNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action, long leafGraphId); + ValueNode createGuard(BooleanNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action, boolean negated, long leafGraphId); + Assumptions assumptions(); Block getBlockFor(Node node); @@ -42,4 +47,3 @@ */ FixedWithNextNode lastFixedNode(); } - diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Negatable.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Negatable.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Negatable.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,16 +25,18 @@ import com.oracle.graal.nodes.*; /** - * This interface marks a node as being able to negate its effect, this is intended for nodes that depend on a - * BooleanNode condition. The canonical representation of has, for example, no way to represent a != b. If such an - * expression appears during canonicalization the negated expression will be created (a == b) and the usages will be - * negated, using this interface's {@link #negate()} method. + * This interface marks a node as being able to negate its effect, this is intended for nodes that + * depend on a BooleanNode condition. The canonical representation of has, for example, no way to + * represent a != b. If such an expression appears during canonicalization the negated expression + * will be created (a == b) and the usages will be negated, using this interface's {@link #negate()} + * method. */ public interface Negatable { /** - * Tells this node that a condition it depends has been negated, and that it thus needs to invert its own effect. - * For example, an {@link IfNode} would switch its true and false successors. + * Tells this node that a condition it depends has been negated, and that it thus needs to + * invert its own effect. For example, an {@link IfNode} would switch its true and false + * successors. */ Negatable negate(); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Simplifiable.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Simplifiable.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Simplifiable.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,11 +23,13 @@ package com.oracle.graal.nodes.spi; /** - * 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 simplify. + * 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 + * simplify. */ public interface Simplifiable { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/SimplifierTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/SimplifierTool.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/SimplifierTool.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,6 +29,7 @@ * @see Simplifiable */ public interface SimplifierTool extends CanonicalizerTool { + void deleteBranch(FixedNode branch); /** diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Virtualizable.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Virtualizable.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Virtualizable.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,9 +26,10 @@ import com.oracle.graal.nodes.virtual.*; /** - * This interface allows a node to convey information about what its effect would be if some of its inputs were - * virtualized. The {@link #virtualize(VirtualizerTool)} method will only be called for nodes that have some interaction - * with virtualized nodes. However, the virtualized nodes might have been re-materialized in the meantime. + * This interface allows a node to convey information about what its effect would be if some of its + * inputs were virtualized. The {@link #virtualize(VirtualizerTool)} method will only be called for + * nodes that have some interaction with virtualized nodes. However, the virtualized nodes might + * have been re-materialized in the meantime. */ public interface Virtualizable { @@ -54,11 +55,12 @@ } /** - * A node class can implement this method to convey information about what its effect would be if some of its inputs - * were virtualized. All modifications must be made through the supplied 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. - * + * A node class can implement this method to convey information about what its effect would be + * if some of its inputs were virtualized. All modifications must be made through the supplied + * 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); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizableAllocation.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizableAllocation.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizableAllocation.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,13 +23,14 @@ package com.oracle.graal.nodes.spi; /** - * 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. - * + * 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 VirtualizableAllocation extends Virtualizable { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizerTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizerTool.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizerTool.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,22 +29,23 @@ import com.oracle.graal.nodes.virtual.*; /** - * This tool can be used to query the current state (normal/virtualized/re-materialized) of values and to describe the - * actions that would be taken for this state. - * + * This tool can be used to query the current state (normal/virtualized/re-materialized) of values + * and to describe the actions that would be taken for this state. + * * See also {@link Virtualizable}. */ public interface VirtualizerTool { /** - * @return the {@link MetaAccessProvider} associated with the current compilation, which might be required for - * creating constants, etc. + * @return the {@link MetaAccessProvider} associated with the current compilation, which might + * be required for creating constants, etc. */ MetaAccessProvider getMetaAccessProvider(); /** - * This method should be used to query the maximum size of virtualized objects before attempting virtualization. - * + * This method should be used to query the maximum size of virtualized objects before attempting + * virtualization. + * * @return the maximum number of entries for virtualized objects. */ int getMaximumEntryCount(); @@ -58,7 +59,7 @@ /** * Introduces a new virtual object to the current state. - * + * * @param virtualObject the new virtual object. * @param entryState the initial state of the virtual object's fields. * @param lockCount the initial locking depth. @@ -66,17 +67,18 @@ void createVirtualObject(VirtualObjectNode virtualObject, ValueNode[] entryState, int lockCount); /** - * Queries the current state of the given value: if it is virtualized (thread-local and the compiler knows all - * entries) or not. - * + * Queries the current state of the given value: if it is virtualized (thread-local and the + * compiler knows all entries) or not. + * * @param value the value whose state should be queried. - * @return the {@link State} representing the value if it has been virtualized at some point, null otherwise. + * @return the {@link State} representing the value if it has been virtualized at some point, + * null otherwise. */ State getObjectState(ValueNode value); /** * Sets the entry (field or array element) with the given index in the virtualized object. - * + * * @param state the state. * @param index the index to be set. * @param value the new value for the given index. @@ -85,19 +87,20 @@ /** * Queries the current state of the given value: if it was materialized or not. - * + * * @param value the value whose state should be queried. - * @return the materialized value (usually a MaterializeObjectNode or a {@link PhiNode}) if it was materialized, - * null otherwise. + * @return the materialized value (usually a MaterializeObjectNode or a {@link PhiNode}) if it + * was materialized, null otherwise. */ ValueNode getMaterializedValue(ValueNode value); // scalar replacement /** - * Replacements via {@link #replaceWithValue(ValueNode)} are not immediately committed. This method can be used to - * determine if a value was replaced by another one (e.g., a load field by the loaded value). - * + * Replacements via {@link #replaceWithValue(ValueNode)} are not immediately committed. This + * method can be used to determine if a value was replaced by another one (e.g., a load field by + * the loaded value). + * * @param original the original input value. * @return the replacement value, or the original value if there is no replacement. */ @@ -107,14 +110,14 @@ /** * Deletes the current node and replaces it with the given virtualized object. - * + * * @param virtual the virtualized object that should replace the current node. */ void replaceWithVirtual(VirtualObjectNode virtual); /** * Deletes the current node and replaces it with the given value. - * + * * @param replacement the value that should replace the current node. */ void replaceWithValue(ValueNode replacement); @@ -126,16 +129,16 @@ /** * Replaces an input of the current node. - * + * * @param oldInput the old input value. * @param replacement the new input value. */ void replaceFirstInput(Node oldInput, Node replacement); /** - * Performs a custom action on the current node. This action will only be performed when, and if, the changes are - * committed. Custom actions must not modify inputs of nodes. - * + * Performs a custom action on the current node. This action will only be performed when, and + * if, the changes are committed. Custom actions must not modify inputs of nodes. + * * @param action the custom action. */ void customAction(Runnable action); @@ -143,7 +146,7 @@ /** * This method performs either {@link #replaceWithValue(ValueNode)} or * {@link #replaceWithVirtual(VirtualObjectNode)}, depending on the given value. - * + * * @param value the replacement value */ void replaceWith(ValueNode value); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/FloatStamp.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/FloatStamp.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/FloatStamp.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,7 +24,6 @@ import com.oracle.graal.api.meta.*; - public class FloatStamp extends Stamp { private final double lowerBound; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/IntegerStamp.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/IntegerStamp.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/IntegerStamp.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,7 +28,7 @@ /** * Describes the possible values of a {@link ValueNode} that produces an int or long result. - * + * * The description consists of (inclusive) lower and upper bounds and a bit-mask. */ public class IntegerStamp extends Stamp { @@ -72,8 +72,8 @@ } /** - * This bit-mask describes the bits that can be set in the value described by this stamp. It is primarily used to - * represent values that are multiples of a known power of two. + * This bit-mask describes the bits that can be set in the value described by this stamp. It is + * primarily used to represent values that are multiples of a known power of two. */ public long mask() { return mask; @@ -191,14 +191,21 @@ public static long defaultMask(Kind kind) { switch (kind) { - case Boolean: return 0x01L; - case Byte: return 0xffL; - case Char: return 0xffffL; - case Short: return 0xffffL; + case Boolean: + return 0x01L; + case Byte: + return 0xffL; + case Char: + return 0xffffL; + case Short: + return 0xffffL; case Jsr: - case Int: return 0xffffffffL; - case Long: return 0xffffffffffffffffL; - default: throw GraalInternalError.shouldNotReachHere(); + case Int: + return 0xffffffffL; + case Long: + return 0xffffffffffffffffL; + default: + throw GraalInternalError.shouldNotReachHere(); } } @@ -212,9 +219,11 @@ } /** - * Checks if the 2 stamps represent values of the same sign. - * Returns true if the two stamps are both positive of null or if they are both strictly negative - * @return true if the two stamps are both positive of null or if they are both strictly negative + * Checks if the 2 stamps represent values of the same sign. Returns true if the two stamps are + * both positive of null or if they are both strictly negative + * + * @return true if the two stamps are both positive of null or if they are both strictly + * negative */ public static boolean sameSign(IntegerStamp s1, IntegerStamp s2) { return s1.isPositive() && s2.isPositive() || s1.isStrictlyNegative() && s2.isStrictlyNegative(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,7 +24,6 @@ import com.oracle.graal.api.meta.*; - public class ObjectStamp extends Stamp { private final ResolvedJavaType type; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/Stamp.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/Stamp.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/Stamp.java Wed Jan 23 16:34:57 2013 +0100 @@ -41,8 +41,8 @@ } /** - * Returns the type of the stamp, guaranteed to be non-null. In some cases, this requires the lookup of class meta - * data, therefore the {@link MetaAccessProvider} is mandatory. + * Returns the type of the stamp, guaranteed to be non-null. In some cases, this requires the + * lookup of class meta data, therefore the {@link MetaAccessProvider} is mandatory. */ public abstract ResolvedJavaType javaType(MetaAccessProvider metaAccess); @@ -53,8 +53,9 @@ public abstract boolean alwaysDistinct(Stamp other); /** - * Returns the union of this stamp and the given stamp. Typically used to create stamps for {@link PhiNode}s. - * + * Returns the union of this stamp and the given stamp. Typically used to create stamps for + * {@link PhiNode}s. + * * @param other The stamp that will enlarge this stamp. * @return The union of this stamp and the given stamp. */ @@ -62,7 +63,7 @@ /** * Returns the intersection of this stamp and the given stamp. - * + * * @param other The stamp that will tighten this stamp. * @return The intersection of this stamp and the given stamp. */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,8 +27,8 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.type.GenericStamp.GenericStampType; +public class StampFactory { -public class StampFactory { private static final Stamp[] stampCache = new Stamp[Kind.values().length]; private static final Stamp objectStamp = new ObjectStamp(null, false, false, false); private static final Stamp objectNonNullStamp = new ObjectStamp(null, false, true, false); @@ -73,16 +73,16 @@ } /** - * A stamp used only in the graph of intrinsics, e.g., snippets. It is then replaced by an actual stamp when the - * intrinsic is used, i.e., when the snippet template is instantiated. + * A stamp used only in the graph of intrinsics, e.g., snippets. It is then replaced by an + * actual stamp when the intrinsic is used, i.e., when the snippet template is instantiated. */ public static Stamp forNodeIntrinsic() { return nodeIntrinsicStamp; } /** - * A stamp used only in the graph of intrinsics, e.g., snippets. It is then replaced by the actual primitive type - * stamp for the target-specific {@link TargetDescription#wordKind}. + * A stamp used only in the graph of intrinsics, e.g., snippets. It is then replaced by the + * actual primitive type stamp for the target-specific {@link TargetDescription#wordKind}. */ public static Stamp forWord() { return wordStamp; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampProvider.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampProvider.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampProvider.java Wed Jan 23 16:34:57 2013 +0100 @@ -22,7 +22,7 @@ */ package com.oracle.graal.nodes.type; +public interface StampProvider { -public interface StampProvider { Stamp stamp(); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java Wed Jan 23 16:34:57 2013 +0100 @@ -45,7 +45,7 @@ } public static Stamp meet(Collection values) { - Iterator< ? extends StampProvider> iterator = values.iterator(); + Iterator iterator = values.iterator(); if (iterator.hasNext()) { Stamp stamp = iterator.next().stamp(); while (iterator.hasNext()) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/ComputeImmediateDominator.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/ComputeImmediateDominator.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/ComputeImmediateDominator.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,8 +27,8 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +public final class ComputeImmediateDominator { -public final class ComputeImmediateDominator { private final MergeNode dominated; private final Queue toExplore; private final Queue speculativeExplore; @@ -73,7 +73,7 @@ if (info.isExplored()) { return; } - //TTY.println("exploreUp(" + from + ") with " + info); + // TTY.println("exploreUp(" + from + ") with " + info); info.setExplored(); while (p != null) { if (p instanceof MergeNode) { @@ -89,7 +89,7 @@ } private void processControlSplit(ControlSplitNode cs, DominatorInfo info) { - //TTY.println("processControlSplit(" + cs + ", " + info + ")"); + // TTY.println("processControlSplit(" + cs + ", " + info + ")"); DominatorInfo csInfo = infoMap.get(cs); if (csInfo == null) { csInfo = new DominatorInfo(cs, false); @@ -101,15 +101,16 @@ return; } if (csInfo.isExplored()) { - //TTY.println(" Already explored, propagate update"); + // TTY.println(" Already explored, propagate update"); propagateUpdate(csInfo); } else { - if (csInfo.parentCount() == cs.successors().count()) { // all paths leading to this CS have been explored - //TTY.println(" All parents explored, Enqueue"); + if (csInfo.parentCount() == cs.successors().count()) { // all paths leading to this CS + // have been explored + // TTY.println(" All parents explored, Enqueue"); toExplore.add(next); speculativeExplore.remove(next); } else { - //TTY.println(" Not all parents explored : Enqueue speculative"); + // TTY.println(" Not all parents explored : Enqueue speculative"); speculativeExplore.add(next); } } @@ -117,12 +118,12 @@ } private boolean propagateUpdate(DominatorInfo di) { - //TTY.println(" propagateUpdate(" + di + ")"); + // TTY.println(" propagateUpdate(" + di + ")"); for (DominatorInfo child : di.children()) { - //TTY.println(" add to child " + child); + // TTY.println(" add to child " + child); if (child.add(di, false)) { if (child.equals(fullInfo)) { - //TTY.println(" Found DOM!"); + // TTY.println(" Found DOM!"); dominator = child.node(); return true; } @@ -135,25 +136,26 @@ } private boolean checkControlSplitInfo(DominatorInfo di) { - //TTY.println(" checkControlSplitInfo(" + di + ")"); + // TTY.println(" checkControlSplitInfo(" + di + ")"); if (di.equals(fullInfo)) { dominator = di.node(); - //TTY.println(" Found DOM!"); + // TTY.println(" Found DOM!"); return true; } return false; } private void processMerge(MergeNode merge, DominatorInfo info) { - //TTY.println("processMerge(" + merge + ", " + info + ")"); + // TTY.println("processMerge(" + merge + ", " + info + ")"); for (EndNode end : merge.cfgPredecessors()) { toExplore.add(end); infoMap.set(end, info.createChild(end)); - //TTY.println(" Enqueue end : " + end + " with " + infoMap.get(end)); + // TTY.println(" Enqueue end : " + end + " with " + infoMap.get(end)); } } private class DominatorInfo { + private final FixedNode node; private final BitSet bits; private final BitSet ownBits; @@ -231,7 +233,6 @@ return parents.size(); } - public FixedNode node() { return node; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,9 +34,10 @@ public class GraphUtil { private static final NodePredicate FLOATING = new NodePredicate() { + @Override - public final boolean apply(Node n) { - //isA(FloatingNode.class).or(VirtualState.class).or(CallTargetNode.class) + public final boolean apply(Node n) { + // isA(FloatingNode.class).or(VirtualState.class).or(CallTargetNode.class) return n instanceof FloatingNode || n instanceof VirtualState || n instanceof CallTargetNode; } }; @@ -49,9 +50,11 @@ killEnd(end); } else { // Normal control flow node. - /* We do not take a successor snapshot because this iterator supports concurrent modifications - * as long as they do not change the size of the successor list. Not taking a snapshot allows - * us to see modifications to other branches that may happen while processing one branch. + /* + * We do not take a successor snapshot because this iterator supports concurrent + * modifications as long as they do not change the size of the successor list. Not + * taking a snapshot allows us to see modifications to other branches that may happen + * while processing one branch. */ for (Node successor : node.successors()) { killCFG((FixedNode) successor); @@ -65,7 +68,7 @@ if (merge != null) { merge.removeEnd(end); StructuredGraph graph = (StructuredGraph) end.graph(); - if (merge instanceof LoopBeginNode && merge.forwardEndCount() == 0) { //dead loop + if (merge instanceof LoopBeginNode && merge.forwardEndCount() == 0) { // dead loop for (PhiNode phi : merge.phis().snapshot()) { propagateKill(phi); } @@ -77,11 +80,15 @@ } begin.removeExits(); FixedNode loopBody = begin.next(); - if (loopBody != null) { // for small infinite loops, the body may be killed while killing the loop ends + if (loopBody != null) { // for small infinite loops, the body may be killed while + // killing the loop ends killCFG(loopBody); } begin.safeDelete(); - } else if (merge instanceof LoopBeginNode && ((LoopBeginNode) merge).loopEnds().isEmpty()) { // not a loop anymore + } else if (merge instanceof LoopBeginNode && ((LoopBeginNode) merge).loopEnds().isEmpty()) { // not + // a + // loop + // anymore graph.reduceDegenerateLoopBegin((LoopBeginNode) merge); } else if (merge.phiPredecessorCount() == 1) { // not a merge anymore graph.reduceTrivialMerge(merge); @@ -172,7 +179,8 @@ } public static void normalizeLoopBegin(LoopBeginNode begin) { - // Delete unnecessary loop phi functions, i.e., phi functions where all inputs are either the same or the phi itself. + // Delete unnecessary loop phi functions, i.e., phi functions where all inputs are either + // the same or the phi itself. for (PhiNode phi : begin.phis().snapshot()) { GraphUtil.checkRedundantPhi(phi); } @@ -185,7 +193,7 @@ /** * Gets an approximate source code location for a node if possible. - * + * * @return the StackTraceElements if an approximate source location is found, null otherwise */ public static StackTraceElement[] approxSourceStackTraceElement(Node node) { @@ -213,10 +221,9 @@ return elements.toArray(new StackTraceElement[elements.size()]); } - /** * 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) { @@ -235,9 +242,9 @@ /** * Gets an approximate source code location for a node if possible. - * - * @return a file name and source line number in stack trace format (e.g. "String.java:32") if an approximate source - * location is found, null otherwise + * + * @return a file name and source line number in stack trace format (e.g. "String.java:32") if + * an approximate source location is found, null otherwise */ public static String approxSourceLocation(Node node) { StackTraceElement[] stackTraceElements = approxSourceStackTraceElement(node); @@ -260,11 +267,11 @@ /** * Returns a string representation of the given collection of objects. - * + * * @param objects The {@link Iterable} that will be used to iterate over the objects. * @return A string of the format "[a, b, ...]". */ - public static String toString(Iterable< ? > objects) { + public static String toString(Iterable objects) { StringBuilder str = new StringBuilder(); str.append("["); for (Object o : objects) { @@ -278,8 +285,9 @@ } /** - * Tries to find an original value of the given node by traversing through proxies and unambiguous phis. - * + * Tries to find an original value of the given node by traversing through proxies and + * unambiguous phis. + * * @param proxy The node whose original value should be determined. */ public static ValueNode originalValue(ValueNode proxy) { @@ -294,7 +302,8 @@ } } while (v != null); - // if the simple check fails (this can happen for complicated phi/proxy/phi constructs), we do an exhaustive search + // if the simple check fails (this can happen for complicated phi/proxy/phi constructs), we + // do an exhaustive search if (v == null) { NodeWorkList worklist = proxy.graph().createNodeWorkList(); worklist.add(proxy); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/NodeIterators.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/NodeIterators.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/NodeIterators.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,10 +31,13 @@ public static NodeIterable dominators(final FixedNode n) { return new AbstractNodeIterable() { + @Override public Iterator iterator() { - return new NodeIterator(){ + return new NodeIterator() { + FixedNode p = n; + @Override protected void forward() { if (current == null) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/TreeIterators.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/TreeIterators.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/TreeIterators.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,7 +26,8 @@ public class TreeIterators { - public abstract static class PrefixTreeIterator implements Iterator{ + public abstract static class PrefixTreeIterator implements Iterator { + private Deque stack = new LinkedList<>(); public PrefixTreeIterator(T root) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/BoxedVirtualObjectNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/BoxedVirtualObjectNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/BoxedVirtualObjectNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,7 +27,6 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; - public class BoxedVirtualObjectNode extends VirtualObjectNode implements LIRLowerable, Node.ValueNumberable { @Input ValueNode unboxedValue; @@ -63,7 +62,8 @@ @Override public int entryIndexForOffset(long constantOffset) { - // (lstadler) unsafe access to a newly created boxing object should only ever touch the value field + // (lstadler) unsafe access to a newly created boxing object should only ever touch the + // value field return 0; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EscapeObjectState.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EscapeObjectState.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EscapeObjectState.java Wed Jan 23 16:34:57 2013 +0100 @@ -40,7 +40,8 @@ @Override public void generate(LIRGeneratorTool generator) { - // Nothing to do, virtual object states are processed as part of the handling of StateSplit nodes. + // Nothing to do, virtual object states are processed as part of the handling of StateSplit + // nodes. } @Override diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualObjectNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualObjectNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualObjectNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -54,7 +54,8 @@ public abstract String fieldName(int i); - public void materializeAt(@SuppressWarnings("unused") FixedNode fixed) { + public void materializeAt(@SuppressWarnings("unused") + FixedNode fixed) { // nothing to do in here - this method allows subclasses to respond to materialization } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -38,6 +38,7 @@ import com.oracle.graal.phases.*; public class CanonicalizerPhase extends Phase { + private static final int MAX_ITERATION_PER_NODE = 10; private static final DebugMetric METRIC_CANONICALIZED_NODES = Debug.metric("CanonicalizedNodes"); private static final DebugMetric METRIC_CANONICALIZATION_CONSIDERED_NODES = Debug.metric("CanonicalizationConsideredNodes"); @@ -58,6 +59,7 @@ private List snapshotTemp; public interface CustomCanonicalizer { + ValueNode canonicalize(Node node); } @@ -69,7 +71,8 @@ * @param target * @param runtime * @param assumptions - * @param workingSet the initial working set of nodes on which the canonicalizer works, should be an auto-grow node bitmap + * @param workingSet the initial working set of nodes on which the canonicalizer works, should + * be an auto-grow node bitmap * @param customCanonicalizer */ public CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions, Iterable workingSet, CustomCanonicalizer customCanonicalizer) { @@ -77,8 +80,8 @@ } /** - * @param newNodesMark only the {@linkplain Graph#getNewNodes(int) new nodes} specified by - * this mark are processed otherwise all nodes in the graph are processed + * @param newNodesMark only the {@linkplain Graph#getNewNodes(int) new nodes} specified by this + * mark are processed otherwise all nodes in the graph are processed */ public CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions, int newNodesMark, CustomCanonicalizer customCanonicalizer) { this(target, runtime, assumptions, null, newNodesMark, customCanonicalizer); @@ -111,6 +114,7 @@ private void processWorkSet(StructuredGraph graph) { graph.trackInputChange(new InputChangedListener() { + @Override public void inputChanged(Node node) { workList.addAgain(node); @@ -191,7 +195,8 @@ if (node instanceof Canonicalizable) { assert !(node instanceof Simplifiable); METRIC_CANONICALIZATION_CONSIDERED_NODES.increment(); - return Debug.scope("CanonicalizeNode", node, new Callable(){ + return Debug.scope("CanonicalizeNode", node, new Callable() { + public Boolean call() { ValueNode canonical = ((Canonicalizable) node).canonical(tool); // @formatter:off @@ -209,7 +214,6 @@ // X: must not happen (checked with assertions) // @formatter:on - return performReplacement(node, graph, canonical); } }); @@ -217,6 +221,7 @@ Debug.log("Canonicalizer: simplifying %s", node); METRIC_SIMPLIFICATION_CONSIDERED_NODES.increment(); Debug.scope("SimplifyNode", node, new Runnable() { + public void run() { ((Simplifiable) node).simplify(tool); } @@ -246,7 +251,8 @@ assert node instanceof FixedWithNextNode && node.predecessor() != null : node + " -> " + canonical + " : node should be fixed & connected (" + node.predecessor() + ")"; FixedWithNextNode fixedWithNext = (FixedWithNextNode) node; - // When removing a fixed node, new canonicalization opportunities for its successor may arise + // When removing a fixed node, new canonicalization opportunities for its successor + // may arise assert fixedWithNext.next() != null; tool.addToWorkList(fixedWithNext.next()); @@ -275,9 +281,10 @@ } /** - * Calls {@link ValueNode#inferStamp()} on the node and, if it returns true (which means that the stamp has - * changed), re-queues the node's usages . If the stamp has changed then this method also checks if the stamp - * now describes a constant integer value, in which case the node is replaced with a constant. + * Calls {@link ValueNode#inferStamp()} on the node and, if it returns true (which means that + * the stamp has changed), re-queues the node's usages . If the stamp has changed then this + * method also checks if the stamp now describes a constant integer value, in which case the + * node is replaced with a constant. */ private void tryInferStamp(Node node, StructuredGraph graph) { if (node.isAlive() && node instanceof ValueNode) { @@ -319,7 +326,8 @@ } /** - * @return the current target or {@code null} if no target is available in the current context. + * @return the current target or {@code null} if no target is available in the current + * context. */ @Override public TargetDescription target() { @@ -327,7 +335,8 @@ } /** - * @return an object that can be used for recording assumptions or {@code null} if assumptions are not allowed in the current context. + * @return an object that can be used for recording assumptions or {@code null} if + * assumptions are not allowed in the current context. */ @Override public Assumptions assumptions() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ComputeProbabilityPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ComputeProbabilityPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ComputeProbabilityPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -36,17 +36,21 @@ *

        * The computation of absolute probabilities works in three steps: *

          - *
        1. {@link PropagateProbability} traverses the graph in post order (merges after their ends, ...) and keeps track of the "probability state". - * Whenever it encounters a {@link ControlSplitNode} it uses the split's probability information to divide the probability upon the successors. - * Whenever it encounters an {@link Invoke} it assumes that the exception edge is unlikely and propagates the whole probability to the normal successor. - * Whenever it encounters a {@link MergeNode} it sums up the probability of all predecessors. - * It also maintains a set of active loops (whose {@link LoopBeginNode} has been visited) and builds def/use information for step 2.
        2. + *
        3. {@link PropagateProbability} traverses the graph in post order (merges after their ends, ...) + * and keeps track of the "probability state". Whenever it encounters a {@link ControlSplitNode} it + * uses the split's probability information to divide the probability upon the successors. Whenever + * it encounters an {@link Invoke} it assumes that the exception edge is unlikely and propagates the + * whole probability to the normal successor. Whenever it encounters a {@link MergeNode} it sums up + * the probability of all predecessors. It also maintains a set of active loops (whose + * {@link LoopBeginNode} has been visited) and builds def/use information for step 2.
        4. *
        5. - *
        6. {@link PropagateLoopFrequency} propagates the loop frequencies and multiplies each {@link FixedNode}'s probability with its loop frequency.
        7. + *
        8. {@link PropagateLoopFrequency} propagates the loop frequencies and multiplies each + * {@link FixedNode}'s probability with its loop frequency.
        9. *
        * TODO: add exception probability information to Invokes */ public class ComputeProbabilityPhase extends Phase { + private static final double EPSILON = 1d / Integer.MAX_VALUE; @Override @@ -126,6 +130,7 @@ } public static class LoopInfo { + public final LoopBeginNode loopBegin; public final NodeMap> requires; @@ -168,6 +173,7 @@ public Map> mergeLoops = new IdentityHashMap<>(); private class Probability implements MergeableState { + public double probability; public HashSet loops; public LoopInfo loopInfo; @@ -279,6 +285,7 @@ } private class LoopCount implements MergeableState { + public double count; public LoopCount(double count) { @@ -374,6 +381,7 @@ } private static class ComputeInliningRelevanceIterator extends ScopedPostOrderNodeIterator { + private final HashMap lowestPathProbabilities; private double currentProbability; @@ -431,7 +439,7 @@ double maxProbability = 0.0; // TODO: process recursively if we have multiple successors with same probability - for (Node sux: controlSplit.successors()) { + for (Node sux : controlSplit.successors()) { double probability = controlSplit.probability((BeginNode) sux); if (probability > maxProbability) { maxProbability = probability; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -162,7 +162,8 @@ } } - // this piece of code handles phis (merges the types and knownNull/knownNotNull of the values) + // this piece of code handles phis (merges the types and knownNull/knownNotNull of the + // values) if (!(merge instanceof LoopBeginNode)) { for (PhiNode phi : merge.phis()) { if (phi.type() == PhiType.Value && phi.kind() == Kind.Object) { @@ -250,6 +251,7 @@ } public class ConditionalElimination extends PostOrderNodeIterator { + private BeginNode lastBegin = null; public ConditionalElimination(FixedNode start, State initialState) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -81,7 +81,8 @@ BeginNode otherBegin = ifNode.trueSuccessor(); BooleanNode conditionNode = ifNode.condition(); if (conditionNode instanceof InstanceOfNode) { - // TODO The lowering currently does not support a FixedGuard as the usage of an InstanceOfNode. Relax this restriction. + // TODO The lowering currently does not support a FixedGuard as the usage of an + // InstanceOfNode. Relax this restriction. return; } boolean negated = false; @@ -90,7 +91,8 @@ otherBegin = ifNode.falseSuccessor(); } BeginNode ifBlockBegin = findBeginNode(ifNode); - Debug.log("Converting %s on %-5s branch of %s to guard for remaining branch %s. IfBegin=%s", deopt, deoptBegin == ifNode.trueSuccessor() ? "true" : "false", ifNode, otherBegin, ifBlockBegin); + Debug.log("Converting %s on %-5s branch of %s to guard for remaining branch %s. IfBegin=%s", deopt, deoptBegin == ifNode.trueSuccessor() ? "true" : "false", ifNode, otherBegin, + ifBlockBegin); FixedGuardNode guard = graph.add(new FixedGuardNode(conditionNode, deopt.reason(), deopt.action(), negated, deopt.leafGraphId())); otherBegin.replaceAtUsages(ifBlockBegin); FixedNode next = otherBegin.next(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertUnreachedToGuardPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertUnreachedToGuardPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertUnreachedToGuardPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,8 +30,8 @@ import com.oracle.graal.nodes.util.*; import com.oracle.graal.phases.*; +public class ConvertUnreachedToGuardPhase extends Phase { -public class ConvertUnreachedToGuardPhase extends Phase { private OptimisticOptimizations opt; public ConvertUnreachedToGuardPhase(OptimisticOptimizations opt) { @@ -58,7 +58,8 @@ delete = ifNode.falseSuccessor(); } if (insertGuard != null) { - GuardNode guard = graph.unique(new GuardNode(ifNode.condition(), BeginNode.prevBegin(ifNode), DeoptimizationReason.UnreachedCode, DeoptimizationAction.InvalidateReprofile, inverted, ifNode.leafGraphId())); + GuardNode guard = graph.unique(new GuardNode(ifNode.condition(), BeginNode.prevBegin(ifNode), DeoptimizationReason.UnreachedCode, DeoptimizationAction.InvalidateReprofile, + inverted, ifNode.leafGraphId())); graph.addBeforeFixed(ifNode, graph.add(new ValueAnchorNode(guard))); GraphUtil.killCFG(delete); graph.removeSplit(ifNode, inverted ? ifNode.falseSuccessor() : ifNode.trueSuccessor()); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CullFrameStatesPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CullFrameStatesPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CullFrameStatesPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,8 +31,8 @@ import com.oracle.graal.phases.graph.*; /** - * This phase culls unused FrameStates from the graph. - * It does a post order iteration over the graph, and + * This phase culls unused FrameStates from the graph. It does a post order iteration over the + * graph, and */ public class CullFrameStatesPhase extends Phase { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,7 +27,6 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.phases.*; - public class DeadCodeEliminationPhase extends Phase { // Metrics diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/EliminatePartiallyRedundantGuardsPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/EliminatePartiallyRedundantGuardsPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/EliminatePartiallyRedundantGuardsPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,7 +33,6 @@ import com.oracle.graal.nodes.PhiNode.PhiType; import com.oracle.graal.phases.*; - public class EliminatePartiallyRedundantGuardsPhase extends Phase { private static final DebugMetric metricPRGuardsEliminatedAtMerge = Debug.metric("PRGuardsEliminatedAtMerge"); @@ -50,12 +49,15 @@ } private static class Condition { + final BooleanNode conditionNode; final boolean negated; + public Condition(BooleanNode conditionNode, boolean negated) { this.conditionNode = conditionNode; this.negated = negated; } + @Override public int hashCode() { final int prime = 31; @@ -64,6 +66,7 @@ result = prime * result + (negated ? 1231 : 1237); return result; } + @Override public boolean equals(Object obj) { if (this == obj) { @@ -105,7 +108,7 @@ hits |= eliminateAtControlSplit(controlSplit); } } - } while(hits); + } while (hits); } private static boolean eliminateAtMerge(MergeNode merge) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -35,10 +35,12 @@ private IdentityHashMap> loopEndStatesMap; private static class LoopState { + public LoopBeginNode loopBegin; public MemoryMap state; public IdentityHashMap loopPhiLocations = new IdentityHashMap<>(); public ValueNode loopEntryAnyLocation; + public LoopState(LoopBeginNode loopBegin, MemoryMap state, ValueNode loopEntryAnyLocation) { this.loopBegin = loopBegin; this.state = state; @@ -52,6 +54,7 @@ } private class MemoryMap implements MergeableState { + private IdentityHashMap lastMemorySnapshot; private LinkedList loops; @@ -171,6 +174,7 @@ protected void run(StructuredGraph graph) { loopEndStatesMap = new IdentityHashMap<>(); new PostOrderNodeIterator(graph.start(), new MemoryMap()) { + @Override protected void node(FixedNode node) { processNode(node, state); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -37,10 +37,12 @@ import com.oracle.graal.phases.common.InliningUtil.*; public class InliningPhase extends Phase implements InliningCallback { + /* - * - Detect method which only call another method with some parameters set to constants: void foo(a) -> void foo(a, b) -> void foo(a, b, c) ... - * These should not be taken into account when determining inlining depth. - * - honor the result of overrideInliningDecision(0, caller, invoke.bci, method, true); + * - Detect method which only call another method with some parameters set to constants: void + * foo(a) -> void foo(a, b) -> void foo(a, b, c) ... These should not be taken into account when + * determining inlining depth. - honor the result of overrideInliningDecision(0, caller, + * invoke.bci, method, true); */ private final TargetDescription target; @@ -58,7 +60,8 @@ private static final DebugMetric metricInliningStoppedByMaxDesiredSize = Debug.metric("InliningStoppedByMaxDesiredSize"); private static final DebugMetric metricInliningRuns = Debug.metric("Runs"); - public InliningPhase(TargetDescription target, GraalCodeCacheProvider runtime, Collection hints, Assumptions assumptions, GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) { + public InliningPhase(TargetDescription target, GraalCodeCacheProvider runtime, Collection hints, Assumptions assumptions, GraphCache cache, PhasePlan plan, + OptimisticOptimizations optimisticOpts) { this(target, runtime, assumptions, cache, plan, createInliningPolicy(assumptions, optimisticOpts, hints)); } @@ -146,10 +149,12 @@ } private interface InliningDecision { + boolean isWorthInlining(InlineInfo info); } private abstract static class AbstractInliningDecision implements InliningDecision { + protected static boolean decideSizeBasedInlining(InlineInfo info, double maxSize) { assert !Double.isNaN(info.weight()) && !Double.isNaN(maxSize); boolean success = info.weight() <= maxSize; @@ -178,6 +183,7 @@ } private static class C1StaticSizeBasedInliningDecision extends AbstractInliningDecision { + @Override public boolean isWorthInlining(InlineInfo info) { double maxSize = Math.max(GraalOptions.MaximumTrivialSize, Math.pow(GraalOptions.NestedInliningSizeRatio, info.level()) * GraalOptions.MaximumInlineSize); @@ -186,6 +192,7 @@ } private static class MinimumCodeSizeBasedInliningDecision extends AbstractInliningDecision { + @Override public boolean isWorthInlining(InlineInfo info) { assert GraalOptions.ProbabilityAnalysis; @@ -202,6 +209,7 @@ } private static class DynamicSizeBasedInliningDecision extends AbstractInliningDecision { + @Override public boolean isWorthInlining(InlineInfo info) { assert GraalOptions.ProbabilityAnalysis; @@ -220,6 +228,7 @@ } private static class GreedySizeBasedInliningDecision extends AbstractInliningDecision { + @Override public boolean isWorthInlining(InlineInfo info) { assert GraalOptions.ProbabilityAnalysis; @@ -246,6 +255,7 @@ } private static class GreedyMachineCodeInliningDecision extends AbstractInliningDecision { + @Override public boolean isWorthInlining(InlineInfo info) { assert GraalOptions.ProbabilityAnalysis; @@ -260,6 +270,7 @@ } private static class BytecodeSizeBasedWeightComputationPolicy implements WeightComputationPolicy { + @Override public double computeWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke, boolean preferredInvoke) { if (GraalOptions.AlwaysInlineIntrinsics && InliningUtil.canIntrinsify(method)) { @@ -275,6 +286,7 @@ } private static class ComplexityBasedWeightComputationPolicy implements WeightComputationPolicy { + @Override public double computeWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke, boolean preferredInvoke) { if (GraalOptions.AlwaysInlineIntrinsics && InliningUtil.canIntrinsify(method)) { @@ -290,6 +302,7 @@ } private static class CompiledCodeSizeWeightComputationPolicy implements WeightComputationPolicy { + @Override public double computeWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke, boolean preferredInvoke) { if (GraalOptions.AlwaysInlineIntrinsics && InliningUtil.canIntrinsify(method)) { @@ -302,6 +315,7 @@ } private static class CFInliningPolicy implements InliningPolicy { + private final InliningDecision inliningDecision; private final WeightComputationPolicy weightComputationPolicy; private final Collection hints; @@ -311,8 +325,8 @@ private NodeBitMap visitedFixedNodes; private FixedNode invokePredecessor; - public CFInliningPolicy(InliningDecision inliningPolicy, WeightComputationPolicy weightComputationPolicy, Collection hints, - Assumptions assumptions, OptimisticOptimizations optimisticOpts) { + public CFInliningPolicy(InliningDecision inliningPolicy, WeightComputationPolicy weightComputationPolicy, Collection hints, Assumptions assumptions, + OptimisticOptimizations optimisticOpts) { this.inliningDecision = inliningPolicy; this.weightComputationPolicy = weightComputationPolicy; this.hints = hints; @@ -373,6 +387,7 @@ } private static class PriorityInliningPolicy implements InliningPolicy { + private final InliningDecision inliningDecision; private final WeightComputationPolicy weightComputationPolicy; private final Collection hints; @@ -380,8 +395,8 @@ private final OptimisticOptimizations optimisticOpts; private final PriorityQueue sortedCandidates; - public PriorityInliningPolicy(InliningDecision inliningPolicy, WeightComputationPolicy weightComputationPolicy, Collection hints, - Assumptions assumptions, OptimisticOptimizations optimisticOpts) { + public PriorityInliningPolicy(InliningDecision inliningPolicy, WeightComputationPolicy weightComputationPolicy, Collection hints, Assumptions assumptions, + OptimisticOptimizations optimisticOpts) { this.inliningDecision = inliningPolicy; this.weightComputationPolicy = weightComputationPolicy; this.hints = hints; @@ -422,7 +437,7 @@ } public void scanInvokes(Iterable nodes) { - for (Node node: nodes) { + for (Node node : nodes) { if (node != null) { if (node instanceof Invoke) { Invoke invoke = (Invoke) node; @@ -450,6 +465,7 @@ } private static class InliningIterator { + private final FixedNode start; private final NodeBitMap processedNodes; @@ -503,7 +519,7 @@ } else { assert false : current; } - } while(current != null); + } while (current != null); return invokes; } @@ -546,9 +562,11 @@ } private static InliningPolicy createInliningPolicy(Assumptions assumptions, OptimisticOptimizations optimisticOpts, Collection hints) { - switch(GraalOptions.InliningPolicy) { - case 0: return new CFInliningPolicy(createInliningDecision(), createWeightComputationPolicy(), hints, assumptions, optimisticOpts); - case 1: return new PriorityInliningPolicy(createInliningDecision(), createWeightComputationPolicy(), hints, assumptions, optimisticOpts); + switch (GraalOptions.InliningPolicy) { + case 0: + return new CFInliningPolicy(createInliningDecision(), createWeightComputationPolicy(), hints, assumptions, optimisticOpts); + case 1: + return new PriorityInliningPolicy(createInliningDecision(), createWeightComputationPolicy(), hints, assumptions, optimisticOpts); default: GraalInternalError.shouldNotReachHere(); return null; @@ -556,12 +574,17 @@ } private static InliningDecision createInliningDecision() { - switch(GraalOptions.InliningDecision) { - case 1: return new C1StaticSizeBasedInliningDecision(); - case 2: return new MinimumCodeSizeBasedInliningDecision(); - case 3: return new DynamicSizeBasedInliningDecision(); - case 4: return new GreedySizeBasedInliningDecision(); - case 5: return new GreedyMachineCodeInliningDecision(); + switch (GraalOptions.InliningDecision) { + case 1: + return new C1StaticSizeBasedInliningDecision(); + case 2: + return new MinimumCodeSizeBasedInliningDecision(); + case 3: + return new DynamicSizeBasedInliningDecision(); + case 4: + return new GreedySizeBasedInliningDecision(); + case 5: + return new GreedyMachineCodeInliningDecision(); default: GraalInternalError.shouldNotReachHere(); return null; @@ -569,11 +592,15 @@ } private static WeightComputationPolicy createWeightComputationPolicy() { - switch(GraalOptions.WeightComputationPolicy) { - case 0: throw new GraalInternalError("removed because of invokation counter changes"); - case 1: return new BytecodeSizeBasedWeightComputationPolicy(); - case 2: return new ComplexityBasedWeightComputationPolicy(); - case 3: return new CompiledCodeSizeWeightComputationPolicy(); + switch (GraalOptions.WeightComputationPolicy) { + case 0: + throw new GraalInternalError("removed because of invokation counter changes"); + case 1: + return new BytecodeSizeBasedWeightComputationPolicy(); + case 2: + return new ComplexityBasedWeightComputationPolicy(); + case 3: + return new CompiledCodeSizeWeightComputationPolicy(); default: GraalInternalError.shouldNotReachHere(); return null; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Wed Jan 23 16:34:57 2013 +0100 @@ -44,23 +44,32 @@ import com.oracle.graal.phases.*; public class InliningUtil { + private static final DebugMetric metricInliningTailDuplication = Debug.metric("InliningTailDuplication"); private static final String inliningDecisionsScopeString = "InliningDecisions"; public interface InliningCallback { + StructuredGraph buildGraph(final ResolvedJavaMethod method); } public interface InliningPolicy { + void initialize(StructuredGraph graph); + boolean continueInlining(StructuredGraph graph); + InlineInfo next(); + void scanInvokes(Iterable newNodes); + double inliningWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke); + boolean isWorthInlining(InlineInfo info); } public interface WeightComputationPolicy { + double computeWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke, boolean preferredInvoke); } @@ -76,6 +85,7 @@ public static void logInliningDecision(final String msg, final Object... args) { Debug.scope(inliningDecisionsScopeString, new Runnable() { + public void run() { Debug.log(msg, args); } @@ -120,6 +130,7 @@ private static boolean shouldLogInliningDecision() { return Debug.scope(inliningDecisionsScopeString, new Callable() { + public Boolean call() { return Debug.isLogEnabled(); } @@ -157,24 +168,31 @@ /** * Represents an opportunity for inlining at the given invoke, with the given weight and level. - * The weight is the amortized weight of the additional code - so smaller is better. - * The level is the number of nested inlinings that lead to this invoke. + * The weight is the amortized weight of the additional code - so smaller is better. The level + * is the number of nested inlinings that lead to this invoke. */ public interface InlineInfo extends Comparable { + Invoke invoke(); + double weight(); + int level(); + int compiledCodeSize(); + int compareTo(InlineInfo o); /** - * Performs the inlining described by this object and returns the node that represents the return value of the - * inlined method (or null for void methods and methods that have no non-exceptional exit). + * Performs the inlining described by this object and returns the node that represents the + * return value of the inlined method (or null for void methods and methods that have no + * non-exceptional exit). */ void inline(StructuredGraph graph, GraalCodeCacheProvider runtime, InliningCallback callback, Assumptions assumptions); } public abstract static class AbstractInlineInfo implements InlineInfo { + protected final Invoke invoke; protected final double weight; @@ -201,7 +219,7 @@ } protected static void inline(Invoke invoke, ResolvedJavaMethod concrete, InliningCallback callback, Assumptions assumptions, boolean receiverNullCheck) { - Class< ? extends FixedWithNextNode> macroNodeClass = getMacroNodeClass(concrete); + Class macroNodeClass = getMacroNodeClass(concrete); if (macroNodeClass != null) { StructuredGraph graph = (StructuredGraph) invoke.graph(); assert invoke instanceof InvokeNode; @@ -226,6 +244,7 @@ private static StructuredGraph getGraph(final ResolvedJavaMethod concrete, final InliningCallback callback) { return Debug.scope("GetInliningGraph", concrete, new Callable() { + @Override public StructuredGraph call() throws Exception { assert !Modifier.isNative(concrete.getModifiers()); @@ -236,10 +255,11 @@ } /** - * Represents an inlining opportunity where the compiler can statically determine a monomorphic target method and - * therefore is able to determine the called method exactly. + * Represents an inlining opportunity where the compiler can statically determine a monomorphic + * target method and therefore is able to determine the called method exactly. */ private static class ExactInlineInfo extends AbstractInlineInfo { + public final ResolvedJavaMethod concrete; public ExactInlineInfo(Invoke invoke, double weight, ResolvedJavaMethod concrete) { @@ -264,10 +284,12 @@ } /** - * Represents an inlining opportunity for which profiling information suggests a monomorphic receiver, but for which - * the receiver type cannot be proven. A type check guard will be generated if this inlining is performed. + * Represents an inlining opportunity for which profiling information suggests a monomorphic + * receiver, but for which the receiver type cannot be proven. A type check guard will be + * generated if this inlining is performed. */ private static class TypeGuardInlineInfo extends AbstractInlineInfo { + public final ResolvedJavaMethod concrete; public final ResolvedJavaType type; @@ -311,17 +333,18 @@ } /** - * Polymorphic inlining of m methods with n type checks (n >= m) in case that the profiling information suggests a reasonable - * amounts of different receiver types and different methods. If an unknown type is encountered a deoptimization is triggered. + * Polymorphic inlining of m methods with n type checks (n >= m) in case that the profiling + * information suggests a reasonable amounts of different receiver types and different methods. + * If an unknown type is encountered a deoptimization is triggered. */ private static class MultiTypeGuardInlineInfo extends AbstractInlineInfo { + public final List concretes; public final ArrayList ptypes; public final int[] typesToConcretes; public final double notRecordedTypeProbability; - public MultiTypeGuardInlineInfo(Invoke invoke, double weight, ArrayList concretes, ArrayList ptypes, - int[] typesToConcretes, double notRecordedTypeProbability) { + public MultiTypeGuardInlineInfo(Invoke invoke, double weight, ArrayList concretes, ArrayList ptypes, int[] typesToConcretes, double notRecordedTypeProbability) { super(invoke, weight); assert concretes.size() > 0 && concretes.size() <= ptypes.size() : "must have at least one method but no more than types methods"; assert ptypes.size() == typesToConcretes.length : "array lengths must match"; @@ -335,7 +358,7 @@ @Override public int compiledCodeSize() { int result = 0; - for (ResolvedJavaMethod m: concretes) { + for (ResolvedJavaMethod m : concretes) { result += InliningUtil.compiledCodeSize(m); } return result; @@ -457,8 +480,8 @@ } if (GraalOptions.OptTailDuplication) { /* - * We might want to perform tail duplication at the merge after a type switch, if there are invokes that would - * benefit from the improvement in type information. + * We might want to perform tail duplication at the merge after a type switch, if + * there are invokes that would benefit from the improvement in type information. */ FixedNode current = returnMerge; int opportunities = 0; @@ -513,7 +536,7 @@ graph.addBeforeFixed(invoke.node(), receiverHub); BeginNode unknownTypeSux = BeginNode.begin(graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated, invoke.leafGraphId()))); - BeginNode[] successors = new BeginNode[] {calleeEntryNode, unknownTypeSux}; + BeginNode[] successors = new BeginNode[]{calleeEntryNode, unknownTypeSux}; FixedNode dispatchOnType = createDispatchOnType(graph, receiverHub, successors); FixedWithNextNode pred = (FixedWithNextNode) invoke.node().predecessor(); @@ -545,8 +568,8 @@ return typeSwitch; } - private static BeginNode createInvocationBlock(StructuredGraph graph, Invoke invoke, MergeNode returnMerge, PhiNode returnValuePhi, - MergeNode exceptionMerge, PhiNode exceptionObjectPhi, double probability, boolean useForInlining) { + private static BeginNode createInvocationBlock(StructuredGraph graph, Invoke invoke, MergeNode returnMerge, PhiNode returnValuePhi, MergeNode exceptionMerge, PhiNode exceptionObjectPhi, + double probability, boolean useForInlining) { Invoke duplicatedInvoke = duplicateInvokeForInlining(graph, invoke, exceptionMerge, exceptionObjectPhi, useForInlining, probability); BeginNode calleeEntryNode = graph.add(new BeginNode()); calleeEntryNode.setNext(duplicatedInvoke.node()); @@ -626,12 +649,12 @@ } } - /** - * Represents an inlining opportunity where the current class hierarchy leads to a monomorphic target method, - * but for which an assumption has to be registered because of non-final classes. + * Represents an inlining opportunity where the current class hierarchy leads to a monomorphic + * target method, but for which an assumption has to be registered because of non-final classes. */ private static class AssumptionInlineInfo extends ExactInlineInfo { + private final Assumption takenAssumption; public AssumptionInlineInfo(Invoke invoke, double weight, ResolvedJavaMethod concrete, Assumption takenAssumption) { @@ -655,6 +678,7 @@ /** * Determines if inlining is possible at the given invoke node. + * * @param invoke the invoke that should be inlined * @param inliningPolicy used to determine the weight of a specific inlining * @return an instance of InlineInfo, or null if no inlining is possible at the given invoke @@ -676,7 +700,8 @@ ResolvedJavaType holder = targetMethod.getDeclaringClass(); ObjectStamp receiverStamp = callTarget.receiver().objectStamp(); if (receiverStamp.type() != null) { - // the invoke target might be more specific than the holder (happens after inlining: locals lose their declared type...) + // the invoke target might be more specific than the holder (happens after inlining: + // locals lose their declared type...) ResolvedJavaType receiverType = receiverStamp.type(); if (receiverType != null && holder.isAssignableFrom(receiverType)) { holder = receiverType; @@ -692,7 +717,8 @@ return getExactInlineInfo(invoke, inliningPolicy, optimisticOpts, caller, holder.resolveMethod(targetMethod)); } - // TODO (chaeubl): we could also use the type determined after assumptions for the type-checked inlining case as it might have an effect on type filtering + // TODO (chaeubl): we could also use the type determined after assumptions for the + // type-checked inlining case as it might have an effect on type filtering if (assumptions.useOptimisticAssumptions()) { ResolvedJavaType uniqueSubtype = holder.findUniqueConcreteSubtype(); if (uniqueSubtype != null) { @@ -711,8 +737,8 @@ return getTypeCheckedInlineInfo(invoke, inliningPolicy, caller, holder, targetMethod, optimisticOpts); } - private static InlineInfo getAssumptionInlineInfo(Invoke invoke, InliningPolicy inliningPolicy, OptimisticOptimizations optimisticOpts, - ResolvedJavaMethod caller, ResolvedJavaMethod concrete, Assumption takenAssumption) { + private static InlineInfo getAssumptionInlineInfo(Invoke invoke, InliningPolicy inliningPolicy, OptimisticOptimizations optimisticOpts, ResolvedJavaMethod caller, ResolvedJavaMethod concrete, + Assumption takenAssumption) { assert !Modifier.isAbstract(concrete.getModifiers()); if (!checkTargetConditions(invoke, concrete, optimisticOpts)) { return null; @@ -721,8 +747,7 @@ return new AssumptionInlineInfo(invoke, weight, concrete, takenAssumption); } - private static InlineInfo getExactInlineInfo(Invoke invoke, InliningPolicy inliningPolicy, OptimisticOptimizations optimisticOpts, - ResolvedJavaMethod caller, ResolvedJavaMethod targetMethod) { + private static InlineInfo getExactInlineInfo(Invoke invoke, InliningPolicy inliningPolicy, OptimisticOptimizations optimisticOpts, ResolvedJavaMethod caller, ResolvedJavaMethod targetMethod) { assert !Modifier.isAbstract(targetMethod.getModifiers()); if (!checkTargetConditions(invoke, targetMethod, optimisticOpts)) { return null; @@ -731,8 +756,8 @@ return new ExactInlineInfo(invoke, weight, targetMethod); } - private static InlineInfo getTypeCheckedInlineInfo(Invoke invoke, InliningPolicy inliningPolicy, ResolvedJavaMethod caller, - ResolvedJavaType holder, ResolvedJavaMethod targetMethod, OptimisticOptimizations optimisticOpts) { + private static InlineInfo getTypeCheckedInlineInfo(Invoke invoke, InliningPolicy inliningPolicy, ResolvedJavaMethod caller, ResolvedJavaType holder, ResolvedJavaMethod targetMethod, + OptimisticOptimizations optimisticOpts) { ProfilingInfo profilingInfo = caller.getProfilingInfo(); JavaTypeProfile typeProfile = profilingInfo.getTypeProfile(invoke.bci()); if (typeProfile == null) { @@ -765,16 +790,19 @@ return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "inlining polymorphic calls is disabled (%d types)", ptypes.size()); } if (!optimisticOpts.inlineMegamorphicCalls() && notRecordedTypeProbability > 0) { - // due to filtering impossible types, notRecordedTypeProbability can be > 0 although the number of types is lower than what can be recorded in a type profile - return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "inlining megamorphic calls is disabled (%d types, %f %% not recorded types)", ptypes.size(), notRecordedTypeProbability * 100); + // due to filtering impossible types, notRecordedTypeProbability can be > 0 although + // the number of types is lower than what can be recorded in a type profile + return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "inlining megamorphic calls is disabled (%d types, %f %% not recorded types)", ptypes.size(), + notRecordedTypeProbability * 100); } // TODO (chaeubl) inlining of multiple methods should work differently // 1. check which methods can be inlined - // 2. for those methods, use weight and probability to compute which of them should be inlined + // 2. for those methods, use weight and probability to compute which of them should be + // inlined // 3. do the inlining - // a) all seen methods can be inlined -> do so and guard with deopt - // b) some methods can be inlined -> inline them and fall back to invocation if violated + // a) all seen methods can be inlined -> do so and guard with deopt + // b) some methods can be inlined -> inline them and fall back to invocation if violated // determine concrete methods and map type to specific method ArrayList concreteMethods = new ArrayList<>(); @@ -791,7 +819,7 @@ } double totalWeight = 0; - for (ResolvedJavaMethod concrete: concreteMethods) { + for (ResolvedJavaMethod concrete : concreteMethods) { if (!checkTargetConditions(invoke, concrete, optimisticOpts)) { return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "it is a polymorphic method call and at least one invoked method cannot be inlined"); } @@ -801,7 +829,6 @@ } } - private static ArrayList getCompatibleTypes(ProfiledType[] types, ResolvedJavaType holder) { ArrayList result = new ArrayList<>(); for (int i = 0; i < types.length; i++) { @@ -890,10 +917,11 @@ /** * Performs an actual inlining, thereby replacing the given invoke with the given inlineGraph. - * + * * @param invoke the invoke that will be replaced * @param inlineGraph the graph that the invoke will be replaced with - * @param receiverNullCheck true if a null check needs to be generated for non-static inlinings, false if no such check is required + * @param receiverNullCheck true if a null check needs to be generated for non-static inlinings, + * false if no such check is required */ public static Map inline(Invoke invoke, StructuredGraph inlineGraph, boolean receiverNullCheck) { NodeInputList parameters = invoke.callTarget().arguments(); @@ -924,7 +952,10 @@ } } } - replacements.put(entryPointNode, BeginNode.prevBegin(invoke.node())); // ensure proper anchoring of things that were anchored to the StartNode + replacements.put(entryPointNode, BeginNode.prevBegin(invoke.node())); // ensure proper + // anchoring of things + // that were anchored + // to the StartNode assert invoke.node().successors().first() != null : invoke; assert invoke.node().predecessor() != null; @@ -958,7 +989,8 @@ UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode); DeoptimizeNode deoptimizeNode = new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.NotCompiledExceptionHandler, invoke.leafGraphId()); unwindDuplicate.replaceAndDelete(graph.add(deoptimizeNode)); - // move the deopt upwards if there is a monitor exit that tries to use the "after exception" frame state + // move the deopt upwards if there is a monitor exit that tries to use the + // "after exception" frame state // (because there is no "after exception" frame state!) if (deoptimizeNode.predecessor() instanceof MonitorExitNode) { MonitorExitNode monitorExit = (MonitorExitNode) deoptimizeNode.predecessor(); @@ -1045,7 +1077,8 @@ NodeInputList parameters = callTarget.arguments(); ValueNode firstParam = parameters.size() <= 0 ? null : parameters.get(0); if (!callTarget.isStatic() && firstParam.kind() == Kind.Object && !firstParam.objectStamp().nonNull()) { - graph.addBeforeFixed(invoke.node(), graph.add(new FixedGuardNode(graph.unique(new IsNullNode(firstParam)), DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile, true, invoke.leafGraphId()))); + graph.addBeforeFixed(invoke.node(), graph.add(new FixedGuardNode(graph.unique(new IsNullNode(firstParam)), DeoptimizationReason.NullCheckException, + DeoptimizationAction.InvalidateReprofile, true, invoke.leafGraphId()))); } } @@ -1065,8 +1098,8 @@ } } - public static Class< ? extends FixedWithNextNode> getMacroNodeClass(ResolvedJavaMethod target) { + public static Class getMacroNodeClass(ResolvedJavaMethod target) { Object result = target.getCompilerStorage().get(Node.class); - return result == null ? null : ((Class< ? >) result).asSubclass(FixedWithNextNode.class); + return result == null ? null : ((Class) result).asSubclass(FixedWithNextNode.class); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InsertStateAfterPlaceholderPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InsertStateAfterPlaceholderPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InsertStateAfterPlaceholderPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,6 +31,7 @@ public class InsertStateAfterPlaceholderPhase extends Phase { private static class PlaceholderNode extends AbstractStateSplit implements StateSplit, Node.IterableNodeType, LIRLowerable, Canonicalizable { + public PlaceholderNode() { super(StampFactory.forVoid()); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,8 +31,8 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.phases.*; +public class IterativeConditionalEliminationPhase extends Phase { -public class IterativeConditionalEliminationPhase extends Phase { private final TargetDescription target; private final MetaAccessProvider runtime; private final Assumptions assumptions; @@ -61,10 +61,13 @@ } private static class Listener implements InputChangedListener { + private final Set canonicalizationRoots; + public Listener(Set canonicalizationRoots) { this.canonicalizationRoots = canonicalizationRoots; } + @Override public void inputChanged(Node node) { canonicalizationRoots.add(node); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LockEliminationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LockEliminationPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LockEliminationPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,7 +27,6 @@ import com.oracle.graal.nodes.util.*; import com.oracle.graal.phases.*; - public class LockEliminationPhase extends Phase { @Override diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoopSafepointInsertionPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoopSafepointInsertionPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoopSafepointInsertionPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,13 +34,13 @@ @Override protected void run(StructuredGraph graph) { - nextLoop: - for (LoopEndNode loopEnd : graph.getNodes(LoopEndNode.class)) { + nextLoop: for (LoopEndNode loopEnd : graph.getNodes(LoopEndNode.class)) { if (!loopEnd.canSafepoint()) { continue; } if (GraalOptions.OptSafepointElimination) { - // We 'eliminate' safepoints by simply never placing them into loops that have at least one call + // We 'eliminate' safepoints by simply never placing them into loops that have at + // least one call NodeIterable it = NodeIterators.dominators(loopEnd).until(loopEnd.loopBegin()); for (FixedNode n : it) { if (n instanceof Invoke) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -122,7 +122,7 @@ @Override protected void run(final StructuredGraph graph) { - int i = 0; + int i = 0; NodeBitMap processed = graph.createNodeBitMap(); while (true) { int mark = graph.getMark(); @@ -189,9 +189,12 @@ if (node.isAlive() && !processed.isMarked(node) && node instanceof Lowerable) { if (loweringTool.lastFixedNode == null) { - // We cannot lower the node now because we don't have a fixed node to anchor the replacements. - // This can happen when previous lowerings in this lowering iteration deleted the BeginNode of this block. - // In the next iteration, we will have the new BeginNode available, and we can lower this node. + // We cannot lower the node now because we don't have a fixed node to anchor the + // replacements. + // This can happen when previous lowerings in this lowering iteration deleted + // the BeginNode of this block. + // In the next iteration, we will have the new BeginNode available, and we can + // lower this node. deferred = true; } else { processed.mark(node); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/PhiStampPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/PhiStampPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/PhiStampPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,6 +26,7 @@ import com.oracle.graal.phases.*; public class PhiStampPhase extends Phase { + @Override protected void run(StructuredGraph graph) { // Infer phis stopping at loop phis. diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ReadEliminationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ReadEliminationPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ReadEliminationPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,6 +32,7 @@ import com.oracle.graal.phases.*; public class ReadEliminationPhase extends Phase { + private Queue newPhis; @Override diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -37,8 +37,8 @@ /** * This class is a phase that looks for opportunities for tail duplication. The static method - * {@link #tailDuplicate(MergeNode, TailDuplicationDecision, List)} can also be used to drive tail duplication from - * other places, e.g., inlining. + * {@link #tailDuplicate(MergeNode, TailDuplicationDecision, List)} can also be used to drive tail + * duplication from other places, e.g., inlining. */ public class TailDuplicationPhase extends Phase { @@ -52,24 +52,28 @@ private static final DebugMetric metricDuplicationOtherPerformed = Debug.metric("DuplicationOtherPerformed"); /** - * This interface is used by tail duplication to let clients decide if tail duplication should be performed. + * This interface is used by tail duplication to let clients decide if tail duplication should + * be performed. */ public interface TailDuplicationDecision { /** - * Queries if tail duplication should be performed at the given merge. If this method returns true then the tail - * duplication will be performed, because all other checks have happened before. - * + * Queries if tail duplication should be performed at the given merge. If this method + * returns true then the tail duplication will be performed, because all other checks have + * happened before. + * * @param merge The merge at which tail duplication can be performed. - * @param fixedNodeCount The size of the set of fixed nodes that forms the base for the duplicated set of nodes. + * @param fixedNodeCount The size of the set of fixed nodes that forms the base for the + * duplicated set of nodes. * @return true if the tail duplication should be performed, false otherwise. */ boolean doTransform(MergeNode merge, int fixedNodeCount); } /** - * A tail duplication decision closure that employs the default algorithm: Check if there are any phis on the merge - * whose stamps improve and that have usages within the duplicated set of fixed nodes. + * A tail duplication decision closure that employs the default algorithm: Check if there are + * any phis on the merge whose stamps improve and that have usages within the duplicated set of + * fixed nodes. */ public static final TailDuplicationDecision DEFAULT_DECISION = new TailDuplicationDecision() { @@ -122,7 +126,8 @@ @Override protected void run(StructuredGraph graph) { - // A snapshot is taken here, so that new MergeNode instances aren't considered for tail duplication. + // A snapshot is taken here, so that new MergeNode instances aren't considered for tail + // duplication. for (MergeNode merge : graph.getNodes(MergeNode.class).snapshot()) { if (!(merge instanceof LoopBeginNode) && merge.probability() >= GraalOptions.TailDuplicationProbability) { tailDuplicate(merge, DEFAULT_DECISION, null); @@ -131,18 +136,20 @@ } /** - * This method attempts to duplicate the tail of the given merge. The merge must not be a {@link LoopBeginNode}. If - * the merge is eligible for duplication (at least one fixed node in its tail, no {@link MonitorEnterNode}/ - * {@link MonitorExitNode}, non-null {@link MergeNode#stateAfter()}) then the decision callback is used to determine - * whether the tail duplication should actually be performed. If replacements is non-null, then this list of + * This method attempts to duplicate the tail of the given merge. The merge must not be a + * {@link LoopBeginNode}. If the merge is eligible for duplication (at least one fixed node in + * its tail, no {@link MonitorEnterNode}/ {@link MonitorExitNode}, non-null + * {@link MergeNode#stateAfter()}) then the decision callback is used to determine whether the + * tail duplication should actually be performed. If replacements is non-null, then this list of * {@link PiNode}s is used to replace one value per merge end. - * + * * @param merge The merge whose tail should be duplicated. - * @param decision A callback that can make the final decision if tail duplication should occur or not. - * @param replacements A list of {@link PiNode}s, or null. If this list is non-null then its size needs to match the - * merge's end count. Each entry can either be null or a {@link PiNode}, and is used to replace - * {@link PiNode#object()} with the {@link PiNode} in the duplicated branch that corresponds to the - * entry. + * @param decision A callback that can make the final decision if tail duplication should occur + * or not. + * @param replacements A list of {@link PiNode}s, or null. If this list is non-null then its + * size needs to match the merge's end count. Each entry can either be null or a + * {@link PiNode}, and is used to replace {@link PiNode#object()} with the + * {@link PiNode} in the duplicated branch that corresponds to the entry. */ public static void tailDuplicate(MergeNode merge, TailDuplicationDecision decision, List replacements) { assert !(merge instanceof LoopBeginNode); @@ -159,7 +166,8 @@ } if (containsMonitor) { // cannot currently be handled - // TODO (ls) re-evaluate this limitation after changes to the lock representation and the LIR generator + // TODO (ls) re-evaluate this limitation after changes to the lock representation and + // the LIR generator metricDuplicationMonitors.increment(); } else if (fixedCount > 1) { if (fixed instanceof EndNode && !(((EndNode) fixed).merge() instanceof LoopBeginNode)) { @@ -191,10 +199,10 @@ /** * Initializes the tail duplication operation without actually performing any work. - * + * * @param merge The merge whose tail should be duplicated. - * @param replacements A list of replacement {@link PiNode}s, or null. If this is non-null, then the size of the - * list needs to match the number of end nodes at the merge. + * @param replacements A list of replacement {@link PiNode}s, or null. If this is non-null, + * then the size of the list needs to match the number of end nodes at the merge. */ public DuplicationOperation(MergeNode merge, List replacements) { this.merge = merge; @@ -205,8 +213,8 @@ /** * Performs the actual tail duplication: *
          - *
        • Creates a new {@link ValueAnchorNode} at the beginning of the duplicated area, an transfers all - * dependencies from the merge to this anchor.
        • + *
        • Creates a new {@link ValueAnchorNode} at the beginning of the duplicated area, an + * transfers all dependencies from the merge to this anchor.
        • *
        • Determines the set of fixed nodes to be duplicated.
        • *
        • Creates the new merge at the bottom of the duplicated area.
        • *
        • Determines the complete set of duplicated nodes.
        • @@ -218,7 +226,8 @@ ValueAnchorNode anchor = addValueAnchor(); - // determine the fixed nodes that should be duplicated (currently: all nodes up until the first control + // determine the fixed nodes that should be duplicated (currently: all nodes up until + // the first control // split, end node, deopt or return. ArrayList fixedNodes = new ArrayList<>(); FixedNode fixed = merge.next(); @@ -257,7 +266,8 @@ } mergeAfter.addForwardEnd((EndNode) duplicates.get(endAfter)); - // re-wire the duplicated ValueAnchorNode to the predecessor of the corresponding EndNode + // re-wire the duplicated ValueAnchorNode to the predecessor of the corresponding + // EndNode FixedNode anchorDuplicate = (FixedNode) duplicates.get(anchor); ((FixedWithNextNode) forwardEnd.predecessor()).setNext(anchorDuplicate); // move dependencies on the ValueAnchorNode to the previous BeginNode @@ -282,7 +292,8 @@ forwardEnd.safeDelete(); } for (PhiNode phi : phiSnapshot) { - // these phis should go away, but they still need to be anchored to a merge to be valid... + // these phis should go away, but they still need to be anchored to a merge to be + // valid... if (phi.isAlive()) { phi.setMerge(mergeAfter); } @@ -291,9 +302,9 @@ } /** - * Inserts a new ValueAnchorNode after the merge and transfers all dependency-usages (not phis) to this - * ValueAnchorNode. - * + * Inserts a new ValueAnchorNode after the merge and transfers all dependency-usages (not + * phis) to this ValueAnchorNode. + * * @return The new {@link ValueAnchorNode} that was created. */ private ValueAnchorNode addValueAnchor() { @@ -310,12 +321,14 @@ } /** - * Given a set of fixed nodes, this method determines the set of fixed and floating nodes that needs to be - * duplicated, i.e., all nodes that due to data flow and other dependencies needs to be duplicated. - * + * Given a set of fixed nodes, this method determines the set of fixed and floating nodes + * that needs to be duplicated, i.e., all nodes that due to data flow and other dependencies + * needs to be duplicated. + * * @param fixedNodes The set of fixed nodes that should be duplicated. - * @param stateAfter The frame state of the merge that follows the set of fixed nodes. All {@link ValueNode}s - * reachable from this state are considered to be reachable from within the duplicated set of nodes. + * @param stateAfter The frame state of the merge that follows the set of fixed nodes. All + * {@link ValueNode}s reachable from this state are considered to be reachable + * from within the duplicated set of nodes. * @return The set of nodes that need to be duplicated. */ private HashSet buildDuplicatedNodeSet(final ArrayList fixedNodes, FrameState stateAfter) { @@ -325,7 +338,8 @@ final Deque worklist = new ArrayDeque<>(); // Build the set of nodes that have (transitive) usages within the duplicatedNodes. - // This is achieved by iterating all nodes that are reachable via inputs from the the fixed nodes. + // This is achieved by iterating all nodes that are reachable via inputs from the the + // fixed nodes. aboveBound.markAll(fixedNodes); worklist.addAll(fixedNodes); @@ -342,7 +356,8 @@ if (node instanceof PhiNode && !fixedNodes.contains(((PhiNode) node).merge())) { // stop iterating: phis belonging to outside merges are known to be outside. } else if (node instanceof FixedNode) { - // stop iterating: fixed nodes within the given set are traversal roots anyway, and all other + // stop iterating: fixed nodes within the given set are traversal roots + // anyway, and all other // fixed nodes are known to be outside. } else if (!aboveBound.isMarked(node)) { worklist.add(node); @@ -362,7 +377,8 @@ } // Build the set of nodes that have (transitive) inputs within the duplicatedNodes. - // This is achieved by iterating all nodes that are reachable via usages from the fixed nodes. + // This is achieved by iterating all nodes that are reachable via usages from the fixed + // nodes. belowBound.markAll(fixedNodes); worklist.addAll(fixedNodes); @@ -378,7 +394,8 @@ if (usage instanceof PhiNode && !fixedNodes.contains(((PhiNode) usage).merge())) { // stop iterating: phis belonging to outside merges are known to be outside. } else if (usage instanceof FixedNode) { - // stop iterating: fixed nodes within the given set are traversal roots anyway, and all other + // stop iterating: fixed nodes within the given set are traversal roots + // anyway, and all other // fixed nodes are known to be outside. } else if (!belowBound.isMarked(usage)) { worklist.add(usage); @@ -397,11 +414,11 @@ } /** - * Creates a new merge and end node construct at the end of the duplicated area. While it is useless in itself - * (merge with only one end) it simplifies the later duplication step. - * - * @param successor The successor of the duplicated set of nodes, i.e., the first node that should not be - * duplicated. + * Creates a new merge and end node construct at the end of the duplicated area. While it is + * useless in itself (merge with only one end) it simplifies the later duplication step. + * + * @param successor The successor of the duplicated set of nodes, i.e., the first node that + * should not be duplicated. * @param stateAfterMerge The frame state that should be used for the merge. * @return The newly created end node. */ @@ -420,21 +437,26 @@ /** * Expands the set of nodes to be duplicated by looking at a number of conditions: *
            - *
          • {@link ValueNode}s that have usages on the outside need to be replaced with phis for the outside usages.
          • - *
          • Non-{@link ValueNode} nodes that have outside usages (frame states, virtual object states, ...) need to - * be cloned immediately for the outside usages.
          • - *
          • Nodes that have a {@link StampFactory#extension()} or {@link StampFactory#condition()} stamp need to be - * cloned immediately for the outside usages.
          • - *
          • Dependencies into the duplicated nodes will be replaced with dependencies on the merge.
          • - *
          • Outside non-{@link ValueNode}s with usages within the duplicated set of nodes need to also be duplicated. - *
          • - *
          • Outside {@link ValueNode}s with {@link StampFactory#extension()} or {@link StampFactory#condition()} - * stamps that have usages within the duplicated set of nodes need to also be duplicated.
          • + *
          • {@link ValueNode}s that have usages on the outside need to be replaced with phis for + * the outside usages.
          • + *
          • Non-{@link ValueNode} nodes that have outside usages (frame states, virtual object + * states, ...) need to be cloned immediately for the outside usages.
          • + *
          • Nodes that have a {@link StampFactory#extension()} or + * {@link StampFactory#condition()} stamp need to be cloned immediately for the outside + * usages.
          • + *
          • Dependencies into the duplicated nodes will be replaced with dependencies on the + * merge.
          • + *
          • Outside non-{@link ValueNode}s with usages within the duplicated set of nodes need to + * also be duplicated.
          • + *
          • Outside {@link ValueNode}s with {@link StampFactory#extension()} or + * {@link StampFactory#condition()} stamps that have usages within the duplicated set of + * nodes need to also be duplicated.
          • *
          - * + * * @param duplicatedNodes The set of duplicated nodes that will be modified (expanded). - * @param newBottomMerge The merge that follows the duplicated set of nodes. It will be used for newly created - * phis and to as a target for dependencies that pointed into the duplicated set of nodes. + * @param newBottomMerge The merge that follows the duplicated set of nodes. It will be used + * for newly created phis and to as a target for dependencies that pointed into + * the duplicated set of nodes. */ private void expandDuplicated(HashSet duplicatedNodes, MergeNode newBottomMerge) { Deque worklist = new ArrayDeque<>(duplicatedNodes); @@ -468,7 +490,8 @@ // clone the offending node to the outside Node newOutsideClone = duplicated.copyWithInputs(); replaceUsagesOutside(duplicated, newOutsideClone, duplicatedNodes); - // this might cause other nodes to have outside usages, we need to look at those as well + // this might cause other nodes to have outside usages, we need to look at + // those as well for (Node input : newOutsideClone.inputs()) { if (duplicatedNodes.contains(input)) { worklist.add(input); @@ -498,10 +521,12 @@ } /** - * Moves all depdendencies that point outside the duplicated area to the supplied value anchor node. - * + * Moves all depdendencies that point outside the duplicated area to the supplied value + * anchor node. + * * @param duplicatedNodes The set of duplicated nodes. - * @param anchor The node that will be the new target for all dependencies that point outside the duplicated set of nodes. + * @param anchor The node that will be the new target for all dependencies that point + * outside the duplicated set of nodes. */ private static void retargetDependencies(HashSet duplicatedNodes, ValueAnchorNode anchor) { for (Node node : duplicatedNodes) { @@ -520,7 +545,7 @@ /** * Checks if the given node has usages that are not within the given set of nodes. - * + * * @param node The node whose usages are checked. * @param nodeSet The set of nodes that are considered to be "within". * @return true if the given node has usages on the outside, false otherwise. @@ -535,8 +560,9 @@ } /** - * Replaces the given node with the given replacement at all usages that are not within the given set of nodes. - * + * Replaces the given node with the given replacement at all usages that are not within the + * given set of nodes. + * * @param node The node to be replaced at outside usages. * @param replacement The node that replaced the given node at outside usages. * @param nodeSet The set of nodes that are considered to be "within". diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Wed Jan 23 16:34:57 2013 +0100 @@ -22,11 +22,9 @@ */ package com.oracle.graal.phases; - - /** * This class encapsulates options that control the behavior of the Graal compiler. - * + * * (thomaswue) WARNING: Fields of this class are treated as final by Graal. */ // @formatter:off diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/OptimisticOptimizations.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/OptimisticOptimizations.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/OptimisticOptimizations.java Wed Jan 23 16:34:57 2013 +0100 @@ -52,7 +52,8 @@ if (checkDeoptimizations(method.getProfilingInfo(), deoptReason)) { enabledOpts.add(optimization); } else { - // TODO (chaeubl): change to Debug.log when we are sure that optimistic optimizations are not disabled + // TODO (chaeubl): change to Debug.log when we are sure that optimistic optimizations + // are not disabled // unnecessarily TTY.println("WARN: deactivated optimistic optimization %s for %s", optimization.name(), MetaUtil.format("%H.%n(%p)", method)); disabledOptimisticOptsMetric.increment(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/Phase.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/Phase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/Phase.java Wed Jan 23 16:34:57 2013 +0100 @@ -52,6 +52,7 @@ public final void apply(final StructuredGraph graph, final boolean dumpGraph) { Debug.scope(name, this, new Runnable() { + public void run() { Phase.this.run(graph); metricPhaseRuns.increment(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhasePlan.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhasePlan.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhasePlan.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,6 +30,7 @@ * Tells the compiler about additional phases that need to be executed during compilation. */ public class PhasePlan { + // @formatter:off /** * The compilation is split into the following sections: @@ -55,8 +56,7 @@ } // @formatter:on - @SuppressWarnings("unchecked") - private final ArrayList[] phases = new ArrayList[PhasePosition.values().length]; + @SuppressWarnings("unchecked") private final ArrayList[] phases = new ArrayList[PhasePosition.values().length]; private final Set> disabledPhases = new HashSet<>(); public void addPhase(PhasePosition pos, Phase phase) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/MergeableState.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/MergeableState.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/MergeableState.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,10 +26,15 @@ import com.oracle.graal.nodes.*; -public interface MergeableState { +public interface MergeableState { + T clone(); + boolean merge(MergeNode merge, List withStates); + void loopBegin(LoopBeginNode loopBegin); + void loopEnds(LoopBeginNode loopBegin, List loopEndStates); + void afterSplit(BeginNode node); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/PostOrderNodeIterator.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/PostOrderNodeIterator.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/PostOrderNodeIterator.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,11 +28,16 @@ import com.oracle.graal.nodes.*; /** - * A PostOrderNodeIterator iterates the fixed nodes of the graph in post order starting from a specified fixed node.

          - * For this iterator the CFG is defined by the classical CFG nodes ({@link ControlSplitNode}, {@link MergeNode}...) and the {@link FixedWithNextNode#next() next} pointers - * of {@link FixedWithNextNode}.

          - * While iterating it maintains a user-defined state by calling the methods available in {@link MergeableState}. - * + * A PostOrderNodeIterator iterates the fixed nodes of the graph in post order starting from a + * specified fixed node. + *

          + * For this iterator the CFG is defined by the classical CFG nodes ({@link ControlSplitNode}, + * {@link MergeNode}...) and the {@link FixedWithNextNode#next() next} pointers of + * {@link FixedWithNextNode}. + *

          + * While iterating it maintains a user-defined state by calling the methods available in + * {@link MergeableState}. + * * @param the type of {@link MergeableState} handled by this PostOrderNodeIterator */ public abstract class PostOrderNodeIterator> { @@ -100,7 +105,7 @@ } else { assert false : current; } - } while(current != null); + } while (current != null); } private void queueSuccessors(FixedNode x, Set successors) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ReentrantBlockIterator.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ReentrantBlockIterator.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ReentrantBlockIterator.java Wed Jan 23 16:34:57 2013 +0100 @@ -89,7 +89,8 @@ Block successor = current.getSuccessors().get(0); if (successor.isLoopHeader()) { if (current.isLoopEnd()) { - // nothing to do... loop ends only lead to loop begins we've already visited + // nothing to do... loop ends only lead to loop begins we've already + // visited blockEndStates.put(current.getEndNode(), state); } else { // recurse into the loop diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ScopedPostOrderNodeIterator.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ScopedPostOrderNodeIterator.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ScopedPostOrderNodeIterator.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,6 +29,7 @@ import com.oracle.graal.nodes.*; public abstract class ScopedPostOrderNodeIterator { + private final NodeBitMap processedNodes; private final Deque nodeQueue; private final NodeBitMap queuedNodes; @@ -92,7 +93,7 @@ } else { assert false : current; } - } while(current != null); + } while (current != null); } protected void queueLoopBeginSuccessors(LoopBeginNode node) { @@ -101,7 +102,7 @@ } else if (currentScope instanceof LoopBeginNode) { // so we are currently processing loop A and found another loop B // -> queue all loop exits of B except those that also exit loop A - for (LoopExitNode loopExit: node.loopExits()) { + for (LoopExitNode loopExit : node.loopExits()) { if (!((LoopBeginNode) currentScope).loopExits().contains(loopExit)) { queue(loopExit); } @@ -120,7 +121,7 @@ protected Deque getScopes(StructuredGraph graph) { Deque result = new ArrayDeque<>(); result.push(graph.start()); - for (LoopBeginNode loopBegin: graph.getNodes(LoopBeginNode.class)) { + for (LoopBeginNode loopBegin : graph.getNodes(LoopBeginNode.class)) { result.push(loopBegin); } return result; @@ -171,5 +172,6 @@ } protected abstract void initializeScope(); + protected abstract void invoke(Invoke invoke); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/BlockClosure.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/BlockClosure.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/BlockClosure.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,5 +28,6 @@ * The {@code BlockClosure} interface represents a closure for iterating over blocks. */ public interface BlockClosure { + void apply(Block block); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,6 +34,7 @@ import com.oracle.graal.phases.*; public class SchedulePhase extends Phase { + private ControlFlowGraph cfg; private NodeMap earliestCache; @@ -57,8 +58,9 @@ } /** - * Sets {@link ScheduledNode#scheduledNext} on all scheduled nodes in all blocks using the scheduling built by @link {@link #run(StructuredGraph)}. - * This method should thus only be called when run has been successfully executed. + * Sets {@link ScheduledNode#scheduledNext} on all scheduled nodes in all blocks using the + * scheduling built by @link {@link #run(StructuredGraph)}. This method should thus only be + * called when run has been successfully executed. */ public void scheduleGraph() { assert blockToNodesMap != null : "cannot set scheduledNext before run has been executed"; @@ -110,7 +112,8 @@ } /** - * Assigns a block to the given node. This method expects that PhiNodes and FixedNodes are already assigned to a block. + * Assigns a block to the given node. This method expects that PhiNodes and FixedNodes are + * already assigned to a block. */ private void assignBlockToNode(ScheduledNode node) { assert !node.isDeleted(); @@ -119,7 +122,8 @@ if (prevBlock != null) { return; } - // PhiNodes and FixedNodes should already have been placed in blocks by ControlFlowGraph.identifyBlocks + // PhiNodes and FixedNodes should already have been placed in blocks by + // ControlFlowGraph.identifyBlocks assert !(node instanceof PhiNode) : node; assert !(node instanceof FixedNode) : node; // if in CFG, schedule at the latest position possible in the outermost loop possible @@ -139,8 +143,8 @@ } /** - * Calculates the last block that the given node could be scheduled in, i.e., the common dominator of all usages. - * To do so all usages are also assigned to blocks. + * Calculates the last block that the given node could be scheduled in, i.e., the common + * dominator of all usages. To do so all usages are also assigned to blocks. */ private Block latestBlock(ScheduledNode node) { CommonDominatorBlockClosure cdbc = new CommonDominatorBlockClosure(null); @@ -156,13 +160,17 @@ } /** - * A closure that will calculate the common dominator of all blocks passed to its {@link #apply(Block)} method. + * 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; } + @Override public void apply(Block newBlock) { this.block = getCommonDominator(this.block, newBlock); @@ -182,13 +190,14 @@ return earliest; } /* - * 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. - * - * While iterating over the inputs a set of dominator blocks of the current earliest placement is maintained. - * When the block of an input is not within this set, it becomes the current earliest placement and the list of - * dominator blocks is updated. + * 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. + * + * While iterating over the inputs a set of dominator blocks of the current earliest + * placement is maintained. When the block of an input is not within this set, it becomes + * the current earliest placement and the list of dominator blocks is updated. */ BitSet dominators = new BitSet(cfg.getBlocks().length); @@ -201,7 +210,7 @@ do { dominators.set(inputEarliest.getId()); inputEarliest = inputEarliest.getDominator(); - } while(inputEarliest != null && !dominators.get(inputEarliest.getId())); + } while (inputEarliest != null && !dominators.get(inputEarliest.getId())); } } if (earliest == null) { @@ -211,7 +220,6 @@ return earliest; } - private static Block scheduleOutOfLoops(Node n, Block latestBlock, Block earliest) { assert latestBlock != null : "no latest : " + n; Block cur = latestBlock; @@ -227,9 +235,9 @@ } /** - * Passes all blocks that a specific usage of a node is in to a given closure. - * This is more complex than just taking the usage's block because of of PhiNodes and FrameStates. - * + * Passes all blocks that a specific usage of a node is in to a given closure. This is more + * complex than just taking the usage's block because of of PhiNodes and FrameStates. + * * @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 @@ -238,8 +246,10 @@ assert !(node instanceof PhiNode); if (usage instanceof PhiNode) { - // An input to a PhiNode is used at the end of the predecessor block that corresponds to the PhiNode input. - // One PhiNode can use an input multiple times, the closure will be called for each usage. + // An input to a PhiNode is used at the end of the predecessor block that corresponds to + // the PhiNode input. + // One PhiNode can use an input multiple times, the closure will be called for each + // usage. PhiNode phi = (PhiNode) usage; MergeNode merge = phi.merge(); Block mergeBlock = cfg.getNodeToBlock().get(merge); @@ -258,15 +268,18 @@ } } } else if (usage instanceof VirtualState) { - // The following logic does not work if node is a PhiNode, but this method is never called for PhiNodes. + // The following logic does not work if node is a PhiNode, but this method is never + // called for PhiNodes. for (Node unscheduledUsage : usage.usages()) { 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. + // 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); } else if (unscheduledUsage instanceof MergeNode) { // Only FrameStates can be connected to MergeNodes. assert usage instanceof FrameState; - // If a FrameState belongs to a MergeNode then it's inputs will be placed at the common dominator of all EndNodes. + // If a FrameState belongs to a MergeNode 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)); } @@ -311,8 +324,9 @@ } /** - * Sorts the nodes within a block by adding the nodes to a list in a post-order iteration over all inputs. - * This means that a node is added to the list after all its inputs have been processed. + * Sorts the nodes within a block by adding the nodes to a list in a post-order iteration over + * all inputs. This means that a node is added to the list after all its inputs have been + * processed. */ private void sortNodesWithinBlock(Block b, NodeBitMap visited) { List instructions = blockToNodesMap.get(b); @@ -325,7 +339,8 @@ addToSorting(b, i, sortedInstructions, visited); } - // Make sure that last node gets really last (i.e. when a frame state successor hangs off it). + // Make sure that last node gets really last (i.e. when a frame state successor hangs off + // it). Node lastSorted = sortedInstructions.get(sortedInstructions.size() - 1); if (lastSorted != b.getEndNode()) { int idx = sortedInstructions.indexOf(b.getEndNode()); @@ -338,12 +353,11 @@ } if (canNotMove) { if (b.getEndNode() instanceof ControlSplitNode) { - throw new GraalInternalError("Schedule is not possible : needs to move a node after the last node of the block which can not be move"). - addContext(lastSorted). - addContext(b.getEndNode()); + throw new GraalInternalError("Schedule is not possible : needs to move a node after the last node of the block which can not be move").addContext(lastSorted).addContext( + b.getEndNode()); } - //b.setLastNode(lastSorted); + // b.setLastNode(lastSorted); } else { sortedInstructions.remove(b.getEndNode()); sortedInstructions.add(b.getEndNode()); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/ArrayMap.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/ArrayMap.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/ArrayMap.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,10 +23,10 @@ package com.oracle.graal.phases.util; /** - * The {@code ArrayMap} class implements an efficient one-level map which is implemented - * as an array. Note that because of the one-level array inside, this data structure performs best - * when the range of integer keys is small and densely used. Note that the implementation can - * handle arbitrary intervals, including negative numbers, up to intervals of size 2^31 - 1. + * The {@code ArrayMap} class implements an efficient one-level map which is implemented as an + * array. Note that because of the one-level array inside, this data structure performs best when + * the range of integer keys is small and densely used. Note that the implementation can handle + * arbitrary intervals, including negative numbers, up to intervals of size 2^31 - 1. */ public class ArrayMap { @@ -43,8 +43,9 @@ } /** - * Constructs a new {@code ArrayMap} that initially covers the specified interval. - * Note that this map will automatically expand if necessary later. + * 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 */ @@ -55,6 +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 */ @@ -79,9 +81,10 @@ /** * 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 + * @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 */ public T get(int i) { int index = i - low; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/BitMap2D.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/BitMap2D.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/BitMap2D.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,13 +32,13 @@ private BitSet map; private final int bitsPerSlot; - private int bitIndex(int slotIndex, int bitWithinSlotIndex) { - return slotIndex * bitsPerSlot + bitWithinSlotIndex; + private int bitIndex(int slotIndex, int bitWithinSlotIndex) { + return slotIndex * bitsPerSlot + bitWithinSlotIndex; } - private boolean verifyBitWithinSlotIndex(int index) { - assert index < bitsPerSlot : "index " + index + " is out of bounds " + bitsPerSlot; - return true; + private boolean verifyBitWithinSlotIndex(int index) { + assert index < bitsPerSlot : "index " + index + " is out of bounds " + bitsPerSlot; + return true; } public BitMap2D(int sizeInSlots, int bitsPerSlot) { @@ -47,50 +47,50 @@ } public int sizeInBits() { - return map.size(); + return map.size(); } // Returns number of full slots that have been allocated public int sizeInSlots() { - return map.size() / bitsPerSlot; + return map.size() / bitsPerSlot; } public boolean isValidIndex(int slotIndex, int bitWithinSlotIndex) { - assert verifyBitWithinSlotIndex(bitWithinSlotIndex); - return (bitIndex(slotIndex, bitWithinSlotIndex) < sizeInBits()); + assert verifyBitWithinSlotIndex(bitWithinSlotIndex); + return (bitIndex(slotIndex, bitWithinSlotIndex) < sizeInBits()); } - public boolean at(int slotIndex, int bitWithinSlotIndex) { - assert verifyBitWithinSlotIndex(bitWithinSlotIndex); - return map.get(bitIndex(slotIndex, bitWithinSlotIndex)); + public boolean at(int slotIndex, int bitWithinSlotIndex) { + assert verifyBitWithinSlotIndex(bitWithinSlotIndex); + return map.get(bitIndex(slotIndex, bitWithinSlotIndex)); } public void setBit(int slotIndex, int bitWithinSlotIndex) { - assert verifyBitWithinSlotIndex(bitWithinSlotIndex); - map.set(bitIndex(slotIndex, bitWithinSlotIndex)); + assert verifyBitWithinSlotIndex(bitWithinSlotIndex); + map.set(bitIndex(slotIndex, bitWithinSlotIndex)); } public void clearBit(int slotIndex, int bitWithinSlotIndex) { - assert verifyBitWithinSlotIndex(bitWithinSlotIndex); - map.clear(bitIndex(slotIndex, bitWithinSlotIndex)); + assert verifyBitWithinSlotIndex(bitWithinSlotIndex); + map.clear(bitIndex(slotIndex, bitWithinSlotIndex)); } public void atPutGrow(int slotIndex, int bitWithinSlotIndex, boolean value) { - int size = sizeInSlots(); - if (size <= slotIndex) { - while (size <= slotIndex) { - size *= 2; - } - BitSet newBitMap = new BitSet(size * bitsPerSlot); - newBitMap.or(map); - map = newBitMap; - } + int size = sizeInSlots(); + if (size <= slotIndex) { + while (size <= slotIndex) { + size *= 2; + } + BitSet newBitMap = new BitSet(size * bitsPerSlot); + newBitMap.or(map); + map = newBitMap; + } - if (value) { - setBit(slotIndex, bitWithinSlotIndex); - } else { - clearBit(slotIndex, bitWithinSlotIndex); - } + if (value) { + setBit(slotIndex, bitWithinSlotIndex); + } else { + clearBit(slotIndex, bitWithinSlotIndex); + } } public void clear() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/BlockWorkList.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/BlockWorkList.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/BlockWorkList.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,18 +25,19 @@ import com.oracle.graal.nodes.*; /** - * This class implements a worklist for dealing with blocks. The worklist can - * operate either as a stack (i.e. first-in / last-out), or as a sorted list, - * where blocks can be sorted by a supplied number. The latter usage lends itself - * naturally to iterative dataflow analysis problems. + * This class implements a worklist for dealing with blocks. The worklist can operate either as a + * stack (i.e. first-in / last-out), or as a sorted list, where blocks can be sorted by a supplied + * number. The latter usage lends itself naturally to iterative dataflow analysis problems. */ public class BlockWorkList { + MergeNode[] workList; int[] workListNumbers; int workListIndex; /** * Adds a block to this list in an unsorted fashion, like a stack. + * * @param block the block to add */ public void add(MergeNode block) { @@ -52,8 +53,9 @@ } /** - * Adds a block to this list, sorted by the supplied number. The block - * with the lowest number is returned upon subsequent removes. + * 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 */ @@ -84,9 +86,10 @@ } /** - * 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. + * 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 MergeNode removeFromWorkList() { @@ -98,6 +101,7 @@ /** * Checks whether the list is empty. + * * @return {@code true} if this list is empty */ public boolean isEmpty() { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/IntList.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/IntList.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/IntList.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,7 +26,7 @@ /** * An expandable and indexable list of {@code int}s. - * + * * This class avoids the boxing/unboxing incurred by {@code ArrayList}. */ public final class IntList { @@ -36,7 +36,7 @@ /** * Creates an int list with a specified initial capacity. - * + * * @param initialCapacity */ public IntList(int initialCapacity) { @@ -45,9 +45,10 @@ /** * 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} + * @param initialSize the initial {@linkplain #size() size} of the list (must be less than or + * equal to {@code array.length} */ public IntList(int[] array, int initialSize) { assert initialSize <= array.length; @@ -57,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} @@ -69,11 +70,12 @@ /** * 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} - * @param initialCapacity the initial capacity of the new int list (must be greater or equal to {@code length}) + * @param initialCapacity the initial capacity of the new int list (must be greater or equal to + * {@code length}) * @return a new int list whose {@linkplain #size() size} is {@code length} */ public static IntList copy(IntList other, int startIndex, int length, int initialCapacity) { @@ -89,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) { @@ -102,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()} */ @@ -122,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()} @@ -136,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}. - * + * + * 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) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/Util.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/Util.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/Util.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,7 +31,8 @@ import com.oracle.graal.nodes.calc.*; /** - * The {@code Util} class contains a motley collection of utility methods used throughout the compiler. + * The {@code Util} class contains a motley collection of utility methods used throughout the + * compiler. */ public class Util { @@ -55,7 +56,8 @@ * Statically cast an object to an arbitrary Object type. Dynamically checked. */ @SuppressWarnings("unchecked") - public static T uncheckedCast(@SuppressWarnings("unused") Class type, Object object) { + public static T uncheckedCast(@SuppressWarnings("unused") + Class type, Object object) { return (T) object; } @@ -69,7 +71,7 @@ /** * Utility method to combine a base hash with the identity hash of one or more objects. - * + * * @param hash the base hash * @param x the object to add to the hash * @return the combined hash @@ -81,7 +83,7 @@ /** * Utility method to combine a base hash with the identity hash of one or more objects. - * + * * @param hash the base hash * @param x the first object to add to the hash * @param y the second object to add to the hash @@ -94,7 +96,7 @@ /** * Utility method to combine a base hash with the identity hash of one or more objects. - * + * * @param hash the base hash * @param x the first object to add to the hash * @param y the second object to add to the hash @@ -108,7 +110,7 @@ /** * Utility method to combine a base hash with the identity hash of one or more objects. - * + * * @param hash the base hash * @param x the first object to add to the hash * @param y the second object to add to the hash @@ -150,13 +152,15 @@ } /** - * Sets the element at a given position of a list and ensures that this position exists. If the list is current - * shorter than the position, intermediate positions are filled with a given value. - * + * Sets the element at a given position of a list and ensures that this position exists. If the + * list is current shorter than the position, intermediate positions are filled with a given + * value. + * * @param list the list to put the element into * @param pos the position at which to insert the element * @param x the element that should be inserted - * @param filler the filler element that is used for the intermediate positions in case the list is shorter than pos + * @param filler the filler element that is used for the intermediate positions in case the list + * is shorter than pos */ public static void atPutGrow(List list, int pos, T x, T filler) { if (list.size() < pos + 1) { @@ -214,8 +218,9 @@ /** * Prints entries in a byte array as space separated hex values to {@link TTY}. - * - * @param address an address at which the bytes are located. This is used to print an address prefix per line of output. + * + * @param address an address at which the bytes are located. This is used to print an address + * prefix per line of output. * @param array the array containing all the bytes to print * @param bytesPerLine the number of values to print per line of output */ @@ -225,8 +230,9 @@ /** * Prints entries in a byte array as space separated hex values to {@link TTY}. - * - * @param address an address at which the bytes are located. This is used to print an address prefix per line of output. + * + * @param address an address at which the bytes are located. This is used to print an address + * prefix per line of output. * @param array the array containing the bytes to print * @param offset the offset in {@code array} of the values to print * @param length the number of values from {@code array} print @@ -297,6 +303,7 @@ public static boolean isInt(long l) { return (int) l == l; } + /** * Determines if a given {@code int} value is the range of signed short values. */ @@ -322,14 +329,14 @@ } /** - * Creates an array of integers of length "size", in which each number from 0 to (size - 1) occurs exactly once. The - * integers are sorted using the given comparator. This can be used to create a sorting for arrays that cannot be - * modified directly. - * + * Creates an array of integers of length "size", in which each number from 0 to (size - 1) + * occurs exactly once. The integers are sorted using the given comparator. This can be used to + * create a sorting for arrays that cannot be modified directly. + * * @param size The size of the range to be sorted. * @param comparator A comparator that is used to compare indexes. - * @return An array of integers that contains each number from 0 to (size - 1) exactly once, sorted using the - * comparator. + * @return An array of integers that contains each number from 0 to (size - 1) exactly once, + * sorted using the comparator. */ public static Integer[] createSortedPermutation(int size, Comparator comparator) { Integer[] indexes = new Integer[size]; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BasicIdealGraphPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BasicIdealGraphPrinter.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BasicIdealGraphPrinter.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,7 +27,8 @@ import java.util.Map.Entry; /** - * Elementary, generic generator of Ideal Graph Visualizer input for use in printers for specific data structures. + * Elementary, generic generator of Ideal Graph Visualizer input for use in printers for specific + * data structures. */ class BasicIdealGraphPrinter { @@ -35,6 +36,7 @@ * Edge between two nodes. */ protected static class Edge { + final String from; final int fromIndex; final String to; @@ -68,11 +70,8 @@ } if (obj instanceof Edge) { Edge other = (Edge) obj; - return from.equals(other.from) - && fromIndex == other.fromIndex - && to.equals(other.to) - && toIndex == other.toIndex - && (label == other.label || (label != null && label.equals(other.label))); + return from.equals(other.from) && fromIndex == other.fromIndex && to.equals(other.to) && toIndex == other.toIndex && + (label == other.label || (label != null && label.equals(other.label))); } return false; } @@ -278,7 +277,6 @@ return !stream.checkError(); } - private static String escape(String s) { StringBuilder str = null; for (int i = 0; i < s.length(); i++) { @@ -293,7 +291,7 @@ str = new StringBuilder(); str.append(s, 0, i); } - switch(c) { + switch (c) { case '&': str.append("&"); break; @@ -313,13 +311,34 @@ assert false; } break; - case '\u0000': case '\u0001': case '\u0002': case '\u0003': - case '\u0004': case '\u0005': case '\u0006': case '\u0007': - case '\u0008': case '\u000b': case '\u000c': case '\u000e': - case '\u000f': case '\u0010': case '\u0011': case '\u0012': - case '\u0013': case '\u0014': case '\u0015': case '\u0016': - case '\u0017': case '\u0018': case '\u0019': case '\u001a': - case '\u001b': case '\u001c': case '\u001d': case '\u001e': + case '\u0000': + case '\u0001': + case '\u0002': + case '\u0003': + case '\u0004': + case '\u0005': + case '\u0006': + case '\u0007': + case '\u0008': + case '\u000b': + case '\u000c': + case '\u000e': + case '\u000f': + case '\u0010': + case '\u0011': + case '\u0012': + case '\u0013': + case '\u0014': + case '\u0015': + case '\u0016': + case '\u0017': + case '\u0018': + case '\u0019': + case '\u001a': + case '\u001b': + case '\u001c': + case '\u001d': + case '\u001e': case '\u001f': if (str == null) { str = new StringBuilder(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java Wed Jan 23 16:34:57 2013 +0100 @@ -36,7 +36,8 @@ import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.phases.schedule.*; -public class BinaryGraphPrinter implements GraphPrinter{ +public class BinaryGraphPrinter implements GraphPrinter { + private static final int CONSTANT_POOL_MAX_SIZE = 2000; private static final int BEGIN_GROUP = 0x00; @@ -66,13 +67,16 @@ private static final int ENUM_KLASS = 0x01; private static final class ConstantPool extends LinkedHashMap { + private final LinkedList availableIds; private int nextId; private static final long serialVersionUID = -2676889957907285681L; + public ConstantPool() { super(50, 0.65f); availableIds = new LinkedList<>(); } + @Override protected boolean removeEldestEntry(java.util.Map.Entry eldest) { if (size() > CONSTANT_POOL_MAX_SIZE) { @@ -115,7 +119,7 @@ } catch (Throwable t) { } } - ControlFlowGraph cfg = schedule == null ? null : schedule.getCFG(); + ControlFlowGraph cfg = schedule == null ? null : schedule.getCFG(); BlockMap> blockToNodes = schedule == null ? null : schedule.getBlockToNodesMap(); Block[] blocks = cfg == null ? null : cfg.getBlocks(); writeByte(BEGIN_GRAPH); @@ -249,7 +253,7 @@ writeByte(POOL_NEW); writeInt(index); if (object instanceof Class) { - Class klass = (Class< ? >) object; + Class klass = (Class) object; writeByte(POOL_CLASS); writeString(getClassName(klass)); if (klass.isEnum()) { @@ -336,7 +340,7 @@ writeByte(PROPERTY_FALSE); } } else if (obj != null && obj.getClass().isArray()) { - Class< ? > componentType = obj.getClass().getComponentType(); + Class componentType = obj.getClass().getComponentType(); if (componentType.isPrimitive()) { if (componentType == Double.TYPE) { writeByte(PROPERTY_ARRAY); @@ -391,7 +395,7 @@ writeInt(sux.getId()); writeShort((char) pos.index); } - //inputs + // inputs NodeClassIterable inputs = node.inputs(); writeShort((char) inputs.count()); NodeClassIterator inIt = inputs.iterator(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Wed Jan 23 16:34:57 2013 +0100 @@ -54,7 +54,7 @@ /** * Creates a control flow graph printer. - * + * * @param out where the output generated via this printer shown be written */ public CFGPrinter(OutputStream out) { @@ -63,9 +63,10 @@ /** * Prints the control flow graph denoted by a given block map. - * + * * @param label A label describing the compilation phase that produced the control flow graph. - * @param blockMap A data structure describing the blocks in a method and how they are connected. + * @param blockMap A data structure describing the blocks in a method and how they are + * connected. */ public void printCFG(String label, BciBlockMapping blockMap) { begin("cfg"); @@ -113,7 +114,6 @@ out.print("loop_depth ").println(Long.bitCount(block.loops)); } - private NodeMap latestScheduling; private NodeBitMap printedNodes; @@ -123,7 +123,7 @@ /** * Prints the specified list of blocks. - * + * * @param label A label describing the compilation phase that produced the control flow graph. * @param blocks The list of blocks to be printed. */ @@ -421,7 +421,7 @@ /** * Prints the LIR for each instruction in a given block. - * + * * @param block the block to print */ private void printLIR(Block block) { @@ -442,6 +442,7 @@ final StringBuilder stateString = new StringBuilder(); inst.forEachState(new LIRInstruction.StateProcedure() { + @Override protected void doState(LIRFrameState state) { if (state.hasDebugInfo()) { @@ -486,16 +487,18 @@ private String blockToString(Block block) { if (lir == null) { - // During all the front-end phases, the block schedule is built only for the debug output. - // Therefore, the block numbers would be different for every CFG printed -> use the id of the first instruction. + // During all the front-end phases, the block schedule is built only for the debug + // output. + // Therefore, the block numbers would be different for every CFG printed -> use the id + // of the first instruction. return "B" + block.getBeginNode().toString(Verbosity.Id); } else { - // LIR instructions contain references to blocks and these blocks are printed as the blockID -> use the blockID. + // LIR instructions contain references to blocks and these blocks are printed as the + // blockID -> use the blockID. return "B" + block.getId(); } } - public void printIntervals(String label, Interval[] intervals) { begin("intervals"); out.println(String.format("name \"%s\"", label)); @@ -543,4 +546,3 @@ out.println(); } } - diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Wed Jan 23 16:34:57 2013 +0100 @@ -39,8 +39,8 @@ import com.oracle.graal.nodes.cfg.*; /** - * Observes compilation events and uses {@link CFGPrinter} to produce a control flow graph for the C1 Visualizer. + * Observes compilation events and uses {@link CFGPrinter} to produce a control flow graph for the + * C1 Visualizer. */ public class CFGPrinterObserver implements DebugDumpHandler { @@ -59,9 +59,9 @@ } /** - * Looks for the outer most method and its {@link DebugDumpScope#decorator}s - * in the current debug scope and opens a new compilation scope if this pair - * does not match the current method and decorator pair. + * Looks for the outer most method and its {@link DebugDumpScope#decorator}s in the current + * debug scope and opens a new compilation scope if this pair does not match the current method + * and decorator pair. */ private boolean checkMethodScope() { ResolvedJavaMethod method = null; @@ -153,15 +153,19 @@ final CompilationResult tm = (CompilationResult) object; final byte[] code = Arrays.copyOf(tm.getTargetCode(), tm.getTargetCodeSize()); CodeInfo info = new CodeInfo() { + public ResolvedJavaMethod getMethod() { return curMethod; } + public long getStart() { return 0L; } + public byte[] getCode() { return code; } + @Override public String toString() { int size = code == null ? 0 : code.length; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,11 +32,12 @@ import com.oracle.graal.debug.*; /** - * Utility for printing compilation related data structures at various compilation phases. - * The output format is such that it can then be fed to the - * C1 Visualizer. + * Utility for printing compilation related data structures at various compilation phases. The + * output format is such that it can then be fed to the C1 Visualizer. */ public class CompilationPrinter implements Closeable { + public static final String COLUMN_END = " <|@"; public static final String HOVER_START = "<@"; public static final String HOVER_SEP = "|@"; @@ -45,11 +46,12 @@ private static OutputStream globalOut; /** - * Gets a global output stream on a file in the current working directory. - * This stream is first opened if necessary. The name of the file - * is {@code "compilations-" + System.currentTimeMillis() + ".cfg"}. - * - * @return the global output stream or {@code null} if there was an error opening the file for writing + * Gets a global output stream on a file in the current working directory. This stream is first + * opened if necessary. The name of the file is + * {@code "compilations-" + System.currentTimeMillis() + ".cfg"}. + * + * @return the global output stream or {@code null} if there was an error opening the file for + * writing */ public static synchronized OutputStream globalOut() { if (globalOut == null) { @@ -67,7 +69,7 @@ /** * Creates a control flow graph printer. - * + * * @param os where the output generated via this printer will be sent */ public CompilationPrinter(OutputStream os) { @@ -98,7 +100,7 @@ /** * Prints a compilation timestamp for a given method. - * + * * @param method the method for which a timestamp will be printed */ public void printCompilation(JavaMethod method) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,7 +29,6 @@ import com.oracle.graal.debug.*; import com.oracle.graal.phases.*; - public class DebugEnvironment { public static void initialize(PrintStream log) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinter.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinter.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,13 +29,16 @@ import com.oracle.graal.phases.schedule.*; interface GraphPrinter extends Closeable { + /** - * Starts a new group of graphs with the given name, short name and method byte code index (BCI) as properties. + * Starts a new group of graphs with the given name, short name and method byte code index (BCI) + * as properties. */ void beginGroup(String name, String shortName, ResolvedJavaMethod method, int bci) throws IOException; /** - * Prints an entire {@link Graph} with the specified title, optionally using short names for nodes. + * Prints an entire {@link Graph} with the specified title, optionally using short names for + * nodes. */ void print(Graph graph, String title, SchedulePhase predefinedSchedule) throws IOException; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java Wed Jan 23 16:34:57 2013 +0100 @@ -35,8 +35,9 @@ import com.oracle.graal.phases.*; /** - * Observes compilation events and uses {@link IdealGraphPrinter} to generate a graph representation that can be - * inspected with the Ideal Graph Visualizer. + * Observes compilation events and uses {@link IdealGraphPrinter} to generate a graph representation + * that can be inspected with the Ideal Graph + * Visualizer. */ public class GraphPrinterDumpHandler implements DebugDumpHandler { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.printer/src/com/oracle/graal/printer/HexCodeFile.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/HexCodeFile.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/HexCodeFile.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,40 +32,41 @@ import com.oracle.graal.api.code.CompilationResult.JumpTable; import com.oracle.graal.api.code.CompilationResult.LookupTable; - /** - * A HexCodeFile is a textual format for representing a chunk of machine code along - * with extra information that can be used to enhance a disassembly of the code. - * + * A HexCodeFile is a textual format for representing a chunk of machine code along with extra + * information that can be used to enhance a disassembly of the code. + * * A pseudo grammar for a HexCodeFile is given below. + * *

            *     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 := "<||@"
            * 
          - * - * There must be exactly one HexCode and Platform part in a HexCodeFile. The length of HexDigits must be even - * as each pair of digits represents a single byte. + * + * There must be exactly one HexCode and Platform part in a HexCodeFile. The length of HexDigits + * must be even as each pair of digits represents a single byte. *

          * Below is an example of a valid Code input: + * *

          - *
          + * 
            *  Platform AMD64 64  <||@
            *  HexCode 0 e8000000009090904883ec084889842410d0ffff48893c24e800000000488b3c24488bf0e8000000004883c408c3  <||@
            *  Comment 24 frame-ref-map: +0 {0}
          @@ -81,7 +82,7 @@
            *     locals:  |stack:0:a
            *    <||@
            *  OperandComment 36 {java.lang.String.toLowerCase(Locale)}  <||@
          - *
          + * 
            * 
          */ public class HexCodeFile { @@ -112,7 +113,8 @@ public final Map> comments = new TreeMap<>(); /** - * Map from a machine code position to a comment for the operands of the instruction at the position. + * Map from a machine code position to a comment for the operands of the instruction at the + * position. */ public final Map operandComments = new TreeMap<>(); @@ -136,14 +138,16 @@ } /** - * Parses a string in the format produced by {@link #toString()} to produce a {@link HexCodeFile} object. + * Parses a string in the format produced by {@link #toString()} to produce a + * {@link HexCodeFile} object. */ public static HexCodeFile parse(String input, int sourceOffset, String source, String sourceName) { return new Parser(input, sourceOffset, source, sourceName).hcf; } /** - * Formats this HexCodeFile as a string that can be parsed with {@link #parse(String, int, String, String)}. + * Formats this HexCodeFile as a string that can be parsed with + * {@link #parse(String, int, String, String)}. */ @Override public String toString() { @@ -158,7 +162,7 @@ public void writeTo(OutputStream out) { PrintStream ps = out instanceof PrintStream ? (PrintStream) out : new PrintStream(out); - ps.printf("Platform %s %d %s%n", isa, wordWidth, SECTION_DELIM); + ps.printf("Platform %s %d %s%n", isa, wordWidth, SECTION_DELIM); ps.printf("HexCode %x %s %s%n", startAddress, HexCodeFile.hexCodeString(code), SECTION_DELIM); for (JumpTable table : jumpTables) { @@ -182,7 +186,6 @@ ps.flush(); } - /** * Formats a byte array as a string of hex digits. */ @@ -212,7 +215,7 @@ /** * Sets an operand comment for a given position. - * + * * @return the previous operand comment for {@code pos} */ public String addOperandComment(int pos, String comment) { @@ -253,8 +256,8 @@ } /** - * Helper class to parse a string in the format produced by {@link HexCodeFile#toString()} - * and produce a {@link HexCodeFile} object. + * Helper class to parse a string in the format produced by {@link HexCodeFile#toString()} and + * produce a {@link HexCodeFile} object. */ static class Parser { @@ -308,8 +311,10 @@ } static class InputPos { + final int line; final int col; + public InputPos(int line, int col) { this.line = line; this.col = col; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java Wed Jan 23 16:34:57 2013 +0100 @@ -37,10 +37,11 @@ import com.oracle.graal.phases.schedule.*; /** - * Generates a representation of {@link Graph Graphs} that can be visualized and inspected with the Ideal Graph Visualizer. + * Generates a representation of {@link Graph Graphs} that can be visualized and inspected with the + * Ideal Graph Visualizer. */ class IdealGraphPrinter extends BasicIdealGraphPrinter implements GraphPrinter { + /** * Creates a new {@link IdealGraphPrinter} that writes to the specified output stream. */ @@ -50,7 +51,8 @@ } /** - * Starts a new group of graphs with the given name, short name and method byte code index (BCI) as properties. + * Starts a new group of graphs with the given name, short name and method byte code index (BCI) + * as properties. */ @Override public void beginGroup(String name, String shortName, ResolvedJavaMethod method, int bci) { @@ -70,7 +72,8 @@ } /** - * Prints an entire {@link Graph} with the specified title, optionally using short names for nodes. + * Prints an entire {@link Graph} with the specified title, optionally using short names for + * nodes. */ @Override public void print(Graph graph, String title, SchedulePhase predefinedSchedule) { @@ -84,7 +87,7 @@ } catch (Throwable t) { } } - ControlFlowGraph cfg = schedule == null ? null : schedule.getCFG(); + ControlFlowGraph cfg = schedule == null ? null : schedule.getCFG(); beginNodes(); List edges = printNodes(graph, cfg == null ? null : cfg.getNodeToBlock(), noBlockNodes); @@ -131,9 +134,10 @@ Block block = nodeToBlock == null ? null : nodeToBlock.get(node); if (block != null) { printProperty("block", Integer.toString(block.getId())); -// if (!(node instanceof PhiNode || node instanceof FrameState || node instanceof LocalNode) && !block.nodes().contains(node)) { -// printProperty("notInOwnBlock", "true"); -// } + // if (!(node instanceof PhiNode || node instanceof FrameState || node instanceof + // LocalNode) && !block.nodes().contains(node)) { + // printProperty("notInOwnBlock", "true"); + // } } else { printProperty("block", "noBlock"); noBlockNodes.add(node); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/CheckCastTest.java --- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/CheckCastTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/CheckCastTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,8 +29,7 @@ import com.oracle.graal.nodes.java.*; /** - * Tests the implementation of checkcast, allowing profiling information to - * be manually specified. + * Tests the implementation of checkcast, allowing profiling information to be manually specified. */ public class CheckCastTest extends TypeCheckTest { @@ -45,26 +44,26 @@ @Test public void test1() { - test("asNumber", profile(), 111); - test("asNumber", profile(Integer.class), 111); - test("asNumber", profile(Long.class, Short.class), 111); - test("asNumberExt", profile(), 111); - test("asNumberExt", profile(Integer.class), 111); + test("asNumber", profile(), 111); + test("asNumber", profile(Integer.class), 111); + test("asNumber", profile(Long.class, Short.class), 111); + test("asNumberExt", profile(), 111); + test("asNumberExt", profile(Integer.class), 111); test("asNumberExt", profile(Long.class, Short.class), 111); } @Test public void test2() { - test("asString", profile(), "111"); - test("asString", profile(String.class), "111"); - test("asString", profile(String.class), "111"); + test("asString", profile(), "111"); + test("asString", profile(String.class), "111"); + test("asString", profile(String.class), "111"); final String nullString = null; - test("asString", profile(), nullString); - test("asString", profile(String.class), nullString); - test("asString", profile(String.class), nullString); + test("asString", profile(), nullString); + test("asString", profile(String.class), nullString); + test("asString", profile(String.class), nullString); - test("asStringExt", profile(), "111"); + test("asStringExt", profile(), "111"); test("asStringExt", profile(String.class), "111"); test("asStringExt", profile(String.class), "111"); } @@ -92,9 +91,9 @@ @Test public void test7() { Throwable throwable = new Exception(); - test("asThrowable", profile(), throwable); - test("asThrowable", profile(Throwable.class), throwable); - test("asThrowable", profile(Exception.class, Error.class), throwable); + test("asThrowable", profile(), throwable); + test("asThrowable", profile(Throwable.class), throwable); + test("asThrowable", profile(Exception.class, Error.class), throwable); } @Test @@ -145,20 +144,47 @@ return arr; } - static class Depth1 implements Cloneable {} - static class Depth2 extends Depth1 {} - static class Depth3 extends Depth2 {} - static class Depth4 extends Depth3 {} - static class Depth5 extends Depth4 {} - static class Depth6 extends Depth5 {} - static class Depth7 extends Depth6 {} - static class Depth8 extends Depth7 {} - static class Depth9 extends Depth8 {} - static class Depth10 extends Depth9 {} - static class Depth11 extends Depth10 {} - static class Depth12 extends Depth11 {} - static class Depth13 extends Depth12 {} - static class Depth14 extends Depth12 {} + static class Depth1 implements Cloneable { + } + + static class Depth2 extends Depth1 { + } + + static class Depth3 extends Depth2 { + } + + static class Depth4 extends Depth3 { + } + + static class Depth5 extends Depth4 { + } + + static class Depth6 extends Depth5 { + } + + static class Depth7 extends Depth6 { + } + + static class Depth8 extends Depth7 { + } + + static class Depth9 extends Depth8 { + } + + static class Depth10 extends Depth9 { + } + + static class Depth11 extends Depth10 { + } + + static class Depth12 extends Depth11 { + } + + static class Depth13 extends Depth12 { + } + + static class Depth14 extends Depth12 { + } public static Depth12 asDepth12(Object o) { return (Depth12) o; @@ -175,9 +201,9 @@ @Test public void test9() { Object o = new Depth13(); - test("asDepth12", profile(), o); - test("asDepth12", profile(Depth13.class), o); - test("asDepth12", profile(Depth13.class, Depth14.class), o); + test("asDepth12", profile(), o); + test("asDepth12", profile(Depth13.class), o); + test("asDepth12", profile(Depth13.class, Depth14.class), o); } @Test diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/InstanceOfTest.java --- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/InstanceOfTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/InstanceOfTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -39,8 +39,7 @@ import com.oracle.graal.snippets.CheckCastTest.Depth14; /** - * Tests the implementation of instanceof, allowing profiling information to - * be manually specified. + * Tests the implementation of instanceof, allowing profiling information to be manually specified. */ public class InstanceOfTest extends TypeCheckTest { @@ -60,112 +59,112 @@ @Test public void test1() { - test("isString", profile(), "object"); - test("isString", profile(String.class), "object"); + test("isString", profile(), "object"); + test("isString", profile(String.class), "object"); - test("isString", profile(), Object.class); - test("isString", profile(String.class), Object.class); + test("isString", profile(), Object.class); + test("isString", profile(String.class), Object.class); } @Test public void test2() { - test("isStringInt", profile(), "object"); - test("isStringInt", profile(String.class), "object"); + test("isStringInt", profile(), "object"); + test("isStringInt", profile(String.class), "object"); - test("isStringInt", profile(), Object.class); - test("isStringInt", profile(String.class), Object.class); + test("isStringInt", profile(), Object.class); + test("isStringInt", profile(String.class), Object.class); } @Test public void test2_1() { - test("isStringIntComplex", profile(), "object"); - test("isStringIntComplex", profile(String.class), "object"); + test("isStringIntComplex", profile(), "object"); + test("isStringIntComplex", profile(String.class), "object"); - test("isStringIntComplex", profile(), Object.class); - test("isStringIntComplex", profile(String.class), Object.class); + test("isStringIntComplex", profile(), Object.class); + test("isStringIntComplex", profile(String.class), Object.class); } @Test public void test3() { Throwable throwable = new Exception(); - test("isThrowable", profile(), throwable); - test("isThrowable", profile(Throwable.class), throwable); - test("isThrowable", profile(Exception.class, Error.class), throwable); + test("isThrowable", profile(), throwable); + test("isThrowable", profile(Throwable.class), throwable); + test("isThrowable", profile(Exception.class, Error.class), throwable); - test("isThrowable", profile(), Object.class); - test("isThrowable", profile(Throwable.class), Object.class); - test("isThrowable", profile(Exception.class, Error.class), Object.class); + test("isThrowable", profile(), Object.class); + test("isThrowable", profile(Throwable.class), Object.class); + test("isThrowable", profile(Exception.class, Error.class), Object.class); } @Test public void test3_1() { onlyFirstIsException(new Exception(), new Error()); - test("onlyFirstIsException", profile(), new Exception(), new Error()); - test("onlyFirstIsException", profile(), new Error(), new Exception()); - test("onlyFirstIsException", profile(), new Exception(), new Exception()); - test("onlyFirstIsException", profile(), new Error(), new Error()); + test("onlyFirstIsException", profile(), new Exception(), new Error()); + test("onlyFirstIsException", profile(), new Error(), new Exception()); + test("onlyFirstIsException", profile(), new Exception(), new Exception()); + test("onlyFirstIsException", profile(), new Error(), new Error()); } @Test public void test4() { Throwable throwable = new Exception(); - test("isThrowableInt", profile(), throwable); - test("isThrowableInt", profile(Throwable.class), throwable); - test("isThrowableInt", profile(Exception.class, Error.class), throwable); + test("isThrowableInt", profile(), throwable); + test("isThrowableInt", profile(Throwable.class), throwable); + test("isThrowableInt", profile(Exception.class, Error.class), throwable); - test("isThrowableInt", profile(), Object.class); - test("isThrowableInt", profile(Throwable.class), Object.class); - test("isThrowableInt", profile(Exception.class, Error.class), Object.class); + test("isThrowableInt", profile(), Object.class); + test("isThrowableInt", profile(Throwable.class), Object.class); + test("isThrowableInt", profile(Exception.class, Error.class), Object.class); } @Test public void test5() { Map map = new HashMap<>(); - test("isMap", profile(), map); - test("isMap", profile(HashMap.class), map); - test("isMap", profile(TreeMap.class, HashMap.class), map); + test("isMap", profile(), map); + test("isMap", profile(HashMap.class), map); + test("isMap", profile(TreeMap.class, HashMap.class), map); - test("isMap", profile(), Object.class); - test("isMap", profile(HashMap.class), Object.class); - test("isMap", profile(TreeMap.class, HashMap.class), Object.class); + test("isMap", profile(), Object.class); + test("isMap", profile(HashMap.class), Object.class); + test("isMap", profile(TreeMap.class, HashMap.class), Object.class); } @Test public void test6() { Map map = new HashMap<>(); - test("isMapInt", profile(), map); - test("isMapInt", profile(HashMap.class), map); - test("isMapInt", profile(TreeMap.class, HashMap.class), map); + test("isMapInt", profile(), map); + test("isMapInt", profile(HashMap.class), map); + test("isMapInt", profile(TreeMap.class, HashMap.class), map); - test("isMapInt", profile(), Object.class); - test("isMapInt", profile(HashMap.class), Object.class); - test("isMapInt", profile(TreeMap.class, HashMap.class), Object.class); + test("isMapInt", profile(), Object.class); + test("isMapInt", profile(HashMap.class), Object.class); + test("isMapInt", profile(TreeMap.class, HashMap.class), Object.class); } @Test public void test7() { Object o = new Depth13(); - test("isDepth12", profile(), o); - test("isDepth12", profile(Depth13.class), o); - test("isDepth12", profile(Depth13.class, Depth14.class), o); + test("isDepth12", profile(), o); + test("isDepth12", profile(Depth13.class), o); + test("isDepth12", profile(Depth13.class, Depth14.class), o); o = "not a depth"; - test("isDepth12", profile(), o); - test("isDepth12", profile(Depth13.class), o); - test("isDepth12", profile(Depth13.class, Depth14.class), o); + test("isDepth12", profile(), o); + test("isDepth12", profile(Depth13.class), o); + test("isDepth12", profile(Depth13.class, Depth14.class), o); } @Test public void test8() { Object o = new Depth13(); - test("isDepth12Int", profile(), o); - test("isDepth12Int", profile(Depth13.class), o); - test("isDepth12Int", profile(Depth13.class, Depth14.class), o); + test("isDepth12Int", profile(), o); + test("isDepth12Int", profile(Depth13.class), o); + test("isDepth12Int", profile(Depth13.class, Depth14.class), o); o = "not a depth"; - test("isDepth12Int", profile(), o); - test("isDepth12Int", profile(Depth13.class), o); - test("isDepth12Int", profile(Depth13.class, Depth14.class), o); + test("isDepth12Int", profile(), o); + test("isDepth12Int", profile(Depth13.class), o); + test("isDepth12Int", profile(Depth13.class, Depth14.class), o); } public static boolean isString(Object o) { @@ -232,25 +231,30 @@ } abstract static class MySite { + final int offset; + MySite(int offset) { this.offset = offset; } } static class MyMark extends MySite { + MyMark(int offset) { super(offset); } } abstract static class MySafepoint extends MySite { + MySafepoint(int offset) { super(offset); } } static class MyCall extends MySafepoint { + MyCall(int offset) { super(offset); } @@ -260,10 +264,10 @@ public void test9() { MyCall callAt63 = new MyCall(63); MyMark markAt63 = new MyMark(63); - test("compareMySites", callAt63, callAt63); - test("compareMySites", callAt63, markAt63); - test("compareMySites", markAt63, callAt63); - test("compareMySites", markAt63, markAt63); + test("compareMySites", callAt63, callAt63); + test("compareMySites", callAt63, markAt63); + test("compareMySites", markAt63, callAt63); + test("compareMySites", markAt63, markAt63); } public static int compareMySites(MySite s1, MySite s2) { @@ -278,10 +282,10 @@ Mark[] noMarks = {}; Call callAt63 = new Call("ignore", 63, 5, true, null); Mark markAt63 = new Mark(63, "1", noMarks); - test("compareSites", callAt63, callAt63); - test("compareSites", callAt63, markAt63); - test("compareSites", markAt63, callAt63); - test("compareSites", markAt63, markAt63); + test("compareSites", callAt63, callAt63); + test("compareSites", callAt63, markAt63); + test("compareSites", markAt63, callAt63); + test("compareSites", markAt63, markAt63); } public static int compareSites(Site s1, Site s2) { @@ -295,15 +299,15 @@ * This test exists to show the kind of pattern that is be optimizable by * {@code removeIntermediateMaterialization()} in {@link IfNode}. *

          - * The test exists in this source file as the transformation was originally motivated by the need to - * remove use of special JumpNodes in the {@code InstanceOfSnippets}. + * The test exists in this source file as the transformation was originally motivated by the + * need to remove use of special JumpNodes in the {@code InstanceOfSnippets}. */ @Test public void test_removeIntermediateMaterialization() { List list = Arrays.asList("1", "2", "3", "4"); - test("removeIntermediateMaterialization", profile(), list, "2", "yes", "no"); - test("removeIntermediateMaterialization", profile(), list, null, "yes", "no"); - test("removeIntermediateMaterialization", profile(), null, "2", "yes", "no"); + test("removeIntermediateMaterialization", profile(), list, "2", "yes", "no"); + test("removeIntermediateMaterialization", profile(), list, null, "yes", "no"); + test("removeIntermediateMaterialization", profile(), null, "2", "yes", "no"); } public static String removeIntermediateMaterialization(List list, Object e, String a, String b) { @@ -325,10 +329,17 @@ return b; } - abstract static class A {} - static class B extends A {} - static class C extends B {} - abstract static class D extends C {} + abstract static class A { + } + + static class B extends A { + } + + static class C extends B { + } + + abstract static class D extends C { + } public static boolean isArrayOfA(Object o) { return o instanceof A[]; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/IntrinsificationTest.java --- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/IntrinsificationTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/IntrinsificationTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -41,11 +41,12 @@ import com.oracle.graal.snippets.nodes.*; /** - * Tests if compiler intrinsics are inlined correctly. Most test cases only assert that there are no remaining - * invocations in the graph. This is sufficient if the method that is being intrinsified is a native method. - * For Java methods, additional checks are necessary. + * Tests if compiler intrinsics are inlined correctly. Most test cases only assert that there are no + * remaining invocations in the graph. This is sufficient if the method that is being intrinsified + * is a native method. For Java methods, additional checks are necessary. */ public class IntrinsificationTest extends GraalCompilerTest { + @Test public void testObjectIntrinsics() { test("getClassSnippet"); @@ -56,12 +57,12 @@ public static boolean getClassSnippet(Object obj, Class clazz) { return obj.getClass() == clazz; } + @SuppressWarnings("all") public static int objectHashCodeSnippet(TestClassA obj) { return obj.hashCode(); } - @Test public void testClassIntrinsics() { test("getModifiersSnippet"); @@ -77,32 +78,37 @@ public static int getModifiersSnippet(Class clazz) { return clazz.getModifiers(); } + @SuppressWarnings("all") public static boolean isInstanceSnippet(Class clazz) { return clazz.isInstance(Number.class); } + @SuppressWarnings("all") public static boolean isInterfaceSnippet(Class clazz) { return clazz.isInterface(); } + @SuppressWarnings("all") public static boolean isArraySnippet(Class clazz) { return clazz.isArray(); } + @SuppressWarnings("all") public static boolean isPrimitiveSnippet(Class clazz) { return clazz.isPrimitive(); } + @SuppressWarnings("all") public static Class getSuperClassSnippet(Class clazz) { return clazz.getSuperclass(); } + @SuppressWarnings("all") public static Class getComponentTypeSnippet(Class clazz) { return clazz.getComponentType(); } - @Test public void testThreadIntrinsics() { test("currentThreadSnippet"); @@ -114,16 +120,17 @@ public static Thread currentThreadSnippet() { return Thread.currentThread(); } + @SuppressWarnings("all") public static boolean threadIsInterruptedSnippet(Thread thread) { return thread.isInterrupted(); } + @SuppressWarnings("all") public static boolean threadInterruptedSnippet() { return Thread.interrupted(); } - @Test public void testSystemIntrinsics() { test("systemTimeSnippet"); @@ -132,15 +139,14 @@ @SuppressWarnings("all") public static long systemTimeSnippet() { - return System.currentTimeMillis() + - System.nanoTime(); + return System.currentTimeMillis() + System.nanoTime(); } + @SuppressWarnings("all") public static int systemIdentityHashCode(Object obj) { return System.identityHashCode(obj); } - @Test public void testUnsafeIntrinsics() { test("unsafeCompareAndSwapIntSnippet"); @@ -173,117 +179,125 @@ public static boolean unsafeCompareAndSwapIntSnippet(Unsafe unsafe, Object obj, long offset) { return unsafe.compareAndSwapInt(obj, offset, 0, 1); } + @SuppressWarnings("all") public static boolean unsafeCompareAndSwapLongSnippet(Unsafe unsafe, Object obj, long offset) { return unsafe.compareAndSwapLong(obj, offset, 0, 1); } + @SuppressWarnings("all") public static boolean unsafeCompareAndSwapObjectSnippet(Unsafe unsafe, Object obj, long offset) { return unsafe.compareAndSwapObject(obj, offset, null, new Object()); } + @SuppressWarnings("all") public static boolean unsafeGetBooleanSnippet(Unsafe unsafe, Object obj, long offset) { - return unsafe.getBoolean(obj, offset) && - unsafe.getBooleanVolatile(obj, offset); + return unsafe.getBoolean(obj, offset) && unsafe.getBooleanVolatile(obj, offset); } + @SuppressWarnings("all") public static int unsafeGetByteSnippet(Unsafe unsafe, Object obj, long offset) { - return unsafe.getByte(obj, offset) + - unsafe.getByteVolatile(obj, offset); + return unsafe.getByte(obj, offset) + unsafe.getByteVolatile(obj, offset); } + @SuppressWarnings("all") public static int unsafeGetShortSnippet(Unsafe unsafe, Object obj, long offset) { - return unsafe.getShort(obj, offset) + - unsafe.getShortVolatile(obj, offset); + return unsafe.getShort(obj, offset) + unsafe.getShortVolatile(obj, offset); } + @SuppressWarnings("all") public static int unsafeGetCharSnippet(Unsafe unsafe, Object obj, long offset) { - return unsafe.getChar(obj, offset) + - unsafe.getCharVolatile(obj, offset); + return unsafe.getChar(obj, offset) + unsafe.getCharVolatile(obj, offset); } + @SuppressWarnings("all") public static int unsafeGetIntSnippet(Unsafe unsafe, Object obj, long offset) { - return unsafe.getInt(obj, offset) + - unsafe.getIntVolatile(obj, offset); + return unsafe.getInt(obj, offset) + unsafe.getIntVolatile(obj, offset); } + @SuppressWarnings("all") public static long unsafeGetLongSnippet(Unsafe unsafe, Object obj, long offset) { - return unsafe.getLong(obj, offset) + - unsafe.getLongVolatile(obj, offset); + return unsafe.getLong(obj, offset) + unsafe.getLongVolatile(obj, offset); } + @SuppressWarnings("all") public static float unsafeGetFloatSnippet(Unsafe unsafe, Object obj, long offset) { - return unsafe.getFloat(obj, offset) + - unsafe.getFloatVolatile(obj, offset); + return unsafe.getFloat(obj, offset) + unsafe.getFloatVolatile(obj, offset); } + @SuppressWarnings("all") public static double unsafeGetDoubleSnippet(Unsafe unsafe, Object obj, long offset) { - return unsafe.getDouble(obj, offset) + - unsafe.getDoubleVolatile(obj, offset); + return unsafe.getDouble(obj, offset) + unsafe.getDoubleVolatile(obj, offset); } + @SuppressWarnings("all") public static boolean unsafeGetObjectSnippet(Unsafe unsafe, Object obj, long offset) { return unsafe.getObject(obj, offset) == unsafe.getObjectVolatile(obj, offset); } + @SuppressWarnings("all") public static void unsafePutBooleanSnippet(Unsafe unsafe, Object obj, long offset, boolean value) { unsafe.putBoolean(obj, offset, value); unsafe.putBooleanVolatile(obj, offset, value); } + @SuppressWarnings("all") public static void unsafePutByteSnippet(Unsafe unsafe, Object obj, long offset, byte value) { unsafe.putByte(obj, offset, value); unsafe.putByteVolatile(obj, offset, value); } + @SuppressWarnings("all") public static void unsafePutShortSnippet(Unsafe unsafe, Object obj, long offset, short value) { unsafe.putShort(obj, offset, value); unsafe.putShortVolatile(obj, offset, value); } + @SuppressWarnings("all") public static void unsafePutCharSnippet(Unsafe unsafe, Object obj, long offset, char value) { unsafe.putChar(obj, offset, value); unsafe.putCharVolatile(obj, offset, value); } + @SuppressWarnings("all") public static void unsafePutIntSnippet(Unsafe unsafe, Object obj, long offset, int value) { unsafe.putInt(obj, offset, value); unsafe.putIntVolatile(obj, offset, value); unsafe.putOrderedInt(obj, offset, value); } + @SuppressWarnings("all") public static void unsafePutLongSnippet(Unsafe unsafe, Object obj, long offset, long value) { unsafe.putLong(obj, offset, value); unsafe.putLongVolatile(obj, offset, value); unsafe.putOrderedLong(obj, offset, value); } + @SuppressWarnings("all") public static void unsafePutFloatSnippet(Unsafe unsafe, Object obj, long offset, float value) { unsafe.putFloat(obj, offset, value); unsafe.putFloatVolatile(obj, offset, value); } + @SuppressWarnings("all") public static void unsafePutDoubleSnippet(Unsafe unsafe, Object obj, long offset, double value) { unsafe.putDouble(obj, offset, value); unsafe.putDoubleVolatile(obj, offset, value); } + @SuppressWarnings("all") public static void unsafePutObjectSnippet(Unsafe unsafe, Object obj, long offset, Object value) { unsafe.putObject(obj, offset, value); unsafe.putObjectVolatile(obj, offset, value); unsafe.putOrderedObject(obj, offset, value); } + @SuppressWarnings("all") public static double unsafeDirectMemoryReadSnippet(Unsafe unsafe, long address) { // Unsafe.getBoolean(long) and Unsafe.getObject(long) do not exist - return unsafe.getByte(address) + - unsafe.getShort(address) + - unsafe.getChar(address) + - unsafe.getInt(address) + - unsafe.getLong(address) + - unsafe.getFloat(address) + - unsafe.getDouble(address); + return unsafe.getByte(address) + unsafe.getShort(address) + unsafe.getChar(address) + unsafe.getInt(address) + unsafe.getLong(address) + unsafe.getFloat(address) + unsafe.getDouble(address); } + @SuppressWarnings("all") public static void unsafeDirectMemoryWriteSnippet(Unsafe unsafe, long address, byte value) { // Unsafe.putBoolean(long) and Unsafe.putObject(long) do not exist @@ -296,7 +310,6 @@ unsafe.putDouble(address, value); } - @Test public void testMathIntrinsics() { assertInGraph(assertNotInGraph(test("mathAbsSnippet"), IfNode.class), MathIntrinsicNode.class); // Java @@ -307,19 +320,14 @@ public static double mathAbsSnippet(double value) { return Math.abs(value); } + @SuppressWarnings("all") public static double mathSnippet(double value) { - return Math.sqrt(value) + - Math.log(value) + - Math.log10(value) + - Math.sin(value) + - Math.cos(value) + - Math.tan(value); -// Math.exp(value) + -// Math.pow(value, 13); + return Math.sqrt(value) + Math.log(value) + Math.log10(value) + Math.sin(value) + Math.cos(value) + Math.tan(value); + // Math.exp(value) + + // Math.pow(value, 13); } - @Test public void testIntegerIntrinsics() { assertInGraph(test("integerReverseBytesSnippet"), ReverseBytesNode.class); // Java @@ -332,20 +340,22 @@ public static int integerReverseBytesSnippet(int value) { return Integer.reverseBytes(value); } + @SuppressWarnings("all") public static int integerNumberOfLeadingZerosSnippet(int value) { return Integer.numberOfLeadingZeros(value); } + @SuppressWarnings("all") public static int integerNumberOfTrailingZerosSnippet(int value) { return Integer.numberOfTrailingZeros(value); } + @SuppressWarnings("all") public static int integerBitCountSnippet(int value) { return Integer.bitCount(value); } - @Test public void testLongIntrinsics() { assertInGraph(test("longReverseBytesSnippet"), ReverseBytesNode.class); // Java @@ -358,20 +368,22 @@ public static long longReverseBytesSnippet(long value) { return Long.reverseBytes(value); } + @SuppressWarnings("all") public static long longNumberOfLeadingZerosSnippet(long value) { return Long.numberOfLeadingZeros(value); } + @SuppressWarnings("all") public static long longNumberOfTrailingZerosSnippet(long value) { return Long.numberOfTrailingZeros(value); } + @SuppressWarnings("all") public static int longBitCountSnippet(long value) { return Long.bitCount(value); } - @Test public void testFloatIntrinsics() { assertInGraph(test("floatToIntBitsSnippet"), ConvertNode.class); // Java @@ -382,12 +394,12 @@ public static int floatToIntBitsSnippet(float value) { return Float.floatToIntBits(value); } + @SuppressWarnings("all") public static float intBitsToFloatSnippet(int value) { return Float.intBitsToFloat(value); } - @Test public void testDoubleIntrinsics() { assertInGraph(test("doubleToLongBitsSnippet"), ConvertNode.class); // Java @@ -398,14 +410,15 @@ public static long doubleToLongBitsSnippet(double value) { return Double.doubleToLongBits(value); } + @SuppressWarnings("all") public static double longBitsToDoubleSnippet(long value) { return Double.longBitsToDouble(value); } - private StructuredGraph test(final String snippet) { return Debug.scope("IntrinsificationTest", runtime.lookupJavaMethod(getMethod(snippet)), new Callable() { + @Override public StructuredGraph call() { StructuredGraph graph = parse(snippet); @@ -425,7 +438,7 @@ } private static StructuredGraph assertNotInGraph(StructuredGraph graph, Class clazz) { - for (Node node: graph.getNodes()) { + for (Node node : graph.getNodes()) { if (clazz.isInstance(node)) { fail(node.toString()); } @@ -434,7 +447,7 @@ } private static StructuredGraph assertInGraph(StructuredGraph graph, Class clazz) { - for (Node node: graph.getNodes()) { + for (Node node : graph.getNodes()) { if (clazz.isInstance(node)) { return graph; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/InvokeTest.java --- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/InvokeTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/InvokeTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -41,11 +41,14 @@ } public interface I { + String virtualMethod(String s); } public static class A implements I { + final String name = "A"; + public String virtualMethod(String s) { return name + s; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/MonitorTest.java --- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/MonitorTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/MonitorTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -161,11 +161,13 @@ } static class Chars { + final char[] data; public Chars(int size) { this.data = new char[size]; } + public Chars(char[] data) { this.data = data; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewArrayTest.java --- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewArrayTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewArrayTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -59,7 +59,7 @@ @Test public void test1() { - for (String type : new String[] {"Byte", "Char", "Short", "Int", "Float", "Long", "Double", "String"}) { + for (String type : new String[]{"Byte", "Char", "Short", "Int", "Float", "Long", "Double", "String"}) { test("new" + type + "Array7"); test("new" + type + "ArrayMinus7"); test("new" + type + "Array", 7); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewInstanceTest.java --- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewInstanceTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewInstanceTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -139,10 +139,10 @@ } static class SomeObject { + String name = "o1"; HashMap map = new HashMap<>(); - public SomeObject() { map.put(name, this.getClass()); } @@ -163,6 +163,7 @@ } static class BigObject { + Object f01; Object f02; Object f03; @@ -210,12 +211,12 @@ } /** - * Tests that an earlier bug does not occur. The issue was that the loading of the TLAB - * 'top' and 'end' values was being GVN'ed from each branch of the 'if' statement. - * This meant that the allocated B object in the true branch overwrote the allocated - * array. The cause is that RegisterNode was a floating node and the reads from it - * were UnsafeLoads which are also floating. The fix was to make RegisterNode a fixed - * node (which it should have been in the first place). + * Tests that an earlier bug does not occur. The issue was that the loading of the TLAB 'top' + * and 'end' values was being GVN'ed from each branch of the 'if' statement. This meant that the + * allocated B object in the true branch overwrote the allocated array. The cause is that + * RegisterNode was a floating node and the reads from it were UnsafeLoads which are also + * floating. The fix was to make RegisterNode a fixed node (which it should have been in the + * first place). */ public static Object newRegression(boolean condition) { Object result; @@ -237,6 +238,7 @@ } static class B { + long f1 = 0xdeadbeefdeadbe01L; long f2 = 0xdeadbeefdeadbe02L; long f3 = 0xdeadbeefdeadbe03L; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewMultiArrayTest.java --- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewMultiArrayTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewMultiArrayTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -89,11 +89,11 @@ @Test public void test1() { - for (Class clazz : new Class[] {byte.class, char.class, short.class, int.class, float.class, long.class, double.class, String.class}) { + for (Class clazz : new Class[]{byte.class, char.class, short.class, int.class, float.class, long.class, double.class, String.class}) { bottomClass = clazz; bottomType = runtime.lookupJavaType(clazz); arrayType = bottomType; - for (int rank : new int[] {1, 2, 10, 50, 100, 200, 254, 255}) { + for (int rank : new int[]{1, 2, 10, 50, 100, 200, 254, 255}) { while (rank(arrayType) != rank) { arrayType = arrayType.getArrayClass(); } @@ -113,7 +113,8 @@ public static Object newMultiArray() { // This is merely a template - the NewMultiArrayNode is replaced in getCode() above. // This also means we need a separate test for correct handling of negative dimensions - // as deoptimization won't do what we want for a graph modified to be different from the source bytecode. + // as deoptimization won't do what we want for a graph modified to be different from the + // source bytecode. return new Object[10][9][8]; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/WordTest.java --- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/WordTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/WordTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -106,10 +106,10 @@ @Test public void test_compare() { - long[] words = new long[] {Long.MIN_VALUE, Long.MIN_VALUE + 1, -1L, 0L, 1L, Long.MAX_VALUE - 1, Long.MAX_VALUE}; + long[] words = new long[]{Long.MIN_VALUE, Long.MIN_VALUE + 1, -1L, 0L, 1L, Long.MAX_VALUE - 1, Long.MAX_VALUE}; for (long word1 : words) { for (long word2 : words) { - for (String method : new String[] {"aboveOrEqual", "above", "belowOrEqual", "below"}) { + for (String method : new String[]{"aboveOrEqual", "above", "belowOrEqual", "below"}) { test(method, word1, word2); test(method, word2, word1); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/ClassSubstitution.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/ClassSubstitution.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/ClassSubstitution.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,8 +29,8 @@ import com.oracle.graal.snippets.nodes.*; /** - * Denotes a class that substitutes methods of another specified class. The substitute methods are exactly those - * annotated by {@link MethodSubstitution}. + * Denotes a class that substitutes methods of another specified class. The substitute methods are + * exactly those annotated by {@link MethodSubstitution}. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @@ -39,25 +39,25 @@ /** * Specifies the original class. *

          - * If the default value is specified for this element, then a non-default value must be given for the - * {@link #className()} element. + * If the default value is specified for this element, then a non-default value must be given + * for the {@link #className()} element. */ - Class< ? > value() default ClassSubstitution.class; + Class value() default ClassSubstitution.class; /** * Specifies the original class. *

          - * This method is provided for cases where the original class is not accessible (according to Java language access - * control rules). + * This method is provided for cases where the original class is not accessible (according to + * Java language access control rules). *

          - * If the default value is specified for this element, then a non-default value must be given for the - * {@link #value()} element. + * If the default value is specified for this element, then a non-default value must be given + * for the {@link #value()} element. */ String className() default ""; /** - * Denotes a substitute method. A substitute method can call the original/substituted method by making a recursive - * call to itself. + * Denotes a substitute method. A substitute method can call the original/substituted method by + * making a recursive call to itself. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @@ -66,8 +66,8 @@ /** * Gets the name of the original method. *

          - * If the default value is specified for this element, then the name of the original method is same as the - * substitute method. + * If the default value is specified for this element, then the name of the original method + * is same as the substitute method. */ String value() default ""; @@ -79,18 +79,18 @@ /** * Gets the {@linkplain Signature#getMethodDescriptor() signature} of the original method. *

          - * If the default value is specified for this element, then the signature of the original method is the same as - * the substitute method. + * If the default value is specified for this element, then the signature of the original + * method is the same as the substitute method. */ String signature() default ""; } /** - * Denotes a macro substitute method. This replaces a method invocation with an instance of the specified node - * class. - * - * A macro substitution can be combined with a normal substitution, so that the macro node can be replaced with the - * actual substitution code during lowering. + * Denotes a macro substitute method. This replaces a method invocation with an instance of the + * specified node class. + * + * A macro substitution can be combined with a normal substitution, so that the macro node can + * be replaced with the actual substitution code during lowering. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @@ -99,8 +99,8 @@ /** * Gets the name of the substituted method. *

          - * If the default value is specified for this element, then the name of the substituted method is same as the - * substitute method. + * If the default value is specified for this element, then the name of the substituted + * method is same as the substitute method. */ String value() default ""; @@ -110,18 +110,20 @@ boolean isStatic() default true; /** - * Gets the {@linkplain Signature#getMethodDescriptor() signature} of the substituted method. + * Gets the {@linkplain Signature#getMethodDescriptor() signature} of the substituted + * method. *

          - * If the default value is specified for this element, then the signature of the substituted method is the same - * as the substitute method. + * If the default value is specified for this element, then the signature of the substituted + * method is the same as the substitute method. */ String signature() default ""; /** - * The node class with which the method invocation should be replaced. It needs to be a subclass of - * {@link FixedWithNextNode}, and it is expected to provide a public constructor that takes an InvokeNode as a - * parameter. For most cases this class should subclass {@link MacroNode} and use its constructor. + * The node class with which the method invocation should be replaced. It needs to be a + * subclass of {@link FixedWithNextNode}, and it is expected to provide a public constructor + * that takes an InvokeNode as a parameter. For most cases this class should subclass + * {@link MacroNode} and use its constructor. */ - Class< ? extends FixedWithNextNode> macro(); + Class macro(); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/GraalIntrinsics.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/GraalIntrinsics.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/GraalIntrinsics.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,6 +28,7 @@ * Definition of the snippets that are VM-independent and can be intrinsified by Graal in any VM. */ public class GraalIntrinsics { + public static void installIntrinsics(SnippetInstaller installer) { if (GraalOptions.Intrinsify) { installer.installSubstitutions(MathSubstitutionsX86.class); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/InstanceOfSnippetsTemplates.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/InstanceOfSnippetsTemplates.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/InstanceOfSnippetsTemplates.java Wed Jan 23 16:34:57 2013 +0100 @@ -39,19 +39,18 @@ import com.oracle.graal.snippets.SnippetTemplate.Key; import com.oracle.graal.snippets.SnippetTemplate.UsageReplacer; - /** - * Helper class for lowering {@link InstanceOfNode}s with snippets. The majority of the - * complexity in such a lowering derives from the fact that {@link InstanceOfNode} - * is a floating node. A snippet used to lower an {@link InstanceOfNode} will almost always - * incorporate control flow and replacing a floating node with control flow is not trivial. + * Helper class for lowering {@link InstanceOfNode}s with snippets. The majority of the complexity + * in such a lowering derives from the fact that {@link InstanceOfNode} is a floating node. A + * snippet used to lower an {@link InstanceOfNode} will almost always incorporate control flow and + * replacing a floating node with control flow is not trivial. *

          - * The mechanism implemented in this class ensures that the graph for an instanceof snippet - * is instantiated once per {@link InstanceOfNode} being lowered. The result produced the graph - * is then re-used by all usages of the node. Additionally, if there is a single usage that - * is an {@link IfNode}, the control flow in the snippet is connected directly to the true - * and false successors of the {@link IfNode}. This avoids materializating the instanceof - * test as a boolean which is then retested by the {@link IfNode}. + * The mechanism implemented in this class ensures that the graph for an instanceof snippet is + * instantiated once per {@link InstanceOfNode} being lowered. The result produced the graph is then + * re-used by all usages of the node. Additionally, if there is a single usage that is an + * {@link IfNode}, the control flow in the snippet is connected directly to the true and false + * successors of the {@link IfNode}. This avoids materializating the instanceof test as a boolean + * which is then retested by the {@link IfNode}. */ public abstract class InstanceOfSnippetsTemplates extends AbstractTemplates { @@ -63,8 +62,10 @@ * The key and arguments used to retrieve and instantiate an instanceof snippet template. */ public static class KeyAndArguments { + public final Key key; public final Arguments arguments; + public KeyAndArguments(Key key, Arguments arguments) { this.key = key; this.arguments = arguments; @@ -105,8 +106,8 @@ } /** - * Gets the specific replacer object used to replace the usage of an instanceof node - * with the result of an instantiated instanceof snippet. + * Gets the specific replacer object used to replace the usage of an instanceof node with the + * result of an instantiated instanceof snippet. */ protected InstanceOfUsageReplacer createReplacer(FloatingNode instanceOf, LoweringTool tool, int nUsages, Instantiation instantiation, Node usage, final StructuredGraph graph) { InstanceOfUsageReplacer replacer; @@ -121,10 +122,11 @@ } /** - * The result of an instantiating an instanceof snippet. - * This enables a snippet instantiation to be re-used which reduces compile time and produces better code. + * The result of an instantiating an instanceof snippet. This enables a snippet instantiation to + * be re-used which reduces compile time and produces better code. */ public static final class Instantiation { + private PhiNode result; private CompareNode condition; private ValueNode trueValue; @@ -146,7 +148,7 @@ /** * Gets the result of this instantiation as a condition. - * + * * @param testValue the returned condition is true if the result is equal to this value */ CompareNode asCondition(ValueNode testValue) { @@ -160,7 +162,7 @@ /** * Gets the result of the instantiation as a materialized value. - * + * * @param t the true value for the materialization * @param f the false value for the materialization */ @@ -179,6 +181,7 @@ * Replaces a usage of an {@link InstanceOfNode} or {@link InstanceOfDynamicNode}. */ public abstract static class InstanceOfUsageReplacer implements UsageReplacer { + public final Instantiation instantiation; public final FloatingNode instanceOf; public final ValueNode trueValue; @@ -199,7 +202,8 @@ } /** - * Replaces an {@link IfNode} usage of an {@link InstanceOfNode} or {@link InstanceOfDynamicNode}. + * Replaces an {@link IfNode} usage of an {@link InstanceOfNode} or + * {@link InstanceOfDynamicNode}. */ public static class IfUsageReplacer extends InstanceOfUsageReplacer { @@ -233,8 +237,8 @@ } /** - * Directly wires the incoming edges of the merge at the end of the snippet to - * the outgoing edges of the IfNode that uses the materialized result. + * Directly wires the incoming edges of the merge at the end of the snippet to the outgoing + * edges of the IfNode that uses the materialized result. */ private void removeIntermediateMaterialization(ValueNode newNode) { IfNode ifNode = usage; @@ -276,7 +280,8 @@ private static void connectEnds(MergeNode merge, List ends, BeginNode successor) { if (ends.size() == 0) { - // InstanceOf has been lowered to always true or always false - this successor is therefore unreachable. + // InstanceOf has been lowered to always true or always false - this successor is + // therefore unreachable. GraphUtil.killCFG(successor); } else if (ends.size() == 1) { EndNode end = ends.get(0); @@ -296,7 +301,8 @@ } /** - * Replaces a {@link ConditionalNode} usage of an {@link InstanceOfNode} or {@link InstanceOfDynamicNode}. + * Replaces a {@link ConditionalNode} usage of an {@link InstanceOfNode} or + * {@link InstanceOfDynamicNode}. */ public static class ConditionalUsageReplacer extends InstanceOfUsageReplacer { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/JavacBug.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/JavacBug.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/JavacBug.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,11 +23,14 @@ package com.oracle.graal.snippets; /** - * Used to indicate that an otherwise strange looking code pattern is required to work around a bug in javac. + * Used to indicate that an otherwise strange looking code pattern is required to work around a bug + * in javac. */ public @interface JavacBug { + /** - * A description of the bug. Only really useful if there is no existing entry for the bug in the Bug Database. + * A description of the bug. Only really useful if there is no existing entry for the bug in the + * Bug Database. */ String value() default ""; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Log.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Log.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Log.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,7 +33,8 @@ //JaCoCo Exclude /** - * Provides {@link PrintStream}-like logging facility. This should only be used in {@linkplain Snippet snippets}. + * Provides {@link PrintStream}-like logging facility. This should only be used in + * {@linkplain Snippet snippets}. */ public final class Log { @@ -43,17 +44,20 @@ // Note: Must be kept in sync with constants in c1_Runtime1.hpp private static final int LOG_OBJECT_NEWLINE = 0x01; - private static final int LOG_OBJECT_STRING = 0x02; + private static final int LOG_OBJECT_STRING = 0x02; private static final int LOG_OBJECT_ADDRESS = 0x04; @NodeIntrinsic(RuntimeCallNode.class) - private static native void log(@ConstantNodeParameter Descriptor logObject, Object object, int flags); + private static native void log(@ConstantNodeParameter + Descriptor logObject, Object object, int flags); @NodeIntrinsic(RuntimeCallNode.class) - private static native void log(@ConstantNodeParameter Descriptor logPrimitive, int typeChar, long value, boolean newline); + private static native void log(@ConstantNodeParameter + Descriptor logPrimitive, int typeChar, long value, boolean newline); @NodeIntrinsic(RuntimeCallNode.class) - private static native void printf(@ConstantNodeParameter Descriptor logPrintf, String format, long v1, long v2, long v3); + private static native void printf(@ConstantNodeParameter + Descriptor logPrintf, String format, long v1, long v2, long v3); public static void print(boolean value) { log(LOG_PRIMITIVE, Kind.Boolean.getTypeChar(), value ? 1L : 0L, false); @@ -81,17 +85,19 @@ /** * 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 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 */ public static void printf(String format, long value) { printf(LOG_PRINTF, format, value, 0L, 0L); } + public static void printf(String format, long v1, long v2) { printf(LOG_PRINTF, format, v1, v2, 0L); } + public static void printf(String format, long v1, long v2, long v3) { printf(LOG_PRINTF, format, v1, v2, v3); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/MathSubstitutionsX86.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/MathSubstitutionsX86.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/MathSubstitutionsX86.java Wed Jan 23 16:34:57 2013 +0100 @@ -59,10 +59,10 @@ } // NOTE on snippets below: - // Math.sin(), .cos() and .tan() guarantee a value within 1 ULP of the - // exact result, but x87 trigonometric FPU instructions are only that - // accurate within [-pi/4, pi/4]. Examine the passed value and provide - // a slow path for inputs outside of that interval. + // Math.sin(), .cos() and .tan() guarantee a value within 1 ULP of the + // exact result, but x87 trigonometric FPU instructions are only that + // accurate within [-pi/4, pi/4]. Examine the passed value and provide + // a slow path for inputs outside of that interval. @MethodSubstitution public static double sin(double x) { @@ -96,5 +96,6 @@ public static final Descriptor ARITHMETIC_TAN = new Descriptor("arithmeticTan", false, double.class, double.class); @NodeIntrinsic(value = RuntimeCallNode.class, setStampFromReturnType = true) - public static native double callDouble(@ConstantNodeParameter Descriptor descriptor, double value); + public static native double callDouble(@ConstantNodeParameter + Descriptor descriptor, double value); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/NodeClassSubstitutions.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/NodeClassSubstitutions.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/NodeClassSubstitutions.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,11 +28,11 @@ import com.oracle.graal.snippets.ClassSubstitution.*; /** - * Substitutions for improving the performance of some critical methods in {@link NodeClass} methods. - * These substitutions improve the performance by forcing the relevant methods to be inlined - * (intrinsification being a special form of inlining) and removing a checked cast. - * The latter cannot be done directly in Java code as {@link UnsafeCastNode} - * is not available to the project containing {@link NodeClass}. + * Substitutions for improving the performance of some critical methods in {@link NodeClass} + * methods. These substitutions improve the performance by forcing the relevant methods to be + * inlined (intrinsification being a special form of inlining) and removing a checked cast. The + * latter cannot be done directly in Java code as {@link UnsafeCastNode} is not available to the + * project containing {@link NodeClass}. */ @ClassSubstitution(NodeClass.class) public class NodeClassSubstitutions { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Snippet.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Snippet.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Snippet.java Wed Jan 23 16:34:57 2013 +0100 @@ -36,7 +36,8 @@ * A snippet is a Graal graph expressed as a Java source method. Graal snippets can be used for: *

            *
          • intrinsifying native JDK methods (see {@link ClassSubstitution})
          • - *
          • lowering operations that have runtime dependent semantics (e.g. the {@code CHECKCAST} bytecode)
          • + *
          • lowering operations that have runtime dependent semantics (e.g. the {@code CHECKCAST} + * bytecode)
          • *
          • replacing a method call with a single graph node (see {@link NodeIntrinsic})
          • *
          */ @@ -45,8 +46,8 @@ public @interface Snippet { /** - * Specifies the class defining the inlining policy for this snippet. - * A {@linkplain DefaultSnippetInliningPolicy default} policy is used if none is supplied. + * Specifies the class defining the inlining policy for this snippet. A + * {@linkplain DefaultSnippetInliningPolicy default} policy is used if none is supplied. */ Class inlining() default SnippetInliningPolicy.class; @@ -54,6 +55,7 @@ * Guides inlining decisions used when installing a snippet. */ public interface SnippetInliningPolicy { + /** * Determines if {@code method} should be inlined into {@code caller}. */ @@ -61,8 +63,8 @@ } /** - * The default inlining policy which inlines everything except for methods - * in any of the following categories. + * The default inlining policy which inlines everything except for methods in any of the + * following categories. *
            *
          • {@linkplain Fold foldable} methods
          • *
          • {@linkplain NodeIntrinsic node intrinsics}
          • @@ -71,6 +73,7 @@ *
          */ public static class DefaultSnippetInliningPolicy implements SnippetInliningPolicy { + private final MetaAccessProvider metaAccess; private final BoxingMethodPool pool; @@ -106,12 +109,11 @@ } /** - * Annotates a method replaced by a compile-time constant. - * A (resolved) call to the annotated method is replaced - * with a constant obtained by calling the annotated method via reflection. - * - * All arguments to such a method (including the receiver if applicable) - * must be compile-time constants. + * Annotates a method replaced by a compile-time constant. A (resolved) call to the annotated + * method is replaced with a constant obtained by calling the annotated method via reflection. + * + * All arguments to such a method (including the receiver if applicable) must be compile-time + * constants. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @@ -119,12 +121,13 @@ } /** - * Denotes a snippet parameter that will be bound during snippet - * template {@linkplain SnippetTemplate#instantiate instantiation}. + * Denotes a snippet parameter that will be bound during snippet template + * {@linkplain SnippetTemplate#instantiate instantiation}. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.PARAMETER) public @interface Parameter { + /** * The name of this parameter. */ @@ -132,18 +135,20 @@ } /** - * Denotes a snippet parameter representing 0 or more arguments that will be bound during snippet - * template {@linkplain SnippetTemplate#instantiate instantiation}. During snippet template creation, - * its value must be an array whose length specifies the number of arguments (the contents - * of the array are ignored) bound to the parameter during {@linkplain SnippetTemplate#instantiate instantiation}. - * - * Such a parameter must be used in a counted loop in the snippet preceded by a call - * to {@link ExplodeLoopNode#explodeLoop()}. The counted looped must be a - * standard iteration over all the loop's elements (i.e. {@code for (T e : arr) ... }). + * Denotes a snippet parameter representing 0 or more arguments that will be bound during + * snippet template {@linkplain SnippetTemplate#instantiate instantiation}. During snippet + * template creation, its value must be an array whose length specifies the number of arguments + * (the contents of the array are ignored) bound to the parameter during + * {@linkplain SnippetTemplate#instantiate instantiation}. + * + * Such a parameter must be used in a counted loop in the snippet preceded by a call to + * {@link ExplodeLoopNode#explodeLoop()}. The counted looped must be a standard iteration over + * all the loop's elements (i.e. {@code for (T e : arr) ... }). */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.PARAMETER) public @interface VarargsParameter { + /** * The name of this parameter. */ @@ -151,12 +156,13 @@ } /** - * Denotes a snippet parameter that will bound to a constant value during - * snippet template {@linkplain SnippetTemplate#instantiate instantiation}. + * Denotes a snippet parameter that will bound to a constant value during snippet template + * {@linkplain SnippetTemplate#instantiate instantiation}. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.PARAMETER) public @interface ConstantParameter { + /** * The name of this constant. */ @@ -167,6 +173,7 @@ * Wrapper for the prototype value of a {@linkplain VarargsParameter varargs} parameter. */ public static class Varargs { + private final Object args; private final Class argType; private final int length; @@ -189,8 +196,7 @@ public boolean equals(Object obj) { if (obj instanceof Varargs) { Varargs other = (Varargs) obj; - return other.argType == argType && - other.length == length; + return other.argType == argType && other.length == length; } return false; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetCounter.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetCounter.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetCounter.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,8 +34,8 @@ import com.oracle.graal.snippets.nodes.*; /** - * A counter that can be safely {@linkplain #inc() incremented} from within a - * snippet for gathering snippet specific metrics. + * A counter that can be safely {@linkplain #inc() incremented} from within a snippet for gathering + * snippet specific metrics. */ public class SnippetCounter implements Comparable { @@ -43,6 +43,7 @@ * A group of related counters. */ public static class Group { + final String name; final List counters; @@ -104,9 +105,9 @@ /** * Creates a counter. - * - * @param group the group to which the counter belongs. If this is null, the newly created counter is disabled and - * {@linkplain #inc() incrementing} is a no-op. + * + * @param group the group to which the counter belongs. If this is null, the newly created + * counter is disabled and {@linkplain #inc() incrementing} is a no-op. * @param name the name of the counter * @param description a brief comment describing the metric represented by the counter */ @@ -127,8 +128,8 @@ } /** - * Increments the value of this counter. This method can be safely used in a snippet - * if it is invoked on a compile-time constant {@link SnippetCounter} object. + * Increments the value of this counter. This method can be safely used in a snippet if it is + * invoked on a compile-time constant {@link SnippetCounter} object. */ public void inc() { if (group != null) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetFrameStateCleanupPhase.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetFrameStateCleanupPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetFrameStateCleanupPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,7 +28,8 @@ import com.oracle.graal.phases.*; /** - * Removes frame states from {@linkplain StateSplit#hasSideEffect() non-side-effecting} nodes in a snippet. + * Removes frame states from {@linkplain StateSplit#hasSideEffect() non-side-effecting} nodes in a + * snippet. */ public class SnippetFrameStateCleanupPhase extends Phase { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetInstaller.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetInstaller.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetInstaller.java Wed Jan 23 16:34:57 2013 +0100 @@ -60,10 +60,9 @@ private final Thread owner; /** - * A graph cache used by this installer to avoid using the compiler - * storage for each method processed during snippet installation. - * Without this, all processed methods are to be determined as - * {@linkplain InliningUtil#canIntrinsify intrinsifiable}. + * A graph cache used by this installer to avoid using the compiler storage for each method + * processed during snippet installation. Without this, all processed methods are to be + * determined as {@linkplain InliningUtil#canIntrinsify intrinsifiable}. */ private final Map graphCache; @@ -77,11 +76,11 @@ } /** - * Finds all the snippet methods in a given class, builds a graph for them and - * installs the graph with the key value of {@code Graph.class} in the + * Finds all the snippet methods in a given class, builds a graph for them and installs the + * graph with the key value of {@code Graph.class} in the * {@linkplain ResolvedJavaMethod#getCompilerStorage() compiler storage} of each method. */ - public void installSnippets(Class< ? extends SnippetsInterface> clazz) { + public void installSnippets(Class clazz) { for (Method method : clazz.getDeclaredMethods()) { if (method.getAnnotation(Snippet.class) != null) { int modifiers = method.getModifiers(); @@ -91,17 +90,17 @@ ResolvedJavaMethod snippet = runtime.lookupJavaMethod(method); assert snippet.getCompilerStorage().get(Graph.class) == null : method; StructuredGraph graph = makeGraph(snippet, inliningPolicy(snippet), false); - //System.out.println("snippet: " + graph); + // System.out.println("snippet: " + graph); snippet.getCompilerStorage().put(Graph.class, graph); } } } /** - * Finds all the {@linkplain MethodSubstitution substitution} methods in a given class, - * builds a graph for them. If the original class is resolvable, then the - * graph is installed with the key value of {@code Graph.class} in the - * {@linkplain ResolvedJavaMethod#getCompilerStorage() compiler storage} of each original method. + * Finds all the {@linkplain MethodSubstitution substitution} methods in a given class, builds a + * graph for them. If the original class is resolvable, then the graph is installed with the key + * value of {@code Graph.class} in the {@linkplain ResolvedJavaMethod#getCompilerStorage() + * compiler storage} of each original method. */ public void installSubstitutions(Class substitutions) { assert owner == Thread.currentThread() : "substitution installation must be single threaded"; @@ -143,7 +142,7 @@ /** * Installs a method substitution. - * + * * @param originalMethod a method being substituted * @param substituteMethod the substitute method */ @@ -151,7 +150,8 @@ substitute = runtime.lookupJavaMethod(substituteMethod); original = runtime.lookupJavaMethod(originalMethod); try { - //System.out.println("substitution: " + MetaUtil.format("%H.%n(%p)", original) + " --> " + MetaUtil.format("%H.%n(%p)", substitute)); + // System.out.println("substitution: " + MetaUtil.format("%H.%n(%p)", original) + + // " --> " + MetaUtil.format("%H.%n(%p)", substitute)); StructuredGraph graph = makeGraph(substitute, inliningPolicy(substitute), true); Object oldValue = original.getCompilerStorage().put(Graph.class, graph); assert oldValue == null; @@ -164,18 +164,18 @@ /** * Installs a macro substitution. - * + * * @param originalMethod a method being substituted * @param macro the substitute macro node class */ - protected void installMacroSubstitution(Method originalMethod, Class< ? extends FixedWithNextNode> macro) { + protected void installMacroSubstitution(Method originalMethod, Class macro) { ResolvedJavaMethod originalJavaMethod = runtime.lookupJavaMethod(originalMethod); Object oldValue = originalJavaMethod.getCompilerStorage().put(Node.class, macro); assert oldValue == null; } private SnippetInliningPolicy inliningPolicy(ResolvedJavaMethod method) { - Class< ? extends SnippetInliningPolicy> policyClass = SnippetInliningPolicy.class; + Class policyClass = SnippetInliningPolicy.class; Snippet snippet = method.getAnnotation(Snippet.class); if (snippet != null) { policyClass = snippet.inlining(); @@ -191,7 +191,8 @@ } public StructuredGraph makeGraph(final ResolvedJavaMethod method, final SnippetInliningPolicy policy, final boolean isSubstitution) { - return Debug.scope("BuildSnippetGraph", new Object[] {method}, new Callable() { + return Debug.scope("BuildSnippetGraph", new Object[]{method}, new Callable() { + @Override public StructuredGraph call() throws Exception { StructuredGraph graph = parseGraph(method, policy); @@ -218,7 +219,7 @@ StructuredGraph graph = graphCache.get(method); if (graph == null) { graph = buildGraph(method, policy == null ? inliningPolicy(method) : policy); - //System.out.println("built " + graph); + // System.out.println("built " + graph); graphCache.put(method, graph); } return graph; @@ -245,7 +246,8 @@ new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.NONE).apply(originalGraph); InliningUtil.inline(invoke, originalGraph, true); - // TODO the inlined frame states still show the call from the substitute to the original. + // TODO the inlined frame states still show the call from the substitute to the + // original. // If this poses a problem, a phase should added to fix up these frame states. Debug.dump(graph, "after inlining %s", callee); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetIntrinsificationPhase.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetIntrinsificationPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetIntrinsificationPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -46,7 +46,8 @@ private final boolean intrinsificationOrFoldingCanBeDeferred; /** - * @param intrinsificationOrFoldingCanBeDeferred if true, then {@link NonConstantParameterError}s are not fatal + * @param intrinsificationOrFoldingCanBeDeferred if true, then {@link NonConstantParameterError} + * s are not fatal */ public SnippetIntrinsificationPhase(MetaAccessProvider runtime, BoxingMethodPool pool, boolean intrinsificationOrFoldingCanBeDeferred) { this.runtime = runtime; @@ -70,8 +71,8 @@ } /** - * Exception raised when an argument to a {@linkplain Fold foldable} or - * {@link NodeIntrinsic} method is not a constant. + * Exception raised when an argument to a {@linkplain Fold foldable} or {@link NodeIntrinsic} + * method is not a constant. */ @SuppressWarnings("serial") public static class NonConstantParameterError extends Error { @@ -83,7 +84,7 @@ public static Class[] signatureToTypes(Signature signature, ResolvedJavaType accessingClass) { int count = signature.getParameterCount(false); - Class[] result = new Class< ? >[count]; + Class[] result = new Class[count]; for (int i = 0; i < result.length; ++i) { result[i] = getMirrorOrFail(signature.getParameterType(i, accessingClass).resolve(accessingClass), Thread.currentThread().getContextClassLoader()); } @@ -98,14 +99,14 @@ assert target.getAnnotation(Fold.class) == null; assert Modifier.isNative(target.getModifiers()) : "node intrinsic " + target + " should be native"; - Class< ? >[] parameterTypes = signatureToTypes(target.getSignature(), declaringClass); + Class[] parameterTypes = signatureToTypes(target.getSignature(), declaringClass); ResolvedJavaType returnType = target.getSignature().getReturnType(declaringClass).resolve(declaringClass); // Prepare the arguments for the reflective constructor call on the node class. Object[] nodeConstructorArguments = prepareArguments(invoke, parameterTypes, target, false); // Create the new node instance. - Class< ? > c = getNodeClass(target, intrinsic); + Class c = getNodeClass(target, intrinsic); Node newInstance = createNodeInstance(c, parameterTypes, returnType, intrinsic.setStampFromReturnType(), nodeConstructorArguments); // Replace the invoke with the new node. @@ -115,7 +116,7 @@ // Clean up checkcast instructions inserted by javac if the return type is generic. cleanUpReturnCheckCast(newInstance); } else if (target.getAnnotation(Fold.class) != null) { - Class< ? >[] parameterTypes = signatureToTypes(target.getSignature(), declaringClass); + Class[] parameterTypes = signatureToTypes(target.getSignature(), declaringClass); // Prepare the arguments for the reflective method call Object[] arguments = prepareArguments(invoke, parameterTypes, target, true); @@ -126,7 +127,8 @@ } // Call the method - Constant constant = callMethod(target.getSignature().getReturnKind(), getMirrorOrFail(declaringClass, Thread.currentThread().getContextClassLoader()), target.getName(), parameterTypes, receiver, arguments); + Constant constant = callMethod(target.getSignature().getReturnKind(), getMirrorOrFail(declaringClass, Thread.currentThread().getContextClassLoader()), target.getName(), parameterTypes, + receiver, arguments); if (constant != null) { // Replace the invoke with the result of the call @@ -145,10 +147,10 @@ /** * Converts the arguments of an invoke node to object values suitable for use as the arguments * to a reflective invocation of a Java constructor or method. - * + * * @param folding specifies if the invocation is for handling a {@link Fold} annotation */ - private Object[] prepareArguments(Invoke invoke, Class< ? >[] parameterTypes, ResolvedJavaMethod target, boolean folding) { + private Object[] prepareArguments(Invoke invoke, Class[] parameterTypes, ResolvedJavaMethod target, boolean folding) { NodeInputList arguments = invoke.callTarget().arguments(); Object[] reflectionCallArguments = new Object[arguments.size()]; for (int i = 0; i < reflectionCallArguments.length; ++i) { @@ -159,13 +161,14 @@ ValueNode argument = tryBoxingElimination(parameterIndex, target, arguments.get(i)); if (folding || MetaUtil.getParameterAnnotation(ConstantNodeParameter.class, parameterIndex, target) != null) { if (!(argument instanceof ConstantNode)) { - throw new NonConstantParameterError("parameter " + parameterIndex + " must be a compile time constant for calling " + invoke.methodCallTarget().targetMethod() + " at " + sourceLocation(invoke.node()) + ": " + argument); + throw new NonConstantParameterError("parameter " + parameterIndex + " must be a compile time constant for calling " + invoke.methodCallTarget().targetMethod() + " at " + + sourceLocation(invoke.node()) + ": " + argument); } ConstantNode constantNode = (ConstantNode) argument; Constant constant = constantNode.asConstant(); Object o = constant.asBoxedValue(); - if (o instanceof Class< ? >) { - reflectionCallArguments[i] = runtime.lookupJavaType((Class< ? >) o); + if (o instanceof Class) { + reflectionCallArguments[i] = runtime.lookupJavaType((Class) o); parameterTypes[i] = ResolvedJavaType.class; } else { if (parameterTypes[i] == boolean.class) { @@ -188,8 +191,8 @@ return reflectionCallArguments; } - private static Class< ? > getNodeClass(ResolvedJavaMethod target, NodeIntrinsic intrinsic) { - Class< ? > result = intrinsic.value(); + private static Class getNodeClass(ResolvedJavaMethod target, NodeIntrinsic intrinsic) { + Class result = intrinsic.value(); if (result == NodeIntrinsic.class) { return getMirrorOrFail(target.getDeclaringClass(), Thread.currentThread().getContextClassLoader()); } @@ -270,11 +273,10 @@ static final int VARARGS = 0x00000080; - private static Node createNodeInstance(Class< ? > nodeClass, Class< ? >[] parameterTypes, ResolvedJavaType returnType, boolean setStampFromReturnType, Object[] nodeConstructorArguments) { + private static Node createNodeInstance(Class nodeClass, Class[] parameterTypes, ResolvedJavaType returnType, boolean setStampFromReturnType, Object[] nodeConstructorArguments) { Object[] arguments = null; - Constructor< ? > constructor = null; - nextConstructor: - for (Constructor c : nodeClass.getDeclaredConstructors()) { + Constructor constructor = null; + nextConstructor: for (Constructor c : nodeClass.getDeclaredConstructors()) { Class[] signature = c.getParameterTypes(); if ((c.getModifiers() & VARARGS) != 0) { int fixedArgs = signature.length - 1; @@ -334,7 +336,7 @@ /** * Calls a Java method via reflection. */ - private static Constant callMethod(Kind returnKind, Class< ? > holder, String name, Class< ? >[] parameterTypes, Object receiver, Object[] arguments) { + private static Constant callMethod(Kind returnKind, Class holder, String name, Class[] parameterTypes, Object receiver, Object[] arguments) { Method method; try { method = holder.getDeclaredMethod(name, parameterTypes); @@ -371,9 +373,8 @@ graph.removeFixed(valueAnchorNode); } else if (checkCastUsage instanceof MethodCallTargetNode) { MethodCallTargetNode checkCastCallTarget = (MethodCallTargetNode) checkCastUsage; - assert pool.isUnboxingMethod(checkCastCallTarget.targetMethod()) : - "checkcast at " + sourceLocation(checkCastNode) + " not used by an unboxing method but by a call at " + - sourceLocation(checkCastCallTarget.usages().first()) + " to " + checkCastCallTarget.targetMethod(); + assert pool.isUnboxingMethod(checkCastCallTarget.targetMethod()) : "checkcast at " + sourceLocation(checkCastNode) + " not used by an unboxing method but by a call at " + + sourceLocation(checkCastCallTarget.usages().first()) + " to " + checkCastCallTarget.targetMethod(); Invoke invokeNode = checkCastCallTarget.invoke(); invokeNode.node().replaceAtUsages(newInstance); if (invokeNode instanceof InvokeWithExceptionNode) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetProvider.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetProvider.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetProvider.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,7 +24,7 @@ import com.oracle.graal.api.code.*; +public interface SnippetProvider { -public interface SnippetProvider { void installSnippets(SnippetInstaller installer, Assumptions assumptions); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java Wed Jan 23 16:34:57 2013 +0100 @@ -48,20 +48,21 @@ import com.oracle.graal.word.phases.*; /** - * A snippet template is a graph created by parsing a snippet method and then - * specialized by binding constants to the snippet's {@link ConstantParameter} parameters. - * + * A snippet template is a graph created by parsing a snippet method and then specialized by binding + * constants to the snippet's {@link ConstantParameter} parameters. + * * Snippet templates can be managed in a {@link Cache}. */ public class SnippetTemplate { /** - * A snippet template key encapsulates the method from which a snippet was built - * and the arguments used to specialize the snippet. - * + * A snippet template key encapsulates the method from which a snippet was built and the + * arguments used to specialize the snippet. + * * @see Cache */ public static class Key implements Iterable> { + public final ResolvedJavaMethod method; private final HashMap map = new HashMap<>(); private int hash; @@ -122,6 +123,7 @@ * Arguments used to instantiate a template. */ public static class Arguments implements Iterable> { + private final HashMap map = new HashMap<>(); public static Arguments arguments(String name, Object value) { @@ -158,7 +160,6 @@ private final MetaAccessProvider runtime; private final TargetDescription target; - public Cache(MetaAccessProvider runtime, TargetDescription target) { this.runtime = runtime; this.target = target; @@ -171,12 +172,13 @@ SnippetTemplate template = templates.get(key); if (template == null) { template = Debug.scope("SnippetSpecialization", key.method, new Callable() { + @Override public SnippetTemplate call() throws Exception { return new SnippetTemplate(runtime, assumptions, target, key); } }); - //System.out.println(key + " -> " + template); + // System.out.println(key + " -> " + template); templates.put(key, template); } return template; @@ -184,6 +186,7 @@ } public abstract static class AbstractTemplates { + protected final Cache cache; protected final MetaAccessProvider runtime; protected final Assumptions assumptions; @@ -334,7 +337,8 @@ do { exploded = false; ExplodeLoopNode explodeLoop = snippetCopy.getNodes().filter(ExplodeLoopNode.class).first(); - if (explodeLoop != null) { // Earlier canonicalization may have removed the loop altogether + if (explodeLoop != null) { // Earlier canonicalization may have removed the loop + // altogether LoopBeginNode loopBegin = explodeLoop.findLoopBegin(); if (loopBegin != null) { LoopEx loop = new LoopsData(snippetCopy).loop(loopBegin); @@ -415,11 +419,10 @@ return true; } if (kind == Kind.Object) { - assert arg == null || type.isInstance(Constant.forObject(arg)) : - method + ": wrong value type for " + name + ": expected " + type.getName() + ", got " + arg.getClass().getName(); + assert arg == null || type.isInstance(Constant.forObject(arg)) : method + ": wrong value type for " + name + ": expected " + type.getName() + ", got " + arg.getClass().getName(); } else { - assert arg != null && kind.toBoxedJavaClass() == arg.getClass() : - method + ": wrong value kind for " + name + ": expected " + kind + ", got " + (arg == null ? "null" : arg.getClass().getSimpleName()); + assert arg != null && kind.toBoxedJavaClass() == arg.getClass() : method + ": wrong value kind for " + name + ": expected " + kind + ", got " + + (arg == null ? "null" : arg.getClass().getSimpleName()); } return true; } @@ -438,10 +441,10 @@ private final StructuredGraph snippet; /** - * The named parameters of this template that must be bound to values during instantiation. - * For a parameter that is still live after specialization, the value in this map is either - * a {@link LocalNode} instance or a {@link LocalNode} array. For an eliminated parameter, - * the value is identical to the key. + * The named parameters of this template that must be bound to values during instantiation. For + * a parameter that is still live after specialization, the value in this map is either a + * {@link LocalNode} instance or a {@link LocalNode} array. For an eliminated parameter, the + * value is identical to the key. */ private final Map parameters; @@ -451,7 +454,8 @@ private final ReturnNode returnNode; /** - * Nodes that inherit the {@link StateSplit#stateAfter()} from the replacee during instantiation. + * Nodes that inherit the {@link StateSplit#stateAfter()} from the replacee during + * instantiation. */ private final List sideEffectNodes; @@ -467,7 +471,7 @@ /** * Gets the instantiation-time bindings to this template's parameters. - * + * * @return the map that will be used to bind arguments to parameters when inlining this template */ private IdentityHashMap bind(StructuredGraph replaceeGraph, MetaAccessProvider runtime, SnippetTemplate.Arguments args) { @@ -521,13 +525,13 @@ } /** - * Logic for replacing a snippet-lowered node at its usages with the return value - * of the snippet. An alternative to the - * {@linkplain SnippetTemplate#DEFAULT_REPLACER default} replacement logic can be used to - * handle mismatches between the stamp of the node being lowered and the - * stamp of the snippet's return value. + * Logic for replacing a snippet-lowered node at its usages with the return value of the + * snippet. An alternative to the {@linkplain SnippetTemplate#DEFAULT_REPLACER default} + * replacement logic can be used to handle mismatches between the stamp of the node being + * lowered and the stamp of the snippet's return value. */ public interface UsageReplacer { + /** * Replaces all usages of {@code oldNode} with direct or indirect usages of {@code newNode}. */ @@ -535,10 +539,11 @@ } /** - * Represents the default {@link UsageReplacer usage replacer} logic which - * simply delegates to {@link Node#replaceAtUsages(Node)}. + * Represents the default {@link UsageReplacer usage replacer} logic which simply delegates to + * {@link Node#replaceAtUsages(Node)}. */ public static final UsageReplacer DEFAULT_REPLACER = new UsageReplacer() { + @Override public void replace(ValueNode oldNode, ValueNode newNode) { oldNode.replaceAtUsages(newNode); @@ -547,17 +552,14 @@ /** * Replaces a given fixed node with this specialized snippet. - * + * * @param runtime * @param replacee the node that will be replaced * @param replacer object that replaces the usages of {@code replacee} * @param args the arguments to be bound to the flattened positional parameters of the snippet * @return the map of duplicated nodes (original -> duplicate) */ - public Map instantiate(MetaAccessProvider runtime, - FixedWithNextNode replacee, - UsageReplacer replacer, - SnippetTemplate.Arguments args) { + public Map instantiate(MetaAccessProvider runtime, FixedWithNextNode replacee, UsageReplacer replacer, SnippetTemplate.Arguments args) { // Inline the snippet nodes, replacing parameters with the given args in the process String name = snippet.name == null ? "{copy}" : snippet.name + "{copy}"; @@ -623,17 +625,14 @@ /** * Replaces a given floating node with this specialized snippet. - * + * * @param runtime * @param replacee the node that will be replaced * @param replacer object that replaces the usages of {@code replacee} * @param lastFixedNode the CFG of the snippet is inserted after this node * @param args the arguments to be bound to the flattened positional parameters of the snippet */ - public void instantiate(MetaAccessProvider runtime, - FloatingNode replacee, - UsageReplacer replacer, - FixedWithNextNode lastFixedNode, SnippetTemplate.Arguments args) { + public void instantiate(MetaAccessProvider runtime, FloatingNode replacee, UsageReplacer replacer, FixedWithNextNode lastFixedNode, SnippetTemplate.Arguments args) { // Inline the snippet nodes, replacing parameters with the given args in the process String name = snippet.name == null ? "{copy}" : snippet.name + "{copy}"; @@ -692,7 +691,7 @@ Object value = e.getValue(); buf.append(sep); sep = ", "; - if (value == UNUSED_PARAMETER) { + if (value == UNUSED_PARAMETER) { buf.append(" ").append(name); } else if (value instanceof LocalNode) { LocalNode local = (LocalNode) value; @@ -728,10 +727,8 @@ Varargs varargs = (Varargs) key.get(name); assert checkVarargs(method, signature, i, name, varargs); } else { - assert p != null : method + ": parameter " + i + " must be annotated with exactly one of " + - "@" + ConstantParameter.class.getSimpleName() + " or " + - "@" + VarargsParameter.class.getSimpleName() + " or " + - "@" + Parameter.class.getSimpleName(); + assert p != null : method + ": parameter " + i + " must be annotated with exactly one of " + "@" + ConstantParameter.class.getSimpleName() + " or " + "@" + + VarargsParameter.class.getSimpleName() + " or " + "@" + Parameter.class.getSimpleName(); } } if (!key.names().containsAll(expected)) { @@ -741,8 +738,8 @@ if (!expected.containsAll(key.names())) { Set namesCopy = new HashSet<>(key.names()); namesCopy.removeAll(expected); - assert false : "parameter(s) " + namesCopy + " should be annotated with @" + ConstantParameter.class.getSimpleName() + - " or @" + VarargsParameter.class.getSimpleName() + " in " + MetaUtil.format("%H.%n(%p)", method); + assert false : "parameter(s) " + namesCopy + " should be annotated with @" + ConstantParameter.class.getSimpleName() + " or @" + VarargsParameter.class.getSimpleName() + " in " + + MetaUtil.format("%H.%n(%p)", method); } return true; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/UnsafeSubstitutions.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/UnsafeSubstitutions.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/UnsafeSubstitutions.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,23 +34,28 @@ */ @ClassSubstitution(sun.misc.Unsafe.class) public class UnsafeSubstitutions { + @MethodSubstitution(isStatic = false) - public static boolean compareAndSwapObject(@SuppressWarnings("unused") final Object thisObj, Object o, long offset, Object expected, Object x) { + public static boolean compareAndSwapObject(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset, Object expected, Object x) { return CompareAndSwapNode.compareAndSwap(o, 0, offset, expected, x); } @MethodSubstitution(isStatic = false) - public static boolean compareAndSwapInt(@SuppressWarnings("unused") final Object thisObj, Object o, long offset, int expected, int x) { + public static boolean compareAndSwapInt(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset, int expected, int x) { return CompareAndSwapNode.compareAndSwap(o, 0, offset, expected, x); } @MethodSubstitution(isStatic = false) - public static boolean compareAndSwapLong(@SuppressWarnings("unused") final Object thisObj, Object o, long offset, long expected, long x) { + public static boolean compareAndSwapLong(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset, long expected, long x) { return CompareAndSwapNode.compareAndSwap(o, 0, offset, expected, x); } @MethodSubstitution(isStatic = false) - public static Object getObject(@SuppressWarnings("unused") final Object thisObj, Object o, long offset) { + public static Object getObject(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset) { return UnsafeLoadNode.load(o, 0, offset, Kind.Object); } @@ -63,7 +68,8 @@ } @MethodSubstitution(isStatic = false) - public static void putObject(@SuppressWarnings("unused") final Object thisObj, Object o, long offset, Object x) { + public static void putObject(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset, Object x) { UnsafeStoreNode.store(o, 0, offset, x, Kind.Object); } @@ -82,7 +88,8 @@ } @MethodSubstitution(isStatic = false) - public static int getInt(@SuppressWarnings("unused") final Object thisObj, Object o, long offset) { + public static int getInt(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset) { Integer value = UnsafeLoadNode.load(o, 0, offset, Kind.Int); return value; } @@ -96,7 +103,8 @@ } @MethodSubstitution(isStatic = false) - public static void putInt(@SuppressWarnings("unused") final Object thisObj, Object o, long offset, int x) { + public static void putInt(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset, int x) { UnsafeStoreNode.store(o, 0, offset, x, Kind.Int); } @@ -115,7 +123,8 @@ } @MethodSubstitution(isStatic = false) - public static boolean getBoolean(@SuppressWarnings("unused") final Object thisObj, Object o, long offset) { + public static boolean getBoolean(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset) { @JavacBug(id = 6995200) Boolean result = UnsafeLoadNode.load(o, 0, offset, Kind.Boolean); return result; @@ -130,7 +139,8 @@ } @MethodSubstitution(isStatic = false) - public static void putBoolean(@SuppressWarnings("unused") final Object thisObj, Object o, long offset, boolean x) { + public static void putBoolean(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset, boolean x) { UnsafeStoreNode.store(o, 0, offset, x, Kind.Boolean); } @@ -142,7 +152,8 @@ } @MethodSubstitution(isStatic = false) - public static byte getByte(@SuppressWarnings("unused") final Object thisObj, Object o, long offset) { + public static byte getByte(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset) { @JavacBug(id = 6995200) Byte result = UnsafeLoadNode.load(o, 0, offset, Kind.Byte); return result; @@ -157,7 +168,8 @@ } @MethodSubstitution(isStatic = false) - public static void putByte(@SuppressWarnings("unused") final Object thisObj, Object o, long offset, byte x) { + public static void putByte(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset, byte x) { UnsafeStoreNode.store(o, 0, offset, x, Kind.Byte); } @@ -169,7 +181,8 @@ } @MethodSubstitution(isStatic = false) - public static short getShort(@SuppressWarnings("unused") final Object thisObj, Object o, long offset) { + public static short getShort(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset) { @JavacBug(id = 6995200) Short result = UnsafeLoadNode.load(o, 0, offset, Kind.Short); return result; @@ -184,7 +197,8 @@ } @MethodSubstitution(isStatic = false) - public static void putShort(@SuppressWarnings("unused") final Object thisObj, Object o, long offset, short x) { + public static void putShort(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset, short x) { UnsafeStoreNode.store(o, 0, offset, x, Kind.Short); } @@ -196,7 +210,8 @@ } @MethodSubstitution(isStatic = false) - public static char getChar(@SuppressWarnings("unused") final Object thisObj, Object o, long offset) { + public static char getChar(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset) { @JavacBug(id = 6995200) Character result = UnsafeLoadNode.load(o, 0, offset, Kind.Char); return result; @@ -211,7 +226,8 @@ } @MethodSubstitution(isStatic = false) - public static void putChar(@SuppressWarnings("unused") final Object thisObj, Object o, long offset, char x) { + public static void putChar(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset, char x) { UnsafeStoreNode.store(o, 0, offset, x, Kind.Char); } @@ -223,7 +239,8 @@ } @MethodSubstitution(isStatic = false) - public static long getLong(@SuppressWarnings("unused") final Object thisObj, Object o, long offset) { + public static long getLong(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset) { @JavacBug(id = 6995200) Long result = UnsafeLoadNode.load(o, 0, offset, Kind.Long); return result; @@ -238,7 +255,8 @@ } @MethodSubstitution(isStatic = false) - public static void putLong(@SuppressWarnings("unused") final Object thisObj, Object o, long offset, long x) { + public static void putLong(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset, long x) { UnsafeStoreNode.store(o, 0, offset, x, Kind.Long); } @@ -257,7 +275,8 @@ } @MethodSubstitution(isStatic = false) - public static float getFloat(@SuppressWarnings("unused") final Object thisObj, Object o, long offset) { + public static float getFloat(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset) { @JavacBug(id = 6995200) Float result = UnsafeLoadNode.load(o, 0, offset, Kind.Float); return result; @@ -272,7 +291,8 @@ } @MethodSubstitution(isStatic = false) - public static void putFloat(@SuppressWarnings("unused") final Object thisObj, Object o, long offset, float x) { + public static void putFloat(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset, float x) { UnsafeStoreNode.store(o, 0, offset, x, Kind.Float); } @@ -284,7 +304,8 @@ } @MethodSubstitution(isStatic = false) - public static double getDouble(@SuppressWarnings("unused") final Object thisObj, Object o, long offset) { + public static double getDouble(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset) { @JavacBug(id = 6995200) Double result = UnsafeLoadNode.load(o, 0, offset, Kind.Double); return result; @@ -299,7 +320,8 @@ } @MethodSubstitution(isStatic = false) - public static void putDouble(@SuppressWarnings("unused") final Object thisObj, Object o, long offset, double x) { + public static void putDouble(@SuppressWarnings("unused") + final Object thisObj, Object o, long offset, double x) { UnsafeStoreNode.store(o, 0, offset, x, Kind.Double); } @@ -311,72 +333,86 @@ } @MethodSubstitution(isStatic = false) - public static void putByte(@SuppressWarnings("unused") final Object thisObj, long address, byte value) { + public static void putByte(@SuppressWarnings("unused") + final Object thisObj, long address, byte value) { DirectStoreNode.store(address, value); } @MethodSubstitution(isStatic = false) - public static void putShort(@SuppressWarnings("unused") final Object thisObj, long address, short value) { + public static void putShort(@SuppressWarnings("unused") + final Object thisObj, long address, short value) { DirectStoreNode.store(address, value); } @MethodSubstitution(isStatic = false) - public static void putChar(@SuppressWarnings("unused") final Object thisObj, long address, char value) { + public static void putChar(@SuppressWarnings("unused") + final Object thisObj, long address, char value) { DirectStoreNode.store(address, value); } @MethodSubstitution(isStatic = false) - public static void putInt(@SuppressWarnings("unused") final Object thisObj, long address, int value) { + public static void putInt(@SuppressWarnings("unused") + final Object thisObj, long address, int value) { DirectStoreNode.store(address, value); } @MethodSubstitution(isStatic = false) - public static void putLong(@SuppressWarnings("unused") final Object thisObj, long address, long value) { + public static void putLong(@SuppressWarnings("unused") + final Object thisObj, long address, long value) { DirectStoreNode.store(address, value); } @MethodSubstitution(isStatic = false) - public static void putFloat(@SuppressWarnings("unused") final Object thisObj, long address, float value) { + public static void putFloat(@SuppressWarnings("unused") + final Object thisObj, long address, float value) { DirectStoreNode.store(address, value); } @MethodSubstitution(isStatic = false) - public static void putDouble(@SuppressWarnings("unused") final Object thisObj, long address, double value) { + public static void putDouble(@SuppressWarnings("unused") + final Object thisObj, long address, double value) { DirectStoreNode.store(address, value); } @MethodSubstitution(isStatic = false) - public static byte getByte(@SuppressWarnings("unused") final Object thisObj, long address) { + public static byte getByte(@SuppressWarnings("unused") + final Object thisObj, long address) { return DirectReadNode.read(address, Kind.Byte); } @MethodSubstitution(isStatic = false) - public static short getShort(@SuppressWarnings("unused") final Object thisObj, long address) { + public static short getShort(@SuppressWarnings("unused") + final Object thisObj, long address) { return DirectReadNode.read(address, Kind.Short); } @MethodSubstitution(isStatic = false) - public static char getChar(@SuppressWarnings("unused") final Object thisObj, long address) { + public static char getChar(@SuppressWarnings("unused") + final Object thisObj, long address) { return DirectReadNode.read(address, Kind.Char); } @MethodSubstitution(isStatic = false) - public static int getInt(@SuppressWarnings("unused") final Object thisObj, long address) { + public static int getInt(@SuppressWarnings("unused") + final Object thisObj, long address) { return DirectReadNode.read(address, Kind.Int); } @MethodSubstitution(isStatic = false) - public static long getLong(@SuppressWarnings("unused") final Object thisObj, long address) { + public static long getLong(@SuppressWarnings("unused") + final Object thisObj, long address) { return DirectReadNode.read(address, Kind.Long); } @MethodSubstitution(isStatic = false) - public static float getFloat(@SuppressWarnings("unused") final Object thisObj, long address) { + public static float getFloat(@SuppressWarnings("unused") + final Object thisObj, long address) { return DirectReadNode.read(address, Kind.Float); } @MethodSubstitution(isStatic = false) - public static double getDouble(@SuppressWarnings("unused") final Object thisObj, long address) { + public static double getDouble(@SuppressWarnings("unused") + final Object thisObj, long address) { return DirectReadNode.read(address, Kind.Double); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/UnsignedMathSubstitutions.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/UnsignedMathSubstitutions.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/UnsignedMathSubstitutions.java Wed Jan 23 16:34:57 2013 +0100 @@ -127,14 +127,18 @@ } @NodeIntrinsic(UnsignedDivNode.class) - private static native int unsignedDivide(@ConstantNodeParameter Kind kind, int a, int b); + private static native int unsignedDivide(@ConstantNodeParameter + Kind kind, int a, int b); @NodeIntrinsic(UnsignedDivNode.class) - private static native long unsignedDivide(@ConstantNodeParameter Kind kind, long a, long b); + private static native long unsignedDivide(@ConstantNodeParameter + Kind kind, long a, long b); @NodeIntrinsic(UnsignedRemNode.class) - private static native int unsignedRemainder(@ConstantNodeParameter Kind kind, int a, int b); + private static native int unsignedRemainder(@ConstantNodeParameter + Kind kind, int a, int b); @NodeIntrinsic(UnsignedRemNode.class) - private static native long unsignedRemainder(@ConstantNodeParameter Kind kind, long a, long b); + private static native long unsignedRemainder(@ConstantNodeParameter + Kind kind, long a, long b); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitCountNode.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitCountNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitCountNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,8 +31,8 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; +public class BitCountNode extends FloatingNode implements LIRGenLowerable, Canonicalizable { -public class BitCountNode extends FloatingNode implements LIRGenLowerable, Canonicalizable { @Input private ValueNode value; public BitCountNode(ValueNode value) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanForwardNode.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanForwardNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanForwardNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,8 +31,8 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; +public class BitScanForwardNode extends FloatingNode implements LIRGenLowerable, Canonicalizable { -public class BitScanForwardNode extends FloatingNode implements LIRGenLowerable, Canonicalizable { @Input private ValueNode value; public BitScanForwardNode(ValueNode value) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanReverseNode.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanReverseNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanReverseNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,8 +31,8 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; +public class BitScanReverseNode extends FloatingNode implements LIRGenLowerable, Canonicalizable { -public class BitScanReverseNode extends FloatingNode implements LIRGenLowerable, Canonicalizable { @Input private ValueNode value; public BitScanReverseNode(ValueNode value) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BranchProbabilityNode.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BranchProbabilityNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BranchProbabilityNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,9 +28,9 @@ import com.oracle.graal.nodes.util.*; /** - * Instances of this node class will look for a preceding if node and put the given probability into the if node's taken - * probability. Then the branch probability node will be removed. This node is intended primarily for snippets, so that - * they can define their fast and slow paths. + * Instances of this node class will look for a preceding if node and put the given probability into + * the if node's taken probability. Then the branch probability node will be removed. This node is + * intended primarily for snippets, so that they can define their fast and slow paths. */ public class BranchProbabilityNode extends FixedWithNextNode implements Simplifiable { @@ -64,6 +64,7 @@ } @NodeIntrinsic - public static native void probability(@ConstantNodeParameter double probability); + public static native void probability(@ConstantNodeParameter + double probability); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectObjectStoreNode.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectObjectStoreNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectObjectStoreNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,10 +29,11 @@ import com.oracle.graal.word.*; /** - * A special purpose store node that differs from {@link UnsafeStoreNode} in that - * it is not a {@link StateSplit} and does not include a write barrier. + * A special purpose store node that differs from {@link UnsafeStoreNode} in that it is not a + * {@link StateSplit} and does not include a write barrier. */ public class DirectObjectStoreNode extends FixedWithNextNode implements Lowerable { + @Input private ValueNode object; @Input private ValueNode value; @Input private ValueNode offset; @@ -47,16 +48,20 @@ } @NodeIntrinsic - public static native void storeObject(Object obj, @ConstantNodeParameter int displacement, long offset, Object value); + public static native void storeObject(Object obj, @ConstantNodeParameter + int displacement, long offset, Object value); @NodeIntrinsic - public static native void storeLong(Object obj, @ConstantNodeParameter int displacement, long offset, long value); + public static native void storeLong(Object obj, @ConstantNodeParameter + int displacement, long offset, long value); @NodeIntrinsic - public static native void storeWord(Object obj, @ConstantNodeParameter int displacement, long offset, Word value); + public static native void storeWord(Object obj, @ConstantNodeParameter + int displacement, long offset, Word value); @NodeIntrinsic - public static native void storeInt(Object obj, @ConstantNodeParameter int displacement, long offset, int value); + public static native void storeInt(Object obj, @ConstantNodeParameter + int displacement, long offset, int value); @Override public void lower(LoweringTool tool) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectReadNode.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectReadNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectReadNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,10 +30,11 @@ import com.oracle.graal.nodes.type.*; /** - * A special purpose store node that differs from {@link UnsafeStoreNode} in that - * it is not a {@link StateSplit} and takes a computed address instead of an object. + * A special purpose store node that differs from {@link UnsafeStoreNode} in that it is not a + * {@link StateSplit} and takes a computed address instead of an object. */ public class DirectReadNode extends FixedWithNextNode implements LIRLowerable { + @Input private ValueNode address; private final Kind readKind; @@ -49,5 +50,6 @@ } @NodeIntrinsic - public static native T read(long address, @ConstantNodeParameter Kind kind); + public static native T read(long address, @ConstantNodeParameter + Kind kind); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectStoreNode.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectStoreNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectStoreNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,10 +30,11 @@ import com.oracle.graal.nodes.type.*; /** - * A special purpose store node that differs from {@link UnsafeStoreNode} in that - * it is not a {@link StateSplit} and takes a computed address instead of an object. + * A special purpose store node that differs from {@link UnsafeStoreNode} in that it is not a + * {@link StateSplit} and takes a computed address instead of an object. */ public class DirectStoreNode extends FixedWithNextNode implements LIRLowerable { + @Input private ValueNode address; @Input private ValueNode value; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ExplodeLoopNode.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ExplodeLoopNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ExplodeLoopNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,9 +30,9 @@ import com.oracle.graal.snippets.Snippet.VarargsParameter; /** - * Placeholder node to denote to snippet preparation that the following loop - * must be completely unrolled. - * + * Placeholder node to denote to snippet preparation that the following loop must be completely + * unrolled. + * * @see VarargsParameter */ public final class ExplodeLoopNode extends FixedWithNextNode { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/MathIntrinsicNode.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/MathIntrinsicNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/MathIntrinsicNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -61,14 +61,29 @@ Variable input = gen.load(gen.operand(x())); Variable result = gen.newVariable(kind()); switch (operation()) { - case ABS: gen.emitMathAbs(result, input); break; - case SQRT: gen.emitMathSqrt(result, input); break; - case LOG: gen.emitMathLog(result, input, false); break; - case LOG10: gen.emitMathLog(result, input, true); break; - case SIN: gen.emitMathSin(result, input); break; - case COS: gen.emitMathCos(result, input); break; - case TAN: gen.emitMathTan(result, input); break; - default: throw GraalInternalError.shouldNotReachHere(); + case ABS: + gen.emitMathAbs(result, input); + break; + case SQRT: + gen.emitMathSqrt(result, input); + break; + case LOG: + gen.emitMathLog(result, input, false); + break; + case LOG10: + gen.emitMathLog(result, input, true); + break; + case SIN: + gen.emitMathSin(result, input); + break; + case COS: + gen.emitMathCos(result, input); + break; + case TAN: + gen.emitMathTan(result, input); + break; + default: + throw GraalInternalError.shouldNotReachHere(); } gen.setResult(this, result); } @@ -78,18 +93,26 @@ if (x().isConstant()) { double value = x().asConstant().asDouble(); switch (operation()) { - case ABS: return ConstantNode.forDouble(Math.abs(value), graph()); - case SQRT: return ConstantNode.forDouble(Math.sqrt(value), graph()); - case LOG: return ConstantNode.forDouble(Math.log(value), graph()); - case LOG10: return ConstantNode.forDouble(Math.log10(value), graph()); - case SIN: return ConstantNode.forDouble(Math.sin(value), graph()); - case COS: return ConstantNode.forDouble(Math.cos(value), graph()); - case TAN: return ConstantNode.forDouble(Math.tan(value), graph()); + case ABS: + return ConstantNode.forDouble(Math.abs(value), graph()); + case SQRT: + return ConstantNode.forDouble(Math.sqrt(value), graph()); + case LOG: + return ConstantNode.forDouble(Math.log(value), graph()); + case LOG10: + return ConstantNode.forDouble(Math.log10(value), graph()); + case SIN: + return ConstantNode.forDouble(Math.sin(value), graph()); + case COS: + return ConstantNode.forDouble(Math.cos(value), graph()); + case TAN: + return ConstantNode.forDouble(Math.tan(value), graph()); } } return this; } @NodeIntrinsic - public static native double compute(double x, @ConstantNodeParameter Operation op); + public static native double compute(double x, @ConstantNodeParameter + Operation op); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ReverseBytesNode.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ReverseBytesNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ReverseBytesNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,8 +31,8 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; +public class ReverseBytesNode extends FloatingNode implements LIRGenLowerable, Canonicalizable { -public class ReverseBytesNode extends FloatingNode implements LIRGenLowerable, Canonicalizable { @Input private ValueNode value; public ReverseBytesNode(ValueNode value) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java Wed Jan 23 16:34:57 2013 +0100 @@ -45,7 +45,8 @@ @Override public void generate(LIRGeneratorTool generator) { - // Nothing to do, virtual object states are processed as part of the handling of StateSplit nodes. + // Nothing to do, virtual object states are processed as part of the handling of StateSplit + // nodes. } @Override @@ -54,7 +55,7 @@ } @Override - public void applyToNonVirtual(NodeClosure< ? super ValueNode> closure) { + public void applyToNonVirtual(NodeClosure closure) { closure.apply(this, materializedValue); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java Wed Jan 23 16:34:57 2013 +0100 @@ -54,7 +54,8 @@ @Override public void generate(LIRGeneratorTool generator) { - // Nothing to do, virtual object states are processed as part of the handling of StateSplit nodes. + // Nothing to do, virtual object states are processed as part of the handling of StateSplit + // nodes. } @Override @@ -63,7 +64,7 @@ } @Override - public void applyToNonVirtual(NodeClosure< ? super ValueNode> closure) { + public void applyToNonVirtual(NodeClosure closure) { for (ValueNode value : fieldValues) { closure.apply(this, value); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/BlockState.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/BlockState.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/BlockState.java Wed Jan 23 16:34:57 2013 +0100 @@ -84,7 +84,8 @@ materializeEffects.addAll(deferredStores); } - private void materializeChangedBefore(FixedNode fixed, VirtualObjectNode virtual, EscapeState state, HashSet deferred, GraphEffectList deferredStores, GraphEffectList materializeEffects) { + private void materializeChangedBefore(FixedNode fixed, VirtualObjectNode virtual, EscapeState state, HashSet deferred, GraphEffectList deferredStores, + GraphEffectList materializeEffects) { trace("materializing %s at %s", virtual, fixed); ObjectState obj = getObjectState(virtual); if (obj.getLockCount() > 0 && obj.virtual.type().isArray()) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectList.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectList.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectList.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,9 +29,9 @@ import com.oracle.graal.nodes.*; /** - * An {@link EffectList} can be used to maintain a list of {@link Effect}s and backtrack to a previous state by - * truncating the list. It can also maintain a level for each effect, which helps in creating a string representation - * for the list. + * An {@link EffectList} can be used to maintain a list of {@link Effect}s and backtrack to a + * previous state by truncating the list. It can also maintain a level for each effect, which helps + * in creating a string representation for the list. */ public class EffectList implements Iterable { @@ -87,7 +87,7 @@ effects[size++] = effect; } - public void addAll(Collection< ? extends Effect> list) { + public void addAll(Collection list) { int length = effects.length; if (size + list.size() > length) { while (size + list.size() > length) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/GraphEffectList.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/GraphEffectList.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/GraphEffectList.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,9 +34,9 @@ public class GraphEffectList extends EffectList { /** - * Adds the given fixed node to the graph's control flow, before position (so that the original predecessor of - * position will then be node's predecessor). - * + * Adds the given fixed node to the graph's control flow, before position (so that the original + * predecessor of position will then be node's predecessor). + * * @param node The fixed node to be added to the graph. * @param position The fixed node before which the node should be added. */ @@ -59,7 +59,7 @@ /** * Add the given floating node to the graph. - * + * * @param node The floating node to be added. */ public void addFloatingNode(final FloatingNode node) { @@ -79,8 +79,9 @@ } /** - * Add the materialization node to the graph's control flow at the given position, and then sets its values. - * + * Add the materialization node to the graph's control flow at the given position, and then sets + * its values. + * * @param node The materialization node that should be added. * @param position The fixed node before which the materialization node should be added. * @param values The values for the materialization node's entries. @@ -107,7 +108,7 @@ /** * Adds an value to the given phi node. - * + * * @param node The phi node to which the value should be added. * @param value The value that will be added to the phi node. */ @@ -129,7 +130,7 @@ /** * Sets the phi node's input at the given index to the given value. - * + * * @param node The phi node whose input should be changed. * @param index The index of the phi input to be changed. * @param value The new value for the phi input. @@ -151,9 +152,9 @@ } /** - * Adds a virtual object's state to the given frame state. If the given reusedVirtualObjects set contains the - * virtual object then old states for this object will be removed. - * + * Adds a virtual object's state to the given frame state. If the given reusedVirtualObjects set + * contains the virtual object then old states for this object will be removed. + * * @param node The frame state to which the state should be added. * @param state The virtual object state to add. */ @@ -186,7 +187,7 @@ /** * Removes the given fixed node from the control flow and deletes it. - * + * * @param node The fixed node that should be deleted. */ public void deleteFixedNode(final FixedWithNextNode node) { @@ -209,13 +210,14 @@ } /** - * 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} - * + * 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} + * * @param node The node to be replaced. - * @param replacement The node that should replace the original value. If the replacement is a non-connected - * {@link FixedWithNextNode} it will be added to the control flow. - * + * @param replacement The node that should replace the original value. If the replacement is a + * non-connected {@link FixedWithNextNode} it will be added to the control flow. + * */ public void replaceAtUsages(final ValueNode node, final ValueNode replacement) { add(new Effect() { @@ -245,7 +247,7 @@ /** * Replaces the first occurrence of oldInput in node with newInput. - * + * * @param node The node whose input should be changed. * @param oldInput The value to look for. * @param newInput The value to replace with. @@ -273,7 +275,7 @@ /** * Performs a custom action. - * + * * @param action The action that should be performed when the effects are applied. */ public void customAction(final Runnable action) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ObjectState.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ObjectState.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ObjectState.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,9 +28,9 @@ import com.oracle.graal.nodes.virtual.*; /** - * This class describes the state of a virtual object while iterating over the graph. - * It describes the fields or array elements (called "entries") and the lock count if the object is still virtual. - * If the object was materialized, it contains the current materialized value. + * This class describes the state of a virtual object while iterating over the graph. It describes + * the fields or array elements (called "entries") and the lock count if the object is still + * virtual. If the object was materialized, it contains the current materialized value. */ class ObjectState extends Virtualizable.State { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java Wed Jan 23 16:34:57 2013 +0100 @@ -210,7 +210,8 @@ BlockState newState = BlockState.meetAliases(states); // Iterative processing: - // Merging the materialized/virtual state of virtual objects can lead to new materializations, which can + // Merging the materialized/virtual state of virtual objects can lead to new + // materializations, which can // lead to new materializations because of phis, and so on. boolean materialized; @@ -549,7 +550,8 @@ if (endValueObj == null || !endValueObj.isVirtual() || valueObj.virtual != endValueObj.virtual) { additionalMaterializations.add(valueObj.virtual); } else { - // endValue is also virtual and refers to the same virtual object, so we're + // endValue is also virtual and refers to the same virtual + // object, so we're // good. } } @@ -613,7 +615,8 @@ if (endValueObj == null || !endValueObj.isVirtual() || valueObj.virtual != endValueObj.virtual) { assert !additionalMaterializations.isEmpty(); } else { - // endValue is also virtual and refers to the same virtual object, so we're + // endValue is also virtual and refers to the same virtual + // object, so we're // good. } } else { @@ -621,7 +624,8 @@ (endValueObj == null && valueObj.getMaterializedValue() != endValue)) { phis.add(new PhiDesc(state.virtual, i)); } else { - // either endValue has the same materialized value as value or endValue is the + // either endValue has the same materialized value as value or + // endValue is the // same as the materialized value, so we're good. } } @@ -650,7 +654,8 @@ // throw new GraalInternalError("un-materialized object state at %s", loopEnd); } else { if (state.getMaterializedValue() != endState.getMaterializedValue()) { - // throw new GraalInternalError("changed materialized value during loop: %s vs %s", + // throw new + // GraalInternalError("changed materialized value during loop: %s vs %s", // state.materializedValue, endState.materializedValue); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,474 +25,556 @@ public interface Pointer extends Unsigned { /** - * Unsafe conversion of this Pointer to a Java language object. No correctness checks or type checks are performed. - * The caller must ensure that the Pointer contains a valid Java object that can i.e., processed by the garbage - * collector. - * + * Unsafe conversion of this Pointer to a Java language object. No correctness checks or type + * checks are performed. The caller must ensure that the Pointer contains a valid Java object + * that can i.e., processed by the garbage collector. + * * @return this Pointer cast to Object. */ Object toObject(); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ byte readByte(WordBase offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ char readChar(WordBase offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ short readShort(WordBase offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ int readInt(WordBase offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ long readLong(WordBase offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ float readFloat(WordBase offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ double readDouble(WordBase offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ Word readWord(WordBase offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ Object readObject(WordBase offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @return the result of the memory access */ byte readByte(int offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @return the result of the memory access */ char readChar(int offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @return the result of the memory access */ short readShort(int offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @return the result of the memory access */ int readInt(int offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @return the result of the memory access */ long readLong(int offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @return the result of the memory access */ float readFloat(int offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @return the result of the memory access */ double readDouble(int offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @return the result of the memory access */ Word readWord(int offset); /** - * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @return the result of the memory access */ Object readObject(int offset); /** - * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore - * eliminate memory accesses more aggressively.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the constant memory at address {@code (this + offset)}. Both the base address and + * offset are in bytes. + *

          + * The caller guarantees that the memory content is final, i.e., never changing. The compiler + * can therefore eliminate memory accesses more aggressively. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ byte readFinalByte(WordBase offset); /** - * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore - * eliminate memory accesses more aggressively.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the constant memory at address {@code (this + offset)}. Both the base address and + * offset are in bytes. + *

          + * The caller guarantees that the memory content is final, i.e., never changing. The compiler + * can therefore eliminate memory accesses more aggressively. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ char readFinalChar(WordBase offset); /** - * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore - * eliminate memory accesses more aggressively.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the constant memory at address {@code (this + offset)}. Both the base address and + * offset are in bytes. + *

          + * The caller guarantees that the memory content is final, i.e., never changing. The compiler + * can therefore eliminate memory accesses more aggressively. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ short readFinalShort(WordBase offset); /** - * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore - * eliminate memory accesses more aggressively.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the constant memory at address {@code (this + offset)}. Both the base address and + * offset are in bytes. + *

          + * The caller guarantees that the memory content is final, i.e., never changing. The compiler + * can therefore eliminate memory accesses more aggressively. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ int readFinalInt(WordBase offset); /** - * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore - * eliminate memory accesses more aggressively.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the constant memory at address {@code (this + offset)}. Both the base address and + * offset are in bytes. + *

          + * The caller guarantees that the memory content is final, i.e., never changing. The compiler + * can therefore eliminate memory accesses more aggressively. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ long readFinalLong(WordBase offset); /** - * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore - * eliminate memory accesses more aggressively.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the constant memory at address {@code (this + offset)}. Both the base address and + * offset are in bytes. + *

          + * The caller guarantees that the memory content is final, i.e., never changing. The compiler + * can therefore eliminate memory accesses more aggressively. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ float readFinalFloat(WordBase offset); /** - * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore - * eliminate memory accesses more aggressively.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the constant memory at address {@code (this + offset)}. Both the base address and + * offset are in bytes. + *

          + * The caller guarantees that the memory content is final, i.e., never changing. The compiler + * can therefore eliminate memory accesses more aggressively. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ double readFinalDouble(WordBase offset); /** - * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore - * eliminate memory accesses more aggressively.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the constant memory at address {@code (this + offset)}. Both the base address and + * offset are in bytes. + *

          + * The caller guarantees that the memory content is final, i.e., never changing. The compiler + * can therefore eliminate memory accesses more aggressively. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ Word readFinalWord(WordBase offset); /** - * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore - * eliminate memory accesses more aggressively.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Reads the constant memory at address {@code (this + offset)}. Both the base address and + * offset are in bytes. + *

          + * The caller guarantees that the memory content is final, i.e., never changing. The compiler + * can therefore eliminate memory accesses more aggressively. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @return the result of the memory access */ Object readFinalObject(WordBase offset); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeByte(WordBase offset, byte val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeChar(WordBase offset, char val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeShort(WordBase offset, Short val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeInt(WordBase offset, int val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeLong(WordBase offset, long val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeFloat(WordBase offset, float val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeDouble(WordBase offset, double val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeWord(WordBase offset, WordBase val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.

          - * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the - * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned - * value is never used). - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + *

          + * The offset is always treated as a {@link Signed} value. However, the static type is + * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller + * knows that the highest-order bit of the unsigned value is never used). + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeObject(WordBase offset, Object val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeByte(int offset, byte val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeChar(int offset, char val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeShort(int offset, short val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeInt(int offset, int val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeLong(int offset, long val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeFloat(int offset, float val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeDouble(int offset, double val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeWord(int offset, WordBase val); /** - * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. - * + * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in + * bytes. + * * @param offset the signed offset for the memory access * @param val the value to be written to memory */ void writeObject(int offset, Object val); - // Math functions that are defined in Unsigned, but known to preserve the pointer-characteristics. + // Math functions that are defined in Unsigned, but known to preserve the + // pointer-characteristics. // It is therefore safe that they return a static type of Pointer instead of Unsigned. @Override diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.word/src/com/oracle/graal/word/Signed.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Signed.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Signed.java Wed Jan 23 16:34:57 2013 +0100 @@ -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,50 +74,50 @@ /** * Returns a Signed whose value is {@code (this >> n)}. Sign extension is performed. - * + * * @param n shift distance, in bits. * @return {@code this >> n} */ Signed signedShiftRight(Unsigned n); /** - * 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.) - * + * 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} */ Signed and(Signed val); /** - * 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.) - * + * 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} */ Signed or(Signed val); /** - * 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.) - * + * 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} */ Signed xor(Signed val); /** - * Returns a Signed whose value is {@code (~this)}. (This method returns a negative value if and only if this Signed - * is non-negative.) - * + * 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,17 +141,15 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this >= val} */ boolean greaterOrEqual(Signed val); - - /** * Returns a Signed whose value is {@code (this + val)}. - * + * * @param val value to be added to this Signed. * @return {@code this + val} */ @@ -159,7 +157,7 @@ /** * Returns a Signed whose value is {@code (this - val)}. - * + * * @param val value to be subtracted from this Signed. * @return {@code this - val} */ @@ -167,7 +165,7 @@ /** * Returns a Signed whose value is {@code (this * val)}. - * + * * @param val value to be multiplied by this Signed. * @return {@code this * val} */ @@ -175,7 +173,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} */ @@ -183,7 +181,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} */ @@ -191,7 +189,7 @@ /** * Returns a Signed whose value is {@code (this << n)}. - * + * * @param n shift distance, in bits. * @return {@code this << n} */ @@ -199,34 +197,34 @@ /** * Returns a Signed whose value is {@code (this >> n)}. Sign extension is performed. - * + * * @param n shift distance, in bits. * @return {@code this >> n} */ Signed signedShiftRight(int n); /** - * 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.) - * + * 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} */ Signed and(int val); /** - * 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.) - * + * 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} */ Signed or(int val); /** - * 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.) - * + * 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} */ @@ -234,7 +232,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this < val} */ @@ -242,7 +240,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this <= val} */ @@ -250,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} */ @@ -258,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} */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.word/src/com/oracle/graal/word/Unsigned.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Unsigned.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Unsigned.java Wed Jan 23 16:34:57 2013 +0100 @@ -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,147 +137,161 @@ /** * Compares this Unsigned with the specified value. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this >= val} */ boolean aboveOrEqual(Unsigned val); /** - * Returns a Unsigned whose value is {@code (this + val)}.

          - * 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. - * + * Returns a Unsigned whose value is {@code (this + val)}. + *

          + * 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} */ Unsigned add(int val); /** - * Returns a Unsigned whose value is {@code (this - val)}.

          - * 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. - * + * Returns a Unsigned whose value is {@code (this - val)}. + *

          + * 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} */ Unsigned subtract(int val); /** - * Returns a Unsigned whose value is {@code (this * val)}.

          - * 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. - * + * Returns a Unsigned whose value is {@code (this * val)}. + *

          + * 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} */ Unsigned multiply(int val); /** - * Returns a Unsigned whose value is {@code (this / val)}.

          - * 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. - * + * Returns a Unsigned whose value is {@code (this / val)}. + *

          + * 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} */ Unsigned unsignedDivide(int val); /** - * Returns a Unsigned whose value is {@code (this % val)}.

          - * 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. - * + * Returns a Unsigned whose value is {@code (this % val)}. + *

          + * 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} */ Unsigned unsignedRemainder(int val); /** - * Returns a Unsigned whose value is {@code (this << n)}.

          - * 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. - * + * Returns a Unsigned whose value is {@code (this << n)}. + *

          + * 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} */ Unsigned shiftLeft(int n); /** - * Returns a Unsigned whose value is {@code (this >>> n)}. No sign extension is performed.

          - * 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. - * + * Returns a Unsigned whose value is {@code (this >>> n)}. No sign extension is performed. + *

          + * 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} */ Unsigned unsignedShiftRight(int n); /** - * Returns a Unsigned whose value is {@code (this & val)}.

          - * 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. - * + * Returns a Unsigned whose value is {@code (this & val)}. + *

          + * 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} */ Unsigned and(int val); /** - * Returns a Unsigned whose value is {@code (this | val)}.

          - * 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. - * + * Returns a Unsigned whose value is {@code (this | val)}. + *

          + * 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} */ Unsigned or(int val); /** - * Returns a Unsigned whose value is {@code (this ^ val)}.

          - * 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. - * + * Returns a Unsigned whose value is {@code (this ^ val)}. + *

          + * 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} */ Unsigned xor(int val); /** - * Compares this Unsigned with the specified value.

          - * 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. - * + * Compares this Unsigned with the specified value. + *

          + * 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} */ boolean belowThan(int val); /** - * Compares this Unsigned with the specified value.

          - * 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. - * + * Compares this Unsigned with the specified value. + *

          + * 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} */ boolean belowOrEqual(int val); /** - * Compares this Unsigned with the specified value.

          - * 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. - * + * Compares this Unsigned with the specified value. + *

          + * 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} */ boolean aboveThan(int val); /** - * Compares this Unsigned with the specified value.

          - * 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. - * + * Compares this Unsigned with the specified value. + *

          + * 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} */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,22 +32,27 @@ import com.oracle.graal.nodes.calc.*; public abstract class Word implements Signed, Unsigned, Pointer { - /** - * Links a method to a canonical operation represented by an {@link Opcode} val. - */ - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.METHOD) - public @interface Operation { - Class node() default ValueNode.class; - boolean rightOperandIsInt() default false; - Opcode opcode() default Opcode.NODE_CLASS; - Condition condition() default Condition.EQ; - } + + /** + * Links a method to a canonical operation represented by an {@link Opcode} val. + */ + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.METHOD) + public @interface Operation { + + Class node() default ValueNode.class; - /** - * The canonical {@link Operation} represented by a method in the {@link Word} class. - */ - // @formatter:off + boolean rightOperandIsInt() default false; + + Opcode opcode() default Opcode.NODE_CLASS; + + Condition condition() default Condition.EQ; + } + + /** + * The canonical {@link Operation} represented by a method in the {@link Word} class. + */ + // @formatter:off public enum Opcode { NODE_CLASS, COMPARISON, @@ -74,9 +79,10 @@ return box(val); } - /** - * The constant 0, i.e., the word with no bits set. There is no difference between a signed and unsigned zero. + * The constant 0, i.e., the word with no bits set. There is no difference between a signed and + * unsigned zero. + * * @return the constant 0. */ @Operation(opcode = Opcode.ZERO) @@ -85,7 +91,9 @@ } /** - * Unsafe conversion from a Java long value to a Word. The parameter is treated as an unsigned 64-bit value (in contrast to the semantics of a Java long). + * Unsafe conversion from a Java long value to a Word. The parameter is treated as an unsigned + * 64-bit value (in contrast to the semantics of a Java long). + * * @param val a 64 bit unsigned value * @return the value cast to Word */ @@ -95,7 +103,9 @@ } /** - * Unsafe conversion from a Java int value to a Word. The parameter is treated as an unsigned 32-bit value (in contrast to the semantics of a Java int). + * Unsafe conversion from a Java int value to a Word. The parameter is treated as an unsigned + * 32-bit value (in contrast to the semantics of a Java int). + * * @param val a 32 bit unsigned value * @return the value cast to Word */ @@ -105,7 +115,9 @@ } /** - * Unsafe conversion from a Java long value to a Word. The parameter is treated as a signed 64-bit value (unchanged semantics of a Java long). + * Unsafe conversion from a Java long value to a Word. The parameter is treated as a signed + * 64-bit value (unchanged semantics of a Java long). + * * @param val a 64 bit signed value * @return the value cast to Word */ @@ -115,7 +127,9 @@ } /** - * Unsafe conversion from a Java int value to a Word. The parameter is treated as a signed 32-bit value (unchanged semantics of a Java int). + * Unsafe conversion from a Java int value to a Word. The parameter is treated as a signed + * 32-bit value (unchanged semantics of a Java int). + * * @param val a 32 bit signed value * @return the value cast to Word */ @@ -137,22 +151,24 @@ @Operation(opcode = Opcode.TO_OBJECT) public native Object toObject(); - @Override @Operation(node = IntegerAddNode.class) public Word add(Signed val) { return add((Word) val); } + @Override @Operation(node = IntegerAddNode.class) public Word add(Unsigned val) { return add((Word) val); } + @Override @Operation(node = IntegerAddNode.class) public Word add(int val) { return add(intParam(val)); } + @Operation(node = IntegerAddNode.class) public Word add(Word val) { return box(unbox() + val.unbox()); @@ -163,16 +179,19 @@ public Word subtract(Signed val) { return subtract((Word) val); } + @Override @Operation(node = IntegerSubNode.class) public Word subtract(Unsigned val) { return subtract((Word) val); } + @Override @Operation(node = IntegerSubNode.class) public Word subtract(int val) { return subtract(intParam(val)); } + @Operation(node = IntegerSubNode.class) public Word subtract(Word val) { return box(unbox() - val.unbox()); @@ -183,16 +202,19 @@ public Word multiply(Signed val) { return multiply((Word) val); } + @Override @Operation(node = IntegerMulNode.class) public Word multiply(Unsigned val) { return multiply((Word) val); } + @Override @Operation(node = IntegerMulNode.class) public Word multiply(int val) { return multiply(intParam(val)); } + @Operation(node = IntegerMulNode.class) public Word multiply(Word val) { return box(unbox() * val.unbox()); @@ -203,11 +225,13 @@ public Word signedDivide(Signed val) { return signedDivide((Word) val); } + @Override @Operation(node = IntegerDivNode.class) public Word signedDivide(int val) { return signedDivide(intParam(val)); } + @Operation(node = IntegerDivNode.class) public Word signedDivide(Word val) { return box(unbox() / val.unbox()); @@ -218,11 +242,13 @@ public Word unsignedDivide(Unsigned val) { return unsignedDivide((Word) val); } + @Override @Operation(node = UnsignedDivNode.class) public Word unsignedDivide(int val) { return signedDivide(intParam(val)); } + @Operation(node = UnsignedDivNode.class) public Word unsignedDivide(Word val) { return box(UnsignedMath.divide(unbox(), val.unbox())); @@ -233,11 +259,13 @@ public Word signedRemainder(Signed val) { return signedRemainder((Word) val); } + @Override @Operation(node = IntegerRemNode.class) public Word signedRemainder(int val) { return signedRemainder(intParam(val)); } + @Operation(node = IntegerRemNode.class) public Word signedRemainder(Word val) { return box(unbox() % val.unbox()); @@ -248,11 +276,13 @@ public Word unsignedRemainder(Unsigned val) { return unsignedRemainder((Word) val); } + @Override @Operation(node = UnsignedRemNode.class) public Word unsignedRemainder(int val) { return signedRemainder(intParam(val)); } + @Operation(node = UnsignedRemNode.class) public Word unsignedRemainder(Word val) { return box(UnsignedMath.remainder(unbox(), val.unbox())); @@ -263,11 +293,13 @@ public Word shiftLeft(Unsigned val) { return shiftLeft((Word) val); } + @Override @Operation(node = LeftShiftNode.class, rightOperandIsInt = true) public Word shiftLeft(int val) { return shiftLeft(intParam(val)); } + @Operation(node = LeftShiftNode.class, rightOperandIsInt = true) public Word shiftLeft(Word val) { return box(unbox() << val.unbox()); @@ -278,11 +310,13 @@ public Word signedShiftRight(Unsigned val) { return signedShiftRight((Word) val); } + @Override @Operation(node = RightShiftNode.class, rightOperandIsInt = true) public Word signedShiftRight(int val) { return signedShiftRight(intParam(val)); } + @Operation(node = RightShiftNode.class, rightOperandIsInt = true) public Word signedShiftRight(Word val) { return box(unbox() >> val.unbox()); @@ -293,11 +327,13 @@ public Word unsignedShiftRight(Unsigned val) { return unsignedShiftRight((Word) val); } + @Override @Operation(node = UnsignedRightShiftNode.class, rightOperandIsInt = true) public Word unsignedShiftRight(int val) { return unsignedShiftRight(intParam(val)); } + @Operation(node = UnsignedRightShiftNode.class, rightOperandIsInt = true) public Word unsignedShiftRight(Word val) { return box(unbox() >>> val.unbox()); @@ -308,16 +344,19 @@ public Word and(Signed val) { return and((Word) val); } + @Override @Operation(node = AndNode.class) public Word and(Unsigned val) { return and((Word) val); } + @Override @Operation(node = AndNode.class) public Word and(int val) { return and(intParam(val)); } + @Operation(node = AndNode.class) public Word and(Word val) { return box(unbox() & val.unbox()); @@ -328,16 +367,19 @@ public Word or(Signed val) { return or((Word) val); } + @Override @Operation(node = OrNode.class) public Word or(Unsigned val) { return or((Word) val); } + @Override @Operation(node = OrNode.class) public Word or(int val) { return or(intParam(val)); } + @Operation(node = OrNode.class) public Word or(Word val) { return box(unbox() | val.unbox()); @@ -348,16 +390,19 @@ public Word xor(Signed val) { return xor((Word) val); } + @Override @Operation(node = XorNode.class) public Word xor(Unsigned val) { return xor((Word) val); } + @Override @Operation(node = XorNode.class) public Word xor(int val) { return xor(intParam(val)); } + @Operation(node = XorNode.class) public Word xor(Word val) { return box(unbox() ^ val.unbox()); @@ -374,11 +419,13 @@ public boolean lessThan(Signed val) { return lessThan((Word) val); } + @Override @Operation(opcode = Opcode.COMPARISON, condition = Condition.LT) public boolean lessThan(int val) { return lessThan(intParam(val)); } + @Operation(opcode = Opcode.COMPARISON, condition = Condition.LT) public boolean lessThan(Word val) { return unbox() < val.unbox(); @@ -389,11 +436,13 @@ public boolean lessOrEqual(Signed val) { return lessOrEqual((Word) val); } + @Override @Operation(opcode = Opcode.COMPARISON, condition = Condition.LE) public boolean lessOrEqual(int val) { return lessOrEqual(intParam(val)); } + @Operation(opcode = Opcode.COMPARISON, condition = Condition.LE) public boolean lessOrEqual(Word val) { return unbox() <= val.unbox(); @@ -404,11 +453,13 @@ public boolean greaterThan(Signed val) { return greaterThan((Word) val); } + @Override @Operation(opcode = Opcode.COMPARISON, condition = Condition.GT) public boolean greaterThan(int val) { return greaterThan(intParam(val)); } + @Operation(opcode = Opcode.COMPARISON, condition = Condition.GT) public boolean greaterThan(Word val) { return unbox() > val.unbox(); @@ -419,27 +470,30 @@ public boolean greaterOrEqual(Signed val) { return greaterOrEqual((Word) val); } + @Override @Operation(opcode = Opcode.COMPARISON, condition = Condition.GE) public boolean greaterOrEqual(int val) { return greaterOrEqual(intParam(val)); } + @Operation(opcode = Opcode.COMPARISON, condition = Condition.GE) public boolean greaterOrEqual(Word val) { return unbox() >= val.unbox(); } - @Override @Operation(opcode = Opcode.COMPARISON, condition = Condition.BT) public boolean belowThan(Unsigned val) { return belowThan((Word) val); } + @Override @Operation(opcode = Opcode.COMPARISON, condition = Condition.BT) public boolean belowThan(int val) { return belowThan(intParam(val)); } + @Operation(opcode = Opcode.COMPARISON, condition = Condition.BT) public boolean belowThan(Word val) { return UnsignedMath.belowThan(unbox(), val.unbox()); @@ -450,11 +504,13 @@ public boolean belowOrEqual(Unsigned val) { return belowOrEqual((Word) val); } + @Override @Operation(opcode = Opcode.COMPARISON, condition = Condition.BE) public boolean belowOrEqual(int val) { return belowOrEqual(intParam(val)); } + @Operation(opcode = Opcode.COMPARISON, condition = Condition.BE) public boolean belowOrEqual(Word val) { return UnsignedMath.belowOrEqual(unbox(), val.unbox()); @@ -465,11 +521,13 @@ public boolean aboveThan(Unsigned val) { return aboveThan((Word) val); } + @Override @Operation(opcode = Opcode.COMPARISON, condition = Condition.AT) public boolean aboveThan(int val) { return aboveThan(intParam(val)); } + @Operation(opcode = Opcode.COMPARISON, condition = Condition.AT) public boolean aboveThan(Word val) { return UnsignedMath.aboveThan(unbox(), val.unbox()); @@ -480,57 +538,66 @@ public boolean aboveOrEqual(Unsigned val) { return aboveOrEqual((Word) val); } + @Override @Operation(opcode = Opcode.COMPARISON, condition = Condition.AE) public boolean aboveOrEqual(int val) { return aboveOrEqual(intParam(val)); } + @Operation(opcode = Opcode.COMPARISON, condition = Condition.AE) public boolean aboveOrEqual(Word val) { return UnsignedMath.aboveOrEqual(unbox(), val.unbox()); } - @Override @Operation(opcode = Opcode.READ) public byte readByte(WordBase offset) { return unsafe.getByte(add((Word) offset).unbox()); } + @Override @Operation(opcode = Opcode.READ) public char readChar(WordBase offset) { return unsafe.getChar(add((Word) offset).unbox()); } + @Override @Operation(opcode = Opcode.READ) public short readShort(WordBase offset) { return unsafe.getShort(add((Word) offset).unbox()); } + @Override @Operation(opcode = Opcode.READ) public int readInt(WordBase offset) { return unsafe.getInt(add((Word) offset).unbox()); } + @Override @Operation(opcode = Opcode.READ) public long readLong(WordBase offset) { return unsafe.getLong(add((Word) offset).unbox()); } + @Override @Operation(opcode = Opcode.READ) public float readFloat(WordBase offset) { return unsafe.getFloat(add((Word) offset).unbox()); } + @Override @Operation(opcode = Opcode.READ) public double readDouble(WordBase offset) { return unsafe.getDouble(add((Word) offset).unbox()); } + @Override @Operation(opcode = Opcode.READ) public Word readWord(WordBase offset) { return box(unsafe.getAddress(add((Word) offset).unbox())); } + @Override @Operation(opcode = Opcode.READ) public native Object readObject(WordBase offset); @@ -540,41 +607,49 @@ public byte readByte(int offset) { return readByte(signed(offset)); } + @Override @Operation(opcode = Opcode.READ) public char readChar(int offset) { return readChar(signed(offset)); } + @Override @Operation(opcode = Opcode.READ) public short readShort(int offset) { return readShort(signed(offset)); } + @Override @Operation(opcode = Opcode.READ) public int readInt(int offset) { return readInt(signed(offset)); } + @Override @Operation(opcode = Opcode.READ) public long readLong(int offset) { return readLong(signed(offset)); } + @Override @Operation(opcode = Opcode.READ) public float readFloat(int offset) { return readFloat(signed(offset)); } + @Override @Operation(opcode = Opcode.READ) public double readDouble(int offset) { return readDouble(signed(offset)); } + @Override @Operation(opcode = Opcode.READ) public Word readWord(int offset) { return readWord(signed(offset)); } + @Override @Operation(opcode = Opcode.READ) public Object readObject(int offset) { @@ -586,41 +661,49 @@ public byte readFinalByte(WordBase offset) { return readByte(offset); } + @Override @Operation(opcode = Opcode.READ_FINAL) public char readFinalChar(WordBase offset) { return readChar(offset); } + @Override @Operation(opcode = Opcode.READ_FINAL) public short readFinalShort(WordBase offset) { return readShort(offset); } + @Override @Operation(opcode = Opcode.READ_FINAL) public int readFinalInt(WordBase offset) { return readInt(offset); } + @Override @Operation(opcode = Opcode.READ_FINAL) public long readFinalLong(WordBase offset) { return readLong(offset); } + @Override @Operation(opcode = Opcode.READ_FINAL) public float readFinalFloat(WordBase offset) { return readFloat(offset); } + @Override @Operation(opcode = Opcode.READ_FINAL) public double readFinalDouble(WordBase offset) { return readDouble(offset); } + @Override @Operation(opcode = Opcode.READ_FINAL) public Word readFinalWord(WordBase offset) { return readWord(offset); } + @Override @Operation(opcode = Opcode.READ_FINAL) public Object readFinalObject(WordBase offset) { @@ -632,41 +715,49 @@ public void writeByte(WordBase offset, byte val) { unsafe.putByte(add((Word) offset).unbox(), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeChar(WordBase offset, char val) { unsafe.putChar(add((Word) offset).unbox(), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeShort(WordBase offset, Short val) { unsafe.putShort(add((Word) offset).unbox(), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeInt(WordBase offset, int val) { unsafe.putInt(add((Word) offset).unbox(), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeLong(WordBase offset, long val) { unsafe.putLong(add((Word) offset).unbox(), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeFloat(WordBase offset, float val) { unsafe.putFloat(add((Word) offset).unbox(), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeDouble(WordBase offset, double val) { unsafe.putDouble(add((Word) offset).unbox(), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeWord(WordBase offset, WordBase val) { unsafe.putAddress(add((Word) offset).unbox(), ((Word) val).unbox()); } + @Override @Operation(opcode = Opcode.WRITE) public native void writeObject(WordBase offset, Object val); @@ -676,41 +767,49 @@ public void writeByte(int offset, byte val) { writeByte(signed(offset), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeChar(int offset, char val) { writeChar(signed(offset), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeShort(int offset, short val) { writeShort(signed(offset), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeInt(int offset, int val) { writeInt(signed(offset), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeLong(int offset, long val) { writeLong(signed(offset), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeFloat(int offset, float val) { writeFloat(signed(offset), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeDouble(int offset, double val) { writeDouble(signed(offset), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeWord(int offset, WordBase val) { writeWord(signed(offset), val); } + @Override @Operation(opcode = Opcode.WRITE) public void writeObject(int offset, Object val) { @@ -719,6 +818,7 @@ } final class HostedWord extends Word { + private static final int SMALL_FROM = -1; private static final int SMALL_TO = 100; @@ -734,7 +834,7 @@ private final long rawValue; private HostedWord(long rawValue) { - this.rawValue = rawValue; + this.rawValue = rawValue; } protected static Word box(long val) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -38,8 +38,8 @@ import com.oracle.graal.word.Word.Operation; /** - * Transforms all uses of the {@link Word} class into unsigned operations on {@code int} or {@code long} values, - * depending on the word kind of the underlying platform. + * Transforms all uses of the {@link Word} class into unsigned operations on {@code int} or + * {@code long} values, depending on the word kind of the underlying platform. */ public class WordTypeRewriterPhase extends Phase { @@ -87,7 +87,8 @@ } } - // Replace ObjectEqualsNodes with IntegerEqualsNodes where the values being compared are words + // Replace ObjectEqualsNodes with IntegerEqualsNodes where the values being compared are + // words for (ObjectEqualsNode objectEqualsNode : graph.getNodes().filter(ObjectEqualsNode.class).snapshot()) { ValueNode x = objectEqualsNode.x(); ValueNode y = objectEqualsNode.y(); @@ -98,7 +99,8 @@ } } - // Replace ObjectEqualsNodes with IntegerEqualsNodes where the values being compared are words + // Replace ObjectEqualsNodes with IntegerEqualsNodes where the values being compared are + // words for (LoadIndexedNode load : graph.getNodes().filter(LoadIndexedNode.class).snapshot()) { if (isWord(load)) { load.setStamp(StampFactory.forKind(wordKind)); @@ -217,7 +219,7 @@ private ValueNode nodeClassOp(StructuredGraph graph, Class nodeClass, ValueNode left, ValueNode right, Invoke invoke) { try { - Constructor< ? extends ValueNode> constructor = nodeClass.getConstructor(Kind.class, ValueNode.class, ValueNode.class); + Constructor constructor = nodeClass.getConstructor(Kind.class, ValueNode.class, ValueNode.class); ValueNode result = graph.add(constructor.newInstance(wordKind, left, right)); if (result instanceof FixedWithNextNode) { graph.addBeforeFixed(invoke.node(), (FixedWithNextNode) result); @@ -237,7 +239,6 @@ ValueNode a = mirror ? right : left; ValueNode b = mirror ? left : right; - CompareNode comparison; if (condition == Condition.EQ || condition == Condition.NE) { comparison = new IntegerEqualsNode(a, b); @@ -261,7 +262,8 @@ IndexedLocationNode location = IndexedLocationNode.create(locationIdentity, invoke.node().kind(), 0, offset, graph, false); ReadNode read = graph.add(new ReadNode(base, location, invoke.node().stamp())); graph.addBeforeFixed(invoke.node(), read); - // The read must not float outside its block otherwise it may float above an explicit zero check on its base address + // The read must not float outside its block otherwise it may float above an explicit zero + // check on its base address read.dependencies().add(BeginNode.prevBegin(invoke.node())); return read; } @@ -289,7 +291,8 @@ if (node instanceof LoadIndexedNode) { ValueNode array = ((LoadIndexedNode) node).array(); if (array.objectStamp().type() == null) { - // There are cases where the array does not have a known type yet. Assume it is not a word type. + // There are cases where the array does not have a known type yet. Assume it is not + // a word type. // TODO disallow LoadIndexedNode for word arrays? return false; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeVerificationPhase.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeVerificationPhase.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeVerificationPhase.java Wed Jan 23 16:34:57 2013 +0100 @@ -36,8 +36,8 @@ import com.oracle.graal.word.Word.Operation; /** - * Verifies invariants that must hold for snippet code above and beyond normal - * bytecode verification. + * Verifies invariants that must hold for snippet code above and beyond normal bytecode + * verification. */ public class WordTypeVerificationPhase extends Phase { @@ -130,9 +130,7 @@ } private static void error(Node node, Node usage, String message) { - throw new GraalInternalError(String.format("Snippet verification error: %s" + - "%n node: %s (%s)" + - "%n usage: %s (%s)", message, node, sourceLocation(node), usage, sourceLocation(usage))); + throw new GraalInternalError(String.format("Snippet verification error: %s" + "%n node: %s (%s)" + "%n usage: %s (%s)", message, node, sourceLocation(node), usage, sourceLocation(usage))); } private static String sourceLocation(Node n) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/ExtensionAnnotation.java --- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/ExtensionAnnotation.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/ExtensionAnnotation.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,7 +24,6 @@ import java.lang.annotation.*; - @Retention(RetentionPolicy.CLASS) @Target({ElementType.ANNOTATION_TYPE}) public @interface ExtensionAnnotation { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/GeneratedBy.java --- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/GeneratedBy.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/GeneratedBy.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,6 +31,6 @@ @Target({ElementType.TYPE}) public @interface GeneratedBy { - Class< ? > value(); + Class value(); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/GuardCheck.java --- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/GuardCheck.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/GuardCheck.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,7 +26,7 @@ /** * - * + * * @see SpecializationGuard */ @Retention(RetentionPolicy.CLASS) diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/SpecializationGuard.java --- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/SpecializationGuard.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/SpecializationGuard.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,8 +32,8 @@ public @interface SpecializationGuard { /** - * Specifies the name of the guard method annotated by {@link GuardCheck} specified as method in the - * {@link TypeSystem} class. + * Specifies the name of the guard method annotated by {@link GuardCheck} specified as method in + * the {@link TypeSystem} class. */ String methodName(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/SpecializationThrows.java --- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/SpecializationThrows.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/SpecializationThrows.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,7 +28,7 @@ @Target({ElementType.METHOD}) public @interface SpecializationThrows { - Class< ? extends Throwable> javaClass(); + Class javaClass(); String transitionTo(); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeCast.java --- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeCast.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeCast.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,7 +24,6 @@ import java.lang.annotation.*; - /** * * @@ -34,5 +33,4 @@ @Target({ElementType.METHOD}) public @interface TypeCast { - } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeCheck.java --- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeCheck.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeCheck.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,51 +26,52 @@ /** *

          - * Provides a way to define a custom type check for a defined type. The name of the annotated method must fit to the - * pattern is${typeName} (eg. isInteger), where ${typeName} must be a valid type defined in the parent - * {@link TypeSystem}. The annotated method must have exactly one argument where the type of the argument is the generic - * type {@link Object} or a more specific one from the {@link TypeSystem}. You can define multiple overloaded - * {@link TypeCheck} methods for the same type. This can be used to reduce the boxing overhead in type conversions. + * Provides a way to define a custom type check for a defined type. The name of the annotated method + * must fit to the pattern is${typeName} (eg. isInteger), where ${typeName} must be a valid type + * defined in the parent {@link TypeSystem}. The annotated method must have exactly one argument + * where the type of the argument is the generic type {@link Object} or a more specific one from the + * {@link TypeSystem}. You can define multiple overloaded {@link TypeCheck} methods for the same + * type. This can be used to reduce the boxing overhead in type conversions. *

          - * + * *

          - * By default the system generates type checks for all types in the parent {@link TypeSystem} which look like the - * follows: - * + * By default the system generates type checks for all types in the parent {@link TypeSystem} which + * look like the follows: + * *

            * {@literal @}TypeCheck
            * boolean is${typeName}(Object value) {
            *         return value instanceof ${typeName};
            * }
            * 
          - * + * *

          - * + * * Example: *

          * A type check for BigInteger with one overloaded optimized variant to reduce boxing. *

          - * + * *
          - *
          - *
          + * 
          + * 
            * {@literal @}TypeSystem(types = {int.class, BigInteger.class, String.class}, nodeBaseClass = TypedNode.class)
            * public abstract class Types {
          - *
          + * 
            *     {@literal @}TypeCheck
            *     public boolean isBigInteger(Object value) {
            *         return value instanceof Integer || value instanceof BigInteger;
            *     }
          - *
          + * 
            *     {@literal @}TypeCheck
            *     public boolean isBigInteger(int value) {
            *         return true;
            *     }
          - *
          + * 
            * }
            * 
          - * - * + * + * */ @Retention(RetentionPolicy.CLASS) @Target({ElementType.METHOD}) diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeSystem.java --- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeSystem.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeSystem.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,28 +26,29 @@ /** *

          - * Annotates a type system class that represents type information for a node. Generates code for converting and managing - * types. Methods contained in the type system may be annotated with {@link TypeCast}, {@link TypeCheck} or - * {@link GuardCheck}. These methods alter the default behavior of the type system. + * Annotates a type system class that represents type information for a node. Generates code for + * converting and managing types. Methods contained in the type system may be annotated with + * {@link TypeCast}, {@link TypeCheck} or {@link GuardCheck}. These methods alter the default + * behavior of the type system. *

          - * - * + * + * * Example: *

          - * Shows a @TypeSystem definition with three types. In this example BigIntegers can be also treated as - * integers if their bit width is less than 32. + * Shows a @TypeSystem definition with three types. In this example BigIntegers can be + * also treated as integers if their bit width is less than 32. *

          - * + * *
          - *
          + * 
            * {@literal @}TypeSystem(types = {int.class, BigInteger.class, String.class}, nodeBaseClass = TypedNode.class)
            * public abstract class Types {
          - *
          + * 
            *     {@literal @}TypeCheck
            *     public boolean isInteger(Object value) {
            *         return value instanceof Integer || (value instanceof BigInteger && ((BigInteger) value).bitLength() < Integer.SIZE);
            *     }
          - *
          + * 
            *     {@literal @}TypeCast
            *     public int asInteger(Object value) {
            *         if (value instanceof Integer) {
          @@ -58,7 +59,7 @@
            *     }
            * }
            * 
          - * + * * @see TypeCast * @see TypeCheck * @see GuardCheck @@ -68,7 +69,8 @@ public @interface TypeSystem { /** - * Sets the types contained by this type system. The order of types also determines the order of specialization. + * Sets the types contained by this type system. The order of types also determines the order of + * specialization. */ Class[] value(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ArgumentsTest.java --- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ArgumentsTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ArgumentsTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,25 +28,26 @@ import com.oracle.truffle.api.frame.*; import com.oracle.truffle.api.nodes.*; - /** *

          Passing Arguments

          - * + * *

          - * A guest language can pass its own custom arguments when invoking a Truffle method by creating a subclass of - * {@link Arguments}. When invoking a call target with {@link CallTarget#call(Arguments)}, the arguments can be passed. - * A Truffle node can access the arguments passed into the Truffle method by using {@link VirtualFrame#getArguments()}. + * A guest language can pass its own custom arguments when invoking a Truffle method by creating a + * subclass of {@link Arguments}. When invoking a call target with + * {@link CallTarget#call(Arguments)}, the arguments can be passed. A Truffle node can access the + * arguments passed into the Truffle method by using {@link VirtualFrame#getArguments()}. *

          - * + * *

          - * The arguments class should only contain fields that are declared as final. This allows the Truffle runtime to improve - * optimizations around guest language method calls. Also, the arguments object must never be stored into a field. It - * should be created immediately before invoking {@link CallTarget#call(Arguments)} and no longer be accessed - * afterwards. + * The arguments class should only contain fields that are declared as final. This allows the + * Truffle runtime to improve optimizations around guest language method calls. Also, the arguments + * object must never be stored into a field. It should be created immediately before invoking + * {@link CallTarget#call(Arguments)} and no longer be accessed afterwards. *

          - * + * *

          - * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.FrameTest}. + * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.FrameTest} + * . *

          */ public class ArgumentsTest { @@ -61,7 +62,9 @@ } class TestArguments extends Arguments { + final int[] values; + TestArguments(int... values) { this.values = values; } @@ -86,6 +89,7 @@ } class TestArgumentNode extends Node { + private final int index; TestArgumentNode(int index) { @@ -97,4 +101,3 @@ } } } - diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/CallTest.java --- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/CallTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/CallTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,17 +28,18 @@ import com.oracle.truffle.api.frame.*; import com.oracle.truffle.api.nodes.*; - /** *

          Calling Another Tree

          - * + * *

          - * A guest language implementation can create multiple call targets using the {@link TruffleRuntime#createCallTarget(RootNode)} method. - * Those call targets can be passed around as normal Java objects and used for calling guest language methods. + * A guest language implementation can create multiple call targets using the + * {@link TruffleRuntime#createCallTarget(RootNode)} method. Those call targets can be passed around + * as normal Java objects and used for calling guest language methods. *

          - * + * *

          - * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.ArgumentsTest}. + * The next part of the Truffle API introduction is at + * {@link com.oracle.truffle.api.test.ArgumentsTest}. *

          */ public class CallTest { @@ -70,6 +71,7 @@ } class ConstantRootNode extends RootNode { + private final int value; public ConstantRootNode(int value) { @@ -82,4 +84,3 @@ } } } - diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ChildNodeTest.java --- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ChildNodeTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ChildNodeTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,20 +33,24 @@ /** *

          Creating a Child Node

          - * + * *

          - * Child nodes are stored in the class of the parent node in fields that are marked with the {@link Child} annotation. - * Before such a field is assigned, {@link Node#adoptChild} must be called. This method automatically establishes a link - * from the child to the parent. The {@link Node#getParent()} method allows access to this field. Every node also - * provides the ability to iterate over its children using {@link Node#getChildren()}.

          - * - *

          A child node field must be declared private and non-final. It may only be assigned in the constructor of the parent - * node. For changing the structure of the tree at run time, the method {@link Node#replace(Node)} must be used (see - * {@link ReplaceTest}). + * Child nodes are stored in the class of the parent node in fields that are marked with the + * {@link Child} annotation. Before such a field is assigned, {@link Node#adoptChild} must be + * called. This method automatically establishes a link from the child to the parent. The + * {@link Node#getParent()} method allows access to this field. Every node also provides the ability + * to iterate over its children using {@link Node#getChildren()}. *

          - * + * *

          - * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.ChildrenNodesTest}. + * A child node field must be declared private and non-final. It may only be assigned in the + * constructor of the parent node. For changing the structure of the tree at run time, the method + * {@link Node#replace(Node)} must be used (see {@link ReplaceTest}). + *

          + * + *

          + * The next part of the Truffle API introduction is at + * {@link com.oracle.truffle.api.test.ChildrenNodesTest}. *

          */ public class ChildNodeTest { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ChildrenNodesTest.java --- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ChildrenNodesTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ChildrenNodesTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,17 +32,19 @@ /** *

          Creating an Array of Children Nodes

          - * + * *

          - * An array of children nodes can be used as a field in a parent node. The field has to be annotated with - * {@link com.oracle.truffle.api.nodes.Node.Children} and must be declared private and final. Before assigning the field - * in the parent node constructor, {@link Node#adoptChildren} must be called in order to update the parent pointers in - * the child nodes. After filling the array with its first values, it must never be changed. It is only possible to call - * {@link Node#replace} on a child node. + * An array of children nodes can be used as a field in a parent node. The field has to be annotated + * with {@link com.oracle.truffle.api.nodes.Node.Children} and must be declared private and final. + * Before assigning the field in the parent node constructor, {@link Node#adoptChildren} must be + * called in order to update the parent pointers in the child nodes. After filling the array with + * its first values, it must never be changed. It is only possible to call {@link Node#replace} on a + * child node. *

          - * + * *

          - * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.FinalFieldTest}. + * The next part of the Truffle API introduction is at + * {@link com.oracle.truffle.api.test.FinalFieldTest}. *

          */ public class ChildrenNodesTest { @@ -83,9 +85,9 @@ } class TestChildNode extends Node { + public int execute() { return 21; } } } - diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FinalFieldTest.java --- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FinalFieldTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FinalFieldTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,22 +30,23 @@ /** *

          Using Final Fields in Node Classes

          - * + * *

          - * The usage of final fields in node classes is highly encouraged. It is beneficial for performance to declare every - * field that is not pointing to a child node as final. This gives the Truffle runtime an increased opportunity to - * optimize this node. + * The usage of final fields in node classes is highly encouraged. It is beneficial for performance + * to declare every field that is not pointing to a child node as final. This gives the Truffle + * runtime an increased opportunity to optimize this node. *

          - * + * *

          - * If a node has a value which may change at run time, but will rarely do so, it is recommended to speculate on the - * field being final. This involves starting executing with a node where this field is final and only if this - * turns out to be no longer the case, the node is replaced with an alternative implementation of the operation (see - * {@link ReplaceTest}). + * If a node has a value which may change at run time, but will rarely do so, it is recommended to + * speculate on the field being final. This involves starting executing with a node where this field + * is final and only if this turns out to be no longer the case, the node is replaced with an + * alternative implementation of the operation (see {@link ReplaceTest}). *

          - * + * *

          - * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.ReplaceTest}. + * The next part of the Truffle API introduction is at + * {@link com.oracle.truffle.api.test.ReplaceTest}. *

          */ public class FinalFieldTest { @@ -78,6 +79,7 @@ } class TestChildNode extends Node { + private final int value; public TestChildNode(int value) { @@ -89,4 +91,3 @@ } } } - diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameSlotTypeSpecializationTest.java --- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameSlotTypeSpecializationTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameSlotTypeSpecializationTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,22 +28,23 @@ import com.oracle.truffle.api.frame.*; import com.oracle.truffle.api.nodes.*; - /** *

          Specializing Frame Slot Types

          - * + * *

          - * Dynamically typed languages can speculate on the type of a frame slot and only fall back at run time to a more - * generic type if necessary. The new type of a frame slot can be set using the {@link FrameSlot#setType(Class)} method. - * It is the responsibility of the language implementor to update the content of currently active frames (using - * {@link Frame#updateToLatestVersion()}). Also, nodes that depend a specific type of a frame slot must be replaced. - * Such node can register a listener that implements {@link FrameSlotTypeListener} using - * {@link FrameSlot#registerOneShotTypeListener(FrameSlotTypeListener)}. The event of a type change on the frame slot - * will fire only once for the next upcoming change. + * Dynamically typed languages can speculate on the type of a frame slot and only fall back at run + * time to a more generic type if necessary. The new type of a frame slot can be set using the + * {@link FrameSlot#setType(Class)} method. It is the responsibility of the language implementor to + * update the content of currently active frames (using {@link Frame#updateToLatestVersion()}). + * Also, nodes that depend a specific type of a frame slot must be replaced. Such node can register + * a listener that implements {@link FrameSlotTypeListener} using + * {@link FrameSlot#registerOneShotTypeListener(FrameSlotTypeListener)}. The event of a type change + * on the frame slot will fire only once for the next upcoming change. *

          - * + * *

          - * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.ReturnTypeSpecializationTest}. + * The next part of the Truffle API introduction is at + * {@link com.oracle.truffle.api.test.ReturnTypeSpecializationTest}. *

          */ public class FrameSlotTypeSpecializationTest { @@ -79,10 +80,12 @@ } abstract class TestChildNode extends Node { + abstract Object execute(VirtualFrame frame); } abstract class FrameSlotNode extends TestChildNode { + protected final FrameSlot slot; public FrameSlotNode(FrameSlot slot) { @@ -100,6 +103,7 @@ } class IntAssignLocal extends FrameSlotNode implements FrameSlotTypeListener { + @Child private TestChildNode value; IntAssignLocal(FrameSlot slot, TestChildNode value) { @@ -122,7 +126,7 @@ } @Override - public void typeChanged(FrameSlot changedSlot, Class< ? > oldType) { + public void typeChanged(FrameSlot changedSlot, Class oldType) { if (changedSlot.getType() == Object.class) { this.replace(new ObjectAssignLocal(changedSlot, value)); } @@ -130,6 +134,7 @@ } class ObjectAssignLocal extends FrameSlotNode { + @Child private TestChildNode value; ObjectAssignLocal(FrameSlot slot, TestChildNode value) { @@ -146,6 +151,7 @@ } class IntReadLocal extends FrameSlotNode implements FrameSlotTypeListener { + IntReadLocal(FrameSlot slot) { super(slot); slot.registerOneShotTypeListener(this); @@ -157,7 +163,7 @@ } @Override - public void typeChanged(FrameSlot changedSlot, Class< ? > oldType) { + public void typeChanged(FrameSlot changedSlot, Class oldType) { if (changedSlot.getType() == Object.class) { this.replace(new ObjectReadLocal(changedSlot)); } @@ -165,6 +171,7 @@ } class ObjectReadLocal extends FrameSlotNode { + ObjectReadLocal(FrameSlot slot) { super(slot); } @@ -175,4 +182,3 @@ } } } - diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameTest.java --- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,26 +30,29 @@ /** *

          Storing Values in Frame Slots

          - * + * *

          - * The frame is the preferred data structure for passing values between nodes. It can in particular be used for storing - * the values of local variables of the guest language. The {@link FrameDescriptor} represents the current structure of - * the frame. The method {@link FrameDescriptor#addFrameSlot(String, Class)} can be used to create predefined frame - * slots. The setter and getter methods in the {@link Frame} class can be used to access the current value of a - * particular frame slot. + * The frame is the preferred data structure for passing values between nodes. It can in particular + * be used for storing the values of local variables of the guest language. The + * {@link FrameDescriptor} represents the current structure of the frame. The method + * {@link FrameDescriptor#addFrameSlot(String, Class)} can be used to create predefined frame slots. + * The setter and getter methods in the {@link Frame} class can be used to access the current value + * of a particular frame slot. *

          - * + * *

          - * There are five primitive types for slots available: {@link java.lang.Boolean}, @{link java.lang.Integer}, - * {@link java.lang.Long}, {@link java.lang.Float}, and {@link java.lang.Double}. It is encouraged to use those types - * whenever possible. Dynamically typed languages can speculate on the type of a value fitting into a primitive (see - * {@link FrameSlotTypeSpecializationTest}). When a frame slot is of one of those particular primitive types, its value - * may only be accessed with the repectively typed getter method ({@link Frame#getBoolean}, {@link Frame#getInt}, - * {@link Frame#getLong}, {@link Frame#getFloat}, or {@link Frame#getDouble}) or setter method ({@link Frame#setBoolean}, - * {@link Frame#setInt}, {@link Frame#setLong}, {@link Frame#setFloat}, or {@link Frame#setDouble}) in the - * {@link Frame} class. + * There are five primitive types for slots available: {@link java.lang.Boolean}, @{link + * java.lang.Integer}, {@link java.lang.Long}, {@link java.lang.Float}, and {@link java.lang.Double} + * . It is encouraged to use those types whenever possible. Dynamically typed languages can + * speculate on the type of a value fitting into a primitive (see + * {@link FrameSlotTypeSpecializationTest}). When a frame slot is of one of those particular + * primitive types, its value may only be accessed with the repectively typed getter method ( + * {@link Frame#getBoolean}, {@link Frame#getInt}, {@link Frame#getLong}, {@link Frame#getFloat}, or + * {@link Frame#getDouble}) or setter method ({@link Frame#setBoolean}, {@link Frame#setInt}, + * {@link Frame#setLong}, {@link Frame#setFloat}, or {@link Frame#setDouble}) in the {@link Frame} + * class. *

          - * + * *

          * The next part of the Truffle API introduction is at * {@link com.oracle.truffle.api.test.FrameSlotTypeSpecializationTest}. @@ -85,10 +88,12 @@ } abstract class TestChildNode extends Node { + abstract int execute(VirtualFrame frame); } abstract class FrameSlotNode extends TestChildNode { + protected final FrameSlot slot; public FrameSlotNode(FrameSlot slot) { @@ -97,6 +102,7 @@ } class AssignLocal extends FrameSlotNode { + AssignLocal(FrameSlot slot) { super(slot); } @@ -109,6 +115,7 @@ } class ReadLocal extends FrameSlotNode { + ReadLocal(FrameSlot slot) { super(slot); } @@ -119,4 +126,3 @@ } } } - diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReplaceTest.java --- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReplaceTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReplaceTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,22 +32,21 @@ import com.oracle.truffle.api.frame.*; import com.oracle.truffle.api.nodes.*; - /** *

          Replacing Nodes at Run Time

          - * + * *

          - * 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. + * 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. *

          - * + * *

          - * 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. + * 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. *

          - * + * *

          * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.CallTest}. *

          @@ -99,10 +98,12 @@ } abstract class ValueNode extends Node { + abstract int execute(); } class UnresolvedNode extends ValueNode { + private final String value; public UnresolvedNode(String value) { @@ -118,6 +119,7 @@ } class ResolvedNode extends ValueNode { + private final int value; ResolvedNode(int value) { @@ -130,4 +132,3 @@ } } } - diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReturnTypeSpecializationTest.java --- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReturnTypeSpecializationTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReturnTypeSpecializationTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,14 +30,15 @@ /** *

          Specializing Return Types

          - * + * *

          - * In order to avoid boxing and/or type casts on the return value of a node, the return value the method for executing a - * node can have a specific type and need not be of type {@link java.lang.Object}. For dynamically typed languages, this - * return type is something that should be speculated on. When the speculation fails and the child node cannot return - * the appropriate type of value, it can use an {@link UnexpectedResultException} to still pass the result to the - * caller. In such a case, the caller must rewrite itself to a more general version in oder to avoid future failures of - * this kind. + * In order to avoid boxing and/or type casts on the return value of a node, the return value the + * method for executing a node can have a specific type and need not be of type + * {@link java.lang.Object}. For dynamically typed languages, this return type is something that + * should be speculated on. When the speculation fails and the child node cannot return the + * appropriate type of value, it can use an {@link UnexpectedResultException} to still pass the + * result to the caller. In such a case, the caller must rewrite itself to a more general version in + * oder to avoid future failures of this kind. *

          */ public class ReturnTypeSpecializationTest { @@ -73,6 +74,7 @@ } abstract class TestChildNode extends Node { + abstract Object execute(VirtualFrame frame); int executeInt(VirtualFrame frame) throws UnexpectedResultException { @@ -85,6 +87,7 @@ } abstract class FrameSlotNode extends TestChildNode { + protected final FrameSlot slot; public FrameSlotNode(FrameSlot slot) { @@ -102,6 +105,7 @@ } class IntAssignLocal extends FrameSlotNode implements FrameSlotTypeListener { + @Child private TestChildNode value; IntAssignLocal(FrameSlot slot, TestChildNode value) { @@ -123,7 +127,7 @@ } @Override - public void typeChanged(FrameSlot changedSlot, Class< ? > oldType) { + public void typeChanged(FrameSlot changedSlot, Class oldType) { if (changedSlot.getType() == Object.class) { this.replace(new ObjectAssignLocal(changedSlot, value)); } @@ -131,6 +135,7 @@ } class ObjectAssignLocal extends FrameSlotNode { + @Child private TestChildNode value; ObjectAssignLocal(FrameSlot slot, TestChildNode value) { @@ -147,6 +152,7 @@ } class IntReadLocal extends FrameSlotNode implements FrameSlotTypeListener { + IntReadLocal(FrameSlot slot) { super(slot); slot.registerOneShotTypeListener(this); @@ -163,7 +169,7 @@ } @Override - public void typeChanged(FrameSlot changedSlot, Class< ? > oldType) { + public void typeChanged(FrameSlot changedSlot, Class oldType) { if (changedSlot.getType() == Object.class) { this.replace(new ObjectReadLocal(changedSlot)); } @@ -171,6 +177,7 @@ } class ObjectReadLocal extends FrameSlotNode { + ObjectReadLocal(FrameSlot slot) { super(slot); } @@ -181,4 +188,3 @@ } } } - diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/RootNodeTest.java --- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/RootNodeTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/RootNodeTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,18 +30,20 @@ /** *

          Creating a Root Node

          - * + * *

          - * A Truffle root node is the entry point into a Truffle tree that represents a guest language method. It contains a - * {@link RootNode#execute(VirtualFrame)} method that can return a {@link java.lang.Object} value as the result of the - * guest language method invocation. This method must however never be called directly. Instead, the Truffle runtime - * must be used to create a {@link CallTarget} object from a root node using the - * {@link TruffleRuntime#createCallTarget(RootNode)} method. This call target object can then be executed using the - * {@link CallTarget#call()} method or one of its overloads. + * A Truffle root node is the entry point into a Truffle tree that represents a guest language + * method. It contains a {@link RootNode#execute(VirtualFrame)} method that can return a + * {@link java.lang.Object} value as the result of the guest language method invocation. This method + * must however never be called directly. Instead, the Truffle runtime must be used to create a + * {@link CallTarget} object from a root node using the + * {@link TruffleRuntime#createCallTarget(RootNode)} method. This call target object can then be + * executed using the {@link CallTarget#call()} method or one of its overloads. *

          - * + * *

          - * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.ChildNodeTest}. + * The next part of the Truffle API introduction is at + * {@link com.oracle.truffle.api.test.ChildNodeTest}. *

          */ public class RootNodeTest { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/TruffleRuntimeTest.java --- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/TruffleRuntimeTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/TruffleRuntimeTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,16 +28,18 @@ /** *

          Accessing the Truffle Runtime

          - * + * *

          * The Truffle runtime can be accessed at any point in time globally using the static method - * {@link Truffle#getRuntime()}. This method is guaranteed to return a non-null Truffle runtime object with an - * identifying name. A Java Virtual Machine implementation can chose to replace the default implementation of the - * {@link TruffleRuntime} interface with its own implementation for providing improved performance. + * {@link Truffle#getRuntime()}. This method is guaranteed to return a non-null Truffle runtime + * object with an identifying name. A Java Virtual Machine implementation can chose to replace the + * default implementation of the {@link TruffleRuntime} interface with its own implementation for + * providing improved performance. *

          - * + * *

          - * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.RootNodeTest}. + * The next part of the Truffle API introduction is at + * {@link com.oracle.truffle.api.test.RootNodeTest}. *

          */ public class TruffleRuntimeTest { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/Arguments.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/Arguments.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/Arguments.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,22 +24,23 @@ /** * Base class for arguments passed to guest language methods via the - * {@link CallTarget#call(com.oracle.truffle.api.frame.PackedFrame, Arguments)} method. A guest language create a - * subclass with immutable fields representing the arguments passed to a guest language method. The {@link Arguments} - * object must be created immediately before a method call and it must not be stored in a field or cast to - * {@link java.lang.Object}. + * {@link CallTarget#call(com.oracle.truffle.api.frame.PackedFrame, Arguments)} method. A guest + * language create a subclass with immutable fields representing the arguments passed to a guest + * language method. The {@link Arguments} object must be created immediately before a method call + * and it must not be stored in a field or cast to {@link java.lang.Object}. */ public class Arguments { /** * Constant that can be used as an argument to - * {@link CallTarget#call(com.oracle.truffle.api.frame.PackedFrame, Arguments)} in case no arguments should be - * supplied. + * {@link CallTarget#call(com.oracle.truffle.api.frame.PackedFrame, Arguments)} in case no + * arguments should be supplied. */ public static final Arguments EMPTY_ARGUMENTS = new Arguments(); /** - * Constructs an empty {@link Arguments} instance. Guest languages should create a subclass to specify their own arguments. + * Constructs an empty {@link Arguments} instance. Guest languages should create a subclass to + * specify their own arguments. */ protected Arguments() { } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CallTarget.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CallTarget.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CallTarget.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,12 +26,14 @@ /** * Represents the target of a call. Instances of this interface can be created using the - * {@link TruffleRuntime#createCallTarget(com.oracle.truffle.api.nodes.RootNode, FrameDescriptor)} method. + * {@link TruffleRuntime#createCallTarget(com.oracle.truffle.api.nodes.RootNode, FrameDescriptor)} + * method. */ public abstract class CallTarget { /** * Calls this target as a root method and without arguments. + * * @return the return result of the call */ public final Object call() { @@ -40,6 +42,7 @@ /** * Calls this target with a caller frame and no arguments. + * * @param caller the caller frame * @return the return result of the call */ @@ -49,6 +52,7 @@ /** * Calls this target as a root method passing arguments. + * * @param arguments the arguments that should be passed to the callee * @return the return result of the call */ @@ -58,6 +62,7 @@ /** * Calls this target passing a caller frame and arguments. + * * @param caller the caller frame * @param arguments the arguments that should be passed to the callee * @return the return result of the call diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntime.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntime.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntime.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,25 +26,34 @@ import com.oracle.truffle.api.nodes.*; /** - * Interface representing a Truffle runtime object. The runtime is responsible for creating call targets and performing optimizations for them. + * Interface representing a Truffle runtime object. The runtime is responsible for creating call + * targets and performing optimizations for them. */ public interface TruffleRuntime { + /** * Name describing this runtime implementation for debugging purposes. + * * @return the name as a String */ String getName(); /** * Creates a new call target for a given root node. - * @param rootNode the root node whose {@link RootNode#execute(com.oracle.truffle.api.frame.VirtualFrame)} method represents the entry point + * + * @param rootNode the root node whose + * {@link RootNode#execute(com.oracle.truffle.api.frame.VirtualFrame)} method + * represents the entry point * @return the new call target object */ CallTarget createCallTarget(RootNode rootNode); /** * Creates a new call target for a given root node and a given frame descriptor. - * @param rootNode the root node whose {@link RootNode#execute(com.oracle.truffle.api.frame.VirtualFrame)} method represents the entry point + * + * @param rootNode the root node whose + * {@link RootNode#execute(com.oracle.truffle.api.frame.VirtualFrame)} method + * represents the entry point * @param frameDescriptor the descriptor used for creating a new frame at each invocation * @return the new call target object */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/DefaultTypeConversion.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/DefaultTypeConversion.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/DefaultTypeConversion.java Wed Jan 23 16:34:57 2013 +0100 @@ -38,12 +38,12 @@ } @Override - public Class< ? > getTopType() { + public Class getTopType() { return Object.class; } @Override - public Object convertTo(Class< ? > targetType, Object value) { + public Object convertTo(Class targetType, Object value) { return value; } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/Frame.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/Frame.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/Frame.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,8 +25,8 @@ import com.oracle.truffle.api.*; /** - * Represents a frame containing values of local variables of the guest language. Instances of this type must not be - * stored in a field or cast to {@link java.lang.Object}. + * Represents a frame containing values of local variables of the guest language. Instances of this + * type must not be stored in a field or cast to {@link java.lang.Object}. */ public interface Frame { @@ -37,7 +37,7 @@ /** * Read access to a local variable of type {@link Object}. - * + * * @param slot the slot of the local variable * @return the current value of the local variable */ @@ -45,7 +45,7 @@ /** * Write access to a local variable of type {@link Object}. - * + * * @param slot the slot of the local variable * @param value the new value of the local variable */ @@ -53,7 +53,7 @@ /** * Read access to a local variable of type boolean. - * + * * @param slot the slot of the local variable * @return the current value of the local variable */ @@ -61,7 +61,7 @@ /** * Write access to a local variable of type boolean. - * + * * @param slot the slot of the local variable * @param value the new value of the local variable */ @@ -69,7 +69,7 @@ /** * Read access to a local variable of type int. - * + * * @param slot the slot of the local variable * @return the current value of the local variable */ @@ -77,7 +77,7 @@ /** * Write access to a local variable of type int. - * + * * @param slot the slot of the local variable * @param value the new value of the local variable */ @@ -85,7 +85,7 @@ /** * Read access to a local variable of type long. - * + * * @param slot the slot of the local variable * @return the current value of the local variable */ @@ -93,7 +93,7 @@ /** * Write access to a local variable of type long. - * + * * @param slot the slot of the local variable * @param value the new value of the local variable */ @@ -101,7 +101,7 @@ /** * Read access to a local variable of type float. - * + * * @param slot the slot of the local variable * @return the current value of the local variable */ @@ -109,7 +109,7 @@ /** * Write access to a local variable of type float. - * + * * @param slot the slot of the local variable * @param value the new value of the local variable */ @@ -117,7 +117,7 @@ /** * Read access to a local variable of type double. - * + * * @param slot the slot of the local variable * @return the current value of the local variable */ @@ -125,7 +125,7 @@ /** * Write access to a local variable of type double. - * + * * @param slot the slot of the local variable * @param value the new value of the local variable */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameDescriptor.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameDescriptor.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameDescriptor.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,7 +25,8 @@ import java.util.*; /** - * Descriptor of the slots of frame objects. Multiple frame instances are associated with one such descriptor. + * Descriptor of the slots of frame objects. Multiple frame instances are associated with one such + * descriptor. */ public final class FrameDescriptor { @@ -77,7 +78,7 @@ return slots.size(); } - public List< ? extends FrameSlot> getSlots() { + public List getSlots() { return Collections.unmodifiableList(slots); } @@ -100,10 +101,10 @@ class TypeChangeFrameVersionImpl extends FrameVersionImpl implements FrameVersion.TypeChange { private final FrameSlotImpl slot; - private final Class< ? > oldType; - private final Class< ? > newType; + private final Class oldType; + private final Class newType; - protected TypeChangeFrameVersionImpl(FrameSlotImpl slot, Class< ? > oldType, Class< ? > newType) { + protected TypeChangeFrameVersionImpl(FrameSlotImpl slot, Class oldType, Class newType) { this.slot = slot; this.oldType = oldType; this.newType = newType; @@ -121,10 +122,10 @@ private final FrameDescriptor descriptor; private final String name; private final int index; - private Class< ? > type; + private Class type; private ArrayList listeners; - protected FrameSlotImpl(FrameDescriptor descriptor, String name, int index, Class< ? > type) { + protected FrameSlotImpl(FrameDescriptor descriptor, String name, int index, Class type) { this.descriptor = descriptor; this.name = name; this.index = index; @@ -140,11 +141,11 @@ return index; } - public Class< ? > getType() { + public Class getType() { return type; } - protected Object getValue(Class< ? > accessType, Frame frame) { + protected Object getValue(Class accessType, Frame frame) { if (accessType == Integer.class) { return frame.getInt(this); } else if (accessType == Long.class) { @@ -158,7 +159,7 @@ } } - protected void setValue(Class< ? > accessType, Frame frame, Object value) { + protected void setValue(Class accessType, Frame frame, Object value) { Object newValue = descriptor.typeConversion.convertTo(accessType, value); if (accessType == Integer.class) { frame.setInt(this, (Integer) newValue); @@ -173,8 +174,8 @@ } } - public void setType(final Class< ? > type) { - final Class< ? > oldType = this.type; + public void setType(final Class type) { + final Class oldType = this.type; this.type = type; ArrayList oldListeners = this.listeners; this.listeners = null; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlot.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlot.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlot.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,9 +26,14 @@ * A slot in a frame that can store a value of a given type. */ public interface FrameSlot { + String getName(); + int getIndex(); - Class< ? > getType(); - void setType(Class< ? > type); + + Class getType(); + + void setType(Class type); + void registerOneShotTypeListener(FrameSlotTypeListener listener); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlotTypeListener.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlotTypeListener.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlotTypeListener.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,5 +26,6 @@ * Listener for the event of a type change of a frame slot. */ public interface FrameSlotTypeListener { - void typeChanged(FrameSlot slot, Class< ? > oldType); + + void typeChanged(FrameSlot slot, Class oldType); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/MaterializedFrame.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/MaterializedFrame.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/MaterializedFrame.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,10 +23,11 @@ package com.oracle.truffle.api.frame; /** - * Represents a materialized frame containing values of local variables of the guest language. It can be created using - * the {@link VirtualFrame#materialize()} method. Instances of this type are the only frame instances that may be stored - * in fields or cast to {@link java.lang.Object}. In contrast to a {@link VirtualFrame}, a {@link MaterializedFrame} can - * no longer be packed and it also does not provide access to the caller frame. + * Represents a materialized frame containing values of local variables of the guest language. It + * can be created using the {@link VirtualFrame#materialize()} method. Instances of this type are + * the only frame instances that may be stored in fields or cast to {@link java.lang.Object}. In + * contrast to a {@link VirtualFrame}, a {@link MaterializedFrame} can no longer be packed and it + * also does not provide access to the caller frame. */ public interface MaterializedFrame extends Frame { } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/NativeFrame.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/NativeFrame.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/NativeFrame.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,8 +25,8 @@ import com.oracle.truffle.api.*; /** - * Represents a native frame without any local variables. Instances of this type must not be stored in a field or cast - * to {@link java.lang.Object}. + * Represents a native frame without any local variables. Instances of this type must not be stored + * in a field or cast to {@link java.lang.Object}. */ public class NativeFrame implements VirtualFrame, PackedFrame { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/PackedFrame.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/PackedFrame.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/PackedFrame.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,14 +23,16 @@ package com.oracle.truffle.api.frame; /** - * Represents a packed frame that represents a virtual frame. A packed frame instance can be retrieved with the - * {@link VirtualFrame#pack()} method. It can be converted back into a virtual frame using {@link PackedFrame#unpack()}. - * Instances of this type must not be stored in a field or cast to {@link java.lang.Object}. + * Represents a packed frame that represents a virtual frame. A packed frame instance can be + * retrieved with the {@link VirtualFrame#pack()} method. It can be converted back into a virtual + * frame using {@link PackedFrame#unpack()}. Instances of this type must not be stored in a field or + * cast to {@link java.lang.Object}. */ public interface PackedFrame { /** * Unpacks this frame and converts it back to a virtual frame. + * * @return the virtual frame that was the content of this packed frame */ VirtualFrame unpack(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/TypeConversion.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/TypeConversion.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/TypeConversion.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,6 +26,7 @@ * Interface for defining type conversions for frame slot values. */ public interface TypeConversion { + Class getTopType(); Object convertTo(Class targetType, Object value); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/VirtualFrame.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/VirtualFrame.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/VirtualFrame.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,35 +25,38 @@ import com.oracle.truffle.api.*; /** - * Represents a frame containing values of local variables of the guest language. Instances of this type must not be - * stored in a field or cast to {@link java.lang.Object}. If this is necessary, the frame must be explicitly converted - * into a materialized frame using the {@link VirtualFrame#materialize()} method. Whenever fast access to the local - * variables of a frame is no longer necessary, a virtual frame should be converted into a packed frame using the + * Represents a frame containing values of local variables of the guest language. Instances of this + * type must not be stored in a field or cast to {@link java.lang.Object}. If this is necessary, the + * frame must be explicitly converted into a materialized frame using the + * {@link VirtualFrame#materialize()} method. Whenever fast access to the local variables of a frame + * is no longer necessary, a virtual frame should be converted into a packed frame using the * {@link VirtualFrame#pack()} method. */ public interface VirtualFrame extends Frame { /** - * Converts this virtual frame into a packed frame that has no longer direct access to the local variables. This - * packing is an important hint to the Truffle optimizer and therefore passing around a {@link PackedFrame} should - * be preferred over passing around a {@link VirtualFrame} when the probability that an unpacking will occur is low. - * + * Converts this virtual frame into a packed frame that has no longer direct access to the local + * variables. This packing is an important hint to the Truffle optimizer and therefore passing + * around a {@link PackedFrame} should be preferred over passing around a {@link VirtualFrame} + * when the probability that an unpacking will occur is low. + * * @return the packed frame */ PackedFrame pack(); /** - * Accesses the caller frame passed in via {@link CallTarget#call}. To get full access, it must be first unpacked - * using {@link PackedFrame#unpack()}. - * + * Accesses the caller frame passed in via {@link CallTarget#call}. To get full access, it must + * be first unpacked using {@link PackedFrame#unpack()}. + * * @return the caller frame or null if this was a root method call */ PackedFrame getCaller(); /** - * Materializes this frame, which allows it to be stored in a field or cast to {@link java.lang.Object}. The frame - * however looses the ability to be packed or to access the caller frame. - * + * Materializes this frame, which allows it to be stored in a field or cast to + * {@link java.lang.Object}. The frame however looses the ability to be packed or to access the + * caller frame. + * * @return the new materialized frame */ MaterializedFrame materialize(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultMaterializedFrame.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultMaterializedFrame.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultMaterializedFrame.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,6 +26,7 @@ import com.oracle.truffle.api.frame.*; final class DefaultMaterializedFrame implements MaterializedFrame { + private final DefaultVirtualFrame wrapped; protected DefaultMaterializedFrame(DefaultVirtualFrame wrapped) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultPackedFrame.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultPackedFrame.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultPackedFrame.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,6 +25,7 @@ import com.oracle.truffle.api.frame.*; final class DefaultPackedFrame implements PackedFrame { + private final DefaultVirtualFrame wrapped; protected DefaultPackedFrame(DefaultVirtualFrame wrapped) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultTruffleRuntime.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultTruffleRuntime.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultTruffleRuntime.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,7 +27,8 @@ import com.oracle.truffle.api.nodes.*; /** - * Default implementation of the Truffle runtime if the virtual machine does not provide a better performing alternative. + * Default implementation of the Truffle runtime if the virtual machine does not provide a better + * performing alternative. */ public final class DefaultTruffleRuntime implements TruffleRuntime { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultVirtualFrame.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultVirtualFrame.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultVirtualFrame.java Wed Jan 23 16:34:57 2013 +0100 @@ -49,7 +49,8 @@ this.arguments = arguments; this.currentVersion = descriptor.getCurrentVersion(); this.locals = new Object[descriptor.getSize()]; - // The tags are only needed for assertion checking, so initialize the field only when assertions are enabled + // The tags are only needed for assertion checking, so initialize the field only when + // assertions are enabled assert (this.tags = new Class[descriptor.getSize()]) != null; } @@ -133,7 +134,7 @@ set(slot, Double.class, value); } - private Object get(FrameSlot slot, Class< ? > accessType, Object defaultValue) { + private Object get(FrameSlot slot, Class accessType, Object defaultValue) { Object value = locals[slot.getIndex()]; assert verifyGet(slot, accessType, value); if (value == null) { @@ -143,9 +144,9 @@ } } - private boolean verifyGet(FrameSlot slot, Class< ? > accessType, Object value) { + private boolean verifyGet(FrameSlot slot, Class accessType, Object value) { assert descriptor.getSlots().get(slot.getIndex()) == slot; - Class< ? > tag = tags[slot.getIndex()]; + Class tag = tags[slot.getIndex()]; if (value == null) { assert tag == null || tag == Object.class; } else { @@ -154,12 +155,12 @@ return true; } - private void set(FrameSlot slot, Class< ? > accessType, Object value) { + private void set(FrameSlot slot, Class accessType, Object value) { assert verifySet(slot, accessType, value); locals[slot.getIndex()] = value; } - private boolean verifySet(FrameSlot slot, Class< ? > accessType, Object value) { + private boolean verifySet(FrameSlot slot, Class accessType, Object value) { assert descriptor.getSlots().get(slot.getIndex()) == slot; tags[slot.getIndex()] = accessType; assert accessType.isAssignableFrom(slot.getType()) : "Local variable " + slot + ": " + accessType + " is not assignable from " + slot.getType(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/intrinsics/ExactMath.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/intrinsics/ExactMath.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/intrinsics/ExactMath.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,8 +23,9 @@ package com.oracle.truffle.api.intrinsics; /** - * This class contains methods that will be part of java.lang.Math starting with JDK 8. Until JDK 8 is release, we - * duplicate them here because they are generally useful for dynamic language implementations. + * This class contains methods that will be part of java.lang.Math starting with JDK 8. Until JDK 8 + * is release, we duplicate them here because they are generally useful for dynamic language + * implementations. */ public class ExactMath { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/intrinsics/TruffleIntrinsics.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/intrinsics/TruffleIntrinsics.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/intrinsics/TruffleIntrinsics.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,14 +28,16 @@ public final class TruffleIntrinsics { /** - * Specifies that the compiler should put a deoptimization point at this position that will continue execution in the interpreter. - * Should be used to cut off cold paths that should not be part of the compiled machine code. + * Specifies that the compiler should put a deoptimization point at this position that will + * continue execution in the interpreter. Should be used to cut off cold paths that should not + * be part of the compiled machine code. */ public static void deoptimize() { } /** - * Checks whether the Thread has been interrupted in the interpreter in order to avoid endless loops. The compiled code may choose a more efficient implementation. + * Checks whether the Thread has been interrupted in the interpreter in order to avoid endless + * loops. The compiled code may choose a more efficient implementation. */ public static void checkThreadInterrupted() { if (Thread.currentThread().isInterrupted()) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/ExplodeLoop.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/ExplodeLoop.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/ExplodeLoop.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,7 +25,8 @@ import java.lang.annotation.*; /** - * Specifies for a method that the loops with constant number of invocations should be fully unrolled. + * Specifies for a method that the loops with constant number of invocations should be fully + * unrolled. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/GraphPrintVisitor.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/GraphPrintVisitor.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/GraphPrintVisitor.java Wed Jan 23 16:34:57 2013 +0100 @@ -235,7 +235,8 @@ protected void setNodeProperty(Object node, String propertyName, Object value) { Element nodeElem = getElementByObject(node); - Element propElem = getPropertyElement(node, propertyName); // if property exists, replace its value + Element propElem = getPropertyElement(node, propertyName); // if property exists, replace + // its value if (null == propElem) { // if property doesn't exist, create one propElem = dom.createElement("p"); propElem.setAttribute("name", propertyName); @@ -347,37 +348,46 @@ } public class GraphPrintAdapter { + public void createElementForNode(Object node) { GraphPrintVisitor.this.createElementForNode(node); } + public void visit(Object node) { GraphPrintVisitor.this.visit(node); } + public void connectNodes(Object node, Object child) { GraphPrintVisitor.this.connectNodes(node, child); } + public void setNodeProperty(Object node, String propertyName, Object value) { GraphPrintVisitor.this.setNodeProperty(node, propertyName, value); } } public interface GraphPrintHandler { + void visit(Object node, GraphPrintAdapter gPrinter); } @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface CustomGraphPrintHandler { + Class handler(); } + @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface NullGraphPrintHandler { } + @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface GraphDuplicate { } + @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface HiddenField { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java Wed Jan 23 16:34:57 2013 +0100 @@ -54,8 +54,9 @@ } /** - * Method that updates the link to the parent in the array of specified new child nodes to this node. - * + * Method that updates the link to the parent in the array of specified new child nodes to this + * node. + * * @param newChildren the array of new children whose parent should be updated * @return the array of new children */ @@ -70,7 +71,7 @@ /** * Method that updates the link to the parent in the specified new child node to this node. - * + * * @param newChild the new child whose parent should be updated * @return the new child */ @@ -82,9 +83,9 @@ } /** - * Returns properties of this node interesting for debugging and can be overwritten by subclasses to add their own - * custom properties. - * + * Returns properties of this node interesting for debugging and can be overwritten by + * subclasses to add their own custom properties. + * * @return the properties as a key/value hash map */ public Map getDebugProperties() { @@ -94,7 +95,7 @@ /** * The current parent node of this node. - * + * * @return the parent node */ public final Node getParent() { @@ -103,7 +104,7 @@ /** * Replaces one child of this node with another node. - * + * * @param oldChild the old child * @param newChild the new child that should replace the old child * @return the new child @@ -116,7 +117,7 @@ /** * Replaces this node with another node. - * + * * @param newNode the new node that is the replacement * @param reason a description of the reason for the replacement * @return the new node @@ -129,7 +130,7 @@ /** * Replaces this node with another node. - * + * * @param newNode the new node that is the replacement * @return the new node */ @@ -138,8 +139,9 @@ } /** - * Invokes the {@link NodeVisitor#visit(Node)} method for this node and recursively also for all child nodes. - * + * Invokes the {@link NodeVisitor#visit(Node)} method for this node and recursively also for all + * child nodes. + * * @param nodeVisitor the visitor */ public final void accept(NodeVisitor nodeVisitor) { @@ -154,7 +156,7 @@ /** * Iterator over the children of this node. - * + * * @return the iterator */ public final Iterable getChildren() { @@ -169,7 +171,7 @@ /** * Creates a shallow copy of this node. - * + * * @return the new copy */ public Node copy() { @@ -181,8 +183,8 @@ } /** - * This method must never be called. It enforces that {@link Object#clone} is not directly called by subclasses. - * Use the {@link #copy()} method instead. + * This method must never be called. It enforces that {@link Object#clone} is not directly + * called by subclasses. Use the {@link #copy()} method instead. */ @Override @Deprecated diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeInfo.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeInfo.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeInfo.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,6 +33,7 @@ /** * Short name representing the node that can be used for debugging. + * * @return the short name */ String shortName() default ""; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java Wed Jan 23 16:34:57 2013 +0100 @@ -43,11 +43,11 @@ private final Class[] nodeArrayFieldClasses; private final long parentOffset; private final long[] nodeDataFieldOffsets; - private final Class< ? >[] nodeDataFieldClasses; + private final Class[] nodeDataFieldClasses; - private static final Map, NodeClass> nodeClasses = new IdentityHashMap<>(); + private static final Map, NodeClass> nodeClasses = new IdentityHashMap<>(); - public static NodeClass get(Class< ? > clazz) { + public static NodeClass get(Class clazz) { NodeClass nodeClass = nodeClasses.get(clazz); if (nodeClass == null) { nodeClass = new NodeClass(clazz); @@ -56,15 +56,15 @@ return nodeClass; } - private NodeClass(Class< ? > clazz) { + private NodeClass(Class clazz) { // scan object fields - Class< ? > parentClassTmp = null; + Class parentClassTmp = null; List nodeFieldOffsetsList = new ArrayList<>(); - List> nodeFieldClassesList = new ArrayList<>(); + List> nodeFieldClassesList = new ArrayList<>(); List nodeArrayFieldOffsetsList = new ArrayList<>(); - List> nodeArrayFieldClassesList = new ArrayList<>(); + List> nodeArrayFieldClassesList = new ArrayList<>(); List nodeDataFieldOffsetList = new ArrayList<>(); - List> nodeDataFieldClassList = new ArrayList<>(); + List> nodeDataFieldClassList = new ArrayList<>(); Field[] fields = getAllFields(clazz); long parentOffsetTemp = -1; for (Field field : fields) { @@ -95,7 +95,7 @@ this.nodeArrayFieldOffsets = toLongArray(nodeArrayFieldOffsetsList); this.nodeArrayFieldClasses = nodeArrayFieldClassesList.toArray(new Class[nodeArrayFieldClassesList.size()]); this.nodeDataFieldOffsets = toLongArray(nodeDataFieldOffsetList); - this.nodeDataFieldClasses = nodeDataFieldClassList.toArray(new Class< ? >[nodeDataFieldClassList.size()]); + this.nodeDataFieldClasses = nodeDataFieldClassList.toArray(new Class[nodeDataFieldClassList.size()]); this.parentOffset = parentOffsetTemp; } @@ -198,7 +198,7 @@ @SuppressWarnings("unchecked") public static T cloneNode(T orig) { - Class< ? extends Node> clazz = orig.getClass(); + Class clazz = orig.getClass(); NodeClass nodeClass = NodeClass.get(clazz); Node clone = orig.copy(); if (clone == null) { @@ -279,49 +279,49 @@ } } - public static long[] getNodeDataFieldOffsets(Class< ? > nodeClass) { + public static long[] getNodeDataFieldOffsets(Class nodeClass) { NodeClass clazz = NodeClass.get(nodeClass); return Arrays.copyOf(clazz.nodeDataFieldOffsets, clazz.nodeDataFieldClasses.length); } - public static Class[] getNodeDataFieldClasses(Class< ? > nodeClass) { + public static Class[] getNodeDataFieldClasses(Class nodeClass) { NodeClass clazz = NodeClass.get(nodeClass); return Arrays.copyOf(clazz.nodeDataFieldClasses, clazz.nodeDataFieldClasses.length); } - public static long getNodeParentOffset(Class< ? > nodeClass) { + public static long getNodeParentOffset(Class nodeClass) { NodeClass clazz = NodeClass.get(nodeClass); return clazz.parentOffset; } /** Returns the number of Node field declarations in the class hierarchy. */ - public static long[] getNodeFieldOffsets(Class< ? > nodeClass) { + public static long[] getNodeFieldOffsets(Class nodeClass) { NodeClass clazz = NodeClass.get(nodeClass); return Arrays.copyOf(clazz.nodeFieldOffsets, clazz.nodeFieldOffsets.length); } /** Returns the number of Node[] declaration in the class hierarchy. */ - public static long[] getNodeFieldArrayOffsets(Class< ? > nodeClass) { + public static long[] getNodeFieldArrayOffsets(Class nodeClass) { NodeClass clazz = NodeClass.get(nodeClass); return Arrays.copyOf(clazz.nodeArrayFieldOffsets, clazz.nodeArrayFieldOffsets.length); } - public static Class[] getNodeFieldArrayClasses(Class< ? > nodeClass) { + public static Class[] getNodeFieldArrayClasses(Class nodeClass) { NodeClass clazz = NodeClass.get(nodeClass); return Arrays.copyOf(clazz.nodeArrayFieldClasses, clazz.nodeArrayFieldClasses.length); } - public static Class getNodeParentClass(Class< ? > nodeClass) { + public static Class getNodeParentClass(Class nodeClass) { return NodeClass.get(nodeClass).parentClass; } - public static Class[] getNodeFieldClasses(Class< ? > nodeClass) { + public static Class[] getNodeFieldClasses(Class nodeClass) { NodeClass clazz = NodeClass.get(nodeClass); return Arrays.copyOf(clazz.nodeFieldClasses, clazz.nodeFieldClasses.length); } /** Returns all declared fields in the class hierarchy. */ - public static Field[] getAllFields(Class< ? extends Object> clazz) { + public static Field[] getAllFields(Class clazz) { Field[] declaredFields = clazz.getDeclaredFields(); if (clazz.getSuperclass() != null) { return concat(getAllFields(clazz.getSuperclass()), declaredFields); @@ -336,11 +336,11 @@ } /** find annotation in class/interface hierarchy. */ - public static T findAnnotation(Class< ? > clazz, Class annotationClass) { + public static T findAnnotation(Class clazz, Class annotationClass) { if (clazz.getAnnotation(annotationClass) != null) { return clazz.getAnnotation(annotationClass); } else { - for (Class< ? > intf : clazz.getInterfaces()) { + for (Class intf : clazz.getInterfaces()) { if (intf.getAnnotation(annotationClass) != null) { return intf.getAnnotation(annotationClass); } @@ -468,9 +468,9 @@ } /** - * Prints a human readable form of a {@link Node} AST to the given {@link PrintStream}. This print method does not - * check for cycles in the node structure. - * + * Prints a human readable form of a {@link Node} AST to the given {@link PrintStream}. This + * print method does not check for cycles in the node structure. + * * @param p the {@link PrintStream} to print to. * @param node the root node to write */ @@ -479,9 +479,10 @@ } /** - * Prints a human readable form of a tree to the given {@link PrintStream}. The {@link TreeResolver} interface needs - * to be implemented to specify how the method can read the tree from plain a object. - * + * Prints a human readable form of a tree to the given {@link PrintStream}. The + * {@link TreeResolver} interface needs to be implemented to specify how the method can read the + * tree from plain a object. + * * @param p the {@link PrintStream} to print to. * @param o the root object to be printed. * @param resolver an implementation of a tree resolver @@ -537,7 +538,7 @@ // I refetch the fields to get declaration order. for (int i = 0; i < childFields.size(); i++) { Field field = childFields.get(i); - Class< ? > fieldClass = field.getType(); + Class fieldClass = field.getType(); String name = field.getName(); long offset = unsafe.objectFieldOffset(field); @@ -576,7 +577,7 @@ } } - private static Object getObjectValue(Object base, Class< ? > fieldClass, long offset) { + private static Object getObjectValue(Object base, Class fieldClass, long offset) { if (fieldClass == boolean.class) { return unsafe.getBoolean(base, offset); } else if (fieldClass == byte.class) { @@ -648,42 +649,42 @@ /** * Returns true if a {@link Field} is filtered from the tree. - * + * * @param f the field to check */ boolean isFiltered(Field f); /** - * Returns true if a {@link Field} is a field that contains a data value which should not be traversed - * recursively. - * + * Returns true if a {@link Field} is a field that contains a data value which should not be + * traversed recursively. + * * @param f the field to check * @return true if a the given field is a data field else false. */ boolean isDataField(Field f); /** - * Returns true if a {@link Field} is a field that contains an {@link Object} which should be recursively - * visited. - * + * Returns true if a {@link Field} is a field that contains an {@link Object} which should + * be recursively visited. + * * @param f the field to check * @return true if a the given field is a child field else false. */ boolean isChildObject(Field f); /** - * Returns true if a {@link Field} is a field that contains any kind of list/array structure which itself holds - * values that should be recursively visited. - * + * Returns true if a {@link Field} is a field that contains any kind of list/array structure + * which itself holds values that should be recursively visited. + * * @param f the field to check * @return true if a the given field is a child array/list field else false. */ boolean isChildArrayObject(Field f); /** - * Converts an given child array object to array which can be traversed. This is especially useful to convert - * any kind of list structure to a traversable array. - * + * Converts an given child array object to array which can be traversed. This is especially + * useful to convert any kind of list structure to a traversable array. + * * @param f the field for meta data needed to convert the data {@link Object}. * @param value the actual value of the child array/list object. * @return the converted {@link Object} array. @@ -692,7 +693,7 @@ /** * Returns a human readable string for any data field object in the tree. - * + * * @param o the object to convert to string. * @return the converted string */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeVisitor.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeVisitor.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeVisitor.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,9 +28,9 @@ public interface NodeVisitor { /** - * 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. - * + * 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 */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,12 +26,15 @@ import com.oracle.truffle.api.frame.*; /** - * A root node is a node with a method to execute it given only a frame as a parameter. Therefore, a root node can be used to create a call target using {@link TruffleRuntime#createCallTarget(RootNode, FrameDescriptor)}. + * A root node is a node with a method to execute it given only a frame as a parameter. Therefore, a + * root node can be used to create a call target using + * {@link TruffleRuntime#createCallTarget(RootNode, FrameDescriptor)}. */ public abstract class RootNode extends Node { /** * 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 */ diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/SlowPathException.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/SlowPathException.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/SlowPathException.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,8 +23,8 @@ package com.oracle.truffle.api.nodes; /** - * An exception thrown to enter a slow path. The Truffle optimizer has special knowledge of this exception class and - * will never compile a catch block that catches this exception type. + * An exception thrown to enter a slow path. The Truffle optimizer has special knowledge of this + * exception class and will never compile a catch block that catches this exception type. */ public class SlowPathException extends Exception { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java Wed Jan 23 16:34:57 2013 +0100 @@ -23,9 +23,9 @@ package com.oracle.truffle.api.nodes; /** - * An exception that should be thrown if the return value cannot be represented as a value of the return type. The - * Truffle optimizer has special knowledge of this exception class and will never compile a catch block that catches this - * exception type. + * An exception that should be thrown if the return value cannot be represented as a value of the + * return type. The Truffle optimizer has special knowledge of this exception class and will never + * compile a catch block that catches this exception type. */ public final class UnexpectedResultException extends SlowPathException { @@ -33,7 +33,9 @@ private final Object result; /** - * Creates the exception with the alternative result that cannot be respresented as a value of the return type. + * Creates the exception with the alternative result that cannot be respresented as a value of + * the return type. + * * @param result the alternative result */ public UnexpectedResultException(Object result) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/AbstractParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/AbstractParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/AbstractParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -65,7 +65,8 @@ } protected abstract M parse(Element element, AnnotationMirror mirror); - public abstract Class< ? extends Annotation> getAnnotationType(); + + public abstract Class getAnnotationType(); public boolean isDelegateToRootDeclaredType() { return false; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Log.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Log.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Log.java Wed Jan 23 16:34:57 2013 +0100 @@ -39,11 +39,11 @@ this.processingEnv = env; } - public void warning(Element element, String format, Object ... args) { + public void warning(Element element, String format, Object... args) { message(Kind.WARNING, element, null, null, format, args); } - public void warning(Element element, AnnotationMirror mirror, String format, Object ... args) { + public void warning(Element element, AnnotationMirror mirror, String format, Object... args) { message(Kind.WARNING, element, mirror, null, format, args); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ProcessorContext.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ProcessorContext.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ProcessorContext.java Wed Jan 23 16:34:57 2013 +0100 @@ -147,7 +147,7 @@ return null; } - public TypeMirror getType(Class< ? > element) { + public TypeMirror getType(Class element) { TypeMirror mirror; if (element.isPrimitive()) { if (element == boolean.class) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/TruffleProcessor.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/TruffleProcessor.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/TruffleProcessor.java Wed Jan 23 16:34:57 2013 +0100 @@ -36,17 +36,18 @@ /** * THIS IS NOT PUBLIC API. */ -//@SupportedAnnotationTypes({"com.oracle.truffle.codegen.Operation", "com.oracle.truffle.codegen.TypeLattice"}) +// @SupportedAnnotationTypes({"com.oracle.truffle.codegen.Operation", +// "com.oracle.truffle.codegen.TypeLattice"}) @SupportedSourceVersion(SourceVersion.RELEASE_7) public class TruffleProcessor extends AbstractProcessor implements ProcessCallback { private ProcessorContext context; - private List> generators; + private List> generators; private RoundEnvironment round; @Override - public boolean process(Set< ? extends TypeElement> annotations, RoundEnvironment roundEnv) { + public boolean process(Set annotations, RoundEnvironment roundEnv) { if (!roundEnv.processingOver()) { processImpl(roundEnv); } @@ -55,7 +56,8 @@ private void processImpl(RoundEnvironment env) { this.round = env; - // TODO run verifications that other annotations are not processed out of scope of the operation or typelattice. + // TODO run verifications that other annotations are not processed out of scope of the + // operation or typelattice. try { for (AnnotationProcessor generator : getGenerators()) { AbstractParser parser = generator.getParser(); @@ -116,13 +118,13 @@ List> annotationsTypes = new ArrayList<>(); annotationsTypes.addAll(NodeParser.ANNOTATIONS); annotationsTypes.addAll(TypeSystemParser.ANNOTATIONS); - for (Class< ? extends Annotation > type : annotationsTypes) { + for (Class type : annotationsTypes) { annotations.add(type.getCanonicalName()); } return annotations; } - private List> getGenerators() { + private List> getGenerators() { if (generators == null && processingEnv != null) { generators = new ArrayList<>(); generators.add(new AnnotationProcessor<>(getContext(), new TypeSystemParser(getContext()), new TypeSystemCodeGenerator(getContext()))); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Utils.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Utils.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Utils.java Wed Jan 23 16:34:57 2013 +0100 @@ -47,10 +47,8 @@ } } - public static List collectAnnotations( - ProcessorContext context, - AnnotationMirror markerAnnotation, String elementName, Element element, - Class< ? extends Annotation> annotationClass) { + public static List collectAnnotations(ProcessorContext context, AnnotationMirror markerAnnotation, String elementName, Element element, + Class annotationClass) { List result = Utils.getAnnotationValueList(markerAnnotation, elementName); AnnotationMirror explicit = Utils.findAnnotationMirror(context.getEnvironment(), element, annotationClass); if (explicit != null) { @@ -160,7 +158,6 @@ } } - private static String getGenericName(TypeElement element) { String simpleName = element.getSimpleName().toString(); @@ -346,7 +343,7 @@ } public static String createConstantName(String simpleName) { - //TODO use camel case to produce underscores. + // TODO use camel case to produce underscores. return simpleName.toString().toUpperCase(); } @@ -364,7 +361,7 @@ @SuppressWarnings("unchecked") public static List getAnnotationValueList(AnnotationMirror mirror, String name) { List result = new ArrayList<>(); - List< ? extends AnnotationValue> values = (List< ? extends AnnotationValue>) getAnnotationValue(mirror, name).getValue(); + List values = (List) getAnnotationValue(mirror, name).getValue(); for (AnnotationValue value : values) { result.add((T) value.getValue()); } @@ -419,11 +416,11 @@ return e.getMessage() + "\r\n" + string.toString(); } - public static AnnotationMirror findAnnotationMirror(ProcessingEnvironment processingEnv, Element element, Class< ? > annotationClass) { + public static AnnotationMirror findAnnotationMirror(ProcessingEnvironment processingEnv, Element element, Class annotationClass) { return findAnnotationMirror(processingEnv, element.getAnnotationMirrors(), annotationClass); } - public static AnnotationMirror findAnnotationMirror(ProcessingEnvironment processingEnv, List< ? extends AnnotationMirror> mirrors, Class< ? > annotationClass) { + public static AnnotationMirror findAnnotationMirror(ProcessingEnvironment processingEnv, List mirrors, Class annotationClass) { TypeElement expectedAnnotationType = processingEnv.getElementUtils().getTypeElement(annotationClass.getCanonicalName()); for (AnnotationMirror mirror : mirrors) { DeclaredType annotationType = mirror.getAnnotationType(); @@ -526,7 +523,6 @@ return qualified1.equals(qualified2); } - public static int compareByTypeHierarchy(TypeMirror t1, TypeMirror t2) { if (typeEquals(t1, t2)) { return 0; @@ -543,7 +539,6 @@ return 0; } - public static boolean canThrowType(List thrownTypes, TypeMirror exceptionType) { if (Utils.containsType(thrownTypes, exceptionType)) { return true; @@ -604,5 +599,4 @@ return true; } - } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/ExtensionContext.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/ExtensionContext.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/ExtensionContext.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,7 +26,6 @@ import com.oracle.truffle.codegen.processor.api.element.*; - public interface ExtensionContext { ProcessingEnvironment getProcessingEnvironment(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/ExtensionProcessor.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/ExtensionProcessor.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/ExtensionProcessor.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,7 +24,6 @@ import javax.lang.model.element.*; - public interface ExtensionProcessor { void process(ExtensionContext context, AnnotationMirror mirror, Element element); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableElement.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableElement.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableElement.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,7 +24,6 @@ import javax.lang.model.element.*; - public interface WritableElement extends Element { void addAnnotationMirror(AnnotationMirror annotationMirror); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableElementFactory.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableElementFactory.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableElementFactory.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,19 +25,24 @@ import javax.lang.model.element.*; import javax.lang.model.type.*; - public interface WritableElementFactory { WritableExecutableElement cloneExecutableElement(ExecutableElement method); + WritableVariableElement cloneVariableElement(VariableElement parameter); + WritableAnnotationMirror cloneAnnotationMirror(AnnotationMirror mirror); WritableVariableElement createParameter(TypeMirror type, String simpleName); + WritableExecutableElement createExecutableElement(TypeMirror returnType, String methodName); + WritableAnnotationMirror createAnnotationMirror(DeclaredType annotationClass); Name createName(String name); + AnnotationValue createAnnotationValue(Object value); + TypeMirror createTypeMirror(Class javaClass); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableExecutableElement.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableExecutableElement.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableExecutableElement.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,17 +28,22 @@ public interface WritableExecutableElement extends ExecutableElement, WritableElement { void setReturnType(TypeMirror type); + void setDefaultValue(AnnotationValue defaultValue); void addParameter(VariableElement parameter); + void removeParameter(VariableElement parameter); void addThrownType(TypeMirror thrownType); + void removeThrownType(TypeMirror thrownType); void setSimpleName(Name name); + void setVarArgs(boolean varargs); void setBody(String body); + String getBody(); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableVariableElement.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableVariableElement.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableVariableElement.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,6 +28,7 @@ public interface WritableVariableElement extends VariableElement, WritableElement { void setSimpleName(Name name); + void setType(TypeMirror type); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeAnnotationMirror.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeAnnotationMirror.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeAnnotationMirror.java Wed Jan 23 16:34:57 2013 +0100 @@ -45,7 +45,7 @@ } @Override - public Map< ? extends ExecutableElement, ? extends AnnotationValue> getElementValues() { + public Map getElementValues() { return values; } @@ -77,5 +77,4 @@ return copy; } - } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeAnnotationValue.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeAnnotationValue.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeAnnotationValue.java Wed Jan 23 16:34:57 2013 +0100 @@ -58,8 +58,8 @@ public R accept(AnnotationValueVisitor v, P p) { if (value instanceof AnnotationMirror) { return v.visitAnnotation((AnnotationMirror) value, p); - } else if (value instanceof List< ? >) { - return v.visitArray((List< ? extends AnnotationValue>) value, p); + } else if (value instanceof List) { + return v.visitArray((List) value, p); } else if (value instanceof Boolean) { return v.visitBoolean((boolean) value, p); } else if (value instanceof Byte) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeElement.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeElement.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeElement.java Wed Jan 23 16:34:57 2013 +0100 @@ -46,7 +46,6 @@ this.modifiers = new LinkedHashSet<>(); } - @Override public void setGeneratorAnnotationMirror(AnnotationMirror mirror) { this.generatorAnnotationMirror = mirror; @@ -128,8 +127,7 @@ public CodeTypeElement getEnclosingClass() { Element p = enclosingElement; - while (p != null && p.getKind() != ElementKind.CLASS - && p.getKind() != ElementKind.ENUM) { + while (p != null && p.getKind() != ElementKind.CLASS && p.getKind() != ElementKind.ENUM) { p = p.getEnclosingElement(); } return (CodeTypeElement) p; @@ -139,7 +137,6 @@ return new ParentableList<>(parent, list); } - @Override public String toString() { StringBuilderCodeWriter codeWriter = new StringBuilderCodeWriter(); @@ -157,13 +154,13 @@ protected Writer createWriter(CodeTypeElement clazz) throws IOException { return writer; } + public String getString() { return new String(((CharArrayWriter) writer).toCharArray()).trim(); } } - private static class ParentableList implements List { private final Element parent; @@ -234,12 +231,12 @@ } @Override - public boolean containsAll(Collection< ? > c) { + public boolean containsAll(Collection c) { return delegate.containsAll(c); } @Override - public boolean addAll(Collection< ? extends T> c) { + public boolean addAll(Collection c) { if (c != null) { for (T t : c) { addImpl(t); @@ -249,7 +246,7 @@ } @Override - public boolean addAll(int index, Collection< ? extends T> c) { + public boolean addAll(int index, Collection c) { if (c != null) { for (T t : c) { addImpl(t); @@ -259,7 +256,7 @@ } @Override - public boolean removeAll(Collection< ? > c) { + public boolean removeAll(Collection c) { if (c != null) { for (Object t : c) { removeImpl(t); @@ -274,7 +271,7 @@ } @Override - public boolean retainAll(Collection< ? > c) { + public boolean retainAll(Collection c) { throw new UnsupportedOperationException("Not supported by parentable list"); } @@ -338,5 +335,4 @@ } - } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeElementScanner.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeElementScanner.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeElementScanner.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,7 +25,7 @@ import javax.lang.model.element.*; import javax.lang.model.util.*; -public abstract class CodeElementScanner extends ElementScanner7{ +public abstract class CodeElementScanner extends ElementScanner7 { @Override public final R visitExecutable(ExecutableElement e, P p) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeExecutableElement.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeExecutableElement.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeExecutableElement.java Wed Jan 23 16:34:57 2013 +0100 @@ -79,7 +79,7 @@ } @Override - public List< ? extends TypeParameterElement> getTypeParameters() { + public List getTypeParameters() { return Collections.emptyList(); } @@ -156,7 +156,6 @@ parameters.remove(parameter); } - public void removeParameter(String varName) { VariableElement remove = null; for (VariableElement var : getParameters()) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTreeBuilder.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTreeBuilder.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTreeBuilder.java Wed Jan 23 16:34:57 2013 +0100 @@ -99,10 +99,12 @@ public CodeTreeBuilder startStatement() { startGroup(); registerCallBack(new EndCallback() { + @Override public void beforeEnd() { string(";").newLine(); } + @Override public void afterEnd() { } @@ -195,9 +197,11 @@ startGroup(); string("(").startGroup(); registerCallBack(new EndCallback() { + @Override public void beforeEnd() { } + @Override public void afterEnd() { string(")"); @@ -210,9 +214,11 @@ public CodeTreeBuilder startDoubleQuote() { startGroup().string("\""); registerCallBack(new EndCallback() { + @Override public void beforeEnd() { } + @Override public void afterEnd() { string("\""); @@ -293,10 +299,12 @@ public CodeTreeBuilder startCase() { startGroup().string("case "); registerCallBack(new EndCallback() { + @Override public void beforeEnd() { string(" :").newLine(); } + @Override public void afterEnd() { } @@ -317,10 +325,12 @@ if (method != null && Utils.isVoid(method.getReturnType())) { startGroup(); registerCallBack(new EndCallback() { + @Override public void beforeEnd() { string(";").newLine(); // complete statement to execute } + @Override public void afterEnd() { string("return").string(";").newLine(); // emit a return; @@ -374,9 +384,11 @@ startGroup(); string("{").newLine().startIndention(); registerCallBack(new EndCallback() { + @Override public void beforeEnd() { } + @Override public void afterEnd() { string("}").newLine(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTypeElement.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTypeElement.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTypeElement.java Wed Jan 23 16:34:57 2013 +0100 @@ -103,7 +103,7 @@ } @Override - public List< ? extends TypeParameterElement> getTypeParameters() { + public List getTypeParameters() { return Collections.emptyList(); } @@ -184,9 +184,8 @@ public ExecutableElement getMethod(String name) { for (Element element : getEnclosedElements()) { - if (element.getKind() == ElementKind.METHOD - && element.getSimpleName().toString().equals(name)) { - return (ExecutableElement) element; + if (element.getKind() == ElementKind.METHOD && element.getSimpleName().toString().equals(name)) { + return (ExecutableElement) element; } } return null; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTypeMirror.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTypeMirror.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTypeMirror.java Wed Jan 23 16:34:57 2013 +0100 @@ -81,7 +81,7 @@ } @Override - public List< ? extends TypeMirror> getTypeArguments() { + public List getTypeArguments() { return Collections.emptyList(); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeVariableElement.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeVariableElement.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeVariableElement.java Wed Jan 23 16:34:57 2013 +0100 @@ -140,5 +140,4 @@ return copy; } - } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/GeneratedElement.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/GeneratedElement.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/GeneratedElement.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,13 +24,14 @@ import javax.lang.model.element.*; - public interface GeneratedElement { AnnotationMirror getGeneratorAnnotationMirror(); + void setGeneratorAnnotationMirror(AnnotationMirror mirror); Element getGeneratorElement(); + void setGeneratorElement(Element element); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/AbstractCodeWriter.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/AbstractCodeWriter.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/AbstractCodeWriter.java Wed Jan 23 16:34:57 2013 +0100 @@ -250,7 +250,6 @@ init = ((CodeVariableElement) f).getInit(); } - if (parent.getKind() == ElementKind.ENUM && f.getModifiers().contains(Modifier.STATIC)) { write(f.getSimpleName()); if (init != null) { @@ -294,6 +293,7 @@ } Collections.sort(methodsList, new Comparator() { + @Override public int compare(ExecutableElement o1, ExecutableElement o2) { return o1.getSimpleName().toString().compareTo(o2.getSimpleName().toString()); @@ -322,46 +322,55 @@ } private class AnnotationValueWriterVisitor extends AbstractAnnotationValueVisitor7 { + @Override public Void visitBoolean(boolean b, Void p) { write(Boolean.toString(b)); return null; } + @Override public Void visitByte(byte b, Void p) { write(Byte.toString(b)); return null; } + @Override public Void visitChar(char c, Void p) { write(Character.toString(c)); return null; } + @Override public Void visitDouble(double d, Void p) { write(Double.toString(d)); return null; } + @Override public Void visitFloat(float f, Void p) { write(Float.toString(f)); return null; } + @Override public Void visitInt(int i, Void p) { write(Integer.toString(i)); return null; } + @Override public Void visitLong(long i, Void p) { write(Long.toString(i)); return null; } + @Override public Void visitShort(short s, Void p) { write(Short.toString(s)); return null; } + @Override public Void visitString(String s, Void p) { write("\""); @@ -369,12 +378,14 @@ write("\""); return null; } + @Override public Void visitType(TypeMirror t, Void p) { write(typeSimpleName(t)); write(".class"); return null; } + @Override public Void visitEnumConstant(VariableElement c, Void p) { write(typeSimpleName(c.asType())); @@ -382,13 +393,15 @@ write(c.getSimpleName().toString()); return null; } + @Override public Void visitAnnotation(AnnotationMirror a, Void p) { AbstractCodeWriter.this.visitAnnotation(a); return null; } + @Override - public Void visitArray(List< ? extends AnnotationValue> vals, Void p) { + public Void visitArray(List vals, Void p) { write("{"); for (int i = 0; i < vals.size(); i++) { AnnotationValue value = vals.get(i); @@ -421,15 +434,15 @@ } } -// @Override -// public void visitParameter(CodeVariableElement e) { -// for (CodeAnnotationMirror annotation : e.getAnnotationMirrors()) { -// annotation.accept(this); -// } -// write(typeSimpleName(e.getType())); -// write(" "); -// write(e.getSimpleName()); -// } + // @Override + // public void visitParameter(CodeVariableElement e) { + // for (CodeAnnotationMirror annotation : e.getAnnotationMirrors()) { + // annotation.accept(this); + // } + // write(typeSimpleName(e.getType())); + // write(" "); + // write(e.getSimpleName()); + // } @Override public Void visitExecutable(CodeExecutableElement e, Void p) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/FixWarningsVisitor.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/FixWarningsVisitor.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/FixWarningsVisitor.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,9 +34,7 @@ import com.oracle.truffle.codegen.processor.*; import com.oracle.truffle.codegen.processor.ast.*; - -public class FixWarningsVisitor extends CodeElementScanner{ - +public class FixWarningsVisitor extends CodeElementScanner { private final Set symbolsUsed = new HashSet<>(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/OrganizedImports.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/OrganizedImports.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/OrganizedImports.java Wed Jan 23 16:34:57 2013 +0100 @@ -143,7 +143,8 @@ private static boolean processStaticImportElements(Set newElements, Set ambiguousElements, Set declaredElements) { boolean allAmbiguous = false; if (declaredElements.containsAll(newElements)) { - // all types already declared -> we can remove the import completely -> they will all get ambiguous + // all types already declared -> we can remove the import completely -> they will all + // get ambiguous allAmbiguous = true; } Set newAmbiguous = new HashSet<>(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/AbstractCompiler.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/AbstractCompiler.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/AbstractCompiler.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,17 +24,15 @@ import java.lang.reflect.*; - public abstract class AbstractCompiler implements Compiler { - protected static Object method(Object o, String methodName) throws Exception { Method method = o.getClass().getMethod(methodName); method.setAccessible(true); return method.invoke(o); } - protected static Object method(Object o, String methodName, Class[] paramTypes, Object ... values) throws Exception { + protected static Object method(Object o, String methodName, Class[] paramTypes, Object... values) throws Exception { Method method = o.getClass().getMethod(methodName, paramTypes); method.setAccessible(true); return method.invoke(o, values); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/Compiler.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/Compiler.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/Compiler.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,7 +25,6 @@ import javax.annotation.processing.*; import javax.lang.model.element.*; - public interface Compiler { String getMethodBody(ProcessingEnvironment env, ExecutableElement method); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/CompilerFactory.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/CompilerFactory.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/CompilerFactory.java Wed Jan 23 16:34:57 2013 +0100 @@ -45,6 +45,4 @@ } } - - } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/JDTCompiler.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/JDTCompiler.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/JDTCompiler.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,7 +31,7 @@ public static boolean isValidElement(Element currentElement) { try { - Class< ? > elementClass = Class.forName("org.eclipse.jdt.internal.compiler.apt.model.ElementImpl"); + Class elementClass = Class.forName("org.eclipse.jdt.internal.compiler.apt.model.ElementImpl"); return elementClass.isAssignableFrom(currentElement.getClass()); } catch (ClassNotFoundException e) { return false; @@ -48,8 +48,9 @@ } /* - * AbstractMethodDeclaration decl = ((MethodBinding)(((ElementImpl)method)._binding)).sourceMethod(); int - * bodyStart = decl.bodyStart; int bodyEnd = decl.bodyEnd; + * AbstractMethodDeclaration decl = + * ((MethodBinding)(((ElementImpl)method)._binding)).sourceMethod(); int bodyStart = + * decl.bodyStart; int bodyEnd = decl.bodyEnd; */ Object decl = method(field(method, "_binding"), "sourceMethod"); int bodyStart = (int) field(decl, "bodyStart"); @@ -67,17 +68,17 @@ private static char[] getSource(Element element) throws Exception { /* - * Binding binding = ((ElementImpl)element)._binding; char[] source = null; if (binding instanceof - * MethodBinding) { source = ((MethodBinding) - * binding).sourceMethod().compilationResult.getCompilationUnit().getContents(); } else if (binding instanceof - * SourceTypeBinding) { source = - * ((SourceTypeBinding)binding).scope.referenceContext.compilationResult.compilationUnit.getContents(); } return - * source; + * Binding binding = ((ElementImpl)element)._binding; char[] source = null; if (binding + * instanceof MethodBinding) { source = ((MethodBinding) + * binding).sourceMethod().compilationResult.getCompilationUnit().getContents(); } else if + * (binding instanceof SourceTypeBinding) { source = + * ((SourceTypeBinding)binding).scope.referenceContext + * .compilationResult.compilationUnit.getContents(); } return source; */ Object binding = field(element, "_binding"); - Class< ? > methodBindingClass = Class.forName("org.eclipse.jdt.internal.compiler.lookup.MethodBinding"); - Class< ? > referenceBindingClass = Class.forName("org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding"); + Class methodBindingClass = Class.forName("org.eclipse.jdt.internal.compiler.lookup.MethodBinding"); + Class referenceBindingClass = Class.forName("org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding"); char[] source = null; if (methodBindingClass.isAssignableFrom(binding.getClass())) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/JavaCCompiler.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/JavaCCompiler.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/JavaCCompiler.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,7 +27,6 @@ import com.oracle.truffle.codegen.processor.*; - public class JavaCCompiler extends AbstractCompiler { public static boolean isValidElement(Element currentElement) { @@ -46,15 +45,13 @@ public String getMethodBody(ProcessingEnvironment env, ExecutableElement method) { try { /* - if (false) { - Pair treeAndTopLevel = ((JavacElements) env.getElementUtils()).getTreeAndTopLevel(method, null, null); - JCBlock block = ((JCMethodDecl) treeAndTopLevel.fst).getBody(); - int startPos = block.pos; - int endPos = block.endpos; - String methodBody = treeAndTopLevel.snd.getSourceFile().getCharContent(true).subSequence(startPos + 1, endPos).toString(); - return methodBody; - } - */ + * if (false) { Pair treeAndTopLevel = ((JavacElements) + * env.getElementUtils()).getTreeAndTopLevel(method, null, null); JCBlock block = + * ((JCMethodDecl) treeAndTopLevel.fst).getBody(); int startPos = block.pos; int endPos + * = block.endpos; String methodBody = + * treeAndTopLevel.snd.getSourceFile().getCharContent(true).subSequence(startPos + 1, + * endPos).toString(); return methodBody; } + */ Object treeAndTopLevel = getTreeAndTopLevel(env, method); Object block = method(field(treeAndTopLevel, "fst"), "getBody"); @@ -75,7 +72,8 @@ private static Object getTreeAndTopLevel(ProcessingEnvironment env, Element element) throws Exception { /* - * Pair treeAndTopLevel = ((JavacElements) env.getElementUtils()).getTreeAndTopLevel(method, null, null); + * Pair treeAndTopLevel = ((JavacElements) + * env.getElementUtils()).getTreeAndTopLevel(method, null, null); */ return method(method(env, "getElementUtils"), "getTreeAndTopLevel", getTreeAndTopLevelSignature, element, null, null); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionCodeElementFactory.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionCodeElementFactory.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionCodeElementFactory.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,7 +29,6 @@ import com.oracle.truffle.codegen.processor.api.element.*; import com.oracle.truffle.codegen.processor.ast.*; - final class ExtensionCodeElementFactory implements WritableElementFactory { private final ProcessorContext context; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionContextImpl.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionContextImpl.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionContextImpl.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,7 +29,6 @@ import com.oracle.truffle.codegen.processor.api.*; import com.oracle.truffle.codegen.processor.api.element.*; - public class ExtensionContextImpl implements ExtensionContext { private final ProcessingEnvironment env; @@ -44,7 +43,6 @@ this.factory = factory; } - List returnElements() { List returnElements = new ArrayList<>(this.elements); this.elements.clear(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,7 +32,6 @@ import com.oracle.truffle.codegen.processor.api.*; import com.oracle.truffle.codegen.processor.api.element.*; - public class ExtensionParser { private final Map extensions = new HashMap<>(); @@ -115,5 +114,4 @@ return processor; } - } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ExecutableTypeData.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ExecutableTypeData.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ExecutableTypeData.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,7 +28,6 @@ import com.oracle.truffle.codegen.processor.template.*; import com.oracle.truffle.codegen.processor.typesystem.*; - public class ExecutableTypeData extends TemplateMethod { private final TypeSystemData typeSystem; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ExecutableTypeMethodParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ExecutableTypeMethodParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ExecutableTypeMethodParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -47,8 +47,7 @@ types.addAll(Arrays.asList(getNode().getTypeSystem().getPrimitiveTypeMirrors())); types.add(getContext().getType(void.class)); - ParameterSpec returnTypeSpec = new ParameterSpec("executedValue", types.toArray(new TypeMirror[types.size()]), - getNode().getTypeSystem().getGenericType(), false, Cardinality.ONE); + ParameterSpec returnTypeSpec = new ParameterSpec("executedValue", types.toArray(new TypeMirror[types.size()]), getNode().getTypeSystem().getGenericType(), false, Cardinality.ONE); List parameters = new ArrayList<>(); parameters.add(new ParameterSpec("frame", getContext().getTruffleTypes().getFrame(), true)); @@ -71,7 +70,7 @@ } @Override - public Class< ? extends Annotation> getAnnotationType() { + public Class getAnnotationType() { return null; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/GenericParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/GenericParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/GenericParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -57,7 +57,7 @@ } @Override - public Class< ? extends Annotation> getAnnotationType() { + public Class getAnnotationType() { return Generic.class; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/MethodParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/MethodParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/MethodParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -31,8 +31,7 @@ import com.oracle.truffle.codegen.processor.template.*; import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality; - -public abstract class MethodParser extends TemplateMethodParser{ +public abstract class MethodParser extends TemplateMethodParser { public MethodParser(ProcessorContext context, NodeData node) { super(context, node); @@ -42,7 +41,6 @@ return template; } - protected ParameterSpec createValueParameterSpec(String valueName, NodeData nodeData) { return new ParameterSpec(valueName, nodeData, false, Cardinality.ONE); } @@ -74,8 +72,7 @@ break; } - defaultParameters.add(new ParameterSpec(shortCircuitValueName(valueName), - getContext().getType(boolean.class), false)); + defaultParameters.add(new ParameterSpec(shortCircuitValueName(valueName), getContext().getType(boolean.class), false)); defaultParameters.add(createValueParameterSpec(valueName, field.getNodeData())); } else { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeCodeGenerator.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeCodeGenerator.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeCodeGenerator.java Wed Jan 23 16:34:57 2013 +0100 @@ -37,7 +37,6 @@ import com.oracle.truffle.codegen.processor.template.*; import com.oracle.truffle.codegen.processor.typesystem.*; - public class NodeCodeGenerator extends CompilationUnitFactory { private static final String THIS_NODE_LOCAL_VAR_NAME = "thisNode"; @@ -67,8 +66,7 @@ } } name += nodeClassName(specialization.getNode()); - if (name.equals(Utils.getSimpleName(specialization.getNode().getNodeType())) - || name.equals(Utils.getSimpleName(specialization.getNode().getTemplateType()))) { + if (name.equals(Utils.getSimpleName(specialization.getNode().getNodeType())) || name.equals(Utils.getSimpleName(specialization.getNode().getTemplateType()))) { name = name + "Impl"; } @@ -149,7 +147,7 @@ body.startCall(method.getMethodName()); } - private static void startCallTypeSystemMethod(ProcessorContext context, CodeTreeBuilder body, NodeData node, String methodName) { + private static void startCallTypeSystemMethod(ProcessorContext context, CodeTreeBuilder body, NodeData node, String methodName) { VariableElement singleton = TypeSystemCodeGenerator.findSingleton(context, node.getTypeSystem()); assert singleton != null; @@ -170,8 +168,7 @@ } body.string(andOperator); - startCallTypeSystemMethod(context, body, specialization.getNode(), - TypeSystemCodeGenerator.isTypeMethodName(type)); + startCallTypeSystemMethod(context, body, specialization.getNode(), TypeSystemCodeGenerator.isTypeMethodName(type)); body.string(valueName(specialization, param)); body.end().end(); // call andOperator = " && "; @@ -180,8 +177,7 @@ if (specialization.getGuards().length > 0) { // Explicitly specified guards for (SpecializationGuardData guard : specialization.getGuards()) { - if ((guard.isOnSpecialization() && onSpecialization) - || (guard.isOnExecution() && !onSpecialization)) { + if ((guard.isOnSpecialization() && onSpecialization) || (guard.isOnExecution() && !onSpecialization)) { body.string(andOperator); startCallOperationMethod(body, guard.getGuardDeclaration()); @@ -236,8 +232,7 @@ CodeExecutableElement superConstructor = createSuperConstructor(clazz, executable); if (superConstructor != null) { - if (superConstructor.getParameters().size() == 1 - && Utils.typeEquals(superConstructor.getParameters().get(0).asType(), node.getTemplateType().asType())) { + if (superConstructor.getParameters().size() == 1 && Utils.typeEquals(superConstructor.getParameters().get(0).asType(), node.getTemplateType().asType())) { String originalName = superConstructor.getParameters().get(0).getSimpleName().toString(); superConstructor.getParameters().clear(); superConstructor.getParameters().add(new CodeVariableElement(clazz.asType(), originalName)); @@ -328,8 +323,7 @@ } // skip node rewrite constructor - if (constructor.getParameters().size() == 1 - && typeEquals(constructor.getParameters().get(0).asType(), node.getNodeType())) { + if (constructor.getParameters().size() == 1 && typeEquals(constructor.getParameters().get(0).asType(), node.getNodeType())) { continue; } @@ -427,7 +421,6 @@ return method; } - private CodeExecutableElement createGeneratedGenericMethod(NodeData node) { CodeExecutableElement method = new CodeExecutableElement(modifiers(PRIVATE, STATIC), node.getGenericSpecialization().getReturnType().getActualType(), "generatedGeneric"); method.addParameter(new CodeVariableElement(node.getNodeType(), THIS_NODE_LOCAL_VAR_NAME)); @@ -482,7 +475,6 @@ private class SpecializedNodeFactory extends ClassElementFactory { - public SpecializedNodeFactory(ProcessorContext context) { super(context); } @@ -675,8 +667,7 @@ private void buildGenericValueExecute(CodeTreeBuilder builder, SpecializationData specialization, NodeFieldData field, NodeFieldData exceptionSpec) { ActualParameter specParameter = specialization.findParameter(field.getName()); - boolean shortCircuit = startShortCircuit(builder, specialization, - field, exceptionSpec); + boolean shortCircuit = startShortCircuit(builder, specialization, field, exceptionSpec); builder.startStatement(); if (!shortCircuit) { @@ -715,7 +706,6 @@ builder.end(); } - private void buildSpecializedValueExecute(CodeTreeBuilder builder, SpecializationData specialization, NodeFieldData field) { ActualParameter param = specialization.findParameter(field.getName()); boolean shortCircuit = startShortCircuit(builder, specialization, field, null); @@ -734,7 +724,6 @@ buildExecute(builder, field, execType); builder.end(); - if (execType.hasUnexpectedValue(getContext())) { builder.end().startCatchBlock(getUnexpectedValueException(), "ex"); boolean execute = false; @@ -756,9 +745,7 @@ builder.newLine(); } - - private boolean startShortCircuit(CodeTreeBuilder builder, SpecializationData specialization, - NodeFieldData forField, NodeFieldData exceptionField) { + private boolean startShortCircuit(CodeTreeBuilder builder, SpecializationData specialization, NodeFieldData forField, NodeFieldData exceptionField) { if (forField.getExecutionKind() != ExecutionKind.SHORT_CIRCUIT) { return false; } @@ -785,15 +772,13 @@ builder.end(); // statement - builder.declaration(parameter.getActualType(), valueName(specialization, parameter), - CodeTreeBuilder.createBuilder().defaultValue(parameter.getActualType())); + builder.declaration(parameter.getActualType(), valueName(specialization, parameter), CodeTreeBuilder.createBuilder().defaultValue(parameter.getActualType())); builder.startIf().string(shortCircuitParam.getSpecification().getName()).end(); builder.startBlock(); return true; } - private void endShortCircuit(CodeTreeBuilder builder, boolean shortCircuit) { if (shortCircuit) { builder.end(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeData.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeData.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeData.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,7 +33,6 @@ import com.oracle.truffle.codegen.processor.template.*; import com.oracle.truffle.codegen.processor.typesystem.*; - public class NodeData extends Template { private NodeData parent; @@ -109,7 +108,6 @@ return methods; } - public TemplateMethod[] getSpecializationListeners() { return specializationListeners; } @@ -239,8 +237,7 @@ public boolean needsRewrites(ProcessorContext context) { boolean needsRewrites = false; for (NodeFieldData field : getFields()) { - if (field.getExecutionKind() == ExecutionKind.DEFAULT - || field.getExecutionKind() == ExecutionKind.SHORT_CIRCUIT) { + if (field.getExecutionKind() == ExecutionKind.DEFAULT || field.getExecutionKind() == ExecutionKind.SHORT_CIRCUIT) { if (!field.getNodeData().hasUnexpectedExecutableTypes(context)) { continue; } @@ -329,6 +326,4 @@ return null; } - - } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeFieldData.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeFieldData.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeFieldData.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,7 +25,6 @@ import javax.lang.model.element.*; import javax.lang.model.type.*; - public class NodeFieldData { public enum FieldKind { @@ -44,8 +43,7 @@ private final ExecutionKind executionKind; private final NodeData nodeData; - public NodeFieldData(NodeData typeNodeData, VariableElement fieldElement, Element accessElement, AnnotationMirror childAnnotationMirror, - FieldKind fieldKind, ExecutionKind executionKind) { + public NodeFieldData(NodeData typeNodeData, VariableElement fieldElement, Element accessElement, AnnotationMirror childAnnotationMirror, FieldKind fieldKind, ExecutionKind executionKind) { this.fieldElement = fieldElement; this.accessElement = accessElement; this.childAnnotationMirror = childAnnotationMirror; @@ -86,7 +84,6 @@ return fieldElement.getSimpleName().toString(); } - @Override public String toString() { return "NodeFieldData[name=" + getName() + ", kind=" + fieldKind + ", execution=" + executionKind + "]"; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -39,10 +39,9 @@ import com.oracle.truffle.codegen.processor.template.*; import com.oracle.truffle.codegen.processor.typesystem.*; -public class NodeParser extends TemplateParser{ +public class NodeParser extends TemplateParser { - public static final List> ANNOTATIONS = Arrays.asList( - Generic.class, GuardCheck.class, TypeSystemReference.class, ShortCircuit.class, Specialization.class, + public static final List> ANNOTATIONS = Arrays.asList(Generic.class, GuardCheck.class, TypeSystemReference.class, ShortCircuit.class, Specialization.class, SpecializationGuard.class, SpecializationListener.class, SpecializationThrows.class); private static final boolean DEBUG = false; @@ -149,7 +148,8 @@ nodeData.setExecutableTypes(executableTypes.toArray(new ExecutableTypeData[executableTypes.size()])); - parsedNodes.put(Utils.getQualifiedName(type), nodeData); // node fields will resolve node types, to avoid endless loops + parsedNodes.put(Utils.getQualifiedName(type), nodeData); // node fields will resolve node + // types, to avoid endless loops NodeFieldData[] fields = parseFields(nodeData, elements, typeHierarchy); if (fields == null) { @@ -157,7 +157,6 @@ } nodeData.setFields(fields); - List genericSpecializations = new GenericParser(context, nodeData).parse(elements); List guards = new GuardParser(context, nodeData, nodeData.getTypeSystem()).parse(elements); nodeData.setGuards(guards.toArray(new GuardData[guards.size()])); @@ -167,7 +166,7 @@ List shortCircuits = new ShortCircuitParser(context, nodeData).parse(elements); List listeners = new SpecializationListenerParser(context, nodeData).parse(elements); - if (specializations == null || genericSpecializations == null || shortCircuits == null || listeners == null || guards == null) { + if (specializations == null || genericSpecializations == null || shortCircuits == null || listeners == null || guards == null) { return null; } @@ -187,6 +186,7 @@ } Collections.sort(specializations, new Comparator() { + @Override public int compare(SpecializationData o1, SpecializationData o2) { return compareSpecialization(typeSystem, o1, o2); @@ -197,8 +197,8 @@ if (genericSpecialization != null) { allSpecializations.add(genericSpecialization); CodeExecutableElement uninitializedMethod = new CodeExecutableElement(Utils.modifiers(Modifier.PUBLIC), context.getType(void.class), "doUninitialized"); - TemplateMethod uninializedMethod = new TemplateMethod(nodeData, genericSpecialization.getSpecification(), uninitializedMethod, - genericSpecialization.getMarkerAnnotation(), genericSpecialization.getReturnType(), genericSpecialization.getParameters()); + TemplateMethod uninializedMethod = new TemplateMethod(nodeData, genericSpecialization.getSpecification(), uninitializedMethod, genericSpecialization.getMarkerAnnotation(), + genericSpecialization.getReturnType(), genericSpecialization.getParameters()); allSpecializations.add(0, new SpecializationData(uninializedMethod, false, true)); } @@ -263,7 +263,8 @@ boolean valid = true; for (ExecutableElement unusedMethod : ElementFilter.methodsIn(unusedElements)) { if (unusedMethod.getModifiers().contains(Modifier.ABSTRACT)) { - context.getLog().error(nodeData.getTemplateType(), "The type %s must implement the inherited abstract method %s.", Utils.getSimpleName(nodeData.getTemplateType()), Utils.getReadableSignature(unusedMethod)); + context.getLog().error(nodeData.getTemplateType(), "The type %s must implement the inherited abstract method %s.", Utils.getSimpleName(nodeData.getTemplateType()), + Utils.getReadableSignature(unusedMethod)); valid = false; } } @@ -373,13 +374,13 @@ } } - //TODO parse getters + // TODO parse getters if (!valid) { return null; } - NodeFieldData[] fieldArray = fields.toArray(new NodeFieldData[fields.size()]); - sortByExecutionOrder(fieldArray, executionDefinition == null ? Collections.emptyList() : executionDefinition, typeHierarchy); + NodeFieldData[] fieldArray = fields.toArray(new NodeFieldData[fields.size()]); + sortByExecutionOrder(fieldArray, executionDefinition == null ? Collections. emptyList() : executionDefinition, typeHierarchy); return fieldArray; } @@ -420,7 +421,7 @@ Element errorElement = Utils.typeEquals(parentNodeData.getTemplateType().asType(), var.getEnclosingElement().asType()) ? var : parentNodeData.getTemplateType(); if (fieldNodeData == null) { - //TODO redirect errors from resolve. + // TODO redirect errors from resolve. context.getLog().error(errorElement, "Node type '%s' is invalid.", Utils.getQualifiedName(nodeType)); return null; } else if (fieldNodeData.findGenericExecutableType(context) == null) { @@ -429,7 +430,7 @@ } } - //TODO correct handling of access elements + // TODO correct handling of access elements if (var.getModifiers().contains(Modifier.PRIVATE) && Utils.typeEquals(var.getEnclosingElement().asType(), parentNodeData.getTemplateType().asType())) { execution = ExecutionKind.IGNORE; } @@ -452,9 +453,7 @@ ExecutableElement getter = null; for (ExecutableElement method : ElementFilter.methodsIn(enclosed.getEnclosedElements())) { - if (method.getSimpleName().toString().equals(methodName) - && method.getParameters().size() == 0 - && !Utils.typeEquals(method.getReturnType(), context.getType(void.class))) { + if (method.getSimpleName().toString().equals(methodName) && method.getParameters().size() == 0 && !Utils.typeEquals(method.getReturnType(), context.getType(void.class))) { getter = method; break; } @@ -469,6 +468,7 @@ private static void sortByExecutionOrder(NodeFieldData[] fields, final List executionOrder, final List typeHierarchy) { Arrays.sort(fields, new Comparator() { + @Override public int compare(NodeFieldData o1, NodeFieldData o2) { // sort by execution order @@ -489,9 +489,7 @@ }); } - private boolean assignShortCircuitsToSpecializations(NodeData nodeData, - List specializations, - List shortCircuits) { + private boolean assignShortCircuitsToSpecializations(NodeData nodeData, List specializations, List shortCircuits) { Map> groupedShortCircuits = groupShortCircuits(shortCircuits); @@ -502,14 +500,11 @@ List availableCircuits = groupedShortCircuits.get(valueName); if (availableCircuits == null || availableCircuits.isEmpty()) { - log.error(nodeData.getTemplateType(), - "@%s method for short cut value '%s' required.", - ShortCircuit.class.getSimpleName(), valueName); + log.error(nodeData.getTemplateType(), "@%s method for short cut value '%s' required.", ShortCircuit.class.getSimpleName(), valueName); valid = false; continue; } - boolean sameMethodName = true; String methodName = availableCircuits.get(0).getMethodName(); for (ShortCircuitData circuit : availableCircuits) { @@ -535,8 +530,7 @@ } if (genericCircuit == null) { - log.error(nodeData.getTemplateType(), - "No generic @%s method available for short cut value '%s'.", ShortCircuit.class.getSimpleName(), valueName); + log.error(nodeData.getTemplateType(), "No generic @%s method available for short cut value '%s'.", ShortCircuit.class.getSimpleName(), valueName); valid = false; continue; } @@ -606,7 +600,6 @@ return valid; } - private static boolean isGenericShortCutMethod(NodeData node, TemplateMethod method) { for (NodeFieldData field : node.getFields()) { ActualParameter parameter = method.findParameter(field.getName()); @@ -633,7 +626,6 @@ return group; } - private TypeMirror getComponentType(TypeMirror type) { if (type instanceof ArrayType) { return getComponentType(((ArrayType) type).getComponentType()); @@ -652,7 +644,6 @@ return collection; } - private boolean verifySpecializationOrder(TypeSystemData typeSystem, List specializations) { for (int i = 0; i < specializations.size(); i++) { SpecializationData m1 = specializations.get(i); @@ -681,7 +672,6 @@ return true; } - private boolean verifySpecializationThrows(TypeSystemData typeSystem, List specializations) { Map specializationMap = new HashMap<>(); for (SpecializationData spec : specializations) { @@ -695,8 +685,7 @@ AnnotationValue value = Utils.getAnnotationValue(throwsData.getAnnotationMirror(), "transitionTo"); if (targetSpecialization == null) { - log.error(throwsData.getSpecialization().getMethod(), throwsData.getAnnotationMirror(), value, - "Specialization with name '%s' not found.", throwsData.getTransitionToName()); + log.error(throwsData.getSpecialization().getMethod(), throwsData.getAnnotationMirror(), value, "Specialization with name '%s' not found.", throwsData.getTransitionToName()); valid = false; } else if (compareSpecialization(typeSystem, sourceSpecialization, targetSpecialization) >= 0) { log.error(throwsData.getSpecialization().getMethod(), throwsData.getAnnotationMirror(), value, @@ -705,11 +694,9 @@ } for (SpecializationThrowsData otherThrowsData : sourceSpecialization.getExceptions()) { - if (otherThrowsData != throwsData - && Utils.typeEquals(otherThrowsData.getJavaClass(), throwsData.getJavaClass())) { + if (otherThrowsData != throwsData && Utils.typeEquals(otherThrowsData.getJavaClass(), throwsData.getJavaClass())) { AnnotationValue javaClassValue = Utils.getAnnotationValue(throwsData.getAnnotationMirror(), "javaClass"); - log.error(throwsData.getSpecialization().getMethod(), throwsData.getAnnotationMirror(), javaClassValue, - "Duplicate exception type.", throwsData.getTransitionToName()); + log.error(throwsData.getSpecialization().getMethod(), throwsData.getAnnotationMirror(), javaClassValue, "Duplicate exception type.", throwsData.getTransitionToName()); valid = false; } } @@ -719,7 +706,6 @@ return valid; } - private static int compareSpecialization(TypeSystemData typeSystem, SpecializationData m1, SpecializationData m2) { if (m1 == m2) { return 0; @@ -767,14 +753,13 @@ return index1 - index2; } - @Override - public Class< ? extends Annotation> getAnnotationType() { + public Class getAnnotationType() { return null; } @Override - public List> getTypeDelegatedAnnotationTypes() { + public List> getTypeDelegatedAnnotationTypes() { return ANNOTATIONS; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ShortCircuitData.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ShortCircuitData.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ShortCircuitData.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,7 +25,6 @@ import com.oracle.truffle.codegen.processor.*; import com.oracle.truffle.codegen.processor.template.*; - public class ShortCircuitData extends TemplateMethod { private ShortCircuitData genericShortCircuitMethod; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ShortCircuitParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ShortCircuitParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ShortCircuitParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,7 +32,6 @@ import com.oracle.truffle.codegen.processor.node.NodeFieldData.ExecutionKind; import com.oracle.truffle.codegen.processor.template.*; - public class ShortCircuitParser extends MethodParser { private final Set shortCircuitValues; @@ -73,7 +72,7 @@ } @Override - public Class< ? extends Annotation> getAnnotationType() { + public Class getAnnotationType() { return ShortCircuit.class; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationListenerParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationListenerParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationListenerParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,7 +30,6 @@ import com.oracle.truffle.codegen.processor.*; import com.oracle.truffle.codegen.processor.template.*; - public class SpecializationListenerParser extends MethodParser { private final MethodSpec specification; @@ -56,7 +55,7 @@ } @Override - public Class< ? extends Annotation> getAnnotationType() { + public Class getAnnotationType() { return SpecializationListener.class; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationMethodParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationMethodParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationMethodParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -33,7 +33,6 @@ import com.oracle.truffle.codegen.processor.template.*; import com.oracle.truffle.codegen.processor.typesystem.*; - public class SpecializationMethodParser extends MethodParser { private final MethodSpec specification; @@ -58,7 +57,7 @@ } @Override - public Class< ? extends Annotation> getAnnotationType() { + public Class getAnnotationType() { return Specialization.class; } @@ -84,6 +83,7 @@ } Arrays.sort(exceptionData, new Comparator() { + @Override public int compare(SpecializationThrowsData o1, SpecializationThrowsData o2) { return Utils.compareByTypeHierarchy(o1.getJavaClass(), o2.getJavaClass()); @@ -125,7 +125,7 @@ return specialization; } - private GuardData matchSpecializationGuard(AnnotationMirror mirror, SpecializationData specialization, SpecializationGuardData specializationGuard) { + private GuardData matchSpecializationGuard(AnnotationMirror mirror, SpecializationData specialization, SpecializationGuardData specializationGuard) { List foundGuards = getNode().findGuards(specializationGuard.getGuardMethod()); GuardData compatibleGuard = null; @@ -170,5 +170,4 @@ return true; } - } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationThrowsData.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationThrowsData.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationThrowsData.java Wed Jan 23 16:34:57 2013 +0100 @@ -38,7 +38,6 @@ this.transitionTo = transitionTo; } - void setSpecialization(SpecializationData specialization) { this.specialization = specialization; } @@ -68,4 +67,3 @@ return null; } } - diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ClassElementFactory.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ClassElementFactory.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ClassElementFactory.java Wed Jan 23 16:34:57 2013 +0100 @@ -44,7 +44,6 @@ @Override protected abstract CodeTypeElement create(M m); - @Override public CodeTypeElement getElement() { return (CodeTypeElement) super.getElement(); @@ -87,7 +86,6 @@ return method; } - private static ExecutableElement findConstructor(TypeElement clazz) { List constructors = ElementFilter.constructorsIn(clazz.getEnclosedElements()); if (constructors.isEmpty()) { @@ -117,7 +115,6 @@ return executable; } - protected CodeTypeElement createClass(Template model, Set modifiers, String simpleName, TypeMirror superType, boolean enumType) { TypeElement templateType = model.getTemplateType(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/CodeElementFactory.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/CodeElementFactory.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/CodeElementFactory.java Wed Jan 23 16:34:57 2013 +0100 @@ -41,7 +41,8 @@ protected abstract CodeElement create(M m); @SuppressWarnings("unused") - protected void createChildren(M m) { } + protected void createChildren(M m) { + } @SuppressWarnings("unchecked") public CodeElement process(CodeElement parent, M m) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/JavaName.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/JavaName.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/JavaName.java Wed Jan 23 16:34:57 2013 +0100 @@ -25,13 +25,12 @@ import java.util.*; import java.util.regex.*; - public final class JavaName { private static final String[] RESERVED_NAMES = new String[]{"abstract", "continue", "for", "new", "switch", "assert", "default", "goto", "package", "synchronized", "boolean", "do", "if", - "private", "this", "break", "double", "implements", "protected", "throw", "byte", "else", "import", "public", "throws", "case", "enum", "instanceof", "return", "transient", - "catch", "extends", "int", "short", "try", "char", "final", "interface", "static", "void", "class", "finally", "long", "strictfp", "volatile", "const", "float", "native", "super", - "while"}; + "private", "this", "break", "double", "implements", "protected", "throw", "byte", "else", "import", "public", "throws", "case", "enum", "instanceof", "return", "transient", + "catch", "extends", "int", "short", "try", "char", "final", "interface", "static", "void", "class", "finally", "long", "strictfp", "volatile", "const", "float", "native", "super", + "while"}; private static final Set RESERVED_NAMES_SET = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(RESERVED_NAMES))); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ParameterSpec.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ParameterSpec.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ParameterSpec.java Wed Jan 23 16:34:57 2013 +0100 @@ -51,7 +51,7 @@ } /** Type constructor. */ - public ParameterSpec(String name, TypeMirror singleFixedType, boolean optional) { + public ParameterSpec(String name, TypeMirror singleFixedType, boolean optional) { this(name, new TypeMirror[]{singleFixedType}, singleFixedType, optional, Cardinality.ONE); } @@ -77,7 +77,6 @@ return typeMirrors.toArray(new TypeMirror[typeMirrors.size()]); } - public final String getName() { return name; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/Template.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/Template.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/Template.java Wed Jan 23 16:34:57 2013 +0100 @@ -49,11 +49,11 @@ return annotation; } - public List< ? extends WritableElement> getExtensionElements() { + public List getExtensionElements() { return extensionElements; } - public void setExtensionElements(List< ? extends WritableElement> extensionMethods) { + public void setExtensionElements(List extensionMethods) { this.extensionElements = extensionMethods; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateMethodParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateMethodParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateMethodParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -138,8 +138,8 @@ return null; } - Iterator< ? extends VariableElement> variableIterator = method.getParameters().iterator(); - Iterator< ? extends ParameterSpec> specificationIterator = parameterSpecs.iterator(); + Iterator variableIterator = method.getParameters().iterator(); + Iterator specificationIterator = parameterSpecs.iterator(); List resolvedMirrors = new ArrayList<>(); VariableElement parameter = null; @@ -231,7 +231,7 @@ return new ActualParameter(specification, resolvedType); } - public static String createExpectedSignature(String methodName, ParameterSpec returnType, List< ? extends ParameterSpec> parameters) { + public static String createExpectedSignature(String methodName, ParameterSpec returnType, List parameters) { StringBuilder b = new StringBuilder(); b.append(" "); @@ -270,7 +270,7 @@ TypeMirror[] types = null; - //TODO allowed types may differ so different must be generated. + // TODO allowed types may differ so different must be generated. if (returnType.getAllowedTypes().length > 1) { types = returnType.getAllowedTypes(); } @@ -308,5 +308,4 @@ return builder.toString(); } - } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -43,7 +43,7 @@ return extensionParser; } - protected boolean verifyExclusiveMethodAnnotation(TypeElement type, Class ... annotationTypes) { + protected boolean verifyExclusiveMethodAnnotation(TypeElement type, Class... annotationTypes) { boolean valid = true; List methods = ElementFilter.methodsIn(type.getEnclosedElements()); for (ExecutableElement method : methods) { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/GuardData.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/GuardData.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/GuardData.java Wed Jan 23 16:34:57 2013 +0100 @@ -24,7 +24,6 @@ import com.oracle.truffle.codegen.processor.template.*; - public class GuardData extends TemplateMethod { private final Template origin; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/GuardParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/GuardParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/GuardParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,7 +32,6 @@ import com.oracle.truffle.codegen.processor.template.*; import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality; - public class GuardParser extends TemplateMethodParser { private final TypeSystemData typeSystem; @@ -62,7 +61,7 @@ } @Override - public Class< ? extends Annotation> getAnnotationType() { + public Class getAnnotationType() { return GuardCheck.class; } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeCastParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeCastParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeCastParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -32,7 +32,6 @@ import com.oracle.truffle.codegen.processor.template.*; import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality; - class TypeCastParser extends TypeSystemMethodParser { public TypeCastParser(ProcessorContext context, TypeSystemData typeSystem) { @@ -60,7 +59,7 @@ } @Override - public Class< ? extends Annotation> getAnnotationType() { + public Class getAnnotationType() { return TypeCast.class; } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeCheckParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeCheckParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeCheckParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -61,7 +61,7 @@ } @Override - public Class< ? extends Annotation> getAnnotationType() { + public Class getAnnotationType() { return TypeCheck.class; } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeData.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeData.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeData.java Wed Jan 23 16:34:57 2013 +0100 @@ -39,8 +39,7 @@ private final List typeCasts = new ArrayList<>(); private final List typeChecks = new ArrayList<>(); - public TypeData(TypeElement templateType, AnnotationMirror annotation, - TypeMirror primitiveType, TypeMirror boxedType) { + public TypeData(TypeElement templateType, AnnotationMirror annotation, TypeMirror primitiveType, TypeMirror boxedType) { super(templateType, annotation); this.primitiveType = primitiveType; this.boxedType = boxedType; @@ -91,4 +90,3 @@ } } - diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemCodeGenerator.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemCodeGenerator.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemCodeGenerator.java Wed Jan 23 16:34:57 2013 +0100 @@ -53,8 +53,8 @@ } /** - * Finds the generated singleton field for a TypeSytemData instance. TypeSystemCodeGenerator must be applied to the - * TypeSystemData model before use. + * Finds the generated singleton field for a TypeSytemData instance. TypeSystemCodeGenerator + * must be applied to the TypeSystemData model before use. */ public static VariableElement findSingleton(ProcessorContext context, TypeSystemData typeSystem) { TypeMirror type = context.findGeneratedClassBySimpleName(TypeClassFactory.typeName(typeSystem), typeSystem); @@ -125,7 +125,6 @@ return new ArrayList<>(sourceTypes); } - private CodeExecutableElement createConvertTo(TypeSystemData typeSystem, CodeVariableElement singleton) { CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), getContext().getType(Object.class), "convertTo"); method.addParameter(new CodeVariableElement(getContext().getType(Class.class), "targetType")); @@ -198,8 +197,7 @@ return null; } - CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), getContext().getType(boolean.class), - TypeSystemCodeGenerator.isTypeMethodName(type)); + CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), getContext().getType(boolean.class), TypeSystemCodeGenerator.isTypeMethodName(type)); method.addParameter(new CodeVariableElement(getContext().getType(Object.class), LOCAL_VALUE)); CodeTreeBuilder body = method.createBuilder(); @@ -213,8 +211,7 @@ return null; } - CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), type.getPrimitiveType(), - TypeSystemCodeGenerator.asTypeMethodName(type)); + CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), type.getPrimitiveType(), TypeSystemCodeGenerator.asTypeMethodName(type)); method.addParameter(new CodeVariableElement(getContext().getType(Object.class), LOCAL_VALUE)); CodeTreeBuilder body = method.createBuilder(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemData.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemData.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemData.java Wed Jan 23 16:34:57 2013 +0100 @@ -40,9 +40,7 @@ private final TypeData voidType; - - public TypeSystemData(TypeElement templateType, AnnotationMirror annotation, - TypeData[] types, TypeMirror genericType, TypeData voidType) { + public TypeSystemData(TypeElement templateType, AnnotationMirror annotation, TypeData[] types, TypeMirror genericType, TypeData voidType) { super(templateType, annotation); this.types = types; this.genericType = genericType; @@ -60,7 +58,7 @@ for (TypeData type : types) { type.typeSystem = this; } - if (voidType != null) { + if (voidType != null) { voidType.typeSystem = this; } } @@ -103,6 +101,7 @@ } return null; } + public TypeData findTypeData(TypeMirror type) { if (Utils.typeEquals(voidType.getPrimitiveType(), type)) { return voidType; @@ -115,7 +114,6 @@ return types[index]; } - public int findType(TypeMirror type) { for (int i = 0; i < types.length; i++) { if (Utils.typeEquals(types[i].getPrimitiveType(), type)) { @@ -125,11 +123,9 @@ return -1; } - @Override public String toString() { return getClass().getSimpleName() + "[template = " + Utils.getSimpleName(getTemplateType()) + ", types = " + Arrays.toString(types) + "]"; } - } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemMethodParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemMethodParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemMethodParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,7 +28,6 @@ import com.oracle.truffle.codegen.processor.*; import com.oracle.truffle.codegen.processor.template.*; - abstract class TypeSystemMethodParser extends TemplateMethodParser { public TypeSystemMethodParser(ProcessorContext context, TypeSystemData typeSystem) { @@ -48,8 +47,7 @@ String methodName = method.getSimpleName().toString(); if (!methodName.startsWith(prefix)) { String annotationName = Utils.getSimpleName(annotationMirror.getAnnotationType()); - getContext().getLog().error(method, "Methods annotated with %s must match the pattern '%s'.", - annotationName, String.format("%s${typeName}", prefix)); + getContext().getLog().error(method, "Methods annotated with %s must match the pattern '%s'.", annotationName, String.format("%s${typeName}", prefix)); return null; } String typeName = methodName.substring(prefix.length(), methodName.length()); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemParser.java --- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemParser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemParser.java Wed Jan 23 16:34:57 2013 +0100 @@ -44,7 +44,7 @@ } @Override - public Class< ? extends Annotation> getAnnotationType() { + public Class getAnnotationType() { return TypeSystem.class; } @@ -119,11 +119,9 @@ } } if (!hasGeneric) { - log.error(type.getTypeSystem().getTemplateType(), - "No generic but specific @%s method %s for type %s specified. " + - "Specify a generic @%s method with parameter type %s to resolve this.", - TypeCheck.class.getSimpleName(), TypeSystemCodeGenerator.isTypeMethodName(type), Utils.getSimpleName(type.getBoxedType()), - TypeCheck.class.getSimpleName(), Object.class.getSimpleName()); + log.error(type.getTypeSystem().getTemplateType(), "No generic but specific @%s method %s for type %s specified. " + + "Specify a generic @%s method with parameter type %s to resolve this.", TypeCheck.class.getSimpleName(), TypeSystemCodeGenerator.isTypeMethodName(type), + Utils.getSimpleName(type.getBoxedType()), TypeCheck.class.getSimpleName(), Object.class.getSimpleName()); valid = false; } } @@ -136,11 +134,9 @@ } } if (!hasGeneric) { - log.error(type.getTypeSystem().getTemplateType(), - "No generic but specific @%s method %s for type %s specified. " + - "Specify a generic @%s method with parameter type %s to resolve this.", - TypeCast.class.getSimpleName(), TypeSystemCodeGenerator.asTypeMethodName(type), Utils.getSimpleName(type.getBoxedType()), - TypeCast.class.getSimpleName(), Object.class.getSimpleName()); + log.error(type.getTypeSystem().getTemplateType(), "No generic but specific @%s method %s for type %s specified. " + + "Specify a generic @%s method with parameter type %s to resolve this.", TypeCast.class.getSimpleName(), TypeSystemCodeGenerator.asTypeMethodName(type), + Utils.getSimpleName(type.getBoxedType()), TypeCast.class.getSimpleName(), Object.class.getSimpleName()); valid = false; } } @@ -148,7 +144,6 @@ return valid; } - private TypeData[] parseTypes(TypeElement templateType, AnnotationMirror templateTypeAnnotation) { List typeMirrors = Utils.getAnnotationValueList(templateTypeAnnotation, "value"); if (typeMirrors.size() == 0) { @@ -163,8 +158,7 @@ for (TypeMirror primitiveType : typeMirrors) { if (isPrimitiveWrapper(primitiveType)) { - log.error(templateType, templateTypeAnnotation, annotationValue, - "Types must not contain primitive wrapper types."); + log.error(templateType, templateTypeAnnotation, annotationValue, "Types must not contain primitive wrapper types."); continue; } @@ -174,8 +168,7 @@ } if (Utils.typeEquals(boxedType, objectType)) { - log.error(templateType, templateTypeAnnotation, annotationValue, - "Types must not contain the generic type java.lang.Object."); + log.error(templateType, templateTypeAnnotation, annotationValue, "Types must not contain the generic type java.lang.Object."); continue; } @@ -196,8 +189,7 @@ TypeData typeData = types.get(i); TypeMirror type = typeData.getBoxedType(); if (invalidTypes.containsKey(Utils.getQualifiedName(type))) { - log.error(templateType, templateTypeAnnotation, annotationValue, - "Invalid type order. The type(s) %s are inherited from a earlier defined type %s.", + log.error(templateType, templateTypeAnnotation, annotationValue, "Invalid type order. The type(s) %s are inherited from a earlier defined type %s.", invalidTypes.get(Utils.getQualifiedName(type)), Utils.getQualifiedName(type)); } List nextInvalidTypes = Utils.getQualifiedSuperTypeNames(Utils.fromTypeMirror(type)); @@ -227,7 +219,6 @@ return false; } - private boolean verifyMethodSignatures(Element element, TypeData[] types) { Set generatedIsMethodNames = new HashSet<>(); Set generatedAsMethodNames = new HashSet<>(); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/AbstractTest.java --- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/AbstractTest.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/AbstractTest.java Wed Jan 23 16:34:57 2013 +0100 @@ -29,6 +29,7 @@ import com.oracle.truffle.sl.*; public class AbstractTest { + public static final int REPEATS = 10; private static final String NEWLINE = System.getProperty("line.separator"); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/NodeFactory.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/NodeFactory.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/NodeFactory.java Wed Jan 23 16:34:57 2013 +0100 @@ -75,7 +75,7 @@ } nodes[expressions.size()] = new PrintLineNode(printOutput); return new BlockNode(nodes); - } else { + } else { return new BlockNode(new StatementNode[]{new PrintLineNode(printOutput)}); } } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLTypes.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLTypes.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLTypes.java Wed Jan 23 16:34:57 2013 +0100 @@ -66,8 +66,8 @@ } @TypeCheck - public boolean isBigInteger(@SuppressWarnings("unused") int value) { + public boolean isBigInteger(@SuppressWarnings("unused") + int value) { return true; } } - diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ArithmeticNode.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ArithmeticNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ArithmeticNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -43,9 +43,11 @@ } public abstract static class AddNode extends ArithmeticNode { + public AddNode(TypedNode left, TypedNode right) { super(left, right); } + protected AddNode(AddNode node) { super(node); } @@ -74,9 +76,11 @@ } public abstract static class SubNode extends ArithmeticNode { + public SubNode(TypedNode left, TypedNode right) { super(left, right); } + protected SubNode(SubNode node) { super(node); } @@ -94,9 +98,11 @@ } public abstract static class DivNode extends ArithmeticNode { + public DivNode(TypedNode left, TypedNode right) { super(left, right); } + protected DivNode(DivNode node) { super(node); } @@ -118,6 +124,7 @@ public MulNode(TypedNode left, TypedNode right) { super(left, right); } + protected MulNode(MulNode node) { super(node); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/BinaryNode.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/BinaryNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/BinaryNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,11 +27,9 @@ @ExecuteChildren({"leftNode", "rightNode"}) public abstract class BinaryNode extends TypedNode { - @Child - protected TypedNode leftNode; + @Child protected TypedNode leftNode; - @Child - protected TypedNode rightNode; + @Child protected TypedNode rightNode; public BinaryNode(TypedNode left, TypedNode right) { this.leftNode = adoptChild(left); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/BlockNode.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/BlockNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/BlockNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,8 +26,7 @@ public class BlockNode extends StatementNode { - @Children - private final StatementNode[] statements; + @Children private final StatementNode[] statements; public BlockNode(StatementNode[] statements) { this.statements = adoptChildren(statements); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ConditionalNode.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ConditionalNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ConditionalNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -30,14 +30,11 @@ @ExecuteChildren({"conditionNode", "ifPartNode", "elsePartNode"}) public abstract class ConditionalNode extends TypedNode { - @Child - protected ConditionNode conditionNode; + @Child protected ConditionNode conditionNode; - @Child - protected TypedNode ifPartNode; + @Child protected TypedNode ifPartNode; - @Child - protected TypedNode elsePartNode; + @Child protected TypedNode elsePartNode; public ConditionalNode(ConditionNode condition, TypedNode ifPart, TypedNode elsePart) { this.conditionNode = adoptChild(condition); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/FrameSlotNode.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/FrameSlotNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/FrameSlotNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -34,11 +34,11 @@ } @Override - public void typeChanged(FrameSlot changedSlot, Class< ? > oldType) { + public void typeChanged(FrameSlot changedSlot, Class oldType) { if (getParent() != null) { replace(specialize(changedSlot.getType())); } } - protected abstract FrameSlotNode specialize(Class< ? > clazz); + protected abstract FrameSlotNode specialize(Class clazz); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/FunctionDefinitionNode.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/FunctionDefinitionNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/FunctionDefinitionNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -27,11 +27,9 @@ public class FunctionDefinitionNode extends RootNode { - @Child - private StatementNode body; + @Child private StatementNode body; - @Child - private TypedNode returnValue; + @Child private TypedNode returnValue; private final FrameDescriptor frameDescriptor; private final String name; @@ -43,7 +41,6 @@ this.returnValue = adoptChild(returnValue); } - @Override public Object execute(VirtualFrame frame) { try { diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/IfNode.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/IfNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/IfNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,14 +28,11 @@ @ExecuteChildren("conditionNode") public abstract class IfNode extends StatementNode { - @Child - protected ConditionNode conditionNode; + @Child protected ConditionNode conditionNode; - @Child - private StatementNode thenPartNode; + @Child private StatementNode thenPartNode; - @Child - private StatementNode elsePartNode; + @Child private StatementNode elsePartNode; public IfNode(ConditionNode condition, StatementNode thenPart, StatementNode elsePart) { this.conditionNode = adoptChild(condition); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/PrintNode.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/PrintNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/PrintNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,8 +28,7 @@ public abstract class PrintNode extends StatementNode { - @Child - protected TypedNode expression; + @Child protected TypedNode expression; private final PrintStream output; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ReadLocalNode.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ReadLocalNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ReadLocalNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -63,7 +63,7 @@ } @Override - protected FrameSlotNode specialize(Class< ? > clazz) { + protected FrameSlotNode specialize(Class clazz) { return ReadLocalNodeFactory.createSpecialized(this, clazz); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ReturnNode.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ReturnNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ReturnNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -28,8 +28,7 @@ private static final ReturnException EXCEPTION = new ReturnException(); - @Child - private StatementNode expr; + @Child private StatementNode expr; public ReturnNode(StatementNode expr) { this.expr = adoptChild(expr); diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/WhileNode.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/WhileNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/WhileNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -26,11 +26,9 @@ public class WhileNode extends StatementNode { - @Child - private ConditionNode condition; + @Child private ConditionNode condition; - @Child - private StatementNode body; + @Child private StatementNode body; private final BreakException breakTarget; private final ContinueException continueTarget; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/WriteLocalNode.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/WriteLocalNode.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/WriteLocalNode.java Wed Jan 23 16:34:57 2013 +0100 @@ -77,7 +77,7 @@ } @Override - protected FrameSlotNode specialize(Class< ? > clazz) { + protected FrameSlotNode specialize(Class clazz) { return WriteLocalNodeFactory.createSpecialized(this, clazz); } diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Parser.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Parser.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Parser.java Wed Jan 23 16:34:57 2013 +0100 @@ -21,9 +21,10 @@ * questions. */ - // The content of this file is automatically generated. DO NOT EDIT. +// The content of this file is automatically generated. DO NOT EDIT. package com.oracle.truffle.sl.parser; + import java.util.*; import com.oracle.truffle.sl.*; diff -r 4a11124a3563 -r 5e3d1a68664e graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Scanner.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Scanner.java Wed Jan 23 16:34:38 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Scanner.java Wed Jan 23 16:34:57 2013 +0100 @@ -21,7 +21,7 @@ * questions. */ - // The content of this file is automatically generated. DO NOT EDIT. +// The content of this file is automatically generated. DO NOT EDIT. package com.oracle.truffle.sl.parser;