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.7% of users enabled 2FA.

Commit 4fcad221 authored by Kunshan Wang's avatar Kunshan Wang
Browse files

Operations not required by the spec and not implemented now throws

UnimplementedOprationException.
parent 1c9f0697
...@@ -251,7 +251,7 @@ class ClientAgent(microVM: MicroVM) { ...@@ -251,7 +251,7 @@ class ClientAgent(microVM: MicroVM) {
case 16 => MemorySupport.loadShort(iRef) case 16 => MemorySupport.loadShort(iRef)
case 32 => MemorySupport.loadInt(iRef) case 32 => MemorySupport.loadInt(iRef)
case 64 => MemorySupport.loadLong(iRef) case 64 => MemorySupport.loadLong(iRef)
case _ => throw new UvmRefImplException("Loading int of length %d is not supported".format(l)) case _ => throw new UnimplementedOprationException("Loading int of length %d is not supported".format(l))
} }
BoxInt(OpHelper.unprepare(bi, l)) BoxInt(OpHelper.unprepare(bi, l))
case _: TypeFloat => case _: TypeFloat =>
...@@ -293,9 +293,9 @@ class ClientAgent(microVM: MicroVM) { ...@@ -293,9 +293,9 @@ class ClientAgent(microVM: MicroVM) {
case _: TypeDouble => case _: TypeDouble =>
val vs = for (i <- (0L until len)) yield MemorySupport.loadDouble(iRef + i * 8L) val vs = for (i <- (0L until len)) yield MemorySupport.loadDouble(iRef + i * 8L)
BoxVector(vs.map(v => BoxDouble(v))) BoxVector(vs.map(v => BoxDouble(v)))
case _ => throw new UvmRefImplException("Loading of vector type with element type %s is not supporing".format(ety.getClass.getName)) case _ => throw new UnimplementedOprationException("Loading of vector type with element type %s is not supporing".format(ety.getClass.getName))
} }
case _ => throw new UvmRefImplException("Loading of type %s is not supporing".format(uty.getClass.getName)) case _ => throw new UnimplementedOprationException("Loading of type %s is not supporing".format(uty.getClass.getName))
} }
newHandle(uty, nb) newHandle(uty, nb)
} }
...@@ -314,7 +314,7 @@ class ClientAgent(microVM: MicroVM) { ...@@ -314,7 +314,7 @@ class ClientAgent(microVM: MicroVM) {
case 16 => MemorySupport.storeShort(iRef, bi.shortValue) case 16 => MemorySupport.storeShort(iRef, bi.shortValue)
case 32 => MemorySupport.storeInt(iRef, bi.intValue) case 32 => MemorySupport.storeInt(iRef, bi.intValue)
case 64 => MemorySupport.storeLong(iRef, bi.longValue) case 64 => MemorySupport.storeLong(iRef, bi.longValue)
case _ => throw new UvmRefImplException("Storing int of length %d is not supported".format(l)) case _ => throw new UnimplementedOprationException("Storing int of length %d is not supported".format(l))
} }
BoxInt(OpHelper.unprepare(bi, l)) BoxInt(OpHelper.unprepare(bi, l))
case _: TypeFloat => case _: TypeFloat =>
...@@ -351,9 +351,9 @@ class ClientAgent(microVM: MicroVM) { ...@@ -351,9 +351,9 @@ class ClientAgent(microVM: MicroVM) {
for (i <- (0L until len)) MemorySupport.storeFloat(iRef + i * 4L, vbs(i.toInt).asInstanceOf[BoxFloat].value) for (i <- (0L until len)) MemorySupport.storeFloat(iRef + i * 4L, vbs(i.toInt).asInstanceOf[BoxFloat].value)
case _: TypeDouble => case _: TypeDouble =>
for (i <- (0L until len)) MemorySupport.storeDouble(iRef + i * 8L, vbs(i.toInt).asInstanceOf[BoxDouble].value) for (i <- (0L until len)) MemorySupport.storeDouble(iRef + i * 8L, vbs(i.toInt).asInstanceOf[BoxDouble].value)
case _ => throw new UvmRefImplException("Storing of vector type with element type %s is not supporing".format(ety.getClass.getName)) case _ => throw new UnimplementedOprationException("Storing of vector type with element type %s is not supporing".format(ety.getClass.getName))
} }
case _ => throw new UvmRefImplException("Storing of type %s is not supporing".format(uty.getClass.getName)) case _ => throw new UnimplementedOprationException("Storing of type %s is not supporing".format(uty.getClass.getName))
} }
} }
...@@ -377,7 +377,7 @@ class ClientAgent(microVM: MicroVM) { ...@@ -377,7 +377,7 @@ class ClientAgent(microVM: MicroVM) {
val (succ2, rv) = MemorySupport.cmpXchgLong(iRef, ebi.longValue, dbi.longValue) val (succ2, rv) = MemorySupport.cmpXchgLong(iRef, ebi.longValue, dbi.longValue)
(succ2, BigInt(rv)) (succ2, BigInt(rv))
} }
case _ => throw new UvmRefImplException("CmpXchg on int of length %d is not supported".format(l)) case _ => throw new UnimplementedOprationException("CmpXchg on int of length %d is not supported".format(l))
} }
val rb = BoxInt(OpHelper.unprepare(rbi, l)) val rb = BoxInt(OpHelper.unprepare(rbi, l))
val rh = newHandle(uty, rb) val rh = newHandle(uty, rb)
...@@ -415,7 +415,7 @@ class ClientAgent(microVM: MicroVM) { ...@@ -415,7 +415,7 @@ class ClientAgent(microVM: MicroVM) {
val rs = microVM.threadStackManager.getStackByID(rl.toInt) val rs = microVM.threadStackManager.getStackByID(rl.toInt)
val rh = newHandle(uty, BoxStack(rs)) val rh = newHandle(uty, BoxStack(rs))
(succ, rh) (succ, rh)
case _ => throw new UvmRefImplException("CmpXchg of type %s is not supporing".format(uty.getClass.getName)) case _ => throw new UnimplementedOprationException("CmpXchg of type %s is not supporing".format(uty.getClass.getName))
} }
} }
...@@ -435,13 +435,13 @@ class ClientAgent(microVM: MicroVM) { ...@@ -435,13 +435,13 @@ class ClientAgent(microVM: MicroVM) {
case 64 => { case 64 => {
MemorySupport.atomicRMWLong(op, iRef, obi.longValue) MemorySupport.atomicRMWLong(op, iRef, obi.longValue)
} }
case _ => throw new UvmRefImplException("AtomicRMW on int of length %d is not supported".format(l)) case _ => throw new UnimplementedOprationException("AtomicRMW on int of length %d is not supported".format(l))
} }
val rb = BoxInt(OpHelper.unprepare(rbi, l)) val rb = BoxInt(OpHelper.unprepare(rbi, l))
newHandle(uty, rb) newHandle(uty, rb)
case _ => case _ =>
if (op != XCHG) { if (op != XCHG) {
throw new UvmRefImplException("AtomicRMW operation other than XCHG only supports int. %s found.".format(uty.getClass.getName)) throw new UnimplementedOprationException("AtomicRMW operation other than XCHG only supports int. %s found.".format(uty.getClass.getName))
} else { } else {
uty match { uty match {
case _: TypeRef => case _: TypeRef =>
...@@ -472,7 +472,7 @@ class ClientAgent(microVM: MicroVM) { ...@@ -472,7 +472,7 @@ class ClientAgent(microVM: MicroVM) {
val rl = MemorySupport.atomicRMWLong(op, iRef, ol) val rl = MemorySupport.atomicRMWLong(op, iRef, ol)
newHandle(uty, BoxTagRef64(rl)) newHandle(uty, BoxTagRef64(rl))
case _ => case _ =>
throw new UvmRefImplException("AtomicRMW XCHG of type %s is not supporing".format(uty.getClass.getName)) throw new UnimplementedOprationException("AtomicRMW XCHG of type %s is not supporing".format(uty.getClass.getName))
} }
} }
} }
......
...@@ -2,7 +2,11 @@ package uvm.refimpl ...@@ -2,7 +2,11 @@ package uvm.refimpl
import uvm.UvmException import uvm.UvmException
/** Parent of all exceptions in the implementation part. This does not include the data structure and parser outside uvm.refimpl. */
class UvmRefImplException(message: String = null, cause: Throwable = null) extends UvmException(message, cause) class UvmRefImplException(message: String = null, cause: Throwable = null) extends UvmException(message, cause)
/** Thrown when the µVM cannot allocate memory. */
class UvmOutOfMemoryException(message: String = null, cause: Throwable = null) extends UvmRefImplException(message, cause) class UvmOutOfMemoryException(message: String = null, cause: Throwable = null) extends UvmRefImplException(message, cause)
/** Thrown when an action not required by the specification and not implemented by this refimpl is performed. */
class UnimplementedOprationException(message: String = null, cause: Throwable = null) extends UvmRefImplException(message, cause)
...@@ -40,6 +40,9 @@ class ThreadStackManager(microVM: MicroVM) { ...@@ -40,6 +40,9 @@ class ThreadStackManager(microVM: MicroVM) {
sta sta
} }
/**
* Create a new thread, bind to a given stack.
*/
def newThread(stack: InterpreterStack): InterpreterThread = { def newThread(stack: InterpreterStack): InterpreterThread = {
val mutator = microVM.memoryManager.makeMutator() val mutator = microVM.memoryManager.makeMutator()
val id = makeThreadID() val id = makeThreadID()
......
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