You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by mf...@apache.org on 2007/07/13 16:19:39 UTC
svn commit: r556007 [2/3] - in /harmony/enhanced/drlvm/trunk/vm:
jitrino/src/codegenerator/ jitrino/src/codegenerator/ia32/
jitrino/src/codegenerator/ipf/ jitrino/src/codegenerator/ipf/include/
jitrino/src/dynopt/ jitrino/src/main/ jitrino/src/optimize...
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/FlowGraph.cpp Fri Jul 13 07:19:35 2007
@@ -34,7 +34,6 @@
#include "escapeanalyzer.h"
#include "deadcodeeliminator.h"
#include "TranslatorIntfc.h"
-#include "CGSupport.h"
#include "LoopTree.h"
#include <stdlib.h>
@@ -253,7 +252,10 @@
var = opndManager.createVarOpnd(dst->getType(), false);
Inst* stVar = instFactory.makeStVar(var, dst);
if(inst->getOperation().canThrow()) {
- stBlock = fg.createBlockNode(instFactory.makeLabel());
+ LabelInst* lblInst = instFactory.makeLabel();
+ assert(inst->getBCOffset()!=ILLEGAL_BC_MAPPING_VALUE);
+ lblInst->setBCOffset(inst->getBCOffset());
+ stBlock = fg.createBlockNode(lblInst);
stBlock->appendInst(stVar);
Node* succ = node->getUnconditionalEdge()->getTargetNode();
Edge* succEdge = node->findTargetEdge(succ);
@@ -614,29 +616,6 @@
Node* newEntry = _duplicateRegion(*irManager, entryJSR, nodesInJSR, defUses, *nodeRenameTable, *opndRenameTable, 0);
- // update the BCMap
- if(irManager->getCompilationInterface().isBCMapInfoRequired()) {
- MethodDesc* meth = irManager->getCompilationInterface().getMethodToCompile();
- void *bc2HIRmapHandler = getContainerHandler(bcOffset2HIRHandlerName, meth);
-
- // update the BCMap for each copied node
- NodeRenameTable::Iter nodeIter(nodeRenameTable);
- Node* oldNode = NULL;
- Node* newNode = NULL;
- StlBitVector regionNodes(inlineManager);
- while(nodeIter.getNextElem(oldNode, newNode)) {
- Inst* oldLast = (Inst*)oldNode->getLastInst();
- Inst* newLast = (Inst*)newNode->getLastInst();
- if (oldLast->asMethodCallInst() || oldLast->asCallInst()) {
- assert(newLast->asMethodCallInst() || newLast->asCallInst());
- uint16 bcOffset = getBCMappingEntry(bc2HIRmapHandler, oldLast->getId());
- assert((bcOffset != 0) && (bcOffset != ILLEGAL_BC_MAPPING_VALUE));
- setBCMappingEntry(bc2HIRmapHandler, newLast->getId(), bcOffset);
- }
-
- }
- }
-
fg.removeEdge(block,retTarget);
fg.removeEdge(block,entryJSR);
jsrInst->unlink();
@@ -858,7 +837,35 @@
}
+static void checkBCMapping(IRManager& irm) {
+#ifdef _DEBUG
+ ControlFlowGraph& fg = irm.getFlowGraph();
+ const Nodes& nodes= fg.getNodes();
+ for (Nodes::const_iterator it = nodes.begin(), end = nodes.end(); it!=end; ++it) {
+ Node* node = *it;
+ if (!node->isEmpty()) { //allow empty nodes (like dispatches, exit, return nodes) do not have bc-mapping
+ for (Inst* inst = (Inst*)node->getFirstInst(); inst!=NULL; inst = inst->getNextInst()) {
+ if (inst->getOperation().canThrow() || inst->isLabel()) {
+ assert(inst->getBCOffset()!=ILLEGAL_BC_MAPPING_VALUE);
+ }
+ }
+ }
+ }
+#endif
+}
+
void FlowGraph::doTranslatorCleanupPhase(IRManager& irm) {
+ uint32 id = irm.getCompilationContext()->getCurrentSessionNum();
+ const char* stage = "trans_cleanup";
+ if (Log::isLogEnabled(LogStream::IRDUMP)) {
+ LogStream& irdump = Log::log(LogStream::IRDUMP);
+ Log::printStageBegin(irdump.out(), id, "TRANS", stage, stage);
+ irdump << OptPass::indent(irm) << "Trans: Running " << "cleanup" << ::std::endl;
+ Log::printIRDumpBegin(irdump.out(), id, stage, "before");
+ printHIR(irdump.out(), irm.getFlowGraph(), irm.getMethodDesc());
+ Log::printIRDumpEnd(irdump.out(), id, stage, "before");
+ }
+
ControlFlowGraph& fg = irm.getFlowGraph();
InstFactory& instFactory = irm.getInstFactory();
OpndManager& opndManager = irm.getOpndManager();
@@ -869,7 +876,9 @@
inlineJSRs(&irm);
fg.purgeUnreachableNodes();
-
+
+ checkBCMapping(irm);
+
{
static CountTime cleanupPhaseInternalTimer("ptra::fg::cleanupPhase::in");
AutoTimer tm(cleanupPhaseInternalTimer);
@@ -1032,6 +1041,11 @@
//
fg.purgeUnreachableNodes();
fg.purgeEmptyNodes(false);
+
+ if (Log::isLogEnabled(LogStream::IRDUMP)) {
+ LogStream& irdump = Log::log(LogStream::IRDUMP);
+ Log::printStageEnd(irdump.out(), id, "TRANS", stage, stage);
+ }
}
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.cpp Fri Jul 13 07:19:35 2007
@@ -25,7 +25,6 @@
#include "Inst.h"
#include "CSEHash.h"
#include "Log.h"
-#include "CGSupport.h"
#include "irmanager.h"
#include "CompilationContext.h"
@@ -140,10 +139,9 @@
irBuilder.genBranch(instType, mod, label, src1);
}
virtual Inst* genDirectCall(MethodDesc* methodDesc,Type* returnType,Opnd* tauNullCheckedFirstArg,
- Opnd* tauTypesChecked,uint32 numArgs,Opnd* args[],InlineInfoBuilder* inlineBuilder)
+ Opnd* tauTypesChecked,uint32 numArgs,Opnd* args[])
{
- irBuilder.genDirectCall(methodDesc, returnType, tauNullCheckedFirstArg, tauTypesChecked,
- numArgs, args, inlineBuilder);
+ irBuilder.genDirectCall(methodDesc, returnType, tauNullCheckedFirstArg, tauTypesChecked, numArgs, args);
return (Inst*)irBuilder.getCurrentLabel()->getNode()->getLastInst();
}
// load, store & mov
@@ -251,8 +249,7 @@
irBuilderFlags.expandVirtualCallAddrs = getBoolArg("expandVirtualCallAddrs", true);
irBuilderFlags.expandNullChecks = getBoolArg("expandNullChecks", true);
irBuilderFlags.expandElemTypeChecks = getBoolArg("expandElemTypeChecks", true);
- irBuilderFlags.fullBcMap = getBoolArg("fullBcMap", false);
-
+
//
// IRBuilder translation-time optimizations
//
@@ -284,8 +281,7 @@
cseHashTable(NULL),
simplifier(NULL),
tauMethodSafeOpnd(NULL),
-offset(0),
-bc2HIRmapHandler(NULL)
+offset(0)
{
}
@@ -307,13 +303,7 @@
CompilationInterface* ci = getCompilationContext()->getVMCompilationInterface();
irBuilderFlags.insertWriteBarriers = ci->needWriteBarriers();
- irBuilderFlags.isBCMapinfoRequired = ci->isBCMapInfoRequired();
irBuilderFlags.compressedReferences = irBuilderFlags.compressedReferences || VMInterface::areReferencesCompressed();
-
- if (irBuilderFlags.isBCMapinfoRequired) {
- MethodDesc* meth = irm->getCompilationInterface().getMethodToCompile();
- bc2HIRmapHandler = getContainerHandler(bcOffset2HIRHandlerName, meth);
- }
}
@@ -324,15 +314,16 @@
Inst* IRBuilder::appendInst(Inst* inst) {
assert(currentLabel);
- if (irBuilderFlags.isBCMapinfoRequired) {
- uint32 instID = inst->getId();
- if (irBuilderFlags.fullBcMap) {
- setBCMappingEntry(bc2HIRmapHandler, instID, (uint16)offset);
- } else if (inst->asMethodCallInst() || inst->asCallInst()) {
- setBCMappingEntry(bc2HIRmapHandler, instID, (uint16)offset);
- }
+ inst->setBCOffset((uint16)offset);
+ Node* node = currentLabel->getNode();
+
+ assert(currentLabel->getBCOffset()!=ILLEGAL_BC_MAPPING_VALUE || node->isEmpty());
+ if (node->isEmpty() && currentLabel->getBCOffset()==ILLEGAL_BC_MAPPING_VALUE) {
+ currentLabel->setBCOffset((uint16)offset);
}
- currentLabel->getNode()->appendInst(inst);
+ assert(currentLabel->getBCOffset()!=ILLEGAL_BC_MAPPING_VALUE);
+
+ node->appendInst(inst);
if(Log::isEnabled()) {
inst->print(Log::out());
Log::out() << ::std::endl;
@@ -378,6 +369,7 @@
LabelInst* IRBuilder::genMethodEntryLabel(MethodDesc* methodDesc) {
LabelInst* labelInst = instFactory->makeMethodEntryLabel(methodDesc);
currentLabel = labelInst;
+ labelInst->setBCOffset(0);
if(Log::isEnabled()) {
currentLabel->print(Log::out());
@@ -387,25 +379,6 @@
return labelInst;
}
-void IRBuilder::genMethodEntryMarker(MethodDesc* methodDesc) {
- if (! irBuilderFlags.insertMethodLabels)
- return;
- appendInst(instFactory->makeMethodMarker(MethodMarkerInst::Entry, methodDesc));
-}
-
-void IRBuilder::genMethodEndMarker(MethodDesc* methodDesc, Opnd *obj, Opnd *retOpnd) {
- if (! irBuilderFlags.insertMethodLabels)
- return;
- assert(obj && !obj->isNull());
- appendInst(instFactory->makeMethodMarker(MethodMarkerInst::Exit, methodDesc, obj, retOpnd));
-}
-
-void IRBuilder::genMethodEndMarker(MethodDesc* methodDesc, Opnd *retOpnd) {
- if (! irBuilderFlags.insertMethodLabels)
- return;
- appendInst(instFactory->makeMethodMarker(MethodMarkerInst::Exit, methodDesc, retOpnd));
-}
-
// compute instructions
Opnd*
IRBuilder::genAdd(Type* dstType, Modifier mod, Opnd* src1, Opnd* src2) {
@@ -1371,7 +1344,7 @@
insertHash(Op_VMHelperCall, bc, cpIndex, numArgs>0?args[0]->getId() : 0, callAddrOpnd->getInst());
}
- return genIndirectMemoryCall(returnType, callAddrOpnd, tauNullCheckedFirstArg, tauTypesChecked, numArgs, args, NULL);
+ return genIndirectMemoryCall(returnType, callAddrOpnd, tauNullCheckedFirstArg, tauTypesChecked, numArgs, args);
}
@@ -1381,8 +1354,7 @@
Opnd* tauNullCheckedFirstArg,
Opnd* tauTypesChecked,
uint32 numArgs,
- Opnd* args[],
- InlineInfoBuilder* inlineInfoBuilder) // NULL if this call is not inlined
+ Opnd* args[])
{
if (!tauNullCheckedFirstArg)
tauNullCheckedFirstArg = genTauUnsafe();
@@ -1396,19 +1368,14 @@
if (irBuilderFlags.expandCallAddrs) {
return genIndirectMemoryCall(returnType, genLdFunAddrSlot(methodDesc),
tauNullCheckedFirstArg, tauTypesChecked,
- numArgs, args,
- inlineInfoBuilder);
+ numArgs, args);
}
for (uint32 i=0; i<numArgs; i++) {
args[i] = propagateCopy(args[i]);
}
Opnd* dst = createOpnd(returnType);
- appendInstUpdateInlineInfo(instFactory->makeDirectCall(dst,
- tauNullCheckedFirstArg, tauTypesChecked,
- numArgs, args,
- methodDesc),
- inlineInfoBuilder,
- methodDesc);
+ appendInst(instFactory->makeDirectCall(dst, tauNullCheckedFirstArg, tauTypesChecked,
+ numArgs, args, methodDesc));
// Note that type initialization should be made available for this type
// and all its ancestor types.
@@ -1421,15 +1388,13 @@
Opnd* tauNullCheckedFirstArg,
Opnd* tauTypesChecked,
uint32 numArgs,
- Opnd* args[],
- InlineInfoBuilder* inlineInfoBuilder) // NULL if this call is not inlined
+ Opnd* args[])
{
if(!methodDesc->isVirtual())
// Must de-virtualize - no vtable
return genDirectCall(methodDesc, returnType,
tauNullCheckedFirstArg, tauTypesChecked,
- numArgs, args,
- inlineInfoBuilder);
+ numArgs, args);
for (uint32 i=0; i<numArgs; i++) {
args[i] = propagateCopy(args[i]);
}
@@ -1453,8 +1418,7 @@
tauNullCheckedFirstArg,
tauTypesChecked,
numArgs,
- args,
- inlineInfoBuilder);
+ args);
if (dst) return dst;
}
@@ -1465,17 +1429,11 @@
methodDesc),
tauNullCheckedFirstArg,
tauTypesChecked,
- numArgs, args,
- inlineInfoBuilder);
+ numArgs, args);
}
Opnd *dst = createOpnd(returnType);
- appendInstUpdateInlineInfo(instFactory->makeTauVirtualCall(dst,
- tauNullCheckedFirstArg,
- tauTypesChecked,
- numArgs, args,
- methodDesc),
- inlineInfoBuilder,
- methodDesc);
+ appendInst(instFactory->makeTauVirtualCall(dst, tauNullCheckedFirstArg,
+ tauTypesChecked, numArgs, args, methodDesc));
return dst;
}
@@ -1556,8 +1514,7 @@
Opnd* tauNullCheckedFirstArg,
Opnd* tauTypesChecked,
uint32 numArgs,
- Opnd* args[],
- InlineInfoBuilder* inlineInfoBuilder) // NULL if this call is not inlined
+ Opnd* args[])
{
for (uint32 i=0; i<numArgs; i++) {
args[i] = propagateCopy(args[i]);
@@ -1573,12 +1530,8 @@
else
tauTypesChecked = propagateCopy(tauTypesChecked);
- appendInstUpdateInlineInfo(instFactory->makeIndirectCall(dst, funAddr,
- tauNullCheckedFirstArg, tauTypesChecked,
- numArgs,
- args),
- inlineInfoBuilder,
- NULL); // indirect call -- no method desc
+ appendInst(instFactory->makeIndirectCall(dst, funAddr, tauNullCheckedFirstArg, tauTypesChecked,
+ numArgs, args));
return dst;
}
@@ -1588,8 +1541,7 @@
Opnd* tauNullCheckedFirstArg,
Opnd* tauTypesChecked,
uint32 numArgs,
- Opnd* args[],
- InlineInfoBuilder* inlineInfoBuilder) // NULL if this call is not inlined
+ Opnd* args[])
{
for (uint32 i=0; i<numArgs; i++) {
args[i] = propagateCopy(args[i]);
@@ -1605,13 +1557,8 @@
tauTypesChecked = propagateCopy(tauTypesChecked);
Opnd* dst = createOpnd(returnType);
- appendInstUpdateInlineInfo(instFactory->makeIndirectMemoryCall(dst, funAddr,
- tauNullCheckedFirstArg,
- tauTypesChecked,
- numArgs,
- args),
- inlineInfoBuilder,
- NULL); // indirect call -- no method desc
+ appendInst(instFactory->makeIndirectMemoryCall(dst, funAddr, tauNullCheckedFirstArg,
+ tauTypesChecked, numArgs, args));
return dst;
}
@@ -1961,8 +1908,7 @@
Opnd* opnd = lookupHash(Op_InitType, type->getId());
if (opnd) return; // no need to re-initialize
- insertHash(Op_InitType, type->getId(),
- appendInst(instFactory->makeInitType(type)));
+ insertHash(Op_InitType, type->getId(), appendInst(instFactory->makeInitType(type)));
}
Opnd*
@@ -3667,17 +3613,6 @@
return dst;
}
-void
-IRBuilder::appendInstUpdateInlineInfo(Inst* inst, InlineInfoBuilder* builder, MethodDesc* target_md)
-{
- assert(inst->getCallInstInlineInfoPtr());
-
- if ( builder ) {
- offset = builder->buildInlineInfoForInst(inst, offset, target_md);
- }
-
- appendInst(inst);
-}
Inst* IRBuilder::getLastGeneratedInst() {
return (Inst*)currentLabel->getNode()->getLastInst();
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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilder.h Fri Jul 13 07:19:35 2007
@@ -31,7 +31,6 @@
#include "Inst.h"
#include "CSEHash.h"
#include "simplifier.h"
-#include "InlineInfo.h"
#include "IRBuilderFlags.h"
#include "PMFAction.h"
@@ -140,24 +139,21 @@
Opnd* tauNullCheckedFirstArg, // 0 for unsafe
Opnd* tauTypesChecked, // 0 to let IRBuilder find taus
uint32 numArgs,
- Opnd* args[],
- InlineInfoBuilder* inlineInfoBuilder); // NULL if this call is not inlined
+ Opnd* args[]);
Opnd* genTauVirtualCall(MethodDesc* methodDesc,//TR
Type* returnType,
Opnd* tauNullCheckedFirstArg, // 0 to let IRBuilder add check
Opnd* tauTypesChecked, // 0 to let IRBuilder find it
uint32 numArgs,
- Opnd* args[],
- InlineInfoBuilder* inlineInfoBuilder); // NULL if this call is not inlined
+ Opnd* args[]);
Opnd* genIndirectCall( Type* returnType, //TR
Opnd* funAddr,
Opnd* tauNullCheckedFirstArg, // 0 for unsafe
Opnd* tauTypesChecked, // 0 to let IRBuilder find it
uint32 numArgs,
- Opnd* args[],
- InlineInfoBuilder* inlineInfoBuilder); // NULL if this call is not inlined
+ Opnd* args[]);
Opnd* genIntrinsicCall(
IntrinsicCallId intrinsicId, //TR
@@ -273,9 +269,6 @@
void genFallThroughLabel(LabelInst* labelInst); //TR
// method entry/exit
LabelInst* genMethodEntryLabel(MethodDesc* methodDesc);//TR
- void genMethodEntryMarker(MethodDesc* methodDesc);//TR
- void genMethodEndMarker(MethodDesc* methodDesc, Opnd *obj, Opnd *retOpnd);//TR
- void genMethodEndMarker(MethodDesc* methodDesc, Opnd *retOpnd);//TR
// value object instructions
Opnd* genLdObj(Type* type, Opnd* addrOfValObj);//TR
void genStObj(Opnd* addrOfDstVal, Opnd* srcVal, Type* type);//TR
@@ -340,8 +333,7 @@
Opnd* tauNullCheckedFirstArg, // 0 to let IRBuilder add check
Opnd* tauTypesChecked, // 0 to let IRBuilder find it
uint32 numArgs,
- Opnd* args[],
- InlineInfoBuilder* inlineInfoBuilder); // NULL if this call is not inlined
+ Opnd* args[]);
Opnd* genLdElemAddrNoChecks(Type *elemType, Opnd* array, Opnd* index);
Opnd* genTauLdVirtFunAddrSlot(Opnd* base, Opnd* tauOk, MethodDesc* methodDesc);
@@ -401,9 +393,6 @@
// checks
void genSourceLineNumber(uint32 fileId, uint32 lineNumber);
-protected:
- void appendInstUpdateInlineInfo(Inst* inst, InlineInfoBuilder* builder, MethodDesc* target_md);
-
private:
void readFlagsFromCommandLine(SessionAction* argSource, const char* argPrefix);
@@ -439,8 +428,8 @@
void insertHash(uint32 opc, Opnd* op1, Opnd* op2, Inst*i) { insertHash(opc, op1->getId(), op2->getId(), i); };
void insertHash(uint32 opc, Opnd* op1, Opnd* op2, Opnd* op3, Inst*i) { insertHash(opc, op1->getId(), op2->getId(), op3->getId(), i); };
void invalid(); // called when the builder detects invalid IR
- void setBcOffset(uint32 bcOffset) { offset = bcOffset; };
- uint32 getBcOffset() { return offset; };
+ void setBcOffset(uint32 bcOffset) { offset = bcOffset;}
+ uint32 getBcOffset() const { return offset; };
friend class JavaByteCodeTranslator;
@@ -472,7 +461,6 @@
// current bc offset
uint32 offset;
- void* bc2HIRmapHandler;
};
} //namespace Jitrino
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilderFlags.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilderFlags.h?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilderFlags.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/IRBuilderFlags.h Fri Jul 13 07:19:35 2007
@@ -40,7 +40,6 @@
genMinMaxAbs = false;
genFMinMaxAbs = false;
useNewTypeSystem = false;
- isBCMapinfoRequired = false;
}
/* expansion flags */
bool expandMemAddrs : 1; // expand field/array element accesses
@@ -61,8 +60,6 @@
bool genFMinMaxAbs : 1;
// LBS Project flags
bool useNewTypeSystem : 1; // Use the new LBS type system rather than the old one
- bool isBCMapinfoRequired : 1; // Produce HIR bc map info
- bool fullBcMap : 1; // Produce HIR bc map info for all intructions
};
} //namespace
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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.cpp Fri Jul 13 07:19:35 2007
@@ -189,11 +189,6 @@
void Inst::print(::std::ostream& os) const {
os << "I" << (int)id << ":";
printFormatString(os, getOperation().getOpcodeFormatString());
- InlineInfo* ii = getCallInstInlineInfoPtr();
- if ( ii && !ii->isEmpty() ) {
- os << " has II: ";
- ii->printLevels(Log::out());
- }
}
void Inst::handlePrintEscape(::std::ostream& os, char code) const {
@@ -220,6 +215,19 @@
}
}
break;
+ case 'b': // bytecode mapping info
+ {
+ if (getBCOffset() == ILLEGAL_BC_MAPPING_VALUE) {
+ Node* node = getNode();
+ if (node!=NULL && node->isBlockNode()) { // write 'unknown' only for block nodes
+ os<<"bcmap:unknown ";
+ }
+ } else {
+ int32 bcOffset = (int32)getBCOffset();
+ os<<"bcmap:"<<bcOffset<<" ";
+ }
+ }
+ break;
case 'p': // arguments to a more direct call
{
bool comma = false;
@@ -673,7 +681,9 @@
InstFactory::clone(Inst* inst, OpndManager& opndManager, OpndRenameTable *table) {
CloneVisitor cloneVisitor(*this, opndManager, *table);
inst->visit(cloneVisitor);
- return cloneVisitor.getClone();
+ Inst* newInst = cloneVisitor.getClone();
+ newInst->setBCOffset(inst->getBCOffset());
+ return newInst;
}
Inst*
@@ -1005,8 +1015,6 @@
newArgs,
inst->getMethodDesc());
newInst->setPersistentInstructionId(inst->getPersistentInstructionId());
- InlineInfo* ii = newInst->getInlineInfoPtr();
- ii->getInlineChainFrom(*inst->getInlineInfoPtr());
return newInst;
}
@@ -1027,8 +1035,6 @@
inst->getNumArgs(),
newArgs);
newInst->setPersistentInstructionId(inst->getPersistentInstructionId());
- InlineInfo* ii = newInst->getInlineInfoPtr();
- ii->getInlineChainFrom(*inst->getInlineInfoPtr());
return newInst;
}
@@ -1600,12 +1606,10 @@
Opnd* dst,
uint32 nArgs,
Opnd** args_,
- CompilationInterface::RuntimeHelperId id,
- InlineInfo* inlInfo) {
+ CompilationInterface::RuntimeHelperId id) {
VMHelperCallInst * inst =
new (memManager) VMHelperCallInst(op, mod, type, dst, nArgs, args_, id);
inst->id = numInsts++;
- inst->inlInfo = inlInfo;
return inst;
}
@@ -2039,12 +2043,10 @@
}
Inst*
-InstFactory::makeVMHelperCall(Opnd* dst, CompilationInterface::RuntimeHelperId id, uint32 numArgs,
- Opnd** args, InlineInfo* inlInfo) {
+InstFactory::makeVMHelperCall(Opnd* dst, CompilationInterface::RuntimeHelperId id, uint32 numArgs, Opnd** args) {
Type::Tag returnType = dst->isNull()? Type::Void : dst->getType()->tag;
args = copyOpnds(args, numArgs);
- return makeVMHelperCallInst(Op_VMHelperCall, Modifier(Exception_Sometimes),
- returnType, dst, numArgs, args, id, inlInfo);
+ return makeVMHelperCallInst(Op_VMHelperCall, Modifier(Exception_Sometimes), returnType, dst, numArgs, args, id);
}
@@ -2833,56 +2835,6 @@
assert(0);
}
return NULL;
-}
-
-InlineInfo*
-Inst::getCallInstInlineInfoPtr() const
-{
- InlineInfo *ii = NULL;
- if ( isMethodCall() ) {
- ii = asMethodCallInst()->getInlineInfoPtr();
- }else if ( isCall() ) {
- ii = asCallInst()->getInlineInfoPtr();
- }
- return ii;
-}
-
-uint32
-InlineInfoBuilder::buildInlineInfoForInst(Inst* inst, uint32 currOffset, MethodDesc* target_md)
-{
- InlineInfo* ii = inst->getCallInstInlineInfoPtr();
- if ( ii ) {
- //buildInlineInfo(ii, currOffset);
- InlineInfoBuilder* parBuilder = parent;
- uint32 parOffset = getCurrentBcOffset();
- ii->prependLevel(getCurrentMd(), currOffset);
- while (parBuilder) {
- ii->prependLevel(parBuilder->getCurrentMd(), parOffset);
- parOffset = parBuilder->getCurrentBcOffset();
- parBuilder = parBuilder->parent;
- }
- if ( Log::isEnabled() ) {
- Log::out() << "InlineInfoBuiler: inlined call to ";
- if ( target_md ) {
- Log::out() << target_md->getName();
- }else{
- Log::out() << "[some method]";
- }
- Log::out() << ", chain: ";
- ii->printLevels(Log::out());
- }
- return parOffset;
- }
- return currOffset;
-}
-void
-InlineInfoBuilder::buildInlineInfo(InlineInfo* ii, uint32 offset) // ii must be non-NULL
-{
- if ( parent ) {
- parent->buildInlineInfo(ii, offset);
- } else {
- addCurrentLevel(ii, getCurrentBcOffset());
- }
}
} //namespace Jitrino
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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Inst.h Fri Jul 13 07:19:35 2007
@@ -33,7 +33,6 @@
#include "Opcode.h"
#include "Opnd.h"
#include "Log.h"
-#include "InlineInfo.h"
#include "ControlFlowGraph.h"
#include "open/types.h"
@@ -365,8 +364,6 @@
}
- InlineInfo* getCallInstInlineInfoPtr() const;
-
protected:
//
// Constructors
@@ -888,7 +885,6 @@
public:
void visit(InstFormatVisitor& visitor) {visitor.accept(this);}
bool isMethodCall() const {return true;}
- InlineInfo* getInlineInfoPtr() { return &inlineInfo; }
private:
friend class InstFactory;
@@ -899,10 +895,7 @@
Opnd** args_,
MethodDesc* md,
MemoryManager& mem_mgr)
- : MethodInst(op, mod, type, dst, nArgs, args_, md),
- inlineInfo(mem_mgr)
- {}
- InlineInfo inlineInfo;
+ : MethodInst(op, mod, type, dst, nArgs, args_, md){}
};
// for call instructions
@@ -914,7 +907,6 @@
uint32 getNumArgs() const {return getNumSrcOperands()-1;}
Opnd* getArg(uint32 argIndex) {return getSrc(argIndex+1);}
Opnd** getArgs() {args[0] = srcs[1]; return args;}
- InlineInfo* getInlineInfoPtr() { return &inlineInfo; }
private:
friend class InstFactory;
@@ -925,8 +917,7 @@
uint32 nArgs,
Opnd** args_,
MemoryManager& mem_mgr)
- : Inst(op, mod, type, dst, nArgs+1),
- inlineInfo(mem_mgr)
+ : Inst(op, mod, type, dst, nArgs+1)
{
args = args_;
switch (nArgs) {
@@ -944,7 +935,6 @@
args[srcIndex - 1] = src;
}
Opnd** args;
- InlineInfo inlineInfo;
};
// intrinsic calls
@@ -1023,7 +1013,6 @@
bool isVMHelperCallInst() const { return true; }
CompilationInterface::RuntimeHelperId getVMHelperId() const {return vmHelperId;}
bool isThrowLazy() const {return vmHelperId == CompilationInterface::Helper_Throw_Lazy;}
-InlineInfo* getInlineInfoPtr() { return inlInfo; }
private:
virtual void handlePrintEscape(::std::ostream&, char code) const;
friend class InstFactory;
@@ -1034,7 +1023,7 @@
uint32 nArgs,
Opnd** args_,
CompilationInterface::RuntimeHelperId id)
- : Inst(op, mod, type, dst, nArgs), vmHelperId(id), inlInfo(NULL)
+ : Inst(op, mod, type, dst, nArgs), vmHelperId(id)
{
args = args_;
switch (nArgs) {
@@ -1052,7 +1041,6 @@
}
Opnd** args;
CompilationInterface::RuntimeHelperId vmHelperId;
- InlineInfo* inlInfo;
};
@@ -1148,7 +1136,7 @@
uint32 numArgs, Opnd** args);
Inst* makeJitHelperCall(Opnd* dst, JitHelperCallId id, uint32 numArgs, Opnd** args);
Inst* makeVMHelperCall(Opnd* dst, CompilationInterface::RuntimeHelperId id, uint32 numArgs,
- Opnd** args, InlineInfo* inlInfo = NULL);
+ Opnd** args);
Inst* makeReturn(Opnd* src);
@@ -1532,8 +1520,7 @@
Opnd* dst,
uint32 nArgs,
Opnd** args_,
- CompilationInterface::RuntimeHelperId id,
- InlineInfo* inlInfo = NULL);
+ CompilationInterface::RuntimeHelperId id);
PhiInst* makePhiInst(Type::Tag type, Opnd* dst, uint32 nArgs, Opnd** args_);
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Opcode.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Opcode.cpp?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Opcode.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/Opcode.cpp Fri Jul 13 07:19:35 2007
@@ -102,18 +102,18 @@
{ Op_Branch, true, MB::ControlFlow, MK::Comparison, "br ", "if c%m.%t %s goto %l", },
{ Op_Jump, true, MB::ControlFlow, MK::None, "jmp ", "goto %l", }, // (different from the CLI jmp opcode)
{ Op_Switch, true, MB::ControlFlow, MK::None, "switch", "switch (%l)[%0]", },
- { Op_DirectCall, true, MB::Call, MK::Exception, "call ", "call %d(%p) ((%0,%1)) -) %l", },
- { Op_TauVirtualCall, true, MB::Call, MK::Exception, "callvirt", "callvrt [%2.%d](%a) ((%0,%1)) -) %l", },
+ { Op_DirectCall, true, MB::Call, MK::Exception, "call ", "call %d(%p) ((%0,%1)) -) %l %b", },
+ { Op_TauVirtualCall, true, MB::Call, MK::Exception, "callvirt", "callvrt [%2.%d](%a) ((%0,%1)) -) %l %b", },
{ Op_IndirectCall, true, MB::Call, MK::Exception, "calli", "calli [%0](%a) ((%1,%2)) -) %l", },
{ Op_IndirectMemoryCall, true, MB::Call, MK::Exception, "callimem", "callimem [%0](%a) ((%1,%2)) -) %l", },
{ Op_IntrinsicCall, true, MB::Call, MK::Exception, "callintr", "callintr %d(%p) ((%0,%1)) -) %l", },
{ Op_JitHelperCall, true, MB::Call, MK::Exception, "callhelper", "callhelper %d(%s) -) %l", },
- { Op_VMHelperCall, true, MB::Call, MK::Exception, "callvmhelper", "callvmhelper %d(%s) -) %l", },
+ { Op_VMHelperCall, true, MB::Call, MK::Exception, "callvmhelper", "callvmhelper %d(%s) -) %l %b", },
{ Op_Return, true, MB::ControlFlow, MK::None, "return", "return %s", },
{ Op_Catch, true, MB::ControlFlow, MK::None, "catch", "catch -) %l", },
- { Op_Throw, true, MB::Exception, MK::Throw, "throw ", "throw %0", },
- { Op_PseudoThrow, true, MB::Exception, MK::Exception, "pseudoThrow ", "pseudoThrow", },
- { Op_ThrowSystemException, true, MB::Exception, MK::None, "throwsys ", "throwsys %d", },
+ { Op_Throw, true, MB::Exception, MK::Throw, "throw ", "throw %0 %b", },
+ { Op_PseudoThrow, true, MB::Exception, MK::Exception, "pseudoThrow ", "pseudoThrow %b", },
+ { Op_ThrowSystemException, true, MB::Exception, MK::None, "throwsys ", "throwsys %d %b", },
{ Op_ThrowLinkingException, true, MB::Exception, MK::None, "throwLink ", "throwLink", },
{ Op_Leave, true, MB::ControlFlow, MK::None, "leave ", "leave %l", }, // CLI only -- DELETE
{ Op_EndFinally, true, MB::ControlFlow, MK::None, "endfinally", "endfinally", }, // CLI only -- DELETE
@@ -127,7 +127,7 @@
{ Op_DefArg, true, MB::None, MK::DefArg, "defarg", "defarg%m -) %l", },
// Load instructions
{ Op_LdConstant, false, MB::Movable, MK::None, "ldc ", "ldc%t #%c -) %l", },
- { Op_LdRef, false, MB::Movable, MK::AutoCompress, "ldref ", "ldref%m (%d) -) %l", },
+ { Op_LdRef, false, MB::Movable, MK::AutoCompress, "ldref ", "ldref%m (%d) -) %l %b", },
{ Op_LdVar, false, MB::None, MK::None, "ldvar ", "ldvar %0 -) %l", },
{ Op_LdVarAddr, false, MB::Movable, MK::None, "ldvara", "ldvara %0 -) %l", },
{ Op_TauLdInd, false, MB::Load, MK::AutoCompress_Speculative, "ldind", "ldind%m:%t [%0] ((%1,%2)) -) %l", },
@@ -154,16 +154,16 @@
{ Op_TauStElem, true, MB::StoreOrSync, MK::Store_AutoCompress, "stelem", "stelem%m:%t %0 ((%3,%4,%5)) -) [%1[%2]]", },
{ Op_TauStStatic, true, MB::StoreOrSync, MK::Store_AutoCompress, "stsfld", "stsfld:%t %0 ((%1)) -) [%d]", },
{ Op_TauStRef, true, MB::StoreOrSync, MK::Store_AutoCompress, "stref ", "stref%m %0 ((%3,%4,%5)) -) [%1 %2] ", }, // high-level version that will make a call to the VM
- { Op_TauCheckBounds, false, MB::Check, MK::Overflow_and_Exception, "chkbounds", "chkbounds %1 .lt. %0 -) %l", }, // takes index and array length arguments, },
+ { Op_TauCheckBounds, false, MB::Check, MK::Overflow_and_Exception, "chkbounds", "chkbounds %1 .lt. %0 -) %l %b", }, // takes index and array length arguments, },
{ Op_TauCheckLowerBound, false, MB::Check, MK::Overflow_and_Exception, "chklb", "chklb %0 .le. %1 -) %l", }, // throws unless src0 <= src1
{ Op_TauCheckUpperBound, false, MB::Check, MK::Overflow_and_Exception, "chkub", "chkub %0 .lt. %1 -) %l", }, // throws unless src0 < src1
- { Op_TauCheckNull, false, MB::Check, MK::Exception_and_DefArg, "chknull", "chknull %0 -) %l", }, // throws NullPointerException if src is null
- { Op_TauCheckZero, false, MB::Check, MK::Exception, "chkzero", "chkzero %0 -) %l", }, // for divide by zero exceptions (div and rem)
+ { Op_TauCheckNull, false, MB::Check, MK::Exception_and_DefArg, "chknull", "chknull %0 -) %l %b", }, // throws NullPointerException if src is null
+ { Op_TauCheckZero, false, MB::Check, MK::Exception, "chkzero", "chkzero %0 -) %l %b", }, // for divide by zero exceptions (div and rem)
{ Op_TauCheckDivOpnds, false, MB::Check, MK::Exception, "chkdivopnds", "chkdivopnds %0,%1 -) %l", }, // for signed divide overflow in CLI (div/rem of MAXNEGINT, -1): generates an ArithmeticException
{ Op_TauCheckElemType, false, MB::Check, MK::Exception, "chkelemtype", "chkelemtype %0,%1 ((%2,%3)) -) %l", }, // Array element type check for aastore
{ Op_TauCheckFinite, false, MB::Check, MK::Exception, "ckfinite", "ckfinite %s -) %l", }, // throws ArithmeticException if value is NaN or +- inifinity
- { Op_NewObj, false, MB::Exception, MK::Exception, "newobj", "newobj %d -) %l", }, // OutOfMemoryException
- { Op_NewArray, false, MB::Exception, MK::Exception, "newarray", "newarray %d[%0] -) %l", }, // OutOfMemoryException, NegativeArraySizeException
+ { Op_NewObj, false, MB::Exception, MK::Exception, "newobj", "newobj %d -) %l %b", }, // OutOfMemoryException
+ { Op_NewArray, false, MB::Exception, MK::Exception, "newarray", "newarray %d[%0] -) %l %b", }, // OutOfMemoryException, NegativeArraySizeException
{ Op_NewMultiArray, false, MB::Exception, MK::Exception, "newmultiarray", "newmultiarray %d[%s] -) %l", }, // OutOfMemoryException, NegativeArraySizeException
{ Op_TauMonitorEnter, true, MB::StoreOrSync, MK::None, "monenter", "monenter %0 ((%1))", }, // (opnd must be non-null)
{ Op_TauMonitorExit, true, MB::StoreOrSync, MK::Exception, "monexit", "monexit %0 ((%1))", }, // (opnd must be non-null), IllegalMonitorStateException
@@ -178,12 +178,12 @@
{ Op_MonitorEnterFence, true, MB::StoreOrSync, MK::None, "monenterfence", "monenterfence %0", }, // (opnd must be non-null)
{ Op_MonitorExitFence, true, MB::StoreOrSync, MK::None, "monexitfence", "monexitfence %0", }, // (opnd must be non-null)
{ Op_TauStaticCast, false, MB::Movable, MK::None, "staticcast", "staticcast %0,%d ((%1)) -) %l", }, // Compile-time assertion. Asserts that cast is legal.
- { Op_TauCast, false, MB::Check, MK::Exception, "cast ", "cast %0,%d ((%1)) -) %l", }, // CastException (suceeds if argument is null, returns casted object)
+ { Op_TauCast, false, MB::Check, MK::Exception, "cast ", "cast %0,%d ((%1)) -) %l %b", }, // CastException (suceeds if argument is null, returns casted object)
{ Op_TauAsType, false, MB::Movable, MK::None, "astype", "astype %0,%d -) %l", }, // returns casted object if argument is an instance of, null otherwise
- { Op_TauInstanceOf, false, MB::Movable, MK::None, "instanceof", "instanceof %0,%d ((%1)) -) %l", }, // returns true if argument is an instance of type T, tau opnd isNonNull
- { Op_InitType, true, MB::CSEable, MK::Exception, "inittype", "inittype %d", }, // can throw a linking exception during class initialization
- { Op_Label, true, MB::None, MK::None, "label ", "%l:", }, // special label instructions for branch labels, finally, catch
- { Op_MethodEntry, true, MB::None, MK::None, "methodentry", "--- MethodEntry(%d): (%s)", }, // method entry label
+ { Op_TauInstanceOf, false, MB::Movable, MK::None, "instanceof", "instanceof %0,%d ((%1)) -) %l",}, // returns true if argument is an instance of type T, tau opnd isNonNull
+ { Op_InitType, true, MB::CSEable, MK::Exception, "inittype", "inittype %d %b", }, // can throw a linking exception during class initialization
+ { Op_Label, true, MB::None, MK::None, "label ", "%l: %b", }, // special label instructions for branch labels, finally, catch
+ { Op_MethodEntry, true, MB::None, MK::None, "methodentry", "--- MethodEntry(%d): (%s) %b",}, // method entry label
{ Op_MethodEnd, true, MB::None, MK::None, "methodend", "+++ MethodEnd(%d) (%s)", }, // end of a method
{ Op_SourceLineNumber, true, MB::None, MK::None, "lineno", "???", }, // change to source position
{ Op_LdObj, false, MB::Load, MK::None, "ldobj ", "ldobj [%0] -) %l", }, // load a value type to the stack
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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/devirtualizer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/devirtualizer.cpp Fri Jul 13 07:19:35 2007
@@ -239,14 +239,7 @@
tauNullChecked,
tauTypesChecked,
numArgs, args, methodDesc);
- //
- // copy InlineInfo
- //
- InlineInfo* call_ii = call->getCallInstInlineInfoPtr();
- InlineInfo* new_ii = directCall->getCallInstInlineInfoPtr();
- assert(call_ii && new_ii);
- new_ii->getInlineChainFrom(*call_ii);
-
+ directCall->setBCOffset(call->getBCOffset());
directCallBlock->appendInst(directCall);
//
@@ -277,6 +270,7 @@
Type* type = ldVTable->asTypeInst()->getTypeInfo();
Opnd* vtable2 = _opndManager.createSsaTmpOpnd(vtable->getType());
Inst* ldVTable2 = _instFactory.makeTauLdIntfcVTableAddr(vtable2, slot, type);
+ ldVTable2->setBCOffset(ldVTable->getBCOffset());
ldSlot2->setSrc(0, vtable2);
ldVTable2->insertBefore(ldSlot2);
}
@@ -412,12 +406,9 @@
if (Log::isLogEnabled(LogStream::DBG)) {
mp->dumpValues(Log::out());
}
- MethodDesc* rootMethodDesc = regionIRM.getCompilationInterface().getMethodToCompile();
// Get bytecode offset of the call
- void* bc2HIRMapHandler = getContainerHandler(bcOffset2HIRHandlerName, rootMethodDesc);
- uint32 callInstId = call->getId();
- uint16 bcOffset = getBCMappingEntry(bc2HIRMapHandler, callInstId);
+ uint16 bcOffset = call->getBCOffset();
assert(bcOffset != 0);
assert(bcOffset != ILLEGAL_BC_MAPPING_VALUE);
Log::out() << "Call instruction bcOffset = " << (int32)bcOffset << std::endl;
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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp Fri Jul 13 07:19:35 2007
@@ -82,6 +82,8 @@
}
ea.doAnalysis();
+
+ irm.getFlowGraph().purgeUnreachableNodes(); //needed to get valid log after this pass
} // run(IRManager& irm)
@@ -111,15 +113,6 @@
assert(translatorAction);
init();
-
- if (compInterface.isBCMapInfoRequired()) {
- isBCmapRequired = true;
- MethodDesc* meth = compInterface.getMethodToCompile();
- bc2HIRMapHandler = getContainerHandler(bcOffset2HIRHandlerName, meth);
- } else {
- isBCmapRequired = false;
- bc2HIRMapHandler = NULL;
- }
}
EscAnalyzer::EscAnalyzer(EscAnalyzer* parent, IRManager& irm)
@@ -4526,19 +4519,9 @@
st_inst = *it3;
removeInst(st_inst);
removeInst(inst=st_inst->getSrc(1)->getInst());
- if (isBCmapRequired) {
- remBCMap(st_inst);
- remBCMap(inst);
- }
removeInst(inst=inst->getSrc(0)->getInst());
- if (isBCmapRequired) {
- remBCMap(inst);
- }
if (inst->getOpcode() == Op_LdArrayBaseAddr) {
removeInst(inst->getSrc(0)->getInst());
- if (isBCmapRequired) {
- remBCMap(inst->getSrc(0)->getInst());
- }
}
}
}
@@ -4557,9 +4540,6 @@
FlowGraph::print(os_sc,no_node);
os_sc << "++++ old newobj: after end" << std::endl;
}
- if (isBCmapRequired) {
- remBCMap(onode->nInst);
- }
}
}
} // doLOScalarReplacement(ObjIds* loids)
@@ -4763,21 +4743,14 @@
TypeManager& _typeManager = irManager.getTypeManager();
Inst* nobj_inst = nonode->nInst; // optimized newobj inst for ldvar opnd
Inst* lobj_inst = NULL; // load opnd inst for ldvar opnd
- Edge* excedge = NULL;
VarOpnd* ob_var_opnd = _opndManager.createVarOpnd(nobj_inst->getDst()->getType(), false);
SsaTmpOpnd* ob_init_opnd = _opndManager.createSsaTmpOpnd(ob_var_opnd->getType());
uint32 ob_id = onode->opndId;
- Node* ob_exc_tnode = NULL;
Insts::iterator itvc;
ScObjFlds::iterator ito;
Node* node_no = nobj_inst->getNode();
ScObjFld* sco = NULL;
- if (nobj_inst->getOperation().canThrow()==true) {
- excedge = (Edge*)nobj_inst->getNode()->getExceptionEdge();
- assert(excedge != NULL);
- ob_exc_tnode = excedge->getTargetNode();
- }
if (lobj_opt) {
lobj_inst = lonode->nInst;
}
@@ -4865,7 +4838,7 @@
scalarizeOFldUsage(sco);
}
}
- restoreEOCreation(vc_insts, scObjFlds, ob_var_opnd, ob_exc_tnode, ob_id);
+ restoreEOCreation(vc_insts, scObjFlds, ob_var_opnd, ob_id);
if (_scinfo) {
os_sc << "++++ old newobj: before" << std::endl;
FlowGraph::print(os_sc,node_no);
@@ -4884,9 +4857,6 @@
if (methodEndInsts->size()!=0)
fixMethodEndInsts(ob_id);
removeInst(nobj_inst);
- if (isBCmapRequired) {
- remBCMap(nobj_inst);
- }
if (_scinfo) {
os_sc << "++++ old newobj: after" << std::endl;
FlowGraph::print(os_sc,node_no);
@@ -5052,18 +5022,9 @@
}
st_ld_var_inst->insertAfter(st_ld_inst);
removeInst(st_ld_inst);
- if (isBCmapRequired) {
- setNewBCMap(st_ld_var_inst,st_ld_inst);
- }
removeInst(inst_ad);
- if (isBCmapRequired) {
- remBCMap(inst_ad);
- }
if (inst_ad->getOpcode()==Op_AddScaledIndex) {
removeInst(inst_ad->getSrc(0)->getInst());
- if (isBCmapRequired) {
- remBCMap(inst_ad->getSrc(0)->getInst());
- }
}
if (_scinfo) {
os_sc << "++++ scalarizeOFldUsage: after" << std::endl;
@@ -5702,8 +5663,7 @@
void
-EscAnalyzer::restoreEOCreation(Insts* vc_insts, ScObjFlds* scObjFlds, VarOpnd* ob_var_opnd,
- Node* tnode, uint32 oid) {
+EscAnalyzer::restoreEOCreation(Insts* vc_insts, ScObjFlds* scObjFlds, VarOpnd* ob_var_opnd, uint32 oid) {
Insts::iterator itvc;
InstFactory& _instFactory = irManager.getInstFactory();
ControlFlowGraph& fg = irManager.getFlowGraph();
@@ -5735,6 +5695,8 @@
}
node_before=vc->getNode();
+ Node* dispatchNode = node_before->getExceptionEdgeTarget(); //now object allocation inst will be connected to this dispatch
+ assert(dispatchNode);
node_obj1 = NULL;
node_after1 = NULL;
node_var1 = NULL;
@@ -5748,7 +5710,6 @@
Inst* ldobj=_instFactory.makeLdVar(ob_opnd,ob_var_opnd);
ldobj->insertBefore(vc);
// reset call inst parameters
- Inst* old_newobj = vc->getSrc(i)->getInst();
for (uint32 i1=0; i1<nsrc; i1++) {
if (vc->getSrc(i1)->getId()==oid) {
vc->setSrc(i1,ob_opnd );
@@ -5806,9 +5767,7 @@
SsaTmpOpnd* nob_opnd = _opndManager.createSsaTmpOpnd(ob_var_opnd->getType());
Inst* newobj=_instFactory.makeNewObj(nob_opnd,ob_var_opnd->getType());
newobj->insertBefore(ldobj);
- if (isBCmapRequired) {
- setNewBCMap(newobj,old_newobj);
- }
+ newobj->setBCOffset(0);
// storing created newobj result in object var opnd
Inst* stvobj=_instFactory.makeStVar(ob_var_opnd,nob_opnd);
stvobj->insertBefore(ldobj);
@@ -5823,7 +5782,7 @@
// node with newobj instruction after opt
node_obj=fg.splitNodeAtInstruction(branch_inst,splitAfter,false,_instFactory.makeLabel());
fg.addEdge(node_before, node_var);
- // created oject field initialization
+ // created object field initialization
ScObjFld* sco = NULL;
if (scObjFlds->size() > 0) {
Opnd* tau_op = _opndManager.createSsaTmpOpnd(_typeManager.getTauType());
@@ -5912,11 +5871,10 @@
fg.addEdge(node_after1,node_after);
}
}
- if (tnode!=NULL) {
- node_obj1=fg.splitNodeAtInstruction(newobj,splitAfter,false,
- _instFactory.makeLabel());
- fg.addEdge(node_obj,tnode);
- }
+
+ node_obj1=fg.splitNodeAtInstruction(newobj,splitAfter,false, _instFactory.makeLabel());
+ fg.addEdge(node_obj,dispatchNode);
+
if (_scinfo) {
os_sc << "++++ objectCreate: after" << std::endl;
FlowGraph::print(os_sc,node_before);
@@ -6330,43 +6288,6 @@
}
}
} // checkToScalarizeFinalFiels(CnGNode* onode, ScObjFlds* scObjFlds)
-
-
-/**
- * Sets bcmap offset in bc2HIRMapHandler.
- * @param new_i - instruction to set offset
- * @param old_i - offset of old_i instruction is set to new_i instruction
- */
-void
-EscAnalyzer::setNewBCMap(Inst* new_i, Inst* old_i) {
- if (isBCmapRequired) {
- uint16 bcOffset = ILLEGAL_BC_MAPPING_VALUE;
- uint32 instID = old_i->getId();
- bcOffset = getBCMappingEntry(bc2HIRMapHandler, instID);
- if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) {
- setBCMappingEntry(bc2HIRMapHandler, new_i->getId(), bcOffset);
- }
- }
-} // setNewBCMap(Inst* new_i, Inst* old_i)
-
-
-/**
- * Removes bcmap offset in bc2HIRMapHandler.
- * @param inst - instruction to remove offset
- */
-void
-EscAnalyzer::remBCMap(Inst* inst) {
- if (isBCmapRequired) {
- uint16 bcOffset = ILLEGAL_BC_MAPPING_VALUE;
- uint32 instID = inst->getId();
- bcOffset = getBCMappingEntry(bc2HIRMapHandler, instID);
- if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) {
- setBCMappingEntry(bc2HIRMapHandler, instID, ILLEGAL_BC_MAPPING_VALUE);
- }
- }
-} // remBCMap(Inst* inst)
-
-
} //namespace Jitrino
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.h?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.h Fri Jul 13 07:19:35 2007
@@ -929,11 +929,9 @@
* @param vc_insts - list of call instructions optimized object is escaped to,
* @param objs - list of optimized object fields,
* @param ob_var_opnd - varOpnd replacing optimized object,
- * @param tnode - target CFG node for newobj instruction exception edge,
* @param oid - escaped optimized object Id.
*/
- void restoreEOCreation(Insts* vc_insts, ScObjFlds* objs, VarOpnd* ob_var_opnd,
- Node* tnode, uint32 oid);
+ void restoreEOCreation(Insts* vc_insts, ScObjFlds* objs, VarOpnd* ob_var_opnd, uint32 oid);
/**
* Removes specified instruction from ControlFlowGraph.
@@ -1005,26 +1003,6 @@
* @param scObjFlds - list to collect onode operand field usage.
*/
void checkToScalarizeFinalFiels(CnGNode* onode, ScObjFlds* scObjFlds);
-
-
-// BCMap support
- // Byte code map info
- bool isBCmapRequired;
- void* bc2HIRMapHandler;
-/**
- * Sets bcmap offset in bc2HIRMapHandler.
- * @param new_i - instruction to set offset,
- * @param old_i - offset of old_i instruction is set to new_i instruction.
- */
- void setNewBCMap(Inst* new_i, Inst* old_i);
-
-/**
- * Removes bcmap offset in bc2HIRMapHandler.
- * @param inst - instruction to remove offset.
- */
- void remBCMap(Inst* inst);
-
-
};
} //namespace Jitrino
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp Fri Jul 13 07:19:35 2007
@@ -394,6 +394,7 @@
instFactory->makeLdConst(allocationHandleOpnd, allocationHandle)->insertBefore(inst);
Opnd* args[2] = {objSizeOpnd, allocationHandleOpnd};
MethodCallInst* call = instFactory->makeDirectCall(callResOpnd, tauSafeOpnd, tauSafeOpnd, 2, args, method)->asMethodCallInst();
+ call->setBCOffset(inst->getBCOffset());
call->insertBefore(inst);
inst->unlink();
@@ -452,6 +453,7 @@
Opnd* args[3] = {numElements, elemSizeOpnd, allocationHandleOpnd};
Opnd* callResOpnd = opndManager->createSsaTmpOpnd(typeManager->getUnmanagedPtrType(typeManager->getInt8Type()));
MethodCallInst* call = instFactory->makeDirectCall(callResOpnd, tauSafeOpnd, tauSafeOpnd, 3, args, method)->asMethodCallInst();
+ call->setBCOffset(inst->getBCOffset());
call->insertBefore(inst);
inst->unlink();
assert(call == call->getNode()->getLastInst());
@@ -483,6 +485,7 @@
instFactory->makeTauSafe(tauSafeOpnd)->insertBefore(inst);
Opnd* args[1] = {objOpnd};
MethodCallInst* call = instFactory->makeDirectCall(opndManager->getNullOpnd(), tauSafeOpnd, tauSafeOpnd, 1, args, method)->asMethodCallInst();
+ call->setBCOffset(inst->getBCOffset());
call->insertBefore(inst);
inst->unlink();
@@ -517,6 +520,7 @@
instFactory->makeTauSafe(tauSafeOpnd)->insertBefore(inst);
Opnd* args[1] = {objOpnd};
MethodCallInst* call = instFactory->makeDirectCall(opndManager->getNullOpnd(), tauSafeOpnd, tauSafeOpnd, 1, args, method)->asMethodCallInst();
+ call->setBCOffset(inst->getBCOffset());
call->insertBefore(inst);
inst->unlink();
@@ -543,6 +547,7 @@
instFactory->makeTauSafe(tauSafeOpnd)->insertBefore(inst);
Opnd* args[3] = {objBaseOpnd, ptrOpnd, srcOpnd};
MethodCallInst* call = instFactory->makeDirectCall(opndManager->getNullOpnd(), tauSafeOpnd, tauSafeOpnd, 3, args, method)->asMethodCallInst();
+ call->setBCOffset(inst->getBCOffset());
call->insertBefore(inst);
inst->unlink();
@@ -591,6 +596,7 @@
instFactory->makeTauSafe(tauSafeOpnd)->insertBefore(inst);
Opnd* args[2] = {baseOpnd, typeOpnd};
MethodCallInst* call = instFactory->makeDirectCall(resOpnd, tauSafeOpnd, tauSafeOpnd, 2, args, method)->asMethodCallInst();
+ call->setBCOffset(inst->getBCOffset());
call->insertBefore(inst);
inst->unlink();
@@ -649,6 +655,7 @@
Opnd* args[6] = {objOpnd, typeOpnd, isArrayOpnd, isInterfaceOpnd, isFinalOpnd, fastCheckDepthOpnd};
MethodCallInst* call = instFactory->makeDirectCall(opndManager->getNullOpnd(), tauSafeOpnd, tauSafeOpnd, 6, args, method)->asMethodCallInst();
+ call->setBCOffset(inst->getBCOffset());
call->insertBefore(inst);
@@ -709,6 +716,7 @@
Opnd* args[6] = {objOpnd, typeOpnd, isArrayOpnd, isInterfaceOpnd, isFinalOpnd, fastCheckDepthOpnd};
MethodCallInst* call = instFactory->makeDirectCall(inst->getDst(), tauSafeOpnd, tauSafeOpnd, 6, args, method)->asMethodCallInst();
+ call->setBCOffset(inst->getBCOffset());
call->insertBefore(inst);
inst->unlink();
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp Fri Jul 13 07:19:35 2007
@@ -79,15 +79,6 @@
translatorAction(NULL)
{
- if (irm.getCompilationInterface().isBCMapInfoRequired()) {
- isBCmapRequired = true;
- MethodDesc* meth = irm.getCompilationInterface().getMethodToCompile();
- bc2HIRMapHandler = getContainerHandler(bcOffset2HIRHandlerName, meth);
- } else {
- isBCmapRequired = false;
- bc2HIRMapHandler = NULL;
- }
-
const char* translatorName = argSource->getStringArg("translatorActionName", "translator");
translatorAction = (TranslatorAction*)PMF::getAction(argSource->getPipeline(), translatorName);
assert(translatorAction);
@@ -503,21 +494,40 @@
Opnd *obj = callInst->getSrc(2); // this parameter for DirectCall
if (obj && !obj->isNull()) obj = 0;
}
- Inst* entryMarker =
- obj ? _instFactory.makeMethodMarker(MethodMarkerInst::Entry,
- &methodDesc, obj)
- : _instFactory.makeMethodMarker(MethodMarkerInst::Entry, &methodDesc);
- Inst* exitMarker =
- obj ? _instFactory.makeMethodMarker(MethodMarkerInst::Exit,
- &methodDesc, obj)
- : _instFactory.makeMethodMarker(MethodMarkerInst::Exit,
- &methodDesc);
- Node* entry = inlinedFlowGraph.getEntryNode();
- entry->prependInst(entryMarker);
- Node* retNode = inlinedFlowGraph.getReturnNode();
- if(retNode != NULL)
- retNode->appendInst(exitMarker);
+
+ //set up inlinee border markers
+ {
+ Node* entry = inlinedFlowGraph.getEntryNode();
+ //replace MethodEntryInst with simple label -> MethodMarkerInsts will be used to mark inlinee borders
+ entry->getFirstInst()->unlink();
+ entry->prependInst(_instFactory.makeLabel());
+
+ uint16 bcOffset = inlineNode->getCallInst()->getBCOffset();
+ assert(bcOffset!=ILLEGAL_BC_MAPPING_VALUE);
+ Inst* entryMarker = obj ? _instFactory.makeMethodMarker(MethodMarkerInst::Entry, &methodDesc, obj)
+ : _instFactory.makeMethodMarker(MethodMarkerInst::Entry, &methodDesc);
+ entryMarker->setBCOffset(bcOffset);
+ entry->prependInst(entryMarker);
+
+ Node* retNode = inlinedFlowGraph.getReturnNode();
+ if (retNode) {
+ Inst* exitMarker = obj ? _instFactory.makeMethodMarker(MethodMarkerInst::Exit, &methodDesc, obj)
+ : _instFactory.makeMethodMarker(MethodMarkerInst::Exit, &methodDesc);
+ exitMarker->setBCOffset(entryMarker->getBCOffset());
+ retNode->appendInst(exitMarker);
+ }
+
+ Node* unwindNode = inlinedFlowGraph.getUnwindNode();
+ if (unwindNode) {
+ Inst* exitMarker = obj ? _instFactory.makeMethodMarker(MethodMarkerInst::Exit, &methodDesc, obj)
+ : _instFactory.makeMethodMarker(MethodMarkerInst::Exit, &methodDesc);
+ exitMarker->setBCOffset(entryMarker->getBCOffset());
+ unwindNode->appendInst(exitMarker);
+ }
+ }
+
+
// Fuse callsite arguments with incoming parameters
uint32 numArgs = callInst->getNumSrcOperands() - 2; // omit taus
Opnd *tauNullChecked = callInst->getSrc(0);
@@ -532,6 +542,8 @@
tauNullCheckInst->setDefArgModifier(NonNullThisArg);
}
+ Node* entry = inlinedFlowGraph.getEntryNode();
+ Node* retNode = inlinedFlowGraph.getReturnNode();
Inst* first = (Inst*)entry->getFirstInst();
Inst* inst;
Opnd* thisPtr = 0;
@@ -658,17 +670,22 @@
if(methodDesc.isSynchronized() && inlinedIRM.getFlowGraph().getUnwindNode()) {
// Add monitor exit to unwind.
Node* unwind = inlinedFlowGraph.getUnwindNode();
+ uint16 monExitBCMap = 0; //this monexit is not present in bytecode. Need some artificial but valid value.
// Test if an exception exit exists
if(unwind->getInDegree() > 0) {
Node* dispatch = inlinedFlowGraph.createDispatchNode(_instFactory.makeLabel());
// Insert catch all
Opnd* ex = _opndManager.createSsaTmpOpnd(_typeManager.getSystemObjectType());
- Node* handler = inlinedFlowGraph.createBlockNode(inlinedIRM.getInstFactory().makeCatchLabel(0, ex->getType()));
+ Inst* catchInst = inlinedIRM.getInstFactory().makeCatchLabel(0, ex->getType());
+ catchInst->setBCOffset(0);
+ Node* handler = inlinedFlowGraph.createBlockNode(catchInst);
handler->appendInst(_instFactory.makeCatch(ex));
if(methodDesc.isStatic()) {
// Release class monitor
- handler->appendInst(_instFactory.makeTypeMonitorExit(methodDesc.getParentType()));
+ Inst* monExit = _instFactory.makeTypeMonitorExit(methodDesc.getParentType());
+ monExit->setBCOffset(monExitBCMap);
+ handler->appendInst(monExit);
} else {
// Release object monitor
assert(callInst->getNumSrcOperands() > 2);
@@ -699,9 +716,9 @@
Opnd *lockAddr = lastInst->getSrc(1);
Opnd *enterDst = lastInst->getSrc(2);
- handler->appendInst(_instFactory.makeOptimisticBalancedMonitorExit(srcObj,
- lockAddr,
- enterDst));
+ Inst* monExit = _instFactory.makeOptimisticBalancedMonitorExit(srcObj,lockAddr,enterDst);
+ monExit->setBCOffset(monExitBCMap);
+ handler->appendInst(monExit);
done = true;
break;
}
@@ -724,14 +741,18 @@
} else {
Opnd* tauSafe = _opndManager.createSsaTmpOpnd(_typeManager.getTauType());
handler->appendInst(_instFactory.makeTauSafe(tauSafe)); // monenter success guarantees non-null
- handler->appendInst(_instFactory.makeTauMonitorExit(obj, tauSafe));
+ Inst* monExit = _instFactory.makeTauMonitorExit(obj, tauSafe);
+ monExit->setBCOffset(monExitBCMap);
+ handler->appendInst(monExit);
}
}
}
// Insert rethrow
Node* rethrow = inlinedFlowGraph.createBlockNode(_instFactory.makeLabel());
- rethrow->appendInst(_instFactory.makeThrow(Throw_NoModifier, ex));
+ Inst* rethrowInst = _instFactory.makeThrow(Throw_NoModifier, ex);
+ rethrowInst->setBCOffset(monExitBCMap);
+ rethrow->appendInst(rethrowInst);
// Redirect exception exits to monitor_exit
while (!unwind->getInEdges().empty()) {
@@ -752,15 +773,20 @@
methodDesc.getParentType()->needsInitialization()) {
// initialize type for static methods
Inst* initType = _instFactory.makeInitType(methodDesc.getParentType());
- entry->prependInst(initType);
+ initType->setBCOffset(callInst->getBCOffset());
+ entry->prependInst(initType); //inittype is placed before methodEntryMarker -> it's a part of caller method in stacktrace
inlinedFlowGraph.splitNodeAtInstruction(initType, true, false, _instFactory.makeLabel());
- Node* unwind = inlinedFlowGraph.getUnwindNode();
- if (unwind == NULL) {
- unwind = inlinedFlowGraph.createDispatchNode(_instFactory.makeLabel());
- inlinedFlowGraph.setUnwindNode(unwind);
- inlinedFlowGraph.addEdge(unwind, inlinedFlowGraph.getExitNode());
+ //here we need to create new unwind node, because old one contains method-exit-marker instruction.
+ //Init-type is a part of caller method -> it must be out of the range of method marker insts.
+ Node* oldUnwind = inlinedFlowGraph.getUnwindNode();
+ Node* newUnwind = inlinedFlowGraph.createDispatchNode(_instFactory.makeLabel());
+ inlinedFlowGraph.addEdge(entry, newUnwind);
+ inlinedFlowGraph.addEdge(newUnwind, inlinedFlowGraph.getExitNode());
+ inlinedFlowGraph.setUnwindNode(newUnwind);
+ if (oldUnwind!=NULL) {
+ assert(oldUnwind->getOutDegree() == 1);
+ inlinedFlowGraph.replaceEdgeTarget(oldUnwind->getExceptionEdge(), newUnwind, true);
}
- inlinedFlowGraph.addEdge(entry, unwind);
}
}
@@ -815,57 +841,6 @@
<< inlinedIRM.getParent()->getMethodDesc().getName()
<< ::std::endl;
- //
- // update inlining-related information in all 'call' instructions of the inlined method
- //
-
- const Nodes& nodes = inlinedFlowGraph.getNodes();
- Nodes::const_iterator niter;
- uint16 count = 0;
-
- assert(callInst->isMethodCall());
- InlineInfo& call_ii = *callInst->asMethodCallInst()->getInlineInfoPtr();
-
- call_ii.printLevels(Log::out());
- Log::out() << ::std::endl;
-
- for(niter = nodes.begin(); niter != nodes.end(); ++niter) {
- Node* node = *niter;
-
- Inst* first = (Inst*)node->getFirstInst();
- Inst* i;
- for(i=first->getNextInst(); i != NULL; i=i->getNextInst()) {
- InlineInfo *ii = i->getCallInstInlineInfoPtr();
- // ii should be non-null for each call instruction
- if ( ii ) {
- //
- // InlineInfo order is parent-first
- // (ii might be non-empty when translation-level inlining is on)
- //
- uint16 bcOff = ILLEGAL_BC_MAPPING_VALUE;
-
- if (isBCmapRequired) {
- uint32 callIinstID = callInst->getId();
- uint32 iinstID = i->getId();
- bcOff = getBCMappingEntry(bc2HIRMapHandler, iinstID);
- if (iinstID != callIinstID) {
- uint16 inlinedBcOff = ILLEGAL_BC_MAPPING_VALUE;
- inlinedBcOff = getBCMappingEntry(bc2HIRMapHandler, callIinstID);
- setBCMappingEntry(bc2HIRMapHandler, iinstID, inlinedBcOff);
- }
- }
-
- ii->prependLevel(&methodDesc, bcOff);
- // appropriate byte code offset instead of 0 should be propogated here
- // to enable correct inline info
- ii->prependInlineChain(call_ii);
- // ii->inlineChain remains at the end
-
- Log::out() << " call No." << count++ << " ";
- ii->printLevels(Log::out());
- }
- }
- }
//
// Splice the inlined region into the top-level flowgraph
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/irmanager.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/irmanager.h?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/irmanager.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/irmanager.h Fri Jul 13 07:19:35 2007
@@ -30,7 +30,6 @@
#include "Opnd.h"
#include "Inst.h"
#include "VMInterface.h"
-#include "CGSupport.h"
#include "JITInstanceContext.h"
#include "ControlFlowGraph.h"
#include "optimizer.h"
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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.cpp Fri Jul 13 07:19:35 2007
@@ -47,14 +47,6 @@
leMemManager("LazyExceptionOpt::doLazyExceptionOpt"),
compInterface(ir_manager.getCompilationInterface())
{
- if (compInterface.isBCMapInfoRequired()) {
- isBCmapRequired = true;
- MethodDesc* meth = compInterface.getMethodToCompile();
- bc2HIRMapHandler = getContainerHandler(bcOffset2HIRHandlerName, meth);
- } else {
- isBCmapRequired = false;
- bc2HIRMapHandler = NULL;
- }
}
/**
@@ -484,9 +476,8 @@
continue;
}
iinst = (*it)->initInst->asMethodCallInst();
- // inline info from constructor should be propogated to lazy
+ // inline info from constructor should be propagated to lazy
// exception if any
- InlineInfo* constrInlineInfo = iinst->getInlineInfoPtr();
#ifdef _DEBUG
if (Log::isEnabled()) {
Log::out() << " to remove ";
@@ -521,8 +512,7 @@
tinst = *it1;
assert(tinst != NULL);
tlinst=irManager.getInstFactory().makeVMHelperCall(
- OpndManager::getNullOpnd(), CompilationInterface::Helper_Throw_Lazy, opcount,
- opnds, constrInlineInfo);
+ OpndManager::getNullOpnd(), CompilationInterface::Helper_Throw_Lazy, opcount, opnds);
#ifdef _DEBUG
if (Log::isEnabled()) {
Log::out() << " 2nd ";
@@ -539,15 +529,9 @@
tlinst->insertBefore(tinst);
tinst->unlink();
- if (isBCmapRequired) {
- uint16 bcOffset = ILLEGAL_BC_MAPPING_VALUE;
- uint32 instID = iinst->getId();
- bcOffset = getBCMappingEntry(bc2HIRMapHandler, instID);
- if (bcOffset != ILLEGAL_BC_MAPPING_VALUE) {
- setBCMappingEntry(bc2HIRMapHandler, mptinst->getId(), bcOffset);
- setBCMappingEntry(bc2HIRMapHandler, tlinst->getId(), bcOffset);
- }
- }
+ uint16 bcOffset = iinst->getBCOffset();
+ mptinst->setBCOffset(bcOffset);
+ tlinst->setBCOffset(bcOffset);
}
}
}
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.h?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/lazyexceptionopt.h Fri Jul 13 07:19:35 2007
@@ -174,9 +174,6 @@
/// List of throwable objects that may be optimized.
OptCandidates* optCandidates;
static int level;
- // Byte code map info
- bool isBCmapRequired;
- void* bc2HIRMapHandler;
};
} // namespace Jitrino
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/optimizer.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/optimizer.cpp?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/optimizer.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/optimizer.cpp Fri Jul 13 07:19:35 2007
@@ -82,15 +82,6 @@
OptimizerFlags& flags = myAction->optimizerFlags;
IRManager* irm = new (mm) IRManager(mm, *cc->getVMCompilationInterface(), flags);
cc->setHIRManager(irm);
-
- MethodDesc* methDesc = cc->getVMCompilationInterface()->getMethodToCompile();
-
- // add bc <-> HIR code map handler
- if (cc->getVMCompilationInterface()->isBCMapInfoRequired()) {
- StlVector<uint16> *bc2HIRMap = new(mm) StlVector<uint16>(mm, methDesc->getByteCodeSize()
- * (ESTIMATED_HIR_SIZE_PER_BYTECODE) + 5, ILLEGAL_BC_MAPPING_VALUE);
- addContainerHandler(bc2HIRMap, bcOffset2HIRHandlerName, methDesc);
- }
}
};
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=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.cpp Fri Jul 13 07:19:35 2007
@@ -3609,8 +3609,7 @@
Opnd* tauNullCheckedFirstArg,
Opnd* tauTypesChecked,
uint32 numArgs,
- Opnd* args[],
- InlineInfoBuilder* inlineBuilder)
+ Opnd* args[])
{
//
// change to a direct call if the type of the this pointer is exactly known
@@ -3626,7 +3625,7 @@
}
return genDirectCall(methodDesc, returnType,
tauNullCheckedFirstArg, tauTypesChecked,
- numArgs, args, inlineBuilder)->getDst();
+ numArgs, args)->getDst();
}
return NULL;
}
@@ -3636,12 +3635,11 @@
Opnd* tauNullCheckedFirstArg,
Opnd* tauTypesChecked,
uint32 numArgs,
- Opnd** args,
- InlineInfoBuilder* inlineBuilder)
+ Opnd** args)
{
return simplifyIndirectMemoryCallInst(funPtr, returnType,
tauNullCheckedFirstArg, tauTypesChecked,
- numArgs, args, inlineBuilder);
+ numArgs, args);
}
Inst*
@@ -3650,8 +3648,7 @@
Opnd* tauNullCheckedFirstArg,
Opnd* tauTypesChecked,
uint32 numArgs,
- Opnd** args,
- InlineInfoBuilder* inlineBuilder)
+ Opnd** args)
{
// if funptr is a load of a fun slot that does not go through a vtable, then
// simplify this to a direct call if direct calls are enabled
@@ -3662,7 +3659,7 @@
if (ldFunInst->getOpcode() == Op_LdFunAddrSlot) {
return genDirectCall(ldFunInst->getMethodDesc(), returnType,
tauNullCheckedFirstArg, tauTypesChecked,
- numArgs, args, inlineBuilder);
+ numArgs, args);
}
return NULL;
}
@@ -3783,11 +3780,8 @@
tauNullCheckedFirstArg,
tauTypesChecked,
numArgs-2, // skip taus
- args+2,
- NULL); // not creating InlineInfo with InlineInfoBuilder
+ args+2);
if (newInst != NULL) {
- assert(inst->getCallInstInlineInfoPtr() && inst->getCallInstInlineInfoPtr());
- newInst->getCallInstInlineInfoPtr()->getInlineChainFrom(*inst->getCallInstInlineInfoPtr());
return newInst;
}
return inst;
@@ -3807,11 +3801,8 @@
tauNullCheckedFirstArg,
tauTypesChecked,
numArgs-2,
- args+2,
- NULL); // not creating InlineInfo with InlineInfoBuilder
+ args+2);
if (newInst != NULL) {
- assert(inst->getCallInstInlineInfoPtr() && inst->getCallInstInlineInfoPtr());
- newInst->getCallInstInlineInfoPtr()->getInlineChainFrom(*inst->getCallInstInlineInfoPtr());
return newInst;
}
return inst;
@@ -3972,6 +3963,7 @@
void
SimplifierWithInstFactory::insertInst(Inst* inst) {
inst->insertBefore(nextInst);
+ inst->setBCOffset(nextInst->getBCOffset());
}
void
@@ -4202,8 +4194,7 @@
Opnd* tauNullCheckedFirstArg,
Opnd* tauTypesChecked,
uint32 numArgs,
- Opnd* args[],
- InlineInfoBuilder* inlineBuilder)
+ Opnd* args[])
{
Opnd* dst;
if (returnType->tag == Type::Void) {
@@ -4215,11 +4206,6 @@
tauNullCheckedFirstArg, tauTypesChecked,
numArgs, args,
methodDesc);
- if ( inlineBuilder ) {
- uint32 callOffset = ILLEGAL_BC_MAPPING_VALUE;
- inlineBuilder->buildInlineInfoForInst(inst, callOffset, methodDesc);
- }
-
insertInst(inst);
return inst;
}
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.h?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/simplifier.h Fri Jul 13 07:19:35 2007
@@ -90,24 +90,21 @@
Opnd* tauNullCheckedFirstArg,
Opnd* tauTypesChecked,
uint32 numArgs,
- Opnd* args[],
- InlineInfoBuilder* inlineBuilder);
+ Opnd* args[]);
Inst* simplifyIndirectCallInst(Opnd* funPtr,
Type* returnType,
Opnd* tauNullCheckedFirstArg,
Opnd* tauTypesChecked,
uint32 numArgs,
- Opnd** args,
- InlineInfoBuilder* inlineBuilder);
+ Opnd** args);
Inst* simplifyIndirectMemoryCallInst(Opnd* funPtr,
Type* returnType,
Opnd* tauNullCheckedFirstArg,
Opnd* tauTypesChecked,
uint32 numArgs,
- Opnd** args,
- InlineInfoBuilder* inlineBuilder);
+ Opnd** args);
// loads
Opnd* simplifyLdRef(Modifier mod, Type *dstType,
uint32 token,
@@ -233,8 +230,7 @@
Opnd* tauNullCheckedFirstArg,
Opnd* tauTypesChecked,
uint32 numArgs,
- Opnd* args[],
- InlineInfoBuilder* inlineBuilder) = 0;
+ Opnd* args[]) = 0;
// load, store & move
virtual Inst* genLdConstant(int32 val) = 0;
virtual Inst* genLdConstant(int64 val) = 0;
@@ -1151,8 +1147,7 @@
Opnd* tauNullCheckedFirstArg,
Opnd* typesChecked,
uint32 numArgs,
- Opnd* args[],
- InlineInfoBuilder* inlineBuilder);
+ Opnd* args[]);
virtual Inst* genLdConstant(int32 val);
virtual Inst* genLdConstant(int64 val);
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.cpp?view=diff&rev=556007&r1=556006&r2=556007
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/ControlFlowGraph.cpp Fri Jul 13 07:19:35 2007
@@ -572,7 +572,7 @@
}
}
} else if (node->isDispatchNode()) {
- if (node->getOutDegree() == 1) {
+ if (node->getOutDegree() == 1 && node->isEmpty()) {
Node* succ = node->getOutEdges().front()->getTargetNode();
if (succ->isDispatchNode()) {
// This dispatch has no handlers.
@@ -691,12 +691,8 @@
if (dispatchNode == NULL) {
dispatchNode = getUnwindNode();
}
- if (dispatchNode != NULL) {
- addEdge(inlineUnwindNode, dispatchNode, 1);
- } else {
- setUnwindNode(inlineUnwindNode);
- addEdge(inlineUnwindNode, getExitNode());
- }
+ assert(dispatchNode != NULL);
+ addEdge(inlineUnwindNode, dispatchNode, 1);
}
}