Index: vm/jitrino/src/translator/java/JavaByteCodeTranslator.h =================================================================== --- vm/jitrino/src/translator/java/JavaByteCodeTranslator.h (revision 573599) +++ vm/jitrino/src/translator/java/JavaByteCodeTranslator.h (working copy) @@ -52,7 +52,7 @@ - void offset(uint32 offset); + void offset(uint32 offset, uint8 opcode); void offset_done(uint32 offset); void checkStack(); // called before parsing starts @@ -187,7 +187,7 @@ void if_acmpne(uint32 targetOffset,uint32 nextOffset); void goto_(uint32 targetOffset,uint32 nextOffset); void jsr(uint32 offset, uint32 nextOffset); - void ret(uint16 varIndex); + void ret(uint16 varIndex, const uint8* byteCodes); void tableswitch(JavaSwitchTargetsIter*); void lookupswitch(JavaLookupSwitchTargetsIter*); void ireturn(uint32 off); Index: vm/jitrino/src/translator/java/JavaLabelPrepass.cpp =================================================================== --- vm/jitrino/src/translator/java/JavaLabelPrepass.cpp (revision 573599) +++ vm/jitrino/src/translator/java/JavaLabelPrepass.cpp (working copy) @@ -204,7 +204,6 @@ { if (opnd) return; opnd = irBuilder->genVarDef(declaredType, false); - if(Log::isEnabled()) { Log::out() << "Create operand for VarIncarnation:" << ::std::endl; Log::out() << " opnd:"; opnd->print(Log::out()); Log::out() << ::std::endl; @@ -328,7 +327,7 @@ handlerOffset, exceptionType); block->addHandler(handler); - StateInfo *hi = prepass.stateTable->createStateInfo(handlerOffset, true); + StateInfo *hi = prepass.stateTable->createStateInfo(handlerOffset, prepass.getNumVars()); hi->addCatchHandler(handler); StateInfo::SlotInfo* slot; if (hi->stackDepth != prepass.getNumVars()) { @@ -562,8 +561,8 @@ stateTable->setStateInfo(&stateInfo, 0, false); } -void JavaLabelPrepass::offset(uint32 offset) { - if (Log::isEnabled()) Log::out() << std::endl << "PREPASS OFFSET " << (int32)offset << ", blockNo=" << blockNumber << std::endl; +void JavaLabelPrepass::offset(uint32 offset, uint8 opcode) { + if (Log::isEnabled()) Log::out() << std::endl << "PREPASS OFFSET " << (int32)offset << " " << opcodeToChar(opcode) << ", blockNo=" << blockNumber << std::endl; bytecodevisited->setBit(offset,true); if (offset==0) stateTable->restoreStateInfo(&stateInfo, offset); @@ -967,7 +966,10 @@ getVisited()->setBit(targetOffset,false); } -void JavaLabelPrepass::ret(uint16 varIndex) { +void JavaLabelPrepass::ret(uint16 varIndex, const uint8* byteCodes) { +if(strcmp(methodDesc.getName(),"main")==0) { +//asm("int3"); +} StateInfo::SlotInfo *slot = &stateInfo.stack[varIndex]; VariableIncarnation* var = slot->vars->getVarIncarnation(); assert(var); @@ -982,7 +984,7 @@ JsrEntryToJsrNextMap::const_iterator iter; for (iter = sub_entry_range.first; iter != sub_entry_range.second; iter++) { assert((*iter).first == subEntryOffset); - uint32 jsrTargetOffset = (*iter).second; + uint32 jsrNextOffset = (*iter).second; // according to JVM Spec: // When executing the ret instruction, which implements a @@ -994,7 +996,9 @@ // propagating new objects created in finally section // to the instruction that follows the JSR // - stateTable->setStateInfoFromFinally(&stateInfo, jsrTargetOffset); + stateTable->setStateInfoFromFinally(&stateInfo, jsrNextOffset); + labelStack->push((uint8*)byteCodes + jsrNextOffset); +// labelStack->push((uint8*)3); } } @@ -1821,7 +1825,6 @@ } state->stackDepth = to; } else { // needs to merge the states - assert(!includeStack || state->stackDepth == stackDepth); if(Log::isEnabled()) { Log::out() << " before\n"; printState(state); @@ -1830,12 +1833,23 @@ struct StateInfo::SlotInfo *inSlot = &inState->stack[i]; struct StateInfo::SlotInfo *slot = &stack[i]; if(Log::isEnabled()) { - Log::out() << " i = " << i << ::std::endl; - Log::out() << "inSlot: ";StateInfo::print(*inSlot, Log::out());Log::out() << ::std::endl; - Log::out() << "slot: ";StateInfo::print(*slot, Log::out());Log::out() << ::std::endl; + Log::out() << " i = " << i << ::std::endl; + Log::out() << " inSlot: ";StateInfo::print(*inSlot, Log::out());Log::out() << ::std::endl; + Log::out() << " slot: ";StateInfo::print(*slot, Log::out());Log::out() << ::std::endl; } - mergeSlots(inSlot, slot, offset, i < (unsigned)numVars); + if(i < state->stackDepth) { + mergeSlots(inSlot, slot, offset, i < (unsigned)numVars); + } else { // inState has more slots. Additional ones should not be merged. + rewriteSlots(inSlot, slot, offset, i < (unsigned)numVars); + } } + if(includeStack) { + assert(state->stackDepth <= stackDepth); + if(state->stackDepth < stackDepth) { + prepass.getVisited()->setBit(offset,false); + state->stackDepth = stackDepth; + } + } } if(Log::isEnabled()) { Log::out() << " after\n"; @@ -1844,13 +1858,35 @@ } } +void StateTable::rewriteSlots(StateInfo::SlotInfo* inSlot, StateInfo::SlotInfo* slot, uint32 offset, bool isVar) { + + Type *intype = inSlot->type; + slot->type = intype; + + assert(inSlot->vars); + if(!slot->vars) { + VariableIncarnation* var_inc = inSlot->vars->getVarIncarnation(); + assert(var_inc); + slot->vars = new (memManager) SlotVar(var_inc); + } + slot->vars->addVarIncarnations(inSlot->vars, memManager, offset); + if (!isVar) { + slot->vars->mergeVarIncarnations(&typeManager); + } + + slot->slotFlags = inSlot->slotFlags; + slot->jsrLabelOffset = inSlot->jsrLabelOffset; +} + void StateTable::mergeSlots(StateInfo::SlotInfo* inSlot, StateInfo::SlotInfo* slot, uint32 offset, bool isVar) { if (!getStateInfo(offset)->isVisited()) { - assert(NULL == slot->type); - assert(NULL == slot->vars); - copySlotInfo(*slot, *inSlot); - return; +// assert(NULL == slot->type); +// assert(NULL == slot->vars); + if (!slot->type && !slot->vars) { + copySlotInfo(*slot, *inSlot); + return; + } // else it is an node after (next) jsr. The state was propagated here from ret. } slot->jsrLabelOffset = inSlot->jsrLabelOffset; @@ -1910,32 +1946,30 @@ Log::out() << "SETSTATE FROM FINALLY offset=" <<(int)offset << " depth=" << inState->stackDepth << ::std::endl; printState(inState); } + unsigned stackDepth = inState->stackDepth; StateInfo *state = getStateInfo(offset); assert(state); - unsigned stackDepth = inState->stackDepth; + assert(state->stackDepth <= stackDepth); + + if(state != NULL && Log::isEnabled()) { + Log::out() << " before\n"; + printState(state); + } if (stackDepth > 0) { - if (maxDepth < stackDepth) maxDepth = stackDepth; - if (Log::isEnabled()) Log::out() << "MAXDEPTH " << maxDepth << ::std::endl; + if (maxDepth < stackDepth) { + maxDepth = stackDepth; + if (Log::isEnabled()) Log::out() << "MAXDEPTH " << maxDepth << ::std::endl; + } struct StateInfo::SlotInfo *stack = state->stack; - // stack must be propagated from JSR to jsrNext earlier - assert(stack); - assert(state->stackDepth == stackDepth); - if(Log::isEnabled()) { - Log::out() << " before\n"; - printState(state); - } + state->stackDepth = stackDepth; for (unsigned i=0; i < stackDepth; i++) { struct StateInfo::SlotInfo *inSlot = &inState->stack[i]; struct StateInfo::SlotInfo *slot = &stack[i]; Type *intype = inSlot->type; Type *type = slot->type; - if (Log::isEnabled()) Log::out() << "STACK " << i << ": "<< type << ::std::endl; +// if (Log::isEnabled()) Log::out() << "STACK " << i << ": "<< type << ::std::endl; if (!type && intype) { // don't merge, just rewrite! - slot->type = intype; - // Consider copying not pointers but SlotVat structures. - slot->vars = inSlot->vars; - slot->slotFlags = inSlot->slotFlags; - slot->jsrLabelOffset = inSlot->jsrLabelOffset; + rewriteSlots(inSlot, slot, offset, i < numVars); prepass.getVisited()->setBit(offset,false); } else if (!intype) { continue; Index: vm/jitrino/src/translator/java/JavaByteCodeParser.h =================================================================== --- vm/jitrino/src/translator/java/JavaByteCodeParser.h (revision 573599) +++ vm/jitrino/src/translator/java/JavaByteCodeParser.h (working copy) @@ -85,7 +85,7 @@ bool noNeedToParse; // called before each byte code to indicate the next byte code's offset - virtual void offset(uint32 offset) = 0; + virtual void offset(uint32 offset, uint8 opcode) = 0; virtual void offset_done(uint32 offset) = 0; virtual void nop() = 0; virtual void aconst_null() = 0; @@ -205,7 +205,7 @@ virtual void if_acmpne(uint32 targetOffset,uint32 nextOffset) = 0; virtual void goto_(uint32 targetOffset,uint32 nextOffset) = 0; virtual void jsr(uint32 offset, uint32 nextOffset) = 0; - virtual void ret(uint16 varIndex) = 0; + virtual void ret(uint16 varIndex, const uint8* byteCodes) = 0; virtual void tableswitch(JavaSwitchTargetsIter*) = 0; virtual void lookupswitch(JavaLookupSwitchTargetsIter*) = 0; virtual void ireturn(uint32 off) = 0; Index: vm/jitrino/src/translator/java/JavaLabelPrepass.h =================================================================== --- vm/jitrino/src/translator/java/JavaLabelPrepass.h (revision 573599) +++ vm/jitrino/src/translator/java/JavaLabelPrepass.h (working copy) @@ -216,7 +216,7 @@ /////////////////////////////////////////////////////////////////////////// // called before each byte code to indicate the next byte code's offset - void offset(uint32 offset); + void offset(uint32 offset, uint8 opcode); // called after each byte code offset is worked out void offset_done(uint32 offset) {} @@ -436,7 +436,7 @@ void if_acmpne(uint32 targetOffset,uint32 nextOffset); void goto_(uint32 targetOffset,uint32 nextOffset); void jsr(uint32 offset, uint32 nextOffset); - void ret(uint16 varIndex); + void ret(uint16 varIndex, const uint8* byteCodes); void tableswitch(JavaSwitchTargetsIter*); void lookupswitch(JavaLookupSwitchTargetsIter*); void incrementReturn(); @@ -549,15 +549,15 @@ StateInfo *getStateInfo(uint32 offset) { return hashtable[offset]; } - StateInfo *createStateInfo(uint32 offset, bool createStack = false) { + StateInfo *createStateInfo(uint32 offset, unsigned stackDepth = MAX_UINT32) { StateInfo *state = hashtable[offset]; if (state == NULL) { state = new (memManager) StateInfo(); hashtable[offset] = state; } - if (createStack && state->stack == NULL) { + if (stackDepth != MAX_UINT32 && state->stack == NULL) { state->stack = new (memManager) StateInfo::SlotInfo[maxDepth]; - state->stackDepth = numVars; + state->stackDepth = stackDepth; } if(Log::isEnabled()) { Log::out() << "CREATESTATE " <<(int)offset << " depth " << state->stackDepth << ::std::endl; @@ -568,6 +568,7 @@ void copySlotInfo(StateInfo::SlotInfo& to, StateInfo::SlotInfo& from); void mergeSlots(StateInfo::SlotInfo* inSlot, StateInfo::SlotInfo* slot, uint32 offset, bool isVar); + void rewriteSlots(StateInfo::SlotInfo* inSlot, StateInfo::SlotInfo* slot, uint32 offset, bool isVar); void setStackInfo(StateInfo *inState, uint32 offset, bool includeVars, bool includeStack); void setStateInfo(StateInfo *inState, uint32 offset, bool isFallThru, bool varsOnly = false); void setStateInfoFromFinally(StateInfo *inState, uint32 offset); Index: vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp =================================================================== --- vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp (revision 573599) +++ vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp (working copy) @@ -300,10 +300,15 @@ // error: invalid local variable id invalid(); VariableIncarnation* varInc = prepass.getVarInc(currentOffset, index); - assert(varInc); - StateInfo::SlotInfo* slot = &stateInfo->stack[index]; - slot->vars = new (memManager) SlotVar(varInc); - Opnd* var = varInc->getOpnd(); + Opnd* var = NULL; + StateInfo::SlotInfo* slot = NULL; + // assert(varInc); + slot = &stateInfo->stack[index]; + if(varInc) { + slot->vars = new (memManager) SlotVar(varInc); + var = varInc->getOpnd(); + } + if (var) { assert(var->isVarOpnd()); return var->asVarOpnd(); @@ -404,8 +409,11 @@ } void -JavaByteCodeTranslator::offset(uint32 offset) { +JavaByteCodeTranslator::offset(uint32 offset, uint8 opcode) { +if(strcmp(methodToCompile.getName(),"main")==0) { +//asm("int3"); +} // set bc offset in ir builder irBuilder.setBcOffset(offset); if (prepass.isLabel(offset) == false) @@ -416,7 +424,7 @@ } // start a new basic block - if (Log::isEnabled()) Log::out() << "TRANSLATOR BASICBLOCK " << (int32)offset << " " << ::std::endl; + if (Log::isEnabled()) Log::out() << ::std::endl << "TRANSLATOR BASICBLOCK " << (int32)offset << " "<< opcodeToChar(opcode) << ::std::endl; // finish the previous basic block, if any work was required if (!lastInstructionWasABranch) { @@ -1306,7 +1314,7 @@ } void -JavaByteCodeTranslator::ret(uint16 varIndex) { +JavaByteCodeTranslator::ret(uint16 varIndex, const uint8* byteCodes) { lastInstructionWasABranch = true; checkStack(); irBuilder.genRet(getVarOpndLdVar(JavaLabelPrepass::RET,varIndex)); @@ -1995,6 +2003,8 @@ } } irBuilder.genReturn(); + // some manually written test case can leave non empty opnd stack after return + opndStack.makeEmpty(); } //----------------------------------------------------------------------------- Index: vm/jitrino/src/translator/java/JavaByteCodeParser.cpp =================================================================== --- vm/jitrino/src/translator/java/JavaByteCodeParser.cpp (revision 573599) +++ vm/jitrino/src/translator/java/JavaByteCodeParser.cpp (working copy) @@ -350,7 +350,7 @@ assert(0); } } - offset(off); + offset(off, opcode); if (isLinearPass) { if (prepassVisited && ! prepassVisited->getBit(off)) { nextOffset = currentOffset + len; @@ -605,13 +605,13 @@ linearPassEnd = true; if (labelStack != NULL) { // If labelStack is stack then the order of pushes should be reverted. - // For now it is line. + // For now it is line. (labelStack is a Queue) labelStack->push((uint8*)byteCodes + off+si16(bcp+1)); labelStack->push((uint8*)byteCodes + off+3); } break; case 0xa9: - ret(su8(bcp+1)); + ret(su8(bcp+1), byteCodes); linearPassEnd = true; break; case 0xaa: @@ -682,7 +682,7 @@ case 0x38: fstore(su16(bcp+2),off); break; case 0x39: dstore(su16(bcp+2),off); break; case 0x3a: astore(su16(bcp+2),off); break; - case 0xa9: ret(su16(bcp+2)); linearPassEnd = true; break; + case 0xa9: ret(su16(bcp+2), byteCodes); linearPassEnd = true; break; case 0x84: iinc(su16(bcp+2),si16(bcp+4)); break; default: assert(0); @@ -712,7 +712,7 @@ linearPassEnd = true; if (labelStack != NULL) { // If labelStack is stack then the order of pushes should be reverted. - // For now it is line. + // For now it is line. (labelStack is a Queue) labelStack->push((uint8*)byteCodes + off+si32(bcp+1)); labelStack->push((uint8*)byteCodes + off+5); } Index: vm/jitrino/src/translator/TranslatorIntfc.h =================================================================== --- vm/jitrino/src/translator/TranslatorIntfc.h (revision 573599) +++ vm/jitrino/src/translator/TranslatorIntfc.h (working copy) @@ -139,7 +139,13 @@ Opnd** opnds; }; +// +// translator utility +// +extern const char* opcodeToChar(const uint8 opcode); + + // // utility methods added to allow refactoring of Opnd.h // Index: vm/jitrino/src/translator/TranslatorIntfc.cpp =================================================================== --- vm/jitrino/src/translator/TranslatorIntfc.cpp (revision 573599) +++ vm/jitrino/src/translator/TranslatorIntfc.cpp (working copy) @@ -178,6 +178,255 @@ } +const char* opcodeToChar(const uint8 opcode) { + + switch (opcode) { + // 0x0[0-f] + case 0x00: return "nop"; break; + case 0x01: return "aconst_null"; break; + case 0x02: return "iconst_-1"; break; + case 0x03: return "iconst_0"; break; + case 0x04: return "iconst_1"; break; + case 0x05: return "iconst_2"; break; + case 0x06: return "iconst_3"; break; + case 0x07: return "iconst_4"; break; + case 0x08: return "iconst_5"; break; + case 0x09: return "lconst_0"; break; + case 0x0a: return "lconst_1"; break; + case 0x0b: return "fconst_0"; break; + case 0x0c: return "fconst_1"; break; + case 0x0d: return "fconst_2"; break; + case 0x0e: return "dconst_0"; break; + case 0x0f: return "dconst_1"; break; + // 0x1[0-f] + case 0x10: return "bipush"; break; + case 0x11: return "sipush"; break; + case 0x12: return "ldc"; break; + case 0x13: return "ldc"; break; + case 0x14: return "ldc2"; break; + case 0x15: return "iload"; break; + case 0x16: return "lload"; break; + case 0x17: return "fload"; break; + case 0x18: return "dload"; break; + case 0x19: return "aload"; break; + case 0x1a: return "iload_0"; break; + case 0x1b: return "iload_1"; break; + case 0x1c: return "iload_2"; break; + case 0x1d: return "iload_3"; break; + case 0x1e: return "lload_0"; break; + case 0x1f: return "lload_1"; break; + // 0x2[0-f] unused: 0x24 + case 0x20: return "lload_2"; break; + case 0x21: return "lload_3"; break; + case 0x22: return "fload_0"; break; + case 0x23: return "fload_1"; break; + case 0x24: return "fload_2"; break; + case 0x25: return "fload_3"; break; + case 0x26: return "dload_0"; break; + case 0x27: return "dload_1"; break; + case 0x28: return "dload_2"; break; + case 0x29: return "dload_3"; break; + case 0x2a: return "aload_0"; break; + case 0x2b: return "aload_1"; break; + case 0x2c: return "aload_2"; break; + case 0x2d: return "aload_3"; break; + case 0x2e: return "iaload"; break; + case 0x2f: return "laload"; break; + // 0x3[0-f] + case 0x30: return "faload"; break; + case 0x31: return "daload"; break; + case 0x32: return "aaload"; break; + case 0x33: return "baload"; break; + case 0x34: return "caload"; break; + case 0x35: return "saload"; break; + case 0x36: return "istore"; break; + case 0x37: return "lstore"; break; + case 0x38: return "fstore"; break; + case 0x39: return "dstore"; break; + case 0x3a: return "astore"; break; + case 0x3b: return "istore_0"; break; + case 0x3c: return "istore_1"; break; + case 0x3d: return "istore_2"; break; + case 0x3e: return "istore_3"; break; + case 0x3f: return "lstore_0"; break; + // 0x4[0-f] + case 0x40: return "lstore_1"; break; + case 0x41: return "lstore_2"; break; + case 0x42: return "lstore_3"; break; + case 0x43: return "fstore_0"; break; + case 0x44: return "fstore_1"; break; + case 0x45: return "fstore_2"; break; + case 0x46: return "fstore_3"; break; + case 0x47: return "dstore_0"; break; + case 0x48: return "dstore_1"; break; + case 0x49: return "dstore_2"; break; + case 0x4a: return "dstore_3"; break; + case 0x4b: return "astore_0"; break; + case 0x4c: return "astore_1"; break; + case 0x4d: return "astore_2"; break; + case 0x4e: return "astore_3"; break; + case 0x4f: return "iastore"; break; + // 0x5[0-f] + case 0x50: return "lastore"; break; + case 0x51: return "fastore"; break; + case 0x52: return "dastore"; break; + case 0x53: return "aastore"; break; + case 0x54: return "bastore"; break; + case 0x55: return "castore"; break; + case 0x56: return "sastore"; break; + case 0x57: return "pop"; break; + case 0x58: return "pop2"; break; + case 0x59: return "dup"; break; + case 0x5a: return "dup_x1"; break; + case 0x5b: return "dup_x2"; break; + case 0x5c: return "dup2"; break; + case 0x5d: return "dup2_x1"; break; + case 0x5e: return "dup2_x2"; break; + case 0x5f: return "swap"; break; + // 0x6[0-f] + case 0x60: return "iadd"; break; + case 0x61: return "ladd"; break; + case 0x62: return "fadd"; break; + case 0x63: return "dadd"; break; + case 0x64: return "isub"; break; + case 0x65: return "lsub"; break; + case 0x66: return "fsub"; break; + case 0x67: return "dsub"; break; + case 0x68: return "imul"; break; + case 0x69: return "lmul"; break; + case 0x6a: return "fmul"; break; + case 0x6b: return "dmul"; break; + case 0x6c: return "idiv"; break; + case 0x6d: return "ldiv"; break; + case 0x6e: return "fdiv"; break; + case 0x6f: return "ddiv"; break; + // 0x7[0-f] + case 0x70: return "irem"; break; + case 0x71: return "lrem"; break; + case 0x72: return "frem"; break; + case 0x73: return "drem"; break; + case 0x74: return "ineg"; break; + case 0x75: return "lneg"; break; + case 0x76: return "fneg"; break; + case 0x77: return "dneg"; break; + case 0x78: return "ishl"; break; + case 0x79: return "lshl"; break; + case 0x7a: return "ishr"; break; + case 0x7b: return "lshr"; break; + case 0x7c: return "iushr"; break; + case 0x7d: return "lushr"; break; + case 0x7e: return "iand"; break; + case 0x7f: return "land"; break; + // 0x8[0-f] + case 0x80: return "ior"; break; + case 0x81: return "lor"; break; + case 0x82: return "ixor"; break; + case 0x83: return "lxor"; break; + case 0x84: return "iinc"; break; + case 0x85: return "i2l"; break; + case 0x86: return "i2f"; break; + case 0x87: return "i2d"; break; + case 0x88: return "l2i"; break; + case 0x89: return "l2f"; break; + case 0x8a: return "l2d"; break; + case 0x8b: return "f2i"; break; + case 0x8c: return "f2l"; break; + case 0x8d: return "f2d"; break; + case 0x8e: return "d2i"; break; + case 0x8f: return "d2l"; break; + case 0x90: return "d2f"; break; + case 0x91: return "i2b"; break; + case 0x92: return "i2c"; break; + case 0x93: return "i2s"; break; + case 0x94: return "lcmp"; break; + case 0x95: return "fcmpl"; break; + case 0x96: return "fcmpg"; break; + case 0x97: return "dcmpl"; break; + case 0x98: return "dcmpg"; break; + + case 0x99: return "ifeq"; break; + case 0x9a: return "ifne"; break; + case 0x9b: return "iflt"; break; + case 0x9c: return "ifge"; break; + case 0x9d: return "ifgt"; break; + case 0x9e: return "ifle"; break; + case 0x9f: return "if_icmpeq"; break; + // 0xa[0-f] + case 0xa0: return "if_icmpne"; break; + case 0xa1: return "if_icmplt"; break; + case 0xa2: return "if_icmpge"; break; + case 0xa3: return "if_icmpgt"; break; + case 0xa4: return "if_icmple"; break; + case 0xa5: return "if_acmpeq"; break; + case 0xa6: return "if_acmpne"; break; + case 0xa7: return "goto"; break; + case 0xa8: return "jsr"; break; + case 0xa9: return "ret"; break; + case 0xaa: return "switch"; break; + case 0xab: return "lookupswitch"; break; + case 0xac: return "ireturn"; break; + case 0xad: return "lreturn"; break; + case 0xae: return "freturn"; break; + case 0xaf: return "dreturn"; break; + // 0xb[0-f] unused: 0xba + case 0xb0: return "areturn"; break; + case 0xb1: return "return"; break; + case 0xb2: return "getstatic"; break; + case 0xb3: return "putstatic"; break; + case 0xb4: return "getfield"; break; + case 0xb5: return "putfield"; break; + case 0xb6: return "invokevirtual"; break; + case 0xb7: return "invokespecial"; break; + case 0xb8: return "invokestatic"; break; + case 0xb9: return "invokeinterface";break; + case 0xbb: return "new"; break; + case 0xbc: return "newarray"; break; + case 0xbd: return "anewarray"; break; + case 0xbe: return "arraylength"; break; + case 0xbf: return "athrow"; break; + // 0xc[0-f] unused: 0xc[a-f] + case 0xc0: return "checkcast"; break; + case 0xc1: return "instanceof"; break; + case 0xc2: return "monitorenter"; break; + case 0xc3: return "monitorexit"; break; + case 0xc4: +/* { + // wide + switch (su8(bcp+1)) { + case 0x15: iload(su16(bcp+2)); break; + case 0x16: lload(su16(bcp+2)); break; + case 0x17: fload(su16(bcp+2)); break; + case 0x18: dload(su16(bcp+2)); break; + case 0x19: aload(su16(bcp+2)); break; + case 0x36: istore(su16(bcp+2),off); break; + case 0x37: lstore(su16(bcp+2),off); break; + case 0x38: fstore(su16(bcp+2),off); break; + case 0x39: dstore(su16(bcp+2),off); break; + case 0x3a: astore(su16(bcp+2),off); break; + case 0xa9: ret(su16(bcp+2)); break; + case 0x84: iinc(su16(bcp+2),si16(bcp+4)); break; + default: + assert(0); + return false; + } + } +*/ + assert(0); + return "UNKNOWN"; + break; + case 0xc5: return "multianewarray"; break; + case 0xc6: return "ifnull"; break; + case 0xc7: return "ifnonnull"; break; + case 0xc8: return "goto_"; break; + case 0xc9: return "jsr"; break; + default: + assert(0); + return "UNKNOWN"; + } + +} + + // // utility methods to allow refactoring of Opnd.h bool Index: vm/jitrino/src/optimizer/FlowGraph.cpp =================================================================== --- vm/jitrino/src/optimizer/FlowGraph.cpp (revision 573599) +++ vm/jitrino/src/optimizer/FlowGraph.cpp (working copy) @@ -529,8 +529,9 @@ // JSR never returns. Convert to jmp. // saveReturn->unlink(); - if(retVar != NULL) - stVar->unlink(); + if(retVar != NULL) { + irManager->getOpndManager().deleteVar((VarOpnd*)retVar); + } const Edges& inEdges = entryJSR->getInEdges(); for(eiter = inEdges.begin(); eiter != inEdges.end();) { Index: vm/jitrino/src/optimizer/inliner.cpp =================================================================== --- vm/jitrino/src/optimizer/inliner.cpp (revision 573599) +++ vm/jitrino/src/optimizer/inliner.cpp (working copy) @@ -296,7 +296,7 @@ protected: bool leaf; - void offset(uint32 offset) {}; + void offset(uint32 offset, uint8 opcode) {}; void offset_done(uint32 offset) {}; void nop() {} void aconst_null() {} @@ -416,7 +416,7 @@ void if_acmpne(uint32 targetOffset,uint32 nextOffset) {} void goto_(uint32 targetOffset,uint32 nextOffset) {} void jsr(uint32 offset, uint32 nextOffset) {} - void ret(uint16 varIndex) {} + void ret(uint16 varIndex,const uint8* byteCodes) {} void tableswitch(JavaSwitchTargetsIter*) {} void lookupswitch(JavaLookupSwitchTargetsIter*) {} void ireturn(uint32 off) {}