# HG changeset patch # User Christian Wimmer # Date 1349821418 25200 # Node ID 2463eb24b6443c9b686ef805e203d9cb723cd278 # Parent d1ba5ba4f48416ef7b6d2dec21ea29fe519ce69c Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods. diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Address.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Address.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Address.java Tue Oct 09 15:23:38 2012 -0700 @@ -37,7 +37,7 @@ /** * A sentinel value used as a place holder in an instruction stream for an address that will be patched. */ - public static final Address Placeholder = new Address(Kind.Illegal, Value.IllegalValue); + public static final Address Placeholder = new Address(Kind.Illegal, Value.ILLEGAL); private Value base; private Value index; @@ -51,7 +51,7 @@ * @param base the base register */ public Address(Kind kind, Value base) { - this(kind, base, IllegalValue, Scale.Times1, 0); + this(kind, base, ILLEGAL, Scale.Times1, 0); } /** @@ -62,7 +62,7 @@ * @param displacement the displacement */ public Address(Kind kind, Value base, int displacement) { - this(kind, base, IllegalValue, Scale.Times1, displacement); + this(kind, base, ILLEGAL, Scale.Times1, displacement); } /** @@ -128,7 +128,7 @@ } StringBuilder s = new StringBuilder(); - s.append(getKind().javaName).append("["); + s.append(getKind().getJavaName()).append("["); String sep = ""; if (isLegal(getBase())) { s.append(getBase()); @@ -163,7 +163,7 @@ /** * @return Base register that defines the start of the address computation. - * If not present, is denoted by {@link Value#IllegalValue}. + * If not present, is denoted by {@link Value#ILLEGAL}. */ public Value getBase() { return base; @@ -175,7 +175,7 @@ /** * @return Index register, the value of which (possibly scaled by {@link #scale}) is added to {@link #base}. - * If not present, is denoted by {@link Value#IllegalValue}. + * If not present, is denoted by {@link Value#ILLEGAL}. */ public Value getIndex() { return index; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java Tue Oct 09 15:23:38 2012 -0700 @@ -92,7 +92,7 @@ * Creates a description of the registers and stack locations used by a call. * * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of the call - * @param returnLocation the location for the return value or {@link Value#IllegalValue} if a void call + * @param returnLocation the location for the return value or {@link Value#ILLEGAL} if a void call * @param argumentLocations the ordered locations in which the arguments are placed */ public CallingConvention(int stackSize, Value returnLocation, Value... argumentLocations) { @@ -104,7 +104,7 @@ * * @param temporaryLocations the locations used (and killed) by the call in addition to {@code arguments} * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of the call - * @param returnLocation the location for the return value or {@link Value#IllegalValue} if a void call + * @param returnLocation the location for the return value or {@link Value#ILLEGAL} if a void call * @param argumentLocations the ordered locations in which the arguments are placed */ public CallingConvention(Value[] temporaryLocations, int stackSize, Value returnLocation, Value... argumentLocations) { @@ -119,7 +119,7 @@ } /** - * Gets the location for the return value or {@link Value#IllegalValue} if a void call. + * Gets the location for the return value or {@link Value#ILLEGAL} if a void call. */ public Value getReturn() { return returnLocation; @@ -165,7 +165,7 @@ sb.append(sep).append(op); sep = ", "; } - if (returnLocation != Value.IllegalValue) { + if (returnLocation != Value.ILLEGAL) { sb.append(" -> ").append(returnLocation); } if (temporaryLocations.length != 0) { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java Tue Oct 09 15:23:38 2012 -0700 @@ -26,26 +26,26 @@ import com.oracle.graal.api.meta.*; /** - * Encapsulates the main functionality of the runtime for the compiler, including access - * to constant pools, OSR frames, inlining requirements, and runtime calls such as checkcast. -s */ + * Encapsulates the main functionality of the runtime for the compiler. + */ public interface CodeCacheProvider extends MetaAccessProvider { /** - * Adds the given compilation result as an implementation of the given method without making it the default implementation. + * Adds the given compilation result as an implementation of the given method without making it the default + * implementation. * * @param method a method to which the executable code is begin added * @param compResult the compilation result to be added - * @param info the object into which details of the installed code will be written. - * Ignored if null, otherwise the info is written to index 0 of this array. + * @param info the object into which details of the installed code will be written. Ignored if null, otherwise the + * info is written to index 0 of this array. * @return a reference to the compiled and ready-to-run code */ InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult, CodeInfo[] info); /** - * Get the size in bytes for locking information on the stack. + * Returns the size in bytes for locking information on the stack. */ - int sizeOfLockData(); + int getSizeOfLockData(); /** * Returns a disassembly of the given installed code. @@ -60,10 +60,11 @@ * * @param method the top level method of a compilation */ - RegisterConfig getRegisterConfig(JavaMethod method); + RegisterConfig lookupRegisterConfig(JavaMethod method); /** * Custom area on the stack of each compiled method that the VM can use for its own purposes. + * * @return the size of the custom area in bytes */ int getCustomStackAreaSize(); @@ -71,6 +72,7 @@ /** * Minimum size of the stack area reserved for outgoing parameters. This area is reserved in all cases, even when * the compiled method has no regular call instructions. + * * @return the minimum size of the outgoing parameter area in bytes */ int getMinimumOutgoingSize(); @@ -78,30 +80,17 @@ /** * Performs any runtime-specific conversion on the object used to describe the target of a call. */ - Object asCallTarget(Object target); + Object lookupCallTarget(Object target); /** * Gets the signature and linkage information for a runtime call. */ - RuntimeCall getRuntimeCall(Descriptor descriptor); + RuntimeCall lookupRuntimeCall(Descriptor descriptor); /** * Encodes a deoptimization action and a deoptimization reason in an integer value. + * * @return the encoded value as an integer */ int encodeDeoptActionAndReason(DeoptimizationAction action, DeoptimizationReason reason); - - /** - * Converts a {@link DeoptimizationReason} into an integer value. - * - * @return an integer value representing the given {@link DeoptimizationReason} - */ - int convertDeoptReason(DeoptimizationReason reason); - - /** - * Converts a {@link DeoptimizationAction} into an integer value. - * - * @return an integer value representing the given {@link DeoptimizationAction} - */ - int convertDeoptAction(DeoptimizationAction action); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeInfo.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeInfo.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeInfo.java Tue Oct 09 15:23:38 2012 -0700 @@ -32,17 +32,17 @@ public interface CodeInfo { /** - * Gets the start address of this installed code. + * Returns the start address of this installed code. */ - long start(); + long getStart(); /** - * Gets a copy of this installed code. + * Returns a copy of this installed code. */ - byte[] code(); + byte[] getCode(); /** - * Gets the method (if any) from which this installed code was compiled. + * Returns the method (if any) from which this installed code was compiled. */ - ResolvedJavaMethod method(); + ResolvedJavaMethod getMethod(); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationQueue.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationQueue.java Tue Oct 09 14:06:26 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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.graal.api.code; - -import com.oracle.graal.api.meta.*; - -/** - * Callback mechanism for the VM to schedule a compilation. - */ -public interface CompilationQueue { - - boolean enqueue(final ResolvedJavaMethod method, final int entryBCI, boolean blocking, int priority) throws Throwable; -} diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java Tue Oct 09 15:23:38 2012 -0700 @@ -149,7 +149,7 @@ } /** - * Provides extra information about instructions or data at specific positions in {@link CompilationResult#targetCode()}. + * Provides extra information about instructions or data at specific positions in {@link CompilationResult#getTargetCode()}. * This is optional information that can be used to enhance a disassembly of the code. */ public abstract static class CodeAnnotation implements Serializable { @@ -340,17 +340,11 @@ private Assumptions assumptions; - /** - * Constructs a new target method. - */ - public CompilationResult() { - } - public void setAssumptions(Assumptions assumptions) { this.assumptions = assumptions; } - public Assumptions assumptions() { + public Assumptions getAssumptions() { return assumptions; } @@ -392,7 +386,7 @@ * * @param codePos the position of the call in the code array * @param size the size of the call instruction - * @param target the {@link CodeCacheProvider#asCallTarget(Object) target} being called + * @param target the {@link CodeCacheProvider#lookupCallTarget(Object) target} being called * @param debugInfo the debug info for the call * @param direct specifies if this is a {@linkplain Call#direct direct} call */ @@ -459,7 +453,7 @@ * * @return the frame size */ - public int frameSize() { + public int getFrameSize() { assert frameSize != -1 : "frame size not yet initialized!"; return frameSize; } @@ -468,7 +462,7 @@ * @return the code offset of the start of the epilogue that restores all callee saved registers, or -1 if this is * not a callee saved method */ - public int registerRestoreEpilogueOffset() { + public int getRegisterRestoreEpilogueOffset() { return registerRestoreEpilogueOffset; } @@ -476,12 +470,12 @@ * Offset in bytes for the custom stack area (relative to sp). * @return the offset in bytes */ - public int customStackAreaOffset() { + public int getCustomStackAreaOffset() { return customStackAreaOffset; } /** - * @see #customStackAreaOffset() + * @see #getCustomStackAreaOffset() * @param offset */ public void setCustomStackAreaOffset(int offset) { @@ -491,21 +485,21 @@ /** * @return the machine code generated for this method */ - public byte[] targetCode() { + public byte[] getTargetCode() { return targetCode; } /** * @return the size of the machine code generated for this method */ - public int targetCodeSize() { + public int getTargetCodeSize() { return targetCodeSize; } /** * @return the code annotations or {@code null} if there are none */ - public List annotations() { + public List getAnnotations() { return annotations; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java Tue Oct 09 15:23:38 2012 -0700 @@ -39,9 +39,8 @@ /** * Returns the method to which the compiled code belongs. - * @return the method to which the compiled code belongs. */ - ResolvedJavaMethod method(); + ResolvedJavaMethod getMethod(); /** * @return true if the code represented by this object is still valid, false otherwise (may happen due to deopt, etc.) diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterValue.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterValue.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterValue.java Tue Oct 09 15:23:38 2012 -0700 @@ -49,7 +49,7 @@ @Override public String toString() { - return getRegister().name + kindSuffix(); + return getRegister().name + getKindSuffix(); } /** diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java Tue Oct 09 15:23:38 2012 -0700 @@ -28,7 +28,7 @@ /** * Represents a compiler spill slot or an outgoing stack-based argument in a method's frame - * or an incoming stack-based argument in a method's {@linkplain #inCallerFrame() caller's frame}. + * or an incoming stack-based argument in a method's {@linkplain #isInCallerFrame() caller's frame}. */ public final class StackSlot extends Value { private static final long serialVersionUID = -7725071921307318433L; @@ -46,7 +46,7 @@ * or the beginning of the frame (stack pointer + total frame size). */ public static StackSlot get(Kind kind, int offset, boolean addFrameSize) { - assert kind.stackKind() == kind; + assert kind.getStackKind() == kind; assert addFrameSize || offset >= 0; if (offset % CACHE_GRANULARITY == 0) { @@ -83,22 +83,22 @@ * Gets the offset of this stack slot, relative to the stack pointer. * @return The offset of this slot (in bytes). */ - public int offset(int totalFrameSize) { + public int getOffset(int totalFrameSize) { assert totalFrameSize > 0 || !addFrameSize; int result = offset + (addFrameSize ? totalFrameSize : 0); assert result >= 0; return result; } - public boolean inCallerFrame() { + public boolean isInCallerFrame() { return addFrameSize && offset >= 0; } - public int rawOffset() { + public int getRawOffset() { return offset; } - public boolean rawAddFrameSize() { + public boolean getRawAddFrameSize() { return addFrameSize; } @@ -122,11 +122,11 @@ @Override public String toString() { if (!addFrameSize) { - return "out:" + offset + kindSuffix(); + return "out:" + offset + getKindSuffix(); } else if (offset >= 0) { - return "in:" + offset + kindSuffix(); + return "in:" + offset + getKindSuffix(); } else { - return "stack:" + (-offset) + kindSuffix(); + return "stack:" + (-offset) + getKindSuffix(); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java Tue Oct 09 15:23:38 2012 -0700 @@ -62,7 +62,7 @@ types = new ResolvedJavaType[] {type}; exact = true; } else { - ResolvedJavaType uniqueSubtype = type == null ? null : type.uniqueConcreteSubtype(); + ResolvedJavaType uniqueSubtype = type == null ? null : type.findUniqueConcreteSubtype(); if (uniqueSubtype != null) { types = new ResolvedJavaType[] {uniqueSubtype}; if (assumptions != null) { @@ -83,10 +83,10 @@ int hintCount = 0; double totalHintProbability = 0.0d; for (ProfiledType ptype : ptypes) { - ResolvedJavaType hint = ptype.type; + ResolvedJavaType hint = ptype.getType(); if (type != null && hint.isSubtypeOf(type)) { hintTypes[hintCount++] = hint; - totalHintProbability += ptype.probability; + totalHintProbability += ptype.getProbability(); } } if (totalHintProbability >= minHintHitProbability) { @@ -105,6 +105,6 @@ } public static boolean isFinalClass(ResolvedJavaType type) { - return Modifier.isFinal(type.accessFlags()) || (type.isArrayClass() && Modifier.isFinal(type.componentType().accessFlags())); + return Modifier.isFinal(type.getModifiers()) || (type.isArrayClass() && Modifier.isFinal(type.getComponentType().getModifiers())); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java Tue Oct 09 15:23:38 2012 -0700 @@ -30,7 +30,7 @@ public final class ValueUtil { public static boolean isIllegal(Value value) { assert value != null; - return value == Value.IllegalValue; + return value == Value.ILLEGAL; } public static boolean isLegal(Value value) { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java Tue Oct 09 15:23:38 2012 -0700 @@ -38,7 +38,7 @@ /** * Creates a new {@link VirtualObject} for the given type, with the given fields. If the type is an instance class * then the values array needs to have one entry for each field, ordered in like the fields returned by - * {@link ResolvedJavaType#declaredFields()}. If the type is an array then the length of the values array determines + * {@link ResolvedJavaType#getDeclaredFields()}. If the type is an array then the length of the values array determines * the reallocated array length. * * @param type the type of the object whose allocation was removed during compilation. This can be either an @@ -65,23 +65,23 @@ } /** - * @return the type of the object whose allocation was removed during compilation. This can be either an instance of an array type. + * Returns the type of the object whose allocation was removed during compilation. This can be either an instance of an array type. */ - public JavaType type() { + public JavaType getType() { return type; } /** - * @return an array containing all the values to be stored into the object when it is recreated. + * Returns an array containing all the values to be stored into the object when it is recreated. */ - public Value[] values() { + public Value[] getValues() { return values; } /** - * @return the unique id that identifies the object within the debug information for one position in the compiled code. + * Returns the unique id that identifies the object within the debug information for one position in the compiled code. */ - public int id() { + public int getId() { return id; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java Tue Oct 09 15:23:38 2012 -0700 @@ -23,11 +23,12 @@ package com.oracle.graal.api.meta; /** - * Represents a constant (boxed) value, such as an integer, floating point number, or object reference, - * within the compiler and across the compiler/runtime interface. Exports a set of {@code Constant} - * instances that represent frequently used constant values, such as {@link #NULL_OBJECT}. + * Represents a constant (boxed) value, such as an integer, floating point number, or object reference, within the + * compiler and across the compiler/runtime interface. Exports a set of {@code Constant} instances that represent + * frequently used constant values, such as {@link #NULL_OBJECT}. */ public final class Constant extends Value { + private static final long serialVersionUID = -6355452536852663986L; private static final Constant[] INT_CONSTANT_CACHE = new Constant[100]; @@ -67,15 +68,15 @@ private final Object object; /** - * The boxed primitive value as a {@code long}. This is ignored iff {@code kind.isObject()}. - * For {@code float} and {@code double} values, this value is the result of - * {@link Float#floatToRawIntBits(float)} and {@link Double#doubleToRawLongBits(double)} respectively. + * The boxed primitive value as a {@code long}. This is ignored iff {@code kind.isObject()}. For {@code float} and + * {@code double} values, this value is the result of {@link Float#floatToRawIntBits(float)} and + * {@link Double#doubleToRawLongBits(double)} respectively. */ private final long primitive; /** * Create a new constant represented by the specified object reference. - * + * * @param kind the type of this constant * @param object the value of this constant */ @@ -87,7 +88,7 @@ /** * Create a new constant represented by the specified primitive. - * + * * @param kind the type of this constant * @param primitive the value of this constant */ @@ -99,6 +100,7 @@ /** * Checks whether this constant is non-null. + * * @return {@code true} if this constant is a primitive, or an object constant that is not null */ public boolean isNonNull() { @@ -107,6 +109,7 @@ /** * Checks whether this constant is null. + * * @return {@code true} if this constant is the null constant */ public boolean isNull() { @@ -115,51 +118,37 @@ @Override public String toString() { - return getKind().javaName + "[" + getKind().format(boxedValue()) + (getKind() != Kind.Object ? "|0x" + Long.toHexString(primitive) : "") + "]"; - } - - /** - * Gets this constant's value as a string. - * - * @return this constant's value as a string - */ - public String valueString() { - if (getKind().isPrimitive()) { - return boxedValue().toString(); - } else if (getKind().isObject()) { - if (object == null) { - return "null"; - } else if (object instanceof String) { - return "\"" + object + "\""; - } else { - return ""; - } - } else if (getKind().isJsr()) { - return "bci:" + boxedValue().toString(); - } else { - return "???"; - } + return getKind().getJavaName() + "[" + getKind().format(asBoxedValue()) + (getKind() != Kind.Object ? "|0x" + Long.toHexString(primitive) : "") + "]"; } /** * Returns the value of this constant as a boxed Java value. + * * @return the value of this constant */ - public Object boxedValue() { - // Checkstyle: stop + public Object asBoxedValue() { switch (getKind()) { - case Byte: return (byte) asInt(); - case Boolean: return asInt() == 0 ? Boolean.FALSE : Boolean.TRUE; - case Short: return (short) asInt(); - case Char: return (char) asInt(); - case Jsr: return (int) primitive; - case Int: return asInt(); - case Long: return asLong(); - case Float: return asFloat(); - case Double: return asDouble(); - case Object: return object; + case Byte: + return (byte) asInt(); + case Boolean: + return asInt() == 0 ? Boolean.FALSE : Boolean.TRUE; + case Short: + return (short) asInt(); + case Char: + return (char) asInt(); + case Jsr: + return (int) primitive; + case Int: + return asInt(); + case Long: + return asLong(); + case Float: + return asFloat(); + case Double: + return asDouble(); + case Object: + return object; } - // Checkstyle: resume throw new IllegalArgumentException(); } @@ -176,10 +165,11 @@ /** * Converts this constant to a primitive int. + * * @return the int value of this constant */ public int asInt() { - if (getKind().stackKind().isStackInt() || getKind().isJsr()) { + if (getKind().getStackKind().isStackInt() || getKind().isJsr()) { return (int) primitive; } throw new Error("Constant is not int: " + this); @@ -187,6 +177,7 @@ /** * Converts this constant to a primitive boolean. + * * @return the boolean value of this constant */ public boolean asBoolean() { @@ -198,23 +189,27 @@ /** * Converts this constant to a primitive long. + * * @return the long value of this constant */ public long asLong() { - // Checkstyle: stop - switch (getKind().stackKind()) { + switch (getKind().getStackKind()) { case Jsr: case Int: - case Long: return primitive; - case Float: return (long) asFloat(); - case Double: return (long) asDouble(); - default: throw new Error("Constant is not long: " + this); + case Long: + return primitive; + case Float: + return (long) asFloat(); + case Double: + return (long) asDouble(); + default: + throw new Error("Constant is not long: " + this); } - // Checkstyle: resume } /** * Converts this constant to a primitive float. + * * @return the float value of this constant */ public float asFloat() { @@ -226,6 +221,7 @@ /** * Converts this constant to a primitive double. + * * @return the double value of this constant */ public double asDouble() { @@ -240,6 +236,7 @@ /** * Converts this constant to the object reference it represents. + * * @return the object which this constant represents */ public Object asObject() { @@ -251,6 +248,7 @@ /** * Converts this constant to the jsr reference it represents. + * * @return the object which this constant represents */ public int asJsr() { @@ -272,6 +270,7 @@ /** * Computes the hashcode of this constant. + * * @return a suitable hashcode for this constant */ @Override @@ -283,8 +282,9 @@ } /** - * Checks whether this constant equals another object. This is only - * true if the other object is a constant and has the same value. + * Checks whether this constant equals another object. This is only true if the other object is a constant and has + * the same value. + * * @param o the object to compare equality * @return {@code true} if this constant is equivalent to the specified object */ @@ -295,6 +295,7 @@ /** * Creates a boxed double constant. + * * @param d the double value to box * @return a boxed copy of {@code value} */ @@ -310,6 +311,7 @@ /** * Creates a boxed float constant. + * * @param f the float value to box * @return a boxed copy of {@code value} */ @@ -328,6 +330,7 @@ /** * Creates a boxed long constant. + * * @param i the long value to box * @return a boxed copy of {@code value} */ @@ -337,6 +340,7 @@ /** * Creates a boxed integer constant. + * * @param i the integer value to box * @return a boxed copy of {@code value} */ @@ -352,6 +356,7 @@ /** * Creates a boxed byte constant. + * * @param i the byte value to box * @return a boxed copy of {@code value} */ @@ -361,6 +366,7 @@ /** * Creates a boxed boolean constant. + * * @param i the boolean value to box * @return a boxed copy of {@code value} */ @@ -370,6 +376,7 @@ /** * Creates a boxed char constant. + * * @param i the char value to box * @return a boxed copy of {@code value} */ @@ -379,6 +386,7 @@ /** * Creates a boxed short constant. + * * @param i the short value to box * @return a boxed copy of {@code value} */ @@ -388,6 +396,7 @@ /** * Creates a boxed address (jsr/ret address) constant. + * * @param i the address value to box * @return a boxed copy of {@code value} */ @@ -397,7 +406,7 @@ /** * Creates a boxed object constant. - * + * * @param o the object value to box * @return a boxed copy of {@code value} */ @@ -409,9 +418,9 @@ } /** - * Creates a boxed constant for the given kind from an Object. - * The object needs to be of the Java boxed type corresponding to the kind. - * + * Creates a boxed constant for the given kind from an Object. The object needs to be of the Java boxed type + * corresponding to the kind. + * * @param kind the kind of the constant to create * @param value the Java boxed value: a {@link Byte} instance for {@link Kind#Byte}, etc. * @return the boxed copy of {@code value} diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ConstantPool.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ConstantPool.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ConstantPool.java Tue Oct 09 15:23:38 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,26 +23,25 @@ package com.oracle.graal.api.meta; /** - * Represents the runtime representation of the constant pool that is - * used by the compiler when parsing bytecode. Provides methods to look up a constant - * pool entry without performing resolution. They are used during compilation. + * Represents the runtime representation of the constant pool that is used by the compiler when parsing bytecode. + * Provides methods to look up a constant pool entry without performing resolution. They are used during compilation. */ public interface ConstantPool { /** - * Makes sure that the type referenced by the specified constant pool entry is loaded and - * initialized. This can be used to compile time resolve a type. It works for field, method, - * or type constant pool entries. + * Makes sure that the type referenced by the specified constant pool entry is loaded and initialized. This can be + * used to compile time resolve a type. It works for field, method, or type constant pool entries. + * * @param cpi the index of the constant pool entry that references the type * @param opcode the opcode of the instruction that references the type */ void loadReferencedType(int cpi, int opcode); /** - * Looks up a reference to a field. If {@code opcode} is non-negative, then resolution checks - * specific to the JVM instruction it denotes are performed if the field is already resolved. - * Should any of these checks fail, an unresolved field reference is returned. - * + * Looks up a reference to a field. If {@code opcode} is non-negative, then resolution checks specific to the + * bytecode it denotes are performed if the field is already resolved. Should any of these checks fail, an + * unresolved field reference is returned. + * * @param cpi the constant pool index * @param opcode the opcode of the instruction for which the lookup is being performed or {@code -1} * @return a reference to the field at {@code cpi} in this pool @@ -51,10 +50,10 @@ JavaField lookupField(int cpi, int opcode); /** - * Looks up a reference to a method. If {@code opcode} is non-negative, then resolution checks - * specific to the JVM instruction it denotes are performed if the method is already resolved. - * Should any of these checks fail, an unresolved method reference is returned. - * + * Looks up a reference to a method. If {@code opcode} is non-negative, then resolution checks specific to the + * bytecode it denotes are performed if the method is already resolved. Should any of these checks fail, an + * unresolved method reference is returned. + * * @param cpi the constant pool index * @param opcode the opcode of the instruction for which the lookup is being performed or {@code -1} * @return a reference to the method at {@code cpi} in this pool @@ -63,10 +62,10 @@ JavaMethod lookupMethod(int cpi, int opcode); /** - * Looks up a reference to a type. If {@code opcode} is non-negative, then resolution checks - * specific to the JVM instruction it denotes are performed if the type is already resolved. - * Should any of these checks fail, an unresolved type reference is returned. - * + * Looks up a reference to a type. If {@code opcode} is non-negative, then resolution checks specific to the + * bytecode it denotes are performed if the type is already resolved. Should any of these checks fail, an unresolved + * type reference is returned. + * * @param cpi the constant pool index * @param opcode the opcode of the instruction for which the lookup is being performed or {@code -1} * @return a reference to the compiler interface type @@ -75,7 +74,7 @@ /** * Looks up a method signature. - * + * * @param cpi the constant pool index * @return the method signature at index {@code cpi} in this constant pool */ @@ -83,6 +82,7 @@ /** * Looks up a constant at the specified index. + * * @param cpi the constant pool index * @return the {@code Constant} or {@code JavaType} instance representing the constant pool entry */ diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java Tue Oct 09 15:23:38 2012 -0700 @@ -22,16 +22,13 @@ */ package com.oracle.graal.api.meta; - /** * An implementation of {@link ProfilingInfo} that can used in the absence of real profile information. */ public final class DefaultProfilingInfo implements ProfilingInfo { - private static final ProfilingInfo[] NO_PROFILING_INFO = new ProfilingInfo[] { - new DefaultProfilingInfo(ExceptionSeen.TRUE), - new DefaultProfilingInfo(ExceptionSeen.FALSE), - new DefaultProfilingInfo(ExceptionSeen.NOT_SUPPORTED) - }; + + private static final ProfilingInfo[] NO_PROFILING_INFO = new ProfilingInfo[]{new DefaultProfilingInfo(ExceptionSeen.TRUE), new DefaultProfilingInfo(ExceptionSeen.FALSE), + new DefaultProfilingInfo(ExceptionSeen.NOT_SUPPORTED)}; private final ExceptionSeen exceptionSeen; @@ -40,7 +37,7 @@ } @Override - public int codeSize() { + public int getCodeSize() { return 0; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java Tue Oct 09 15:23:38 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,5 +38,5 @@ Unresolved, JavaSubroutineMismatch, ArithmeticException, - RuntimeConstraint; + RuntimeConstraint, } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java Tue Oct 09 15:23:38 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,9 +23,10 @@ package com.oracle.graal.api.meta; /** - * Represents an exception handler within the bytecode. + * Represents an exception handler within the bytecodes. */ public final class ExceptionHandler { + private final int startBCI; private final int endBCI; private final int handlerBCI; @@ -34,6 +35,7 @@ /** * Creates a new exception handler with the specified ranges. + * * @param startBCI the start index of the protected range * @param endBCI the end index of the protected range * @param catchBCI the index of the handler @@ -49,33 +51,28 @@ } /** - * Gets the start bytecode index of the protected range of this handler. - * @return the start bytecode index + * Returns the start bytecode index of the protected range of this handler. */ - public int startBCI() { + public int getStartBCI() { return startBCI; } /** - * Gets the end bytecode index of the protected range of this handler. - * @return the end bytecode index + * Returns the end bytecode index of the protected range of this handler. */ - public int endBCI() { + public int getEndBCI() { return endBCI; } /** - * Gets the bytecode index of the handler block of this handler. - * @return the handler block bytecode index + * Returns the bytecode index of the handler block of this handler. */ - public int handlerBCI() { + public int getHandlerBCI() { return handlerBCI; } /** - * Gets the index into the constant pool representing the type of exception - * caught by this handler. - * @return the constant pool index of the catch type + * Returns the index into the constant pool representing the type of exception caught by this handler. */ public int catchTypeCPI() { return catchTypeCPI; @@ -83,6 +80,7 @@ /** * Checks whether this handler catches all exceptions. + * * @return {@code true} if this handler catches all exceptions */ public boolean isCatchAll() { @@ -90,11 +88,9 @@ } /** - * The type of exception caught by this exception handler. - * - * @return the exception type + * Returns the type of exception caught by this exception handler. */ - public JavaType catchType() { + public JavaType getCatchType() { return catchType; } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionSeen.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionSeen.java Tue Oct 09 14:06:26 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.api.meta; - - -/** - * Represents the three possibilities that an exception was seen at a specific BCI. - */ -public enum ExceptionSeen { - TRUE, - FALSE, - NOT_SUPPORTED; - - public static ExceptionSeen get(boolean value) { - return value ? TRUE : FALSE; - } -} diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaField.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaField.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaField.java Tue Oct 09 15:23:38 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,31 +23,28 @@ package com.oracle.graal.api.meta; /** - * Represents a reference to a Java field, including both resolved and unresolved fields. Fields, like methods and types, are + * Represents a reference to a Java field, either resolved or unresolved fields. Fields, like methods and types, are * resolved through {@link ConstantPool constant pools}. */ public interface JavaField { + /** - * Gets the name of this field as a string. - * @return the name of this field + * Returns the name of this field. */ - String name(); + String getName(); /** - * Gets the type of this field as a compiler-runtime interface type. - * @return the type of this field + * Returns a {@link JavaType} object that identifies the declared type for this field. */ - JavaType type(); + JavaType getType(); /** - * Gets the kind of this field. - * @return the kind + * Returns the kind of this field. This is the same as calling {@link #getType}.{@link JavaType#getKind getKind}. */ - Kind kind(); + Kind getKind(); /** - * Gets the holder of this field as a compiler-runtime interface type. - * @return the holder of this field + * Returns the {@link JavaType} object representing the class or interface that declares this field. */ - JavaType holder(); + JavaType getDeclaringClass(); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaMethod.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaMethod.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaMethod.java Tue Oct 09 15:23:38 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,26 +23,23 @@ package com.oracle.graal.api.meta; /** - * Represents resolved and unresolved Java methods. Methods, like fields and types, are resolved through - * {@link ConstantPool constant pools}. + * Represents a reference to a Java method, either resolved or unresolved. Methods, like fields and types, are resolved + * through {@link ConstantPool constant pools}. */ public interface JavaMethod { /** - * Gets the name of the method as a string. - * @return the name of the method + * Returns the name of this method. */ - String name(); + String getName(); /** - * Gets the type in which this method is declared. - * @return the type in which this method is declared + * Returns the {@link JavaType} object representing the class or interface that declares this method. */ - JavaType holder(); + JavaType getDeclaringClass(); /** - * Gets the signature of the method. - * @return the signature of the method + * Returns the signature of this method. */ - Signature signature(); + Signature getSignature(); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java Tue Oct 09 15:23:38 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,82 +23,41 @@ package com.oracle.graal.api.meta; /** - * Represents a resolved or unresolved type in the compiler-runtime interface. Types include primitives, objects, {@code void}, - * and arrays thereof. + * Represents a resolved or unresolved type. Types include primitives, objects, {@code void}, and arrays thereof. */ public interface JavaType { /** - * Represents each of the several different parts of the runtime representation of - * a type which compiled code may need to reference individually. These may or may not be - * different objects or data structures, depending on the runtime system. - */ - public enum Representation { - /** - * The runtime representation of the data structure containing the static primitive fields of this type. - */ - StaticPrimitiveFields, - - /** - * The runtime representation of the data structure containing the static object fields of this type. - */ - StaticObjectFields, - - /** - * The runtime representation of the Java class object of this type. - */ - JavaClass, - - /** - * The runtime representation of the "hub" of this type--that is, the closest part of the type - * representation which is typically stored in the object header. For example, in the HotSpot - * VM the hub correlates with the C++ klassOop type. - */ - ObjectHub - } - - /** - * Gets the name of this type in internal form. The following are examples of strings returned by this method: + * Returns the name of this type in internal form. The following are examples of strings returned by this method: + * *
      *     "Ljava/lang/Object;"
      *     "I"
      *     "[[B"
      * 
