Ignore:
Timestamp:
Oct 22, 2019 11:31:16 AM (7 weeks ago)
Author:
randersson
Message:

#5819 Merged trunk into branch

Location:
branches/dev-5819
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-5819

  • branches/dev-5819/Compiler/ModelicaFlatTree/src/jastadd/ConstantEvaluation/ExternalConstantEvaluation.jrag

    r11541 r13800  
    2626import java.util.TimerTask;
    2727
     28import org.jmodelica.common.evaluation.ExternalFunctionCompiler;
    2829import org.jmodelica.common.evaluation.ExternalFunction;
    2930import org.jmodelica.common.evaluation.ExternalProcessCache;
    3031import org.jmodelica.common.evaluation.ExternalProcessCacheImpl;
    3132import org.jmodelica.common.evaluation.ExternalProcessMultiCache;
     33import org.jmodelica.common.evaluation.FailedExternalFunction;
    3234import org.jmodelica.common.evaluation.ProcessCommunicator;
    3335
     
    4951    class ModelicaCompiler {}
    5052   
    51     ModelicaCompiler   implements ExternalProcessMultiCache.Compiler<ExternalArgument, FExternalStmt>;
     53    ModelicaCompiler   implements ExternalFunctionCompiler<ExternalArgument, FExternalStmt>;
    5254    FExternalStmt      implements ExternalProcessMultiCache.External<ExternalArgument>;
    5355    ExternalArgument   extends    ExternalProcessMultiCache.Variable<CValue,FType>;
     
    8991     * Check if this external function should be cached as a live process.
    9092     */
    91     syn boolean FExternalStmt.shouldCacheProcess() {
    92         return myOptions().getIntegerOption("external_constant_evaluation_max_proc") > 0;
    93     }
     93    syn int FExternalStmt.processLimit() =
     94            myOptions().external_constant_evaluation_max_proc.getValue();
     95   
     96    syn boolean FExternalStmt.dynamicEvaluatorEnabled() =
     97            myOptions().external_constant_evaluation_dynamic.getValue()
     98            && !externalObjectsToSerialize().iterator().hasNext();
    9499   
    95100    /**
     
    169174        ExternalFunctionCache efc = root().getUtilInterface().getExternalFunctionCache();
    170175        if (efc == null) {
    171             return new ExternalProcessCacheImpl<>(root().getUtilInterface().getModelicaCompiler())
    172                 .failedEval(this, "external function cache unavailable", false);
     176            return FailedExternalFunction.<ExternalArgument, CValue, FType, FExternalStmt>failedEval(
     177                    root().getUtilInterface().getModelicaCompiler(),
     178                    this, "external function cache unavailable", false);
    173179        }
    174180        return efc.getExternalProcessCache(getLibTopPackagePath()).getExternalFunction(this);
     
    205211       
    206212        if (error != null) {
    207             throw new ConstantEvaluationException(null, ExternalProcessCacheImpl.failedEvalMsg(getName(), error));
     213            throw new ConstantEvaluationException(null, FailedExternalFunction.failedEvalMsg(getName(), error));
    208214        }
    209215       
     
    330336    }
    331337    public CValue FRealType.deserializeScalar(ProcessCommunicator com) throws IOException {
    332         return new CValueReal(com.deserializeReal());
     338        return CValueReal.valueOf(com.deserializeReal());
    333339    }
    334340    public CValue FIntegerType.deserializeScalar(ProcessCommunicator com) throws IOException {
    335         return new CValueInteger((int) com.deserializeReal());
     341        return CValueInteger.valueOf((int) com.deserializeReal());
    336342    }
    337343    public CValue FBooleanType.deserializeScalar(ProcessCommunicator com) throws IOException {
    338         return new CValueBoolean(com.deserializeReal() != 0);
     344        return CValueBoolean.valueOf(com.deserializeReal() != 0);
    339345    }
    340346    public CValue FStringType.deserializeScalar(ProcessCommunicator com) throws IOException {
Note: See TracChangeset for help on using the changeset viewer.