ValueAnalysisRefiner(
      final ARGCPA pArgCPA,
      final ValueAnalysisFeasibilityChecker pFeasibilityChecker,
      final StrongestPostOperator<ValueAnalysisState> pStrongestPostOperator,
      final PathExtractor pPathExtractor,
      final GenericPrefixProvider<ValueAnalysisState> pPrefixProvider,
      final Configuration pConfig,
      final LogManager pLogger,
      final ShutdownNotifier pShutdownNotifier,
      final CFA pCfa)
      throws InvalidConfigurationException {

    super(
        pArgCPA,
        pFeasibilityChecker,
        new ValueAnalysisPathInterpolator(
            pFeasibilityChecker,
            pStrongestPostOperator,
            pPrefixProvider,
            pConfig,
            pLogger,
            pShutdownNotifier,
            pCfa),
        ValueAnalysisInterpolantManager.getInstance(),
        pPathExtractor,
        pConfig,
        pLogger);

    pConfig.inject(this, ValueAnalysisRefiner.class);

    checker = pFeasibilityChecker;
    concreteErrorPathAllocator =
        new ValueAnalysisConcreteErrorPathAllocator(pConfig, logger, pCfa.getMachineModel());
    shutdownNotifier = pShutdownNotifier;
  }
 public AutomatonTransferRelation(
     ControlAutomatonCPA pCpa, Configuration config, LogManager pLogger)
     throws InvalidConfigurationException {
   config.inject(this);
   this.cpa = pCpa;
   this.logger = pLogger;
 }
  public static ValueAnalysisRefiner create(final ConfigurableProgramAnalysis pCpa)
      throws InvalidConfigurationException {

    final ARGCPA argCpa = retrieveCPA(pCpa, ARGCPA.class);
    final ValueAnalysisCPA valueAnalysisCpa = retrieveCPA(pCpa, ValueAnalysisCPA.class);

    valueAnalysisCpa.injectRefinablePrecision();

    final LogManager logger = valueAnalysisCpa.getLogger();
    final Configuration config = valueAnalysisCpa.getConfiguration();
    final CFA cfa = valueAnalysisCpa.getCFA();

    final StrongestPostOperator<ValueAnalysisState> strongestPostOp =
        new ValueAnalysisStrongestPostOperator(logger, Configuration.builder().build(), cfa);

    final ValueAnalysisFeasibilityChecker checker =
        new ValueAnalysisFeasibilityChecker(strongestPostOp, logger, cfa, config);

    final GenericPrefixProvider<ValueAnalysisState> prefixProvider =
        new ValueAnalysisPrefixProvider(logger, cfa, config);

    return new ValueAnalysisRefiner(
        argCpa,
        checker,
        strongestPostOp,
        new PathExtractor(logger, config),
        prefixProvider,
        config,
        logger,
        valueAnalysisCpa.getShutdownNotifier(),
        cfa);
  }
 @Before
 public void loadZ3() throws Exception {
   NativeLibraries.loadLibrary("z3j");
   Configuration config = Configuration.defaultConfiguration();
   LogManager logger = TestLogManager.getInstance();
   mgr = Z3FormulaManager.create(logger, config, ShutdownNotifier.create(), null, 42);
   ifmgr = (Z3IntegerFormulaManager) mgr.getIntegerFormulaManager();
 }
 private Configuration getConfigFromFile(Path path)
     throws IOException, InvalidConfigurationException {
   ConfigurationBuilder singleConfigBuilder = Configuration.builder();
   singleConfigBuilder.copyFrom(globalConfig);
   singleConfigBuilder.clearOption("restartAlgorithm.configFiles");
   singleConfigBuilder.loadFromFile(path);
   Configuration singleConfig = singleConfigBuilder.build();
   return singleConfig;
 }
  public CoverageReport(Configuration pConfig, LogManager pLogger)
      throws InvalidConfigurationException {

    pConfig.inject(this);

    this.reportWriters = Lists.newArrayList();
    this.reportWriters.add(new CoverageReportGcov(pConfig, pLogger));
    this.reportWriters.add(new CoverageReportStdoutSummary(pConfig));
  }
  public CoreComponentsFactory(
      Configuration pConfig, LogManager pLogger, ShutdownNotifier pShutdownNotifier)
      throws InvalidConfigurationException {
    config = pConfig;
    logger = pLogger;
    shutdownNotifier = pShutdownNotifier;

    config.inject(this);

    reachedSetFactory = new ReachedSetFactory(config, logger);
    cpaFactory = new CPABuilder(config, logger, shutdownNotifier, reachedSetFactory);
  }
  protected PredicateAbstractionGlobalRefinementStrategy(
      final Configuration config,
      final LogManager pLogger,
      final PredicateAbstractionManager pPredAbsMgr,
      final Solver pSolver)
      throws InvalidConfigurationException {
    super(pSolver);

    config.inject(this, PredicateAbstractionGlobalRefinementStrategy.class);

    logger = pLogger;
    fmgr = pSolver.getFormulaManager();
    bfmgr = fmgr.getBooleanFormulaManager();
    predAbsMgr = pPredAbsMgr;
  }
  public RefinableConstraintsPrecision(final Configuration pConfig)
      throws InvalidConfigurationException {
    pConfig.inject(this);

    switch (precisionType) {
      case CONSTRAINTS:
        delegate = ConstraintBasedConstraintsPrecision.getEmptyPrecision();
        break;
      case LOCATION:
        delegate = LocationBasedConstraintsPrecision.getEmptyPrecision();
        break;
      default:
        throw new AssertionError("Unhandled precision type " + precisionType);
    }
  }
  public CompositeTransferRelation(
      ImmutableList<TransferRelation> transferRelations, Configuration config)
      throws InvalidConfigurationException {
    config.inject(this);
    this.transferRelations = transferRelations;
    size = transferRelations.size();

    // prepare special case handling if both predicates and assumptions are used
    for (int i = 0; i < size; i++) {
      TransferRelation t = transferRelations.get(i);
      if (t instanceof PredicateTransferRelation) {
        predicatesIndex = i;
      }
      if (t instanceof AssumptionStorageTransferRelation) {
        assumptionIndex = i;
      }
    }
  }
  public RestartAlgorithmWithARGReplay(
      Configuration config,
      LogManager pLogger,
      ShutdownNotifier pShutdownNotifier,
      CFA pCfa,
      Specification pSpecification)
      throws InvalidConfigurationException {
    config.inject(this);

    if (configFiles.size() != 2) {
      throw new InvalidConfigurationException(
          "Need at least one configuration for restart algorithm!");
    }

    this.stats = new RestartAlgorithmStatistics(configFiles.size());
    this.logger = pLogger;
    this.shutdownNotifier = pShutdownNotifier;
    this.cfa = pCfa;
    this.globalConfig = config;
    specification = checkNotNull(pSpecification);
  }
 public AssumeEdgesInPathCondition(Configuration config, LogManager logger)
     throws InvalidConfigurationException {
   config.inject(this);
 }
  JavaBDDRegionManager(String bddPackage, Configuration config, LogManager pLogger)
      throws InvalidConfigurationException {
    config.inject(this);
    logger = pLogger;
    if (initTableRatio <= 0 || initTableRatio >= 1) {
      throw new InvalidConfigurationException(
          "Invalid value "
              + initTableRatio
              + " for option bdd.javabdd.initTableRatio, needs to be between 0 and 1.");
    }
    if (initTableSize == 0) {
      // JFactory uses 5 ints of 4 byte sizes for each entry in the BDD table
      double size = Runtime.getRuntime().maxMemory() * initTableRatio / 5 / 4;
      initTableSize = (size > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) size;
      logger.log(Level.CONFIG, "Setting value of bdd.javabdd.initTableSize to", initTableSize);
    }

    if (cacheRatio < 0) {
      throw new InvalidConfigurationException(
          "Invalid value "
              + cacheRatio
              + " for option bdd.javabdd.cacheRatio, cannot be negative.");
    }
    if (cacheSize == 0) {
      cacheSize = (int) (initTableSize * cacheRatio);
    }
    factory = BDDFactory.init(bddPackage.toLowerCase(), initTableSize, cacheSize);

    // register callbacks for logging
    try {
      Method gcCallback =
          JavaBDDRegionManager.class.getDeclaredMethod(
              "gcCallback", Integer.class, BDDFactory.GCStats.class);
      gcCallback.setAccessible(true);
      factory.registerGCCallback(this, gcCallback);

      Method resizeCallback =
          JavaBDDRegionManager.class.getDeclaredMethod(
              "resizeCallback", Integer.class, Integer.class);
      resizeCallback.setAccessible(true);
      factory.registerResizeCallback(this, resizeCallback);

      Method reorderCallback =
          JavaBDDRegionManager.class.getDeclaredMethod(
              "reorderCallback", Integer.class, BDDFactory.ReorderStats.class);
      reorderCallback.setAccessible(true);
      factory.registerReorderCallback(this, reorderCallback);

      // If we do not log, unregister the handlers to avoid the cost of
      // calling them with reflection.
      // Registering and immediately unregistering prevents the library
      // from printing stuff to stdout.
      if (!logger.wouldBeLogged(LOG_LEVEL)) {
        factory.unregisterGCCallback(this, gcCallback);
        factory.unregisterResizeCallback(this, resizeCallback);
        factory.unregisterReorderCallback(this, reorderCallback);
      }

    } catch (NoSuchMethodException e) {
      throw new AssertionError(e);
    }

    factory.setVarNum(varcount);
    factory.setCacheRatio(cacheRatio);

    trueFormula = new JavaBDDRegion(factory.one());
    falseFormula = new JavaBDDRegion(factory.zero());
  }
 public StatisticsCPAStatistics(Configuration config, LogManager logger, StatisticsCPA cpa)
     throws InvalidConfigurationException {
   config.inject(this);
   this.cpa = cpa;
   this.logger = logger;
 }
 public AssignmentsInPathCondition(Configuration config) throws InvalidConfigurationException {
   config.inject(this);
 }