harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r540926 [4/5] - in /harmony/enhanced/drlvm/trunk/vm: include/ include/open/ jitrino/src/codegenerator/ia32/ jitrino/src/jet/ jitrino/src/main/ jitrino/src/optimizer/ jitrino/src/shared/ jitrino/src/translator/ jitrino/src/translator/java/ j...
Date Wed, 23 May 2007 11:22:57 GMT
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaLabelPrepass.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaLabelPrepass.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaLabelPrepass.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaLabelPrepass.cpp Wed May 23 04:22:55 2007
@@ -314,6 +314,7 @@
                                       uint32 handlerLength,
                                       Type*  exceptionType) {
         jitrino_assert( exceptionType);
+        assert(!exceptionType->isUnresolvedType());//must be resolved by verifier
         Log::out() << "Catch Exception Type = " << exceptionType->getName() << ::std::endl;
 
         CatchHandler* handler = new (memManager) 
@@ -381,10 +382,19 @@
 
         Type* exceptionType = NULL;
         if (exceptionTypeToken != 0) {
-            exceptionType = compilationInterface.resolveNamedType(enclosingMethod,exceptionTypeToken);
+            exceptionType = compilationInterface.getNamedType(enclosingMethod->getParentHandle(),exceptionTypeToken, ResolveNewCheck_NoCheck);
             if(!exceptionType) { // the type can not be resolved. LinkingException must be thrown
                 return 0;
             }
+            if (exceptionType->isUnresolvedObject()) {
+                //WORKAROUND! resolving exception type during a compilation session!!!
+                //Details: using singleton UnresolvedObjectType we unable to 
+                //distinct exception types if there are several unresolved exceptions in a single try block
+                //usually verifier loads all exception types caught for in method
+                //but verifier is turned off for bootstrap classes
+                Log::out()<<"WARNING: resolving type from inside of compilation session!!"<<std::endl;
+                exceptionType = compilationInterface.resolveNamedType(enclosingMethod->getParentHandle(),exceptionTypeToken);
+            }
         } else {
             exceptionType = prepass.typeManager.getSystemObjectType();
         }
@@ -503,7 +513,6 @@
     } else {
         numCatchHandlers = exceptionTypes.numCatch;
     }
-
     hasJsrLabels = false;
     isFallThruLabel = true;
     numVars = methodDesc.getNumVars();
@@ -1148,10 +1157,13 @@
     StateInfo::SlotInfo slot;
     StateInfo::setNonNull(&slot);
     StateInfo::setExactType(&slot);
-    Type* nType = resolveTypeNew(constPoolIndex);
+    
+    Type* nType = compilationInterface.getNamedType(methodDesc.getParentHandle(), constPoolIndex, ResolveNewCheck_DoCheck);
+    
     if (nType) {
         slot.type = nType;
     } else {
+        assert(!typeManager.isLazyResolutionMode());
         slot.type = typeManager.getNullObjectType();
     }
     slot.vars = NULL;
@@ -1187,10 +1199,13 @@
     StateInfo::SlotInfo slot;
     StateInfo::setNonNull(&slot);
     StateInfo::setExactType(&slot);
-    Type* type = resolveType(constPoolIndex);
+
+    Type* type = compilationInterface.getNamedType(methodDesc.getParentHandle(), constPoolIndex);
+    
     if (type) {
         slot.type = typeManager.getArrayType(type);
     } else {
+        assert(!typeManager.isLazyResolutionMode());
         slot.type = typeManager.getNullObjectType();
     }
     slot.vars = NULL;
@@ -1198,8 +1213,15 @@
     pushType(slot);
 }
 
-void JavaLabelPrepass::arraylength()                       { popAndCheck(A); pushType(int32Type); }
-void JavaLabelPrepass::athrow()                            { popAndCheck(A); }
+void JavaLabelPrepass::arraylength() {
+    popAndCheck(A); 
+    pushType(int32Type); 
+}
+
+void JavaLabelPrepass::athrow() { 
+    popAndCheck(A); 
+}
+
 void JavaLabelPrepass::checkcast(uint32 constPoolIndex)    { 
     StateInfo::SlotInfo slot = stateInfo.stack[stateInfo.stackDepth - 1];
     if ( (slot.type) &&
@@ -1207,68 +1229,20 @@
          (slot.vars == NULL) ) {
         return;
     }
-    Type *type = resolveType(constPoolIndex);
+    Type* type = compilationInterface.getNamedType(methodDesc.getParentHandle(), constPoolIndex);
     if (!type) {
+        assert(!typeManager.isLazyResolutionMode());
         // leave stack as is as in case of success because
         // resolution of item by constPoolIndex fails and
         // respective exception will be thrown
         return;
     }
     popAndCheck(A);
-    jitrino_assert( type);
     pushType(type);
 }
+
 int JavaLabelPrepass::instanceof(const uint8* bcp, uint32 constPoolIndex, uint32 off)   {
-    struct StateInfo::SlotInfo exitInfo = popType();
-    if ( !StateInfo::isVarNumberSet(exitInfo)) {
-        pushType(int32Type);
-        return 3;
-    }
-    Type *restype = resolveType(constPoolIndex);
-    if (!restype) {
-        // skip other activity because
-        // resolution of item by constPoolIndex fails and
-        // respective exception will be thrown
-        pushType(int32Type);
-        return 3;  // length of instanceof
-    }
-    // check the next byte code following the instanceof
-    bcp += 3;
-    off += 3;
-    const uint8* byteCodes = bcp-off;
-    StateInfo::SlotInfo *slot = &stateInfo.stack[exitInfo.varNumber];
-    bool isSubClassOf = false;
-    Type *runtype = exitInfo.type;
-    Type *chktype = restype;
-    if (runtype->isArrayType() && chktype->isArrayType()) {
-        runtype = ((ArrayType*)runtype)->getElementType();
-        chktype = ((ArrayType*)chktype)->getElementType();
-    }
-    if (!runtype->isNullObject() && runtype->isObject() && chktype->isObject()) {
-        isSubClassOf = ((ObjectType*)runtype)->isSubClassOf((ObjectType*)chktype);
-    }
-    if (false && !isSubClassOf)
-        switch(*bcp) {
-        case 0x9a: // ifne
-            {uint32 targetOffset = off+si16(bcp+1);
-             uint32 nextOffset   = off+3;
-            setStackVars();
-            // propagate state info on both ways
-            Type * oldtype    = slot->type;
-            uint16 oldflags   = slot->slotFlags;
-            slot->type        = restype;
-            StateInfo::setNonNull(slot);
-            StateInfo::setChangeState(slot);
-            propagateStateInfo(targetOffset,false);
-            slot->type        = oldtype;
-            slot->slotFlags   = oldflags;
-            setLabel(nextOffset);
-            isFallThruLabel = targetOffset > nextOffset;
-            if (labelStack != NULL)
-                labelStack->push((uint8*)byteCodes + off+si16(bcp+1));
-            }
-            return 3+3;
-         }
+    popType();
     pushType(int32Type);
     return 3;  // length of instanceof
 }
@@ -1307,66 +1281,59 @@
 }
 
 void JavaLabelPrepass::getstatic(uint32 constPoolIndex)    {
-    FieldDesc *fdesc = resolveStaticField(constPoolIndex, false);
+    FieldDesc *fdesc = compilationInterface.getStaticField(methodDesc.getParentHandle(), constPoolIndex, false);
     Type* fieldType = 0;
     if (fdesc && fdesc->isStatic()) {
         fieldType = fdesc->getFieldType();
-        if (!fieldType){
-            fieldType = compilationInterface.getFieldType(&methodDesc,constPoolIndex);
-        }
-    } else {
-        fieldType = compilationInterface.getFieldType(&methodDesc,constPoolIndex);
     }
+    if (!fieldType){
+        fieldType = compilationInterface.getFieldType(methodDesc.getParentHandle(), constPoolIndex);
+     }
     assert(fieldType);
     pushType(typeManager.toInternalType(fieldType));
 }
+
 void JavaLabelPrepass::putstatic(uint32 constPoolIndex)    {
-    FieldDesc *fdesc = resolveStaticField(constPoolIndex, true);
-    if (fdesc) {
-        Type* fieldType = fdesc->getFieldType();
-        if (!fieldType){
-            popType();
-        }else {
-            popAndCheck(getJavaType(fieldType));
-        }
+    FieldDesc *fdesc = compilationInterface.getStaticField(methodDesc.getParentHandle(), constPoolIndex, true);
+    Type* fieldType = fdesc ? fdesc->getFieldType() : NULL;
+    if (fieldType){
+        popAndCheck(getJavaType(fieldType));
     } else {
+        // lazy resolution mode or
         // throwing respective exception helper will be inserted at the Translator
-        popType();
-    }
+       popType();
+    } 
 }
+
 void JavaLabelPrepass::getfield(uint32 constPoolIndex)     {
-    popAndCheck(A);
-    FieldDesc *fdesc = resolveField(constPoolIndex, false);
-    Type* fieldType = 0;
+    popAndCheck(A);//obj
+    FieldDesc *fdesc = compilationInterface.getNonStaticField(methodDesc.getParentHandle(), constPoolIndex, false);
+    Type* fieldType = NULL;
     if (fdesc) {
         fieldType = fdesc->getFieldType();
-        if (!fieldType){
-            fieldType = compilationInterface.getFieldType(&methodDesc,constPoolIndex);
-        }
-    } else {
-        fieldType = compilationInterface.getFieldType(&methodDesc,constPoolIndex);
+    }
+    if (!fieldType){
+        fieldType = compilationInterface.getFieldType(methodDesc.getParentHandle(), constPoolIndex);
     }
     assert(fieldType);
     pushType(typeManager.toInternalType(fieldType));
 }
+
 void JavaLabelPrepass::putfield(uint32 constPoolIndex)     {
-    FieldDesc *fdesc = resolveField(constPoolIndex, true);
-    if (fdesc) {
-        Type* fieldType = fdesc->getFieldType();
-        if (!fieldType){
-            popType();
-        }else {
-            popAndCheck(getJavaType(fieldType));
-        }
+    FieldDesc *fdesc = compilationInterface.getNonStaticField(methodDesc.getParentHandle(), constPoolIndex, true);
+    Type* fieldType = fdesc ? fdesc->getFieldType() : NULL;
+    if (fieldType){
+        popAndCheck(getJavaType(fieldType));
     } else {
         // throwing respective exception helper will be inserted at the Translator
+        // TODO: why not check types for lazy-resolve mode?
         popType();
     }
     popAndCheck(A);
 }
 
 void JavaLabelPrepass::invokevirtual(uint32 constPoolIndex){
-    MethodDesc *mdesc = resolveVirtualMethod(constPoolIndex);
+    MethodDesc *mdesc = compilationInterface.getVirtualMethod(methodDesc.getParentHandle(), constPoolIndex);
     if (mdesc) {// resolution was successful
         invoke(mdesc);
     } else {    // exception happens during resolving/linking
@@ -1377,17 +1344,18 @@
 }
 
 void JavaLabelPrepass::invokespecial(uint32 constPoolIndex){
-    MethodDesc *mdesc = resolveSpecialMethod(constPoolIndex);
+    MethodDesc* mdesc = compilationInterface.getSpecialMethod(methodDesc.getParentHandle(),constPoolIndex);
     if (mdesc) {// resolution was successful
         invoke(mdesc);
-    } else {    // exception happens during resolving/linking
+    } else {    
+        // exception happens during resolving/linking or lazy resolution mode
         const char* methodSig_string = methodSignatureString(constPoolIndex);
         popType(); // is not static
         pseudoInvoke(methodSig_string);
     }
 }
 void JavaLabelPrepass::invokestatic(uint32 constPoolIndex) {
-    MethodDesc *mdesc = resolveStaticMethod(constPoolIndex);
+    MethodDesc *mdesc = compilationInterface.getStaticMethod(methodDesc.getParentHandle(), constPoolIndex);
     if (mdesc) {// resolution was successful
         invoke(mdesc);
     } else {    // exception happens during resolving/linking
@@ -1396,7 +1364,7 @@
     }
 }
 void JavaLabelPrepass::invokeinterface(uint32 constPoolIndex,uint32 count) {
-    MethodDesc *mdesc = resolveInterfaceMethod(constPoolIndex);
+    MethodDesc *mdesc = compilationInterface.getInterfaceMethod(methodDesc.getParentHandle(), constPoolIndex);
     if (mdesc) {// resolution was successful
         invoke(mdesc);
     } else {    // exception happens during resolving/linking
@@ -1406,10 +1374,12 @@
     }
 }
 void JavaLabelPrepass::multianewarray(uint32 constPoolIndex,uint8 dimensions) {
-    for (int i =0; i < dimensions; i++)
+    for (int i =0; i < dimensions; i++) {
         popAndCheck(int32Type);
-    Type *type = resolveType(constPoolIndex);
+    }
+    Type *type = compilationInterface.getNamedType(methodDesc.getParentHandle(), constPoolIndex);
     if ( !type ) {
+        assert(!typeManager.isLazyResolutionMode());
         type = typeManager.getNullObjectType();
     }
     jitrino_assert( type);
@@ -1426,7 +1396,7 @@
         popType();
 
     // recognize and push respective returnType
-    Type* retType = getRetTypeBySignature(methodSig, typeManager);
+    Type* retType = getRetTypeBySignature(compilationInterface, methodDesc.getParentHandle(), methodSig);
     assert(retType);
 
     // push the return type
@@ -1474,13 +1444,15 @@
     return numArgs;
 }
 
-Type* JavaLabelPrepass::getRetTypeBySignature(const char* methodSig, TypeManager& typeManager) 
+Type* JavaLabelPrepass::getRetTypeBySignature(CompilationInterface& ci, Class_Handle enclClass, const char* origSig) 
 {
-    assert(*methodSig == '(' || *methodSig == ')');
-    while( *(methodSig++) != ')' ); // in case getNumArgsBySignature was not run earlier
+    assert(*origSig== '(' || *origSig == ')');
+    while( *(origSig++) != ')' ); // in case getNumArgsBySignature was not run earlier
 
     Type* retType = NULL;
     uint32 arrayDim = 0;
+    const char* methodSig = origSig;
+
 
     // collect array dimension if any
     while( *(methodSig) == '[' ) {
@@ -1488,10 +1460,18 @@
         methodSig++;
     }
 
+    bool arrayIsWrapped = false;
+    TypeManager& typeManager = ci.getTypeManager();
     switch( *methodSig ) 
     {
-    case 'L':
-        retType = typeManager.getNullObjectType();
+    case 'L': {
+            if (!typeManager.isLazyResolutionMode()) {
+                typeManager.getNullObjectType();
+            }
+            retType = ci.getTypeFromDescriptor(enclClass, origSig);
+            //in lazy resolution mode retType is already valid array type
+            arrayIsWrapped = true;
+        }
         break;
     case 'B':
         retType = typeManager.getInt8Type();
@@ -1503,7 +1483,7 @@
         retType = typeManager.getDoubleType();
         break;
     case 'F':
-        retType = typeManager.getFloatType();
+        retType = typeManager.getSingleType();
         break;
     case 'I':
         retType = typeManager.getInt32Type();
@@ -1532,12 +1512,15 @@
 
     void* arrVMTypeHandle = NULL;
     if(retType == typeManager.getNullObjectType()) {
+        assert(!typeManager.isLazyResolutionMode());
         // VM can not operate with an array of NullObjects
         // Let's cheat here
         arrVMTypeHandle = (void*)(POINTER_SIZE_INT)0xdeadbeef;
     }
-    for (;arrayDim > 0; arrayDim--) {
-        retType = typeManager.getArrayType(retType, false, arrVMTypeHandle);
+    if (!arrayIsWrapped && arrayDim > 0) {
+        for (;arrayDim > 0; arrayDim--) {
+            retType = typeManager.getArrayType(retType, false, arrVMTypeHandle);
+        }
     }
     return retType;
 }
@@ -1751,7 +1734,7 @@
 void JavaLabelPrepass::genTypeArrayLoad() {
     popAndCheck(int32Type);
     Type* type = popType().type;
-    assert(type->isArrayType() || type->isNullObject());
+    assert(type->isArrayType() || type->isNullObject() || type->isUnresolvedObject());
     if(type->isArrayType()) {
         type = ((ArrayType*)type)->getElementType();
     }
@@ -1775,7 +1758,7 @@
     type = 
 #endif
         popType().type;
-    assert(type->isArrayType() || type->isNullObject());
+    assert(type->isArrayType() || type->isNullObject() || type->isUnresolvedObject());
 }
 
 void JavaLabelPrepass::genBinary    (Type *type) {
@@ -1806,47 +1789,7 @@
     pushType(int32Type);
 }
 
-// cut and paste from JavaLabelPrepass.cpp
 
-FieldDesc*      JavaLabelPrepass::resolveField(uint32 cpIndex, bool putfield) {
-    FieldDesc* res = compilationInterface.resolveField(&methodDesc, cpIndex, putfield);
-    return res;
-}
-
-FieldDesc*      JavaLabelPrepass::resolveStaticField(uint32 cpIndex, bool putfield) {
-    FieldDesc* res = compilationInterface.resolveStaticField(&methodDesc, cpIndex, putfield);
-    return res;
-}
-
-MethodDesc*     JavaLabelPrepass::resolveVirtualMethod(uint32 cpIndex) {
-    MethodDesc* res = compilationInterface.resolveVirtualMethod(&methodDesc,cpIndex);
-    return res;
-}
-
-MethodDesc*     JavaLabelPrepass::resolveSpecialMethod(uint32 cpIndex) {
-    MethodDesc* res = compilationInterface.resolveSpecialMethod(&methodDesc,cpIndex);
-    return res;
-}
-
-MethodDesc*     JavaLabelPrepass::resolveStaticMethod(uint32 cpIndex) {
-    MethodDesc* res = compilationInterface.resolveStaticMethod(&methodDesc,cpIndex);
-    return res;
-}
-
-MethodDesc*     JavaLabelPrepass::resolveInterfaceMethod(uint32 cpIndex) {
-    MethodDesc* res = compilationInterface.resolveInterfaceMethod(&methodDesc,cpIndex);
-    return res;
-}
-
-Type*   JavaLabelPrepass::resolveType(uint32 cpIndex) {
-    Type* res = compilationInterface.resolveNamedType(&methodDesc,cpIndex);
-    return res;
-}
-
-Type*   JavaLabelPrepass::resolveTypeNew(uint32 cpIndex) {
-    Type* res = compilationInterface.resolveNamedTypeNew(&methodDesc,cpIndex);
-    return res;
-}
 
 const char*     JavaLabelPrepass::methodSignatureString(uint32 cpIndex) {
     return compilationInterface.getSignatureString(&methodDesc,cpIndex);

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaLabelPrepass.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaLabelPrepass.h?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaLabelPrepass.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaLabelPrepass.h Wed May 23 04:22:55 2007
@@ -266,14 +266,6 @@
     // cut and paste from Java_Translator.cpp
     // field, method, and type resolution
     //
-    FieldDesc*              resolveField(uint32 cpIndex, bool putfield);
-    FieldDesc*              resolveStaticField(uint32 cpIndex, bool putfield);
-    MethodDesc*             resolveVirtualMethod(uint32 cpIndex);
-    MethodDesc*             resolveSpecialMethod(uint32 cpIndex);
-    MethodDesc*             resolveStaticMethod(uint32 cpIndex);
-    MethodDesc*             resolveInterfaceMethod(uint32 cpIndex);
-    Type*                   resolveType(uint32 cpIndex);
-    Type*                   resolveTypeNew(uint32 cpIndex);
     const char*             methodSignatureString(uint32 cpIndex);
     StateInfo*              getStateInfo()  { return &stateInfo; }
     StateTable*             getStateTable() { return stateTable; }
@@ -293,6 +285,7 @@
         case Type::Array:           
         case Type::Object:
         case Type::NullObject:
+        case Type::UnresolvedObject:
         case Type::SystemString:
         case Type::SystemObject:
         case Type::SystemClass:
@@ -331,7 +324,7 @@
     void invoke       (MethodDesc *mdesc);
     void pseudoInvoke (const char* mdesc);
     static  uint32  getNumArgsBySignature(const char*& methodSig);
-    static  Type*   getRetTypeBySignature(const char* methodSig, TypeManager& tm);
+    static  Type*   getRetTypeBySignature(CompilationInterface& ci, Class_Handle enclClass, const char* methodSig);
 
     // remaining instructions
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaTranslator.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaTranslator.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaTranslator.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaTranslator.cpp Wed May 23 04:22:55 2007
@@ -59,48 +59,4 @@
     cfgBuilder.build();
 }
 
-
-//
-// version for translation-level inlining
-//
-Opnd*
-JavaCompileMethodInline(CompilationInterface& compilationInterface,
-                        MemoryManager& translatorMemManager,
-                        MethodDesc& methodDesc,
-                        IRBuilder&        irBuilder,
-                        uint32            numActualArgs,
-                        Opnd**            actualArgs,
-                        JavaFlowGraphBuilder&  cfgBuilder, 
-                        uint32 inlineDepth,
-                        InlineInfoBuilder* parentInlineInfoBuilder,
-                        JsrEntryInstToRetInstMap* parentJsrEntryMap)
-{
-    uint32 byteCodeSize = methodDesc.getByteCodeSize();
-    const unsigned char* byteCodes = methodDesc.getByteCodes();
-
-
-    ByteCodeParser parser((const uint8*)byteCodes,byteCodeSize);
-    // generate code
-    JavaByteCodeTranslator translator(compilationInterface,
-                              translatorMemManager,
-                              irBuilder,
-                              parser,
-                              methodDesc,
-                              *irBuilder.getTypeManager(),
-                              cfgBuilder,
-                              numActualArgs,actualArgs,NULL,NULL,
-                              (ExceptionInfo*)irBuilder.getCurrentLabel()->getState(),
-                              inlineDepth,false /* startNewBlock */,
-                              parentInlineInfoBuilder,
-                              parentJsrEntryMap);  // isInlined=true for this c-tor
-    if ( compilationInterface.isBCMapInfoRequired()) {
-        size_t incSize = byteCodeSize * ESTIMATED_HIR_SIZE_PER_BYTECODE;
-        MethodDesc* parentMethod = compilationInterface.getMethodToCompile();
-        incVectorHandlerSize(bcOffset2HIRHandlerName, parentMethod, incSize);
-    }
-    parser.parse(&translator);
-    return translator.getResultOpnd();
-}
-
-
 } //namespace Jitrino 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaTranslator.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaTranslator.h?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaTranslator.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/java/JavaTranslator.h Wed May 23 04:22:55 2007
@@ -37,20 +37,6 @@
 typedef std::pair<JsrEntryInstToRetInstMap::const_iterator, 
         JsrEntryInstToRetInstMap::const_iterator> JsrEntryCIterRange;
 
-//
-// version for translation-level inlining
-//
-extern Opnd* JavaCompileMethodInline(
-                                CompilationInterface& compilationInterface,
-                                MemoryManager& translatorMemManager,
-                                MethodDesc& methodDesc,
-                                IRBuilder& irBuilder,
-                                uint32 numActualArgs,
-                                Opnd** actualArgs,
-                                JavaFlowGraphBuilder& cfgBuilder, uint32 inlineDepth,
-                                InlineInfoBuilder* parentInlineInfoBuilder,
-                                JsrEntryInstToRetInstMap* parentJsrEntryMap);
-
 
 class JavaTranslator {
 public:

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.cpp Wed May 23 04:22:55 2007
@@ -94,6 +94,17 @@
     DECL_HELPER_ITEM(MethodEntry),
     DECL_HELPER_ITEM(MethodExit),
     DECL_HELPER_ITEM(WriteBarrier),
+    DECL_HELPER_ITEM(NewObjWithResolve),
+    DECL_HELPER_ITEM(NewArrayWithResolve),
+    DECL_HELPER_ITEM(GetNonStaticFieldOffsetWithResolve),
+    DECL_HELPER_ITEM(GetStaticFieldAddrWithResolve),
+    DECL_HELPER_ITEM(CheckCastWithResolve),
+    DECL_HELPER_ITEM(InstanceOfWithResolve),
+    DECL_HELPER_ITEM(GetInvokeStaticAddrWithResolve),
+    DECL_HELPER_ITEM(GetInvokeInterfaceAddrWithResolve),
+    DECL_HELPER_ITEM(GetInvokeVirtualAddrWithResolve),
+    DECL_HELPER_ITEM(GetInvokeSpecialAddrWithResolve),
+    DECL_HELPER_ITEM(InitializeClassWithResolve)
 #undef DECL_HELPER_ITEM
 };
 static const unsigned runtime_helpers_names_count = sizeof(runtime_helpers_names)/sizeof(runtime_helpers_names[0]);

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h Wed May 23 04:22:55 2007
@@ -136,6 +136,7 @@
 
 };
 
+///Field representation for resolved fields
 class FieldDesc : public TypeMemberDesc {
 public:
     FieldDesc(Field_Handle field, CompilationInterface* ci, uint32 id) 
@@ -155,10 +156,6 @@
         bool          isInitOnly() const     {return field_is_final(drlField)?true:false;}    
         // accesses to field cannot be reordered or CSEed
         bool          isVolatile() const    {return field_is_volatile(drlField)?true:false;}
-        //
-        // this is a compile-time constant field -- static fields only
-        //
-        bool          isLiteral() const;
         Type*         getFieldType();
         uint32        getOffset() const; // for non-static fields
         void*         getAddress() const    {return field_get_address(drlField);} // for static fields
@@ -168,6 +165,7 @@
     Field_Handle drlField;
 };
 
+///Method representation for resolved methods
 class MethodDesc : public TypeMemberDesc {
 public:
     MethodDesc(Method_Handle m, JIT_Handle jit, CompilationInterface* ci = NULL, uint32 id = 0)
@@ -275,6 +273,7 @@
     ChaMethodIterator iterator;
 };
 
+enum ResolveNewCheck{ResolveNewCheck_NoCheck, ResolveNewCheck_DoCheck};
 
 class CompilationInterface {
 public:
@@ -350,6 +349,17 @@
         Helper_MethodEntry, // f(MethodHandle)
         Helper_MethodExit,   // f(MethodHandle, void* ret_value)
         Helper_WriteBarrier,
+        Helper_NewObjWithResolve,       //f(class_handle, cp_index)
+        Helper_NewArrayWithResolve,     //f(class_handle, cp_index, length)
+        Helper_GetNonStaticFieldOffsetWithResolve, //f(class_handle, cp_index)
+        Helper_GetStaticFieldAddrWithResolve,       //f(class_handle, cp_index)
+        Helper_CheckCastWithResolve,                //f(class_handle, cp_index, obj)
+        Helper_InstanceOfWithResolve,               //f(class_handle, cp_index, obj)
+        Helper_GetInvokeStaticAddrWithResolve,      //f(class_handle, cp_index)
+        Helper_GetInvokeInterfaceAddrWithResolve,   //f(class_handle, cp_index, obj)
+        Helper_GetInvokeVirtualAddrWithResolve,     //f(class_handle, cp_index, obj)
+        Helper_GetInvokeSpecialAddrWithResolve,     //f(class_handle, cp_index)
+        Helper_InitializeClassWithResolve,          //f(class_handle, cp_index)
         Num_Helpers
     };
 
@@ -375,29 +385,25 @@
     void*       getRuntimeHelperAddressForType(RuntimeHelperId, Type*);
 
 
-    FieldDesc*  resolveField(MethodDesc* enclosingMethod,
-        uint32 fieldToken,
-        bool putfield);
-    FieldDesc*  resolveFieldByIndex(NamedType *klass, int index, NamedType **fieldType);
-    FieldDesc*  resolveStaticField(MethodDesc* enclosingMethod,
-        uint32 fieldToken,
-        bool putfield);
-    MethodDesc* resolveVirtualMethod(MethodDesc* enclosingMethod,
-        uint32 methodToken);
-    MethodDesc* resolveSpecialMethod(MethodDesc* enclosingMethod,
-        uint32 methodToken);
-    //FIXME
-    //MethodDesc* resolveMethod(MethodDesc* enclosingMethod,uint32 methodToken){assert(false); return 0;}
-    MethodDesc* resolveStaticMethod(MethodDesc* enclosingMethod,
-        uint32 methodToken);
-    MethodDesc* resolveInterfaceMethod(MethodDesc* enclosingMethod,
-        uint32 methodToken);
-    NamedType*  resolveNamedType(MethodDesc* enclosingMethod,
-        uint32 typeToken);
-    NamedType*  resolveNamedTypeNew(MethodDesc* enclosingMethod,
-        uint32 typeToken);
-    Type*       getFieldType(MethodDesc* enclosingMethodDesc, uint32 entryCPIndex);
+    Type*      getFieldType(Class_Handle enclClass, uint32 cpIndex);
+
+    NamedType* getNamedType(Class_Handle enclClass, uint32 cpIndex, ResolveNewCheck check = ResolveNewCheck_NoCheck);
+    Type*      getTypeFromDescriptor(Class_Handle enclClass, const char* descriptor);
+
+    //this method is obsolete and will be removed. Use getNamedType if unsure.
+    NamedType* resolveNamedType(Class_Handle enclClass, uint32 cpIndex);
+
+
+
+    MethodDesc* getStaticMethod(Class_Handle enclClass, uint32 cpIndex);
+    MethodDesc* getVirtualMethod(Class_Handle enclClass, uint32 cpIndex);
+    MethodDesc* getSpecialMethod(Class_Handle enclClass, uint32 cpIndex);
+    MethodDesc* getInterfaceMethod(Class_Handle enclClass, uint32 cpIndex);
+
+    FieldDesc*  getNonStaticField(Class_Handle enclClass, uint32 cpIndex, bool putfield);
+    FieldDesc*  getStaticField(Class_Handle enclClass, uint32 cpIndex, bool putfield);
 
+    
 
     // resolve-by-name methods
     /**

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlJITInterface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlJITInterface.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlJITInterface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlJITInterface.cpp Wed May 23 04:22:55 2007
@@ -271,6 +271,9 @@
              << "\tbyte code size=" <<  method_get_byte_code_size(method_handle)
              << std::endl;
     }
+#ifdef _DEBUG
+    Jitrino::incCompilationRecursionLevel();
+#endif
 
     JIT_Result result;
  
@@ -282,6 +285,10 @@
 #endif  // USE_FAST_PATH
 
         result = Jitrino::CompileMethod(&cs) ? JIT_SUCCESS : JIT_FAILURE;
+
+#ifdef _DEBUG
+    Jitrino::decCompilationRecursionLevel();
+#endif
 
     if (info.isEnabled()) {
         info << current_nb << ">\t"

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.cpp Wed May 23 04:22:55 2007
@@ -360,32 +360,30 @@
                                     Byte*  endAddr,
                                     Byte*  handlerAddr,
                                     NamedType*  exceptionType,
-                                    bool   exceptionObjIsDead) {
-                                        void* exn_handle;
-                                        assert(exceptionType);
-                                        if (exceptionType->isSystemObject())
-                                            exn_handle = NULL;
-                                        else
-                                            exn_handle = exceptionType->getRuntimeIdentifier();
-                                        method_set_target_handler_info(drlMethod,
-                                            getJitHandle(),
-                                            exceptionHandlerNumber,
-                                            startAddr,
-                                            endAddr,
-                                            handlerAddr,
-                                            (Class_Handle) exn_handle,
-                                            exceptionObjIsDead ? TRUE : FALSE);
-                                    }
+                                    bool   exceptionObjIsDead) 
+{
+    void* exn_handle;
+    assert(exceptionType);
+    if (exceptionType->isSystemObject() || exceptionType->isUnresolvedObject()) {
+        exn_handle = NULL;
+    } else {
+        exn_handle = exceptionType->getRuntimeIdentifier();
+    }
+    method_set_target_handler_info(drlMethod,
+        getJitHandle(),
+        exceptionHandlerNumber,
+        startAddr,
+        endAddr,
+        handlerAddr,
+        (Class_Handle) exn_handle,
+        exceptionObjIsDead ? TRUE : FALSE);
+}
 
 
 //////////////////////////////////////////////////////////////////////////////
 ///////////////////////// FieldDesc ///////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////
 
-bool
-FieldDesc::isLiteral() const {
-    return field_is_literal(drlField)?true:false;
-}
 
 Class_Handle FieldDesc::getParentHandle() const {
     return field_get_class(drlField);
@@ -449,9 +447,15 @@
         // void return type
         type = typeManager.getVoidType();
     } else if (type_info_is_reference(typeHandle)) {
+        bool lazy = typeManager.isLazyResolutionMode();
+        if (lazy && !type_info_is_resolved(typeHandle)) {
+            return typeManager.getUnresolvedObjectType();
+        }
         Class_Handle classHandle = type_info_get_class_no_exn(typeHandle);
-        if (!classHandle)
+        if (!classHandle) {
+            assert(!lazy);
             return NULL;
+        }
         type = typeManager.getObjectType(classHandle);
     } else if (type_info_is_primitive(typeHandle)) {
         // value type
@@ -461,10 +465,24 @@
         type = typeManager.getValueType(valueTypeHandle);
     } else if (type_info_is_vector(typeHandle)) {
         // vector
+        bool lazy = typeManager.isLazyResolutionMode();
+        if (lazy && !type_info_is_resolved(typeHandle)) {
+            Type* elemType = typeManager.getUnresolvedObjectType();
+            uint32 dims =  type_info_get_num_array_dimensions(typeHandle);
+            Type* arrayType = NULL;
+            while (dims!=0) {
+                arrayType = typeManager.getArrayType(arrayType==NULL ? elemType : arrayType);
+                dims--;
+            }
+            assert(arrayType!=NULL && arrayType->isArrayType());
+            return arrayType;
+        }
         Type_Info_Handle elemTypeInfo = type_info_get_type_info(typeHandle);
         Type* elemType = getTypeFromDrlVMTypeHandle(elemTypeInfo);
-        if (!elemType)
+        if (!elemType) {
+            assert(!lazy);
             return NULL;
+        }
         type = typeManager.getArrayType(elemType);
     } else {
         // should not get here
@@ -521,8 +539,20 @@
     case Helper_ConvDtoI32:            vmHelperId = VM_RT_D2I; break;
     case Helper_ConvDtoI64:            vmHelperId = VM_RT_D2L; break;
     case Helper_MethodEntry:           vmHelperId = VM_RT_JVMTI_METHOD_ENTER_CALLBACK; break;
-    case Helper_MethodExit:             vmHelperId = VM_RT_JVMTI_METHOD_EXIT_CALLBACK; break;
+    case Helper_MethodExit:            vmHelperId = VM_RT_JVMTI_METHOD_EXIT_CALLBACK; break;
     case Helper_WriteBarrier:          vmHelperId = VM_RT_GC_HEAP_WRITE_REF; break;
+    case Helper_NewObjWithResolve:                  vmHelperId=VM_RT_NEWOBJ_WITHRESOLVE; break;
+    case Helper_NewArrayWithResolve:                vmHelperId=VM_RT_NEWARRAY_WITHRESOLVE; break;
+    case Helper_GetNonStaticFieldOffsetWithResolve: vmHelperId=VM_RT_GET_NONSTATIC_FIELD_OFFSET_WITHRESOLVE; break;
+    case Helper_GetStaticFieldAddrWithResolve:      vmHelperId=VM_RT_GET_STATIC_FIELD_ADDR_WITHRESOLVE; break;
+    case Helper_CheckCastWithResolve:               vmHelperId=VM_RT_CHECKCAST_WITHRESOLVE; break;
+    case Helper_InstanceOfWithResolve:              vmHelperId=VM_RT_INSTANCEOF_WITHRESOLVE; break;
+    case Helper_GetInvokeStaticAddrWithResolve:     vmHelperId=VM_RT_GET_INVOKESTATIC_ADDR_WITHRESOLVE; break;
+    case Helper_GetInvokeInterfaceAddrWithResolve:  vmHelperId=VM_RT_GET_INVOKEINTERFACE_ADDR_WITHRESOLVE; break;
+    case Helper_GetInvokeVirtualAddrWithResolve:    vmHelperId=VM_RT_GET_INVOKEVIRTUAL_ADDR_WITHRESOLVE; break;
+    case Helper_GetInvokeSpecialAddrWithResolve:    vmHelperId=VM_RT_GET_INVOKE_SPECIAL_ADDR_WITHRESOLVE; break;
+    case Helper_InitializeClassWithResolve:         vmHelperId=VM_RT_INITIALIZE_CLASS_WITHRESOLVE; break;
+
 
     default:
         assert(0);
@@ -582,135 +612,7 @@
     return res == JIT_SUCCESS ? true : false;
 }
 
-FieldDesc*  
-CompilationInterface::resolveField(MethodDesc* enclosingMethodDesc,
-                                        uint32 fieldToken,
-                                        bool putfield) {
-    Class_Handle enclosingDrlVMClass = enclosingMethodDesc->getParentHandle();
-    
-    Field_Handle resolvedField = 
-        resolve_nonstatic_field(compileHandle,enclosingDrlVMClass,fieldToken,putfield);
-    if (!resolvedField) return NULL;
-    return getFieldDesc(resolvedField);
-}
-
-FieldDesc*
-CompilationInterface::resolveFieldByIndex(NamedType* klass, int index, NamedType **fieldType) {
-
-    Class_Handle ch = (Class_Handle) klass->getVMTypeHandle();
-    Field_Handle fh;
-    fh = class_get_instance_field_recursive(ch,index);
-    ::std::cerr << "load field "<< class_get_name((Class_Handle) klass->getVMTypeHandle()) << ".";
-    ::std::cerr << field_get_name(fh) << " as ";
-    (*fieldType)->print(::std::cerr); ::std::cerr << ::std::endl;
-    return getFieldDesc(fh);
-}
-
-FieldDesc*
-CompilationInterface::resolveStaticField(MethodDesc* enclosingMethodDesc,
-                                                   uint32 fieldToken, bool putfield) {
-    Class_Handle enclosingDrlVMClass = enclosingMethodDesc->getParentHandle();
-
-    Field_Handle resolvedField = 
-        resolve_static_field(compileHandle,enclosingDrlVMClass,fieldToken,putfield);
-    if (!resolvedField) return NULL;
-    return getFieldDesc(resolvedField);
-}
 
-MethodDesc* 
-CompilationInterface::resolveVirtualMethod(MethodDesc* enclosingMethodDesc,
-                                                     uint32 methodToken) {
-    Class_Handle enclosingDrlVMClass = enclosingMethodDesc->getParentHandle();
-    
-    Method_Handle resolvedMethod = 
-        resolve_virtual_method(compileHandle,enclosingDrlVMClass,methodToken);
-    if (!resolvedMethod) return NULL;
-    return getMethodDesc(resolvedMethod);
-}    
-
-MethodDesc* 
-CompilationInterface::resolveSpecialMethod(MethodDesc* enclosingMethodDesc,
-                                                     uint32 methodToken) {
-    Class_Handle enclosingDrlVMClass = enclosingMethodDesc->getParentHandle();
-    
-    Method_Handle resolvedMethod = 
-        resolve_special_method(compileHandle,enclosingDrlVMClass,methodToken);
-    if (!resolvedMethod) return NULL;
-    return getMethodDesc(resolvedMethod);
-}    
-
-MethodDesc* 
-CompilationInterface::resolveStaticMethod(MethodDesc* enclosingMethodDesc,
-                                                    uint32 methodToken) {
-    Class_Handle enclosingDrlVMClass = enclosingMethodDesc->getParentHandle();
-    
-    Method_Handle resolvedMethod = 
-        resolve_static_method(compileHandle,enclosingDrlVMClass,methodToken);
-    if (!resolvedMethod) return NULL;
-    return getMethodDesc(resolvedMethod);
-}    
-
-MethodDesc* 
-CompilationInterface::resolveInterfaceMethod(MethodDesc* enclosingMethodDesc,
-                                                       uint32 methodToken) {
-    Class_Handle enclosingDrlVMClass = enclosingMethodDesc->getParentHandle();
-    
-    Method_Handle resolvedMethod = 
-        resolve_interface_method(compileHandle,enclosingDrlVMClass,methodToken);
-    if (!resolvedMethod) return NULL;
-    return getMethodDesc(resolvedMethod);
-}    
-
-NamedType*
-CompilationInterface::resolveNamedType(MethodDesc* enclosingMethodDesc,
-                                                 uint32 typeToken) {
-    Class_Handle enclosingDrlVMClass = enclosingMethodDesc->getParentHandle();
-    
-    Class_Handle ch = 
-        resolve_class(compileHandle,enclosingDrlVMClass,typeToken);
-    if (!ch) return NULL;
-    if (class_is_primitive(ch))
-        return typeManager.getValueType(ch);
-    return typeManager.getObjectType(ch);
-}
-
-NamedType*
-CompilationInterface::resolveNamedTypeNew(MethodDesc* enclosingMethodDesc,
-                                                    uint32 typeToken) {
-    Class_Handle enclosingDrlVMClass = enclosingMethodDesc->getParentHandle();
-    
-    Class_Handle ch = 
-        resolve_class_new(compileHandle,enclosingDrlVMClass,typeToken);
-    if (!ch) return NULL;
-    if (class_is_primitive(ch))
-        return typeManager.getValueType(ch);
-    return typeManager.getObjectType(ch);
-}
-
-Type*
-CompilationInterface::getFieldType(MethodDesc* enclosingMethodDesc,
-                                             uint32 entryCPIndex) {
-    Class_Handle enclosingDrlVMClass = enclosingMethodDesc->getParentHandle();
-    Java_Type drlType = (Java_Type)class_get_cp_field_type(enclosingDrlVMClass, (unsigned short)entryCPIndex);
-    switch (drlType) {
-    case JAVA_TYPE_BOOLEAN:  return typeManager.getBooleanType();
-    case JAVA_TYPE_CHAR:     return typeManager.getCharType();
-    case JAVA_TYPE_BYTE:     return typeManager.getInt8Type();
-    case JAVA_TYPE_SHORT:    return typeManager.getInt16Type();
-    case JAVA_TYPE_INT:      return typeManager.getInt32Type();
-    case JAVA_TYPE_LONG:     return typeManager.getInt64Type();
-    case JAVA_TYPE_DOUBLE:   return typeManager.getDoubleType();
-    case JAVA_TYPE_FLOAT:    return typeManager.getSingleType();
-    case JAVA_TYPE_ARRAY:
-    case JAVA_TYPE_CLASS:    return typeManager.getNullObjectType();
-
-    case JAVA_TYPE_VOID:     // class_get_cp_field_type can't return VOID
-    case JAVA_TYPE_STRING:   // class_get_cp_field_type can't return STRING
-    default: assert(0);
-    }
-    assert(0);
-    return NULL;
-}
 
 void* 
 CompilationInterface::loadStringObject(MethodDesc* enclosingMethodDesc,
@@ -746,6 +648,9 @@
 
 MethodDesc*
 CompilationInterface::getOverriddenMethod(NamedType* type, MethodDesc *methodDesc) {
+    if (type->isUnresolvedType()) {
+        return NULL;
+    }
     Method_Handle m = method_find_overridden_method((Class_Handle) type->getVMTypeHandle(),
                          methodDesc->getMethodHandle());
     if (!m)
@@ -841,24 +746,24 @@
 }
 
 FieldDesc*    CompilationInterface::getFieldDesc(Field_Handle field) {
-FieldDesc* fieldDesc = fieldDescs->lookup(field);
-if (fieldDesc == NULL) {
-fieldDesc = new (memManager)
-FieldDesc(field,this,nextMemberId++);
-fieldDescs->insert(field,fieldDesc);
-}
-return fieldDesc;
+    FieldDesc* fieldDesc = fieldDescs->lookup(field);
+    if (fieldDesc == NULL) {
+        fieldDesc = new (memManager)
+            FieldDesc(field,this,nextMemberId++);
+        fieldDescs->insert(field,fieldDesc);
+    }
+    return fieldDesc;
 }
 
 MethodDesc*   CompilationInterface:: getMethodDesc(Method_Handle method, JIT_Handle jit) {
-assert(method);
-MethodDesc* methodDesc = methodDescs->lookup(method);
-if (methodDesc == NULL) {
-methodDesc = new (memManager)
-MethodDesc(method, jit, this, nextMemberId++);
-methodDescs->insert(method,methodDesc);
-}
-return methodDesc;
+    assert(method);
+    MethodDesc* methodDesc = methodDescs->lookup(method);
+    if (methodDesc == NULL) {
+        methodDesc = new (memManager)
+            MethodDesc(method, jit, this, nextMemberId++);
+        methodDescs->insert(method,methodDesc);
+    }
+    return methodDesc;
 }
 
 CompilationInterface::CompilationInterface(Compile_Handle c, 
@@ -900,5 +805,166 @@
 MethodDesc*     CompilationInterface::getMethodDesc(Method_Handle method) {
     return getMethodDesc(method, getJitHandle());
 }
+
+
+static uint32 getArrayDims(Class_Handle cl, uint32 cpIndex) {
+    return class_get_num_array_dimensions(cl, (unsigned short)cpIndex);
+}
+
+static NamedType* getUnresolvedType(TypeManager& typeManager, Class_Handle enclClass, uint32 cpIndex) {
+    uint32 arrayDims = getArrayDims(enclClass, cpIndex);
+    NamedType * res = typeManager.getUnresolvedObjectType();
+    while (arrayDims > 0) {
+        res = typeManager.getArrayType(res);
+        arrayDims --;
+    }
+    return res;
+}
+
+NamedType* CompilationInterface::resolveNamedType(Class_Handle enclClass, uint32 cpIndex) {
+    //this method is allowed to use only for unresolved exception types
+    Class_Handle ch = resolve_class(compileHandle,enclClass,cpIndex);
+    assert(!class_is_primitive(ch));
+    ObjectType* res = typeManager.getObjectType(ch);    
+    assert(res->isLikelyExceptionType());
+    return res;
+}
+
+NamedType* CompilationInterface::getNamedType(Class_Handle enclClass, uint32 cpIndex, ResolveNewCheck checkNew) {
+    Class_Handle ch = NULL;
+    bool lazy = typeManager.isLazyResolutionMode();
+    if (lazy && !class_is_cp_entry_resolved(compileHandle, enclClass, cpIndex)) {
+        NamedType * res = getUnresolvedType(typeManager, enclClass, cpIndex);
+        return res; 
+    } else {
+        if (checkNew == ResolveNewCheck_DoCheck) {
+            ch = resolve_class_new(compileHandle,enclClass,cpIndex);
+        } else {
+            ch = resolve_class(compileHandle,enclClass,cpIndex);
+        }
+        if (ch == NULL) {
+            if (lazy) {//instantiation of abstract/private class -> do it lazily
+                assert(checkNew == ResolveNewCheck_DoCheck);
+                return typeManager.getUnresolvedObjectType();
+            } else {
+                return NULL;
+            }
+        }
+    }
+    if (class_is_primitive(ch)) {
+        return typeManager.getValueType(ch);
+    }
+    return typeManager.getObjectType(ch);    
+}
+
+Type* CompilationInterface::getTypeFromDescriptor(Class_Handle enclClass, const char* descriptor) {
+    ClassLoaderHandle loader = class_get_class_loader(enclClass);
+    Type_Info_Handle tih = type_info_create_from_java_descriptor(loader, descriptor);
+    return getTypeFromDrlVMTypeHandle(tih);
+}
+
+MethodDesc* 
+CompilationInterface::getSpecialMethod(Class_Handle enclClass, uint32 cpIndex) {
+    Method_Handle res = NULL;
+    bool lazy = typeManager.isLazyResolutionMode();
+    if (!lazy || class_is_cp_entry_resolved(compileHandle, enclClass, cpIndex)) {
+        res =  resolve_special_method(compileHandle,enclClass, cpIndex);
+    }
+    if (!res) return NULL;
+    return getMethodDesc(res);
+}    
+
+MethodDesc* 
+CompilationInterface::getInterfaceMethod(Class_Handle enclClass, uint32 cpIndex) {
+    Method_Handle res = NULL;
+    bool lazy = typeManager.isLazyResolutionMode();
+    if (!lazy || class_is_cp_entry_resolved(compileHandle, enclClass, cpIndex)) {
+        res =  resolve_interface_method(compileHandle,enclClass, cpIndex);
+    }
+    if (!res) return NULL;
+    return getMethodDesc(res);
+}    
+
+MethodDesc* 
+CompilationInterface::getStaticMethod(Class_Handle enclClass, uint32 cpIndex) {
+    Method_Handle res = NULL;
+    bool lazy = typeManager.isLazyResolutionMode();
+    if (!lazy || class_is_cp_entry_resolved(compileHandle, enclClass, cpIndex)) {
+        res =  resolve_static_method(compileHandle,enclClass, cpIndex);
+    }
+    if (!res) return NULL;
+    return getMethodDesc(res);
+}    
+
+MethodDesc* 
+CompilationInterface::getVirtualMethod(Class_Handle enclClass, uint32 cpIndex) {
+    Method_Handle res = NULL;
+    bool lazy = typeManager.isLazyResolutionMode();
+    if (!lazy || class_is_cp_entry_resolved(compileHandle, enclClass, cpIndex)) {
+        res =  resolve_virtual_method(compileHandle,enclClass, cpIndex);
+    }
+    if (!res) return NULL;
+    return getMethodDesc(res);
+}    
+
+
+FieldDesc*  
+CompilationInterface::getNonStaticField(Class_Handle enclClass, uint32 cpIndex, bool putfield) {
+    Field_Handle res = NULL;
+    bool lazy = typeManager.isLazyResolutionMode();
+    if (!lazy || class_is_cp_entry_resolved(compileHandle, enclClass, cpIndex)) {
+        res = resolve_nonstatic_field(compileHandle, enclClass, cpIndex, putfield);
+    }
+    if (!res) {
+        return NULL;
+    }
+    return getFieldDesc(res);
+}
+
+
+FieldDesc*  
+CompilationInterface::getStaticField(Class_Handle enclClass, uint32 cpIndex, bool putfield) {
+    Field_Handle res = NULL;
+    bool lazy = typeManager.isLazyResolutionMode();
+    if (!lazy || class_is_cp_entry_resolved(compileHandle, enclClass, cpIndex)) {
+        res = resolve_static_field(compileHandle, enclClass, cpIndex, putfield);
+    }
+    if (!res) {
+        return NULL;
+    }
+    return getFieldDesc(res);
+}
+
+Type*
+CompilationInterface::getFieldType(Class_Handle enclClass, uint32 cpIndex) {
+    Java_Type drlType = (Java_Type)class_get_cp_field_type(enclClass, (unsigned short)cpIndex);
+    bool lazy = typeManager.isLazyResolutionMode();
+    switch (drlType) {
+        case JAVA_TYPE_BOOLEAN:  return typeManager.getBooleanType();
+        case JAVA_TYPE_CHAR:     return typeManager.getCharType();
+        case JAVA_TYPE_BYTE:     return typeManager.getInt8Type();
+        case JAVA_TYPE_SHORT:    return typeManager.getInt16Type();
+        case JAVA_TYPE_INT:      return typeManager.getInt32Type();
+        case JAVA_TYPE_LONG:     return typeManager.getInt64Type();
+        case JAVA_TYPE_DOUBLE:   return typeManager.getDoubleType();
+        case JAVA_TYPE_FLOAT:    return typeManager.getSingleType();
+        case JAVA_TYPE_ARRAY:
+        
+        case JAVA_TYPE_CLASS:    
+                if (lazy) {
+                    const char* fieldTypeName = const_pool_get_field_descriptor(enclClass, cpIndex);
+                    assert(fieldTypeName);
+                    return getTypeFromDescriptor(enclClass, fieldTypeName);
+                } 
+                return typeManager.getNullObjectType();
+
+        case JAVA_TYPE_VOID:     // class_get_cp_field_type can't return VOID
+        case JAVA_TYPE_STRING:   // class_get_cp_field_type can't return STRING
+        default: assert(0);
+    }
+    assert(0);
+    return NULL;
+}
+
 
 } //namespace Jitrino

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/Class.h Wed May 23 04:22:55 2007
@@ -1155,6 +1155,11 @@
         return m_vtable_descriptors[method_idx];
     }
 
+    /// Returns the number of virtual methods in vtable
+    unsigned get_number_of_virtual_method_entries() const {
+        return m_num_virtual_method_entries;
+    }
+
     /** Gets the first subclass for Class Hierarchy Analysis.
      * @return The first subclass.*/
     Class* get_first_child() const { return m_cha_first_child; }
@@ -2024,5 +2029,17 @@
  *         otherwise <code>true</code>.*/
 bool
 class_unregister_methods(Class_Handle klass);
+
+//method is defined in Resolve.cpp
+Class* resolve_class_new_env(Global_Env* env, Class* clss, unsigned cp_index, bool raise_exn);
+Method* resolve_special_method_env(Global_Env *env, Class_Handle curr_clss, unsigned index, bool raise_exn);
+Method* resolve_static_method_env(Global_Env *env, Class *clss, unsigned cp_index, bool raise_exn);
+Method* resolve_virtual_method_env(Global_Env *env, Class *clss, unsigned cp_index, bool raise_exn);
+Method* resolve_interface_method_env(Global_Env *env, Class *clss, unsigned cp_index, bool raise_exn);
+Field* resolve_static_field_env(Global_Env *env, Class *clss, unsigned cp_index, bool putfield, bool is_runtume);
+Field* resolve_nonstatic_field_env(Global_Env* env, Class* clss, unsigned cp_index, unsigned putfield, bool raise_exn);
+
+
+
 
 #endif // _CLASS_H_

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/type.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/type.h?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/type.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/type.h Wed May 23 04:22:55 2007
@@ -91,6 +91,8 @@
     // For other types return NULL.
     Class* load_type_desc();
 
+    bool is_loaded() const {return clss != NULL;}
+
     const String* get_type_name(){
         return name;
     }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp Wed May 23 04:22:55 2007
@@ -59,9 +59,32 @@
 } //class_is_array
 
 
-Boolean     class_get_array_num_dimensions(Class_Handle cl) {
-    assert(cl);
-    return cl->get_number_of_dimensions();
+static uint32 countLeadingChars(const char* str, char c) {
+    uint32 n=0;
+    while (str[n]==c) {
+        n++;                
+    }
+    return n;
+}
+ 
+VMEXPORT uint32 class_get_num_array_dimensions(Class_Handle cl, unsigned short cpIndex) {
+    ConstantPool& cp  = cl->get_constant_pool();
+    unsigned char tag = cp.get_tag(cpIndex);
+    char c = '[';
+    switch (tag) {
+        case CONSTANT_Class: {
+            uint16 nameIdx = cp.get_class_name_index(cpIndex);
+            const char* str = cp.get_utf8_string(nameIdx)->bytes;
+            return countLeadingChars(str, c);
+        }
+        case CONSTANT_Fieldref: {
+            const char* str = class_get_cp_entry_signature(cl, cpIndex);
+            return countLeadingChars(str, c);
+        }
+        default:
+            assert(0);
+    }
+    return 0;
 }
 
 const char* class_get_package_name(Class_Handle cl) {
@@ -2083,6 +2106,54 @@
     }
 } //type_info_get_type_info
 
+uint32 type_info_get_num_array_dimensions(Type_Info_Handle tih) {
+    TypeDesc* td = (TypeDesc*)tih;
+    if (td->get_kind() == K_Vector) {
+        const String* name = td->get_type_name();
+        uint32 res = 0;
+        if (name == NULL) {
+            res = 1 + type_info_get_num_array_dimensions(td->get_element_type());
+        } else {
+            res = countLeadingChars(name->bytes, '[');
+        }
+        assert(res<=255);
+        return res;
+    }
+    return 0;
+}
+
+Boolean type_info_is_resolved(Type_Info_Handle tih) {
+    TypeDesc* td = (TypeDesc*)tih;
+    switch (td->get_kind()) {
+        case K_Vector:
+            if (td->get_element_type()->is_primitive()) {
+                return true;
+            }
+            return type_info_is_resolved(td->get_element_type());
+        case K_Object:
+            {
+                bool res = td->is_loaded();
+                if (!res) {
+                    const String* typeName = td->get_type_name();
+                    assert(typeName);
+                    res =  td->get_classloader()->LookupClass(typeName) != NULL;
+                    if (res) {
+                        // type descs for some bootstrap classes (e.g. java/lang/Throwable) 
+                        // are not initialized by default. Do it here to avoid extra lookups next time
+                        td->load_type_desc();
+                        assert(td->is_loaded());
+                    }
+                }
+                
+                return res;
+            }
+        default:
+            ABORT("Unexpected kind");
+            return 0;
+    }
+}
+
+
 void free_string_buffer(char *buffer)
 {
     STD_FREE(buffer);
@@ -2109,6 +2180,10 @@
 } //class_get_element_type_info
 
 
+Type_Info_Handle type_info_create_from_java_descriptor(ClassLoaderHandle cl, const char* typeName) {
+    return type_desc_create_from_java_descriptor(typeName, cl);
+}
+
 
 /////////////////////////////////////////////////////
 // New GC stuff
@@ -2168,7 +2243,7 @@
 void* class_alloc_via_classloader(Class_Handle ch, int32 size)
 {
     assert(ch);
-	assert(size >= 0);
+    assert(size >= 0);
     Class *clss = (Class *)ch;
     assert (clss->get_class_loader());
     return clss->get_class_loader()->Alloc(size);
@@ -2630,7 +2705,7 @@
     switch(table_number) {
     case JAVA_PROPERTIES: 
         VM_Global_State::loader_env->JavaProperties()->set(key, value);
-    	break;
+        break;
     case VM_PROPERTIES: 
         VM_Global_State::loader_env->VmProperties()->set(key, value);
         break;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Resolve.cpp Wed May 23 04:22:55 2007
@@ -221,8 +221,8 @@
 }
 
 
-Class* _resolve_class_new(Global_Env* env, Class* clss,
-                          unsigned cp_index)
+Class* resolve_class_new_env(Global_Env* env, Class* clss,
+                          unsigned cp_index, bool raise_exn)
 {
     ASSERT_RAISE_AREA;
 
@@ -504,36 +504,52 @@
 static bool LINK_WRITE_ACCESS   = true;  // link from putfield/putstatic
 static bool LINK_READ_ACCESS = false;    // link from getfield/getstatic
 static bool LINK_THROW_ERRORS = true;    // should throw linking exception on error
-static bool LINK_NO_THROW = false;       // must not throw linking exception on error
 
-static Field* _resolve_static_field(Global_Env *env,
-                                  Class *clss,
-                                  unsigned cp_index,
-                                  bool putfield)
-{
+Field* resolve_static_field_env(Global_Env *env,
+                                Class *clss,
+                                unsigned cp_index,
+                                bool putfield, 
+                                bool is_runtume)
+ {
     ASSERT_RAISE_AREA;
-
+ 
     Field *field = clss->_resolve_field(env, cp_index);
-    if(field && !field_can_link(clss, field, CAN_LINK_FROM_STATIC, putfield, LINK_NO_THROW)) {
+    if(!field) {
+        assert(clss->get_constant_pool().is_entry_in_error(cp_index));
+        if (is_runtume) {
+            exn_raise_object(clss->get_constant_pool().get_error_cause(cp_index));
+        }
+        return NULL;
+     }
+    if(!field_can_link(clss, field, CAN_LINK_FROM_STATIC, putfield, is_runtume)) {
         return NULL;
     }
-    return field;
-} // _resolve_static_field
+     return field;
+ }
 
 
-static Field* _resolve_nonstatic_field(Global_Env* env,
-                                       Class* clss,
-                                       unsigned cp_index,
-                                       unsigned putfield)
-{
-    ASSERT_RAISE_AREA;
-
+Field* resolve_nonstatic_field_env(Global_Env* env,
+                                    Class* clss,
+                                    unsigned cp_index,
+                                    unsigned putfield, 
+                                    bool raise_exn)
+ {
+     ASSERT_RAISE_AREA;
+ 
     Field *field = clss->_resolve_field(env, cp_index);
-    if(field && !field_can_link(clss, field, CAN_LINK_FROM_FIELD, putfield, LINK_NO_THROW)) {
+    if(!field) {
+        assert(clss->get_constant_pool().is_entry_in_error(cp_index));
+        if (raise_exn) {
+            exn_raise_object(clss->get_constant_pool().get_error_cause(cp_index));
+        }
+        return NULL;
+    }
+    if(!field_can_link(clss, field, CAN_LINK_FROM_FIELD, putfield, raise_exn)) {
         return NULL;
     }
     return field;
-} // _resolve_nonstatic_field
+ } 
+
 
 
 Method* Class::_resolve_method(Global_Env* env, unsigned cp_index)
@@ -645,17 +661,27 @@
     return true;
 }
 
-static Method* _resolve_static_method(Global_Env *env,
-                                      Class *clss,
-                                      unsigned cp_index)
+Method* resolve_static_method_env(Global_Env *env,
+                                Class *clss,
+                                unsigned cp_index, 
+                                bool raise_exn)
 {
     ASSERT_RAISE_AREA;
-
+ 
     Method* method = clss->_resolve_method(env, cp_index);
-    if(method && !method_can_link_static(clss, cp_index, method, LINK_NO_THROW))
+    if(!method) {
+        assert(clss->get_constant_pool().is_entry_in_error(cp_index));
+        if (raise_exn) {
+            exn_raise_object(clss->get_constant_pool().get_error_cause(cp_index));
+        }
         return NULL;
+    }
+
+    if (!method_can_link_static(clss, cp_index, method, raise_exn)) {
+        return NULL;
+    }
     return method;
-} //_resolve_static_method
+}
 
 
 static bool method_can_link_virtual(Class* clss, unsigned cp_index, Method* method, bool _throw)
@@ -684,15 +710,25 @@
 }
 
 
-static Method* _resolve_virtual_method(Global_Env *env,
-                                       Class *clss,
-                                       unsigned cp_index)
+Method* resolve_virtual_method_env(Global_Env *env,
+                                    Class *clss,
+                                    unsigned cp_index,
+                                    bool raise_exn)
 {
     Method* method = clss->_resolve_method(env, cp_index);
-    if(method && !method_can_link_virtual(clss, cp_index, method, LINK_NO_THROW))
+    if(!method) {
+        assert(clss->get_constant_pool().is_entry_in_error(cp_index));
+        if (raise_exn) {
+            exn_raise_object(clss->get_constant_pool().get_error_cause(cp_index));
+        }
+        return NULL;
+    }
+
+    if (!method_can_link_virtual(clss, cp_index, method, raise_exn)) {
         return NULL;
+    }
     return method;
-} //_resolve_virtual_method
+}
 
 
 static bool method_can_link_interface(Class* clss, unsigned cp_index, Method* method, bool _throw) {
@@ -700,16 +736,24 @@
 }
 
 
-static Method* _resolve_interface_method(Global_Env *env,
-                                         Class *clss,
-                                         unsigned cp_index)
-{
+Method* resolve_interface_method_env(Global_Env *env,
+                                    Class *clss,
+                                    unsigned cp_index, 
+                                    bool raise_exn)
+ {
     Method* method = clss->_resolve_method(env, cp_index);
-    if(method && !method_can_link_interface(clss, cp_index, method, LINK_NO_THROW)) {
+    if (!method) {
+        assert(clss->get_constant_pool().is_entry_in_error(cp_index));
+        if (raise_exn) {
+            exn_raise_object(clss->get_constant_pool().get_error_cause(cp_index));
+        }
+        return NULL;
+     }
+    if (!method_can_link_interface(clss, cp_index, method, raise_exn)) {
         return NULL;
     }
     return method;
-} //_resolve_interface_method
+}
 
 
 Field_Handle resolve_field(Compile_Handle h,
@@ -729,7 +773,7 @@
                                      unsigned index,
                                      unsigned putfield)
 {
-    return _resolve_nonstatic_field(compile_handle_to_environment(h), c, index, putfield);
+    return resolve_nonstatic_field_env(compile_handle_to_environment(h), c, index, putfield, false);
 } //resolve_nonstatic_field
 
 
@@ -742,7 +786,7 @@
                                   unsigned index,
                                   unsigned putfield)
 {
-    return _resolve_static_field(compile_handle_to_environment(h), c, index, putfield);
+    return resolve_static_field_env(compile_handle_to_environment(h), c, index, putfield, false);
 } //resolve_static_field
 
 
@@ -760,7 +804,7 @@
                                      Class_Handle c,
                                      unsigned index)
 {
-    return _resolve_virtual_method(compile_handle_to_environment(h), c, index);
+    return resolve_virtual_method_env(compile_handle_to_environment(h), c, index, false);
 } //resolve_virtual_method
 
 
@@ -813,14 +857,19 @@
 // resolve constant pool reference to a method
 // used for invokespecial
 //
-Method_Handle resolve_special_method_env(Global_Env *env,
-                                         Class_Handle curr_clss,
-                                         unsigned index)
+Method* resolve_special_method_env(Global_Env *env,
+                                    Class_Handle curr_clss,
+                                    unsigned index,
+                                    bool raise_exn)
 {
     ASSERT_RAISE_AREA;
 
     Method* method = curr_clss->_resolve_method(env, index);
     if(!method) {
+        assert(curr_clss->get_constant_pool().is_entry_in_error(index));
+        if (raise_exn) {
+            exn_raise_object(curr_clss->get_constant_pool().get_error_cause(index));
+        }
         return NULL;
     }
     if(curr_clss->is_super()
@@ -851,7 +900,7 @@
                                      Class_Handle c,
                                      unsigned index)
 {
-    return resolve_special_method_env(compile_handle_to_environment(h), c, index);
+    return resolve_special_method_env(compile_handle_to_environment(h), c, index, false);
 } //resolve_special_method
 
 
@@ -864,7 +913,7 @@
                                     Class_Handle c,
                                     unsigned index) 
 {
-    return _resolve_static_method(compile_handle_to_environment(h), c, index);
+    return resolve_static_method_env(compile_handle_to_environment(h), c, index, false);
 } //resolve_static_method
 
 