- * - * @return the name of this type in internal form */ - String name(); + String getName(); /** - * For array types, gets the type of the components. - * This will be null if this is not an array type. - * This method is analogous to {@link Class#getComponentType()}. - * - * @return the component type of this type if it is an array type otherwise null + * For array types, gets the type of the components, or {@code null} if this is not an array type. This method is + * analogous to {@link Class#getComponentType()}. */ - JavaType componentType(); + JavaType getComponentType(); /** - * Gets the type representing an array with elements of this type. - * @return a new compiler interface type representing an array of this type + * Gets the array class type representing an array with elements of this type. */ - JavaType arrayOf(); + JavaType getArrayClass(); /** - * Gets the kind of this compiler interface type. - * @return the kind + * Gets the kind of this type. */ - Kind kind(); + Kind getKind(); /** - * Gets the kind used to represent the specified part of this type. - * @param r the part of the this type - * @return the kind of constants for the specified part of the type - */ - Kind getRepresentationKind(Representation r); - - /** - * Resolved this Java type and returns the result. + * Resolved this type and returns a {@link ResolvedJavaType}. If this type is already a {@link ResolvedJavaType}, it + * returns this type. + * * @param accessingClass the class that requests resolving this type * @return the resolved Java type */ diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java Tue Oct 09 15:23:38 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2012, 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 @@ -25,22 +25,24 @@ import java.io.*; /** - * This profile object represents the type profile at a specific BCI. The precision of the supplied values may vary, - * but a runtime that provides this information should be aware that it will be used to guide performance-critical - * decisions like speculative inlining, etc. + * This profile object represents the type profile at a specific BCI. The precision of the supplied values may vary, but + * a runtime that provides this information should be aware that it will be used to guide performance-critical decisions + * like speculative inlining, etc. */ public final class JavaTypeProfile implements Serializable { private static final long serialVersionUID = -6877016333706838441L; /** - * A profiled type that has a probability. Profiled types are naturally sorted in - * descending order of their probabilities. + * A profiled type that has a probability. Profiled types are naturally sorted in descending order of their + * probabilities. */ - public static class ProfiledType implements Comparable, Serializable { + public static final class ProfiledType implements Comparable, Serializable { + private static final long serialVersionUID = 7838575753661305744L; - public final ResolvedJavaType type; - public final double probability; + + private final ResolvedJavaType type; + private final double probability; public ProfiledType(ResolvedJavaType type, double probability) { assert type != null; @@ -49,11 +51,27 @@ this.probability = probability; } + /** + * Returns the type for this profile entry. + */ + public ResolvedJavaType getType() { + return type; + } + + /** + * Returns the estimated probability of {@link #getType()}. + * + * @return double value >= 0.0 and <= 1.0 + */ + public double getProbability() { + return probability; + } + @Override public int compareTo(ProfiledType o) { - if (probability > o.probability) { + if (getProbability() > o.getProbability()) { return -1; - } else if (probability < o.probability) { + } else if (getProbability() < o.getProbability()) { return 1; } return 0; @@ -66,9 +84,9 @@ /** * Determines if an array of profiled types are sorted in descending order of their probabilities. */ - public static boolean isSorted(ProfiledType[] ptypes) { + private static boolean isSorted(ProfiledType[] ptypes) { for (int i = 1; i < ptypes.length; i++) { - if (ptypes[i - 1].probability < ptypes[i].probability) { + if (ptypes[i - 1].getProbability() < ptypes[i].getProbability()) { return false; } } @@ -83,6 +101,7 @@ /** * Returns the estimated probability of all types that could not be recorded due to profiling limitations. + * * @return double value >= 0.0 and <= 1.0 */ public double getNotRecordedProbability() { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java Tue Oct 09 15:23:38 2012 -0700 @@ -68,30 +68,36 @@ /** The non-type. */ Illegal('-', "illegal", false, false); - private Kind(char ch, String name, boolean isPrimitive, boolean isStackInt) { - this.typeChar = ch; - this.javaName = name; + private final char typeChar; + private final String javaName; + private final boolean isStackInt; + private final boolean isPrimitive; + + private Kind(char typeChar, String javaName, boolean isPrimitive, boolean isStackInt) { + this.typeChar = typeChar; + this.javaName = javaName; this.isPrimitive = isPrimitive; this.isStackInt = isStackInt; } - private final boolean isStackInt; - private final boolean isPrimitive; + /** + * Returns the name of the kind as a single character. + */ + public char getTypeChar() { + return typeChar; + } /** - * The name of the kind as a single character. + * Returns the name of this kind which will also be it Java programming language name if it is + * {@linkplain #isPrimitive() primitive} or {@code void}. */ - public final char typeChar; - - /** - * The name of this kind which will also be it Java programming language name if it is {@linkplain #isPrimitive() - * primitive} or {@code void}. - */ - public final String javaName; + public String getJavaName() { + return javaName; + } /** * Checks whether this type is valid as an {@code int} on the Java operand stack. - * + * * @return {@code true} if this type is represented by an {@code int} on the operand stack */ public boolean isStackInt() { @@ -100,7 +106,7 @@ /** * Checks whether this type is a Java primitive type. - * + * * @return {@code true} if this is {@link #Boolean}, {@link #Byte}, {@link #Char}, {@link #Short}, {@link #Int}, * {@link #Long}, {@link #Float} or {@link #Double}. */ @@ -109,11 +115,11 @@ } /** - * Gets the kind that represents this kind when on the Java operand stack. - * + * Returns the kind that represents this kind when on the Java operand stack. + * * @return the kind used on the operand stack */ - public Kind stackKind() { + public Kind getStackKind() { if (isStackInt()) { return Int; } @@ -122,7 +128,7 @@ /** * Returns the kind corresponding to the Java type string. - * + * * @param typeString the Java type string * @return the kind */ @@ -136,8 +142,8 @@ } /** - * Gets the kind from the character describing a primitive or void. - * + * Returns the kind from the character describing a primitive or void. + * * @param ch the character * @return the kind */ @@ -167,7 +173,7 @@ /** * Returns the Kind representing the given Java class. - * + * * @param klass the class * @return the kind */ @@ -197,7 +203,7 @@ /** * Returns the Java class representing this kind. - * + * * @return the Java class */ public Class< ? > toJavaClass() { @@ -227,7 +233,7 @@ /** * Returns the Java class for instances of boxed values of this kind. - * + * * @return the Java class */ public Class< ? > toBoxedJavaClass() { @@ -257,7 +263,7 @@ /** * Checks whether this value type is void. - * + * * @return {@code true} if this type is void */ public final boolean isVoid() { @@ -266,7 +272,7 @@ /** * Checks whether this value type is long. - * + * * @return {@code true} if this type is long */ public final boolean isLong() { @@ -275,7 +281,7 @@ /** * Checks whether this value type is float. - * + * * @return {@code true} if this type is float */ public final boolean isFloat() { @@ -284,7 +290,7 @@ /** * Checks whether this value type is double. - * + * * @return {@code true} if this type is double */ public final boolean isDouble() { @@ -293,7 +299,7 @@ /** * Checks whether this value type is float or double. - * + * * @return {@code true} if this type is float or double */ public final boolean isFloatOrDouble() { @@ -302,7 +308,7 @@ /** * Checks whether this value type is an object type. - * + * * @return {@code true} if this type is an object */ public final boolean isObject() { @@ -311,7 +317,7 @@ /** * Checks whether this value type is an address type. - * + * * @return {@code true} if this type is an address */ public boolean isJsr() { @@ -335,7 +341,7 @@ /** * Gets a formatted string for a given value of this kind. - * + * * @param value a value of this kind * @return a formatted string for {@code value} based on this kind */ @@ -396,7 +402,7 @@ /** * The offset from the origin of an array to the first element. - * + * * @return the offset in bytes */ public final int getArrayBaseOffset() { @@ -427,7 +433,7 @@ /** * The scale used for the index when accessing elements of an array of this kind. - * + * * @return the scale in order to convert the index into a byte offset */ public final int getArrayIndexScale() { @@ -458,7 +464,7 @@ /** * Utility function for reading a value of this kind using an object and a displacement. - * + * * @param object the object from which the value is read * @param displacement the displacement within the object in bytes * @return the read value encapsulated in a {@link Constant} object @@ -493,7 +499,7 @@ /** * The minimum value that can be represented as a value of this kind. - * + * * @return the minimum value */ public long getMinValue() { @@ -518,7 +524,7 @@ /** * The maximum value that can be represented as a value of this kind. - * + * * @return the maximum value */ public long getMaxValue() { @@ -543,7 +549,7 @@ /** * Number of bits that are necessary to represent a value of this kind. - * + * * @return the number of bits */ public int getBitCount() { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java Tue Oct 09 15:23:38 2012 -0700 @@ -25,51 +25,45 @@ import java.lang.reflect.*; /** - * Interface implemented by the runtime to allow access to its meta data. - * + * Interface implemented by the runtime to allow access to its metadata. */ public interface MetaAccessProvider { /** * Returns the resolved Java type representing a given Java class. - * + * * @param clazz the Java class object * @return the resolved Java type object */ - ResolvedJavaType getResolvedJavaType(Class< ? > clazz); - - /** - * Returns the JavaType object representing the base type for the given kind. - */ - ResolvedJavaType getResolvedJavaType(Kind kind); - - /** - * Returns the type of the given constant object. - * - * @return {@code null} if {@code constant.isNull() || !constant.kind.isObject()} - */ - ResolvedJavaType getTypeOf(Constant constant); - - /** - * Used by the canonicalizer to compare objects, since a given runtime might not want to expose the real objects to - * the compiler. - * - * @return true if the two parameters represent the same runtime object, false otherwise - */ - boolean areConstantObjectsEqual(Constant x, Constant y); + ResolvedJavaType lookupJavaType(Class< ? > clazz); /** * Provides the {@link ResolvedJavaMethod} for a {@link Method} obtained via reflection. */ - ResolvedJavaMethod getResolvedJavaMethod(Method reflectionMethod); + ResolvedJavaMethod lookupJavaMethod(Method reflectionMethod); /** * Provides the {@link ResolvedJavaField} for a {@link Field} obtained via reflection. */ - ResolvedJavaField getResolvedJavaField(Field reflectionField); + ResolvedJavaField lookupJavaField(Field reflectionField); + + /** + * Returns the resolved Java type of the given {@link Constant} object. + * + * @return {@code null} if {@code constant.isNull() || !constant.kind.isObject()} + */ + ResolvedJavaType lookupJavaType(Constant constant); /** - * Gets the length of the array that is wrapped in a Constant object. + * Compares two object constants. Since a given runtime might not want to expose the real objects to the compiler, + * the {@link Constant#asObject()} cannot be compared directly. + * + * @return {@code true} if the two parameters represent the same runtime object, {@code false} otherwise */ - int getArrayLength(Constant array); + boolean constantEquals(Constant x, Constant y); + + /** + * Returns the length of an array that is wrapped in a {@link Constant} object. + */ + int lookupArrayLength(Constant array); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java Tue Oct 09 15:23:38 2012 -0700 @@ -29,6 +29,7 @@ import java.util.*; import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType; +import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen; /** * Miscellaneous collection of utility methods used by {@code com.oracle.graal.api.meta} and its clients. @@ -38,7 +39,7 @@ /** * Extends the functionality of {@link Class#getSimpleName()} to include a non-empty string for anonymous and local * classes. - * + * * @param clazz the class for which the simple name is being requested * @param withEnclosingClass specifies if the returned name should be qualified with the name(s) of the enclosing * class/classes of {@code clazz} (if any). This option is ignored if {@code clazz} denotes an anonymous @@ -71,11 +72,10 @@ return name.substring(index + 1); } - /** * Converts a given type to its Java programming language name. The following are examples of strings returned by * this method: - * + * *
      *     qualified == true:
      *         java.lang.Object
@@ -86,34 +86,34 @@
      *         int
      *         boolean[][]
      * 
- * + * * @param type the type to be converted to a Java name * @param qualified specifies if the package prefix of the type should be included in the returned name * @return the Java name corresponding to {@code type} */ public static String toJavaName(JavaType type, boolean qualified) { - Kind kind = type.kind(); + Kind kind = type.getKind(); if (kind.isObject()) { - return internalNameToJava(type.name(), qualified); + return internalNameToJava(type.getName(), qualified); } - return type.kind().javaName; + return type.getKind().getJavaName(); } /** * Converts a given type to its Java programming language name. The following are examples of strings returned by * this method: - * + * *
      *      java.lang.Object
      *      int
      *      boolean[][]
      * 
- * + * * @param type the type to be converted to a Java name * @return the Java name corresponding to {@code type} */ public static String toJavaName(JavaType type) { - return (type == null) ? null : internalNameToJava(type.name(), true); + return (type == null) ? null : internalNameToJava(type.getName(), true); } private static String internalNameToJava(String name, boolean qualified) { @@ -135,17 +135,16 @@ if (name.length() != 1) { throw new IllegalArgumentException("Illegal internal name: " + name); } - return Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0)).javaName; + return Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0)).getJavaName(); } } - /** * Gets a string for a given method formatted according to a given format specification. A format specification is * composed of characters that are to be copied verbatim to the result and specifiers that denote an attribute of * the method that is to be copied to the result. A specifier is a single character preceded by a '%' character. The * accepted specifiers and the method attributes they denote are described below: - * + * *
      *     Specifier | Description                                          | Example(s)
      *     ----------+------------------------------------------------------------------------------------------
@@ -159,7 +158,7 @@
      *     'f'       | Indicator if method is unresolved, static or virtual | "unresolved" "static" "virtual"
      *     '%'       | A '%' character                                      | "%"
      * 
- * + * * @param format a format specification * @param method the method to be formatted * @return the result of formatting this method according to {@code format} @@ -183,20 +182,20 @@ // fall through case 'r': { if (sig == null) { - sig = method.signature(); + sig = method.getSignature(); } - sb.append(toJavaName(sig.returnType(null), qualified)); + sb.append(toJavaName(sig.getReturnType(null), qualified)); break; } case 'H': qualified = true; // fall through case 'h': { - sb.append(toJavaName(method.holder(), qualified)); + sb.append(toJavaName(method.getDeclaringClass(), qualified)); break; } case 'n': { - sb.append(method.name()); + sb.append(method.getName()); break; } case 'P': @@ -204,18 +203,18 @@ // fall through case 'p': { if (sig == null) { - sig = method.signature(); + sig = method.getSignature(); } - for (int i = 0; i < sig.argumentCount(false); i++) { + for (int i = 0; i < sig.getParameterCount(false); i++) { if (i != 0) { sb.append(", "); } - sb.append(toJavaName(sig.argumentTypeAt(i, null), qualified)); + sb.append(toJavaName(sig.getParameterType(i, null), qualified)); } break; } case 'f': { - sb.append(!(method instanceof ResolvedJavaMethod) ? "unresolved" : isStatic(((ResolvedJavaMethod) method).accessFlags()) ? "static" : "virtual"); + sb.append(!(method instanceof ResolvedJavaMethod) ? "unresolved" : isStatic(((ResolvedJavaMethod) method).getModifiers()) ? "static" : "virtual"); break; } case '%': { @@ -233,13 +232,12 @@ return sb.toString(); } - /** * Gets a string for a given field formatted according to a given format specification. A format specification is * composed of characters that are to be copied verbatim to the result and specifiers that denote an attribute of * the field that is to be copied to the result. A specifier is a single character preceded by a '%' character. The * accepted specifiers and the field attributes they denote are described below: - * + * *
      *     Specifier | Description                                          | Example(s)
      *     ----------+------------------------------------------------------------------------------------------
@@ -251,7 +249,7 @@
      *     'f'       | Indicator if field is unresolved, static or instance | "unresolved" "static" "instance"
      *     '%'       | A '%' character                                      | "%"
      * 
- * + * * @param format a format specification * @param field the field to be formatted * @return the result of formatting this field according to {@code format} @@ -260,7 +258,7 @@ public static String format(String format, JavaField field) throws IllegalFormatException { final StringBuilder sb = new StringBuilder(); int index = 0; - JavaType type = field.type(); + JavaType type = field.getType(); while (index < format.length()) { final char ch = format.charAt(index++); if (ch == '%') { @@ -281,15 +279,15 @@ qualified = true; // fall through case 'h': { - sb.append(toJavaName(field.holder(), qualified)); + sb.append(toJavaName(field.getDeclaringClass(), qualified)); break; } case 'n': { - sb.append(field.name()); + sb.append(field.getName()); break; } case 'f': { - sb.append(!(field instanceof ResolvedJavaField) ? "unresolved" : isStatic(((ResolvedJavaField) field).accessFlags()) ? "static" : "instance"); + sb.append(!(field instanceof ResolvedJavaField) ? "unresolved" : isStatic(((ResolvedJavaField) field).getModifiers()) ? "static" : "instance"); break; } case '%': { @@ -307,10 +305,9 @@ return sb.toString(); } - /** * Gets the annotations of a particular type for the formal parameters of a given method. - * + * * @param annotationClass the Class object corresponding to the annotation type * @param method the method for which a parameter annotations are being requested * @return the annotation of type {@code annotationClass} (if any) for each formal parameter present @@ -331,7 +328,7 @@ /** * Gets the annotation of a particular type for a formal parameter of a given method. - * + * * @param annotationClass the Class object corresponding to the annotation type * @param parameterIndex the index of a formal parameter of {@code method} * @param method the method for which a parameter annotation is being requested @@ -351,39 +348,38 @@ } /** - * Convenient shortcut for calling {@link #appendLocation(StringBuilder, ResolvedJavaMethod, int)} without having to supply a - * a {@link StringBuilder} instance and convert the result to a string. + * Convenient shortcut for calling {@link #appendLocation(StringBuilder, ResolvedJavaMethod, int)} without having to + * supply a a {@link StringBuilder} instance and convert the result to a string. */ public static String toLocation(ResolvedJavaMethod method, int bci) { return appendLocation(new StringBuilder(), method, bci).toString(); } - /** * Appends a string representation of a location specified by a given method and bci to a given * {@link StringBuilder}. If a stack trace element with a non-null file name and non-negative line number is - * {@linkplain ResolvedJavaMethod#toStackTraceElement(int) available} for the given method, then the string returned is the - * {@link StackTraceElement#toString()} value of the stack trace element, suffixed by the bci location. For example: - * + * {@linkplain ResolvedJavaMethod#asStackTraceElement(int) available} for the given method, then the string returned + * is the {@link StackTraceElement#toString()} value of the stack trace element, suffixed by the bci location. For + * example: + * *
      *     java.lang.String.valueOf(String.java:2930) [bci: 12]
      * 
- * - * Otherwise, the string returned is the value of applying {@link #format(String, JavaMethod)} - * with the format string {@code "%H.%n(%p)"}, suffixed by the bci location. - * For example: - * + * + * Otherwise, the string returned is the value of applying {@link #format(String, JavaMethod)} with the format + * string {@code "%H.%n(%p)"}, suffixed by the bci location. For example: + * *
      *     java.lang.String.valueOf(int) [bci: 12]
      * 
- * + * * @param sb * @param method * @param bci */ public static StringBuilder appendLocation(StringBuilder sb, ResolvedJavaMethod method, int bci) { if (method != null) { - StackTraceElement ste = method.toStackTraceElement(bci); + StackTraceElement ste = method.asStackTraceElement(bci); if (ste.getFileName() != null && ste.getLineNumber() > 0) { sb.append(ste); } else { @@ -395,15 +391,13 @@ return sb.append(" [bci: ").append(bci).append(']'); } - public static Kind[] signatureToKinds(ResolvedJavaMethod method) { - Kind receiver = isStatic(method.accessFlags()) ? null : method.holder().kind(); - return signatureToKinds(method.signature(), receiver); + Kind receiver = isStatic(method.getModifiers()) ? null : method.getDeclaringClass().getKind(); + return signatureToKinds(method.getSignature(), receiver); } - public static Kind[] signatureToKinds(Signature signature, Kind receiverKind) { - int args = signature.argumentCount(false); + int args = signature.getParameterCount(false); Kind[] result; int i = 0; if (receiverKind != null) { @@ -414,25 +408,23 @@ result = new Kind[args]; } for (int j = 0; j < args; j++) { - result[i + j] = signature.argumentKindAt(j); + result[i + j] = signature.getParameterKind(j); } return result; } - public static Class< ? >[] signatureToTypes(Signature signature, ResolvedJavaType accessingClass) { - int count = signature.argumentCount(false); + int count = signature.getParameterCount(false); Class< ? >[] result = new Class< ? >[count]; for (int i = 0; i < result.length; ++i) { - result[i] = signature.argumentTypeAt(i, accessingClass).resolve(accessingClass).toJava(); + result[i] = signature.getParameterType(i, accessingClass).resolve(accessingClass).toJava(); } return result; } - /** * Formats some profiling information associated as a string. - * + * * @param info the profiling info to format * @param method an optional method that augments the profile string returned * @param sep the separator to use for each separate profile record @@ -440,10 +432,9 @@ public static String profileToString(ProfilingInfo info, ResolvedJavaMethod method, String sep) { StringBuilder buf = new StringBuilder(100); if (method != null) { - buf.append(String.format("canBeStaticallyBound: %b%s", method.canBeStaticallyBound(), sep)). - append(String.format("invocationCount: %d%s", method.invocationCount(), sep)); + buf.append(String.format("canBeStaticallyBound: %b%s", method.canBeStaticallyBound(), sep)); } - for (int i = 0; i < info.codeSize(); i++) { + for (int i = 0; i < info.getCodeSize(); i++) { if (info.getExecutionCount(i) != -1) { buf.append(String.format("executionCount@%d: %d%s", i, info.getExecutionCount(i), sep)); } @@ -472,7 +463,7 @@ buf.append(String.format("types@%d:", i)); for (int j = 0; j < ptypes.length; j++) { ProfiledType ptype = ptypes[j]; - buf.append(String.format(" %.3f (%s)%s", ptype.probability, ptype.type, sep)); + buf.append(String.format(" %.3f (%s)%s", ptype.getProbability(), ptype.getType(), sep)); } buf.append(String.format(" %.3f %s", typeProfile.getNotRecordedProbability(), sep)); } @@ -480,7 +471,7 @@ } boolean firstDeoptReason = true; - for (DeoptimizationReason reason: DeoptimizationReason.values()) { + for (DeoptimizationReason reason : DeoptimizationReason.values()) { int count = info.getDeoptimizationCount(reason); if (count > 0) { if (firstDeoptReason) { @@ -498,10 +489,9 @@ return s.substring(0, s.length() - sep.length()); } - /** * Converts a Java source-language class name into the internal form. - * + * * @param className the class name * @return the internal name form of the class name */ @@ -509,7 +499,6 @@ return "L" + className.replace('.', '/') + ";"; } - /** * Prepends the String {@code indentation} to every line in String {@code lines}, including a possibly non-empty * line following the final newline. diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ProfilingInfo.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ProfilingInfo.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ProfilingInfo.java Tue Oct 09 15:23:38 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,58 +23,77 @@ package com.oracle.graal.api.meta; /** - * Provides access to the profiling information of one specific method. - * Every accessor method returns the information that is available at the time of invocation. - * If a method is invoked multiple times, it may return significantly different results for every invocation - * as the profiling information may be changed by other Java threads at any time. + * Provides access to the profiling information of one specific method. Every accessor method returns the information + * that is available at the time of invocation. If a method is invoked multiple times, it may return significantly + * different results for every invocation as the profiling information may be changed by other Java threads at any time. */ public interface ProfilingInfo { /** - * Gets the length of the code associated with this profile. + * Represents the three possibilities that an exception was seen at a specific BCI. */ - int codeSize(); + public enum ExceptionSeen { + TRUE, FALSE, NOT_SUPPORTED; + + public static ExceptionSeen get(boolean value) { + return value ? TRUE : FALSE; + } + } + + /** + * Returns the length of the bytecodes associated with this profile. + */ + int getCodeSize(); /** * Returns an estimate of how often the branch at the given byte code was taken. - * @return The estimated probability, with 0.0 meaning never and 1.0 meaning always, or -1 if this information is not available. + * + * @return The estimated probability, with 0.0 meaning never and 1.0 meaning always, or -1 if this information is + * not available. */ double getBranchTakenProbability(int bci); /** - * Returns an estimate of how often the switch cases are taken at the given BCI. - * The default case is stored as the last entry. + * Returns an estimate of how often the switch cases are taken at the given BCI. The default case is stored as the + * last entry. + * * @return A double value that contains the estimated probabilities, with 0.0 meaning never and 1.0 meaning always, - * or -1 if this information is not available. + * or -1 if this information is not available. */ double[] getSwitchProbabilities(int bci); /** * Returns the TypeProfile for the given BCI. + * * @return Returns an JavaTypeProfile object, or null if not available. */ JavaTypeProfile getTypeProfile(int bci); /** * Returns information if the given BCI did ever throw an exception. + * * @return {@link ExceptionSeen#TRUE} if the instruction has thrown an exception at least once, - * {@link ExceptionSeen#FALSE} if it never threw an exception, and {@link ExceptionSeen#NOT_SUPPORTED} - * if this information was not recorded. + * {@link ExceptionSeen#FALSE} if it never threw an exception, and {@link ExceptionSeen#NOT_SUPPORTED} if + * this information was not recorded. */ ExceptionSeen getExceptionSeen(int bci); /** - * Returns an estimate how often the current BCI was executed. Avoid comparing execution counts to each other, - * as the returned value highly depends on the time of invocation. + * Returns an estimate how often the current BCI was executed. Avoid comparing execution counts to each other, as + * the returned value highly depends on the time of invocation. + * * @return the estimated execution count or -1 if not available. */ int getExecutionCount(int bci); /** * Returns how frequently a method was deoptimized for the given deoptimization reason. This only indicates how - * often the method did fall back to the interpreter for the execution and does not indicate how often it was recompiled. + * often the method did fall back to the interpreter for the execution and does not indicate how often it was + * recompiled. + * * @param reason the reason for which the number of deoptimizations should be queried * @return the number of times the compiled method deoptimized for the given reason. */ int getDeoptimizationCount(DeoptimizationReason reason); + } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaField.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaField.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaField.java Tue Oct 09 15:23:38 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,44 +26,46 @@ import java.lang.reflect.*; /** - * Represents a reference to a resolved Java field. Fields, like methods and types, are - * resolved through {@link ConstantPool constant pools}. + * Represents a reference to a resolved Java field. Fields, like methods and types, are resolved through + * {@link ConstantPool constant pools}. */ public interface ResolvedJavaField extends JavaField { /** - * Gets the access flags for this field. Only the flags specified in the JVM specification - * will be included in the returned mask. The utility methods in the {@link Modifier} class - * should be used to query the returned mask for the presence/absence of individual flags. - * @return the mask of JVM defined field access flags defined for this field + * Returns the Java language modifiers for this field, as an integer. The {@link Modifier} class should be used to + * decode the modifiers. Only the flags specified in the JVM specification will be included in the returned mask. */ - int accessFlags(); + int getModifiers(); /** - * Gets the constant value of this field if available. - * @param receiver object from which this field's value is to be read. This value is ignored if this field is static. + * Gets the constant value of this field for a given object, if available. + * + * @param receiver object from which this field's value is to be read. This value is ignored if this field is + * static. * @return the constant value of this field or {@code null} if the constant value is not available */ - Constant constantValue(Constant receiver); + Constant readConstantValue(Constant receiver); /** - * Gets the current value of the field if available. - * @param receiver object from which this field's value is to be read. This value is ignored if this field is static. - * @return the value of this field or {@code null} if the value is not available (e.g., because the field holder is not yet initialized). + * Gets the current value of this field for a given object, if available. + * + * @param receiver object from which this field's value is to be read. This value is ignored if this field is + * static. + * @return the value of this field or {@code null} if the value is not available (e.g., because the field holder is + * not yet initialized). */ - Constant getValue(Constant receiver); + Constant readValue(Constant receiver); /** - * Gets the holder of this field as a compiler-runtime interface type. - * @return the holder of this field + * Returns the {@link ResolvedJavaType} object representing the class or interface that declares this field. */ - ResolvedJavaType holder(); + ResolvedJavaType getDeclaringClass(); /** - * Returns this field's annotation of a specified type. - * + * Returns the annotation for the specified type of this field, if such an annotation is present. + * * @param annotationClass the Class object corresponding to the annotation type - * @return the annotation of type {@code annotationClass} for this field if present, else null + * @return this element's annotation for the specified annotation type if present on this field, else {@code null} */ T getAnnotation(Class annotationClass); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java Tue Oct 09 15:23:38 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,157 +27,135 @@ import java.util.*; /** - * Represents resolved Java methods. Methods, like fields and types, are resolved through - * {@link ConstantPool constant pools}. + * Represents a resolved Java method. Methods, like fields and types, are resolved through {@link ConstantPool constant + * pools}. */ public interface ResolvedJavaMethod extends JavaMethod { /** - * Gets the bytecode of the method, if the method has code. - * The returned byte array does not contain breakpoints or non-Java bytecodes. - * @return the bytecode of the method or {@code null} if none is available + * Returns the bytecodes of this method, if the method has code. The returned byte array does not contain + * breakpoints or non-Java bytecodes. + * + * @return the bytecodes of the method, or {@code null} if none is available */ - byte[] code(); - - /** - * Gets the size of the bytecode of the method, if the method has code. - * @return the size of the bytecode in bytes, or 0 if no bytecode is available - */ - int codeSize(); + byte[] getCode(); /** - * Gets the size of the compiled machine code. - * @return the size of the compiled machine code in bytes, or 0 if no compiled code exists. + * Returns the size of the bytecodes of this method, if the method has code. This is equivalent to + * {@link #getCode()}. {@code length} if the method has code. + * + * @return the size of the bytecodes in bytes, or 0 if no bytecodes is available */ - int compiledCodeSize(); + int getCodeSize(); /** - * Gets an estimate how complex it is to compile this method. - * @return A value >= 0, where higher means more complex. + * Returns the size of the compiled machine code of this method. + * + * @return the size of the compiled machine code in bytes, or 0 if no compiled code exists. */ - int compilationComplexity(); - - /** - * Gets the symbol used to link this method if it is native, otherwise {@code null}. - */ - String jniSymbol(); + int getCompiledCodeSize(); /** - * Gets the type in which this method is declared. - * @return the type in which this method is declared + * Returns an estimate how complex it is to compile this method. + * + * @return A value >= 0, where higher means more complex. */ - ResolvedJavaType holder(); + int getCompilationComplexity(); /** - * Gets the maximum number of locals used in this method's bytecode. - * @return the maximum number of locals + * Returns the {@link ResolvedJavaType} object representing the class or interface that declares this method. */ - int maxLocals(); - - /** - * Gets the maximum number of stack slots used in this method's bytecode. - * @return the maximum number of stack slots - */ - int maxStackSize(); + ResolvedJavaType getDeclaringClass(); /** - * Checks whether this method has balanced monitor operations. - * @return {@code true} if the method has balanced monitor operations + * Returns the maximum number of locals used in this method's bytecodes. */ - boolean hasBalancedMonitors(); + int getMaxLocals(); /** - * Gets the access flags for this method. Only the flags specified in the JVM specification - * will be included in the returned mask. The utility methods in the {@link Modifier} class - * should be used to query the returned mask for the presence/absence of individual flags. - * @return the mask of JVM defined method access flags defined for this method + * Returns the maximum number of stack slots used in this method's bytecodes. */ - int accessFlags(); + int getMaxStackSize(); /** - * Checks whether this method is a leaf method. - * @return {@code true} if the method is a leaf method (that is, is final or private) + * Returns the Java language modifiers for this method, as an integer. The {@link Modifier} class should be used to + * decode the modifiers. Only the flags specified in the JVM specification will be included in the returned mask. */ - boolean isLeafMethod(); + int getModifiers(); /** * Checks whether this method is a class initializer. + * * @return {@code true} if the method is a class initializer */ boolean isClassInitializer(); /** * Checks whether this method is a constructor. + * * @return {@code true} if the method is a constructor */ boolean isConstructor(); /** - * Checks whether this method can be statically bound (that is, it is final or private or static). + * Checks whether this method can be statically bound (usually, that means it is final or private or static, but not + * abstract). + * * @return {@code true} if this method can be statically bound */ boolean canBeStaticallyBound(); /** - * Gets the list of exception handlers for this method. - * @return the list of exception handlers + * Returns the list of exception handlers for this method. */ - ExceptionHandler[] exceptionHandlers(); - - /** - * Gets a stack trace element for this method and a given bytecode index. - */ - StackTraceElement toStackTraceElement(int bci); + ExceptionHandler[] getExceptionHandlers(); /** - * Provides an estimate of how often this method has been executed. - * @return The number of invocations, or -1 if this information isn't available. + * Returns a stack trace element for this method and a given bytecode index. */ - int invocationCount(); + StackTraceElement asStackTraceElement(int bci); /** - * Returns an object that provides access to the method's profiling information. - * @return The profiling information recorded for this method. + * Returns an object that provides access to the profiling information recorded for this method. */ - ProfilingInfo profilingInfo(); + ProfilingInfo getProfilingInfo(); /** * Returns a map that the compiler can use to store objects that should survive the current compilation. */ - Map compilerStorage(); + Map getCompilerStorage(); /** - * Returns a pointer to the method's constant pool. - * @return the constant pool + * Returns the constant pool of this method. */ ConstantPool getConstantPool(); /** - * Returns this method's annotation of a specified type. - * + * Returns the annotation for the specified type of this method, if such an annotation is present. + * * @param annotationClass the Class object corresponding to the annotation type - * @return the annotation of type {@code annotationClass} for this method if present, else null + * @return this element's annotation for the specified annotation type if present on this method, else {@code null} */ T getAnnotation(Class annotationClass); /** - * Returns an array of arrays that represent the annotations on the formal - * parameters, in declaration order, of this method. - * + * Returns an array of arrays that represent the annotations on the formal parameters, in declaration order, of this + * method. + * * @see Method#getParameterAnnotations() */ Annotation[][] getParameterAnnotations(); /** - * Returns an array of {@link Type} objects that represent the formal - * parameter types, in declaration order, of this method. - * + * Returns an array of {@link Type} objects that represent the formal parameter types, in declaration order, of this + * method. + * * @see Method#getGenericParameterTypes() */ Type[] getGenericParameterTypes(); /** - * @return {@code true} if this method can be inlined + * Returns {@code true} if this method can be inlined. */ boolean canBeInlined(); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java Tue Oct 09 15:23:38 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,66 +26,99 @@ import java.lang.reflect.*; /** - * Represents a resolved Java types. Types include primitives, objects, {@code void}, - * and arrays thereof. Types, like fields and methods, are resolved through {@link ConstantPool constant pools}. + * Represents a resolved Java types. Types include primitives, objects, {@code void}, and arrays thereof. Types, like + * fields and methods, are resolved through {@link ConstantPool constant pools}. */ public interface ResolvedJavaType extends JavaType { /** + * Represents each of the several different parts of the runtime representation of a type which compiled code may + * need to reference individually. These may or may not be different objects or data structures, depending on the + * runtime system. + */ + public enum Representation { + /** + * The runtime representation of the data structure containing the static primitive fields of this type. + */ + StaticPrimitiveFields, + + /** + * The runtime representation of the data structure containing the static object fields of this type. + */ + StaticObjectFields, + + /** + * The runtime representation of the Java class object of this type. + */ + JavaClass, + + /** + * The runtime representation of the "hub" of this type--that is, the closest part of the type representation + * which is typically stored in the object header. + */ + ObjectHub + } + + /** * Gets the encoding of (that is, a constant representing the value of) the specified part of this type. - * @param r the part of the this type + * + * @param r the part of this type * @return a constant representing a reference to the specified part of this type */ Constant getEncoding(Representation r); /** * Checks whether this type has a finalizer method. + * * @return {@code true} if this class has a finalizer */ boolean hasFinalizer(); /** - * Checks whether this type has any finalizable subclasses so far. Any decisions - * based on this information require the registration of a dependency, since - * this information may change. + * Checks whether this type has any finalizable subclasses so far. Any decisions based on this information require + * the registration of a dependency, since this information may change. + * * @return {@code true} if this class has any subclasses with finalizers */ boolean hasFinalizableSubclass(); /** * Checks whether this type is an interface. + * * @return {@code true} if this type is an interface */ boolean isInterface(); /** * Checks whether this type is an instance class. + * * @return {@code true} if this type is an instance class */ boolean isInstanceClass(); /** * Checks whether this type is an array class. + * * @return {@code true} if this type is an array class */ boolean isArrayClass(); /** - * Gets the access flags for this type. Only the flags specified in the JVM specification - * will be included in the returned mask. The utility methods in the {@link Modifier} class - * should be used to query the returned mask for the presence/absence of individual flags. - * @return the mask of JVM defined class access flags defined for this type + * Returns the Java language modifiers for this type, as an integer. The {@link Modifier} class should be used to + * decode the modifiers. Only the flags specified in the JVM specification will be included in the returned mask. */ - int accessFlags(); + int getModifiers(); /** * Checks whether this type is initialized. + * * @return {@code true} if this type is initialized */ boolean isInitialized(); /** * Checks whether this type is a subtype of another type. + * * @param other the type to test * @return {@code true} if this type a subtype of the specified type */ @@ -93,81 +126,89 @@ /** * Checks whether the specified object is an instance of this type. + * * @param obj the object to test * @return {@code true} if the object is an instance of this type */ boolean isInstance(Constant obj); /** - * Attempts to get an exact type for this type. Final classes, - * arrays of final classes, and primitive types all have exact types. + * Attempts to get an exact type for this type. Final classes, arrays of final classes, and primitive types all have + * exact types. + * * @return the exact type of this type, if it exists; {@code null} otherwise */ - ResolvedJavaType exactType(); + ResolvedJavaType getExactType(); /** - * Gets the super type of this type or {@code null} if no such type exists. + * Gets the superclass of this type, or {@code null} if it does not exist. This method is analogous to + * {@link Class#getSuperclass()}. */ - ResolvedJavaType superType(); + ResolvedJavaType getSuperclass(); /** - * Walks the class hierarchy upwards and returns the least common type that is a super type of both - * the current and the given type. - * @return the least common type that is a super type of both the current and the given type, or null if primitive types are involved. + * Walks the class hierarchy upwards and returns the least common class that is a superclass of both the current and + * the given type. + * + * @return the least common type that is a super type of both the current and the given type, or {@code null} if + * primitive types are involved. */ - ResolvedJavaType leastCommonAncestor(ResolvedJavaType otherType); + ResolvedJavaType findLeastCommonAncestor(ResolvedJavaType otherType); /** - * Attempts to get the unique concrete subtype of this type. + * Attempts to get the unique concrete subclass of this type. + *

+ * If the compiler uses the result of this method for its compilation, it must register an assumption because + * dynamic class loading can invalidate the result of this method. + * * @return the exact type of this type, if it exists; {@code null} otherwise */ - ResolvedJavaType uniqueConcreteSubtype(); + ResolvedJavaType findUniqueConcreteSubtype(); - ResolvedJavaType componentType(); + ResolvedJavaType getComponentType(); - ResolvedJavaType arrayOf(); + ResolvedJavaType getArrayClass(); /** - * Resolves the method implementation for virtual dispatches on objects - * of this dynamic type. + * Resolves the method implementation for virtual dispatches on objects of this dynamic type. + * * @param method the method to select the implementation of * @return the method implementation that would be selected at runtime */ - ResolvedJavaMethod resolveMethodImpl(ResolvedJavaMethod method); + ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method); /** - * Given an JavaMethod a, returns a concrete JavaMethod b that is the only possible - * unique target for a virtual call on a(). Returns {@code null} if either no - * such concrete method or more than one such method exists. Returns the method a - * if a is a concrete method that is not overridden. If the compiler uses the - * result of this method for its compilation, it must register an assumption - * because dynamic class loading can invalidate the result of this method. + * Given an JavaMethod a, returns a concrete JavaMethod b that is the only possible unique target for a virtual call + * on a(). Returns {@code null} if either no such concrete method or more than one such method exists. Returns the + * method a if a is a concrete method that is not overridden. + *

+ * If the compiler uses the result of this method for its compilation, it must register an assumption because + * dynamic class loading can invalidate the result of this method. * * @param method the method a for which a unique concrete target is searched - * @return the unique concrete target or {@code null} if no such target exists - * or assumptions are not supported by this runtime + * @return the unique concrete target or {@code null} if no such target exists or assumptions are not supported by + * this runtime */ - ResolvedJavaMethod uniqueConcreteMethod(ResolvedJavaMethod method); + ResolvedJavaMethod findUniqueConcreteMethod(ResolvedJavaMethod method); /** - * Returns the instance fields declared in this class sorted by field offset. - * A zero-length array is returned for array and primitive classes. + * Returns the instance fields declared in this class. A zero-length array is returned for array and primitive + * types. * * @return an array of instance fields */ - ResolvedJavaField[] declaredFields(); + ResolvedJavaField[] getDeclaredFields(); /** - * Returns this type's annotation of a specified type. + * Returns the annotation for the specified type of this class, if such an annotation is present. * * @param annotationClass the Class object corresponding to the annotation type - * @return the annotation of type {@code annotationClass} for this type if present, else null + * @return this element's annotation for the specified annotation type if present on this class, else {@code null} */ T getAnnotation(Class annotationClass); /** - * Returns the java.lang.Class object representing this JavaType instance or {@code null} if none exists. - * @return the java.lang.Class object + * Returns the {@link java.lang.Class} object representing this type. */ - Class toJava(); + Class< ? > toJava(); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java Tue Oct 09 15:23:38 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2012, 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 @@ -24,66 +24,63 @@ /** * Represents a method signature provided by the runtime. - * + * * @see Method Descriptors */ public interface Signature { + /** - * Gets the number of arguments in this signature, adding 1 for a receiver if requested. - * + * Returns the number of parameters in this signature, adding 1 for a receiver if requested. + * * @param receiver true if 1 is to be added to the result for a receiver - * @return the number of arguments + 1 iff {@code receiver == true} + * @return the number of parameters; + 1 iff {@code receiver == true} */ - int argumentCount(boolean receiver); + int getParameterCount(boolean receiver); /** - * Gets the argument type at the specified position. This method will return a - * {@linkplain ResolvedJavaType resolved} type if possible but without - * triggering any class loading or resolution. - * + * Gets the parameter type at the specified position. This method returns a {@linkplain ResolvedJavaType resolved} + * type if possible but without triggering any class loading or resolution. + * * @param index the index into the parameters, with {@code 0} indicating the first parameter - * @param accessingClass the context of the type lookup. If accessing class is provided, its class loader - * is used to retrieve an existing resolved type. This value can be {@code null} if the caller does - * not care for a resolved type. - * @return the {@code index}'th argument type + * @param accessingClass the context of the type lookup. If accessing class is provided, its class loader is used to + * retrieve an existing resolved type. This value can be {@code null} if the caller does not care for a + * resolved type. + * @return the {@code index}'th parameter type */ - JavaType argumentTypeAt(int index, ResolvedJavaType accessingClass); - - /** - * Gets the argument kind at the specified position. - * @param index the index into the parameters, with {@code 0} indicating the first parameter - * @return the kind of the argument at the specified position - */ - Kind argumentKindAt(int index); + JavaType getParameterType(int index, ResolvedJavaType accessingClass); /** - * Gets the return type of this signature. This method will return a - * {@linkplain ResolvedJavaType resolved} type if possible but without - * triggering any class loading or resolution. - * - * @param accessingClass the context of the type lookup. If accessing class is provided, its class loader - * is used to retrieve an existing resolved type. This value can be {@code null} if the caller does - * not care for a resolved type. - * @return the compiler interface type representing the return type + * Gets the parameter kind at the specified position. This is the same as calling {@link #getParameterType}. + * {@link JavaType#getKind getKind}. + * + * @param index the index into the parameters, with {@code 0} indicating the first parameter + * @return the kind of the parameter at the specified position */ - JavaType returnType(ResolvedJavaType accessingClass); + Kind getParameterKind(int index); /** - * Gets the return kind of this signature. - * @return the return kind + * Gets the return type of this signature. This method will return a {@linkplain ResolvedJavaType resolved} type if + * possible but without triggering any class loading or resolution. + * + * @param accessingClass the context of the type lookup. If accessing class is provided, its class loader is used to + * retrieve an existing resolved type. This value can be {@code null} if the caller does not care for a + * resolved type. + * @return the return type */ - Kind returnKind(); + JavaType getReturnType(ResolvedJavaType accessingClass); /** - * Converts this signature to a string. - * @return the signature as a string + * Gets the return kind of this signature. This is the same as calling {@link #getReturnType}. + * {@link JavaType#getKind getKind}. */ - String asString(); + Kind getReturnKind(); /** - * Gets the size, in Java slots, of the arguments to this signature. - * @param withReceiver {@code true} if to add a slot for a receiver object; {@code false} not to include the receiver - * @return the size of the arguments in slots + * Gets the size, in Java slots, of the parameters to this signature. + * + * @param withReceiver {@code true} if to add a slot for a receiver object; {@code false} not to include the + * receiver + * @return the size of the parameters in slots */ - int argumentSlots(boolean withReceiver); + int getParameterSlots(boolean withReceiver); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/UnresolvedField.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/UnresolvedField.java Tue Oct 09 14:06:26 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.api.meta; - - -/** - * A implementation of {@link JavaField} for an unresolved field. - */ -public class UnresolvedField implements JavaField { - - private final String name; - private final JavaType holder; - private final JavaType type; - - public UnresolvedField(JavaType holder, String name, JavaType type) { - this.name = name; - this.type = type; - this.holder = holder; - } - - public String name() { - return name; - } - - public JavaType type() { - return type; - } - - public Kind kind() { - return type.kind(); - } - - public JavaType holder() { - return holder; - } - - /** - * Converts this compiler interface field to a string. - */ - @Override - public String toString() { - return MetaUtil.format("%H.%n [unresolved]", this); - } -} diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/UnresolvedMethod.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/UnresolvedMethod.java Tue Oct 09 14:06:26 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.api.meta; - - -/** - * A implementation of {@link JavaMethod} for an unresolved method. - */ -public class UnresolvedMethod implements JavaMethod { - - private final String name; - private final JavaType holder; - private final Signature signature; - - public UnresolvedMethod(JavaType holder, String name, Signature signature) { - this.name = name; - this.holder = holder; - this.signature = signature; - } - - public String name() { - return name; - } - - public JavaType holder() { - return holder; - } - - public Signature signature() { - return signature; - } - - @Override - public String toString() { - return MetaUtil.format("%H.%n(%p) [unresolved]", this); - } -} diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java Tue Oct 09 15:23:38 2012 -0700 @@ -25,28 +25,29 @@ import java.io.*; /** - * Abstract base class for values manipulated by the compiler. All values have a {@linkplain Kind kind} and are immutable. + * Abstract base class for values manipulated by the compiler. All values have a {@linkplain Kind kind} and are + * immutable. */ public abstract class Value implements Serializable { + private static final long serialVersionUID = -6909397188697766469L; public static final Value[] NONE = {}; @SuppressWarnings("serial") - public static final Value IllegalValue = new Value(Kind.Illegal) { + public static final Value ILLEGAL = new Value(Kind.Illegal) { + @Override public String toString() { return "-"; } }; - /** - * The kind of this value. - */ private final Kind kind; /** * Initializes a new value of the specified kind. + * * @param kind the kind */ protected Value(Kind kind) { @@ -54,15 +55,15 @@ } /** - * String representation of the kind, which should be the end of all {@link #toString()} implementation of subclasses. + * Returns a String representation of the kind, which should be the end of all {@link #toString()} implementation of + * subclasses. */ - protected final String kindSuffix() { - return "|" + getKind().typeChar; + protected final String getKindSuffix() { + return "|" + getKind().getTypeChar(); } /** - * Gets the kind of the value. - * @return the kind + * Returns the kind of this value. */ public final Kind getKind() { return kind; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/package-info.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/package-info.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/package-info.java Tue Oct 09 15:23:38 2012 -0700 @@ -23,8 +23,7 @@ /** * Package that defines the interface between a runtime and a Java application that wants to access meta information. The runtime - * provides an implementation of the {@link com.oracle.graal.api.meta.MetaAccessProvider} interface. The method - * {@link com.oracle.graal.api.meta.MetaAccessProvider#getResolvedJavaType(Class)} allows to get access to the - * {@link com.oracle.graal.api.meta.ResolvedJavaType} corresponding to a given {@link java.lang.Class}. + * provides an implementation of the {@link com.oracle.graal.api.meta.MetaAccessProvider} interface. */ package com.oracle.graal.api.meta; + diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.boot/src/com/oracle/graal/boot/BigBang.java --- a/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/BigBang.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/BigBang.java Tue Oct 09 15:23:38 2012 -0700 @@ -110,7 +110,7 @@ } else if (node instanceof StoreIndexedNode) { StoreIndexedNode storeIndexedNode = (StoreIndexedNode) node; if (storeIndexedNode.elementKind() == Kind.Object) { - resultElement = getProcessedArrayType(metaAccessProvider.getResolvedJavaType(Object[].class)); + resultElement = getProcessedArrayType(metaAccessProvider.lookupJavaType(Object[].class)); } } else if (node instanceof ReturnNode) { ReturnNode returnNode = (ReturnNode) node; @@ -157,7 +157,7 @@ } else if (node instanceof LoadIndexedNode) { LoadIndexedNode loadIndexedNode = (LoadIndexedNode) node; if (loadIndexedNode.kind() == Kind.Object) { - resultElement = getProcessedArrayType(metaAccessProvider.getResolvedJavaType(Object[].class)); + resultElement = getProcessedArrayType(metaAccessProvider.lookupJavaType(Object[].class)); } } else if (node instanceof LocalNode) { LocalNode localNode = (LocalNode) node; @@ -223,8 +223,8 @@ Map scannedObjects = new IdentityHashMap<>(); for (FieldElement field : originalRoots) { assert field.isStatic(); - if (field.getUsageCount() > 0 && field.getJavaField().kind() == Kind.Object) { - Object value = field.getJavaField().getValue(null).asObject(); + if (field.getUsageCount() > 0 && field.getJavaField().getKind() == Kind.Object) { + Object value = field.getJavaField().readValue(null).asObject(); BigBang.out.printf("Root field %s: %s\n", field, value); scanField(scannedObjects, field, value); } @@ -245,20 +245,20 @@ } scannedObjects.put(value, Boolean.TRUE); - ResolvedJavaType type = getMetaAccess().getResolvedJavaType(value.getClass()); + ResolvedJavaType type = getMetaAccess().lookupJavaType(value.getClass()); scan(scannedObjects, value, type); } private void scan(Map scannedObjects, Object value, ResolvedJavaType type) { - if (type.superType() != null) { - scan(scannedObjects, value, type.superType()); + if (type.getSuperclass() != null) { + scan(scannedObjects, value, type.getSuperclass()); } - ResolvedJavaField[] declaredFields = type.declaredFields(); + ResolvedJavaField[] declaredFields = type.getDeclaredFields(); for (ResolvedJavaField field : declaredFields) { - if (field.kind() == Kind.Object) { + if (field.getKind() == Kind.Object) { FieldElement fieldElement = getProcessedField(field); - Object fieldValue = field.getValue(Constant.forObject(value)).asObject(); + Object fieldValue = field.readValue(Constant.forObject(value)).asObject(); scanField(scannedObjects, fieldElement, fieldValue); } } @@ -270,7 +270,7 @@ int nativeMethodCount = 0; for (MethodElement methodElement : methodMap.values()) { if (methodElement.hasGraph()) { - if (Modifier.isNative(methodElement.getResolvedJavaMethod().accessFlags())) { + if (Modifier.isNative(methodElement.getResolvedJavaMethod().getModifiers())) { BigBang.out.println("Included native method: " + methodElement.getResolvedJavaMethod()); nativeMethodCount++; } @@ -280,7 +280,7 @@ int methodCount = 0; for (MethodElement methodElement : methodMap.values()) { if (methodElement.hasGraph()) { - if (!Modifier.isNative(methodElement.getResolvedJavaMethod().accessFlags())) { + if (!Modifier.isNative(methodElement.getResolvedJavaMethod().getModifiers())) { BigBang.out.println("Included method: " + methodElement.getResolvedJavaMethod()); methodCount++; } @@ -295,7 +295,7 @@ fieldElement.printSeenTypes(); BigBang.out.println(); fieldCount++; - includedTypes.add(fieldElement.getJavaField().holder()); + includedTypes.add(fieldElement.getJavaField().getDeclaringClass()); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.boot/src/com/oracle/graal/boot/BootImageGenerator.java --- a/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/BootImageGenerator.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/BootImageGenerator.java Tue Oct 09 15:23:38 2012 -0700 @@ -44,7 +44,7 @@ throw new RuntimeException("Could not find method " + name + " with parameter types " + parameterTypes + " in class " + convertedClass.getCanonicalName()); } BigBang.out.printf("Adding method %s.%s to the boot image\n", method.getDeclaringClass().getName(), method.getName()); - addEntryMethod(metaAccess.getResolvedJavaMethod(method)); + addEntryMethod(metaAccess.lookupJavaMethod(method)); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/ArrayTypeElement.java --- a/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/ArrayTypeElement.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/ArrayTypeElement.java Tue Oct 09 15:23:38 2012 -0700 @@ -36,7 +36,7 @@ private ResolvedJavaType javaType; public ArrayTypeElement(ResolvedJavaType javaType) { - super(javaType.componentType()); + super(javaType.getComponentType()); this.javaType = javaType; } @@ -62,7 +62,7 @@ BigBang.out.println(((StructuredGraph) load.graph()).method()); System.exit(-1); } - ResolvedJavaType componentType = type.componentType(); + ResolvedJavaType componentType = type.getComponentType(); Set newSet = new HashSet<>(); for (ResolvedJavaType myType : set) { if (myType.isSubtypeOf(componentType)) { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/Element.java --- a/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/Element.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/Element.java Tue Oct 09 15:23:38 2012 -0700 @@ -121,7 +121,7 @@ public synchronized void printSeenTypes() { for (ResolvedJavaType type : seenTypes) { - BigBang.out.print(type.name() + " "); + BigBang.out.print(type.getName() + " "); } } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/FieldElement.java --- a/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/FieldElement.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/FieldElement.java Tue Oct 09 15:23:38 2012 -0700 @@ -34,12 +34,12 @@ protected ResolvedJavaField javaField; public FieldElement(ResolvedJavaField javaField) { - super(javaField.type().resolve(javaField.holder())); + super(javaField.getType().resolve(javaField.getDeclaringClass())); this.javaField = javaField; } public boolean isStatic() { - return Modifier.isStatic(javaField.accessFlags()); + return Modifier.isStatic(javaField.getModifiers()); } public ResolvedJavaField getJavaField() { @@ -54,7 +54,7 @@ public synchronized void registerNewValue(BigBang bb, Object value) { if (value != null) { Class clazz = value.getClass(); - ResolvedJavaType resolvedType = bb.getMetaAccess().getResolvedJavaType(clazz); + ResolvedJavaType resolvedType = bb.getMetaAccess().lookupJavaType(clazz); if (seenTypes.add(resolvedType)) { Set newSeenTypes = new HashSet<>(); newSeenTypes.add(resolvedType); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/InvokeElement.java --- a/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/InvokeElement.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/InvokeElement.java Tue Oct 09 15:23:38 2012 -0700 @@ -39,7 +39,7 @@ @SuppressWarnings("unchecked") public InvokeElement(MethodCallTargetNode methodCallTarget) { - super(methodCallTarget.isStatic() ? null : methodCallTarget.targetMethod().holder()); + super(methodCallTarget.isStatic() ? null : methodCallTarget.targetMethod().getDeclaringClass()); this.methodCallTarget = methodCallTarget; parameterTypes = new Set[methodCallTarget.arguments().size()]; } @@ -78,7 +78,7 @@ for (ResolvedJavaType type : newSeenTypes) { if (seenTypes.add(type)) { // There is a new receiver type! - ResolvedJavaMethod method = type.resolveMethodImpl(methodCallTarget.targetMethod()); + ResolvedJavaMethod method = type.resolveMethod(methodCallTarget.targetMethod()); BigBang.out.println("resolved method " + method + " for type " + type + " and method " + methodCallTarget.targetMethod()); if (method == null) { BigBang.out.println("!!! type = " + type + " / " + methodCallTarget.targetMethod()); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/MethodElement.java --- a/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/MethodElement.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/MethodElement.java Tue Oct 09 15:23:38 2012 -0700 @@ -43,10 +43,10 @@ private ResolvedJavaMethod resolvedJavaMethod; public MethodElement(ResolvedJavaMethod javaMethod) { - super(javaMethod.signature().returnType(javaMethod.holder()).resolve(javaMethod.holder())); + super(javaMethod.getSignature().getReturnType(javaMethod.getDeclaringClass()).resolve(javaMethod.getDeclaringClass())); assert javaMethod != null; this.resolvedJavaMethod = javaMethod; - int parameterCount = resolvedJavaMethod.signature().argumentCount(!Modifier.isStatic(resolvedJavaMethod.accessFlags())); + int parameterCount = resolvedJavaMethod.getSignature().getParameterCount(!Modifier.isStatic(resolvedJavaMethod.getModifiers())); parameters = new ParameterElement[parameterCount]; for (int i = 0; i < parameters.length; ++i) { parameters[i] = new ParameterElement(resolvedJavaMethod, i); @@ -91,12 +91,12 @@ this.graph = newGraph; } - if (Modifier.isNative(resolvedJavaMethod.accessFlags())) { + if (Modifier.isNative(resolvedJavaMethod.getModifiers())) { BigBang.out.println("NATIVE METHOD " + resolvedJavaMethod); return; } - BigBang.out.println("parsing graph " + resolvedJavaMethod + ", locals=" + resolvedJavaMethod.maxLocals()); + BigBang.out.println("parsing graph " + resolvedJavaMethod + ", locals=" + resolvedJavaMethod.getMaxLocals()); GraphBuilderConfiguration config = new GraphBuilderConfiguration(ResolvePolicy.Eager, null); GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(bb.getMetaAccess(), config, OptimisticOptimizations.NONE); graphBuilderPhase.apply(newGraph); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/ParameterElement.java --- a/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/ParameterElement.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/ParameterElement.java Tue Oct 09 15:23:38 2012 -0700 @@ -39,13 +39,13 @@ } private static ResolvedJavaType calculateDeclaredType(ResolvedJavaMethod m, int i) { - if (Modifier.isStatic(m.accessFlags())) { - return m.signature().argumentTypeAt(i, m.holder()).resolve(m.holder()); + if (Modifier.isStatic(m.getModifiers())) { + return m.getSignature().getParameterType(i, m.getDeclaringClass()).resolve(m.getDeclaringClass()); } else { if (i == 0) { - return m.holder(); + return m.getDeclaringClass(); } - return m.signature().argumentTypeAt(i - 1, m.holder()).resolve(m.holder()); + return m.getSignature().getParameterType(i - 1, m.getDeclaringClass()).resolve(m.getDeclaringClass()); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64DeoptimizationStub.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64DeoptimizationStub.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64DeoptimizationStub.java Tue Oct 09 15:23:38 2012 -0700 @@ -65,12 +65,12 @@ keepAlive.add(deoptInfo.toString()); AMD64Move.move(tasm, masm, scratch.asValue(), Constant.forObject(deoptInfo)); // TODO Make this an explicit calling convention instead of using a scratch register - AMD64Call.directCall(tasm, masm, tasm.runtime.getRuntimeCall(SET_DEOPT_INFO), info); + AMD64Call.directCall(tasm, masm, tasm.runtime.lookupRuntimeCall(SET_DEOPT_INFO), info); } masm.movl(scratch, tasm.runtime.encodeDeoptActionAndReason(action, reason)); // TODO Make this an explicit calling convention instead of using a scratch register - AMD64Call.directCall(tasm, masm, tasm.runtime.getRuntimeCall(DEOPTIMIZE), info); + AMD64Call.directCall(tasm, masm, tasm.runtime.lookupRuntimeCall(DEOPTIMIZE), info); AMD64Call.shouldNotReachHere(tasm, masm); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Tue Oct 09 15:23:38 2012 -0700 @@ -137,18 +137,18 @@ @Override public Address makeAddress(LocationNode location, ValueNode object) { Value base = operand(object); - Value index = Value.IllegalValue; + Value index = Value.ILLEGAL; int scale = 1; int displacement = location.displacement(); if (isConstant(base)) { if (asConstant(base).isNull()) { - base = Value.IllegalValue; + base = Value.ILLEGAL; } else if (asConstant(base).getKind() != Kind.Object) { long newDisplacement = displacement + asConstant(base).asLong(); if (NumUtil.isInt(newDisplacement)) { displacement = (int) newDisplacement; - base = Value.IllegalValue; + base = Value.ILLEGAL; } } } @@ -165,7 +165,7 @@ // only use the constant index if the resulting displacement fits into a 32 bit offset if (NumUtil.isInt(newDisplacement)) { displacement = (int) newDisplacement; - index = Value.IllegalValue; + index = Value.ILLEGAL; } else { // create a temporary variable for the index, the pointer load cannot handle a constant index Value newIndex = newVariable(Kind.Long); @@ -228,7 +228,7 @@ public void emitBranch(Value left, Value right, Condition cond, boolean unorderedIsTrue, LabelRef label, LIRFrameState info) { boolean mirrored = emitCompare(left, right); Condition finalCondition = mirrored ? cond.mirror() : cond; - switch (left.getKind().stackKind()) { + switch (left.getKind().getStackKind()) { case Int: case Long: case Object: append(new BranchOp(finalCondition, label, info)); break; @@ -244,7 +244,7 @@ Condition finalCondition = mirrored ? cond.mirror() : cond; Variable result = newVariable(trueValue.getKind()); - switch (left.getKind().stackKind()) { + switch (left.getKind().getStackKind()) { case Int: case Long: case Object: append(new CondMoveOp(result, finalCondition, load(trueValue), loadNonConst(falseValue))); break; @@ -275,7 +275,7 @@ right = loadNonConst(b); mirrored = false; } - switch (left.getKind().stackKind()) { + switch (left.getKind().getStackKind()) { case Jsr: case Int: append(new CompareOp(ICMP, left, right)); break; case Long: append(new CompareOp(LCMP, left, right)); break; @@ -377,11 +377,11 @@ append(new DivOp(LREM, RDX_L, RAX_L, load(b), state())); return emitMove(RDX_L); case Float: { - RuntimeCall stub = runtime.getRuntimeCall(ARITHMETIC_FREM); + RuntimeCall stub = runtime.lookupRuntimeCall(ARITHMETIC_FREM); return emitCall(stub, stub.getCallingConvention(), false, a, b); } case Double: { - RuntimeCall stub = runtime.getRuntimeCall(ARITHMETIC_DREM); + RuntimeCall stub = runtime.lookupRuntimeCall(ARITHMETIC_DREM); return emitCall(stub, stub.getCallingConvention(), false, a, b); } default: @@ -633,7 +633,7 @@ protected void emitSequentialSwitch(Constant[] keyConstants, LabelRef[] keyTargets, LabelRef defaultTarget, Value key) { // Making a copy of the switch value is necessary because jump table destroys the input value if (key.getKind() == Kind.Int) { - append(new SequentialSwitchOp(keyConstants, keyTargets, defaultTarget, key, Value.IllegalValue)); + append(new SequentialSwitchOp(keyConstants, keyTargets, defaultTarget, key, Value.ILLEGAL)); } else { assert key.getKind() == Kind.Object; append(new SequentialSwitchOp(keyConstants, keyTargets, defaultTarget, key, newVariable(Kind.Object))); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompiledMethodTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompiledMethodTest.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompiledMethodTest.java Tue Oct 09 15:23:38 2012 -0700 @@ -67,7 +67,7 @@ } } - final ResolvedJavaMethod javaMethod = runtime.getResolvedJavaMethod(method); + final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method); InstalledCode compiledMethod = getCode(javaMethod, graph); try { Object result = compiledMethod.execute("1", "2", "3"); @@ -81,7 +81,7 @@ public void test3() { Method method = getMethod("testMethod"); final StructuredGraph graph = parse(method); - final ResolvedJavaMethod javaMethod = runtime.getResolvedJavaMethod(method); + final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method); InstalledCode compiledMethod = getCode(javaMethod, graph); try { Object result = compiledMethod.executeVarargs("1", "2", "3"); @@ -95,7 +95,7 @@ public void test4() { Method method = getMethod("testMethodVirtual"); final StructuredGraph graph = parse(method); - final ResolvedJavaMethod javaMethod = runtime.getResolvedJavaMethod(method); + final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method); InstalledCode compiledMethod = getCode(javaMethod, graph); try { f1 = "0"; @@ -109,7 +109,7 @@ @Test public void test2() throws NoSuchMethodException, SecurityException { Method method = CompilableObjectImpl.class.getDeclaredMethod("executeHelper", ObjectCompiler.class, String.class); - ResolvedJavaMethod javaMethod = runtime.getResolvedJavaMethod(method); + ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method); StructuredGraph graph = new StructuredGraph(javaMethod); new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.NONE).apply(graph); new CanonicalizerPhase(null, runtime, null).apply(graph); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Tue Oct 09 15:23:38 2012 -0700 @@ -232,7 +232,7 @@ } } - InstalledCode compiledMethod = getCode(runtime.getResolvedJavaMethod(method), parse(method)); + InstalledCode compiledMethod = getCode(runtime.lookupJavaMethod(method), parse(method)); try { return new Result(compiledMethod.executeVarargs(executeArgs), null); } catch (Throwable e) { @@ -331,7 +331,7 @@ * Parses a Java method to produce a graph. */ protected StructuredGraph parse(Method m) { - ResolvedJavaMethod javaMethod = runtime.getResolvedJavaMethod(m); + ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(m); StructuredGraph graph = new StructuredGraph(javaMethod); new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.ALL).apply(graph); return graph; @@ -341,7 +341,7 @@ * Parses a Java method to produce a graph. */ protected StructuredGraph parseProfiled(Method m) { - ResolvedJavaMethod javaMethod = runtime.getResolvedJavaMethod(m); + ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(m); StructuredGraph graph = new StructuredGraph(javaMethod); new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL).apply(graph); return graph; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/NestedLoopTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/NestedLoopTest.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/NestedLoopTest.java Tue Oct 09 15:23:38 2012 -0700 @@ -135,7 +135,7 @@ private static Invoke getInvoke(String name, StructuredGraph graph) { for (Invoke invoke : graph.getInvokes()) { - if (invoke.methodCallTarget().targetMethod().name().equals(name)) { + if (invoke.methodCallTarget().targetMethod().getName().equals(name)) { return invoke; } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Tue Oct 09 15:23:38 2012 -0700 @@ -71,7 +71,7 @@ public CompilationResult compileMethod(final ResolvedJavaMethod method, final StructuredGraph graph, int osrBCI, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts) { - assert (method.accessFlags() & Modifier.NATIVE) == 0 : "compiling native methods is not supported"; + assert (method.getModifiers() & Modifier.NATIVE) == 0 : "compiling native methods is not supported"; if (osrBCI != -1) { throw new BailoutException("No OSR supported"); } @@ -234,7 +234,7 @@ } public FrameMap emitLIR(final LIR lir, StructuredGraph graph, final ResolvedJavaMethod method) { - final FrameMap frameMap = backend.newFrameMap(runtime.getRegisterConfig(method)); + final FrameMap frameMap = backend.newFrameMap(runtime.lookupRegisterConfig(method)); final LIRGenerator lirGenerator = backend.newLIRGenerator(graph, frameMap, method, lir); Debug.scope("LIRGen", lirGenerator, new Runnable() { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java Tue Oct 09 15:23:38 2012 -0700 @@ -518,7 +518,7 @@ void setKind(Kind kind) { assert isRegister(operand) || this.kind() == Kind.Illegal || this.kind() == kind : "overwriting existing type"; - assert kind == kind.stackKind() || kind == Kind.Short : "these kinds should have int type registers"; + assert kind == kind.getStackKind() || kind == Kind.Short : "these kinds should have int type registers"; this.kind = kind; } @@ -660,7 +660,7 @@ /** * Sentinel interval to denote the end of an interval list. */ - static final Interval EndMarker = new Interval(Value.IllegalValue, -1); + static final Interval EndMarker = new Interval(Value.ILLEGAL, -1); Interval(Value operand, int operandNumber) { assert operand != null; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Tue Oct 09 15:23:38 2012 -0700 @@ -1194,7 +1194,7 @@ @Override public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { - addDef(operand, opId, registerPriorityOfOutputOperand(op), operand.getKind().stackKind()); + addDef(operand, opId, registerPriorityOfOutputOperand(op), operand.getKind().getStackKind()); addRegisterHint(op, operand, mode, flags); } return operand; @@ -1204,7 +1204,7 @@ @Override public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { - addTemp(operand, opId, RegisterPriority.MustHaveRegister, operand.getKind().stackKind()); + addTemp(operand, opId, RegisterPriority.MustHaveRegister, operand.getKind().getStackKind()); addRegisterHint(op, operand, mode, flags); } return operand; @@ -1215,7 +1215,7 @@ public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { RegisterPriority p = registerPriorityOfInputOperand(flags); - addUse(operand, blockFrom, opId + 1, p, operand.getKind().stackKind()); + addUse(operand, blockFrom, opId + 1, p, operand.getKind().getStackKind()); addRegisterHint(op, operand, mode, flags); } return operand; @@ -1226,7 +1226,7 @@ public Value doValue(Value operand, OperandMode mode, EnumSet flags) { if (isVariableOrRegister(operand)) { RegisterPriority p = registerPriorityOfInputOperand(flags); - addUse(operand, blockFrom, opId, p, operand.getKind().stackKind()); + addUse(operand, blockFrom, opId, p, operand.getKind().getStackKind()); addRegisterHint(op, operand, mode, flags); } return operand; @@ -1240,7 +1240,7 @@ op.forEachState(new ValueProcedure() { @Override public Value doValue(Value operand) { - addUse(operand, blockFrom, opId + 1, RegisterPriority.None, operand.getKind().stackKind()); + addUse(operand, blockFrom, opId + 1, RegisterPriority.None, operand.getKind().getStackKind()); return operand; } }); @@ -1688,7 +1688,7 @@ // intervals that have no oops inside need not to be processed. // to ensure a walking until the last instruction id, add a dummy interval // with a high operation id - nonOopIntervals = new Interval(Value.IllegalValue, -1); + nonOopIntervals = new Interval(Value.ILLEGAL, -1); nonOopIntervals.addRange(Integer.MAX_VALUE - 2, Integer.MAX_VALUE - 1); return new IntervalWalker(this, oopIntervals, nonOopIntervals); @@ -2060,7 +2060,7 @@ fixedIntervals = createUnhandledLists(IS_PRECOLORED_INTERVAL, null).first; // to ensure a walking until the last instruction id, add a dummy interval // with a high operation id - otherIntervals = new Interval(Value.IllegalValue, -1); + otherIntervals = new Interval(Value.ILLEGAL, -1); otherIntervals.addRange(Integer.MAX_VALUE - 2, Integer.MAX_VALUE - 1); IntervalWalker iw = new IntervalWalker(this, fixedIntervals, otherIntervals); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java Tue Oct 09 15:23:38 2012 -0700 @@ -333,7 +333,7 @@ assert fromInterval.operand != toInterval.operand : "from and to interval equal: " + fromInterval; assert fromInterval.kind() == toInterval.kind(); mappingFrom.add(fromInterval); - mappingFromOpr.add(Value.IllegalValue); + mappingFromOpr.add(Value.ILLEGAL); mappingTo.add(toInterval); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Tue Oct 09 15:23:38 2012 -0700 @@ -76,7 +76,7 @@ changed = false; IdentityHashMap virtualObjectsCopy = new IdentityHashMap<>(virtualObjects); for (Entry entry : virtualObjectsCopy.entrySet()) { - if (entry.getValue().values() == null) { + if (entry.getValue().getValues() == null) { VirtualObjectNode vobj = entry.getKey(); if (vobj instanceof BoxedVirtualObjectNode) { BoxedVirtualObjectNode boxedVirtualObjectNode = (BoxedVirtualObjectNode) vobj; @@ -170,7 +170,7 @@ } else { // return a dummy value because real value not needed Debug.metric("StateIllegals").increment(); - return Value.IllegalValue; + return Value.ILLEGAL; } } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Tue Oct 09 15:23:38 2012 -0700 @@ -146,7 +146,7 @@ */ @Override public Variable newVariable(Kind kind) { - Kind stackKind = kind.stackKind(); + Kind stackKind = kind.getStackKind(); switch (stackKind) { case Jsr: case Int: @@ -170,10 +170,10 @@ public Value setResult(ValueNode x, Value operand) { assert (isVariable(operand) && x.kind() == operand.getKind()) || (isRegister(operand) && !attributes(asRegister(operand)).isAllocatable()) || - (isConstant(operand) && x.kind() == operand.getKind().stackKind()) : operand.getKind() + " for node " + x; + (isConstant(operand) && x.kind() == operand.getKind().getStackKind()) : operand.getKind() + " for node " + x; assert operand(x) == null : "operand cannot be set twice"; assert operand != null && isLegal(operand) : "operand must be legal"; - assert operand.getKind().stackKind() == x.kind(); + assert operand.getKind().getStackKind() == x.kind(); assert !(x instanceof VirtualObjectNode); nodeOperands.set(x, operand); return operand; @@ -242,7 +242,7 @@ */ public Value resultOperandFor(Kind kind) { if (kind == Kind.Void) { - return IllegalValue; + return ILLEGAL; } return frameMap.registerConfig.getReturnRegister(kind).asValue(kind); } @@ -449,14 +449,14 @@ } protected void emitPrologue() { - CallingConvention incomingArguments = frameMap.registerConfig.getCallingConvention(JavaCallee, method.signature().returnKind(), MetaUtil.signatureToKinds(method), target, false); + CallingConvention incomingArguments = frameMap.registerConfig.getCallingConvention(JavaCallee, method.getSignature().getReturnKind(), MetaUtil.signatureToKinds(method), target, false); Value[] params = new Value[incomingArguments.getArgumentCount()]; for (int i = 0; i < params.length; i++) { params[i] = toStackKind(incomingArguments.getArgument(i)); if (ValueUtil.isStackSlot(params[i])) { StackSlot slot = ValueUtil.asStackSlot(params[i]); - if (slot.inCallerFrame() && !lir.hasArgInCallerFrame()) { + if (slot.isInCallerFrame() && !lir.hasArgInCallerFrame()) { lir.setHasArgInCallerFrame(); } } @@ -466,7 +466,7 @@ for (LocalNode local : graph.getNodes(LocalNode.class)) { Value param = params[local.index()]; - assert param.getKind() == local.kind().stackKind(); + assert param.getKind() == local.kind().getStackKind(); setResult(local, emitMove(param)); } } @@ -476,7 +476,7 @@ */ public void lock() { if (lockDataSlots.size() == currentLockCount) { - lockDataSlots.add(frameMap.allocateStackBlock(runtime.sizeOfLockData(), false)); + lockDataSlots.add(frameMap.allocateStackBlock(runtime.getSizeOfLockData(), false)); } currentLockCount++; } @@ -502,7 +502,7 @@ @Override public void visitReturn(ReturnNode x) { - Value operand = Value.IllegalValue; + Value operand = Value.ILLEGAL; if (!x.kind().isVoid()) { operand = resultOperandFor(x.kind()); emitMove(operand(x.result()), operand); @@ -662,11 +662,11 @@ public abstract Variable emitCMove(Value leftVal, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue); protected FrameState stateBeforeCallWithArguments(FrameState stateAfter, MethodCallTargetNode call, int bci) { - return stateAfter.duplicateModified(bci, stateAfter.rethrowException(), call.returnStamp().kind(), toJVMArgumentStack(call.targetMethod().signature(), call.isStatic(), call.arguments())); + return stateAfter.duplicateModified(bci, stateAfter.rethrowException(), call.returnStamp().kind(), toJVMArgumentStack(call.targetMethod().getSignature(), call.isStatic(), call.arguments())); } private static ValueNode[] toJVMArgumentStack(Signature signature, boolean isStatic, NodeInputList arguments) { - int slotCount = signature.argumentSlots(!isStatic); + int slotCount = signature.getParameterSlots(!isStatic); ValueNode[] stack = new ValueNode[slotCount]; int stackIndex = 0; int argumentIndex = 0; @@ -677,7 +677,7 @@ // Current argument is receiver. stackIndex += stackSlots(Kind.Object); } else { - stackIndex += stackSlots(signature.argumentKindAt(argumentIndex)); + stackIndex += stackSlots(signature.getParameterKind(argumentIndex)); argumentIndex++; } } @@ -730,12 +730,12 @@ protected abstract void emitCall(Object targetMethod, Value result, Value[] arguments, Value[] temps, Value targetAddress, LIRFrameState info); private static Value toStackKind(Value value) { - if (value.getKind().stackKind() != value.getKind()) { + if (value.getKind().getStackKind() != value.getKind()) { // We only have stack-kinds in the LIR, so convert the operand kind for values from the calling convention. if (isRegister(value)) { - return asRegister(value).asValue(value.getKind().stackKind()); + return asRegister(value).asValue(value.getKind().getStackKind()); } else if (isStackSlot(value)) { - return StackSlot.get(value.getKind().stackKind(), asStackSlot(value).rawOffset(), asStackSlot(value).rawAddFrameSize()); + return StackSlot.get(value.getKind().getStackKind(), asStackSlot(value).getRawOffset(), asStackSlot(value).getRawAddFrameSize()); } else { throw GraalInternalError.shouldNotReachHere(); } @@ -788,7 +788,7 @@ @Override public void visitRuntimeCall(RuntimeCallNode x) { - RuntimeCall call = runtime.getRuntimeCall(x.getDescriptor()); + RuntimeCall call = runtime.lookupRuntimeCall(x.getDescriptor()); CallingConvention cc = call.getCallingConvention(); frameMap.callsMethod(cc); Value resultOperand = cc.getReturn(); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/PhiResolver.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/PhiResolver.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/PhiResolver.java Tue Oct 09 15:23:38 2012 -0700 @@ -118,7 +118,7 @@ public PhiResolver(LIRGenerator gen) { this.gen = gen; - temp = IllegalValue; + temp = ILLEGAL; } public void dispose() { @@ -221,7 +221,7 @@ private void moveTempTo(Value dest) { assert isLegal(temp); emitMove(temp, dest); - temp = IllegalValue; + temp = ILLEGAL; } private void moveToTemp(Value src) { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Tue Oct 09 15:23:38 2012 -0700 @@ -247,7 +247,7 @@ // Emit the prefix tasm.recordMark(Marks.MARK_OSR_ENTRY); - boolean isStatic = Modifier.isStatic(method.accessFlags()); + boolean isStatic = Modifier.isStatic(method.getModifiers()); if (!isStatic) { tasm.recordMark(Marks.MARK_UNVERIFIED_ENTRY); CallingConvention cc = regConfig.getCallingConvention(JavaCallee, Kind.Void, new Kind[] {Kind.Object}, target, false); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java Tue Oct 09 15:23:38 2012 -0700 @@ -154,12 +154,12 @@ } if (locations[i] == null) { - locations[i] = StackSlot.get(kind.stackKind(), currentStackOffset, !type.out); + locations[i] = StackSlot.get(kind.getStackKind(), currentStackOffset, !type.out); currentStackOffset += Math.max(target.sizeInBytes(kind), target.wordSize); } } - Value returnLocation = returnKind.isVoid() ? Value.IllegalValue : getReturnRegister(returnKind).asValue(returnKind); + Value returnLocation = returnKind.isVoid() ? Value.ILLEGAL : getReturnRegister(returnKind).asValue(returnKind); return new CallingConvention(currentStackOffset, returnLocation, locations); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/ReplacingStreams.java --- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/ReplacingStreams.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/ReplacingStreams.java Tue Oct 09 15:23:38 2012 -0700 @@ -46,7 +46,7 @@ input = new ReplacingInputStream(new BufferedInputStream(inputStream)); invocation = new InvocationSocket(output, input); - addStaticObject(Value.IllegalValue); + addStaticObject(Value.ILLEGAL); } public void setInvocationSocket(InvocationSocket invocation) { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java Tue Oct 09 15:23:38 2012 -0700 @@ -30,6 +30,7 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.hotspot.meta.*; @SuppressWarnings("unused") public final class CompilationStatistics { @@ -76,14 +77,14 @@ private int codeSize; private int deoptCount; - private CompilationStatistics(ResolvedJavaMethod method) { + private CompilationStatistics(HotSpotResolvedJavaMethod method) { if (method != null) { holder = MetaUtil.format("%H", method); - name = method.name(); + name = method.getName(); signature = MetaUtil.format("%p", method); startTime = System.nanoTime(); startInvCount = method.invocationCount(); - bytecodeCount = method.codeSize(); + bytecodeCount = method.getCodeSize(); } else { holder = ""; name = ""; @@ -92,11 +93,11 @@ } } - public void finish(ResolvedJavaMethod method) { + public void finish(HotSpotResolvedJavaMethod method) { if (ENABLED) { duration = System.nanoTime() - startTime; endInvCount = method.invocationCount(); - codeSize = method.compiledCodeSize(); + codeSize = method.getCompiledCodeSize(); if (current.get().getLast() != this) { throw new RuntimeException("mismatch in finish()"); } @@ -108,7 +109,7 @@ return current.get().isEmpty() ? null : current.get().getLast(); } - public static CompilationStatistics create(ResolvedJavaMethod method) { + public static CompilationStatistics create(HotSpotResolvedJavaMethod method) { if (ENABLED) { CompilationStatistics stats = new CompilationStatistics(method); list.add(stats); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Tue Oct 09 15:23:38 2012 -0700 @@ -103,7 +103,7 @@ try { final boolean printCompilation = GraalOptions.PrintCompilation && !TTY.isSuppressed(); if (printCompilation) { - TTY.println(String.format("%-6d Graal %-70s %-45s %-50s ...", id, method.holder().name(), method.name(), method.signature().asString())); + TTY.println(String.format("%-6d Graal %-70s %-45s %-50s ...", id, method.getDeclaringClass().getName(), method.getName(), method.getSignature())); } CompilationResult result = null; @@ -121,7 +121,7 @@ } finally { filter.remove(); if (printCompilation) { - TTY.println(String.format("%-6d Graal %-70s %-45s %-50s | %4dnodes %5dB", id, "", "", "", 0, (result != null ? result.targetCodeSize() : -1))); + TTY.println(String.format("%-6d Graal %-70s %-45s %-50s | %4dnodes %5dB", id, "", "", "", 0, (result != null ? result.getTargetCodeSize() : -1))); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotRuntimeInterpreterInterface.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotRuntimeInterpreterInterface.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotRuntimeInterpreterInterface.java Tue Oct 09 15:23:38 2012 -0700 @@ -285,7 +285,7 @@ if (arrayType == null) { return; } - ResolvedJavaType type = metaProvider.getResolvedJavaType(array.getClass()).componentType(); + ResolvedJavaType type = metaProvider.lookupJavaType(array.getClass()).getComponentType(); if (!type.toJava().isAssignableFrom(arrayType)) { throw new ArrayStoreException(arrayType.getName()); } @@ -293,7 +293,7 @@ private void checkArray(Object array, long index) { nullCheck(array); - ResolvedJavaType type = metaProvider.getResolvedJavaType(array.getClass()); + ResolvedJavaType type = metaProvider.lookupJavaType(array.getClass()); if (!type.isArrayClass()) { throw new ArrayStoreException(array.getClass().getName()); } @@ -308,7 +308,7 @@ } private static boolean isVolatile(ResolvedJavaField field) { - return Modifier.isVolatile(field.accessFlags()); + return Modifier.isVolatile(field.getModifiers()); } private static long resolveOffset(ResolvedJavaField field) { @@ -318,7 +318,7 @@ private static Object resolveBase(Object base, ResolvedJavaField field) { Object accessorBase = base; if (accessorBase == null) { - accessorBase = field.holder().toJava(); + accessorBase = field.getDeclaringClass().toJava(); } return accessorBase; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/MethodFilter.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/MethodFilter.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/MethodFilter.java Tue Oct 09 15:23:38 2012 -0700 @@ -108,19 +108,19 @@ public boolean matches(JavaMethod o) { // check method name first, since MetaUtil.toJavaName is expensive - if (methodName != null && !methodName.matcher(o.name()).matches()) { + if (methodName != null && !methodName.matcher(o.getName()).matches()) { return false; } - if (clazz != null && !clazz.matcher(MetaUtil.toJavaName(o.holder())).matches()) { + if (clazz != null && !clazz.matcher(MetaUtil.toJavaName(o.getDeclaringClass())).matches()) { return false; } if (signature != null) { - Signature sig = o.signature(); - if (sig.argumentCount(false) != signature.length) { + Signature sig = o.getSignature(); + if (sig.getParameterCount(false) != signature.length) { return false; } for (int i = 0; i < signature.length; i++) { - JavaType type = sig.argumentTypeAt(i, null); + JavaType type = sig.getParameterType(i, null); String javaName = MetaUtil.toJavaName(type); if (signature[i] != null && !signature[i].matcher(javaName).matches()) { return false; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Tue Oct 09 15:23:38 2012 -0700 @@ -221,8 +221,8 @@ } private void enqueue(Method m) throws Throwable { - JavaMethod javaMethod = graalRuntime.getRuntime().getResolvedJavaMethod(m); - assert !Modifier.isAbstract(((HotSpotResolvedJavaMethod) javaMethod).accessFlags()) && !Modifier.isNative(((HotSpotResolvedJavaMethod) javaMethod).accessFlags()) : javaMethod; + JavaMethod javaMethod = graalRuntime.getRuntime().lookupJavaMethod(m); + assert !Modifier.isAbstract(((HotSpotResolvedJavaMethod) javaMethod).getModifiers()) && !Modifier.isNative(((HotSpotResolvedJavaMethod) javaMethod).getModifiers()) : javaMethod; compileMethod((HotSpotResolvedJavaMethod) javaMethod, 0, false, 10); } @@ -408,7 +408,7 @@ HotSpotResolvedJavaType resolved = (HotSpotResolvedJavaType) holder; return resolved.createField(name, type, offset, flags); } - return new UnresolvedField(holder, name, type); + return new HotSpotUnresolvedField(holder, name, type); } @Override diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeInfo.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeInfo.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeInfo.java Tue Oct 09 15:23:38 2012 -0700 @@ -45,12 +45,12 @@ } @Override - public long start() { + public long getStart() { return start; } @Override - public byte[] code() { + public byte[] getCode() { return code; } @@ -62,7 +62,7 @@ } @Override - public ResolvedJavaMethod method() { + public ResolvedJavaMethod getMethod() { return method; } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCompiledMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCompiledMethod.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCompiledMethod.java Tue Oct 09 15:23:38 2012 -0700 @@ -46,7 +46,7 @@ } @Override - public ResolvedJavaMethod method() { + public ResolvedJavaMethod getMethod() { return method; } @@ -62,10 +62,10 @@ @Override public Object execute(Object arg1, Object arg2, Object arg3) { - assert method.signature().argumentCount(!Modifier.isStatic(method.accessFlags())) == 3; - assert method.signature().argumentKindAt(0) == Kind.Object; - assert method.signature().argumentKindAt(1) == Kind.Object; - assert !Modifier.isStatic(method.accessFlags()) || method.signature().argumentKindAt(2) == Kind.Object; + assert method.getSignature().getParameterCount(!Modifier.isStatic(method.getModifiers())) == 3; + assert method.getSignature().getParameterKind(0) == Kind.Object; + assert method.getSignature().getParameterKind(1) == Kind.Object; + assert !Modifier.isStatic(method.getModifiers()) || method.getSignature().getParameterKind(2) == Kind.Object; return HotSpotGraalRuntime.getInstance().getCompilerToVM().executeCompiledMethod(this, arg1, arg2, arg3); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphCache.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphCache.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphCache.java Tue Oct 09 15:23:38 2012 -0700 @@ -44,7 +44,7 @@ * depends upon the reachability of the keys. * * Therefore the graph cache is implemented in such a way that it stores its cache entries within the {@link ResolvedJavaMethod}. - * It uses the {@link ResolvedJavaMethod#compilerStorage()} map with the HotSpotGraphCache instance as key. + * It uses the {@link ResolvedJavaMethod#getCompilerStorage()} map with the HotSpotGraphCache instance as key. * The cached graph will be kept alive as long as the {@link ResolvedJavaMethod} is alive, but does not prevent the method, and * therefore the class, from being unloaded. * @@ -78,9 +78,9 @@ if (size() > GraalOptions.GraphCacheSize) { ResolvedJavaMethod method = eldest.getValue().get(); if (method != null) { - StructuredGraph cachedGraph = (StructuredGraph) method.compilerStorage().get(HotSpotGraphCache.this); + StructuredGraph cachedGraph = (StructuredGraph) method.getCompilerStorage().get(HotSpotGraphCache.this); if (cachedGraph != null && cachedGraph.graphId() == eldest.getKey()) { - method.compilerStorage().remove(HotSpotGraphCache.this); + method.getCompilerStorage().remove(HotSpotGraphCache.this); } } return true; @@ -110,7 +110,7 @@ @Override public StructuredGraph get(ResolvedJavaMethod method) { - StructuredGraph result = (StructuredGraph) method.compilerStorage().get(this); + StructuredGraph result = (StructuredGraph) method.getCompilerStorage().get(this); if (GraalOptions.PrintGraphCache) { if (result == null) { @@ -126,7 +126,7 @@ public void put(StructuredGraph graph) { assert graph.method() != null; cachedGraphIds.put(graph.graphId(), new WeakReference<>(graph.method())); - graph.method().compilerStorage().put(this, graph); + graph.method().getCompilerStorage().put(this, graph); if (GraalOptions.PrintGraphCache) { putCounter++; @@ -138,7 +138,7 @@ for (WeakReference ref : cachedGraphIds.values()) { ResolvedJavaMethod method = ref.get(); if (method != null) { - method.compilerStorage().remove(this); + method.getCompilerStorage().remove(this); } } cachedGraphIds.clear(); @@ -155,9 +155,9 @@ WeakReference ref = cachedGraphIds.get(graphId); ResolvedJavaMethod method = ref == null ? null : ref.get(); if (method != null) { - StructuredGraph cachedGraph = (StructuredGraph) method.compilerStorage().get(this); + StructuredGraph cachedGraph = (StructuredGraph) method.getCompilerStorage().get(this); if (cachedGraph != null && cachedGraph.graphId() == graphId) { - method.compilerStorage().remove(this); + method.getCompilerStorage().remove(this); if (GraalOptions.PrintGraphCache) { removeHitCounter++; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotJavaType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotJavaType.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotJavaType.java Tue Oct 09 15:23:38 2012 -0700 @@ -33,7 +33,7 @@ protected String name; @Override - public final String name() { + public final String getName() { return name; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethod.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethod.java Tue Oct 09 15:23:38 2012 -0700 @@ -31,7 +31,7 @@ protected String name; @Override - public final String name() { + public final String getName() { return name; } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java Tue Oct 09 15:23:38 2012 -0700 @@ -27,7 +27,8 @@ import sun.misc.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.meta.JavaTypeProfile.*; +import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType; +import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen; import com.oracle.graal.hotspot.*; import com.oracle.graal.phases.*; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java Tue Oct 09 15:23:38 2012 -0700 @@ -23,6 +23,7 @@ package com.oracle.graal.hotspot.meta; import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen; /** * Interface for accessor objects that encapsulate the logic for accessing the different kinds of data in a HotSpot methodDataOop. diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodUnresolved.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodUnresolved.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodUnresolved.java Tue Oct 09 15:23:38 2012 -0700 @@ -39,17 +39,17 @@ } @Override - public Signature signature() { + public Signature getSignature() { return signature; } @Override - public JavaType holder() { + public JavaType getDeclaringClass() { return holder; } @Override public String toString() { - return "HotSpotMethod<" + holder.name() + ". " + name + ", unresolved>"; + return "HotSpotMethod<" + holder.getName() + ". " + name + ", unresolved>"; } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java Tue Oct 09 15:23:38 2012 -0700 @@ -47,7 +47,7 @@ } @Override - public int codeSize() { + public int getCodeSize() { return codeSize; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Tue Oct 09 15:23:38 2012 -0700 @@ -27,7 +27,7 @@ import java.lang.reflect.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.meta.JavaType.*; +import com.oracle.graal.api.meta.ResolvedJavaType.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.phases.*; @@ -54,18 +54,18 @@ } @Override - public int accessFlags() { + public int getModifiers() { return accessFlags; } @Override - public Constant constantValue(Constant receiver) { + public Constant readConstantValue(Constant receiver) { if (receiver == null) { assert Modifier.isStatic(accessFlags); if (constant == null) { if (holder.isInitialized() && holder.toJava() != System.class) { - if (Modifier.isFinal(accessFlags()) || assumeStaticFieldsFinal(holder.toJava())) { - constant = getValue(receiver); + if (Modifier.isFinal(getModifiers()) || assumeStaticFieldsFinal(holder.toJava())) { + constant = readValue(receiver); } } } @@ -73,25 +73,25 @@ } else { assert !Modifier.isStatic(accessFlags); // TODO (chaeubl) HotSpot does not trust final non-static fields (see ciField.cpp) - if (Modifier.isFinal(accessFlags())) { - return getValue(receiver); + if (Modifier.isFinal(getModifiers())) { + return readValue(receiver); } } return null; } @Override - public Constant getValue(Constant receiver) { + public Constant readValue(Constant receiver) { if (receiver == null) { assert Modifier.isStatic(accessFlags); if (holder.isInitialized()) { - Constant encoding = holder.getEncoding(kind() == Kind.Object ? Representation.StaticObjectFields : Representation.StaticPrimitiveFields); - return this.kind().readUnsafeConstant(encoding.asObject(), offset); + Constant encoding = holder.getEncoding(getKind() == Kind.Object ? Representation.StaticObjectFields : Representation.StaticPrimitiveFields); + return this.getKind().readUnsafeConstant(encoding.asObject(), offset); } return null; } else { assert !Modifier.isStatic(accessFlags); - return this.kind().readUnsafeConstant(receiver.asObject(), offset); + return this.getKind().readUnsafeConstant(receiver.asObject(), offset); } } @@ -100,22 +100,22 @@ } @Override - public ResolvedJavaType holder() { + public ResolvedJavaType getDeclaringClass() { return holder; } @Override - public Kind kind() { - return type().kind(); + public Kind getKind() { + return getType().getKind(); } @Override - public String name() { + public String getName() { return name; } @Override - public JavaType type() { + public JavaType getType() { return type; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Tue Oct 09 15:23:38 2012 -0700 @@ -28,6 +28,7 @@ import java.util.concurrent.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen; import com.oracle.graal.bytecode.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.phases.*; @@ -65,22 +66,22 @@ } @Override - public ResolvedJavaType holder() { + public ResolvedJavaType getDeclaringClass() { return holder; } @Override - public int accessFlags() { + public int getModifiers() { return accessFlags; } @Override public boolean canBeStaticallyBound() { - return isLeafMethod() || Modifier.isStatic(accessFlags()); + return (Modifier.isFinal(getModifiers()) || Modifier.isPrivate(getModifiers()) || Modifier.isStatic(getModifiers())) && !Modifier.isAbstract(getModifiers()); } @Override - public byte[] code() { + public byte[] getCode() { if (code == null) { code = HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_code(this); assert code.length == codeSize : "expected: " + codeSize + ", actual: " + code.length; @@ -89,16 +90,15 @@ } @Override - public int codeSize() { + public int getCodeSize() { return codeSize; } @Override - public ExceptionHandler[] exceptionHandlers() { + public ExceptionHandler[] getExceptionHandlers() { return HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_exceptionHandlers(this); } - @Override public boolean hasBalancedMonitors() { if (hasBalancedMonitors == null) { hasBalancedMonitors = HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_hasBalancedMonitors(this); @@ -108,36 +108,26 @@ @Override public boolean isClassInitializer() { - return "".equals(name) && Modifier.isStatic(accessFlags()); + return "".equals(name) && Modifier.isStatic(getModifiers()); } @Override public boolean isConstructor() { - return "".equals(name) && !Modifier.isStatic(accessFlags()); + return "".equals(name) && !Modifier.isStatic(getModifiers()); } @Override - public boolean isLeafMethod() { - return Modifier.isFinal(accessFlags()) || Modifier.isPrivate(accessFlags()); - } - - @Override - public String jniSymbol() { - throw new UnsupportedOperationException("jniSymbol"); - } - - @Override - public int maxLocals() { + public int getMaxLocals() { return maxLocals; } @Override - public int maxStackSize() { + public int getMaxStackSize() { return maxStackSize; } @Override - public StackTraceElement toStackTraceElement(int bci) { + public StackTraceElement asStackTraceElement(int bci) { if (bci < 0 || bci >= codeSize) { // HotSpot code can only construct stack trace elements for valid bcis StackTraceElement ste = HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_toStackTraceElement(this, 0); @@ -151,7 +141,7 @@ } @Override - public Signature signature() { + public Signature getSignature() { if (signature == null) { signature = new HotSpotSignature(HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_signature(this)); } @@ -167,19 +157,18 @@ return HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_hasCompiledCode(this); } - public int compiledCodeSize() { + public int getCompiledCodeSize() { return HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_getCompiledCodeSize(this); } - @Override public int invocationCount() { return HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaMethod_invocationCount(this); } @Override - public int compilationComplexity() { - if (compilationComplexity <= 0 && codeSize() > 0) { - BytecodeStream s = new BytecodeStream(code()); + public int getCompilationComplexity() { + if (compilationComplexity <= 0 && getCodeSize() > 0) { + BytecodeStream s = new BytecodeStream(getCode()); int result = 0; int currentBC; while ((currentBC = s.currentBC()) != Bytecodes.END) { @@ -193,7 +182,7 @@ } @Override - public ProfilingInfo profilingInfo() { + public ProfilingInfo getProfilingInfo() { ProfilingInfo info; if (GraalOptions.UseProfilingInformation && methodData == null) { @@ -210,7 +199,7 @@ } @Override - public Map compilerStorage() { + public Map getCompilerStorage() { if (compilerStorage == null) { compilerStorage = new ConcurrentHashMap<>(); } @@ -219,7 +208,7 @@ @Override public ConstantPool getConstantPool() { - return ((HotSpotResolvedJavaType) holder()).constantPool(); + return ((HotSpotResolvedJavaType) getDeclaringClass()).constantPool(); } @Override @@ -254,7 +243,7 @@ private Method toJava() { try { - return holder.toJava().getDeclaredMethod(name, MetaUtil.signatureToTypes(signature(), holder)); + return holder.toJava().getDeclaredMethod(name, MetaUtil.signatureToTypes(getSignature(), holder)); } catch (NoSuchMethodException e) { return null; } @@ -262,7 +251,7 @@ private Constructor toJavaConstructor() { try { - return holder.toJava().getDeclaredConstructor(MetaUtil.signatureToTypes(signature(), holder)); + return holder.toJava().getDeclaredConstructor(MetaUtil.signatureToTypes(getSignature(), holder)); } catch (NoSuchMethodException e) { return null; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java Tue Oct 09 15:23:38 2012 -0700 @@ -60,12 +60,12 @@ } @Override - public int accessFlags() { + public int getModifiers() { return accessFlags; } @Override - public ResolvedJavaType arrayOf() { + public ResolvedJavaType getArrayClass() { if (arrayOfType == null) { arrayOfType = (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_arrayOf(this); } @@ -73,7 +73,7 @@ } @Override - public ResolvedJavaType componentType() { + public ResolvedJavaType getComponentType() { if (isArrayClass) { return (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_componentType(this); } @@ -81,9 +81,9 @@ } @Override - public ResolvedJavaType uniqueConcreteSubtype() { + public ResolvedJavaType findUniqueConcreteSubtype() { if (isArrayClass()) { - return Modifier.isFinal(componentType().accessFlags()) ? this : null; + return Modifier.isFinal(getComponentType().getModifiers()) ? this : null; } else { ResolvedJavaType subtype = (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_uniqueConcreteSubtype(this); assert subtype == null || !subtype.isInterface(); @@ -92,7 +92,7 @@ } @Override - public ResolvedJavaType superType() { + public ResolvedJavaType getSuperclass() { if (!superTypeSet) { superType = (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_superType(this); superTypeSet = true; @@ -101,7 +101,7 @@ } @Override - public ResolvedJavaType leastCommonAncestor(ResolvedJavaType otherType) { + public ResolvedJavaType findLeastCommonAncestor(ResolvedJavaType otherType) { if (otherType instanceof HotSpotTypePrimitive) { return null; } else { @@ -110,7 +110,7 @@ } @Override - public ResolvedJavaType exactType() { + public ResolvedJavaType getExactType() { if (Modifier.isFinal(accessFlags)) { return this; } @@ -134,11 +134,6 @@ } @Override - public Kind getRepresentationKind(Representation r) { - return Kind.Object; - } - - @Override public boolean hasFinalizableSubclass() { return hasFinalizableSubclass; } @@ -186,14 +181,14 @@ } @Override - public Kind kind() { + public Kind getKind() { return Kind.Object; } @Override - public ResolvedJavaMethod resolveMethodImpl(ResolvedJavaMethod method) { + public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method) { assert method instanceof HotSpotMethod; - return (ResolvedJavaMethod) HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_resolveMethodImpl(this, method.name(), method.signature().asString()); + return (ResolvedJavaMethod) HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_resolveMethodImpl(this, method.getName(), ((HotSpotSignature) method.getSignature()).asString()); } @Override @@ -233,20 +228,20 @@ result = new HotSpotResolvedJavaField(this, fieldName, type, offset, flags); fieldCache.put(id, result); } else { - assert result.name().equals(fieldName); - assert result.accessFlags() == flags; + assert result.getName().equals(fieldName); + assert result.getModifiers() == flags; } return result; } @Override - public ResolvedJavaMethod uniqueConcreteMethod(ResolvedJavaMethod method) { + public ResolvedJavaMethod findUniqueConcreteMethod(ResolvedJavaMethod method) { return ((HotSpotResolvedJavaMethod) method).uniqueConcreteMethod(); } @Override - public ResolvedJavaField[] declaredFields() { + public ResolvedJavaField[] getDeclaredFields() { if (fields == null) { if (isArrayClass) { fields = new ResolvedJavaField[0]; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Tue Oct 09 15:23:38 2012 -0700 @@ -43,7 +43,7 @@ import com.oracle.graal.api.code.Register.RegisterFlag; import com.oracle.graal.api.code.RuntimeCall.Descriptor; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.meta.JavaType.Representation; +import com.oracle.graal.api.meta.ResolvedJavaType.Representation; import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.bridge.*; @@ -78,7 +78,7 @@ protected Value ret(Kind kind) { if (kind.isVoid()) { - return IllegalValue; + return ILLEGAL; } return globalStubRegConfig.getReturnRegister(kind).asValue(kind); } @@ -226,11 +226,11 @@ @Override public String disassemble(CodeInfo info, CompilationResult tm) { - byte[] code = info.code(); + byte[] code = info.getCode(); TargetDescription target = graalRuntime.getTarget(); - HexCodeFile hcf = new HexCodeFile(code, info.start(), target.arch.name, target.wordSize * 8); + HexCodeFile hcf = new HexCodeFile(code, info.getStart(), target.arch.name, target.wordSize * 8); if (tm != null) { - HexCodeFile.addAnnotations(hcf, tm.annotations()); + HexCodeFile.addAnnotations(hcf, tm.getAnnotations()); addExceptionHandlersComment(tm, hcf); Register fp = regConfig.getFrameRegister(); RefMapFormatter slotFormatter = new RefMapFormatter(target.arch, target.wordSize, fp, 0); @@ -319,27 +319,22 @@ } @Override - public ResolvedJavaType getResolvedJavaType(Kind kind) { - return (ResolvedJavaType) graalRuntime.getCompilerToVM().getType(kind.toJavaClass()); - } - - @Override - public ResolvedJavaType getTypeOf(Constant constant) { + public ResolvedJavaType lookupJavaType(Constant constant) { return (ResolvedJavaType) graalRuntime.getCompilerToVM().getJavaType(constant); } @Override - public int sizeOfLockData() { + public int getSizeOfLockData() { return config.basicLockSize; } @Override - public boolean areConstantObjectsEqual(Constant x, Constant y) { + public boolean constantEquals(Constant x, Constant y) { return graalRuntime.getCompilerToVM().compareConstantObjects(x, y); } @Override - public RegisterConfig getRegisterConfig(JavaMethod method) { + public RegisterConfig lookupRegisterConfig(JavaMethod method) { return regConfig; } @@ -357,7 +352,7 @@ } @Override - public int getArrayLength(Constant array) { + public int lookupArrayLength(Constant array) { return graalRuntime.getCompilerToVM().getArrayLength(array); } @@ -377,7 +372,7 @@ if (!callTarget.isStatic() && receiver.kind() == Kind.Object && !receiver.objectStamp().nonNull()) { invoke.node().dependencies().add(tool.createNullCheckGuard(receiver, invoke.leafGraphId())); } - Kind[] signature = MetaUtil.signatureToKinds(callTarget.targetMethod().signature(), callTarget.isStatic() ? null : callTarget.targetMethod().holder().kind()); + Kind[] signature = MetaUtil.signatureToKinds(callTarget.targetMethod().getSignature(), callTarget.isStatic() ? null : callTarget.targetMethod().getDeclaringClass().getKind()); AbstractCallTargetNode loweredCallTarget = null; if (callTarget.invokeKind() == InvokeKind.Virtual && @@ -385,7 +380,7 @@ (GraalOptions.AlwaysInlineVTableStubs || invoke.isMegamorphic())) { HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) callTarget.targetMethod(); - if (!hsMethod.holder().isInterface()) { + if (!hsMethod.getDeclaringClass().isInterface()) { // We use LocationNode.ANY_LOCATION for the reads that access the vtable entry and the compiled code entry // as HotSpot does not guarantee they are final values. int vtableEntryOffset = hsMethod.vtableEntryOffset(); @@ -413,7 +408,7 @@ LoadFieldNode field = (LoadFieldNode) n; int displacement = ((HotSpotResolvedJavaField) field.field()).offset(); assert field.kind() != Kind.Illegal; - ReadNode memoryRead = graph.add(new ReadNode(field.object(), LocationNode.create(field.field(), field.field().kind(), displacement, graph), field.stamp())); + ReadNode memoryRead = graph.add(new ReadNode(field.object(), LocationNode.create(field.field(), field.field().getKind(), displacement, graph), field.stamp())); memoryRead.dependencies().add(tool.createNullCheckGuard(field.object(), field.leafGraphId())); graph.replaceFixedWithFixed(field, memoryRead); if (field.isVolatile()) { @@ -425,13 +420,13 @@ } else if (n instanceof StoreFieldNode) { StoreFieldNode storeField = (StoreFieldNode) n; HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) storeField.field(); - WriteNode memoryWrite = graph.add(new WriteNode(storeField.object(), storeField.value(), LocationNode.create(storeField.field(), storeField.field().kind(), field.offset(), graph))); + WriteNode memoryWrite = graph.add(new WriteNode(storeField.object(), storeField.value(), LocationNode.create(storeField.field(), storeField.field().getKind(), field.offset(), graph))); memoryWrite.dependencies().add(tool.createNullCheckGuard(storeField.object(), storeField.leafGraphId())); memoryWrite.setStateAfter(storeField.stateAfter()); graph.replaceFixedWithFixed(storeField, memoryWrite); FixedWithNextNode last = memoryWrite; - if (field.kind() == Kind.Object && !memoryWrite.value().objectStamp().alwaysNull()) { + if (field.getKind() == Kind.Object && !memoryWrite.value().objectStamp().alwaysNull()) { FieldWriteBarrier writeBarrier = graph.add(new FieldWriteBarrier(memoryWrite.object())); graph.addAfterFixed(memoryWrite, writeBarrier); last = writeBarrier; @@ -481,14 +476,14 @@ // Store check! ResolvedJavaType arrayType = array.objectStamp().type(); if (arrayType != null && array.objectStamp().isExactType()) { - ResolvedJavaType elementType = arrayType.componentType(); - if (elementType.superType() != null) { + ResolvedJavaType elementType = arrayType.getComponentType(); + if (elementType.getSuperclass() != null) { ConstantNode type = ConstantNode.forConstant(elementType.getEncoding(Representation.ObjectHub), this, graph); checkcast = graph.add(new CheckCastNode(type, elementType, value)); graph.addBeforeFixed(storeIndexed, checkcast); value = checkcast; } else { - assert elementType.name().equals("Ljava/lang/Object;") : elementType.name(); + assert elementType.getName().equals("Ljava/lang/Object;") : elementType.getName(); } } else { LoadHubNode arrayClass = graph.add(new LoadHubNode(array)); @@ -588,9 +583,9 @@ @Override public StructuredGraph intrinsicGraph(ResolvedJavaMethod caller, int bci, ResolvedJavaMethod method, List parameters) { - JavaType holder = method.holder(); - String fullName = method.name() + method.signature().asString(); - String holderName = holder.name(); + JavaType holder = method.getDeclaringClass(); + String fullName = method.getName() + ((HotSpotSignature) method.getSignature()).asString(); + String holderName = holder.getName(); if (holderName.equals("Ljava/lang/Object;")) { if (fullName.equals("getClass()Ljava/lang/Class;")) { ValueNode obj = (ValueNode) parameters.get(0); @@ -605,7 +600,7 @@ StructuredGraph graph = new StructuredGraph(); LocalNode receiver = graph.unique(new LocalNode(0, StampFactory.objectNonNull())); LoadHubNode hub = graph.add(new LoadHubNode(receiver)); - Stamp resultStamp = StampFactory.declaredNonNull(getResolvedJavaType(Class.class)); + Stamp resultStamp = StampFactory.declaredNonNull(lookupJavaType(Class.class)); FloatingReadNode result = graph.unique(new FloatingReadNode(hub, LocationNode.create(LocationNode.FINAL_LOCATION, Kind.Object, config.classMirrorOffset, graph), null, resultStamp)); ReturnNode ret = graph.add(new ReturnNode(result)); graph.start().setNext(hub); @@ -639,28 +634,28 @@ return graph.add(new SafeReadNode(value, LocationNode.create(LocationNode.FINAL_LOCATION, kind, offset, graph), stamp, leafGraphId)); } - public ResolvedJavaType getResolvedJavaType(Class clazz) { + public ResolvedJavaType lookupJavaType(Class clazz) { return (ResolvedJavaType) graalRuntime.getCompilerToVM().getType(clazz); } - public Object asCallTarget(Object target) { + public Object lookupCallTarget(Object target) { if (target instanceof HotSpotRuntimeCall) { return ((HotSpotRuntimeCall) target).address; } return target; } - public RuntimeCall getRuntimeCall(Descriptor descriptor) { + public RuntimeCall lookupRuntimeCall(Descriptor descriptor) { assert runtimeCalls.containsKey(descriptor) : descriptor; return runtimeCalls.get(descriptor); } - public ResolvedJavaMethod getResolvedJavaMethod(Method reflectionMethod) { + public ResolvedJavaMethod lookupJavaMethod(Method reflectionMethod) { return (ResolvedJavaMethod) graalRuntime.getCompilerToVM().getJavaMethod(reflectionMethod); } @Override - public ResolvedJavaField getResolvedJavaField(Field reflectionField) { + public ResolvedJavaField lookupJavaField(Field reflectionField) { return graalRuntime.getCompilerToVM().getJavaField(reflectionField); } @@ -694,7 +689,6 @@ return (~(((reasonValue) << reasonShift) + ((actionValue) << actionShift))); } - @Override public int convertDeoptAction(DeoptimizationAction action) { // This must be kept in sync with the DeoptAction enum defined in deoptimization.hpp switch(action) { @@ -707,7 +701,6 @@ } } - @Override public int convertDeoptReason(DeoptimizationReason reason) { // This must be kept in sync with the DeoptReason enum defined in deoptimization.hpp switch(reason) { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java Tue Oct 09 15:23:38 2012 -0700 @@ -92,26 +92,26 @@ } @Override - public int argumentCount(boolean withReceiver) { + public int getParameterCount(boolean withReceiver) { return arguments.size() + (withReceiver ? 1 : 0); } @Override - public Kind argumentKindAt(int index) { + public Kind getParameterKind(int index) { return Kind.fromTypeString(arguments.get(index)); } @Override - public int argumentSlots(boolean withReceiver) { + public int getParameterSlots(boolean withReceiver) { int argSlots = 0; - for (int i = 0; i < argumentCount(false); i++) { - argSlots += FrameStateBuilder.stackSlots(argumentKindAt(i)); + for (int i = 0; i < getParameterCount(false); i++) { + argSlots += FrameStateBuilder.stackSlots(getParameterKind(i)); } return argSlots + (withReceiver ? 1 : 0); } @Override - public JavaType argumentTypeAt(int index, ResolvedJavaType accessingClass) { + public JavaType getParameterType(int index, ResolvedJavaType accessingClass) { if (argumentTypes == null) { argumentTypes = new JavaType[arguments.size()]; } @@ -123,18 +123,17 @@ return type; } - @Override public String asString() { return originalString; } @Override - public Kind returnKind() { + public Kind getReturnKind() { return Kind.fromTypeString(returnType); } @Override - public JavaType returnType(ResolvedJavaType accessingClass) { + public JavaType getReturnType(ResolvedJavaType accessingClass) { if (returnTypeCache == null) { returnTypeCache = HotSpotGraalRuntime.getInstance().lookupType(returnType, (HotSpotResolvedJavaType) accessingClass, false); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotTypePrimitive.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotTypePrimitive.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotTypePrimitive.java Tue Oct 09 15:23:38 2012 -0700 @@ -40,38 +40,38 @@ public HotSpotTypePrimitive(Kind kind) { this.kind = kind; - this.name = String.valueOf(Character.toUpperCase(kind.typeChar)); + this.name = String.valueOf(Character.toUpperCase(kind.getTypeChar())); this.klassOop = new HotSpotKlassOop(this); } @Override - public int accessFlags() { + public int getModifiers() { assert kind != null && kind.toJavaClass() != null; return Modifier.ABSTRACT | Modifier.FINAL | Modifier.PUBLIC; } @Override - public ResolvedJavaType arrayOf() { + public ResolvedJavaType getArrayClass() { return (ResolvedJavaType) HotSpotGraalRuntime.getInstance().getCompilerToVM().getPrimitiveArrayType(kind); } @Override - public ResolvedJavaType componentType() { + public ResolvedJavaType getComponentType() { return null; } @Override - public ResolvedJavaType exactType() { + public ResolvedJavaType getExactType() { return this; } @Override - public ResolvedJavaType superType() { + public ResolvedJavaType getSuperclass() { return null; } @Override - public ResolvedJavaType leastCommonAncestor(ResolvedJavaType otherType) { + public ResolvedJavaType findLeastCommonAncestor(ResolvedJavaType otherType) { return null; } @@ -81,11 +81,6 @@ } @Override - public Kind getRepresentationKind(Representation r) { - return kind; - } - - @Override public boolean hasFinalizableSubclass() { return false; } @@ -126,12 +121,12 @@ } @Override - public Kind kind() { + public Kind getKind() { return kind; } @Override - public ResolvedJavaMethod resolveMethodImpl(ResolvedJavaMethod method) { + public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method) { return null; } @@ -141,17 +136,17 @@ } @Override - public ResolvedJavaType uniqueConcreteSubtype() { + public ResolvedJavaType findUniqueConcreteSubtype() { return this; } @Override - public ResolvedJavaMethod uniqueConcreteMethod(ResolvedJavaMethod method) { + public ResolvedJavaMethod findUniqueConcreteMethod(ResolvedJavaMethod method) { return null; } @Override - public ResolvedJavaField[] declaredFields() { + public ResolvedJavaField[] getDeclaredFields() { return new ResolvedJavaField[0]; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotTypeUnresolved.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotTypeUnresolved.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotTypeUnresolved.java Tue Oct 09 15:23:38 2012 -0700 @@ -78,18 +78,18 @@ } @Override - public JavaType componentType() { - assert dimensions > 0 : "no array class" + name(); + public JavaType getComponentType() { + assert dimensions > 0 : "no array class" + getName(); return new HotSpotTypeUnresolved(simpleName, dimensions - 1); } @Override - public JavaType arrayOf() { + public JavaType getArrayClass() { return new HotSpotTypeUnresolved(simpleName, dimensions + 1); } @Override - public Kind kind() { + public Kind getKind() { return Kind.Object; } @@ -109,11 +109,6 @@ } @Override - public Kind getRepresentationKind(JavaType.Representation r) { - return Kind.Object; - } - - @Override public ResolvedJavaType resolve(ResolvedJavaType accessingClass) { JavaType type = HotSpotGraalRuntime.getInstance().lookupType(name, (HotSpotResolvedJavaType) accessingClass, true); return (ResolvedJavaType) type; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedField.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedField.java Tue Oct 09 15:23:38 2012 -0700 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.hotspot.meta; + +import com.oracle.graal.api.meta.*; + + +/** + * A implementation of {@link JavaField} for an unresolved field. + */ +public class HotSpotUnresolvedField implements JavaField { + + private final String name; + private final JavaType holder; + private final JavaType type; + + public HotSpotUnresolvedField(JavaType holder, String name, JavaType type) { + this.name = name; + this.type = type; + this.holder = holder; + } + + public String getName() { + return name; + } + + public JavaType getType() { + return type; + } + + public Kind getKind() { + return type.getKind(); + } + + public JavaType getDeclaringClass() { + return holder; + } + + /** + * Converts this compiler interface field to a string. + */ + @Override + public String toString() { + return MetaUtil.format("%H.%n [unresolved]", this); + } +} diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentThread.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentThread.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentThread.java Tue Oct 09 15:23:38 2012 -0700 @@ -34,7 +34,7 @@ private int threadObjectOffset; public CurrentThread(int threadObjectOffset, CodeCacheProvider runtime) { - super(StampFactory.declaredNonNull(runtime.getResolvedJavaType(Thread.class))); + super(StampFactory.declaredNonNull(runtime.lookupJavaType(Thread.class))); this.threadObjectOffset = threadObjectOffset; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorEnterStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorEnterStubCall.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorEnterStubCall.java Tue Oct 09 15:23:38 2012 -0700 @@ -50,7 +50,7 @@ @Override public void generate(LIRGenerator gen) { - RuntimeCall stub = gen.getRuntime().getRuntimeCall(MonitorEnterStubCall.MONITORENTER); + RuntimeCall stub = gen.getRuntime().lookupRuntimeCall(MonitorEnterStubCall.MONITORENTER); gen.emitCall(stub, stub.getCallingConvention(), true, gen.operand(object), gen.operand(lock)); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorExitStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorExitStubCall.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorExitStubCall.java Tue Oct 09 15:23:38 2012 -0700 @@ -47,7 +47,7 @@ @Override public void generate(LIRGenerator gen) { - RuntimeCall stub = gen.getRuntime().getRuntimeCall(MonitorExitStubCall.MONITOREXIT); + RuntimeCall stub = gen.getRuntime().lookupRuntimeCall(MonitorExitStubCall.MONITOREXIT); gen.emitCall(stub, stub.getCallingConvention(), true, gen.operand(object), gen.emitLea(gen.peekLock())); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java Tue Oct 09 15:23:38 2012 -0700 @@ -66,7 +66,7 @@ @Override public void generate(LIRGenerator gen) { - RuntimeCall stub = gen.getRuntime().getRuntimeCall(isObjectArray ? NewArrayStubCall.NEW_OBJECT_ARRAY : NewArrayStubCall.NEW_TYPE_ARRAY); + RuntimeCall stub = gen.getRuntime().lookupRuntimeCall(isObjectArray ? NewArrayStubCall.NEW_OBJECT_ARRAY : NewArrayStubCall.NEW_TYPE_ARRAY); Variable result = gen.emitCall(stub, stub.getCallingConvention(), true, gen.operand(hub), gen.operand(length)); gen.setResult(this, result); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java Tue Oct 09 15:23:38 2012 -0700 @@ -60,7 +60,7 @@ @Override public void generate(LIRGenerator gen) { - RuntimeCall stub = gen.getRuntime().getRuntimeCall(NewInstanceStubCall.NEW_INSTANCE); + RuntimeCall stub = gen.getRuntime().lookupRuntimeCall(NewInstanceStubCall.NEW_INSTANCE); Variable result = gen.emitCall(stub, stub.getCallingConvention(), true, gen.operand(hub)); gen.setResult(this, result); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Tue Oct 09 15:23:38 2012 -0700 @@ -67,7 +67,7 @@ @Override public void generate(LIRGenerator gen) { - RuntimeCall stub = gen.getRuntime().getRuntimeCall(NewMultiArrayStubCall.NEW_MULTI_ARRAY); + RuntimeCall stub = gen.getRuntime().lookupRuntimeCall(NewMultiArrayStubCall.NEW_MULTI_ARRAY); Variable result = gen.emitCall(stub, stub.getCallingConvention(), true, gen.operand(hub), Constant.forInt(rank), gen.operand(dims)); gen.setResult(this, result); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -58,9 +58,9 @@ LIRGenerator gen = (LIRGenerator) generator; HotSpotVMConfig config = HotSpotGraalRuntime.getInstance().getConfig(); ResolvedJavaMethod method = frameState.method(); - boolean isStatic = Modifier.isStatic(method.accessFlags()); + boolean isStatic = Modifier.isStatic(method.getModifiers()); - Kind[] signature = MetaUtil.signatureToKinds(method.signature(), isStatic ? null : method.holder().kind()); + Kind[] signature = MetaUtil.signatureToKinds(method.getSignature(), isStatic ? null : method.getDeclaringClass().getKind()); CallingConvention cc = gen.frameMap().registerConfig.getCallingConvention(CallingConvention.Type.JavaCall, Kind.Void, signature, gen.target(), false); gen.frameMap().callsMethod(cc); // TODO (aw): I think this is unnecessary for a tail call. List parameters = new ArrayList<>(); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -60,7 +60,7 @@ where = "in compiled code for " + MetaUtil.format("%H.%n(%p)", gen.method()); } - RuntimeCall stub = gen.getRuntime().getRuntimeCall(VMErrorNode.VM_ERROR); + RuntimeCall stub = gen.getRuntime().lookupRuntimeCall(VMErrorNode.VM_ERROR); gen.emitCall(stub, stub.getCallingConvention(), false, Constant.forObject(where), gen.operand(format), gen.operand(value)); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VerifyOopStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VerifyOopStubCall.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VerifyOopStubCall.java Tue Oct 09 15:23:38 2012 -0700 @@ -45,7 +45,7 @@ @Override public void generate(LIRGenerator gen) { - RuntimeCall stub = gen.getRuntime().getRuntimeCall(VerifyOopStubCall.VERIFY_OOP); + RuntimeCall stub = gen.getRuntime().lookupRuntimeCall(VerifyOopStubCall.VERIFY_OOP); gen.emitCall(stub, stub.getCallingConvention(), true, gen.operand(object)); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/IntrinsifyArrayCopyPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/IntrinsifyArrayCopyPhase.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/IntrinsifyArrayCopyPhase.java Tue Oct 09 15:23:38 2012 -0700 @@ -57,7 +57,7 @@ floatArrayCopy = getArrayCopySnippet(runtime, float.class); doubleArrayCopy = getArrayCopySnippet(runtime, double.class); objectArrayCopy = getArrayCopySnippet(runtime, Object.class); - arrayCopy = runtime.getResolvedJavaMethod(System.class.getDeclaredMethod("arraycopy", Object.class, int.class, Object.class, int.class, int.class)); + arrayCopy = runtime.lookupJavaMethod(System.class.getDeclaredMethod("arraycopy", Object.class, int.class, Object.class, int.class, int.class)); } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { @@ -67,7 +67,7 @@ private static ResolvedJavaMethod getArrayCopySnippet(CodeCacheProvider runtime, Class componentClass) throws NoSuchMethodException { Class arrayClass = Array.newInstance(componentClass, 0).getClass(); - return runtime.getResolvedJavaMethod(ArrayCopySnippets.class.getDeclaredMethod("arraycopy", arrayClass, int.class, arrayClass, int.class, int.class)); + return runtime.lookupJavaMethod(ArrayCopySnippets.class.getDeclaredMethod("arraycopy", arrayClass, int.class, arrayClass, int.class, int.class)); } @Override @@ -86,8 +86,8 @@ && srcType.isArrayClass() && destType != null && destType.isArrayClass()) { - Kind componentKind = srcType.componentType().kind(); - if (srcType.componentType() == destType.componentType()) { + Kind componentKind = srcType.getComponentType().getKind(); + if (srcType.getComponentType() == destType.getComponentType()) { if (componentKind == Kind.Int) { snippetMethod = intArrayCopy; } else if (componentKind == Kind.Char) { @@ -106,17 +106,17 @@ snippetMethod = objectArrayCopy; } } else if (componentKind == Kind.Object - && srcType.componentType().isSubtypeOf(destType.componentType())) { + && srcType.getComponentType().isSubtypeOf(destType.getComponentType())) { snippetMethod = objectArrayCopy; } } } if (snippetMethod != null) { - StructuredGraph snippetGraph = (StructuredGraph) snippetMethod.compilerStorage().get(Graph.class); + StructuredGraph snippetGraph = (StructuredGraph) snippetMethod.getCompilerStorage().get(Graph.class); assert snippetGraph != null : "ArrayCopySnippets should be installed"; hits = true; - Debug.log("%s > Intinsify (%s)", Debug.currentScope(), snippetMethod.signature().argumentTypeAt(0, snippetMethod.holder()).componentType()); + Debug.log("%s > Intinsify (%s)", Debug.currentScope(), snippetMethod.getSignature().getParameterType(0, snippetMethod.getDeclaringClass()).getComponentType()); InliningUtil.inline(methodCallTarget.invoke(), snippetGraph, false); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/MonitorSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/MonitorSnippets.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/MonitorSnippets.java Tue Oct 09 15:23:38 2012 -0700 @@ -476,7 +476,7 @@ if (type == null) { return false; } - return (type.name().contains(TRACE_TYPE_FILTER)); + return (type.getName().contains(TRACE_TYPE_FILTER)); } } @@ -504,17 +504,17 @@ NodeIterable nodes = graph.getNodes().filter(MonitorCounterNode.class); if (nodes.isEmpty()) { // Only insert the nodes if this is the first monitorenter being lowered. - JavaType returnType = initCounter.signature().returnType(initCounter.holder()); + JavaType returnType = initCounter.getSignature().getReturnType(initCounter.getDeclaringClass()); MethodCallTargetNode callTarget = graph.add(new MethodCallTargetNode(InvokeKind.Static, initCounter, new ValueNode[0], returnType)); InvokeNode invoke = graph.add(new InvokeNode(callTarget, 0, -1)); invoke.setStateAfter(graph.start().stateAfter()); graph.addAfterFixed(graph.start(), invoke); - StructuredGraph inlineeGraph = (StructuredGraph) initCounter.compilerStorage().get(Graph.class); + StructuredGraph inlineeGraph = (StructuredGraph) initCounter.getCompilerStorage().get(Graph.class); InliningUtil.inline(invoke, inlineeGraph, false); List rets = graph.getNodes().filter(ReturnNode.class).snapshot(); for (ReturnNode ret : rets) { - returnType = checkCounter.signature().returnType(checkCounter.holder()); + returnType = checkCounter.getSignature().getReturnType(checkCounter.getDeclaringClass()); ConstantNode errMsg = ConstantNode.forObject("unbalanced monitors in " + MetaUtil.format("%H.%n(%p)", graph.method()) + ", count = %d", runtime, graph); callTarget = graph.add(new MethodCallTargetNode(InvokeKind.Static, checkCounter, new ValueNode[] {errMsg}, returnType)); invoke = graph.add(new InvokeNode(callTarget, 0, -1)); @@ -522,7 +522,7 @@ FrameState stateAfter = new FrameState(graph.method(), FrameState.AFTER_BCI, new ValueNode[0], stack, new ValueNode[0], false, false, null); invoke.setStateAfter(graph.add(stateAfter)); graph.addBeforeFixed(ret, invoke); - inlineeGraph = (StructuredGraph) checkCounter.compilerStorage().get(Graph.class); + inlineeGraph = (StructuredGraph) checkCounter.getCompilerStorage().get(Graph.class); InliningUtil.inline(invoke, inlineeGraph, false); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java Tue Oct 09 15:23:38 2012 -0700 @@ -288,8 +288,8 @@ ValueNode lengthNode = newArrayNode.length(); TLABAllocateNode tlabAllocateNode; ResolvedJavaType elementType = newArrayNode.elementType(); - ResolvedJavaType arrayType = elementType.arrayOf(); - Kind elementKind = elementType.kind(); + ResolvedJavaType arrayType = elementType.getArrayClass(); + Kind elementKind = elementType.getKind(); final int alignment = target.wordSize; final int headerSize = elementKind.getArrayBaseOffset(); final Integer length = lengthNode.isConstant() ? Integer.valueOf(lengthNode.asConstant().asInt()) : null; @@ -355,10 +355,10 @@ public void lower(InitializeArrayNode initializeNode, LoweringTool tool) { StructuredGraph graph = (StructuredGraph) initializeNode.graph(); HotSpotResolvedJavaType type = (HotSpotResolvedJavaType) initializeNode.type(); - ResolvedJavaType elementType = type.componentType(); + ResolvedJavaType elementType = type.getComponentType(); assert elementType != null; HotSpotKlassOop hub = type.klassOop(); - Kind elementKind = elementType.kind(); + Kind elementKind = elementType.getKind(); final int headerSize = elementKind.getArrayBaseOffset(); Key key = new Key(elementKind.isObject() ? initializeObjectArray : initializePrimitiveArray).add("headerSize", headerSize).add("fillContents", initializeNode.fillContents()).add("locked", initializeNode.locked()); ValueNode memory = initializeNode.memory(); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/BytecodeInterpreter.java --- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/BytecodeInterpreter.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/BytecodeInterpreter.java Tue Oct 09 15:23:38 2012 -0700 @@ -135,7 +135,7 @@ } public void addDelegate(Method method, InterpreterCallable callable) { - ResolvedJavaMethod resolvedMethod = metaAccessProvider.getResolvedJavaMethod(method); + ResolvedJavaMethod resolvedMethod = metaAccessProvider.lookupJavaMethod(method); if (methodDelegates.containsKey(resolvedMethod)) { throw new IllegalArgumentException("Delegate for method " + method + " already added."); } @@ -144,22 +144,22 @@ } public void removeDelegate(Method method) { - methodDelegates.remove(metaAccessProvider.getResolvedJavaMethod(method)); + methodDelegates.remove(metaAccessProvider.lookupJavaMethod(method)); } @Override public Object execute(ResolvedJavaMethod method, Object... boxedArguments) throws Throwable { try { boolean receiver = hasReceiver(method); - Signature signature = method.signature(); + Signature signature = method.getSignature(); assert boxedArguments != null; - assert signature.argumentCount(receiver) == boxedArguments.length; + assert signature.getParameterCount(receiver) == boxedArguments.length; if (TRACE) { trace(0, "Executing root method " + method); } - InterpreterFrame rootFrame = new InterpreterFrame(rootMethod, signature.argumentSlots(true)); + InterpreterFrame rootFrame = new InterpreterFrame(rootMethod, signature.getParameterSlots(true)); rootFrame.pushObject(this); rootFrame.pushObject(method); rootFrame.pushObject(boxedArguments); @@ -171,12 +171,12 @@ } for (int i = 0; index < boxedArguments.length; i++, index++) { - pushAsObject(rootFrame, signature.argumentKindAt(i), boxedArguments[index]); + pushAsObject(rootFrame, signature.getParameterKind(i), boxedArguments[index]); } InterpreterFrame frame = rootFrame.create(method, receiver); executeRoot(rootFrame, frame); - return popAsObject(rootFrame, signature.returnKind()); + return popAsObject(rootFrame, signature.getReturnKind()); } catch (Exception e) { // TODO (chaeubl): remove this exception handler (only used for debugging) throw e; @@ -184,24 +184,24 @@ } public Object execute(Method javaMethod, Object... boxedArguments) throws Throwable { - return execute(metaAccessProvider.getResolvedJavaMethod(javaMethod), boxedArguments); + return execute(metaAccessProvider.lookupJavaMethod(javaMethod), boxedArguments); } private boolean hasReceiver(ResolvedJavaMethod method) { - return !Modifier.isStatic(method.accessFlags()); + return !Modifier.isStatic(method.getModifiers()); } private void executeRoot(InterpreterFrame root, InterpreterFrame frame) throws Throwable { // TODO reflection redirection InterpreterFrame prevFrame = frame; InterpreterFrame currentFrame = frame; - BytecodeStream bs = new BytecodeStream(currentFrame.getMethod().code()); + BytecodeStream bs = new BytecodeStream(currentFrame.getMethod().getCode()); if (TRACE) { traceCall(frame, "Call"); } while (currentFrame != root) { if (prevFrame != currentFrame) { - bs = new BytecodeStream(currentFrame.getMethod().code()); + bs = new BytecodeStream(currentFrame.getMethod().getCode()); } bs.setBCI(currentFrame.getBCI()); @@ -925,7 +925,7 @@ currentFrame = popFrame(currentFrame); } else { // found a handler -> execute it - currentFrame.setBCI(handler.handlerBCI()); + currentFrame.setBCI(handler.getHandlerBCI()); currentFrame.popStack(); currentFrame.pushObject(t); return currentFrame; @@ -963,10 +963,10 @@ } private ExceptionHandler resolveExceptionHandlers(InterpreterFrame frame, int bci, Throwable t) { - ExceptionHandler[] handlers = frame.getMethod().exceptionHandlers(); + ExceptionHandler[] handlers = frame.getMethod().getExceptionHandlers(); for (int i = 0; i < handlers.length; i++) { ExceptionHandler handler = handlers[i]; - if (bci >= handler.startBCI() && bci <= handler.endBCI()) { + if (bci >= handler.getStartBCI() && bci <= handler.getEndBCI()) { ResolvedJavaType catchType = null; if (!handler.isCatchAll()) { // exception handlers are similar to instanceof bytecodes, so we pass instanceof @@ -995,12 +995,12 @@ if (TRACE) { traceCall(nextFrame, "Call"); } - if (Modifier.isSynchronized(nextFrame.getMethod().accessFlags())) { + if (Modifier.isSynchronized(nextFrame.getMethod().getModifiers())) { if (TRACE) { traceOp(frame, "Method monitor enter"); } - if (Modifier.isStatic(nextFrame.getMethod().accessFlags())) { - runtimeInterface.monitorEnter(nextFrame.getMethod().holder().toJava()); + if (Modifier.isStatic(nextFrame.getMethod().getModifiers())) { + runtimeInterface.monitorEnter(nextFrame.getMethod().getDeclaringClass().toJava()); } else { Object enterObject = nextFrame.getObject(frame.resolveLocalIndex(0)); assert enterObject != null; @@ -1017,12 +1017,12 @@ private InterpreterFrame popFrame(InterpreterFrame frame) { InterpreterFrame parent = frame.getParentFrame(); - if (Modifier.isSynchronized(frame.getMethod().accessFlags())) { + if (Modifier.isSynchronized(frame.getMethod().getModifiers())) { if (TRACE) { traceOp(frame, "Method monitor exit"); } - if (Modifier.isStatic(frame.getMethod().accessFlags())) { - runtimeInterface.monitorExit(frame.getMethod().holder().toJava()); + if (Modifier.isStatic(frame.getMethod().getModifiers())) { + runtimeInterface.monitorExit(frame.getMethod().getDeclaringClass().toJava()); } else { Object exitObject = frame.getObject(frame.resolveLocalIndex(0)); if (exitObject != null) { @@ -1043,7 +1043,7 @@ } private void traceCall(InterpreterFrame frame, String type) { - trace(frame.depth(), type + " " + frame.getMethod() + " - " + frame.getMethod().signature().asString()); + trace(frame.depth(), type + " " + frame.getMethod() + " - " + frame.getMethod().getSignature()); } private void trace(int level, String message) { @@ -1187,11 +1187,11 @@ private ResolvedJavaType resolveType(InterpreterFrame frame, int opcode, char cpi) { ConstantPool constantPool = frame.getConstantPool(); constantPool.loadReferencedType(cpi, opcode); - return constantPool.lookupType(cpi, opcode).resolve(frame.getMethod().holder()); + return constantPool.lookupType(cpi, opcode).resolve(frame.getMethod().getDeclaringClass()); } private ResolvedJavaType resolveType(InterpreterFrame frame, Class< ? > javaClass) { - return metaAccessProvider.getResolvedJavaType(javaClass).resolve(frame.getMethod().holder()); + return metaAccessProvider.lookupJavaType(javaClass).resolve(frame.getMethod().getDeclaringClass()); } private ResolvedJavaMethod resolveMethod(InterpreterFrame frame, int opcode, char cpi) { @@ -1236,7 +1236,7 @@ assert false : "unspecified case"; } } else if (constant instanceof JavaType) { - frame.pushObject(((JavaType) constant).resolve(method.holder()).toJava()); + frame.pushObject(((JavaType) constant).resolve(method.getDeclaringClass()).toJava()); } else { assert false : "unexpected case"; } @@ -1290,7 +1290,7 @@ private InterpreterFrame resolveAndInvoke(InterpreterFrame parent, ResolvedJavaMethod m) throws Throwable { Object receiver = nullCheck(parent.peekReceiver(m)); - ResolvedJavaMethod method = resolveType(parent, receiver.getClass()).resolveMethodImpl(m); + ResolvedJavaMethod method = resolveType(parent, receiver.getClass()).resolveMethod(m); if (method == null) { throw new AbstractMethodError(); @@ -1301,7 +1301,7 @@ private InterpreterFrame invokeVirtual(InterpreterFrame frame, char cpi) throws Throwable { ResolvedJavaMethod m = resolveMethod(frame, Bytecodes.INVOKEVIRTUAL, cpi); - if (Modifier.isFinal(m.accessFlags())) { + if (Modifier.isFinal(m.getModifiers())) { return invoke(frame, m, nullCheck(frame.peekReceiver(m))); } else { return resolveAndInvoke(frame, m); @@ -1314,14 +1314,14 @@ } private Object[] popArgumentsAsObject(InterpreterFrame frame, ResolvedJavaMethod method, boolean hasReceiver) { - Signature signature = method.signature(); - int argumentCount = method.signature().argumentCount(hasReceiver); + Signature signature = method.getSignature(); + int argumentCount = method.getSignature().getParameterCount(hasReceiver); Object[] parameters = new Object[argumentCount]; int lastSignatureIndex = hasReceiver ? 1 : 0; for (int i = argumentCount - 1; i >= lastSignatureIndex; i--) { - ResolvedJavaType type = signature.argumentTypeAt(i - lastSignatureIndex, method.holder()).resolve(method.holder()); - parameters[i] = popAsObject(frame, type.kind()); + ResolvedJavaType type = signature.getParameterType(i - lastSignatureIndex, method.getDeclaringClass()).resolve(method.getDeclaringClass()); + parameters[i] = popAsObject(frame, type.getKind()); } if (hasReceiver) { @@ -1335,7 +1335,7 @@ throw new StackOverflowError("Maximum callstack of " + maxStackFrames + " exceeded."); } - if (Modifier.isNative(method.accessFlags())) { + if (Modifier.isNative(method.getModifiers())) { return invokeNativeMethodViaVM(caller, method, receiver != null); } else { MethodRedirectionInfo redirectedMethod = methodDelegates.get(method); @@ -1356,7 +1356,7 @@ // mark the current thread as high level and execute the native method Object[] parameters = popArgumentsAsObject(caller, method, hasReceiver); Object returnValue = runtimeInterface.invoke(method, parameters); - pushAsObject(caller, method.signature().returnKind(), returnValue); + pushAsObject(caller, method.getSignature().getReturnKind(), returnValue); return null; } @@ -1371,7 +1371,7 @@ Object[] originalCalleeParameters = popArgumentsAsObject(caller, originalMethod, hasReceiver); Object[] parameters = new Object[]{caller, originalMethod, originalCalleeParameters}; Object returnValue = redirectionInfo.getTargetMethod().invoke(redirectionInfo.getReceiver(), parameters); - pushAsObject(caller, originalMethod.signature().returnKind(), returnValue); + pushAsObject(caller, originalMethod.getSignature().getReturnKind(), returnValue); return null; } @@ -1393,7 +1393,7 @@ private ResolvedJavaType getLastDimensionType(ResolvedJavaType type) { ResolvedJavaType result = type; while (result.isArrayClass()) { - result = result.componentType(); + result = result.getComponentType(); } return result; } @@ -1446,7 +1446,7 @@ } private void putFieldStatic(InterpreterFrame frame, ResolvedJavaField field) { - switch (field.kind()) { + switch (field.getKind()) { case Boolean: case Byte: case Char: @@ -1472,7 +1472,7 @@ } private void putFieldVirtual(InterpreterFrame frame, ResolvedJavaField field) { - switch (field.kind()) { + switch (field.getKind()) { case Boolean: case Byte: case Char: @@ -1499,7 +1499,7 @@ private void getField(InterpreterFrame frame, Object base, int opcode, char cpi) { ResolvedJavaField field = resolveField(frame, opcode, cpi); - switch (field.kind()) { + switch (field.getKind()) { case Boolean: frame.pushInt(runtimeInterface.getFieldBoolean(base, field) ? 1 : 0); break; @@ -1599,7 +1599,7 @@ private ResolvedJavaMethod resolveRootMethod() { try { - return metaAccessProvider.getResolvedJavaMethod(BytecodeInterpreter.class.getDeclaredMethod("execute", Method.class, Object[].class)); + return metaAccessProvider.lookupJavaMethod(BytecodeInterpreter.class.getDeclaredMethod("execute", Method.class, Object[].class)); } catch (Exception e) { throw new RuntimeException(e); } @@ -1620,7 +1620,7 @@ while (tmp != null) { if (first || !filterStackElement(tmp)) { first = true; - elements.add(tmp.getMethod().toStackTraceElement(tmp.getBCI())); + elements.add(tmp.getMethod().asStackTraceElement(tmp.getBCI())); } tmp = tmp.getParentFrame(); } @@ -1628,14 +1628,14 @@ } private static boolean filterStackElement(InterpreterFrame frame) { - return Throwable.class.isAssignableFrom(frame.getMethod().holder().toJava()); + return Throwable.class.isAssignableFrom(frame.getMethod().getDeclaringClass().toJava()); } private ResolvedJavaField findThrowableField(InterpreterFrame frame, String name) { ResolvedJavaType throwableType = resolveType(frame, Throwable.class); - ResolvedJavaField[] fields = throwableType.declaredFields(); + ResolvedJavaField[] fields = throwableType.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { - if (fields[i].name().equals(name)) { + if (fields[i].getName().equals(name)) { return fields[i]; } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterFrame.java --- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterFrame.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterFrame.java Tue Oct 09 15:23:38 2012 -0700 @@ -45,7 +45,7 @@ } private InterpreterFrame(ResolvedJavaMethod method, InterpreterFrame parent, int additionalStackSpace, int depth) { - super(method.maxLocals() + method.maxStackSize() + BASE_LENGTH + additionalStackSpace, parent); + super(method.getMaxLocals() + method.getMaxStackSize() + BASE_LENGTH + additionalStackSpace, parent); setMethod(method); setBCI(0); this.depth = depth; @@ -54,9 +54,9 @@ public InterpreterFrame create(ResolvedJavaMethod method, boolean hasReceiver) { InterpreterFrame frame = new InterpreterFrame(method, this, 0, this.depth + 1); - int length = method.signature().argumentSlots(hasReceiver); + int length = method.getSignature().getParameterSlots(hasReceiver); - frame.pushVoid(method.maxLocals()); + frame.pushVoid(method.getMaxLocals()); if (length > 0) { copyArguments(frame, length); popVoid(length); @@ -74,7 +74,7 @@ } private int stackTos() { - return BASE_LENGTH + getMethod().maxLocals(); + return BASE_LENGTH + getMethod().getMaxLocals(); } private void copyArguments(InterpreterFrame dest, int length) { @@ -86,7 +86,7 @@ public Object peekReceiver(ResolvedJavaMethod method) { - return getObject(tosSingle(method.signature().argumentSlots(false))); + return getObject(tosSingle(method.getSignature().getParameterSlots(false))); } public void pushBoth(Object oValue, int intValue) { @@ -318,7 +318,7 @@ @Override public String toString() { ResolvedJavaMethod method = getMethod(); - StringBuilder b = new StringBuilder(getMethod().toStackTraceElement(getBCI()).toString()); + StringBuilder b = new StringBuilder(getMethod().asStackTraceElement(getBCI()).toString()); for (int i = 0; i < tos; i++) { Object object = getObject(tosSingle(i)); long primitive = getLong(tosSingle(i)); @@ -337,7 +337,7 @@ typeString = "bci"; } else if (index == PARENT_FRAME_SLOT) { typeString = "parent"; - } else if (index < BASE_LENGTH + method.maxLocals()) { + } else if (index < BASE_LENGTH + method.getMaxLocals()) { typeString = "var " + (index - BASE_LENGTH); } else { typeString = "local"; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java Tue Oct 09 15:23:38 2012 -0700 @@ -163,9 +163,9 @@ */ public BciBlockMapping(ResolvedJavaMethod method) { this.method = method; - exceptionHandlers = method.exceptionHandlers(); - stream = new BytecodeStream(method.code()); - this.blockMap = new Block[method.codeSize()]; + exceptionHandlers = method.getExceptionHandlers(); + stream = new BytecodeStream(method.getCode()); + this.blockMap = new Block[method.getCodeSize()]; this.blocks = new ArrayList<>(); this.loopHeaders = new Block[64]; } @@ -233,7 +233,7 @@ private void makeExceptionEntries() { // start basic blocks at all exception handler blocks and mark them as exception entries for (ExceptionHandler h : this.exceptionHandlers) { - Block xhandler = makeBlock(h.handlerBCI()); + Block xhandler = makeBlock(h.getHandlerBCI()); xhandler.isExceptionEntry = true; } } @@ -486,7 +486,7 @@ for (int i = exceptionHandlers.length - 1; i >= 0; i--) { ExceptionHandler h = exceptionHandlers[i]; - if (h.startBCI() <= bci && bci < h.endBCI()) { + if (h.getStartBCI() <= bci && bci < h.getEndBCI()) { if (h.isCatchAll()) { // Discard all information about succeeding exception handlers, since they can never be reached. lastHandler = null; @@ -500,7 +500,7 @@ curHandler.endBci = -1; curHandler.deoptBci = bci; curHandler.handler = h; - curHandler.successors.add(blockMap[h.handlerBCI()]); + curHandler.successors.add(blockMap[h.getHandlerBCI()]); if (lastHandler != null) { curHandler.successors.add(lastHandler); } @@ -749,10 +749,10 @@ } private void computeLocalLiveness(Block block) { - block.localsLiveIn = new BitSet(method.maxLocals()); - block.localsLiveOut = new BitSet(method.maxLocals()); - block.localsLiveGen = new BitSet(method.maxLocals()); - block.localsLiveKill = new BitSet(method.maxLocals()); + block.localsLiveIn = new BitSet(method.getMaxLocals()); + block.localsLiveOut = new BitSet(method.getMaxLocals()); + block.localsLiveGen = new BitSet(method.getMaxLocals()); + block.localsLiveKill = new BitSet(method.getMaxLocals()); if (block.startBci < 0 || block.endBci < 0) { return; @@ -762,7 +762,7 @@ while (stream.currentBCI() <= block.endBci) { switch (stream.currentBC()) { case RETURN: - if (method.isConstructor() && method.holder().superType() == null) { + if (method.isConstructor() && method.getDeclaringClass().getSuperclass() == null) { // return from Object.init implicitly registers a finalizer // for the receiver if needed, so keep it alive. loadOne(block, 0); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java Tue Oct 09 15:23:38 2012 -0700 @@ -51,11 +51,11 @@ * @return {@code null} if {@code method} has no bytecode (e.g., it is native or abstract) */ public String disassemble(ResolvedJavaMethod method) { - if (method.code() == null) { + if (method.getCode() == null) { return null; } ConstantPool cp = method.getConstantPool(); - BytecodeStream stream = new BytecodeStream(method.code()); + BytecodeStream stream = new BytecodeStream(method.getCode()); StringBuilder buf = new StringBuilder(); int opcode = stream.currentBC(); while (opcode != Bytecodes.END) { @@ -81,7 +81,7 @@ case PUTFIELD : { int cpi = stream.readCPI(); JavaField field = cp.lookupField(cpi, opcode); - String fieldDesc = field.holder().name().equals(method.holder().name()) ? MetaUtil.format("%n:%T", field) : MetaUtil.format("%H.%n:%T", field); + String fieldDesc = field.getDeclaringClass().getName().equals(method.getDeclaringClass().getName()) ? MetaUtil.format("%n:%T", field) : MetaUtil.format("%H.%n:%T", field); buf.append(String.format("#%-10d // %s", cpi, fieldDesc)); break; } @@ -90,14 +90,14 @@ case INVOKESTATIC : { int cpi = stream.readCPI(); JavaMethod callee = cp.lookupMethod(cpi, opcode); - String calleeDesc = callee.holder().name().equals(method.holder().name()) ? MetaUtil.format("%n:(%P)%R", callee) : MetaUtil.format("%H.%n:(%P)%R", callee); + String calleeDesc = callee.getDeclaringClass().getName().equals(method.getDeclaringClass().getName()) ? MetaUtil.format("%n:(%P)%R", callee) : MetaUtil.format("%H.%n:(%P)%R", callee); buf.append(String.format("#%-10d // %s", cpi, calleeDesc)); break; } case INVOKEINTERFACE: { int cpi = stream.readCPI(); JavaMethod callee = cp.lookupMethod(cpi, opcode); - String calleeDesc = callee.holder().name().equals(method.holder().name()) ? MetaUtil.format("%n:(%P)%R", callee) : MetaUtil.format("%H.%n:(%P)%R", callee); + String calleeDesc = callee.getDeclaringClass().getName().equals(method.getDeclaringClass().getName()) ? MetaUtil.format("%n:(%P)%R", callee) : MetaUtil.format("%H.%n:(%P)%R", callee); buf.append(String.format("#%-10s // %s", cpi + ", " + stream.readUByte(bci + 3), calleeDesc)); break; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java Tue Oct 09 15:23:38 2012 -0700 @@ -55,29 +55,29 @@ assert graph != null; this.method = method; this.graph = graph; - this.locals = new ValueNode[method.maxLocals()]; + this.locals = new ValueNode[method.getMaxLocals()]; // we always need at least one stack slot (for exceptions) - this.stack = new ValueNode[Math.max(1, method.maxStackSize())]; + this.stack = new ValueNode[Math.max(1, method.getMaxStackSize())]; this.locks = EMPTY_ARRAY; int javaIndex = 0; int index = 0; - if (!isStatic(method.accessFlags())) { + if (!isStatic(method.getModifiers())) { // add the receiver - LocalNode local = graph.unique(new LocalNode(javaIndex, StampFactory.declaredNonNull(method.holder()))); + LocalNode local = graph.unique(new LocalNode(javaIndex, StampFactory.declaredNonNull(method.getDeclaringClass()))); storeLocal(javaIndex, local); javaIndex = 1; index = 1; } - Signature sig = method.signature(); - int max = sig.argumentCount(false); - ResolvedJavaType accessingClass = method.holder(); + Signature sig = method.getSignature(); + int max = sig.getParameterCount(false); + ResolvedJavaType accessingClass = method.getDeclaringClass(); for (int i = 0; i < max; i++) { - JavaType type = sig.argumentTypeAt(i, accessingClass); + JavaType type = sig.getParameterType(i, accessingClass); if (eagerResolve) { type = type.resolve(accessingClass); } - Kind kind = type.kind().stackKind(); + Kind kind = type.getKind().getStackKind(); Stamp stamp; if (kind == Kind.Object && type instanceof ResolvedJavaType) { stamp = StampFactory.declared((ResolvedJavaType) type); @@ -100,8 +100,8 @@ stackSize = other.stackSize; rethrowException = other.rethrowException; - assert locals.length == method.maxLocals(); - assert stack.length == Math.max(1, method.maxStackSize()); + assert locals.length == method.getMaxLocals(); + assert stack.length == Math.max(1, method.getMaxStackSize()); } @Override @@ -477,7 +477,7 @@ public void pushReturn(Kind kind, ValueNode x) { if (kind != Kind.Void) { - push(kind.stackKind(), x); + push(kind.getStackKind(), x); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Tue Oct 09 15:23:38 2012 -0700 @@ -29,10 +29,11 @@ import java.util.*; import com.oracle.graal.api.code.*; -import com.oracle.graal.api.code.RuntimeCall.*; +import com.oracle.graal.api.code.RuntimeCall.Descriptor; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.meta.JavaType.Representation; import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType; +import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen; +import com.oracle.graal.api.meta.ResolvedJavaType.Representation; import com.oracle.graal.bytecode.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; @@ -119,9 +120,9 @@ protected void run(StructuredGraph graph) { method = graph.method(); graphId = graph.graphId(); - profilingInfo = method.profilingInfo(); - assert method.code() != null : "method must contain bytecodes: " + method; - this.stream = new BytecodeStream(method.code()); + profilingInfo = method.getProfilingInfo(); + assert method.getCode() != null : "method must contain bytecodes: " + method; + this.stream = new BytecodeStream(method.getCode()); this.constantPool = method.getConstantPool(); unwindBlock = null; returnBlock = null; @@ -160,7 +161,7 @@ loopHeaders = blockMap.loopHeaders; lastInstr = currentGraph.start(); - if (isSynchronized(method.accessFlags())) { + if (isSynchronized(method.getModifiers())) { // add a monitor enter to the start block currentGraph.start().setStateAfter(frameState.create(FrameState.BEFORE_BCI)); methodSynchronizedObject = synchronizedObject(frameState, method); @@ -238,7 +239,7 @@ } public static boolean covers(ExceptionHandler handler, int bci) { - return handler.startBCI() <= bci && bci < handler.endBCI(); + return handler.getStartBCI() <= bci && bci < handler.getEndBCI(); } public static boolean isCatchAll(ExceptionHandler handler) { @@ -295,7 +296,7 @@ } } else if (con instanceof Constant) { Constant constant = (Constant) con; - frameState.push(constant.getKind().stackKind(), appendConstant(constant)); + frameState.push(constant.getKind().getStackKind(), appendConstant(constant)); } else { throw new Error("lookupConstant returned an object of incorrect type"); } @@ -307,13 +308,13 @@ ValueNode index = frameState.ipop(); ValueNode array = frameState.apop(); ValueNode v = append(currentGraph.add(new LoadIndexedNode(array, index, kind, graphId))); - frameState.push(kind.stackKind(), v); + frameState.push(kind.getStackKind(), v); } private void genStoreIndexed(Kind kind) { emitExplicitExceptions(frameState.peek(2), frameState.peek(1)); - ValueNode value = frameState.pop(kind.stackKind()); + ValueNode value = frameState.pop(kind.getStackKind()); ValueNode index = frameState.ipop(); ValueNode array = frameState.apop(); StoreIndexedNode result = currentGraph.add(new StoreIndexedNode(array, index, kind, value, graphId)); @@ -404,7 +405,7 @@ private void genArithmeticOp(Kind result, int opcode, boolean canTrap) { ValueNode y = frameState.pop(result); ValueNode x = frameState.pop(result); - boolean isStrictFP = isStrict(method.accessFlags()); + boolean isStrictFP = isStrict(method.getModifiers()); ArithmeticNode v; switch(opcode){ case IADD: @@ -482,8 +483,8 @@ } private void genConvert(ConvertNode.Op opcode) { - ValueNode input = frameState.pop(opcode.from.stackKind()); - frameState.push(opcode.to.stackKind(), append(currentGraph.unique(new ConvertNode(opcode, input)))); + ValueNode input = frameState.pop(opcode.from.getStackKind()); + frameState.push(opcode.to.getStackKind(), append(currentGraph.unique(new ConvertNode(opcode, input)))); } private void genIncrement() { @@ -584,14 +585,14 @@ private JavaMethod lookupMethod(int cpi, int opcode) { eagerResolvingForSnippets(cpi, opcode); JavaMethod result = constantPool.lookupMethod(cpi, opcode); - assert !graphBuilderConfig.eagerResolvingForSnippets() || ((result instanceof ResolvedJavaMethod) && ((ResolvedJavaMethod) result).holder().isInitialized()); + assert !graphBuilderConfig.eagerResolvingForSnippets() || ((result instanceof ResolvedJavaMethod) && ((ResolvedJavaMethod) result).getDeclaringClass().isInitialized()); return result; } private JavaField lookupField(int cpi, int opcode) { eagerResolvingForSnippets(cpi, opcode); JavaField result = constantPool.lookupField(cpi, opcode); - assert !graphBuilderConfig.eagerResolvingForSnippets() || (result instanceof ResolvedJavaField && ((ResolvedJavaField) result).holder().isInitialized()); + assert !graphBuilderConfig.eagerResolvingForSnippets() || (result instanceof ResolvedJavaField && ((ResolvedJavaField) result).getDeclaringClass().isInitialized()); return result; } @@ -618,7 +619,7 @@ if (!optimisticOpts.useTypeCheckHints() || TypeCheckHints.isFinalClass(type)) { return null; } else { - ResolvedJavaType uniqueSubtype = type.uniqueConcreteSubtype(); + ResolvedJavaType uniqueSubtype = type.findUniqueConcreteSubtype(); if (uniqueSubtype != null) { return new JavaTypeProfile(0.0D, new ProfiledType(uniqueSubtype, 1.0D)); } else { @@ -632,7 +633,7 @@ JavaType type = lookupType(cpi, CHECKCAST); boolean initialized = type instanceof ResolvedJavaType; if (initialized) { - ConstantNode typeInstruction = genTypeOrDeopt(JavaType.Representation.ObjectHub, type, true); + ConstantNode typeInstruction = genTypeOrDeopt(Representation.ObjectHub, type, true); ValueNode object = frameState.apop(); CheckCastNode checkCast = currentGraph.add(new CheckCastNode(typeInstruction, (ResolvedJavaType) type, object, getProfileForTypeCheck((ResolvedJavaType) type))); append(checkCast); @@ -650,7 +651,7 @@ ValueNode object = frameState.apop(); if (type instanceof ResolvedJavaType) { ResolvedJavaType resolvedType = (ResolvedJavaType) type; - ConstantNode hub = appendConstant(resolvedType.getEncoding(JavaType.Representation.ObjectHub)); + ConstantNode hub = appendConstant(resolvedType.getEncoding(Representation.ObjectHub)); InstanceOfNode instanceOfNode = new InstanceOfNode(hub, (ResolvedJavaType) type, object, getProfileForTypeCheck(resolvedType)); frameState.ipush(append(MaterializeNode.create(currentGraph.unique(instanceOfNode)))); } else { @@ -680,25 +681,25 @@ * @param code the array type code * @return the kind from the array type code */ - public static Kind arrayTypeCodeToKind(int code) { + public static Class< ? > arrayTypeCodeToClass(int code) { // Checkstyle: stop switch (code) { - case 4: return Kind.Boolean; - case 5: return Kind.Char; - case 6: return Kind.Float; - case 7: return Kind.Double; - case 8: return Kind.Byte; - case 9: return Kind.Short; - case 10: return Kind.Int; - case 11: return Kind.Long; + case 4: return boolean.class; + case 5: return char.class; + case 6: return float.class; + case 7: return double.class; + case 8: return byte.class; + case 9: return short.class; + case 10: return int.class; + case 11: return long.class; default: throw new IllegalArgumentException("unknown array type code: " + code); } // Checkstyle: resume } private void genNewPrimitiveArray(int typeCode) { - Kind kind = arrayTypeCodeToKind(typeCode); - ResolvedJavaType elementType = runtime.getResolvedJavaType(kind); + Class< ? > clazz = arrayTypeCodeToClass(typeCode); + ResolvedJavaType elementType = runtime.lookupJavaType(clazz); NewPrimitiveArrayNode nta = currentGraph.add(new NewPrimitiveArrayNode(elementType, frameState.ipop(), true, false)); frameState.apush(append(nta)); } @@ -735,14 +736,14 @@ private void genGetField(JavaField field) { emitExplicitExceptions(frameState.peek(0), null); - Kind kind = field.kind(); + Kind kind = field.getKind(); ValueNode receiver = frameState.apop(); - if ((field instanceof ResolvedJavaField) && ((ResolvedJavaField) field).holder().isInitialized()) { + if ((field instanceof ResolvedJavaField) && ((ResolvedJavaField) field).getDeclaringClass().isInitialized()) { LoadFieldNode load = currentGraph.add(new LoadFieldNode(receiver, (ResolvedJavaField) field, graphId)); appendOptimizedLoadField(kind, load); } else { append(currentGraph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.Unresolved, graphId))); - frameState.push(kind.stackKind(), append(ConstantNode.defaultForKind(kind, currentGraph))); + frameState.push(kind.getStackKind(), append(ConstantNode.defaultForKind(kind, currentGraph))); } } @@ -812,9 +813,9 @@ private void genPutField(JavaField field) { emitExplicitExceptions(frameState.peek(1), null); - ValueNode value = frameState.pop(field.kind().stackKind()); + ValueNode value = frameState.pop(field.getKind().getStackKind()); ValueNode receiver = frameState.apop(); - if (field instanceof ResolvedJavaField && ((ResolvedJavaField) field).holder().isInitialized()) { + if (field instanceof ResolvedJavaField && ((ResolvedJavaField) field).getDeclaringClass().isInitialized()) { StoreFieldNode store = currentGraph.add(new StoreFieldNode(receiver, (ResolvedJavaField) field, value, graphId)); appendOptimizedStoreField(store); } else { @@ -823,32 +824,32 @@ } private void genGetStatic(JavaField field) { - JavaType holder = field.holder(); + JavaType holder = field.getDeclaringClass(); boolean isInitialized = (field instanceof ResolvedJavaField) && ((ResolvedJavaType) holder).isInitialized(); Constant constantValue = null; if (isInitialized) { - constantValue = ((ResolvedJavaField) field).constantValue(null); + constantValue = ((ResolvedJavaField) field).readConstantValue(null); } if (constantValue != null) { - frameState.push(constantValue.getKind().stackKind(), appendConstant(constantValue)); + frameState.push(constantValue.getKind().getStackKind(), appendConstant(constantValue)); } else { - ValueNode container = genTypeOrDeopt(field.kind() == Kind.Object ? JavaType.Representation.StaticObjectFields : JavaType.Representation.StaticPrimitiveFields, holder, isInitialized); - Kind kind = field.kind(); + ValueNode container = genTypeOrDeopt(field.getKind() == Kind.Object ? Representation.StaticObjectFields : Representation.StaticPrimitiveFields, holder, isInitialized); + Kind kind = field.getKind(); if (container != null) { LoadFieldNode load = currentGraph.add(new LoadFieldNode(container, (ResolvedJavaField) field, graphId)); appendOptimizedLoadField(kind, load); } else { // deopt will be generated by genTypeOrDeopt, not needed here - frameState.push(kind.stackKind(), append(ConstantNode.defaultForKind(kind, currentGraph))); + frameState.push(kind.getStackKind(), append(ConstantNode.defaultForKind(kind, currentGraph))); } } } private void genPutStatic(JavaField field) { - JavaType holder = field.holder(); + JavaType holder = field.getDeclaringClass(); boolean isInitialized = (field instanceof ResolvedJavaField) && ((ResolvedJavaType) holder).isInitialized(); - ValueNode container = genTypeOrDeopt(field.kind() == Kind.Object ? JavaType.Representation.StaticObjectFields : JavaType.Representation.StaticPrimitiveFields, holder, isInitialized); - ValueNode value = frameState.pop(field.kind().stackKind()); + ValueNode container = genTypeOrDeopt(field.getKind() == Kind.Object ? Representation.StaticObjectFields : Representation.StaticPrimitiveFields, holder, isInitialized); + ValueNode value = frameState.pop(field.getKind().getStackKind()); if (container != null) { StoreFieldNode store = currentGraph.add(new StoreFieldNode(container, (ResolvedJavaField) field, value, graphId)); appendOptimizedStoreField(store); @@ -857,7 +858,7 @@ } } - private ConstantNode genTypeOrDeopt(JavaType.Representation representation, JavaType holder, boolean initialized) { + private ConstantNode genTypeOrDeopt(Representation representation, JavaType holder, boolean initialized) { if (initialized) { return appendConstant(((ResolvedJavaType) holder).getEncoding(representation)); } else { @@ -873,17 +874,17 @@ private void appendOptimizedLoadField(Kind kind, LoadFieldNode load) { // append the load to the instruction ValueNode optimized = append(load); - frameState.push(kind.stackKind(), optimized); + frameState.push(kind.getStackKind(), optimized); } private void genInvokeStatic(JavaMethod target) { if (target instanceof ResolvedJavaMethod) { ResolvedJavaMethod resolvedTarget = (ResolvedJavaMethod) target; - ResolvedJavaType holder = resolvedTarget.holder(); + ResolvedJavaType holder = resolvedTarget.getDeclaringClass(); if (!holder.isInitialized() && GraalOptions.ResolveClassBeforeStaticInvoke) { genInvokeDeopt(target, false); } else { - ValueNode[] args = frameState.popArguments(resolvedTarget.signature().argumentSlots(false), resolvedTarget.signature().argumentCount(false)); + ValueNode[] args = frameState.popArguments(resolvedTarget.getSignature().getParameterSlots(false), resolvedTarget.getSignature().getParameterCount(false)); appendInvoke(InvokeKind.Static, resolvedTarget, args); } } else { @@ -893,7 +894,7 @@ private void genInvokeInterface(JavaMethod target) { if (target instanceof ResolvedJavaMethod) { - ValueNode[] args = frameState.popArguments(target.signature().argumentSlots(true), target.signature().argumentCount(true)); + ValueNode[] args = frameState.popArguments(target.getSignature().getParameterSlots(true), target.getSignature().getParameterCount(true)); genInvokeIndirect(InvokeKind.Interface, (ResolvedJavaMethod) target, args); } else { genInvokeDeopt(target, true); @@ -902,7 +903,7 @@ private void genInvokeVirtual(JavaMethod target) { if (target instanceof ResolvedJavaMethod) { - ValueNode[] args = frameState.popArguments(target.signature().argumentSlots(true), target.signature().argumentCount(true)); + ValueNode[] args = frameState.popArguments(target.getSignature().getParameterSlots(true), target.getSignature().getParameterCount(true)); genInvokeIndirect(InvokeKind.Virtual, (ResolvedJavaMethod) target, args); } else { genInvokeDeopt(target, true); @@ -913,8 +914,8 @@ private void genInvokeSpecial(JavaMethod target) { if (target instanceof ResolvedJavaMethod) { assert target != null; - assert target.signature() != null; - ValueNode[] args = frameState.popArguments(target.signature().argumentSlots(true), target.signature().argumentCount(true)); + assert target.getSignature() != null; + ValueNode[] args = frameState.popArguments(target.getSignature().getParameterSlots(true), target.getSignature().getParameterCount(true)); invokeDirect((ResolvedJavaMethod) target, args); } else { genInvokeDeopt(target, true); @@ -923,32 +924,32 @@ private void genInvokeDeopt(JavaMethod unresolvedTarget, boolean withReceiver) { append(currentGraph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.Unresolved, graphId))); - frameState.popArguments(unresolvedTarget.signature().argumentSlots(withReceiver), unresolvedTarget.signature().argumentCount(withReceiver)); - Kind kind = unresolvedTarget.signature().returnKind(); + frameState.popArguments(unresolvedTarget.getSignature().getParameterSlots(withReceiver), unresolvedTarget.getSignature().getParameterCount(withReceiver)); + Kind kind = unresolvedTarget.getSignature().getReturnKind(); if (kind != Kind.Void) { - frameState.push(kind.stackKind(), append(ConstantNode.defaultForKind(kind, currentGraph))); + frameState.push(kind.getStackKind(), append(ConstantNode.defaultForKind(kind, currentGraph))); } } private void genInvokeIndirect(InvokeKind invokeKind, ResolvedJavaMethod target, ValueNode[] args) { ValueNode receiver = args[0]; // attempt to devirtualize the call - ResolvedJavaType klass = target.holder(); + ResolvedJavaType klass = target.getDeclaringClass(); // 0. check for trivial cases - if (target.canBeStaticallyBound() && !isAbstract(target.accessFlags())) { + if (target.canBeStaticallyBound()) { // check for trivial cases (e.g. final methods, nonvirtual methods) invokeDirect(target, args); return; } // 1. check if the exact type of the receiver can be determined - ResolvedJavaType exact = klass.exactType(); + ResolvedJavaType exact = klass.getExactType(); if (exact == null && receiver.objectStamp().isExactType()) { exact = receiver.objectStamp().type(); } if (exact != null) { // either the holder class is exact, or the receiver object has an exact type - invokeDirect(exact.resolveMethodImpl(target), args); + invokeDirect(exact.resolveMethod(target), args); return; } // devirtualization failed, produce an actual invokevirtual @@ -960,18 +961,18 @@ } private void appendInvoke(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args) { - Kind resultType = targetMethod.signature().returnKind(); + Kind resultType = targetMethod.getSignature().getReturnKind(); if (GraalOptions.DeoptALot) { DeoptimizeNode deoptimize = currentGraph.add(new DeoptimizeNode(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint, graphId)); - deoptimize.setMessage("invoke " + targetMethod.name()); + deoptimize.setMessage("invoke " + targetMethod.getName()); append(deoptimize); frameState.pushReturn(resultType, ConstantNode.defaultForKind(resultType, currentGraph)); return; } - JavaType returnType = targetMethod.signature().returnType(method.holder()); + JavaType returnType = targetMethod.getSignature().getReturnType(method.getDeclaringClass()); if (graphBuilderConfig.eagerResolvingForSnippets()) { - returnType = returnType.resolve(targetMethod.holder()); + returnType = returnType.resolve(targetMethod.getDeclaringClass()); } MethodCallTargetNode callTarget = currentGraph.add(new MethodCallTargetNode(invokeKind, targetMethod, args, returnType)); // be conservative if information was not recorded (could result in endless recompiles otherwise) @@ -1285,8 +1286,8 @@ } private ValueNode synchronizedObject(FrameStateBuilder state, ResolvedJavaMethod target) { - if (isStatic(target.accessFlags())) { - return append(ConstantNode.forConstant(target.holder().getEncoding(Representation.JavaClass), runtime, currentGraph)); + if (isStatic(target.getModifiers())) { + return append(ConstantNode.forConstant(target.getDeclaringClass().getEncoding(Representation.JavaClass), runtime, currentGraph)); } else { return state.loadLocal(0); } @@ -1354,15 +1355,15 @@ } private void createReturn() { - if (method.isConstructor() && method.holder().superType() == null) { + if (method.isConstructor() && method.getDeclaringClass().getSuperclass() == null) { callRegisterFinalizer(); } - Kind returnKind = method.signature().returnKind().stackKind(); + Kind returnKind = method.getSignature().getReturnKind().getStackKind(); ValueNode x = returnKind == Kind.Void ? null : frameState.pop(returnKind); assert frameState.stackSize() == 0; // TODO (gdub) remove this when FloatingRead can handle this case - if (Modifier.isSynchronized(method.accessFlags())) { + if (Modifier.isSynchronized(method.getModifiers())) { append(currentGraph.add(new ValueAnchorNode(x))); assert !frameState.rethrowException(); } @@ -1378,7 +1379,7 @@ } private void synchronizedEpilogue(int bci) { - if (Modifier.isSynchronized(method.accessFlags())) { + if (Modifier.isSynchronized(method.getModifiers())) { MonitorExitNode monitorExit = genMonitorExit(methodSynchronizedObject); monitorExit.setStateAfter(frameState.create(bci)); assert !frameState.rethrowException(); @@ -1393,7 +1394,7 @@ return; } - JavaType catchType = block.handler.catchType(); + JavaType catchType = block.handler.getCatchType(); if (graphBuilderConfig.eagerResolving()) { catchType = lookupType(block.handler.catchTypeCPI(), INSTANCEOF); } @@ -1408,7 +1409,7 @@ } } - ConstantNode typeInstruction = genTypeOrDeopt(JavaType.Representation.ObjectHub, catchType, initialized); + ConstantNode typeInstruction = genTypeOrDeopt(Representation.ObjectHub, catchType, initialized); if (typeInstruction != null) { Block nextBlock = block.successors.size() == 1 ? unwindBlock(block.deoptBci) : block.successors.get(1); ValueNode exception = frameState.stackAt(0); @@ -1522,11 +1523,11 @@ log.println(String.format("| state [nr locals = %d, stack depth = %d, method = %s]", frameState.localsSize(), frameState.stackSize(), method)); for (int i = 0; i < frameState.localsSize(); ++i) { ValueNode value = frameState.localAt(i); - log.println(String.format("| local[%d] = %-8s : %s", i, value == null ? "bogus" : value.kind().javaName, value)); + log.println(String.format("| local[%d] = %-8s : %s", i, value == null ? "bogus" : value.kind().getJavaName(), value)); } for (int i = 0; i < frameState.stackSize(); ++i) { ValueNode value = frameState.stackAt(i); - log.println(String.format("| stack[%d] = %-8s : %s", i, value == null ? "bogus" : value.kind().javaName, value)); + log.println(String.format("| stack[%d] = %-8s : %s", i, value == null ? "bogus" : value.kind().getJavaName(), value)); } } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java Tue Oct 09 15:23:38 2012 -0700 @@ -190,7 +190,7 @@ assert isConstant(y) || asRegister(y) == AMD64.rcx; assert differentRegisters(result, y) || sameRegister(x, y); verifyKind(opcode, result, x, x); - assert y.getKind().stackKind() == Kind.Int; + assert y.getKind().getStackKind() == Kind.Int; } } @@ -484,7 +484,7 @@ private static void verifyKind(AMD64Arithmetic opcode, Value result, Value x, Value y) { - assert (opcode.name().startsWith("I") && result.getKind() == Kind.Int && x.getKind().stackKind() == Kind.Int && y.getKind().stackKind() == Kind.Int) + assert (opcode.name().startsWith("I") && result.getKind() == Kind.Int && x.getKind().getStackKind() == Kind.Int && y.getKind().getStackKind() == Kind.Int) || (opcode.name().startsWith("L") && result.getKind() == Kind.Long && x.getKind() == Kind.Long && y.getKind() == Kind.Long) || (opcode.name().startsWith("F") && result.getKind() == Kind.Float && x.getKind() == Kind.Float && y.getKind() == Kind.Float) || (opcode.name().startsWith("D") && result.getKind() == Kind.Double && x.getKind() == Kind.Double && y.getKind() == Kind.Double); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java Tue Oct 09 15:23:38 2012 -0700 @@ -122,7 +122,7 @@ masm.call(); } int after = masm.codeBuffer.position(); - tasm.recordDirectCall(before, after, tasm.runtime.asCallTarget(target), info); + tasm.recordDirectCall(before, after, tasm.runtime.lookupCallTarget(target), info); tasm.recordExceptionHandlers(after, info); masm.ensureUniquePC(); } @@ -131,7 +131,7 @@ int before = masm.codeBuffer.position(); masm.jmp(0, true); int after = masm.codeBuffer.position(); - tasm.recordDirectCall(before, after, tasm.runtime.asCallTarget(target), null); + tasm.recordDirectCall(before, after, tasm.runtime.lookupCallTarget(target), null); masm.ensureUniquePC(); } @@ -139,7 +139,7 @@ int before = masm.codeBuffer.position(); masm.call(dst); int after = masm.codeBuffer.position(); - tasm.recordIndirectCall(before, after, tasm.runtime.asCallTarget(target), info); + tasm.recordIndirectCall(before, after, tasm.runtime.lookupCallTarget(target), info); tasm.recordExceptionHandlers(after, info); masm.ensureUniquePC(); } @@ -149,7 +149,7 @@ assert (assertions = true) == true; if (assertions) { - directCall(tasm, masm, tasm.runtime.getRuntimeCall(DEBUG), null); + directCall(tasm, masm, tasm.runtime.lookupRuntimeCall(DEBUG), null); masm.hlt(); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java Tue Oct 09 15:23:38 2012 -0700 @@ -52,7 +52,7 @@ @Override protected void verify() { super.verify(); - assert (name().startsWith("I") && x.getKind() == Kind.Int && y.getKind().stackKind() == Kind.Int) + assert (name().startsWith("I") && x.getKind() == Kind.Int && y.getKind().getStackKind() == Kind.Int) || (name().startsWith("I") && x.getKind() == Kind.Jsr && y.getKind() == Kind.Jsr) || (name().startsWith("L") && x.getKind() == Kind.Long && y.getKind() == Kind.Long) || (name().startsWith("A") && x.getKind() == Kind.Object && y.getKind() == Kind.Object) diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Tue Oct 09 15:23:38 2012 -0700 @@ -292,7 +292,7 @@ // Note: we use the kind of the input operand (and not the kind of the result operand) because they don't match // in all cases. For example, an object constant can be loaded to a long register when unsafe casts occurred (e.g., // for a write barrier where arithmetic operations are then performed on the pointer). - switch (input.getKind().stackKind()) { + switch (input.getKind().getStackKind()) { case Jsr: case Int: // Do not optimize with an XOR as this instruction may be between @@ -341,7 +341,7 @@ } private static void const2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, Value result, Constant input) { - switch (input.getKind().stackKind()) { + switch (input.getKind().getStackKind()) { case Jsr: case Int: masm.movl(tasm.asAddress(result), input.asInt()); break; case Long: masm.movlong(tasm.asAddress(result), input.asLong()); break; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java Tue Oct 09 15:23:38 2012 -0700 @@ -71,7 +71,7 @@ *
* A runtime has two ways to reserve space in the stack frame for its own use:

    *
  • A memory block somewhere in the frame of size {@link CodeCacheProvider#getCustomStackAreaSize()}. The offset - * to this block is returned in {@link CompilationResult#customStackAreaOffset()}. + * to this block is returned in {@link CompilationResult#getCustomStackAreaOffset()}. *
  • At the beginning of the overflow argument area: The calling convention can specify that the first * overflow stack argument is not at offset 0, but at a specified offset o. Use * {@link CodeCacheProvider#getMinimumOutgoingSize()} to make sure that call-free methods also have this space @@ -194,13 +194,13 @@ * @return the offset of the stack slot */ public int offsetForStackSlot(StackSlot slot) { - assert (!slot.rawAddFrameSize() && slot.rawOffset() < outgoingSize) || - (slot.rawAddFrameSize() && slot.rawOffset() < 0 && -slot.rawOffset() <= spillSize) || - (slot.rawAddFrameSize() && slot.rawOffset() >= 0); - if (slot.inCallerFrame()) { + assert (!slot.getRawAddFrameSize() && slot.getRawOffset() < outgoingSize) || + (slot.getRawAddFrameSize() && slot.getRawOffset() < 0 && -slot.getRawOffset() <= spillSize) || + (slot.getRawAddFrameSize() && slot.getRawOffset() >= 0); + if (slot.isInCallerFrame()) { accessesCallerFrame = true; } - return slot.offset(totalFrameSize()); + return slot.getOffset(totalFrameSize()); } /** diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java Tue Oct 09 15:23:38 2012 -0700 @@ -69,7 +69,7 @@ } if (virtualObjects != null) { for (VirtualObject obj : virtualObjects) { - processValues(obj.values(), proc); + processValues(obj.getValues(), proc); } } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java Tue Oct 09 15:23:38 2012 -0700 @@ -169,7 +169,7 @@ CONST, /** - * The value can be {@link Value#IllegalValue}. + * The value can be {@link Value#ILLEGAL}. */ ILLEGAL, diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java Tue Oct 09 15:23:38 2012 -0700 @@ -49,7 +49,7 @@ */ public Variable(Kind kind, int index, Register.RegisterFlag flag) { super(kind); - assert kind == kind.stackKind() : "Variables can be only created for stack kinds"; + assert kind == kind.getStackKind() : "Variables can be only created for stack kinds"; assert index >= 0; this.index = index; this.flag = flag; @@ -62,6 +62,6 @@ @Override public String toString() { - return "v" + index + kindSuffix(); + return "v" + index + getKindSuffix(); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java Tue Oct 09 15:23:38 2012 -0700 @@ -109,7 +109,7 @@ } Debug.metric("TargetMethods").increment(); - Debug.metric("CodeBytesEmitted").add(targetMethod.targetCodeSize()); + Debug.metric("CodeBytesEmitted").add(targetMethod.getTargetCodeSize()); Debug.metric("SafepointsEmitted").add(targetMethod.getSafepoints().size()); Debug.metric("DataPatches").add(targetMethod.getDataReferences().size()); Debug.metric("ExceptionHandlersEmitted").add(targetMethod.getExceptionHandlers().size()); @@ -178,7 +178,7 @@ * including long constants that fit into the 32-bit range. */ public int asIntConst(Value value) { - assert (value.getKind().stackKind() == Kind.Int || value.getKind() == Kind.Jsr || value.getKind() == Kind.Long) && isConstant(value); + assert (value.getKind().getStackKind() == Kind.Int || value.getKind() == Kind.Jsr || value.getKind() == Kind.Long) && isConstant(value); long c = ((Constant) value).asLong(); if (!(NumUtil.isInt(c))) { throw GraalInternalError.shouldNotReachHere(); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -223,14 +223,14 @@ @Override public Map getDebugProperties(Map map) { Map properties = super.getDebugProperties(map); - properties.put("rawvalue", value.getKind().isObject() ? value.getKind().format(value.boxedValue()) : value.boxedValue()); + properties.put("rawvalue", value.getKind().isObject() ? value.getKind().format(value.asBoxedValue()) : value.asBoxedValue()); return properties; } @Override public String toString(Verbosity verbosity) { if (verbosity == Verbosity.Name) { - return super.toString(Verbosity.Name) + "(" + value.getKind().format(value.boxedValue()) + ")"; + return super.toString(Verbosity.Name) + "(" + value.getKind().format(value.asBoxedValue()) + ")"; } else { return super.toString(verbosity); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DirectCallTargetNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DirectCallTargetNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DirectCallTargetNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -37,7 +37,7 @@ @Override public String targetName() { if (target() instanceof JavaMethod) { - return "Direct#" + ((JavaMethod) target()).name(); + return "Direct#" + ((JavaMethod) target()).getName(); } else if (target() != null) { return "Direct#" + target().getClass().getSimpleName(); } else { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java Tue Oct 09 15:23:38 2012 -0700 @@ -272,7 +272,7 @@ copy.remove(copy.size() - 1); } ValueNode lastSlot = copy.get(copy.size() - 1); - assert lastSlot.kind().stackKind() == popKind.stackKind() || (lastSlot instanceof BoxedVirtualObjectNode && popKind.isObject()); + assert lastSlot.kind().getStackKind() == popKind.getStackKind() || (lastSlot instanceof BoxedVirtualObjectNode && popKind.isObject()); copy.remove(copy.size() - 1); } Collections.addAll(copy, pushedValues); @@ -391,7 +391,7 @@ Map properties = super.getDebugProperties(map); if (method != null) { //properties.put("method", MetaUtil.format("%H.%n(%p):%r", method)); - StackTraceElement ste = method.toStackTraceElement(bci); + StackTraceElement ste = method.asStackTraceElement(bci); if (ste.getFileName() != null && ste.getLineNumber() >= 0) { properties.put("sourceFile", ste.getFileName()); properties.put("sourceLine", ste.getLineNumber()); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IndirectCallTargetNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IndirectCallTargetNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IndirectCallTargetNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -44,7 +44,7 @@ @Override public String targetName() { if (target() instanceof JavaMethod) { - return "Indirect#" + ((JavaMethod) target()).name(); + return "Indirect#" + ((JavaMethod) target()).getName(); } else if (target() != null) { return "Indirect#" + target().getClass().getSimpleName(); } else { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MaterializeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MaterializeNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MaterializeNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -37,15 +37,15 @@ if (x.kind().isObject()) { comparison = new ObjectEqualsNode(x, y); } else { - assert x.kind().stackKind().isStackInt() || x.kind().isLong(); + assert x.kind().getStackKind().isStackInt() || x.kind().isLong(); comparison = new IntegerEqualsNode(x, y); } } else if (condition == Condition.LT) { - assert x.kind().stackKind().isStackInt() || x.kind().isLong(); + assert x.kind().getStackKind().isStackInt() || x.kind().isLong(); comparison = new IntegerLessThanNode(x, y); } else { assert condition == Condition.BT; - assert x.kind().stackKind().isStackInt() || x.kind().isLong(); + assert x.kind().getStackKind().isStackInt() || x.kind().isLong(); comparison = new IntegerBelowThanNode(x, y); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -50,7 +50,7 @@ @Override public void generate(LIRGeneratorTool gen) { - RuntimeCall call = gen.getRuntime().getRuntimeCall(UNWIND_EXCEPTION); + RuntimeCall call = gen.getRuntime().lookupRuntimeCall(UNWIND_EXCEPTION); gen.emitCall(call, call.getCallingConvention(), false, gen.operand(exception())); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -39,7 +39,7 @@ /** * The kind of this value. This is {@link Kind#Void} for instructions that produce no value. - * This kind is guaranteed to be a {@linkplain Kind#stackKind() stack kind}. + * This kind is guaranteed to be a {@linkplain Kind#getStackKind() stack kind}. */ private Stamp stamp; @@ -174,7 +174,7 @@ assertTrue(!(v.stamp() instanceof GenericStamp) || ((GenericStamp) v.stamp()).type() == GenericStampType.Dependency, "cannot depend on node with stamp %s", v.stamp()); } assertTrue(kind() != null, "Should have a valid kind"); - assertTrue(kind() == kind().stackKind(), "Should have a stack kind : %s", kind()); + assertTrue(kind() == kind().getStackKind(), "Should have a stack kind : %s", kind()); return super.verify(); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNodeUtil.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNodeUtil.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNodeUtil.java Tue Oct 09 15:23:38 2012 -0700 @@ -96,13 +96,13 @@ /** * Converts a given instruction to a value string. The representation of an node as - * a value is formed by concatenating the {@linkplain com.oracle.graal.api.meta.Kind#typeChar character} denoting its + * a value is formed by concatenating the {@linkplain com.oracle.graal.api.meta.Kind#getTypeChar character} denoting its * {@linkplain ValueNode#kind kind} and its id. For example, {@code "i13"}. * * @param value the instruction to convert to a value string. If {@code value == null}, then "-" is returned. * @return the instruction representation as a string */ public static String valueString(ValueNode value) { - return (value == null) ? "-" : ("" + value.kind().typeChar + value.toString(Verbosity.Id)); + return (value == null) ? "-" : ("" + value.kind().getTypeChar() + value.toString(Verbosity.Id)); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java Tue Oct 09 15:23:38 2012 -0700 @@ -303,8 +303,8 @@ } case Object: { switch (this) { - case EQ: return runtime.areConstantObjectsEqual(lt, rt); - case NE: return !runtime.areConstantObjectsEqual(lt, rt); + case EQ: return runtime.constantEquals(lt, rt); + case NE: return !runtime.constantEquals(lt, rt); default: throw new GraalInternalError("expected condition: %s", this); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -78,7 +78,7 @@ * @param value the instruction producing the input value */ public ConvertNode(Op opcode, ValueNode value) { - super(StampFactory.forKind(opcode.to.stackKind())); + super(StampFactory.forKind(opcode.to.getStackKind())); assert value.kind() == opcode.from : opcode + " : " + value.kind() + " != " + opcode.from; this.opcode = opcode; this.value = value; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -55,7 +55,7 @@ public void expand(BoxingMethodPool pool) { ResolvedJavaMethod boxingMethod = pool.getBoxingMethod(sourceKind); - MethodCallTargetNode callTarget = graph().add(new MethodCallTargetNode(InvokeKind.Static, boxingMethod, new ValueNode[]{source}, boxingMethod.signature().returnType(boxingMethod.holder()))); + MethodCallTargetNode callTarget = graph().add(new MethodCallTargetNode(InvokeKind.Static, boxingMethod, new ValueNode[]{source}, boxingMethod.getSignature().getReturnType(boxingMethod.getDeclaringClass()))); InvokeNode invokeNode = graph().add(new InvokeNode(callTarget, bci, -1)); invokeNode.setProbability(this.probability()); invokeNode.setStateAfter(stateAfter()); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxingMethodPool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxingMethodPool.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxingMethodPool.java Tue Oct 09 15:23:38 2012 -0700 @@ -77,19 +77,19 @@ private void initialize(Kind kind, Class type, String unboxMethod) throws SecurityException, NoSuchMethodException { // Get boxing method from runtime. - ResolvedJavaMethod boxingMethod = runtime.getResolvedJavaMethod(type.getDeclaredMethod("valueOf", kind.toJavaClass())); + ResolvedJavaMethod boxingMethod = runtime.lookupJavaMethod(type.getDeclaredMethod("valueOf", kind.toJavaClass())); specialMethods.add(boxingMethod); boxingMethods[kind.ordinal()] = boxingMethod; // Get unboxing method from runtime. - ResolvedJavaMethod unboxingMethod = runtime.getResolvedJavaMethod(type.getDeclaredMethod(unboxMethod)); + ResolvedJavaMethod unboxingMethod = runtime.lookupJavaMethod(type.getDeclaredMethod(unboxMethod)); unboxingMethods[kind.ordinal()] = unboxingMethod; specialMethods.add(unboxingMethod); // Get the field that contains the boxed value. - ResolvedJavaField[] fields = runtime.getResolvedJavaType(type).declaredFields(); + ResolvedJavaField[] fields = runtime.lookupJavaType(type).getDeclaredFields(); ResolvedJavaField boxField = fields[0]; - assert fields.length == 1 && boxField.kind() == kind; + assert fields.length == 1 && boxField.getKind() == kind; boxFields[kind.ordinal()] = boxField; } @@ -98,11 +98,11 @@ } public boolean isBoxingMethod(ResolvedJavaMethod method) { - return isSpecialMethod(method) && method.signature().returnKind() == Kind.Object; + return isSpecialMethod(method) && method.getSignature().getReturnKind() == Kind.Object; } public boolean isUnboxingMethod(ResolvedJavaMethod method) { - return isSpecialMethod(method) && method.signature().returnKind() != Kind.Object; + return isSpecialMethod(method) && method.getSignature().getReturnKind() != Kind.Object; } public ResolvedJavaMethod getBoxingMethod(Kind kind) { @@ -122,32 +122,32 @@ } public static boolean isBoxingMethodStatic(ResolvedJavaMethod method) { - Signature signature = method.signature(); - if (!Modifier.isStatic(method.accessFlags()) - || signature.returnKind() == Kind.Object - || signature.argumentCount(false) != 1) { + Signature signature = method.getSignature(); + if (!Modifier.isStatic(method.getModifiers()) + || signature.getReturnKind() == Kind.Object + || signature.getParameterCount(false) != 1) { return false; } - Kind kind = signature.argumentKindAt(0); + Kind kind = signature.getParameterKind(0); BoxingMethod boxing = boxings.get(kind); if (boxing == null) { return false; } - return method.holder().toJava() == boxing.type && method.name().equals("valueOf"); + return method.getDeclaringClass().toJava() == boxing.type && method.getName().equals("valueOf"); } public static boolean isUnboxingMethodStatic(ResolvedJavaMethod method) { - Signature signature = method.signature(); - if (signature.returnKind() == Kind.Object - || signature.argumentCount(false) != 0 - || Modifier.isStatic(method.accessFlags())) { + Signature signature = method.getSignature(); + if (signature.getReturnKind() == Kind.Object + || signature.getParameterCount(false) != 0 + || Modifier.isStatic(method.getModifiers())) { return false; } - Kind kind = signature.returnKind(); + Kind kind = signature.getReturnKind(); BoxingMethod boxing = boxings.get(kind); if (boxing == null) { return false; } - return method.holder().toJava() == boxing.type && method.name().equals(boxing.unboxMethod); + return method.getDeclaringClass().toJava() == boxing.type && method.getName().equals(boxing.unboxMethod); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -22,7 +22,7 @@ */ package com.oracle.graal.nodes.extended; -import com.oracle.graal.api.meta.JavaType.Representation; +import com.oracle.graal.api.meta.ResolvedJavaType.Representation; import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; @@ -58,7 +58,7 @@ if (stamp.isExactType()) { exactType = stamp.type(); } else if (stamp.type() != null && tool.assumptions() != null) { - exactType = stamp.type().uniqueConcreteSubtype(); + exactType = stamp.type().findUniqueConcreteSubtype(); if (exactType != null) { tool.assumptions().recordConcreteSubtype(stamp.type(), exactType); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -41,13 +41,13 @@ } public UnsafeCastNode(ValueNode object, ResolvedJavaType toType, boolean exactType, boolean nonNull) { - super(toType.kind().isObject() ? new ObjectStamp(toType, exactType, nonNull, false) : StampFactory.forKind(toType.kind())); + super(toType.getKind().isObject() ? new ObjectStamp(toType, exactType, nonNull, false) : StampFactory.forKind(toType.getKind())); this.object = object; this.toType = toType; } public UnsafeCastNode(ValueNode object, ResolvedJavaType toType) { - super(toType.kind().isObject() ? StampFactory.declared(toType, object.stamp().nonNull()) : StampFactory.forKind(toType.kind())); + super(toType.getKind().isObject() ? StampFactory.declared(toType, object.stamp().nonNull()) : StampFactory.forKind(toType.getKind())); this.object = object; this.toType = toType; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -58,7 +58,7 @@ } public UnsafeLoadNode(ValueNode object, int displacement, ValueNode offset, Kind kind) { - super(StampFactory.forKind(kind.stackKind())); + super(StampFactory.forKind(kind.getStackKind())); this.object = object; this.displacement = displacement; this.offset = offset; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -53,7 +53,7 @@ this.object = object; this.field = field; this.leafGraphId = leafGraphId; - assert field.holder().isInitialized(); + assert field.getDeclaringClass().isInitialized(); } /** @@ -73,7 +73,7 @@ * @return {@code true} if this field access is to a static field */ public boolean isStatic() { - return Modifier.isStatic(field.accessFlags()); + return Modifier.isStatic(field.getModifiers()); } /** @@ -81,7 +81,7 @@ * @return {@code true} if the field is resolved and declared volatile */ public boolean isVolatile() { - return Modifier.isVolatile(field.accessFlags()); + return Modifier.isVolatile(field.getModifiers()); } @Override @@ -92,7 +92,7 @@ @Override public String toString(Verbosity verbosity) { if (verbosity == Verbosity.Name) { - return super.toString(verbosity) + "#" + field.name(); + return super.toString(verbosity) + "#" + field.getName(); } else { return super.toString(verbosity); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -54,7 +54,7 @@ if (runtime != null && array().isConstant() && !array().isNullConstant()) { Constant constantValue = array().asConstant(); if (constantValue != null && constantValue.isNonNull()) { - return ConstantNode.forInt(runtime.getArrayLength(constantValue), graph()); + return ConstantNode.forInt(runtime.lookupArrayLength(constantValue), graph()); } } return this; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -61,7 +61,7 @@ } public CompareAndSwapNode(ValueNode object, int displacement, ValueNode offset, ValueNode expected, ValueNode newValue) { - super(StampFactory.forKind(Kind.Boolean.stackKind())); + super(StampFactory.forKind(Kind.Boolean.getStackKind())); assert expected.kind() == newValue.kind(); this.object = object; this.offset = offset; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -37,7 +37,7 @@ * Constructs a new ExceptionObject instruction. */ public ExceptionObjectNode(MetaAccessProvider runtime) { - super(StampFactory.declared(runtime.getResolvedJavaType(Throwable.class))); + super(StampFactory.declared(runtime.lookupJavaType(Throwable.class))); } @Override diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -45,9 +45,9 @@ } private static Stamp createStamp(ResolvedJavaField field) { - Kind kind = field.kind(); - if (kind == Kind.Object && field.type() instanceof ResolvedJavaType) { - return StampFactory.declared((ResolvedJavaType) field.type()); + Kind kind = field.getKind(); + if (kind == Kind.Object && field.getType() instanceof ResolvedJavaType) { + return StampFactory.declared((ResolvedJavaType) field.getType()); } else { return StampFactory.forKind(kind); } @@ -59,9 +59,9 @@ if (runtime != null) { Constant constant = null; if (isStatic()) { - constant = field().constantValue(null); + constant = field().readConstantValue(null); } else if (object().isConstant() && !object().isNullConstant()) { - constant = field().constantValue(object().asConstant()); + constant = field().readConstantValue(object().asConstant()); } if (constant != null) { return ConstantNode.forConstant(constant, runtime, graph()); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -47,7 +47,7 @@ private static Stamp createStamp(ValueNode array, Kind kind) { if (kind == Kind.Object && array.objectStamp().type() != null) { - return StampFactory.declared(array.objectStamp().type().componentType()); + return StampFactory.declared(array.objectStamp().type().getComponentType()); } else { return StampFactory.forKind(kind); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -88,7 +88,7 @@ } public Kind returnKind() { - return targetMethod().signature().returnKind(); + return targetMethod().getSignature().getReturnKind(); } public Invoke invoke() { @@ -120,7 +120,7 @@ ValueNode receiver = receiver(); if (receiver != null && receiver.objectStamp().isExactType()) { if (invokeKind == InvokeKind.Interface || invokeKind == InvokeKind.Virtual) { - ResolvedJavaMethod method = receiver.objectStamp().type().resolveMethodImpl(targetMethod); + ResolvedJavaMethod method = receiver.objectStamp().type().resolveMethod(targetMethod); if (method != null) { invokeKind = InvokeKind.Special; targetMethod = method; @@ -133,7 +133,7 @@ @Override public Stamp returnStamp() { - Kind returnKind = targetMethod.signature().returnKind(); + Kind returnKind = targetMethod.getSignature().getReturnKind(); if (returnKind == Kind.Object && returnType instanceof ResolvedJavaType) { return StampFactory.declared((ResolvedJavaType) returnType); } else { @@ -146,6 +146,6 @@ if (targetMethod() == null) { return "??Invalid!"; } - return targetMethod().name(); + return targetMethod().getName(); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -54,7 +54,7 @@ * @param locked determines whether the array should be locked immediately. */ protected NewArrayNode(ResolvedJavaType elementType, ValueNode length, boolean fillContents, boolean locked) { - super(StampFactory.exactNonNull(elementType.arrayOf())); + super(StampFactory.exactNonNull(elementType.getArrayClass())); this.length = length; this.elementType = elementType; this.fillContents = fillContents; @@ -115,7 +115,7 @@ public ValueNode[] fieldState() { ValueNode[] state = new ValueNode[constantLength]; for (int i = 0; i < constantLength; i++) { - state[i] = ConstantNode.defaultForKind(elementType().kind(), graph()); + state[i] = ConstantNode.defaultForKind(elementType().getKind(), graph()); } return state; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -85,8 +85,8 @@ private void fillEscapeFields(ResolvedJavaType type, List escapeFields) { if (type != null) { - fillEscapeFields(type.superType(), escapeFields); - for (ResolvedJavaField field : type.declaredFields()) { + fillEscapeFields(type.getSuperclass(), escapeFields); + for (ResolvedJavaField field : type.getDeclaredFields()) { escapeFields.add(field); } } @@ -105,7 +105,7 @@ public ValueNode[] fieldState() { ValueNode[] state = new ValueNode[fields.length]; for (int i = 0; i < state.length; i++) { - state[i] = ConstantNode.defaultForKind(fields[i].type().kind(), graph()); + state[i] = ConstantNode.defaultForKind(fields[i].getType().getKind(), graph()); } return state; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -49,7 +49,7 @@ @Override public void generate(LIRGeneratorTool gen) { - RuntimeCall call = gen.getRuntime().getRuntimeCall(REGISTER_FINALIZER); + RuntimeCall call = gen.getRuntime().lookupRuntimeCall(REGISTER_FINALIZER); gen.emitCall(call, call.getCallingConvention(), true, gen.operand(object())); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -25,7 +25,7 @@ import java.util.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.meta.JavaType.*; +import com.oracle.graal.api.meta.ResolvedJavaType.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; @@ -81,7 +81,7 @@ for (int i = 0; i < keyCount(); i++) { Constant typeHub = keyAt(i); assert constant.getKind() == typeHub.getKind(); - if (tool.runtime().areConstantObjectsEqual(value().asConstant(), typeHub)) { + if (tool.runtime().constantEquals(value().asConstant(), typeHub)) { survivingEdge = keySuccessorIndex(i); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/FloatStamp.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/FloatStamp.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/FloatStamp.java Tue Oct 09 15:23:38 2012 -0700 @@ -73,7 +73,7 @@ @Override public String toString() { StringBuilder str = new StringBuilder(); - str.append(kind().typeChar); + str.append(kind().getTypeChar()); str.append(nonNaN ? "!" : ""); if (lowerBound == upperBound) { str.append(" [").append(lowerBound).append(']'); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/IntegerStamp.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/IntegerStamp.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/IntegerStamp.java Tue Oct 09 15:23:38 2012 -0700 @@ -109,7 +109,7 @@ @Override public String toString() { StringBuilder str = new StringBuilder(); - str.append(kind().typeChar); + str.append(kind().getTypeChar()); if (lowerBound == upperBound) { str.append(" [").append(lowerBound).append(']'); } else if (lowerBound != kind().getMinValue() || upperBound != kind().getMaxValue()) { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java Tue Oct 09 15:23:38 2012 -0700 @@ -62,8 +62,8 @@ @Override public String toString() { StringBuilder str = new StringBuilder(); - str.append(kind().typeChar); - str.append(nonNull ? "!" : "").append(exactType ? "#" : "").append(' ').append(type == null ? "-" : type.name()).append(alwaysNull ? " NULL" : ""); + str.append(kind().getTypeChar()); + str.append(nonNull ? "!" : "").append(exactType ? "#" : "").append(' ').append(type == null ? "-" : type.getName()).append(alwaysNull ? " NULL" : ""); return str.toString(); } @@ -160,7 +160,7 @@ } else if (a == null || b == null) { return null; } else { - return a.leastCommonAncestor(b); + return a.findLeastCommonAncestor(b); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java Tue Oct 09 15:23:38 2012 -0700 @@ -66,8 +66,8 @@ } public static Stamp forKind(Kind kind) { - assert stampCache[kind.stackKind().ordinal()] != null : "unexpected forKind(" + kind + ")"; - return stampCache[kind.stackKind().ordinal()]; + assert stampCache[kind.getStackKind().ordinal()] != null : "unexpected forKind(" + kind + ")"; + return stampCache[kind.getStackKind().ordinal()]; } public static Stamp forVoid() { @@ -134,14 +134,14 @@ } else if (value.getKind() == Kind.Float || value.getKind() == Kind.Double) { return forFloat(value.getKind(), value.asDouble(), value.asDouble(), !Double.isNaN(value.asDouble())); } - return forKind(value.getKind().stackKind()); + return forKind(value.getKind().getStackKind()); } } public static Stamp forConstant(Constant value, MetaAccessProvider runtime) { assert value.getKind() == Kind.Object; if (value.getKind() == Kind.Object) { - ResolvedJavaType type = value.isNull() ? null : runtime.getTypeOf(value); + ResolvedJavaType type = value.isNull() ? null : runtime.lookupJavaType(value); return new ObjectStamp(type, value.isNonNull(), value.isNonNull(), value.isNull()); } else { throw new GraalInternalError(Kind.Object + " expected, actual kind: %s", value.getKind()); @@ -170,8 +170,8 @@ public static Stamp declared(ResolvedJavaType type, boolean nonNull) { assert type != null; - assert type.kind() == Kind.Object; - ResolvedJavaType exact = type.exactType(); + assert type.getKind() == Kind.Object; + ResolvedJavaType exact = type.getExactType(); if (exact != null) { return new ObjectStamp(exact, true, nonNull, false); } else { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java Tue Oct 09 15:23:38 2012 -0700 @@ -186,7 +186,7 @@ if (fromStamp.upperBound() > toKind.getMaxValue()) { lowerBound = toKind.getMinValue(); } - return StampFactory.forInteger(toKind.stackKind(), lowerBound, upperBound, mask); + return StampFactory.forInteger(toKind.getStackKind(), lowerBound, upperBound, mask); } public static Stamp intToByte(IntegerStamp intStamp) { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/WordStamp.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/WordStamp.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/WordStamp.java Tue Oct 09 15:23:38 2012 -0700 @@ -44,7 +44,7 @@ @Override public String toString() { StringBuilder str = new StringBuilder(); - str.append(kind().typeChar); + str.append(kind().getTypeChar()); str.append(nonNull ? "!" : ""); return str.toString(); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java Tue Oct 09 15:23:38 2012 -0700 @@ -198,7 +198,7 @@ if (stateAfter != null) { ResolvedJavaMethod method = stateAfter.method(); if (method != null) { - StackTraceElement stackTraceElement = method.toStackTraceElement(stateAfter.bci); + StackTraceElement stackTraceElement = method.asStackTraceElement(stateAfter.bci); if (stackTraceElement.getFileName() != null && stackTraceElement.getLineNumber() >= 0) { return stackTraceElement.getFileName() + ":" + stackTraceElement.getLineNumber(); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualArrayNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualArrayNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -40,7 +40,7 @@ @Override public ResolvedJavaType type() { - return componentType.arrayOf(); + return componentType.getArrayClass(); } public ResolvedJavaType componentType() { @@ -60,7 +60,7 @@ @Override public String toString(Verbosity verbosity) { if (verbosity == Verbosity.Name) { - return super.toString(Verbosity.Name) + " " + componentType.name() + "[" + length + "]"; + return super.toString(Verbosity.Name) + " " + componentType.getName() + "[" + length + "]"; } else { return super.toString(verbosity); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -68,7 +68,7 @@ @Override public Object fieldName(int index) { - return fields[index].name(); + return fields[index].getName(); } public int fieldIndex(ResolvedJavaField field) { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CheckCastEliminationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CheckCastEliminationPhase.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CheckCastEliminationPhase.java Tue Oct 09 15:23:38 2012 -0700 @@ -229,7 +229,7 @@ } else if (a == b) { return a; } else { - return a.leastCommonAncestor(b); + return a.findLeastCommonAncestor(b); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IdentifyBoxingPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IdentifyBoxingPhase.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IdentifyBoxingPhase.java Tue Oct 09 15:23:38 2012 -0700 @@ -61,12 +61,12 @@ Node newNode = null; if (returnKind == Kind.Object) { // We have a boxing method here. - assert Modifier.isStatic(targetMethod.accessFlags()) : "boxing method must be static"; - Kind sourceKind = targetMethod.signature().argumentKindAt(0); - newNode = invoke.graph().add(new BoxNode(sourceValue, targetMethod.holder(), sourceKind, invoke.bci())); + assert Modifier.isStatic(targetMethod.getModifiers()) : "boxing method must be static"; + Kind sourceKind = targetMethod.getSignature().getParameterKind(0); + newNode = invoke.graph().add(new BoxNode(sourceValue, targetMethod.getDeclaringClass(), sourceKind, invoke.bci())); } else { // We have an unboxing method here. - assert !Modifier.isStatic(targetMethod.accessFlags()) : "unboxing method must be an instance method"; + assert !Modifier.isStatic(targetMethod.getModifiers()) : "unboxing method must be an instance method"; newNode = invoke.graph().add(new UnboxNode(returnKind, sourceValue)); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Tue Oct 09 15:23:38 2012 -0700 @@ -358,9 +358,9 @@ double maxSize = GraalOptions.MaximumGreedyInlineSize; if (GraalOptions.InliningBonusPerTransferredValue != 0) { - Signature signature = info.invoke.methodCallTarget().targetMethod().signature(); - int transferredValues = signature.argumentCount(!Modifier.isStatic(info.invoke.methodCallTarget().targetMethod().accessFlags())); - if (signature.returnKind() != Kind.Void) { + Signature signature = info.invoke.methodCallTarget().targetMethod().getSignature(); + int transferredValues = signature.getParameterCount(!Modifier.isStatic(info.invoke.methodCallTarget().targetMethod().getModifiers())); + if (signature.getReturnKind() != Kind.Void) { transferredValues++; } maxSize += transferredValues * GraalOptions.InliningBonusPerTransferredValue; @@ -399,7 +399,7 @@ private static class BytecodeSizeBasedWeightComputationPolicy implements WeightComputationPolicy { @Override public double computeWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke, boolean preferredInvoke) { - double codeSize = method.codeSize(); + double codeSize = method.getCodeSize(); if (preferredInvoke) { codeSize = codeSize / GraalOptions.BoostInliningForEscapeAnalysis; } @@ -410,7 +410,7 @@ private static class ComplexityBasedWeightComputationPolicy implements WeightComputationPolicy { @Override public double computeWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke, boolean preferredInvoke) { - double complexity = method.compilationComplexity(); + double complexity = method.getCompilationComplexity(); if (preferredInvoke) { complexity = complexity / GraalOptions.BoostInliningForEscapeAnalysis; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Tue Oct 09 15:23:38 2012 -0700 @@ -28,7 +28,7 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.meta.JavaType.Representation; +import com.oracle.graal.api.meta.ResolvedJavaType.Representation; import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; @@ -58,9 +58,9 @@ if (!Debug.isLogEnabled()) { return null; } else if (invoke != null && invoke.stateAfter() != null) { - return methodName(invoke.stateAfter(), invoke.bci()) + ": " + MetaUtil.format("%H.%n(%p):%r", method) + " (" + method.codeSize() + " bytes)"; + return methodName(invoke.stateAfter(), invoke.bci()) + ": " + MetaUtil.format("%H.%n(%p):%r", method) + " (" + method.getCodeSize() + " bytes)"; } else { - return MetaUtil.format("%H.%n(%p):%r", method) + " (" + method.codeSize() + " bytes)"; + return MetaUtil.format("%H.%n(%p):%r", method) + " (" + method.getCodeSize() + " bytes)"; } } @@ -152,7 +152,7 @@ @Override public int compiledCodeSize() { - return concrete.compiledCodeSize(); + return concrete.getCompiledCodeSize(); } @Override @@ -182,7 +182,7 @@ @Override public int compiledCodeSize() { - return concrete.compiledCodeSize(); + return concrete.getCompiledCodeSize(); } @Override @@ -247,7 +247,7 @@ public int compiledCodeSize() { int result = 0; for (ResolvedJavaMethod m: concretes) { - result += m.compiledCodeSize(); + result += m.getCompiledCodeSize(); } return result; } @@ -308,7 +308,7 @@ for (int j = 0; j < typesToConcretes.length; j++) { if (typesToConcretes[j] == i) { predecessors++; - probability += ptypes[j].probability; + probability += ptypes[j].getProbability(); } } @@ -405,9 +405,9 @@ for (int i = 0; i < typesToConcretes.length; i++) { if (typesToConcretes[i] == concreteMethodIndex) { if (commonType == null) { - commonType = ptypes[i].type; + commonType = ptypes[i].getType(); } else { - commonType = commonType.leastCommonAncestor(ptypes[i].type); + commonType = commonType.findLeastCommonAncestor(ptypes[i].getType()); } } } @@ -445,8 +445,8 @@ BeginNode[] successors = new BeginNode[ptypes.length + 1]; int[] keySuccessors = new int[ptypes.length + 1]; for (int i = 0; i < ptypes.length; i++) { - types[i] = ptypes[i].type; - probabilities[i] = ptypes[i].probability; + types[i] = ptypes[i].getType(); + probabilities[i] = ptypes[i].getProbability(); FixedNode entry = calleeEntryNodes[typesToConcretes[i]]; if (entry instanceof MergeNode) { EndNode endNode = graph.add(new EndNode()); @@ -609,15 +609,15 @@ ObjectStamp receiverStamp = callTarget.receiver().objectStamp(); ResolvedJavaType receiverType = receiverStamp.type(); if (receiverStamp.isExactType()) { - assert receiverType.isSubtypeOf(targetMethod.holder()) : receiverType + " subtype of " + targetMethod.holder() + " for " + targetMethod; - ResolvedJavaMethod resolved = receiverType.resolveMethodImpl(targetMethod); + assert receiverType.isSubtypeOf(targetMethod.getDeclaringClass()) : receiverType + " subtype of " + targetMethod.getDeclaringClass() + " for " + targetMethod; + ResolvedJavaMethod resolved = receiverType.resolveMethod(targetMethod); if (checkTargetConditions(invoke, resolved, optimisticOpts)) { double weight = callback == null ? 0 : callback.inliningWeight(parent, resolved, invoke); return new ExactInlineInfo(invoke, weight, level, resolved); } return null; } - ResolvedJavaType holder = targetMethod.holder(); + ResolvedJavaType holder = targetMethod.getDeclaringClass(); if (receiverStamp.type() != null) { // the invoke target might be more specific than the holder (happens after inlining: locals lose their declared type...) @@ -628,7 +628,7 @@ } // TODO (thomaswue) fix this if (assumptions != null) { - ResolvedJavaMethod concrete = holder.uniqueConcreteMethod(targetMethod); + ResolvedJavaMethod concrete = holder.findUniqueConcreteMethod(targetMethod); if (concrete != null) { if (checkTargetConditions(invoke, concrete, optimisticOpts)) { double weight = callback == null ? 0 : callback.inliningWeight(parent, concrete, invoke); @@ -643,7 +643,7 @@ } private static InlineInfo getTypeCheckedInlineInfo(Invoke invoke, int level, InliningCallback callback, ResolvedJavaMethod parent, ResolvedJavaMethod targetMethod, OptimisticOptimizations optimisticOpts) { - ProfilingInfo profilingInfo = parent.profilingInfo(); + ProfilingInfo profilingInfo = parent.getProfilingInfo(); JavaTypeProfile typeProfile = profilingInfo.getTypeProfile(invoke.bci()); if (typeProfile != null) { ProfiledType[] ptypes = typeProfile.getTypes(); @@ -652,8 +652,8 @@ double notRecordedTypeProbability = typeProfile.getNotRecordedProbability(); if (ptypes.length == 1 && notRecordedTypeProbability == 0) { if (optimisticOpts.inlineMonomorphicCalls()) { - ResolvedJavaType type = ptypes[0].type; - ResolvedJavaMethod concrete = type.resolveMethodImpl(targetMethod); + ResolvedJavaType type = ptypes[0].getType(); + ResolvedJavaMethod concrete = type.resolveMethod(targetMethod); if (checkTargetConditions(invoke, concrete, optimisticOpts)) { double weight = callback == null ? 0 : callback.inliningWeight(parent, concrete, invoke); return new TypeGuardInlineInfo(invoke, weight, level, concrete, type); @@ -680,7 +680,7 @@ ArrayList concreteMethods = new ArrayList<>(); int[] typesToConcretes = new int[ptypes.length]; for (int i = 0; i < ptypes.length; i++) { - ResolvedJavaMethod concrete = ptypes[i].type.resolveMethodImpl(targetMethod); + ResolvedJavaMethod concrete = ptypes[i].getType().resolveMethod(targetMethod); int index = concreteMethods.indexOf(concrete); if (index < 0) { @@ -756,15 +756,15 @@ return false; } ResolvedJavaMethod resolvedMethod = (ResolvedJavaMethod) method; - if (Modifier.isNative(resolvedMethod.accessFlags())) { + if (Modifier.isNative(resolvedMethod.getModifiers())) { Debug.log("not inlining %s because it is a native method", methodName(resolvedMethod, invoke)); return false; } - if (Modifier.isAbstract(resolvedMethod.accessFlags())) { + if (Modifier.isAbstract(resolvedMethod.getModifiers())) { Debug.log("not inlining %s because it is an abstract method", methodName(resolvedMethod, invoke)); return false; } - if (!resolvedMethod.holder().isInitialized()) { + if (!resolvedMethod.getDeclaringClass().isInitialized()) { Debug.log("not inlining %s because of non-initialized class", methodName(resolvedMethod, invoke)); return false; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IntrinsificationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IntrinsificationPhase.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IntrinsificationPhase.java Tue Oct 09 15:23:38 2012 -0700 @@ -67,7 +67,7 @@ } private static StructuredGraph getIntrinsicGraph(Invoke invoke, ResolvedJavaMethod target, GraalCodeCacheProvider runtime) { - StructuredGraph intrinsicGraph = (StructuredGraph) target.compilerStorage().get(Graph.class); + StructuredGraph intrinsicGraph = (StructuredGraph) target.getCompilerStorage().get(Graph.class); if (intrinsicGraph == null) { // TODO remove once all intrinsics are available via compilerStorage intrinsicGraph = runtime.intrinsicGraph(invoke.stateAfter().method(), invoke.bci(), target, invoke.callTarget().arguments()); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/OptimisticOptimizations.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/OptimisticOptimizations.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/OptimisticOptimizations.java Tue Oct 09 15:23:38 2012 -0700 @@ -46,7 +46,7 @@ public OptimisticOptimizations(ResolvedJavaMethod method) { this.enabledOpts = EnumSet.noneOf(Optimization.class); - ProfilingInfo profilingInfo = method.profilingInfo(); + ProfilingInfo profilingInfo = method.getProfilingInfo(); if (checkDeoptimizations(profilingInfo, DeoptimizationReason.UnreachedCode)) { enabledOpts.add(Optimization.RemoveNeverExecutedCode); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java Tue Oct 09 15:23:38 2012 -0700 @@ -288,27 +288,27 @@ } else if (object instanceof ResolvedJavaMethod) { writeByte(POOL_METHOD); ResolvedJavaMethod method = ((ResolvedJavaMethod) object); - writePoolObject(method.holder()); - writePoolObject(method.name()); - writePoolObject(method.signature()); - writeInt(method.accessFlags()); - writeBytes(method.code()); + writePoolObject(method.getDeclaringClass()); + writePoolObject(method.getName()); + writePoolObject(method.getSignature()); + writeInt(method.getModifiers()); + writeBytes(method.getCode()); } else if (object instanceof ResolvedJavaField) { writeByte(POOL_FIELD); ResolvedJavaField field = ((ResolvedJavaField) object); - writePoolObject(field.holder()); - writePoolObject(field.name()); - writePoolObject(field.type().name()); - writeInt(field.accessFlags()); + writePoolObject(field.getDeclaringClass()); + writePoolObject(field.getName()); + writePoolObject(field.getType().getName()); + writeInt(field.getModifiers()); } else if (object instanceof Signature) { writeByte(POOL_SIGNATURE); Signature signature = ((Signature) object); - int args = signature.argumentCount(false); + int args = signature.getParameterCount(false); writeShort((char) args); for (int i = 0; i < args; i++) { - writePoolObject(signature.argumentTypeAt(i, null).name()); + writePoolObject(signature.getParameterType(i, null).getName()); } - writePoolObject(signature.returnType(null).name()); + writePoolObject(signature.getReturnType(null).getName()); } else { writeByte(POOL_STRING); writeString(object.toString()); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Tue Oct 09 15:23:38 2012 -0700 @@ -476,7 +476,7 @@ if (value.kind() == Kind.Illegal) { prefix = "v"; } else { - prefix = String.valueOf(value.kind().typeChar); + prefix = String.valueOf(value.kind().getTypeChar()); } } else { prefix = "?"; @@ -512,10 +512,10 @@ private void printInterval(Interval interval) { out.printf("%s %s ", interval.operand, (isRegister(interval.operand) ? "fixed" : interval.kind().name())); if (isRegister(interval.operand)) { - out.printf("\"[%s|%c]\"", interval.operand, interval.operand.getKind().typeChar); + out.printf("\"[%s|%c]\"", interval.operand, interval.operand.getKind().getTypeChar()); } else { if (interval.location() != null) { - out.printf("\"[%s|%c]\"", interval.location(), interval.location().getKind().typeChar); + out.printf("\"[%s|%c]\"", interval.location(), interval.location().getKind().getTypeChar()); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Tue Oct 09 15:23:38 2012 -0700 @@ -136,7 +136,7 @@ if (object instanceof BciBlockMapping) { BciBlockMapping blockMap = (BciBlockMapping) object; cfgPrinter.printCFG(message, blockMap); - if (blockMap.method.code() != null) { + if (blockMap.method.getCode() != null) { cfgPrinter.printBytecodes(new BytecodeDisassembler(false).disassemble(blockMap.method)); } @@ -151,15 +151,15 @@ } else if (object instanceof CompilationResult) { final CompilationResult tm = (CompilationResult) object; - final byte[] code = Arrays.copyOf(tm.targetCode(), tm.targetCodeSize()); + final byte[] code = Arrays.copyOf(tm.getTargetCode(), tm.getTargetCodeSize()); CodeInfo info = new CodeInfo() { - public ResolvedJavaMethod method() { + public ResolvedJavaMethod getMethod() { return null; } - public long start() { + public long getStart() { return 0L; } - public byte[] code() { + public byte[] getCode() { return code; } }; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java Tue Oct 09 15:23:38 2012 -0700 @@ -165,9 +165,9 @@ for (int i = 0; i < virtualObjects.size(); i++) { VirtualObject obj = virtualObjects.get(i); - sb.append(obj).append(" ").append(obj.type().name()).append(" "); - for (int j = 0; j < obj.values().length; j++) { - sb.append(valueToString(obj.values()[j], virtualObjects)).append(' '); + sb.append(obj).append(" ").append(obj.getType().getName()).append(" "); + for (int j = 0; j < obj.getValues().length; j++) { + sb.append(valueToString(obj.getValues()[j], virtualObjects)).append(' '); } sb.append("\n"); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java Tue Oct 09 15:23:38 2012 -0700 @@ -59,7 +59,7 @@ printProperty("name", name); endProperties(); beginMethod(name, shortName, bci); - if (method != null && method.code() != null) { + if (method != null && method.getCode() != null) { printBytecodes(new BytecodeDisassembler(false).disassemble(method)); } endMethod(); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewMultiArrayTest.java --- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewMultiArrayTest.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewMultiArrayTest.java Tue Oct 09 15:23:38 2012 -0700 @@ -65,7 +65,7 @@ } private static int rank(ResolvedJavaType type) { - String name = type.name(); + String name = type.getName(); int dims = 0; while (dims < name.length() && name.charAt(dims) == '[') { dims++; @@ -116,11 +116,11 @@ @Test public void test1() { for (Class clazz : new Class[] {byte.class, char.class, short.class, int.class, float.class, long.class, double.class, String.class}) { - bottomType = runtime.getResolvedJavaType(clazz); + bottomType = runtime.lookupJavaType(clazz); arrayType = bottomType; for (int rank : new int[] {1, 2, 10, 50, 100, 200, 254, 255}) { while (rank(arrayType) != rank) { - arrayType = arrayType.arrayOf(); + arrayType = arrayType.getArrayClass(); } dimensions = new int[rank]; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/TypeCheckTest.java --- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/TypeCheckTest.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/TypeCheckTest.java Tue Oct 09 15:23:38 2012 -0700 @@ -53,7 +53,7 @@ } ProfiledType[] ptypes = new ProfiledType[types.length]; for (int i = 0; i < types.length; i++) { - ptypes[i] = new ProfiledType(runtime.getResolvedJavaType(types[i]), 1.0D / types.length); + ptypes[i] = new ProfiledType(runtime.lookupJavaType(types[i]), 1.0D / types.length); } return new JavaTypeProfile(0.0D, ptypes); } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/WordTest.java --- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/WordTest.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/WordTest.java Tue Oct 09 15:23:38 2012 -0700 @@ -50,7 +50,7 @@ @Override protected StructuredGraph parse(Method m) { - ResolvedJavaMethod resolvedMethod = runtime.getResolvedJavaMethod(m); + ResolvedJavaMethod resolvedMethod = runtime.lookupJavaMethod(m); return installer.makeGraph(resolvedMethod, inliningPolicy.get()); } @@ -116,7 +116,7 @@ public void test_fromObject() { inliningPolicy.set(new InliningPolicy() { public boolean shouldInline(ResolvedJavaMethod method, ResolvedJavaMethod caller) { - return InliningPolicy.Default.shouldInline(method, caller) && !method.name().equals("hashCode"); + return InliningPolicy.Default.shouldInline(method, caller) && !method.getName().equals("hashCode"); } }); test("fromToObject", "object1", "object2"); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Log.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Log.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Log.java Tue Oct 09 15:23:38 2012 -0700 @@ -56,27 +56,27 @@ private static native void printf(@ConstantNodeParameter Descriptor logPrintf, String format, long value); public static void print(boolean value) { - log(LOG_PRIMITIVE, Kind.Boolean.typeChar, value ? 1L : 0L, false); + log(LOG_PRIMITIVE, Kind.Boolean.getTypeChar(), value ? 1L : 0L, false); } public static void print(byte value) { - log(LOG_PRIMITIVE, Kind.Byte.typeChar, value, false); + log(LOG_PRIMITIVE, Kind.Byte.getTypeChar(), value, false); } public static void print(char value) { - log(LOG_PRIMITIVE, Kind.Char.typeChar, value, false); + log(LOG_PRIMITIVE, Kind.Char.getTypeChar(), value, false); } public static void print(short value) { - log(LOG_PRIMITIVE, Kind.Short.typeChar, value, false); + log(LOG_PRIMITIVE, Kind.Short.getTypeChar(), value, false); } public static void print(int value) { - log(LOG_PRIMITIVE, Kind.Int.typeChar, value, false); + log(LOG_PRIMITIVE, Kind.Int.getTypeChar(), value, false); } public static void print(long value) { - log(LOG_PRIMITIVE, Kind.Long.typeChar, value, false); + log(LOG_PRIMITIVE, Kind.Long.getTypeChar(), value, false); } /** @@ -97,7 +97,7 @@ } else if (value == Float.NEGATIVE_INFINITY) { print("-Infinity"); } else { - log(LOG_PRIMITIVE, Kind.Float.typeChar, Float.floatToRawIntBits(value), false); + log(LOG_PRIMITIVE, Kind.Float.getTypeChar(), Float.floatToRawIntBits(value), false); } } @@ -109,7 +109,7 @@ } else if (value == Double.NEGATIVE_INFINITY) { print("-Infinity"); } else { - log(LOG_PRIMITIVE, Kind.Double.typeChar, Double.doubleToRawLongBits(value), false); + log(LOG_PRIMITIVE, Kind.Double.getTypeChar(), Double.doubleToRawLongBits(value), false); } } @@ -126,27 +126,27 @@ } public static void println(boolean value) { - log(LOG_PRIMITIVE, Kind.Boolean.typeChar, value ? 1L : 0L, true); + log(LOG_PRIMITIVE, Kind.Boolean.getTypeChar(), value ? 1L : 0L, true); } public static void println(byte value) { - log(LOG_PRIMITIVE, Kind.Byte.typeChar, value, true); + log(LOG_PRIMITIVE, Kind.Byte.getTypeChar(), value, true); } public static void println(char value) { - log(LOG_PRIMITIVE, Kind.Char.typeChar, value, true); + log(LOG_PRIMITIVE, Kind.Char.getTypeChar(), value, true); } public static void println(short value) { - log(LOG_PRIMITIVE, Kind.Short.typeChar, value, true); + log(LOG_PRIMITIVE, Kind.Short.getTypeChar(), value, true); } public static void println(int value) { - log(LOG_PRIMITIVE, Kind.Int.typeChar, value, true); + log(LOG_PRIMITIVE, Kind.Int.getTypeChar(), value, true); } public static void println(long value) { - log(LOG_PRIMITIVE, Kind.Long.typeChar, value, true); + log(LOG_PRIMITIVE, Kind.Long.getTypeChar(), value, true); } public static void println(float value) { @@ -157,7 +157,7 @@ } else if (value == Float.NEGATIVE_INFINITY) { println("-Infinity"); } else { - log(LOG_PRIMITIVE, Kind.Float.typeChar, Float.floatToRawIntBits(value), true); + log(LOG_PRIMITIVE, Kind.Float.getTypeChar(), Float.floatToRawIntBits(value), true); } } @@ -169,7 +169,7 @@ } else if (value == Double.NEGATIVE_INFINITY) { println("-Infinity"); } else { - log(LOG_PRIMITIVE, Kind.Double.typeChar, Double.doubleToRawLongBits(value), true); + log(LOG_PRIMITIVE, Kind.Double.getTypeChar(), Double.doubleToRawLongBits(value), true); } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Snippet.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Snippet.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Snippet.java Tue Oct 09 15:23:38 2012 -0700 @@ -70,7 +70,7 @@ */ InliningPolicy Default = new InliningPolicy() { public boolean shouldInline(ResolvedJavaMethod method, ResolvedJavaMethod caller) { - if (Modifier.isNative(method.accessFlags())) { + if (Modifier.isNative(method.getModifiers())) { return false; } if (method.getAnnotation(Fold.class) != null) { @@ -79,8 +79,8 @@ if (method.getAnnotation(NodeIntrinsic.class) != null) { return false; } - if (Throwable.class.isAssignableFrom(method.holder().toJava())) { - if (method.name().equals("")) { + if (Throwable.class.isAssignableFrom(method.getDeclaringClass().toJava())) { + if (method.getName().equals("")) { return false; } } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetInstaller.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetInstaller.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetInstaller.java Tue Oct 09 15:23:38 2012 -0700 @@ -66,7 +66,7 @@ /** * Finds all the snippet methods in a given class, builds a graph for them and * installs the graph with the key value of {@code Graph.class} in the - * {@linkplain ResolvedJavaMethod#compilerStorage() compiler storage} of each method. + * {@linkplain ResolvedJavaMethod#getCompilerStorage() compiler storage} of each method. *

    * If {@code snippetsHolder} is annotated with {@link ClassSubstitution}, then all * methods in the class are snippets. Otherwise, the snippets are those methods @@ -87,11 +87,11 @@ if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) { throw new RuntimeException("Snippet must not be abstract or native"); } - ResolvedJavaMethod snippet = runtime.getResolvedJavaMethod(method); - assert snippet.compilerStorage().get(Graph.class) == null; + ResolvedJavaMethod snippet = runtime.lookupJavaMethod(method); + assert snippet.getCompilerStorage().get(Graph.class) == null; StructuredGraph graph = makeGraph(snippet, inliningPolicy(snippet)); //System.out.println("snippet: " + graph); - snippet.compilerStorage().put(Graph.class, graph); + snippet.getCompilerStorage().put(Graph.class, graph); } } } @@ -110,10 +110,10 @@ if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) { throw new RuntimeException("Snippet must not be abstract or native"); } - ResolvedJavaMethod snippet = runtime.getResolvedJavaMethod(method); + ResolvedJavaMethod snippet = runtime.lookupJavaMethod(method); StructuredGraph graph = makeGraph(snippet, inliningPolicy(snippet)); //System.out.println("snippet: " + graph); - runtime.getResolvedJavaMethod(originalMethod).compilerStorage().put(Graph.class, graph); + runtime.lookupJavaMethod(originalMethod).getCompilerStorage().put(Graph.class, graph); } catch (NoSuchMethodException e) { throw new GraalInternalError("Could not resolve method in " + originalClazz + " to substitute with " + method, e); } @@ -141,7 +141,7 @@ new SnippetIntrinsificationPhase(runtime, pool, SnippetTemplate.hasConstantParameter(method)).apply(graph); - Debug.dump(graph, "%s: Final", method.name()); + Debug.dump(graph, "%s: Final", method.getName()); return graph; } @@ -165,7 +165,7 @@ GraphBuilderPhase graphBuilder = new GraphBuilderPhase(runtime, config, OptimisticOptimizations.NONE); graphBuilder.apply(graph); - Debug.dump(graph, "%s: %s", method.name(), GraphBuilderPhase.class.getSimpleName()); + Debug.dump(graph, "%s: %s", method.getName(), GraphBuilderPhase.class.getSimpleName()); new SnippetVerificationPhase().apply(graph); @@ -179,7 +179,7 @@ InliningUtil.inline(invoke, targetGraph, true); Debug.dump(graph, "after inlining %s", callee); if (GraalOptions.OptCanonicalizer) { - new WordTypeRewriterPhase(target.wordKind, runtime.getResolvedJavaType(target.wordKind)).apply(graph); + new WordTypeRewriterPhase(target.wordKind, runtime.lookupJavaType(target.wordKind.toJavaClass())).apply(graph); new CanonicalizerPhase(target, runtime, null).apply(graph); } } @@ -187,7 +187,7 @@ new SnippetIntrinsificationPhase(runtime, pool, true).apply(graph); - new WordTypeRewriterPhase(target.wordKind, runtime.getResolvedJavaType(target.wordKind)).apply(graph); + new WordTypeRewriterPhase(target.wordKind, runtime.lookupJavaType(target.wordKind.toJavaClass())).apply(graph); new DeadCodeEliminationPhase().apply(graph); if (GraalOptions.OptCanonicalizer) { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetIntrinsificationPhase.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetIntrinsificationPhase.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetIntrinsificationPhase.java Tue Oct 09 15:23:38 2012 -0700 @@ -84,10 +84,10 @@ NodeIntrinsic intrinsic = target.getAnnotation(Node.NodeIntrinsic.class); if (intrinsic != null) { assert target.getAnnotation(Fold.class) == null; - assert Modifier.isNative(target.accessFlags()) : "node intrinsic " + target + " should be native"; + assert Modifier.isNative(target.getModifiers()) : "node intrinsic " + target + " should be native"; - Class< ? >[] parameterTypes = MetaUtil.signatureToTypes(target.signature(), target.holder()); - ResolvedJavaType returnType = (ResolvedJavaType) target.signature().returnType(target.holder()); + Class< ? >[] parameterTypes = MetaUtil.signatureToTypes(target.getSignature(), target.getDeclaringClass()); + ResolvedJavaType returnType = (ResolvedJavaType) target.getSignature().getReturnType(target.getDeclaringClass()); // Prepare the arguments for the reflective constructor call on the node class. Object[] nodeConstructorArguments = prepareArguments(invoke, parameterTypes, target, false); @@ -103,7 +103,7 @@ // Clean up checkcast instructions inserted by javac if the return type is generic. cleanUpReturnCheckCast(newInstance); } else if (target.getAnnotation(Fold.class) != null) { - Class< ? >[] parameterTypes = MetaUtil.signatureToTypes(target.signature(), target.holder()); + Class< ? >[] parameterTypes = MetaUtil.signatureToTypes(target.getSignature(), target.getDeclaringClass()); // Prepare the arguments for the reflective method call Object[] arguments = prepareArguments(invoke, parameterTypes, target, true); @@ -114,7 +114,7 @@ } // Call the method - Constant constant = callMethod(target.signature().returnKind(), target.holder().toJava(), target.name(), parameterTypes, receiver, arguments); + Constant constant = callMethod(target.getSignature().getReturnKind(), target.getDeclaringClass().toJava(), target.getName(), parameterTypes, receiver, arguments); if (constant != null) { // Replace the invoke with the result of the call @@ -151,9 +151,9 @@ } ConstantNode constantNode = (ConstantNode) argument; Constant constant = constantNode.asConstant(); - Object o = constant.boxedValue(); + Object o = constant.asBoxedValue(); if (o instanceof Class< ? >) { - reflectionCallArguments[i] = runtime.getResolvedJavaType((Class< ? >) o); + reflectionCallArguments[i] = runtime.lookupJavaType((Class< ? >) o); parameterTypes[i] = ResolvedJavaType.class; } else { if (parameterTypes[i] == boolean.class) { @@ -179,7 +179,7 @@ private static Class< ? > getNodeClass(ResolvedJavaMethod target, NodeIntrinsic intrinsic) { Class< ? > result = intrinsic.value(); if (result == NodeIntrinsic.class) { - result = target.holder().toJava(); + result = target.getDeclaringClass().toJava(); } assert Node.class.isAssignableFrom(result); return result; @@ -307,10 +307,10 @@ try { ValueNode intrinsicNode = (ValueNode) constructor.newInstance(arguments); if (setStampFromReturnType) { - if (returnType.kind().isObject()) { + if (returnType.getKind().isObject()) { intrinsicNode.setStamp(StampFactory.declared(returnType)); } else { - intrinsicNode.setStamp(StampFactory.forKind(returnType.kind())); + intrinsicNode.setStamp(StampFactory.forKind(returnType.getKind())); } } return intrinsicNode; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java Tue Oct 09 15:23:38 2012 -0700 @@ -190,7 +190,7 @@ protected ResolvedJavaMethod snippet(String name, Class... parameterTypes) { try { - ResolvedJavaMethod snippet = runtime.getResolvedJavaMethod(snippetsClass.getDeclaredMethod(name, parameterTypes)); + ResolvedJavaMethod snippet = runtime.lookupJavaMethod(snippetsClass.getDeclaredMethod(name, parameterTypes)); assert snippet.getAnnotation(Snippet.class) != null : "snippet is not annotated with @" + Snippet.class.getSimpleName(); return snippet; } catch (NoSuchMethodException e) { @@ -216,16 +216,16 @@ */ public SnippetTemplate(MetaAccessProvider runtime, SnippetTemplate.Key key) { ResolvedJavaMethod method = key.method; - assert Modifier.isStatic(method.accessFlags()) : "snippet method must be static: " + method; - Signature signature = method.signature(); + assert Modifier.isStatic(method.getModifiers()) : "snippet method must be static: " + method; + Signature signature = method.getSignature(); // Copy snippet graph, replacing constant parameters with given arguments - StructuredGraph snippetGraph = (StructuredGraph) method.compilerStorage().get(Graph.class); + StructuredGraph snippetGraph = (StructuredGraph) method.getCompilerStorage().get(Graph.class); StructuredGraph snippetCopy = new StructuredGraph(snippetGraph.name, snippetGraph.method()); IdentityHashMap replacements = new IdentityHashMap<>(); replacements.put(snippetGraph.start(), snippetCopy.start()); - int parameterCount = signature.argumentCount(false); + int parameterCount = signature.getParameterCount(false); assert checkTemplate(key, parameterCount, method, signature); Parameter[] parameterAnnotations = new Parameter[parameterCount]; @@ -236,7 +236,7 @@ if (c != null) { String name = c.value(); Object arg = key.get(name); - Kind kind = signature.argumentKindAt(i); + Kind kind = signature.getParameterKind(i); replacements.put(snippetGraph.getLocal(i), ConstantNode.forConstant(Constant.forBoxed(kind, arg), runtime, snippetCopy)); } else { VarargsParameter vp = MetaUtil.getParameterAnnotation(VarargsParameter.class, i, method); @@ -271,7 +271,7 @@ Object array = ((Varargs) key.get(vp.value())).array; int length = Array.getLength(array); LocalNode[] locals = new LocalNode[length]; - Stamp stamp = StampFactory.forKind(runtime.getResolvedJavaType(array.getClass().getComponentType()).kind()); + Stamp stamp = StampFactory.forKind(runtime.lookupJavaType(array.getClass().getComponentType()).getKind()); for (int j = 0; j < length; j++) { assert (parameterCount & 0xFFFF) == parameterCount; int idx = i << 16 | j; @@ -409,7 +409,7 @@ private static boolean checkConstantArgument(final ResolvedJavaMethod method, Signature signature, int i, String name, Object arg, Kind kind) { if (kind.isObject()) { - Class type = signature.argumentTypeAt(i, method.holder()).resolve(method.holder()).toJava(); + Class type = signature.getParameterType(i, method.getDeclaringClass()).resolve(method.getDeclaringClass()).toJava(); assert arg == null || type.isInstance(arg) : method + ": wrong value type for " + name + ": expected " + type.getName() + ", got " + arg.getClass().getName(); } else { @@ -421,7 +421,7 @@ private static boolean checkVarargs(final ResolvedJavaMethod method, Signature signature, int i, String name, Varargs varargs) { Object arg = varargs.array; - ResolvedJavaType type = (ResolvedJavaType) signature.argumentTypeAt(i, method.holder()); + ResolvedJavaType type = (ResolvedJavaType) signature.getParameterType(i, method.getDeclaringClass()); Class< ? > javaType = type.toJava(); assert javaType.isArray() : "varargs parameter must be an array type"; assert javaType.isInstance(arg) : "value for " + name + " is not a " + javaType.getName() + " instance: " + arg; @@ -702,10 +702,10 @@ sep = ", "; if (value instanceof LocalNode) { LocalNode local = (LocalNode) value; - buf.append(local.kind().javaName).append(' ').append(name); + buf.append(local.kind().getJavaName()).append(' ').append(name); } else { LocalNode[] locals = (LocalNode[]) value; - String kind = locals.length == 0 ? "?" : locals[0].kind().javaName; + String kind = locals.length == 0 ? "?" : locals[0].kind().getJavaName(); buf.append(kind).append('[').append(locals.length).append("] ").append(name); } } @@ -722,7 +722,7 @@ assert vp == null && p == null; String name = c.value(); expected.add(name); - Kind kind = signature.argumentKindAt(i); + Kind kind = signature.getParameterKind(i); assert key.names().contains(name) : "key for " + method + " is missing \"" + name + "\": " + key; assert checkConstantArgument(method, signature, i, c.value(), key.get(name), kind); } else if (vp != null) { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetVerificationPhase.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetVerificationPhase.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetVerificationPhase.java Tue Oct 09 15:23:38 2012 -0700 @@ -68,7 +68,7 @@ if (method.getAnnotation(NodeIntrinsic.class) == null) { Invoke invoke = (Invoke) callTarget.usages().first(); NodeInputList arguments = callTarget.arguments(); - boolean isStatic = Modifier.isStatic(method.accessFlags()); + boolean isStatic = Modifier.isStatic(method.getModifiers()); int argc = 0; if (!isStatic) { ValueNode receiver = arguments.get(argc); @@ -78,11 +78,11 @@ } argc++; } - Signature signature = method.signature(); - for (int i = 0; i < signature.argumentCount(false); i++) { + Signature signature = method.getSignature(); + for (int i = 0; i < signature.getParameterCount(false); i++) { ValueNode argument = arguments.get(argc); if (argument == node) { - ResolvedJavaType type = (ResolvedJavaType) signature.argumentTypeAt(i, method.holder()); + ResolvedJavaType type = (ResolvedJavaType) signature.getParameterType(i, method.getDeclaringClass()); verify((type.toJava() == Word.class) == isWord(argument), node, invoke.node(), "cannot pass word value to non-word parameter " + i + " or vice-versa"); } argc++; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/WordTypeRewriterPhase.java --- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/WordTypeRewriterPhase.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/WordTypeRewriterPhase.java Tue Oct 09 15:23:38 2012 -0700 @@ -158,7 +158,7 @@ case W2A: { assert arguments.size() == 1; ValueNode value = arguments.first(); - ResolvedJavaType targetType = (ResolvedJavaType) targetMethod.signature().returnType(targetMethod.holder()); + ResolvedJavaType targetType = (ResolvedJavaType) targetMethod.getSignature().getReturnType(targetMethod.getDeclaringClass()); UnsafeCastNode cast = graph.unique(new UnsafeCastNode(value, targetType)); replace(invoke, cast); break; diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/CyclicMaterializeStoreNode.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/CyclicMaterializeStoreNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/CyclicMaterializeStoreNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -75,7 +75,7 @@ ResolvedJavaType type = object.objectStamp().type(); FixedWithNextNode store; if (target instanceof Integer) { - store = graph.add(new StoreIndexedNode(object, ConstantNode.forInt((int) target, graph), type.componentType().kind(), value, -1)); + store = graph.add(new StoreIndexedNode(object, ConstantNode.forInt((int) target, graph), type.getComponentType().getKind(), value, -1)); } else { assert target instanceof ResolvedJavaField; store = graph.add(new StoreFieldNode(object, (ResolvedJavaField) target, value, -1)); diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializeObjectNode.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializeObjectNode.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializeObjectNode.java Tue Oct 09 15:23:38 2012 -0700 @@ -72,7 +72,7 @@ ResolvedJavaType element = virtual.componentType(); NewArrayNode newArray; - if (element.kind() == Kind.Object) { + if (element.getKind() == Kind.Object) { newArray = graph.add(new NewObjectArrayNode(element, ConstantNode.forInt(virtual.entryCount(), graph), false, locked)); } else { newArray = graph.add(new NewPrimitiveArrayNode(element, ConstantNode.forInt(virtual.entryCount(), graph), false, locked)); @@ -82,7 +82,7 @@ FixedWithNextNode position = newArray; for (int i = 0; i < virtual.entryCount(); i++) { - StoreIndexedNode store = graph.add(new StoreIndexedNode(newArray, ConstantNode.forInt(i, graph), element.kind(), values.get(i), -1)); + StoreIndexedNode store = graph.add(new StoreIndexedNode(newArray, ConstantNode.forInt(i, graph), element.getKind(), values.get(i), -1)); graph.addAfterFixed(position, store); position = store; } diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeAnalysisPhase.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeAnalysisPhase.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeAnalysisPhase.java Tue Oct 09 15:23:38 2012 -0700 @@ -26,7 +26,7 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.meta.JavaType.*; +import com.oracle.graal.api.meta.ResolvedJavaType.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; @@ -267,11 +267,11 @@ Kind fieldKind; if (virtual instanceof VirtualArrayNode) { deferredStores.add(graph.add(new CyclicMaterializeStoreNode(materialize, valueObj.materializedValue, i))); - fieldKind = ((VirtualArrayNode) virtual).componentType().kind(); + fieldKind = ((VirtualArrayNode) virtual).componentType().getKind(); } else { VirtualInstanceNode instanceObject = (VirtualInstanceNode) virtual; deferredStores.add(graph.add(new CyclicMaterializeStoreNode(materialize, valueObj.materializedValue, instanceObject.field(i)))); - fieldKind = instanceObject.field(i).type().kind(); + fieldKind = instanceObject.field(i).getType().getKind(); } materialize.values().set(i, ConstantNode.defaultForKind(fieldKind, graph)); } else { diff -r d1ba5ba4f484 -r 2463eb24b644 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/experimental/SplitPartialEscapeAnalysisPhase.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/experimental/SplitPartialEscapeAnalysisPhase.java Tue Oct 09 14:06:26 2012 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/experimental/SplitPartialEscapeAnalysisPhase.java Tue Oct 09 15:23:38 2012 -0700 @@ -25,7 +25,7 @@ import java.util.*; import com.oracle.graal.api.code.*; -import com.oracle.graal.api.meta.JavaType.Representation; +import com.oracle.graal.api.meta.ResolvedJavaType.Representation; import com.oracle.graal.api.meta.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; @@ -283,11 +283,11 @@ CyclicMaterializeStoreNode store; if (virtual instanceof VirtualArrayNode) { store = new CyclicMaterializeStoreNode(materialize, valueObj.materializedValue, i); - fieldKind = ((VirtualArrayNode) virtual).componentType().kind(); + fieldKind = ((VirtualArrayNode) virtual).componentType().getKind(); } else { VirtualInstanceNode instanceObject = (VirtualInstanceNode) virtual; store = new CyclicMaterializeStoreNode(materialize, valueObj.materializedValue, instanceObject.field(i)); - fieldKind = instanceObject.field(i).type().kind(); + fieldKind = instanceObject.field(i).getType().getKind(); } deferredStores.addFixedNodeBefore(store, fixed); values[i] = ConstantNode.defaultForKind(fieldKind, graph); diff -r d1ba5ba4f484 -r 2463eb24b644 src/share/vm/graal/graalCodeInstaller.cpp --- a/src/share/vm/graal/graalCodeInstaller.cpp Tue Oct 09 14:06:26 2012 +0200 +++ b/src/share/vm/graal/graalCodeInstaller.cpp Tue Oct 09 15:23:38 2012 -0700 @@ -104,7 +104,7 @@ // TODO: finish this - graal doesn't provide any scope values at the moment static ScopeValue* get_hotspot_value(oop value, int total_frame_size, GrowableArray* objects, ScopeValue* &second) { second = NULL; - if (value == Value::IllegalValue()) { + if (value == Value::ILLEGAL()) { return new LocationValue(Location::new_stk_loc(Location::invalid, 0)); } @@ -499,8 +499,8 @@ } if (second != NULL) { i++; - assert(i < values->length(), "double-slot value not followed by Value.IllegalValue"); - assert(((oop*) values->base(T_OBJECT))[i] == Value::IllegalValue(), "double-slot value not followed by Value.IllegalValue"); + assert(i < values->length(), "double-slot value not followed by Value.ILLEGAL"); + assert(((oop*) values->base(T_OBJECT))[i] == Value::ILLEGAL(), "double-slot value not followed by Value.ILLEGAL"); } } diff -r d1ba5ba4f484 -r 2463eb24b644 src/share/vm/graal/graalJavaAccess.hpp --- a/src/share/vm/graal/graalJavaAccess.hpp Tue Oct 09 14:06:26 2012 +0200 +++ b/src/share/vm/graal/graalJavaAccess.hpp Tue Oct 09 15:23:38 2012 -0700 @@ -191,7 +191,7 @@ end_class \ start_class(Value) \ oop_field(Value, kind, "Lcom/oracle/graal/api/meta/Kind;") \ - static_oop_field(Value, IllegalValue, "Lcom/oracle/graal/api/meta/Value;"); \ + static_oop_field(Value, ILLEGAL, "Lcom/oracle/graal/api/meta/Value;"); \ end_class \ start_class(RegisterValue) \ oop_field(RegisterValue, reg, "Lcom/oracle/graal/api/code/Register;") \