Mercurial > hg > truffle
changeset 19519:d173a928cc15
Merge with 1cde96b966732b050683207d1c32758dac5a292b
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Thu, 19 Feb 2015 13:24:50 -0800 |
parents | b5467bb34b24 (current diff) 1cde96b96673 (diff) |
children | a015953a69f2 |
files | graal/com.oracle.graal.java/src/com/oracle/graal/java/GraalDirectivePlugins.java graal/com.oracle.graal.java/src/com/oracle/graal/java/StandardGraphBuilderPlugins.java |
diffstat | 86 files changed, 889 insertions(+), 576 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CalleeSaveLayout.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CalleeSaveLayout.java Thu Feb 19 13:24:50 2015 -0800 @@ -64,7 +64,7 @@ /** * Creates a CSA layout. - * + * * @param size size (in bytes) of the CSA. If this is {@code -1}, then the CSA size will be * computed from {@code registers}. * @param slotSize the size (in bytes) of an {@linkplain #registerAt(int) indexable} slot in the @@ -113,7 +113,7 @@ /** * Gets the offset of a given register in the CSA. - * + * * @return the offset (in bytes) of {@code reg} in the CSA * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA */ @@ -123,7 +123,7 @@ /** * Gets the index of a given register in the CSA. - * + * * @return the index of {@code reg} in the CSA * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA */ @@ -136,7 +136,7 @@ /** * Gets the offset of a given register in the CSA. - * + * * @return the offset (in bytes) of {@code reg} in the CSA * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA */ @@ -146,7 +146,7 @@ /** * Determines if the CSA includes a slot for a given register. - * + * * @param reg the register to test * @return true if the CSA contains a slot for {@code reg} */ @@ -156,7 +156,7 @@ /** * Gets the register whose slot in the CSA is at a given index. - * + * * @param index an index of a slot in the CSA * @return the register whose slot in the CSA is at {@code index} or {@code null} if * {@code index} does not denote a slot in the CSA aligned with a register
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java Thu Feb 19 13:24:50 2015 -0800 @@ -78,7 +78,7 @@ /** * Creates a description of the registers and stack locations used by a call. - * + * * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of * the call * @param returnLocation the location for the return value or {@link Value#ILLEGAL} if a void
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DisassemblerProvider.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DisassemblerProvider.java Thu Feb 19 13:24:50 2015 -0800 @@ -29,7 +29,7 @@ /** * Gets a textual disassembly of some given installed code. - * + * * @return a non-zero length string containing a disassembly of {@code code} or null if * {@code code} is {@link InstalledCode#isValid() invalid} or it could not be * disassembled for some other reason
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ForeignCallLinkage.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ForeignCallLinkage.java Thu Feb 19 13:24:50 2015 -0800 @@ -57,7 +57,7 @@ /** * Determines if the foreign call target destroys all registers. - * + * * @return {@code true} if the register allocator must save all live registers around a call to * this target */
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MemoryBarriers.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MemoryBarriers.java Thu Feb 19 13:24:50 2015 -0800 @@ -24,7 +24,7 @@ /** * Constants and intrinsic definition for memory barriers. - * + * * The documentation for each constant is taken from Doug Lea's <a * href="http://gee.cs.oswego.edu/dl/jmm/cookbook.html">The JSR-133 Cookbook for Compiler * Writers</a>. @@ -32,14 +32,14 @@ * The {@code JMM_*} constants capture the memory barriers necessary to implement the Java Memory * Model with respect to volatile field accesses. Their values are explained by this comment from * templateTable_i486.cpp in the HotSpot source code: - * + * * <pre> * Volatile variables demand their effects be made known to all CPU's in * order. Store buffers on most chips allow reads & writes to reorder; the * JMM's ReadAfterWrite.java test fails in -Xint mode without some kind of * memory barrier (i.e., it's not sufficient that the interpreter does not * reorder volatile references, the hardware also must not reorder them). - * + * * According to the new Java Memory Model (JMM): * (1) All volatiles are serialized wrt to each other. * ALSO reads & writes act as acquire & release, so: @@ -50,7 +50,7 @@ * that happen BEFORE the write float down to after the write. It's OK for * non-volatile memory refs that happen after the volatile write to float up * before it. - * + * * We only put in barriers around volatile refs (they are expensive), not * _between_ memory refs (which would require us to track the flavor of the * previous memory refs). Requirements (2) and (3) require some barriers
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterAttributes.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterAttributes.java Thu Feb 19 13:24:50 2015 -0800 @@ -47,7 +47,7 @@ * Creates a map from register {@linkplain Register#number numbers} to register * {@linkplain RegisterAttributes attributes} for a given register configuration and set of * registers. - * + * * @param registerConfig a register configuration * @param registers a set of registers * @return an array whose length is the max register number in {@code registers} plus 1. An
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/SpeculationLog.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/SpeculationLog.java Thu Feb 19 13:24:50 2015 -0800 @@ -29,7 +29,7 @@ /** * Manages a list of unique deoptimization reasons. - * + * */ public abstract class SpeculationLog { private volatile Object lastFailed;
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/BytecodeDisassemblerProvider.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/BytecodeDisassemblerProvider.java Thu Feb 19 13:24:50 2015 -0800 @@ -30,7 +30,7 @@ /** * Gets a textual disassembly of the bytecode for a given method. In the absence of bytecode * rewriting, disassembling a method will produce the same result. - * + * * @return a non-zero length string containing a disassembly of {@code method}'s bytecode or * null if {@code method} has no bytecode (i.e., {@code method.getCodeSize() == 0}) */
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java Thu Feb 19 13:24:50 2015 -0800 @@ -37,7 +37,7 @@ /** * Creates a new exception handler with the specified ranges. - * + * * @param startBCI the start index of the protected range * @param endBCI the end index of the protected range * @param catchBCI the index of the handler @@ -83,7 +83,7 @@ /** * Checks whether this handler catches all exceptions. - * + * * @return {@code true} if this handler catches all exceptions */ public boolean isCatchAll() {
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java Thu Feb 19 13:24:50 2015 -0800 @@ -282,7 +282,7 @@ /** * Checks whether the method has a receiver parameter - i.e., whether it is not static. - * + * * @return whether the method has a receiver parameter */ default boolean hasReceiver() {
--- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Address.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Address.java Thu Feb 19 13:24:50 2015 -0800 @@ -38,7 +38,7 @@ /** * Creates an {@link AMD64Address} with given base register, no scaling and no displacement. - * + * * @param base the base register */ public AMD64Address(Register base) { @@ -48,7 +48,7 @@ /** * Creates an {@link AMD64Address} with given base register, no scaling and a given * displacement. - * + * * @param base the base register * @param displacement the displacement */ @@ -59,7 +59,7 @@ /** * Creates an {@link AMD64Address} with given base and index registers, scaling and * displacement. This is the most general constructor. - * + * * @param base the base register * @param index the index register * @param scale the scaling factor
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeLookupSwitch.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeLookupSwitch.java Thu Feb 19 13:24:50 2015 -0800 @@ -34,7 +34,7 @@ /** * Constructor for a {@link BytecodeStream}. - * + * * @param stream the {@code BytecodeStream} containing the switch instruction * @param bci the index in the stream of the switch instruction */
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeStream.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeStream.java Thu Feb 19 13:24:50 2015 -0800 @@ -36,7 +36,7 @@ /** * Creates a new {@code BytecodeStream} for the specified bytecode. - * + * * @param code the array of bytes that contains the bytecode */ public BytecodeStream(byte[] code) { @@ -54,7 +54,7 @@ /** * Gets the next bytecode index (no side-effects). - * + * * @return the next bytecode index */ public int nextBCI() { @@ -63,7 +63,7 @@ /** * Gets the current bytecode index. - * + * * @return the current bytecode index */ public int currentBCI() { @@ -72,7 +72,7 @@ /** * Gets the bytecode index of the end of the code. - * + * * @return the index of the end of the code */ public int endBCI() { @@ -82,7 +82,7 @@ /** * Gets the current opcode. This method will never return the {@link Bytecodes#WIDE WIDE} * opcode, but will instead return the opcode that is modified by the {@code WIDE} opcode. - * + * * @return the current opcode; {@link Bytecodes#END} if at or beyond the end of the code */ public int currentBC() { @@ -96,7 +96,7 @@ /** * Reads the index of a local variable for one of the load or store instructions. The WIDE * modifier is handled internally. - * + * * @return the index of the local variable */ public int readLocalIndex() { @@ -109,7 +109,7 @@ /** * Read the delta for an {@link Bytecodes#IINC} bytecode. - * + * * @return the delta for the {@code IINC} */ public int readIncrement() { @@ -122,7 +122,7 @@ /** * Read the destination of a {@link Bytecodes#GOTO} or {@code IF} instructions. - * + * * @return the destination bytecode index */ public int readBranchDest() { @@ -136,7 +136,7 @@ /** * Read a signed 4-byte integer from the bytecode stream at the specified bytecode index. - * + * * @param bci the bytecode index * @return the integer value */ @@ -147,7 +147,7 @@ /** * Reads an unsigned, 1-byte value from the bytecode stream at the specified bytecode index. - * + * * @param bci the bytecode index * @return the byte */ @@ -157,7 +157,7 @@ /** * Reads a constant pool index for the current instruction. - * + * * @return the constant pool index */ public char readCPI() { @@ -169,7 +169,7 @@ /** * Reads a constant pool index for an invokedynamic instruction. - * + * * @return the constant pool index */ public int readCPI4() { @@ -179,7 +179,7 @@ /** * Reads a signed, 1-byte value for the current instruction (e.g. BIPUSH). - * + * * @return the byte */ public byte readByte() { @@ -188,7 +188,7 @@ /** * Reads a signed, 2-byte short for the current instruction (e.g. SIPUSH). - * + * * @return the short value */ public short readShort() { @@ -199,7 +199,7 @@ * Sets the bytecode index to the specified value. If {@code bci} is beyond the end of the * array, {@link #currentBC} will return {@link Bytecodes#END} and other methods may throw * {@link ArrayIndexOutOfBoundsException}. - * + * * @param bci the new bytecode index */ public void setBCI(int bci) {
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeSwitch.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeSwitch.java Thu Feb 19 13:24:50 2015 -0800 @@ -44,7 +44,7 @@ /** * Constructor for a {@link BytecodeStream}. - * + * * @param stream the {@code BytecodeStream} containing the switch instruction * @param bci the index in the stream of the switch instruction */ @@ -56,7 +56,7 @@ /** * Gets the current bytecode index. - * + * * @return the current bytecode index */ public int bci() { @@ -65,7 +65,7 @@ /** * Gets the index of the instruction denoted by the {@code i}'th switch target. - * + * * @param i index of the switch target * @return the index of the instruction denoted by the {@code i}'th switch target */ @@ -75,7 +75,7 @@ /** * Gets the index of the instruction for the default switch target. - * + * * @return the index of the instruction for the default switch target */ public int defaultTarget() { @@ -84,7 +84,7 @@ /** * Gets the offset from the start of the switch instruction to the default switch target. - * + * * @return the offset to the default switch target */ public int defaultOffset() { @@ -93,7 +93,7 @@ /** * Gets the key at {@code i}'th switch target index. - * + * * @param i the switch target index * @return the key at {@code i}'th switch target index */ @@ -101,7 +101,7 @@ /** * Gets the offset from the start of the switch instruction for the {@code i}'th switch target. - * + * * @param i the switch target index * @return the offset to the {@code i}'th switch target */ @@ -109,14 +109,14 @@ /** * Gets the number of switch targets. - * + * * @return the number of switch targets */ public abstract int numberOfCases(); /** * Gets the total size in bytes of the switch instruction. - * + * * @return the total size in bytes of the switch instruction */ public abstract int size();
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeTableSwitch.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeTableSwitch.java Thu Feb 19 13:24:50 2015 -0800 @@ -34,7 +34,7 @@ /** * Constructor for a {@link BytecodeStream}. - * + * * @param stream the {@code BytecodeStream} containing the switch instruction * @param bci the index in the stream of the switch instruction */ @@ -44,7 +44,7 @@ /** * Gets the low key of the table switch. - * + * * @return the low key */ public int lowKey() { @@ -53,7 +53,7 @@ /** * Gets the high key of the table switch. - * + * * @return the high key */ public int highKey() {
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytes.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytes.java Thu Feb 19 13:24:50 2015 -0800 @@ -29,7 +29,7 @@ /** * Gets a signed 1-byte value. - * + * * @param data the array containing the data * @param bci the start index of the value to retrieve * @return the signed 1-byte value at index {@code bci} in array {@code data} @@ -40,7 +40,7 @@ /** * Gets a signed 2-byte big-endian value. - * + * * @param data the array containing the data * @param bci the start index of the value to retrieve * @return the signed 2-byte, big-endian, value at index {@code bci} in array {@code data} @@ -51,7 +51,7 @@ /** * Gets an unsigned 1-byte value. - * + * * @param data the array containing the data * @param bci the start index of the value to retrieve * @return the unsigned 1-byte value at index {@code bci} in array {@code data} @@ -62,7 +62,7 @@ /** * Gets an unsigned 2-byte big-endian value. - * + * * @param data the array containing the data * @param bci the start index of the value to retrieve * @return the unsigned 2-byte, big-endian, value at index {@code bci} in array {@code data} @@ -73,7 +73,7 @@ /** * Gets a signed 4-byte big-endian value. - * + * * @param data the array containing the data * @param bci the start index of the value to retrieve * @return the signed 4-byte, big-endian, value at index {@code bci} in array {@code data} @@ -84,7 +84,7 @@ /** * Gets either a signed 2-byte or a signed 4-byte big-endian value. - * + * * @param data the array containing the data * @param bci the start index of the value to retrieve * @param fourByte if true, this method will return a 4-byte value
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/util/ArrayMap.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/util/ArrayMap.java Thu Feb 19 13:24:50 2015 -0800 @@ -45,7 +45,7 @@ /** * Constructs a new {@code ArrayMap} that initially covers the specified interval. Note that * this map will automatically expand if necessary later. - * + * * @param low the low index, inclusive * @param high the high index, exclusive */ @@ -56,7 +56,7 @@ /** * Puts a new value in the map at the specified index. - * + * * @param i the index at which to store the value * @param value the value to store at the specified index */ @@ -81,7 +81,7 @@ /** * Gets the value at the specified index in the map. - * + * * @param i the index * @return the value at the specified index; {@code null} if there is no value at the specified * index, or if the index is out of the currently stored range
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/util/IntList.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/util/IntList.java Thu Feb 19 13:24:50 2015 -0800 @@ -26,7 +26,7 @@ /** * An expandable and indexable list of {@code int}s. - * + * * This class avoids the boxing/unboxing incurred by {@code ArrayList<Integer>}. */ public final class IntList { @@ -36,7 +36,7 @@ /** * Creates an int list with a specified initial capacity. - * + * * @param initialCapacity */ public IntList(int initialCapacity) { @@ -45,7 +45,7 @@ /** * Creates an int list with a specified initial array. - * + * * @param array the initial array used for the list (no copy is made) * @param initialSize the initial {@linkplain #size() size} of the list (must be less than or * equal to {@code array.length} @@ -58,7 +58,7 @@ /** * Makes a new int list by copying a range from a given int list. - * + * * @param other the list from which a range of values is to be copied into the new list * @param startIndex the index in {@code other} at which to start copying * @param length the number of values to copy from {@code other} @@ -70,7 +70,7 @@ /** * Makes a new int list by copying a range from a given int list. - * + * * @param other the list from which a range of values is to be copied into the new list * @param startIndex the index in {@code other} at which to start copying * @param length the number of values to copy from {@code other} @@ -91,7 +91,7 @@ /** * Appends a value to the end of this list, increasing its {@linkplain #size() size} by 1. - * + * * @param value the value to append */ public void add(int value) { @@ -104,7 +104,7 @@ /** * Gets the value in this list at a given index. - * + * * @param index the index of the element to return * @throws IndexOutOfBoundsException if {@code index < 0 || index >= size()} */ @@ -124,7 +124,7 @@ /** * Sets a value at a given index in this list. - * + * * @param index the index of the element to update * @param value the new value of the element * @throws IndexOutOfBoundsException if {@code index < 0 || index >= size()} @@ -138,11 +138,11 @@ /** * Adjusts the {@linkplain #size() size} of this int list. - * + * * If {@code newSize < size()}, the size is changed to {@code newSize}. If * {@code newSize > size()}, sufficient 0 elements are {@linkplain #add(int) added} until * {@code size() == newSize}. - * + * * @param newSize the new size of this int list */ public void setSize(int newSize) {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/InstructionPrinter.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/InstructionPrinter.java Thu Feb 19 13:24:50 2015 -0800 @@ -71,7 +71,7 @@ /** * Prints this column's label to a given stream after padding the stream with '_' characters * until its {@linkplain LogStream#position() position} is equal to this column's position. - * + * * @param out the print stream */ public void printLabel(LogStream out) { @@ -82,7 +82,7 @@ /** * Prints space characters to a given stream until its {@linkplain LogStream#position() * position} is equal to this column's position. - * + * * @param out the print stream */ public void advance(LogStream out) { @@ -116,7 +116,7 @@ /** * Prints an instruction listing on one line. The instruction listing is composed of the columns * specified by {@link InstructionLineColumn}. - * + * * @param instruction the instruction to print */ public void printInstructionListing(ValueNode instruction) {
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfigScope.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfigScope.java Thu Feb 19 13:24:50 2015 -0800 @@ -27,7 +27,7 @@ /** * A utility for scoping a change to the current debug * {@linkplain DebugScope#setConfig(DebugConfig) configuration}. For example: - * + * * <pre> * DebugConfig config = ...; * try (DebugConfigScope s = new DebugConfigScope(config)) {
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/LogStream.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/LogStream.java Thu Feb 19 13:24:50 2015 -0800 @@ -26,20 +26,20 @@ /** * A utility for printing compiler debug and informational output to an output stream. - * + * * A {@link LogStream} instance maintains an internal buffer that is flushed to the underlying * output stream every time one of the {@code println} methods is invoked, or a newline character ( * {@code '\n'}) is written. - * + * * All of the {@code print} and {@code println} methods return the {code LogStream} instance on * which they were invoked. This allows chaining of these calls to mitigate use of String * concatenation by the caller. - * + * * A {@code LogStream} maintains a current {@linkplain #indentationLevel() indentation} level. Each * line of output written to this stream has {@code n} spaces prefixed to it where {@code n} is the * value that would be returned by {@link #indentationLevel()} when the first character of a new * line is written. - * + * * A {@code LogStream} maintains a current {@linkplain #position() position} for the current line * being written. This position can be advanced to a specified position by * {@linkplain #fillTo(int, char) filling} this stream with a given character. @@ -87,7 +87,7 @@ /** * Creates a new log stream. - * + * * @param os the underlying output stream to which prints are sent */ public LogStream(OutputStream os) { @@ -98,7 +98,7 @@ /** * Creates a new log stream that shares the same {@linkplain #ps output stream} as a given * {@link LogStream}. - * + * * @param log a LogStream whose output stream is shared with this one */ public LogStream(LogStream log) { @@ -147,7 +147,7 @@ /** * Gets the current column position of this log stream. - * + * * @return the current column position of this log stream */ public int position() { @@ -157,7 +157,7 @@ /** * Gets the current indentation level for this log stream. - * + * * @return the current indentation level for this log stream. */ public int indentationLevel() { @@ -166,7 +166,7 @@ /** * Adjusts the current indentation level of this log stream. - * + * * @param delta */ public void adjustIndentation(int delta) { @@ -202,7 +202,7 @@ /** * Advances this stream's {@linkplain #position() position} to a given position by repeatedly * appending a given character as necessary. - * + * * @param position the position to which this stream's position will be advanced * @param filler the character used to pad the stream */ @@ -218,7 +218,7 @@ /** * Writes a boolean value to this stream as {@code "true"} or {@code "false"}. - * + * * @param b the value to be printed * @return this {@link LogStream} instance */ @@ -233,7 +233,7 @@ /** * Writes a boolean value to this stream followed by a {@linkplain #LINE_SEPARATOR line * separator}. - * + * * @param b the value to be printed * @return this {@link LogStream} instance */ @@ -248,7 +248,7 @@ /** * Writes a character value to this stream. - * + * * @param c the value to be printed * @return this {@link LogStream} instance */ @@ -268,7 +268,7 @@ /** * Writes a character value to this stream followed by a {@linkplain #LINE_SEPARATOR line * separator}. - * + * * @param c the value to be printed * @return this {@link LogStream} instance */ @@ -283,7 +283,7 @@ /** * Prints an int value. - * + * * @param i the value to be printed * @return this {@link LogStream} instance */ @@ -297,7 +297,7 @@ /** * Writes an int value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}. - * + * * @param i the value to be printed * @return this {@link LogStream} instance */ @@ -312,7 +312,7 @@ /** * Writes a float value to this stream. - * + * * @param f the value to be printed * @return this {@link LogStream} instance */ @@ -327,7 +327,7 @@ /** * Writes a float value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator} * . - * + * * @param f the value to be printed * @return this {@link LogStream} instance */ @@ -342,7 +342,7 @@ /** * Writes a long value to this stream. - * + * * @param l the value to be printed * @return this {@link LogStream} instance */ @@ -356,7 +356,7 @@ /** * Writes a long value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}. - * + * * @param l the value to be printed * @return this {@link LogStream} instance */ @@ -371,7 +371,7 @@ /** * Writes a double value to this stream. - * + * * @param d the value to be printed * @return this {@link LogStream} instance */ @@ -386,7 +386,7 @@ /** * Writes a double value to this stream followed by a {@linkplain #LINE_SEPARATOR line * separator}. - * + * * @param d the value to be printed * @return this {@link LogStream} instance */ @@ -403,7 +403,7 @@ * Writes a {@code String} value to this stream. This method ensures that the * {@linkplain #position() position} of this stream is updated correctly with respect to any * {@linkplain #LINE_SEPARATOR line separators} present in {@code s}. - * + * * @param s the value to be printed * @return this {@link LogStream} instance */ @@ -436,7 +436,7 @@ /** * Writes a {@code String} value to this stream followed by a {@linkplain #LINE_SEPARATOR line * separator}. - * + * * @param s the value to be printed * @return this {@link LogStream} instance */ @@ -450,7 +450,7 @@ /** * Writes a formatted string to this stream. - * + * * @param format a format string as described in {@link String#format(String, Object...)} * @param args the arguments to be formatted * @return this {@link LogStream} instance @@ -464,7 +464,7 @@ /** * Writes a {@linkplain #LINE_SEPARATOR line separator} to this stream. - * + * * @return this {@code LogStream} instance */ public LogStream println() {
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/TTY.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/TTY.java Thu Feb 19 13:24:50 2015 -0800 @@ -46,7 +46,7 @@ * Creates an object that will suppress {@link TTY} for the current thread if the given * filter does not match the given object. To revert the suppression state to how it was * before this call, the {@link #remove()} method must be called on the suppression object. - * + * * @param filter the pattern for matching. If {@code null}, then the match is successful. If * it starts with "~", then a regular expression * {@linkplain Pattern#matches(String, CharSequence) match} is performed where
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeIdAccessor.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeIdAccessor.java Thu Feb 19 13:24:50 2015 -0800 @@ -40,7 +40,7 @@ /** * Verifies that node identifiers have not changed since this object was created. - * + * * @return true if the check succeeds * @throws VerificationError if the check fails */
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/VerificationError.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/VerificationError.java Thu Feb 19 13:24:50 2015 -0800 @@ -34,7 +34,7 @@ * This constructor creates a {@link VerificationError} with a message assembled via * {@link String#format(String, Object...)}. It always uses the ENGLISH locale in order to * always generate the same output. - * + * * @param msg the message that will be associated with the error, in String.format syntax * @param args parameters to String.format - parameters that implement {@link Iterable} will be * expanded into a [x, x, ...] representation.
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/spi/Simplifiable.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/spi/Simplifiable.java Thu Feb 19 13:24:50 2015 -0800 @@ -25,7 +25,7 @@ /** * This interface allows nodes to perform more complicated simplifications, in contrast to * {@link Canonicalizable}, which supports only replacing the current node. - * + * * Implementors of this interface need to be aware that they need to call * {@link SimplifierTool#addToWorkList(com.oracle.graal.graph.Node)} for each node that might be * influenced (in terms of simplification and canonicalization) by the actions performed in
--- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/InvocationSocket.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/InvocationSocket.java Thu Feb 19 13:24:50 2015 -0800 @@ -31,7 +31,7 @@ /** * A collection of java.lang.reflect proxies that communicate over a socket connection. - * + * * Calling a method sends the method name and the parameters through the socket. Afterwards this * class waits for a result. While waiting for a result three types of objects can arrive through * the socket: a method invocation, a method result or an exception. Method invocation can thus be @@ -83,7 +83,7 @@ /** * Represents one invocation of a method that is transferred via the socket connection. - * + * */ private static class Invocation implements Serializable { @@ -102,7 +102,7 @@ /** * Represents the result of an invocation that is transferred via the socket connection. - * + * */ private static class Result implements Serializable { @@ -130,7 +130,7 @@ * Each instance of this class handles remote invocations for one instance of a Remote class. It * will forward all interface methods to the other end of the socket and cache the results of * calls to certain methods. - * + * */ public class Handler implements InvocationHandler {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java Thu Feb 19 13:24:50 2015 -0800 @@ -33,6 +33,7 @@ import com.oracle.graal.hotspot.stubs.*; import com.oracle.graal.java.*; import com.oracle.graal.nodes.spi.*; +import com.oracle.graal.replacements.*; /** * Common functionality of HotSpot host backends. @@ -73,7 +74,7 @@ try (InitTimer st = timer("graphBuilderPlugins.initialize")) { GraphBuilderPhase phase = (GraphBuilderPhase) providers.getSuites().getDefaultGraphBuilderSuite().findPhase(GraphBuilderPhase.class).previous(); InvocationPlugins plugins = phase.getGraphBuilderConfig().getInvocationPlugins(); - registerInvocationPlugins(providers.getMetaAccess(), plugins); + registerInvocationPlugins(providers, plugins); } try (InitTimer st = timer("foreignCalls.initialize")) { @@ -105,8 +106,8 @@ } } - protected void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { - StandardGraphBuilderPlugins.registerInvocationPlugins(metaAccess, plugins); - HotSpotGraphBuilderPlugins.registerInvocationPlugins(metaAccess, plugins); + protected void registerInvocationPlugins(HotSpotProviders providers, InvocationPlugins plugins) { + StandardGraphBuilderPlugins.registerInvocationPlugins(providers.getMetaAccess(), plugins); + HotSpotGraphBuilderPlugins.registerInvocationPlugins(providers, plugins); } }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java Thu Feb 19 13:24:50 2015 -0800 @@ -22,28 +22,46 @@ */ package com.oracle.graal.hotspot.meta; +import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.java.GraphBuilderContext.*; +import static java.lang.Character.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.replacements.*; import com.oracle.graal.compiler.common.type.*; +import com.oracle.graal.hotspot.nodes.type.*; import com.oracle.graal.hotspot.replacements.*; +import com.oracle.graal.hotspot.word.*; import com.oracle.graal.java.*; import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin; import com.oracle.graal.java.InvocationPlugins.Registration; import com.oracle.graal.java.InvocationPlugins.Registration.Receiver; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.options.*; +import com.oracle.graal.word.*; +import com.oracle.graal.word.nodes.*; /** * Provides HotSpot specific {@link InvocationPlugin}s. */ public class HotSpotGraphBuilderPlugins { - public static void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { - // Object.class + public static void registerInvocationPlugins(HotSpotProviders providers, InvocationPlugins plugins) { + MetaAccessProvider metaAccess = providers.getMetaAccess(); + SnippetReflectionProvider snippetReflection = providers.getSnippetReflection(); + Kind wordKind = providers.getCodeCache().getTarget().wordKind; + + registerObjectPlugins(plugins, metaAccess); + registerClassPlugins(plugins, metaAccess); + registerStableOptionPlugins(plugins, metaAccess); + registerMetaspacePointerPlugins(plugins, metaAccess, snippetReflection, wordKind); + } + + private static void registerObjectPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess) { Registration r = new Registration(plugins, metaAccess, Object.class); r.register1("getClass", Receiver.class, new InvocationPlugin() { public boolean apply(GraphBuilderContext builder, ValueNode rcvr) { @@ -60,9 +78,10 @@ return true; } }); + } - // Class.class - r = new Registration(plugins, metaAccess, Class.class); + private static void registerClassPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess) { + Registration r = new Registration(plugins, metaAccess, Class.class); r.register2("cast", Receiver.class, Object.class, new InvocationPlugin() { public boolean apply(GraphBuilderContext builder, ValueNode rcvr, ValueNode object) { if (rcvr.isConstant() && !rcvr.isNullConstant()) { @@ -88,9 +107,10 @@ return false; } }); + } - // StableOptionValue.class - r = new Registration(plugins, metaAccess, StableOptionValue.class); + private static void registerStableOptionPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess) { + Registration r = new Registration(plugins, metaAccess, StableOptionValue.class); r.register1("getValue", Receiver.class, new InvocationPlugin() { public boolean apply(GraphBuilderContext builder, ValueNode rcvr) { if (rcvr.isConstant() && !rcvr.isNullConstant()) { @@ -104,4 +124,130 @@ } }); } + + private static void registerMetaspacePointerPlugins(InvocationPlugins plugins, MetaAccessProvider metaAccess, SnippetReflectionProvider snippetReflection, Kind wordKind) { + Registration r = new Registration(plugins, metaAccess, MetaspacePointer.class); + r.register1("isNull", Receiver.class, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode pointer) { + assert pointer.stamp() instanceof MetaspacePointerStamp; + IsNullNode isNull = builder.append(new IsNullNode(pointer)); + ConstantNode trueValue = builder.append(ConstantNode.forBoolean(true)); + ConstantNode falseValue = builder.append(ConstantNode.forBoolean(false)); + builder.push(Kind.Boolean.getStackKind(), builder.append(new ConditionalNode(isNull, trueValue, falseValue))); + return true; + } + }); + r.register1("asWord", Receiver.class, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode pointer) { + builder.append(new PointerCastNode(StampFactory.forKind(wordKind), pointer)); + return true; + } + }); + r.register2("readObject", Receiver.class, int.class, new ReadOp(snippetReflection, wordKind, Kind.Object, BarrierType.NONE, true)); + r.register3("readObject", Receiver.class, int.class, LocationIdentity.class, new ReadOp(snippetReflection, wordKind, Kind.Object, BarrierType.NONE, true)); + r.register3("readObject", Receiver.class, int.class, BarrierType.class, new ReadOp(snippetReflection, wordKind, Kind.Object, BarrierType.NONE, true)); + r.register2("readObject", Receiver.class, WordBase.class, new ReadOp(snippetReflection, wordKind, Kind.Object, BarrierType.NONE, true)); + r.register3("readObject", Receiver.class, WordBase.class, LocationIdentity.class, new ReadOp(snippetReflection, wordKind, Kind.Object, BarrierType.NONE, true)); + r.register3("readObject", Receiver.class, WordBase.class, BarrierType.class, new ReadOp(snippetReflection, wordKind, Kind.Object, BarrierType.NONE, true)); + + registerWordOpPlugins(r, snippetReflection, wordKind, Kind.Byte, Kind.Short, Kind.Char, Kind.Int, Kind.Float, Kind.Long, Kind.Double); + } + + private static void registerWordOpPlugins(Registration r, SnippetReflectionProvider snippetReflection, Kind wordKind, Kind... kinds) { + for (Kind kind : kinds) { + String kindName = kind.getJavaName(); + kindName = toUpperCase(kindName.charAt(0)) + kindName.substring(1); + String getName = "read" + kindName; + // String putName = "write" + kindName; + r.register2(getName, Receiver.class, int.class, new ReadOp(snippetReflection, wordKind, kind)); + r.register3(getName, Receiver.class, int.class, LocationIdentity.class, new ReadOp(snippetReflection, wordKind, kind)); + } + } + + static class ReadOp implements InvocationPlugin { + final SnippetReflectionProvider snippetReflection; + final Kind wordKind; + final Kind resultKind; + final BarrierType barrierType; + final boolean compressible; + + public ReadOp(SnippetReflectionProvider snippetReflection, Kind wordKind, Kind resultKind, BarrierType barrierType, boolean compressible) { + this.snippetReflection = snippetReflection; + this.wordKind = wordKind; + this.resultKind = resultKind; + this.barrierType = barrierType; + this.compressible = compressible; + } + + public ReadOp(SnippetReflectionProvider snippetReflection, Kind wordKind, Kind resultKind) { + this(snippetReflection, wordKind, resultKind, BarrierType.NONE, false); + } + + public boolean apply(GraphBuilderContext builder, ValueNode pointer, ValueNode offset) { + LocationNode location = makeLocation(builder, offset, ANY_LOCATION, wordKind); + builder.push(resultKind, builder.append(readOp(builder, resultKind, pointer, location, barrierType, compressible))); + return true; + } + + public boolean apply(GraphBuilderContext builder, ValueNode pointer, ValueNode offset, ValueNode locationIdentityArg) { + assert locationIdentityArg.isConstant(); + LocationIdentity locationIdentity = snippetReflection.asObject(LocationIdentity.class, locationIdentityArg.asJavaConstant()); + LocationNode location = makeLocation(builder, offset, locationIdentity, wordKind); + builder.push(resultKind, builder.append(readOp(builder, resultKind, pointer, location, barrierType, compressible))); + return true; + } + } + + public static ValueNode readOp(GraphBuilderContext builder, Kind readKind, ValueNode base, LocationNode location, BarrierType barrierType, boolean compressible) { + JavaReadNode read = builder.append(new JavaReadNode(readKind, base, location, barrierType, compressible)); + /* + * The read must not float outside its block otherwise it may float above an explicit zero + * check on its base address. + */ + read.setGuard(builder.getCurrentBlockGuard()); + return read; + } + + public static LocationNode makeLocation(GraphBuilderContext builder, ValueNode offset, LocationIdentity locationIdentity, Kind wordKind) { + return builder.append(new IndexedLocationNode(locationIdentity, 0, fromSigned(builder, offset, wordKind), 1)); + } + + public static LocationNode makeLocation(GraphBuilderContext builder, ValueNode offset, ValueNode locationIdentity, Kind wordKind) { + if (locationIdentity.isConstant()) { + return makeLocation(builder, offset, builder.getSnippetReflection().asObject(LocationIdentity.class, locationIdentity.asJavaConstant()), wordKind); + } + return builder.append(new SnippetLocationNode(builder.getSnippetReflection(), locationIdentity, builder.append(ConstantNode.forLong(0)), fromSigned(builder, offset, wordKind), + builder.append(ConstantNode.forInt(1)))); + } + + public static ValueNode fromUnsigned(GraphBuilderContext builder, ValueNode value, Kind wordKind) { + return convert(builder, value, wordKind, true); + } + + public static ValueNode fromSigned(GraphBuilderContext builder, ValueNode value, Kind wordKind) { + return convert(builder, value, wordKind, false); + } + + public static ValueNode toUnsigned(GraphBuilderContext builder, ValueNode value, Kind toKind) { + return convert(builder, value, toKind, true); + } + + public static ValueNode convert(GraphBuilderContext builder, ValueNode value, Kind toKind, boolean unsigned) { + if (value.getKind() == toKind) { + return value; + } + + if (toKind == Kind.Int) { + assert value.getKind() == Kind.Long; + return builder.append(new NarrowNode(value, 32)); + } else { + assert toKind == Kind.Long; + assert value.getKind().getStackKind() == Kind.Int; + if (unsigned) { + return builder.append(new ZeroExtendNode(value, 64)); + } else { + return builder.append(new SignExtendNode(value, 64)); + } + } + } }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java Thu Feb 19 13:24:50 2015 -0800 @@ -22,14 +22,21 @@ */ package com.oracle.graal.hotspot.meta; +import static com.oracle.graal.api.meta.MetaUtil.*; import static com.oracle.graal.compiler.common.GraalOptions.*; +import static com.oracle.graal.replacements.NodeIntrinsificationPhase.*; + +import java.util.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.compiler.common.type.*; +import com.oracle.graal.graph.Node.NodeIntrinsic; import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.hotspot.phases.*; import com.oracle.graal.java.*; import com.oracle.graal.java.GraphBuilderConfiguration.DebugInfoMode; +import com.oracle.graal.java.GraphBuilderPlugin.AnnotatedInvocationPlugin; import com.oracle.graal.java.GraphBuilderPlugin.InlineInvokePlugin; import com.oracle.graal.java.GraphBuilderPlugin.LoadFieldPlugin; import com.oracle.graal.lir.phases.*; @@ -39,6 +46,7 @@ import com.oracle.graal.options.DerivedOptionValue.OptionSupplier; import com.oracle.graal.phases.*; import com.oracle.graal.phases.tiers.*; +import com.oracle.graal.replacements.*; /** * HotSpot implementation of {@link SuitesProvider}. @@ -104,6 +112,20 @@ return ret; } + NodeIntrinsificationPhase intrinsifier; + + NodeIntrinsificationPhase getIntrinsifier() { + if (intrinsifier == null) { + HotSpotProviders providers = runtime.getHostProviders(); + intrinsifier = new NodeIntrinsificationPhase(providers, providers.getSnippetReflection()); + } + return intrinsifier; + } + + MetaAccessProvider getMetaAccess() { + return runtime.getHostProviders().getMetaAccess(); + } + protected PhaseSuite<HighTierContext> createGraphBuilderSuite(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, Replacements replacements) { PhaseSuite<HighTierContext> suite = new PhaseSuite<>(); GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(); @@ -127,12 +149,57 @@ if (subst != null) { return subst; } + if (builder.parsingReplacement() && method.getAnnotation(NodeIntrinsic.class) == null) { + return method; + } if (method.hasBytecodes() && method.getCode().length <= TrivialInliningSize.getValue() && depth < InlineDuringParsingMaxDepth.getValue()) { return method; } return null; } }); + config.setAnnotatedInvocationPlugin(new AnnotatedInvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ResolvedJavaMethod method, ValueNode[] args) { + if (builder.parsingReplacement()) { + @SuppressWarnings("hiding") + NodeIntrinsificationPhase intrinsifier = getIntrinsifier(); + NodeIntrinsic intrinsic = intrinsifier.getIntrinsic(method); + if (intrinsic != null) { + Signature sig = method.getSignature(); + Kind returnKind = sig.getReturnKind(); + Stamp stamp = StampFactory.forKind(returnKind); + if (returnKind == Kind.Object) { + JavaType returnType = sig.getReturnType(method.getDeclaringClass()); + if (returnType instanceof ResolvedJavaType) { + stamp = StampFactory.declared((ResolvedJavaType) returnType); + } + } + + ValueNode res = intrinsifier.createIntrinsicNode(Arrays.asList(args), stamp, method, builder.getGraph(), intrinsic); + res = builder.append(res); + if (res.getKind().getStackKind() != Kind.Void) { + builder.push(returnKind.getStackKind(), res); + } + return true; + } else if (intrinsifier.isFoldable(method)) { + ResolvedJavaType[] parameterTypes = resolveJavaTypes(method.toParameterTypes(), method.getDeclaringClass()); + JavaConstant constant = intrinsifier.tryFold(Arrays.asList(args), parameterTypes, method); + if (!COULD_NOT_FOLD.equals(constant)) { + if (constant != null) { + // Replace the invoke with the result of the call + ConstantNode res = builder.append(ConstantNode.forConstant(constant, getMetaAccess())); + builder.push(res.getKind().getStackKind(), builder.append(res)); + } else { + // This must be a void invoke + assert method.getSignature().getReturnKind() == Kind.Void; + } + return true; + } + } + } + return false; + } + }); } suite.appendPhase(new GraphBuilderPhase(config)); return suite;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/DeoptimizationStub.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/DeoptimizationStub.java Thu Feb 19 13:24:50 2015 -0800 @@ -138,7 +138,7 @@ * Stack bang to make sure there's enough room for the interpreter frames. Bang stack for * total size of the interpreter frames plus shadow page size. Bang one page at a time * because large sizes can bang beyond yellow and red zones. - * + * * @deprecated This code should go away as soon as JDK-8032410 hits the Graal repository. */ final int totalFrameSizes = unrollBlock.readInt(deoptimizationUnrollBlockTotalFrameSizesOffset());
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UncommonTrapStub.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UncommonTrapStub.java Thu Feb 19 13:24:50 2015 -0800 @@ -149,7 +149,7 @@ * Stack bang to make sure there's enough room for the interpreter frames. Bang stack for * total size of the interpreter frames plus shadow page size. Bang one page at a time * because large sizes can bang beyond yellow and red zones. - * + * * @deprecated This code should go away as soon as JDK-8032410 hits the Graal repository. */ final int totalFrameSizes = unrollBlock.readInt(deoptimizationUnrollBlockTotalFrameSizesOffset());
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java Thu Feb 19 13:24:50 2015 -0800 @@ -37,7 +37,6 @@ import com.oracle.graal.compiler.common.calc.*; import com.oracle.graal.debug.*; import com.oracle.graal.java.BciBlockMapping.BciBlock; -import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin; import com.oracle.graal.java.GraphBuilderPlugin.LoadFieldPlugin; import com.oracle.graal.nodes.*; import com.oracle.graal.options.*; @@ -119,7 +118,7 @@ if (kind == Kind.Object) { value = frameState.xpop(); // astore and astore_<n> may be used to store a returnAddress (jsr) - assert value.getKind() == Kind.Object || value.getKind() == Kind.Int; + assert parsingReplacement || (value.getKind() == Kind.Object || value.getKind() == Kind.Int) : value + ":" + value.getKind(); } else { value = frameState.pop(kind); } @@ -573,7 +572,7 @@ } private JavaTypeProfile getProfileForTypeCheck(ResolvedJavaType type) { - if (profilingInfo == null || !optimisticOpts.useTypeCheckHints() || !canHaveSubtype(type)) { + if (parsingReplacement || profilingInfo == null || !optimisticOpts.useTypeCheckHints() || !canHaveSubtype(type)) { return null; } else { return profilingInfo.getTypeProfile(bci()); @@ -757,7 +756,7 @@ private void genGetStatic(JavaField field) { Kind kind = field.getKind(); if (field instanceof ResolvedJavaField && ((ResolvedJavaType) field.getDeclaringClass()).isInitialized()) { - InvocationPlugin.LoadFieldPlugin loadFieldPlugin = this.graphBuilderConfig.getLoadFieldPlugin(); + LoadFieldPlugin loadFieldPlugin = this.graphBuilderConfig.getLoadFieldPlugin(); if (loadFieldPlugin == null || !loadFieldPlugin.apply((GraphBuilderContext) this, (ResolvedJavaField) field)) { appendOptimizedLoadField(kind, genLoadField(null, (ResolvedJavaField) field)); }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractFrameStateBuilder.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractFrameStateBuilder.java Thu Feb 19 13:24:50 2015 -0800 @@ -36,15 +36,21 @@ protected T[] lockedObjects; /** + * Specifies if asserting type checks are enabled. + */ + protected final boolean checkTypes; + + /** * @see BytecodeFrame#rethrowException */ protected boolean rethrowException; - public AbstractFrameStateBuilder(ResolvedJavaMethod method) { + public AbstractFrameStateBuilder(ResolvedJavaMethod method, boolean checkTypes) { this.method = method; this.locals = allocateArray(method.getMaxLocals()); this.stack = allocateArray(Math.max(1, method.getMaxStackSize())); this.lockedObjects = allocateArray(0); + this.checkTypes = checkTypes; } protected AbstractFrameStateBuilder(S other) { @@ -54,6 +60,7 @@ this.stack = other.stack.clone(); this.lockedObjects = other.lockedObjects.length == 0 ? other.lockedObjects : other.lockedObjects.clone(); this.rethrowException = other.rethrowException; + this.checkTypes = other.checkTypes; assert locals.length == method.getMaxLocals(); assert stack.length == Math.max(1, method.getMaxStackSize()); @@ -171,8 +178,8 @@ public T loadLocal(int i) { T x = locals[i]; assert x != null : i; - assert x.getKind().getSlotCount() == 1 || locals[i + 1] == null; - assert i == 0 || locals[i - 1] == null || locals[i - 1].getKind().getSlotCount() == 1; + assert !checkTypes || (x.getKind().getSlotCount() == 1 || locals[i + 1] == null); + assert !checkTypes || (i == 0 || locals[i - 1] == null || locals[i - 1].getKind().getSlotCount() == 1); return x; } @@ -184,7 +191,7 @@ * @param x the instruction which produces the value for the local */ public void storeLocal(int i, T x) { - assert x == null || x.getKind() != Kind.Void && x.getKind() != Kind.Illegal : "unexpected value: " + x; + assert x == null || !checkTypes || (x.getKind() != Kind.Void && x.getKind() != Kind.Illegal) : "unexpected value: " + x; locals[i] = x; if (x != null && x.getKind().needsTwoSlots()) { // if this is a double word, then kill i+1 @@ -211,7 +218,7 @@ * @param x the instruction to push onto the stack */ public void push(Kind kind, T x) { - assert x.getKind() != Kind.Void && x.getKind() != Kind.Illegal; + assert !checkTypes || (x.getKind() != Kind.Void && x.getKind() != Kind.Illegal) : x; xpush(assertKind(kind, x)); if (kind.needsTwoSlots()) { xpush(null); @@ -224,7 +231,7 @@ * @param x the instruction to push onto the stack */ public void xpush(T x) { - assert x == null || (x.getKind() != Kind.Void && x.getKind() != Kind.Illegal); + assert !checkTypes || (x == null || (x.getKind() != Kind.Void && x.getKind() != Kind.Illegal)); stack[stackSize++] = x; } @@ -368,7 +375,7 @@ newStackSize--; assert stack[newStackSize].getKind().needsTwoSlots(); } else { - assert stack[newStackSize].getKind().getSlotCount() == 1; + assert !checkTypes || (stack[newStackSize].getKind().getSlotCount() == 1); } result[i] = stack[newStackSize]; } @@ -404,7 +411,7 @@ } private T assertKind(Kind kind, T x) { - assert x != null && x.getKind() == kind : "kind=" + kind + ", value=" + x + ((x == null) ? "" : ", value.kind=" + x.getKind()); + assert x != null && (!checkTypes || x.getKind() == kind) : "kind=" + kind + ", value=" + x + ((x == null) ? "" : ", value.kind=" + x.getKind()); return x; } @@ -424,7 +431,7 @@ } private T assertObject(T x) { - assert x != null && (x.getKind() == Kind.Object); + assert x != null && (!checkTypes || (x.getKind() == Kind.Object)); return x; }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java Thu Feb 19 13:24:50 2015 -0800 @@ -367,6 +367,7 @@ private int blocksNotYetAssignedId; public int returnCount; + private int returnBci; /** * Creates a new BlockMap instance from bytecode of the given method . @@ -465,6 +466,7 @@ case RETURN: { returnCount++; current = null; + returnBci = bci; break; } case ATHROW: { @@ -769,11 +771,15 @@ // Add return block. BciBlock returnBlock = new BciBlock(); + returnBlock.startBci = returnBci; + returnBlock.endBci = returnBci; returnBlock.setId(newBlocks.length - 2); newBlocks[newBlocks.length - 2] = returnBlock; // Add unwind block. ExceptionDispatchBlock unwindBlock = new ExceptionDispatchBlock(); + unwindBlock.startBci = -1; + unwindBlock.endBci = -1; unwindBlock.deoptBci = method.isSynchronized() ? BytecodeFrame.UNWIND_BCI : BytecodeFrame.AFTER_EXCEPTION_BCI; unwindBlock.setId(newBlocks.length - 1); newBlocks[newBlocks.length - 1] = unwindBlock;
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraalDirectivePlugins.java Thu Feb 19 11:42:03 2015 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.java; - -import com.oracle.graal.api.directives.*; -import com.oracle.graal.api.meta.*; -import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin; -import com.oracle.graal.java.InvocationPlugins.Registration; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.debug.*; -import com.oracle.graal.nodes.extended.*; - -public class GraalDirectivePlugins { - - public static void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { - Registration r = new Registration(plugins, metaAccess, GraalDirectives.class); - r.register0("deoptimize", new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder) { - builder.append(new DeoptimizeNode(DeoptimizationAction.None, DeoptimizationReason.TransferToInterpreter)); - return true; - } - }); - - r.register0("deoptimizeAndInvalidate", new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder) { - builder.append(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TransferToInterpreter)); - return true; - } - }); - - r.register0("inCompiledCode", new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder) { - builder.push(Kind.Int, builder.append(ConstantNode.forInt(1))); - return true; - } - }); - - r.register0("controlFlowAnchor", new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder) { - builder.append(new ControlFlowAnchorNode()); - return true; - } - }); - - r.register2("injectBranchProbability", double.class, boolean.class, new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder, ValueNode probability, ValueNode condition) { - builder.push(Kind.Int, builder.append(new BranchProbabilityNode(probability, condition))); - return true; - } - }); - - InvocationPlugin blackholePlugin = new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder, ValueNode value) { - builder.append(new BlackholeNode(value)); - return true; - } - }; - - for (Kind kind : Kind.values()) { - Class<?> cls = null; - switch (kind) { - case Object: - cls = Object.class; - break; - case Void: - case Illegal: - continue; - default: - cls = kind.toJavaClass(); - } - - r.register1("blackhole", cls, blackholePlugin); - - final Kind stackKind = kind.getStackKind(); - r.register1("opaque", cls, new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder, ValueNode value) { - builder.push(stackKind, builder.append(new OpaqueNode(value))); - return true; - } - }); - } - } -}
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderContext.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderContext.java Thu Feb 19 13:24:50 2015 -0800 @@ -27,6 +27,7 @@ import com.oracle.graal.api.replacements.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; +import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; /** @@ -56,6 +57,8 @@ void push(Kind kind, ValueNode value); + StructuredGraph getGraph(); + /** * Determines if the graph builder is parsing a snippet or method substitution. */ @@ -71,4 +74,6 @@ } return nonNullValue; } + + GuardingNode getCurrentBlockGuard(); }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Thu Feb 19 13:24:50 2015 -0800 @@ -26,6 +26,7 @@ import static com.oracle.graal.api.meta.DeoptimizationReason.*; import static com.oracle.graal.bytecode.Bytecodes.*; import static com.oracle.graal.compiler.common.GraalOptions.*; +import static com.oracle.graal.graph.iterators.NodePredicates.*; import static com.oracle.graal.nodes.StructuredGraph.*; import static java.lang.String.*; @@ -126,7 +127,7 @@ int entryBCI = graph.getEntryBCI(); assert method.getCode() != null : "method must contain bytecodes: " + method; this.currentGraph = graph; - HIRFrameStateBuilder frameState = new HIRFrameStateBuilder(method, graph, null); + HIRFrameStateBuilder frameState = new HIRFrameStateBuilder(method, graph, true, null); frameState.initializeForMethodStart(graphBuilderConfig.eagerResolving(), this.graphBuilderConfig.getParameterPlugin()); TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method); try { @@ -889,7 +890,8 @@ Mark mark = needsNullCheck ? currentGraph.getMark() : null; if (InvocationPlugin.execute(this, plugin, args)) { assert beforeStackSize + resultType.getSlotCount() == frameState.stackSize : "plugin manipulated the stack incorrectly " + targetMethod; - assert !needsNullCheck || containsNullCheckOf(currentGraph.getNewNodes(mark), args[0]) : "plugin needs to null check the receiver of " + targetMethod + ": " + args[0]; + assert !needsNullCheck || args[0].usages().filter(isNotA(FrameState.class)).isEmpty() || containsNullCheckOf(currentGraph.getNewNodes(mark), args[0]) : "plugin needs to null check the receiver of " + + targetMethod + ": " + args[0]; return true; } assert nodeCount == currentGraph.getNodeCount() : "plugin that returns false must not create new nodes"; @@ -938,7 +940,13 @@ private void parseAndInlineCallee(ResolvedJavaMethod targetMethod, ValueNode[] args, boolean isReplacement) { BytecodeParser parser = new BytecodeParser(metaAccess, targetMethod, graphBuilderConfig, optimisticOpts, INVOCATION_ENTRY_BCI, isReplacement); final FrameState[] lazyFrameState = new FrameState[1]; - HIRFrameStateBuilder startFrameState = new HIRFrameStateBuilder(targetMethod, currentGraph, () -> { + + // Replacements often produce nodes with an illegal kind (e.g., pointer stamps) + // so the frame state builder should not check the types flowing through the frame + // since all such assertions are in terms of Java kinds. + boolean checkTypes = !isReplacement; + + HIRFrameStateBuilder startFrameState = new HIRFrameStateBuilder(targetMethod, currentGraph, checkTypes, () -> { if (lazyFrameState[0] == null) { lazyFrameState[0] = frameState.create(bci()); } @@ -1924,6 +1932,19 @@ public boolean parsingReplacement() { return parsingReplacement; } + + public StructuredGraph getGraph() { + return currentGraph; + } + + public GuardingNode getCurrentBlockGuard() { + return (GuardingNode) getFirstInstruction(currentBlock, getCurrentDimension()); + } + + @Override + public String toString() { + return method.format("%H.%n(%p)@") + bci(); + } } }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java Thu Feb 19 13:24:50 2015 -0800 @@ -53,8 +53,8 @@ * @param method the method whose frame is simulated * @param graph the target graph of Graal nodes created by the builder */ - public HIRFrameStateBuilder(ResolvedJavaMethod method, StructuredGraph graph, Supplier<FrameState> outerFrameStateSupplier) { - super(method); + public HIRFrameStateBuilder(ResolvedJavaMethod method, StructuredGraph graph, boolean checkTypes, Supplier<FrameState> outerFrameStateSupplier) { + super(method, checkTypes); assert graph != null;
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/InvocationPlugins.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/InvocationPlugins.java Thu Feb 19 13:24:50 2015 -0800 @@ -222,28 +222,15 @@ public static boolean check(ResolvedJavaMethod method, InvocationPlugin plugin) { int arguments = method.getSignature().getParameterCount(!method.isStatic()); assert arguments < SIGS.length : format("need to extend %s to support method with %d arguments: %s", InvocationPlugin.class.getSimpleName(), arguments, method.format("%H.%n(%p)")); - Method expected = null; for (Method m : plugin.getClass().getDeclaredMethods()) { if (m.getName().equals("apply")) { Class<?>[] parameterTypes = m.getParameterTypes(); - assert Arrays.equals(SIGS[arguments], parameterTypes) : format("graph builder plugin for %s has wrong signature%nexpected: (%s)%n actual: (%s)", method.format("%H.%n(%p)"), - sigString(SIGS[arguments]), sigString(m.getParameterTypes())); - expected = m; + if (Arrays.equals(SIGS[arguments], parameterTypes)) { + return true; + } } } - assert expected != null : format("graph builder plugin %s must define exactly one \"apply\" method, none found", plugin); - return true; - } - - protected static String sigString(Class<?>... sig) { - StringBuilder sb = new StringBuilder(); - for (Class<?> t : sig) { - if (sb.length() != 0) { - sb.append(", "); - } - sb.append(t.getSimpleName()); - } - return sb.toString(); + throw new AssertionError(format("graph builder plugin for %s not found", method.format("%H.%n(%p)"))); } } }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/StandardGraphBuilderPlugins.java Thu Feb 19 11:42:03 2015 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.java; - -import static com.oracle.graal.java.GraphBuilderContext.*; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin; -import com.oracle.graal.java.InvocationPlugins.Registration; -import com.oracle.graal.java.InvocationPlugins.Registration.Receiver; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; -import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.java.*; - -/** - * Provides non-runtime specific {@link InvocationPlugin}s. - */ -public class StandardGraphBuilderPlugins { - public static void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { - Registration r = new Registration(plugins, metaAccess, Object.class); - r.register1("<init>", Receiver.class, new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder, ValueNode object) { - if (RegisterFinalizerNode.mayHaveFinalizer(object, builder.getAssumptions())) { - builder.append(new RegisterFinalizerNode(object)); - } - return true; - } - }); - - r = new Registration(plugins, metaAccess, Math.class); - r.register1("abs", Float.TYPE, new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder, ValueNode value) { - builder.push(Kind.Float, builder.append(new AbsNode(value))); - return true; - } - }); - r.register1("abs", Double.TYPE, new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder, ValueNode value) { - builder.push(Kind.Double, builder.append(new AbsNode(value))); - return true; - } - }); - r.register1("sqrt", Double.TYPE, new InvocationPlugin() { - public boolean apply(GraphBuilderContext builder, ValueNode value) { - builder.push(Kind.Double, builder.append(new SqrtNode(value))); - return true; - } - }); - - for (Kind kind : Kind.values()) { - if (kind.isPrimitive() && kind != Kind.Void) { - new BoxPlugin(kind).register(metaAccess, plugins); - new UnboxPlugin(kind).register(metaAccess, plugins); - } - } - - GraalDirectivePlugins.registerInvocationPlugins(metaAccess, plugins); - } - - static class BoxPlugin implements InvocationPlugin { - - private final Kind kind; - - BoxPlugin(Kind kind) { - this.kind = kind; - } - - public boolean apply(GraphBuilderContext builder, ValueNode value) { - ResolvedJavaType resultType = builder.getMetaAccess().lookupJavaType(kind.toBoxedJavaClass()); - builder.push(Kind.Object, builder.append(new BoxNode(value, resultType, kind))); - return true; - } - - void register(MetaAccessProvider metaAccess, InvocationPlugins plugins) { - ResolvedJavaMethod method = Registration.resolve(metaAccess, kind.toBoxedJavaClass(), "valueOf", kind.toJavaClass()); - plugins.register(method, this); - } - } - - static class UnboxPlugin implements InvocationPlugin { - - private final Kind kind; - - UnboxPlugin(Kind kind) { - this.kind = kind; - } - - public boolean apply(GraphBuilderContext builder, ValueNode value) { - ValueNode valueNode = UnboxNode.create(builder.getMetaAccess(), builder.getConstantReflection(), nullCheckedValue(builder, value), kind); - builder.push(kind.getStackKind(), builder.append(valueNode)); - return true; - } - - void register(MetaAccessProvider metaAccess, InvocationPlugins plugins) { - String name = kind.toJavaClass().getSimpleName() + "Value"; - ResolvedJavaMethod method = Registration.resolve(metaAccess, kind.toBoxedJavaClass(), name); - plugins.register(method, this); - } - } -}
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/UntrustedInterfaces.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/UntrustedInterfaces.java Thu Feb 19 13:24:50 2015 -0800 @@ -45,20 +45,20 @@ * public void setField() { * field = new TestConstant(); * } - * + * * public void setStaticField() { * staticField = new TestConstant(); * } - * + * * public int callMe(CallBack callback) { * return callback.callBack(new TestConstant()); * } - * + * * public TestInterface get() { * return new TestConstant(); * } * } - * + * * private static final class TestConstant implements TestInterface { * public int method() { * return 42;
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6753639.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6753639.java Thu Feb 19 13:24:50 2015 -0800 @@ -30,7 +30,7 @@ * @test * @bug 6753639 * @summary Strange optimisation in for loop with cyclic integer condition - * + * * @run main/othervm -Xbatch Test6753639 */ // @formatter:off
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/LongToSomethingArray01.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/LongToSomethingArray01.java Thu Feb 19 13:24:50 2015 -0800 @@ -28,7 +28,7 @@ /** * inspired by java.security.SecureRandom.longToByteArray(long). - * + * */ public class LongToSomethingArray01 extends JTTTest {
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMap.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMap.java Thu Feb 19 13:24:50 2015 -0800 @@ -36,7 +36,7 @@ * * <pre> * Base Contents - * + * * : : ----- * caller | incoming overflow argument n | ^ * frame : ... : | positive
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMap.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMap.java Thu Feb 19 13:24:50 2015 -0800 @@ -35,7 +35,7 @@ * * <pre> * Base Contents - * + * * : : ----- * caller | incoming overflow argument n | ^ * frame : ... : | positive
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SwitchStrategy.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SwitchStrategy.java Thu Feb 19 13:24:50 2015 -0800 @@ -31,7 +31,7 @@ /** * This class encapsulates different strategies on how to generate code for switch instructions. - * + * * The {@link #getBestStrategy(double[], JavaConstant[], LabelRef[])} method can be used to get * strategy with the smallest average effort (average number of comparisons until a decision is * reached). The strategy returned by this method will have its averageEffort set, while a strategy @@ -43,7 +43,7 @@ /** * Generates a conditional or unconditional jump. The jump will be unconditional if * condition is null. If defaultTarget is true, then the jump will go the the default. - * + * * @param index Index of the value and the jump target (only used if defaultTarget == false) * @param condition The condition on which to jump (can be null) * @param defaultTarget true if the jump should go to the default target, false if index @@ -54,7 +54,7 @@ /** * Generates a conditional jump to the target with the specified index. The fall through * should go to the default target. - * + * * @param index Index of the value and the jump target * @param condition The condition on which to jump * @param canFallThrough true if this is the last instruction in the switch statement, to @@ -64,7 +64,7 @@ /** * Create a new label and generate a conditional jump to it. - * + * * @param index Index of the value and the jump target * @param condition The condition on which to jump * @return a new Label
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/Range.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/Range.java Thu Feb 19 13:24:50 2015 -0800 @@ -50,7 +50,7 @@ /** * Creates a new range. - * + * * @param from the start of the range, inclusive * @param to the end of the range, exclusive * @param next link to the next range in a linked list
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Thu Feb 19 13:24:50 2015 -0800 @@ -332,7 +332,7 @@ * VirtualState nodes contained in the old exit's state may be shared by other * dominated VirtualStates. Those dominated virtual states need to see the * proxy->phi update that are applied below. - * + * * We now update the original fragment's nodes accordingly: */ originalExitState.applyToVirtual(node -> original.nodes.clearAndGrow(node));
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNodeUtil.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNodeUtil.java Thu Feb 19 13:24:50 2015 -0800 @@ -88,7 +88,7 @@ * Converts a given instruction to a value string. The representation of an node as a value is * formed by concatenating the {@linkplain com.oracle.graal.api.meta.Kind#getTypeChar character} * denoting its {@linkplain ValueNode#getKind kind} and its id. For example, {@code "i13"}. - * + * * @param value the instruction to convert to a value string. If {@code value == null}, then "-" * is returned. * @return the instruction representation as a string
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Thu Feb 19 13:24:50 2015 -0800 @@ -92,7 +92,7 @@ /* * One of the two objects has identity, the other doesn't. In code, this looks like * "Integer.valueOf(a) == new Integer(b)", which is always false. - * + * * In other words: an object created via valueOf can never be equal to one created * by new in the same compilation unit. */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/PiPushable.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/PiPushable.java Thu Feb 19 13:24:50 2015 -0800 @@ -30,7 +30,7 @@ public interface PiPushable { /** - * + * * @param parent PiNode * @return true if node was moved */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Virtualizable.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Virtualizable.java Thu Feb 19 13:24:50 2015 -0800 @@ -60,7 +60,7 @@ * tool, and not directly on the node, because by the time this method is called the * virtualized/non-virtualized state is still speculative and might not hold because of loops, * etc. - * + * * @param tool the tool used to describe the effects of this node */ void virtualize(VirtualizerTool tool);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizableAllocation.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizableAllocation.java Thu Feb 19 13:24:50 2015 -0800 @@ -25,7 +25,7 @@ /** * This interface allows a node to convey information about what its effect would be if some of its * inputs were virtualized. - * + * * The difference to {@link VirtualizableRoot} is that removing {@link VirtualizableAllocation} * nodes is not considered progress during the escape analysis iterations. */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizableRoot.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizableRoot.java Thu Feb 19 13:24:50 2015 -0800 @@ -25,12 +25,12 @@ /** * This interface allows a node to convey information about what its effect would be if some of its * inputs were virtualized. - * + * * The difference to {@link Virtualizable} is that the {@link #virtualize(VirtualizerTool)} method * will be called regardless of whether this node had any interaction with virtualized nodes. This * interface can therefore be used for object allocations, for which virtualization introduces new * virtualized objects. - * + * */ public interface VirtualizableRoot extends Virtualizable {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ExpandLogicPhase.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ExpandLogicPhase.java Thu Feb 19 13:24:50 2015 -0800 @@ -60,9 +60,9 @@ double firstIfProbability = shortCircuitProbability; /* * P(Y | not(X)) = P(Y inter not(X)) / P(not(X)) = (P(X union Y) - P(X)) / (1 - P(X)) - * + * * P(X) = shortCircuitProbability - * + * * P(X union Y) = ifNode.probability(trueTarget) */ double secondIfProbability = (ifNode.probability(trueTarget) - shortCircuitProbability) / (1 - shortCircuitProbability);
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/VerifyPhase.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/VerifyPhase.java Thu Feb 19 13:24:50 2015 -0800 @@ -54,7 +54,7 @@ /** * Performs the actual verification. - * + * * @throws VerificationError if the verification fails */ protected abstract boolean verify(StructuredGraph graph, C context);
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ScheduledNodeIterator.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ScheduledNodeIterator.java Thu Feb 19 13:24:50 2015 -0800 @@ -32,7 +32,7 @@ /** * Iterates over a list of nodes, which usually comes from * {@link SchedulePhase#getBlockToNodesMap()}. - * + * * While iterating, it is possible to {@link #insert(FixedNode, FixedWithNextNode) insert} and * {@link #replaceCurrent(FixedWithNextNode) replace} nodes. */
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/BlockWorkList.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/BlockWorkList.java Thu Feb 19 13:24:50 2015 -0800 @@ -37,7 +37,7 @@ /** * Adds a block to this list in an unsorted fashion, like a stack. - * + * * @param block the block to add */ public void add(AbstractMergeNode block) { @@ -55,7 +55,7 @@ /** * Adds a block to this list, sorted by the supplied number. The block with the lowest number is * returned upon subsequent removes. - * + * * @param block the block to add * @param number the number used to sort the block */ @@ -89,7 +89,7 @@ * Removes the next block from this work list. If the blocks have been added in a sorted order, * then the block with the lowest number is returned. Otherwise, the last block added is * returned. - * + * * @return the next block in the list */ public AbstractMergeNode removeFromWorkList() { @@ -101,7 +101,7 @@ /** * Checks whether the list is empty. - * + * * @return {@code true} if this list is empty */ public boolean isEmpty() {
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/HexCodeFile.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/HexCodeFile.java Thu Feb 19 13:24:50 2015 -0800 @@ -39,23 +39,23 @@ * * <pre> * HexCodeFile ::= Platform Delim HexCode Delim (OptionalSection Delim)* - * + * * OptionalSection ::= Comment | OperandComment | JumpTable | LookupTable - * + * * Platform ::= "Platform" ISA WordWidth - * + * * HexCode ::= "HexCode" StartAddress HexDigits - * + * * Comment ::= "Comment" Position String - * + * * OperandComment ::= "OperandComment" Position String - * + * * JumpTable ::= "JumpTable" Position EntrySize Low High - * + * * LookupTable ::= "LookupTable" Position NPairs KeySize OffsetSize - * + * * Position, EntrySize, Low, High, NPairs KeySize OffsetSize ::= int - * + * * Delim := "<||@" * </pre> *
--- a/graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/APHotSpotSignature.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/APHotSpotSignature.java Thu Feb 19 13:24:50 2015 -0800 @@ -149,7 +149,7 @@ /** * Returns the kind from the character describing a primitive or void. - * + * * @param ch the character * @return the kind */
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/Log.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/Log.java Thu Feb 19 13:24:50 2015 -0800 @@ -80,7 +80,7 @@ /** * Prints a formatted string to the log stream. - * + * * @param format a C style printf format value that can contain at most one conversion specifier * (i.e., a sequence of characters starting with '%'). * @param value the value associated with the conversion specifier
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java Thu Feb 19 13:24:50 2015 -0800 @@ -114,7 +114,7 @@ return true; } - @SuppressWarnings("serial") private static final JavaConstant COULD_NOT_FOLD = new PrimitiveConstant(Kind.Illegal, 100) { + @SuppressWarnings("serial") public static final JavaConstant COULD_NOT_FOLD = new PrimitiveConstant(Kind.Illegal, 100) { @Override public boolean equals(Object o) { return this == o; @@ -183,14 +183,14 @@ /** * Permits a subclass to override the default definition of "intrinsic". */ - protected NodeIntrinsic getIntrinsic(ResolvedJavaMethod method) { + public NodeIntrinsic getIntrinsic(ResolvedJavaMethod method) { return method.getAnnotation(Node.NodeIntrinsic.class); } /** * Permits a subclass to override the default definition of "foldable". */ - protected boolean isFoldable(ResolvedJavaMethod method) { + public boolean isFoldable(ResolvedJavaMethod method) { return method.getAnnotation(Fold.class) != null; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java Thu Feb 19 13:24:50 2015 -0800 @@ -0,0 +1,280 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.replacements; + +import static com.oracle.graal.api.code.MemoryBarriers.*; +import static com.oracle.graal.java.GraphBuilderContext.*; +import static java.lang.Character.*; +import sun.misc.*; + +import com.oracle.graal.api.directives.*; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.java.*; +import com.oracle.graal.java.GraphBuilderPlugin.InvocationPlugin; +import com.oracle.graal.java.InvocationPlugins.Registration; +import com.oracle.graal.java.InvocationPlugins.Registration.Receiver; +import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.calc.*; +import com.oracle.graal.nodes.debug.*; +import com.oracle.graal.nodes.extended.*; +import com.oracle.graal.nodes.java.*; +import com.oracle.graal.replacements.nodes.*; + +/** + * Provides non-runtime specific {@link InvocationPlugin}s. + */ +public class StandardGraphBuilderPlugins { + + public static void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + registerObjectPlugins(metaAccess, plugins); + registerMathPlugins(metaAccess, plugins); + registerUnsafePlugins(metaAccess, plugins); + registerGraalDirectivesPlugins(metaAccess, plugins); + } + + public static void registerUnsafePlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, Unsafe.class); + for (Kind kind : Kind.values()) { + if ((kind.isPrimitive() && kind != Kind.Void) || kind == Kind.Object) { + String kindName = kind.getJavaName(); + kindName = toUpperCase(kindName.charAt(0)) + kindName.substring(1); + String getName = "get" + kindName; + String putName = "put" + kindName; + r.register3(getName, Receiver.class, Object.class, long.class, new UnsafeGetPlugin(kind, false)); + r.register4(putName, Receiver.class, Object.class, long.class, kind == Kind.Object ? Object.class : kind.toJavaClass(), new UnsafePutPlugin(kind, false)); + r.register3(getName + "Volatile", Receiver.class, Object.class, long.class, new UnsafeGetPlugin(kind, true)); + r.register4(putName + "Volatile", Receiver.class, Object.class, long.class, kind == Kind.Object ? Object.class : kind.toJavaClass(), new UnsafePutPlugin(kind, true)); + if (kind != Kind.Boolean && kind != Kind.Object) { + r.register2(getName, Receiver.class, long.class, new UnsafeGetPlugin(kind, false)); + r.register3(putName, Receiver.class, long.class, kind.toJavaClass(), new UnsafePutPlugin(kind, false)); + } + } + } + } + + public static void registerMathPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, Math.class); + r.register1("abs", Float.TYPE, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode value) { + builder.push(Kind.Float, builder.append(new AbsNode(value))); + return true; + } + }); + r.register1("abs", Double.TYPE, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode value) { + builder.push(Kind.Double, builder.append(new AbsNode(value))); + return true; + } + }); + r.register1("sqrt", Double.TYPE, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode value) { + builder.push(Kind.Double, builder.append(new SqrtNode(value))); + return true; + } + }); + + for (Kind kind : Kind.values()) { + if (kind.isPrimitive() && kind != Kind.Void) { + new BoxPlugin(kind).register(metaAccess, plugins); + new UnboxPlugin(kind).register(metaAccess, plugins); + } + } + } + + public static void registerObjectPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, Object.class); + r.register1("<init>", Receiver.class, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode object) { + if (RegisterFinalizerNode.mayHaveFinalizer(object, builder.getAssumptions())) { + builder.append(new RegisterFinalizerNode(object)); + } + return true; + } + }); + } + + static class BoxPlugin implements InvocationPlugin { + + private final Kind kind; + + BoxPlugin(Kind kind) { + this.kind = kind; + } + + public boolean apply(GraphBuilderContext builder, ValueNode value) { + ResolvedJavaType resultType = builder.getMetaAccess().lookupJavaType(kind.toBoxedJavaClass()); + builder.push(Kind.Object, builder.append(new BoxNode(value, resultType, kind))); + return true; + } + + void register(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + ResolvedJavaMethod method = Registration.resolve(metaAccess, kind.toBoxedJavaClass(), "valueOf", kind.toJavaClass()); + plugins.register(method, this); + } + } + + static class UnboxPlugin implements InvocationPlugin { + + private final Kind kind; + + UnboxPlugin(Kind kind) { + this.kind = kind; + } + + public boolean apply(GraphBuilderContext builder, ValueNode value) { + ValueNode valueNode = UnboxNode.create(builder.getMetaAccess(), builder.getConstantReflection(), nullCheckedValue(builder, value), kind); + builder.push(kind.getStackKind(), builder.append(valueNode)); + return true; + } + + void register(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + String name = kind.toJavaClass().getSimpleName() + "Value"; + ResolvedJavaMethod method = Registration.resolve(metaAccess, kind.toBoxedJavaClass(), name); + plugins.register(method, this); + } + } + + static class UnsafeGetPlugin implements InvocationPlugin { + + private final Kind returnKind; + private final boolean isVolatile; + + public UnsafeGetPlugin(Kind returnKind, boolean isVolatile) { + this.returnKind = returnKind; + this.isVolatile = isVolatile; + } + + public boolean apply(GraphBuilderContext builder, ValueNode ignoredUnsafe, ValueNode address) { + builder.push(returnKind.getStackKind(), builder.append(new DirectReadNode(address, returnKind))); + return true; + } + + public boolean apply(GraphBuilderContext builder, ValueNode ignoredUnsafe, ValueNode object, ValueNode offset) { + if (isVolatile) { + builder.append(new MembarNode(JMM_PRE_VOLATILE_READ)); + } + builder.push(returnKind.getStackKind(), builder.append(new UnsafeLoadNode(object, offset, returnKind, LocationIdentity.ANY_LOCATION))); + if (isVolatile) { + builder.append(new MembarNode(JMM_POST_VOLATILE_READ)); + } + return true; + } + } + + static class UnsafePutPlugin implements InvocationPlugin { + + private final Kind kind; + private final boolean isVolatile; + + public UnsafePutPlugin(Kind kind, boolean isVolatile) { + this.kind = kind; + this.isVolatile = isVolatile; + } + + public boolean apply(GraphBuilderContext builder, ValueNode ignoredUnsafe, ValueNode address, ValueNode value) { + builder.append(new DirectStoreNode(address, value, kind)); + return true; + } + + public boolean apply(GraphBuilderContext builder, ValueNode ignoredUnsafe, ValueNode object, ValueNode offset, ValueNode value) { + if (isVolatile) { + builder.append(new MembarNode(JMM_PRE_VOLATILE_WRITE)); + } + builder.append(new UnsafeStoreNode(object, offset, value, kind, LocationIdentity.ANY_LOCATION)); + if (isVolatile) { + builder.append(new MembarNode(JMM_PRE_VOLATILE_WRITE)); + } + return true; + } + } + + public static void registerGraalDirectivesPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, GraalDirectives.class); + r.register0("deoptimize", new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder) { + builder.append(new DeoptimizeNode(DeoptimizationAction.None, DeoptimizationReason.TransferToInterpreter)); + return true; + } + }); + + r.register0("deoptimizeAndInvalidate", new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder) { + builder.append(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TransferToInterpreter)); + return true; + } + }); + + r.register0("inCompiledCode", new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder) { + builder.push(Kind.Int, builder.append(ConstantNode.forInt(1))); + return true; + } + }); + + r.register0("controlFlowAnchor", new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder) { + builder.append(new ControlFlowAnchorNode()); + return true; + } + }); + + r.register2("injectBranchProbability", double.class, boolean.class, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode probability, ValueNode condition) { + builder.push(Kind.Int, builder.append(new BranchProbabilityNode(probability, condition))); + return true; + } + }); + + InvocationPlugin blackholePlugin = new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode value) { + builder.append(new BlackholeNode(value)); + return true; + } + }; + + for (Kind kind : Kind.values()) { + Class<?> cls = null; + switch (kind) { + case Object: + cls = Object.class; + break; + case Void: + case Illegal: + continue; + default: + cls = kind.toJavaClass(); + } + + r.register1("blackhole", cls, blackholePlugin); + + final Kind stackKind = kind.getStackKind(); + r.register1("opaque", cls, new InvocationPlugin() { + public boolean apply(GraphBuilderContext builder, ValueNode value) { + builder.push(stackKind, builder.append(new OpaqueNode(value))); + return true; + } + }); + } + } + +}
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ArrayEqualsNode.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ArrayEqualsNode.java Thu Feb 19 13:24:50 2015 -0800 @@ -53,7 +53,8 @@ public ArrayEqualsNode(ValueNode array1, ValueNode array2, ValueNode length) { super(TYPE, StampFactory.forKind(Kind.Boolean)); - assert array1.stamp().equals(array2.stamp()); + // Ignore nullness in stamp equality test + assert array1.stamp().join(StampFactory.objectNonNull()).equals(array2.stamp().join(StampFactory.objectNonNull())); ObjectStamp array1Stamp = (ObjectStamp) array1.stamp(); ResolvedJavaType componentType = array1Stamp.type().getComponentType(); this.kind = componentType.getKind();
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BasicObjectCloneNode.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BasicObjectCloneNode.java Thu Feb 19 13:24:50 2015 -0800 @@ -64,7 +64,7 @@ /* * Looks at the given stamp and determines if it is an exact type (or can be assumed to be an * exact type) and if it is a cloneable type. - * + * * If yes, then the exact type is returned, otherwise it returns null. */ protected static ResolvedJavaType getConcreteType(Stamp stamp, Assumptions assumptions, MetaAccessProvider metaAccess) {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectReadNode.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectReadNode.java Thu Feb 19 13:24:50 2015 -0800 @@ -54,9 +54,9 @@ } /** - * If we are sub it sizes, we try to sign/zero extend the value to at least int as it is done in - * the {@link com.oracle.graal.replacements.DefaultJavaLoweringProvider#implicitLoadConvert} and - * {@link com.oracle.graal.replacements.DefaultJavaLoweringProvider#createUnsafeRead}. + * If we are sub int sizes, we try to sign/zero extend the value to at least int as it is done + * in the {@link com.oracle.graal.replacements.DefaultJavaLoweringProvider#implicitLoadConvert} + * and {@link com.oracle.graal.replacements.DefaultJavaLoweringProvider#createUnsafeRead}. * * @see com.oracle.graal.replacements.DefaultJavaLoweringProvider#implicitLoadConvert * @see com.oracle.graal.replacements.DefaultJavaLoweringProvider#createUnsafeRead
--- a/graal/com.oracle.graal.runtime/src/com/oracle/graal/runtime/RuntimeProvider.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.runtime/src/com/oracle/graal/runtime/RuntimeProvider.java Thu Feb 19 13:24:50 2015 -0800 @@ -37,7 +37,7 @@ /** * Gets the backend for a given architecture. - * + * * @param arch a specific architecture class */ <T extends Architecture> Backend getBackend(Class<T> arch);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java Thu Feb 19 13:24:50 2015 -0800 @@ -52,7 +52,21 @@ public class TruffleGraphBuilderPlugins { public static void registerInvocationPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { - // OptimizedAssumption.class + registerOptimizedAssumptionPlugins(metaAccess, plugins); + registerExactMathPlugins(metaAccess, plugins); + registerCompilerDirectivesPlugins(metaAccess, plugins); + registerOptimizedCallTargetPlugins(metaAccess, plugins); + registerUnsafeAccessImplPlugins(metaAccess, plugins); + + if (TruffleCompilerOptions.TruffleUseFrameWithoutBoxing.getValue()) { + registerFrameWithoutBoxingPlugins(metaAccess, plugins); + } else { + registerFrameWithBoxingPlugins(metaAccess, plugins); + } + + } + + public static void registerOptimizedAssumptionPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { Registration r = new Registration(plugins, metaAccess, OptimizedAssumption.class); r.register1("isValid", Receiver.class, new InvocationPlugin() { public boolean apply(GraphBuilderContext builder, ValueNode arg) { @@ -69,9 +83,10 @@ return true; } }); + } - // ExactMath.class - r = new Registration(plugins, metaAccess, ExactMath.class); + public static void registerExactMathPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, ExactMath.class); r.register2("addExact", Integer.TYPE, Integer.TYPE, new InvocationPlugin() { public boolean apply(GraphBuilderContext builder, ValueNode x, ValueNode y) { builder.push(Kind.Int.getStackKind(), builder.append(new IntegerAddExactNode(x, y))); @@ -108,9 +123,10 @@ return true; } }); + } - // CompilerDirectives.class - r = new Registration(plugins, metaAccess, CompilerDirectives.class); + public static void registerCompilerDirectivesPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, CompilerDirectives.class); r.register0("inInterpreter", new InvocationPlugin() { public boolean apply(GraphBuilderContext builder) { builder.push(Kind.Boolean.getStackKind(), builder.append(ConstantNode.forBoolean(false))); @@ -175,9 +191,10 @@ return true; } }); + } - // OptimizedCallTarget.class - r = new Registration(plugins, metaAccess, OptimizedCallTarget.class); + public static void registerOptimizedCallTargetPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, OptimizedCallTarget.class); r.register2("createFrame", FrameDescriptor.class, Object[].class, new InvocationPlugin() { public boolean apply(GraphBuilderContext builder, ValueNode arg1, ValueNode arg2) { Class<?> frameClass = TruffleCompilerOptions.TruffleUseFrameWithoutBoxing.getValue() ? FrameWithoutBoxing.class : FrameWithBoxing.class; @@ -185,22 +202,23 @@ return true; } }); + } - if (TruffleCompilerOptions.TruffleUseFrameWithoutBoxing.getValue()) { - // FrameWithoutBoxing.class - r = new Registration(plugins, metaAccess, FrameWithoutBoxing.class); - registerMaterialize(r); - registerUnsafeCast(r); - registerUnsafeLoadStorePlugins(r, Kind.Int, Kind.Long, Kind.Float, Kind.Double, Kind.Object); - } else { - // FrameWithBoxing.class - r = new Registration(plugins, metaAccess, FrameWithBoxing.class); - registerMaterialize(r); - registerUnsafeCast(r); - } + public static void registerFrameWithoutBoxingPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, FrameWithoutBoxing.class); + registerMaterialize(r); + registerUnsafeCast(r); + registerUnsafeLoadStorePlugins(r, Kind.Int, Kind.Long, Kind.Float, Kind.Double, Kind.Object); + } - // CompilerDirectives.class - r = new Registration(plugins, metaAccess, UnsafeAccessImpl.class); + public static void registerFrameWithBoxingPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, FrameWithBoxing.class); + registerMaterialize(r); + registerUnsafeCast(r); + } + + public static void registerUnsafeAccessImplPlugins(MetaAccessProvider metaAccess, InvocationPlugins plugins) { + Registration r = new Registration(plugins, metaAccess, UnsafeAccessImpl.class); registerUnsafeCast(r); registerUnsafeLoadStorePlugins(r, Kind.Boolean, Kind.Byte, Kind.Int, Kind.Short, Kind.Long, Kind.Float, Kind.Double, Kind.Object); }
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Signed.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Signed.java Thu Feb 19 13:24:50 2015 -0800 @@ -26,7 +26,7 @@ /** * Returns a Signed whose value is {@code (this + val)}. - * + * * @param val value to be added to this Signed. * @return {@code this + val} */ @@ -34,7 +34,7 @@ /** * Returns a Signed whose value is {@code (this - val)}. - * + * * @param val value to be subtracted from this Signed. * @return {@code this - val} */ @@ -42,7 +42,7 @@ /** * Returns a Signed whose value is {@code (this * val)}. - * + * * @param val value to be multiplied by this Signed. * @return {@code this * val} */ @@ -50,7 +50,7 @@ /** * Returns a Signed whose value is {@code (this / val)}. - * + * * @param val value by which this Signed is to be divided. * @return {@code this / val} */ @@ -58,7 +58,7 @@ /** * Returns a Signed whose value is {@code (this % val)}. - * + * * @param val value by which this Signed is to be divided, and the remainder computed. * @return {@code this % val} */ @@ -66,7 +66,7 @@ /** * Returns a Signed whose value is {@code (this << n)}. - * + * * @param n shift distance, in bits. * @return {@code this << n} */ @@ -74,7 +74,7 @@ /** * Returns a Signed whose value is {@code (this >> n)}. Sign extension is performed. - * + * * @param n shift distance, in bits. * @return {@code this >> n} */ @@ -83,7 +83,7 @@ /** * Returns a Signed whose value is {@code (this & val)}. (This method returns a negative Signed * if and only if this and val are both negative.) - * + * * @param val value to be AND'ed with this Signed. * @return {@code this & val} */ @@ -92,7 +92,7 @@ /** * Returns a Signed whose value is {@code (this | val)}. (This method returns a negative Signed * if and only if either this or val is negative.) - * + * * @param val value to be OR'ed with this Signed. * @return {@code this | val} */ @@ -101,7 +101,7 @@ /** * Returns a Signed whose value is {@code (this ^ val)}. (This method returns a negative Signed * if and only if exactly one of this and val are negative.) - * + * * @param val value to be XOR'ed with this Signed. * @return {@code this ^ val} */ @@ -110,14 +110,14 @@ /** * Returns a Signed whose value is {@code (~this)}. (This method returns a negative value if and * only if this Signed is non-negative.) - * + * * @return {@code ~this} */ Signed not(); /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this == val} */ @@ -125,7 +125,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this != val} */ @@ -133,7 +133,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this < val} */ @@ -141,7 +141,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this <= val} */ @@ -149,7 +149,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this > val} */ @@ -157,7 +157,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this >= val} */ @@ -165,7 +165,7 @@ /** * Returns a Signed whose value is {@code (this + val)}. - * + * * @param val value to be added to this Signed. * @return {@code this + val} */ @@ -173,7 +173,7 @@ /** * Returns a Signed whose value is {@code (this - val)}. - * + * * @param val value to be subtracted from this Signed. * @return {@code this - val} */ @@ -181,7 +181,7 @@ /** * Returns a Signed whose value is {@code (this * val)}. - * + * * @param val value to be multiplied by this Signed. * @return {@code this * val} */ @@ -189,7 +189,7 @@ /** * Returns a Signed whose value is {@code (this / val)}. - * + * * @param val value by which this Signed is to be divided. * @return {@code this / val} */ @@ -197,7 +197,7 @@ /** * Returns a Signed whose value is {@code (this % val)}. - * + * * @param val value by which this Signed is to be divided, and the remainder computed. * @return {@code this % val} */ @@ -205,7 +205,7 @@ /** * Returns a Signed whose value is {@code (this << n)}. - * + * * @param n shift distance, in bits. * @return {@code this << n} */ @@ -213,7 +213,7 @@ /** * Returns a Signed whose value is {@code (this >> n)}. Sign extension is performed. - * + * * @param n shift distance, in bits. * @return {@code this >> n} */ @@ -222,7 +222,7 @@ /** * Returns a Signed whose value is {@code (this & val)}. (This method returns a negative Signed * if and only if this and val are both negative.) - * + * * @param val value to be AND'ed with this Signed. * @return {@code this & val} */ @@ -231,7 +231,7 @@ /** * Returns a Signed whose value is {@code (this | val)}. (This method returns a negative Signed * if and only if either this or val is negative.) - * + * * @param val value to be OR'ed with this Signed. * @return {@code this | val} */ @@ -240,7 +240,7 @@ /** * Returns a Signed whose value is {@code (this ^ val)}. (This method returns a negative Signed * if and only if exactly one of this and val are negative.) - * + * * @param val value to be XOR'ed with this Signed. * @return {@code this ^ val} */ @@ -248,7 +248,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this == val} */ @@ -256,7 +256,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this != val} */ @@ -264,7 +264,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this < val} */ @@ -272,7 +272,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this <= val} */ @@ -280,7 +280,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this > val} */ @@ -288,7 +288,7 @@ /** * Compares this Signed with the specified value. - * + * * @param val value to which this Signed is to be compared. * @return {@code this >= val} */
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Unsigned.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Unsigned.java Thu Feb 19 13:24:50 2015 -0800 @@ -26,7 +26,7 @@ /** * Returns a Unsigned whose value is {@code (this + val)}. - * + * * @param val value to be added to this Unsigned. * @return {@code this + val} */ @@ -34,7 +34,7 @@ /** * Returns a Unsigned whose value is {@code (this - val)}. - * + * * @param val value to be subtracted from this Unsigned. * @return {@code this - val} */ @@ -42,7 +42,7 @@ /** * Returns a Unsigned whose value is {@code (this * val)}. - * + * * @param val value to be multiplied by this Unsigned. * @return {@code this * val} */ @@ -50,7 +50,7 @@ /** * Returns a Unsigned whose value is {@code (this / val)}. - * + * * @param val value by which this Unsigned is to be divided. * @return {@code this / val} */ @@ -58,7 +58,7 @@ /** * Returns a Unsigned whose value is {@code (this % val)}. - * + * * @param val value by which this Unsigned is to be divided, and the remainder computed. * @return {@code this % val} */ @@ -66,7 +66,7 @@ /** * Returns a Unsigned whose value is {@code (this << n)}. - * + * * @param n shift distance, in bits. * @return {@code this << n} */ @@ -74,7 +74,7 @@ /** * Returns a Unsigned whose value is {@code (this >>> n)}. No sign extension is performed. - * + * * @param n shift distance, in bits. * @return {@code this >> n} */ @@ -82,7 +82,7 @@ /** * Returns a Unsigned whose value is {@code (this & val)}. - * + * * @param val value to be AND'ed with this Unsigned. * @return {@code this & val} */ @@ -90,7 +90,7 @@ /** * Returns a Unsigned whose value is {@code (this | val)}. - * + * * @param val value to be OR'ed with this Unsigned. * @return {@code this | val} */ @@ -98,7 +98,7 @@ /** * Returns a Unsigned whose value is {@code (this ^ val)}. - * + * * @param val value to be XOR'ed with this Unsigned. * @return {@code this ^ val} */ @@ -106,14 +106,14 @@ /** * Returns a Unsigned whose value is {@code (~this)}. - * + * * @return {@code ~this} */ Unsigned not(); /** * Compares this Unsigned with the specified value. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this == val} */ @@ -121,7 +121,7 @@ /** * Compares this Unsigned with the specified value. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this != val} */ @@ -129,7 +129,7 @@ /** * Compares this Unsigned with the specified value. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this < val} */ @@ -137,7 +137,7 @@ /** * Compares this Unsigned with the specified value. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this <= val} */ @@ -145,7 +145,7 @@ /** * Compares this Unsigned with the specified value. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this > val} */ @@ -153,7 +153,7 @@ /** * Compares this Unsigned with the specified value. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this >= val} */ @@ -164,7 +164,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to be added to this Unsigned. * @return {@code this + val} */ @@ -175,7 +175,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to be subtracted from this Unsigned. * @return {@code this - val} */ @@ -186,7 +186,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to be multiplied by this Unsigned. * @return {@code this * val} */ @@ -197,7 +197,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value by which this Unsigned is to be divided. * @return {@code this / val} */ @@ -208,7 +208,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value by which this Unsigned is to be divided, and the remainder computed. * @return {@code this % val} */ @@ -219,7 +219,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param n shift distance, in bits. * @return {@code this << n} */ @@ -230,7 +230,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param n shift distance, in bits. * @return {@code this >> n} */ @@ -241,7 +241,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to be AND'ed with this Unsigned. * @return {@code this & val} */ @@ -252,7 +252,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to be OR'ed with this Unsigned. * @return {@code this | val} */ @@ -263,7 +263,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to be XOR'ed with this Unsigned. * @return {@code this ^ val} */ @@ -274,7 +274,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this == val} */ @@ -285,7 +285,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this != val} */ @@ -296,7 +296,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this < val} */ @@ -307,7 +307,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this <= val} */ @@ -318,7 +318,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this > val} */ @@ -329,7 +329,7 @@ * <p> * Note that the right operand is a signed value, while the operation is performed unsigned. * Therefore, the result is only well-defined for positive right operands. - * + * * @param val value to which this Unsigned is to be compared. * @return {@code this >= val} */
--- a/graal/com.oracle.nfi/src/com/oracle/nfi/api/NativeFunctionPointer.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.nfi/src/com/oracle/nfi/api/NativeFunctionPointer.java Thu Feb 19 13:24:50 2015 -0800 @@ -33,14 +33,14 @@ /** * Returns the name of the function. - * + * * @return name of the function */ String getName(); /** * Returns the raw function pointer value. - * + * * @return raw function pointer value */ long getRawValue();
--- a/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/Implies.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/Implies.java Thu Feb 19 13:24:50 2015 -0800 @@ -28,7 +28,7 @@ /** * Experimental API. - * + * * @deprecated annotation has no effect anymore. */ @Retention(RetentionPolicy.CLASS)
--- a/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/TypeSystem.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/TypeSystem.java Thu Feb 19 13:24:50 2015 -0800 @@ -37,7 +37,7 @@ * concrete type is found first when searching the list sequentially for the type of a given generic * value. * </p> - * + * * <p> * Each {@link #value()} is represented as a java type. A type can specify two annotations: * {@link TypeCheck} and {@link TypeCast}. The {@link TypeCheck} checks whether a given generic @@ -51,30 +51,30 @@ * accept also {@link Integer} values, implicitly converting them to {@link Double} . This example * points out how we express implicit type conversions. * </p> - * + * * <p> * <b>Example:</b> The {@link TypeSystem} contains the types {@link Boolean}, {@link Integer}, and * {@link Double}. The type {@link Object} is always used implicitly as the generic type represent * all values. - * + * * <pre> - * + * * {@literal @}TypeSystem(types = {boolean.class, int.class, double.class}) * public abstract class ExampleTypeSystem { - * + * * {@literal @}TypeCheck * public boolean isInteger(Object value) { * return value instanceof Integer || value instanceof Double; * } - * + * * {@literal @}TypeCast * public double asInteger(Object value) { * return ((Number)value).doubleValue(); * } * } * </pre> - * - * + * + * * @see TypeCast * @see TypeCheck */
--- a/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/TypeSystemReference.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/TypeSystemReference.java Thu Feb 19 13:24:50 2015 -0800 @@ -31,7 +31,7 @@ /** * References a {@link TypeSystem} on a node. Must be applied on a {@link Node} class. At least one * {@link TypeSystem} must be referenced in a {@link Node}'s type hierarchy. - * + * * @see TypeSystem * @see Node */
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/OnAdoptTest.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/OnAdoptTest.java Thu Feb 19 13:24:50 2015 -0800 @@ -30,13 +30,13 @@ /** * <h3>Inserting Extra Nodes into the AST Transparently</h3> - * + * * <p> * The {@link Node} class provides a callback that is invoked whenever a node is adopted in an AST * by insertion or replacement. Node classes can override the {@code onAdopt()} method to run extra * functionality upon adoption. * </p> - * + * * <p> * This test demonstrates how node instances of a specific class can be automatically wrapped in * extra nodes when they are inserted into the AST.
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReplaceTest.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReplaceTest.java Thu Feb 19 13:24:50 2015 -0800 @@ -34,19 +34,19 @@ /** * <h3>Replacing Nodes at Run Time</h3> - * + * * <p> * The structure of the Truffle tree can be changed at run time by replacing nodes using the * {@link Node#replace(Node)} method. This method will automatically change the child pointer in the * parent of the node and replace it with a pointer to the new node. * </p> - * + * * <p> * Replacing nodes is a costly operation, so it should not happen too often. The convention is that * the implementation of the Truffle nodes should ensure that there are maximal a small (and * constant) number of node replacements per Truffle node. * </p> - * + * * <p> * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.CallTest}. * </p>
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameUtil.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameUtil.java Thu Feb 19 13:24:50 2015 -0800 @@ -28,7 +28,7 @@ /** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). - * + * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getObject(FrameSlot) @@ -44,7 +44,7 @@ /** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). - * + * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getByte(FrameSlot) @@ -60,7 +60,7 @@ /** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). - * + * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getBoolean(FrameSlot) @@ -76,7 +76,7 @@ /** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). - * + * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getInt(FrameSlot) @@ -92,7 +92,7 @@ /** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). - * + * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getLong(FrameSlot) @@ -108,7 +108,7 @@ /** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). - * + * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getDouble(FrameSlot) @@ -124,7 +124,7 @@ /** * Read a frame slot that is guaranteed to be of the desired kind (either previously checked by * a guard or statically known). - * + * * @param frameSlot the slot of the variable * @throws IllegalStateException if the slot kind does not match * @see Frame#getFloat(FrameSlot)
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/StandardSyntaxTag.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/StandardSyntaxTag.java Thu Feb 19 13:24:50 2015 -0800 @@ -32,7 +32,7 @@ * (for example for mostly expression-oriented languages) or even for specific languages. * <p> * <strong>Disclaimer:</strong> experimental interface under development. - * + * * @see Probe */ public enum StandardSyntaxTag implements SyntaxTag {
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeVisitor.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeVisitor.java Thu Feb 19 13:24:50 2015 -0800 @@ -32,7 +32,7 @@ /** * This visitor method is called for every node in the tree. Its return value determines if the * children of this node should be excluded in the iteration. - * + * * @param node the node that is currently visited * @return {@code true} if the children should be visited too, {@code false} otherwise */
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java Thu Feb 19 13:24:50 2015 -0800 @@ -72,7 +72,7 @@ * language specific implementations may want to return <code>true</code> here to indicate that * gathering call site specific profiling information might make sense for this {@link RootNode} * . - * + * * @return <code>true</code> if cloning is allowed else <code>false</code>. */ public boolean isCloningAllowed() { @@ -91,7 +91,7 @@ /** * Executes this function using the specified frame and returns the result value. - * + * * @param frame the frame of the currently executing guest language method * @return the value of the execution */ @@ -114,14 +114,14 @@ * the correct <code>ExecutionContext</code> to be determined for a <code>RootNode</code> (and * so also for a {@link RootCallTarget} and a {@link FrameInstance} obtained from the call * stack) without prior knowledge of the language it has come from. - * + * * Used for instance to determine the language of a <code>RootNode<code>: - * + * * <pre> * <code> * rootNode.getExecutionContext().getLanguageShortName(); * </code> </pre> - * + * * Returns <code>null</code> by default. */ public ExecutionContext getExecutionContext() { @@ -151,7 +151,7 @@ * <p> * Implementations should ensure that instrumentation is never applied more than once to an AST, * as this is not guaranteed to be error-free. - * + * * @see Probe#registerASTProber(com.oracle.truffle.api.instrument.ASTProber) */ public void applyInstrumentation() {
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java Thu Feb 19 13:24:50 2015 -0800 @@ -39,7 +39,7 @@ /** * Creates the exception with the alternative result that cannot be represented as a value of * the return type. - * + * * @param result the alternative result */ public UnexpectedResultException(Object result) {
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/serial/SerializerConstantPool.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/serial/SerializerConstantPool.java Thu Feb 19 13:24:50 2015 -0800 @@ -39,7 +39,7 @@ * additional types that are necessary to serialize a truffle AST for a specific truffle * implementation. If a type is not supported by this constant pool implementation a * {@link UnsupportedConstantPoolTypeException} should be thrown. - * + * * @param clazz the {@link Class} of the value * @param value the value to be stored. Must be at least a subclass of the given clazz. * @return the constant pool index @@ -54,7 +54,7 @@ * are necessary to serialize a truffle AST for a specific truffle implementation. If a type is * not supported by this constant pool implementation a * {@link UnsupportedConstantPoolTypeException} should be thrown. - * + * * @param clazz the {@link Class} of the value in the constant pool. * @param cpi the previously returned index * @return the value stored inside the constant pool @@ -66,7 +66,7 @@ /** * Stores a Class instance in the constant pool and returns the constant pool index. - * + * * @param value the class to store * @return the new or existing constant pool index of the Class */ @@ -74,7 +74,7 @@ /** * Returns the {@link Class} instance to the given constant pool index. - * + * * @param cpi the constant pool index * @return stored value * @throws IllegalArgumentException if the constant pool indes is invalid. @@ -83,7 +83,7 @@ /** * Stores an int value in the constant pool and returns the constant pool index. - * + * * @param value the value to store * @return the new or existing constant pool index of the value */ @@ -91,7 +91,7 @@ /** * Returns the stored int value to the given constant pool index from the constant pool. - * + * * @param cpi the constant pool index * @return stored value * @throws IllegalArgumentException if the constant pool index is invalid. @@ -100,7 +100,7 @@ /** * Stores a long value in the constant pool and returns the constant pool index. - * + * * @param value the value to store * @return the new or existing constant pool index of the value */ @@ -108,7 +108,7 @@ /** * Returns the stored long value to the given constant pool index from the constant pool. - * + * * @param cpi the constant pool index * @return the stored value * @throws IllegalArgumentException if the constant pool index is invalid. @@ -117,7 +117,7 @@ /** * Stores a double value in the constant pool and returns the constant pool index. - * + * * @param value the value to store * @return the new or existing constant pool index of the value */ @@ -125,7 +125,7 @@ /** * Returns the stored double value to the given constant pool index from the constant pool. - * + * * @param cpi the constant pool index * @return the stored value * @throws IllegalArgumentException if the constant pool index is invalid. @@ -134,7 +134,7 @@ /** * Stores a float value in the constant pool and returns the constant pool index. - * + * * @param value the value to store * @return the new or existing constant pool index of the value */ @@ -142,7 +142,7 @@ /** * Returns the stored float value to the given constant pool index from the constant pool. - * + * * @param cpi the constant pool index * @return the stored value * @throws IllegalArgumentException if the constant pool index is invalid.
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ConditionProfile.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ConditionProfile.java Thu Feb 19 13:24:50 2015 -0800 @@ -30,24 +30,24 @@ /** * Abstract utility class to speculate on conditions. Condition profiles are intended to be used as * part of if conditions. - * + * * Example usage: - * + * * <pre> * private final ConditionProfile zero = ConditionProfile.createBinaryProfile(); - * + * * int value = ...; * if (zero.profile(value == 0)) { * return 0; * } else { * return value; * } - * + * * </pre> - * + * * All instances of {@code ConditionProfile} (and subclasses) must be held in {@code final} fields * for compiler optimizations to take effect. - * + * * @see #createCountingProfile() * @see #createBinaryProfile() */ @@ -62,7 +62,7 @@ * true and false. This information is reported to the underlying optimization system using * {@link CompilerDirectives#injectBranchProbability(double, boolean)}. Condition profiles are * intended to be used as part of if conditions. - * + * * @see ConditionProfile * @see #createBinaryProfile() */ @@ -73,7 +73,7 @@ /** * Returns a {@link ConditionProfile} that speculates on conditions to be never true or to be * never false. Condition profiles are intended to be used as part of if conditions. - * + * * @see ConditionProfile * @see ConditionProfile#createCountingProfile() */
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ValueProfile.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/ValueProfile.java Thu Feb 19 13:24:50 2015 -0800 @@ -26,18 +26,18 @@ /** * Utility class to speculate on certain properties of values. - * + * * Example usage: - * + * * <pre> * private final ValueProfile classProfile = ValueProfile.createClassProfile(); - * + * * return classProfile.profile(value); * </pre> - * + * * All instances of {@code ValueProfile} (and subclasses) must be held in {@code final} fields for * compiler optimizations to take effect. - * + * * @see #createPrimitiveProfile() * @see #createIdentityProfile() * @see #createClassProfile()
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java Thu Feb 19 11:42:03 2015 -0800 +++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java Thu Feb 19 13:24:50 2015 -0800 @@ -275,8 +275,7 @@ */ @Override @TruffleBoundary - public final Property getProperty(Object key) { - // return this.propertyMap.get(propertyName); + public Property getProperty(Object key) { PropertyMap current = this.propertyMap; while (current.getLastProperty() != null) { if (current.getLastProperty().getKey().equals(key)) { @@ -284,7 +283,6 @@ } current = current.getParentMap(); } - return null; }
--- a/mx/suite.py Thu Feb 19 11:42:03 2015 -0800 +++ b/mx/suite.py Thu Feb 19 13:24:50 2015 -0800 @@ -591,6 +591,7 @@ "dependencies" : [ "com.oracle.graal.compiler", "com.oracle.graal.java", + "com.oracle.graal.api.directives", "com.oracle.graal.word", ], "checkstyle" : "com.oracle.graal.graph", @@ -801,7 +802,6 @@ "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ - "com.oracle.graal.api.directives", "com.oracle.graal.phases", ], "checkstyle" : "com.oracle.graal.graph", @@ -851,6 +851,7 @@ "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ + "com.oracle.graal.api.directives", "com.oracle.graal.test", "com.oracle.graal.printer", "com.oracle.graal.runtime",