@@ -877,7 +926,7 @@
                                        Class_Handle c,
                                        unsigned index) 
 {
-    return _resolve_interface_method(compile_handle_to_environment(h), c, index);
+    return resolve_interface_method_env(compile_handle_to_environment(h), c, index, false);
 } //resolve_interface_method
 
 
@@ -898,7 +947,7 @@
                                Class_Handle c,
                                unsigned index) 
 {
-    return _resolve_class_new(compile_handle_to_environment(h), c, index);
+    return resolve_class_new_env(compile_handle_to_environment(h), c, index, false);
 } //resolve_class_new
 
 
@@ -912,6 +961,38 @@
 {
     return c->_resolve_class(compile_handle_to_environment(h), index);
 } //resolve_class
+
+Boolean class_is_cp_entry_resolved(Compile_Handle ch, Class_Handle clazz, unsigned cp_index) {
+    ConstantPool& cp = clazz->get_constant_pool();
+    Boolean res = cp.is_entry_resolved(cp_index);
+    if (!res) {
+        unsigned char tag = cp.get_tag(cp_index);
+        //during the loading of a class not all items in it's constant pool are updated
+        if (tag == CONSTANT_Fieldref || tag == CONSTANT_Methodref  
+            || tag == CONSTANT_InterfaceMethodref || tag == CONSTANT_Class)
+        {
+            uint16 typeIndex = tag == CONSTANT_Class ? cp_index : cp.get_ref_class_index(cp_index);
+            res = cp.is_entry_resolved(typeIndex);
+            if (!res) {
+                // the type is not marked as loaded in local constant pool
+                // ask classloader directly
+                uint16 nameIdx = cp.get_class_name_index(typeIndex);
+                String* typeName = cp.get_utf8_string(nameIdx);
+                assert(typeName!=NULL);
+                Class* type = clazz->get_class_loader()->LookupClass(typeName);
+                if (type) {
+                    /*TODO: uncommenting this code lead to a crash in StressLoader test
+                    clazz->lock();
+                    cp.resolve_entry(typeIndex, type);
+                    clazz->unlock();*/
+                    res = true;
+                }
+            }
+
+        } 
+    }
+    return res;
+}
 
 
 void class_throw_linking_error(Class_Handle ch, unsigned index, unsigned opcode)

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/method.cpp Wed May 23 04:22:55 2007
@@ -710,12 +710,6 @@
 //////////////////////////////////////////////////////
 // begin nop analysis
 
-
-Method_Handle resolve_special_method_env(Global_Env *env,
-                                         Class_Handle c,
-                                         unsigned index);
-
-
 enum Nop_Stack_State {
     NS_StackEmpty,
     NS_ThisPushed,
@@ -779,7 +773,7 @@
                     }
                     Method_Handle mh = resolve_special_method_env(VM_Global_State::loader_env,
                                                                   get_class(),
-                                                                  index);
+                                                                  index, false);
                     Method *callee = (Method *)mh;
                     if(!callee) {
                         if(verbose) {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp Wed May 23 04:22:55 2007
@@ -757,6 +757,10 @@
     // Precompile InternalError.
     class_alloc_new_object_and_run_default_constructor(vm_env->java_lang_InternalError_Class);
 
+    //String must be initialized before strings from intern pool are used
+    class_initialize(vm_env->JavaLangString_Class);
+
+
     hythread_suspend_enable();
 
     // Mark j.l.Throwable() constructor as a side effects free.



Mime
View raw message