Commit fb6c7513 authored by Kunshan Wang's avatar Kunshan Wang

Test case regarding GETFIELDIREF arg types

With a better uvm.staticanalysys.StaticAnalyzer, Holstein should have
reject ill-formed Mu bundles if there are type errors.  Fixing this will
need refactoring, moving `uvm.refimpl.internals.scala` into a package
for general IR processing, not specific to the interpreter

See #10
parent e8889b5b
package uvm.refimpl.misc
import org.scalatest._
import uvm._
import uvm.types._
import uvm.ssavariables._
import uvm.refimpl._
import uvm.refimpl.itpr._
import MemoryOrder._
import AtomicRMWOptr._
import uvm.refimpl.Word
import ch.qos.logback.classic.Level._
import uvm.refimpl.UvmBundleTesterBase
import org.slf4j.LoggerFactory
import com.typesafe.scalalogging.Logger
import uvm.refimpl.TrapHandlerResult.Rebind
import uvm.refimpl.HowToResume.ThrowExc
object GetFieldIRefTest {
val logger = Logger(LoggerFactory.getLogger(getClass.getName))
class GetFieldIRefTest extends UvmBundleTesterBase {
import GetFieldIRefTest._
"uvm.refimpl.misc" -> DEBUG,
"uvm.refimpl.itpr" -> DEBUG)
preloadBundles("tests/uvm-refimpl-test/primitives.uir", "tests/uvm-refimpl-test/getfieldireftest.uir")
"GetFieldIRef" should "not work if the argument is a ref" in {
val ctx = microVM.newContext()
val func = ctx.handleFromFunc("@main")
var exceptionCaught: Boolean = false
try {
testFunc(ctx, func, Seq()) { (ctx, th, st, wp) =>
} catch {
case e: Exception => {"Caught exception. This is expected.", e)
exceptionCaught = true
if (!exceptionCaught) {
fail("Exception expected, but not caught")
\ No newline at end of file
// require primitives.uir
.typedef @s0 = hybrid<@i32 @i64 @i8>
.funcdef @main VERSION %v1 <@v_v> {
%obj = NEWHYBRID <@s0 @i64> @I64_10
%fir = GETFIELDIREF <@s0 0> %obj
COMMINST @uvm.thread_exit
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