harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r540926 [2/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/optimizer/IRBuilder.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.h?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.h Wed May 23 04:22:55 2007
@@ -24,6 +24,8 @@
 #ifndef _IRBUILDER_H_
 #define _IRBUILDER_H_
 
+#include "open/bytecodes.h"
+
 #include "MemoryManager.h"
 #include "Opcode.h"
 #include "Inst.h"
@@ -118,9 +120,21 @@
     void  genBranch(Type::Tag instType, ComparisonModifier mod, LabelInst* label, Opnd* src); // TR //SI
     void  genJump(LabelInst* label); //TR
     void  genSwitch(uint32 numLabels, LabelInst* label[], LabelInst* defaultLabel, Opnd* src);//TR
+
+        
     // Calls
     // If the call does not return a value, then the returned Opnd* is the
     // null Opnd*.
+    Opnd* genIndirectCallWithResolve(Type* returnType,
+                                    Opnd* tauNullCheckedFirstArg,
+                                    Opnd* tauTypesChecked,
+                                    uint32 numArgs,
+                                    Opnd* args[],
+                                    ObjectType* ch,
+                                    JavaByteCodes bc,
+                                    uint32 cpIndex
+                                    );
+    
     Opnd* genDirectCall(MethodDesc* methodDesc, // TR //SI
                         Type* returnType,
                         Opnd* tauNullCheckedFirstArg, // 0 for unsafe
@@ -198,11 +212,17 @@
     Opnd*      genLdElem(Type* elemType, Opnd* array, Opnd* index,
                          Opnd* tauNullCheck, Opnd* tauAddressInRange);
     Opnd*      genLdFieldAddr(Type* fieldType, Opnd* base, FieldDesc* fieldDesc); //TR
+    Opnd*      genLdFieldAddrWithResolve(Type* fieldType, Opnd* base, ObjectType* enclClass, uint32 cpIndex, bool putfield); //TR
     Opnd*      genLdStaticAddr(Type* fieldType, FieldDesc* fieldDesc);//TR
+    Opnd*      genLdStaticAddrWithResolve(Type* fieldType, ObjectType* enclClass, uint32 cpIndex, bool putfield);//TR
     Opnd*      genLdElemAddr(Type* elemType, Opnd* array, Opnd* index);//TR
     Opnd*      genLdVirtFunAddr(Opnd* base, MethodDesc* methodDesc);//TR
     Opnd*      genLdFunAddr(MethodDesc* methodDesc);//TR
     Opnd*      genArrayLen(Type* dstType, Type::Tag type, Opnd* array); // TR
+
+    Opnd*      genLdFieldWithResolve(Type*, Opnd* base, ObjectType* enclClass, uint32 cpIdx); //TR
+    Opnd*      genLdStaticWithResolve(Type*, ObjectType* enclClass, uint32 cpIdx);//TR
+
     // store instructions
     void       genStVar(VarOpnd* var, Opnd* src);//TR
     void       genStField(Type*, Opnd* base, FieldDesc* fieldDesc, Opnd* src);//TR
@@ -211,14 +231,22 @@
     void       genStElem(Type*, Opnd* array, Opnd* index, Opnd* src,
                          Opnd* tauNullCheck, Opnd* tauBaseTypeCheck, Opnd* tauAddressInRange);
     void       genStInd(Type*, Opnd* ptr, Opnd* src);//TR
+
+    void       genStFieldWithResolve(Type*, Opnd* base, ObjectType* enclClass, uint32 cpIdx, Opnd* src);//TR
+    void       genStStaticWithResolve(Type*, ObjectType* enclClass, uint32 cpIdx, Opnd* src);//TR
+
     // checks
     Opnd*      genTauCheckNull(Opnd* base);
     Opnd*      genTauCheckBounds(Opnd* array, Opnd* index, Opnd *tauNullChecked);
     Opnd*      genCheckFinite(Type* dstType, Opnd* src); // TR
     // allocation
     Opnd*      genNewObj(Type* type);//TR
+    Opnd*      genNewObjWithResolve(ObjectType* enclClass, uint32 cpIndex);//TR
     Opnd*      genNewArray(NamedType* elemType, Opnd* numElems);//TR
+    Opnd*      genNewArrayWithResolve(NamedType* elemType, Opnd* numElems, ObjectType* enclClass, uint32 cpIndex);//TR
     Opnd*      genMultianewarray(NamedType* arrayType, uint32 dimensions, Opnd** numElems);//TR
+    Opnd*      genMultianewarrayWithResolve(NamedType* arrayType, ObjectType* enclClass, uint32 cpIndex, uint32 dimensions, Opnd** numElems);//TR
+    //Opnd*      genMultianewarrayWithResolve(NamedType* arrayType, uint32 dimensions, Opnd** numElems);//TR
     // sync
     void       genMonitorEnter(Opnd* src); // also inserts nullcheck of src//TR
     void       genMonitorExit(Opnd* src);  // also inserts nullcheck of src//TR
@@ -233,10 +261,12 @@
     // type checking
     // CastException (succeeds if argument is null, returns casted object)
     Opnd*      genCast(Opnd* src, Type* type); // TR
+    Opnd*      genCastWithResolve(Opnd* src, Type* type, ObjectType* enclClass, uint32 cpIndex); // TR
     // returns trueResult if src is an instance of type, 0 otherwise
     Opnd*      genAsType(Opnd* src, Type* type); // TR
     // returns 1 if src is not null and an instance of type, 0 otherwise
     Opnd*      genInstanceOf(Opnd* src, Type* type); //TR
+    Opnd*      genInstanceOfWithResolve(Opnd* src, ObjectType* enclClass, uint32 cpIndex); //TR
     void       genInitType(NamedType* type); //TR
     // labels
     void       genLabel(LabelInst* labelInst); //TR
@@ -313,9 +343,7 @@
                                      Opnd* args[],
                                      InlineInfoBuilder* inlineInfoBuilder);     // NULL if this call is not inlined
 
-    Opnd*      genLdFieldAddrNoChecks(Type* fieldType, Opnd* base, FieldDesc* fieldDesc);
     Opnd*      genLdElemAddrNoChecks(Type *elemType, Opnd* array, Opnd* index);
-    Opnd*      genLdStaticAddrNoChecks(Type *fieldType, FieldDesc* fieldDesc);
     Opnd*      genTauLdVirtFunAddrSlot(Opnd* base, Opnd* tauOk, MethodDesc* methodDesc);
     Opnd*      genLdVTable(Opnd* base, Type* type);
     Opnd*      genTauLdVTable(Opnd* base, Opnd *tauNullChecked, Type* type);
@@ -345,6 +373,9 @@
     Opnd*      genTauCheckCast(Opnd* src, Opnd *tauNullChecked, Type* type);
     Opnd*      genTauStaticCast(Opnd *src, Opnd *tauCheckedCast, Type *castType);
     Opnd*      genTauHasType(Opnd *src, Type *hasType);
+    //generates tauhastype + copy conversion of src has unresolved type
+    //stores result of conversion in *src
+    Opnd*      genTauHasTypeWithConv(Opnd **src, Type *hasType);
     Opnd*      genTauHasExactType(Opnd *src, Type *hasType);
     Opnd*      genTauIsNonNull(Opnd *src);
     Opnd*      genTauAnd(Opnd *src1, Opnd *src2);
@@ -392,6 +423,7 @@
     Type*    getOpndTypeFromLdType(Type* ldType);
     Opnd*    createOpnd(Type*);
     PiOpnd*  createPiOpnd(Opnd *org);
+    Opnd*    createTypeOpnd(ObjectType* type);
     Opnd*    lookupHash(uint32 opc);
     Opnd*    lookupHash(uint32 opc, uint32 op);
     Opnd*    lookupHash(uint32 opc, uint32 op1, uint32 op2);

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.cpp Wed May 23 04:22:55 2007
@@ -270,7 +270,7 @@
     }
 }
 
