-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
When interpreting the Call instruction, we mark the return continuation of the sub-process as the same as the current calling frame. Should we use the 'next continuation' (newK) for returning from a sub-process, like eval(body, List(), newFrame, newK, List(newK), 0)?
GenSym/src/main/scala/wasm/MiniWasm.scala
Lines 295 to 305 in a8781d4
| case Call(f) if frame.module.funcs(f).isInstanceOf[FuncDef] => | |
| val FuncDef(_, FuncBodyDef(ty, _, locals, body)) = frame.module.funcs(f) | |
| val args = stack.take(ty.inps.size).reverse | |
| val newStack = stack.drop(ty.inps.size) | |
| val frameLocals = args ++ locals.map(_ => I32V(0)) // GW: always I32? or depending on their types? | |
| val newFrame = Frame(frame.module, ArrayBuffer(frameLocals: _*)) | |
| val newK: Cont[Ans] = (retStack) => | |
| eval(rest, retStack.take(ty.out.size) ++ newStack, frame, kont, trail, ret) | |
| // We push newK on the trail since function creates a new block to escape | |
| // (more or less like `return`) | |
| eval(body, List(), newFrame, newK, newK :: trail, ret+1) |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels