WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.3% of users enabled 2FA.

Commit fb6c7513 authored by Kunshan Wang's avatar Kunshan Wang
Browse files

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
implementation.

See #10
parent e8889b5b
package uvm.refimpl.misc
import org.scalatest._
import java.io.FileReader
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._
setLogLevels(
ROOT_LOGGER_NAME -> INFO,
"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) =>
returnFromTrap(st)
}
} catch {
case e: Exception => {
logger.info("Caught exception. This is expected.", e)
exceptionCaught = true
}
}
if (!exceptionCaught) {
fail("Exception expected, but not caught")
}
ctx.closeContext()
}
}
\ No newline at end of file
// require primitives.uir
.typedef @s0 = hybrid<@i32 @i64 @i8>
.funcdef @main VERSION %v1 <@v_v> {
%entry():
%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