Commit bdd1dce5 authored by Kunshan Wang's avatar Kunshan Wang

Updated the Factorial program to use idOf and nameOf, too.

parent df65c319
......@@ -11,14 +11,12 @@ object FactorialFromRPython extends App {
ca.loadBundle(r)
r.close()
// Magical trick. Theoretically the client would publish bundles as binary and knows all the IDs. But in this version
// only the text form is supported and IDs are automatically generated. So we look into the globalBundle itself.
val m = ca.putFunction(microVM.globalBundle.funcNs("@main").id)
val m = ca.putFunction(microVM.idOf("@main"))
microVM.trapManager.trapHandler = new TrapHandler {
override def handleTrap(ca: ClientAgent, thread: Handle, stack: Handle, watchPointID: Int): TrapHandlerResult = {
val curInst = ca.currentInstruction(stack, 0)
val trapName = microVM.globalBundle.varNs(curInst).name.get
val trapName = microVM.nameOf(curInst)
if (trapName == "@main_v1.main_trap") {
val kas = ca.dumpKeepalives(stack, 0)
......
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