ApplyReturnAddress() static private method

static private ApplyReturnAddress ( ReturnAddress returnAddress ) : void
returnAddress Shovel.Vm.Types.ReturnAddress
return void
示例#1
0
文件: Vm.cs 项目: mbrezu/Shovel
 static void FinishPrimitiveCall(
     Vm vm, int numArgs, bool saveReturnAddress, Value result)
 {
     vm.stack.PopMany (numArgs);
     if (saveReturnAddress) {
         vm.programCounter ++;
     } else {
         var maybeRa = vm.stack.PopTop ();
         if (maybeRa.Kind == Value.Kinds.ReturnAddress) {
             vm.ApplyReturnAddress (maybeRa.ReturnAddressValue);
         } else {
             Utils.Panic ();
         }
     }
     vm.stack.Push (result);
     vm.IncrementCells (1);
 }
示例#2
0
文件: Vm.cs 项目: mbrezu/Shovel
 static void HandleReturn(Vm vm)
 {
     // SLOW: maybe there's a faster way to manipulate the stack here?
     var result = vm.stack.PopTop ();
     var maybeRa = vm.stack.PopTop ();
     if (maybeRa.Kind == Value.Kinds.ReturnAddress) {
         vm.ApplyReturnAddress (maybeRa.ReturnAddressValue);
     } else {
         Utils.Panic ();
     }
     vm.stack.Push (result);
 }