changeset 13453:e3ec81d3e976

Merge.
author Doug Simon <doug.simon@oracle.com>
date Wed, 18 Dec 2013 11:35:04 +0100
parents 8275a0d0c90a (current diff) 40530019af02 (diff)
children aba12e3603b4
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java src/share/vm/classfile/vmSymbols.hpp
diffstat 16 files changed, 118 insertions(+), 151 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Assembler.java	Wed Dec 18 11:26:37 2013 +0100
+++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Assembler.java	Wed Dec 18 11:35:04 2013 +0100
@@ -917,7 +917,7 @@
 
     public final void movb(AMD64Address dst, Register src) {
         assert src.getRegisterCategory() == AMD64.CPU : "must have byte register";
-        prefix(dst, src); // , true)
+        prefix(dst, src, true);
         emitByte(0x88);
         emitOperandHelper(src, dst);
     }
@@ -1895,6 +1895,10 @@
     }
 
     private void prefix(AMD64Address adr, Register reg) {
+        prefix(adr, reg, false);
+    }
+
+    private void prefix(AMD64Address adr, Register reg, boolean byteinst) {
         if (reg.encoding < 8) {
             if (needsRex(adr.getBase())) {
                 if (needsRex(adr.getIndex())) {
@@ -1905,7 +1909,7 @@
             } else {
                 if (needsRex(adr.getIndex())) {
                     emitByte(Prefix.REXX);
-                } else if (reg.encoding >= 4) {
+                } else if (byteinst && reg.encoding >= 4) {
                     emitByte(Prefix.REX);
                 }
             }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Wed Dec 18 11:26:37 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Wed Dec 18 11:35:04 2013 +0100
@@ -1655,11 +1655,25 @@
         }
 
         if (isIllegal(interval.location()) && interval.canMaterialize()) {
+            assert mode != OperandMode.DEF;
             return interval.getMaterializedValue();
         }
         return interval.location();
     }
 
+    private boolean isMaterialized(AllocatableValue operand, int opId, OperandMode mode) {
+        Interval interval = intervalFor(operand);
+        assert interval != null : "interval must exist";
+
+        if (opId != -1) {
+            // operands are not changed when an interval is split during allocation,
+            // so search the right interval here
+            interval = splitChildAtOpId(interval, opId, mode);
+        }
+
+        return isIllegal(interval.location()) && interval.canMaterialize();
+    }
+
     protected IntervalWalker initIntervalWalker(IntervalPredicate predicate) {
         // setup lists of potential oops for walking
         Interval oopIntervals;
@@ -1776,6 +1790,23 @@
                 continue;
             }
 
+            // remove useless moves
+            MoveOp move = null;
+            if (op instanceof MoveOp) {
+                move = (MoveOp) op;
+                AllocatableValue result = move.getResult();
+                if (isVariable(result) && isMaterialized(result, op.id(), OperandMode.DEF)) {
+                    /*
+                     * This happens if a materializable interval is originally not spilled but then
+                     * kicked out in LinearScanWalker.splitForSpilling(). When kicking out such an
+                     * interval this move operation was already generated.
+                     */
+                    instructions.set(j, null);
+                    hasDead = true;
+                    continue;
+                }
+            }
+
             ValueProcedure assignProc = new ValueProcedure() {
 
                 @Override
@@ -1802,8 +1833,7 @@
             });
 
             // remove useless moves
