예제 #1
0
bool Jitrino::Init(JIT_Handle jh, const char* name)
{
    //check for duplicate initialization
    JITInstanceContext* jitInstance = getJITInstanceContext(jh);
    if (jitInstance!=NULL) {
        assert(0);
        return false;
    }
    // check if jitName is already in use

    if (jitInstances) {
        for (JITInstances::const_iterator it = jitInstances->begin(), end = jitInstances->end(); it!=end; ++it) {
            JITInstanceContext* jitContext = *it;
            if (jitContext->getJITName() == name) {
                assert(0);
                return false;
            }
        }
    }else {
        global_mm = new MemoryManager("Jitrino::Init.global_mm"); 
#if defined(_IPF_)
        runtimeInterface = new IPF::RuntimeInterface;
        flags.codegen = CG_IPF;
#else
        runtimeInterface = new Ia32::RuntimeInterface;
        flags.codegen = CG_IA32;
#endif
        jitInstances = new (*global_mm) JITInstances(*global_mm);

        flags.time=false;

        recursionKey = Tls::allocKey();
    }

    jitInstance = new (*global_mm) JITInstanceContext(*global_mm, jh, name);
    jitInstances->push_back(jitInstance);

    jitInstance->getPMF().init(jitInstances->size() == 1);

    if (countWriter == 0 && jitInstance->getPMF().getBoolArg(0, "time", false)) {
        countWriter = new CountWriterFile(0);
        XTimer::initialize(true);
    }

    return true;
}
예제 #2
0
void Jitrino::DeInit(JIT_Handle jh)
{
    JITInstanceContext* jitInstance = getJITInstanceContext(jh);
    if (jitInstance==NULL) {
        assert(0);
        return;
    }

    if (countWriter != 0) {
        jitInstance->getPMF().summTimes(summtimes);
    }
        jitInstance->getPMF().deinit();

    killJITInstanceContext(jitInstance);

    if (jitInstances->empty()) {
        if (countWriter != 0)  {
        delete countWriter;
        countWriter = 0;
    }
    }
}
예제 #3
0
void TranslatorAction::init() {
    readFlags();
    MemoryManager& mm = getJITInstanceContext().getGlobalMemoryManager();
    irbAction = (IRBuilderAction*)createAuxAction(mm, IRBUILDER_ACTION_NAME, "irbuilder");
    irbAction->init();
}