Search in sources :

Example 1 with DuplicateKeyException

use of com.jopdesign.wcet.uppaal.model.DuplicateKeyException in project jop by jop-devel.

the class JavaOneProcessPerMethodTranslator method translate.

@Override
protected void translate() {
    systemBuilder.addMethodSynchChannels(methodInfos, this.methodIDs);
    String bbClock = systemBuilder.addProcessClock(0);
    /* For each method, create a process */
    for (MethodInfo mi : this.methodInfos) {
        if (project.getCallGraph().isLeafMethod(mi) && config.collapseLeaves)
            continue;
        int pid = getMethodID(mi);
        TemplateBuilder tBuilder = new TemplateBuilder(config, MiscUtils.qEncode(mi.getFQMethodName()), pid, bbClock);
        recordLoops(mi, tBuilder);
        processes.put(mi, tBuilder);
        translateMethod(tBuilder, tBuilder.getTemplateAutomaton(), pid, mi, new InvokeViaSyncBuilder(this, tBuilder));
        if (mi.equals(root)) {
            tBuilder.getInitial().setCommited();
            tBuilder.addPostEnd();
        } else {
            tBuilder.addSyncLoop();
        }
        try {
            systemBuilder.addTemplate(pid, 0, tBuilder.getFinalTemplate());
        } catch (DuplicateKeyException e) {
            throw new AssertionError("Unexpected exception when adding template: " + e.getMessage());
        }
    }
}
Also used : MethodInfo(com.jopdesign.common.MethodInfo) DuplicateKeyException(com.jopdesign.wcet.uppaal.model.DuplicateKeyException)

Example 2 with DuplicateKeyException

use of com.jopdesign.wcet.uppaal.model.DuplicateKeyException in project jop by jop-devel.

the class JavaOneProcessPerSupergraphTranslator method translate.

@Override
protected void translate() {
    computeCallSiteIDs();
    systemBuilder.addCallStack(root, callSiteIDs.size());
    /* Create one template for root method */
    TemplateBuilder tBuilder = new TemplateBuilder(config, "Process", 0, "t_local");
    tBuilder.addClock("t_local");
    SubAutomaton mRoot = tBuilder.getTemplateAutomaton();
    addMethodAutomaton(root, mRoot);
    recordLoops(tBuilder);
    /* Create start and end nodes for other methods */
    for (int i = 1; i < this.methodInfos.size(); i++) {
        MethodInfo mi = methodInfos.get(i);
        if (project.getCallGraph().isLeafMethod(mi) && config.collapseLeaves)
            continue;
        SubAutomaton mAuto = tBuilder.createSubAutomaton(MiscUtils.qEncode(mi.getFQMethodName()));
        addMethodAutomaton(mi, mAuto);
    }
    int i = 0;
    for (MethodInfo mi : methodInfos) {
        if (project.getCallGraph().isLeafMethod(mi) && config.collapseLeaves)
            continue;
        translateMethod(tBuilder, getMethodAutomaton(mi), i++, mi, new InvokeViaCallStackBuilder(this, tBuilder));
    }
    tBuilder.getInitial().setCommited();
    addProgessMeasure(tBuilder);
    tBuilder.addPostEnd();
    try {
        systemBuilder.addTemplate(0, 0, tBuilder.getFinalTemplate());
    } catch (DuplicateKeyException e) {
        throw new AssertionError("Unexpected exception: " + e);
    }
}
Also used : MethodInfo(com.jopdesign.common.MethodInfo) DuplicateKeyException(com.jopdesign.wcet.uppaal.model.DuplicateKeyException)

Aggregations

MethodInfo (com.jopdesign.common.MethodInfo)2 DuplicateKeyException (com.jopdesign.wcet.uppaal.model.DuplicateKeyException)2