Commit 88bba067 authored by Kunshan Wang's avatar Kunshan Wang

Fixed cmdline arguments

parent 2bee1cff
......@@ -301,7 +301,7 @@ private[textinput] class InstanceUIRTextReader(idFactory: IDFactory, source: Str
val gc = mkGlobalCell(ty)
val name = gdctx.nam
gc.id = idFactory.getID(name)
logger.info("global cell: id=%d, name=%s".format(gc.id, gc.name))
logger.debug("global cell: id=%d, name=%s".format(gc.id, gc.name))
gc.name = Some(name)
addGlobalCell(gc, toSourceInfo(name))
}
......
......@@ -44,21 +44,21 @@ object MicroVM {
MicroVM(vmConf)
}
def apply(confStr: String, appArgs: Seq[String]): MicroVM = {
def apply(confStr: String, allArgs: Seq[String]): MicroVM = {
val vmConf = VMConf(confStr)
MicroVM(vmConf, appArgs)
MicroVM(vmConf, allArgs)
}
def apply(vmConf: VMConf): MicroVM = {
new MicroVM(vmConf, None)
}
def apply(vmConf: VMConf, appArgs: Seq[String]): MicroVM = {
new MicroVM(vmConf, Some(appArgs))
def apply(vmConf: VMConf, allArgs: Seq[String]): MicroVM = {
new MicroVM(vmConf, Some(allArgs))
}
}
class MicroVM private (val vmConf: VMConf, val appArgs: Option[Seq[String]]) extends IRBuilderListener {
class MicroVM private (val vmConf: VMConf, val allArgs: Option[Seq[String]]) extends IRBuilderListener {
// implicitly injected resources
private implicit val microVM = this
......@@ -221,7 +221,7 @@ class MicroVM private (val vmConf: VMConf, val appArgs: Option[Seq[String]]) ext
* Load from a boot image.
*/
def loadBootImage(file: String): Unit = {
tryWithResource(new BootImageLoader(file, appArgs)) { bil =>
tryWithResource(new BootImageLoader(file, allArgs)) { bil =>
bil.load()
}
}
......
......@@ -43,7 +43,7 @@ object BootImageLoader {
val EXTRALIBS_FILE = "extralibs"
}
class BootImageLoader(file: String, maybeAppArgs: Option[Seq[String]])(implicit microVM: MicroVM) extends AutoCloseable {
class BootImageLoader(file: String, maybeAllArgs: Option[Seq[String]])(implicit microVM: MicroVM) extends AutoCloseable {
import BootImageLoader._
import BootImageFile._
......@@ -309,7 +309,7 @@ class BootImageLoader(file: String, maybeAppArgs: Option[Seq[String]])(implicit
case Some(initFuncID) => {
val func = microVM.globalBundle.funcNs(initFuncID)
val appArgs = maybeAppArgs.getOrElse {
val allArgs = maybeAllArgs.getOrElse {
throw new BootImageLoaderException("Boot image has a primordial thread, but the MicroVM instance is not created " +
"with command line arguments. Please use the tools/runmu.sh command line utility to run boot images that has " +
"primordial threads. In realistic scenarios, the primordial thread in the boot image is supposed to be the " +
......@@ -325,7 +325,7 @@ class BootImageLoader(file: String, maybeAppArgs: Option[Seq[String]])(implicit
val func = microVM.globalBundle.funcNs(initFuncID)
logger.info("Stack-bottom function name: %s".format(func.name.getOrElse("(no name)")))
logger.info("Thread local obj address: %d 0x%x".format(threadLocalAddr, threadLocalAddr))
logger.info("Thread-local obj address: %d 0x%x".format(threadLocalAddr, threadLocalAddr))
logger.info {
if (threadLocalAddr == 0L) {
"The thread-local obj ref is NULL"
......@@ -337,7 +337,7 @@ class BootImageLoader(file: String, maybeAppArgs: Option[Seq[String]])(implicit
}
val stack = microVM.threadStackManager.newStack(func, mutator)
val allArgs = Seq(file) ++ appArgs
logger.info("All arguments: %s".format(allArgs))
val nativeArgv = new NativeArgv(allArgs)
val argcBox = BoxInt(nativeArgv.argc)
val argvBox = BoxPointer(nativeArgv.argv)
......
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