Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ce5a4f1
Improve SymbExLogger:
Jun 8, 2022
88c2a54
move smt delta calculation to ProverStdIO for thread safety
Jun 8, 2022
8fab02f
move smt statistics calculations out of ProverStdIO
Jun 29, 2022
10940f0
Merge branch 'upstream-master'
Sep 23, 2022
91372f4
Bump silver submodule to master branch version
Sep 23, 2022
70e0678
Merge branch 'upstream-master'
Sep 23, 2022
952f78b
Merge branch 'upstream-master'
Nov 15, 2022
7876aea
move symbexlogger state into classes, shim the old usage
Nov 17, 2022
0ea06e8
make Verifier own a current MemberSymbExLogger
Nov 17, 2022
bd87c97
Give Verifier the capability to open symbexlogs for members
Nov 17, 2022
35a2ff0
swap out shims
Nov 17, 2022
4aadffe
some bugs:
Nov 17, 2022
aa57446
address comment
Nov 17, 2022
05caac5
make NoopLog do nothing
Nov 17, 2022
19f9a37
also do nothing on whenEnabled for NoopLog
Nov 17, 2022
11037a5
symbexlogs can be closed: they do not accept further records (now unr…
pieter-bos Nov 18, 2022
e73b8ce
close log on timeout
pieter-bos Nov 18, 2022
285baec
SymbExLogger.ofConfig makes the silicon slightly less lazy, so invali…
pieter-bos Nov 18, 2022
d816372
use NoopMemberSymbExLog if there is no log yet (a bug, but better tha…
pieter-bos Nov 18, 2022
f17c120
move config to concrete logger; state is always null, so drop it.
pieter-bos Nov 18, 2022
a1f2b6c
Merge branch 'upstream-master'
pieter-bos Nov 25, 2022
4846a2c
update silver
pieter-bos Nov 25, 2022
505c61b
change by-name trickery to lambdas
Nov 29, 2022
a32cc49
remove debug println
Nov 29, 2022
a2daeed
namespace Member
Nov 29, 2022
c060dc1
clarify val names for Config vs LogConfig
Nov 29, 2022
4b9728e
Revert "change by-name trickery to lambdas"
Nov 29, 2022
6951369
validateFileOpt already checks whether the file exists
pieter-bos Nov 30, 2022
0939b02
log a warning when the symbexlog config cannot be parsed
pieter-bos Nov 30, 2022
2edf5a8
no delta for values not yet encountered
pieter-bos Nov 30, 2022
85bd80d
use the symbExLog of the current verifier
pieter-bos Nov 30, 2022
aab07e5
resolve warnings: clean up imports; mark unused vals as @unused
pieter-bos Nov 30, 2022
754f2ec
Merge branch 'upstream-master'
pieter-bos Nov 30, 2022
59f43e1
missed merge conflict: just use ours
pieter-bos Nov 30, 2022
b333909
adjust documentation
pieter-bos Nov 30, 2022
6dff920
update silver
pieter-bos Nov 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions src/main/scala/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -754,19 +754,15 @@ class Config(args: Seq[String]) extends SilFrontendConfig(args, "Silicon") {
case _ => Right(())
}

validateOpt(ideModeAdvanced, numberOfParallelVerifiers) {
case (Some(false), _) =>
Right(())
case (Some(true), Some(n)) =>
if (n == 1)
Right(())
else
Left( s"Option ${ideModeAdvanced.name} requires setting "
+ s"${numberOfParallelVerifiers.name} to 1")
validateOpt(ideModeAdvanced, parallelizeBranches) {
Comment thread
pieter-bos marked this conversation as resolved.
case (Some(false), _) => Right(())
case (_, Some(false)) => Right(())
case (Some(true), Some(true)) =>
Left(s"Option ${ideModeAdvanced.name} is not supported in combination with ${parallelizeBranches.name}")
case other =>
sys.error(s"Unexpected combination: $other")
}

validateOpt(counterexample, enableMoreCompleteExhale) {
case (Some(_), Some(false)) => Left( s"Option ${counterexample.name} requires setting "
+ s"flag ${enableMoreCompleteExhale.name}")
Expand Down
15 changes: 9 additions & 6 deletions src/main/scala/Silicon.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package viper.silicon

import java.text.SimpleDateFormat
import java.util.concurrent.{Callable, Executors, TimeUnit, TimeoutException}

import scala.collection.immutable.ArraySeq
import scala.util.{Left, Right}
import ch.qos.logback.classic.{Level, Logger}
Expand All @@ -19,7 +18,7 @@ import viper.silver.frontend.{DefaultStates, SilFrontend}
import viper.silver.reporter._
import viper.silver.verifier.{AbstractVerificationError => SilAbstractVerificationError, Failure => SilFailure, Success => SilSuccess, TimeoutOccurred => SilTimeoutOccurred, VerificationResult => SilVerificationResult, Verifier => SilVerifier}
import viper.silicon.interfaces.Failure
import viper.silicon.logger.SymbExLogger
import viper.silicon.logger.{MemberSymbExLogger, SymbExLogger}
import viper.silicon.reporting.{MultiRunRecorders, condenseToViperResult}
import viper.silicon.verifier.DefaultMainVerifier
import viper.silicon.decider.{Cvc5ProverStdIO, Z3ProverStdIO}
Expand Down Expand Up @@ -93,6 +92,10 @@ class Silicon(val reporter: Reporter, private var debugInfo: Seq[(String, Any)]
private var _config: Config = _
final def config = _config

private var _symbExLog: SymbExLogger[_ <: MemberSymbExLogger] = _
final def symbExLog = _symbExLog
final def symbExLog_=(log: SymbExLogger[_ <: MemberSymbExLogger]) = { _symbExLog = log }

private sealed trait LifetimeState

private object LifetimeState {
Expand All @@ -113,6 +116,7 @@ class Silicon(val reporter: Reporter, private var debugInfo: Seq[(String, Any)]
lifetimeState = LifetimeState.Configured

_config = new Config(args)
_symbExLog = SymbExLogger.ofConfig(_config)
}

def debugInfo(debugInfo: Seq[(String, Any)]): Unit = { this.debugInfo = debugInfo }
Expand All @@ -129,7 +133,7 @@ class Silicon(val reporter: Reporter, private var debugInfo: Seq[(String, Any)]

setLogLevelsFromConfig()

verifier = new DefaultMainVerifier(config, reporter)
verifier = new DefaultMainVerifier(config, reporter, symbExLog)
verifier.start()
}

Expand Down Expand Up @@ -202,10 +206,9 @@ class Silicon(val reporter: Reporter, private var debugInfo: Seq[(String, Any)]
result = Some(condenseToViperResult(failures))
} catch { /* Catch exceptions thrown during verification (errors are not caught) */
case _: TimeoutException =>
// verification was interrupted, therefore close the current member's scope:
SymbExLogger.currentLog().closeMemberScope()
if (config.ideModeAdvanced()) {
reporter report ExecutionTraceReport(SymbExLogger.memberList, List(), List())
symbExLog.close()
reporter report ExecutionTraceReport(symbExLog.logs.toSeq, List(), List())
}
result = Some(SilFailure(SilTimeoutOccurred(config.timeout(), "second(s)") :: Nil))
case exception: Exception if !config.disableCatchingExceptions() =>
Expand Down
30 changes: 14 additions & 16 deletions src/main/scala/decider/Decider.scala
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,18 @@ trait DefaultDeciderProvider extends VerifierComponent { this: Verifier =>

def pushScope(): Unit = {
//val commentRecord = new CommentRecord("push", null, null)
//val sepIdentifier = SymbExLogger.currentLog().openScope(commentRecord)
//val sepIdentifier = symbExLog.openScope(commentRecord)
Comment thread
pieter-bos marked this conversation as resolved.
pathConditions.pushScope()
_prover.push(timeout = Verifier.config.pushTimeout.toOption)
//SymbExLogger.currentLog().closeScope(sepIdentifier)
//symbExLog.closeScope(sepIdentifier)
}

def popScope(): Unit = {
//val commentRecord = new CommentRecord("pop", null, null)
//val sepIdentifier = SymbExLogger.currentLog().openScope(commentRecord)
//val sepIdentifier = symbExLog.openScope(commentRecord)
_prover.pop()
pathConditions.popScope()
//SymbExLogger.currentLog().closeScope(sepIdentifier)
//symbExLog.closeScope(sepIdentifier)
}

def setCurrentBranchCondition(t: Term, te: Option[ast.Exp] = None): Unit = {
Expand Down Expand Up @@ -223,15 +223,15 @@ trait DefaultDeciderProvider extends VerifierComponent { this: Verifier =>

private def assumeWithoutSmokeChecks(terms: InsertionOrderedSet[Term]) = {
val assumeRecord = new DeciderAssumeRecord(terms)
val sepIdentifier = SymbExLogger.currentLog().openScope(assumeRecord)
val sepIdentifier = symbExLog.openScope(assumeRecord)

/* Add terms to Silicon-managed path conditions */
terms foreach pathConditions.add

/* Add terms to the prover's assumptions */
terms foreach prover.assume

SymbExLogger.currentLog().closeScope(sepIdentifier)
symbExLog.closeScope(sepIdentifier)
None
}

Expand All @@ -252,21 +252,21 @@ trait DefaultDeciderProvider extends VerifierComponent { this: Verifier =>
// previously (it did not cause a verification failure) and ignore the
// current one, because it cannot cause a verification error.
if (success)
SymbExLogger.currentLog().discardSMTQuery()
symbExLog.discardSMTQuery()
else
SymbExLogger.currentLog().setSMTQuery(t)
symbExLog.setSMTQuery(t)

Q(success)
}

private def deciderAssert(t: Term, timeout: Option[Int]) = {
val assertRecord = new DeciderAssertRecord(t, timeout)
val sepIdentifier = SymbExLogger.currentLog().openScope(assertRecord)
val sepIdentifier = symbExLog.openScope(assertRecord)

val asserted = isKnownToBeTrue(t)
val result = asserted || proverAssert(t, timeout)

SymbExLogger.currentLog().closeScope(sepIdentifier)
symbExLog.closeScope(sepIdentifier)
result
}

Expand All @@ -280,17 +280,15 @@ trait DefaultDeciderProvider extends VerifierComponent { this: Verifier =>

private def proverAssert(t: Term, timeout: Option[Int]) = {
val assertRecord = new ProverAssertRecord(t, timeout)
val sepIdentifier = SymbExLogger.currentLog().openScope(assertRecord)
val sepIdentifier = symbExLog.openScope(assertRecord)

val result = prover.assert(t, timeout)

if (SymbExLogger.enabled) {
val statistics = prover.statistics()
val deltaStatistics = SymbExLogger.getDeltaSmtStatistics(statistics)
assertRecord.statistics = Some(statistics ++ deltaStatistics)
symbExLog.whenEnabled {
assertRecord.statistics = Some(symbExLog.deltaStatistics(prover.statistics()))
}

SymbExLogger.currentLog().closeScope(sepIdentifier)
symbExLog.closeScope(sepIdentifier)

result
}
Expand Down
15 changes: 14 additions & 1 deletion src/main/scala/logger/LogConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,23 @@
package viper.silicon.logger

import spray.json._
import viper.silicon.logger.records.data.DataRecord

case class LogConfig(isBlackList: Boolean,
includeStore: Boolean, includeHeap: Boolean, includeOldHeap: Boolean, includePcs: Boolean,
recordConfigs: List[RecordConfig])
recordConfigs: List[RecordConfig]) {
def getRecordConfig(d: DataRecord): Option[RecordConfig] = {
for (rc <- recordConfigs) {
if (rc.kind.equals(d.toTypeString)) {
rc.value match {
case Some(value) => if (value.equals(d.toSimpleString)) return Some(rc)
case None => return Some(rc)
}
}
}
None
}
}

object LogConfig {
def default(): LogConfig = LogConfig(
Expand Down
Loading