Commit 918eeb4e authored by Kunshan Wang's avatar Kunshan Wang

WIP: Fixing client API (goodbye "client agent")

parent bbb76da5
......@@ -27,6 +27,7 @@ object InternalTypes {
val I32 = TypeInt(32) := internal("i32")
val I52 = TypeInt(52) := internal("i52")
val I64 = TypeInt(52) := internal("i64")
val FLOAT = TypeFloat() := internal("float")
val DOUBLE = TypeDouble() := internal("double")
val VOID = TypeVoid() := internal("void")
......@@ -41,6 +42,7 @@ object InternalTypes {
}
object InternalTypePool {
val intOf = LazyPool(TypeInt)
val refOf = LazyPool(TypeRef)
val irefOf = LazyPool(TypeIRef)
val ptrOf = LazyPool(TypeUPtr)
......
......@@ -53,12 +53,6 @@ case class BoxIRef(var objRef: Word, var offset: Word) extends HasObjRef {
def oo: (Word, Word) = (objRef, offset)
def oo_=(newVal: (Word, Word)): Unit = { objRef = newVal._1; offset = newVal._2 }
}
case class BoxStruct(var values: Seq[ValueBox]) extends ValueBox {
def copyFrom(other: ValueBox): Unit = { for ((t, o) <- this.values.zip(other.asInstanceOf[BoxStruct].values)) t.copyFrom(o) }
}
case class BoxVoid() extends ValueBox {
def copyFrom(other: ValueBox): Unit = {}
}
case class BoxFunc(var func: Option[Function]) extends ObjectBox[Function] {
def obj = func
def obj_=(other: Option[Function]): Unit = { func = other }
......@@ -97,7 +91,7 @@ object ValueBox {
case _: TypeRef => BoxRef(0L)
case _: TypeIRef => BoxIRef(0L, 0L)
case _: TypeWeakRef => throw new UvmRefImplException("weakref cannot be an SSA variable type")
case TypeStruct(fieldTys) => BoxStruct(fieldTys.map(makeBoxForType))
case TypeStruct(fieldTys) => BoxSeq(fieldTys.map(makeBoxForType))
case TypeArray(elemTy, len) => BoxSeq(Seq.fill(len.toInt)(makeBoxForType(elemTy)))
case _: TypeHybrid => throw new UvmRefImplException("hybrid cannot be an SSA variable type")
case _: TypeFuncRef => BoxFunc(None)
......
......@@ -66,7 +66,7 @@ abstract class UvmBundleTesterBase extends FlatSpec with Matchers {
def testFunc(ca: ClientAgent, func: Handle, args: Seq[Handle])(handler: TrapHandlerFunction): Unit = {
microVM.trapManager.trapHandler = new MockTrapHandler(handler)
val hStack = ca.newStack(func, args)
val hStack = ca.newStack(func)
val hThread = ca.newThread(hStack)
microVM.execute()
}
......
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