Commit 092104b2 authored by Kunshan Wang's avatar Kunshan Wang

allow disabling static checking

parent 19a2f273
......@@ -41,6 +41,7 @@ or::
losSize = 2*1024*1024,
globalSize = 4*1024*1024,
stackSize = 63*1024,
staticCheck = False,
gcLog = "WARN",
vmLog = "INFO",
)
......@@ -1149,6 +1150,8 @@ class MuRefImpl2StartDLL(object):
losSize: large object space size (bytes, must be 4096-byte aligned)
globalSize: global space size (bytes, must be 4096-byte aligned)
stackSize: stack size (bytes)
staticCheck: enable or disable static checks ("true" or "false".
Python boolean values are also accepted.)
vmLog: log level for the micro VM
gcLog: log level fof the garbage collector
......@@ -1159,7 +1162,8 @@ class MuRefImpl2StartDLL(object):
Setting to WARN will disable almost all logs. Set vmLog to INFO to see
the execution of each instruction; Set gcLog to DEBUG to see GC logs.
"""
conf = "".join("{}={}\n".format(k,v) for k,v in kwargs.items())
conf = "".join("{}={}\n".format(k,to_vmconf_str(v))
for k,v in kwargs.items())
ptr = self.dll.mu_refimpl2_new_ex(_priv._encode(conf, "utf8"))
return MuVM(ptr, self)
......@@ -1168,4 +1172,9 @@ class MuRefImpl2StartDLL(object):
really closed."""
self.dll.mu_refimpl2_close(muvm._struct_ptr)
def to_vmconf_str(obj):
if isinstance(obj, bool):
return "true" if obj else "false"
return str(obj)
# vim: ts=4 sw=4 et sts=4 ai tw=80
......@@ -76,7 +76,9 @@ class MicroVM(vmConf: VMConf) {
* Add things from a bundle to the Micro VM.
*/
def addBundle(bundle: TrantientBundle) {
staticAnalyzer.checkBundle(bundle, Some(globalBundle))
if (vmConf.staticCheck) {
staticAnalyzer.checkBundle(bundle, Some(globalBundle))
}
globalBundle.merge(bundle);
......
......@@ -8,15 +8,18 @@ package uvm.refimpl
import uvm.refimpl.mem.TypeSizes._
object VMConf {
val DEFAULT_CONF = new VMConf()
val ReComment = """^\s*#.*$""".r
val ReBlank = """^\s*$""".r
val ReConf = """^\s*(\w+)=(\w+)\s*$""".r
def apply(confStr: String): VMConf = {
var sosSize = MicroVM.DEFAULT_SOS_SIZE
var losSize = MicroVM.DEFAULT_LOS_SIZE
var globalSize = MicroVM.DEFAULT_GLOBAL_SIZE
var stackSize = MicroVM.DEFAULT_GLOBAL_SIZE
var sosSize = DEFAULT_CONF.sosSize
var losSize = DEFAULT_CONF.losSize
var globalSize = DEFAULT_CONF.globalSize
var stackSize = DEFAULT_CONF.stackSize
var staticCheck = DEFAULT_CONF.staticCheck
confStr.lines foreach {
case ReComment() =>
case ReBlank() =>
......@@ -26,13 +29,14 @@ object VMConf {
case "losSize" => losSize = value.toLong
case "globalSize" => globalSize = value.toLong
case "stackSize" => stackSize = value.toLong
case "staticCheck" => staticCheck = value.toLowerCase().toBoolean
case "vmLog" => setLog("uvm", value)
case "gcLog" => setLog("uvm.refimpl.mem", value)
case _ => throw new UvmRefImplException("Unrecognized option %s".format(key))
}
}
}
new VMConf(sosSize, losSize, globalSize, stackSize)
new VMConf(sosSize, losSize, globalSize, stackSize, staticCheck)
}
def setLog(name: String, levelStr: String): Unit = {
......@@ -51,5 +55,6 @@ class VMConf(
val sosSize: Word = MicroVM.DEFAULT_SOS_SIZE,
val losSize: Word = MicroVM.DEFAULT_LOS_SIZE,
val globalSize: Word = MicroVM.DEFAULT_GLOBAL_SIZE,
val stackSize: Word = MicroVM.DEFAULT_STACK_SIZE)
val stackSize: Word = MicroVM.DEFAULT_STACK_SIZE,
val staticCheck: Boolean = true)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment