Commit a6ff7b64 authored by Kunshan Wang's avatar Kunshan Wang

Re-apply the "charpp" fix to this branch.

parents 938280e1 b2aac66b
......@@ -86,6 +86,13 @@ class MicroVM(val vmConf: VMConf) {
globalBundle.constantNs.add(c)
constantPool.addGlobalVar(c)
}
// Some types required by the RunMu class
for (ty <- Seq(C_INT, C_CHAR, C_CHARP, C_CHARPP)) {
globalBundle.typeNs.add(ty)
}
}
/**
......
......@@ -13,6 +13,7 @@ import java.io.BufferedReader
import uvm.refimpl.nat.NativeSupport
import uvm.refimpl.nat.PlatformConstants
import uvm.refimpl.HowToResume.PassValues
import uvm.refimpl.InternalTypes
/** Run Mu from the command line. */
object RunMu {
......@@ -110,7 +111,7 @@ object RunMu {
val func = ctx.handleFromFunc(id)
val stack = ctx.newStack(func)
val hArgc = ctx.handleFromInt(argc, 32)
val hArgv = ctx.handleFromPtr(ctx.idOf("@charpp"), cArgv.address())
val hArgv = ctx.handleFromPtr(InternalTypes.C_CHARPP.id, cArgv.address())
val thread = ctx.newThread(stack, None, PassValues(Seq(hArgc, hArgv)))
}
......
......@@ -17,6 +17,11 @@ object InternalTypes {
val n = "@uvm.internal.types." + name
(id, n)
}
val C_INT = TypeInt(32) := internal("c_int")
val C_CHAR = TypeInt(8) := internal("c_char")
val C_CHARP = TypeUPtr(C_CHAR) := internal("c_charp")
val C_CHARPP = TypeUPtr(C_CHARP) := internal("c_charpp")
val I1 = TypeInt(1) := internal("i1")
val I6 = TypeInt(6) := internal("i6")
......
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