-            if (op instanceof MoveOp) {
-                MoveOp move = (MoveOp) op;
+            if (move != null) {
                 if (move.getInput().equals(move.getResult())) {
                     instructions.set(j, null);
                     hasDead = true;
@@ -1878,14 +1908,7 @@
             printLir("After register number assignment", true);
             EdgeMoveOptimizer.optimize(ir);
             ControlFlowOptimizer.optimize(ir);
-
-            /*
-             * Temporarily disabled because of problem in specjvm2008. TODO: fix the problem and
-             * re-enable it.
-             * 
-             * RedundantMoveElimination.optimize(ir, frameMap, gen.getGraph().method());
-             */
-
+            RedundantMoveElimination.optimize(ir, frameMap, gen.getGraph().method());
             NullCheckOptimizer.optimize(ir, target.implicitNullCheckLimit);
             printLir("After control flow optimization", false);
         } catch (Throwable e) {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java	Wed Dec 18 11:26:37 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java	Wed Dec 18 11:35:04 2013 +0100
@@ -197,6 +197,12 @@
      *         can only be a {@link Constant}.
      */
     public Constant getMaterializedValue(LIRInstruction op, Value operand) {
+        if (op instanceof MoveOp) {
+            MoveOp move = (MoveOp) op;
+            if (move.getInput() instanceof Constant) {
+                return (Constant) move.getInput();
+            }
+        }
         return null;
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Wed Dec 18 11:26:37 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Wed Dec 18 11:35:04 2013 +0100
@@ -73,11 +73,10 @@
      * Used to implement {@link ResolvedJavaType#findUniqueConcreteMethod(ResolvedJavaMethod)}.
      * 
      * @param metaspaceMethod the metaspace Method on which to based the search
-     * @param resultHolder the holder of the result is put in element 0 of this array
      * @return the metaspace Method result or 0 is there is no unique concrete method for
      *         {@code metaspaceMethod}
      */
-    long getUniqueConcreteMethod(long metaspaceMethod, HotSpotResolvedObjectType[] resultHolder);
+    long findUniqueConcreteMethod(long metaspaceMethod);
 
     /**
      * Used to determine if an interface has exactly one implementor.
@@ -195,7 +194,7 @@
 
     void initializeConfiguration(HotSpotVMConfig config);
 
-    JavaMethod resolveMethod(HotSpotResolvedObjectType klass, String name, String signature);
+    long resolveMethod(HotSpotResolvedObjectType klass, String name, String signature);
 
     HotSpotResolvedJavaField[] getInstanceFields(HotSpotResolvedObjectType klass);
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Wed Dec 18 11:26:37 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Wed Dec 18 11:35:04 2013 +0100
@@ -56,7 +56,7 @@
     public native boolean isMethodCompilable(long metaspaceMethod);
 
     @Override
-    public native long getUniqueConcreteMethod(long metaspaceMethod, HotSpotResolvedObjectType[] resultHolder);
+    public native long findUniqueConcreteMethod(long metaspaceMethod);
 
     @Override
     public native ResolvedJavaType getUniqueImplementor(HotSpotResolvedObjectType interfaceType);
@@ -86,7 +86,7 @@
     public native void initializeConfiguration(HotSpotVMConfig config);
 
     @Override
-    public native JavaMethod resolveMethod(HotSpotResolvedObjectType klass, String name, String signature);
+    public native long resolveMethod(HotSpotResolvedObjectType klass, String name, String signature);
 
     @Override
     public native boolean hasFinalizableSubclass(HotSpotResolvedObjectType klass);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java	Wed Dec 18 11:26:37 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java	Wed Dec 18 11:35:04 2013 +0100
@@ -61,13 +61,10 @@
     /**
      * Creates a resolved Java type.
      * 
-     * @param metaspaceKlass the metaspace Klass object for the type
-     * @param name the {@linkplain JavaType#getName() name} of the type
-     * @param simpleName a simple, unqualified name for the type
      * @param javaMirror the {@link Class} mirror
      * @return the resolved type associated with {@code javaMirror} which may not be the type
      *         instantiated by this call in the case of another thread racing to create the same
      *         type
      */
-    ResolvedJavaType createResolvedJavaType(long metaspaceKlass, String name, String simpleName, Class javaMirror, int sizeOrSpecies);
+    ResolvedJavaType createResolvedJavaType(Class javaMirror);
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Wed Dec 18 11:26:37 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Wed Dec 18 11:35:04 2013 +0100
@@ -673,15 +673,8 @@
     }
 
     @Override
-    public HotSpotResolvedObjectType createResolvedJavaType(long metaspaceKlass, String name, String simpleName, Class javaMirror, int sizeOrSpecies) {
-        HotSpotResolvedObjectType type = new HotSpotResolvedObjectType(metaspaceKlass, name, simpleName, javaMirror, sizeOrSpecies);
-
-        long offset = runtime().getConfig().graalMirrorInClassOffset;
-        if (!unsafe.compareAndSwapObject(javaMirror, offset, null, type)) {
-            // lost the race - return the existing value instead
-            type = (HotSpotResolvedObjectType) unsafe.getObject(javaMirror, offset);
-        }
-        return type;
+    public ResolvedJavaType createResolvedJavaType(Class javaMirror) {
+        return HotSpotResolvedObjectType.fromClass(javaMirror);
     }
 
     @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Wed Dec 18 11:26:37 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Wed Dec 18 11:35:04 2013 +0100
@@ -320,13 +320,22 @@
     }
 
     public ResolvedJavaMethod uniqueConcreteMethod() {
-        HotSpotResolvedObjectType[] resultHolder = {null};
-        long ucm = runtime().getCompilerToVM().getUniqueConcreteMethod(metaspaceMethod, resultHolder);
-        if (ucm != 0L) {
-            assert resultHolder[0] != null;
-            return resultHolder[0].createMethod(ucm);
+        if (holder.isInterface()) {
+            // Cannot trust interfaces. Because of:
+            // interface I { void foo(); }
+            // class A { public void foo() {} }
+            // class B extends A implements I { }
+            // class C extends B { public void foo() { } }
+            // class D extends B { }
+            // Would lead to identify C.foo() as the unique concrete method for I.foo() without
+            // seeing A.foo().
+            return null;
         }
-        return null;
+        final long uniqueConcreteMethod = runtime().getCompilerToVM().findUniqueConcreteMethod(metaspaceMethod);
+        if (uniqueConcreteMethod == 0) {
+            return null;
+        }
+        return fromMetaspace(uniqueConcreteMethod);
     }
 
     @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java	Wed Dec 18 11:26:37 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java	Wed Dec 18 11:35:04 2013 +0100
@@ -109,13 +109,6 @@
         return type;
     }
 
-    public HotSpotResolvedObjectType(long metaspaceKlass, String name, String simpleName, Class javaMirror, int sizeOrSpecies) {
-        super(name);
-        assert HotSpotGraalRuntime.unsafeReadWord(javaMirror, runtime().getConfig().klassOffset) == metaspaceKlass;
-        this.javaClass = javaMirror;
-        assert name.charAt(0) != '[' || isArray() : name + " " + simpleName + " " + Long.toHexString(sizeOrSpecies);
-    }
-
     /**
      * Creates the Graal mirror for a {@link Class} object.
      * 
@@ -125,7 +118,7 @@
      * 
      * @param javaClass the Class to create the mirror for
      */
-    public HotSpotResolvedObjectType(Class<?> javaClass) {
+    private HotSpotResolvedObjectType(Class<?> javaClass) {
         super(getSignatureName(javaClass));
         this.javaClass = javaClass;
         assert getName().charAt(0) != '[' || isArray() : getName();
@@ -356,11 +349,15 @@
     @Override
     public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method) {
         assert method instanceof HotSpotMethod;
-        ResolvedJavaMethod res = (ResolvedJavaMethod) runtime().getCompilerToVM().resolveMethod(this, method.getName(), ((HotSpotSignature) method.getSignature()).getMethodDescriptor());
-        if (res == null || isAbstract(res.getModifiers())) {
+        final long resolvedMetaspaceMethod = runtime().getCompilerToVM().resolveMethod(this, method.getName(), ((HotSpotSignature) method.getSignature()).getMethodDescriptor());
+        if (resolvedMetaspaceMethod == 0) {
             return null;
         }
-        return res;
+        HotSpotResolvedJavaMethod resolvedMethod = HotSpotResolvedJavaMethod.fromMetaspace(resolvedMetaspaceMethod);
+        if (isAbstract(resolvedMethod.getModifiers())) {
+            return null;
+        }
+        return resolvedMethod;
     }
 
     public ConstantPool constantPool() {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/RedundantMoveElimination.java	Wed Dec 18 11:26:37 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/RedundantMoveElimination.java	Wed Dec 18 11:35:04 2013 +0100
@@ -297,6 +297,7 @@
                 int sourceIdx = getStateIdx(moveOp.getInput());
                 int destIdx = getStateIdx(moveOp.getResult());
                 if (sourceIdx >= 0 && destIdx >= 0) {
+                    assert isObjectValue(state[sourceIdx]) || (moveOp.getInput().getKind() != Kind.Object) : "move op moves object but input is not defined as object";
                     state[destIdx] = state[sourceIdx];
                     indent.log("move value %d from %d to %d", state[sourceIdx], sourceIdx, destIdx);
                     return initValueNum;
@@ -342,8 +343,13 @@
             }
 
             OutputValueProc outputValueProc = new OutputValueProc(valueNum);
+
+            op.forEachTemp(outputValueProc);
+            /*
+             * Semantically the output values are written _after_ the temp values
+             */
             op.forEachOutput(outputValueProc);
-            op.forEachTemp(outputValueProc);
+
             valueNum = outputValueProc.opValueNum;
 
             if (op.hasState()) {
@@ -351,6 +357,9 @@
                  * All instructions with framestates (mostly method calls), may do garbage
                  * collection. GC will rewrite all object references which are live at this point.
                  * So we can't rely on their values.
+                 * 
+                 * It would be sufficient to just kill all values which are referenced in the state
+                 * (or all values which are not), but for simplicity we kill all values.
                  */
                 indent.log("kill all object values");
                 clearValuesOfKindObject(state, valueNum);
--- a/src/share/vm/classfile/vmSymbols.hpp	Wed Dec 18 11:26:37 2013 +0100
+++ b/src/share/vm/classfile/vmSymbols.hpp	Wed Dec 18 11:35:04 2013 +0100
@@ -368,7 +368,7 @@
   template(createUnresolvedJavaType_name,         "createUnresolvedJavaType")                                                         \
   template(createUnresolvedJavaType_signature,    "(Ljava/lang/String;)Lcom/oracle/graal/api/meta/JavaType;")                         \
   template(createResolvedJavaType_name,           "createResolvedJavaType")                                                           \
-  template(createResolvedJavaType_signature,      "(JLjava/lang/String;Ljava/lang/String;Ljava/lang/Class;I)Lcom/oracle/graal/api/meta/ResolvedJavaType;") \
+  template(createResolvedJavaType_signature,      "(Ljava/lang/Class;)Lcom/oracle/graal/api/meta/ResolvedJavaType;") \
   template(createPrimitiveJavaType_name,          "createPrimitiveJavaType")                                                          \
   template(createPrimitiveJavaType_signature,     "(I)Lcom/oracle/graal/api/meta/JavaType;")                                          \
   template(getVMToCompiler_name,                  "getVMToCompiler")                                                                  \
--- a/src/share/vm/graal/graalCompiler.cpp	Wed Dec 18 11:26:37 2013 +0100
+++ b/src/share/vm/graal/graalCompiler.cpp	Wed Dec 18 11:35:04 2013 +0100
@@ -219,21 +219,17 @@
   TRACE_graal_1("GraalCompiler::print_timers");
 }
 
-Handle GraalCompiler::get_JavaType(Symbol* klass_name, TRAPS) {
-   return VMToCompiler::createUnresolvedJavaType(java_lang_String::create_from_symbol(klass_name, THREAD), THREAD);
-}
-
 Handle GraalCompiler::get_JavaTypeFromSignature(Symbol* signature, KlassHandle loading_klass, TRAPS) {
-  
   BasicType field_type = FieldType::basic_type(signature);
   // If the field is a pointer type, get the klass of the
   // field.
   if (field_type == T_OBJECT || field_type == T_ARRAY) {
-    KlassHandle handle = GraalEnv::get_klass_by_name(loading_klass, signature, false);
-    if (handle.is_null()) {
-      return get_JavaType(signature, CHECK_NH);
+    KlassHandle klass = GraalEnv::get_klass_by_name(loading_klass, signature, false);
+    if (klass.is_null()) {
+      Handle signature_string = java_lang_String::create_from_symbol(signature, CHECK_NH);
+      return VMToCompiler::createUnresolvedJavaType(signature_string, CHECK_NH);
     } else {
-      return get_JavaType(handle, CHECK_NH);
+      return createHotSpotResolvedObjectType(klass, CHECK_NH);
     }
   } else {
     return VMToCompiler::createPrimitiveJavaType(field_type, CHECK_NH);
@@ -256,7 +252,7 @@
       if (tag.is_klass()) {
         // The klass has been inserted into the constant pool
         // very recently.
-        return GraalCompiler::get_JavaType(cp->resolved_klass_at(index), CHECK_NH);
+        return GraalCompiler::createHotSpotResolvedObjectType(cp->resolved_klass_at(index), CHECK_NH);
       } else if (tag.is_symbol()) {
         klass_name = cp->symbol_at(index);
       } else {
@@ -264,62 +260,26 @@
         klass_name = cp->unresolved_klass_at(index);
       }
     }
-    return GraalCompiler::get_JavaType(klass_name, CHECK_NH);
+    Handle klass_name_string = java_lang_String::create_from_symbol(klass_name, CHECK_NH);
+    return VMToCompiler::createUnresolvedJavaType(klass_name_string, CHECK_NH);
   } else {
-    return GraalCompiler::get_JavaType(klass, CHECK_NH);
+    return GraalCompiler::createHotSpotResolvedObjectType(klass, CHECK_NH);
   }
 }
 
-Handle GraalCompiler::get_JavaType(KlassHandle klass, TRAPS) {
-  Handle name = java_lang_String::create_from_symbol(klass->name(), THREAD);
-  return createHotSpotResolvedObjectType(klass, name, CHECK_NH);
-}
-
 Handle GraalCompiler::get_JavaField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, TRAPS) {
   Handle name = java_lang_String::create_from_symbol(field_name, CHECK_NH);
   return VMToCompiler::createJavaField(field_holder, name, field_type, offset, flags, false, CHECK_NH);
 }
 
-Handle GraalCompiler::createHotSpotResolvedObjectType(methodHandle method, TRAPS) {
-  KlassHandle klass = method->method_holder();
-  oop java_class = klass->java_mirror();
-  oop graal_mirror = java_lang_Class::graal_mirror(java_class);
-  if (graal_mirror != NULL) {
-    assert(graal_mirror->is_a(HotSpotResolvedObjectType::klass()), "unexpected class...");
-    return graal_mirror;
-  }
-  Handle name = java_lang_String::create_from_symbol(klass->name(), CHECK_NH);
-  return GraalCompiler::createHotSpotResolvedObjectType(klass, name, CHECK_NH);
-}
-
-Handle GraalCompiler::createHotSpotResolvedObjectType(KlassHandle klass, Handle name, TRAPS) {
+Handle GraalCompiler::createHotSpotResolvedObjectType(KlassHandle klass, TRAPS) {
   oop java_class = klass->java_mirror();
   oop graal_mirror = java_lang_Class::graal_mirror(java_class);
   if (graal_mirror != NULL) {
     assert(graal_mirror->is_a(HotSpotResolvedObjectType::klass()), "unexpected class...");
     return graal_mirror;
   }
-
-  Handle simpleName = name;
-  if (klass->oop_is_instance()) {
-    ResourceMark rm;
-    InstanceKlass* ik = (InstanceKlass*) klass();
-    name = java_lang_String::create_from_str(ik->signature_name(), CHECK_NH);
-  }
-
-  int sizeOrSpecies;
-  if (klass->is_interface()) {
-    sizeOrSpecies = (int) 0x80000000; // see HotSpotResolvedObjectType.INTERFACE_SPECIES_VALUE
-  } else if (klass->oop_is_array()) {
-    sizeOrSpecies = (int) 0x7fffffff; // see HotSpotResolvedObjectType.ARRAY_SPECIES_VALUE
-  } else {
-    sizeOrSpecies = InstanceKlass::cast(klass())->size_helper() * HeapWordSize;
-    if (!InstanceKlass::cast(klass())->can_be_fastpath_allocated()) {
-      sizeOrSpecies = -sizeOrSpecies;
-    }
-  }
-
-  return VMToCompiler::createResolvedJavaType(klass(), name, simpleName, java_class, sizeOrSpecies, CHECK_NH);
+  return VMToCompiler::createResolvedJavaType(java_class, CHECK_NH);
 }
 
 BasicType GraalCompiler::kindToBasicType(jchar ch) {
--- a/src/share/vm/graal/graalCompiler.hpp	Wed Dec 18 11:26:37 2013 +0100
+++ b/src/share/vm/graal/graalCompiler.hpp	Wed Dec 18 11:35:04 2013 +0100
@@ -73,12 +73,9 @@
 
   static Handle get_JavaTypeFromSignature(Symbol* signature, KlassHandle accessor, TRAPS);
   static Handle get_JavaType(constantPoolHandle cp, int index, KlassHandle accessor, TRAPS);
-  static Handle get_JavaType(Symbol* klass_name, TRAPS);
-  static Handle get_JavaType(KlassHandle klass, TRAPS);
   static Handle get_JavaField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, TRAPS);
 
-  static Handle createHotSpotResolvedObjectType(KlassHandle klass, Handle name, TRAPS);
-  static Handle createHotSpotResolvedObjectType(methodHandle method, TRAPS);
+  static Handle createHotSpotResolvedObjectType(KlassHandle klass, TRAPS);
 
   void exit();
 
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Wed Dec 18 11:26:37 2013 +0100
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Wed Dec 18 11:35:04 2013 +0100
@@ -171,33 +171,14 @@
   return (jlong) (address) method();
 }
 
-C2V_VMENTRY(jlong, getUniqueConcreteMethod, (JNIEnv *, jobject, jlong metaspace_method, jobject resultHolder))
+C2V_VMENTRY(jlong, findUniqueConcreteMethod, (JNIEnv *, jobject, jlong metaspace_method))
   methodHandle method = asMethod(metaspace_method);
   KlassHandle holder = method->method_holder();
-  if (holder->is_interface()) {
-    // Cannot trust interfaces. Because of:
-    // interface I { void foo(); }
-    // class A { public void foo() {} }
-    // class B extends A implements I { }
-    // class C extends B { public void foo() { } }
-    // class D extends B { }
-    // Would lead to identify C.foo() as the unique concrete method for I.foo() without seeing A.foo().
-    return 0L;
-  }
-  methodHandle ucm;
-  {
-    ResourceMark rm;
-    MutexLocker locker(Compile_lock);
-    ucm = Dependencies::find_unique_concrete_method(holder(), method());
-  }
-
-  if (ucm.is_null()) {
-    return 0L;
-  }
-
-  Handle type = GraalCompiler::createHotSpotResolvedObjectType(ucm(), CHECK_0);
-  objArrayOop(JNIHandles::resolve(resultHolder))->obj_at_put(0, type());
-  return (jlong) (address) ucm();
+  assert(!holder->is_interface(), "should be handled in Java code");
+  ResourceMark rm;
+  MutexLocker locker(Compile_lock);
+  Method* ucm = Dependencies::find_unique_concrete_method(holder(), method());
+  return (jlong) (address) ucm;
 C2V_END
 
 C2V_VMENTRY(jobject, getUniqueImplementor, (JNIEnv *, jobject, jobject interface_type))
@@ -206,7 +187,7 @@
   if (klass->nof_implementors() == 1) {
     InstanceKlass* implementor = (InstanceKlass*) klass->implementor();
     if (!implementor->is_abstract() && !implementor->is_interface() && implementor->is_leaf_class()) {
-      Handle type = GraalCompiler::get_JavaType(implementor, CHECK_NULL);
+      Handle type = GraalCompiler::createHotSpotResolvedObjectType(implementor, CHECK_NULL);
       return JNIHandles::make_local(THREAD, type());
     }
   }
@@ -262,7 +243,7 @@
       Handle type = VMToCompiler::createUnresolvedJavaType(name, THREAD);
       result = type();
     } else {
-      Handle type = GraalCompiler::createHotSpotResolvedObjectType(resolved_type, name, CHECK_NULL);
+      Handle type = GraalCompiler::createHotSpotResolvedObjectType(resolved_type, CHECK_NULL);
       result = type();
     }
   }
@@ -307,7 +288,7 @@
 
   methodHandle method = GraalEnv::get_method_by_index(cp, cp_index, bc, pool_holder);
   if (!method.is_null()) {
-    Handle holder = GraalCompiler::get_JavaType(method->method_holder(), CHECK_NULL);
+    Handle holder = GraalCompiler::createHotSpotResolvedObjectType(method->method_holder(), CHECK_NULL);
     return JNIHandles::make_local(THREAD, VMToCompiler::createResolvedJavaMethod(holder, method(), THREAD));
   } else {
     // Get the method's name and signature.
@@ -382,7 +363,7 @@
       flags = result.access_flags();
       holder_klass = result.field_holder();
       basic_type = result.field_type();
-      holder = GraalCompiler::get_JavaType(holder_klass, CHECK_NULL);
+      holder = GraalCompiler::createHotSpotResolvedObjectType(holder_klass, CHECK_NULL);
     }
   }
 
@@ -392,22 +373,20 @@
   return JNIHandles::make_local(THREAD, field_handle());
 C2V_END
 
-C2V_VMENTRY(jobject, resolveMethod, (JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature))
-
+C2V_VMENTRY(jlong, resolveMethod, (JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature))
   assert(JNIHandles::resolve(resolved_type) != NULL, "");
   Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaClass(resolved_type));
   Symbol* name_symbol = java_lang_String::as_symbol(JNIHandles::resolve(name), THREAD);
   Symbol* signature_symbol = java_lang_String::as_symbol(JNIHandles::resolve(signature), THREAD);
-  methodHandle method = klass->lookup_method(name_symbol, signature_symbol);
-  if (method.is_null()) {
+  Method* method = klass->lookup_method(name_symbol, signature_symbol);
+  if (method == NULL) {
     if (TraceGraal >= 3) {
       ResourceMark rm;
       tty->print_cr("Could not resolve method %s %s on klass %s", name_symbol->as_C_string(), signature_symbol->as_C_string(), klass->name()->as_C_string());
     }
-    return NULL;
+    return 0;
   }
-  Handle holder = GraalCompiler::get_JavaType(method->method_holder(), CHECK_NULL);
-  return JNIHandles::make_local(THREAD, VMToCompiler::createResolvedJavaMethod(holder, method(), THREAD));
+  return (jlong) (address) method;
 C2V_END
 
 C2V_VMENTRY(jboolean, hasFinalizableSubclass,(JNIEnv *, jobject, jobject hotspot_klass))
@@ -889,7 +868,7 @@
   {CC"initializeBytecode",            CC"("METASPACE_METHOD"[B)[B",                                     FN_PTR(initializeBytecode)},
   {CC"exceptionTableStart",           CC"("METASPACE_METHOD")J",                                        FN_PTR(exceptionTableStart)},
   {CC"hasBalancedMonitors",           CC"("METASPACE_METHOD")Z",                                        FN_PTR(hasBalancedMonitors)},
-  {CC"getUniqueConcreteMethod",       CC"("METASPACE_METHOD"["HS_RESOLVED_TYPE")"METASPACE_METHOD,      FN_PTR(getUniqueConcreteMethod)},
+  {CC"findUniqueConcreteMethod",      CC"("METASPACE_METHOD")"METASPACE_METHOD,                         FN_PTR(findUniqueConcreteMethod)},
   {CC"getUniqueImplementor",          CC"("HS_RESOLVED_TYPE")"RESOLVED_TYPE,                            FN_PTR(getUniqueImplementor)},
   {CC"getStackTraceElement",          CC"("METASPACE_METHOD"I)"STACK_TRACE_ELEMENT,                     FN_PTR(getStackTraceElement)},
   {CC"initializeMethod",              CC"("METASPACE_METHOD HS_RESOLVED_METHOD")V",                     FN_PTR(initializeMethod)},
@@ -903,7 +882,7 @@
   {CC"lookupTypeInPool",              CC"("METASPACE_CONSTANT_POOL"I)"TYPE,                             FN_PTR(lookupTypeInPool)},
   {CC"lookupReferencedTypeInPool",    CC"("METASPACE_CONSTANT_POOL"IB)V",                               FN_PTR(lookupReferencedTypeInPool)},
   {CC"lookupFieldInPool",             CC"("METASPACE_CONSTANT_POOL"IB)"FIELD,                           FN_PTR(lookupFieldInPool)},
-  {CC"resolveMethod",                 CC"("HS_RESOLVED_TYPE STRING STRING")"METHOD,                     FN_PTR(resolveMethod)},
+  {CC"resolveMethod",                 CC"("HS_RESOLVED_TYPE STRING STRING")"METASPACE_METHOD,           FN_PTR(resolveMethod)},
   {CC"getInstanceFields",             CC"("HS_RESOLVED_TYPE")["HS_RESOLVED_FIELD,                       FN_PTR(getInstanceFields)},
   {CC"getClassInitializer",           CC"("HS_RESOLVED_TYPE")"METASPACE_METHOD,                         FN_PTR(getClassInitializer)},
   {CC"hasFinalizableSubclass",        CC"("HS_RESOLVED_TYPE")Z",                                        FN_PTR(hasFinalizableSubclass)},
--- a/src/share/vm/graal/graalVMToCompiler.cpp	Wed Dec 18 11:26:37 2013 +0100
+++ b/src/share/vm/graal/graalVMToCompiler.cpp	Wed Dec 18 11:35:04 2013 +0100
@@ -239,17 +239,11 @@
   return (oop) result.get_jobject();
 }
 
-oop VMToCompiler::createResolvedJavaType(Klass* klass, Handle name, Handle simpleName, Handle java_mirror, jint sizeOrSpecies, TRAPS) {
-  assert(!name.is_null(), "just checking");
-  assert(!simpleName.is_null(), "just checking");
+oop VMToCompiler::createResolvedJavaType(Handle java_mirror, TRAPS) {
   JavaValue result(T_OBJECT);
   JavaCallArguments args;
   args.push_oop(instance());
-  args.push_long((jlong) (address) klass);
-  args.push_oop(name);
-  args.push_oop(simpleName);
   args.push_oop(java_mirror);
-  args.push_int(sizeOrSpecies);
   JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createResolvedJavaType_name(), vmSymbols::createResolvedJavaType_signature(), &args, THREAD);
   check_pending_exception("Error while calling createResolvedJavaType");
   return (oop) result.get_jobject();
--- a/src/share/vm/graal/graalVMToCompiler.hpp	Wed Dec 18 11:26:37 2013 +0100
+++ b/src/share/vm/graal/graalVMToCompiler.hpp	Wed Dec 18 11:35:04 2013 +0100
@@ -87,8 +87,8 @@
   // public abstract JavaType createUnresolvedJavaType(String name);
   static oop createUnresolvedJavaType(Handle name, TRAPS);
 
-  // public abstract ResolvedJavaType createResolvedJavaType(long metaspaceKlass, String name, String simpleName, Class javaMirror, int sizeOrSpecies);
-  static oop createResolvedJavaType(Klass* klass, Handle name, Handle simpleName, Handle java_mirror, jint sizeOrSpecies, TRAPS);
+  // public abstract ResolvedJavaType createResolvedJavaType(Class javaMirror);
+  static oop createResolvedJavaType(Handle java_mirror, TRAPS);
 
   // public abstract JavaType createPrimitiveJavaType(int basicType);
   static oop createPrimitiveJavaType(int basicType, TRAPS);