Mercurial > hg > graal-jvmci-8
changeset 4142:bc8527f3071c
Adjust code base to new level of warnings.
line wrap: on
line diff
--- a/graal/com.oracle.max.asm/src/com/oracle/max/asm/AbstractAssembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asm/src/com/oracle/max/asm/AbstractAssembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -48,7 +48,7 @@ l.patchInstructions(this); } - protected abstract void patchJumpTarget(int branch, int target); + protected abstract void patchJumpTarget(int branch, int jumpTarget); protected final void emitByte(int x) { codeBuffer.emitByte(x);
--- a/graal/com.oracle.max.asm/src/com/oracle/max/asm/Buffer.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asm/src/com/oracle/max/asm/Buffer.java Sun Dec 18 05:24:06 2011 +0100 @@ -112,9 +112,10 @@ public int emitByte(int b, int pos) { assert NumUtil.isUByte(b); - ensureSize(pos + 1); - data[pos++] = (byte) (b & 0xFF); - return pos; + int newPos = pos + 1; + ensureSize(newPos); + data[pos] = (byte) (b & 0xFF); + return newPos; } public abstract int emitShort(int b, int pos); @@ -135,34 +136,37 @@ @Override public int emitShort(int b, int pos) { assert NumUtil.isUShort(b); + int newPos = pos + 2; ensureSize(pos + 2); - data[pos++] = (byte) ((b >> 8) & 0xFF); - data[pos++] = (byte) (b & 0xFF); - return pos; + data[pos] = (byte) ((b >> 8) & 0xFF); + data[pos + 1] = (byte) (b & 0xFF); + return newPos; } @Override public int emitInt(int b, int pos) { - ensureSize(pos + 4); - data[pos++] = (byte) ((b >> 24) & 0xFF); - data[pos++] = (byte) ((b >> 16) & 0xFF); - data[pos++] = (byte) ((b >> 8) & 0xFF); - data[pos++] = (byte) (b & 0xFF); - return pos; + int newPos = pos + 4; + ensureSize(newPos); + data[pos] = (byte) ((b >> 24) & 0xFF); + data[pos + 1] = (byte) ((b >> 16) & 0xFF); + data[pos + 2] = (byte) ((b >> 8) & 0xFF); + data[pos + 3] = (byte) (b & 0xFF); + return newPos; } @Override public int emitLong(long b, int pos) { - ensureSize(pos + 8); - data[pos++] = (byte) ((b >> 56) & 0xFF); - data[pos++] = (byte) ((b >> 48) & 0xFF); - data[pos++] = (byte) ((b >> 40) & 0xFF); - data[pos++] = (byte) ((b >> 32) & 0xFF); - data[pos++] = (byte) ((b >> 24) & 0xFF); - data[pos++] = (byte) ((b >> 16) & 0xFF); - data[pos++] = (byte) ((b >> 8) & 0xFF); - data[pos++] = (byte) (b & 0xFF); - return pos; + int newPos = pos + 8; + ensureSize(newPos); + data[pos] = (byte) ((b >> 56) & 0xFF); + data[pos + 1] = (byte) ((b >> 48) & 0xFF); + data[pos + 2] = (byte) ((b >> 40) & 0xFF); + data[pos + 3] = (byte) ((b >> 32) & 0xFF); + data[pos + 4] = (byte) ((b >> 24) & 0xFF); + data[pos + 5] = (byte) ((b >> 16) & 0xFF); + data[pos + 6] = (byte) ((b >> 8) & 0xFF); + data[pos + 7] = (byte) (b & 0xFF); + return newPos; } @Override @@ -186,34 +190,37 @@ @Override public int emitShort(int b, int pos) { assert NumUtil.isUShort(b); - ensureSize(pos + 2); - data[pos++] = (byte) (b & 0xFF); - data[pos++] = (byte) ((b >> 8) & 0xFF); - return pos; + int newPos = pos + 2; + ensureSize(newPos); + data[pos] = (byte) (b & 0xFF); + data[pos + 1] = (byte) ((b >> 8) & 0xFF); + return newPos; } @Override public int emitInt(int b, int pos) { - ensureSize(pos + 4); - data[pos++] = (byte) (b & 0xFF); - data[pos++] = (byte) ((b >> 8) & 0xFF); - data[pos++] = (byte) ((b >> 16) & 0xFF); - data[pos++] = (byte) ((b >> 24) & 0xFF); - return pos; + int newPos = pos + 4; + ensureSize(newPos); + data[pos] = (byte) (b & 0xFF); + data[pos + 1] = (byte) ((b >> 8) & 0xFF); + data[pos + 2] = (byte) ((b >> 16) & 0xFF); + data[pos + 3] = (byte) ((b >> 24) & 0xFF); + return newPos; } @Override public int emitLong(long b, int pos) { - ensureSize(pos + 8); - data[pos++] = (byte) (b & 0xFF); - data[pos++] = (byte) ((b >> 8) & 0xFF); - data[pos++] = (byte) ((b >> 16) & 0xFF); - data[pos++] = (byte) ((b >> 24) & 0xFF); - data[pos++] = (byte) ((b >> 32) & 0xFF); - data[pos++] = (byte) ((b >> 40) & 0xFF); - data[pos++] = (byte) ((b >> 48) & 0xFF); - data[pos++] = (byte) ((b >> 56) & 0xFF); - return pos; + int newPos = pos + 8; + ensureSize(newPos); + data[pos] = (byte) (b & 0xFF); + data[pos + 1] = (byte) ((b >> 8) & 0xFF); + data[pos + 2] = (byte) ((b >> 16) & 0xFF); + data[pos + 3] = (byte) ((b >> 24) & 0xFF); + data[pos + 4] = (byte) ((b >> 32) & 0xFF); + data[pos + 5] = (byte) ((b >> 40) & 0xFF); + data[pos + 6] = (byte) ((b >> 48) & 0xFF); + data[pos + 7] = (byte) ((b >> 56) & 0xFF); + return newPos; } @Override
--- a/graal/com.oracle.max.asm/src/com/oracle/max/asm/Label.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asm/src/com/oracle/max/asm/Label.java Sun Dec 18 05:24:06 2011 +0100 @@ -35,7 +35,7 @@ * These instructions need to be patched when the label is bound * using the {@link #patchInstructions(AbstractAssembler)} method. */ - private ArrayList<Integer> patchPositions = new ArrayList<Integer>(4); + private ArrayList<Integer> patchPositions = new ArrayList<>(4); /** * Returns the position of this label in the code buffer.
--- a/graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64Assembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64Assembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -688,10 +688,10 @@ emitOperandHelper(rax, dst); } - public final void jcc(ConditionFlag cc, int target, boolean forceDisp32) { + public final void jcc(ConditionFlag cc, int jumpTarget, boolean forceDisp32) { int shortSize = 2; int longSize = 6; - long disp = target - codeBuffer.position(); + long disp = jumpTarget - codeBuffer.position(); if (!forceDisp32 && isByte(disp - shortSize)) { // 0111 tttn #8-bit disp emitByte(0x70 | cc.value); @@ -745,10 +745,10 @@ emitOperandHelper(rsp, adr); } - public final void jmp(int target, boolean forceDisp32) { + public final void jmp(int jumpTarget, boolean forceDisp32) { int shortSize = 2; int longSize = 5; - long disp = target - codeBuffer.position(); + long disp = jumpTarget - codeBuffer.position(); if (!forceDisp32 && isByte(disp - shortSize)) { emitByte(0xEB); emitByte((int) ((disp - shortSize) & 0xFF)); @@ -1278,7 +1278,8 @@ nop(1); } - public void nop(int i) { + public void nop(int count) { + int i = count; if (AsmOptions.UseNormalNop) { assert i > 0 : " "; // The fancy nops aren't currently recognized by debuggers making it a @@ -2123,7 +2124,7 @@ int prefixAndEncode(int regEnc, boolean byteinst) { if (regEnc >= 8) { emitByte(Prefix.REXB); - regEnc -= 8; + return regEnc - 8; } else if (byteinst && regEnc >= 4) { emitByte(Prefix.REX); } @@ -2133,18 +2134,20 @@ int prefixqAndEncode(int regEnc) { if (regEnc < 8) { emitByte(Prefix.REXW); + return regEnc; } else { emitByte(Prefix.REXWB); - regEnc -= 8; + return regEnc - 8; } - return regEnc; } int prefixAndEncode(int dstEnc, int srcEnc) { return prefixAndEncode(dstEnc, srcEnc, false); } - int prefixAndEncode(int dstEnc, int srcEnc, boolean byteinst) { + int prefixAndEncode(int dstEncoding, int srcEncoding, boolean byteinst) { + int srcEnc = srcEncoding; + int dstEnc = dstEncoding; if (dstEnc < 8) { if (srcEnc >= 8) { emitByte(Prefix.REXB); @@ -2172,7 +2175,9 @@ * @param rmEnc the encoding of the r/m part of the ModRM-Byte * @return the lower 6 bits of the ModRM-Byte that should be emitted */ - private int prefixqAndEncode(int regEnc, int rmEnc) { + private int prefixqAndEncode(int regEncoding, int rmEncoding) { + int rmEnc = rmEncoding; + int regEnc = regEncoding; if (regEnc < 8) { if (rmEnc < 8) { emitByte(Prefix.REXW); @@ -2929,8 +2934,7 @@ emitByte(0xC8); // appended: emitByte(imm16 & 0xff); - imm16 >>= 8; - emitByte(imm16 & 0xff); + emitByte((imm16 >> 8) & 0xff); emitByte(imm8); }
--- a/graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/X86InstructionDecoder.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/X86InstructionDecoder.java Sun Dec 18 05:24:06 2011 +0100 @@ -499,9 +499,9 @@ assert code[pos + 2] == 0; assert code[pos + 3] == 0; - code[pos++] = (byte) (offset & 0xFF); - code[pos++] = (byte) ((offset >> 8) & 0xFF); - code[pos++] = (byte) ((offset >> 16) & 0xFF); - code[pos++] = (byte) ((offset >> 24) & 0xFF); + code[pos] = (byte) (offset & 0xFF); + code[pos + 1] = (byte) ((offset >> 8) & 0xFF); + code[pos + 2] = (byte) ((offset >> 16) & 0xFF); + code[pos + 3] = (byte) ((offset >> 24) & 0xFF); } }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/Assembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/Assembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -31,6 +31,7 @@ /** * Assembler base class. */ +@SuppressWarnings("unused") public abstract class Assembler { private final Directives directives; @@ -276,8 +277,8 @@ boundLabels.add(label); } - private final List<AssembledObject> assembledObjects = new LinkedList<AssembledObject>(); - private final List<MutableAssembledObject> mutableAssembledObjects = new LinkedList<MutableAssembledObject>(); + private final List<AssembledObject> assembledObjects = new LinkedList<>(); + private final List<MutableAssembledObject> mutableAssembledObjects = new LinkedList<>(); private int potentialExpansionSize;
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/AssemblyException.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/AssemblyException.java Sun Dec 18 05:24:06 2011 +0100 @@ -27,6 +27,8 @@ */ public class AssemblyException extends Exception { + private static final long serialVersionUID = -633368746009467839L; + public AssemblyException(String message) { super(message); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/InlineDataDecoder.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/InlineDataDecoder.java Sun Dec 18 05:24:06 2011 +0100 @@ -69,7 +69,7 @@ } public InlineDataDecoder(List<InlineDataDescriptor> descriptors) { - positionToDescriptorMap = new TreeMap<Integer, InlineDataDescriptor>(); + positionToDescriptorMap = new TreeMap<>(); for (InlineDataDescriptor descriptor : descriptors) { positionToDescriptorMap.put(descriptor.startPosition(), descriptor); } @@ -86,7 +86,7 @@ final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(encodedDescriptors); final DataInputStream dataInputStream = new DataInputStream(byteArrayInputStream); final int numberOfEntries = dataInputStream.readInt(); - positionToDescriptorMap = new TreeMap<Integer, InlineDataDescriptor>(); + positionToDescriptorMap = new TreeMap<>(); for (int i = 0; i < numberOfEntries; ++i) { final Tag tag = InlineDataDescriptor.Tag.VALUES.get(dataInputStream.readByte()); final InlineDataDescriptor inlineDataDescriptor = tag.decode(dataInputStream);
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/InlineDataRecorder.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/InlineDataRecorder.java Sun Dec 18 05:24:06 2011 +0100 @@ -43,7 +43,7 @@ public void add(InlineDataDescriptor inlineData) { if (inlineData.size() != 0) { if (descriptors == null) { - descriptors = new ArrayList<InlineDataDescriptor>(); + descriptors = new ArrayList<>(); } descriptors.add(inlineData); normalized = false; @@ -92,8 +92,8 @@ private void normalize() { if (descriptors != null && !normalized) { - final SortedSet<InlineDataDescriptor> sortedEntries = new TreeSet<InlineDataDescriptor>(descriptors); - final List<InlineDataDescriptor> entries = new ArrayList<InlineDataDescriptor>(descriptors.size()); + final SortedSet<InlineDataDescriptor> sortedEntries = new TreeSet<>(descriptors); + final List<InlineDataDescriptor> entries = new ArrayList<>(descriptors.size()); int lastEnd = 0; for (InlineDataDescriptor inlineDataDescriptor : sortedEntries) { if (inlineDataDescriptor.startPosition() >= lastEnd) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64BaseRegister32.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64BaseRegister32.java Sun Dec 18 05:24:06 2011 +0100 @@ -48,7 +48,7 @@ R14D_BASE, R15D_BASE; - public static final Enumerator<AMD64BaseRegister32> ENUMERATOR = new Enumerator<AMD64BaseRegister32>(AMD64BaseRegister32.class); + public static final Enumerator<AMD64BaseRegister32> ENUMERATOR = new Enumerator<>(AMD64BaseRegister32.class); public static AMD64BaseRegister32 from(GeneralRegister generalRegister) { return ENUMERATOR.get(generalRegister.id());
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64BaseRegister64.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64BaseRegister64.java Sun Dec 18 05:24:06 2011 +0100 @@ -48,7 +48,7 @@ R14_BASE, R15_BASE; - public static final Enumerator<AMD64BaseRegister64> ENUMERATOR = new Enumerator<AMD64BaseRegister64>(AMD64BaseRegister64.class); + public static final Enumerator<AMD64BaseRegister64> ENUMERATOR = new Enumerator<>(AMD64BaseRegister64.class); public static AMD64BaseRegister64 from(GeneralRegister generalRegister) { return ENUMERATOR.get(generalRegister.id());
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64GeneralRegister16.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64GeneralRegister16.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,7 +34,7 @@ AX, CX, DX, BX, SP, BP, SI, DI, R8W, R9W, R10W, R11W, R12W, R13W, R14W, R15W; - public static final Enumerator<AMD64GeneralRegister16> ENUMERATOR = new Enumerator<AMD64GeneralRegister16>(AMD64GeneralRegister16.class); + public static final Enumerator<AMD64GeneralRegister16> ENUMERATOR = new Enumerator<>(AMD64GeneralRegister16.class); public static AMD64GeneralRegister16 from(GeneralRegister generalRegister) { return ENUMERATOR.get(generalRegister.id());
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64GeneralRegister32.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64GeneralRegister32.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,7 +34,7 @@ EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI, R8D, R9D, R10D, R11D, R12D, R13D, R14D, R15D; - public static final Enumerator<AMD64GeneralRegister32> ENUMERATOR = new Enumerator<AMD64GeneralRegister32>(AMD64GeneralRegister32.class); + public static final Enumerator<AMD64GeneralRegister32> ENUMERATOR = new Enumerator<>(AMD64GeneralRegister32.class); public static AMD64GeneralRegister32 from(GeneralRegister generalRegister) { return ENUMERATOR.get(generalRegister.id());
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64GeneralRegister64.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64GeneralRegister64.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,7 +34,7 @@ RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI, R8, R9, R10, R11, R12, R13, R14, R15; - public static final Enumerator<AMD64GeneralRegister64> ENUMERATOR = new Enumerator<AMD64GeneralRegister64>(AMD64GeneralRegister64.class); + public static final Enumerator<AMD64GeneralRegister64> ENUMERATOR = new Enumerator<>(AMD64GeneralRegister64.class); public static AMD64GeneralRegister64 from(GeneralRegister generalRegister) { return ENUMERATOR.get(generalRegister.id());
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64GeneralRegister8.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64GeneralRegister8.java Sun Dec 18 05:24:06 2011 +0100 @@ -51,7 +51,7 @@ DH(6, true), BH(7, true); - public static final Enumerator<AMD64GeneralRegister8> ENUMERATOR = new Enumerator<AMD64GeneralRegister8>(AMD64GeneralRegister8.class); + public static final Enumerator<AMD64GeneralRegister8> ENUMERATOR = new Enumerator<>(AMD64GeneralRegister8.class); private final int value; private final boolean isHighByte;
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64IndexRegister32.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64IndexRegister32.java Sun Dec 18 05:24:06 2011 +0100 @@ -48,7 +48,7 @@ R14D_INDEX, R15D_INDEX; - public static final Enumerator<AMD64IndexRegister32> ENUMERATOR = new Enumerator<AMD64IndexRegister32>(AMD64IndexRegister32.class); + public static final Enumerator<AMD64IndexRegister32> ENUMERATOR = new Enumerator<>(AMD64IndexRegister32.class); public static AMD64IndexRegister32 from(GeneralRegister generalRegister) { int ordinal = generalRegister.id();
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64IndexRegister64.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64IndexRegister64.java Sun Dec 18 05:24:06 2011 +0100 @@ -92,5 +92,5 @@ return RSI_INDEX; } - public static final Enumerator<AMD64IndexRegister64> ENUMERATOR = new Enumerator<AMD64IndexRegister64>(AMD64IndexRegister64.class); + public static final Enumerator<AMD64IndexRegister64> ENUMERATOR = new Enumerator<>(AMD64IndexRegister64.class); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64IndirectRegister32.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64IndirectRegister32.java Sun Dec 18 05:24:06 2011 +0100 @@ -48,7 +48,7 @@ R14D_INDIRECT, R15D_INDIRECT; - public static final Enumerator<AMD64IndirectRegister32> ENUMERATOR = new Enumerator<AMD64IndirectRegister32>(AMD64IndirectRegister32.class); + public static final Enumerator<AMD64IndirectRegister32> ENUMERATOR = new Enumerator<>(AMD64IndirectRegister32.class); public static AMD64IndirectRegister32 from(GeneralRegister generalRegister) { return ENUMERATOR.get(generalRegister.id());
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64IndirectRegister64.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64IndirectRegister64.java Sun Dec 18 05:24:06 2011 +0100 @@ -48,7 +48,7 @@ R14_INDIRECT, R15_INDIRECT; - public static final Enumerator<AMD64IndirectRegister64> ENUMERATOR = new Enumerator<AMD64IndirectRegister64>(AMD64IndirectRegister64.class); + public static final Enumerator<AMD64IndirectRegister64> ENUMERATOR = new Enumerator<>(AMD64IndirectRegister64.class); public static AMD64IndirectRegister64 from(GeneralRegister generalRegister) { return ENUMERATOR.get(generalRegister.id());
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64XMMComparison.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64XMMComparison.java Sun Dec 18 05:24:06 2011 +0100 @@ -61,5 +61,5 @@ return LESS_THAN_OR_EQUAL; } - public static final Enumerator<AMD64XMMComparison> ENUMERATOR = new Enumerator<AMD64XMMComparison>(AMD64XMMComparison.class); + public static final Enumerator<AMD64XMMComparison> ENUMERATOR = new Enumerator<>(AMD64XMMComparison.class); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64XMMRegister.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/AMD64XMMRegister.java Sun Dec 18 05:24:06 2011 +0100 @@ -31,7 +31,7 @@ XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15; - public static final Enumerator<AMD64XMMRegister> ENUMERATOR = new Enumerator<AMD64XMMRegister>(AMD64XMMRegister.class); + public static final Enumerator<AMD64XMMRegister> ENUMERATOR = new Enumerator<>(AMD64XMMRegister.class); public int value() { return ordinal();
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/complete/AMD64LabelAssembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/complete/AMD64LabelAssembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -27,6 +27,7 @@ import com.sun.max.asm.amd64.*; import com.sun.max.asm.x86.*; +@SuppressWarnings("unused") public class AMD64LabelAssembler extends AMD64RawAssembler { public AMD64LabelAssembler(long startAddress) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/complete/AMD64RawAssembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/amd64/complete/AMD64RawAssembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -27,6 +27,7 @@ import com.sun.max.asm.amd64.*; import com.sun.max.asm.x86.*; +@SuppressWarnings("all") public class AMD64RawAssembler extends AbstractAMD64Assembler { public AMD64RawAssembler(long startAddress) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/arm/PSR.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/arm/PSR.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,7 +34,7 @@ CPSR, SPSR; - public static final Enumerator<PSR> ENUMERATOR = new Enumerator<PSR>(PSR.class); + public static final Enumerator<PSR> ENUMERATOR = new Enumerator<>(PSR.class); public int value() { return ordinal();
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/dis/AddressMapper.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/dis/AddressMapper.java Sun Dec 18 05:24:06 2011 +0100 @@ -36,8 +36,8 @@ private int serial; private int unnamedLabels; - private final Map<ImmediateArgument, DisassembledObject> objectMap = new HashMap<ImmediateArgument, DisassembledObject>(); - private final Map<ImmediateArgument, DisassembledLabel> labelMap = new TreeMap<ImmediateArgument, DisassembledLabel>(new Comparator<ImmediateArgument>() { + private final Map<ImmediateArgument, DisassembledObject> objectMap = new HashMap<>(); + private final Map<ImmediateArgument, DisassembledLabel> labelMap = new TreeMap<>(new Comparator<ImmediateArgument>() { public int compare(ImmediateArgument o1, ImmediateArgument o2) { final long l1 = o1.asLong(); final long l2 = o2.asLong();
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/dis/Disassembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/dis/Disassembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -39,7 +39,7 @@ */ public abstract class Disassembler { - private static final Map<String, Constructor> disassemblerConstructors = new HashMap<String, Constructor>(); + private static final Map<String, Constructor> disassemblerConstructors = new HashMap<>(); /** * Gets a constructor for instantiating a disassembler for a given {@linkplain ISA ISA} @@ -136,11 +136,6 @@ } } - /** - * Turn on the following flag in order to get debugging output. - */ - public static final boolean TRACE = false; - private final ImmediateArgument startAddress; private final Endianness endianness; @@ -221,7 +216,7 @@ } case JUMP_TABLE32: { final JumpTable32 jumpTable32 = (JumpTable32) descriptor; - final List<DisassembledData> result = new ArrayList<DisassembledData>(jumpTable32.numberOfEntries()); + final List<DisassembledData> result = new ArrayList<>(jumpTable32.numberOfEntries()); int caseValue = jumpTable32.low(); final InputStream stream = new ByteArrayInputStream(inlineData.data()); @@ -267,7 +262,7 @@ } case LOOKUP_TABLE32: { final LookupTable32 lookupTable32 = (LookupTable32) descriptor; - final List<DisassembledData> result = new ArrayList<DisassembledData>(lookupTable32.numberOfEntries()); + final List<DisassembledData> result = new ArrayList<>(lookupTable32.numberOfEntries()); final InputStream stream = new ByteArrayInputStream(inlineData.data()); final int lookupTable = startPosition; @@ -422,6 +417,6 @@ public abstract ImmediateArgument addressForRelativeAddressing(DisassembledInstruction di); public abstract String mnemonic(DisassembledInstruction di); - public abstract String operandsToString(DisassembledInstruction di, AddressMapper addressMapper); - public abstract String toString(DisassembledInstruction di, AddressMapper addressMapper); + public abstract String operandsToString(DisassembledInstruction di, AddressMapper printAddressMapper); + public abstract String toString(DisassembledInstruction di, AddressMapper printAddressMapper); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/dis/DisassemblyPrinter.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/dis/DisassemblyPrinter.java Sun Dec 18 05:24:06 2011 +0100 @@ -48,7 +48,7 @@ * @param outputStream the stream to which the disassembly wil be printed * @param disassembledObjects the disassembled objects to be printed */ - public void print(Disassembler disassembler, OutputStream outputStream, List<DisassembledObject> disassembledObjects) throws IOException { + public void print(Disassembler disassembler, OutputStream outputStream, List<DisassembledObject> disassembledObjects) { final PrintStream stream = outputStream instanceof PrintStream ? (PrintStream) outputStream : new PrintStream(outputStream); final int nOffsetChars = Integer.toString(Utils.last(disassembledObjects).startPosition()).length(); final int nLabelChars = disassembler.addressMapper().maximumLabelNameLength();
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/dis/risc/OpcodeMaskGroup.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/dis/risc/OpcodeMaskGroup.java Sun Dec 18 05:24:06 2011 +0100 @@ -43,17 +43,17 @@ return mask; } - private final Set<RiscTemplate> templates = new HashSet<RiscTemplate>(); + private final Set<RiscTemplate> templates = new HashSet<>(); - private final IntHashMap<List<RiscTemplate>> templatesForOpcodes = new IntHashMap<List<RiscTemplate>>(); - private final List<RiscTemplate> empty = new LinkedList<RiscTemplate>(); + private final IntHashMap<List<RiscTemplate>> templatesForOpcodes = new IntHashMap<>(); + private final List<RiscTemplate> empty = new LinkedList<>(); public void add(RiscTemplate template) { assert template.opcodeMask() == mask; templates.add(template); List<RiscTemplate> templatesForOpcode = templatesForOpcodes.get(template.opcode()); if (templatesForOpcode == null) { - templatesForOpcode = new LinkedList<RiscTemplate>(); + templatesForOpcode = new LinkedList<>(); templatesForOpcodes.put(template.opcode(), templatesForOpcode); } templatesForOpcode.add(template);
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/dis/risc/RiscDisassembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/dis/risc/RiscDisassembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -24,7 +24,6 @@ import java.io.*; import java.util.*; -import java.util.Arrays; import com.sun.max.*; import com.sun.max.asm.*; @@ -63,8 +62,8 @@ * @return the decoded arguments for each operand or null if at least one operand has * an invalid value in the encoded instruction */ - private List<Argument> disassemble(int instruction, RiscTemplate template) { - final List<Argument> arguments = new ArrayList<Argument>(); + private static List<Argument> disassemble(int instruction, RiscTemplate template) { + final List<Argument> arguments = new ArrayList<>(); for (OperandField operandField : template.parameters()) { final Argument argument = operandField.disassemble(instruction); if (argument == null) { @@ -75,7 +74,7 @@ return arguments; } - private boolean isLegalArgumentList(RiscTemplate template, List<Argument> arguments) { + private static boolean isLegalArgumentList(RiscTemplate template, List<Argument> arguments) { final List<InstructionConstraint> constraints = template.instructionDescription().constraints(); for (InstructionConstraint constraint : constraints) { if (!(constraint.check(template, arguments))) { @@ -100,7 +99,7 @@ @Override public List<DisassembledObject> scanOne0(BufferedInputStream stream) throws IOException, AssemblyException { final int instruction = endianness().readInt(stream); - final List<DisassembledObject> result = new LinkedList<DisassembledObject>(); + final List<DisassembledObject> result = new LinkedList<>(); final byte[] instructionBytes = endianness().toBytes(instruction); for (SpecificityGroup specificityGroup : assembly().specificityGroups()) { for (OpcodeMaskGroup opcodeMaskGroup : specificityGroup.opcodeMaskGroups()) { @@ -145,7 +144,7 @@ @Override public List<DisassembledObject> scan0(BufferedInputStream stream) throws IOException, AssemblyException { - final List<DisassembledObject> result = new ArrayList<DisassembledObject>(); + final List<DisassembledObject> result = new ArrayList<>(); try { while (true) { @@ -178,6 +177,7 @@ return new RiscTemplate(instructionDescription); } + @SuppressWarnings("unused") private final ImmediateOperandField[] byteFields; private ImmediateOperandField createByteField(int index) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/dis/x86/X86Disassembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/dis/x86/X86Disassembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -162,15 +162,11 @@ byteValue = stream.read(); } while (byteValue >= 0); - if (TRACE && !justSkip) { - System.out.println("Scanned header: " + header); - } - return justSkip ? null : header; } private List<Argument> scanArguments(BufferedInputStream stream, X86Template template, X86InstructionHeader header, byte modRMByte, byte sibByte) throws IOException { - final List<Argument> arguments = new ArrayList<Argument>(); + final List<Argument> arguments = new ArrayList<>(); final byte rexByte = (header.rexPrefix != null) ? header.rexPrefix.byteValue() : 0; for (X86Parameter parameter : template.parameters()) { int value = 0; @@ -249,7 +245,7 @@ return arguments; } - private int getModVariantParameterIndex(X86Template template, byte modRMByte, byte sibByte) { + private static int getModVariantParameterIndex(X86Template template, byte modRMByte, byte sibByte) { if (template.modCase() == X86TemplateContext.ModCase.MOD_0 && X86Field.MOD.extract(modRMByte) != X86TemplateContext.ModCase.MOD_0.value()) { switch (template.rmCase()) { case NORMAL: { @@ -357,7 +353,7 @@ // Remove the mod variant argument final Argument modVariantArgument = arguments.get(modVariantParameterIndex); - final List<Argument> result = new ArrayList<Argument>(); + final List<Argument> result = new ArrayList<>(); for (Argument argument : arguments) { if (modVariantArgument != argument) { result.add(argument); @@ -367,19 +363,14 @@ } if (!(Utils.indexOfIdentical(arguments, null) != -1)) { byte[] bytes; - if (true) { - final Assembler assembler = createAssembler(currentPosition); - try { - assembly.assemble(assembler, template, arguments); - } catch (AssemblyException e) { - // try the next template - continue; - } - bytes = assembler.toByteArray(); - } else { // TODO: does not work yet - final X86TemplateAssembler templateAssembler = new X86TemplateAssembler(template, addressWidth()); - bytes = templateAssembler.assemble(arguments); + final Assembler assembler = createAssembler(currentPosition); + try { + assembly.assemble(assembler, template, arguments); + } catch (AssemblyException e) { + // try the next template + continue; } + bytes = assembler.toByteArray(); if (bytes != null) { stream.reset(); if (Streams.startsWith(stream, bytes)) { @@ -416,17 +407,15 @@ return disassembledInstruction; } } - if (INLINE_INVALID_INSTRUCTIONS_AS_BYTES) { - stream.reset(); - final int size = 1; - final byte[] data = new byte[size]; - Streams.readFully(stream, data); - final InlineData inlineData = new InlineData(currentPosition, data); - final DisassembledData disassembledData = createDisassembledDataObjects(inlineData).iterator().next(); - currentPosition += size; - return disassembledData; - } - throw new AssemblyException("unknown instruction"); + + stream.reset(); + final int size = 1; + final byte[] data = new byte[size]; + Streams.readFully(stream, data); + final InlineData inlineData = new InlineData(currentPosition, data); + final DisassembledData disassembledData = createDisassembledDataObjects(inlineData).iterator().next(); + currentPosition += size; + return disassembledData; } /** @@ -444,11 +433,9 @@ } private static final int MORE_THAN_ANY_INSTRUCTION_LENGTH = 100; - private static final boolean INLINE_INVALID_INSTRUCTIONS_AS_BYTES = true; - @Override public List<DisassembledObject> scanOne0(BufferedInputStream stream) throws IOException, AssemblyException { - final List<DisassembledObject> disassembledObjects = new ArrayList<DisassembledObject>(); + final List<DisassembledObject> disassembledObjects = new ArrayList<>(); stream.mark(MORE_THAN_ANY_INSTRUCTION_LENGTH); final X86InstructionHeader header = scanInstructionHeader(stream, false); if (header == null) { @@ -460,8 +447,8 @@ @Override public List<DisassembledObject> scan0(BufferedInputStream stream) throws IOException, AssemblyException { - final SortedSet<Integer> knownGoodCodePositions = new TreeSet<Integer>(); - final List<DisassembledObject> result = new ArrayList<DisassembledObject>(); + final SortedSet<Integer> knownGoodCodePositions = new TreeSet<>(); + final List<DisassembledObject> result = new ArrayList<>(); boolean processingKnownValidCode = true; while (true) { @@ -518,7 +505,7 @@ } } - private boolean isRelativeJumpForward(DisassembledInstruction instruction) { + private static boolean isRelativeJumpForward(DisassembledInstruction instruction) { return instruction.template().internalName().equals("jmp") && // check if this is a jump instruction... instruction.arguments().size() == 1 && // that accepts one operand... ((Utils.first(instruction.arguments()) instanceof Immediate32Argument && // which is a relative offset... @@ -539,11 +526,11 @@ @Override public String operandsToString(DisassembledInstruction di, AddressMapper addressMapper) { - final LinkedList<X86Operand> operandQueue = new LinkedList<X86Operand>(); + final LinkedList<X86Operand> operandQueue = new LinkedList<>(); for (Operand operand : di.template().operands()) { operandQueue.add((X86Operand) operand); } - final LinkedList<Argument> argumentQueue = new LinkedList<Argument>(di.arguments()); + final LinkedList<Argument> argumentQueue = new LinkedList<>(di.arguments()); String result = ""; String separator = ""; while (!operandQueue.isEmpty()) { @@ -562,7 +549,7 @@ return Strings.padLengthWithSpaces(mnemonic(di), 8) + s; } - private String getSibIndexAndScale(Queue<X86Operand> operands, Queue<Argument> arguments) { + private static String getSibIndexAndScale(Queue<X86Operand> operands, Queue<Argument> arguments) { X86Parameter parameter = (X86Parameter) operands.remove(); assert parameter.place() == ParameterPlace.SIB_INDEX || parameter.place() == ParameterPlace.SIB_INDEX_REXX; final String result = arguments.remove().disassembledValue(); @@ -575,7 +562,7 @@ return result + " * " + scale.disassembledValue(); } - private String addition(Argument argument, String space) { + private static String addition(Argument argument, String space) { assert argument instanceof ImmediateArgument; final long value = argument.asLong(); final String s = Long.toString(value); @@ -585,7 +572,7 @@ return "-" + space + s.substring(1); } - private String getOperand(DisassembledInstruction di, Queue<X86Operand> operands, Queue<Argument> arguments, AddressMapper addressMapper) { + private static String getOperand(DisassembledInstruction di, Queue<X86Operand> operands, Queue<Argument> arguments, AddressMapper addressMapper) { final X86Operand operand = operands.remove(); if (operand instanceof ImplicitOperand) { final ImplicitOperand implicitOperand = (ImplicitOperand) operand;
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/dis/x86/X86InstructionHeader.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/dis/x86/X86InstructionHeader.java Sun Dec 18 05:24:06 2011 +0100 @@ -92,12 +92,12 @@ } public static Map<X86InstructionHeader, List<X86Template>> createMapping(Assembly<? extends X86Template> assembly, WordWidth addressWidth) { - final Map<X86InstructionHeader, List<X86Template>> result = new HashMap<X86InstructionHeader, List<X86Template>>(); + final Map<X86InstructionHeader, List<X86Template>> result = new HashMap<>(); for (X86Template template : assembly.templates()) { X86InstructionHeader header = new X86InstructionHeader(addressWidth, template); List<X86Template> matchingTemplates = result.get(header); if (matchingTemplates == null) { - matchingTemplates = new LinkedList<X86Template>(); + matchingTemplates = new LinkedList<>(); result.put(header, matchingTemplates); } matchingTemplates.add(template);
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/AssemblerGenerator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/AssemblerGenerator.java Sun Dec 18 05:24:06 2011 +0100 @@ -118,17 +118,17 @@ } - private List<Template_Type> filterTemplates(List<Template_Type> templates) { + private List<Template_Type> filterTemplates(List<Template_Type> templateList) { if (!generateRedundantInstructionsOption.getValue()) { - final List<Template_Type> result = new LinkedList<Template_Type>(); - for (Template_Type template : templates) { + final List<Template_Type> result = new LinkedList<>(); + for (Template_Type template : templateList) { if (!template.isRedundant()) { result.add(template); } } return result; } - return templates; + return templateList; } /** @@ -143,8 +143,8 @@ templates = filterTemplates(assembly().templates()); labelTemplates = filterTemplates(assembly().labelTemplates()); } else { - final List<Template_Type> newTemplates = new ArrayList<Template_Type>(); - final List<Template_Type> newLabelTemplates = new ArrayList<Template_Type>(); + final List<Template_Type> newTemplates = new ArrayList<>(); + final List<Template_Type> newLabelTemplates = new ArrayList<>(); Class assemberInterface = null; try { @@ -153,7 +153,7 @@ } catch (ClassNotFoundException e) { throw ProgramError.unexpected("The assembler interface class " + assemblerInterfaceName + " must be on the class path"); } - final Set<MethodKey> assemblerInterfaceMethods = new HashSet<MethodKey>(); + final Set<MethodKey> assemblerInterfaceMethods = new HashSet<>(); for (Method assemblerInterfaceMethod : assemberInterface.getDeclaredMethods()) { assemblerInterfaceMethods.add(new MethodKey(assemblerInterfaceMethod)); } @@ -213,7 +213,7 @@ return new File(outputDirectoryOption.getValue(), className.replace('.', File.separatorChar) + ".java").getAbsoluteFile(); } - protected final String formatParameterList(String separator, List<? extends Parameter> parameters, boolean typesOnly) { + protected static final String formatParameterList(String separator, List<? extends Parameter> parameters, boolean typesOnly) { String sep = separator; final StringBuilder sb = new StringBuilder(); for (Parameter parameter : parameters) { @@ -239,6 +239,7 @@ /** * Prints the source code for support methods that are used by the methods printed by {@link #printMethod(IndentWriter, Template)}. + * @param writer * * @return the number of subroutines printed */ @@ -255,7 +256,7 @@ */ public Set<String> getImportPackages(String className, Iterable<Template_Type> templateList) { final String outputPackage = getPackageName(className); - final Set<String> packages = new TreeSet<String>(); + final Set<String> packages = new TreeSet<>(); packages.add(getPackageName(AssemblyException.class)); packages.add(getPackageName(Label.class)); for (Template_Type template : templateList) { @@ -288,6 +289,7 @@ * and the logic for decoding the bit width of a {@link Label} value may be generated in a single assembler method. * <p> * The default implementation of this method returns {@code false}. + * @param labelTemplate */ protected boolean omitLabelTemplate(Template_Type labelTemplate) { return false; @@ -296,6 +298,7 @@ /** * Gets a reference to the architecture manual section describing the given template. The * returned string should conform to the format of the {@code @see} Javadoc tag. + * @param template */ protected String getJavadocManualReference(Template_Type template) { return null; @@ -308,6 +311,7 @@ * @param extraLinks * a sequence to which extra javadoc links should be appended */ + @SuppressWarnings("unused") protected void printExtraMethodJavadoc(IndentWriter writer, Template_Type template, List<String> extraLinks, boolean forLabelAssemblerMethod) { } @@ -319,7 +323,7 @@ * @param template the template from which the assembler method is generated */ protected void printMethodJavadoc(IndentWriter writer, Template_Type template, boolean forLabelAssemblerMethod) { - final List<String> extraLinks = new LinkedList<String>(); + final List<String> extraLinks = new LinkedList<>(); final List<? extends Parameter> parameters = getParameters(template, forLabelAssemblerMethod); writer.println("/**"); writer.println(" * Pseudo-external assembler syntax: {@code " + template.externalName() + externalMnemonicSuffixes(parameters) + " }" + externalParameters(parameters)); @@ -327,7 +331,7 @@ final boolean printExampleInstruction = true; if (printExampleInstruction) { - final List<Argument> arguments = new ArrayList<Argument>(); + final List<Argument> arguments = new ArrayList<>(); final AddressMapper addressMapper = new AddressMapper(); for (Parameter p : template.parameters()) { final Argument exampleArg = p.getExampleArgument(); @@ -360,7 +364,7 @@ } printExtraMethodJavadoc(writer, template, extraLinks, forLabelAssemblerMethod); - final List<InstructionConstraint> constraints = new ArrayList<InstructionConstraint>(template.instructionDescription().specifications().size()); + final List<InstructionConstraint> constraints = new ArrayList<>(template.instructionDescription().specifications().size()); for (Object s : template.instructionDescription().specifications()) { if (s instanceof InstructionConstraint) { constraints.add((InstructionConstraint) s); @@ -394,7 +398,7 @@ protected abstract DisassembledInstruction generateExampleInstruction(Template_Type template, List<Argument> arguments) throws AssemblyException; - private String externalParameters(List< ? extends Parameter> parameters) { + private static String externalParameters(List< ? extends Parameter> parameters) { final StringBuilder sb = new StringBuilder(); boolean first = true; for (Parameter parameter : parameters) { @@ -409,7 +413,7 @@ return sb.toString(); } - private String externalMnemonicSuffixes(List< ? extends Parameter> parameters) { + private static String externalMnemonicSuffixes(List< ? extends Parameter> parameters) { final StringBuilder sb = new StringBuilder(); for (Parameter parameter : parameters) { if (ExternalMnemonicSuffixArgument.class.isAssignableFrom(parameter.type())) { @@ -448,7 +452,7 @@ writer.indent(); int codeLineCount = 0; - final Map<InstructionDescription, Integer> instructionDescriptions = new HashMap<InstructionDescription, Integer>(); + final Map<InstructionDescription, Integer> instructionDescriptions = new HashMap<>(); int maxTemplatesPerDescription = 0; int i = 0; for (Template_Type template : templateList) { @@ -494,7 +498,7 @@ final Class<List<Parameter>> type = null; return Utils.cast(type, template.parameters()); } - final List<Parameter> parameters = new ArrayList<Parameter>(template.parameters()); + final List<Parameter> parameters = new ArrayList<>(template.parameters()); parameters.set(template.labelParameterIndex(), LabelParameter.LABEL); return parameters; } @@ -665,7 +669,7 @@ labelMethodHelperClasses.add(stringWriter.toString()); } - private final List<String> labelMethodHelperClasses = new ArrayList<String>(); + private final List<String> labelMethodHelperClasses = new ArrayList<>(); private void printLabelMethodHelperClass( IndentWriter writer, @@ -765,7 +769,7 @@ if (rawAssemblerMethodsUpdated || labelAssemblerMethodsUpdated) { System.out.println("modified: " + getSourceFileFor(rawAssemblerClassName)); if (!ToolChain.compile(AssemblerGenerator.class, rawAssemblerClassName)) { - List<Template_Type> allTemplates = new ArrayList<Template_Type>(templates()); + List<Template_Type> allTemplates = new ArrayList<>(templates()); allTemplates.addAll(labelTemplates()); throw ProgramError.unexpected("compilation failed for: " + rawAssemblerClassName + "[Maybe missing an import statement for one of the following packages: " +
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/Assembly.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/Assembly.java Sun Dec 18 05:24:06 2011 +0100 @@ -65,7 +65,7 @@ public final List<Template_Type> labelTemplates() { if (labelTemplates == null) { - labelTemplates = new LinkedList<Template_Type>(); + labelTemplates = new LinkedList<>(); for (Template_Type template : templates()) { if (!template.isRedundant() && template.labelParameterIndex() >= 0) { labelTemplates.add(template); @@ -77,7 +77,7 @@ public abstract BitRangeOrder bitRangeEndianness(); - private Object getBoxedJavaValue(Argument argument) { + private static Object getBoxedJavaValue(Argument argument) { if (argument instanceof ImmediateArgument) { final ImmediateArgument immediateArgument = (ImmediateArgument) argument; return immediateArgument.boxedJavaValue(); @@ -85,7 +85,7 @@ return argument; } - public final String createMethodCallString(Template template, List<Argument> argumentList) { + public static final String createMethodCallString(Template template, List<Argument> argumentList) { assert argumentList.size() == template.parameters().size(); String call = template.assemblerMethodName() + "("; for (int i = 0; i < argumentList.size(); i++) { @@ -94,7 +94,7 @@ return call + ")"; } - private Method getAssemblerMethod(Assembler assembler, Template template, Class[] parameterTypes) throws NoSuchAssemblerMethodError { + private static Method getAssemblerMethod(Assembler assembler, Template template, Class[] parameterTypes) throws NoSuchAssemblerMethodError { try { return assembler.getClass().getMethod(template.assemblerMethodName(), parameterTypes); } catch (NoSuchMethodException e) { @@ -102,7 +102,7 @@ } } - private Method getAssemblerMethod(Assembler assembler, Template template, List<Argument> arguments) throws NoSuchAssemblerMethodError { + private static Method getAssemblerMethod(Assembler assembler, Template template, List<Argument> arguments) throws NoSuchAssemblerMethodError { final Class[] parameterTypes = template.parameterTypes(); final int index = template.labelParameterIndex(); if (index >= 0 && arguments.get(index) instanceof Label) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/AssemblyTester.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/AssemblyTester.java Sun Dec 18 05:24:06 2011 +0100 @@ -228,7 +228,7 @@ if (argumentRange == null || !argumentRange.appliesInternally()) { testArgumentIterators[i] = argumentsIterable.iterator(); } else { - testArgumentIterators[i] = new FilterIterator<Argument>(argumentsIterable.iterator(), new Predicate<Argument>() { + testArgumentIterators[i] = new FilterIterator<>(argumentsIterable.iterator(), new Predicate<Argument>() { public boolean evaluate(Argument argument) { return argumentRange.includes(argument); } @@ -283,7 +283,7 @@ private static final String SOURCE_EXTENSION = ".s"; private static final String BINARY_EXTENSION = ".o"; - private boolean findExcludedDisassemblerTestArgument(List<? extends Parameter> parameters, List<Argument> arguments) { + private static boolean findExcludedDisassemblerTestArgument(List<? extends Parameter> parameters, List<Argument> arguments) { for (int i = 0; i < parameters.size(); i++) { if (parameters.get(i).excludedDisassemblerTestArguments().contains(arguments.get(i))) { return true; @@ -292,7 +292,7 @@ return false; } - private boolean findExcludedExternalTestArgument(List<? extends Parameter> parameters, List<Argument> arguments) { + private static boolean findExcludedExternalTestArgument(List<? extends Parameter> parameters, List<Argument> arguments) { for (int i = 0; i < parameters.size(); i++) { final Parameter parameter = parameters.get(i); if (parameter.excludedExternalTestArguments().contains(arguments.get(i))) { @@ -403,7 +403,7 @@ * * @param command the command line to execute */ - private void exec(String command) throws IOException, InterruptedException { + private static void exec(String command) throws IOException, InterruptedException { exec(command, System.out, System.err, System.in); } @@ -416,7 +416,7 @@ * @param err the stream to which standard error output will be directed * @param in the stream from which standard input will be read */ - private void exec(String command, OutputStream out, OutputStream err, InputStream in) throws IOException, InterruptedException { + private static void exec(String command, OutputStream out, OutputStream err, InputStream in) throws IOException, InterruptedException { final Process process = Runtime.getRuntime().exec(command); try { final Redirector stderr = Streams.redirect(process, process.getErrorStream(), err, command + " [stderr]", 50); @@ -499,7 +499,7 @@ * It would have been much more clean to override 'equals()' of those argument classes, * but they are enums and Java predeclares methods inherited via Enum final :-( */ - private boolean equals(List<Argument> arguments1, List<Argument> arguments2) { + private static boolean equals(List<Argument> arguments1, List<Argument> arguments2) { if (arguments1.size() != arguments2.size()) { return false; } @@ -580,7 +580,7 @@ disassemblyStream.close(); } - private void testTemplate(final Template_Type template, List<File> temporaryFiles) throws IOException, InterruptedException, AssemblyException { + private void testTemplate(final Template_Type template, List<File> temporaryFiles) throws IOException, AssemblyException { final boolean testingExternally = components.contains(AssemblyTestComponent.EXTERNAL_ASSEMBLER) && template.isExternallyTestable(); // Process legal test cases @@ -610,7 +610,7 @@ assembly().assemble(assembler, template, argumentList); final byte[] internalResult = assembler.toByteArray(); if (Trace.hasLevel(3)) { - Trace.line(3, "assembleInternally[" + testCaseNumber + "]: " + assembly().createMethodCallString(template, argumentList) + " = " + DisassembledInstruction.toHexString(internalResult)); + Trace.line(3, "assembleInternally[" + testCaseNumber + "]: " + Assembly.createMethodCallString(template, argumentList) + " = " + DisassembledInstruction.toHexString(internalResult)); } if (components.contains(AssemblyTestComponent.DISASSEMBLER) && template.isDisassemblable() && !findExcludedDisassemblerTestArgument(template.parameters(), argumentList)) { @@ -640,12 +640,12 @@ // Process illegal test cases int illegalTestCaseNumber = 0; - final Set<String> uniqueExceptionMessages = new HashSet<String>(); + final Set<String> uniqueExceptionMessages = new HashSet<>(); for (TestCaseLegality testCaseLegality : new TestCaseLegality[]{TestCaseLegality.ILLEGAL_BY_CONSTRAINT, TestCaseLegality.ILLEGAL_BY_ARGUMENT}) { for (final ArgumentListIterator iterator = new ArgumentListIterator(template, testCaseLegality); iterator.hasNext();) { final List<Argument> argumentList = iterator.next(); final Assembler assembler = createTestAssembler(); - Trace.line(3, "assembleInternally-negative[" + illegalTestCaseNumber + "]: " + assembly().createMethodCallString(template, argumentList)); + Trace.line(3, "assembleInternally-negative[" + illegalTestCaseNumber + "]: " + Assembly.createMethodCallString(template, argumentList)); try { assembly().assemble(assembler, template, argumentList); } catch (IllegalArgumentException e) { @@ -716,9 +716,9 @@ } final ThreadPoolExecutor compilerService = (ThreadPoolExecutor) Executors.newFixedThreadPool(numberOfWorkerThreads); - final CompletionService<Template_Type> compilationCompletionService = new ExecutorCompletionService<Template_Type>(compilerService); + final CompletionService<Template_Type> compilationCompletionService = new ExecutorCompletionService<>(compilerService); long submittedTests = 0; - final List<Template_Type> errors = new LinkedList<Template_Type>(); + final List<Template_Type> errors = new LinkedList<>(); for (final Template_Type template : assembly().templates()) { if (template.serial() > endTemplateSerial) { break; @@ -729,7 +729,7 @@ ++submittedTests; compilationCompletionService.submit(new Callable<Template_Type>() { public Template_Type call() { - final List<File> temporaryFiles = new ArrayList<File>(); + final List<File> temporaryFiles = new ArrayList<>(); try { testTemplate(template, temporaryFiles); } catch (Throwable throwable) { @@ -791,7 +791,7 @@ * where to print the generate source. The caller takes responsibility for closing the stream. */ public void createExternalSource(int startTemplateSerial, int endTemplateSerial, IndentWriter stream) { - final List<Template_Type> errors = new LinkedList<Template_Type>(); + final List<Template_Type> errors = new LinkedList<>(); for (Template_Type template : assembly().templates()) { if (template.serial() > endTemplateSerial) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/ImmediateParameter.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/ImmediateParameter.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,9 +34,10 @@ private Static() { } + @SafeVarargs public static <Element_Type extends ImmediateArgument, Argument_Type> List<Element_Type> createSequence(Class<Element_Type> elementType, final Class<Argument_Type> argumentType, Argument_Type... values) throws NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException { - final List<Element_Type> result = new ArrayList<Element_Type>(); + final List<Element_Type> result = new ArrayList<>(); final Constructor<Element_Type> elementConstructor = elementType.getConstructor(argumentType); for (Argument_Type value : values) { result.add(elementConstructor.newInstance(value));
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/InstructionDescription.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/InstructionDescription.java Sun Dec 18 05:24:06 2011 +0100 @@ -75,7 +75,7 @@ */ public List<InstructionConstraint> constraints() { if (constraints == null) { - constraints = new ArrayList<InstructionConstraint>(specifications.size()); + constraints = new ArrayList<>(specifications.size()); for (Object s : specifications) { if (s instanceof InstructionConstraint) { constraints.add((InstructionConstraint) s);
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/InstructionDescriptionCreator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/InstructionDescriptionCreator.java Sun Dec 18 05:24:06 2011 +0100 @@ -48,7 +48,7 @@ return instructionDescription; } - private final List<InstructionDescription_Type> instructionDescriptions = new LinkedList<InstructionDescription_Type>(); + private final List<InstructionDescription_Type> instructionDescriptions = new LinkedList<>(); private static void deepCopy(Object[] src, List<Object> dst) { for (Object object : src) { @@ -61,7 +61,7 @@ } protected InstructionDescription_Type define(Object... specifications) { - List<Object> specList = new ArrayList<Object>(specifications.length * 2); + List<Object> specList = new ArrayList<>(specifications.length * 2); deepCopy(specifications, specList); return defineInstructionDescription(specList); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/NoSuchAssemblerMethodError.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/NoSuchAssemblerMethodError.java Sun Dec 18 05:24:06 2011 +0100 @@ -33,6 +33,10 @@ */ public class NoSuchAssemblerMethodError extends NoSuchMethodError { + /** + * + */ + private static final long serialVersionUID = 6071040691387949757L; public final Template template; public NoSuchAssemblerMethodError(String message, Template template) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/TemplateNotNeededException.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/TemplateNotNeededException.java Sun Dec 18 05:24:06 2011 +0100 @@ -36,6 +36,11 @@ */ public class TemplateNotNeededException extends Exception { + /** + * + */ + private static final long serialVersionUID = 3785941470671918973L; + public TemplateNotNeededException() { super(); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/amd64/AMD64AssemblerGenerator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/amd64/AMD64AssemblerGenerator.java Sun Dec 18 05:24:06 2011 +0100 @@ -55,12 +55,12 @@ return Bytes.toHexLiteral(basicRexValue(template)); } - private void printUnconditionalRexBit(IndentWriter writer, X86Parameter parameter, int bitIndex) { + private static void printUnconditionalRexBit(IndentWriter writer, X86Parameter parameter, int bitIndex) { writer.print(REX_BYTE_NAME + " |= (" + parameter.valueString() + " & 8) >> " + (3 - bitIndex) + ";"); writer.println(" // " + parameter.place().comment()); } - private void checkGeneralRegister8Values(IndentWriter writer, X86Template template) { + private static void checkGeneralRegister8Values(IndentWriter writer, X86Template template) { for (X86Parameter parameter : template.parameters()) { if (parameter.type() == AMD64GeneralRegister8.class) { writer.println("if (" + parameter.variableName() + ".isHighByte()) {"); @@ -97,7 +97,7 @@ writer.println(); } - private void printConditionalRexBit(IndentWriter writer, X86Template template, X86Parameter parameter, int bitIndex) { + private static void printConditionalRexBit(IndentWriter writer, X86Template template, X86Parameter parameter, int bitIndex) { if (parameter.type() == AMD64GeneralRegister8.class) { writer.println("if (" + parameter.variableName() + ".requiresRexPrefix()) {"); writer.indent();
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/amd64/AMD64Template.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/amd64/AMD64Template.java Sun Dec 18 05:24:06 2011 +0100 @@ -100,7 +100,7 @@ // so for now we do not produce them: TemplateNotNeededException.raise(); } - addParameter(new X86EnumerableParameter<Scale>(designation, ParameterPlace.SIB_SCALE, Scale.ENUMERATOR)); + addParameter(new X86EnumerableParameter<>(designation, ParameterPlace.SIB_SCALE, Scale.ENUMERATOR)); } /** @@ -223,11 +223,11 @@ throws TemplateNotNeededException { switch (operandCode) { case Cq: { - addParameter(new X86EnumerableParameter<ControlRegister>(designation, ParameterPlace.MOD_REG, ControlRegister.ENUMERATOR)); + addParameter(new X86EnumerableParameter<>(designation, ParameterPlace.MOD_REG, ControlRegister.ENUMERATOR)); break; } case Dq: { - addParameter(new X86EnumerableParameter<DebugRegister>(designation, ParameterPlace.MOD_REG, DebugRegister.ENUMERATOR)); + addParameter(new X86EnumerableParameter<>(designation, ParameterPlace.MOD_REG, DebugRegister.ENUMERATOR)); break; } case Eb: {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/amd64/AMD64TemplateCreator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/amd64/AMD64TemplateCreator.java Sun Dec 18 05:24:06 2011 +0100 @@ -30,7 +30,7 @@ public class AMD64TemplateCreator extends X86TemplateCreator<AMD64Template> { public AMD64TemplateCreator() { - super(AMD64Assembly.ASSEMBLY, WordWidth.BITS_64); + super(WordWidth.BITS_64); } @Override
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/ia32/IA32Template.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/ia32/IA32Template.java Sun Dec 18 05:24:06 2011 +0100 @@ -82,7 +82,7 @@ // so for now we do not produce them: TemplateNotNeededException.raise(); } - addParameter(new X86EnumerableParameter<Scale>(designation, ParameterPlace.SIB_SCALE, Scale.ENUMERATOR)); + addParameter(new X86EnumerableParameter<>(designation, ParameterPlace.SIB_SCALE, Scale.ENUMERATOR)); } @Override @@ -228,11 +228,11 @@ } break; case Cd: { - addParameter(new X86EnumerableParameter<ControlRegister>(designation, ParameterPlace.MOD_REG, ControlRegister.ENUMERATOR)); + addParameter(new X86EnumerableParameter<>(designation, ParameterPlace.MOD_REG, ControlRegister.ENUMERATOR)); break; } case Dd: { - addParameter(new X86EnumerableParameter<DebugRegister>(designation, ParameterPlace.MOD_REG, DebugRegister.ENUMERATOR)); + addParameter(new X86EnumerableParameter<>(designation, ParameterPlace.MOD_REG, DebugRegister.ENUMERATOR)); break; } case Eb: {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/ia32/IA32TemplateCreator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/ia32/IA32TemplateCreator.java Sun Dec 18 05:24:06 2011 +0100 @@ -30,7 +30,7 @@ public class IA32TemplateCreator extends X86TemplateCreator<IA32Template> { public IA32TemplateCreator() { - super(IA32Assembly.ASSEMBLY, WordWidth.BITS_32); + super(WordWidth.BITS_32); } @Override
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/FloatingPointOperandCode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/FloatingPointOperandCode.java Sun Dec 18 05:24:06 2011 +0100 @@ -53,6 +53,6 @@ } public TestArgumentExclusion excludeExternalTestArguments(Argument... arguments) { - return new TestArgumentExclusion(AssemblyTestComponent.EXTERNAL_ASSEMBLER, this, new HashSet<Argument>(Arrays.asList(arguments))); + return new TestArgumentExclusion(AssemblyTestComponent.EXTERNAL_ASSEMBLER, this, new HashSet<>(Arrays.asList(arguments))); } }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/OperandCode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/OperandCode.java Sun Dec 18 05:24:06 2011 +0100 @@ -127,15 +127,15 @@ } public TestArgumentExclusion excludeDisassemblerTestArguments(Argument... arguments) { - return new TestArgumentExclusion(AssemblyTestComponent.DISASSEMBLER, this, new HashSet<Argument>(Arrays.asList(arguments))); + return new TestArgumentExclusion(AssemblyTestComponent.DISASSEMBLER, this, new HashSet<>(Arrays.asList(arguments))); } public TestArgumentExclusion excludeExternalTestArguments(Argument... arguments) { - return new TestArgumentExclusion(AssemblyTestComponent.EXTERNAL_ASSEMBLER, this, new HashSet<Argument>(Arrays.asList(arguments))); + return new TestArgumentExclusion(AssemblyTestComponent.EXTERNAL_ASSEMBLER, this, new HashSet<>(Arrays.asList(arguments))); } public TestArgumentExclusion excludeExternalTestArguments(Enumerator... argumentEnumerators) { - final Set<Argument> arguments = new HashSet<Argument>(); + final Set<Argument> arguments = new HashSet<>(); for (Enumerator argumentEnumerator : argumentEnumerators) { for (Object e : argumentEnumerator) { arguments.add((Argument) e);
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/X86AssemblerGenerator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/X86AssemblerGenerator.java Sun Dec 18 05:24:06 2011 +0100 @@ -102,7 +102,8 @@ return argument.getClass().getSimpleName() + "." + argument.name(); } - protected <Argument_Type extends Enum<Argument_Type> & EnumerableArgument<Argument_Type>> void printModVariant(IndentWriter writer, final Template_Type template, Argument_Type... arguments) { + @SafeVarargs + protected final <Argument_Type extends Enum<Argument_Type> & EnumerableArgument<Argument_Type>> void printModVariant(IndentWriter writer, final Template_Type template, Argument_Type... arguments) { final Class argumentType = arguments[0].getClass(); final X86Parameter parameter = getParameter(template, argumentType); writer.print("if ("); @@ -229,7 +230,8 @@ writer.println(); } - protected <Argument_Type extends Enum<Argument_Type> & EnumerableArgument<Argument_Type>> void printSibVariant(IndentWriter writer, Template_Type template, Argument_Type... arguments) { + @SafeVarargs + protected final <Argument_Type extends Enum<Argument_Type> & EnumerableArgument<Argument_Type>> void printSibVariant(IndentWriter writer, Template_Type template, Argument_Type... arguments) { final Class argumentType = arguments[0].getClass(); final X86Parameter parameter = getParameter(template, argumentType); writer.print("if ("); @@ -294,7 +296,7 @@ return "assemble" + number; } - private Map<String, String> subroutineToName = new HashMap<String, String>(); + private Map<String, String> subroutineToName = new HashMap<>(); private static final String OPCODE1_VARIABLE_NAME = "opcode1"; private static final String OPCODE2_VARIABLE_NAME = "opcode2"; @@ -416,6 +418,7 @@ } } + @SuppressWarnings("static-method") private String getValidSizesMaskExpression(List<LabelWidthCase> labelWidthCases) { final Iterator<LabelWidthCase> iterator = labelWidthCases.iterator(); String mask = String.valueOf(iterator.next().width.numberOfBytes); @@ -437,7 +440,7 @@ } // Report the found cases in the order of ascending width: - final List<LabelWidthCase> result = new LinkedList<LabelWidthCase>(); + final List<LabelWidthCase> result = new LinkedList<>(); for (int i = 0; i < array.size(); i++) { final LabelWidthCase labelWidthCase = array.get(i); if (labelWidthCase != null) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/X86AssemblyTester.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/X86AssemblyTester.java Sun Dec 18 05:24:06 2011 +0100 @@ -47,7 +47,7 @@ return Utils.cast(type, super.assembly()); } - private String getSibIndexAndScale(Queue<X86Operand> operands, Queue<Argument> arguments) { + private static String getSibIndexAndScale(Queue<X86Operand> operands, Queue<Argument> arguments) { X86Parameter parameter = (X86Parameter) operands.remove(); assert parameter.place() == ParameterPlace.SIB_INDEX || parameter.place() == ParameterPlace.SIB_INDEX_REXX; final String result = arguments.remove().externalValue() + ","; @@ -56,7 +56,7 @@ return result + arguments.remove().externalValue() + ")"; } - private String getOperand(X86Template template, Queue<X86Operand> operands, Queue<Argument> arguments, String label) { + private static String getOperand(X86Template template, Queue<X86Operand> operands, Queue<Argument> arguments, String label) { final X86Operand operand = operands.remove(); if (operand instanceof ImplicitOperand) { final ImplicitOperand implicitOperand = (ImplicitOperand) operand; @@ -129,8 +129,8 @@ } else { stream.println(".code" + addressWidth().numberOfBits); } - final LinkedList<X86Operand> operandQueue = new LinkedList<X86Operand>(template.operands()); - final LinkedList<Argument> argumentQueue = new LinkedList<Argument>(argumentList); + final LinkedList<X86Operand> operandQueue = new LinkedList<>(template.operands()); + final LinkedList<Argument> argumentQueue = new LinkedList<>(argumentList); String first = ""; if (!operandQueue.isEmpty()) { first = getOperand(template, operandQueue, argumentQueue, label);
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/X86Parameter.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/X86Parameter.java Sun Dec 18 05:24:06 2011 +0100 @@ -64,8 +64,8 @@ this.argumentRange = argumentRange; } - private Set<Argument> excludedDisassemblerTestArguments = new HashSet<Argument>(); - private Set<Argument> excludedExternalTestArguments = new HashSet<Argument>(); + private Set<Argument> excludedDisassemblerTestArguments = new HashSet<>(); + private Set<Argument> excludedExternalTestArguments = new HashSet<>(); public void excludeTestArguments(TestArgumentExclusion testArgumentExclusion) { switch (testArgumentExclusion.component()) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/X86Template.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/X86Template.java Sun Dec 18 05:24:06 2011 +0100 @@ -44,9 +44,9 @@ private HexByte opcode2; private ModRMGroup modRMGroup; private ModRMGroup.Opcode modRMGroupOpcode; - private List<X86Operand> operands = new LinkedList<X86Operand>(); - private List<X86ImplicitOperand> implicitOperands = new LinkedList<X86ImplicitOperand>(); - private List<X86Parameter> parameters = new ArrayList<X86Parameter>(); + private List<X86Operand> operands = new LinkedList<>(); + private List<X86ImplicitOperand> implicitOperands = new LinkedList<>(); + private List<X86Parameter> parameters = new ArrayList<>(); protected boolean isLabelMethodWritten; protected X86Template(X86InstructionDescription instructionDescription, int serial, InstructionAssessment instructionFamily, X86TemplateContext context) { @@ -147,7 +147,7 @@ return result; } - private String format(HexByte parameter) { + private static String format(HexByte parameter) { return parameter == null ? "" : parameter.toString() + ", "; } @@ -239,7 +239,7 @@ protected <EnumerableArgument_Type extends Enum<EnumerableArgument_Type> & EnumerableArgument<EnumerableArgument_Type>> X86Parameter addEnumerableParameter(X86Operand.Designation designation, ParameterPlace parameterPlace, final Enumerator<EnumerableArgument_Type> enumerator) { - return addParameter(new X86EnumerableParameter<EnumerableArgument_Type>(designation, parameterPlace, enumerator)); + return addParameter(new X86EnumerableParameter<>(designation, parameterPlace, enumerator)); } protected void addImplicitOperand(X86ImplicitOperand implicitOperand) { @@ -299,7 +299,7 @@ return operandTypeCode.name(); } - private void checkSuffix(String newSuffix, String oldSuffix) { + private static void checkSuffix(String newSuffix, String oldSuffix) { if (oldSuffix != null) { ProgramError.check(newSuffix.equals(oldSuffix), "conflicting operand type codes specified: " + newSuffix + " vs. " + oldSuffix); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/X86TemplateAssembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/X86TemplateAssembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -41,8 +41,6 @@ private final byte[] bytes = new byte[MORE_BYTES_THAN_ANY_INSTRUCTION]; private int n; - private int rexByte; - private void emit(byte b) { bytes[n++] = b; } @@ -59,24 +57,24 @@ if (unconditionalRexBit) { return ((int) argument.asLong() & 8) >> (3 - bitIndex); } - int rexByte = 0; + int result = 0; if (argument instanceof AMD64GeneralRegister8) { final AMD64GeneralRegister8 reg8 = (AMD64GeneralRegister8) argument; if (reg8.requiresRexPrefix()) { - rexByte |= basicRexValue(template); + result |= basicRexValue(template); if (argument.asLong() >= 8) { - rexByte |= createRexData(bitIndex, argument.asLong()); + result |= createRexData(bitIndex, argument.asLong()); } } } else { if (argument.asLong() >= 8) { - rexByte |= createRexData(bitIndex, argument.asLong()) + basicRexValue(template); + result |= createRexData(bitIndex, argument.asLong()) + basicRexValue(template); } } - return rexByte; + return result; } - private int createRexData(int bitIndex, long argument) { + private static int createRexData(int bitIndex, long argument) { final byte b = (byte) (argument & 0xffL); if (b == 0) { return 0; @@ -84,7 +82,7 @@ return X86Field.inRexPlace(bitIndex, b); } - private int createFieldData(X86Field field, long argument) { + private static int createFieldData(X86Field field, long argument) { return field.inPlace((byte) (argument & field.mask)); } @@ -115,26 +113,26 @@ return 0; } - private boolean modRMRequiresSib(int modRMByte) { + private static boolean modRMRequiresSib(int modRMByte) { final byte m = (byte) modRMByte; return X86Field.MOD.extract(m) != 3 && X86Field.RM.extract(m) == 4; } - private boolean modRMRequiresImmediate(int modRMByte) { + private static boolean modRMRequiresImmediate(int modRMByte) { final byte m = (byte) modRMByte; return X86Field.MOD.extract(m) == 0 && X86Field.RM.extract(m) == 5; } - private boolean sibRequiresImmediate(int sibRMByte) { + private static boolean sibRequiresImmediate(int sibRMByte) { final byte s = (byte) sibRMByte; return X86Field.BASE.extract(s) == 5; } public byte[] assemble(List<Argument> arguments) { - int rexByte = 0; + int curRexByte = 0; final boolean unconditionalRexBit = template.operandSizeAttribute() == WordWidth.BITS_64 && template.instructionDescription().defaultOperandSize() != WordWidth.BITS_64; if (unconditionalRexBit) { - rexByte = X86Opcode.REX_MIN.byteValue() | (1 << X86Field.REX_W_BIT_INDEX); + curRexByte = X86Opcode.REX_MIN.byteValue() | (1 << X86Field.REX_W_BIT_INDEX); } int opcode1 = template.opcode1().byteValue() & 0xff; int opcode2 = template.opcode2() == null ? 0 : template.opcode2().byteValue() & 0xff; @@ -146,25 +144,25 @@ final long argument = arguments.get(i).asLong(); switch (parameter.place()) { case MOD_REG_REXR: - rexByte |= createRexData(X86Field.REX_R_BIT_INDEX, arguments.get(i), unconditionalRexBit); + curRexByte |= createRexData(X86Field.REX_R_BIT_INDEX, arguments.get(i), unconditionalRexBit); // fall through... case MOD_REG: modRMByte |= createFieldData(X86Field.REG, argument); break; case MOD_RM_REXB: - rexByte |= createRexData(X86Field.REX_B_BIT_INDEX, arguments.get(i), unconditionalRexBit); + curRexByte |= createRexData(X86Field.REX_B_BIT_INDEX, arguments.get(i), unconditionalRexBit); // fall through... case MOD_RM: modRMByte |= createFieldData(X86Field.RM, argument); break; case SIB_BASE_REXB: - rexByte |= createRexData(X86Field.REX_B_BIT_INDEX, arguments.get(i), unconditionalRexBit); + curRexByte |= createRexData(X86Field.REX_B_BIT_INDEX, arguments.get(i), unconditionalRexBit); // fall through... case SIB_BASE: sibByte |= createFieldData(X86Field.BASE, argument); break; case SIB_INDEX_REXX: - rexByte |= createRexData(X86Field.REX_X_BIT_INDEX, arguments.get(i), unconditionalRexBit); + curRexByte |= createRexData(X86Field.REX_X_BIT_INDEX, arguments.get(i), unconditionalRexBit); // fall through... case SIB_INDEX: sibByte |= createFieldData(X86Field.INDEX, argument); @@ -198,21 +196,21 @@ } break; case OPCODE1_REXB: - rexByte |= createRexData(X86Field.REX_B_BIT_INDEX, arguments.get(i), unconditionalRexBit); + curRexByte |= createRexData(X86Field.REX_B_BIT_INDEX, arguments.get(i), unconditionalRexBit); // fall through... case OPCODE1: opcode1 |= (int) argument & 7; break; case OPCODE2_REXB: - rexByte |= createRexData(X86Field.REX_B_BIT_INDEX, arguments.get(i), unconditionalRexBit); + curRexByte |= createRexData(X86Field.REX_B_BIT_INDEX, arguments.get(i), unconditionalRexBit); // fall through... case OPCODE2: opcode2 |= (int) argument & 7; break; } } - if (rexByte > 0) { - emit(rexByte); + if (curRexByte > 0) { + emit(curRexByte); } if (template.addressSizeAttribute() != addressWidth) { emit(X86Opcode.ADDRESS_SIZE);
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/X86TemplateCreator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/cisc/x86/X86TemplateCreator.java Sun Dec 18 05:24:06 2011 +0100 @@ -31,31 +31,29 @@ */ public abstract class X86TemplateCreator<Template_Type extends X86Template> { - private final Assembly assembly; private final WordWidth addressWidth; private X86InstructionDescription instructionDescription; private InstructionAssessment instructionAssessment; private X86TemplateContext context; private int serial = 1; - protected X86TemplateCreator(Assembly assembly, WordWidth addressWidth) { - this.assembly = assembly; + protected X86TemplateCreator(WordWidth addressWidth) { this.addressWidth = addressWidth; } - private final List<Template_Type> templates = new ArrayList<Template_Type>(); + private final List<Template_Type> templates = new ArrayList<>(); public List<Template_Type> templates() { return templates; } - private final Map<String, List<Template_Type>> internalNameToTemplates = new HashMap<String, List<Template_Type>>(); + private final Map<String, List<Template_Type>> internalNameToTemplates = new HashMap<>(); private void addTemplate(Template_Type template) { templates.add(template); List<Template_Type> t = internalNameToTemplates.get(template.internalName()); if (t == null) { - t = new LinkedList<Template_Type>(); + t = new LinkedList<>(); internalNameToTemplates.put(template.internalName(), t); } t.add(template);
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscAssemblerGenerator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscAssemblerGenerator.java Sun Dec 18 05:24:06 2011 +0100 @@ -43,7 +43,7 @@ super(assembly, false); } - private String encode(OperandField operandField, String val) { + private static String encode(OperandField operandField, String val) { String value = val; // Convert the argument value to the operand value if (operandField.zeroes() != 0) { @@ -129,7 +129,7 @@ * @param rawOperand * a parameter of {@code rawTemplate} */ - private String getRawOperandReplacement(RiscTemplate syntheticTemplate, RiscTemplate rawTemplate, OperandField rawOperand, boolean forLabelAssemblerMethod) { + private static String getRawOperandReplacement(RiscTemplate syntheticTemplate, RiscTemplate rawTemplate, OperandField rawOperand, boolean forLabelAssemblerMethod) { if (Utils.indexOfIdentical(syntheticTemplate.operandFields(), rawOperand) != -1) { if (rawOperand instanceof OffsetParameter && forLabelAssemblerMethod) { return LABEL.variableName();
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscAssembly.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscAssembly.java Sun Dec 18 05:24:06 2011 +0100 @@ -41,12 +41,12 @@ private List<SpecificityGroup> specificityGroups; private void initialize() { - final IntHashMap<IntHashMap<OpcodeMaskGroup>> specificityTable = new IntHashMap<IntHashMap<OpcodeMaskGroup>>(); + final IntHashMap<IntHashMap<OpcodeMaskGroup>> specificityTable = new IntHashMap<>(); for (RiscTemplate template : templates()) { if (!template.isRedundant()) { IntHashMap<OpcodeMaskGroup> opcodeMaskGroups = specificityTable.get(template.specificity()); if (opcodeMaskGroups == null) { - opcodeMaskGroups = new IntHashMap<OpcodeMaskGroup>(); + opcodeMaskGroups = new IntHashMap<>(); specificityTable.put(template.specificity(), opcodeMaskGroups); } final int opcodeMask = template.opcodeMask(); @@ -58,7 +58,7 @@ opcodeMaskGroup.add(template); } } - specificityGroups = new LinkedList<SpecificityGroup>(); + specificityGroups = new LinkedList<>(); for (int specificity = 33; specificity >= 0; specificity--) { final IntHashMap<OpcodeMaskGroup> opcodeGroupTable = specificityTable.get(specificity); if (opcodeGroupTable != null) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscAssemblyTester.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscAssemblyTester.java Sun Dec 18 05:24:06 2011 +0100 @@ -49,7 +49,7 @@ @Override protected String disassembleFields(Template_Type template, byte[] assembledInstruction) { - return new RiscFieldDisassembler<Template_Type>(template, assembledInstruction).toString(); + return new RiscFieldDisassembler<>(template, assembledInstruction).toString(); } @Override
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscExternalInstruction.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscExternalInstruction.java Sun Dec 18 05:24:06 2011 +0100 @@ -56,14 +56,14 @@ public RiscExternalInstruction(RiscTemplate template, List<Argument> arguments) { this.template = template; - this.arguments = new LinkedList<Argument>(arguments); + this.arguments = new LinkedList<>(arguments); this.address = null; this.addressMapper = null; } public RiscExternalInstruction(RiscTemplate template, List<Argument> arguments, ImmediateArgument address, AddressMapper addressMapper) { this.template = template; - this.arguments = new LinkedList<Argument>(arguments); + this.arguments = new LinkedList<>(arguments); this.address = address; this.addressMapper = addressMapper; }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscInstructionDescriptionCreator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscInstructionDescriptionCreator.java Sun Dec 18 05:24:06 2011 +0100 @@ -46,7 +46,7 @@ return new RiscInstructionDescription(specifications); } - private int firstStringIndex(List<Object> specifications) { + private static int firstStringIndex(List<Object> specifications) { for (int i = 0; i < specifications.size(); i++) { if (specifications.get(i) instanceof String) { return i; @@ -55,11 +55,11 @@ throw ProgramError.unexpected("template instruction description without name"); } - private void setFirstString(List<Object> specifications, String value) { + private static void setFirstString(List<Object> specifications, String value) { specifications.set(firstStringIndex(specifications), value); } - private void eliminateConstraintFor(Parameter parameter, List<Object> specifications) { + private static void eliminateConstraintFor(Parameter parameter, List<Object> specifications) { for (final Iterator iterator = specifications.iterator(); iterator.hasNext();) { final Object s = iterator.next(); if (s instanceof InstructionConstraint) { @@ -71,7 +71,7 @@ } } - private boolean updateSpecifications(List<Object> specifications, Object pattern) { + private static boolean updateSpecifications(List<Object> specifications, Object pattern) { for (int i = 0; i < specifications.size(); i++) { final Object specification = specifications.get(i); if (specification.equals(pattern)) { @@ -102,7 +102,7 @@ } private RiscInstructionDescription createSyntheticInstructionDescription(String name, RiscTemplate template, Object[] patterns) { - final List<Object> specifications = new ArrayList<Object>(template.instructionDescription().specifications()); + final List<Object> specifications = new ArrayList<>(template.instructionDescription().specifications()); for (Object pattern : patterns) { if (!updateSpecifications(specifications, pattern)) { // InstructionDescription with the same name, but different specifications, skip it: @@ -125,11 +125,11 @@ * @return the newly created instruction descriptions resulting from the substitution wrapped in a RiscInstructionDescriptionModifier */ protected RiscInstructionDescriptionModifier synthesize(String name, String templateName, Object... patterns) { - final List<RiscInstructionDescription> instructionDescriptions = new ArrayList<RiscInstructionDescription>(); + final List<RiscInstructionDescription> instructionDescriptions = new ArrayList<>(); // Creating a new VariableSequence here prevents iterator comodification below: final List<? extends RiscTemplate> nameTemplates = templateCreator.nameToTemplates(templateName); if (!nameTemplates.isEmpty()) { - final List<RiscTemplate> templates = new ArrayList<RiscTemplate>(nameTemplates); + final List<RiscTemplate> templates = new ArrayList<>(nameTemplates); assert !templates.isEmpty(); for (RiscTemplate template : templates) { final RiscInstructionDescription instructionDescription = createSyntheticInstructionDescription(name, template, patterns);
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscTemplate.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscTemplate.java Sun Dec 18 05:24:06 2011 +0100 @@ -32,11 +32,11 @@ */ public class RiscTemplate extends Template implements RiscInstructionDescriptionVisitor { - private final List<RiscField> allFields = new LinkedList<RiscField>(); - private final List<OperandField> operandFields = new LinkedList<OperandField>(); - private final List<OptionField> optionFields = new LinkedList<OptionField>(); - private final List<OperandField> parameters = new ArrayList<OperandField>(); - private final List<Option> options = new LinkedList<Option>(); + private final List<RiscField> allFields = new LinkedList<>(); + private final List<OperandField> operandFields = new LinkedList<>(); + private final List<OptionField> optionFields = new LinkedList<>(); + private final List<OperandField> parameters = new ArrayList<>(); + private final List<Option> options = new LinkedList<>(); private int opcode; private int opcodeMask; @@ -141,7 +141,7 @@ return Integer.bitCount(opcodeMask); } - public void organizeOption(Option option, RiscTemplate canonicalRepresentative) { + public void organizeOption(Option option, RiscTemplate newCanonicalRepresentative) { instructionDescription().setExternalName(externalName() + option.externalName()); setInternalName(internalName() + option.name()); try { @@ -153,7 +153,7 @@ options.add(option); if (option.isRedundant()) { - this.canonicalRepresentative = canonicalRepresentative; + this.canonicalRepresentative = newCanonicalRepresentative; } }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscTemplateCreator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/RiscTemplateCreator.java Sun Dec 18 05:24:06 2011 +0100 @@ -35,7 +35,7 @@ public RiscTemplateCreator() { } - private List<RiscTemplate> templates = new LinkedList<RiscTemplate>(); + private List<RiscTemplate> templates = new LinkedList<>(); public List<RiscTemplate> templates() { return templates; @@ -46,7 +46,7 @@ } public List<RiscTemplate> createOptionTemplates(List<RiscTemplate> templateList, OptionField optionField) { - final List<RiscTemplate> newTemplates = new LinkedList<RiscTemplate>(); + final List<RiscTemplate> newTemplates = new LinkedList<>(); for (RiscTemplate template : templateList) { RiscTemplate canonicalRepresentative = null; if (optionField.defaultOption() != null) { @@ -67,12 +67,13 @@ } private int serial; + @SuppressWarnings("serial") private HashMap<String, List<RiscTemplate>> nameToTemplates = new HashMap<String, List<RiscTemplate>>() { @Override public List<RiscTemplate> get(Object key) { List<RiscTemplate> list = super.get(key); if (list == null) { - list = new ArrayList<RiscTemplate>(); + list = new ArrayList<>(); put((String) key, list); } return list; @@ -84,14 +85,14 @@ } public void createTemplates(RiscInstructionDescriptionCreator instructionDescriptionCreator) { - final List<RiscTemplate> initialTemplates = new LinkedList<RiscTemplate>(); + final List<RiscTemplate> initialTemplates = new LinkedList<>(); for (InstructionDescription instructionDescription : instructionDescriptionCreator.instructionDescriptions()) { final RiscTemplate template = createTemplate(instructionDescription); initialTemplates.add(template); RiscInstructionDescriptionVisitor.Static.visitInstructionDescription(template, instructionDescription); } for (RiscTemplate initialTemplate : initialTemplates) { - List<RiscTemplate> newTemplates = new LinkedList<RiscTemplate>(); + List<RiscTemplate> newTemplates = new LinkedList<>(); newTemplates.add(initialTemplate); for (OptionField optionField : initialTemplate.optionFields()) { newTemplates = createOptionTemplates(newTemplates, optionField);
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/arm/ARMFields.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/arm/ARMFields.java Sun Dec 18 05:24:06 2011 +0100 @@ -74,7 +74,7 @@ public static final ImmediateOperandField bits_31_0 = new ImmediateOperandField(new DescendingBitRange(31, 0)) { @Override public Iterable< ? extends Argument> getIllegalTestArguments() { - final List<Immediate32Argument> illegalTestArguments = new ArrayList<Immediate32Argument>(); + final List<Immediate32Argument> illegalTestArguments = new ArrayList<>(); illegalTestArguments.add(new Immediate32Argument(0x101)); illegalTestArguments.add(new Immediate32Argument(0x102)); illegalTestArguments.add(new Immediate32Argument(0xff1)); @@ -85,7 +85,7 @@ } @Override public Iterable< ? extends Argument> getLegalTestArguments() { - final List<Immediate32Argument> legalTestArguments = new ArrayList<Immediate32Argument>(); + final List<Immediate32Argument> legalTestArguments = new ArrayList<>(); int argument; for (int imm : new int[]{0, 1, 31, 32, 33, 63, 64, 65, 127, 128, 129, 254, 255}) { for (int j = 0; j < 32; j += 2) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/bitRange/CompoundBitRange.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/bitRange/CompoundBitRange.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,7 +34,7 @@ super(); } - private List<ContiguousBitRange> contiguousBitRanges = new ArrayList<ContiguousBitRange>(); + private List<ContiguousBitRange> contiguousBitRanges = new ArrayList<>(); public List<ContiguousBitRange> contiguousBitRanges() { return contiguousBitRanges;
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/field/AlignedImmediateOperandField.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/field/AlignedImmediateOperandField.java Sun Dec 18 05:24:06 2011 +0100 @@ -97,7 +97,7 @@ } @Override - public int assemble(int value) throws IndexOutOfBoundsException, AssemblyException { + public int assemble(int value) throws AssemblyException { return super.assemble(argumentToOperand(value)); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/field/ImmediateOperandField.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/field/ImmediateOperandField.java Sun Dec 18 05:24:06 2011 +0100 @@ -121,7 +121,7 @@ public Iterable<? extends Argument> getLegalTestArguments() { if (testArguments == null) { final List<Integer> integers = signDependentOperations().legalTestArgumentValues(minArgumentValue(), maxArgumentValue(), grain()); - List<Argument> result = new ArrayList<Argument>(integers.size()); + List<Argument> result = new ArrayList<>(integers.size()); for (Integer i : integers) { result.add(new Immediate32Argument(i)); } @@ -132,7 +132,7 @@ public Iterable<? extends Argument> getIllegalTestArguments() { if (this.illegalTestArguments == null) { - final List<Immediate32Argument> illegalArguments = new LinkedList<Immediate32Argument>(); + final List<Immediate32Argument> illegalArguments = new LinkedList<>(); final int min = minArgumentValue(); if (min != Integer.MIN_VALUE) { illegalArguments.add(new Immediate32Argument(min - 1)); @@ -149,7 +149,7 @@ } public TestArgumentExclusion excludeExternalTestArguments(Argument... arguments) { - return new TestArgumentExclusion(AssemblyTestComponent.EXTERNAL_ASSEMBLER, this, new HashSet<Argument>(Arrays.asList(arguments))); + return new TestArgumentExclusion(AssemblyTestComponent.EXTERNAL_ASSEMBLER, this, new HashSet<>(Arrays.asList(arguments))); } @Override
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/field/OperandField.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/field/OperandField.java Sun Dec 18 05:24:06 2011 +0100 @@ -65,6 +65,9 @@ return signDependentOperations.minArgumentValue(bitRange()); } + /** + * @throws AssemblyException + */ public int assemble(int value) throws AssemblyException { return signDependentOperations.assemble(value, bitRange()); } @@ -148,7 +151,7 @@ } public OperandField<Argument_Type> withExcludedDisassemblerTestArguments(Argument... arguments) { - return withExcludedDisassemblerTestArguments(new HashSet<Argument>(Arrays.asList(arguments))); + return withExcludedDisassemblerTestArguments(new HashSet<>(Arrays.asList(arguments))); } public Set<Argument> excludedDisassemblerTestArguments() { @@ -164,7 +167,7 @@ } public OperandField<Argument_Type> withExcludedExternalTestArguments(Argument... arguments) { - return withExcludedExternalTestArguments(new HashSet<Argument>(Arrays.asList(arguments))); + return withExcludedExternalTestArguments(new HashSet<>(Arrays.asList(arguments))); } public Set<Argument> excludedExternalTestArguments() {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/field/OptionField.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/field/OptionField.java Sun Dec 18 05:24:06 2011 +0100 @@ -67,7 +67,7 @@ return defaultOption; } - protected List<Option> options = new LinkedList<Option>(); + protected List<Option> options = new LinkedList<>(); public Iterable<Option> options() { return options; @@ -76,7 +76,7 @@ @Override public OptionField clone() { final OptionField result = (OptionField) super.clone(); - result.options = new LinkedList<Option>(options); + result.options = new LinkedList<>(options); return result; }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/field/SignDependentOperations.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/field/SignDependentOperations.java Sun Dec 18 05:24:06 2011 +0100 @@ -136,7 +136,7 @@ public static List<Integer> smallContiguousRange(int min, int max, int grain) { final long range = (((long) max - (long) min) + 1) / grain; if (range > 0 && range <= 32) { - final List<Integer> result = new ArrayList<Integer>((int) range); + final List<Integer> result = new ArrayList<>((int) range); for (int i = min; i <= max; i += grain * 2) { result.add(i); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/field/SymbolicOperandField.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/field/SymbolicOperandField.java Sun Dec 18 05:24:06 2011 +0100 @@ -45,13 +45,13 @@ public static <Argument_Type extends SymbolicArgument> SymbolicOperandField<Argument_Type> createAscending(Symbolizer<Argument_Type> symbolizer, int... bits) { final BitRange bitRange = BitRange.create(bits, BitRangeOrder.ASCENDING); - return new SymbolicOperandField<Argument_Type>(bitRange, symbolizer); + return new SymbolicOperandField<>(bitRange, symbolizer); } public static <Argument_Type extends SymbolicArgument> SymbolicOperandField<Argument_Type> createDescending(String variableName, final Symbolizer<Argument_Type> symbolizer, int... bits) { final BitRange bitRange = BitRange.create(bits, BitRangeOrder.DESCENDING); - final SymbolicOperandField<Argument_Type> field = new SymbolicOperandField<Argument_Type>(bitRange, symbolizer); + final SymbolicOperandField<Argument_Type> field = new SymbolicOperandField<>(bitRange, symbolizer); if (variableName != null) { field.setVariableName(variableName); } @@ -78,7 +78,7 @@ return variableName() + ".value()"; } - public int assemble(Argument_Type argument) throws AssemblyException { + public int assemble(Argument_Type argument) { return bitRange().assembleUncheckedUnsignedInt(argument.value()); } @@ -112,7 +112,7 @@ } public TestArgumentExclusion excludeExternalTestArguments(Argument... arguments) { - return new TestArgumentExclusion(AssemblyTestComponent.EXTERNAL_ASSEMBLER, this, new HashSet<Argument>(Arrays.asList(arguments))); + return new TestArgumentExclusion(AssemblyTestComponent.EXTERNAL_ASSEMBLER, this, new HashSet<>(Arrays.asList(arguments))); } @Override
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/ppc/PPCAssembly.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/ppc/PPCAssembly.java Sun Dec 18 05:24:06 2011 +0100 @@ -40,14 +40,17 @@ super(ISA.PPC, RiscTemplate.class); } + @SuppressWarnings("static-method") public boolean generatingDeprecatedInstructions() { return GENERATING_DEPRECATED_INSTRUCTIONS; } + @SuppressWarnings("static-method") public boolean generating64BitInstructions() { return GENERATING_64BIT_INSTRUCTIONS; } + @SuppressWarnings("static-method") public boolean generatingPower5Instructions() { return GENERATING_POWER5_INSTRUCTIONS; } @@ -59,6 +62,7 @@ * This will have to be a non-constant method should another non-broken external assembler * be used for testing. */ + @SuppressWarnings("static-method") public boolean isExternalMTCRFEncodingBroken() { return true; }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/sparc/SPARCAssembly.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/gen/risc/sparc/SPARCAssembly.java Sun Dec 18 05:24:06 2011 +0100 @@ -39,10 +39,12 @@ super(ISA.SPARC, RiscTemplate.class); } + @SuppressWarnings("static-method") public boolean generatingDeprecatedInstructions() { return GENERATING_DEPRECATED_INSTRUCTIONS; } + @SuppressWarnings("static-method") public boolean generatingV9Instructions() { return GENERATING_V9_INSTRUCTIONS; }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32BaseRegister32.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32BaseRegister32.java Sun Dec 18 05:24:06 2011 +0100 @@ -77,5 +77,5 @@ return EBX_BASE; } - public static final Enumerator<IA32BaseRegister32> ENUMERATOR = new Enumerator<IA32BaseRegister32>(IA32BaseRegister32.class); + public static final Enumerator<IA32BaseRegister32> ENUMERATOR = new Enumerator<>(IA32BaseRegister32.class); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32GeneralRegister16.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32GeneralRegister16.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,7 +34,7 @@ AX, CX, DX, BX, SP, BP, SI, DI; - public static final Enumerator<IA32GeneralRegister16> ENUMERATOR = new Enumerator<IA32GeneralRegister16>(IA32GeneralRegister16.class); + public static final Enumerator<IA32GeneralRegister16> ENUMERATOR = new Enumerator<>(IA32GeneralRegister16.class); public static IA32GeneralRegister16 from(GeneralRegister generalRegister) { return ENUMERATOR.get(generalRegister.id());
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32GeneralRegister32.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32GeneralRegister32.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,7 +34,7 @@ EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI; - public static final Enumerator<IA32GeneralRegister32> ENUMERATOR = new Enumerator<IA32GeneralRegister32>(IA32GeneralRegister32.class); + public static final Enumerator<IA32GeneralRegister32> ENUMERATOR = new Enumerator<>(IA32GeneralRegister32.class); public static IA32GeneralRegister32 from(GeneralRegister generalRegister) { return ENUMERATOR.get(generalRegister.id());
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32GeneralRegister8.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32GeneralRegister8.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,7 +34,7 @@ AL, CL, DL, BL, AH, CH, DH, BH; - public static final Enumerator<IA32GeneralRegister8> ENUMERATOR = new Enumerator<IA32GeneralRegister8>(IA32GeneralRegister8.class); + public static final Enumerator<IA32GeneralRegister8> ENUMERATOR = new Enumerator<>(IA32GeneralRegister8.class); private static final IA32GeneralRegister8[] lowRegisters = {AL, CL, DL, BL};
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32IndexRegister32.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32IndexRegister32.java Sun Dec 18 05:24:06 2011 +0100 @@ -39,7 +39,7 @@ ESI_INDEX, EDI_INDEX; - public static final Enumerator<IA32IndexRegister32> ENUMERATOR = new Enumerator<IA32IndexRegister32>(IA32IndexRegister32.class); + public static final Enumerator<IA32IndexRegister32> ENUMERATOR = new Enumerator<>(IA32IndexRegister32.class); public static IA32IndexRegister32 from(GeneralRegister generalRegister) { int ordinal = generalRegister.id(); if (ordinal >= IA32GeneralRegister32.ESP.id()) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32IndirectRegister16.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32IndirectRegister16.java Sun Dec 18 05:24:06 2011 +0100 @@ -39,7 +39,7 @@ BP_INDIRECT(IA32GeneralRegister16.BP.id(), "%bp", "bp"), BX_INDIRECT(IA32GeneralRegister16.BX.id(), "%bx", "bx"); - public static final Enumerator<IA32IndirectRegister16> ENUMERATOR = new Enumerator<IA32IndirectRegister16>(IA32IndirectRegister16.class); + public static final Enumerator<IA32IndirectRegister16> ENUMERATOR = new Enumerator<>(IA32IndirectRegister16.class); private final int id; private final String externalValue;
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32IndirectRegister32.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32IndirectRegister32.java Sun Dec 18 05:24:06 2011 +0100 @@ -39,7 +39,7 @@ ESI_INDIRECT, EDI_INDIRECT; - public static final Enumerator<IA32IndirectRegister32> ENUMERATOR = new Enumerator<IA32IndirectRegister32>(IA32IndirectRegister32.class); + public static final Enumerator<IA32IndirectRegister32> ENUMERATOR = new Enumerator<>(IA32IndirectRegister32.class); public static IA32IndirectRegister32 from(GeneralRegister generalRegister) { return ENUMERATOR.get(generalRegister.id());
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32XMMComparison.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32XMMComparison.java Sun Dec 18 05:24:06 2011 +0100 @@ -63,6 +63,6 @@ return LESS_THAN_OR_EQUAL; } - public static final Enumerator<IA32XMMComparison> ENUMERATOR = new Enumerator<IA32XMMComparison>(IA32XMMComparison.class); + public static final Enumerator<IA32XMMComparison> ENUMERATOR = new Enumerator<>(IA32XMMComparison.class); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32XMMRegister.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/IA32XMMRegister.java Sun Dec 18 05:24:06 2011 +0100 @@ -31,7 +31,7 @@ XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7; - public static final Enumerator<IA32XMMRegister> ENUMERATOR = new Enumerator<IA32XMMRegister>(IA32XMMRegister.class); + public static final Enumerator<IA32XMMRegister> ENUMERATOR = new Enumerator<>(IA32XMMRegister.class); public int value() { return ordinal(); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/complete/IA32LabelAssembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/complete/IA32LabelAssembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -27,6 +27,7 @@ import com.sun.max.asm.ia32.*; import com.sun.max.asm.x86.*; +@SuppressWarnings("unused") public abstract class IA32LabelAssembler extends IA32RawAssembler { public IA32LabelAssembler(int startAddress) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/complete/IA32RawAssembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ia32/complete/IA32RawAssembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -27,6 +27,7 @@ import com.sun.max.asm.ia32.*; import com.sun.max.asm.x86.*; +@SuppressWarnings("all") public abstract class IA32RawAssembler extends AbstractIA32Assembler { public IA32RawAssembler(int startAddress) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ppc/CRF.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ppc/CRF.java Sun Dec 18 05:24:06 2011 +0100 @@ -67,7 +67,7 @@ /** * Given the index of a bit within this 4-bit field, returns the index of the same bit * in the 32-bit Condition Register. - * + * * @throws IllegalArgumentException if n is not between 0 and 3 inclusive */ public int bitFor(int n) { @@ -137,6 +137,6 @@ */ public static final int UN = 3; - public static final Enumerator<CRF> ENUMERATOR = new Enumerator<CRF>(CRF.class); + public static final Enumerator<CRF> ENUMERATOR = new Enumerator<>(CRF.class); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ppc/FPR.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ppc/FPR.java Sun Dec 18 05:24:06 2011 +0100 @@ -59,6 +59,6 @@ return F0; } - public static final Enumerator<FPR> ENUMERATOR = new Enumerator<FPR>(FPR.class); + public static final Enumerator<FPR> ENUMERATOR = new Enumerator<>(FPR.class); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ppc/complete/PPCLabelAssembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/ppc/complete/PPCLabelAssembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -26,6 +26,7 @@ import com.sun.max.asm.*; import com.sun.max.asm.ppc.*; +@SuppressWarnings("unused") public abstract class PPCLabelAssembler extends PPCRawAssembler { // START GENERATED LABEL ASSEMBLER METHODS
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/sparc/FPR.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/sparc/FPR.java Sun Dec 18 05:24:06 2011 +0100 @@ -120,6 +120,7 @@ private static final FPR[] doubleValues = {F0, F2, F4, F6, F8, F10, F12, F14, F16, F18, F20, F22, F24, F26, F28, F30, F32, F34, F36, F38, F40, F42, F44, F46, F48, F50, F52, F54, F56, F58, F60, F62}; + @SuppressWarnings("unused") private static final FPR[] quadrupleValues = {F0, F4, F8, F12, F16, F20, F24, F28, F32, F36, F40, F44, F48, F52, F56, F60}; public static FPR fromValue(int value) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/sparc/complete/SPARCAssembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/sparc/complete/SPARCAssembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -33,6 +33,7 @@ * The base class for the 32-bit and 64-bit SPARC assemblers. This class also defines * the more complex synthetic SPARC instructions. */ +@SuppressWarnings("unused") public abstract class SPARCAssembler extends SPARCLabelAssembler { public static SPARCAssembler createAssembler(WordWidth wordWidth) {
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/sparc/complete/SPARCLabelAssembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/sparc/complete/SPARCLabelAssembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -26,6 +26,7 @@ import com.sun.max.asm.*; import com.sun.max.asm.sparc.*; +@SuppressWarnings("unused") public abstract class SPARCLabelAssembler extends SPARCRawAssembler { // START GENERATED LABEL ASSEMBLER METHODS
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/x86/ControlRegister.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/x86/ControlRegister.java Sun Dec 18 05:24:06 2011 +0100 @@ -61,6 +61,6 @@ return CR0; } - public static final Enumerator<ControlRegister> ENUMERATOR = new Enumerator<ControlRegister>(ControlRegister.class); + public static final Enumerator<ControlRegister> ENUMERATOR = new Enumerator<>(ControlRegister.class); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/x86/DebugRegister.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/x86/DebugRegister.java Sun Dec 18 05:24:06 2011 +0100 @@ -61,6 +61,6 @@ return DR0; } - public static final Enumerator<DebugRegister> ENUMERATOR = new Enumerator<DebugRegister>(DebugRegister.class); + public static final Enumerator<DebugRegister> ENUMERATOR = new Enumerator<>(DebugRegister.class); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/x86/FPStackRegister.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/x86/FPStackRegister.java Sun Dec 18 05:24:06 2011 +0100 @@ -78,6 +78,6 @@ return ST_0; } - public static final Enumerator<FPStackRegister> ENUMERATOR = new Enumerator<FPStackRegister>(FPStackRegister.class); + public static final Enumerator<FPStackRegister> ENUMERATOR = new Enumerator<>(FPStackRegister.class); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/x86/MMXRegister.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/x86/MMXRegister.java Sun Dec 18 05:24:06 2011 +0100 @@ -55,5 +55,5 @@ return MM0; } - public static final Enumerator<MMXRegister> ENUMERATOR = new Enumerator<MMXRegister>(MMXRegister.class); + public static final Enumerator<MMXRegister> ENUMERATOR = new Enumerator<>(MMXRegister.class); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/x86/Scale.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/x86/Scale.java Sun Dec 18 05:24:06 2011 +0100 @@ -55,6 +55,6 @@ return SCALE_4; } - public static final Enumerator<Scale> ENUMERATOR = new Enumerator<Scale>(Scale.class); + public static final Enumerator<Scale> ENUMERATOR = new Enumerator<>(Scale.class); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/x86/SegmentRegister.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/x86/SegmentRegister.java Sun Dec 18 05:24:06 2011 +0100 @@ -60,6 +60,6 @@ return ES; } - public static final Enumerator<SegmentRegister> ENUMERATOR = new Enumerator<SegmentRegister>(SegmentRegister.class); + public static final Enumerator<SegmentRegister> ENUMERATOR = new Enumerator<>(SegmentRegister.class); }
--- a/graal/com.oracle.max.asmdis/src/com/sun/max/asm/x86/TestRegister.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/src/com/sun/max/asm/x86/TestRegister.java Sun Dec 18 05:24:06 2011 +0100 @@ -61,6 +61,6 @@ return TR3; } - public static final Enumerator<TestRegister> ENUMERATOR = new Enumerator<TestRegister>(TestRegister.class); + public static final Enumerator<TestRegister> ENUMERATOR = new Enumerator<>(TestRegister.class); }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/AssemblerTestCase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/AssemblerTestCase.java Sun Dec 18 05:24:06 2011 +0100 @@ -53,6 +53,7 @@ /** * Subclasses override this to modify a tester that is about to be {@linkplain #run() run}. * Typically, the modification is based on the values of any subclasses specific addition to {@link #options}. + * @param tester */ protected void configure(AssemblyTester tester) { }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/amd64/BoundLabelTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/amd64/BoundLabelTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -61,7 +61,7 @@ private static final int LABEL_DELTA = 10; - private int insertInstructions(AMD64Assembler assembler, Label[] labels, int labelIndex) { + private static int insertInstructions(AMD64Assembler assembler, Label[] labels, int labelIndex) { int index = labelIndex; for (int i = 0; i < LABEL_DELTA; i++) { assembler.bindLabel(labels[index]); @@ -71,7 +71,7 @@ return index; } - private byte[] assemble(long startAddress, int labelDelta) throws IOException, AssemblyException { + private static byte[] assemble(long startAddress, int labelDelta) throws AssemblyException { final AMD64Assembler assembler = new AMD64Assembler(startAddress); final List<AMD64Template> labelTemplates = AMD64Assembly.ASSEMBLY.labelTemplates(); final Label[] labels = new Label[labelTemplates.size() + LABEL_DELTA]; @@ -87,7 +87,7 @@ } for (AMD64Template template : labelTemplates) { assembler.bindLabel(labels[bindIndex]); - final List<Argument> arguments = new ArrayList<Argument>(template.parameters().size()); + final List<Argument> arguments = new ArrayList<>(template.parameters().size()); for (int parameterIndex = 0; parameterIndex < template.parameters().size(); parameterIndex++) { if (parameterIndex == template.labelParameterIndex()) { arguments.set(parameterIndex, labels[labelIndex]); @@ -118,7 +118,7 @@ return assembler.toByteArray(); } - private void disassemble(long startAddress, byte[] bytes) throws IOException, AssemblyException { + private static void disassemble(long startAddress, byte[] bytes) throws IOException, AssemblyException { final AMD64Disassembler disassembler = new AMD64Disassembler(startAddress, null); final BufferedInputStream stream = new BufferedInputStream(new ByteArrayInputStream(bytes)); disassembler.scanAndPrint(stream, System.out); @@ -137,7 +137,7 @@ disassemble(startAddress, bytes); } - public void test_effectOfVariableInstructionLengthOnLabel() throws IOException, AssemblyException { + public void test_effectOfVariableInstructionLengthOnLabel() throws AssemblyException { // Repeat with different assembled sizes of the 'jnz' instruction below: for (int n = 4; n < 2000; n += 128) { final long startAddress = 0x0L;
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/amd64/InliningAndAlignmentTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/amd64/InliningAndAlignmentTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -61,6 +61,7 @@ junit.textui.TestRunner.run(InliningAndAlignmentTest.class); } + @SuppressWarnings("static-method") private void disassemble(long address, byte[] bytes, InlineDataDecoder inlineDataDecoder) throws IOException, AssemblyException { final AMD64Disassembler disassembler = new AMD64Disassembler(address, inlineDataDecoder); final BufferedInputStream stream = new BufferedInputStream(new ByteArrayInputStream(bytes)); @@ -71,7 +72,8 @@ * The assembly code in this example was once generated by the CPS compiler of the Maxine VM for method 'ExpiringCache.<init>()'. * And then the alignment did not work. The 'jmp' instruction turned out to be only 2 bytes long. */ - private byte[] assembleExpiringCacheInit(long address) throws IOException, AssemblyException { + @SuppressWarnings("static-method") + private byte[] assembleExpiringCacheInit(long address) throws AssemblyException { final AMD64Assembler asm = new AMD64Assembler(address); final Directives dir = asm.directives(); @@ -113,7 +115,8 @@ disassemble(startAddress, bytes, null); } - private byte[] assembleInlinedData(final long startAddress, InlineDataRecorder inlineDataRecorder) throws IOException, AssemblyException { + @SuppressWarnings("static-method") + private byte[] assembleInlinedData(final long startAddress, InlineDataRecorder inlineDataRecorder) throws AssemblyException { // tests inlining of various data types final AMD64Assembler asm = new AMD64Assembler(startAddress); final Directives dir = asm.directives(); @@ -194,7 +197,8 @@ disassemble(longStartAddress, bytes, InlineDataDecoder.createFrom(inlineDataRecorder)); } - private byte[] assembleAlignmentPadding(final long startAddress, InlineDataRecorder inlineDataRecorder) throws IOException, AssemblyException { + @SuppressWarnings("static-method") + private byte[] assembleAlignmentPadding(final long startAddress, InlineDataRecorder inlineDataRecorder) throws AssemblyException { // test memory alignment directives from 1 byte to 16 bytes final AMD64Assembler asm = new AMD64Assembler(startAddress); final Directives dir = asm.directives(); @@ -298,7 +302,7 @@ disassemble(longStartAddress, bytes, InlineDataDecoder.createFrom(inlineDataRecorder)); } - private byte[] assembleJumpAndAlignmentPadding(long startAddress, InlineDataRecorder inlineDataRecorder) throws IOException, AssemblyException { + private static byte[] assembleJumpAndAlignmentPadding(long startAddress, InlineDataRecorder inlineDataRecorder) throws AssemblyException { // tests span dependent instruction processing for label and padding instructions final AMD64Assembler asm = new AMD64Assembler(startAddress); final Directives dir = asm.directives(); @@ -363,7 +367,7 @@ disassemble(longStartAddress, bytes, InlineDataDecoder.createFrom(inlineDataRecorder)); } - private byte[] assembleInvalidInstructionDisassembly(long startAddress, InlineDataRecorder inlineDataRecorder) throws IOException, AssemblyException { + private static byte[] assembleInvalidInstructionDisassembly(long startAddress, InlineDataRecorder inlineDataRecorder) throws AssemblyException { // tests span dependent instruction processing for label and padding instructions final AMD64Assembler asm = new AMD64Assembler(startAddress); final Directives dir = asm.directives(); @@ -407,7 +411,7 @@ * case matchN: rcx = matchN; break; * } */ - private byte[] assembleSwitchTable(long startAddress, int[] matches, InlineDataRecorder inlineDataRecorder) throws IOException, AssemblyException { + private static byte[] assembleSwitchTable(long startAddress, int[] matches, InlineDataRecorder inlineDataRecorder) throws AssemblyException { final AMD64Assembler asm = new AMD64Assembler(startAddress); final Directives directives = asm.directives(); @@ -474,11 +478,11 @@ } } - private void emitByte(AMD64Assembler asm) { + private static void emitByte(AMD64Assembler asm) { asm.int_3(); // any one byte instruction } - private byte[] assembleAlignmentWithVariableLengthInstructions(long startAddress, InlineDataRecorder inlineDataRecorder) throws IOException, AssemblyException { + private static byte[] assembleAlignmentWithVariableLengthInstructions(long startAddress, InlineDataRecorder inlineDataRecorder) throws AssemblyException { final AMD64Assembler asm = new AMD64Assembler(startAddress); final Directives dir = asm.directives();
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/amd64/InternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/amd64/InternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -61,7 +61,7 @@ junit.textui.TestRunner.run(InternalTest.class); } - private void disassemble(long startAddress, byte[] bytes) throws IOException, AssemblyException { + private static void disassemble(long startAddress, byte[] bytes) throws IOException, AssemblyException { final AMD64Disassembler disassembler = new AMD64Disassembler(startAddress, null); final BufferedInputStream stream = new BufferedInputStream(new ByteArrayInputStream(bytes)); disassembler.scanAndPrint(stream, System.out); @@ -91,7 +91,7 @@ } - private byte[] assemble1(long startAddress) throws IOException, AssemblyException { + private static byte[] assemble1(long startAddress) throws AssemblyException { final AMD64GeneralRegister64 myGPR = RAX; final AMD64Assembler asm = new AMD64Assembler(startAddress); final Label startLabel = new Label(); @@ -143,7 +143,7 @@ disassemble(startAddress, bytes); } - private byte[] assemble2(long startAddress) throws IOException, AssemblyException { + private static byte[] assemble2(long startAddress) throws AssemblyException { final AMD64Assembler asm = new AMD64Assembler(startAddress); final Label loop = new Label();
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/amd64/RawDisassemblerAndExternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/amd64/RawDisassemblerAndExternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.amd64; -import java.io.*; import java.util.*; import junit.framework.*; @@ -56,7 +55,7 @@ junit.textui.TestRunner.run(RawDisassemblerAndExternalTest.class); } - public void test_disassemblerAndExternalAssembler() throws FileNotFoundException, IOException { + public void test_disassemblerAndExternalAssembler() { run(new AMD64AssemblyTester(EnumSet.of(AssemblyTestComponent.DISASSEMBLER, AssemblyTestComponent.EXTERNAL_ASSEMBLER))); }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/amd64/RawDisassemblerTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/amd64/RawDisassemblerTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.amd64; -import java.io.*; import java.util.*; import junit.framework.*; @@ -54,7 +53,7 @@ junit.textui.TestRunner.run(RawDisassemblerTest.class); } - public void test_assemble() throws FileNotFoundException, IOException { + public void test_assemble() { run(new AMD64AssemblyTester(EnumSet.of(AssemblyTestComponent.DISASSEMBLER))); } }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/amd64/RawExternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/amd64/RawExternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.amd64; -import java.io.*; import java.util.*; import junit.framework.*; @@ -54,7 +53,7 @@ junit.textui.TestRunner.run(RawExternalTest.class); } - public void test_assemble() throws FileNotFoundException, IOException { + public void test_assemble() { run(new AMD64AssemblyTester(EnumSet.of(AssemblyTestComponent.EXTERNAL_ASSEMBLER))); }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/arm/InliningAndAlignmentTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/arm/InliningAndAlignmentTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,17 +22,8 @@ */ package test.com.sun.max.asm.arm; -import java.io.*; - import junit.framework.*; -import test.com.sun.max.asm.*; - -import com.sun.max.asm.*; -import com.sun.max.asm.Assembler.*; -import com.sun.max.asm.dis.ppc.*; -import com.sun.max.asm.ppc.complete.*; import com.sun.max.ide.*; -import com.sun.max.lang.*; /** */ @@ -56,197 +47,4 @@ public static void main(String[] args) { junit.textui.TestRunner.run(InliningAndAlignmentTest.class); } - - private void disassemble(PPCDisassembler disassembler, byte[] bytes) throws IOException, AssemblyException { - final BufferedInputStream stream = new BufferedInputStream(new ByteArrayInputStream(bytes)); - disassembler.scanAndPrint(stream, System.out); - } - - private byte[] assembleInlineData(PPCAssembler asm, long startAddress, InlineDataRecorder recorder) throws IOException, AssemblyException { - final Directives dir = asm.directives(); - final Label label1 = new Label(); - - asm.b(label1); - asm.nop(); - - final byte byteValue = (byte) 0x77; - final Label inlinedByte = new Label(); - asm.bindLabel(inlinedByte); - dir.inlineByte(byteValue); - - final short shortValue = (short) 0xABCD; - final Label inlinedShort = new Label(); - asm.bindLabel(inlinedShort); - dir.inlineShort(shortValue); - - final int intValue = 0x12345678; - final Label inlinedInt = new Label(); - asm.bindLabel(inlinedInt); - dir.inlineInt(intValue); - - final long longValue = 0x12345678CAFEBABEL; - final Label inlinedLong = new Label(); - asm.bindLabel(inlinedLong); - dir.inlineLong(longValue); - - final byte[] byteArrayValue = {1, 2, 3, 4, 5}; - final Label inlinedByteArray = new Label(); - asm.bindLabel(inlinedByteArray); - dir.inlineByteArray(byteArrayValue); - - final Label labelValue = label1; - final Label inlinedLabel = new Label(); - asm.bindLabel(inlinedLabel); - dir.inlineAddress(labelValue); - - final Label inlinedPaddingByte = new Label(); - asm.bindLabel(inlinedPaddingByte); - dir.inlineByte((byte) 0); - - final Label unalignedLabel = new Label(); - asm.bindLabel(unalignedLabel); - - dir.align(4); - asm.bindLabel(label1); - asm.nop(); - - // retrieve the byte stream output of the assembler and confirm that the inlined data is in the expected format, and are aligned correctly - final byte[] asmBytes = asm.toByteArray(recorder); - - assertTrue(ByteUtils.checkBytes(ByteUtils.toByteArray(byteValue), asmBytes, inlinedByte.position())); - assertEquals(1, inlinedShort.position() - inlinedByte.position()); - - assertTrue(ByteUtils.checkBytes(ByteUtils.toBigEndByteArray(shortValue), asmBytes, inlinedShort.position())); - assertEquals(2, inlinedInt.position() - inlinedShort.position()); - - assertTrue(ByteUtils.checkBytes(ByteUtils.toBigEndByteArray(intValue), asmBytes, inlinedInt.position())); - assertEquals(4, inlinedLong.position() - inlinedInt.position()); - - assertTrue(ByteUtils.checkBytes(ByteUtils.toBigEndByteArray(0x12345678CAFEBABEL), asmBytes, inlinedLong.position())); - assertEquals(8, inlinedByteArray.position() - inlinedLong.position()); - - assertTrue(ByteUtils.checkBytes(byteArrayValue, asmBytes, inlinedByteArray.position())); - assertEquals(5, inlinedLabel.position() - inlinedByteArray.position()); - - if (asm.wordWidth() == WordWidth.BITS_32) { - assertTrue(ByteUtils.checkBytes(ByteUtils.toBigEndByteArray((int) (startAddress + labelValue.position())), asmBytes, inlinedLabel.position())); - } else if (asm.wordWidth() == WordWidth.BITS_64) { - assertTrue(ByteUtils.checkBytes(ByteUtils.toBigEndByteArray(startAddress + labelValue.position()), asmBytes, inlinedLabel.position())); - } - assertEquals(asm.wordWidth().numberOfBytes, inlinedPaddingByte.position() - inlinedLabel.position()); - - return asmBytes; - } - - private byte[] assembleAlignmentPadding(PPCAssembler asm, long startAddress, InlineDataRecorder recorder) throws IOException, AssemblyException { - // test memory alignment directives from 1 byte to 16 bytes - final Directives dir = asm.directives(); - - final Label unalignedLabel1 = new Label(); - final Label alignedLabel1 = new Label(); - - final Label unalignedLabel2 = new Label(); - final Label alignedLabel2 = new Label(); - - final Label unalignedLabel4By1 = new Label(); - final Label alignedLabel4By1 = new Label(); - - final Label unalignedLabel4By2 = new Label(); - final Label alignedLabel4By2 = new Label(); - - final Label unalignedLabel4By3 = new Label(); - final Label alignedLabel4By3 = new Label(); - - final Label unalignedLabel8 = new Label(); - final Label alignedLabel8 = new Label(); - - final Label unalignedLabel16 = new Label(); - final Label alignedLabel16 = new Label(); - - final Label done = new Label(); - - asm.b(done); - dir.inlineByteArray(new byte[]{1}); // padding to make the following unaligned by 1 byte - asm.bindLabel(unalignedLabel1); - dir.align(1); - asm.bindLabel(alignedLabel1); - asm.nop(); - - dir.align(4); - asm.b(done); - dir.inlineByteArray(new byte[]{1}); // padding to make the following unaligned by 1 byte - asm.bindLabel(unalignedLabel2); - dir.align(2); - asm.bindLabel(alignedLabel2); - asm.nop(); - - dir.align(4); - asm.b(done); - dir.inlineByteArray(new byte[]{1}); // padding to make the following unaligned by 1 byte - asm.bindLabel(unalignedLabel4By1); - dir.align(4); - asm.bindLabel(alignedLabel4By1); - asm.nop(); - - dir.align(4); - asm.b(done); - dir.inlineByteArray(new byte[]{1, 2}); // padding to make the following unaligned by 2 bytes - asm.bindLabel(unalignedLabel4By2); - dir.align(4); - asm.bindLabel(alignedLabel4By2); - asm.nop(); - - dir.align(4); - asm.b(done); - dir.inlineByteArray(new byte[]{1, 2, 3}); // padding to make the following unaligned by 3 bytes - asm.bindLabel(unalignedLabel4By3); - dir.align(4); - asm.bindLabel(alignedLabel4By3); - asm.nop(); - - dir.align(4); - asm.b(done); - dir.inlineByteArray(new byte[]{1}); // padding to make the following unaligned by 1 byte - asm.bindLabel(unalignedLabel8); - dir.align(8); - asm.bindLabel(alignedLabel8); - asm.nop(); - - dir.align(4); - asm.b(done); - dir.inlineByteArray(new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9}); // padding to make the following unaligned by 1 byte - asm.bindLabel(unalignedLabel16); - dir.align(16); - asm.bindLabel(alignedLabel16); - asm.nop(); - - dir.align(4); - asm.bindLabel(done); - asm.nop(); - - // check the memory alignment (and that the memory locations were unaligned before the alignment directives) - final byte[] asmCode = asm.toByteArray(recorder); - - assertEquals(1, (startAddress + unalignedLabel2.position()) % 2); - assertEquals(0, (startAddress + alignedLabel2.position()) % 2); - - assertEquals(1, (startAddress + unalignedLabel4By1.position()) % 4); - assertEquals(0, (startAddress + alignedLabel4By1.position()) % 4); - - assertEquals(2, (startAddress + unalignedLabel4By2.position()) % 4); - assertEquals(0, (startAddress + alignedLabel4By2.position()) % 4); - - assertEquals(3, (startAddress + unalignedLabel4By3.position()) % 4); - assertEquals(0, (startAddress + alignedLabel4By3.position()) % 4); - - assertEquals(1, (startAddress + unalignedLabel8.position()) % 8); - assertEquals(0, (startAddress + alignedLabel8.position()) % 8); - - assertEquals(1, (startAddress + unalignedLabel16.position()) % 16); - assertEquals(0, (startAddress + alignedLabel16.position()) % 16); - - assertEquals(0, (startAddress + done.position()) % 4); - - return asmCode; - } }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/arm/InternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/arm/InternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -58,12 +58,12 @@ junit.textui.TestRunner.run(InternalTest.class); } - private byte[] assemble(ARMAssembler asm) throws IOException, AssemblyException { + private static byte[] assemble(ARMAssembler asm) throws AssemblyException { asm.adc(EQ, S, R0, R0, 1); return asm.toByteArray(); } - private void disassemble(ARMDisassembler disassembler, byte[] bytes) throws IOException, AssemblyException { + private static void disassemble(ARMDisassembler disassembler, byte[] bytes) throws IOException, AssemblyException { final BufferedInputStream stream = new BufferedInputStream(new ByteArrayInputStream(bytes)); disassembler.scanAndPrint(stream, System.out); }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/arm/RawDisassemblerAndExternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/arm/RawDisassemblerAndExternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.arm; -import java.io.*; import java.util.*; import junit.framework.*; @@ -57,7 +56,7 @@ junit.textui.TestRunner.run(RawDisassemblerAndExternalTest.class); } - public void test_disassemblerAndExternalAssembler() throws FileNotFoundException, IOException { + public void test_disassemblerAndExternalAssembler() { run(new ARMAssemblyTester(ARMAssembly.ASSEMBLY, WordWidth.BITS_32, EnumSet.of(AssemblyTestComponent.DISASSEMBLER, AssemblyTestComponent.EXTERNAL_ASSEMBLER))); }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/arm/RawDisassemblerTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/arm/RawDisassemblerTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.arm; -import java.io.*; import java.util.*; import junit.framework.*; @@ -55,7 +54,7 @@ junit.textui.TestRunner.run(RawDisassemblerTest.class); } - public void test_disassembler() throws FileNotFoundException, IOException { + public void test_disassembler() { run(new ARMAssemblyTester(ARMAssembly.ASSEMBLY, WordWidth.BITS_32, EnumSet.of(AssemblyTestComponent.DISASSEMBLER))); } }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/arm/RawExternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/arm/RawExternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.arm; -import java.io.*; import java.util.*; import junit.framework.*; @@ -55,7 +54,7 @@ junit.textui.TestRunner.run(RawExternalTest.class); } - public void test_assemble() throws FileNotFoundException, IOException { + public void test_assemble() { run(new ARMAssemblyTester(ARMAssembly.ASSEMBLY, WordWidth.BITS_32, EnumSet.of(AssemblyTestComponent.EXTERNAL_ASSEMBLER))); }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/arm/SpeedTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/arm/SpeedTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,8 +22,6 @@ */ package test.com.sun.max.asm.arm; -import java.io.*; - import junit.framework.*; import com.sun.max.asm.*; @@ -53,7 +51,7 @@ junit.textui.TestRunner.run(SpeedTest.class); } - public byte[] produce() throws IOException, AssemblyException { + public byte[] produce() throws AssemblyException { final int startAddress = 0x0000ecf0; final ARMAssembler asm = new ARMAssembler(startAddress); //final Label label1 = new Label(); @@ -100,7 +98,7 @@ return asm.toByteArray(); } - public void test_speed() throws IOException, AssemblyException { + public void test_speed() throws AssemblyException { System.out.println("start"); for (int i = 0; i < 10000000; i++) { produce();
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ia32/InliningAndAlignmentTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ia32/InliningAndAlignmentTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -60,13 +60,13 @@ junit.textui.TestRunner.run(InliningAndAlignmentTest.class); } - private void disassemble(int startAddress, byte[] bytes, InlineDataDecoder inlineDataDecoder) throws IOException, AssemblyException { + private static void disassemble(int startAddress, byte[] bytes, InlineDataDecoder inlineDataDecoder) throws IOException, AssemblyException { final IA32Disassembler disassembler = new IA32Disassembler(startAddress, inlineDataDecoder); final BufferedInputStream stream = new BufferedInputStream(new ByteArrayInputStream(bytes)); disassembler.scanAndPrint(stream, System.out); } - private byte[] assembleInlinedData(int startAddress, InlineDataRecorder recorder) throws IOException, AssemblyException { + private static byte[] assembleInlinedData(int startAddress, InlineDataRecorder recorder) throws AssemblyException { // tests inlining of various data types final IA32Assembler asm = new IA32Assembler(startAddress); final Directives dir = asm.directives(); @@ -147,7 +147,7 @@ disassemble(intStartAddress, bytes, InlineDataDecoder.createFrom(recorder)); } - private byte[] assembleAlignmentPadding(int startAddress, InlineDataRecorder recorder) throws IOException, AssemblyException { + private static byte[] assembleAlignmentPadding(int startAddress, InlineDataRecorder recorder) throws AssemblyException { // test memory alignment directives from 1 byte to 16 bytes final IA32Assembler asm = new IA32Assembler(startAddress); final Directives dir = asm.directives(); @@ -251,7 +251,7 @@ disassemble(intStartAddress, bytes, InlineDataDecoder.createFrom(recorder)); } - private byte[] assembleJumpAndAlignmentPadding(int startAddress, InlineDataRecorder recorder) throws IOException, AssemblyException { + private static byte[] assembleJumpAndAlignmentPadding(int startAddress, InlineDataRecorder recorder) throws AssemblyException { // tests span dependent instruction processing for label and padding instructions final IA32Assembler asm = new IA32Assembler(startAddress); final Directives dir = asm.directives(); @@ -319,7 +319,7 @@ disassemble(intStartAddress, bytes, InlineDataDecoder.createFrom(recorder)); } - private byte[] assembleInvalidInstructionDisassembly(int startAddress, InlineDataRecorder recorder) throws IOException, AssemblyException { + private static byte[] assembleInvalidInstructionDisassembly(int startAddress, InlineDataRecorder recorder) throws AssemblyException { // tests span dependent instruction processing for label and padding instructions final IA32Assembler asm = new IA32Assembler(startAddress); final Directives dir = asm.directives(); @@ -365,7 +365,7 @@ * case matchN: rcx = matchN; break; * } */ - private byte[] assembleSwitchTable(int startAddress, int[] matches, InlineDataRecorder inlineDataRecorder) throws IOException, AssemblyException { + private static byte[] assembleSwitchTable(int startAddress, int[] matches, InlineDataRecorder inlineDataRecorder) throws AssemblyException { final IA32Assembler asm = new IA32Assembler(startAddress); final Directives directives = asm.directives();
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ia32/InternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ia32/InternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -62,7 +62,7 @@ junit.textui.TestRunner.run(InternalTest.class); } - private byte[] assemble(int startAddress) throws IOException, AssemblyException { + private static byte[] assemble(int startAddress) throws AssemblyException { final IA32GeneralRegister32 myGPR = EAX; final IA32Assembler asm = new IA32Assembler(startAddress); final Label startLabel = new Label(); @@ -150,7 +150,7 @@ return asm.toByteArray(); } - private void disassemble(int startAddress, byte[] bytes, InlineDataDecoder inlineDataDecoder) throws IOException, AssemblyException { + private static void disassemble(int startAddress, byte[] bytes, InlineDataDecoder inlineDataDecoder) throws IOException, AssemblyException { final IA32Disassembler disassembler = new IA32Disassembler(startAddress, inlineDataDecoder); final BufferedInputStream stream = new BufferedInputStream(new ByteArrayInputStream(bytes)); disassembler.scanAndPrint(stream, System.out); @@ -162,7 +162,7 @@ disassemble(startAddress, bytes, null); } - private byte[] assembleSwitchTable(int startAddress, InlineDataRecorder recorder) throws IOException, AssemblyException { + private static byte[] assembleSwitchTable(int startAddress, InlineDataRecorder recorder) throws AssemblyException { final IA32Assembler asm = new IA32Assembler(startAddress); final Label skip = new Label(); final Label table = new Label();
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ia32/RawDisassemblerAndExternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ia32/RawDisassemblerAndExternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.ia32; -import java.io.*; import java.util.*; import junit.framework.*; @@ -56,7 +55,7 @@ junit.textui.TestRunner.run(RawDisassemblerAndExternalTest.class); } - public void test_disassemblerAndExternalAssembler() throws FileNotFoundException, IOException { + public void test_disassemblerAndExternalAssembler() { run(new IA32AssemblyTester(EnumSet.of(AssemblyTestComponent.DISASSEMBLER, AssemblyTestComponent.EXTERNAL_ASSEMBLER))); } }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ia32/RawDisassemblerTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ia32/RawDisassemblerTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.ia32; -import java.io.*; import java.util.*; import junit.framework.*; @@ -54,7 +53,7 @@ junit.textui.TestRunner.run(RawDisassemblerTest.class); } - public void test_disassembler() throws FileNotFoundException, IOException { + public void test_disassembler() { run(new IA32AssemblyTester(EnumSet.of(AssemblyTestComponent.DISASSEMBLER))); } }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ia32/RawExternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ia32/RawExternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.ia32; -import java.io.*; import java.util.*; import junit.framework.*; @@ -54,7 +53,7 @@ junit.textui.TestRunner.run(RawExternalTest.class); } - public void test_assemble() throws FileNotFoundException, IOException { + public void test_assemble() { run(new IA32AssemblyTester(EnumSet.of(AssemblyTestComponent.EXTERNAL_ASSEMBLER))); }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ppc/InliningAndAlignmentTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ppc/InliningAndAlignmentTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -56,12 +56,12 @@ junit.textui.TestRunner.run(InliningAndAlignmentTest.class); } - private void disassemble(PPCDisassembler disassembler, byte[] bytes) throws IOException, AssemblyException { + private static void disassemble(PPCDisassembler disassembler, byte[] bytes) throws IOException, AssemblyException { final BufferedInputStream stream = new BufferedInputStream(new ByteArrayInputStream(bytes)); disassembler.scanAndPrint(stream, System.out); } - private byte[] assembleInlineData(PPCAssembler asm, long startAddress, int pointerSize, InlineDataRecorder recorder) throws IOException, AssemblyException { + private static byte[] assembleInlineData(PPCAssembler asm, long startAddress, int pointerSize, InlineDataRecorder recorder) throws AssemblyException { final Directives dir = asm.directives(); final Label label1 = new Label(); @@ -159,7 +159,7 @@ System.out.println(); } - private byte[] assembleAlignmentPadding(PPCAssembler asm, long startAddress, InlineDataRecorder recorder) throws IOException, AssemblyException { + private static byte[] assembleAlignmentPadding(PPCAssembler asm, long startAddress, InlineDataRecorder recorder) throws AssemblyException { // test memory alignment directives from 1 byte to 16 bytes final Directives dir = asm.directives();
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ppc/InternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ppc/InternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -59,7 +59,7 @@ junit.textui.TestRunner.run(InternalTest.class); } - private byte[] assemble(PPCAssembler asm) throws IOException, AssemblyException { + private static byte[] assemble(PPCAssembler asm) throws AssemblyException { final Label loop1 = new Label(); final Label loop2 = new Label(); @@ -79,7 +79,7 @@ return asm.toByteArray(); } - private void disassemble(PPCDisassembler disassembler, byte[] bytes) throws IOException, AssemblyException { + private static void disassemble(PPCDisassembler disassembler, byte[] bytes) throws IOException, AssemblyException { final BufferedInputStream stream = new BufferedInputStream(new ByteArrayInputStream(bytes)); disassembler.scanAndPrint(stream, System.out); }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ppc/RawDisassemblerAndExternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ppc/RawDisassemblerAndExternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.ppc; -import java.io.*; import java.util.*; import junit.framework.*; @@ -56,7 +55,7 @@ junit.textui.TestRunner.run(RawDisassemblerAndExternalTest.class); } - public void test_disassemblerAndExternalAssembler() throws FileNotFoundException, IOException { + public void test_disassemblerAndExternalAssembler() { run(new PPC32AssemblyTester(EnumSet.of(AssemblyTestComponent.DISASSEMBLER, AssemblyTestComponent.EXTERNAL_ASSEMBLER))); }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ppc/RawDisassemblerTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ppc/RawDisassemblerTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.ppc; -import java.io.*; import java.util.*; import junit.framework.*; @@ -54,7 +53,7 @@ junit.textui.TestRunner.run(RawDisassemblerTest.class); } - public void test_disassembler() throws FileNotFoundException, IOException { + public void test_disassembler() { run(new PPC32AssemblyTester(EnumSet.of(AssemblyTestComponent.DISASSEMBLER))); } }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ppc/RawExternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ppc/RawExternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.ppc; -import java.io.*; import java.util.*; import junit.framework.*; @@ -54,7 +53,7 @@ junit.textui.TestRunner.run(RawExternalTest.class); } - public void test_assemble() throws FileNotFoundException, IOException { + public void test_assemble() { run(new PPC32AssemblyTester(EnumSet.of(AssemblyTestComponent.EXTERNAL_ASSEMBLER))); }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ppc/SpeedTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/ppc/SpeedTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -26,8 +26,6 @@ import static com.sun.max.asm.ppc.CRF.*; import static com.sun.max.asm.ppc.GPR.*; -import java.io.*; - import junit.framework.*; import com.sun.max.asm.*; @@ -57,7 +55,7 @@ junit.textui.TestRunner.run(SpeedTest.class); } - public byte[] produce() throws IOException, AssemblyException { + public byte[] produce() throws AssemblyException { final int startAddress = 0x0000ecf0; final PPC32Assembler asm = new PPC32Assembler(startAddress); final Label label1 = new Label(); @@ -102,7 +100,7 @@ return asm.toByteArray(); } - public void test_speed() throws IOException, AssemblyException { + public void test_speed() throws AssemblyException { System.out.println("start"); for (int i = 0; i < 10000000; i++) { produce();
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/sparc/InliningAndAlignmentTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/sparc/InliningAndAlignmentTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -60,12 +60,12 @@ junit.textui.TestRunner.run(InliningAndAlignmentTest.class); } - private void disassemble(SPARCDisassembler disassembler, byte[] bytes, InlineDataDecoder inlineDataDecoder) throws IOException, AssemblyException { + private static void disassemble(SPARCDisassembler disassembler, byte[] bytes) throws IOException, AssemblyException { final BufferedInputStream stream = new BufferedInputStream(new ByteArrayInputStream(bytes)); disassembler.scanAndPrint(stream, System.out); } - private byte[] assembleInlineData(SPARCAssembler asm, long startAddress, int pointerSize, InlineDataRecorder recorder) throws IOException, AssemblyException { + private static byte[] assembleInlineData(SPARCAssembler asm, long startAddress, int pointerSize, InlineDataRecorder recorder) throws AssemblyException { final Directives dir = asm.directives(); final Label label1 = new Label(); @@ -148,7 +148,7 @@ final InlineDataRecorder recorder = new InlineDataRecorder(); final byte[] bytes = assembleInlineData(assembler, startAddress, 4, recorder); final SPARC32Disassembler disassembler = new SPARC32Disassembler(startAddress, InlineDataDecoder.createFrom(recorder)); - disassemble(disassembler, bytes, InlineDataDecoder.createFrom(recorder)); + disassemble(disassembler, bytes); System.out.println(); } @@ -159,11 +159,11 @@ final InlineDataRecorder recorder = new InlineDataRecorder(); final byte[] bytes = assembleInlineData(assembler, startAddress, 8, recorder); final SPARC64Disassembler disassembler = new SPARC64Disassembler(startAddress, InlineDataDecoder.createFrom(recorder)); - disassemble(disassembler, bytes, InlineDataDecoder.createFrom(recorder)); + disassemble(disassembler, bytes); System.out.println(); } - private byte[] assembleAlignmentPadding(SPARCAssembler asm, long startAddress, InlineDataRecorder recorder) throws IOException, AssemblyException { + private static byte[] assembleAlignmentPadding(SPARCAssembler asm, long startAddress, InlineDataRecorder recorder) throws AssemblyException { // test memory alignment directives from 1 byte to 16 bytes final Directives dir = asm.directives(); @@ -282,7 +282,7 @@ final InlineDataRecorder recorder = new InlineDataRecorder(); final byte[] bytes = assembleAlignmentPadding(assembler, startAddress, recorder); final SPARC32Disassembler disassembler = new SPARC32Disassembler(startAddress, InlineDataDecoder.createFrom(recorder)); - disassemble(disassembler, bytes, InlineDataDecoder.createFrom(recorder)); + disassemble(disassembler, bytes); System.out.println(); } @@ -293,11 +293,11 @@ final InlineDataRecorder recorder = new InlineDataRecorder(); final byte[] bytes = assembleAlignmentPadding(assembler, startAddress, recorder); final SPARC64Disassembler disassembler = new SPARC64Disassembler(startAddress, InlineDataDecoder.createFrom(recorder)); - disassemble(disassembler, bytes, InlineDataDecoder.createFrom(recorder)); + disassemble(disassembler, bytes); System.out.println(); } - private byte[] assembleSwitchTable(SPARCAssembler asm, int[] matches, InlineDataRecorder inlineDataRecorder) throws IOException, AssemblyException { + private static byte[] assembleSwitchTable(SPARCAssembler asm, int[] matches, InlineDataRecorder inlineDataRecorder) throws AssemblyException { final Directives directives = asm.directives(); final Label[] matchTargets = new Label[matches.length]; @@ -372,7 +372,7 @@ return asm.toByteArray(inlineDataRecorder); } - private boolean isSimm13(final int imm) { + private static boolean isSimm13(final int imm) { return Ints.numberOfEffectiveSignedBits(imm) <= 13; } @@ -391,7 +391,7 @@ final byte[] bytes = assembleSwitchTable(assembler, matches, recorder); final SPARC32Disassembler disassembler = new SPARC32Disassembler(startAddress, InlineDataDecoder.createFrom(recorder)); - disassemble(disassembler, bytes, InlineDataDecoder.createFrom(recorder)); + disassemble(disassembler, bytes); System.out.println(); } } @@ -405,7 +405,7 @@ final byte[] bytes = assembleSwitchTable(assembler, matches, recorder); final SPARCDisassembler disassembler = new SPARC64Disassembler(startAddress, InlineDataDecoder.createFrom(recorder)); - disassemble(disassembler, bytes, InlineDataDecoder.createFrom(recorder)); + disassemble(disassembler, bytes); System.out.println(); } }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/sparc/InternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/sparc/InternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -61,7 +61,7 @@ junit.textui.TestRunner.run(InternalTest.class); } - private byte[] assemble(SPARCAssembler asm) throws IOException, AssemblyException { + private static byte[] assemble(SPARCAssembler asm) throws AssemblyException { asm.rd(StateRegister.PC, G1); asm.add(G0, I1, O2); @@ -101,7 +101,7 @@ return asm.toByteArray(); } - private void disassemble(SPARCDisassembler disassembler, byte[] bytes) throws IOException, AssemblyException { + private static void disassemble(SPARCDisassembler disassembler, byte[] bytes) throws IOException, AssemblyException { final BufferedInputStream stream = new BufferedInputStream(new ByteArrayInputStream(bytes)); disassembler.scanAndPrint(stream, System.out); }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/sparc/RawDisassemblerAndExternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/sparc/RawDisassemblerAndExternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.sparc; -import java.io.*; import java.util.*; import junit.framework.*; @@ -56,7 +55,7 @@ junit.textui.TestRunner.run(RawDisassemblerAndExternalTest.class); } - public void test_disassemblerAndExternalAssembler() throws FileNotFoundException, IOException { + public void test_disassemblerAndExternalAssembler() { run(new SPARC32AssemblyTester(EnumSet.of(AssemblyTestComponent.DISASSEMBLER, AssemblyTestComponent.EXTERNAL_ASSEMBLER))); } }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/sparc/RawDisassemblerTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/sparc/RawDisassemblerTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.sparc; -import java.io.*; import java.util.*; import junit.framework.*; @@ -54,7 +53,7 @@ junit.textui.TestRunner.run(RawDisassemblerTest.class); } - public void test_assemble() throws FileNotFoundException, IOException { + public void test_assemble() { run(new SPARC32AssemblyTester(EnumSet.of(AssemblyTestComponent.DISASSEMBLER))); } }
--- a/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/sparc/RawExternalTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.asmdis/test/test/com/sun/max/asm/sparc/RawExternalTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package test.com.sun.max.asm.sparc; -import java.io.*; import java.util.*; import junit.framework.*; @@ -54,7 +53,7 @@ junit.textui.TestRunner.run(RawExternalTest.class); } - public void test_assemble() throws FileNotFoundException, IOException { + public void test_assemble() { run(new SPARC32AssemblyTester(EnumSet.of(AssemblyTestComponent.EXTERNAL_ASSEMBLER))); } }
--- a/graal/com.oracle.max.base/src/com/sun/max/Utils.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/Utils.java Sun Dec 18 05:24:06 2011 +0100 @@ -164,7 +164,7 @@ * */ @SuppressWarnings("unchecked") - public static <T> T cast(Class<T> type, Object object) { + public static <T> T cast(@SuppressWarnings("unused") Class<T> type, Object object) { return (T) object; } @@ -184,6 +184,7 @@ * @param tail the elements to be concatenated to {@code head} * @return the result of concatenating {@code tail} to the end of {@code head} */ + @SafeVarargs public static <T> T[] concat(T[] head, T... tail) { T[] result = Arrays.copyOf(head, head.length + tail.length); System.arraycopy(tail, 0, result, head.length, tail.length); @@ -198,6 +199,7 @@ * @param head the prefix of the result array * @return the result of concatenating {@code tail} to the end of {@code head} */ + @SafeVarargs public static <T> T[] prepend(T[] tail, T... head) { return concat(head, tail); }
--- a/graal/com.oracle.max.base/src/com/sun/max/collect/ArrayPool.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/collect/ArrayPool.java Sun Dec 18 05:24:06 2011 +0100 @@ -31,6 +31,7 @@ protected final T[] objects; + @SafeVarargs public ArrayPool(T... objects) { this.objects = objects; }
--- a/graal/com.oracle.max.base/src/com/sun/max/collect/ChainedHashMapping.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/collect/ChainedHashMapping.java Sun Dec 18 05:24:06 2011 +0100 @@ -328,8 +328,8 @@ setThreshold(); } - protected Entry<K, V> createEntry(int hashOfKey, K key, V value, Entry<K, V> next) { - return new DefaultEntry<K, V>(key, value, next); + protected Entry<K, V> createEntry(@SuppressWarnings("unused") int hashOfKey, K key, V value, Entry<K, V> next) { + return new DefaultEntry<>(key, value, next); } protected abstract class HashIterator<Type> implements Iterator<Type> {
--- a/graal/com.oracle.max.base/src/com/sun/max/collect/HashEntryChainedHashMapping.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/collect/HashEntryChainedHashMapping.java Sun Dec 18 05:24:06 2011 +0100 @@ -82,7 +82,7 @@ @Override protected Entry<K, V> createEntry(int hashOfKey, K key, V value, Entry<K, V> next) { - return new HashEntryChainedHashMapping.HashEntry<K, V>(hashOfKey, key, value, next); + return new HashEntryChainedHashMapping.HashEntry<>(hashOfKey, key, value, next); } @Override
--- a/graal/com.oracle.max.base/src/com/sun/max/collect/HashEquality.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/collect/HashEquality.java Sun Dec 18 05:24:06 2011 +0100 @@ -48,7 +48,7 @@ return object.hashCode(); } - private static final HashEquality equality = new HashEquality<Object>(); + private static final HashEquality equality = new HashEquality<>(); public static <T> HashEquality<T> instance(Class<HashEquality<T>> type) { return Utils.cast(type, equality);
--- a/graal/com.oracle.max.base/src/com/sun/max/collect/HashIdentity.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/collect/HashIdentity.java Sun Dec 18 05:24:06 2011 +0100 @@ -45,7 +45,7 @@ return System.identityHashCode(object); } - private static final HashIdentity identity = new HashIdentity<Object>(); + private static final HashIdentity identity = new HashIdentity<>(); public static <T> HashIdentity<T> instance(Class<HashIdentity<T>> type) { return Utils.cast(type, identity);
--- a/graal/com.oracle.max.base/src/com/sun/max/collect/HashMapping.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/collect/HashMapping.java Sun Dec 18 05:24:06 2011 +0100 @@ -109,7 +109,7 @@ } public static <K, V> Mapping<K, V> createMapping(HashEquivalence<K> equivalence) { - return new OpenAddressingHashMapping<K, V>(equivalence); + return new OpenAddressingHashMapping<>(equivalence); } public static <K, V> Mapping<K, V> createIdentityMapping() { @@ -123,7 +123,7 @@ } public static <K, V> Mapping<K, V> createVariableMapping(HashEquivalence<K> equivalence) { - return new ChainedHashMapping<K, V>(equivalence); + return new ChainedHashMapping<>(equivalence); } public static <K, V> Mapping<K, V> createVariableIdentityMapping() {
--- a/graal/com.oracle.max.base/src/com/sun/max/collect/IdentityHashMapping.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/collect/IdentityHashMapping.java Sun Dec 18 05:24:06 2011 +0100 @@ -31,11 +31,11 @@ private final Map<K, V> delegate; public IdentityHashMapping() { - delegate = new IdentityHashMap<K, V>(); + delegate = new IdentityHashMap<>(); } public IdentityHashMapping(int expectedMaxSize) { - delegate = new IdentityHashMap<K, V>(expectedMaxSize); + delegate = new IdentityHashMap<>(expectedMaxSize); } public synchronized V put(K key, V value) {
--- a/graal/com.oracle.max.base/src/com/sun/max/collect/IntHashMap.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/collect/IntHashMap.java Sun Dec 18 05:24:06 2011 +0100 @@ -169,7 +169,7 @@ if (values == null) { return Collections.emptyList(); } - final List<T> list = new ArrayList<T>(numberOfValues); + final List<T> list = new ArrayList<>(numberOfValues); for (int i = 0; i < values.length; i++) { final T value = values[i]; if (value != null) {
--- a/graal/com.oracle.max.base/src/com/sun/max/collect/LinkedIdentityHashMap.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/collect/LinkedIdentityHashMap.java Sun Dec 18 05:24:06 2011 +0100 @@ -30,7 +30,11 @@ */ public class LinkedIdentityHashMap<K, V> extends IdentityHashMap<K, V> implements Iterable<K> { - private final LinkedList<K> order = new LinkedList<K>(); + /** + * + */ + private static final long serialVersionUID = -8084814503481369783L; + private final LinkedList<K> order = new LinkedList<>(); public LinkedIdentityHashMap() { }
--- a/graal/com.oracle.max.base/src/com/sun/max/collect/PoolBitSet.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/collect/PoolBitSet.java Sun Dec 18 05:24:06 2011 +0100 @@ -142,7 +142,7 @@ @Override public PoolSet<T> clone() { - return new PoolBitSet<T>(this); + return new PoolBitSet<>(this); } /**
--- a/graal/com.oracle.max.base/src/com/sun/max/collect/PoolSet.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/collect/PoolSet.java Sun Dec 18 05:24:06 2011 +0100 @@ -149,12 +149,12 @@ */ public static <T extends PoolObject> PoolSet<T> noneOf(Pool<T> pool) { if (pool.length() <= PoolSet64.MAX_POOL_SIZE) { - return new PoolSet64<T>(pool); + return new PoolSet64<>(pool); } if (pool.length() <= PoolSet128.MAX_POOL_SIZE) { - return new PoolSet128<T>(pool); + return new PoolSet128<>(pool); } - return new PoolBitSet<T>(pool); + return new PoolBitSet<>(pool); } /** @@ -178,6 +178,7 @@ * @param rest zero or more objects that will be in the returned set * @return a pool set containing {@code first} and all the objects in {@code rest} */ + @SafeVarargs public static <T extends PoolObject, S extends T> PoolSet<T> of(Pool<T> pool, S first, S... rest) { final PoolSet<T> poolSet = noneOf(pool); poolSet.add(first);
--- a/graal/com.oracle.max.base/src/com/sun/max/collect/PoolSet128.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/collect/PoolSet128.java Sun Dec 18 05:24:06 2011 +0100 @@ -214,7 +214,7 @@ @Override public PoolSet<T> clone() { - final PoolSet128<T> poolSet = new PoolSet128<T>(pool); + final PoolSet128<T> poolSet = new PoolSet128<>(pool); poolSet.setLow = setLow; poolSet.setHigh = setHigh; return poolSet; @@ -230,8 +230,6 @@ private boolean inHighSet; private long current = setLow; private long currentBit = -1L; - private long nextSetBit = Long.lowestOneBit(setLow); - public boolean hasNext() { return count != 0; }
--- a/graal/com.oracle.max.base/src/com/sun/max/collect/PoolSet64.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/collect/PoolSet64.java Sun Dec 18 05:24:06 2011 +0100 @@ -169,7 +169,7 @@ @Override public PoolSet<T> clone() { - final PoolSet64<T> clone = new PoolSet64<T>(pool); + final PoolSet64<T> clone = new PoolSet64<>(pool); clone.set = set; return clone; } @@ -182,8 +182,6 @@ private long current = set; private long currentBit = -1L; - private long nextSetBit = Long.lowestOneBit(set); - public boolean hasNext() { return current != 0; }
--- a/graal/com.oracle.max.base/src/com/sun/max/collect/SortedProperties.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/collect/SortedProperties.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,12 +34,17 @@ public class SortedProperties extends Properties { /** + * + */ + private static final long serialVersionUID = 2666154105480821405L; + + /** * Overridden so that the properties are {@linkplain #store(Writer, String) saved} sorted according their keys. */ @Override public synchronized Enumeration<Object> keys() { final Enumeration<Object> keysEnum = super.keys(); - final Vector<String> keyList = new Vector<String>(size()); + final Vector<String> keyList = new Vector<>(size()); while (keysEnum.hasMoreElements()) { keyList.add((String) keysEnum.nextElement()); }
--- a/graal/com.oracle.max.base/src/com/sun/max/gui/ThrowableDialog.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/gui/ThrowableDialog.java Sun Dec 18 05:24:06 2011 +0100 @@ -37,6 +37,11 @@ public final class ThrowableDialog extends JDialog { /** + * + */ + private static final long serialVersionUID = 4566345464169636472L; + + /** * Creates a dialog to display the details of an exception and makes it visible. * * @param throwable the exception whose details are being displayed @@ -151,6 +156,7 @@ // Test code + @SuppressWarnings("unused") public static void main(String[] args) { try { recurse(0);
--- a/graal/com.oracle.max.base/src/com/sun/max/ide/JavaProject.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/ide/JavaProject.java Sun Dec 18 05:24:06 2011 +0100 @@ -66,7 +66,7 @@ */ public static Classpath getClassPath(Class projClass, boolean includeDependencies) { String classfile = projClass.getName().replace('.', '/') + ".class"; - ArrayList<Entry> classPathEntries = new ArrayList<Entry>(); + ArrayList<Entry> classPathEntries = new ArrayList<>(); Entry projEntry = null; for (Entry entry : Classpath.fromSystem().entries()) { if (entry.contains(classfile)) { @@ -162,7 +162,7 @@ */ public static Classpath getSourcePath(Class projClass, boolean includeDependencies) { final Classpath classPath = getClassPath(projClass, includeDependencies); - final List<String> sourcePath = new LinkedList<String>(); + final List<String> sourcePath = new LinkedList<>(); for (Entry entry : classPath.entries()) { WorkspaceFinder finder = new WorkspaceFinder(); finder.deriveWorkspace(entry.file());
--- a/graal/com.oracle.max.base/src/com/sun/max/ide/JavaProjectNotFoundException.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/ide/JavaProjectNotFoundException.java Sun Dec 18 05:24:06 2011 +0100 @@ -28,6 +28,11 @@ */ public class JavaProjectNotFoundException extends RuntimeException { + /** + * + */ + private static final long serialVersionUID = 8609586657751541105L; + public JavaProjectNotFoundException() { }
--- a/graal/com.oracle.max.base/src/com/sun/max/ide/TestCaseClassSet.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/ide/TestCaseClassSet.java Sun Dec 18 05:24:06 2011 +0100 @@ -38,6 +38,10 @@ */ public class TestCaseClassSet extends LinkedHashSet<Class<? extends TestCase>> { + /** + * + */ + private static final long serialVersionUID = -2202526415279951882L; private final String defaultTestSuiteName; /**
--- a/graal/com.oracle.max.base/src/com/sun/max/ide/ToolChain.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/ide/ToolChain.java Sun Dec 18 05:24:06 2011 +0100 @@ -104,7 +104,7 @@ final Classpath sourcePath = JavaProject.getSourcePath(projClass, true); final String outputDirectory = classPath.entries().get(0).toString(); - final ArrayList<File> sourceFiles = new ArrayList<File>(classNames.length); + final ArrayList<File> sourceFiles = new ArrayList<>(classNames.length); for (String className : classNames) { final String sourceFilePathSuffix = className.replace('.', File.separatorChar) + ".java"; final File sourceFile = sourcePath.findFile(sourceFilePathSuffix); @@ -117,7 +117,7 @@ final JavaCompiler compiler = javaCompiler(); final String compilerName = compiler.getClass().getName(); - final List<String> opts = new ArrayList<String>(Arrays.asList(new String[] {"-cp", classPath.toString(), "-d", outputDirectory})); + final List<String> opts = new ArrayList<>(Arrays.asList(new String[] {"-cp", classPath.toString(), "-d", outputDirectory})); if (compilerName.equals("com.sun.tools.javac.api.JavacTool")) { opts.add("-cp"); opts.add(classPath.toString()); @@ -164,12 +164,12 @@ opts.add(outputDirectory); } - final DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>(); + final DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>(); final StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null); final Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(sourceFiles); final CompilationTask task = compiler.getTask(null, fileManager, diagnostics, opts, null, compilationUnits); final boolean result = task.call(); - final Set<String> reportedDiagnostics = new HashSet<String>(); + final Set<String> reportedDiagnostics = new HashSet<>(); for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics()) { final String message = diagnostic.getMessage(Locale.getDefault()); if (!reportedDiagnostics.contains(message)) {
--- a/graal/com.oracle.max.base/src/com/sun/max/io/Files.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/io/Files.java Sun Dec 18 05:24:06 2011 +0100 @@ -123,7 +123,7 @@ /** * Creates/overwrites a file from a reader. */ - public static void fill(File file, Reader reader, boolean append) throws IOException { + public static void fill(File file, Reader reader) throws IOException { final BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file)); try { int ch; @@ -145,7 +145,7 @@ } public static List<String> readLines(File file) throws IOException { - final List<String> lines = new ArrayList<String>(); + final List<String> lines = new ArrayList<>(); readLines(file, lines); return lines; }
--- a/graal/com.oracle.max.base/src/com/sun/max/io/SeekableByteArrayOutputStream.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/io/SeekableByteArrayOutputStream.java Sun Dec 18 05:24:06 2011 +0100 @@ -47,7 +47,7 @@ /** * Updates the write position of this stream. The stream can only be repositioned between 0 and the * {@linkplain #endOfStream() end of the stream}. - * + * * @param index * the index to which the write position of this stream will be set * @throws IllegalArgumentException @@ -71,7 +71,7 @@ } @Override - public void reset() { + public synchronized void reset() { super.reset(); highestCount = 0; }
--- a/graal/com.oracle.max.base/src/com/sun/max/io/TruncatedInputException.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/io/TruncatedInputException.java Sun Dec 18 05:24:06 2011 +0100 @@ -29,6 +29,10 @@ */ public class TruncatedInputException extends EOFException { + /** + * + */ + private static final long serialVersionUID = -6331468138426196525L; private final int nRead; /**
--- a/graal/com.oracle.max.base/src/com/sun/max/lang/Endianness.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/lang/Endianness.java Sun Dec 18 05:24:06 2011 +0100 @@ -348,12 +348,6 @@ public abstract byte[] toBytes(long value); - public void toBytes(byte value, byte[] result, int offset) { - if (result.length > 0) { - result[0] = value; - } - } - public abstract void toBytes(short value, byte[] result, int offset); public abstract void toBytes(int value, byte[] result, int offset);
--- a/graal/com.oracle.max.base/src/com/sun/max/lang/StaticFieldName.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/lang/StaticFieldName.java Sun Dec 18 05:24:06 2011 +0100 @@ -47,7 +47,7 @@ } public static List<StaticFieldName> initialize(Class staticNameFieldClass, StringFunction stringFunction, Procedure procedure) { - final List<StaticFieldName> sequence = new LinkedList<StaticFieldName>(); + final List<StaticFieldName> sequence = new LinkedList<>(); for (Field field : staticNameFieldClass.getDeclaredFields()) { if ((field.getModifiers() & Modifier.STATIC) != 0 && StaticFieldName.class.isAssignableFrom(field.getType())) { field.setAccessible(true);
--- a/graal/com.oracle.max.base/src/com/sun/max/lang/Strings.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/lang/Strings.java Sun Dec 18 05:24:06 2011 +0100 @@ -176,7 +176,7 @@ * quotes are removed). */ public static String[] splitCommand(String command) { - final List<String> parts = new ArrayList<String>(); + final List<String> parts = new ArrayList<>(); boolean escapedChar = false; boolean insideQuotes = false;
--- a/graal/com.oracle.max.base/src/com/sun/max/profile/ContextTree.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/profile/ContextTree.java Sun Dec 18 05:24:06 2011 +0100 @@ -41,7 +41,7 @@ this.id = id; } - public Node findChild(long searchId) { + public Node findChild() { Node pos = child; while (pos != null) { if (pos.id == this.id) { @@ -53,7 +53,7 @@ } public Node addChild(long searchId, Clock clock) { - Node foundChild = findChild(searchId); + Node foundChild = findChild(); if (foundChild == null) { foundChild = new Node(searchId); foundChild.timer = new SingleUseTimer(clock);
--- a/graal/com.oracle.max.base/src/com/sun/max/profile/GlobalMetrics.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/profile/GlobalMetrics.java Sun Dec 18 05:24:06 2011 +0100 @@ -39,15 +39,15 @@ } static class MetricSet<T extends Metric> { - private final Class<T> clazz; - private final Map<String, T> metrics = new HashMap<String, T>(); + protected final Class<T> clazz; + private final Map<String, T> metrics = new HashMap<>(); MetricSet(Class<T> mClass) { clazz = mClass; } } - protected static final Map<Class<? extends Metric>, MetricSet> metricSets = new HashMap<Class<? extends Metric>, MetricSet>(); + protected static final Map<Class<? extends Metric>, MetricSet> metricSets = new HashMap<>(); /** * This method allocates a new counter with the specified name and adds it to the global @@ -115,7 +115,7 @@ public static <T extends Metric> T setMetric(String name, Class<T> mClass, T metric) { MetricSet<T> metricSet = Utils.cast(metricSets.get(mClass)); if (metricSet == null) { - metricSet = new MetricSet<T>(mClass); + metricSet = new MetricSet<>(mClass); metricSets.put(mClass, metricSet); } metricSet.metrics.put(name, metric); @@ -139,7 +139,7 @@ * @param stream the print stream to which to print the report */ public static synchronized void report(PrintStream stream) { - final Map<String, Metric> allMetrics = new HashMap<String, Metric>(); + final Map<String, Metric> allMetrics = new HashMap<>(); for (MetricSet<? extends Metric> metricSet : metricSets.values()) { allMetrics.putAll(metricSet.metrics); }
--- a/graal/com.oracle.max.base/src/com/sun/max/profile/Metrics.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/profile/Metrics.java Sun Dec 18 05:24:06 2011 +0100 @@ -172,6 +172,9 @@ return total; } + /** + * @param value + */ public int getCount(T value) { return -1; }
--- a/graal/com.oracle.max.base/src/com/sun/max/profile/ValueMetrics.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/profile/ValueMetrics.java Sun Dec 18 05:24:06 2011 +0100 @@ -23,7 +23,6 @@ package com.sun.max.profile; import java.util.*; -import java.util.Arrays; import com.sun.max.*; import com.sun.max.profile.Metrics.*; @@ -112,7 +111,7 @@ @Override public Map<Integer, Integer> asMap() { - final Map<Integer, Integer> map = new HashMap<Integer, Integer>(); + final Map<Integer, Integer> map = new HashMap<>(); for (int i = 0; i != counts.length; ++i) { map.put(lowValue + i, counts[i]); } @@ -164,7 +163,7 @@ @Override public Map<Integer, Integer> asMap() { - final Map<Integer, Integer> map = new HashMap<Integer, Integer>(); + final Map<Integer, Integer> map = new HashMap<>(); for (int i = 0; i != count.length; ++i) { map.put(set[i], count[i]); } @@ -229,7 +228,7 @@ public Map<Integer, Integer> asMap() { reduce(); // TODO: another map implementation might be better. - final Map<Integer, Integer> map = new HashMap<Integer, Integer>(); + final Map<Integer, Integer> map = new HashMap<>(); if (values != null) { for (int i = 0; i < values.length; i++) { map.put(values[i], counts[i]); @@ -354,7 +353,7 @@ private Map<Integer, Distribution> map() { if (map == null) { - map = new HashMap<Integer, Distribution>(); + map = new HashMap<>(); } return map; } @@ -381,7 +380,7 @@ @Override public Map<Integer, Integer> asMap() { - final Map<Integer, Integer> result = new HashMap<Integer, Integer>(); + final Map<Integer, Integer> result = new HashMap<>(); for (Map.Entry<Integer, Distribution> entry : map().entrySet()) { result.put(entry.getKey(), entry.getValue().total); } @@ -409,7 +408,7 @@ private Map<T, Distribution> map; private Map<T, Distribution> map() { if (map == null) { - map = new IdentityHashMap<T, Distribution>(); + map = new IdentityHashMap<>(); } return map; } @@ -438,7 +437,7 @@ @Override public Map<T, Integer> asMap() { - final Map<T, Integer> result = new IdentityHashMap<T, Integer>(); + final Map<T, Integer> result = new IdentityHashMap<>(); for (Map.Entry<T, Distribution> entry : map().entrySet()) { result.put(entry.getKey(), entry.getValue().total); } @@ -486,7 +485,7 @@ @Override public Map<T, Integer> asMap() { - final Map<T, Integer> map = new IdentityHashMap<T, Integer>(); + final Map<T, Integer> map = new IdentityHashMap<>(); for (int i = 0; i != count.length; ++i) { map.put(set[i], count[i]); } @@ -610,13 +609,13 @@ if (approx instanceof FixedApproximation) { final FixedApproximation fixedApprox = (FixedApproximation) approx; final T[] values = Utils.cast(fixedApprox.values); - return new FixedSetObjectDistribution<T>(values); + return new FixedSetObjectDistribution<>(values); } if (approx == EXACT) { - return new HashedObjectDistribution<T>(); + return new HashedObjectDistribution<>(); } // default is to use the hashed object distribution - return new HashedObjectDistribution<T>(); + return new HashedObjectDistribution<>(); } /** @@ -628,6 +627,7 @@ * @param set the set of objects for which to record exact profiling information * @return a new distribution capable of producing an exact profile of the occurence of the specified objects */ + @SafeVarargs public static <T> ObjectDistribution<T> newObjectDistribution(String name, T... set) { return newObjectDistribution(name, new FixedApproximation(set)); } @@ -725,6 +725,6 @@ * @return a synchronized view of the distribution */ public static <T> ObjectDistribution<T> threadSafe(ObjectDistribution<T> distribution) { - return new ThreadsafeObjectDistribution<T>(distribution); + return new ThreadsafeObjectDistribution<>(distribution); } }
--- a/graal/com.oracle.max.base/src/com/sun/max/program/ClassSearch.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/program/ClassSearch.java Sun Dec 18 05:24:06 2011 +0100 @@ -46,7 +46,7 @@ */ public ClassSearch(boolean omitDuplicates) { if (omitDuplicates) { - classes = new HashSet<String>(); + classes = new HashSet<>(); } else { classes = null; }
--- a/graal/com.oracle.max.base/src/com/sun/max/program/Classpath.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/program/Classpath.java Sun Dec 18 05:24:06 2011 +0100 @@ -360,10 +360,10 @@ * @return the result of prepending {@code classpath} to this classpath */ public Classpath prepend(Classpath classpath) { - ArrayList<Entry> entries = new ArrayList<Entry>(this.entries.size() + classpath.entries.size()); - entries.addAll(classpath.entries); - entries.addAll(this.entries); - return new Classpath(entries); + ArrayList<Entry> newEntries = new ArrayList<>(this.entries.size() + classpath.entries.size()); + newEntries.addAll(classpath.entries); + newEntries.addAll(this.entries); + return new Classpath(newEntries); } /** @@ -373,10 +373,10 @@ * @return the result of prepending {@code classpath} to this classpath */ public Classpath prepend(String path) { - ArrayList<Entry> entries = new ArrayList<Entry>(this.entries.size()); - entries.add(createEntry(path)); - entries.addAll(this.entries); - return new Classpath(entries); + ArrayList<Entry> newEntries = new ArrayList<>(this.entries.size()); + newEntries.add(createEntry(path)); + newEntries.addAll(this.entries); + return new Classpath(newEntries); } /**
--- a/graal/com.oracle.max.base/src/com/sun/max/program/ProgramError.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/program/ProgramError.java Sun Dec 18 05:24:06 2011 +0100 @@ -31,6 +31,11 @@ public final class ProgramError extends Error { /** + * + */ + private static final long serialVersionUID = -4457023777191065175L; + + /** * Implemented by a client that can {@linkplain ProgramError#setHandler(Handler) register} * itself to handle program errors instead of having them result in a {@link ProgramError} * instance raised.
--- a/graal/com.oracle.max.base/src/com/sun/max/program/Trace.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/program/Trace.java Sun Dec 18 05:24:06 2011 +0100 @@ -156,8 +156,6 @@ return level >= requiredLevel && count >= threshold; } - private static final int MAX_INDENTATION = 10; - @RESET private static int indentation;
--- a/graal/com.oracle.max.base/src/com/sun/max/program/option/Option.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/program/option/Option.java Sun Dec 18 05:24:06 2011 +0100 @@ -62,6 +62,11 @@ public static class Error extends java.lang.Error { + /** + * + */ + private static final long serialVersionUID = -7835290743599345373L; + public Error(String message) { super(message); }
--- a/graal/com.oracle.max.base/src/com/sun/max/program/option/OptionSet.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/program/option/OptionSet.java Sun Dec 18 05:24:06 2011 +0100 @@ -97,10 +97,10 @@ * {@linkplain #loadOptions(OptionSet) loading options from another option set}. */ public OptionSet(boolean allowUnrecognizedOptions) { - optionValues = new HashMap<String, String>(); + optionValues = new HashMap<>(); // Using a LinkedHashMap to preserve insertion order when iterating over values - optionMap = new LinkedHashMap<String, Option>(); - optionSyntax = new HashMap<String, Syntax>(); + optionMap = new LinkedHashMap<>(); + optionSyntax = new HashMap<>(); this.allowUnrecognizedOptions = allowUnrecognizedOptions; } @@ -469,8 +469,8 @@ * @return an iterable collection of {@code Option} instances, sorted according to the name of each option */ public Iterable<Option<?>> getSortedOptions() { - final List<Option<?>> list = new LinkedList<Option<?>>(); - final TreeSet<String> tree = new TreeSet<String>(); + final List<Option<?>> list = new LinkedList<>(); + final TreeSet<String> tree = new TreeSet<>(); for (String string : optionMap.keySet()) { tree.add(string); } @@ -623,30 +623,30 @@ if (prefix.length() > 0) { // setup a "-prefix+name" option String plusName = prefix + ":+" + name; - FieldOption<Boolean> plusOption = new FieldOption<Boolean>(plusName, object, field, (Boolean) defaultValue, OptionTypes.BLANK_BOOLEAN_TYPE, help); + FieldOption<Boolean> plusOption = new FieldOption<>(plusName, object, field, (Boolean) defaultValue, OptionTypes.BLANK_BOOLEAN_TYPE, help); plusOption.nullValue = true; addOption(plusOption, Syntax.REQUIRES_BLANK); // setup a "-prefix-name" option String minusName = prefix + ":-" + name; - FieldOption<Boolean> minusOption = new FieldOption<Boolean>(minusName, object, field, (Boolean) defaultValue, OptionTypes.BLANK_BOOLEAN_TYPE, help); + FieldOption<Boolean> minusOption = new FieldOption<>(minusName, object, field, (Boolean) defaultValue, OptionTypes.BLANK_BOOLEAN_TYPE, help); minusOption.nullValue = false; return addOption(minusOption, Syntax.REQUIRES_BLANK); } - return addOption(new FieldOption<Boolean>(optionName, object, field, (Boolean) defaultValue, OptionTypes.BOOLEAN_TYPE, help)); + return addOption(new FieldOption<>(optionName, object, field, (Boolean) defaultValue, OptionTypes.BOOLEAN_TYPE, help)); } else if (fieldType == int.class) { - return addOption(new FieldOption<Integer>(optionName, object, field, (Integer) defaultValue, OptionTypes.INT_TYPE, help)); + return addOption(new FieldOption<>(optionName, object, field, (Integer) defaultValue, OptionTypes.INT_TYPE, help)); } else if (fieldType == float.class) { - return addOption(new FieldOption<Float>(optionName, object, field, (Float) defaultValue, OptionTypes.FLOAT_TYPE, help)); + return addOption(new FieldOption<>(optionName, object, field, (Float) defaultValue, OptionTypes.FLOAT_TYPE, help)); } else if (fieldType == long.class) { - return addOption(new FieldOption<Long>(optionName, object, field, (Long) defaultValue, OptionTypes.LONG_TYPE, help)); + return addOption(new FieldOption<>(optionName, object, field, (Long) defaultValue, OptionTypes.LONG_TYPE, help)); } else if (fieldType == double.class) { - return addOption(new FieldOption<Double>(optionName, object, field, (Double) defaultValue, OptionTypes.DOUBLE_TYPE, help)); + return addOption(new FieldOption<>(optionName, object, field, (Double) defaultValue, OptionTypes.DOUBLE_TYPE, help)); } else if (fieldType == String.class) { - return addOption(new FieldOption<String>(optionName, object, field, (String) defaultValue, OptionTypes.STRING_TYPE, help)); + return addOption(new FieldOption<>(optionName, object, field, (String) defaultValue, OptionTypes.STRING_TYPE, help)); } else if (fieldType == File.class) { - return addOption(new FieldOption<File>(optionName, object, field, (File) defaultValue, OptionTypes.FILE_TYPE, help)); + return addOption(new FieldOption<>(optionName, object, field, (File) defaultValue, OptionTypes.FILE_TYPE, help)); } else if (fieldType.isEnum()) { final Class<? extends Enum> enumClass = Utils.cast(fieldType); return addOption(makeEnumFieldOption(optionName, object, field, defaultValue, enumClass, help)); @@ -654,53 +654,53 @@ return null; } - private <T extends Enum<T>> FieldOption<T> makeEnumFieldOption(String name, Object object, Field field, Object defaultValue, Class<T> enumClass, String help) { - final OptionTypes.EnumType<T> optionType = new OptionTypes.EnumType<T>(enumClass); + private static <T extends Enum<T>> FieldOption<T> makeEnumFieldOption(String name, Object object, Field field, Object defaultValue, Class<T> enumClass, String help) { + final OptionTypes.EnumType<T> optionType = new OptionTypes.EnumType<>(enumClass); final T defaultV = Utils.<T>cast(defaultValue); - return new FieldOption<T>(name, object, field, defaultV, optionType, help); + return new FieldOption<>(name, object, field, defaultV, optionType, help); } public Option<String> newStringOption(String name, String defaultValue, String help) { - return addOption(new Option<String>(name, defaultValue, OptionTypes.STRING_TYPE, help)); + return addOption(new Option<>(name, defaultValue, OptionTypes.STRING_TYPE, help)); } public Option<Integer> newIntegerOption(String name, Integer defaultValue, String help) { - return addOption(new Option<Integer>(name, defaultValue, OptionTypes.INT_TYPE, help)); + return addOption(new Option<>(name, defaultValue, OptionTypes.INT_TYPE, help)); } public Option<Long> newLongOption(String name, Long defaultValue, String help) { - return addOption(new Option<Long>(name, defaultValue, OptionTypes.LONG_TYPE, help)); + return addOption(new Option<>(name, defaultValue, OptionTypes.LONG_TYPE, help)); } public Option<Float> newFloatOption(String name, Float defaultValue, String help) { - return addOption(new Option<Float>(name, defaultValue, OptionTypes.FLOAT_TYPE, help)); + return addOption(new Option<>(name, defaultValue, OptionTypes.FLOAT_TYPE, help)); } public Option<Double> newDoubleOption(String name, Double defaultValue, String help) { - return addOption(new Option<Double>(name, defaultValue, OptionTypes.DOUBLE_TYPE, help)); + return addOption(new Option<>(name, defaultValue, OptionTypes.DOUBLE_TYPE, help)); } public Option<List<String>> newStringListOption(String name, String defaultValue, String help) { - return addOption(new Option<List<String>>(name, defaultValue == null ? null : OptionTypes.COMMA_SEPARATED_STRING_LIST_TYPE.parseValue(defaultValue), OptionTypes.COMMA_SEPARATED_STRING_LIST_TYPE, help)); + return addOption(new Option<>(name, defaultValue == null ? null : OptionTypes.COMMA_SEPARATED_STRING_LIST_TYPE.parseValue(defaultValue), OptionTypes.COMMA_SEPARATED_STRING_LIST_TYPE, help)); } public Option<List<String>> newStringListOption(String name, String[] defaultValue, String help) { List<String> list = null; if (defaultValue != null) { - list = new ArrayList<String>(defaultValue.length); + list = new ArrayList<>(defaultValue.length); list.addAll(Arrays.asList(defaultValue)); } - return addOption(new Option<List<String>>(name, list, OptionTypes.COMMA_SEPARATED_STRING_LIST_TYPE, help)); + return addOption(new Option<>(name, list, OptionTypes.COMMA_SEPARATED_STRING_LIST_TYPE, help)); } public Option<List<String>> newStringListOption(String name, String defaultValue, char separator, String help) { final OptionTypes.StringListType type = new OptionTypes.StringListType(separator); - return addOption(new Option<List<String>>(name, defaultValue == null ? null : type.parseValue(defaultValue), type, help)); + return addOption(new Option<>(name, defaultValue == null ? null : type.parseValue(defaultValue), type, help)); } public <T> Option<List<T>> newListOption(String name, String defaultValue, Option.Type<T> elementOptionType, char separator, String help) { - final OptionTypes.ListType<T> type = new OptionTypes.ListType<T>(separator, elementOptionType); - return addOption(new Option<List<T>>(name, defaultValue == null ? null : type.parseValue(defaultValue), type, help)); + final OptionTypes.ListType<T> type = new OptionTypes.ListType<>(separator, elementOptionType); + return addOption(new Option<>(name, defaultValue == null ? null : type.parseValue(defaultValue), type, help)); } public Option<File> newFileOption(String name, String defaultValue, String help) { @@ -708,27 +708,27 @@ } public Option<File> newFileOption(String name, File defaultValue, String help) { - return addOption(new Option<File>(name, defaultValue, OptionTypes.FILE_TYPE, help)); + return addOption(new Option<>(name, defaultValue, OptionTypes.FILE_TYPE, help)); } public Option<URL> newURLOption(String name, URL defaultValue, String help) { - return addOption(new Option<URL>(name, defaultValue, OptionTypes.URL_TYPE, help)); + return addOption(new Option<>(name, defaultValue, OptionTypes.URL_TYPE, help)); } public <T> Option<T> newInstanceOption(String name, Class<T> klass, T defaultValue, String help) { - return addOption(new Option<T>(name, defaultValue, OptionTypes.createInstanceOptionType(klass), help)); + return addOption(new Option<>(name, defaultValue, OptionTypes.createInstanceOptionType(klass), help)); } public <T> Option<List<T>> newListInstanceOption(String name, String defaultValue, Class<T> klass, char separator, String help) { final OptionTypes.ListType<T> type = OptionTypes.createInstanceListOptionType(klass, separator); - return addOption(new Option<List<T>>(name, (defaultValue == null) ? null : type.parseValue(defaultValue), type, help)); + return addOption(new Option<>(name, (defaultValue == null) ? null : type.parseValue(defaultValue), type, help)); } public Option<Boolean> newBooleanOption(String name, Boolean defaultValue, String help) { if (defaultValue != null && !defaultValue) { - return addOption(new Option<Boolean>(name, defaultValue, OptionTypes.BOOLEAN_TYPE, help), Syntax.EQUALS_OR_BLANK); + return addOption(new Option<>(name, defaultValue, OptionTypes.BOOLEAN_TYPE, help), Syntax.EQUALS_OR_BLANK); } - return addOption(new Option<Boolean>(name, defaultValue, OptionTypes.BOOLEAN_TYPE, help)); + return addOption(new Option<>(name, defaultValue, OptionTypes.BOOLEAN_TYPE, help)); } public <T> Option<T> newOption(String name, String defaultValue, Option.Type<T> type, String help) { @@ -736,11 +736,11 @@ } public <T> Option<T> newOption(String name, T defaultValue, Option.Type<T> type, Syntax syntax, String help) { - return addOption(new Option<T>(name, defaultValue, type, help), syntax); + return addOption(new Option<>(name, defaultValue, type, help), syntax); } public <E extends Enum<E>> Option<E> newEnumOption(String name, E defaultValue, Class<E> enumClass, String help) { - return addOption(new Option<E>(name, defaultValue, new OptionTypes.EnumType<E>(enumClass), help)); + return addOption(new Option<>(name, defaultValue, new OptionTypes.EnumType<>(enumClass), help)); } public <E extends Enum<E>> Option<List<E>> newEnumListOption(String name, Iterable<E> defaultValue, Class<E> enumClass, String help) { @@ -751,18 +751,18 @@ list = Utils.cast(defaultValue); } else if (defaultValue instanceof Collection) { final Collection<E> collection = Utils.cast(defaultValue); - list = new ArrayList<E>(collection); + list = new ArrayList<>(collection); } else { - list = new ArrayList<E>(); + list = new ArrayList<>(); for (E value : defaultValue) { list.add(value); } } - final Option<List<E>> option = new Option<List<E>>(name, list, new OptionTypes.EnumListType<E>(enumClass, ','), help); + final Option<List<E>> option = new Option<>(name, list, new OptionTypes.EnumListType<>(enumClass, ','), help); return addOption(option); } public Option<File> newConfigOption(String name, File defaultFile, String help) { - return addOption(new Option<File>(name, defaultFile, new OptionTypes.ConfigFile(this), help)); + return addOption(new Option<>(name, defaultFile, new OptionTypes.ConfigFile(this), help)); } }
--- a/graal/com.oracle.max.base/src/com/sun/max/program/option/OptionTypes.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/program/option/OptionTypes.java Sun Dec 18 05:24:06 2011 +0100 @@ -123,7 +123,7 @@ protected final char separator; public final Option.Type<T> elementOptionType; - private static <T> Class<List<T>> listClass(Class<T> valueClass) { + private static <T> Class<List<T>> listClass(@SuppressWarnings("unused") Class<T> valueClass) { final Class<Class<List<T>>> type = null; return Utils.cast(type, List.class); } @@ -150,7 +150,7 @@ @Override public List<T> parseValue(String val) { - final List<T> list = new LinkedList<T>(); + final List<T> list = new LinkedList<>(); if (val.isEmpty()) { return list; } @@ -256,7 +256,7 @@ * of these classes and returns them as a list. */ public static final <T> ListType<T> createInstanceListOptionType(final Class<T> klass, char separator) { - return new ListType<T>(separator, createInstanceOptionType(klass)); + return new ListType<>(separator, createInstanceOptionType(klass)); } public static final Option.Type<Double> DOUBLE_TYPE = new Option.Type<Double>(Double.class, "double") { @@ -387,7 +387,7 @@ public static class EnumListType<T extends Enum<T>> extends ListType<T> { public EnumListType(Class<T> enumClass, char separator) { - super(separator, new EnumType<T>(enumClass)); + super(separator, new EnumType<>(enumClass)); } }
--- a/graal/com.oracle.max.base/src/com/sun/max/program/option/PackageOptionType.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/program/option/PackageOptionType.java Sun Dec 18 05:24:06 2011 +0100 @@ -37,7 +37,7 @@ this.superPackage = superPackage; } - private Class packageClass(String pkgName) { + private static Class packageClass(String pkgName) { try { return Class.forName(pkgName + ".Package"); } catch (ClassNotFoundException e) {
--- a/graal/com.oracle.max.base/src/com/sun/max/test/JavaExecHarness.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/test/JavaExecHarness.java Sun Dec 18 05:24:06 2011 +0100 @@ -77,6 +77,10 @@ throw new RuntimeException(e); } } + @Override + public int hashCode() { + return resolve().hashCode(); + } } public class MethodCall extends CodeLiteral { @@ -154,8 +158,7 @@ } @Override public String failureMessage(TestCase testCase) { - final JavaTestCase javaTestCase = (JavaTestCase) testCase; - return inputToString(javaTestCase.clazz, run, false) + " failed with " + result + " (expected " + expect + ")"; + return inputToString(run, false) + " failed with " + result + " (expected " + expect + ")"; } } @@ -189,9 +192,9 @@ public void parseTests(TestEngine engine, File file, Properties props) { try { // 1. find the class - final Class testClass = findClass(file, props); + final Class testClass = findClass(file); // 2. parse the runs - final List<Run> runs = parseRuns(testClass, file, props); + final List<Run> runs = parseRuns(props); if (runs != null) { // 3. add a test case to the engine engine.addTest(new JavaTestCase("exec", executor, file, testClass, runs, engine.loadingPackages())); @@ -203,7 +206,7 @@ } } - private Class findClass(File file, Properties props) throws Exception { + private static Class findClass(File file) throws Exception { final BufferedReader r = new BufferedReader(new FileReader(file)); // search for the package statement in the file. @@ -242,12 +245,12 @@ throw ProgramError.unexpected("could not find package statement in " + file); } - private List<Run> parseRuns(Class testClass, File file, Properties props) { + private List<Run> parseRuns(Properties props) { final String rstr = props.getProperty("Runs"); if (rstr == null) { return null; } - final List<Run> runs = new LinkedList<Run>(); + final List<Run> runs = new LinkedList<>(); final CharacterIterator i = new StringCharacterIterator(rstr); while (i.getIndex() < i.getEndIndex()) { runs.add(parseRun(i)); @@ -265,7 +268,7 @@ // value=result Object[] vals = new Object[1]; if (skipPeekAndEat(iterator, '(')) { - final List<Object> inputValues = new LinkedList<Object>(); + final List<Object> inputValues = new LinkedList<>(); if (!skipPeekAndEat(iterator, ')')) { while (true) { inputValues.add(parseValue(iterator)); @@ -316,7 +319,7 @@ throw ProgramError.unexpected("invalid value at " + iterator.getIndex()); } - private ProgramError raiseParseErrorAt(String message, CharacterIterator iterator) { + private static ProgramError raiseParseErrorAt(String message, CharacterIterator iterator) { final int errorIndex = iterator.getIndex(); final StringBuilder sb = new StringBuilder(message).append(String.format(":%n")); iterator.setIndex(iterator.getBeginIndex()); @@ -331,7 +334,7 @@ throw ProgramError.unexpected(sb.toString()); } - private Object parseNumber(CharacterIterator iterator) { + private static Object parseNumber(CharacterIterator iterator) { // an integer. final StringBuilder buf = new StringBuilder(); @@ -392,14 +395,14 @@ return Integer.valueOf(buf.toString(), radix); } - private void appendDigits(final StringBuilder buf, CharacterIterator iterator, int radix) { + private static void appendDigits(final StringBuilder buf, CharacterIterator iterator, int radix) { while (Character.digit(iterator.current(), radix) != -1) { buf.append(iterator.current()); iterator.next(); } } - private Class<? extends Throwable> parseException(CharacterIterator iterator) { + private static Class<? extends Throwable> parseException(CharacterIterator iterator) { final String exceptionName = parseCodeLiteral(iterator); try { return Class.forName(exceptionName).asSubclass(Throwable.class); @@ -408,7 +411,7 @@ } } - private String parseCodeLiteral(CharacterIterator iterator) { + private static String parseCodeLiteral(CharacterIterator iterator) { final StringBuilder buf = new StringBuilder(); while (true) { final char ch = iterator.current(); @@ -422,12 +425,12 @@ return buf.toString(); } - private boolean skipPeekAndEat(CharacterIterator iterator, char c) { + private static boolean skipPeekAndEat(CharacterIterator iterator, char c) { skipWhitespace(iterator); return peekAndEat(iterator, c); } - private boolean peekAndEat(CharacterIterator iterator, char c) { + private static boolean peekAndEat(CharacterIterator iterator, char c) { if (iterator.current() == c) { iterator.next(); return true; @@ -435,7 +438,7 @@ return false; } - private boolean peekAndEat(CharacterIterator iterator, String string) { + private static boolean peekAndEat(CharacterIterator iterator, String string) { final int indx = iterator.getIndex(); for (int j = 0; j < string.length(); j++) { if (iterator.current() != string.charAt(j)) { @@ -447,7 +450,7 @@ return true; } - private void skipWhitespace(CharacterIterator iterator) { + private static void skipWhitespace(CharacterIterator iterator) { while (true) { if (!Character.isWhitespace(iterator.current())) { break; @@ -456,7 +459,7 @@ } } - private void expectChar(CharacterIterator i, char c) { + private static void expectChar(CharacterIterator i, char c) { final char r = i.current(); i.next(); if (r != c) { @@ -464,24 +467,7 @@ } } - private char parseCharLiteral(CharacterIterator i) throws Exception { - - expectChar(i, SQUOTE); - - char ch; - if (peekAndEat(i, BACKSLASH)) { - ch = parseEscapeChar(i); - } else { - ch = i.current(); - i.next(); - } - - expectChar(i, SQUOTE); - - return ch; - } - - private char parseEscapeChar(CharacterIterator i) { + private static char parseEscapeChar(CharacterIterator i) { final char c = i.current(); switch (c) { case 'f': @@ -524,7 +510,7 @@ return c; } - private String parseStringLiteral(CharacterIterator i) { + private static String parseStringLiteral(CharacterIterator i) { final StringBuilder buffer = new StringBuilder(i.getEndIndex() - i.getBeginIndex() + 1); expectChar(i, QUOTE); @@ -582,7 +568,7 @@ return accumul; } - public static String inputToString(Class testClass, Run run, boolean asJavaString) { + public static String inputToString(Run run, boolean asJavaString) { final StringBuilder buffer = new StringBuilder(); if (asJavaString) { buffer.append(QUOTE);
--- a/graal/com.oracle.max.base/src/com/sun/max/test/ReflectiveExecutor.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/test/ReflectiveExecutor.java Sun Dec 18 05:24:06 2011 +0100 @@ -63,7 +63,7 @@ } public static void main(String[] args) { - final Registry<TestHarness> reg = new Registry<TestHarness>(TestHarness.class, true); + final Registry<TestHarness> reg = new Registry<>(TestHarness.class, true); final JavaExecHarness javaExecHarness = new JavaExecHarness(new ReflectiveExecutor()); reg.registerObject("java", javaExecHarness); final TestEngine e = new TestEngine(reg);
--- a/graal/com.oracle.max.base/src/com/sun/max/test/TestEngine.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/test/TestEngine.java Sun Dec 18 05:24:06 2011 +0100 @@ -48,16 +48,16 @@ protected ProgressPrinter progress; public TestEngine(Registry<TestHarness> registry) { - allTests = new LinkedList<TestCase>(); - failTests = new LinkedList<TestCase>(); - passTests = new LinkedList<TestCase>(); - skipFiles = new LinkedList<File>(); - queue = new LinkedList<TestCase>(); + allTests = new LinkedList<>(); + failTests = new LinkedList<>(); + passTests = new LinkedList<>(); + skipFiles = new LinkedList<>(); + queue = new LinkedList<>(); this.registry = registry; } public static void main(String[] args) { - final TestEngine e = new TestEngine(new Registry<TestHarness>(TestHarness.class, true)); + final TestEngine e = new TestEngine(new Registry<>(TestHarness.class, true)); e.parseAndRunTests(args); e.report(System.out); } @@ -113,10 +113,6 @@ return allTests; } - private synchronized TestCase dequeue() { - return queue.remove(); - } - private void runTest(TestCase testCase) { try { // run the test (records thrown exceptions internally) @@ -164,7 +160,7 @@ } } - private File[] getFilesFromDirectory(File dir, boolean sort) { + private static File[] getFilesFromDirectory(File dir, boolean sort) { final File[] list = dir.listFiles(); if (sort) { Arrays.sort(list); @@ -175,8 +171,7 @@ private void parseFile(File file, Registry<TestHarness> reg, String filter) { if (filter != null) { if (filter.startsWith("~")) { - filter = filter.substring(1); - if (!Pattern.compile(filter).matcher(file.getName()).find()) { + if (!Pattern.compile(filter.substring(1)).matcher(file.getName()).find()) { return; } } else { @@ -215,7 +210,7 @@ } } - private Properties parseTestProperties(File file) throws FileNotFoundException, IOException { + private static Properties parseTestProperties(File file) throws FileNotFoundException, IOException { final BufferedReader reader = new BufferedReader(new FileReader(file)); final Properties vars = new Properties(); boolean lineFound = false;
--- a/graal/com.oracle.max.base/src/com/sun/max/test/TestResult.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/test/TestResult.java Sun Dec 18 05:24:06 2011 +0100 @@ -54,6 +54,9 @@ } } + /** + * @param tc + */ public String failureMessage(TestCase tc) { return ""; }
--- a/graal/com.oracle.max.base/src/com/sun/max/tools/CheckCopyright.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/tools/CheckCopyright.java Sun Dec 18 05:24:06 2011 +0100 @@ -115,7 +115,7 @@ static Matcher getCopyrightMatcher(String fileName, String fileContent) { if (copyrightMap == null) { copyrightFilePattern = Pattern.compile(copyrightFiles); - copyrightMap = new HashMap<String, CopyrightKind>(); + copyrightMap = new HashMap<>(); copyrightMap.put("java", CopyrightKind.STAR); copyrightMap.put("c", CopyrightKind.STAR); copyrightMap.put("h", CopyrightKind.STAR); @@ -136,7 +136,7 @@ private static String getExtension(String fileName) { int index = fileName.lastIndexOf(File.separatorChar); if (index > 0) { - fileName = fileName.substring(index + 1); + return getExtension(fileName.substring(index + 1)); } index = fileName.lastIndexOf('.'); if (index > 0) { @@ -149,7 +149,6 @@ } } - private static List<YearInfo> infoList = new ArrayList<YearInfo>(); private static int currentYear = Calendar.getInstance().get(Calendar.YEAR); private static final OptionSet options = new OptionSet(true); private static final Option<Boolean> help = options.newBooleanOption("help", false, "Show help message and exit."); @@ -197,11 +196,11 @@ CopyrightKind.HASH.readCopyright(); List<String> filesToCheck = null; if (HG_ALL.getValue()) { - filesToCheck = getAllFiles(true); + filesToCheck = getAllFiles(); } else if (HG_OUTGOING.getValue()) { filesToCheck = getOutgoingFiles(); } else if (HG_MODIFIED.getValue()) { - filesToCheck = getAllFiles(false); + filesToCheck = getAllFiles(); } else if (HG_LOG.getValue() > 0) { filesToCheck = getLastNFiles(HG_LOG.getValue()); } else if (FILE_LIST.getValue() != null) { @@ -228,7 +227,7 @@ try { final List<String> logInfo = hglog(fileName); final Info info = getInfo(fileName, true, logInfo); - checkFile(fileName, info); + checkFile(info); } catch (ProgramError e) { System.err.println("COPYRIGHT CHECK WARNING: error while processing " + fileName); } @@ -251,7 +250,7 @@ } private static List<String> readFileList(String fileListName) throws IOException { - final List<String> result = new ArrayList<String>(); + final List<String> result = new ArrayList<>(); BufferedReader b = null; try { b = new BufferedReader(new FileReader(fileListName)); @@ -339,7 +338,7 @@ return Integer.parseInt(parts[parts.length - 2]); } - private static void checkFile(String c, Info info) throws IOException { + private static void checkFile(Info info) throws IOException { String fileName = info.fileName; File file = new File(fileName); if (!file.exists()) { @@ -394,7 +393,7 @@ return getFilesFiles(exec(null, cmd, false)); } - private static List<String> getAllFiles(boolean all) throws Exception { + private static List<String> getAllFiles() throws Exception { final String[] cmd; if (HG_MODIFIED.getValue()) { cmd = new String[] {hgPath, "status"}; @@ -402,7 +401,7 @@ cmd = new String[] {hgPath, "status", "--all"}; } List<String> output = exec(null, cmd, true); - final List<String> result = new ArrayList<String>(output.size()); + final List<String> result = new ArrayList<>(output.size()); for (String s : output) { final char ch = s.charAt(0); if (!(ch == 'R' || ch == 'I' || ch == '?' || ch == '!')) { @@ -426,7 +425,7 @@ private static List<String> getFilesFiles(List<String> output) { // there may be multiple changesets so merge the "files:" - final Map<String, String> outSet = new TreeMap<String, String>(); + final Map<String, String> outSet = new TreeMap<>(); for (String s : output) { if (s.startsWith("files:")) { int ix = s.indexOf(' '); @@ -439,11 +438,11 @@ } } } - return new ArrayList<String>(outSet.values()); + return new ArrayList<>(outSet.values()); } private static List<String> exec(File workingDir, String[] command, boolean failOnError) throws IOException, InterruptedException { - List<String> result = new ArrayList<String>(); + List<String> result = new ArrayList<>(); if (Trace.hasLevel(2)) { Trace.line(2, "Executing process in directory: " + workingDir); for (String c : command) { @@ -482,7 +481,7 @@ } private static List<String> readOutput(InputStream is) throws IOException { - final List<String> result = new ArrayList<String>(); + final List<String> result = new ArrayList<>(); BufferedReader bs = null; try { bs = new BufferedReader(new InputStreamReader(is));
--- a/graal/com.oracle.max.base/src/com/sun/max/util/ArrayValueHistory.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/util/ArrayValueHistory.java Sun Dec 18 05:24:06 2011 +0100 @@ -37,7 +37,7 @@ private int age = -1; public ArrayValueHistory(int limit) { - this.generations = new ArrayDeque<E>(); + this.generations = new ArrayDeque<>(); this.limit = limit; }
--- a/graal/com.oracle.max.base/src/com/sun/max/util/Deferrable.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/util/Deferrable.java Sun Dec 18 05:24:06 2011 +0100 @@ -57,13 +57,13 @@ } public synchronized void deferAll() { - deferrables = new LinkedList<Deferrable>(); + deferrables = new LinkedList<>(); } public synchronized void runAll() { while (deferrables != null) { final List<Deferrable> oldDeferrables = this.deferrables; - this.deferrables = new LinkedList<Deferrable>(); + this.deferrables = new LinkedList<>(); for (Deferrable deferrable : oldDeferrables) { deferrable.run(); }
--- a/graal/com.oracle.max.base/src/com/sun/max/util/Predicate.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/util/Predicate.java Sun Dec 18 05:24:06 2011 +0100 @@ -40,7 +40,7 @@ } }; - public static <T> Predicate<T> alwaysTrue(Class<T> type) { + public static <T> Predicate<T> alwaysTrue() { final Class<Predicate<T>> predicateType = null; return Utils.cast(predicateType, alwaysTrue); }
--- a/graal/com.oracle.max.base/src/com/sun/max/util/Registry.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/util/Registry.java Sun Dec 18 05:24:06 2011 +0100 @@ -45,9 +45,9 @@ public Registry(Class<C> classType, boolean loadClass) { this.loadClass = loadClass; this.classClass = classType; - this.classMap = new HashMap<String, Class<? extends C>>(); - this.objectMap = new HashMap<String, C>(); - this.stringMap = new HashMap<String, String>(); + this.classMap = new HashMap<>(); + this.objectMap = new HashMap<>(); + this.stringMap = new HashMap<>(); } public void registerObject(String alias, C object) { @@ -98,7 +98,7 @@ } public Iterable<String> getAliases() { - final LinkedList<String> lista = new LinkedList<String>(); + final LinkedList<String> lista = new LinkedList<>(); lista.addAll(objectMap.keySet()); lista.addAll(classMap.keySet()); lista.addAll(stringMap.keySet()); @@ -117,6 +117,6 @@ } public static <T> Registry<T> newRegistry(Class<T> cl) { - return new Registry<T>(cl, true); + return new Registry<>(cl, true); } }
--- a/graal/com.oracle.max.base/src/com/sun/max/util/Symbolizer.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/util/Symbolizer.java Sun Dec 18 05:24:06 2011 +0100 @@ -76,56 +76,59 @@ * @return a map from symbol name to symbol */ public static <S extends Symbol> Map<String, S> toSymbolMap(Symbolizer<S> symbolizer) { - final Map<String, S> map = new HashMap<String, S>(symbolizer.numberOfValues()); + final Map<String, S> map = new HashMap<>(symbolizer.numberOfValues()); for (S symbol : symbolizer) { map.put(symbol.name(), symbol); } return map; } + @SafeVarargs public static <S extends Symbol> Symbolizer<S> from(Class<S> symbolType, S... symbols) { - return new ListSymbolizer<S>(symbolType, Arrays.asList(symbols)); + return new ListSymbolizer<>(symbolType, Arrays.asList(symbols)); } + @SafeVarargs public static <S extends Symbol> Symbolizer<S> fromList(Class<S> symbolType, Iterable< ? extends S> symbols, final S... additionalSymbols) { - final List<S> list = new ArrayList<S>(Arrays.asList(additionalSymbols)); + final List<S> list = new ArrayList<>(Arrays.asList(additionalSymbols)); for (S symbol : symbols) { list.add(symbol); } - return new ListSymbolizer<S>(symbolType, list); + return new ListSymbolizer<>(symbolType, list); } + @SafeVarargs public static <S extends Symbol> Symbolizer<S> append(Symbolizer<S> symbolizer, S... symbols) { return fromList(symbolizer.type(), symbolizer, symbols); } + @SafeVarargs public static <S extends Symbol> Symbolizer<S> append(Class<S> symbolType, Symbolizer< ? extends S> symbolizer, final S... symbols) { return fromList(symbolType, symbolizer, symbols); } public static <S extends Symbol> Symbolizer<S> initialize(Class staticNameFieldClass, Class<S> symbolType) { - final List<S> list = new ArrayList<S>(); + final List<S> list = new ArrayList<>(); final List<StaticFieldName> staticFieldNames = StaticFieldName.Static.initialize(staticNameFieldClass); for (StaticFieldName staticFieldName : staticFieldNames) { if (symbolType.isInstance(staticFieldName)) { list.add(symbolType.cast(staticFieldName)); } } - return new ListSymbolizer<S>(symbolType, list); + return new ListSymbolizer<>(symbolType, list); } public static <S extends Symbol> Symbolizer<S> initialize(Class<S> symbolType) { return initialize(symbolType, symbolType); } - @SuppressWarnings("unchecked") public static <S extends Symbol> Symbolizer<S> fromSymbolizer(Symbolizer<S> symbolizer, Predicate<S> predicate) { if (predicate == null) { return symbolizer; } - final List<S> result = new LinkedList<S>(); + final List<S> result = new LinkedList<>(); for (S element : symbolizer) { if (predicate.evaluate(element)) { result.add(element);
--- a/graal/com.oracle.max.base/src/com/sun/max/util/Utf8Exception.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/src/com/sun/max/util/Utf8Exception.java Sun Dec 18 05:24:06 2011 +0100 @@ -27,6 +27,11 @@ */ public class Utf8Exception extends Exception { + /** + * + */ + private static final long serialVersionUID = 5982621155136696282L; + Utf8Exception() { super(); }
--- a/graal/com.oracle.max.base/test/test/com/sun/max/collect/FilterIteratorTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/collect/FilterIteratorTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -53,8 +53,8 @@ for (int i = 0; i < array.length; i++) { array[i] = new Integer(i); } - final LinkedList<Integer> list = new LinkedList<Integer>(java.util.Arrays.asList(array)); - FilterIterator<Integer> iter = new FilterIterator<Integer>(list.iterator(), evenPred); + final LinkedList<Integer> list = new LinkedList<>(java.util.Arrays.asList(array)); + FilterIterator<Integer> iter = new FilterIterator<>(list.iterator(), evenPred); int i = 0; Integer elem; while (iter.hasNext()) { @@ -65,7 +65,7 @@ assertEquals(i, 10); assertEquals(list.size(), 10); try { - iter = new FilterIterator<Integer>(list.iterator(), evenPred); + iter = new FilterIterator<>(list.iterator(), evenPred); while (iter.hasNext()) { iter.remove(); }
--- a/graal/com.oracle.max.base/test/test/com/sun/max/collect/IdentityHashMappingTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/collect/IdentityHashMappingTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -46,10 +46,6 @@ this.id = id; } - public int id() { - return id; - } - @Override public int hashCode() { return id; @@ -67,20 +63,17 @@ private static final class Value { + @SuppressWarnings("unused") private final int id; private Value(int id) { this.id = id; } - - public int id() { - return id; - } } public void test_basic() { final int num = 100000; - final IdentityHashMapping<Key, Value> map = new IdentityHashMapping<Key, Value>(); + final IdentityHashMapping<Key, Value> map = new IdentityHashMapping<>(); final Key[] keys = new Key[num]; final Value[] values = new Value[num]; final Value[] values2 = new Value[num];
--- a/graal/com.oracle.max.base/test/test/com/sun/max/collect/IdentitySetTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/collect/IdentitySetTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -38,7 +38,7 @@ junit.textui.TestRunner.run(IdentitySetTest.class); } - private Integer[] makeIntegerArray(int nElements) { + private static Integer[] makeIntegerArray(int nElements) { final Integer[] array = new Integer[nElements]; for (int i = 0; i < array.length; i++) { array[i] = i; @@ -46,16 +46,8 @@ return array; } - private IdentitySet<Integer> makeIntegerIdentitySet(int nElements) { - final IdentitySet<Integer> result = new IdentitySet<Integer>(); - for (int i = 0; i < nElements; i++) { - result.add(i); - } - return result; - } - public void test_numberOfElements() { - final IdentitySet<Integer> set = new IdentitySet<Integer>(); + final IdentitySet<Integer> set = new IdentitySet<>(); assertEquals(set.numberOfElements(), 0); try { set.add(null); @@ -68,7 +60,7 @@ } } - private void check_add(IdentitySet<Integer> set) { + private static void check_add(IdentitySet<Integer> set) { assertEquals(set.numberOfElements(), 0); try { set.add(null); @@ -90,7 +82,7 @@ } public void test_contains() { - final IdentitySet<Integer> set = new IdentitySet<Integer>(); + final IdentitySet<Integer> set = new IdentitySet<>(); final Integer[] ints = makeIntegerArray(1000); for (int i = 0; i < 1000; i++) { set.add(ints[i]); @@ -103,13 +95,13 @@ } public void test_iterator() { - final IdentitySet<Integer> set = new IdentitySet<Integer>(); + final IdentitySet<Integer> set = new IdentitySet<>(); final Integer[] ints = makeIntegerArray(1000); for (int i = 0; i < 1000; i++) { set.add(ints[i]); } assertEquals(set.numberOfElements(), 1000); - final IdentitySet<Integer> newSet = new IdentitySet<Integer>(); + final IdentitySet<Integer> newSet = new IdentitySet<>(); assertEquals(newSet.numberOfElements(), 0); for (Integer theInt : set) { assertNotNull(theInt);
--- a/graal/com.oracle.max.base/test/test/com/sun/max/collect/IntHashMapTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/collect/IntHashMapTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -59,7 +59,7 @@ public void test_serialPut() { initialize(); - final IntHashMap<Object> table = new IntHashMap<Object>(); + final IntHashMap<Object> table = new IntHashMap<>(); for (int i = 0; i < N; i++) { assertEquals(table.get(i), null); table.put(i, integers[i] + ""); @@ -70,7 +70,7 @@ public void test_randomPut() { initialize(); - final IntHashMap<Object> table = new IntHashMap<Object>(); + final IntHashMap<Object> table = new IntHashMap<>(); final Random random = new Random(); final int[] keys = new int[N]; for (int i = 0; i < N; i++) {
--- a/graal/com.oracle.max.base/test/test/com/sun/max/collect/LinkedIdentityHashMapTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/collect/LinkedIdentityHashMapTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -62,7 +62,7 @@ public void test_serial() { initialize(); - final LinkedIdentityHashMap<String, Integer> table = new LinkedIdentityHashMap<String, Integer>(); + final LinkedIdentityHashMap<String, Integer> table = new LinkedIdentityHashMap<>(); for (int i = 0; i < nKeys; i++) { assertEquals(table.get(keys[i]), null); table.put(keys[i], vals[i]); @@ -72,7 +72,7 @@ public void test_random() { initialize(); - final LinkedIdentityHashMap<String, Integer> table = new LinkedIdentityHashMap<String, Integer>(); + final LinkedIdentityHashMap<String, Integer> table = new LinkedIdentityHashMap<>(); final Random random = new Random(); final int[] keyOrder = new int[nKeys]; for (int i = 0; i < nKeys; i++) { @@ -94,8 +94,8 @@ public void test_equals() { initialize(); - final LinkedIdentityHashMap<String, Integer> table1 = new LinkedIdentityHashMap<String, Integer>(); - final LinkedIdentityHashMap<String, Integer> table2 = new LinkedIdentityHashMap<String, Integer>(); + final LinkedIdentityHashMap<String, Integer> table1 = new LinkedIdentityHashMap<>(); + final LinkedIdentityHashMap<String, Integer> table2 = new LinkedIdentityHashMap<>(); assertTrue(table1.equals(table2)); assertTrue(table2.equals(table1)); for (int i = 0; i < nKeys; i++) {
--- a/graal/com.oracle.max.base/test/test/com/sun/max/collect/MappingTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/collect/MappingTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -57,8 +57,8 @@ } } - private List<Mapping<Integer, Object>> mappings() { - final List<Mapping<Integer, Object>> mappings = new ArrayList<Mapping<Integer, Object>>(); + private static List<Mapping<Integer, Object>> mappings() { + final List<Mapping<Integer, Object>> mappings = new ArrayList<>(); mappings.add(new OpenAddressingHashMapping<Integer, Object>()); mappings.add(new ChainedHashMapping<Integer, Object>()); return mappings;
--- a/graal/com.oracle.max.base/test/test/com/sun/max/collect/PoolSetTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/collect/PoolSetTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -59,7 +59,7 @@ } public void test_emptyPoolSet() { - final Pool<TestElement> emptyPool = new ArrayPool<TestElement>(); + final Pool<TestElement> emptyPool = new ArrayPool<>(); final PoolSet<TestElement> poolSet = PoolSet.noneOf(emptyPool); assertSame(poolSet.pool(), emptyPool); assertEquals(poolSet.size(), 0); @@ -84,7 +84,7 @@ for (int i = 0; i < numElems; i++) { elems[i] = new TestElement(i); } - pool = new ArrayPool<TestElement>(elems); + pool = new ArrayPool<>(elems); runnable.run(); } }
--- a/graal/com.oracle.max.base/test/test/com/sun/max/collect/PoolTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/collect/PoolTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -54,7 +54,7 @@ } public void test_empty() { - Pool<TestElement> pool = new ArrayPool<TestElement>(new TestElement[0]); + Pool<TestElement> pool = new ArrayPool<>(new TestElement[0]); assertEquals(pool.length(), 0); try { final TestElement elem = pool.get(0); @@ -80,7 +80,7 @@ } public void test_pool() { - Pool<TestElement> pool = new ArrayPool<TestElement>(elems); + Pool<TestElement> pool = new ArrayPool<>(elems); check_pool(pool, nElems); } }
--- a/graal/com.oracle.max.base/test/test/com/sun/max/collect/SortedLongArrayMappingTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/collect/SortedLongArrayMappingTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -58,7 +58,7 @@ public void test_serialPut() { initialize(); - final SortedLongArrayMapping<Object> table = new SortedLongArrayMapping<Object>(); + final SortedLongArrayMapping<Object> table = new SortedLongArrayMapping<>(); for (int i = 0; i < N; i++) { assertEquals(table.get(i), null); table.put(i, integers[i] + ""); @@ -69,7 +69,7 @@ public void test_randomPut() { initialize(); - final SortedLongArrayMapping<Object> table = new SortedLongArrayMapping<Object>(); + final SortedLongArrayMapping<Object> table = new SortedLongArrayMapping<>(); final Random random = new Random(); final int[] keys = new int[N]; for (int i = 0; i < N; i++) { @@ -87,7 +87,7 @@ } private void remove(int index) { - final SortedLongArrayMapping<Object> table = new SortedLongArrayMapping<Object>(); + final SortedLongArrayMapping<Object> table = new SortedLongArrayMapping<>(); for (int i = 0; i < N; i++) { table.put(i, integers[i]); }
--- a/graal/com.oracle.max.base/test/test/com/sun/max/collect/SortedPropertiesTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/collect/SortedPropertiesTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -41,7 +41,7 @@ } public void test() { - final SortedMap<String, String> sortedMap = new TreeMap<String, String>(); + final SortedMap<String, String> sortedMap = new TreeMap<>(); final Properties sortedProperties = new SortedProperties(); final Properties systemProperties = System.getProperties(); for (final Enumeration<?> e = systemProperties.propertyNames(); e.hasMoreElements();) {
--- a/graal/com.oracle.max.base/test/test/com/sun/max/lang/StringsTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/lang/StringsTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -111,13 +111,13 @@ assertTrue(Strings.indexOfNonEscapedChar('"', " \" \" ", 10) == -1); } - private void assertSplitCommandEquals(String command, String... parts) { + private static void assertSplitCommandEquals(String command, String... parts) { final String[] parsedParts = Strings.splitCommand(command); final boolean result = Arrays.equals(parsedParts, parts); assertTrue(Utils.toString(parsedParts, " "), result); } - private void assertSplitCommandThrowsException(String command) { + private static void assertSplitCommandThrowsException(String command) { try { Strings.splitCommand(command); fail("command parsing should have thrown IllegalArgumentException: " + command);
--- a/graal/com.oracle.max.base/test/test/com/sun/max/lang/ThrowTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/lang/ThrowTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -39,11 +39,11 @@ junit.textui.TestRunner.run(ThrowTest.class); } - private void throwArithmeticException() throws ArithmeticException { + private static void throwArithmeticException() throws ArithmeticException { throw new ArithmeticException(); } - private void throwIOExcepion() throws IOException { + private static void throwIOExcepion() throws IOException { throw new IOException(); }
--- a/graal/com.oracle.max.base/test/test/com/sun/max/util/DeferrableTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/util/DeferrableTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -28,6 +28,7 @@ /** * Tests for {@link Deferrable}. */ +@SuppressWarnings("unused") public class DeferrableTest extends MaxTestCase { public DeferrableTest(String name) {
--- a/graal/com.oracle.max.base/test/test/com/sun/max/util/EnumeratorTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/util/EnumeratorTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -54,7 +54,7 @@ return value; } public Enumerator<NonSuccessiveEnum> enumerator() { - return new NonSuccessiveEnumerator<NonSuccessiveEnum>(NonSuccessiveEnum.class); + return new NonSuccessiveEnumerator<>(NonSuccessiveEnum.class); } }
--- a/graal/com.oracle.max.base/test/test/com/sun/max/util/Utf8Test.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.base/test/test/com/sun/max/util/Utf8Test.java Sun Dec 18 05:24:06 2011 +0100 @@ -38,7 +38,7 @@ junit.textui.TestRunner.run(Utf8Test.class); } - private void convertStringToUtf8AndBack(String string) throws Utf8Exception { + private static void convertStringToUtf8AndBack(String string) throws Utf8Exception { final byte[] utf8 = Utf8.stringToUtf8(string); final String result = Utf8.utf8ToString(false, utf8); assertEquals(result, string);
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/intrinsics/IntrinsicImpl.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/intrinsics/IntrinsicImpl.java Sun Dec 18 05:24:06 2011 +0100 @@ -43,7 +43,7 @@ * fully qualified name and signature of a method. */ public class Registry implements Iterable<Map.Entry<String, IntrinsicImpl>> { - private Map<String, IntrinsicImpl> implRegistry = new ConcurrentHashMap<String, IntrinsicImpl>(100, 0.75f, 1); + private Map<String, IntrinsicImpl> implRegistry = new ConcurrentHashMap<>(100, 0.75f, 1); /** * Add an implementation object for an explicitly defined intrinsic ID string.
--- a/graal/com.oracle.max.cri/src/com/sun/cri/bytecode/BytecodeSwitch.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/bytecode/BytecodeSwitch.java Sun Dec 18 05:24:06 2011 +0100 @@ -127,13 +127,13 @@ /** * Reads the signed value at given bytecode index. - * @param bci the start index of the value to retrieve + * @param readBci the start index of the value to retrieve * @return the signed, 4-byte value in the bytecode array starting at {@code bci} */ - protected int readWord(int bci) { + protected int readWord(int readBci) { if (code != null) { - return Bytes.beS4(code, bci); + return Bytes.beS4(code, readBci); } - return stream.readInt(bci); + return stream.readInt(readBci); } }
--- a/graal/com.oracle.max.cri/src/com/sun/cri/bytecode/Bytecodes.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/bytecode/Bytecodes.java Sun Dec 18 05:24:06 2011 +0100 @@ -246,31 +246,6 @@ public static final int JSR_W = 201; // 0xC9 public static final int BREAKPOINT = 202; // 0xCA - // Start extended bytecodes - - /** - * Native function call. - * - * The 'function_address' value on the top of the stack is the result of - * linking a native function. - * - * <pre> - * Format: { u1 opcode; // JNICALL - * u2 sig; // Constant pool index of a CONSTANT_Utf8_info representing the signature of the call - * } - * - * Operand Stack: - * ..., [arg1, [arg2 ... ]] function_address => [return value, ]..., - * </pre> - * - * @see #JNIOP_LINK - * @see #JNIOP_J2N - * @see #JNIOP_N2J - */ - public static final int JNICALL = 203; - - // End extended bytecodes - public static final int ILLEGAL = 255; public static final int END = 256; @@ -370,17 +345,17 @@ * A array that maps from a bytecode value to a {@link String} for the corresponding instruction mnemonic. * This will include the root instruction for the three-byte extended instructions. */ - private static final String[] names = new String[256]; + private static final String[] nameArray = new String[256]; /** * A array that maps from a bytecode value to the set of {@link Flags} for the corresponding instruction. */ - private static final int[] flags = new int[256]; + private static final int[] flagsArray = new int[256]; /** * A array that maps from a bytecode value to the length in bytes for the corresponding instruction. */ - private static final int[] length = new int[256]; + private static final int[] lengthArray = new int[256]; // Checkstyle: stop static { @@ -587,8 +562,6 @@ def(GOTO_W , "goto_w" , "boooo", STOP | BRANCH); def(JSR_W , "jsr_w" , "boooo", STOP | BRANCH); def(BREAKPOINT , "breakpoint" , "b" , TRAP); - - def(JNICALL , "jnicall" , "bii" , EXTENSION | TRAP); } // Checkstyle: resume @@ -598,7 +571,7 @@ * @return {@code true} iff commutative */ public static boolean isCommutative(int opcode) { - return (flags[opcode & 0xff] & COMMUTATIVE) != 0; + return (flagsArray[opcode & 0xff] & COMMUTATIVE) != 0; } /** @@ -609,7 +582,7 @@ * variable length instruction (e.g. {@link #TABLESWITCH}), then 0 is returned. */ public static int lengthOf(int opcode) { - return length[opcode & 0xff]; + return lengthArray[opcode & 0xff]; } /** @@ -622,7 +595,7 @@ */ public static int lengthOf(byte[] code, int bci) { int opcode = Bytes.beU1(code, bci); - int length = Bytecodes.length[opcode & 0xff]; + int length = Bytecodes.lengthArray[opcode & 0xff]; if (length == 0) { switch (opcode) { case TABLESWITCH: { @@ -655,7 +628,7 @@ * @return the mnemonic for {@code opcode} or {@code "<illegal opcode: " + opcode + ">"} if {@code opcode} is not a legal opcode */ public static String nameOf(int opcode) throws IllegalArgumentException { - String name = names[opcode & 0xff]; + String name = nameArray[opcode & 0xff]; if (name == null) { return "<illegal opcode: " + opcode + ">"; } @@ -668,7 +641,7 @@ * @return the mnemonic for {@code opcode} or {@code "<illegal opcode>"} if {@code opcode} is not a legal opcode. */ public static String baseNameOf(int opcode) { - String name = names[opcode & 0xff]; + String name = nameArray[opcode & 0xff]; if (name == null) { return "<illegal opcode>"; } @@ -683,8 +656,8 @@ * @throws IllegalArgumentException if {@code name} does not denote a valid opcode */ public static int valueOf(String name) { - for (int opcode = 0; opcode < names.length; ++opcode) { - if (name.equalsIgnoreCase(names[opcode])) { + for (int opcode = 0; opcode < nameArray.length; ++opcode) { + if (name.equalsIgnoreCase(nameArray[opcode])) { return opcode; } } @@ -698,7 +671,7 @@ * @return {@code true} iff {@code opcode} can cause an implicit exception, {@code false} otherwise */ public static boolean canTrap(int opcode) { - return (flags[opcode & 0xff] & TRAP) != 0; + return (flagsArray[opcode & 0xff] & TRAP) != 0; } /** @@ -708,7 +681,7 @@ * @return {@code true} iff {@code opcode} loads a local variable to the operand stack, {@code false} otherwise */ public static boolean isLoad(int opcode) { - return (flags[opcode & 0xff] & LOAD) != 0; + return (flagsArray[opcode & 0xff] & LOAD) != 0; } /** @@ -719,7 +692,7 @@ * @return {@code true} iff {@code opcode} properly ends a basic block */ public static boolean isStop(int opcode) { - return (flags[opcode & 0xff] & STOP) != 0; + return (flagsArray[opcode & 0xff] & STOP) != 0; } /** @@ -730,7 +703,7 @@ * @return {@code true} iff {@code opcode} stores a value to a local variable, {@code false} otherwise */ public static boolean isInvoke(int opcode) { - return (flags[opcode & 0xff] & INVOKE) != 0; + return (flagsArray[opcode & 0xff] & INVOKE) != 0; } /** @@ -741,7 +714,7 @@ * @return {@code true} iff {@code opcode} stores a value to a local variable, {@code false} otherwise */ public static boolean isStore(int opcode) { - return (flags[opcode & 0xff] & STORE) != 0; + return (flagsArray[opcode & 0xff] & STORE) != 0; } /** @@ -751,7 +724,7 @@ * @return {@code true} iff {@code opcode} delimits a basic block */ public static boolean isBlockEnd(int opcode) { - return (flags[opcode & 0xff] & (STOP | FALL_THROUGH)) != 0; + return (flagsArray[opcode & 0xff] & (STOP | FALL_THROUGH)) != 0; } /** @@ -762,7 +735,7 @@ * @return {@code true} iff {@code opcode} is a branch instruction with a single operand */ public static boolean isBranch(int opcode) { - return (flags[opcode & 0xff] & BRANCH) != 0; + return (flagsArray[opcode & 0xff] & BRANCH) != 0; } /** @@ -771,7 +744,7 @@ * @return {@code true} iff {@code opcode} is a conditional branch */ public static boolean isConditionalBranch(int opcode) { - return (flags[opcode & 0xff] & FALL_THROUGH) != 0; + return (flagsArray[opcode & 0xff] & FALL_THROUGH) != 0; } /** @@ -782,7 +755,7 @@ * @return {@code true} iff {@code opcode} is a standard bytecode */ public static boolean isStandard(int opcode) { - return (flags[opcode & 0xff] & EXTENSION) == 0; + return (flagsArray[opcode & 0xff] & EXTENSION) == 0; } /** @@ -792,7 +765,7 @@ * @return {@code true} if {@code opcode} is an extended bytecode */ public static boolean isExtended(int opcode) { - return (flags[opcode & 0xff] & EXTENSION) != 0; + return (flagsArray[opcode & 0xff] & EXTENSION) != 0; } /** @@ -861,7 +834,7 @@ * * @param name instruction name (should be lower case) * @param format encodes the length of the instruction - * @param flags the set of {@link Flags} associated with the instruction + * @param flagsArray the set of {@link Flags} associated with the instruction */ private static void def(int opcode, String name, String format) { def(opcode, name, format, 0); @@ -875,11 +848,11 @@ * @param flags the set of {@link Flags} associated with the instruction */ private static void def(int opcode, String name, String format, int flags) { - assert names[opcode] == null : "opcode " + opcode + " is already bound to name " + names[opcode]; - names[opcode] = name; + assert nameArray[opcode] == null : "opcode " + opcode + " is already bound to name " + nameArray[opcode]; + nameArray[opcode] = name; int instructionLength = format.length(); - length[opcode] = instructionLength; - Bytecodes.flags[opcode] = flags; + lengthArray[opcode] = instructionLength; + Bytecodes.flagsArray[opcode] = flags; assert !isConditionalBranch(opcode) || isBranch(opcode) : "a conditional branch must also be a branch"; } @@ -919,8 +892,8 @@ String name = matcher.group(2); String value = matcher.group(4); int opcode = Integer.parseInt(value); - if (names[opcode] == null || !names[opcode].equalsIgnoreCase(name)) { - throw new RuntimeException("Missing definition of name and flags for " + opcode + ":" + name + " -- " + names[opcode]); + if (nameArray[opcode] == null || !nameArray[opcode].equalsIgnoreCase(name)) { + throw new RuntimeException("Missing definition of name and flags for " + opcode + ":" + name + " -- " + nameArray[opcode]); } if (opcode != lastExtendedOpcode + 1) { System.err.println("Fixed declaration of opcode " + name + " to be " + (lastExtendedOpcode + 1) + " (was " + value + ")");
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiAddress.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiAddress.java Sun Dec 18 05:24:06 2011 +0100 @@ -30,6 +30,11 @@ public final class CiAddress extends CiValue { /** + * + */ + private static final long serialVersionUID = -1003772042519945089L; + + /** * A sentinel value used as a place holder in an instruction stream for an address that will be patched. */ public static final CiAddress Placeholder = new CiAddress(CiKind.Illegal, CiRegister.None.asValue()); @@ -93,23 +98,24 @@ public CiAddress(CiKind kind, CiValue base, CiValue index, Scale scale, int displacement) { super(kind); + this.base = base; if (index.isConstant()) { long longIndex = ((CiConstant) index).asLong(); long longDisp = displacement + longIndex * scale.value; if ((int) longIndex != longIndex || (int) longDisp != longDisp) { throw new Error("integer overflow when computing constant displacement"); } - displacement = (int) longDisp; - index = IllegalValue; - scale = Scale.Times1; + this.displacement = (int) longDisp; + this.index = IllegalValue; + this.scale = Scale.Times1; + } else { + assert base.isIllegal() || base.isVariableOrRegister(); + assert index.isIllegal() || index.isVariableOrRegister(); + + this.index = index; + this.scale = scale; + this.displacement = displacement; } - assert base.isIllegal() || base.isVariableOrRegister(); - assert index.isIllegal() || index.isVariableOrRegister(); - - this.base = base; - this.index = index; - this.scale = scale; - this.displacement = displacement; } /**
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiArchitecture.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiArchitecture.java Sun Dec 18 05:24:06 2011 +0100 @@ -134,13 +134,13 @@ this.registerReferenceMapBitCount = registerReferenceMapBitCount; this.returnAddressSize = returnAddressSize; - registersByName = new HashMap<String, CiRegister>(registers.length); + registersByName = new HashMap<>(registers.length); for (CiRegister register : registers) { registersByName.put(register.name, register); assert registers[register.number] == register; } - registersByTypeAndEncoding = new EnumMap<CiRegister.RegisterFlag, CiRegister[]>(RegisterFlag.class); + registersByTypeAndEncoding = new EnumMap<>(RegisterFlag.class); EnumMap<RegisterFlag, CiRegister[]> categorizedRegs = CiRegister.categorize(registers); for (RegisterFlag type : RegisterFlag.values()) { CiRegister[] regs = categorizedRegs.get(type);
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiAssumptions.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiAssumptions.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,7 +34,17 @@ */ public final class CiAssumptions implements Serializable, Iterable<CiAssumptions.Assumption> { + /** + * + */ + private static final long serialVersionUID = 5152062717588239131L; + public abstract static class Assumption implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -1936652569665112915L; } /** @@ -42,6 +52,11 @@ */ public static final class ConcreteSubtype extends Assumption { /** + * + */ + private static final long serialVersionUID = -1457173265437676252L; + + /** * Type the assumption is made about. */ public final RiResolvedType context; @@ -81,6 +96,11 @@ public static final class ConcreteMethod extends Assumption { /** + * + */ + private static final long serialVersionUID = -7636746737947390059L; + + /** * A virtual (or interface) method whose unique implementation for the receiver type * in {@link #context} is {@link #impl}. */ @@ -162,7 +182,9 @@ * @param receiverType the type that is assumed to have no finalizable subclasses * @return {@code true} if the assumption was recorded and can be assumed; {@code false} otherwise */ + @SuppressWarnings("static-method") public boolean recordNoFinalizableSubclassAssumption(RiResolvedType receiverType) { + // TODO(tw): Record that assumption correctly. return false; }
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiBitMap.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiBitMap.java Sun Dec 18 05:24:06 2011 +0100 @@ -30,6 +30,7 @@ */ public final class CiBitMap implements Serializable { + private static final long serialVersionUID = 2471441272241401105L; private static final int ADDRESS_BITS_PER_WORD = 6; private static final int BITS_PER_WORD = 1 << ADDRESS_BITS_PER_WORD; private static final int BIT_INDEX_MASK = BITS_PER_WORD - 1; @@ -160,11 +161,11 @@ } } - private int bitInWord(int i) { + private static int bitInWord(int i) { return i & BIT_INDEX_MASK; } - private int wordIndex(int i) { + private static int wordIndex(int i) { return (i >> ADDRESS_BITS_PER_WORD) - 1; } @@ -424,7 +425,7 @@ return -1; } - private int bitIndex(int index) { + private static int bitIndex(int index) { return (index + 1) << ADDRESS_BITS_PER_WORD; } @@ -563,10 +564,8 @@ * @param length the number of bits represented in the returned string. If {@code length < 0 || length > size()}, * then the value of {@link #length()} is used. */ - public String toBinaryString(int length) { - if (length < 0 || length > size) { - length = length(); - } + public String toBinaryString() { + int length = length(); if (length == 0) { return ""; } @@ -589,9 +588,9 @@ if (size == 0) { return ""; } - int size = CiUtil.align(this.size, 4); - StringBuilder sb = new StringBuilder(size / 4); - for (int i = 0; i < size; i += 4) { + int hexSize = CiUtil.align(this.size, 4); + StringBuilder sb = new StringBuilder(hexSize / 4); + for (int i = 0; i < hexSize; i += 4) { int nibble = get(i) ? 1 : 0; if (get(i + 1)) { nibble |= 2; @@ -629,9 +628,6 @@ * @return the number of bytes written to {@code arr} */ public int copyTo(byte[] arr, int off, int numberOfBytes) { - if (numberOfBytes < 0) { - numberOfBytes = (size + 7) / 8; - } for (int i = 0; i < numberOfBytes; ++i) { long word = low; int byteInWord;
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiCalleeSaveLayout.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiCalleeSaveLayout.java Sun Dec 18 05:24:06 2011 +0100 @@ -94,7 +94,6 @@ assert offset <= size; this.size = size; } - size = this.size; this.regNumToIndex = new int[maxRegNum + 1]; this.indexToReg = offset == 0 ? new CiRegister[0] : new CiRegister[offset / slotSize];
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiCodePos.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiCodePos.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,6 +34,11 @@ */ public class CiCodePos implements Serializable { /** + * + */ + private static final long serialVersionUID = 8633885274526033515L; + + /** * The position where this position has been called, {@code null} if none. */ public final CiCodePos caller;
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiConstant.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiConstant.java Sun Dec 18 05:24:06 2011 +0100 @@ -29,6 +29,10 @@ */ public final class CiConstant extends CiValue { + /** + * + */ + private static final long serialVersionUID = -6355452536852663986L; private static final CiConstant[] INT_CONSTANT_CACHE = new CiConstant[100]; static { for (int i = 0; i < INT_CONSTANT_CACHE.length; ++i) { @@ -157,16 +161,6 @@ * @return the value of this constant */ public Object boxedValue() { - return boxedValue(kind); - } - - /** - * Returns the value of this constant as a boxed Java value. - * - * @param kind the kind of the boxed value to be returned - * @return the value of this constant - */ - public Object boxedValue(CiKind kind) { // Checkstyle: stop switch (kind) { case Byte: return (byte) asInt();
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiDebugInfo.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiDebugInfo.java Sun Dec 18 05:24:06 2011 +0100 @@ -31,6 +31,11 @@ public class CiDebugInfo implements Serializable { /** + * + */ + private static final long serialVersionUID = -6047206624915812516L; + + /** * The code position (including all inlined methods) of this debug info. * If this is a {@link CiFrame} instance, then it is also the deoptimization information for each inlined frame. */
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiFrame.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiFrame.java Sun Dec 18 05:24:06 2011 +0100 @@ -33,6 +33,11 @@ */ public class CiFrame extends CiCodePos implements Serializable { /** + * + */ + private static final long serialVersionUID = -345025397165977565L; + + /** * An array of values representing how to reconstruct the state of the Java frame. * This is array is partitioned as follows: * <p> @@ -188,9 +193,9 @@ if (numStack == 0) { return this; } - CiValue[] values = new CiValue[numLocals + numLocks]; - System.arraycopy(this.values, 0, values, 0, numLocals); - System.arraycopy(this.values, numLocals + numStack, values, numLocals, numLocks); - return new CiFrame(caller(), method, bci, rethrowException, values, numLocals, 0, numLocks); + CiValue[] ciValues = new CiValue[numLocals + numLocks]; + System.arraycopy(this.values, 0, ciValues, 0, numLocals); + System.arraycopy(this.values, numLocals + numStack, ciValues, numLocals, numLocks); + return new CiFrame(caller(), method, bci, rethrowException, ciValues, numLocals, 0, numLocks); } }
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiGenericCallback.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiGenericCallback.java Sun Dec 18 05:24:06 2011 +0100 @@ -27,6 +27,7 @@ */ public abstract class CiGenericCallback { + @SuppressWarnings("unused") private Object callbackInternal(Object arg) { try { return callback(arg);
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiMonitorValue.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiMonitorValue.java Sun Dec 18 05:24:06 2011 +0100 @@ -23,6 +23,10 @@ package com.sun.cri.ci; public final class CiMonitorValue extends CiValue { + /** + * + */ + private static final long serialVersionUID = 8241681800464483691L; public final CiValue owner; public final CiValue lockData; public final boolean eliminated;
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiRegister.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiRegister.java Sun Dec 18 05:24:06 2011 +0100 @@ -31,6 +31,11 @@ public final class CiRegister implements Comparable<CiRegister>, Serializable { /** + * + */ + private static final long serialVersionUID = -7213269157816016300L; + + /** * Invalid register. */ public static final CiRegister None = new CiRegister(-1, -1, 0, "noreg"); @@ -121,7 +126,7 @@ } } - private int createMask(RegisterFlag... flags) { + private static int createMask(RegisterFlag... flags) { int result = 0; for (RegisterFlag f : flags) { result |= f.mask; @@ -188,9 +193,9 @@ * {@linkplain #isSet(RegisterFlag) set} */ public static EnumMap<RegisterFlag, CiRegister[]> categorize(CiRegister[] registers) { - EnumMap<RegisterFlag, CiRegister[]> result = new EnumMap<RegisterFlag, CiRegister[]>(RegisterFlag.class); + EnumMap<RegisterFlag, CiRegister[]> result = new EnumMap<>(RegisterFlag.class); for (RegisterFlag flag : RegisterFlag.values()) { - ArrayList<CiRegister> list = new ArrayList<CiRegister>(); + ArrayList<CiRegister> list = new ArrayList<>(); for (CiRegister r : registers) { if (r.isSet(flag)) { list.add(r);
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiRegisterValue.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiRegisterValue.java Sun Dec 18 05:24:06 2011 +0100 @@ -30,6 +30,10 @@ public final class CiRegisterValue extends CiValue { /** + * + */ + private static final long serialVersionUID = 7999341472196897163L; + /** * The register. */ public final CiRegister reg;
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiStackSlot.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiStackSlot.java Sun Dec 18 05:24:06 2011 +0100 @@ -29,6 +29,11 @@ public final class CiStackSlot extends CiValue { /** + * + */ + private static final long serialVersionUID = -7725071921307318433L; + + /** * @see CiStackSlot#index() */ private final int index;
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiTargetMethod.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiTargetMethod.java Sun Dec 18 05:24:06 2011 +0100 @@ -35,10 +35,19 @@ public class CiTargetMethod implements Serializable { /** + * + */ + private static final long serialVersionUID = -1319947729753702434L; + + /** * Represents a code position with associated additional information. */ public abstract static class Site implements Serializable { /** + * + */ + private static final long serialVersionUID = -8214214947651979102L; + /** * The position (or offset) of this site with respect to the start of the target method. */ public final int pcOffset; @@ -52,6 +61,10 @@ * Represents a safepoint with associated debug info. */ public static class Safepoint extends Site implements Comparable<Safepoint> { + /** + * + */ + private static final long serialVersionUID = 2479806696381720162L; public final CiDebugInfo debugInfo; Safepoint(int pcOffset, CiDebugInfo debugInfo) { @@ -84,6 +97,11 @@ */ public static final class Call extends Safepoint { /** + * + */ + private static final long serialVersionUID = 1440741241631046954L; + + /** * The target of the call. */ public final Object target; @@ -127,6 +145,10 @@ * Represents a reference to data from the code. The associated data can be any constant. */ public static final class DataPatch extends Site { + /** + * + */ + private static final long serialVersionUID = 5771730331604867476L; public final CiConstant constant; public final int alignment; @@ -147,6 +169,10 @@ * This is optional information that can be used to enhance a disassembly of the code. */ public abstract static class CodeAnnotation implements Serializable { + /** + * + */ + private static final long serialVersionUID = -7903959680749520748L; public final int position; public CodeAnnotation(int position) { @@ -158,6 +184,10 @@ * A string comment about one or more instructions at a specific position in the code. */ public static final class CodeComment extends CodeAnnotation { + /** + * + */ + private static final long serialVersionUID = 6802287188701961401L; public final String value; public CodeComment(int position, String comment) { super(position); @@ -174,6 +204,10 @@ * Labels some inline data in the code. */ public static final class InlineData extends CodeAnnotation { + /** + * + */ + private static final long serialVersionUID = 305997507263827108L; public final int size; public InlineData(int position, int size) { super(position); @@ -195,6 +229,11 @@ */ public static final class JumpTable extends CodeAnnotation { /** + * + */ + private static final long serialVersionUID = 2222194398353801831L; + + /** * The low value in the key range (inclusive). */ public final int low; @@ -229,6 +268,11 @@ */ public static final class LookupTable extends CodeAnnotation { /** + * + */ + private static final long serialVersionUID = 8367952567559116160L; + + /** * The number of entries in the table. */ public final int npairs; @@ -261,6 +305,10 @@ * well as the caught exception type. */ public static final class ExceptionHandler extends Site { + /** + * + */ + private static final long serialVersionUID = 4897339464722665281L; public final int bci; public final int scopeLevel; public final int handlerPos; @@ -283,6 +331,10 @@ } public static final class Mark extends Site { + /** + * + */ + private static final long serialVersionUID = 3612943150662354844L; public final Object id; public final Mark[] references; @@ -307,28 +359,26 @@ /** * List of safepoints, sorted by {@link Site#pcOffset}. */ - public final List<Safepoint> safepoints = new ArrayList<Safepoint>(); + public final List<Safepoint> safepoints = new ArrayList<>(); /** * List of data references. */ - public final List<DataPatch> dataReferences = new ArrayList<DataPatch>(); + public final List<DataPatch> dataReferences = new ArrayList<>(); /** * List of exception handlers. */ - public final List<ExceptionHandler> exceptionHandlers = new ArrayList<ExceptionHandler>(); + public final List<ExceptionHandler> exceptionHandlers = new ArrayList<>(); /** * List of marks. */ - public final List<Mark> marks = new ArrayList<Mark>(); + public final List<Mark> marks = new ArrayList<>(); private int frameSize = -1; private int customStackAreaOffset = -1; private int registerRestoreEpilogueOffset = -1; - private int deoptReturnAddressOffset; - /** * The buffer containing the emitted machine code. */ @@ -516,7 +566,7 @@ public void addAnnotation(CodeAnnotation annotation) { assert annotation != null; if (annotations == null) { - annotations = new ArrayList<CiTargetMethod.CodeAnnotation>(); + annotations = new ArrayList<>(); } annotations.add(annotation); } @@ -540,7 +590,7 @@ private static void appendRefMap(StringBuilder sb, String name, CiBitMap map) { if (map != null) { - sb.append(' ').append(name).append('[').append(map.toBinaryString(-1)).append(']'); + sb.append(' ').append(name).append('[').append(map.toBinaryString()).append(']'); } } }
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiUtil.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiUtil.java Sun Dec 18 05:24:06 2011 +0100 @@ -236,15 +236,6 @@ } } - // Stub so that there are fewer merging-related changes - // TODO remove - public static String format(String format, RiMethod method, boolean arg) throws IllegalFormatException { - return format(format, method); - } - public static String format(String format, RiField field, boolean arg) throws IllegalFormatException { - return format(format, field); - } - /** * Gets a string for a given method formatted according to a given format specification. A format specification is * composed of characters that are to be copied verbatim to the result and specifiers that denote an attribute of @@ -417,7 +408,8 @@ /** * Gets a stack trace element for a given method and bytecode index. */ - public static StackTraceElement toStackTraceElement(RiMethod method, int bci) { + public static StackTraceElement toStackTraceElement(RiMethod method, @SuppressWarnings("unused") int bci) { + // TODO(tw): Look if we can use bci to get the line number. return new StackTraceElement(CiUtil.toJavaName(method.holder()), method.name(), null, -1); } @@ -431,8 +423,6 @@ return "L" + className.replace('.', '/') + ";"; } - private static final Object[] NO_ARGUMENTS = {}; - /** * Creates a set that uses reference-equality instead of {@link Object#equals(Object)} * when comparing values. @@ -468,7 +458,7 @@ public static String tabulateValues(CiFrame frame) { int cols = Math.max(frame.numLocals, Math.max(frame.numStack, frame.numLocks)); assert cols > 0; - ArrayList<Object> cells = new ArrayList<Object>(); + ArrayList<Object> cells = new ArrayList<>(); cells.add(""); for (int i = 0; i < cols; i++) { cells.add(i);
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiValue.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiValue.java Sun Dec 18 05:24:06 2011 +0100 @@ -30,7 +30,9 @@ * Abstract base class for values manipulated by the compiler. All values have a {@linkplain CiKind kind} and are immutable. */ public abstract class CiValue implements Serializable { + private static final long serialVersionUID = -6909397188697766469L; + @SuppressWarnings("serial") public static CiValue IllegalValue = new CiValue(CiKind.Illegal) { @Override public String name() {
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiVariable.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiVariable.java Sun Dec 18 05:24:06 2011 +0100 @@ -30,6 +30,11 @@ public final class CiVariable extends CiValue { /** + * + */ + private static final long serialVersionUID = 4507578431686109809L; + + /** * The identifier of the variable. This is a non-zero index in a contiguous 0-based name space. */ public final int index;
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiVirtualObject.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiVirtualObject.java Sun Dec 18 05:24:06 2011 +0100 @@ -30,6 +30,10 @@ */ public final class CiVirtualObject extends CiValue { + /** + * + */ + private static final long serialVersionUID = -2907197776426346021L; private final RiType type; private CiValue[] values; private final int id;
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ri/RiTypeProfile.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ri/RiTypeProfile.java Sun Dec 18 05:24:06 2011 +0100 @@ -32,6 +32,11 @@ public class RiTypeProfile implements Serializable { /** + * + */ + private static final long serialVersionUID = -6877016333706838441L; + + /** * How often the instruction was executed, which may be used to judge the maturity of this profile. */ public int count;
--- a/graal/com.oracle.max.cri/src/com/sun/cri/xir/CiXirAssembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/xir/CiXirAssembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -39,12 +39,12 @@ protected XirOperand resultOperand; protected boolean allocateResultOperand; - protected final List<XirInstruction> instructions = new ArrayList<XirInstruction>(); - protected final List<XirLabel> labels = new ArrayList<XirLabel>(5); - protected final List<XirParameter> parameters = new ArrayList<XirParameter>(5); - protected final List<XirTemp> temps = new ArrayList<XirTemp>(5); - protected final List<XirConstant> constants = new ArrayList<XirConstant>(5); - protected final List<XirMark> marks = new ArrayList<XirMark>(5); + protected final List<XirInstruction> instructions = new ArrayList<>(); + protected final List<XirLabel> labels = new ArrayList<>(5); + protected final List<XirParameter> parameters = new ArrayList<>(5); + protected final List<XirTemp> temps = new ArrayList<>(5); + protected final List<XirConstant> constants = new ArrayList<>(5); + protected final List<XirMark> marks = new ArrayList<>(5); protected int outgoingStackSize = 0;
--- a/graal/com.oracle.max.cri/src/com/sun/cri/xir/XirSnippet.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/xir/XirSnippet.java Sun Dec 18 05:24:06 2011 +0100 @@ -57,7 +57,7 @@ return true; } - private boolean assertArgumentCorrect(XirParameter param, XirArgument arg) { + private static boolean assertArgumentCorrect(XirParameter param, XirArgument arg) { if (param.kind == CiKind.Illegal || param.kind == CiKind.Void) { if (arg != null) { return false;
--- a/graal/com.oracle.max.cri/src/com/sun/cri/xir/XirTemplate.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/xir/XirTemplate.java Sun Dec 18 05:24:06 2011 +0100 @@ -161,9 +161,9 @@ assert labels != null; assert parameters != null; - List<XirOperand> inputOperands = new ArrayList<XirOperand>(4); - List<XirOperand> inputTempOperands = new ArrayList<XirOperand>(4); - List<XirOperand> tempOperands = new ArrayList<XirOperand>(4); + List<XirOperand> inputOperandList = new ArrayList<>(4); + List<XirOperand> inputTempOperandList = new ArrayList<>(4); + List<XirOperand> tempOperandList = new ArrayList<>(4); parameterDestroyed = new boolean[parameters.length]; for (int i = 0; i < parameters.length; i++) { @@ -183,21 +183,21 @@ } if (parameterDestroyed[i]) { - inputTempOperands.add(parameters[i]); + inputTempOperandList.add(parameters[i]); } else { - inputOperands.add(parameters[i]); + inputOperandList.add(parameters[i]); } } for (XirTemp temp : temps) { if (temp.reserve) { - tempOperands.add(temp); + tempOperandList.add(temp); } } - this.inputOperands = inputOperands.toArray(new XirOperand[inputOperands.size()]); - this.inputTempOperands = inputTempOperands.toArray(new XirOperand[inputTempOperands.size()]); - this.tempOperands = tempOperands.toArray(new XirOperand[tempOperands.size()]); + this.inputOperands = inputOperandList.toArray(new XirOperand[inputOperandList.size()]); + this.inputTempOperands = inputTempOperandList.toArray(new XirOperand[inputTempOperandList.size()]); + this.tempOperands = tempOperandList.toArray(new XirOperand[tempOperandList.size()]); } /**
--- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseUnresolvedMethod.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseUnresolvedMethod.java Sun Dec 18 05:24:06 2011 +0100 @@ -62,10 +62,6 @@ return o == this; } - public StackTraceElement toStackTraceElement(int bci) { - return new StackTraceElement(CiUtil.toJavaName(holder), name, null, -1); - } - @Override public String toString() { return CiUtil.format("%H.%n(%p) [unresolved]", this);
--- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/CompilationPrinter.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/CompilationPrinter.java Sun Dec 18 05:24:06 2011 +0100 @@ -96,8 +96,8 @@ */ public void printCompilation(RiMethod method) { begin("compilation"); - out.print("name \" ").print(CiUtil.format("%H::%n", method, true)).println('"'); - out.print("method \"").print(CiUtil.format("%f %r %H.%n(%p)", method, true)).println('"'); + out.print("name \" ").print(CiUtil.format("%H::%n", method)).println('"'); + out.print("method \"").print(CiUtil.format("%f %r %H.%n(%p)", method)).println('"'); out.print("date ").println(System.currentTimeMillis()); end("compilation"); } @@ -125,11 +125,12 @@ } if (codePos != null) { + CiCodePos curCodePos = codePos; do { - sb.append(CiUtil.toLocation(codePos.method, codePos.bci)); + sb.append(CiUtil.toLocation(curCodePos.method, curCodePos.bci)); sb.append('\n'); - if (codePos instanceof CiFrame) { - CiFrame frame = (CiFrame) codePos; + if (curCodePos instanceof CiFrame) { + CiFrame frame = (CiFrame) curCodePos; if (frame.numStack > 0) { sb.append("stack: "); for (int i = 0; i < frame.numStack; i++) { @@ -152,8 +153,8 @@ } sb.append("\n"); } - codePos = codePos.caller; - } while (codePos != null); + curCodePos = curCodePos.caller; + } while (curCodePos != null); } return sb.toString(); }
--- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/HexCodeFile.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/HexCodeFile.java Sun Dec 18 05:24:06 2011 +0100 @@ -110,18 +110,18 @@ /** * Map from a machine code position to a list of comments for the position. */ - public final Map<Integer, List<String>> comments = new TreeMap<Integer, List<String>>(); + public final Map<Integer, List<String>> comments = new TreeMap<>(); /** * Map from a machine code position to a comment for the operands of the instruction at the position. */ - public final Map<Integer, String> operandComments = new TreeMap<Integer, String>(); + public final Map<Integer, String> operandComments = new TreeMap<>(); public final byte[] code; - public final ArrayList<JumpTable> jumpTables = new ArrayList<JumpTable>(); + public final ArrayList<JumpTable> jumpTables = new ArrayList<>(); - public final ArrayList<LookupTable> lookupTables = new ArrayList<LookupTable>(); + public final ArrayList<LookupTable> lookupTables = new ArrayList<>(); public final String isa; @@ -205,7 +205,7 @@ public void addComment(int pos, String comment) { List<String> list = comments.get(pos); if (list == null) { - list = new ArrayList<String>(); + list = new ArrayList<>(); comments.put(pos, list); } list.add(encodeString(comment)); @@ -246,10 +246,11 @@ */ public static String encodeString(String s) { int index; - while ((index = s.indexOf(SECTION_DELIM)) != -1) { - s = s.substring(0, index) + " < |@" + s.substring(index + SECTION_DELIM.length()); + String result = s; + while ((index = result.indexOf(SECTION_DELIM)) != -1) { + result = result.substring(0, index) + " < |@" + result.substring(index + SECTION_DELIM.length()); } - return s; + return result; } /**
--- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/TTY.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/TTY.java Sun Dec 18 05:24:06 2011 +0100 @@ -102,16 +102,16 @@ // In case initialize() was not called. cachedOut = System.out; } - PrintStream out = cachedOut; + PrintStream newOut = cachedOut; String value = System.getProperty(MAX_TTY_LOG_FILE_PROPERTY); if (value != null) { try { - out = new PrintStream(new FileOutputStream(value)); + newOut = new PrintStream(new FileOutputStream(value)); } catch (FileNotFoundException e) { System.err.println("Could not open log file " + value + ": " + e); } } - return new LogStream(out); + return new LogStream(newOut); } private static final ThreadLocal<LogStream> out = new ThreadLocal<LogStream>() { @@ -287,7 +287,7 @@ private static String printMap(Map<?, ?> m) { StringBuilder sb = new StringBuilder(); - List<String> keys = new ArrayList<String>(); + List<String> keys = new ArrayList<>(); for (Object key : m.keySet()) { keys.add((String) key); } @@ -303,14 +303,6 @@ return sb.toString(); } - private static void printField(String fieldName, long value) { - TTY.print(" " + fieldName + " = " + value + "\n"); - } - - private static void printField(String fieldName, double value) { - TTY.print(" " + fieldName + " = " + value + "\n"); - } - public static void flush() { out().flush(); }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompilation.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompilation.java Sun Dec 18 05:24:06 2011 +0100 @@ -138,7 +138,7 @@ AbstractAssembler masm = compiler.backend.newAssembler(registerConfig); TargetMethodAssembler tasm = new TargetMethodAssembler(this, masm); tasm.setFrameSize(frameMap.frameSize()); - tasm.targetMethod.setCustomStackAreaOffset(frameMap.offsetToCustomArea()); + tasm.targetMethod.setCustomStackAreaOffset(FrameMap.offsetToCustomArea()); return tasm; } @@ -275,7 +275,7 @@ } List<Block> blocks = schedule.getBlocks(); - NodeMap<LIRBlock> valueToBlock = new NodeMap<LIRBlock>(graph); + NodeMap<LIRBlock> valueToBlock = new NodeMap<>(graph); for (Block b : blocks) { for (Node i : b.getInstructions()) { valueToBlock.set(i, (LIRBlock) b); @@ -315,7 +315,7 @@ } } - public void initFrameMap(int numberOfLocks) { + public void initFrameMap() { frameMap = this.compiler.backend.newFrameMap(this, method); } @@ -327,7 +327,7 @@ nodeOperands = graph.createNodeMap(); LIRGenerator lirGenerator = null; try { - initFrameMap(maxLocks()); + initFrameMap(); lirGenerator = compiler.backend.newLIRGenerator(this, xir); @@ -406,9 +406,9 @@ return compiler.context; } - public void printGraph(String phase, Graph graph) { + public void printGraph(String phase, Graph printedGraph) { if (context().isObserved()) { - context().observable.fireCompilationEvent(phase, this, graph); + context().observable.fireCompilationEvent(phase, this, printedGraph); } } }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalCompiler.java Sun Dec 18 05:24:06 2011 +0100 @@ -36,7 +36,7 @@ public class GraalCompiler { - public final Map<Object, CompilerStub> stubs = new HashMap<Object, CompilerStub>(); + public final Map<Object, CompilerStub> stubs = new HashMap<>(); public final GraalContext context;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalMetrics.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalMetrics.java Sun Dec 18 05:24:06 2011 +0100 @@ -95,7 +95,7 @@ } } - private LinkedHashMap<String, MetricsEntry> map = new LinkedHashMap<String, MetricsEntry>(); + private LinkedHashMap<String, MetricsEntry> map = new LinkedHashMap<>(); public MetricsEntry get(String name) { if (!map.containsKey(name)) { @@ -140,7 +140,7 @@ private static String printMap(Map<?, ?> m) { StringBuilder sb = new StringBuilder(); - List<String> keys = new ArrayList<String>(); + List<String> keys = new ArrayList<>(); for (Object key : m.keySet()) { keys.add((String) key); } @@ -159,9 +159,5 @@ private static void printField(String fieldName, long value) { TTY.print(" " + fieldName + " = " + value + "\n"); } - - private static void printField(String fieldName, double value) { - TTY.print(" " + fieldName + " = " + value + "\n"); - } }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalTimers.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/GraalTimers.java Sun Dec 18 05:24:06 2011 +0100 @@ -51,8 +51,8 @@ public long subTime; public long startTime; - public final ArrayList<String> subNames = new ArrayList<String>(); - public final ArrayList<TimingScope> subScopes = new ArrayList<TimingScope>(); + public final ArrayList<String> subNames = new ArrayList<>(); + public final ArrayList<TimingScope> subScopes = new ArrayList<>(); public TimingScope(TimingScope parent) { this.parent = parent; @@ -66,23 +66,23 @@ TTY.print(PREFIX.substring(PREFIX.length() - i * 8)); } - private void printScope(int level) { + private void printScope(int indent) { TTY.println("%3.0f%% %6.2fs %5d", time * 100.0 / parent.time, time / 1000000000.0, count); if (!subNames.isEmpty() && (time - subTime) > 0) { - treeIndent(level + 1); + treeIndent(indent + 1); TTY.print("%-40s", "self:"); TTY.println("%3.0f%% %6.2fs %5d", (time - subTime) * 100.0 / time, (time - subTime) / 1000000000.0, count); } - printSub(level + 1); + printSub(indent + 1); } - public void printSub(int level) { + public void printSub(int indent) { for (int i = 0; i < subNames.size(); i++) { String name = subNames.get(i); TimingScope scope = subScopes.get(i); - treeIndent(level); + treeIndent(indent); TTY.print("%-40s", name + ":"); - scope.printScope(level); + scope.printScope(indent); } } @@ -184,8 +184,8 @@ rootScope.printSub(0); - TreeMap<String, Long> times = new TreeMap<String, Long>(); - TreeMap<String, Long> counts = new TreeMap<String, Long>(); + TreeMap<String, Long> times = new TreeMap<>(); + TreeMap<String, Long> counts = new TreeMap<>(); long total = rootScope.accumulateSub(times, counts); TTY.println();
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ComputeLinearScanOrder.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ComputeLinearScanOrder.java Sun Dec 18 05:24:06 2011 +0100 @@ -32,7 +32,6 @@ public final class ComputeLinearScanOrder { - private final int maxBlockId; // the highest blockId of a block private int numBlocks; // total number of blocks (smaller than maxBlockId) List<LIRBlock> linearScanOrder; // the resulting list of blocks in correct order @@ -91,12 +90,11 @@ public ComputeLinearScanOrder(int maxBlockId, int loopCount, LIRBlock startBlock) { loopHeaders = new LIRBlock[loopCount]; - this.maxBlockId = maxBlockId; visitedBlocks = new BitMap(maxBlockId); activeBlocks = new BitMap(maxBlockId); dominatorBlocks = new BitMap(maxBlockId); forwardBranches = new int[maxBlockId]; - workList = new ArrayList<LIRBlock>(8); + workList = new ArrayList<>(8); countEdges(startBlock, null); computeOrder(startBlock); @@ -147,7 +145,7 @@ } } - int computeWeight(LIRBlock cur) { + static int computeWeight(LIRBlock cur) { // limit loop-depth to 15 bit (only for security reason, it will never be so big) int weight = (cur.loopDepth() & 0x7FFF) << 16; @@ -291,9 +289,9 @@ } // the start block is always the first block in the linear scan order - linearScanOrder = new ArrayList<LIRBlock>(numBlocks); + linearScanOrder = new ArrayList<>(numBlocks); - codeEmittingOrder = new ArrayList<LIRBlock>(numBlocks); + codeEmittingOrder = new ArrayList<>(numBlocks); // start processing with standard entry block assert workList.isEmpty() : "list must be empty before processing";
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ControlFlowOptimizer.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/ControlFlowOptimizer.java Sun Dec 18 05:24:06 2011 +0100 @@ -44,8 +44,8 @@ List<LIRBlock> code = ir.codeEmittingOrder(); //optimizer.reorderShortLoops(code); optimizer.deleteEmptyBlocks(code); - optimizer.deleteUnnecessaryJumps(code); - optimizer.deleteJumpsToReturn(code); + ControlFlowOptimizer.deleteUnnecessaryJumps(code); + ControlFlowOptimizer.deleteJumpsToReturn(code); } private final LIR ir; @@ -141,7 +141,7 @@ assert verify(code); } - private void deleteUnnecessaryJumps(List<LIRBlock> code) { + private static void deleteUnnecessaryJumps(List<LIRBlock> code) { // skip the last block because there a branch is always necessary for (int i = code.size() - 2; i >= 0; i--) { LIRBlock block = code.get(i); @@ -175,7 +175,7 @@ assert verify(code); } - private void deleteJumpsToReturn(List<LIRBlock> code) { + private static void deleteJumpsToReturn(List<LIRBlock> code) { for (int i = code.size() - 1; i >= 0; i--) { LIRBlock block = code.get(i); List<LIRInstruction> curInstructions = block.lir(); @@ -213,7 +213,7 @@ } } - private boolean verify(List<LIRBlock> code) { + private static boolean verify(List<LIRBlock> code) { for (LIRBlock block : code) { for (Block sux : block.getSuccessors()) { assert code.contains(sux) : "missing successor from: " + block + "to: " + sux;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/EdgeMoveOptimizer.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/EdgeMoveOptimizer.java Sun Dec 18 05:24:06 2011 +0100 @@ -72,7 +72,7 @@ private final List<List<LIRInstruction>> edgeInstructionSeqences; private EdgeMoveOptimizer() { - edgeInstructionSeqences = new ArrayList<List<LIRInstruction>>(4); + edgeInstructionSeqences = new ArrayList<>(4); } /** @@ -84,7 +84,7 @@ * @param op2 the second instruction to compare * @return {@code true} if {@code op1} and {@code op2} are the same by the above algorithm */ - private boolean same(LIRInstruction op1, LIRInstruction op2) { + private static boolean same(LIRInstruction op1, LIRInstruction op2) { assert op1 != null; assert op2 != null;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/Interval.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/Interval.java Sun Dec 18 05:24:06 2011 +0100 @@ -483,19 +483,20 @@ */ private Interval locationHint; - void assignLocation(CiValue location) { - if (location.isRegister()) { + void assignLocation(CiValue newLocation) { + if (newLocation.isRegister()) { assert this.location == null : "cannot re-assign location for " + this; - if (location.kind == CiKind.Illegal && kind != CiKind.Illegal) { - location = location.asRegister().asValue(kind); + if (newLocation.kind == CiKind.Illegal && kind != CiKind.Illegal) { + this.location = newLocation.asRegister().asValue(kind); + return; } } else { assert this.location == null || this.location.isRegister() : "cannot re-assign location for " + this; - assert location.isStackSlot(); - assert location.kind != CiKind.Illegal; - assert location.kind == this.kind; + assert newLocation.isStackSlot(); + assert newLocation.kind != CiKind.Illegal; + assert newLocation.kind == this.kind; } - this.location = location; + this.location = newLocation; } /** @@ -720,7 +721,7 @@ return true; } - public Interval locationHint(boolean searchSplitChild, LinearScan allocator) { + public Interval locationHint(boolean searchSplitChild) { if (!searchSplitChild) { return locationHint; } @@ -786,9 +787,9 @@ // this is an error StringBuilder msg = new StringBuilder(this.toString()).append(" has no child at ").append(opId); if (!splitChildren.isEmpty()) { - Interval first = splitChildren.get(0); - Interval last = splitChildren.get(splitChildren.size() - 1); - msg.append(" (first = ").append(first).append(", last = ").append(last).append(")"); + Interval firstChild = splitChildren.get(0); + Interval lastChild = splitChildren.get(splitChildren.size() - 1); + msg.append(" (first = ").append(firstChild).append(", last = ").append(lastChild).append(")"); } throw new CiBailout("Linear Scan Error: " + msg); } @@ -959,7 +960,7 @@ assert isSplitParent() : "list must be initialized at first split"; // Create new non-shared list - parent.splitChildren = new ArrayList<Interval>(4); + parent.splitChildren = new ArrayList<>(4); parent.splitChildren.add(this); } parent.splitChildren.add(result); @@ -1112,8 +1113,8 @@ from = String.valueOf(from()); to = String.valueOf(to()); } - String location = this.location == null ? "" : "@" + this.location.name(); - return operandNumber + ":" + operand + (operand.isRegister() ? "" : location) + "[" + from + "," + to + "]"; + String locationString = this.location == null ? "" : "@" + this.location.name(); + return operandNumber + ":" + operand + (operand.isRegister() ? "" : locationString) + "[" + from + "," + to + "]"; } /** @@ -1138,7 +1139,7 @@ } buf.append("hints{").append(splitParent.operandNumber); - Interval hint = locationHint(false, allocator); + Interval hint = locationHint(false); if (hint != null && hint.operandNumber != splitParent.operandNumber) { buf.append(", ").append(hint.operandNumber); }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/IntervalWalker.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/IntervalWalker.java Sun Dec 18 05:24:06 2011 +0100 @@ -53,7 +53,7 @@ /** * The current interval (taken from the unhandled list) being processed. */ - protected Interval current; + protected Interval currentInterval; /** * The current position (intercept point through the intervals). @@ -66,10 +66,10 @@ protected RegisterBinding currentBinding; /** - * Processes the {@linkplain #current} interval in an attempt to allocate a physical + * Processes the {@linkplain #currentInterval} interval in an attempt to allocate a physical * register to it and thus allow it to be moved to a list of {@linkplain #activeLists active} intervals. * - * @return {@code true} if a register was allocated to the {@linkplain #current} interval + * @return {@code true} if a register was allocated to the {@linkplain #currentInterval} interval */ boolean activateCurrent() { return true; @@ -98,7 +98,7 @@ activeLists = new RegisterBindingLists(Interval.EndMarker, Interval.EndMarker); inactiveLists = new RegisterBindingLists(Interval.EndMarker, Interval.EndMarker); currentPosition = -1; - current = null; + currentInterval = null; nextInterval(); } @@ -145,7 +145,7 @@ if (cur.currentAtEnd()) { // move to handled state (not maintained as a list) cur.state = State.Handled; - intervalMoved(cur, binding, state, State.Handled); + intervalMoved(cur, state, State.Handled); } else if (cur.currentFrom() <= from) { // sort into active list activeLists.addToListSortedByCurrentFromPositions(binding, cur); @@ -155,7 +155,7 @@ prevprev = prev; prev = cur.next; } - intervalMoved(cur, binding, state, State.Active); + intervalMoved(cur, state, State.Active); } else { // sort into inactive list inactiveLists.addToListSortedByCurrentFromPositions(binding, cur); @@ -165,7 +165,7 @@ prevprev = prev; prev = cur.next; } - intervalMoved(cur, binding, state, State.Inactive); + intervalMoved(cur, state, State.Inactive); } } else { prevprev = prev; @@ -190,21 +190,21 @@ } else if (fixed != Interval.EndMarker) { binding = RegisterBinding.Fixed; } else { - current = null; + currentInterval = null; return; } currentBinding = binding; - current = unhandledLists.get(binding); - unhandledLists.set(binding, current.next); - current.next = Interval.EndMarker; - current.rewindRange(); + currentInterval = unhandledLists.get(binding); + unhandledLists.set(binding, currentInterval.next); + currentInterval.next = Interval.EndMarker; + currentInterval.rewindRange(); } void walkTo(int toOpId) { assert currentPosition <= toOpId : "can not walk backwards"; - while (current != null) { - boolean isActive = current.from() <= toOpId; - int opId = isActive ? current.from() : toOpId; + while (currentInterval != null) { + boolean isActive = currentInterval.from() <= toOpId; + int opId = isActive ? currentInterval.from() : toOpId; if (GraalOptions.TraceLinearScanLevel >= 2 && !TTY.isSuppressed()) { if (currentPosition < opId) { @@ -221,10 +221,10 @@ walkTo(State.Inactive, opId); if (isActive) { - current.state = State.Active; + currentInterval.state = State.Active; if (activateCurrent()) { - activeLists.addToListSortedByCurrentFromPositions(currentBinding, current); - intervalMoved(current, currentBinding, State.Unhandled, State.Active); + activeLists.addToListSortedByCurrentFromPositions(currentBinding, currentInterval); + intervalMoved(currentInterval, State.Unhandled, State.Active); } nextInterval(); @@ -234,7 +234,7 @@ } } - private void intervalMoved(Interval interval, RegisterBinding kind, State from, State to) { + private void intervalMoved(Interval interval, State from, State to) { // intervalMoved() is called whenever an interval moves from one interval list to another. // In the implementation of this method it is prohibited to move the interval to any list. if (GraalOptions.TraceLinearScanLevel >= 4 && !TTY.isSuppressed()) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LIRInsertionBuffer.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LIRInsertionBuffer.java Sun Dec 18 05:24:06 2011 +0100 @@ -52,14 +52,14 @@ public LIRInsertionBuffer() { indexAndCount = new IntList(8); - ops = new ArrayList<LIRInstruction>(8); + ops = new ArrayList<>(8); } // must be called before using the insertion buffer - public void init(List<LIRInstruction> lir) { + public void init(List<LIRInstruction> newLir) { assert !initialized() : "already initialized"; assert indexAndCount.size() == 0 && ops.size() == 0; - this.lir = lir; + this.lir = newLir; } public boolean initialized() {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScan.java Sun Dec 18 05:24:06 2011 +0100 @@ -478,7 +478,7 @@ assert interval == Interval.EndMarker : "missed an interval"; } - private void checkIntervals(Interval interval) { + private static void checkIntervals(Interval interval) { Interval prev = null; Interval temp = interval; while (temp != Interval.EndMarker) { @@ -825,8 +825,8 @@ LIRDebugInfo info = ins.info; if (info != null) { info.forEachLiveStateValue(new ValueProcedure() { - public CiValue doValue(CiValue operand) { - TTY.println(" operand=" + operand); + public CiValue doValue(CiValue liveStateOperand) { + TTY.println(" operand=" + liveStateOperand); return null; } }); @@ -857,7 +857,7 @@ } } - private void traceLiveness(boolean changeOccurredInBlock, int iterationCount, LIRBlock block) { + private static void traceLiveness(boolean changeOccurredInBlock, int iterationCount, LIRBlock block) { char c = iterationCount == 0 || changeOccurredInBlock ? '*' : ' '; TTY.print("(%d) liveIn%c B%d ", iterationCount, c, block.blockID()); TTY.println(block.liveIn.toString()); @@ -873,9 +873,6 @@ TTY.println(" use %s from %d to %d (%s)", operand, from, to, registerPriority.name()); } - if (kind == null) { - kind = operand.kind.stackKind(); - } Interval interval = intervalFor(operand); if (interval == null) { interval = createInterval(operand); @@ -1002,7 +999,7 @@ /** * Determines the priority which with an instruction's input operand will be allocated a register. */ - RegisterPriority registerPriorityOfInputOperand(LIRInstruction op, int operandIndex, CiValue operand) { + RegisterPriority registerPriorityOfInputOperand(LIRInstruction op, int operandIndex) { if (op.code == StandardOpcode.MOVE) { CiValue res = op.result(); boolean resultInMemory = res.isVariable() && operands.mustStartInMemory((CiVariable) res); @@ -1135,9 +1132,6 @@ } } - // Add any platform dependent temps - pdAddTemps(op); - // visit definitions (output and temp operands) int k; int n; @@ -1164,7 +1158,7 @@ for (k = 0; k < n; k++) { CiValue operand = op.operandAt(LIRInstruction.OperandMode.Alive, k); if (operand.isVariableOrRegister()) { - addUse(operand, blockFrom, opId + 1, RegisterPriority.MustHaveRegister, null); + addUse(operand, blockFrom, opId + 1, RegisterPriority.MustHaveRegister, operand.kind.stackKind()); } } @@ -1173,8 +1167,8 @@ for (k = 0; k < n; k++) { CiValue operand = op.operandAt(LIRInstruction.OperandMode.Input, k); if (operand.isVariableOrRegister()) { - RegisterPriority p = registerPriorityOfInputOperand(op, k, operand); - addUse(operand, blockFrom, opId, p, null); + RegisterPriority p = registerPriorityOfInputOperand(op, k); + addUse(operand, blockFrom, opId, p, operand.kind.stackKind()); } } @@ -1186,7 +1180,7 @@ if (info != null) { info.forEachLiveStateValue(new ValueProcedure() { public CiValue doValue(CiValue operand) { - addUse(operand, blockFrom, (opId + 1), RegisterPriority.None, null); + addUse(operand, blockFrom, (opId + 1), RegisterPriority.None, operand.kind.stackKind()); return null; } }); @@ -1210,55 +1204,17 @@ // * Phase 5: actual register allocation - private void pdAddTemps(LIRInstruction op) { - /* NOTE: The intrinsic graphs for the trigonometric functions already contain - * runtime calls for the slow path, so the compiler already takes care of - * saving registers where necessary and killing them here is not required. - * - assert compilation.target.arch.isX86(); - switch (op.code) { - case Tan: - case Sin: - case Cos: { - // The slow path for these functions may need to save and - // restore all live registers but we don't want to save and - // restore everything all the time, so mark the xmms as being - // killed. If the slow path were explicit or we could propagate - // live register masks down to the assembly we could do better - // but we don't have any easy way to do that right now. We - // could also consider not killing all xmm registers if we - // assume that slow paths are uncommon but it's not clear that - // would be a good idea. - if (GraalOptions.TraceLinearScanLevel >= 2) { - TTY.println("killing XMMs for trig"); - } - int opId = op.id(); - - for (CiRegister r : compilation.registerConfig.getCallerSaveRegisters()) { - if (r.isFpu()) { - addTemp(r.asValue(), opId, RegisterPriority.None, CiKind.Illegal); - } - } - break; - } - } - */ - } - - private boolean isSorted(Interval[] intervals) { + private static boolean isSorted(Interval[] intervals) { int from = -1; for (Interval interval : intervals) { assert interval != null; assert from <= interval.from(); from = interval.from(); - - // TODO: very slow! - assert Arrays.asList(this.intervals).contains(interval); } return true; } - Interval addToList(Interval first, Interval prev, Interval interval) { + static Interval addToList(Interval first, Interval prev, Interval interval) { Interval newFirst = first; if (prev != null) { prev.next = interval; @@ -1469,7 +1425,7 @@ } } - void resolveFindInsertPos(LIRBlock fromBlock, LIRBlock toBlock, MoveResolver moveResolver) { + static void resolveFindInsertPos(LIRBlock fromBlock, LIRBlock toBlock, MoveResolver moveResolver) { if (fromBlock.numberOfSux() <= 1) { if (GraalOptions.TraceLinearScanLevel >= 4) { TTY.println("inserting moves at end of fromBlock B%d", fromBlock.blockID()); @@ -1623,7 +1579,7 @@ return true; } - CiStackSlot canonicalSpillOpr(Interval interval) { + static CiStackSlot canonicalSpillOpr(Interval interval) { assert interval.spillSlot() != null : "canonical spill slot not set"; return interval.spillSlot(); }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScanWalker.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/LinearScanWalker.java Sun Dec 18 05:24:06 2011 +0100 @@ -68,7 +68,7 @@ moveResolver = new MoveResolver(allocator); spillIntervals = Util.uncheckedCast(new List[allocator.registers.length]); for (int i = 0; i < allocator.registers.length; i++) { - spillIntervals[i] = new ArrayList<Interval>(2); + spillIntervals[i] = new ArrayList<>(2); } usePos = new int[allocator.registers.length]; blockPos = new int[allocator.registers.length]; @@ -220,11 +220,11 @@ } } - void insertMove(int opId, Interval srcIt, Interval dstIt) { + void insertMove(int operandId, Interval srcIt, Interval dstIt) { // output all moves here. When source and target are equal, the move is // optimized away later in assignRegNums - opId = (opId + 1) & ~1; + int opId = (operandId + 1) & ~1; LIRBlock opBlock = allocator.blockForId(opId); assert opId > 0 && allocator.blockForId(opId - 2) == opBlock : "cannot insert move at block boundary"; @@ -432,7 +432,7 @@ allocator.copyRegisterFlags(interval, splitPart); splitPart.setInsertMoveWhenActivated(moveNecessary); - assert splitPart.from() >= current.currentFrom() : "cannot append new interval before current walk position"; + assert splitPart.from() >= currentInterval.currentFrom() : "cannot append new interval before current walk position"; unhandledLists.addToListSortedByStartAndUsePositions(RegisterBinding.Any, splitPart); if (GraalOptions.TraceLinearScanLevel >= 2) { @@ -607,7 +607,7 @@ } CiRegister hint = null; - Interval locationHint = interval.locationHint(true, allocator); + Interval locationHint = interval.locationHint(true); if (locationHint != null && locationHint.location() != null && locationHint.location().isRegister()) { hint = locationHint.location().asRegister(); if (GraalOptions.TraceLinearScanLevel >= 4) { @@ -826,7 +826,7 @@ } } - boolean isMove(LIRInstruction op, Interval from, Interval to) { + static boolean isMove(LIRInstruction op, Interval from, Interval to) { if (op.code != StandardOpcode.MOVE) { return false; } @@ -844,7 +844,7 @@ return; } - Interval registerHint = interval.locationHint(false, allocator); + Interval registerHint = interval.locationHint(false); if (registerHint == null) { // cur is not the target of a move : otherwise registerHint would be set return; @@ -897,7 +897,7 @@ // allocate a physical register or memory location to an interval @Override boolean activateCurrent() { - Interval interval = current; + Interval interval = currentInterval; boolean result = true; if (GraalOptions.TraceLinearScanLevel >= 2) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/MoveResolver.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/MoveResolver.java Sun Dec 18 05:24:06 2011 +0100 @@ -67,9 +67,9 @@ this.allocator = allocator; this.multipleReadsAllowed = false; - this.mappingFrom = new ArrayList<Interval>(8); - this.mappingFromOpr = new ArrayList<CiValue>(8); - this.mappingTo = new ArrayList<Interval>(8); + this.mappingFrom = new ArrayList<>(8); + this.mappingFromOpr = new ArrayList<>(8); + this.mappingTo = new ArrayList<>(8); this.insertIdx = -1; this.insertionBuffer = new LIRInsertionBuffer(); this.registerBlocked = new int[allocator.registers.length]; @@ -106,7 +106,7 @@ } } - HashSet<CiValue> usedRegs = new HashSet<CiValue>(); + HashSet<CiValue> usedRegs = new HashSet<>(); if (!multipleReadsAllowed) { for (i = 0; i < mappingFrom.size(); i++) { Interval interval = mappingFrom.get(i); @@ -312,21 +312,21 @@ this.insertIdx = insertIdx; } - void moveInsertPosition(List<LIRInstruction> insertList, int insertIdx) { - if (this.insertList != null && (this.insertList != insertList || this.insertIdx != insertIdx)) { + void moveInsertPosition(List<LIRInstruction> newInsertList, int newInsertIdx) { + if (this.insertList != null && (this.insertList != newInsertList || this.insertIdx != newInsertIdx)) { // insert position changed . resolve current mappings resolveMappings(); } - if (this.insertList != insertList) { + if (this.insertList != newInsertList) { // block changed . append insertionBuffer because it is // bound to a specific block and create a new insertionBuffer appendInsertionBuffer(); - createInsertionBuffer(insertList); + createInsertionBuffer(newInsertList); } - this.insertList = insertList; - this.insertIdx = insertIdx; + this.insertList = newInsertList; + this.insertIdx = newInsertIdx; } void addMapping(Interval fromInterval, Interval toInterval) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/OperandPool.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/OperandPool.java Sun Dec 18 05:24:06 2011 +0100 @@ -108,15 +108,16 @@ } private static BitMap set(BitMap map, CiVariable variable) { - if (map == null) { - int length = BitMap.roundUpLength(variable.index + 1); - map = new BitMap(length); - } else if (map.size() <= variable.index) { + BitMap result = map; + if (result == null) { int length = BitMap.roundUpLength(variable.index + 1); - map.grow(length); + result = new BitMap(length); + } else if (result.size() <= variable.index) { + int length = BitMap.roundUpLength(variable.index + 1); + result.grow(length); } - map.set(variable.index); - return map; + result.set(variable.index); + return result; } private static boolean get(BitMap map, CiVariable variable) { @@ -132,10 +133,9 @@ * @param target description of the target architecture for a compilation */ public OperandPool(CiTarget target) { - CiRegister[] registers = target.arch.registers; + this.registers = target.arch.registers; this.firstVariableNumber = registers.length; - this.registers = registers; - variables = new ArrayList<CiVariable>(INITIAL_VARIABLE_CAPACITY); + variables = new ArrayList<>(INITIAL_VARIABLE_CAPACITY); variableDefs = GraalOptions.DetailedAsserts ? new ArrayList<ValueNode>(INITIAL_VARIABLE_CAPACITY) : null; }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/Range.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/Range.java Sun Dec 18 05:24:06 2011 +0100 @@ -63,8 +63,9 @@ this.next = next; } - int intersectsAt(Range r2) { + int intersectsAt(Range other) { Range r1 = this; + Range r2 = other; assert r2 != null : "null ranges not allowed"; assert r1 != EndMarker && r2 != EndMarker : "empty ranges not allowed";
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/RegisterVerifier.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/alloc/RegisterVerifier.java Sun Dec 18 05:24:06 2011 +0100 @@ -69,8 +69,8 @@ RegisterVerifier(LinearScan allocator) { this.allocator = allocator; - workList = new ArrayList<LIRBlock>(16); - this.savedStates = new ArrayMap<Interval[]>(); + workList = new ArrayList<>(16); + this.savedStates = new ArrayMap<>(); } @@ -182,11 +182,11 @@ } } - Interval[] copy(Interval[] inputState) { + static Interval[] copy(Interval[] inputState) { return inputState.clone(); } - void statePut(Interval[] inputState, CiValue location, Interval interval) { + static void statePut(Interval[] inputState, CiValue location, Interval interval) { if (location != null && location.isRegister()) { CiRegister reg = location.asRegister(); int regNum = reg.number; @@ -204,7 +204,7 @@ } } - boolean checkState(Interval[] inputState, CiValue reg, Interval interval) { + static boolean checkState(Interval[] inputState, CiValue reg, Interval interval) { if (reg != null && reg.isRegister()) { if (inputState[reg.asRegister().number] != interval) { throw new CiBailout("!! Error in register allocation: register " + reg + " does not contain interval " + interval.operand + " but interval " + inputState[reg.asRegister().number]);
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/asm/TargetMethodAssembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/asm/TargetMethodAssembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -129,7 +129,7 @@ if (info != null) { if (info.exceptionEdge != null) { if (exceptionInfoList == null) { - exceptionInfoList = new ArrayList<ExceptionInfo>(4); + exceptionInfoList = new ArrayList<>(4); } exceptionInfoList.add(new ExceptionInfo(pcOffset, info.exceptionEdge, info.topFrame.bci)); } @@ -146,18 +146,18 @@ } } - public void recordDirectCall(int posBefore, int posAfter, Object target, LIRDebugInfo info) { + public void recordDirectCall(int posBefore, int posAfter, Object callTarget, LIRDebugInfo info) { CiDebugInfo debugInfo = info != null ? info.debugInfo() : null; assert lastSafepointPos < posAfter; lastSafepointPos = posAfter; - targetMethod.recordCall(posBefore, posAfter - posBefore, target, debugInfo, true); + targetMethod.recordCall(posBefore, posAfter - posBefore, callTarget, debugInfo, true); } - public void recordIndirectCall(int posBefore, int posAfter, Object target, LIRDebugInfo info) { + public void recordIndirectCall(int posBefore, int posAfter, Object callTarget, LIRDebugInfo info) { CiDebugInfo debugInfo = info != null ? info.debugInfo() : null; assert lastSafepointPos < posAfter; lastSafepointPos = posAfter; - targetMethod.recordCall(posBefore, posAfter - posBefore, target, debugInfo, false); + targetMethod.recordCall(posBefore, posAfter - posBefore, callTarget, debugInfo, false); } public void recordSafepoint(int pos, LIRDebugInfo info) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/BasicIdealGraphPrinter.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/BasicIdealGraphPrinter.java Sun Dec 18 05:24:06 2011 +0100 @@ -253,7 +253,7 @@ flush(); } - private String escape(String s) { + private static String escape(String s) { StringBuilder str = null; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i);
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinter.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinter.java Sun Dec 18 05:24:06 2011 +0100 @@ -244,7 +244,7 @@ } } - Map<Object, Object> props = new TreeMap<Object, Object>(node.getDebugProperties()); + Map<Object, Object> props = new TreeMap<>(node.getDebugProperties()); out.print("d ").print(HOVER_START).print("d").print(HOVER_SEP); out.println("=== Debug Properties ==="); for (Map.Entry<Object, Object> entry : props.entrySet()) { @@ -302,33 +302,34 @@ private String stateToString(FrameState state, OperandFormatter operandFmt) { StringBuilder buf = new StringBuilder(); + FrameState curState = state; do { - buf.append(CiUtil.toLocation(state.method(), state.bci)).append('\n'); + buf.append(CiUtil.toLocation(curState.method(), curState.bci)).append('\n'); - if (state.stackSize() > 0) { + if (curState.stackSize() > 0) { buf.append("stack: "); - for (int i = 0; i < state.stackSize(); i++) { - buf.append(stateValueToString(state.stackAt(i), operandFmt)).append(' '); + for (int i = 0; i < curState.stackSize(); i++) { + buf.append(stateValueToString(curState.stackAt(i), operandFmt)).append(' '); } buf.append("\n"); } - if (state.locksSize() > 0) { + if (curState.locksSize() > 0) { buf.append("locks: "); - for (int i = 0; i < state.locksSize(); ++i) { - buf.append(stateValueToString(state.lockAt(i), operandFmt)).append(' '); + for (int i = 0; i < curState.locksSize(); ++i) { + buf.append(stateValueToString(curState.lockAt(i), operandFmt)).append(' '); } buf.append("\n"); } buf.append("locals: "); - for (int i = 0; i < state.localsSize(); i++) { - buf.append(stateValueToString(state.localAt(i), operandFmt)).append(' '); + for (int i = 0; i < curState.localsSize(); i++) { + buf.append(stateValueToString(curState.localAt(i), operandFmt)).append(' '); } buf.append("\n"); - state = state.outerFrameState(); - } while (state != null); + curState = curState.outerFrameState(); + } while (curState != null); return buf.toString(); } @@ -413,20 +414,20 @@ } - public void printIntervals(String label, LinearScan allocator, Interval[] intervals) { + public void printIntervals(String label, Interval[] intervals) { begin("intervals"); out.println(String.format("name \"%s\"", label)); for (Interval interval : intervals) { if (interval != null) { - printInterval(allocator, interval); + printInterval(interval); } } end("intervals"); } - private void printInterval(LinearScan allocator, Interval interval) { + private void printInterval(Interval interval) { out.printf("%s %s ", interval.operand.name(), (interval.operand.isRegister() ? "fixed" : interval.kind().name())); if (interval.operand.isRegister()) { out.printf("\"[%s|%c]\"", interval.operand.name(), interval.operand.kind.typeChar); @@ -436,7 +437,7 @@ } } - Interval hint = interval.locationHint(false, allocator); + Interval hint = interval.locationHint(false); out.printf("%s %s ", interval.splitParent().operand.name(), hint != null ? hint.operand.name() : -1); // print ranges
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinterObserver.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/CFGPrinterObserver.java Sun Dec 18 05:24:06 2011 +0100 @@ -49,7 +49,7 @@ private ThreadLocal<LinkedList<CFGPrinter>> observations = new ThreadLocal<LinkedList<CFGPrinter>>() { @Override protected java.util.LinkedList<CFGPrinter> initialValue() { - return new LinkedList<CFGPrinter>(); + return new LinkedList<>(); } }; @@ -97,7 +97,7 @@ if (schedule == null) { try { schedule = new IdentifyBlocksPhase(true, LIRBlock.FACTORY); - schedule.apply((StructuredGraph) graph, false, false); + schedule.apply((StructuredGraph) graph, false); blocks = schedule.getBlocks(); ComputeLinearScanOrder clso = new ComputeLinearScanOrder(schedule.getBlocks().size(), schedule.loopCount(), (LIRBlock) schedule.getStartBlock()); @@ -111,7 +111,7 @@ } } if (allocator != null && intervals != null) { - cfgPrinter.printIntervals(event.label, allocator, intervals); + cfgPrinter.printIntervals(event.label, intervals); } }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinter.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/debug/IdealGraphPrinter.java Sun Dec 18 05:24:06 2011 +0100 @@ -47,8 +47,8 @@ public class IdealGraphPrinter { private final BasicIdealGraphPrinter printer; - private final HashSet<Class<?>> omittedClasses = new HashSet<Class<?>>(); - private final Set<Node> noBlockNodes = new HashSet<Node>(); + private final HashSet<Class<?>> omittedClasses = new HashSet<>(); + private final Set<Node> noBlockNodes = new HashSet<>(); /** * Creates a new {@link IdealGraphPrinter} that writes to the specified output stream. @@ -130,14 +130,14 @@ /** * Prints an entire {@link Graph} with the specified title, optionally using short names for nodes. */ - @SuppressWarnings("unchecked") - public void print(Graph graph, String title, boolean shortNames, IdentifyBlocksPhase schedule) { + public void print(Graph graph, String title, boolean shortNames, IdentifyBlocksPhase predefinedSchedule) { printer.beginGraph(title); noBlockNodes.clear(); + IdentifyBlocksPhase schedule = predefinedSchedule; if (schedule == null) { try { schedule = new IdentifyBlocksPhase(true); - schedule.apply((StructuredGraph) graph, false, false); + schedule.apply((StructuredGraph) graph, false); } catch (Throwable t) { // nothing to do here... } @@ -180,7 +180,7 @@ } private List<Edge> printNodes(Graph graph, boolean shortNames, NodeMap<Block> nodeToBlock, List<Loop> loops) { - ArrayList<Edge> edges = new ArrayList<Edge>(); + ArrayList<Edge> edges = new ArrayList<>(); NodeBitMap loopExits = graph.createNodeBitMap(); if (loops != null) { for (Loop loop : loops) { @@ -356,7 +356,7 @@ printer.endSuccessors(); printer.beginBlockNodes(); - Set<Node> nodes = new HashSet<Node>(block.getInstructions()); + Set<Node> nodes = new HashSet<>(block.getInstructions()); if (nodeToBlock != null) { for (Node n : graph.getNodes()) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/DebugInfoBuilder.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/DebugInfoBuilder.java Sun Dec 18 05:24:06 2011 +0100 @@ -41,7 +41,7 @@ public DebugInfoBuilder(GraalCompilation compilation) { this.compilation = compilation; if (needLockData()) { - lockDataMap = new NodeMap<StackBlock>(compilation.graph); + lockDataMap = new NodeMap<>(compilation.graph); } else { lockDataMap = null; } @@ -65,7 +65,7 @@ } - private HashMap<VirtualObjectNode, CiVirtualObject> virtualObjects = new HashMap<VirtualObjectNode, CiVirtualObject>(); + private HashMap<VirtualObjectNode, CiVirtualObject> virtualObjects = new HashMap<>(); public LIRDebugInfo build(FrameState topState, List<CiStackSlot> pointerSlots, LabelRef exceptionEdge) { if (compilation.placeholderState != null) { @@ -78,7 +78,7 @@ CiVirtualObject[] virtualObjectsArray = null; if (virtualObjects.size() != 0) { // collect all VirtualObjectField instances: - IdentityHashMap<VirtualObjectNode, VirtualObjectFieldNode> objectStates = new IdentityHashMap<VirtualObjectNode, VirtualObjectFieldNode>(); + IdentityHashMap<VirtualObjectNode, VirtualObjectFieldNode> objectStates = new IdentityHashMap<>(); FrameState current = topState; do { for (Node n : current.virtualObjectMappings()) { @@ -95,7 +95,7 @@ boolean changed; do { changed = false; - IdentityHashMap<VirtualObjectNode, CiVirtualObject> virtualObjectsCopy = new IdentityHashMap<VirtualObjectNode, CiVirtualObject>(virtualObjects); + IdentityHashMap<VirtualObjectNode, CiVirtualObject> virtualObjectsCopy = new IdentityHashMap<>(virtualObjects); for (Entry<VirtualObjectNode, CiVirtualObject> entry : virtualObjectsCopy.entrySet()) { if (entry.getValue().values() == null) { VirtualObjectNode vobj = entry.getKey();
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java Sun Dec 18 05:24:06 2011 +0100 @@ -336,7 +336,7 @@ ((LIRLowerable) node).generate(this); } - private boolean canBeNullCheck(LocationNode location) { + private static boolean canBeNullCheck(LocationNode location) { // TODO: Make this part of CiTarget return !(location instanceof IndexedLocationNode) && location.displacement() < 4096; } @@ -503,6 +503,7 @@ } } + @SuppressWarnings("unused") protected void postGCWriteBarrier(CiValue addr, CiValue newVal) { XirSnippet writeBarrier = xir.genWriteBarrier(toXirArgument(addr)); if (writeBarrier != null) { @@ -510,7 +511,9 @@ } } + @SuppressWarnings("unused") protected void preGCWriteBarrier(CiValue addrOpr, boolean patch, LIRDebugInfo info) { + // TODO(tw): Implement this. } @@ -744,7 +747,7 @@ CiKind[] signature = CiUtil.signatureToKinds(callTarget.targetMethod().signature(), callTarget.isStatic() ? null : callTarget.targetMethod().holder().kind(true)); CiCallingConvention cc = compilation.registerConfig.getCallingConvention(JavaCall, signature, target(), false); compilation.frameMap().adjustOutgoingStackSize(cc, JavaCall); - List<CiStackSlot> pointerSlots = new ArrayList<CiStackSlot>(2); + List<CiStackSlot> pointerSlots = new ArrayList<>(2); List<CiValue> argList = visitInvokeArguments(cc, callTarget.arguments(), pointerSlots); if (target().invokeSnippetAfterArguments) { @@ -772,7 +775,7 @@ public List<CiValue> visitInvokeArguments(CiCallingConvention cc, Iterable<ValueNode> arguments, List<CiStackSlot> pointerSlots) { // for each argument, load it into the correct location - List<CiValue> argList = new ArrayList<CiValue>(); + List<CiValue> argList = new ArrayList<>(); int j = 0; for (ValueNode arg : arguments) { if (arg != null) { @@ -840,7 +843,7 @@ CiValue resultOperand = resultOperandFor(x.kind()); CiCallingConvention cc = compilation.registerConfig.getCallingConvention(RuntimeCall, x.call().arguments, target(), false); compilation.frameMap().adjustOutgoingStackSize(cc, RuntimeCall); - List<CiStackSlot> pointerSlots = new ArrayList<CiStackSlot>(2); + List<CiStackSlot> pointerSlots = new ArrayList<>(2); List<CiValue> argList = visitInvokeArguments(cc, x.arguments(), pointerSlots); LIRDebugInfo info = null; @@ -931,7 +934,7 @@ // Only one of the parameters is used, but code is shared because it is mostly the same. SwitchNode x = ls != null ? ls : ts; // we expect the keys to be sorted by increasing value - List<SwitchRange> res = new ArrayList<SwitchRange>(x.numberOfCases()); + List<SwitchRange> res = new ArrayList<>(x.numberOfCases()); int len = x.numberOfCases(); if (len > 0) { LabelRef defaultSux = getLIRBlock(x.defaultSuccessor()); @@ -1071,7 +1074,7 @@ TTY.println("Emit XIR template " + snippet.template.name); } - final CiValue[] operands = new CiValue[snippet.template.variableCount]; + final CiValue[] operandsArray = new CiValue[snippet.template.variableCount]; compilation.frameMap().reserveOutgoing(snippet.template.outgoingStackSize); @@ -1087,9 +1090,9 @@ } else { outputOperand = newVariable(resultOperand.kind); } - assert operands[resultOperand.index] == null; + assert operandsArray[resultOperand.index] == null; } - operands[resultOperand.index] = outputOperand; + operandsArray[resultOperand.index] = outputOperand; if (GraalOptions.PrintXirTemplates) { TTY.println("Output operand: " + outputOperand); } @@ -1099,7 +1102,7 @@ if (t instanceof XirRegister) { XirRegister reg = (XirRegister) t; if (!t.reserve) { - operands[t.index] = reg.register; + operandsArray[t.index] = reg.register; } } } @@ -1110,8 +1113,8 @@ } for (XirConstant c : snippet.template.constants) { - assert operands[c.index] == null; - operands[c.index] = c.value; + assert operandsArray[c.index] == null; + operandsArray[c.index] = c.value; } XirOperand[] inputOperands = snippet.template.inputOperands; @@ -1125,7 +1128,7 @@ for (int i = 0; i < inputOperands.length; i++) { XirOperand x = inputOperands[i]; CiValue op = allocateOperand(snippet, x); - operands[x.index] = op; + operandsArray[x.index] = op; inputOperandArray[i] = op; inputOperandIndicesArray[i] = x.index; if (GraalOptions.PrintXirTemplates) { @@ -1133,24 +1136,12 @@ } } - for (int i = 0; i < inputTempOperands.length; i++) { - XirOperand x = inputTempOperands[i]; - CiValue op = allocateOperand(snippet, x); - CiValue newOp = emitMove(op); - operands[x.index] = newOp; - inputOperandArray[i + inputOperands.length] = newOp; - inputOperandIndicesArray[i + inputOperands.length] = x.index; - if (GraalOptions.PrintXirTemplates) { - TTY.println("InputTemp operand: " + x); - } - - throw new InternalError("cwi: I think this code is never used. If you see this exception being thrown, please tell me..."); - } + assert inputTempOperands.length == 0 : "cwi: I think this code is never used. If you see this exception being thrown, please tell me..."; for (int i = 0; i < tempOperands.length; i++) { XirOperand x = tempOperands[i]; CiValue op = allocateOperand(snippet, x); - operands[x.index] = op; + operandsArray[x.index] = op; tempOperandArray[i] = op; tempOperandIndicesArray[i] = x.index; if (GraalOptions.PrintXirTemplates) { @@ -1158,11 +1149,11 @@ } } - for (CiValue operand : operands) { + for (CiValue operand : operandsArray) { assert operand != null; } - CiValue allocatedResultOperand = operands[resultOperand.index]; + CiValue allocatedResultOperand = operandsArray[resultOperand.index]; if (!allocatedResultOperand.isVariableOrRegister()) { allocatedResultOperand = IllegalValue; } @@ -1178,18 +1169,18 @@ XirInstruction[] slowPath = snippet.template.slowPath; - if (!operands[resultOperand.index].isConstant() || snippet.template.fastPath.length != 0 || (slowPath != null && slowPath.length > 0)) { + if (!operandsArray[resultOperand.index].isConstant() || snippet.template.fastPath.length != 0 || (slowPath != null && slowPath.length > 0)) { // XIR instruction is only needed when the operand is not a constant! - append(StandardOpcode.XIR.create(snippet, operands, allocatedResultOperand, + append(StandardOpcode.XIR.create(snippet, operandsArray, allocatedResultOperand, inputOperandArray, tempOperandArray, inputOperandIndicesArray, tempOperandIndicesArray, - (operands[resultOperand.index] == IllegalValue) ? -1 : resultOperand.index, + (operandsArray[resultOperand.index] == IllegalValue) ? -1 : resultOperand.index, info, infoAfter, method)); if (GraalOptions.Meter) { context.metrics.LIRXIRInstructions++; } } - return operands[resultOperand.index]; + return operandsArray[resultOperand.index]; } protected final CiValue callRuntime(CiRuntimeCall runtimeCall, LIRDebugInfo info, CiValue... args) { @@ -1229,7 +1220,7 @@ SwitchRange[] createLookupRanges(LookupSwitchNode x) { // we expect the keys to be sorted by increasing value - List<SwitchRange> res = new ArrayList<SwitchRange>(x.numberOfCases()); + List<SwitchRange> res = new ArrayList<>(x.numberOfCases()); int len = x.numberOfCases(); if (len > 0) { LabelRef defaultSux = getLIRBlock(x.defaultSuccessor()); @@ -1261,7 +1252,7 @@ SwitchRange[] createLookupRanges(TableSwitchNode x) { // TODO: try to merge this with the code for LookupSwitch - List<SwitchRange> res = new ArrayList<SwitchRange>(x.numberOfCases()); + List<SwitchRange> res = new ArrayList<>(x.numberOfCases()); int len = x.numberOfCases(); if (len > 0) { LabelRef sux = getLIRBlock(x.blockSuccessor(0));
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiResolver.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/PhiResolver.java Sun Dec 18 05:24:06 2011 +0100 @@ -81,7 +81,7 @@ PhiResolverNode(CiValue operand) { this.operand = operand; - destinations = new ArrayList<PhiResolverNode>(4); + destinations = new ArrayList<>(4); } @Override @@ -106,13 +106,13 @@ private CiValue temp; - private final ArrayList<PhiResolverNode> variableOperands = new ArrayList<PhiResolverNode>(3); - private final ArrayList<PhiResolverNode> otherOperands = new ArrayList<PhiResolverNode>(3); + private final ArrayList<PhiResolverNode> variableOperands = new ArrayList<>(3); + private final ArrayList<PhiResolverNode> otherOperands = new ArrayList<>(3); /** * Maps operands to nodes. */ - private final HashMap<CiValue, PhiResolverNode> operandToNodeMap = new HashMap<CiValue, PhiResolverNode>(); + private final HashMap<CiValue, PhiResolverNode> operandToNodeMap = new HashMap<>(); public PhiResolver(LIRGenerator gen) { this.gen = gen;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/PostOrderNodeIterator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graph/PostOrderNodeIterator.java Sun Dec 18 05:24:06 2011 +0100 @@ -38,8 +38,8 @@ public PostOrderNodeIterator(FixedNode start, T initialState) { visitedEnds = start.graph().createNodeBitMap(); - nodeQueue = new ArrayDeque<FixedNode>(); - nodeStates = new IdentityHashMap<FixedNode, T>(); + nodeQueue = new ArrayDeque<>(); + nodeStates = new IdentityHashMap<>(); this.start = start; this.state = initialState; } @@ -123,7 +123,7 @@ if (node instanceof MergeNode) { MergeNode merge = (MergeNode) node; state = nodeStates.get(merge.endAt(0)).clone(); - ArrayList<T> states = new ArrayList<T>(merge.endCount() - 1); + ArrayList<T> states = new ArrayList<>(merge.endCount() - 1); for (int i = 1; i < merge.endCount(); i++) { T other = nodeStates.get(merge.endAt(i)); assert other != null;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graphbuilder/BlockMap.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graphbuilder/BlockMap.java Sun Dec 18 05:24:06 2011 +0100 @@ -123,7 +123,7 @@ public FixedWithNextNode firstInstruction; - public ArrayList<Block> successors = new ArrayList<Block>(2); + public ArrayList<Block> successors = new ArrayList<>(2); public int normalSuccessors; private boolean visited; @@ -140,7 +140,7 @@ public Block copy() { try { Block block = (Block) super.clone(); - block.successors = new ArrayList<Block>(successors); + block.successors = new ArrayList<>(successors); return block; } catch (CloneNotSupportedException e) { throw new RuntimeException(e); @@ -187,7 +187,7 @@ exceptionHandlers = method.exceptionHandlers(); this.blockMap = new Block[method.codeSize()]; this.canTrap = new BitSet(blockMap.length); - this.blocks = new ArrayList<Block>(); + this.blocks = new ArrayList<>(); this.useBranchPrediction = useBranchPrediction; } @@ -449,7 +449,7 @@ predecessor.normalSuccessors = successors.length; } - private final HashSet<Block> jsrVisited = new HashSet<Block>(); + private final HashSet<Block> jsrVisited = new HashSet<>(); private void createJsrAlternatives(Block block) { jsrVisited.add(block); @@ -480,7 +480,7 @@ clone = successor.jsrAlternatives.get(nextScope); } else { if (successor.jsrAlternatives == null) { - successor.jsrAlternatives = new HashMap<JsrScope, Block>(); + successor.jsrAlternatives = new HashMap<>(); } clone = successor.copy(); clone.jsrScope = nextScope; @@ -503,7 +503,7 @@ } } - private HashMap<RiExceptionHandler, ExceptionBlock> exceptionDispatch = new HashMap<RiExceptionHandler, ExceptionBlock>(); + private HashMap<RiExceptionHandler, ExceptionBlock> exceptionDispatch = new HashMap<>(); private Block makeExceptionDispatch(List<RiExceptionHandler> handlers, int index, int bci) { RiExceptionHandler handler = handlers.get(index); @@ -534,7 +534,7 @@ for (RiExceptionHandler h : this.exceptionHandlers) { if (h.startBCI() <= bci && bci < h.endBCI()) { if (handlers == null) { - handlers = new ArrayList<RiExceptionHandler>(); + handlers = new ArrayList<>(); } handlers.add(h); if (h.isCatchAll()) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graphbuilder/FrameStateBuilder.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graphbuilder/FrameStateBuilder.java Sun Dec 18 05:24:06 2011 +0100 @@ -84,7 +84,7 @@ javaIndex += stackSlots(kind); index++; } - this.locks = new ArrayList<MonitorObject>(); + this.locks = new ArrayList<>(); } @Override
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graphbuilder/GraphBuilderPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/graphbuilder/GraphBuilderPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -67,7 +67,7 @@ */ public static final int TRACELEVEL_STATE = 2; - private StructuredGraph graph; + private StructuredGraph currentGraph; private final CiStatistics stats; private final RiRuntime runtime; @@ -84,13 +84,11 @@ private int nextBlockNumber; private ValueNode methodSynchronizedObject; - private CiExceptionHandler unwindHandler; - private ExceptionBlock unwindBlock; private Block returnBlock; // the worklist of blocks, sorted by depth first number - private final PriorityQueue<Block> workList = new PriorityQueue<Block>(10, new Comparator<Block>() { + private final PriorityQueue<Block> workList = new PriorityQueue<>(10, new Comparator<Block>() { public int compare(Block o1, Block o2) { return o1.blockID - o2.blockID; } @@ -98,12 +96,12 @@ private FixedWithNextNode lastInstr; // the last instruction added - private final Set<Block> blocksOnWorklist = new HashSet<Block>(); - private final Set<Block> blocksVisited = new HashSet<Block>(); + private final Set<Block> blocksOnWorklist = new HashSet<>(); + private final Set<Block> blocksVisited = new HashSet<>(); - private BitSet canTrap; + private BitSet canTrapBitSet; - public static final Map<RiMethod, StructuredGraph> cachedGraphs = new WeakHashMap<RiMethod, StructuredGraph>(); + public static final Map<RiMethod, StructuredGraph> cachedGraphs = new WeakHashMap<>(); private final GraphBuilderConfiguration config; @@ -129,7 +127,7 @@ @Override protected void run(StructuredGraph graph) { assert graph != null; - this.graph = graph; + this.currentGraph = graph; this.frameState = new FrameStateBuilder(method, method.maxLocals(), method.maxStackSize(), graph); build(); } @@ -146,9 +144,9 @@ stats.bytecodeCount += method.code().length; } - if (context.isObserved()) { + if (currentContext.isObserved()) { String label = CiUtil.format("BlockListBuilder %f %R %H.%n(%P)", method); - context.observable.fireCompilationEvent(label, map); + currentContext.observable.fireCompilationEvent(label, map); } return map; } @@ -161,7 +159,7 @@ // compute the block map, setup exception handlers and get the entrypoint(s) BlockMap blockMap = createBlockMap(); - this.canTrap = blockMap.canTrap; + this.canTrapBitSet = blockMap.canTrap; exceptionHandlers = blockMap.exceptionHandlers(); if (stats != null) { @@ -169,10 +167,10 @@ } nextBlockNumber = blockMap.blocks.size(); - lastInstr = graph.start(); + lastInstr = currentGraph.start(); if (isSynchronized(method.accessFlags())) { // add a monitor enter to the start block - graph.start().setStateAfter(frameState.create(FrameState.BEFORE_BCI)); + currentGraph.start().setStateAfter(frameState.create(FrameState.BEFORE_BCI)); methodSynchronizedObject = synchronizedObject(frameState, method); lastInstr = genMonitorEnter(methodSynchronizedObject); } @@ -186,25 +184,23 @@ } addToWorkList(blockMap.startBlock); - unwindHandler = new CiExceptionHandler(0, method.code().length, -2, 0, null); - iterateAllBlocks(); connectLoopEndToBegin(); // remove Placeholders (except for loop exits) - for (PlaceholderNode n : graph.getNodes(PlaceholderNode.class)) { + for (PlaceholderNode n : currentGraph.getNodes(PlaceholderNode.class)) { n.replaceAndDelete(n.next()); } // remove dead FrameStates - for (Node n : graph.getNodes(FrameState.class)) { + for (Node n : currentGraph.getNodes(FrameState.class)) { if (n.usages().size() == 0 && n.predecessor() == null) { n.safeDelete(); } } - if (GraalOptions.CacheGraphs && !graph.hasNode(DeoptimizeNode.class)) { - cachedGraphs.put(method, graph.copy()); + if (GraalOptions.CacheGraphs && !currentGraph.hasNode(DeoptimizeNode.class)) { + cachedGraphs.put(method, currentGraph.copy()); } } @@ -215,14 +211,6 @@ return nextBlockNumber++; } - private Block nextBlock(int bci) { - Block block = new Block(); - block.startBci = bci; - block.endBci = bci; - block.blockID = nextBlockNumber(); - return block; - } - private Block unwindBlock(int bci) { if (unwindBlock == null) { unwindBlock = new ExceptionBlock(); @@ -295,9 +283,9 @@ p.setStateAfter(newState.duplicate(bci)); return; } else { - MergeNode merge = graph.add(new MergeNode()); + MergeNode merge = currentGraph.add(new MergeNode()); FixedNode next = p.next(); - EndNode end = graph.add(new EndNode()); + EndNode end = currentGraph.add(new EndNode()); p.setNext(end); merge.setNext(next); merge.addEnd(end); @@ -330,11 +318,11 @@ frameState.storeLocal(index, frameState.pop(kind)); } - public boolean covers(RiExceptionHandler handler, int bci) { + public static boolean covers(RiExceptionHandler handler, int bci) { return handler.startBCI() <= bci && bci < handler.endBCI(); } - public boolean isCatchAll(RiExceptionHandler handler) { + public static boolean isCatchAll(RiExceptionHandler handler) { return handler.catchTypeCPI() == 0; } @@ -375,13 +363,13 @@ } } - BeginNode p = graph.add(new BeginNode()); + BeginNode p = currentGraph.add(new BeginNode()); p.setStateAfter(frameState.duplicateWithoutStack(bci)); ValueNode currentExceptionObject; ExceptionObjectNode newObj = null; if (exceptionObject == null) { - newObj = graph.add(new ExceptionObjectNode()); + newObj = currentGraph.add(new ExceptionObjectNode()); currentExceptionObject = newObj; } else { currentExceptionObject = exceptionObject; @@ -408,10 +396,10 @@ // this is a load of class constant which might be unresolved RiType riType = (RiType) con; if (riType instanceof RiResolvedType) { - frameState.push(CiKind.Object, append(ConstantNode.forCiConstant(((RiResolvedType) riType).getEncoding(Representation.JavaClass), runtime, graph))); + frameState.push(CiKind.Object, append(ConstantNode.forCiConstant(((RiResolvedType) riType).getEncoding(Representation.JavaClass), runtime, currentGraph))); } else { - append(graph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); - frameState.push(CiKind.Object, append(ConstantNode.forObject(null, runtime, graph))); + append(currentGraph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); + frameState.push(CiKind.Object, append(ConstantNode.forObject(null, runtime, currentGraph))); } } else if (con instanceof CiConstant) { CiConstant constant = (CiConstant) con; @@ -426,8 +414,8 @@ ValueNode index = frameState.ipop(); ValueNode array = frameState.apop(); - ValueNode length = append(graph.add(new ArrayLengthNode(array))); - ValueNode v = append(graph.add(new LoadIndexedNode(array, index, length, kind))); + ValueNode length = append(currentGraph.add(new ArrayLengthNode(array))); + ValueNode v = append(currentGraph.add(new LoadIndexedNode(array, index, length, kind))); frameState.push(kind.stackKind(), v); } @@ -437,8 +425,8 @@ ValueNode value = frameState.pop(kind.stackKind()); ValueNode index = frameState.ipop(); ValueNode array = frameState.apop(); - ValueNode length = append(graph.add(new ArrayLengthNode(array))); - StoreIndexedNode result = graph.add(new StoreIndexedNode(array, index, length, kind, value)); + ValueNode length = append(currentGraph.add(new ArrayLengthNode(array))); + StoreIndexedNode result = currentGraph.add(new StoreIndexedNode(array, index, length, kind, value)); append(result); } @@ -552,15 +540,15 @@ default: throw new CiBailout("should not reach"); } - ValueNode result1 = append(graph.unique(v)); + ValueNode result1 = append(currentGraph.unique(v)); if (canTrap) { - append(graph.add(new ValueAnchorNode(result1))); + append(currentGraph.add(new ValueAnchorNode(result1))); } frameState.push(result, result1); } private void genNegateOp(CiKind kind) { - frameState.push(kind, append(graph.unique(new NegateNode(frameState.pop(kind))))); + frameState.push(kind, append(currentGraph.unique(new NegateNode(frameState.pop(kind))))); } private void genShiftOp(CiKind kind, int opcode) { @@ -577,7 +565,7 @@ default: throw new CiBailout("should not reach"); } - frameState.push(kind, append(graph.unique(v))); + frameState.push(kind, append(currentGraph.unique(v))); } private void genLogicOp(CiKind kind, int opcode) { @@ -594,29 +582,29 @@ default: throw new CiBailout("should not reach"); } - frameState.push(kind, append(graph.unique(v))); + frameState.push(kind, append(currentGraph.unique(v))); } private void genCompareOp(CiKind kind, boolean isUnorderedLess) { ValueNode y = frameState.pop(kind); ValueNode x = frameState.pop(kind); - frameState.ipush(append(graph.unique(new NormalizeCompareNode(x, y, isUnorderedLess)))); + frameState.ipush(append(currentGraph.unique(new NormalizeCompareNode(x, y, isUnorderedLess)))); } private void genConvert(ConvertNode.Op opcode) { ValueNode input = frameState.pop(opcode.from.stackKind()); - frameState.push(opcode.to.stackKind(), append(graph.unique(new ConvertNode(opcode, input)))); + frameState.push(opcode.to.stackKind(), append(currentGraph.unique(new ConvertNode(opcode, input)))); } private void genIncrement() { int index = stream().readLocalIndex(); int delta = stream().readIncrement(); ValueNode x = frameState.localAt(index); - ValueNode y = append(ConstantNode.forInt(delta, graph)); - frameState.storeLocal(index, append(graph.unique(new IntegerAddNode(CiKind.Int, x, y)))); + ValueNode y = append(ConstantNode.forInt(delta, currentGraph)); + frameState.storeLocal(index, append(currentGraph.unique(new IntegerAddNode(CiKind.Int, x, y)))); } - private void genGoto(int toBCI) { + private void genGoto() { appendGoto(createTarget(currentBlock.successors.get(0), frameState)); assert currentBlock.normalSuccessors == 1; } @@ -631,7 +619,7 @@ probability = 0.5; } - IfNode ifNode = graph.add(new IfNode(graph.unique(new CompareNode(x, cond, y)), probability)); + IfNode ifNode = currentGraph.add(new IfNode(currentGraph.unique(new CompareNode(x, cond, y)), probability)); append(ifNode); ifNode.setTrueSuccessor(BeginNode.begin(createTarget(currentBlock.successors.get(0), frameState))); ifNode.setFalseSuccessor(BeginNode.begin(createTarget(currentBlock.successors.get(1), frameState))); @@ -660,7 +648,7 @@ private void genThrow(int bci) { ValueNode exception = frameState.apop(); - FixedGuardNode node = graph.add(new FixedGuardNode(graph.unique(new NullCheckNode(exception, false)))); + FixedGuardNode node = currentGraph.add(new FixedGuardNode(currentGraph.unique(new NullCheckNode(exception, false)))); append(node); append(handleException(exception, bci)); } @@ -699,14 +687,14 @@ if (initialized) { ConstantNode typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, type, true); ValueNode object = frameState.apop(); - AnchorNode anchor = graph.add(new AnchorNode()); + AnchorNode anchor = currentGraph.add(new AnchorNode()); append(anchor); - CheckCastNode checkCast = graph.unique(new CheckCastNode(anchor, typeInstruction, (RiResolvedType) type, object)); - append(graph.add(new ValueAnchorNode(checkCast))); + CheckCastNode checkCast = currentGraph.unique(new CheckCastNode(anchor, typeInstruction, (RiResolvedType) type, object)); + append(currentGraph.add(new ValueAnchorNode(checkCast))); frameState.apush(checkCast); } else { ValueNode object = frameState.apop(); - append(graph.add(new FixedGuardNode(graph.unique(new CompareNode(object, Condition.EQ, ConstantNode.forObject(null, runtime, graph)))))); + append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new CompareNode(object, Condition.EQ, ConstantNode.forObject(null, runtime, currentGraph)))))); frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); } } @@ -717,7 +705,7 @@ ConstantNode typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, type, type instanceof RiResolvedType); ValueNode object = frameState.apop(); if (typeInstruction != null) { - frameState.ipush(append(MaterializeNode.create(graph.unique(new InstanceOfNode(typeInstruction, (RiResolvedType) type, object, false)), graph))); + frameState.ipush(append(MaterializeNode.create(currentGraph.unique(new InstanceOfNode(typeInstruction, (RiResolvedType) type, object, false)), currentGraph))); } else { frameState.ipush(appendConstant(CiConstant.INT_0)); } @@ -726,10 +714,10 @@ void genNewInstance(int cpi) { RiType type = lookupType(cpi, NEW); if (type instanceof RiResolvedType) { - NewInstanceNode n = graph.add(new NewInstanceNode((RiResolvedType) type)); + NewInstanceNode n = currentGraph.add(new NewInstanceNode((RiResolvedType) type)); frameState.apush(append(n)); } else { - append(graph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); + append(currentGraph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); } } @@ -759,7 +747,7 @@ private void genNewTypeArray(int typeCode) { CiKind kind = arrayTypeCodeToKind(typeCode); RiResolvedType elementType = runtime.asRiType(kind); - NewTypeArrayNode nta = graph.add(new NewTypeArrayNode(frameState.ipop(), elementType)); + NewTypeArrayNode nta = currentGraph.add(new NewTypeArrayNode(frameState.ipop(), elementType)); frameState.apush(append(nta)); } @@ -767,10 +755,10 @@ RiType type = lookupType(cpi, ANEWARRAY); ValueNode length = frameState.ipop(); if (type instanceof RiResolvedType) { - NewArrayNode n = graph.add(new NewObjectArrayNode((RiResolvedType) type, length)); + NewArrayNode n = currentGraph.add(new NewObjectArrayNode((RiResolvedType) type, length)); frameState.apush(append(n)); } else { - append(graph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); + append(currentGraph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); } @@ -784,25 +772,25 @@ dims[i] = frameState.ipop(); } if (type instanceof RiResolvedType) { - FixedWithNextNode n = graph.add(new NewMultiArrayNode((RiResolvedType) type, dims)); + FixedWithNextNode n = currentGraph.add(new NewMultiArrayNode((RiResolvedType) type, dims)); frameState.apush(append(n)); } else { - append(graph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); + append(currentGraph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); } } - private void genGetField(int cpi, RiField field) { + private void genGetField(RiField field) { emitExplicitExceptions(frameState.peek(0), null); CiKind kind = field.kind(false); ValueNode receiver = frameState.apop(); if ((field instanceof RiResolvedField) && ((RiResolvedField) field).holder().isInitialized()) { - LoadFieldNode load = graph.add(new LoadFieldNode(receiver, (RiResolvedField) field)); + LoadFieldNode load = currentGraph.add(new LoadFieldNode(receiver, (RiResolvedField) field)); appendOptimizedLoadField(kind, load); } else { - append(graph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); - frameState.push(kind.stackKind(), append(ConstantNode.defaultForKind(kind, graph))); + append(currentGraph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); + frameState.push(kind.stackKind(), append(ConstantNode.defaultForKind(kind, currentGraph))); } } @@ -818,18 +806,18 @@ } private ExceptionInfo emitNullCheck(ValueNode receiver) { - PlaceholderNode trueSucc = graph.add(new PlaceholderNode()); - PlaceholderNode falseSucc = graph.add(new PlaceholderNode()); - IfNode ifNode = graph.add(new IfNode(graph.unique(new NullCheckNode(receiver, false)), trueSucc, falseSucc, 1)); + PlaceholderNode trueSucc = currentGraph.add(new PlaceholderNode()); + PlaceholderNode falseSucc = currentGraph.add(new PlaceholderNode()); + IfNode ifNode = currentGraph.add(new IfNode(currentGraph.unique(new NullCheckNode(receiver, false)), trueSucc, falseSucc, 1)); append(ifNode); lastInstr = trueSucc; if (GraalOptions.OmitHotExceptionStacktrace) { - ValueNode exception = ConstantNode.forObject(new NullPointerException(), runtime, graph); + ValueNode exception = ConstantNode.forObject(new NullPointerException(), runtime, currentGraph); return new ExceptionInfo(falseSucc, exception); } else { - RuntimeCallNode call = graph.add(new RuntimeCallNode(CiRuntimeCall.CreateNullPointerException)); + RuntimeCallNode call = currentGraph.add(new RuntimeCallNode(CiRuntimeCall.CreateNullPointerException)); call.setStateAfter(frameState.duplicate(bci())); falseSucc.setNext(call); return new ExceptionInfo(call, call); @@ -837,18 +825,18 @@ } private ExceptionInfo emitBoundsCheck(ValueNode index, ValueNode length) { - PlaceholderNode trueSucc = graph.add(new PlaceholderNode()); - PlaceholderNode falseSucc = graph.add(new PlaceholderNode()); - IfNode ifNode = graph.add(new IfNode(graph.unique(new CompareNode(index, Condition.BT, length)), trueSucc, falseSucc, 1)); + PlaceholderNode trueSucc = currentGraph.add(new PlaceholderNode()); + PlaceholderNode falseSucc = currentGraph.add(new PlaceholderNode()); + IfNode ifNode = currentGraph.add(new IfNode(currentGraph.unique(new CompareNode(index, Condition.BT, length)), trueSucc, falseSucc, 1)); append(ifNode); lastInstr = trueSucc; if (GraalOptions.OmitHotExceptionStacktrace) { - ValueNode exception = ConstantNode.forObject(new ArrayIndexOutOfBoundsException(), runtime, graph); + ValueNode exception = ConstantNode.forObject(new ArrayIndexOutOfBoundsException(), runtime, currentGraph); return new ExceptionInfo(falseSucc, exception); } else { - RuntimeCallNode call = graph.add(new RuntimeCallNode(CiRuntimeCall.CreateOutOfBoundsException, new ValueNode[] {index})); + RuntimeCallNode call = currentGraph.add(new RuntimeCallNode(CiRuntimeCall.CreateOutOfBoundsException, new ValueNode[] {index})); call.setStateAfter(frameState.duplicate(bci())); falseSucc.setNext(call); return new ExceptionInfo(call, call); @@ -858,11 +846,11 @@ private void emitExplicitExceptions(ValueNode receiver, ValueNode outOfBoundsIndex) { assert receiver != null; - if (canTrap.get(bci()) && GraalOptions.AllowExplicitExceptionChecks) { - ArrayList<ExceptionInfo> exceptions = new ArrayList<ExceptionInfo>(2); + if (canTrapBitSet.get(bci()) && GraalOptions.AllowExplicitExceptionChecks) { + ArrayList<ExceptionInfo> exceptions = new ArrayList<>(2); exceptions.add(emitNullCheck(receiver)); if (outOfBoundsIndex != null) { - ArrayLengthNode length = graph.add(new ArrayLengthNode(receiver)); + ArrayLengthNode length = currentGraph.add(new ArrayLengthNode(receiver)); append(length); exceptions.add(emitBoundsCheck(outOfBoundsIndex, length)); } @@ -871,10 +859,10 @@ exception = exceptions.get(0); } else { assert exceptions.size() > 1; - MergeNode merge = graph.add(new MergeNode()); - PhiNode phi = graph.unique(new PhiNode(CiKind.Object, merge, PhiType.Value)); + MergeNode merge = currentGraph.add(new MergeNode()); + PhiNode phi = currentGraph.unique(new PhiNode(CiKind.Object, merge, PhiType.Value)); for (ExceptionInfo info : exceptions) { - EndNode end = graph.add(new EndNode()); + EndNode end = currentGraph.add(new EndNode()); info.exceptionEdge.setNext(end); merge.addEnd(end); phi.addInput(info.exception); @@ -890,25 +878,25 @@ exception.exceptionEdge.setNext(createTarget(unwindBlock(bci()), frameState.duplicateWithException(bci(), exception.exception))); } if (GraalOptions.Meter) { - context.metrics.ExplicitExceptions++; + currentContext.metrics.ExplicitExceptions++; } } } - private void genPutField(int cpi, RiField field) { + private void genPutField(RiField field) { emitExplicitExceptions(frameState.peek(1), null); ValueNode value = frameState.pop(field.kind(false).stackKind()); ValueNode receiver = frameState.apop(); if (field instanceof RiResolvedField && ((RiResolvedField) field).holder().isInitialized()) { - StoreFieldNode store = graph.add(new StoreFieldNode(receiver, (RiResolvedField) field, value)); + StoreFieldNode store = currentGraph.add(new StoreFieldNode(receiver, (RiResolvedField) field, value)); appendOptimizedStoreField(store); } else { - append(graph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); + append(currentGraph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); } } - private void genGetStatic(int cpi, RiField field) { + private void genGetStatic(RiField field) { RiType holder = field.holder(); boolean isInitialized = (field instanceof RiResolvedField) && ((RiResolvedType) holder).isInitialized(); CiConstant constantValue = null; @@ -921,21 +909,21 @@ ValueNode container = genTypeOrDeopt(RiType.Representation.StaticFields, holder, isInitialized); CiKind kind = field.kind(false); if (container != null) { - LoadFieldNode load = graph.add(new LoadFieldNode(container, (RiResolvedField) field)); + LoadFieldNode load = currentGraph.add(new LoadFieldNode(container, (RiResolvedField) field)); appendOptimizedLoadField(kind, load); } else { // deopt will be generated by genTypeOrDeopt, not needed here - frameState.push(kind.stackKind(), append(ConstantNode.defaultForKind(kind, graph))); + frameState.push(kind.stackKind(), append(ConstantNode.defaultForKind(kind, currentGraph))); } } } - private void genPutStatic(int cpi, RiField field) { + private void genPutStatic(RiField field) { RiType holder = field.holder(); ValueNode container = genTypeOrDeopt(RiType.Representation.StaticFields, holder, field instanceof RiResolvedField && ((RiResolvedType) holder).isInitialized()); ValueNode value = frameState.pop(field.kind(false).stackKind()); if (container != null) { - StoreFieldNode store = graph.add(new StoreFieldNode(container, (RiResolvedField) field, value)); + StoreFieldNode store = currentGraph.add(new StoreFieldNode(container, (RiResolvedField) field, value)); appendOptimizedStoreField(store); } else { // deopt will be generated by genTypeOrDeopt, not needed here @@ -946,7 +934,7 @@ if (initialized) { return appendConstant(((RiResolvedType) holder).getEncoding(representation)); } else { - append(graph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); + append(currentGraph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); return null; } } @@ -961,7 +949,7 @@ frameState.push(kind.stackKind(), optimized); } - private void genInvokeStatic(RiMethod target, int cpi, RiConstantPool constantPool) { + private void genInvokeStatic(RiMethod target) { if (target instanceof RiResolvedMethod) { RiResolvedMethod resolvedTarget = (RiResolvedMethod) target; RiResolvedType holder = resolvedTarget.holder(); @@ -969,53 +957,53 @@ genInvokeDeopt(target, false); } else { ValueNode[] args = frameState.popArguments(resolvedTarget.signature().argumentSlots(false), resolvedTarget.signature().argumentCount(false)); - appendInvoke(InvokeKind.Static, resolvedTarget, args, cpi, constantPool); + appendInvoke(InvokeKind.Static, resolvedTarget, args); } } else { genInvokeDeopt(target, false); } } - private void genInvokeInterface(RiMethod target, int cpi, RiConstantPool constantPool) { + private void genInvokeInterface(RiMethod target) { if (target instanceof RiResolvedMethod) { ValueNode[] args = frameState.popArguments(target.signature().argumentSlots(true), target.signature().argumentCount(true)); - genInvokeIndirect(InvokeKind.Interface, (RiResolvedMethod) target, args, cpi, constantPool); + genInvokeIndirect(InvokeKind.Interface, (RiResolvedMethod) target, args); } else { genInvokeDeopt(target, true); } } - private void genInvokeVirtual(RiMethod target, int cpi, RiConstantPool constantPool) { + private void genInvokeVirtual(RiMethod target) { if (target instanceof RiResolvedMethod) { ValueNode[] args = frameState.popArguments(target.signature().argumentSlots(true), target.signature().argumentCount(true)); - genInvokeIndirect(InvokeKind.Virtual, (RiResolvedMethod) target, args, cpi, constantPool); + genInvokeIndirect(InvokeKind.Virtual, (RiResolvedMethod) target, args); } else { genInvokeDeopt(target, true); } } - private void genInvokeSpecial(RiMethod target, RiType knownHolder, int cpi, RiConstantPool constantPool) { + private void genInvokeSpecial(RiMethod target) { if (target instanceof RiResolvedMethod) { assert target != null; assert target.signature() != null; ValueNode[] args = frameState.popArguments(target.signature().argumentSlots(true), target.signature().argumentCount(true)); - invokeDirect((RiResolvedMethod) target, args, knownHolder, cpi, constantPool); + invokeDirect((RiResolvedMethod) target, args); } else { genInvokeDeopt(target, true); } } private void genInvokeDeopt(RiMethod unresolvedTarget, boolean withReceiver) { - append(graph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); + append(currentGraph.add(new DeoptimizeNode(DeoptAction.InvalidateRecompile))); frameState.popArguments(unresolvedTarget.signature().argumentSlots(withReceiver), unresolvedTarget.signature().argumentCount(withReceiver)); CiKind kind = unresolvedTarget.signature().returnKind(false); if (kind != CiKind.Void) { - frameState.push(kind.stackKind(), append(ConstantNode.defaultForKind(kind, graph))); + frameState.push(kind.stackKind(), append(ConstantNode.defaultForKind(kind, currentGraph))); } } - private void genInvokeIndirect(InvokeKind invokeKind, RiResolvedMethod target, ValueNode[] args, int cpi, RiConstantPool constantPool) { + private void genInvokeIndirect(InvokeKind invokeKind, RiResolvedMethod target, ValueNode[] args) { ValueNode receiver = args[0]; // attempt to devirtualize the call RiResolvedType klass = target.holder(); @@ -1023,44 +1011,44 @@ // 0. check for trivial cases if (target.canBeStaticallyBound() && !isAbstract(target.accessFlags())) { // check for trivial cases (e.g. final methods, nonvirtual methods) - invokeDirect(target, args, target.holder(), cpi, constantPool); + invokeDirect(target, args); return; } // 1. check if the exact type of the receiver can be determined RiResolvedType exact = getExactType(klass, receiver); if (exact != null) { // either the holder class is exact, or the receiver object has an exact type - invokeDirect(exact.resolveMethodImpl(target), args, exact, cpi, constantPool); + invokeDirect(exact.resolveMethodImpl(target), args); return; } // devirtualization failed, produce an actual invokevirtual - appendInvoke(invokeKind, target, args, cpi, constantPool); + appendInvoke(invokeKind, target, args); } - private void invokeDirect(RiResolvedMethod target, ValueNode[] args, RiType knownHolder, int cpi, RiConstantPool constantPool) { - appendInvoke(InvokeKind.Special, target, args, cpi, constantPool); + private void invokeDirect(RiResolvedMethod target, ValueNode[] args) { + appendInvoke(InvokeKind.Special, target, args); } - private void appendInvoke(InvokeKind invokeKind, RiResolvedMethod targetMethod, ValueNode[] args, int cpi, RiConstantPool constantPool) { + private void appendInvoke(InvokeKind invokeKind, RiResolvedMethod targetMethod, ValueNode[] args) { CiKind resultType = targetMethod.signature().returnKind(false); if (GraalOptions.DeoptALot) { - DeoptimizeNode deoptimize = graph.add(new DeoptimizeNode(DeoptAction.None)); + DeoptimizeNode deoptimize = currentGraph.add(new DeoptimizeNode(DeoptAction.None)); deoptimize.setMessage("invoke " + targetMethod.name()); append(deoptimize); - frameState.pushReturn(resultType, ConstantNode.defaultForKind(resultType, graph)); + frameState.pushReturn(resultType, ConstantNode.defaultForKind(resultType, currentGraph)); } else { - MethodCallTargetNode callTarget = graph.add(new MethodCallTargetNode(invokeKind, targetMethod, args, targetMethod.signature().returnType(method.holder()))); + MethodCallTargetNode callTarget = currentGraph.add(new MethodCallTargetNode(invokeKind, targetMethod, args, targetMethod.signature().returnType(method.holder()))); BeginNode exceptionEdge = handleException(null, bci()); ValueNode result; if (exceptionEdge != null) { - InvokeWithExceptionNode invoke = graph.add(new InvokeWithExceptionNode(callTarget, exceptionEdge, bci())); + InvokeWithExceptionNode invoke = currentGraph.add(new InvokeWithExceptionNode(callTarget, exceptionEdge, bci())); result = append(invoke); frameState.pushReturn(resultType, result); Block nextBlock = currentBlock.successors.get(0); invoke.setNext(createTarget(nextBlock, frameState)); invoke.setStateAfter(frameState.create(nextBlock.startBci)); } else { - result = appendWithBCI(graph.add(new InvokeNode(callTarget, bci()))); + result = appendWithBCI(currentGraph.add(new InvokeNode(callTarget, bci()))); frameState.pushReturn(resultType, result); } } @@ -1087,7 +1075,7 @@ private void callRegisterFinalizer() { // append a call to the finalizer registration - append(graph.add(new RegisterFinalizerNode(frameState.loadLocal(0)))); + append(currentGraph.add(new RegisterFinalizerNode(frameState.loadLocal(0)))); } private void genReturn(ValueNode x) { @@ -1099,8 +1087,8 @@ } private MonitorEnterNode genMonitorEnter(ValueNode x) { - MonitorObject monitorObject = graph.add(new MonitorObject(x)); - MonitorEnterNode monitorEnter = graph.add(new MonitorEnterNode(monitorObject)); + MonitorObject monitorObject = currentGraph.add(new MonitorObject(x)); + MonitorEnterNode monitorEnter = currentGraph.add(new MonitorEnterNode(monitorObject)); frameState.lock(monitorObject); appendWithBCI(monitorEnter); return monitorEnter; @@ -1116,7 +1104,7 @@ // that can be optimized away later on, so we have to disable the check for phi functions. assert x == monitorObject.owner() || x instanceof PhiNode; - MonitorExitNode monitorExit = graph.add(new MonitorExitNode(monitorObject)); + MonitorExitNode monitorExit = currentGraph.add(new MonitorExitNode(monitorObject)); appendWithBCI(monitorExit); frameState.unlock(monitorObject); return monitorExit; @@ -1132,7 +1120,7 @@ if (successor.jsrScope.nextReturnAddress() != stream().nextBCI()) { throw new JsrNotSupportedBailout("unstructured control flow (internal limitation)"); } - frameState.push(CiKind.Jsr, ConstantNode.forJsr(stream().nextBCI(), graph)); + frameState.push(CiKind.Jsr, ConstantNode.forJsr(stream().nextBCI(), currentGraph)); appendGoto(createTarget(successor, frameState)); } @@ -1141,7 +1129,7 @@ ValueNode local = frameState.loadLocal(localIndex); JsrScope scope = currentBlock.jsrScope; int retAddress = scope.nextReturnAddress(); - append(graph.add(new FixedGuardNode(graph.unique(new CompareNode(local, Condition.EQ, ConstantNode.forJsr(retAddress, graph)))))); + append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new CompareNode(local, Condition.EQ, ConstantNode.forJsr(retAddress, currentGraph)))))); if (!successor.jsrScope.equals(scope.pop())) { throw new JsrNotSupportedBailout("unstructured control flow (ret leaves more than one scope)"); } @@ -1156,7 +1144,7 @@ int nofCases = ts.numberOfCases() + 1; // including default case assert currentBlock.normalSuccessors == nofCases; - TableSwitchNode tableSwitch = graph.add(new TableSwitchNode(value, ts.lowKey(), switchProbability(nofCases, bci))); + TableSwitchNode tableSwitch = currentGraph.add(new TableSwitchNode(value, ts.lowKey(), switchProbability(nofCases, bci))); for (int i = 0; i < nofCases; ++i) { tableSwitch.setBlockSuccessor(i, BeginNode.begin(createTarget(currentBlock.successors.get(i), frameState))); } @@ -1191,7 +1179,7 @@ for (int i = 0; i < nofCases - 1; ++i) { keys[i] = ls.keyAt(i); } - LookupSwitchNode lookupSwitch = graph.add(new LookupSwitchNode(value, keys, switchProbability(nofCases, bci))); + LookupSwitchNode lookupSwitch = currentGraph.add(new LookupSwitchNode(value, keys, switchProbability(nofCases, bci))); for (int i = 0; i < nofCases; ++i) { lookupSwitch.setBlockSuccessor(i, BeginNode.begin(createTarget(currentBlock.successors.get(i), frameState))); } @@ -1199,7 +1187,7 @@ } private ConstantNode appendConstant(CiConstant constant) { - return ConstantNode.forCiConstant(constant, runtime, graph); + return ConstantNode.forCiConstant(constant, runtime, currentGraph); } private ValueNode append(FixedNode fixed) { @@ -1212,18 +1200,10 @@ return appendWithBCI(x); } - private ValueNode append(ValueNode v) { + private static ValueNode append(ValueNode v) { return v; } - private void append(Node node) { - if (node instanceof FixedNode) { - append((FixedNode) node); - } else { - append((ValueNode) node); - } - } - private ValueNode appendWithBCI(FixedWithNextNode x) { assert x.predecessor() == null : "instruction should not have been appended yet"; assert lastInstr.next() == null : "cannot append instruction to instruction which isn't end (" + lastInstr + "->" + lastInstr.next() + ")"; @@ -1243,18 +1223,18 @@ if (block.firstInstruction == null) { if (block.isLoopHeader) { - LoopBeginNode loopBegin = graph.add(new LoopBeginNode()); - loopBegin.addEnd(graph.add(new EndNode())); - LoopEndNode loopEnd = graph.add(new LoopEndNode()); + LoopBeginNode loopBegin = currentGraph.add(new LoopBeginNode()); + loopBegin.addEnd(currentGraph.add(new EndNode())); + LoopEndNode loopEnd = currentGraph.add(new LoopEndNode()); loopEnd.setLoopBegin(loopBegin); - PlaceholderNode pBegin = graph.add(new PlaceholderNode()); + PlaceholderNode pBegin = currentGraph.add(new PlaceholderNode()); pBegin.setNext(loopBegin.forwardEdge()); - PlaceholderNode pEnd = graph.add(new PlaceholderNode()); + PlaceholderNode pEnd = currentGraph.add(new PlaceholderNode()); pEnd.setNext(loopEnd); loopBegin.setStateAfter(stateAfter.duplicate(block.startBci)); block.firstInstruction = pBegin; } else { - block.firstInstruction = graph.add(new PlaceholderNode()); + block.firstInstruction = currentGraph.add(new PlaceholderNode()); } } mergeOrClone(block, stateAfter); @@ -1272,9 +1252,9 @@ if (result instanceof LoopBeginNode) { result = ((LoopBeginNode) result).forwardEdge(); } else { - EndNode end = graph.add(new EndNode()); + EndNode end = currentGraph.add(new EndNode()); ((MergeNode) result).addEnd(end); - PlaceholderNode p = graph.add(new PlaceholderNode()); + PlaceholderNode p = currentGraph.add(new PlaceholderNode()); int bci = block.startBci; if (block instanceof ExceptionBlock) { bci = ((ExceptionBlock) block).deoptBci; @@ -1290,7 +1270,7 @@ private ValueNode synchronizedObject(FrameStateAccess state, RiResolvedMethod target) { if (isStatic(target.accessFlags())) { - return append(ConstantNode.forCiConstant(target.holder().getEncoding(Representation.JavaClass), runtime, graph)); + return append(ConstantNode.forCiConstant(target.holder().getEncoding(Representation.JavaClass), runtime, currentGraph)); } else { return state.localAt(0); } @@ -1323,13 +1303,13 @@ assert lastInstr.next() == null : "instructions already appended at block " + block.blockID; if (block == returnBlock) { - createReturnBlock(block); + createReturn(); } else if (block == unwindBlock) { - createUnwindBlock(block); + createUnwind(); } else if (block instanceof ExceptionBlock) { createExceptionDispatch((ExceptionBlock) block); } else if (block instanceof DeoptBlock) { - createDeoptBlock((DeoptBlock) block); + createDeopt(); } else { frameState.setRethrowException(false); iterateBytecodesForBlock(block); @@ -1339,7 +1319,7 @@ } private void connectLoopEndToBegin() { - for (LoopBeginNode begin : graph.getNodes(LoopBeginNode.class)) { + for (LoopBeginNode begin : currentGraph.getNodes(LoopBeginNode.class)) { LoopEndNode loopEnd = begin.loopEnd(); AbstractStateSplit loopEndStateSplit = (AbstractStateSplit) loopEnd.predecessor(); if (loopEndStateSplit.stateAfter() != null) { @@ -1379,17 +1359,17 @@ return loopBegin; } - private void createDeoptBlock(DeoptBlock block) { - append(graph.add(new DeoptimizeNode(DeoptAction.InvalidateReprofile))); + private void createDeopt() { + append(currentGraph.add(new DeoptimizeNode(DeoptAction.InvalidateReprofile))); } - private void createUnwindBlock(Block block) { + private void createUnwind() { synchronizedEpilogue(FrameState.AFTER_EXCEPTION_BCI); - UnwindNode unwindNode = graph.add(new UnwindNode(frameState.apop())); + UnwindNode unwindNode = currentGraph.add(new UnwindNode(frameState.apop())); append(unwindNode); } - private void createReturnBlock(Block block) { + private void createReturn() { if (method.isConstructor() && method.holder().superType() == null) { callRegisterFinalizer(); } @@ -1399,11 +1379,11 @@ // TODO (gd) remove this when FloatingRead is fixed if (Modifier.isSynchronized(method.accessFlags())) { - append(graph.add(new ValueAnchorNode(x))); + append(currentGraph.add(new ValueAnchorNode(x))); } synchronizedEpilogue(FrameState.AFTER_BCI); - ReturnNode returnNode = graph.add(new ReturnNode(x)); + ReturnNode returnNode = currentGraph.add(new ReturnNode(x)); append(returnNode); } @@ -1417,7 +1397,7 @@ private void createExceptionDispatch(ExceptionBlock block) { if (block.handler == null) { assert frameState.stackSize() == 1 : "only exception object expected on stack, actual size: " + frameState.stackSize(); - createUnwindBlock(block); + createUnwind(); } else { assert frameState.stackSize() == 1 : frameState; @@ -1428,7 +1408,7 @@ FixedNode catchSuccessor = createTarget(block.successors.get(0), frameState); FixedNode nextDispatch = createTarget(nextBlock, frameState); ValueNode exception = frameState.stackAt(0); - IfNode ifNode = graph.add(new IfNode(graph.unique(new InstanceOfNode(typeInstruction, (RiResolvedType) catchType, exception, false)), catchSuccessor, nextDispatch, 0.5)); + IfNode ifNode = currentGraph.add(new IfNode(currentGraph.unique(new InstanceOfNode(typeInstruction, (RiResolvedType) catchType, exception, false)), catchSuccessor, nextDispatch, 0.5)); append(ifNode); } } @@ -1670,7 +1650,7 @@ case IF_ICMPLE : genIfSame(CiKind.Int, Condition.LE); break; case IF_ACMPEQ : genIfSame(CiKind.Object, Condition.EQ); break; case IF_ACMPNE : genIfSame(CiKind.Object, Condition.NE); break; - case GOTO : genGoto(stream.readBranchDest()); break; + case GOTO : genGoto(); break; case JSR : genJsr(stream.readBranchDest()); break; case RET : genRet(stream.readLocalIndex()); break; case TABLESWITCH : genTableswitch(); break; @@ -1681,14 +1661,14 @@ case DRETURN : genReturn(frameState.dpop()); break; case ARETURN : genReturn(frameState.apop()); break; case RETURN : genReturn(null); break; - case GETSTATIC : cpi = stream.readCPI(); genGetStatic(cpi, lookupField(cpi, opcode)); break; - case PUTSTATIC : cpi = stream.readCPI(); genPutStatic(cpi, lookupField(cpi, opcode)); break; - case GETFIELD : cpi = stream.readCPI(); genGetField(cpi, lookupField(cpi, opcode)); break; - case PUTFIELD : cpi = stream.readCPI(); genPutField(cpi, lookupField(cpi, opcode)); break; - case INVOKEVIRTUAL : cpi = stream.readCPI(); genInvokeVirtual(lookupMethod(cpi, opcode), cpi, constantPool); break; - case INVOKESPECIAL : cpi = stream.readCPI(); genInvokeSpecial(lookupMethod(cpi, opcode), null, cpi, constantPool); break; - case INVOKESTATIC : cpi = stream.readCPI(); genInvokeStatic(lookupMethod(cpi, opcode), cpi, constantPool); break; - case INVOKEINTERFACE: cpi = stream.readCPI(); genInvokeInterface(lookupMethod(cpi, opcode), cpi, constantPool); break; + case GETSTATIC : cpi = stream.readCPI(); genGetStatic(lookupField(cpi, opcode)); break; + case PUTSTATIC : cpi = stream.readCPI(); genPutStatic(lookupField(cpi, opcode)); break; + case GETFIELD : cpi = stream.readCPI(); genGetField(lookupField(cpi, opcode)); break; + case PUTFIELD : cpi = stream.readCPI(); genPutField(lookupField(cpi, opcode)); break; + case INVOKEVIRTUAL : cpi = stream.readCPI(); genInvokeVirtual(lookupMethod(cpi, opcode)); break; + case INVOKESPECIAL : cpi = stream.readCPI(); genInvokeSpecial(lookupMethod(cpi, opcode)); break; + case INVOKESTATIC : cpi = stream.readCPI(); genInvokeStatic(lookupMethod(cpi, opcode)); break; + case INVOKEINTERFACE: cpi = stream.readCPI(); genInvokeInterface(lookupMethod(cpi, opcode)); break; case NEW : genNewInstance(stream.readCPI()); break; case NEWARRAY : genNewTypeArray(stream.readLocalIndex()); break; case ANEWARRAY : genNewObjectArray(stream.readCPI()); break; @@ -1701,7 +1681,7 @@ case MULTIANEWARRAY : genNewMultiArray(stream.readCPI()); break; case IFNULL : genIfNull(Condition.EQ); break; case IFNONNULL : genIfNull(Condition.NE); break; - case GOTO_W : genGoto(stream.readFarBranchDest()); break; + case GOTO_W : genGoto(); break; case JSR_W : genJsr(stream.readFarBranchDest()); break; case BREAKPOINT: throw new CiBailout("concurrent setting of breakpoint"); @@ -1732,7 +1712,7 @@ } private void genArrayLength() { - frameState.ipush(append(graph.add(new ArrayLengthNode(frameState.apop())))); + frameState.ipush(append(currentGraph.add(new ArrayLengthNode(frameState.apop())))); } /**
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/FrameMap.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/FrameMap.java Sun Dec 18 05:24:06 2011 +0100 @@ -187,20 +187,20 @@ /** * Computes the frame size for this frame, given the number of spill slots. - * @param spillSlotCount the number of spill slots + * @param finalSpillSlotCount the number of spill slots */ - public void finalizeFrame(int spillSlotCount) { + public void finalizeFrame(int finalSpillSlotCount) { assert this.spillSlotCount == -1 : "can only be set once"; assert this.frameSize == -1 : "should only be calculated once"; - assert spillSlotCount >= 0 : "must be positive"; + assert finalSpillSlotCount >= 0 : "must be positive"; - this.spillSlotCount = spillSlotCount; - int frameSize = offsetToStackBlocksEnd(); + this.spillSlotCount = finalSpillSlotCount; + int newFrameSize = offsetToStackBlocksEnd(); CiCalleeSaveLayout csl = registerConfig.getCalleeSaveLayout(); if (csl != null) { - frameSize += csl.size; + newFrameSize += csl.size; } - this.frameSize = target.alignFrameSize(frameSize); + this.frameSize = target.alignFrameSize(newFrameSize); } /** @@ -276,6 +276,11 @@ */ public static final class StackBlock extends CiValue { /** + * + */ + private static final long serialVersionUID = -5260976274149772987L; + + /** * The size of this stack block. */ private final int size; @@ -348,7 +353,7 @@ return runtime.getCustomStackAreaSize(); } - public int offsetToCustomArea() { + public static int offsetToCustomArea() { return 0; } @@ -390,8 +395,7 @@ * Initializes a ref map that covers all the slots in the frame. */ public CiBitMap initFrameRefMap() { - int frameSize = frameSize(); - int frameWords = frameSize / target.spillSlotSize; + int frameWords = frameSize() / target.spillSlotSize; CiBitMap frameRefMap = new CiBitMap(frameWords); for (StackBlock sb = stackBlocks; sb != null; sb = sb.next) { if (sb.kind == CiKind.Object) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIR.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIR.java Sun Dec 18 05:24:06 2011 +0100 @@ -78,8 +78,8 @@ this.startBlock = startBlock; this.valueToBlock = valueToBlock; - slowPaths = new ArrayList<SlowPath>(); - deoptimizationStubs = new ArrayList<SlowPath>(); + slowPaths = new ArrayList<>(); + deoptimizationStubs = new ArrayList<>(); } /** @@ -155,7 +155,7 @@ } } - private void emitOp(TargetMethodAssembler tasm, LIRInstruction op) { + private static void emitOp(TargetMethodAssembler tasm, LIRInstruction op) { try { try { op.emitCode(tasm);
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRInstruction.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRInstruction.java Sun Dec 18 05:24:06 2011 +0100 @@ -328,7 +328,7 @@ return buf.toString(); } - protected void appendDebugInfo(StringBuilder buf, Formatter operandFmt, LIRDebugInfo info) { + protected void appendDebugInfo(StringBuilder buf, Formatter operandFmt) { if (info != null) { buf.append(" [bci:").append(info.topFrame.bci); if (info.hasDebugInfo()) { @@ -344,7 +344,7 @@ public String toString(Formatter operandFmt) { StringBuilder buf = new StringBuilder(name()).append(' ').append(operationString(operandFmt)); - appendDebugInfo(buf, operandFmt, info); + appendDebugInfo(buf, operandFmt); return buf.toString(); } }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRXirInstruction.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRXirInstruction.java Sun Dec 18 05:24:06 2011 +0100 @@ -145,7 +145,7 @@ } if (n != 0) { sb.append(' ').append(mode.name().toLowerCase()).append("=("); - HashSet<String> operands = new HashSet<String>(); + HashSet<String> operands = new HashSet<>(); for (int i = 0; i < n; i++) { String operand = operandFmt.format(operandAt(mode, i)); if (!operands.contains(operand)) { @@ -160,7 +160,7 @@ } } - appendDebugInfo(sb, operandFmt, info); + appendDebugInfo(sb, operandFmt); return sb.toString(); }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/loop/Loop.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/loop/Loop.java Sun Dec 18 05:24:06 2011 +0100 @@ -38,7 +38,7 @@ public Loop(LoopBeginNode loopBegin) { this.loopBegin = loopBegin; - this.children = new ArrayList<Loop>(1); + this.children = new ArrayList<>(1); this.exits = loopBegin.graph().createNodeBitMap(); this.directCFGNodes = loopBegin.graph().createNodeBitMap(); }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/loop/LoopUtil.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/loop/LoopUtil.java Sun Dec 18 05:24:06 2011 +0100 @@ -37,7 +37,7 @@ mark(begin, nodeToLoop); } - List<Loop> rootLoops = new ArrayList<Loop>(1); + List<Loop> rootLoops = new ArrayList<>(1); LoopInfo info = new LoopInfo(nodeToLoop, rootLoops); // Get parent-child relationships between loops.
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/observer/ObservableContext.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/observer/ObservableContext.java Sun Dec 18 05:24:06 2011 +0100 @@ -51,7 +51,7 @@ assert observer != null; if (observers == null) { - observers = new LinkedList<CompilationObserver>(); + observers = new LinkedList<>(); } observers.add(observer); }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/package-info.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/package-info.java Sun Dec 18 05:24:06 2011 +0100 @@ -41,7 +41,7 @@ * {@link com.oracle.max.graal.compiler.GraalCompilation#compile} method. * <p> * While there is only one {@code GraalCompiler} instance, there may be several compilations proceeding concurrently, each of - * which is represented by a unique {@code GraalCompilation} instance. The static method {@link com.oracle.max.graal.compiler.GraalCompilation#current}} returns the + * which is represented by a unique {@code GraalCompilation} instance. The static method {@link com.oracle.max.graal.compiler.GraalCompilation#currentInterval}} returns the * {@code GraalCompilation} instance associated with the current thread, and is managed using a {@link java.lang.ThreadLocal} variable. * Each {@code GraalCompilation} instance has an associated {@link com.sun.cri.ci.CiStatistics} object that accumulates information about the compilation process. * </p>
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/BoxingEliminationPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/BoxingEliminationPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,30 +34,24 @@ public class BoxingEliminationPhase extends Phase { - private RiRuntime runtime; - - public BoxingEliminationPhase(RiRuntime runtime) { - this.runtime = runtime; - } - @Override protected void run(StructuredGraph graph) { if (graph.getNodes(UnboxNode.class).iterator().hasNext()) { - Map<PhiNode, PhiNode> phiReplacements = new HashMap<PhiNode, PhiNode>(); + Map<PhiNode, PhiNode> phiReplacements = new HashMap<>(); for (UnboxNode unboxNode : graph.getNodes(UnboxNode.class)) { - tryEliminate(unboxNode, graph, phiReplacements); + tryEliminate(unboxNode, phiReplacements); } new DeadCodeEliminationPhase().apply(graph); for (BoxNode boxNode : graph.getNodes(BoxNode.class)) { - tryEliminate(boxNode, graph); + tryEliminate(boxNode); } } } - private void tryEliminate(UnboxNode unboxNode, StructuredGraph graph, Map<PhiNode, PhiNode> phiReplacements) { + private void tryEliminate(UnboxNode unboxNode, Map<PhiNode, PhiNode> phiReplacements) { ValueNode unboxedValue = unboxedValue(unboxNode.source(), unboxNode.destinationKind(), phiReplacements); if (unboxedValue != null) { assert unboxedValue.kind() == unboxNode.destinationKind(); @@ -107,7 +101,7 @@ } } - private void tryEliminate(BoxNode boxNode, StructuredGraph graph) { + private static void tryEliminate(BoxNode boxNode) { virtualizeUsages(boxNode, boxNode.source(), boxNode.exactType()); @@ -127,7 +121,7 @@ boxNode.safeDelete(); } - private void virtualizeUsages(ValueNode boxNode, ValueNode replacement, RiResolvedType exactType) { + private static void virtualizeUsages(ValueNode boxNode, ValueNode replacement, RiResolvedType exactType) { ValueNode virtualValueNode = null; VirtualObjectNode virtualObjectNode = null; for (Node n : boxNode.usages().filter(FrameState.class).or(VirtualObjectFieldNode.class).snapshot()) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/CanonicalizerPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -69,7 +69,6 @@ TTY.println("Canonicalizer: work on " + node); } graph.mark(); - tool.setNode(node); Node canonical = ((Canonicalizable) node).canonical(tool); if (canonical == null) { node.safeDelete(); @@ -144,7 +143,6 @@ private static final class Tool implements CanonicalizerTool { - private Node node; private final NodeWorkList nodeWorkList; private final RiRuntime runtime; private final CiTarget target; @@ -159,7 +157,7 @@ @Override public void deleteBranch(FixedNode branch) { - node.replaceFirstSuccessor(branch, null); + branch.predecessor().replaceFirstSuccessor(branch, null); killCFG(branch); } @@ -243,10 +241,6 @@ } } - public void setNode(Node node) { - this.node = node; - } - /** * @return the current target or {@code null} if no target is available in the current context. */
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ComputeProbabilityPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/ComputeProbabilityPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -50,12 +50,12 @@ @Override protected void run(StructuredGraph graph) { new PropagateProbability(graph.start()).apply(); - if (context.isObserved() && GraalOptions.TraceProbability) { - context.observable.fireCompilationEvent("After PropagateProbability", graph); + if (currentContext.isObserved() && GraalOptions.TraceProbability) { + currentContext.observable.fireCompilationEvent("After PropagateProbability", graph); } computeLoopFactors(); - if (context.isObserved() && GraalOptions.TraceProbability) { - context.observable.fireCompilationEvent("After computeLoopFactors", graph); + if (currentContext.isObserved() && GraalOptions.TraceProbability) { + currentContext.observable.fireCompilationEvent("After computeLoopFactors", graph); } new PropagateLoopFrequency(graph.start()).apply(); } @@ -85,7 +85,7 @@ public static class LoopInfo { public final LoopBeginNode loopBegin; - public final Set<LoopInfo> requires = new HashSet<LoopInfo>(4); + public final Set<LoopInfo> requires = new HashSet<>(4); private double loopFrequency = -1; public boolean ended = false; @@ -117,8 +117,8 @@ } } - public Set<LoopInfo> loopInfos = new HashSet<LoopInfo>(); - public Map<MergeNode, Set<LoopInfo>> mergeLoops = new IdentityHashMap<MergeNode, Set<LoopInfo>>(); + public Set<LoopInfo> loopInfos = new HashSet<>(); + public Map<MergeNode, Set<LoopInfo>> mergeLoops = new IdentityHashMap<>(); private class Probability implements MergeableState<Probability> { public double probability; @@ -127,7 +127,7 @@ public Probability(double probability, HashSet<LoopInfo> loops) { this.probability = probability; - this.loops = new HashSet<LoopInfo>(4); + this.loops = new HashSet<>(4); if (loops != null) { this.loops.addAll(loops); } @@ -141,7 +141,7 @@ @Override public boolean merge(MergeNode merge, Collection<Probability> withStates) { if (merge.endCount() > 1) { - HashSet<LoopInfo> intersection = new HashSet<LoopInfo>(loops); + HashSet<LoopInfo> intersection = new HashSet<>(loops); for (Probability other : withStates) { intersection.retainAll(other.loops); } @@ -168,7 +168,7 @@ probability += prob; } loops = intersection; - mergeLoops.put(merge, new HashSet<LoopInfo>(intersection)); + mergeLoops.put(merge, new HashSet<>(intersection)); assert isRelativeProbability(probability) : probability; } return true;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/DeadCodeEliminationPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/DeadCodeEliminationPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -31,18 +31,16 @@ public class DeadCodeEliminationPhase extends Phase { private NodeFlood flood; - private StructuredGraph graph; @Override protected void run(StructuredGraph graph) { - this.graph = graph; this.flood = graph.createNodeFlood(); flood.add(graph.start()); iterateSuccessors(); - disconnectCFGNodes(); - iterateInputs(); - deleteNodes(); + disconnectCFGNodes(graph); + iterateInputs(graph); + deleteNodes(graph); // remove chained Merges for (MergeNode merge : graph.getNodes(MergeNode.class)) { @@ -69,7 +67,7 @@ } } - private void disconnectCFGNodes() { + private void disconnectCFGNodes(StructuredGraph graph) { for (EndNode node : graph.getNodes(EndNode.class)) { if (!flood.isMarked(node)) { MergeNode merge = node.merge(); @@ -101,13 +99,13 @@ } } - private void replacePhis(MergeNode merge) { + private static void replacePhis(MergeNode merge) { for (PhiNode phi : merge.phis().snapshot()) { phi.replaceAndDelete((phi).valueAt(0)); } } - private void deleteNodes() { + private void deleteNodes(StructuredGraph graph) { for (Node node : graph.getNodes()) { if (!flood.isMarked(node)) { node.clearInputs(); @@ -121,7 +119,7 @@ } } - private void iterateInputs() { + private void iterateInputs(StructuredGraph graph) { for (Node node : graph.getNodes()) { if (node instanceof LocalNode) { flood.add(node);
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/EscapeAnalysisPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -28,7 +28,6 @@ import com.oracle.max.graal.compiler.*; import com.oracle.max.graal.compiler.graph.*; import com.oracle.max.graal.compiler.graphbuilder.*; -import com.oracle.max.graal.compiler.schedule.*; import com.oracle.max.graal.cri.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.nodes.*; @@ -43,7 +42,7 @@ public class EscapeAnalysisPhase extends Phase { public static class GraphOrder implements Iterable<Node> { - private final ArrayList<Node> nodes = new ArrayList<Node>(); + private final ArrayList<Node> nodes = new ArrayList<>(); public GraphOrder(Graph graph) { NodeBitMap visited = graph.createNodeBitMap(); @@ -211,10 +210,7 @@ public class EscapementFixup { - private List<Block> blocks; - private final Map<Object, Integer> fields = new HashMap<Object, Integer>(); - private final Map<Block, BlockExitState> exitStates = new IdentityHashMap<Block, BlockExitState>(); - + private final Map<Object, Integer> fields = new HashMap<>(); private final EscapeOp op; private final StructuredGraph graph; private final FixedWithNextNode node; @@ -252,14 +248,14 @@ final BlockExitState startState = new BlockExitState(escapeFields, virtual); final PostOrderNodeIterator<?> iterator = new PostOrderNodeIterator<BlockExitState>(next, startState) { @Override - protected void node(FixedNode node) { - int changedField = op.updateState(virtual, node, fields, state.fieldState); + protected void node(FixedNode curNode) { + int changedField = op.updateState(virtual, curNode, fields, state.fieldState); if (changedField != -1) { state.updateField(changedField); } - if (!node.isDeleted() && node instanceof StateSplit && ((StateSplit) node).stateAfter() != null) { + if (!curNode.isDeleted() && curNode instanceof StateSplit && ((StateSplit) curNode).stateAfter() != null) { if (state.virtualObjectField != null) { - ((StateSplit) node).stateAfter().addVirtualObjectMapping(state.virtualObjectField); + ((StateSplit) curNode).stateAfter().addVirtualObjectMapping(state.virtualObjectField); } } } @@ -296,8 +292,8 @@ public static class EscapeRecord { public final Node node; - public final ArrayList<Node> escapesThrough = new ArrayList<Node>(); - public final ArrayList<Invoke> invokes = new ArrayList<Invoke>(); + public final ArrayList<Node> escapesThrough = new ArrayList<>(); + public final ArrayList<Invoke> invokes = new ArrayList<>(); public double localWeight; public EscapeRecord(Node node) { @@ -369,8 +365,9 @@ } } - private void completeAnalysis(StructuredGraph graph) { - // TODO(ls) debugging code + @SuppressWarnings("unused") + private static void completeAnalysis(StructuredGraph graph) { + // TODO(ls): debugging code TTY.println("================================================================"); for (Node node : graph.getNodes()) { @@ -413,8 +410,8 @@ if (!shouldAnalyze(node)) { return; } - Set<Node> exits = new HashSet<Node>(); - Set<Invoke> invokes = new HashSet<Invoke>(); + Set<Node> exits = new HashSet<>(); + Set<Invoke> invokes = new HashSet<>(); int iterations = 0; int minimumWeight = getMinimumWeight(node); @@ -438,20 +435,20 @@ } if (invokes.size() == 0) { - if (context.isObserved()) { - context.observable.fireCompilationEvent("Before escape " + node, graph); + if (currentContext.isObserved()) { + currentContext.observable.fireCompilationEvent("Before escape " + node, graph); } if (GraalOptions.TraceEscapeAnalysis || GraalOptions.PrintEscapeAnalysis) { TTY.println("%n!!!!!!!! non-escaping object: %s (%s)", node, node.exactType()); } try { - context.timers.startScope("Escape Analysis Fixup"); + currentContext.timers.startScope("Escape Analysis Fixup"); removeAllocation(node, op); } finally { - context.timers.endScope(); + currentContext.timers.endScope(); } - if (context.isObserved()) { - context.observable.fireCompilationEvent("After escape", graph); + if (currentContext.isObserved()) { + currentContext.observable.fireCompilationEvent("After escape", graph); } break; } @@ -467,8 +464,8 @@ if (GraalOptions.TraceEscapeAnalysis || GraalOptions.PrintEscapeAnalysis) { TTY.println("Trying inlining to get a non-escaping object for %s", node); } - new InliningPhase(target, runtime, invokes, assumptions, plan, config).apply(graph, context); - new DeadCodeEliminationPhase().apply(graph, context); + new InliningPhase(target, runtime, invokes, assumptions, plan, config).apply(graph, currentContext); + new DeadCodeEliminationPhase().apply(graph, currentContext); if (node.isDeleted()) { if (GraalOptions.TraceEscapeAnalysis || GraalOptions.PrintEscapeAnalysis) { TTY.println("%n!!!!!!!! object died while performing escape analysis: %s (%s)", node, node.exactType()); @@ -501,15 +498,15 @@ } } - protected boolean shouldAnalyze(FixedWithNextNode node) { + protected boolean shouldAnalyze(@SuppressWarnings("unused") FixedWithNextNode node) { return true; } - protected int getMinimumWeight(FixedWithNextNode node) { + protected int getMinimumWeight(@SuppressWarnings("unused") FixedWithNextNode node) { return GraalOptions.ForcedInlineEscapeWeight; } - private double analyze(EscapeOp op, Node node, Collection<Node> exits, Collection<Invoke> invokes) { + private static double analyze(EscapeOp op, Node node, Collection<Node> exits, Collection<Invoke> invokes) { double weight = 0; for (Node usage : node.usages().snapshot()) { boolean escapes = op.escape(node, usage);
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/FindInductionVariablesPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/FindInductionVariablesPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -54,7 +54,7 @@ } } - private void findInductionVariables(Loop loop) { + private static void findInductionVariables(Loop loop) { LoopBeginNode loopBegin = loop.loopBegin(); NodeBitMap loopNodes = loop.nodes(); for (PhiNode phi : loopBegin.phis().snapshot()) { @@ -110,7 +110,7 @@ } } } - private void findDerivedInductionVariable(BasicInductionVariableNode biv, CiKind kind, NodeBitMap loopNodes) { + private static void findDerivedInductionVariable(BasicInductionVariableNode biv, CiKind kind, NodeBitMap loopNodes) { for (Node usage : biv.usages().snapshot()) { ValueNode scale = scale(usage, biv, loopNodes); ValueNode offset = null; @@ -146,7 +146,7 @@ } } - private ValueNode scale(Node n, BasicInductionVariableNode biv, NodeBitMap loopNodes) { + private static ValueNode scale(Node n, BasicInductionVariableNode biv, NodeBitMap loopNodes) { if (n instanceof IntegerMulNode) { IntegerMulNode mul = (IntegerMulNode) n; ValueNode scale = null;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/FloatingReadPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/FloatingReadPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -44,7 +44,7 @@ public MemoryMap(Block block) { this.block = block; - map = new IdentityHashMap<Object, Node>(); + map = new IdentityHashMap<>(); } public MemoryMap(Block block, MemoryMap other) { @@ -107,7 +107,7 @@ mergeOperationCount++; } - private void mergeNodes(Object location, Node original, Node newValue, Block block) { + private void mergeNodes(Object location, Node original, Node newValue, Block mergeBlock) { if (original == newValue) { // Nothing to merge. if (GraalOptions.TraceMemoryMaps) { @@ -115,7 +115,7 @@ } return; } - MergeNode m = (MergeNode) block.firstNode(); + MergeNode m = (MergeNode) mergeBlock.firstNode(); if (m.isPhiAtMerge(original)) { PhiNode phi = (PhiNode) original; phi.addInput((ValueNode) newValue); @@ -178,7 +178,7 @@ public void createLoopEntryMemoryMap(Set<Object> modifiedLocations, Loop loop) { - loopEntryMap = new IdentityHashMap<Object, Node>(); + loopEntryMap = new IdentityHashMap<>(); for (Object modifiedLocation : modifiedLocations) { Node other; @@ -187,19 +187,19 @@ } else { other = map.get(LocationNode.ANY_LOCATION); } - createLoopEntryPhi(modifiedLocation, other, loop, loopEntryMap); + createLoopEntryPhi(modifiedLocation, other, loop); } if (modifiedLocations.contains(LocationNode.ANY_LOCATION)) { for (Map.Entry<Object, Node> entry : map.entrySet()) { if (!modifiedLocations.contains(entry.getKey())) { - createLoopEntryPhi(entry.getKey(), entry.getValue(), loop, loopEntryMap); + createLoopEntryPhi(entry.getKey(), entry.getValue(), loop); } } } } - private void createLoopEntryPhi(Object modifiedLocation, Node other, Loop loop, IdentityHashMap<Object, Node> loopEntryMap) { + private void createLoopEntryPhi(Object modifiedLocation, Node other, Loop loop) { PhiNode phi = other.graph().unique(new PhiNode(CiKind.Illegal, loop.loopBegin(), PhiType.Memory)); phi.addInput((ValueNode) other); map.put(modifiedLocation, phi); @@ -220,10 +220,10 @@ LoopInfo loopInfo = LoopUtil.computeLoopInfo(graph); - HashMap<Loop, Set<Object>> modifiedValues = new HashMap<Loop, Set<Object>>(); + HashMap<Loop, Set<Object>> modifiedValues = new HashMap<>(); // Initialize modified values to empty hash set. for (Loop loop : loopInfo.loops()) { - modifiedValues.put(loop, new HashSet<Object>()); + modifiedValues.put(loop, new HashSet<>()); } // Get modified values in loops. @@ -245,12 +245,12 @@ } if (GraalOptions.TraceMemoryMaps) { - print(graph, loopInfo, modifiedValues); + print(loopInfo, modifiedValues); } // Identify blocks. final IdentifyBlocksPhase s = new IdentifyBlocksPhase(false); - s.apply(graph, context); + s.apply(graph, currentContext); List<Block> blocks = s.getBlocks(); // Process blocks (predecessors first). @@ -260,7 +260,7 @@ } } - private void addStartCheckpoint(StructuredGraph graph) { + private static void addStartCheckpoint(StructuredGraph graph) { BeginNode entryPoint = graph.start(); FixedNode next = entryPoint.next(); if (!(next instanceof MemoryCheckpoint)) { @@ -329,7 +329,7 @@ } } - private void traceMemoryCheckpoint(Loop loop, HashMap<Loop, Set<Object>> modifiedValues) { + private static void traceMemoryCheckpoint(Loop loop, HashMap<Loop, Set<Object>> modifiedValues) { modifiedValues.get(loop).add(LocationNode.ANY_LOCATION); } @@ -340,11 +340,11 @@ } } - private void traceWrite(Loop loop, Object locationIdentity, HashMap<Loop, Set<Object>> modifiedValues) { + private static void traceWrite(Loop loop, Object locationIdentity, HashMap<Loop, Set<Object>> modifiedValues) { modifiedValues.get(loop).add(locationIdentity); } - private void print(StructuredGraph graph, LoopInfo loopInfo, HashMap<Loop, Set<Object>> modifiedValues) { + private static void print(LoopInfo loopInfo, HashMap<Loop, Set<Object>> modifiedValues) { TTY.println(); TTY.println("Loops:"); for (Loop loop : loopInfo.loops()) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GlobalValueNumberingPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GlobalValueNumberingPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -48,7 +48,7 @@ if (newNode != null) { n.replaceAndDelete(newNode); if (GraalOptions.Meter) { - context.metrics.GlobalValueNumberingHits++; + currentContext.metrics.GlobalValueNumberingHits++; } if (GraalOptions.TraceGVN) { TTY.println("GVN applied and new node is " + newNode);
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -45,18 +45,12 @@ * - honor the result of overrideInliningDecision(0, caller, invoke.bci, method, true); */ - private static final int MAX_ITERATIONS = 1000; - private final CiTarget target; private final GraalRuntime runtime; - private int inliningSize; private final Collection<Invoke> hints; - private final PriorityQueue<InlineInfo> inlineCandidates = new PriorityQueue<InlineInfo>(); - private NodeMap<InlineInfo> inlineInfos; - - private StructuredGraph graph; + private final PriorityQueue<InlineInfo> inlineCandidates = new PriorityQueue<>(); private CiAssumptions assumptions; private final PhasePlan plan; @@ -79,15 +73,13 @@ @SuppressWarnings("unchecked") @Override protected void run(StructuredGraph graph) { - this.graph = graph; - inlineInfos = graph.createNodeMap(); + graph.createNodeMap(); if (hints != null) { - Iterable<? extends Node> hints = Util.uncheckedCast(this.hints); - scanInvokes(hints, 0); + scanInvokes((Iterable<? extends Node>) Util.uncheckedCast(this.hints), 0, graph); } else { - scanInvokes(graph.getNodes(InvokeNode.class), 0); - scanInvokes(graph.getNodes(InvokeWithExceptionNode.class), 0); + scanInvokes(graph.getNodes(InvokeNode.class), 0, graph); + scanInvokes(graph.getNodes(InvokeWithExceptionNode.class), 0, graph); } while (!inlineCandidates.isEmpty() && graph.getNodeCount() < GraalOptions.MaximumDesiredSize) { @@ -106,12 +98,12 @@ Iterable<Node> newNodes = null; if (info.invoke.node().isAlive()) { try { - info.inline(this.graph, runtime, this); + info.inline(graph, runtime, this); if (GraalOptions.TraceInlining) { TTY.println("inlining %f: %s", info.weight, info); } if (GraalOptions.TraceInlining) { - context.observable.fireCompilationEvent("after inlining " + info, graph); + currentContext.observable.fireCompilationEvent("after inlining " + info, graph); } // get the new nodes here, the canonicalizer phase will reset the mark newNodes = graph.getNewNodes(); @@ -119,10 +111,10 @@ new CanonicalizerPhase(target, runtime, true, assumptions).apply(graph); } if (GraalOptions.Intrinsify) { - new IntrinsificationPhase(runtime).apply(graph, context); + new IntrinsificationPhase(runtime).apply(graph, currentContext); } if (GraalOptions.Meter) { - context.metrics.InlinePerformed++; + currentContext.metrics.InlinePerformed++; } } catch (CiBailout bailout) { // TODO determine if we should really bail out of the whole compilation. @@ -136,12 +128,12 @@ } } if (newNodes != null && info.level <= GraalOptions.MaximumInlineLevel) { - scanInvokes(newNodes, info.level + 1); + scanInvokes(newNodes, info.level + 1, graph); } } } - private void scanInvokes(Iterable<? extends Node> newNodes, int level) { + private void scanInvokes(Iterable<? extends Node> newNodes, int level, StructuredGraph graph) { graph.mark(); for (Node node : newNodes) { if (node != null) { @@ -163,30 +155,30 @@ InlineInfo info = InliningUtil.getInlineInfo(invoke, level, runtime, assumptions, this); if (info != null) { if (GraalOptions.Meter) { - context.metrics.InlineConsidered++; + currentContext.metrics.InlineConsidered++; } inlineCandidates.add(info); } } - public static final Map<RiMethod, Integer> parsedMethods = new HashMap<RiMethod, Integer>(); + public static final Map<RiMethod, Integer> parsedMethods = new HashMap<>(); @Override public StructuredGraph buildGraph(RiResolvedMethod method) { - StructuredGraph graph = new StructuredGraph(); - new GraphBuilderPhase(runtime, method, null, config).apply(graph, context, true, false); + StructuredGraph newGraph = new StructuredGraph(); + new GraphBuilderPhase(runtime, method, null, config).apply(newGraph, currentContext, false); if (plan != null) { - plan.runPhases(PhasePosition.AFTER_PARSING, graph, context); + plan.runPhases(PhasePosition.AFTER_PARSING, newGraph, currentContext); } if (GraalOptions.ProbabilityAnalysis) { - new DeadCodeEliminationPhase().apply(graph, context, true, false); - new ComputeProbabilityPhase().apply(graph, context, true, false); + new DeadCodeEliminationPhase().apply(newGraph, currentContext, false); + new ComputeProbabilityPhase().apply(newGraph, currentContext, false); } - new CanonicalizerPhase(target, runtime, assumptions).apply(graph, context, true, false); - return graph; + new CanonicalizerPhase(target, runtime, assumptions).apply(newGraph, currentContext, false); + return newGraph; } @Override @@ -228,10 +220,10 @@ int count; if (GraalOptions.ParseBeforeInlining) { if (!parsedMethods.containsKey(method)) { - StructuredGraph graph = new StructuredGraph(); - new GraphBuilderPhase(runtime, method, null).apply(graph, context, true, false); - new CanonicalizerPhase(target, runtime, assumptions).apply(graph, context, true, false); - count = graphComplexity(graph); + StructuredGraph newGraph = new StructuredGraph(); + new GraphBuilderPhase(runtime, method, null).apply(newGraph, currentContext, false); + new CanonicalizerPhase(target, runtime, assumptions).apply(newGraph, currentContext, false); + count = graphComplexity(newGraph); parsedMethods.put(method, count); } else { count = parsedMethods.get(method);
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/IntrinsificationPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/IntrinsificationPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -51,7 +51,6 @@ tryIntrinsify(invoke, target, runtime); } - @SuppressWarnings("unchecked") public static void tryIntrinsify(Invoke invoke, RiResolvedMethod target, GraalRuntime runtime) { StructuredGraph intrinsicGraph = (StructuredGraph) target.compilerStorage().get(Graph.class); if (intrinsicGraph == null) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoweringPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/LoweringPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -40,7 +40,7 @@ @Override protected void run(final StructuredGraph graph) { final IdentifyBlocksPhase s = new IdentifyBlocksPhase(false); - s.apply(graph, context); + s.apply(graph, currentContext); s.calculateAlwaysReachedBlock(); NodeBitMap processed = graph.createNodeBitMap(); @@ -119,7 +119,7 @@ @Override public Node createGuard(Node condition) { - FixedNode anchor = (FixedNode) getGuardAnchor(); + FixedNode guardAnchor = (FixedNode) getGuardAnchor(); if (GraalOptions.OptEliminateGuards) { for (Node usage : condition.usages()) { if (activeGuards.isMarked(usage)) { @@ -127,7 +127,7 @@ } } } - GuardNode newGuard = anchor.graph().unique(new GuardNode((BooleanNode) condition, anchor)); + GuardNode newGuard = guardAnchor.graph().unique(new GuardNode((BooleanNode) condition, guardAnchor)); activeGuards.grow(); activeGuards.mark(newGuard); return newGuard;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java Sun Dec 18 05:24:06 2011 +0100 @@ -32,7 +32,7 @@ private final String name; private final boolean shouldVerify; - protected GraalContext context; + protected GraalContext currentContext; protected Phase() { this.name = this.getClass().getSimpleName(); @@ -57,16 +57,16 @@ } public final void apply(StructuredGraph graph, GraalContext context) { - apply(graph, context, true, true); + apply(graph, context, true); } - public final void apply(StructuredGraph graph, boolean plotOnError, boolean plot) { - apply(graph, GraalContext.EMPTY_CONTEXT, plotOnError, plot); + public final void apply(StructuredGraph graph, boolean plot) { + apply(graph, GraalContext.EMPTY_CONTEXT, plot); } - public final void apply(StructuredGraph graph, GraalContext context, boolean plotOnError, boolean plot) { + public final void apply(StructuredGraph graph, GraalContext context, boolean plot) { - this.context = context; + this.currentContext = context; try { assert graph != null && !shouldVerify || graph.verify(); } catch (GraalInternalError e) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/PhasePlan.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/PhasePlan.java Sun Dec 18 05:24:06 2011 +0100 @@ -59,11 +59,11 @@ @SuppressWarnings("unchecked") private final ArrayList<Phase>[] phases = new ArrayList[PhasePosition.values().length]; - private final Set<Class<? extends Phase>> disabledPhases = new HashSet<Class<? extends Phase>>(); + private final Set<Class<? extends Phase>> disabledPhases = new HashSet<>(); public void addPhase(PhasePosition pos, Phase phase) { if (phases[pos.ordinal()] == null) { - phases[pos.ordinal()] = new ArrayList<Phase>(); + phases[pos.ordinal()] = new ArrayList<>(); } phases[pos.ordinal()].add(phase); }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/RemoveInductionVariablesPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/RemoveInductionVariablesPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -47,7 +47,7 @@ for (InductionVariableNode iv2 : inductionVariables) { if (iv1 != iv2 && iv1.isNextIteration(iv2)) { if (nextIterOf == null) { - nextIterOf = new IdentityHashMap<InductionVariableNode, InductionVariableNode>(); + nextIterOf = new IdentityHashMap<>(); } nextIterOf.put(iv2, iv1); }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/SnippetIntrinsificationPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/SnippetIntrinsificationPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.max.graal.compiler.phases; -import java.lang.annotation.*; import java.lang.reflect.*; import com.oracle.max.graal.graph.*; @@ -102,19 +101,7 @@ return nodeConstructorArguments; } - private Method findMethod(RiResolvedMethod target, Class< ? >[] parameterTypes) { - Class< ? > c = target.holder().toJava(); - if (c != null) { - try { - return c.getDeclaredMethod(target.name(), parameterTypes); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - return null; - } - - private Class< ? > getNodeClass(RiResolvedMethod target, NodeIntrinsic intrinsic) { + private static Class< ? > getNodeClass(RiResolvedMethod target, NodeIntrinsic intrinsic) { Class< ? > result = intrinsic.value(); if (result == NodeIntrinsic.class) { result = target.holder().toJava(); @@ -123,17 +110,6 @@ return result; } - private ConstantNodeParameter findConstantParameterAnnotation(int parameterIndex, Annotation[][] parameterAnnotations) { - if (parameterIndex >= 0) { - for (Annotation a : parameterAnnotations[parameterIndex]) { - if (a instanceof ConstantNodeParameter) { - return (ConstantNodeParameter) a; - } - } - } - return null; - } - private ValueNode tryBoxingElimination(int parameterIndex, RiResolvedMethod target, ValueNode node) { if (parameterIndex >= 0) { Type type = target.getGenericParameterTypes()[parameterIndex]; @@ -169,7 +145,7 @@ return node; } - private Node createNodeInstance(Class< ? > nodeClass, Class< ? >[] parameterTypes, Object[] nodeConstructorArguments) { + private static Node createNodeInstance(Class< ? > nodeClass, Class< ? >[] parameterTypes, Object[] nodeConstructorArguments) { Constructor< ? > constructor; try {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/Block.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/Block.java Sun Dec 18 05:24:06 2011 +0100 @@ -32,13 +32,12 @@ public class Block { private int blockID; - protected final List<Block> successors = new ArrayList<Block>(); - protected final List<Block> predecessors = new ArrayList<Block>(); - private final List<Block> dominated = new ArrayList<Block>(); - private List<Node> instructions = new ArrayList<Node>(); + protected final List<Block> successors = new ArrayList<>(); + protected final List<Block> predecessors = new ArrayList<>(); + private final List<Block> dominated = new ArrayList<>(); + private List<Node> instructions = new ArrayList<>(); private Block alwaysReachedBlock; private Block dominator; - private FixedNode anchor; private EndNode end; private int loopDepth = 0; private int loopIndex = -1; @@ -53,7 +52,6 @@ public void setFirstNode(Node node) { this.firstNode = node; - this.anchor = null; } public Block alwaysReachedBlock() { @@ -171,7 +169,7 @@ } } - private void iterateReverse(IdentityHashMap<Block, Block> mark, BlockClosure closure, List<Block> list) { + private static void iterateReverse(IdentityHashMap<Block, Block> mark, BlockClosure closure, List<Block> list) { for (int i = list.size() - 1; i >= 0; i--) { list.get(i).iterate(mark, closure); } @@ -199,7 +197,7 @@ } public static void iteratePostOrder(List<Block> blocks, BlockClosure closure) { - ArrayList<Block> startBlocks = new ArrayList<Block>(); + ArrayList<Block> startBlocks = new ArrayList<>(); for (Block block : blocks) { if (block.getPredecessors().size() == 0) { startBlocks.add(block); @@ -210,7 +208,7 @@ public static void iteratePostOrder(List<Block> blocks, BlockClosure closure, Block... startBlocks) { BitMap visited = new BitMap(blocks.size()); - LinkedList<Block> workList = new LinkedList<Block>(); + LinkedList<Block> workList = new LinkedList<>(); for (Block block : startBlocks) { workList.add(block); visited.set(block.blockID());
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -45,11 +45,10 @@ } private final BlockFactory blockFactory; - private final List<Block> blocks = new ArrayList<Block>(); + private final List<Block> blocks = new ArrayList<>(); private NodeMap<Block> nodeToBlock; private NodeMap<Block> earliestCache; private Block startBlock; - private StructuredGraph graph; private boolean scheduleAllNodes; private int loopCount; @@ -75,7 +74,7 @@ b.setAlwaysReachedBlock(b.getSuccessors().get(0)); } else if (b.getSuccessors().size() > 1) { BitMap blockBitMap = new BitMap(blocks.size()); - List<Block> visitedBlocks = new ArrayList<Block>(); + List<Block> visitedBlocks = new ArrayList<>(); // Do a fill starting at the dominated blocks and going upwards over predecessors. for (Block dominated : b.getDominated()) { @@ -140,10 +139,9 @@ @Override protected void run(StructuredGraph graph) { - this.graph = graph; nodeToBlock = graph.createNodeMap(); earliestCache = graph.createNodeMap(); - identifyBlocks(); + identifyBlocks(graph); } public Block getStartBlock() { @@ -168,7 +166,8 @@ return loopCount; } - private Block assignBlockNew(Node n, Block b) { + private Block assignBlockNew(Node n, Block block, StructuredGraph graph) { + Block b = block; if (b == null) { b = createBlock(); } @@ -216,25 +215,7 @@ return trueSuccessorCount(n) > 1 || n instanceof ReturnNode || n instanceof UnwindNode || n instanceof DeoptimizeNode; } - private void print(boolean instructions) { - Block dominatorRoot = nodeToBlock.get(graph.start()); - TTY.println("Root = " + dominatorRoot); - TTY.println("nodeToBlock :"); - TTY.println(nodeToBlock.toString()); - TTY.println("Blocks :"); - for (Block b : blocks) { - TTY.println(b + " [S:" + b.getSuccessors() + ", P:" + b.getPredecessors() + ", D:" + b.getDominated()); - if (instructions) { - TTY.println(" f " + b.firstNode()); - for (Node n : b.getInstructions()) { - TTY.println(" - " + n); - } - TTY.println(" l " + b.lastNode()); - } - } - } - - private void identifyBlocks() { + private void identifyBlocks(StructuredGraph graph) { // Identify blocks. for (Node n : graph.getNodes()) { @@ -243,7 +224,7 @@ Node currentNode = n; Node prev = null; while (nodeToBlock.get(currentNode) == null) { - block = assignBlockNew(currentNode, block); + block = assignBlockNew(currentNode, block, graph); if (currentNode instanceof FixedNode) { block.setProbability(((FixedNode) currentNode).probability()); } @@ -283,12 +264,12 @@ } } - computeDominators(); + computeDominators(graph); if (scheduleAllNodes) { computeLoopInformation(); // Will make the graph cyclic. - assignBlockToNodes(); - sortNodesWithinBlocks(); + assignBlockToNodes(graph); + sortNodesWithinBlocks(graph); } } @@ -333,7 +314,7 @@ } } - private void assignBlockToNodes() { + private void assignBlockToNodes(StructuredGraph graph) { for (Node n : graph.getNodes()) { assignBlockToNode(n); } @@ -390,8 +371,8 @@ this.block = block; } @Override - public void apply(Block block) { - this.block = getCommonDominator(this.block, block); + public void apply(Block newBlock) { + this.block = getCommonDominator(this.block, newBlock); } } @@ -405,7 +386,7 @@ return earliest; } BitMap bits = new BitMap(blocks.size()); - ArrayList<Node> before = new ArrayList<Node>(); + ArrayList<Node> before = new ArrayList<>(); if (n.predecessor() != null) { before.add(n.predecessor()); } @@ -426,7 +407,7 @@ } } if (earliest == null) { - Block start = nodeToBlock.get(graph.start()); + Block start = nodeToBlock.get(((StructuredGraph) n.graph()).start()); assert start != null; return start; } @@ -435,7 +416,7 @@ } - private Block scheduleOutOfLoops(Node n, Block latestBlock, Block earliest) { + private static Block scheduleOutOfLoops(Node n, Block latestBlock, Block earliest) { assert latestBlock != null : "no latest : " + n; Block cur = latestBlock; Block result = latestBlock; @@ -503,7 +484,7 @@ return commonDominator(a, b); } - private void sortNodesWithinBlocks() { + private void sortNodesWithinBlocks(StructuredGraph graph) { NodeBitMap map = graph.createNodeBitMap(); for (Block b : blocks) { sortNodesWithinBlocks(b, map); @@ -512,7 +493,7 @@ private void sortNodesWithinBlocks(Block b, NodeBitMap map) { List<Node> instructions = b.getInstructions(); - List<Node> sortedInstructions = new ArrayList<Node>(instructions.size() + 2); + List<Node> sortedInstructions = new ArrayList<>(instructions.size() + 2); assert !map.isMarked(b.firstNode()) && nodeToBlock.get(b.firstNode()) == b; assert !map.isMarked(b.lastNode()) && nodeToBlock.get(b.lastNode()) == b; @@ -586,13 +567,13 @@ sortedInstructions.add(i); } - private void computeDominators() { + private void computeDominators(StructuredGraph graph) { Block dominatorRoot = nodeToBlock.get(graph.start()); assert dominatorRoot != null; assert dominatorRoot.getPredecessors().size() == 0; BitMap visited = new BitMap(blocks.size()); visited.set(dominatorRoot.blockID()); - LinkedList<Block> workList = new LinkedList<Block>(); + LinkedList<Block> workList = new LinkedList<>(); workList.add(dominatorRoot); int cnt = 0;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ArithmeticOpcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ArithmeticOpcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -46,11 +46,9 @@ return new AMD64LIRInstruction(this, result, null, inputs, alives, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue left = input(0); - CiValue right = alive(0); - assert !(right instanceof CiRegisterValue) || tasm.asRegister(result()) != tasm.asRegister(right) : "result and right must be different registers"; - AMD64MoveOpcode.move(tasm, masm, result(), left); - emit(tasm, masm, result(), right); + assert !(alive(0) instanceof CiRegisterValue) || tasm.asRegister(result()) != tasm.asRegister(alive(0)) : "result and right must be different registers"; + AMD64MoveOpcode.move(tasm, masm, result(), input(0)); + emit(tasm, masm, result(), alive(0)); } @Override
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Backend.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Backend.java Sun Dec 18 05:24:06 2011 +0100 @@ -72,7 +72,7 @@ public CompilerStub emit(GraalContext context, Id stub) { final GraalCompilation comp = new GraalCompilation(context, compiler, null, -1, null, DebugInfoLevel.FULL); try { - return new AMD64CompilerStubEmitter(context, comp, stub.arguments, stub.resultKind).emit(stub); + return new AMD64CompilerStubEmitter(comp, stub.arguments, stub.resultKind).emit(stub); } finally { comp.close(); } @@ -82,7 +82,7 @@ public CompilerStub emit(GraalContext context, CiRuntimeCall rtCall) { final GraalCompilation comp = new GraalCompilation(context, compiler, null, -1, null, DebugInfoLevel.FULL); try { - return new AMD64CompilerStubEmitter(context, comp, rtCall.arguments, rtCall.resultKind).emit(rtCall); + return new AMD64CompilerStubEmitter(comp, rtCall.arguments, rtCall.resultKind).emit(rtCall); } finally { comp.close(); } @@ -102,7 +102,7 @@ public CompilerStub emit(GraalContext context, XirTemplate t) { final GraalCompilation comp = new GraalCompilation(context, compiler, null, -1, null, DebugInfoLevel.FULL); try { - return new AMD64CompilerStubEmitter(context, comp, getArgumentKinds(t), t.resultOperand.kind).emit(t); + return new AMD64CompilerStubEmitter(comp, getArgumentKinds(t), t.resultOperand.kind).emit(t); } finally { comp.close(); }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CallOpcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CallOpcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -81,7 +81,7 @@ } - public void callAlignment(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { + public static void callAlignment(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { if (GraalOptions.AlignCallsForPatching) { // make sure that the displacement word of the call ends up word aligned int offset = masm.codeBuffer.position(); @@ -92,7 +92,7 @@ } } - public static void callStub(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CompilerStub stub, CiKind resultKind, LIRDebugInfo info, CiValue result, CiValue... args) { + public static void callStub(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CompilerStub stub, LIRDebugInfo info, CiValue result, CiValue... args) { assert args.length == stub.inArgs.length; for (int i = 0; i < args.length; i++) { assert stub.inArgs[i].inCallerFrame();
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CompareOpcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CompareOpcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -43,9 +43,7 @@ return new AMD64LIRInstruction(this, CiValue.IllegalValue, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue left = input(0); - CiValue right = input(1); - emit(tasm, masm, left, right); + emit(tasm, masm, input(0), input(1)); } @Override
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CompilerStubEmitter.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64CompilerStubEmitter.java Sun Dec 18 05:24:06 2011 +0100 @@ -68,22 +68,19 @@ /** * The layout of the callee save area of the stub being emitted. */ - private CiCalleeSaveLayout csl; + private CiCalleeSaveLayout calleeSaveLayout; /** * The compilation object for the stub being emitted. */ private final GraalCompilation comp; - private final GraalContext context; - private final TargetMethodAssembler tasm; private final AMD64MacroAssembler asm; - public AMD64CompilerStubEmitter(GraalContext context, GraalCompilation compilation, CiKind[] argTypes, CiKind resultKind) { - compilation.initFrameMap(0); + public AMD64CompilerStubEmitter(GraalCompilation compilation, CiKind[] argTypes, CiKind resultKind) { + compilation.initFrameMap(); this.comp = compilation; - this.context = context; final RiRegisterConfig registerConfig = compilation.compiler.compilerStubRegisterConfig; this.asm = new AMD64MacroAssembler(compilation.compiler.target, registerConfig); this.tasm = new TargetMethodAssembler(compilation, asm); @@ -134,7 +131,7 @@ return new CompilerStub(stub, stub.resultKind, stubObject, inArgs, outResult); } - private CiValue allocateOperand(XirTemp temp, ArrayList<CiRegister> allocatableRegisters) { + private static CiValue allocateOperand(XirTemp temp, ArrayList<CiRegister> allocatableRegisters) { if (temp instanceof XirRegister) { XirRegister fixed = (XirRegister) temp; return fixed.register; @@ -143,14 +140,14 @@ return newRegister(temp.kind, allocatableRegisters); } - private CiValue newRegister(CiKind kind, ArrayList<CiRegister> allocatableRegisters) { + private static CiValue newRegister(CiKind kind, ArrayList<CiRegister> allocatableRegisters) { assert kind != CiKind.Float && kind != CiKind.Double; assert allocatableRegisters.size() > 0; return allocatableRegisters.remove(allocatableRegisters.size() - 1).asValue(kind); } public CompilerStub emit(XirTemplate template) { - ArrayList<CiRegister> allocatableRegisters = new ArrayList<CiRegister>(Arrays.asList(comp.registerConfig.getCategorizedAllocatableRegisters().get(RegisterFlag.CPU))); + ArrayList<CiRegister> allocatableRegisters = new ArrayList<>(Arrays.asList(comp.registerConfig.getCategorizedAllocatableRegisters().get(RegisterFlag.CPU))); for (XirTemp t : template.temps) { if (t instanceof XirRegister) { final XirRegister fixed = (XirRegister) t; @@ -223,15 +220,6 @@ return new CompilerStub(null, template.resultOperand.kind, stubObject, inArgs, outResult); } - private CiKind[] getArgumentKinds(XirTemplate template) { - CiXirAssembler.XirParameter[] params = template.parameters; - CiKind[] result = new CiKind[params.length]; - for (int i = 0; i < params.length; i++) { - result[i] = params[i].kind; - } - return result; - } - private void convertPrologue() { prologue(new CiCalleeSaveLayout(0, -1, comp.compiler.target.wordSize, convertArgument, convertResult)); asm.movq(convertArgument, comp.frameMap().toStackAddress(inArgs[0])); @@ -258,7 +246,8 @@ emitCOMISSD(false, true); } - private void emitCOMISSD(boolean isDouble, boolean isInt) { + private void emitCOMISSD(boolean isDouble, @SuppressWarnings("unused") boolean isInt) { + // TODO(tw): Check why isInt is never checked? convertPrologue(); if (isDouble) { asm.ucomisd(convertArgument, tasm.asDoubleConstRef(CiConstant.DOUBLE_0)); @@ -298,9 +287,9 @@ } private void prologue(CiCalleeSaveLayout csl) { - assert this.csl == null; + assert this.calleeSaveLayout == null; assert csl != null : "stub should define a callee save area"; - this.csl = csl; + this.calleeSaveLayout = csl; int entryCodeOffset = comp.compiler.runtime.codeOffset(); if (entryCodeOffset != 0) { // pad to normal code entry point @@ -317,8 +306,8 @@ tasm.targetMethod.setRegisterRestoreEpilogueOffset(asm.codeBuffer.position()); // Restore registers - int frameToCSA = csl.frameOffsetToCSA; - asm.restore(csl, frameToCSA); + int frameToCSA = calleeSaveLayout.frameOffsetToCSA; + asm.restore(calleeSaveLayout, frameToCSA); // Restore rsp asm.addq(AMD64.rsp, frameSize()); @@ -326,7 +315,7 @@ } private int frameSize() { - return comp.compiler.target.alignFrameSize(csl.size); + return comp.compiler.target.alignFrameSize(calleeSaveLayout.size); } private void forwardRuntimeCall(CiRuntimeCall call) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ControlFlowOpcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ControlFlowOpcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -121,7 +121,7 @@ return new LIRBranch(this, cond, unorderedIsTrue, label, info) { @Override public void emitCode(TargetMethodAssembler tasm) { - floatJcc(tasm, (AMD64MacroAssembler) tasm.asm, cond, unorderedIsTrue, destination.label()); + floatJcc((AMD64MacroAssembler) tasm.asm, cond, unorderedIsTrue, destination.label()); } @Override @@ -143,9 +143,7 @@ return new AMD64LIRInstruction(this, CiValue.IllegalValue, null, LIRInstruction.NO_OPERANDS, alives, temps) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue index = alive(0); - CiValue scratch = temp(0); - tableswitch(tasm, masm, lowKey, defaultTarget, targets, tasm.asIntReg(index), tasm.asLongReg(scratch)); + tableswitch(tasm, masm, lowKey, defaultTarget, targets, tasm.asIntReg(alive(0)), tasm.asLongReg(temp(0))); } @Override @@ -174,9 +172,7 @@ return new AMD64LIRInstruction(this, result, null, inputs, alives, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue trueValue = alive(0); - CiValue falseValue = input(0); - cmove(tasm, masm, result(), false, condition, false, trueValue, falseValue); + cmove(tasm, masm, result(), false, condition, false, alive(0), input(0)); } @Override @@ -202,9 +198,7 @@ return new AMD64LIRInstruction(this, result, null, LIRInstruction.NO_OPERANDS, alives, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue trueValue = alive(0); - CiValue falseValue = alive(1); - cmove(tasm, masm, result(), true, condition, unorderedIsTrue, trueValue, falseValue); + cmove(tasm, masm, result(), true, condition, unorderedIsTrue, alive(0), alive(1)); } @Override @@ -272,7 +266,7 @@ tasm.targetMethod.addAnnotation(jt); } - private static void floatJcc(TargetMethodAssembler tasm, AMD64MacroAssembler masm, Condition condition, boolean unorderedIsTrue, Label label) { + private static void floatJcc(AMD64MacroAssembler masm, Condition condition, boolean unorderedIsTrue, Label label) { ConditionFlag cond = floatCond(condition); Label endLabel = new Label(); if (unorderedIsTrue && !trueOnUnordered(cond)) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ConvertFIOpcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ConvertFIOpcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -40,8 +40,7 @@ return new AMD64LIRInstruction(this, result, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue input = input(0); - emit(tasm, masm, result(), stub, input); + emit(tasm, masm, result(), stub, input(0)); } }; } @@ -56,7 +55,7 @@ Label endLabel = new Label(); masm.cmp32(tasm.asIntReg(result), Integer.MIN_VALUE); masm.jcc(ConditionFlag.notEqual, endLabel); - AMD64CallOpcode.callStub(tasm, masm, stub, stub.resultKind, null, result, input); + AMD64CallOpcode.callStub(tasm, masm, stub, null, result, input); masm.bind(endLabel); } }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ConvertFLOpcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ConvertFLOpcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -41,9 +41,7 @@ return new AMD64LIRInstruction(this, result, null, inputs, LIRInstruction.NO_OPERANDS, temps) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue input = input(0); - CiValue scratch = temp(0); - emit(tasm, masm, result(), stub, input, scratch); + emit(tasm, masm, result(), stub, input(0), temp(0)); } }; } @@ -61,7 +59,7 @@ masm.movq(tmp, java.lang.Long.MIN_VALUE); masm.cmpq(dst, tmp); masm.jcc(ConditionFlag.notEqual, endLabel); - AMD64CallOpcode.callStub(tasm, masm, stub, stub.resultKind, null, result, input); + AMD64CallOpcode.callStub(tasm, masm, stub, null, result, input); masm.bind(endLabel); } }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ConvertOpcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ConvertOpcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -41,8 +41,7 @@ return new AMD64LIRInstruction(this, result, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue input = input(0); - emit(tasm, masm, result(), input); + emit(tasm, masm, result(), input(0)); } @Override
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64DeoptimizationStub.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64DeoptimizationStub.java Sun Dec 18 05:24:06 2011 +0100 @@ -46,7 +46,7 @@ } - private static ArrayList<Object> keepAlive = new ArrayList<Object>(); + private static ArrayList<Object> keepAlive = new ArrayList<>(); @Override public void emitCode(TargetMethodAssembler tasm) {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64DivOpcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64DivOpcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -42,9 +42,7 @@ return new AMD64LIRInstruction(this, result, info, inputs, alives, temps) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue left = input(0); - CiValue right = alive(0); - emit(tasm, masm, tasm.asRegister(result()), info, tasm.asRegister(left), tasm.asRegister(right)); + emit(tasm, masm, tasm.asRegister(result()), info, tasm.asRegister(input(0)), tasm.asRegister(alive(0))); } }; }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LIRGenerator.java Sun Dec 18 05:24:06 2011 +0100 @@ -58,7 +58,6 @@ private static final CiRegisterValue RAX_I = AMD64.rax.asValue(CiKind.Int); private static final CiRegisterValue RAX_L = AMD64.rax.asValue(CiKind.Long); - private static final CiRegisterValue RAX_O = AMD64.rax.asValue(CiKind.Object); private static final CiRegisterValue RDX_I = AMD64.rdx.asValue(CiKind.Int); private static final CiRegisterValue RDX_L = AMD64.rdx.asValue(CiKind.Long); private static final CiRegisterValue RCX_I = AMD64.rcx.asValue(CiKind.Int);
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LogicFloatOpcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64LogicFloatOpcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -42,11 +42,9 @@ return new AMD64LIRInstruction(this, result, null, inputs, alives, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue left = input(0); - CiValue right = alive(0); - assert !(right instanceof CiRegisterValue) || tasm.asRegister(result()) != tasm.asRegister(right) : "result and right must be different registers"; - AMD64MoveOpcode.move(tasm, masm, result(), left); - emit(tasm, masm, result(), right); + assert !(alive(0) instanceof CiRegisterValue) || tasm.asRegister(result()) != tasm.asRegister(alive(0)) : "result and right must be different registers"; + AMD64MoveOpcode.move(tasm, masm, result(), input(0)); + emit(tasm, masm, result(), alive(0)); } @Override
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64MoveOpcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64MoveOpcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -46,8 +46,7 @@ return new AMD64LIRInstruction(this, result, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue input = input(0); - move(tasm, masm, result(), input); + move(tasm, masm, result(), input(0)); } @Override @@ -68,9 +67,7 @@ return new AMD64LIRInstruction(this, result, info, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue addrBase = input(0); - CiValue addrIndex = input(1); - load(tasm, masm, result(), new CiAddress(CiKind.Illegal, addrBase, addrIndex, addrScale, addrDisplacement), kind, info); + load(tasm, masm, result(), new CiAddress(CiKind.Illegal, input(0), input(1), addrScale, addrDisplacement), kind, info); } }; } @@ -86,11 +83,7 @@ return new AMD64LIRInstruction(this, CiValue.IllegalValue, info, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue addrBase = input(0); - CiValue addrIndex = input(1); - CiValue input = input(2); - - store(tasm, masm, new CiAddress(CiKind.Illegal, addrBase, addrIndex, addrScale, addrDisplacement), input, kind, info); + store(tasm, masm, new CiAddress(CiKind.Illegal, input(0), input(1), addrScale, addrDisplacement), input(2), kind, info); } }; } @@ -106,9 +99,7 @@ return new AMD64LIRInstruction(this, result, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue addrBase = input(0); - CiValue addrIndex = input(1); - masm.leaq(tasm.asLongReg(result()), new CiAddress(CiKind.Illegal, addrBase, addrIndex, addrScale, addrDisplacement)); + masm.leaq(tasm.asLongReg(result()), new CiAddress(CiKind.Illegal, input(0), input(1), addrScale, addrDisplacement)); } }; } @@ -157,9 +148,8 @@ return new AMD64LIRInstruction(this, CiValue.IllegalValue, info, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue input = input(0); tasm.recordImplicitException(masm.codeBuffer.position(), info); - masm.nullCheck(tasm.asRegister(input)); + masm.nullCheck(tasm.asRegister(input(0))); } }; } @@ -175,12 +165,7 @@ return new AMD64LIRInstruction(this, result, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue addrBase = input(0); - CiValue addrIndex = input(1); - CiValue cmpValue = input(2); - CiValue newValue = input(3); - - compareAndSwap(tasm, masm, result(), new CiAddress(CiKind.Illegal, addrBase, addrIndex, addrScale, addrDisplacement), cmpValue, newValue); + compareAndSwap(tasm, masm, result(), new CiAddress(CiKind.Illegal, input(0), input(1), addrScale, addrDisplacement), input(2), input(3)); } }; }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64MulOpcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64MulOpcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -38,11 +38,9 @@ return new AMD64LIRInstruction(this, result, null, inputs, alives, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue left = input(0); - CiValue right = alive(0); - assert !(right instanceof CiRegisterValue) || tasm.asRegister(result()) != tasm.asRegister(right) : "result and right must be different registers"; - AMD64MoveOpcode.move(tasm, masm, result(), left); - emit(tasm, masm, result(), right); + assert !(alive(0) instanceof CiRegisterValue) || tasm.asRegister(result()) != tasm.asRegister(alive(0)) : "result and right must be different registers"; + AMD64MoveOpcode.move(tasm, masm, result(), input(0)); + emit(tasm, masm, result(), alive(0)); } @Override
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Op1Opcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64Op1Opcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -37,8 +37,7 @@ return new AMD64LIRInstruction(this, result, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue input = input(0); - AMD64MoveOpcode.move(tasm, masm, result(), input); + AMD64MoveOpcode.move(tasm, masm, result(), input(0)); emit(tasm, masm, result()); }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ShiftOpcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64ShiftOpcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -39,11 +39,9 @@ return new AMD64LIRInstruction(this, result, null, inputs, alives, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue left = input(0); - CiValue right = alive(0); - assert !(right instanceof CiRegisterValue) || tasm.asRegister(result()) != tasm.asRegister(right) : "result and right must be different registers"; - AMD64MoveOpcode.move(tasm, masm, result(), left); - emit(tasm, masm, result(), right); + assert !(alive(0) instanceof CiRegisterValue) || tasm.asRegister(result()) != tasm.asRegister(alive(0)) : "result and right must be different registers"; + AMD64MoveOpcode.move(tasm, masm, result(), input(0)); + emit(tasm, masm, result(), alive(0)); } @Override
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64XirAssembler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64XirAssembler.java Sun Dec 18 05:24:06 2011 +0100 @@ -41,9 +41,9 @@ @Override protected XirTemplate buildTemplate(String name, boolean isStub) { - List<XirInstruction> fastPath = new ArrayList<XirInstruction>(instructions.size()); - List<XirInstruction> slowPath = new ArrayList<XirInstruction>(); - List<XirTemplate> calleeTemplates = new ArrayList<XirTemplate>(); + List<XirInstruction> fastPath = new ArrayList<>(instructions.size()); + List<XirInstruction> slowPath = new ArrayList<>(); + List<XirTemplate> calleeTemplates = new ArrayList<>(); int flags = 0; @@ -58,7 +58,7 @@ XirOperand fixedRCX = null; XirOperand fixedRSI = null; XirOperand fixedRDI = null; - HashSet<XirLabel> boundLabels = new HashSet<XirLabel>(); + HashSet<XirLabel> boundLabels = new HashSet<>(); for (XirInstruction i : instructions) { boolean appended = false;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64XirOpcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/target/amd64/AMD64XirOpcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -35,7 +35,6 @@ import com.oracle.max.graal.compiler.asm.*; import com.oracle.max.graal.compiler.lir.*; import com.oracle.max.graal.compiler.util.*; -import com.oracle.max.graal.nodes.calc.*; import com.sun.cri.ci.*; import com.sun.cri.ci.CiTargetMethod.Mark; import com.sun.cri.ri.*; @@ -307,7 +306,7 @@ for (int i = 0; i < args.length; i++) { args[i] = operands[inst.arguments[i].index]; } - AMD64CallOpcode.callStub(tasm, masm, tasm.compilation.compiler.lookupStub(stubId), stubId.resultOperand.kind, info, result, args); + AMD64CallOpcode.callStub(tasm, masm, tasm.compilation.compiler.lookupStub(stubId), info, result, args); break; } case CallRuntime: { @@ -359,42 +358,42 @@ } case Jeq: { Label label = labels[((XirLabel) inst.extra).index]; - emitXirCompare(tasm, masm, inst, Condition.EQ, ConditionFlag.equal, operands, label); + emitXirCompare(tasm, masm, inst, ConditionFlag.equal, operands, label); break; } case Jneq: { Label label = labels[((XirLabel) inst.extra).index]; - emitXirCompare(tasm, masm, inst, Condition.NE, ConditionFlag.notEqual, operands, label); + emitXirCompare(tasm, masm, inst, ConditionFlag.notEqual, operands, label); break; } case Jgt: { Label label = labels[((XirLabel) inst.extra).index]; - emitXirCompare(tasm, masm, inst, Condition.GT, ConditionFlag.greater, operands, label); + emitXirCompare(tasm, masm, inst, ConditionFlag.greater, operands, label); break; } case Jgteq: { Label label = labels[((XirLabel) inst.extra).index]; - emitXirCompare(tasm, masm, inst, Condition.GE, ConditionFlag.greaterEqual, operands, label); + emitXirCompare(tasm, masm, inst, ConditionFlag.greaterEqual, operands, label); break; } case Jugteq: { Label label = labels[((XirLabel) inst.extra).index]; - emitXirCompare(tasm, masm, inst, Condition.AE, ConditionFlag.aboveEqual, operands, label); + emitXirCompare(tasm, masm, inst, ConditionFlag.aboveEqual, operands, label); break; } case Jlt: { Label label = labels[((XirLabel) inst.extra).index]; - emitXirCompare(tasm, masm, inst, Condition.LT, ConditionFlag.less, operands, label); + emitXirCompare(tasm, masm, inst, ConditionFlag.less, operands, label); break; } case Jlteq: { Label label = labels[((XirLabel) inst.extra).index]; - emitXirCompare(tasm, masm, inst, Condition.LE, ConditionFlag.lessEqual, operands, label); + emitXirCompare(tasm, masm, inst, ConditionFlag.lessEqual, operands, label); break; } @@ -545,7 +544,7 @@ } } - private static void emitXirCompare(TargetMethodAssembler tasm, AMD64MacroAssembler masm, XirInstruction inst, Condition condition, ConditionFlag cflag, CiValue[] ops, Label label) { + private static void emitXirCompare(TargetMethodAssembler tasm, AMD64MacroAssembler masm, XirInstruction inst, ConditionFlag cflag, CiValue[] ops, Label label) { CiValue x = ops[inst.x().index]; CiValue y = ops[inst.y().index]; AMD64CompareOpcode code;
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/ComputeImmediateDominator.java Sun Dec 18 05:23:52 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,256 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.graal.compiler.util; - -import java.util.*; - -import com.oracle.max.graal.graph.*; -import com.oracle.max.graal.nodes.*; - - -public final class ComputeImmediateDominator { - private final MergeNode dominated; - private final Queue<FixedNode> toExplore; - private final Queue<FixedNode> speculativeExplore; - private final NodeMap<DominatorInfo> infoMap; - private final DominatorInfo fullInfo; - private FixedNode dominator; - private int nextBit = 1; - - public ComputeImmediateDominator(MergeNode dominated) { - this.dominated = dominated; - this.toExplore = new LinkedList<FixedNode>(); - this.speculativeExplore = new LinkedList<FixedNode>(); - this.infoMap = dominated.graph().createNodeMap(); - fullInfo = new DominatorInfo(dominated, true); - - this.processMerge(dominated, fullInfo); - if (toExplore.size() == 1) { - dominator = toExplore.remove(); - } - } - - public FixedNode compute() { - try { - while (dominator == null && (!toExplore.isEmpty() || !speculativeExplore.isEmpty())) { - while (!toExplore.isEmpty()) { - exploreUp(toExplore.remove()); - if (dominator != null) { - return dominator; - } - } - exploreUp(speculativeExplore.remove()); - } - return dominator; - } catch (Throwable t) { - throw new GraalInternalError(t).addContext("Could not find a dominator").addContext(dominated); - } - } - - private void exploreUp(FixedNode from) { - FixedNode p = from; - DominatorInfo info = infoMap.get(from); - if (info.isExplored()) { - return; - } - //TTY.println("exploreUp(" + from + ") with " + info); - info.setExplored(); - while (p != null) { - if (p instanceof MergeNode) { - processMerge((MergeNode) p, info); - p = null; - } else if (p instanceof ControlSplitNode) { - processControlSplit((ControlSplitNode) p, info); - p = null; - } else { - p = (FixedNode) p.predecessor(); - } - } - } - - private void processControlSplit(ControlSplitNode cs, DominatorInfo info) { - //TTY.println("processControlSplit(" + cs + ", " + info + ")"); - DominatorInfo csInfo = infoMap.get(cs); - if (csInfo == null) { - csInfo = new DominatorInfo(cs, false); - infoMap.set(cs, csInfo); - } - csInfo.add(info); - FixedNode next = (FixedNode) cs.predecessor(); - if (checkControlSplitInfo(csInfo)) { - return; - } - if (csInfo.isExplored()) { - //TTY.println(" Already explored, propagate update"); - propagateUpdate(csInfo); - } else { - if (csInfo.parentCount() == cs.blockSuccessorCount()) { // all paths leading to this CS have been explored - //TTY.println(" All parents explored, Enqueue"); - toExplore.add(next); - speculativeExplore.remove(next); - } else { - //TTY.println(" Not all parents explored : Enqueue speculative"); - speculativeExplore.add(next); - } - } - infoMap.set(next, csInfo); - } - - private boolean propagateUpdate(DominatorInfo di) { - //TTY.println(" propagateUpdate(" + di + ")"); - for (DominatorInfo child : di.children()) { - //TTY.println(" add to child " + child); - if (child.add(di, false)) { - if (child.equals(fullInfo)) { - //TTY.println(" Found DOM!"); - dominator = child.node(); - return true; - } - if (propagateUpdate(child)) { - return true; - } - } - } - return false; - } - - private boolean checkControlSplitInfo(DominatorInfo di) { - //TTY.println(" checkControlSplitInfo(" + di + ")"); - if (di.equals(fullInfo)) { - dominator = di.node(); - //TTY.println(" Found DOM!"); - return true; - } - return false; - } - - private void processMerge(MergeNode merge, DominatorInfo info) { - //TTY.println("processMerge(" + merge + ", " + info + ")"); - for (EndNode end : merge.cfgPredecessors()) { - toExplore.add(end); - infoMap.set(end, info.createChild(end)); - //TTY.println(" Enqueue end : " + end + " with " + infoMap.get(end)); - } - } - - private class DominatorInfo { - private final FixedNode node; - private final BitSet bits; - private final BitSet ownBits; - private final Collection<DominatorInfo> children; - private final Collection<DominatorInfo> parents; - private boolean explored; - - public DominatorInfo(FixedNode node, boolean full) { - this.node = node; - this.bits = new BitSet(); - this.ownBits = new BitSet(); - this.children = new ArrayList<DominatorInfo>(2); - this.parents = new ArrayList<DominatorInfo>(2); - if (full) { - addOwnBits(0); - } - } - - public boolean isExplored() { - return explored; - } - - public void setExplored() { - explored = true; - } - - public DominatorInfo createChild(FixedNode node) { - DominatorInfo di = new DominatorInfo(node, false); - di.bits.or(bits); - di.ownBits.or(ownBits); - if (!children.isEmpty() || di.ownBits.isEmpty()) { - int newBit = nextBit++; - di.bits.xor(ownBits); - di.bits.set(newBit); - di.ownBits.clear(); - di.ownBits.set(newBit); - addOwnBits(newBit); - } - children.add(di); - di.parents.add(this); - return di; - } - - private void addOwnBits(int newBit) { - if (!bits.get(newBit)) { - ownBits.set(newBit); - bits.set(newBit); - for (DominatorInfo parent : parents) { - parent.addOwnBits(newBit); - } - } - } - - public boolean add(DominatorInfo i) { - return add(i, true); - } - - public boolean add(DominatorInfo i, boolean addParent) { - boolean ret = true; - if (addParent) { - parents.add(i); - i.children.add(this); - bits.or(i.bits); - } else { - BitSet newBits = (BitSet) i.bits.clone(); - newBits.andNot(bits); - newBits.andNot(i.ownBits); - ret = !newBits.isEmpty(); - bits.or(newBits); - } - return ret; - } - - public int parentCount() { - return parents.size(); - } - - - public FixedNode node() { - return node; - } - - public Collection<DominatorInfo> children() { - return children; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof DominatorInfo)) { - return false; - } - return ((DominatorInfo) obj).bits.equals(bits); - } - - @Override - public String toString() { - return bits + " (o" + ownBits + ") " + node; - } - } -}
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/InliningUtil.java Sun Dec 18 05:24:06 2011 +0100 @@ -48,15 +48,15 @@ } public static String methodName(RiResolvedMethod method) { - return CiUtil.format("%H.%n(%p):%r", method, false) + " (" + method.codeSize() + " bytes)"; + return CiUtil.format("%H.%n(%p):%r", method) + " (" + method.codeSize() + " bytes)"; } private static String methodName(RiResolvedMethod method, Invoke invoke) { if (invoke != null && invoke.stateAfter() != null) { RiMethod parent = invoke.stateAfter().method(); - return parent.name() + "@" + invoke.bci() + ": " + CiUtil.format("%H.%n(%p):%r", method, false) + " (" + method.codeSize() + " bytes)"; + return parent.name() + "@" + invoke.bci() + ": " + CiUtil.format("%H.%n(%p):%r", method) + " (" + method.codeSize() + " bytes)"; } else { - return CiUtil.format("%H.%n(%p):%r", method, false) + " (" + method.codeSize() + " bytes)"; + return CiUtil.format("%H.%n(%p):%r", method) + " (" + method.codeSize() + " bytes)"; } } @@ -97,33 +97,6 @@ } /** - * Represents an inlining opportunity where an intrinsification can take place. Weight and level are always zero. - */ - private static class IntrinsicInlineInfo extends InlineInfo { - public final StructuredGraph intrinsicGraph; - - public IntrinsicInlineInfo(Invoke invoke, StructuredGraph intrinsicGraph) { - super(invoke, 0, 0); - this.intrinsicGraph = intrinsicGraph; - } - - @Override - public Node inline(StructuredGraph compilerGraph, GraalRuntime runtime, InliningCallback callback) { - return InliningUtil.inline(invoke, intrinsicGraph, true); - } - - @Override - public String toString() { - return "intrinsic inlining " + CiUtil.format("%H.%n(%p):%r", invoke.callTarget().targetMethod(), false); - } - - @Override - public boolean canDeopt() { - return false; - } - } - - /** * Represents an inlining opportunity where the compiler can statically determine a monomorphic target method and * therefore is able to determine the called method exactly. */ @@ -154,7 +127,7 @@ @Override public String toString() { - return "exact inlining " + CiUtil.format("%H.%n(%p):%r", concrete, false); + return "exact inlining " + CiUtil.format("%H.%n(%p):%r", concrete); } @Override @@ -194,7 +167,7 @@ @Override public String toString() { - return "type-checked inlining " + CiUtil.format("%H.%n(%p):%r", concrete, false); + return "type-checked inlining " + CiUtil.format("%H.%n(%p):%r", concrete); } @Override @@ -218,8 +191,8 @@ @Override public Node inline(StructuredGraph graph, GraalRuntime runtime, InliningCallback callback) { if (GraalOptions.TraceInlining) { - String targetName = CiUtil.format("%H.%n(%p):%r", invoke.callTarget().targetMethod(), false); - String concreteName = CiUtil.format("%H.%n(%p):%r", concrete, false); + String targetName = CiUtil.format("%H.%n(%p):%r", invoke.callTarget().targetMethod()); + String concreteName = CiUtil.format("%H.%n(%p):%r", concrete); TTY.println("recording concrete method assumption: %s on receiver type %s -> %s", targetName, context, concreteName); } callback.recordConcreteMethodAssumption(invoke.callTarget().targetMethod(), context, concrete); @@ -228,7 +201,7 @@ @Override public String toString() { - return "inlining with assumption " + CiUtil.format("%H.%n(%p):%r", concrete, false); + return "inlining with assumption " + CiUtil.format("%H.%n(%p):%r", concrete); } @Override @@ -391,9 +364,9 @@ FrameState stateAfter = invoke.stateAfter(); assert stateAfter.isAlive(); - IdentityHashMap<Node, Node> replacements = new IdentityHashMap<Node, Node>(); - ArrayList<Node> nodes = new ArrayList<Node>(); - ArrayList<Node> frameStates = new ArrayList<Node>(); + IdentityHashMap<Node, Node> replacements = new IdentityHashMap<>(); + ArrayList<Node> nodes = new ArrayList<>(); + ArrayList<Node> frameStates = new ArrayList<>(); ReturnNode returnNode = null; UnwindNode unwindNode = null; BeginNode entryPointNode = inlineGraph.start();
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/LoopUtil.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/LoopUtil.java Sun Dec 18 05:24:06 2011 +0100 @@ -106,7 +106,7 @@ } public static List<Loop> computeLoops(StructuredGraph graph) { - List<Loop> loops = new LinkedList<LoopUtil.Loop>(); + List<Loop> loops = new LinkedList<>(); for (LoopBeginNode loopBegin : graph.getNodes(LoopBeginNode.class)) { NodeBitMap cfgNodes = markUpCFG(loopBegin, loopBegin.loopEnd()); // computeLoopNodes(loopBegin); cfgNodes.mark(loopBegin); @@ -202,10 +202,6 @@ return inOrAfter; } - private static NodeBitMap inOrBefore(Loop loop) { - return inOrBefore(loop, inOrAfter(loop)); - } - private static NodeBitMap inOrBefore(Loop loop, NodeBitMap inOrAfter) { return inOrBefore(loop, inOrAfter, loop.cfgNodes()); } @@ -305,15 +301,4 @@ } } } - - private static void clearWithState(Node n, NodeBitMap map) { - map.clear(n); - if (n instanceof StateSplit) { - FrameState stateAfter = ((StateSplit) n).stateAfter(); - while (stateAfter != null) { - map.clear(stateAfter); - stateAfter = stateAfter.outerFrameState(); - } - } - } }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/NodeIterators.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/NodeIterators.java Sun Dec 18 05:24:06 2011 +0100 @@ -26,6 +26,7 @@ import com.oracle.max.graal.graph.iterators.*; import com.oracle.max.graal.nodes.*; +import com.oracle.max.graal.util.*; public class NodeIterators {
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/Util.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/util/Util.java Sun Dec 18 05:24:06 2011 +0100 @@ -81,7 +81,7 @@ * Statically cast an object to an arbitrary Object type. Dynamically checked. */ @SuppressWarnings("unchecked") - public static <T> T uncheckedCast(Class<T> type, Object object) { + public static <T> T uncheckedCast(@SuppressWarnings("unused") Class<T> type, Object object) { return (T) object; }
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/BitMap.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/BitMap.java Sun Dec 18 05:24:06 2011 +0100 @@ -163,11 +163,11 @@ } } - private int bitInWord(int i) { + private static int bitInWord(int i) { return i & BIT_INDEX_MASK; } - private int wordIndex(int i) { + private static int wordIndex(int i) { return (i >> ADDRESS_BITS_PER_WORD) - 1; } @@ -436,7 +436,7 @@ return -1; } - private int bitIndex(int index) { + private static int bitIndex(int index) { return (index + 1) << ADDRESS_BITS_PER_WORD; } @@ -580,10 +580,8 @@ * @param length the number of bits represented in the returned string. If {@code length < 0 || length > size()}, * then the value of {@link #length()} is used. */ - public String toBinaryString(int length) { - if (length < 0 || length > size) { - length = length(); - } + public String toBinaryString() { + int length = length(); if (length == 0) { return ""; } @@ -606,9 +604,9 @@ if (size == 0) { return ""; } - int size = align(this.size, 4); - StringBuilder sb = new StringBuilder(size / 4); - for (int i = 0; i < size; i += 4) { + int hexSize = align(this.size, 4); + StringBuilder sb = new StringBuilder(hexSize / 4); + for (int i = 0; i < hexSize; i += 4) { int nibble = get(i) ? 1 : 0; if (get(i + 1)) { nibble |= 2; @@ -645,14 +643,9 @@ * @param arr the destination * @param off the byte index in {@code arr} at which to start writing * @param numberOfBytes the number of bytes worth of bits to copy from this bit map. - * The number of bits copied is {@code numberOfBytes * 8}. If {@code numberOfBytes} - * is -1, then {@code ((size() + 7) / 8)} is used instead. * @return the number of bytes written to {@code arr} */ public int copyTo(byte[] arr, int off, int numberOfBytes) { - if (numberOfBytes < 0) { - numberOfBytes = (size + 7) / 8; - } for (int i = 0; i < numberOfBytes; ++i) { long word = low; int byteInWord;
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/GraalInternalError.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/GraalInternalError.java Sun Dec 18 05:24:06 2011 +0100 @@ -29,9 +29,13 @@ */ public class GraalInternalError extends Error { + /** + * + */ + private static final long serialVersionUID = 8776065085829593278L; private Node node; private Graph graph; - private final ArrayList<String> context = new ArrayList<String>(); + private final ArrayList<String> context = new ArrayList<>(); /** * This constructor creates a {@link GraalInternalError} with a message assembled via {@link String#format(String, Object...)}. @@ -66,7 +70,7 @@ // expand Iterable parameters into a list representation for (int i = 0; i < args.length; i++) { if (args[i] instanceof Iterable<?>) { - ArrayList<Object> list = new ArrayList<Object>(); + ArrayList<Object> list = new ArrayList<>(); for (Object o : (Iterable<?>) args[i]) { list.add(o); } @@ -77,8 +81,8 @@ return String.format(Locale.ENGLISH, msg, args); } - public GraalInternalError addContext(String context) { - this.context.add(context); + public GraalInternalError addContext(String newContext) { + this.context.add(newContext); return this; } @@ -88,13 +92,13 @@ /** * Adds a graph to the context of this VerificationError. The first graph added via this method will be returned by {@link #graph()}. - * @param graph the graph which is in a incorrect state, if the verification error was not caused by a specific node + * @param newGraph the graph which is in a incorrect state, if the verification error was not caused by a specific node */ - public GraalInternalError addContext(Graph graph) { - if (graph != this.graph) { - addContext("graph", graph); + public GraalInternalError addContext(Graph newGraph) { + if (newGraph != this.graph) { + addContext("graph", newGraph); if (this.graph == null) { - this.graph = graph; + this.graph = newGraph; } } return this; @@ -102,13 +106,13 @@ /** * Adds a node to the context of this VerificationError. The first node added via this method will be returned by {@link #node()}. - * @param node the node which is in a incorrect state, if the verification error was caused by a node + * @param newNode the node which is in a incorrect state, if the verification error was caused by a node */ - public GraalInternalError addContext(Node node) { - if (node != this.node) { - addContext("node", node); + public GraalInternalError addContext(Node newNode) { + if (newNode != this.node) { + addContext("node", newNode); if (this.node == null) { - this.node = node; + this.node = newNode; } } return this;
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Graph.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Graph.java Sun Dec 18 05:24:06 2011 +0100 @@ -48,8 +48,8 @@ private int mark; private GraphEventLog eventLog; - ArrayList<Node> usagesDropped = new ArrayList<Node>(); - private final HashMap<CacheEntry, Node> cachedNodes = new HashMap<CacheEntry, Node>(); + ArrayList<Node> usagesDropped = new ArrayList<>(); + private final HashMap<CacheEntry, Node> cachedNodes = new HashMap<>(); private static final class CacheEntry { @@ -93,9 +93,9 @@ * @param name the name of the graph, used for debugging purposes */ public Graph(String name) { - nodes = new ArrayList<Node>(32); - nodeCacheFirst = new ArrayList<Node>(NodeClass.cacheSize()); - nodeCacheLast = new ArrayList<Node>(NodeClass.cacheSize()); + nodes = new ArrayList<>(32); + nodeCacheFirst = new ArrayList<>(NodeClass.cacheSize()); + nodeCacheLast = new ArrayList<>(NodeClass.cacheSize()); this.name = name; } @@ -111,9 +111,10 @@ * * @param name the name of the copy, used for debugging purposes (can be null) */ - public Graph copy(String name) { - Graph copy = new Graph(name); - copy.addDuplicates(getNodes(), null); + public Graph copy(String newName) { + Graph copy = new Graph(newName); + Map<Node, Node> emptyMap = Collections.emptyMap(); + copy.addDuplicates(getNodes(), emptyMap); return copy; } @@ -154,7 +155,7 @@ public List<Node> getAndCleanUsagesDroppedNodes() { ArrayList<Node> result = usagesDropped; - usagesDropped = new ArrayList<Node>(); + usagesDropped = new ArrayList<>(); return result; } @@ -200,7 +201,7 @@ return null; } - private boolean checkValueNumberable(Node node) { + private static boolean checkValueNumberable(Node node) { if (!node.getNodeClass().valueNumberable()) { throw new VerificationError("node is not valueNumberable").addContext(node); } @@ -350,7 +351,7 @@ return new NodeIterable<T>() { @Override public Iterator<T> iterator() { - return new TypedNodeIterator<T>(start); + return new TypedNodeIterator<>(start); } }; } @@ -376,7 +377,7 @@ } public <T> NodeMap<T> createNodeMap() { - return new NodeMap<T>(this); + return new NodeMap<>(this); } public NodeFlood createNodeFlood() { @@ -483,11 +484,11 @@ * Edges between duplicate and replacement nodes will also be recreated so care should be taken * regarding the matching of node types in the replacement map. * - * @param nodes the nodes to be duplicated + * @param newNodes the nodes to be duplicated * @param replacements the replacement map (can be null if no replacement is to be performed) * @return a map which associates the original nodes from {@code nodes} to their duplicates */ - public Map<Node, Node> addDuplicates(Iterable<Node> nodes, Map<Node, Node> replacements) { - return NodeClass.addGraphDuplicate(this, nodes, replacements); + public Map<Node, Node> addDuplicates(Iterable<Node> newNodes, Map<Node, Node> replacements) { + return NodeClass.addGraphDuplicate(this, newNodes, replacements); } }
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/GraphEventLog.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/GraphEventLog.java Sun Dec 18 05:24:06 2011 +0100 @@ -27,7 +27,7 @@ public class GraphEventLog { - private List<GraphEvent> events = new ArrayList<GraphEvent>(); + private List<GraphEvent> events = new ArrayList<>(); public void add(GraphEvent e) { this.events.add(e);
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/Node.java Sun Dec 18 05:24:06 2011 +0100 @@ -201,10 +201,10 @@ } } - void initialize(Graph graph) { + void initialize(Graph newGraph) { assert assertTrue(id == INITIAL_ID, "unexpected id: %d", id); - this.graph = graph; - graph.register(this); + this.graph = newGraph; + newGraph.register(this); usages = new NodeUsagesList(); for (Node input : inputs()) { updateUsages(null, input); @@ -424,7 +424,7 @@ * visualizer). Subclasses overriding this method should add to the map returned by their superclass. */ public Map<Object, Object> getDebugProperties() { - Map<Object, Object> map = new HashMap<Object, Object>(); + Map<Object, Object> map = new HashMap<>(); map.put("usageCount", usages.size()); map.put("predecessorCount", predecessor == null ? 0 : 1); getNodeClass().getDebugProperties(this, map);
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeBitMap.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeBitMap.java Sun Dec 18 05:24:06 2011 +0100 @@ -101,7 +101,7 @@ @Override public String toString() { - return bitMap.toBinaryString(-1); + return bitMap.toBinaryString(); } public <T extends Node> void markAll(Collection<T> nodes) {
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeClass.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeClass.java Sun Dec 18 05:24:06 2011 +0100 @@ -65,7 +65,7 @@ } } - private static final Map<Class< ? >, NodeClass> nodeClasses = new ConcurrentHashMap<Class< ? >, NodeClass>(); + private static final Map<Class< ? >, NodeClass> nodeClasses = new ConcurrentHashMap<>(); private static int nextIterableId = 0; private final Class< ? > clazz; @@ -118,17 +118,17 @@ canGVN = Node.ValueNumberable.class.isAssignableFrom(clazz); startGVNNumber = clazz.hashCode(); - String shortName = clazz.getSimpleName(); - if (shortName.endsWith("Node") && !shortName.equals("StartNode") && !shortName.equals("EndNode")) { - shortName = shortName.substring(0, shortName.length() - 4); + String newShortName = clazz.getSimpleName(); + if (newShortName.endsWith("Node") && !newShortName.equals("StartNode") && !newShortName.equals("EndNode")) { + newShortName = newShortName.substring(0, newShortName.length() - 4); } NodeInfo info = clazz.getAnnotation(NodeInfo.class); if (info != null) { if (!info.shortName().isEmpty()) { - shortName = info.shortName(); + newShortName = info.shortName(); } } - this.shortName = shortName; + this.shortName = newShortName; if (Node.IterableNodeType.class.isAssignableFrom(clazz)) { this.iterableId = nextIterableId++; // TODO(ls) add type hierarchy - based node iteration @@ -225,17 +225,17 @@ } private static class FieldScanner { - public final ArrayList<Long> inputOffsets = new ArrayList<Long>(); - public final ArrayList<Long> inputListOffsets = new ArrayList<Long>(); - public final Map<Long, Class< ? >> inputTypesMap = new HashMap<Long, Class<?>>(); - public final Map<Long, String> inputNamesMap = new HashMap<Long, String>(); - public final ArrayList<Long> successorOffsets = new ArrayList<Long>(); - public final ArrayList<Long> successorListOffsets = new ArrayList<Long>(); - public final Map<Long, Class< ? >> successorTypesMap = new HashMap<Long, Class<?>>(); - public final Map<Long, String> successorNamesMap = new HashMap<Long, String>(); - public final ArrayList<Long> dataOffsets = new ArrayList<Long>(); - public final ArrayList<Class< ? >> dataTypes = new ArrayList<Class<?>>(); - public final ArrayList<String> dataNames = new ArrayList<String>(); + public final ArrayList<Long> inputOffsets = new ArrayList<>(); + public final ArrayList<Long> inputListOffsets = new ArrayList<>(); + public final Map<Long, Class< ? >> inputTypesMap = new HashMap<>(); + public final Map<Long, String> inputNamesMap = new HashMap<>(); + public final ArrayList<Long> successorOffsets = new ArrayList<>(); + public final ArrayList<Long> successorListOffsets = new ArrayList<>(); + public final Map<Long, Class< ? >> successorTypesMap = new HashMap<>(); + public final Map<Long, String> successorNamesMap = new HashMap<>(); + public final ArrayList<Long> dataOffsets = new ArrayList<>(); + public final ArrayList<Class< ? >> dataTypes = new ArrayList<>(); + public final ArrayList<String> dataNames = new ArrayList<>(); public final CalcOffset calc; public FieldScanner(CalcOffset calc) { @@ -243,8 +243,9 @@ } public void scan(Class< ? > clazz) { + Class< ? > currentClazz = clazz; do { - for (Field field : clazz.getDeclaredFields()) { + for (Field field : currentClazz.getDeclaredFields()) { if (!Modifier.isStatic(field.getModifiers())) { Class< ? > type = field.getType(); long offset = calc.getOffset(field); @@ -283,8 +284,8 @@ } } } - clazz = clazz.getSuperclass(); - } while (clazz != Node.class); + currentClazz = currentClazz.getSuperclass(); + } while (currentClazz != Node.class); } } @@ -730,7 +731,7 @@ long curOffset = inputOffsets[index++]; int size = (getNodeList(node, curOffset)).initialSize; // replacing with a new list object is the expected behavior! - putNodeList(node, curOffset, new NodeInputList<Node>(node, size)); + putNodeList(node, curOffset, new NodeInputList<>(node, size)); } } @@ -748,7 +749,7 @@ long curOffset = successorOffsets[index++]; int size = getNodeList(node, curOffset).initialSize; // replacing with a new list object is the expected behavior! - putNodeList(node, curOffset, new NodeSuccessorList<Node>(node, size)); + putNodeList(node, curOffset, new NodeSuccessorList<>(node, size)); } } @@ -876,10 +877,7 @@ } static Map<Node, Node> addGraphDuplicate(Graph graph, Iterable<Node> nodes, Map<Node, Node> replacements) { - if (replacements == null) { - replacements = Collections.emptyMap(); - } - Map<Node, Node> newNodes = new IdentityHashMap<Node, Node>(); + Map<Node, Node> newNodes = new IdentityHashMap<>(); // create node duplicates for (Node node : nodes) { if (node != null && !replacements.containsKey(node)) {
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeFlood.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeFlood.java Sun Dec 18 05:24:06 2011 +0100 @@ -33,7 +33,7 @@ public NodeFlood(Graph graph) { visited = graph.createNodeBitMap(); - worklist = new ArrayDeque<Node>(); + worklist = new ArrayDeque<>(); } public void add(Node node) {
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeInputsIterable.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeInputsIterable.java Sun Dec 18 05:24:06 2011 +0100 @@ -27,23 +27,6 @@ public abstract class NodeInputsIterable extends NodeIterable<Node> { - @SuppressWarnings("unused") - public int explicitCount() { - int count = 0; - for (Node node : this) { - count++; - } - return count; - } - - public void replaceFirst(Node node, Node newNode) { - throw new UnsupportedOperationException("not implemented"); - } - - public void replace(Node node, Node newNode) { - throw new UnsupportedOperationException("not implemented"); - } - public abstract boolean contains(Node node); @Override
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeSuccessorsIterable.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeSuccessorsIterable.java Sun Dec 18 05:24:06 2011 +0100 @@ -27,23 +27,14 @@ public abstract class NodeSuccessorsIterable extends NodeIterable<Node> { - @SuppressWarnings("unused") public int explicitCount() { int count = 0; - for (Node node : this) { + for (@SuppressWarnings("unused") Node node : this) { count++; } return count; } - public void replaceFirst(Node node, Node newNode) { - throw new UnsupportedOperationException("not implemented"); - } - - public void replace(Node node, Node other) { - throw new UnsupportedOperationException("not implemented"); - } - public abstract boolean contains(Node node); @Override
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeWorkList.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeWorkList.java Sun Dec 18 05:24:06 2011 +0100 @@ -44,13 +44,13 @@ visited = graph.createNodeBitMap(); inQueue = graph.createNodeBitMap(); if (fill) { - ArrayDeque<Node> deque = new ArrayDeque<Node>(graph.getNodeCount()); + ArrayDeque<Node> deque = new ArrayDeque<>(graph.getNodeCount()); for (Node node : graph.getNodes()) { deque.add(node); } worklist = deque; } else { - worklist = new ArrayDeque<Node>(); + worklist = new ArrayDeque<>(); } if (iterationLimitPerNode > 0) { iterationLimit = iterationLimitPerNode * graph.getNodeCount();
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/VerificationError.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/VerificationError.java Sun Dec 18 05:24:06 2011 +0100 @@ -29,6 +29,11 @@ public class VerificationError extends GraalInternalError { /** + * + */ + private static final long serialVersionUID = 8459607567446819822L; + + /** * This constructor creates a {@link VerificationError} with a message assembled via {@link String#format(String, Object...)}. * It always uses the ENGLISH locale in order to always generate the same output. * @param msg the message that will be associated with the error, in String.format syntax
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/FilteredNodeIterable.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/FilteredNodeIterable.java Sun Dec 18 05:24:06 2011 +0100 @@ -46,6 +46,6 @@ @Override public Iterator<T> iterator() { final Iterator<T> iterator = nodeIterable.iterator(); - return new PredicatedProxyNodeIterator<T>(until, iterator, predicate); + return new PredicatedProxyNodeIterator<>(until, iterator, predicate); } }
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/NodeIterable.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/NodeIterable.java Sun Dec 18 05:24:06 2011 +0100 @@ -37,10 +37,10 @@ return this; } public <F extends T> FilteredNodeIterable<F> filter(Class<F> clazz) { - return new FilteredNodeIterable<T>(this).and(clazz); + return new FilteredNodeIterable<>(this).and(clazz); } public List<T> snapshot() { - ArrayList<T> list = new ArrayList<T>(); + ArrayList<T> list = new ArrayList<>(); for (T n : this) { list.add(n); }
--- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/NodePredicate.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/iterators/NodePredicate.java Sun Dec 18 05:24:06 2011 +0100 @@ -97,6 +97,6 @@ } public static <T extends Node> EqualsPredicate<T> equals(T u) { - return new EqualsPredicate<T>(u); + return new EqualsPredicate<>(u); } }
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/CompilerImpl.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/CompilerImpl.java Sun Dec 18 05:24:06 2011 +0100 @@ -96,8 +96,9 @@ return config; } - private CompilerImpl(VMEntries entries) { + private CompilerImpl(VMEntries initialEntries) { + VMEntries entries = initialEntries; // initialize VMEntries if (entries == null) { entries = new VMEntriesNative();
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/CompilerObject.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/CompilerObject.java Sun Dec 18 05:24:06 2011 +0100 @@ -29,6 +29,10 @@ * Parent class for all HotSpot Ri... types. */ public abstract class CompilerObject implements Serializable { + /** + * + */ + private static final long serialVersionUID = -4551670987101214877L; protected final Compiler compiler; protected CompilerObject(Compiler compiler) {
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotConstantPool.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotConstantPool.java Sun Dec 18 05:24:06 2011 +0100 @@ -28,6 +28,10 @@ * Implementation of RiConstantPool for HotSpot. */ public class HotSpotConstantPool extends CompilerObject implements RiConstantPool { + /** + * + */ + private static final long serialVersionUID = -5443206401485234850L; private final HotSpotTypeResolvedImpl type; public HotSpotConstantPool(Compiler compiler, HotSpotTypeResolvedImpl type) {
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotExceptionHandler.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotExceptionHandler.java Sun Dec 18 05:24:06 2011 +0100 @@ -26,6 +26,10 @@ public class HotSpotExceptionHandler extends CompilerObject implements RiExceptionHandler { + /** + * + */ + private static final long serialVersionUID = 7110038548061733686L; private int startBci; private int endBci; private int handlerBci;
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotField.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotField.java Sun Dec 18 05:24:06 2011 +0100 @@ -36,6 +36,10 @@ */ public class HotSpotField extends CompilerObject implements RiResolvedField { + /** + * + */ + private static final long serialVersionUID = 7692985878836955683L; private final RiResolvedType holder; private final String name; private final RiType type; @@ -80,7 +84,7 @@ return null; } - private boolean assumeStaticFieldsFinal(Class< ? > clazz) { + private static boolean assumeStaticFieldsFinal(Class< ? > clazz) { return clazz == GraalOptions.class; } @@ -110,7 +114,7 @@ @Override public String toString() { - return "HotSpotField<" + CiUtil.format("%h.%n", this, false) + ":" + offset + ">"; + return "HotSpotField<" + CiUtil.format("%h.%n", this) + ":" + offset + ">"; } @Override
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotMethod.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotMethod.java Sun Dec 18 05:24:06 2011 +0100 @@ -26,6 +26,10 @@ public abstract class HotSpotMethod extends CompilerObject implements RiMethod { + /** + * + */ + private static final long serialVersionUID = 7167491397941960839L; protected String name; protected HotSpotMethod(Compiler compiler) {
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotMethodResolvedImpl.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotMethodResolvedImpl.java Sun Dec 18 05:24:06 2011 +0100 @@ -28,7 +28,6 @@ import java.util.concurrent.*; import com.oracle.max.criutils.*; -import com.oracle.max.graal.graph.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -37,7 +36,13 @@ */ public final class HotSpotMethodResolvedImpl extends HotSpotMethod implements HotSpotMethodResolved { + /** + * + */ + private static final long serialVersionUID = -5486975070147586588L; + /** DO NOT USE IN JAVA CODE! */ + @SuppressWarnings("unused") @Deprecated private Object javaMirror; @@ -46,10 +51,8 @@ private final int accessFlags; private final int maxLocals; private final int maxStackSize; - private RiExceptionHandler[] exceptionHandlers; private RiSignature signature; private Boolean hasBalancedMonitors; - private Graph intrinsicGraph; private Map<Object, Object> compilerStorage; private RiResolvedType holder; private byte[] code; @@ -169,7 +172,7 @@ @Override public String toString() { - return "HotSpotMethod<" + CiUtil.format("%h.%n", this, false) + ">"; + return "HotSpotMethod<" + CiUtil.format("%h.%n", this) + ">"; } public boolean hasCompiledCode() { @@ -209,7 +212,7 @@ @Override public Map<Object, Object> compilerStorage() { if (compilerStorage == null) { - compilerStorage = new ConcurrentHashMap<Object, Object>(); + compilerStorage = new ConcurrentHashMap<>(); } return compilerStorage; }
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotMethodUnresolved.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotMethodUnresolved.java Sun Dec 18 05:24:06 2011 +0100 @@ -28,6 +28,10 @@ * Implementation of RiMethod for unresolved HotSpot methods. */ public final class HotSpotMethodUnresolved extends HotSpotMethod { + /** + * + */ + private static final long serialVersionUID = 5610263481791970079L; private final RiSignature signature; protected RiType holder;
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotRuntime.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotRuntime.java Sun Dec 18 05:24:06 2011 +0100 @@ -47,16 +47,13 @@ * CRI runtime implementation for the HotSpot VM. */ public class HotSpotRuntime implements GraalRuntime { - private static final long DOUBLENAN_RAW_LONG_BITS = Double.doubleToRawLongBits(Double.NaN); - private static final int FLOATNAN_RAW_INT_BITS = Float.floatToRawIntBits(Float.NaN); - final GraalContext context; final HotSpotVMConfig config; final HotSpotRegisterConfig regConfig; final HotSpotRegisterConfig globalStubRegConfig; private final Compiler compiler; // TODO(ls) this is not a permanent solution - there should be a more sophisticated compiler oracle - private HashSet<RiResolvedMethod> notInlineableMethods = new HashSet<RiResolvedMethod>(); + private HashSet<RiResolvedMethod> notInlineableMethods = new HashSet<>(); public HotSpotRuntime(GraalContext context, HotSpotVMConfig config, Compiler compiler) { this.context = context; @@ -81,7 +78,7 @@ return disassemble(code, new DisassemblyPrinter(false), address); } - private String disassemble(byte[] code, DisassemblyPrinter disassemblyPrinter, long address) { + private static String disassemble(byte[] code, DisassemblyPrinter disassemblyPrinter, long address) { final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); final ISA instructionSet = ISA.AMD64; Disassembler.disassemble(byteArrayOutputStream, code, instructionSet, WordWidth.BITS_64, address, null, disassemblyPrinter); @@ -127,10 +124,6 @@ return "No disassembler available"; } - public Class<?> getJavaClass(CiConstant c) { - return null; - } - @Override public RiResolvedType asRiType(CiKind kind) { return (RiResolvedType) compiler.getVMEntries().getType(kind.toJavaClass()); @@ -375,7 +368,7 @@ return IndexedLocationNode.create(LocationNode.getArrayLocation(elementKind), elementKind, config.getArrayOffset(elementKind), index, graph); } - private GuardNode createBoundsCheck(AccessIndexedNode n, CiLoweringTool tool) { + private static GuardNode createBoundsCheck(AccessIndexedNode n, CiLoweringTool tool) { return (GuardNode) tool.createGuard(n.graph().unique(new CompareNode(n.index(), Condition.BT, n.length()))); } @@ -426,10 +419,6 @@ return null; } - private boolean containsGraph(RiResolvedMethod method) { - return method.compilerStorage().containsKey(Graph.class); - } - private SafeReadNode safeReadHub(Graph graph, ValueNode value) { return safeRead(graph, CiKind.Object, value, config.hubOffset); } @@ -438,7 +427,7 @@ return safeRead(graph, CiKind.Int, value, config.arrayLengthOffset); } - private SafeReadNode safeRead(Graph graph, CiKind kind, ValueNode value, int offset) { + private static SafeReadNode safeRead(Graph graph, CiKind kind, ValueNode value, int offset) { return graph.add(new SafeReadNode(kind, value, LocationNode.create(LocationNode.FINAL_LOCATION, kind, offset, graph))); }
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotSignature.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotSignature.java Sun Dec 18 05:24:06 2011 +0100 @@ -33,7 +33,11 @@ */ public class HotSpotSignature extends CompilerObject implements RiSignature { - private final List<String> arguments = new ArrayList<String>(); + /** + * + */ + private static final long serialVersionUID = -2890917956072366116L; + private final List<String> arguments = new ArrayList<>(); private final String returnType; private final String originalString; private RiType[] argumentTypes; @@ -61,7 +65,8 @@ } } - private int parseSignature(String signature, int cur) { + private static int parseSignature(String signature, int start) { + int cur = start; char first; do { first = signature.charAt(cur++);
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotTargetMethod.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotTargetMethod.java Sun Dec 18 05:24:06 2011 +0100 @@ -35,6 +35,10 @@ */ public final class HotSpotTargetMethod extends CompilerObject { + /** + * + */ + private static final long serialVersionUID = 7807321392203253218L; public final CiTargetMethod targetMethod; public final HotSpotMethodResolved method; // used only for methods public final String name; // used only for stubs @@ -67,7 +71,7 @@ exceptionHandlers = null; } - private Site[] getSortedSites(CiTargetMethod target) { + private static Site[] getSortedSites(CiTargetMethod target) { List<?>[] lists = new List<?>[] {target.safepoints, target.dataReferences, target.marks}; int count = 0; for (List<?> list : lists) {
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotType.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotType.java Sun Dec 18 05:24:06 2011 +0100 @@ -28,6 +28,10 @@ * Common interface for all HotSpot RiType-implementations. */ public abstract class HotSpotType extends CompilerObject implements RiType { + /** + * + */ + private static final long serialVersionUID = -4252886265301910771L; protected String name; protected HotSpotType(Compiler compiler) {
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotTypePrimitive.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotTypePrimitive.java Sun Dec 18 05:24:06 2011 +0100 @@ -33,6 +33,10 @@ */ public final class HotSpotTypePrimitive extends HotSpotType implements RiResolvedType { + /** + * + */ + private static final long serialVersionUID = -6208552348908071473L; private CiKind kind;
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotTypeResolvedImpl.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotTypeResolvedImpl.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,6 +34,10 @@ */ public final class HotSpotTypeResolvedImpl extends HotSpotType implements HotSpotTypeResolved { + /** + * + */ + private static final long serialVersionUID = 3481514353553840471L; private Class javaMirror; private String simpleName; private int accessFlags; @@ -45,7 +49,6 @@ private boolean isInterface; private int instanceSize; private HashMap<Long, RiResolvedField> fieldCache; - private RiConstantPool pool; private RiResolvedType superType; private boolean superTypeSet; private RiResolvedField[] fields; @@ -201,23 +204,23 @@ } @Override - public synchronized RiResolvedField createRiField(String name, RiType type, int offset, int flags) { + public synchronized RiResolvedField createRiField(String fieldName, RiType type, int offset, int flags) { RiResolvedField result = null; long id = offset + ((long) flags << 32); // (tw) Must cache the fields, because the local load elimination only works if the objects from two field lookups are equal. if (fieldCache == null) { - fieldCache = new HashMap<Long, RiResolvedField>(8); + fieldCache = new HashMap<>(8); } else { result = fieldCache.get(id); } if (result == null) { - result = new HotSpotField(compiler, this, name, type, offset, flags); + result = new HotSpotField(compiler, this, fieldName, type, offset, flags); fieldCache.put(id, result); } else { - assert result.name().equals(name); + assert result.name().equals(fieldName); assert result.accessFlags() == flags; }
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotTypeUnresolved.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotTypeUnresolved.java Sun Dec 18 05:24:06 2011 +0100 @@ -30,6 +30,10 @@ */ public class HotSpotTypeUnresolved extends HotSpotType { + /** + * + */ + private static final long serialVersionUID = -2320936267633521314L; public final String simpleName; public final int dimensions; @@ -40,23 +44,23 @@ super(compiler); assert name.length() > 0 : "name cannot be empty"; - int dimensions = 0; + int dims = 0; // Decode name if necessary. if (name.charAt(name.length() - 1) == ';') { int startIndex = 0; while (name.charAt(startIndex) == '[') { startIndex++; - dimensions++; + dims++; } assert name.charAt(startIndex) == 'L'; this.simpleName = name.substring(startIndex + 1, name.length() - 1); this.name = name; } else { this.simpleName = name; - this.name = getFullName(name, dimensions); + this.name = getFullName(name, dims); } - this.dimensions = dimensions; + this.dimensions = dims; } public HotSpotTypeUnresolved(Compiler compiler, String name, int dimensions) { @@ -67,7 +71,7 @@ this.name = getFullName(name, dimensions); } - private String getFullName(String name, int dimensions) { + private static String getFullName(String name, int dimensions) { StringBuilder str = new StringBuilder(name.length() + dimensions + 2); for (int i = 0; i < dimensions; i++) { str.append('[');
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotVMConfig.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotVMConfig.java Sun Dec 18 05:24:06 2011 +0100 @@ -29,6 +29,11 @@ */ public final class HotSpotVMConfig extends CompilerObject { + /** + * + */ + private static final long serialVersionUID = -4744897993263044184L; + private HotSpotVMConfig() { super(null); } @@ -98,7 +103,7 @@ return arrayOffsets[getKindNumber(kind)]; } - private int getKindNumber(CiKind kind) { + private static int getKindNumber(CiKind kind) { if (kind == CiKind.Boolean) { return 0; } else if (kind == CiKind.Byte) {
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotXirGenerator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotXirGenerator.java Sun Dec 18 05:24:06 2011 +0100 @@ -56,7 +56,6 @@ private static final Integer MARK_STATIC_CALL_STUB = 0x1000; - private static final Integer MARK_INVOKE_INVALID = 0x2000; private static final Integer MARK_INVOKEINTERFACE = 0x2001; private static final Integer MARK_INVOKESTATIC = 0x2002; private static final Integer MARK_INVOKESPECIAL = 0x2003; @@ -68,9 +67,6 @@ private static final Integer MARK_POLL_FAR = 0x3003; private static final Integer MARK_POLL_RETURN_FAR = 0x3004; - private static final Integer MARK_KLASS_PATCHING = 0x4000; - private static final Integer MARK_DUMMY_OOP_RELOCATION = 0x4001; - private static final Integer MARK_ACCESS_FIELD_PATCHING = 0x4002; // @formatter:on private final HotSpotVMConfig config; @@ -519,12 +515,12 @@ @Override protected XirTemplate create(CiXirAssembler asm, long flags) { - emitNewTypeArray(asm, flags, CiKind.Object, config.useFastNewObjectArray, config.newObjectArrayStub); + emitNewTypeArray(asm, CiKind.Object, config.useFastNewObjectArray, config.newObjectArrayStub); return asm.finishTemplate("newObjectArray"); } }; - private void emitNewTypeArray(CiXirAssembler asm, long flags, CiKind kind, boolean useFast, long slowPathStub) { + private void emitNewTypeArray(CiXirAssembler asm, CiKind kind, boolean useFast, long slowPathStub) { XirOperand result = asm.restart(target.wordKind); XirParameter lengthParam = asm.createInputParameter("length", CiKind.Int, true); @@ -609,7 +605,7 @@ private KindTemplates newTypeArrayTemplates = new KindTemplates() { @Override protected XirTemplate create(CiXirAssembler asm, long flags, CiKind kind) { - emitNewTypeArray(asm, flags, kind, config.useFastNewTypeArray, config.newTypeArrayStub); + emitNewTypeArray(asm, kind, config.useFastNewTypeArray, config.newTypeArrayStub); return asm.finishTemplate("newTypeArray<" + kind.toString() + ">"); } }; @@ -1235,10 +1231,11 @@ if (elementKind == CiKind.Object) { assert arrayType instanceof RiResolvedType; return new XirSnippet(newObjectArrayTemplates.get(site), length, XirArgument.forObject(arrayType)); + } else { + assert arrayType == null; + RiType primitiveArrayType = compiler.getVMEntries().getPrimitiveArrayType(elementKind); + return new XirSnippet(newTypeArrayTemplates.get(site, elementKind), length, XirArgument.forObject(primitiveArrayType)); } - assert arrayType == null; - arrayType = compiler.getVMEntries().getPrimitiveArrayType(elementKind); - return new XirSnippet(newTypeArrayTemplates.get(site, elementKind), length, XirArgument.forObject(arrayType)); } @Override @@ -1309,7 +1306,7 @@ @Override public List<XirTemplate> makeTemplates(CiXirAssembler asm) { this.globalAsm = asm; - List<XirTemplate> templates = new ArrayList<XirTemplate>(); + List<XirTemplate> templates = new ArrayList<>(); return templates; } @@ -1332,7 +1329,7 @@ asm.pop(result); } - private void useRegisters(CiXirAssembler asm, CiRegister... registers) { + private static void useRegisters(CiXirAssembler asm, CiRegister... registers) { if (registers != null) { for (CiRegister register : registers) { asm.createRegisterTemp("reg", CiKind.Illegal, register); @@ -1355,7 +1352,7 @@ */ private abstract class Templates { - private ConcurrentHashMap<Long, XirTemplate> templates = new ConcurrentHashMap<Long, XirTemplate>(); + private ConcurrentHashMap<Long, XirTemplate> templates = new ConcurrentHashMap<>(); private final long mask; /** @@ -1385,11 +1382,11 @@ } protected XirTemplate getInternal(long flags) { - flags = flags & mask; - XirTemplate template = templates.get(flags); + long maskedFlags = flags & mask; + XirTemplate template = templates.get(maskedFlags); if (template == null) { - template = create(HotSpotXirGenerator.this.globalAsm.copy(), flags); - templates.put(flags, template); + template = create(HotSpotXirGenerator.this.globalAsm.copy(), maskedFlags); + templates.put(maskedFlags, template); } return template; }
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/InvocationSocket.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/InvocationSocket.java Sun Dec 18 05:24:06 2011 +0100 @@ -40,8 +40,8 @@ private static final boolean DEBUG = false; private static final boolean COUNT_CALLS = false; - private static final HashSet<String> cachedMethodNames = new HashSet<String>(); - private static final HashSet<String> forbiddenMethodNames = new HashSet<String>(); + private static final HashSet<String> cachedMethodNames = new HashSet<>(); + private static final HashSet<String> forbiddenMethodNames = new HashSet<>(); static { cachedMethodNames.add("name"); @@ -56,7 +56,7 @@ private final ObjectOutputStream output; private final ObjectInputStream input; - private final Map<String, Integer> counts = new HashMap<String, Integer>(); + private final Map<String, Integer> counts = new HashMap<>(); public InvocationSocket(ObjectOutputStream output, ObjectInputStream input) { this.output = output; @@ -66,7 +66,7 @@ Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { - SortedMap<Integer, String> sorted = new TreeMap<Integer, String>(); + SortedMap<Integer, String> sorted = new TreeMap<>(); for (Map.Entry<String, Integer> entry : counts.entrySet()) { sorted.put(entry.getValue(), entry.getKey()); } @@ -84,6 +84,10 @@ */ private static class Invocation implements Serializable { + /** + * + */ + private static final long serialVersionUID = -799162779226626066L; public Object receiver; public String methodName; public Object[] args; @@ -101,6 +105,10 @@ */ private static class Result implements Serializable { + /** + * + */ + private static final long serialVersionUID = -7496058356272415814L; public Object result; public Result(Object result) { @@ -110,11 +118,11 @@ private void incCount(String name, Object[] args) { if (COUNT_CALLS) { - name = name + (args == null ? 0 : args.length); - if (counts.get(name) != null) { - counts.put(name, counts.get(name) + 1); + String nameAndArgCount = name + (args == null ? 0 : args.length); + if (counts.get(nameAndArgCount) != null) { + counts.put(nameAndArgCount, counts.get(nameAndArgCount) + 1); } else { - counts.put(name, 1); + counts.put(nameAndArgCount, 1); } } } @@ -127,7 +135,7 @@ public class Handler implements InvocationHandler { private final Object receiver; - private final HashMap<String, Object> cache = new HashMap<String, Object>(); + private final HashMap<String, Object> cache = new HashMap<>(); public Handler(Object receiver) { this.receiver = receiver; @@ -180,6 +188,7 @@ * Waits for the result of a remote method invocation. Invocations that should be executed in this VM might arrive * while waiting for the result, and these invocations will be executed before again waiting fort he result. */ + @SuppressWarnings("unused") public Object waitForResult(boolean eofExpected) throws IOException, ClassNotFoundException { while (true) { Object in;
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/VMExitsNative.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/VMExitsNative.java Sun Dec 18 05:24:06 2011 +0100 @@ -24,7 +24,6 @@ package com.oracle.max.graal.hotspot; import java.lang.reflect.*; -import java.util.*; import java.util.concurrent.*; import com.oracle.max.criutils.*; @@ -39,8 +38,6 @@ */ public class VMExitsNative implements VMExits, Remote { - private boolean installedIntrinsics; - private final Compiler compiler; public final HotSpotTypePrimitive typeBoolean; @@ -83,8 +80,6 @@ typeVoid = new HotSpotTypePrimitive(compiler, CiKind.Void); } - private static Set<String> compiledMethods = new HashSet<String>(); - public void startCompiler() throws Throwable { // Make sure TTY is initialized here such that the correct System.out is used for TTY. TTY.initialize();
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/logging/CountingProxy.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/logging/CountingProxy.java Sun Dec 18 05:24:06 2011 +0100 @@ -39,7 +39,7 @@ private T delegate; - private ConcurrentHashMap<Method, AtomicLong> calls = new ConcurrentHashMap<Method, AtomicLong>(); + private ConcurrentHashMap<Method, AtomicLong> calls = new ConcurrentHashMap<>(); public CountingProxy(T delegate) { assert ENABLED; @@ -74,11 +74,11 @@ public static <T> T getProxy(Class<T> interf, T delegate) { Class<?>[] interfaces = ReplacingStreams.getAllInterfaces(delegate.getClass()); - Object obj = Proxy.newProxyInstance(interf.getClassLoader(), interfaces, new CountingProxy<T>(delegate)); + Object obj = Proxy.newProxyInstance(interf.getClassLoader(), interfaces, new CountingProxy<>(delegate)); return interf.cast(obj); } - private static ArrayList<CountingProxy> proxies = new ArrayList<CountingProxy>(); + private static ArrayList<CountingProxy> proxies = new ArrayList<>(); static { if (ENABLED) {
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/logging/Logger.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/logging/Logger.java Sun Dec 18 05:24:06 2011 +0100 @@ -33,7 +33,7 @@ public static final boolean ENABLED = Boolean.valueOf(System.getProperty("graal.debug")); private static final int SPACING = 4; - private static Deque<Boolean> openStack = new LinkedList<Boolean>(); + private static Deque<Boolean> openStack = new LinkedList<>(); private static boolean open = false; private static int level = 0;
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/logging/LoggingProxy.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/logging/LoggingProxy.java Sun Dec 18 05:24:06 2011 +0100 @@ -71,7 +71,7 @@ */ public static <T> T getProxy(Class<T> interf, T delegate) { Class<?>[] interfaces = ReplacingStreams.getAllInterfaces(delegate.getClass()); - Object obj = Proxy.newProxyInstance(interf.getClassLoader(), interfaces, new LoggingProxy<T>(delegate)); + Object obj = Proxy.newProxyInstance(interf.getClassLoader(), interfaces, new LoggingProxy<>(delegate)); return interf.cast(obj); } }
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/nodes/CurrentThread.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/nodes/CurrentThread.java Sun Dec 18 05:24:06 2011 +0100 @@ -42,6 +42,7 @@ generator.setResult(this, generator.emitLoad(new CiAddress(generator.target().wordKind, AMD64.r15.asValue(generator.target().wordKind), threadObjectOffset), CiKind.Object, false)); } + @SuppressWarnings("unused") @NodeIntrinsic public static Object get(int threadObjectOffset) { throw new UnsupportedOperationException();
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/nodes/TailcallNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/nodes/TailcallNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -66,7 +66,7 @@ CiKind[] signature = CiUtil.signatureToKinds(method.signature(), isStatic ? null : method.holder().kind(true)); CiCallingConvention cc = gen.compilation.registerConfig.getCallingConvention(JavaCall, signature, gen.compilation.compiler.target, false); gen.compilation.frameMap().adjustOutgoingStackSize(cc, JavaCall); - List<ValueNode> parameters = new ArrayList<ValueNode>(); + List<ValueNode> parameters = new ArrayList<>(); for (int i = 0; i < cc.locations.length; i++) { parameters.add(frameState.localAt(i)); }
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/server/CompilationServer.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/server/CompilationServer.java Sun Dec 18 05:24:06 2011 +0100 @@ -49,7 +49,7 @@ } private final boolean multiple; - private final ArrayList<ConnectionObserver> observers = new ArrayList<ConnectionObserver>(); + private final ArrayList<ConnectionObserver> observers = new ArrayList<>(); /** * Creates a new Compilation server. The server is activated by calling {@link #run()} directly or via a new
--- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/server/ReplacingStreams.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/server/ReplacingStreams.java Sun Dec 18 05:24:06 2011 +0100 @@ -27,13 +27,12 @@ import java.util.*; import com.oracle.max.graal.hotspot.*; -import com.oracle.max.graal.hotspot.Compiler; import com.sun.cri.ci.*; public class ReplacingStreams { - private IdentityHashMap<Object, Placeholder> objectMap = new IdentityHashMap<Object, Placeholder>(); - private ArrayList<Object> objectList = new ArrayList<Object>(); + private IdentityHashMap<Object, Placeholder> objectMap = new IdentityHashMap<>(); + private ArrayList<Object> objectList = new ArrayList<>(); private ReplacingOutputStream output; private ReplacingInputStream input; @@ -75,6 +74,10 @@ public static class Placeholder implements Serializable { + /** + * + */ + private static final long serialVersionUID = 6071894297788156945L; public final int id; public Placeholder(int id) { @@ -89,6 +92,10 @@ public static class NewRemoteCallPlaceholder implements Serializable { + /** + * + */ + private static final long serialVersionUID = 3084101671389500206L; public final Class<?>[] interfaces; public NewRemoteCallPlaceholder(Class<?>[] interfaces) { @@ -97,6 +104,11 @@ } public static class NewDummyPlaceholder implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 2692666726573532288L; } /** @@ -104,41 +116,35 @@ */ public class ReplacingInputStream extends ObjectInputStream { - private Compiler compiler; - public ReplacingInputStream(InputStream in) throws IOException { super(in); enableResolveObject(true); } - public void setCompiler(Compiler compiler) { - this.compiler = compiler; - } - @Override protected Object resolveObject(Object obj) throws IOException { // see ReplacingInputStream.replaceObject for details on when these types of objects are created if (obj instanceof Placeholder) { Placeholder placeholder = (Placeholder) obj; - obj = objectList.get(placeholder.id); - return obj; + Object resolvedObj = objectList.get(placeholder.id); + return resolvedObj; } if (obj instanceof NewRemoteCallPlaceholder) { NewRemoteCallPlaceholder newPlaceholder = (NewRemoteCallPlaceholder) obj; Placeholder placeholder = new Placeholder(objectList.size()); - obj = Proxy.newProxyInstance(getClass().getClassLoader(), newPlaceholder.interfaces, invocation.new Handler(placeholder)); - objectMap.put(obj, placeholder); - objectList.add(obj); - return obj; + Object resolvedObj = Proxy.newProxyInstance(getClass().getClassLoader(), newPlaceholder.interfaces, invocation.new Handler(placeholder)); + objectMap.put(resolvedObj, placeholder); + objectList.add(resolvedObj); + return resolvedObj; } if (obj instanceof NewDummyPlaceholder) { - obj = new Placeholder(objectList.size()); - objectMap.put(obj, (Placeholder) obj); - objectList.add(obj); - return obj; + Object resolvedObj = new Placeholder(objectList.size()); + objectMap.put(resolvedObj, (Placeholder) resolvedObj); + objectList.add(resolvedObj); + return resolvedObj; } return obj; @@ -196,7 +202,7 @@ } public static Class<?>[] getAllInterfaces(Class<?> clazz) { - HashSet<Class< ? >> interfaces = new HashSet<Class<?>>(); + HashSet<Class< ? >> interfaces = new HashSet<>(); getAllInterfaces(clazz, interfaces); return interfaces.toArray(new Class<?>[interfaces.size()]); }
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/AnchorNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/AnchorNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -31,7 +31,7 @@ */ public final class AnchorNode extends FixedWithNextNode implements LIRLowerable, Canonicalizable { - @Input(notDataflow = true) private final NodeInputList<GuardNode> guards = new NodeInputList<GuardNode>(this); + @Input(notDataflow = true) private final NodeInputList<GuardNode> guards = new NodeInputList<>(this); public AnchorNode() { super(StampFactory.illegal());
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/CallTargetNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/CallTargetNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -33,7 +33,7 @@ public CallTargetNode(ValueNode[] arguments) { super(StampFactory.illegal()); - this.arguments = new NodeInputList<ValueNode>(this, arguments); + this.arguments = new NodeInputList<>(this, arguments); } public NodeInputList<ValueNode> arguments() {
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/ConstantNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/ConstantNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -36,7 +36,6 @@ public final class ConstantNode extends BooleanNode implements LIRLowerable { @Data public final CiConstant value; - private RiRuntime runtime; private ConstantNode(CiConstant value) { this(value, null); @@ -49,7 +48,6 @@ private ConstantNode(CiConstant value, RiRuntime runtime) { super(StampFactory.forConstant(value, runtime)); this.value = value; - this.runtime = runtime; } @Override
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/ControlSplitNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/ControlSplitNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -51,7 +51,7 @@ public ControlSplitNode(Stamp stamp, BeginNode[] blockSuccessors, double[] branchProbability) { super(stamp); assert branchProbability.length == blockSuccessors.length; - this.blockSuccessors = new NodeSuccessorList<BeginNode>(this, blockSuccessors); + this.blockSuccessors = new NodeSuccessorList<>(this, blockSuccessors); this.branchProbability = branchProbability; }
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FixedGuardNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FixedGuardNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -34,7 +34,7 @@ public FixedGuardNode(BooleanNode condition) { super(StampFactory.illegal()); - this.conditions = new NodeInputList<BooleanNode>(this, new BooleanNode[] {condition}); + this.conditions = new NodeInputList<>(this, new BooleanNode[] {condition}); } @Override
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FixedWithNextNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FixedWithNextNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -46,17 +46,17 @@ } public void replaceAndUnlink(Node other) { - FixedNode next = this.next(); + FixedNode tmpNext = this.next(); setNext(null); - replaceAtPredecessors(next); + replaceAtPredecessors(tmpNext); replaceAtUsages(other); safeDelete(); } public void replaceWithFixedWithNext(FixedWithNextNode other) { - FixedNode next = this.next(); + FixedNode tmpNext = this.next(); setNext(null); - other.setNext(next); + other.setNext(tmpNext); replaceAndDelete(other); } }
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FrameState.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/FrameState.java Sun Dec 18 05:24:06 2011 +0100 @@ -122,8 +122,8 @@ this.localsSize = localsSize; this.stackSize = stackSize; this.locksSize = locksSize; - this.values = new NodeInputList<ValueNode>(this, localsSize + stackSize + locksSize); - this.virtualObjectMappings = new NodeInputList<Node>(this); + this.values = new NodeInputList<>(this, localsSize + stackSize + locksSize); + this.virtualObjectMappings = new NodeInputList<>(this); this.rethrowException = rethrowException; } @@ -133,18 +133,18 @@ this.localsSize = locals.length; this.stackSize = stackSize; this.locksSize = locks.size(); - final ValueNode[] values = new ValueNode[locals.length + stackSize + locks.size()]; + final ValueNode[] newValues = new ValueNode[locals.length + stackSize + locks.size()]; for (int i = 0; i < locals.length; i++) { - values[i] = locals[i]; + newValues[i] = locals[i]; } for (int i = 0; i < stackSize; i++) { - values[localsSize + i] = stack[i]; + newValues[localsSize + i] = stack[i]; } for (int i = 0; i < locks.size(); i++) { - values[locals.length + stackSize + i] = locks.get(i); + newValues[locals.length + stackSize + i] = locks.get(i); } - this.values = new NodeInputList<ValueNode>(this, values); - this.virtualObjectMappings = new NodeInputList<Node>(this); + this.values = new NodeInputList<>(this, newValues); + this.virtualObjectMappings = new NodeInputList<>(this); this.rethrowException = rethrowException; } @@ -176,25 +176,25 @@ /** * Gets a copy of this frame state. */ - public FrameState duplicate(int bci) { - return duplicate(bci, false); + public FrameState duplicate(int newBci) { + return duplicate(newBci, false); } - public FrameState duplicate(int bci, boolean duplicateOuter) { - FrameState other = graph().add(new FrameState(method, bci, localsSize, stackSize, locksSize, rethrowException)); + public FrameState duplicate(int newBci, boolean duplicateOuter) { + FrameState other = graph().add(new FrameState(method, newBci, localsSize, stackSize, locksSize, rethrowException)); other.values.setAll(values); other.virtualObjectMappings.setAll(virtualObjectMappings); - FrameState outerFrameState = outerFrameState(); - if (duplicateOuter && outerFrameState != null) { - outerFrameState = outerFrameState.duplicate(outerFrameState.bci, duplicateOuter); + FrameState newOuterFrameState = outerFrameState(); + if (duplicateOuter && newOuterFrameState != null) { + newOuterFrameState = newOuterFrameState.duplicate(newOuterFrameState.bci, duplicateOuter); } - other.setOuterFrameState(outerFrameState); + other.setOuterFrameState(newOuterFrameState); return other; } @Override - public FrameState duplicateWithException(int bci, ValueNode exceptionObject) { - return duplicateModified(bci, true, CiKind.Void, exceptionObject); + public FrameState duplicateWithException(int newBci, ValueNode exceptionObject) { + return duplicateModified(newBci, true, CiKind.Void, exceptionObject); } /** @@ -202,10 +202,10 @@ * values in pushedValues pushed on the stack. The pushedValues are expected to be in slot encoding: a long * or double is followed by a null slot. */ - public FrameState duplicateModified(int bci, boolean rethrowException, CiKind popKind, ValueNode... pushedValues) { + public FrameState duplicateModified(int newBci, boolean newRethrowException, CiKind popKind, ValueNode... pushedValues) { int popSlots = popKind == CiKind.Void ? 0 : isTwoSlot(popKind) ? 2 : 1; int pushSlots = pushedValues.length; - FrameState other = graph().add(new FrameState(method, bci, localsSize, stackSize - popSlots + pushSlots, locksSize(), rethrowException)); + FrameState other = graph().add(new FrameState(method, newBci, localsSize, stackSize - popSlots + pushSlots, locksSize(), newRethrowException)); for (int i = 0; i < localsSize; i++) { other.setValueAt(i, localAt(i)); } @@ -460,7 +460,7 @@ return phi; } - private void addToPhi(PhiNode phiNode, ValueNode otherValue) { + private static void addToPhi(PhiNode phiNode, ValueNode otherValue) { if (otherValue == null || otherValue.kind() != phiNode.kind()) { phiNode.replaceAtUsages(null); phiNode.safeDelete(); @@ -617,9 +617,10 @@ // Nothing to do, frame states are processed as part of the handling of AbstractStateSplit nodes. } - public static String toString(FrameState fs) { + public static String toString(FrameState frameState) { StringBuilder sb = new StringBuilder(); String nl = CiUtil.NEW_LINE; + FrameState fs = frameState; while (fs != null) { CiUtil.appendLocation(sb, fs.method, fs.bci).append(nl); for (int i = 0; i < fs.localsSize(); ++i) { @@ -650,21 +651,15 @@ } } - public void visitFrameState(FrameState i) { - // nothing to do for now - } - public void insertLoopPhis(LoopBeginNode loopBegin) { - int stackSize = stackSize(); - for (int i = 0; i < stackSize; i++) { + for (int i = 0; i < stackSize(); i++) { // always insert phis for the stack ValueNode x = stackAt(i); if (x != null) { setupPhiForStack(loopBegin, i).addInput(x); } } - int localsSize = localsSize(); - for (int i = 0; i < localsSize; i++) { + for (int i = 0; i < localsSize(); i++) { ValueNode x = localAt(i); if (x != null) { setupPhiForLocal(loopBegin, i).addInput(x); @@ -676,7 +671,7 @@ public Map<Object, Object> getDebugProperties() { Map<Object, Object> properties = super.getDebugProperties(); properties.put("bci", bci); - properties.put("method", CiUtil.format("%H.%n(%p):%r", method, false)); + properties.put("method", CiUtil.format("%H.%n(%p):%r", method)); StringBuilder str = new StringBuilder(); for (int i = 0; i < localsSize(); i++) { str.append(i == 0 ? "" : ", ").append(localAt(i) == null ? "_" : localAt(i).toString(Verbosity.Id));
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/InvokeWithExceptionNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/InvokeWithExceptionNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -116,8 +116,7 @@ } public FrameState stateDuring() { - FrameState stateAfter = stateAfter(); - return stateAfter.duplicateModified(bci(), stateAfter.rethrowException(), this.callTarget.targetMethod().signature().returnKind(false)); + return stateAfter().duplicateModified(bci(), stateAfter().rethrowException(), this.callTarget.targetMethod().signature().returnKind(false)); } @Override
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/LoopBeginNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/LoopBeginNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -87,7 +87,7 @@ public Collection<InductionVariableNode> inductionVariables() { // TODO (gd) produces useless garbage - List<InductionVariableNode> list = new LinkedList<InductionVariableNode>(); + List<InductionVariableNode> list = new LinkedList<>(); collectInductionVariables(this, list); return list; }
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/MergeNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/MergeNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -31,7 +31,7 @@ */ public class MergeNode extends BeginNode implements Node.IterableNodeType, LIRLowerable { - @Input(notDataflow = true) private final NodeInputList<EndNode> ends = new NodeInputList<EndNode>(this); + @Input(notDataflow = true) private final NodeInputList<EndNode> ends = new NodeInputList<>(this); @Override public boolean needsStateAfter() {
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/PhiNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/PhiNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -36,7 +36,7 @@ @Input(notDataflow = true) private MergeNode merge; - @Input private final NodeInputList<ValueNode> values = new NodeInputList<ValueNode>(this); + @Input private final NodeInputList<ValueNode> values = new NodeInputList<>(this); public MergeNode merge() { return merge; @@ -50,10 +50,6 @@ private final PhiType type; - private PhiNode(CiKind kind, PhiType type) { - this(kind, null, type); - } - public PhiNode(CiKind kind, MergeNode merge, PhiType type) { super(StampFactory.forKind(kind)); this.type = type; @@ -216,9 +212,8 @@ private void removeIfNode(IfNode ifNode) { FixedNode next = merge().next(); - MergeNode merge = this.merge; - EndNode end1 = merge.endAt(0); - EndNode end2 = merge.endAt(1); + EndNode end1 = this.merge.endAt(0); + EndNode end2 = this.merge.endAt(1); BeginNode trueSuccessor = ifNode.trueSuccessor(); BeginNode falseSuccessor = ifNode.falseSuccessor(); merge().setNext(null); @@ -226,8 +221,8 @@ ifNode.setFalseSuccessor(null); ifNode.replaceAndDelete(next); updateUsages(this.merge, null); + this.merge.safeDelete(); this.merge = null; - merge.safeDelete(); trueSuccessor.safeDelete(); falseSuccessor.safeDelete(); end1.safeDelete();
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/StructuredGraph.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/StructuredGraph.java Sun Dec 18 05:24:06 2011 +0100 @@ -60,9 +60,9 @@ } @Override - public StructuredGraph copy(String name) { - StructuredGraph copy = new StructuredGraph(name); - HashMap<Node, Node> replacements = new HashMap<Node, Node>(); + public StructuredGraph copy(String newName) { + StructuredGraph copy = new StructuredGraph(newName); + HashMap<Node, Node> replacements = new HashMap<>(); replacements.put(start, copy.start); copy.addDuplicates(getNodes(), replacements); return copy;
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/ValueUtil.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/ValueUtil.java Sun Dec 18 05:24:06 2011 +0100 @@ -85,7 +85,7 @@ @SuppressWarnings("unchecked") public static <T extends Node> Collection<T> filter(Iterable<Node> nodes, Class<T> clazz) { - ArrayList<T> phis = new ArrayList<T>(); + ArrayList<T> phis = new ArrayList<>(); for (Node node : nodes) { if (clazz.isInstance(node)) { phis.add((T) node);
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/CompareNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/CompareNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -146,21 +146,21 @@ private Node optimizeNormalizeCmp(CiConstant constant, NormalizeCompareNode normalizeNode) { if (constant.kind == CiKind.Int && constant.asInt() == 0) { - Condition condition = condition(); + Condition cond = condition(); if (normalizeNode.x().kind().isFloatOrDouble()) { - switch (condition) { - case LT: condition = Condition.BT; break; - case LE: condition = Condition.BE; break; - case GE: condition = Condition.AE; break; - case GT: condition = Condition.AT; break; + switch (cond) { + case LT: cond = Condition.BT; break; + case LE: cond = Condition.BE; break; + case GE: cond = Condition.AE; break; + case GT: cond = Condition.AT; break; } } if (normalizeNode == y()) { - condition = condition.mirror(); + cond = cond.mirror(); } - boolean isLess = condition == Condition.LE || condition == Condition.LT || condition == Condition.BE || condition == Condition.BT; - boolean canonUnorderedIsTrue = condition != Condition.EQ && (condition == Condition.NE || !(isLess ^ normalizeNode.isUnorderedLess)); - CompareNode result = graph().unique(new CompareNode(normalizeNode.x(), condition, canonUnorderedIsTrue, normalizeNode.y())); + boolean isLess = cond == Condition.LE || cond == Condition.LT || cond == Condition.BE || cond == Condition.BT; + boolean canonUnorderedIsTrue = cond != Condition.EQ && (cond == Condition.NE || !(isLess ^ normalizeNode.isUnorderedLess)); + CompareNode result = graph().unique(new CompareNode(normalizeNode.x(), cond, canonUnorderedIsTrue, normalizeNode.y())); return result; } return this;
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/ConvertNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/calc/ConvertNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -121,6 +121,7 @@ gen.setResult(this, gen.emitConvert(opcode, gen.operand(value()))); } + @SuppressWarnings("unused") @NodeIntrinsic public static <S, T> S convert(@ConstantNodeParameter Op op, T value) { throw new UnsupportedOperationException();
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/AbstractCallNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/AbstractCallNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -33,7 +33,7 @@ public AbstractCallNode(Stamp stamp, ValueNode[] arguments) { super(stamp); - this.arguments = new NodeInputList<ValueNode>(this, arguments); + this.arguments = new NodeInputList<>(this, arguments); } public NodeInputList<ValueNode> arguments() {
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/AccessNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/AccessNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -32,7 +32,7 @@ @Input private ValueNode object; @Input private GuardNode guard; @Input private LocationNode location; - @Input private final NodeInputList<Node> dependencies = new NodeInputList<Node>(this); + @Input private final NodeInputList<Node> dependencies = new NodeInputList<>(this); @Data private boolean nullCheck; public ValueNode object() {
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/BoxingMethodPool.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/BoxingMethodPool.java Sun Dec 18 05:24:06 2011 +0100 @@ -29,8 +29,7 @@ public class BoxingMethodPool { - private static final String BOX_METHOD = "valueOf"; - private final Set<RiMethod> specialMethods = new HashSet<RiMethod>(); + private final Set<RiMethod> specialMethods = new HashSet<>(); private final RiRuntime runtime; private final RiResolvedMethod[] boxingMethods = new RiResolvedMethod[CiKind.values().length]; private final RiResolvedMethod[] unboxingMethods = new RiResolvedMethod[CiKind.values().length];
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/MembarNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/MembarNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -43,6 +43,7 @@ generator.emitMembar(barriers); } + @SuppressWarnings("unused") @NodeIntrinsic public static void get(@ConstantNodeParameter int barriers) { throw new UnsupportedOperationException("This method may only be compiled with the Graal compiler");
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/RuntimeCallNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/RuntimeCallNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -54,11 +54,13 @@ } // specialized on return type (instead of public static <T> T performCall) until boxing/unboxing is sorted out in intrinsification + @SuppressWarnings("unused") @NodeIntrinsic public static <S> double performCall(@ConstantNodeParameter CiRuntimeCall call, S arg1) { throw new UnsupportedOperationException("This method may only be compiled with the Graal compiler"); } + @SuppressWarnings("unused") @NodeIntrinsic public static long performCall(@ConstantNodeParameter CiRuntimeCall call) { throw new UnsupportedOperationException("This method may only be compiled with the Graal compiler");
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnsafeCastNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnsafeCastNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -61,6 +61,7 @@ replaceAndDelete(x); } + @SuppressWarnings("unused") @NodeIntrinsic public static <T> T cast(Object object, @ConstantNodeParameter Class<?> toType) { throw new UnsupportedOperationException("This method may only be compiled with the Graal compiler");
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnsafeLoadNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnsafeLoadNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -72,6 +72,7 @@ tool.getRuntime().lower(this, tool); } + @SuppressWarnings("unused") @NodeIntrinsic public static <T> T load(Object object, long offset, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException("This method may only be compiled with the Graal compiler");
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnsafeStoreNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnsafeStoreNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -79,46 +79,55 @@ } // specialized on value type until boxing/unboxing is sorted out in intrinsification + @SuppressWarnings("unused") @NodeIntrinsic public static void store(Object object, long offset, Object value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } + @SuppressWarnings("unused") @NodeIntrinsic public static void store(Object object, long offset, boolean value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } + @SuppressWarnings("unused") @NodeIntrinsic public static void store(Object object, long offset, byte value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } + @SuppressWarnings("unused") @NodeIntrinsic public static void store(Object object, long offset, char value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } + @SuppressWarnings("unused") @NodeIntrinsic public static void store(Object object, long offset, double value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } + @SuppressWarnings("unused") @NodeIntrinsic public static void store(Object object, long offset, float value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } + @SuppressWarnings("unused") @NodeIntrinsic public static void store(Object object, long offset, int value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } + @SuppressWarnings("unused") @NodeIntrinsic public static void store(Object object, long offset, long value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException(); } + @SuppressWarnings("unused") @NodeIntrinsic public static void store(Object object, long offset, short value, @ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException();
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/CheckCastNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/CheckCastNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -36,7 +36,7 @@ */ public final class CheckCastNode extends TypeCheckNode implements Canonicalizable, LIRLowerable { - @Input private final AnchorNode anchor; + @Input protected final AnchorNode anchor; /** * Creates a new CheckCast instruction. @@ -76,9 +76,9 @@ // TODO(tw): Find a better way to handle anchors. private void freeAnchor() { - ValueAnchorNode anchor = usages().filter(ValueAnchorNode.class).first(); - if (anchor != null) { - anchor.replaceFirstInput(this, null); + ValueAnchorNode anchorUsage = usages().filter(ValueAnchorNode.class).first(); + if (anchorUsage != null) { + anchorUsage.replaceFirstInput(this, null); } }
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/CompareAndSwapNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/CompareAndSwapNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -80,16 +80,19 @@ } // specialized on value type until boxing/unboxing is sorted out in intrinsification + @SuppressWarnings("unused") @NodeIntrinsic public static boolean compareAndSwap(Object object, long offset, Object expected, Object newValue) { throw new UnsupportedOperationException(); } + @SuppressWarnings("unused") @NodeIntrinsic public static boolean compareAndSwap(Object object, long offset, long expected, long newValue) { throw new UnsupportedOperationException(); } + @SuppressWarnings("unused") @NodeIntrinsic public static boolean compareAndSwap(Object object, long offset, int expected, int newValue) { throw new UnsupportedOperationException();
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/LoadFieldNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/LoadFieldNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -77,18 +77,4 @@ } return this; } - - /** - * Gets a constant value to which this load can be reduced. - * - * @return {@code null} if this load cannot be reduced to a constant - */ - private CiConstant constantValue() { - if (isStatic()) { - return field.constantValue(null); - } else if (object().isConstant()) { - return field.constantValue(object().asConstant()); - } - return null; - } }
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/NewInstanceNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/NewInstanceNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -91,7 +91,7 @@ @Override public EscapeField[] fields(Node node) { NewInstanceNode x = (NewInstanceNode) node; - List<EscapeField> escapeFields = new ArrayList<EscapeField>(); + List<EscapeField> escapeFields = new ArrayList<>(); fillEscapeFields(x.instanceClass(), escapeFields); return escapeFields.toArray(new EscapeField[escapeFields.size()]); }
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/NewMultiArrayNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/java/NewMultiArrayNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -55,7 +55,7 @@ public NewMultiArrayNode(RiResolvedType type, ValueNode[] dimensions) { super(StampFactory.exactNonNull(type)); this.type = type; - this.dimensions = new NodeInputList<ValueNode>(this, dimensions); + this.dimensions = new NodeInputList<>(this, dimensions); assert dimensions.length > 0 && type.isArrayClass(); }
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/loop/DerivedInductionVariableNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/loop/DerivedInductionVariableNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -76,24 +76,24 @@ * @return the new BasicInductionVariable */ public BasicInductionVariableNode toBasicInductionVariable() { - InductionVariableNode base = base(); - if (base instanceof DerivedInductionVariableNode) { - base = ((DerivedInductionVariableNode) base).toBasicInductionVariable(); + InductionVariableNode b = base(); + if (b instanceof DerivedInductionVariableNode) { + b = ((DerivedInductionVariableNode) b).toBasicInductionVariable(); } ValueNode init; ValueNode stride; LoopCounterNode counter; - if (base instanceof BasicInductionVariableNode) { - BasicInductionVariableNode basic = (BasicInductionVariableNode) base; + if (b instanceof BasicInductionVariableNode) { + BasicInductionVariableNode basic = (BasicInductionVariableNode) b; // let the canonicalizer do its job with this init = IntegerArithmeticNode.add(offset(), IntegerArithmeticNode.mul(scale(), basic.init())); stride = IntegerArithmeticNode.mul(scale(), basic.stride()); counter = basic.loopCounter(); } else { - assert base instanceof LoopCounterNode; + assert b instanceof LoopCounterNode; init = offset(); stride = scale(); - counter = (LoopCounterNode) base; + counter = (LoopCounterNode) b; } BasicInductionVariableNode newBIV = graph().add(new BasicInductionVariableNode(kind(), init, stride, counter)); this.replaceAndDelete(newBIV);
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/loop/LoopCounterNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/loop/LoopCounterNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -52,7 +52,7 @@ biv = createBasicInductionVariable(); biv.peelOneIteration(); } - usage.inputs().replace(this, biv); + usage.replaceFirstInput(this, biv); } } }
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/type/StampFactory.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/type/StampFactory.java Sun Dec 18 05:24:06 2011 +0100 @@ -81,6 +81,11 @@ } @Override + public int hashCode() { + return kind.hashCode(); + } + + @Override public String toString() { return String.format("%c%s %s %s", kind().typeChar, nonNull ? "!" : "", declaredType == null ? "-" : declaredType.name(), exactType == null ? "-" : exactType.name()); }
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/util/ComputeImmediateDominator.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/util/ComputeImmediateDominator.java Sun Dec 18 05:24:06 2011 +0100 @@ -39,8 +39,8 @@ public ComputeImmediateDominator(MergeNode dominated) { this.dominated = dominated; - this.toExplore = new LinkedList<FixedNode>(); - this.speculativeExplore = new LinkedList<FixedNode>(); + this.toExplore = new LinkedList<>(); + this.speculativeExplore = new LinkedList<>(); this.infoMap = dominated.graph().createNodeMap(); fullInfo = new DominatorInfo(dominated, true); @@ -165,8 +165,8 @@ this.node = node; this.bits = new BitSet(); this.ownBits = new BitSet(); - this.children = new ArrayList<DominatorInfo>(2); - this.parents = new ArrayList<DominatorInfo>(2); + this.children = new ArrayList<>(2); + this.parents = new ArrayList<>(2); if (full) { addOwnBits(0); } @@ -180,8 +180,8 @@ explored = true; } - public DominatorInfo createChild(FixedNode node) { - DominatorInfo di = new DominatorInfo(node, false); + public DominatorInfo createChild(FixedNode childNode) { + DominatorInfo di = new DominatorInfo(childNode, false); di.bits.or(bits); di.ownBits.or(ownBits); if (!children.isEmpty() || di.ownBits.isEmpty()) { @@ -252,5 +252,10 @@ public String toString() { return bits + " (o" + ownBits + ") " + node; } + + @Override + public int hashCode() { + return bits.hashCode(); + } } }
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/util/TreeIterators.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/util/TreeIterators.java Sun Dec 18 05:24:06 2011 +0100 @@ -27,7 +27,7 @@ public class TreeIterators { public abstract static class PrefixTreeIterator<T> implements Iterator<T>{ - private Deque<T> stack = new LinkedList<T>(); + private Deque<T> stack = new LinkedList<>(); public PrefixTreeIterator(T root) { stack.push(root); @@ -47,7 +47,7 @@ @Override public T next() { T top = stack.pop(); - LinkedList<T> list = new LinkedList<T>(); + LinkedList<T> list = new LinkedList<>(); for (T child : children(top)) { list.addFirst(child); }
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/GraalIntrinsics.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/GraalIntrinsics.java Sun Dec 18 05:24:06 2011 +0100 @@ -39,7 +39,7 @@ Snippets.install(runtime, target, new FloatSnippets(), GraalOptions.PlotSnippets, plan); Snippets.install(runtime, target, new NodeClassSnippets(), GraalOptions.PlotSnippets, plan); Snippets.install(runtime, target, new ArrayCopySnippets(), GraalOptions.PlotSnippets, plan); - plan.addPhase(PhasePosition.HIGH_LEVEL, new IntrinsifyArrayCopyPhase(runtime, target, plan)); + plan.addPhase(PhasePosition.HIGH_LEVEL, new IntrinsifyArrayCopyPhase(runtime)); } } }
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/IntrinsifyArrayCopyPhase.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/IntrinsifyArrayCopyPhase.java Sun Dec 18 05:24:06 2011 +0100 @@ -29,16 +29,11 @@ import com.oracle.max.graal.cri.*; import com.oracle.max.graal.graph.*; import com.oracle.max.graal.nodes.*; -import com.oracle.max.graal.nodes.extended.*; import com.oracle.max.graal.nodes.java.*; -import com.sun.cri.ci.*; import com.sun.cri.ri.*; public class IntrinsifyArrayCopyPhase extends Phase { private final GraalRuntime runtime; - private final CiTarget target; - private final PhasePlan plan; - private BoxingMethodPool pool; private RiResolvedMethod arrayCopy; private RiResolvedMethod byteArrayCopy; private RiResolvedMethod shortArrayCopy; @@ -46,11 +41,8 @@ private RiResolvedMethod intArrayCopy; private RiResolvedMethod longArrayCopy; - public IntrinsifyArrayCopyPhase(GraalRuntime runtime, CiTarget target, PhasePlan plan) { + public IntrinsifyArrayCopyPhase(GraalRuntime runtime) { this.runtime = runtime; - this.target = target; - this.plan = plan; - this.pool = new BoxingMethodPool(runtime); try { byteArrayCopy = getArrayCopySnippet(runtime, byte.class); charArrayCopy = getArrayCopySnippet(runtime, char.class);
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/NodeClassSnippets.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/NodeClassSnippets.java Sun Dec 18 05:24:06 2011 +0100 @@ -29,6 +29,7 @@ /** * Snippets for {@link NodeClass} methods. */ +@SuppressWarnings("unused") @ClassSubstitution(NodeClass.class) public class NodeClassSnippets implements SnippetsInterface {
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/nodes/ArrayHeaderSizeNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/nodes/ArrayHeaderSizeNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -45,6 +45,7 @@ return elementKind; } + @SuppressWarnings("unused") @NodeIntrinsic public static long sizeFor(@ConstantNodeParameter CiKind kind) { throw new UnsupportedOperationException("This method may only be compiled with the Graal compiler");
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/nodes/MathIntrinsicNode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/nodes/MathIntrinsicNode.java Sun Dec 18 05:24:06 2011 +0100 @@ -90,6 +90,7 @@ return this; } + @SuppressWarnings("unused") @NodeIntrinsic public static double compute(double x, @ConstantNodeParameter Operation op) { throw new UnsupportedOperationException("This method may only be compiled with the Graal compiler");
--- a/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/target/amd64/AMD64MathIntrinsicOpcode.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.snippets/src/com/oracle/max/graal/snippets/target/amd64/AMD64MathIntrinsicOpcode.java Sun Dec 18 05:24:06 2011 +0100 @@ -40,12 +40,14 @@ return new AMD64LIRInstruction(this, result, null, inputs, LIRInstruction.NO_OPERANDS, LIRInstruction.NO_OPERANDS) { @Override public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) { - CiValue input = input(0); - emit(tasm, masm, tasm.asDoubleReg(result()), tasm.asDoubleReg(input)); + emit(tasm, masm, tasm.asDoubleReg(result()), tasm.asDoubleReg(input(0))); } }; } + /** + * @param tasm + */ private void emit(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiRegister result, CiRegister input) { switch (this) { case SQRT: masm.sqrtsd(result, input); break;
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/BoxingEliminationTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/BoxingEliminationTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -41,6 +41,7 @@ private static final String REFERENCE_SNIPPET = "referenceSnippet"; + @SuppressWarnings("all") public static int referenceSnippet(int a) { return 1; } @@ -58,6 +59,7 @@ test("test1Snippet"); } + @SuppressWarnings("all") public static int test1Snippet(int a) { return boxedInteger(); } @@ -67,6 +69,7 @@ test("test2Snippet"); } + @SuppressWarnings("all") public static int test2Snippet(int a) { return (Integer) boxedObject(); } @@ -75,6 +78,7 @@ test("test3Snippet"); } + @SuppressWarnings("all") public static int test3Snippet(int a) { int b = boxedInteger(); if (b < 0) { @@ -99,14 +103,14 @@ n.replaceFirstInput(local, constant); } } - Collection<Invoke> hints = new ArrayList<Invoke>(); + Collection<Invoke> hints = new ArrayList<>(); for (Invoke invoke : graph.getInvokes()) { hints.add(invoke); } new InliningPhase(null, runtime(), hints, null, phasePlan).apply(graph); new CanonicalizerPhase(null, runtime(), null).apply(graph); print(graph); - new BoxingEliminationPhase(runtime()).apply(graph); + new BoxingEliminationPhase().apply(graph); print(graph); new ExpandBoxingNodesPhase(pool).apply(graph); new CanonicalizerPhase(null, runtime(), null).apply(graph);
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/DegeneratedLoopsTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/DegeneratedLoopsTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -37,6 +37,7 @@ private static final String REFERENCE_SNIPPET = "referenceSnippet"; + @SuppressWarnings("all") public static int referenceSnippet(int a) { return 1; } @@ -47,6 +48,11 @@ } private static class UnresolvedException extends RuntimeException { + /** + * + */ + private static final long serialVersionUID = 5215434338750728440L; + static { if (true) { throw new UnsupportedOperationException("this class may never be initialized"); @@ -54,6 +60,7 @@ } } + @SuppressWarnings("all") public static int test1Snippet(int a) { for (;;) { try {
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/EscapeAnalysisTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/EscapeAnalysisTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -42,6 +42,7 @@ test("test1Snippet", CiConstant.forInt(101)); } + @SuppressWarnings("all") public static int test1Snippet(int a) { Integer x = new Integer(101); return x.intValue(); @@ -52,6 +53,7 @@ test("test2Snippet", CiConstant.forInt(0)); } + @SuppressWarnings("all") public static int test2Snippet(int a) { Integer[] x = new Integer[0]; return x.length; @@ -62,6 +64,7 @@ test("test3Snippet", CiConstant.forObject(null)); } + @SuppressWarnings("all") public static Object test3Snippet(int a) { Integer[] x = new Integer[1]; return x[0]; @@ -74,6 +77,7 @@ private static native void notInlineable(); + @SuppressWarnings("all") public static int testMonitorSnippet(int a) { Integer x = new Integer(0); Integer[] y = new Integer[0]; @@ -96,6 +100,7 @@ /** * This test case differs from the last one in that it requires inlining within a synchronized region. */ + @SuppressWarnings("all") public static int testMonitor2Snippet(int a) { Integer x = new Integer(0); Integer[] y = new Integer[0]; @@ -110,7 +115,6 @@ } } - @SuppressWarnings("unused") private void test(String snippet, CiConstant expectedResult) { StructuredGraph graph = parse(snippet); for (Invoke n : graph.getInvokes()) { @@ -130,10 +134,10 @@ } Assert.assertEquals(1, retCount); int newInstanceCount = 0; - for (NewInstanceNode n : graph.getNodes(NewInstanceNode.class)) { + for (@SuppressWarnings("unused") NewInstanceNode n : graph.getNodes(NewInstanceNode.class)) { newInstanceCount++; } - for (NewObjectArrayNode n : graph.getNodes(NewObjectArrayNode.class)) { + for (@SuppressWarnings("unused") NewObjectArrayNode n : graph.getNodes(NewObjectArrayNode.class)) { newInstanceCount++; } Assert.assertEquals(0, newInstanceCount);
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/GraalRuntimeAccess.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/GraalRuntimeAccess.java Sun Dec 18 05:24:06 2011 +0100 @@ -37,7 +37,7 @@ * have aliases that can be used with the {@code "graal.runtime"} system property to * specify the VM environment to try first when getting a Graal runtime instance. */ - private static Map<String, String> graalRuntimeFactoryClasses = new LinkedHashMap<String, String>(); + private static Map<String, String> graalRuntimeFactoryClasses = new LinkedHashMap<>(); static { graalRuntimeFactoryClasses.put("HotSpot", "com.oracle.max.graal.hotspot.CompilerImpl"); graalRuntimeFactoryClasses.put("Maxine", "com.oracle.max.vm.ext.maxri.MaxRuntime");
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/IfBoxingEliminationTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/IfBoxingEliminationTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -76,7 +76,7 @@ phasePlan.addPhase(PhasePosition.AFTER_PARSING, identifyBoxingPhase); phasePlan.addPhase(PhasePosition.AFTER_PARSING, new PhiStampPhase()); identifyBoxingPhase.apply(graph); - Collection<Invoke> hints = new ArrayList<Invoke>(); + Collection<Invoke> hints = new ArrayList<>(); for (Invoke invoke : graph.getInvokes()) { hints.add(invoke); } @@ -85,7 +85,7 @@ new PhiStampPhase().apply(graph); new CanonicalizerPhase(null, runtime(), null).apply(graph); print(graph); - new BoxingEliminationPhase(runtime()).apply(graph); + new BoxingEliminationPhase().apply(graph); print(graph); new ExpandBoxingNodesPhase(pool).apply(graph); new CanonicalizerPhase(null, runtime(), null).apply(graph);
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/IfCanonicalizerTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/IfCanonicalizerTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -37,6 +37,7 @@ private static final String REFERENCE_SNIPPET = "referenceSnippet"; + @SuppressWarnings("all") public static int referenceSnippet(int a) { return 1; } @@ -46,6 +47,7 @@ test("test1Snippet"); } + @SuppressWarnings("all") public static int test1Snippet(int a) { if (a == 0) { return 1; @@ -59,6 +61,7 @@ test("test2Snippet"); } + @SuppressWarnings("all") public static int test2Snippet(int a) { if (a == 0) { if (a == 0) { @@ -77,6 +80,7 @@ test("test3Snippet"); } + @SuppressWarnings("all") public static int test3Snippet(int a) { if (a == 0) { if (a != 1) {
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/InvokeTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/InvokeTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -39,6 +39,7 @@ private static final String REFERENCE_SNIPPET = "referenceSnippet"; + @SuppressWarnings("all") public static int referenceSnippet(int a) { return 1; } @@ -52,6 +53,7 @@ test("test1Snippet"); } + @SuppressWarnings("all") public static int test1Snippet(int a) { return const1(); } @@ -61,6 +63,7 @@ test("test2Snippet"); } + @SuppressWarnings("all") public static int test2Snippet(int a) { return const1() + const1() + const1() + const1() + const1() + const1() + const1(); } @@ -76,7 +79,7 @@ n.replaceFirstInput(local, constant); } } - Collection<Invoke> hints = new ArrayList<Invoke>(); + Collection<Invoke> hints = new ArrayList<>(); for (Invoke invoke : graph.getInvokes()) { hints.add(invoke); }
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/MonitorTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/MonitorTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -40,6 +40,7 @@ private static final String REFERENCE_SNIPPET = "referenceSnippet"; + @SuppressWarnings("all") public static synchronized int referenceSnippet(int a) { return 1; } @@ -53,6 +54,7 @@ test("test1Snippet"); } + @SuppressWarnings("all") public static synchronized int test1Snippet(int a) { return const1(); } @@ -66,6 +68,7 @@ Assert.assertEquals(monitor.stateAfter().bci, 3); } + @SuppressWarnings("all") public static int test2Snippet(int a) { return const2(); } @@ -85,7 +88,7 @@ n.replaceFirstInput(local, constant); } } - Collection<Invoke> hints = new ArrayList<Invoke>(); + Collection<Invoke> hints = new ArrayList<>(); for (Invoke invoke : graph.getInvokes()) { hints.add(invoke); }
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/NestedLoopTest.java Sun Dec 18 05:23:52 2011 +0100 +++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/NestedLoopTest.java Sun Dec 18 05:24:06 2011 +0100 @@ -54,6 +54,7 @@ test("test4Snippet"); } + @SuppressWarnings("all") public static void test1Snippet(int a) { while (a()) { m1: while (b()) { @@ -66,6 +67,7 @@ } } + @SuppressWarnings("all") public static void test2Snippet(int a) { while (a()) { try { @@ -81,6 +83,7 @@ } } + @SuppressWarnings("all") public static void test3Snippet(int a) { while (a == 0) { try { @@ -133,7 +136,7 @@ return false; } - private Invoke getInvoke(String name, StructuredGraph graph) { + private static Invoke getInvoke(String name, StructuredGraph graph) { for (Invoke invoke : graph.getInvokes()) { if (invoke.callTarget().targetMethod().name().equals(name)) { return invoke;