Ejemplo n.º 1
0
void StackInfo::registerInsts(IRManager& irm) 
{
    MethodDesc& md = irm.getMethodDesc();
    if (!md.isStatic()) {
#ifdef _EM64T_
        if ((md.isSynchronized() || md.isParentClassIsLikelyExceptionType())) {
            EntryPointPseudoInst * entryPointInst = irm.getEntryPointInst();
            offsetOfThis = (U_32)entryPointInst->thisOpnd->getMemOpndSubOpnd(MemOpndSubOpndKind_Displacement)->getImmValue();
        } else {
            offsetOfThis = 0;
        }
#else
        EntryPointPseudoInst * entryPointInst = irm.getEntryPointInst();
        offsetOfThis = (U_32)entryPointInst->getOpnd(0)->getMemOpndSubOpnd(MemOpndSubOpndKind_Displacement)->getImmValue();
#endif
    }
    const Nodes& nodes = irm.getFlowGraph()->getNodes();
    for (Nodes::const_iterator it = nodes.begin(), end = nodes.end(); it!=end; ++it) {
        Node* node = *it;
        if (node->isBlockNode()){
            for (Inst * inst=(Inst*)node->getFirstInst(); inst!=NULL; inst=inst->getNextInst()){
                if(inst->getMnemonic() == Mnemonic_CALL) {
                    (*stackDepthInfo)[(POINTER_SIZE_INT)inst->getCodeStartAddr()+inst->getCodeSize()]=
                        StackDepthInfo(((CallInst *)inst)->getCallingConventionClient().getCallingConvention()->getCalleeSavedRegs(OpndKind_GPReg).getMask(), 
                        inst->getStackDepth(),
                        inst->getCodeSize());
                } 
            }
        }
    }
    hashTableSize = (U_32)stackDepthInfo->size();
}
Ejemplo n.º 2
0
void
SSAPass::_run(IRManager& irm) {
    OptPass::computeDominators(irm);
    DominatorTree* dominatorTree = irm.getDominatorTree();
    ControlFlowGraph& flowGraph = irm.getFlowGraph();
   
    DomFrontier frontier(irm.getNestedMemoryManager(),*dominatorTree,&flowGraph);
    SSABuilder ssaBuilder(irm.getOpndManager(),irm.getInstFactory(),frontier,&flowGraph, irm.getOptimizerFlags());
    ssaBuilder.convertSSA(irm.getMethodDesc());
    irm.setInSsa(true);
    irm.setSsaUpdated();
}
Ejemplo n.º 3
0
void TranslatorSession::postTranslatorCleanup() {
    IRManager* irm = getCompilationContext()->getHIRManager();
    ControlFlowGraph& flowGraph = irm->getFlowGraph();
    MethodDesc& methodDesc = irm->getMethodDesc();
    if (Log::isEnabled()) {
        Log::out() << "PRINTING LOG: After Translator" << std::endl;
        FlowGraph::printHIR(Log::out(), flowGraph, methodDesc);
    }
    FlowGraph::doTranslatorCleanupPhase(*irm);
    if (Log::isEnabled()) {
        Log::out() << "PRINTING LOG: After Cleanup" << std::endl;
        FlowGraph::printHIR(Log::out(), flowGraph,  methodDesc);
    }
}
Ejemplo n.º 4
0
// this is the regular routine to be used to generate IR for a method
void TranslatorSession::translate() {
    CompilationContext* cc = getCompilationContext();
    IRManager* irm = cc->getHIRManager();
    assert(irm);
    irm->getTypeManager().setLazyResolutionMode(flags.lazyResolution);
    MethodDesc& methodDesc = irm->getMethodDesc();
    //create IRBuilder
    MemoryManager& mm = cc->getCompilationLevelMemoryManager();
    TranslatorAction* myAction = (TranslatorAction*)getAction();
    IRBuilder* irb = (IRBuilder*)myAction->getIRBuilderAction()->createSession(mm);
    irb->setCompilationContext(cc);
    MemoryManager tmpMM("IRBuilder::tmpMM");
    irb->init(irm, &flags, tmpMM);
    JavaTranslator::translateMethod(*cc->getVMCompilationInterface(), methodDesc, *irb);
}
Ejemplo n.º 5
0
void
PersistentInstructionIdGenerator::runPass(IRManager& irm) {
    MemoryManager mm("PersistentInstructionIdGenerator::runPass");
    
    MethodDesc& methodDesc = irm.getMethodDesc();

    StlVector<Node*> nodes(mm);
    irm.getFlowGraph().getNodesPostOrder(nodes);

    StlVector<Node*>::reverse_iterator i;
    for(i = nodes.rbegin(); i != nodes.rend(); ++i) {
        Node* node = *i;
        Inst* label = (Inst*)node->getFirstInst();
        for(Inst* inst = label->getNextInst(); inst != NULL; inst = inst->getNextInst())
            inst->setPersistentInstructionId(PersistentInstructionId(&methodDesc, inst->getId() - irm.getMinimumInstId()));
    }
}
Ejemplo n.º 6
0
MethodCodeSelector::MethodCodeSelector(
                    ::Jitrino::SessionAction* _sa, 
                    CompilationInterface& compIntfc,
                   MemoryManager&          irMM,
                   MemoryManager&          codeSelectorMM,
                   IRManager&              irM)
: sa(_sa), compilationInterface(compIntfc),
irMemManager(irMM), codeSelectorMemManager(codeSelectorMM),
irManager(irM),
methodDesc(NULL),
edgeProfile(NULL)
{  
    ProfilingInterface* pi = irManager.getProfilingInterface();
    if (pi!=NULL && pi->isProfilingEnabled(ProfileType_Edge, JITProfilingRole_GEN)) {
        edgeProfile = pi->getEdgeMethodProfile(irMM, irM.getMethodDesc(), JITProfilingRole_GEN);
    }

}