Skip to content

Commit fed482f

Browse files
committed
Using config.json as the default configuration
1 parent e6c6ec9 commit fed482f

File tree

9 files changed

+28
-15
lines changed

9 files changed

+28
-15
lines changed

config.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"testMode": true,
32
"silent": true,
43
"analyzer": {
54
"console": false,
@@ -10,9 +9,9 @@
109
"heapBuilder": {
1110
"maxStrSetSize": 10,
1211
"recency": false,
13-
"heap-clone": false,
14-
"callsiteSensitivity": 100,
15-
"loopIter": 20,
12+
"heap-clone": true,
13+
"callsiteSensitivity": 20,
14+
"loopIter": 100,
1615
"loopDepth": 10,
1716
"snapshot": ""
1817
}

src/main/scala/kr/ac/kaist/safe/Safe.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ object Safe {
2424
def main(tokens: Array[String]): Unit = {
2525
(tokens.toList match {
2626
case str :: args => cmdMap.get(str) match {
27-
case Some(cmd) => cmd(args, false)
27+
case Some(cmd) => cmd(s"-config=$CONFIG_FILE" :: args, false)
2828
case None => Failure(NoCmdError(str))
2929
}
3030
case Nil => Failure(NoInputError)

src/main/scala/kr/ac/kaist/safe/analyzer/Semantics.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,7 @@ case class Semantics(
508508
}
509509
case (NodeUtil.INTERNAL_NOT_YET_IMPLEMENTED, List(expr), None) => {
510510
val (v, excSet) = V(expr, st);
511-
println(s"[NotYetImplemented] $v")
512-
println(s"* Sensitivity: ")
513-
cp.tracePartition.toStringList.foreach(println)
511+
excLog.signal(SemanticsNotYetImplementedError(v, cp))
514512
(st, excSt)
515513
}
516514
case (NodeUtil.INTERNAL_CHAR_CODE, List(expr), None) => {
@@ -1422,7 +1420,7 @@ case class Semantics(
14221420
(st1, excSt newExcSt)
14231421
}
14241422
case _ =>
1425-
excLog.signal(SemanticsNotYetImplementedError(ir))
1423+
excLog.signal(IRSemanticsNotYetImplementedError(ir))
14261424
(AbsState.Bot, AbsState.Bot)
14271425
}
14281426
}
@@ -1633,7 +1631,7 @@ case class Semantics(
16331631
case CFGInternalValue(ir, name) => getInternalValue(name) match {
16341632
case Some(value) => (value, ExcSetEmpty)
16351633
case None =>
1636-
excLog.signal(SemanticsNotYetImplementedError(ir))
1634+
excLog.signal(IRSemanticsNotYetImplementedError(ir))
16371635
(AbsValue.Bot, ExcSetEmpty)
16381636
}
16391637
case CFGVal(ejsVal) =>

src/main/scala/kr/ac/kaist/safe/errors/error/AnalyzeError.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
package kr.ac.kaist.safe.errors.error
1313

14+
import kr.ac.kaist.safe.LINE_SEP
15+
import kr.ac.kaist.safe.analyzer.domain.AbsValue
16+
import kr.ac.kaist.safe.analyzer.ControlPoint
1417
import kr.ac.kaist.safe.nodes.ir.IRNode
1518
import kr.ac.kaist.safe.util.UserAllocSite
1619

@@ -37,11 +40,17 @@ case class UndefinedFunctionCallError(ir: IRNode) extends AnalyzeIRNodeError({
3740
"CFGConstruct/CFGCall tried to call undefined function"
3841
}, ir)
3942

40-
case class SemanticsNotYetImplementedError(ir: IRNode) extends AnalyzeIRNodeError({
43+
case class IRSemanticsNotYetImplementedError(ir: IRNode) extends AnalyzeIRNodeError({
4144
"Semantics for this node is not implemented yet"
4245
}, ir)
4346

4447
// other errors
48+
case class SemanticsNotYetImplementedError(v: AbsValue, cp: ControlPoint) extends AnalyzeError({
49+
s"[NotYetImplemented] $v" + LINE_SEP +
50+
s"* Sensitivity: " + LINE_SEP +
51+
cp.tracePartition.toStringList.mkString(LINE_SEP)
52+
})
53+
4554
case class ContextAssertionError(funName: String, msg: String) extends AnalyzeError(
4655
s"[Assert:$funName]: $msg"
4756
)

src/main/scala/kr/ac/kaist/safe/package.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ package object safe {
3333
// Base project directory root
3434
val CUR_DIR = System.getProperty("user.dir")
3535

36+
// Configuration file
37+
val CONFIG_FILE = BASE_DIR + SEP + "config.json"
38+
3639
// Predefined variables
3740
val PRED_VARS = List(
3841
// 4.2 Language Overview

src/main/scala/kr/ac/kaist/safe/phase/Analyze.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ case object Analyze extends PhaseObj[(CFG, Semantics, TracePartition, HeapBuildC
5050

5151
// Report errors.
5252
val excLog = sem.excLog
53-
if (excLog.hasError) {
53+
if (!safeConfig.testMode && excLog.hasError) {
5454
println(cfg.fileName + ":")
5555
println(excLog)
5656
}

src/main/scala/kr/ac/kaist/safe/web/WebServer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ object WebServer extends {
110110
val testSafeConfig: SafeConfig = SafeConfig(CmdBase, Nil)
111111
val parser = new ArgParser(CmdBase, testSafeConfig)
112112
val heapBuildConfig = HeapBuild.defaultConfig
113-
val testJSON = Useful.path("config.json")
113+
val testJSON = CONFIG_FILE
114114
parser.addRule(heapBuildConfig, HeapBuild.name, HeapBuild.options)
115115
parser(List(s"-config=$testJSON"))
116116

src/test/scala/kr/ac/kaist/safe/AnalyzeTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ abstract class AnalyzeTest extends SafeTest {
2727
// analysis configuration
2828
val heapBuildConfig = HeapBuild.defaultConfig
2929
val analyzeConfig = Analyze.defaultConfig
30-
val configFile = BASE_DIR + SEP + "config.json"
30+
val configFile = CONFIG_FILE
3131

3232
// check prefix of abstract strings
3333
def prefixCheck(prefix: String): (AbsStr, AbsDataProp) => Boolean = {

src/test/scala/kr/ac/kaist/safe/SafeTest.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ abstract class SafeTest extends FunSuite {
2222
lazy val testDir = BASE_DIR + SEP + "tests" + SEP
2323

2424
// safe configuration
25-
lazy val safeConfig: SafeConfig = SafeConfig(CmdBase, Nil)
25+
lazy val safeConfig: SafeConfig = SafeConfig(
26+
command = CmdBase,
27+
fileNames = Nil,
28+
testMode = true
29+
)
2630

2731
////////////////////////////////////////////////////////////////////////////////
2832
// Helper Functions

0 commit comments

Comments
 (0)