-char *massageStr(const char *string) {
+char *messageStr(const char *string) {
     if (strcmp(string, "<init>")==0)
         return "_init_";
     if (strcmp(string, "<clinit>")==0)
@@ -282,7 +282,7 @@
     switch (code) {
     case 'd':
         os  << methodDesc->getParentType()->getName()
-            << "::" << massageStr(methodDesc->getName());
+            << "::" << messageStr(methodDesc->getName());
         break;
     default:
         Inst::handlePrintEscape(os, code);
@@ -294,7 +294,7 @@
     switch (code) {
     case 'd':
         os  << methodDesc->getParentType()->getName()
-            << "::" << massageStr(methodDesc->getName());
+            << "::" << messageStr(methodDesc->getName());
         break;
     default:
         Inst::handlePrintEscape(os, code);
@@ -424,7 +424,7 @@
     switch (code) {
     case 'd':
         os  << methodDesc->getParentType()->getName()
-            << "::" << massageStr(methodDesc->getName());
+            << "::" << messageStr(methodDesc->getName());
         break;
     default:
         Inst::handlePrintEscape(os, code);
@@ -616,6 +616,9 @@
     void accept(JitHelperCallInst* inst) {
         clone = instFactory.makeClone(inst, opndManager, renameTable);
     }
+    void accept(VMHelperCallInst* inst) {
+        clone = instFactory.makeClone(inst, opndManager, renameTable);
+    }
     void accept(MethodEntryInst* inst) {
         clone = instFactory.makeClone(inst, opndManager, renameTable);
     }
@@ -1065,6 +1068,27 @@
                                  nsrcs,
                                  newArgs,
                                  inst->getJitHelperId());
+    newInst->setPersistentInstructionId(inst->getPersistentInstructionId());
+    return newInst;
+}
+
+VMHelperCallInst*
+InstFactory::makeClone(VMHelperCallInst* inst,
+                       OpndManager& opndManager,
+                       OpndRenameTable& table)
+{
+    uint32 nsrcs = inst->getNumSrcOperands();
+    Opnd** newArgs = new (memManager) Opnd*[nsrcs];
+    for (uint32 i=0; i<nsrcs; i++){
+        newArgs[i] = table.rename(inst->getSrc(i));
+    }
+    VMHelperCallInst *newInst = makeVMHelperCallInst(inst->getOpcode(),
+        inst->getModifier(),
+        inst->getType(),
+        table.duplicate(opndManager, inst->getDst()),
+        nsrcs,
+        newArgs,
+        inst->getVMHelperId());
     newInst->setPersistentInstructionId(inst->getPersistentInstructionId());
     return newInst;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.h?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.h Wed May 23 04:22:55 2007
@@ -92,6 +92,7 @@
     virtual void accept(DispatchLabelInst*) = 0;
     virtual void accept(IntrinsicCallInst*) = 0;
     virtual void accept(JitHelperCallInst*) = 0;
+    virtual void accept(VMHelperCallInst*) = 0;
     virtual void accept(FieldAccessInst*) = 0;
     virtual void accept(LabelInst*) = 0;
     virtual void accept(MethodCallInst*) = 0;
@@ -1361,6 +1362,7 @@
     CallInst*           makeClone(CallInst*, OpndManager&, OpndRenameTable&);
     IntrinsicCallInst*  makeClone(IntrinsicCallInst*, OpndManager&, OpndRenameTable&);
     JitHelperCallInst*  makeClone(JitHelperCallInst*, OpndManager&, OpndRenameTable&);
+    VMHelperCallInst*   makeClone(VMHelperCallInst*, OpndManager&, OpndRenameTable&);
     PhiInst*            makeClone(PhiInst*, OpndManager&, OpndRenameTable&);
     MultiSrcInst*       makeClone(MultiSrcInst*, OpndManager&, OpndRenameTable&);
 public:

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Opnd.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Opnd.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Opnd.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Opnd.cpp Wed May 23 04:22:55 2007
@@ -160,6 +160,7 @@
     case Type::CompressedNullObject:
     case Type::SystemObject:    case Type::SystemClass:    case Type::SystemString:
     case Type::Array:           case Type::Object:
+    case Type::UnresolvedObject:
     case Type::NullObject:
     case Type::Offset:  case Type::OffsetPlusHeapbase:
     case Type::VTablePtr:

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/devirtualizer.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/devirtualizer.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/devirtualizer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/devirtualizer.cpp Wed May 23 04:22:55 2007
@@ -91,7 +91,6 @@
         assert(tauNullChecked->getType()->tag == Type::Tau);
         assert(tauTypesChecked->getType()->tag == Type::Tau);
     } else if(opcode == Op_IndirectMemoryCall) {
-        assert(inst->getNumSrcOperands() >= 4);
         // Indirect call - attempt to determine original virtual call
         CallInst* call = inst->asCallInst();
         assert(call != NULL);
@@ -101,6 +100,8 @@
             // Cannot resolve methodDesc.
             return false;
 
+        assert(inst->getNumSrcOperands() >= 4);
+
         // LdFunAddr should have already converted to a direct call (Op_DirectCall)
         // by the simplifier.
         base = call->getSrc(3);
@@ -413,14 +414,20 @@
         bool isIntfCall = false;
         if(isGuardableVirtualCall(last, methodInst, base, tauNullChecked, tauTypesChecked, argOffset, isIntfCall)) {
             assert(methodInst && base && tauNullChecked && tauTypesChecked && argOffset);
+            Type* type = base->getType();
+            if (type->isNullObject()) { //NullObject type is not ObjectType instance, but Type instance
+                return;
+            }
+            ObjectType* baseType = type->asObjectType();
+            assert(baseType!=NULL);
+            
+            assert(!baseType->isUnresolvedType());
 
-            assert(base->getType()->isObject());
-            ObjectType* baseType = (ObjectType*) base->getType();
             if (! ((_devirtInterfaceCalls && isIntfCall) || (_devirtVirtualCalls && !isIntfCall))) {
                 return;
             }
             // If base type is concrete, consider an explicit guarded test against it
-            if(!baseType->isNullObject() && ((_devirtInterfaceCalls && isIntfCall) || !baseType->isAbstract() || baseType->isArray())) {
+            if((_devirtInterfaceCalls && isIntfCall) || !baseType->isAbstract() || baseType->isArray()) {
                 MethodDesc* origMethodDesc = methodInst->getMethodDesc();
                 MethodDesc* candidateMeth = NULL;
                 int candidateExecCount = 0;

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp Wed May 23 04:22:55 2007
@@ -3027,7 +3027,6 @@
         Type* tt=fd->getFieldType();
         os << "      isInitOnly        " << fd->isInitOnly() << std::endl;
         os << "      isVolatile        " << fd->isVolatile() << std::endl;
-        os << "      isLiteral         " << fd->isLiteral() << std::endl;
         os << "      fldT      " << tt->getName() <<" "<< tt->tag<< std::endl;
         os << "      isObject  " << tt->isObject() << std::endl;
         os << "      isRef     " << tt->isReference()<< std::endl;

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp Wed May 23 04:22:55 2007
@@ -632,14 +632,18 @@
 bool 
 LazyExceptionOpt::methodCallHasSideEffect(Inst* inst) {
     uint32 opcode = inst->getOpcode();
-    MethodDesc* cmd;
-    Method_Side_Effects mse;
+    MethodDesc* cmd = NULL;
+    Method_Side_Effects mse = MSE_Unknown;
 
     if (opcode==Op_DirectCall || opcode==Op_TauVirtualCall) {
         cmd = inst->asMethodCallInst()->getMethodDesc();
     } else {
         if (opcode==Op_IndirectCall || opcode==Op_IndirectMemoryCall) {
-            cmd = inst->asCallInst()->getFunPtr()->getType()->asMethodPtrType()->getMethodDesc();
+            Type* type = inst->asCallInst()->getFunPtr()->getType();
+            if (type->isUnresolvedType()) {
+                return true;
+            }
+            cmd = type->asMethodPtrType()->getMethodDesc();
         } else {
 #ifdef _DEBUG
             if (Log::isEnabled()) {
@@ -720,6 +724,11 @@
     }
 
     if (mse == MSE_Unknown) {  // try to compile method
+        //TODO: avoid compilation here. Use translator to perform analysis needed
+        bool allowRecursion = !compInterface.getTypeManager().isLazyResolutionMode();
+        if (!allowRecursion) {
+            return MSE_True;
+        }
         if (!compInterface.compileMethod(cmd)) {
 #ifdef _DEBUG
             if (Log::isEnabled()) {

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/memoryopt.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/memoryopt.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/memoryopt.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/memoryopt.cpp Wed May 23 04:22:55 2007
@@ -1085,9 +1085,11 @@
     case UnknownKind: os << "Unknown"; break;
         
     case ObjectFieldKind: os << "ObjectField"; break;
+    case UnresolvedObjectFieldKind: os << "UnresolvedObjectField"; break;
     case ArrayElementKind: os << "ArrayElement"; break;
         
     case StaticFieldKind: os << "StaticField"; break;
+    case UnresolvedStaticFieldKind: os << "UnresolvedStaticField"; break;
 
     case ObjectVtableKind: os << "ObjectVtable"; break;
     case MethodPtrKind: os << "MethodPtr"; break;
@@ -1107,6 +1109,7 @@
     if (type || desc || opnd) {
         os << "[";
         if (opnd) { opnd->print(os); if (type || desc) os << ","; };
+        if (enclClass) {enclClass->print(os); os<<","; idx->print(os);}
         if (type) { type->print(os); if (desc) os << ","; };
         if (desc) desc->printFullName(os);
         os << "]";
@@ -1380,6 +1383,14 @@
                     assert(offsetRep.opnd == 0);
                     return findOrInsertAlias(getObjectField(baseOpnd, desc));
                 }
+            case AliasRep::UnresolvedObjectFieldKind:
+                {
+                    assert(offsetRep.opnd == 0);
+                    Opnd* enclClass = offsetRep.enclClass;
+                    Opnd* cpIdx = offsetRep.idx;
+                    assert(enclClass!=NULL &&  cpIdx!=NULL);
+                    return findOrInsertAlias(getUnresolvedObjectField(baseOpnd, enclClass, cpIdx));
+                }
             case AliasRep::LockKind:
                 assert(offsetRep.opnd == 0);
                 return findOrInsertAlias(getLock(baseOpnd));
@@ -1398,6 +1409,16 @@
     case Op_ConvUnmanaged:
     case Op_TauLdInd: // the result of static field load
         break;
+    case Op_VMHelperCall:
+        {
+            VMHelperCallInst* callInst = addri->asVMHelperCallInst();
+            assert(callInst->getVMHelperId() == CompilationInterface::Helper_GetNonStaticFieldOffsetWithResolve
+                || callInst->getVMHelperId() == CompilationInterface::Helper_GetStaticFieldAddrWithResolve);
+            Opnd* enclClass = callInst->getSrc(0);
+            Opnd* cpIdx = callInst->getSrc(1);
+            return findOrInsertAlias(getUnresolvedObjectField(0, enclClass, cpIdx));
+        }
+        break;
     default:
         assert(0);
         break;
@@ -1525,6 +1546,18 @@
     return findOrInsertAlias(theAlias);
 }
 
+AliasRep AliasManager::getUnresolvedObjectField(Opnd *obj, Opnd* enclClass, Opnd* cpIdx)
+{
+    AliasRep theAlias(AliasRep::UnresolvedObjectFieldKind, obj, enclClass, cpIdx);
+    return findOrInsertAlias(theAlias);
+}
+
+AliasRep AliasManager::getUnresolvedStaticField(Opnd* enclClass, Opnd* cpIdx)
+{
+    AliasRep theAlias(AliasRep::UnresolvedStaticFieldKind, 0, enclClass, cpIdx);
+    return findOrInsertAlias(theAlias);
+}
+
 void
 AliasManager::dumpAliasReps(::std::ostream &os) const
 {
@@ -1588,6 +1621,7 @@
     case AliasRep::LocalKind: result->push_back(getAny()); return;
     case AliasRep::AnyKind: return;
     case AliasRep::UnknownKind:
+    case AliasRep::UnresolvedStaticFieldKind:
         result->push_back(getAnyGlobal());
         result->push_back(getAnyLocal());
         result->push_back(getAny());
@@ -1595,10 +1629,10 @@
     case AliasRep::ObjectFieldKind:
         {
             FieldDesc *field = (FieldDesc *) a.desc;
-        if (a.opnd) {
-        result->push_back(getObjectField(0, field));
-        }
-        if (field->isInitOnly()) {
+            if (a.opnd) {
+                result->push_back(getObjectField(0, field));
+            }
+            if (field->isInitOnly()) {
                 result->push_back(getFinishObject(a.opnd));
             } else {
                 if ((a.opnd == 0) || analyzer->mayEscape(a.opnd)) {
@@ -1607,6 +1641,16 @@
                 if ((a.opnd == 0) || !analyzer->mayEscape(a.opnd)) {
                     result->push_back(getAnyLocal());
                 }
+            }
+            result->push_back(getAny()); return;
+        }
+    case AliasRep::UnresolvedObjectFieldKind:
+        {
+            if ((a.opnd == 0) || analyzer->mayEscape(a.opnd)) {
+                result->push_back(getAnyGlobal());
+            }
+            if ((a.opnd == 0) || !analyzer->mayEscape(a.opnd)) {
+                result->push_back(getAnyLocal());
             }
             result->push_back(getAny()); return;
         }

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/memoryoptrep.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/memoryoptrep.h?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/memoryoptrep.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/memoryoptrep.h Wed May 23 04:22:55 2007
@@ -45,9 +45,11 @@
         UnknownKind, // other opnd, should not be vtable, methodptr, arraylen, field
 
         ObjectFieldKind, // parameterized by object and field desc
+        UnresolvedObjectFieldKind, // field of unresolved type
         ArrayElementKind, // offset into array, parameterized by array object and offset opnd
 
         StaticFieldKind, // just field, type is pulled out too
+        UnresolvedStaticFieldKind, // just field, type is pulled out too
 
         ObjectVtableKind, // opnd
         MethodPtrKind, // opnd, desc
@@ -64,23 +66,27 @@
     } kind;
     Opnd *opnd;
     Opnd *idx;
+    Opnd *enclClass;
     Type *type;
     TypeMemberDesc *desc;
     int id;
 
-    AliasRep(int) : kind(NullKind), opnd(0), idx(0), type(0), desc(0), id(0) {};
-    AliasRep(Kind k=NullKind) : kind(k), opnd(0), idx(0), type(0), desc(0), id(0) {};
-    AliasRep(Kind k, Opnd *op) : kind(k), opnd(op), idx(0), type(0), desc(0), id(0) {
+    AliasRep(int) : kind(NullKind), opnd(0), idx(0), enclClass(0), type(0), desc(0), id(0) {};
+    AliasRep(Kind k=NullKind) : kind(k), opnd(0), idx(0), enclClass(0),type(0), desc(0), id(0) {};
+    AliasRep(Kind k, Opnd *op) : kind(k), opnd(op), idx(0), enclClass(0),type(0), desc(0), id(0) {
     };
-    AliasRep(Kind k, Opnd *op, Opnd *idx0) : kind(k), opnd(op), idx(idx0), type(0), desc(0), id(0) {
+    AliasRep(Kind k, Opnd *op, Opnd *idx0) : kind(k), opnd(op), idx(idx0), enclClass(0), type(0), desc(0), id(0) {
     };
-    AliasRep(Kind k, Opnd *op, TypeMemberDesc *md) : kind(k), opnd(op), idx(0), type(0), desc(md), id(0) {
+    AliasRep(Kind k, Opnd *op, TypeMemberDesc *md) : kind(k), opnd(op), idx(0), enclClass(0), type(0), desc(md), id(0) {
     };
-    AliasRep(Kind k, Type *t) : kind(k), opnd(0), idx(0), type(t), desc(0), id(0) {
+    AliasRep(Kind k, Type *t) : kind(k), opnd(0), idx(0), enclClass(0), type(t), desc(0), id(0) {
     };
-    AliasRep(Kind k, TypeMemberDesc *md) : kind(k), opnd(0), idx(0), type(0), desc(md), id(0) {
+    AliasRep(Kind k, TypeMemberDesc *md) : kind(k), opnd(0), idx(0), enclClass(0), type(0), desc(md), id(0) {
     };
     
+    AliasRep(Kind k, Opnd* op, Opnd* enc, Opnd* idx0) : kind(k), opnd(op), idx(idx0), enclClass(enc), type(0), desc(0), id(0) {
+    };
+
     void dump(::std::ostream &os) const;
     void print(::std::ostream &os) const;
 
@@ -95,15 +101,18 @@
                 ((kind == other.kind) && 
                  ((opnd < other.opnd) ||
                   ((opnd == other.opnd) &&
-                   ((type < other.type) ||
-                    ((type == other.type) &&
-                     ((desc < other.desc) ||
-                      ((desc == other.desc) &&
-                       (idx < other.idx)))))))));
+                   ((enclClass < other.enclClass) ||
+                    ((enclClass== other.enclClass) &&
+                     ((type < other.type) ||
+                      ((type == other.type) &&
+                       ((desc < other.desc) ||
+                        ((desc == other.desc) &&
+                         (idx < other.idx)))))))))));
     }
     bool operator == (const AliasRep &other) const {
         return ((kind == other.kind) &&
                 (opnd == other.opnd) &&
+                (enclClass == other.enclClass) &&
                 (type == other.type) &&
                 (desc == other.desc) &&
                 (idx == other.idx));
@@ -112,7 +121,8 @@
         return (((size_t) kind) ^
                 ((size_t) opnd) ^
                 ((size_t) type) ^
-                ((size_t) desc));
+                ((size_t) desc) ^
+                ((size_t) enclClass));
     }
 };
 
@@ -139,7 +149,9 @@
     AliasRep getReference(Opnd *addr); // examine for an indirect addr
 
     AliasRep getObjectField(Opnd *obj, TypeMemberDesc *field);
+    AliasRep getUnresolvedObjectField(Opnd *obj, Opnd* enclClass, Opnd* cpIdx);
     AliasRep getStaticField(TypeMemberDesc *field);
+    AliasRep getUnresolvedStaticField(Opnd* enclClass, Opnd* cpIdx);
     AliasRep getArrayElementByType(Type *elementType);
     AliasRep getLock(Opnd *obj);
     AliasRep getLock(Type *type);

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp Wed May 23 04:22:55 2007
@@ -4426,6 +4426,8 @@
     Type *opndType = src->getType();
     if (isNullObject(src)) {
         return genTauSafe()->getDst();
+    } else if (opndType->isUnresolvedType()) {
+        return NULL;
     } else if (irManager.getTypeManager().isSubClassOf(opndType, castType)) {
         return genTauHasType(src, castType)->getDst();
     } else if (!irManager.getTypeManager().isSubClassOf(castType, opndType)) {

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifytaus.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifytaus.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifytaus.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifytaus.cpp Wed May 23 04:22:55 2007
@@ -581,7 +581,7 @@
         {
             return genTauSafe();
         }
-        
+
     case Op_TauMonitorEnter:
     case Op_TauMonitorExit:
     case Op_TypeMonitorEnter:

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/Type.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/Type.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/Type.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/Type.cpp Wed May 23 04:22:55 2007
@@ -37,6 +37,9 @@
     t1 = t1->getNonValueSupertype();
     t2 = t2->getNonValueSupertype();
     if (t1==t2) return true;
+    if (t1->isUnresolvedType() || t2->isUnresolvedType()) {
+        return false;
+    }
     return typeManager->isSubTypeOf(t1, t2) || typeManager->isSubClassOf(t2, t1);
 }
 
@@ -48,7 +51,7 @@
     // References off of null objects are invalid, so should not interfere 
     // with other accesses or each other.  (Although invalid, these seems
     // to show up, at least briefly, due to constant folding).
-    if (t1->isNullObject() || t2->isNullObject()) {
+    if (t1->isNullObject() || t2->isNullObject() || t1->isUnresolvedType() || t2->isUnresolvedType()) {
         return false;
     }
 
@@ -135,6 +138,7 @@
     case Type::NullObject:
     case Type::Array:
     case Type::Object:
+    case Type::UnresolvedObject:
     case Type::UnmanagedPtr:
     case Type::ManagedPtr:
     case Type::CompressedSystemObject:
@@ -243,13 +247,19 @@
 
 ObjectType * TypeManager::getCommonObjectType(ObjectType *o1, ObjectType *o2) {
     ObjectType *common = NULL;
-    for ( ; o2 != NULL; o2 = o2->getSuperType()) {
-        if (o1->isSubClassOf(o2)) {
-            common = o2;
-            break;
-        } else if (o2->isSubClassOf(o1)) {
-            common = o1;
-            break;
+    if (o1->isUnresolvedType()){
+        common = o2;
+    } else if (o2->isUnresolvedType()) {
+        common = o1;
+    } else {
+        for ( ; o2 != NULL; o2 = o2->getSuperType()) {
+            if (o1->isSubClassOf(o2)) {
+                common = o2;
+                break;
+            } else if (o2->isSubClassOf(o1)) {
+                common = o1;
+                break;
+            }
         }
     }
     return common;
@@ -262,6 +272,11 @@
     Type *common = NULL;
     bool oneIsCompressed = type1->isCompressedReference();
     assert(type1->isCompressedReference() == type2->isCompressedReference());
+    if (type1->isUnresolvedType() || type2->isUnresolvedType()) {
+        if (type1->isNullObject()) return type2;
+        if (type2->isNullObject()) return type1;
+        return type1->isUnresolvedType() ? type2 : type1;
+    }
     if ( type2->isObject() && (oneIsCompressed 
         ? (type1 == getCompressedNullObjectType()) 
         : (type1 == getNullObjectType())) ) {
@@ -303,6 +318,7 @@
     typedReference(Type::TypedReference),
     theSystemStringType(NULL), 
     theSystemObjectType(NULL),
+    theUnresolvedObjectType(NULL),
     theSystemClassType(NULL),
     nullObjectType(Type::NullObject), 
     offsetType(Type::Offset),
@@ -335,6 +351,7 @@
     arrayElementTypes(mm, 32),
     arrayIndexTypes(mm, 32),
     methodPtrObjTypes(mm,32),
+    unresMethodPtrTypes(mm, 32),
     itableObjTypes(mm, 32),
 
     areReferencesCompressed(false)
@@ -343,6 +360,7 @@
     int32Type=int64Type=uintPtrType=uint8Type=uint16Type=NULL;
        uint32Type=uint64Type=singleType=doubleType=floatType=NULL;
        systemObjectVMTypeHandle = systemClassVMTypeHandle = systemStringVMTypeHandle = NULL;
+       lazyResolutionMode = false;
 }
 
 NamedType* 
@@ -365,6 +383,8 @@
         ObjectType(Type::SystemString,systemStringVMTypeHandle,*this);
     theSystemObjectType = new (memManager) 
         ObjectType(Type::SystemObject,systemObjectVMTypeHandle,*this);
+    theUnresolvedObjectType= new (memManager) 
+        ObjectType(Type::UnresolvedObject,systemObjectVMTypeHandle,*this);
     theSystemClassType = new (memManager) 
         ObjectType(Type::SystemClass,systemClassVMTypeHandle,*this);
     userObjectTypes.insert(systemStringVMTypeHandle,theSystemStringType);
@@ -419,11 +439,16 @@
                 isUnboxed = false;
             }
             if (arrayVMTypeHandle == NULL) {
-                arrayVMTypeHandle = VMInterface::getArrayVMTypeHandle(elemNamedType->getVMTypeHandle(),isUnboxed);
+                if (elemNamedType->isUnresolvedType()) {
+                    arrayVMTypeHandle = NULL;
+                } else {
+                    arrayVMTypeHandle = VMInterface::getArrayVMTypeHandle(elemNamedType->getVMTypeHandle(),isUnboxed);
+                }
             }
-            type = new (memManager) 
-                ArrayType(elemNamedType,arrayVMTypeHandle,*this, isCompressed);
-            if (arrayVMTypeHandle != (void*)(POINTER_SIZE_INT)0xdeadbeef && type->getAllocationHandle()!=0) { // type is resolved
+            type = new (memManager)  ArrayType(elemNamedType,arrayVMTypeHandle,*this, isCompressed);
+            if (arrayVMTypeHandle != (void*)(POINTER_SIZE_INT)0xdeadbeef 
+                &&  (type->isUnresolvedType() || type->getAllocationHandle()!=0)) 
+            { // type can be cached
                 lookupTable.insert(elemNamedType,type);
             }
         }
@@ -468,28 +493,176 @@
     return type;
 }
 
+
+PtrType*  
+TypeManager::getManagedPtrType(Type* pointedToType) {
+    PtrType* type = managedPtrTypes.lookup(pointedToType);
+    if (type == NULL) {
+        type = new (memManager) PtrType(pointedToType,true);
+        managedPtrTypes.insert(pointedToType,type);
+    }
+    return type;
+}
+PtrType*
+TypeManager::getUnmanagedPtrType(Type* pointedToType) {
+    PtrType* type = unmanagedPtrTypes.lookup(pointedToType);
+    if (type == NULL) {
+        type = new (memManager) PtrType(pointedToType,false);
+        unmanagedPtrTypes.insert(pointedToType,type);
+    }
+    return type;
+}
+MethodPtrType*    
+TypeManager::getMethodPtrType(MethodDesc* methodDesc) {
+    MethodPtrType* type = methodPtrTypes.lookup(methodDesc);
+    if (type == NULL) {
+        type = new (memManager) MethodPtrType(methodDesc,*this);
+        methodPtrTypes.insert(methodDesc,type);
+    }
+    return type;
+}
+
+UnresolvedMethodPtrType*    
+TypeManager::getUnresolvedMethodPtrType(ObjectType* enclosingClass, uint32 cpIndex) {
+    PtrHashTable<UnresolvedMethodPtrType>* methodsPerClass = unresMethodPtrTypes.lookup(enclosingClass);
+    if (!methodsPerClass) {
+        methodsPerClass = new (memManager) PtrHashTable<UnresolvedMethodPtrType>(memManager, 32);
+        unresMethodPtrTypes.insert(enclosingClass, methodsPerClass);
+    }
+    UnresolvedMethodPtrType* methType = methodsPerClass->lookup((void*)(POINTER_SIZE_INT)cpIndex);
+    if (!methType) {
+        methType = new (memManager) UnresolvedMethodPtrType(enclosingClass, cpIndex, *this);
+        methodsPerClass->insert((void*)(POINTER_SIZE_INT)cpIndex, methType);
+    }
+    return methType;
+}
+
+MethodPtrType* 
+TypeManager::getMethodPtrObjType(ValueName obj, MethodDesc* methodDesc) {
+    PtrHashTable<MethodPtrType>* ptrTypes = methodPtrObjTypes.lookup(methodDesc);
+    if (!ptrTypes) {
+        ptrTypes = new (memManager) PtrHashTable<MethodPtrType>(memManager, 32);
+        methodPtrObjTypes.insert(methodDesc, ptrTypes);
+    }
+    MethodPtrType* ptrType = ptrTypes->lookup(obj);
+    if (!ptrType) {
+        ptrType = new (memManager) MethodPtrType(methodDesc, *this, false, obj);
+        ptrTypes->insert(obj, ptrType);
+    }
+    return ptrType;
+}
+
+VTablePtrType*    
+TypeManager::getVTablePtrType(Type* type) {
+    VTablePtrType* vtableType = vtablePtrTypes.lookup(type);
+    if (vtableType == NULL) {
+        vtableType = new (memManager) VTablePtrType(type);
+        vtablePtrTypes.insert(type,vtableType);
+    }
+    return vtableType;
+}
+
+OrNullType* 
+TypeManager::getOrNullType(Type* t) {
+    OrNullType* orNullType = orNullTypes.lookup(t);
+    if (!orNullType) {
+        orNullType = new (memManager) OrNullType(t);
+        orNullTypes.insert(t, orNullType);
+    }
+    return orNullType;
+}
+
+ValueNameType* 
+TypeManager::getVTablePtrObjType(ValueName val) {
+    ValueNameType* vtablePtrType = vtableObjTypes.lookup(val);
+    if (!vtablePtrType) {
+        vtablePtrType = new (memManager) ValueNameType(Type::VTablePtrObj, val, getIntPtrType());
+        vtableObjTypes.insert(val, vtablePtrType);
+    }
+    return vtablePtrType;
+}
+
+ValueNameType* 
+TypeManager::getITablePtrObjType(ValueName val, NamedType* itype) {
+    PtrHashTable<ITablePtrObjType>* itableTypes = itableObjTypes.lookup(val);
+    if (!itableTypes) {
+        itableTypes = new (memManager) PtrHashTable<ITablePtrObjType>(memManager, 32);
+        itableObjTypes.insert(val, itableTypes);
+    }
+    ITablePtrObjType* itablePtrType = itableTypes->lookup(itype);
+    if (!itablePtrType) {
+        itablePtrType = new (memManager) ITablePtrObjType(val, itype, getIntPtrType());
+        itableTypes->insert(itype, itablePtrType);
+    }
+    return itablePtrType;
+}
+
+ValueNameType* 
+TypeManager::getArrayLengthType(ValueName val) {
+    ValueNameType* arrayLengthType = arrayLengthTypes.lookup(val);
+    if (!arrayLengthType) {
+        arrayLengthType = new (memManager) ValueNameType(Type::ArrayLength, val, getInt32Type());
+        arrayLengthTypes.insert(val, arrayLengthType);
+    }
+    return arrayLengthType;
+}
+
+PtrType* 
+TypeManager::getArrayBaseType(ValueName val) {
+    PtrType* arrayBaseType = arrayBaseTypes.lookup(val);
+    if (!arrayBaseType) {
+        Type* elementType = getArrayElementType(val);
+        arrayBaseType = new (memManager) PtrType(elementType, true, val);
+        arrayBaseTypes.insert(val, arrayBaseType);
+    }
+    return arrayBaseType;
+}
+
+PtrType* 
+TypeManager::getArrayIndexType(ValueName array, ValueName index)
+{
+    PtrHashTable<PtrType>* indexTypes = arrayIndexTypes.lookup(array);
+    if (!indexTypes) {
+        indexTypes = new (memManager) PtrHashTable<PtrType>(memManager, 32);
+        arrayIndexTypes.insert(array, indexTypes);
+    }
+    PtrType* indexType = indexTypes->lookup(index);
+    if (!indexType) {
+        Type* elementType = getArrayElementType(array);
+        indexType = new (memManager) PtrType(elementType, true, array, index);
+        indexTypes->insert(index, indexType);
+    }
+    return indexType;
+}
+
 bool    
-ObjectType::_isFinalClass()    {
+ObjectType::_isFinalClass() {
+    if (isUnresolvedType()) {
+        return false;
+    }
     return VMInterface::isFinalType(vmTypeHandle);
 }
 
 bool    
 ObjectType::isInterface() {
+    assert(!isUnresolvedType());
     return VMInterface::isInterfaceType(vmTypeHandle);
 }
 
 bool    
 ObjectType::isAbstract() {
+    assert(!isUnresolvedType());
     return VMInterface::isAbstractType(vmTypeHandle);
 }
 
 bool    
-NamedType::needsInitialization(){
+NamedType::needsInitialization() {
     return VMInterface::needsInitialization(vmTypeHandle);
 }
 
 bool    
-NamedType::isFinalizable(){
+NamedType::isFinalizable() {
+    assert(!isUnresolvedType());
     return VMInterface::isFinalizable(vmTypeHandle);
 }
 
@@ -500,16 +673,19 @@
 
 bool    
 NamedType::isLikelyExceptionType() {
+    assert(!isUnresolvedType());
     return VMInterface::isLikelyExceptionType(vmTypeHandle);
 }
 
 void*
 NamedType::getRuntimeIdentifier() {
+    assert(!isUnresolvedType());
     return vmTypeHandle;
 }
 
 ObjectType*
 ObjectType::getSuperType() {
+    assert(!isUnresolvedObject());
     void* superTypeVMTypeHandle = VMInterface::getSuperTypeVMTypeHandle(vmTypeHandle);
     if (superTypeVMTypeHandle)
         return typeManager.getObjectType(superTypeVMTypeHandle,
@@ -524,6 +700,7 @@
 //
 void*    
 ObjectType::getVTable() {
+    assert(!isUnresolvedType());
     return VMInterface::getVTable(vmTypeHandle);
 }
 
@@ -532,6 +709,7 @@
 //
 void*    
 ObjectType::getAllocationHandle() {
+    assert(!isUnresolvedType());
     return VMInterface::getAllocationHandle(vmTypeHandle);
 }
 //
@@ -539,6 +717,7 @@
 //
 bool
 ObjectType::isSubClassOf(NamedType *other) {
+    assert(!isUnresolvedType());
     return VMInterface::isSubClassOf(vmTypeHandle,other->getRuntimeIdentifier());
 }
 
@@ -609,26 +788,40 @@
 //
 uint32
 ObjectType::getObjectSize() {
+    assert(!isUnresolvedObject());
     return VMInterface::getObjectSize(vmTypeHandle);
 }
 
 const char* 
 ObjectType::getName() {
+    if (isUnresolvedObject()) {
+        return ".Unresolved";
+    } else if (isUnresolvedArray()) {
+        return ".Unresolved[]";
+    }
+    assert(vmTypeHandle);
     return VMInterface::getTypeName(vmTypeHandle);
 }
 
 const char* 
 ObjectType::getNameQualifier() {
+    if (isUnresolvedObject()) {
+        return ""; //package name
+    }
     return VMInterface::getTypeNameQualifier(vmTypeHandle);
 }
 
 bool 
 ObjectType::getFastInstanceOfFlag() {
+    if (isUnresolvedType()) {
+        return false;
+    }
     return VMInterface::getClassFastInstanceOfFlag(vmTypeHandle);
 }
 
 int 
 ObjectType::getClassDepth() {
+    assert(!isUnresolvedType());
     return VMInterface::getClassDepth(vmTypeHandle);
 }
 
@@ -638,6 +831,11 @@
 uint32    
 ArrayType::getArrayElemOffset()    {
     bool isUnboxed = elemType->isValueType();
+    if (elemType->isUnresolvedType()) {
+        //workaround to keep assertion in public getVMTypeHandle() method for unresolved types
+        //actually any suitable object is OK here to get an offset
+        return VMInterface::getArrayElemOffset(typeManager.getSystemObjectType()->getVMTypeHandle(),isUnboxed);
+    }
     return VMInterface::getArrayElemOffset(elemType->getVMTypeHandle(),isUnboxed);
 }
 
@@ -649,6 +847,12 @@
     return VMInterface::getArrayLengthOffset();
 }
 
+bool    ArrayType::isUnresolvedArray() const {
+    bool res = elemType->isUnresolvedObject();
+    res = res || (elemType->isArrayType() && elemType->asArrayType()->isUnresolvedArray());
+    return res;
+}
+
 // predefined value types
 const char*
 Type::getName() {
@@ -718,6 +922,7 @@
     case Array:            s = "[]"; break;
     case Object:           s = "object"; break;
     case NullObject:       s = "null_object"; break;
+    case UnresolvedObject: s = "unres_object"; break;
     case Offset:           s = "offset"; break;
     case OffsetPlusHeapbase: s = "offsetplushb"; break;
     case UnmanagedPtr:     s = "ptr"; break;
@@ -743,7 +948,8 @@
     os << "enum:" << getName();
 }
 
-extern char *massageStr(const char *);
+extern char *messageStr(const char *);
+
 void    ObjectType::print(::std::ostream& os) {
     if (isCompressedReference()) {
         os << "clsc:" << getName();
@@ -790,9 +996,18 @@
     } else {
         os << "method:";
     }
-    os << massageStr(methodDesc->getName());
+    os << messageStr(methodDesc->getName());
+}
+
+void UnresolvedMethodPtrType::print(::std::ostream& os) {
+    Class_Handle ch = (Class_Handle)enclosingClass->getVMTypeHandle();
+    const char* method_class = const_pool_get_method_class_name(ch, (unsigned short)cpIndex);
+    const char* method_name = const_pool_get_method_name(ch, (unsigned short)cpIndex);
+    const char* signature = const_pool_get_method_descriptor(ch, (unsigned short)cpIndex);
+    os << method_class << "::" << messageStr(method_name) << signature;
 }
 
+
 void    VTablePtrType::print(::std::ostream& os) {
     os << "vtb:";
     baseType->print(os);
@@ -853,6 +1068,7 @@
     case OffsetPlusHeapbase: s = "ohb"; break;
     case Array:           s = "[] "; break;
     case Object:          s = "o  "; break;
+    case UnresolvedObject:s = "uno  "; break;
     case UnmanagedPtr:    s = "*  "; break;
     case ManagedPtr:      s = "&  "; break;
     case MethodPtr:       s = "fun"; break;

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/Type.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/Type.h?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/Type.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/Type.h Wed May 23 04:22:55 2007
@@ -41,6 +41,7 @@
 class NamedType;
 class ArrayType;
 class MethodPtrType;
+class UnresolvedMethodPtrType;
 class ValueNameType;
 class ITablePtrObjType;
 class OrNullType;
@@ -93,6 +94,7 @@
 
         // special null object reference
         NullObject,
+        UnresolvedObject,
 
         //     (2.1.2) Array type
         Array,
@@ -177,6 +179,9 @@
     bool    isFloatingPoint()  {return isFloatingPoint(tag);}
     bool    isNullObject()     {return isNullObject(tag);}
     bool    isObject()         {return isObject(tag);}
+    bool    isUnresolvedObject() {return isUnresolvedObject(tag);}
+    bool    isUnresolvedMethodPtrType() {return asUnresolvedMethodPtrType()!=NULL;}
+    virtual bool    isUnresolvedType() {return false;}
     bool    isArray()          {return isArray(tag);}
     bool    isValue()          {return isValue(tag);}
     bool    isPtr()            {return isPtr(tag);}
@@ -207,6 +212,7 @@
     virtual NamedType*        asNamedType()          {return NULL;}
     virtual ArrayType*        asArrayType()          {return NULL;}
     virtual MethodPtrType*    asMethodPtrType()      {return NULL;}
+    virtual UnresolvedMethodPtrType* asUnresolvedMethodPtrType() { return NULL; }
     virtual ValueNameType*    asValueNameType()      {return NULL;}
     virtual ITablePtrObjType* asITablePtrObjType()   {return NULL;}
     virtual OrNullType*       asOrNullType()         {return NULL;}
@@ -298,6 +304,9 @@
         return (((SystemObject <= tag) && (tag <= Object)) ||
                 ((CompressedSystemObject <= tag) && (tag <= CompressedObject)));
     }
+    static bool isUnresolvedObject(Tag tag) {
+        return tag == UnresolvedObject;
+    }
     static bool isNullObject(Tag tag) {
         return ((tag == NullObject) || (tag == CompressedNullObject));
     }
@@ -396,6 +405,27 @@
     virtual bool isInstance() = 0;
 };
 
+class UnresolvedMethodPtrType : public FunctionPtrType {
+public:
+    UnresolvedMethodPtrType(ObjectType* _enclosingClass, uint32 _cpIndex, TypeManager& tm, bool isCompressed=false, ValueName obj=NULL) 
+        : FunctionPtrType(isCompressed), enclosingClass(_enclosingClass), cpIndex(_cpIndex), typeManager(tm), object(obj) {}
+        virtual ~UnresolvedMethodPtrType() {}
+
+        UnresolvedMethodPtrType* asUnresolvedMethodPtrType() { return this; }
+        uint32 getNumParams() {assert(0); return 0;}
+        Type* getParamType(uint32 n){assert(0); return NULL;}
+        Type* getReturnType() {assert(0); return NULL;}
+        bool isInstance() { assert(0); return false;}
+        void print(::std::ostream& os);
+        virtual bool    isUnresolvedType() {return true;}
+private:
+    ObjectType* enclosingClass;
+    uint32      cpIndex;
+    TypeManager& typeManager;
+    ValueName object;
+
+};
+
 class MethodPtrType : public FunctionPtrType {
 public:
     MethodPtrType(MethodDesc* md, TypeManager& tm, bool isCompressed=false, ValueName obj=NULL) 
@@ -454,7 +484,7 @@
     // dynamic type checking, and look up interface vtables.
     //
     void*    getRuntimeIdentifier();   
-    void*    getVMTypeHandle()        {return vmTypeHandle;}
+    void*    getVMTypeHandle()        {assert(!isUnresolvedType()); return vmTypeHandle;}
 protected:
     void*            vmTypeHandle;
     TypeManager&    typeManager;
@@ -513,6 +543,7 @@
     const    char*    getNameQualifier();
     bool getFastInstanceOfFlag();
     int getClassDepth();
+    virtual bool    isUnresolvedType() {return isUnresolvedObject() || isUnresolvedArray();}
 
     //
     // returns the vtable address of this boxed type
@@ -534,6 +565,8 @@
     //
     // for boxed value types, returns byte offset of the un-boxed value
     //
+
+    virtual bool    isUnresolvedArray() const {return false;}
     uint32          getUnboxedOffset();
     bool            isInterface();
     bool            isAbstract();
@@ -543,31 +576,13 @@
 };
 class ArrayType : public ObjectType {
 public:
-    ArrayType(NamedType*   elemType_,
-              uint32  rank_,
-              uint32  numSizes_,
-              uint32* sizes_,
-              uint32  numLoBounds_,
-              uint32* loBounds_,
-              void*      td,
-              TypeManager& tm,
-              bool isCompressed) 
-        : ObjectType(isCompressed ? CompressedArray : Array,td,tm), elemType(elemType_) {
-        rank = rank_;
-        numSizes = numSizes_;
-        numLoBounds = numLoBounds_;
-        sizes = sizes_;
-        loBounds = loBounds_;
-    }
     ArrayType(NamedType* elemType_,void* td,TypeManager& tm, bool isCompressed) 
-        : ObjectType(isCompressed ? CompressedArray : Array, td, tm), elemType(elemType_) {
-        rank = 1;
-        numSizes = numLoBounds = 0;
-        sizes = loBounds = NULL;
+        : ObjectType(isCompressed ? CompressedArray : Array, td, tm), elemType(elemType_) 
+    {
     }
     ArrayType* asArrayType() { return this; }
     NamedType*    getElementType()        {return elemType;}
-    uint32    getNumArrayDimensions()    {return rank;}
+    virtual bool    isUnresolvedArray() const;
     //
     // for array types, returns byte offset of the first element of the array
     //
@@ -586,11 +601,6 @@
     }
 private:
     NamedType*    elemType;
-    uint32        rank;
-    uint32        numSizes;
-    uint32        numLoBounds;
-    uint32*       sizes;
-    uint32*       loBounds;
 };
 
 class ValueNameType : public Type {
@@ -668,6 +678,7 @@
     Type*         getOffsetPlusHeapbaseType()   {return &offsetPlusHeapbaseType;}
     ObjectType*   getSystemStringType()    {return theSystemStringType;}
     ObjectType*   getSystemObjectType()    {return theSystemObjectType;}
+    ObjectType*   getUnresolvedObjectType(){return theUnresolvedObjectType;}
     ObjectType*   getSystemClassType()     {return theSystemClassType;}
 
     Type*         getCompressedNullObjectType()  {return &compressedNullObjectType;}
@@ -687,113 +698,30 @@
     Type*         uncompressType(Type *compRefType);
     Type*         compressType(Type *uncompRefType);
 
-    PtrType*        getManagedPtrType(Type* pointedToType) {
-        PtrType* type = managedPtrTypes.lookup(pointedToType);
-        if (type == NULL) {
-            type = new (memManager) PtrType(pointedToType,true);
-            managedPtrTypes.insert(pointedToType,type);
-        }
-        return type;
-    }
-    PtrType*        getUnmanagedPtrType(Type* pointedToType) {
-        PtrType* type = unmanagedPtrTypes.lookup(pointedToType);
-        if (type == NULL) {
-            type = new (memManager) PtrType(pointedToType,false);
-            unmanagedPtrTypes.insert(pointedToType,type);
-        }
-        return type;
-    }
-    MethodPtrType*    getMethodPtrType(MethodDesc* methodDesc) {
-        MethodPtrType* type = methodPtrTypes.lookup(methodDesc);
-        if (type == NULL) {
-            type = new (memManager) MethodPtrType(methodDesc,*this);
-            methodPtrTypes.insert(methodDesc,type);
-        }
-        return type;
-    }
-    MethodPtrType* getMethodPtrObjType(ValueName obj, MethodDesc* methodDesc) {
-        PtrHashTable<MethodPtrType>* ptrTypes = methodPtrObjTypes.lookup(methodDesc);
-        if (!ptrTypes) {
-            ptrTypes = new (memManager) PtrHashTable<MethodPtrType>(memManager, 32);
-            methodPtrObjTypes.insert(methodDesc, ptrTypes);
-        }
-        MethodPtrType* ptrType = ptrTypes->lookup(obj);
-        if (!ptrType) {
-            ptrType = new (memManager) MethodPtrType(methodDesc, *this, false, obj);
-            ptrTypes->insert(obj, ptrType);
-        }
-        return ptrType;
-    }
-    VTablePtrType*    getVTablePtrType(Type* type) {
-        VTablePtrType* vtableType = vtablePtrTypes.lookup(type);
-        if (vtableType == NULL) {
-            vtableType = new (memManager) VTablePtrType(type);
-            vtablePtrTypes.insert(type,vtableType);
-        }
-        return vtableType;
-    }
+    PtrType*        getManagedPtrType(Type* pointedToType);
+       
+    PtrType*        getUnmanagedPtrType(Type* pointedToType);
+
+    MethodPtrType*    getMethodPtrType(MethodDesc* methodDesc);
+
+    UnresolvedMethodPtrType*    getUnresolvedMethodPtrType(ObjectType* enclosingClass, uint32 cpIndex);
+        
+    MethodPtrType* getMethodPtrObjType(ValueName obj, MethodDesc* methodDesc);
+        
+    VTablePtrType*    getVTablePtrType(Type* type);
+
+    OrNullType* getOrNullType(Type* t);
+
+    ValueNameType* getVTablePtrObjType(ValueName val);
+
+    ValueNameType* getITablePtrObjType(ValueName val, NamedType* itype);
+        
+    ValueNameType* getArrayLengthType(ValueName val);
+        
+    PtrType* getArrayBaseType(ValueName val);
+        
+    PtrType* getArrayIndexType(ValueName array, ValueName index);
 
-    OrNullType* getOrNullType(Type* t) {
-        OrNullType* orNullType = orNullTypes.lookup(t);
-        if (!orNullType) {
-            orNullType = new (memManager) OrNullType(t);
-            orNullTypes.insert(t, orNullType);
-        }
-        return orNullType;
-    }
-    ValueNameType* getVTablePtrObjType(ValueName val) {
-        ValueNameType* vtablePtrType = vtableObjTypes.lookup(val);
-        if (!vtablePtrType) {
-            vtablePtrType = new (memManager) ValueNameType(Type::VTablePtrObj, val, getIntPtrType());
-            vtableObjTypes.insert(val, vtablePtrType);
-        }
-        return vtablePtrType;
-    }
-    ValueNameType* getITablePtrObjType(ValueName val, NamedType* itype) {
-        PtrHashTable<ITablePtrObjType>* itableTypes = itableObjTypes.lookup(val);
-        if (!itableTypes) {
-            itableTypes = new (memManager) PtrHashTable<ITablePtrObjType>(memManager, 32);
-            itableObjTypes.insert(val, itableTypes);
-        }
-        ITablePtrObjType* itablePtrType = itableTypes->lookup(itype);
-        if (!itablePtrType) {
-            itablePtrType = new (memManager) ITablePtrObjType(val, itype, getIntPtrType());
-            itableTypes->insert(itype, itablePtrType);
-        }
-        return itablePtrType;
-    }
-    ValueNameType* getArrayLengthType(ValueName val) {
-        ValueNameType* arrayLengthType = arrayLengthTypes.lookup(val);
-        if (!arrayLengthType) {
-            arrayLengthType = new (memManager) ValueNameType(Type::ArrayLength, val, getInt32Type());
-            arrayLengthTypes.insert(val, arrayLengthType);
-        }
-        return arrayLengthType;
-    }
-    PtrType* getArrayBaseType(ValueName val) {
-        PtrType* arrayBaseType = arrayBaseTypes.lookup(val);
-        if (!arrayBaseType) {
-            Type* elementType = getArrayElementType(val);
-            arrayBaseType = new (memManager) PtrType(elementType, true, val);
-            arrayBaseTypes.insert(val, arrayBaseType);
-        }
-        return arrayBaseType;
-    }
-    PtrType* getArrayIndexType(ValueName array, ValueName index)
-    {
-        PtrHashTable<PtrType>* indexTypes = arrayIndexTypes.lookup(array);
-        if (!indexTypes) {
-            indexTypes = new (memManager) PtrHashTable<PtrType>(memManager, 32);
-            arrayIndexTypes.insert(array, indexTypes);
-        }
-        PtrType* indexType = indexTypes->lookup(index);
-        if (!indexType) {
-            Type* elementType = getArrayElementType(array);
-            indexType = new (memManager) PtrType(elementType, true, array, index);
-            indexTypes->insert(index, indexType);
-        }
-        return indexType;
-    }
     ValueNameType* getArrayElementType(ValueName val);
     ValueNameType* getSingletonType(ValueName val);
 
@@ -813,6 +741,9 @@
         return getObjectType(vmTypeHandle, isCompressed);
     }
 
+    void setLazyResolutionMode(bool flag) {lazyResolutionMode = flag;}
+    bool isLazyResolutionMode() const {return lazyResolutionMode;}
+
 private:
     MemoryManager& memManager;
     // singletons for the built-in types
@@ -836,6 +767,7 @@
     ValueType     typedReference;
     ObjectType*   theSystemStringType;
     ObjectType*   theSystemObjectType;
+    ObjectType*   theUnresolvedObjectType;
     ObjectType*   theSystemClassType;
     Type          nullObjectType;
     Type          offsetType;
@@ -867,6 +799,7 @@
 
     PtrHashTable< PtrHashTable<PtrType> >          arrayIndexTypes;
     PtrHashTable< PtrHashTable<MethodPtrType> >    methodPtrObjTypes;
+    PtrHashTable< PtrHashTable<UnresolvedMethodPtrType> > unresMethodPtrTypes;
     PtrHashTable< PtrHashTable<ITablePtrObjType> > itableObjTypes;
 
     bool areReferencesCompressed;
@@ -877,6 +810,7 @@
     void*        systemObjectVMTypeHandle;
     void*        systemClassVMTypeHandle;
     void*        systemStringVMTypeHandle;
+    bool         lazyResolutionMode;
 };
 
 } //namespace Jitrino 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/TranslatorIntfc.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/TranslatorIntfc.cpp?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/TranslatorIntfc.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/TranslatorIntfc.cpp Wed May 23 04:22:55 2007
@@ -33,6 +33,7 @@
 #include "methodtable.h"
 #include "CompilationContext.h"
 #include "FlowGraph.h"
+#include "Jitrino.h"
 
 namespace Jitrino {
 
@@ -40,7 +41,12 @@
 void TranslatorSession::run () {
     TranslatorAction* action = (TranslatorAction*)getAction();
     flags = action->getFlags();
-
+#ifdef _DEBUG
+    if (flags.assertOnRecursion) {
+        int rec = Jitrino::getCompilationRecursionLevel();
+        assert( rec == 1);
+    }
+#endif
     translate();
     postTranslatorCleanup();
 }
@@ -50,6 +56,7 @@
     CompilationContext* cc = getCompilationContext();
     IRManager* irm = cc->getHIRManager();
     assert(irm);
+    irm->getTypeManager().setLazyResolutionMode(flags.lazyResolution);
     MethodDesc& methodDesc = irm->getMethodDesc();
     //create IRBuilder
     MemoryManager& mm = cc->getCompilationLevelMemoryManager();
@@ -79,9 +86,7 @@
 
 
 static const char* help = \
-    "  inlineMethods[={ON|off}] - bytecode inlining\n"\
     "  propValues[={ON|off}]    -  propagate values during translation\n"\
-    "  guardedInlining[={on|OFF}]  - do guarded inlining during translation\n"\
     "  genCharArrayCopy[={on|off}] - generate intrinsic calls to char array copy\n"\
     "  genArrayCopy[={ON|off}] - inline java/lang/System::arraycopy call as a copying loop\n"\
     "  genArrayCopyRepMove[={ON|off}] - inline java/lang/System::arraycopy call as 'rep move' instruction\n"\
@@ -120,20 +125,12 @@
     flags.syncAsEnterFence = getBoolArg("syncAsEnterFence",false);
     flags.newCatchHandling = getBoolArg("newCatchHandling",true);
 
-    flags.inlineMethods  = getBoolArg("inlineMethods", false);
-    flags.guardedInlining = getBoolArg("guardedInlining", false);
-
+    
     flags.genMinMaxAbs = getBoolArg("genMinMaxAbs", false);
     flags.genFMinMaxAbs = getBoolArg("genFMinMaxAbs", false);
  
-    const char* skipMethods = getStringArg("skipMethods", NULL);
-    if(skipMethods == NULL) {
-        flags.inlineSkipTable = NULL;
-    } else {
-        MemoryManager& mm = Jitrino::getGlobalMM();
-        flags.inlineSkipTable = new (mm) Method_Table(mm, strdup(skipMethods), "SKIP_METHODS", true);
-    }
-
+    flags.lazyResolution = getBoolArg("lazyResolution", false);
+    flags.assertOnRecursion = getBoolArg("assertOnRecursion", flags.lazyResolution);
 }
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/TranslatorIntfc.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/TranslatorIntfc.h?view=diff&rev=540926&r1=540925&r2=540926
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/TranslatorIntfc.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/translator/TranslatorIntfc.h Wed May 23 04:22:55 2007
@@ -50,8 +50,6 @@
     // to select which byte code translator optimizations are done
 struct TranslatorFlags {
     bool propValues         : 1;    // do value propagation
-    bool inlineMethods      : 1;    // do method inlining
-    bool guardedInlining    : 1;    // a step further for inlining
     bool genCharArrayCopy   : 1;    // generate intrinsic calls to CharArrayCopy
     bool genArrayCopy       : 1;    // inline java/lang/System::arraycopy call as a copying loop
     bool genArrayCopyRepMove: 1;    // inline java/lang/System::arraycopy call as 'rep move' instruction
@@ -62,7 +60,8 @@
     bool genMinMaxAbs       : 1;    // gen min/max/abs opcodes instead of using select
     bool genFMinMaxAbs      : 1;    // gen min/max/abs opcodes for floats
     bool optArrayInit       : 1;    // skip array initializers from optimizations
-    Method_Table* inlineSkipTable; // do not inline these methods
+    bool lazyResolution     : 1;    //do not ask VM to resolve any classes during a compilation
+    bool assertOnRecursion  : 1;    //assert of translator work in recursove compilation. Used to check lazy resolution mode.
 };
 
 class IRBuilderAction;
@@ -168,12 +167,6 @@
 
 extern void
 setStackOpndSavedOpnd(Opnd* opnd,bool val);
-
-extern void 
-IRinline(CompilationInterface&      compilationInterface,
-         IRBuilder&                 irBuilder,
-         InstFactory&               instFactory,
-         ControlFlowGraph*                 fg);
 
 } //namespace Jitrino 
 



Mime
View raw message