Commit f0c46abf authored by Kunshan Wang's avatar Kunshan Wang

fixed startup and threadlocal addr

parent 3e1ba586
......@@ -11,6 +11,7 @@ const char *hw_string = "Hello world!\n";
const char *hw2_string = "Goodbye world!\n";
const char *gc_conf =
"vmLog=DEBUG\n"
"sosSize=524288\n"
"losSize=524288\n"
"globalSize=1048576\n"
......@@ -18,8 +19,10 @@ const char *gc_conf =
;
int main() {
printf("Creating micro VM...\n");
MuVM *mvm = mu_refimpl2_new_ex(gc_conf);
printf("Creating client context...\n");
MuCtx *ctx = mvm->new_context(mvm);
char *bundle1 =
......
......@@ -37,7 +37,7 @@ object MicroVM {
def apply(confStr: String): MicroVM = {
val vmConf = VMConf(confStr)
MicroVM(confStr)
MicroVM(vmConf)
}
def apply(confStr: String, appArgs: Seq[String]): MicroVM = {
......
......@@ -34,6 +34,7 @@ import uvm.refimpl.itpr.BoxPointer
import uvm.utils.IOHelpers
import com.typesafe.scalalogging.Logger
import org.slf4j.LoggerFactory
import uvm.refimpl.mem.HeaderUtils
object BootImageLoader {
val logger = Logger(LoggerFactory.getLogger(getClass.getName))
......@@ -77,6 +78,8 @@ class BootImageLoader(file: String, maybeAppArgs: Option[Seq[String]])(implicit
}
def load(): Unit = {
logger.info("Loading boot image: {}".format(file))
val metaInfo = loadMetaInfo()
loadExtraLibs(metaInfo)
......@@ -313,14 +316,22 @@ class BootImageLoader(file: String, maybeAppArgs: Option[Seq[String]])(implicit
"entry point of a program, thus primordial threads should only exist in STAND-ALONE EXECUTABLE boot iamges.")
}
val threadLocalAddr = metaInfo.get(KEY_THREADLOCAL).map(_.toLong).map { addr =>
addr
val threadLocalAddr = metaInfo.get(KEY_THREADLOCAL).map(_.toLong).map { num =>
objNumToAddr(num)
}.getOrElse(0L)
tryWithResource(heap.makeMutator(PRIMORDIAL_INIT_MUTATOR_NAME)) { mutator =>
logger.info("Creating primordial thread using function %d (name: %s)...".format(initFuncID))
logger.info("Thread local obj address: %d 0x%x".format(threadLocalAddr, threadLocalAddr))
logger.info("Creating primordial thread using function %d...".format(initFuncID))
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 {
val tag = HeaderUtils.getTag(threadLocalAddr)
val ty = HeaderUtils.getType(microVM, tag)
"Thread-local obj type: %s %s".format(ty.repr, ty)
}
val stack = microVM.threadStackManager.newStack(func, mutator)
val allArgs = Seq(file) ++ appArgs
val nativeArgv = new NativeArgv(allArgs)
......
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