本文整理汇总了C#中StackFrame.popOperand方法的典型用法代码示例。如果您正苦于以下问题:C# StackFrame.popOperand方法的具体用法?C# StackFrame.popOperand怎么用?C# StackFrame.popOperand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StackFrame
的用法示例。
在下文中一共展示了StackFrame.popOperand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: execute
public override void execute(StackFrame frame)
{
Object val2 = frame.popOperand();
Object val1 = frame.popOperand();
//Heap.HeapReference val2 = (Heap.HeapReference) frame.popOperand();
//Heap.HeapReference val1 = (Heap.HeapReference) frame.popOperand();
bool eval = false;
switch (opval){
case OP_EQ:{
eval = (val1 == val2);
break;
}
case OP_NE:{
eval = (val1 != val2);
break;
}
default: throw new ToyVMException("Not handling " + opval,frame);
}
if (eval){
int pc = frame.getProgramCounter();
frame.setProgramCounter(pc + branch - size);
}
}
示例2: execute
public override void execute(StackFrame frame)
{
float val1 = (float) frame.popOperand();
float val2 = (float) frame.popOperand();
frame.pushOperand(val1 + val2);
}
示例3: execute
public override void execute(StackFrame frame)
{
double val1 = (double) frame.popOperand();
double val2 = (double) frame.popOperand();
frame.pushOperand(val2 - val1);
}
示例4: execute
public override void execute(StackFrame frame)
{
long val1 = (long) frame.popOperand();
long val2 = (long) frame.popOperand();
frame.pushOperand(val1 & val2);
}
示例5: execute
public override void execute(StackFrame frame)
{
frame.popOperand();
if (count == 2){
frame.popOperand();
}
}
示例6: execute
public override void execute(StackFrame frame)
{
int val1 = (int) frame.popOperand();
int val2 = (int) frame.popOperand();
frame.pushOperand(val1 & val2);
}
示例7: execute
public override void execute(StackFrame frame)
{
if (depth > 0){
throw new ToyVMException("Don't support dup2 with depth of " + depth,frame);
}
Object obj = frame.popOperand();
Object obj2 = null;
if (frame.hasMoreOperands()){
obj2 = frame.popOperand();
}
/*System.Collections.Stack temp = new System.Collections.Stack();
for (int i = 0; i < depth; i++){
temp.Push(frame.popOperand());
}
frame.pushOperand(obj); // insert at depth depth
while (temp.Count > 0){
frame.pushOperand(temp.Pop());
}
*/
frame.pushOperand(obj); // put the duplicated one back on top
if (obj2 != null){
frame.pushOperand(obj2);
}
frame.pushOperand(obj); // put the duplicated one back on top
if (obj2 != null){
frame.pushOperand(obj2);
}
}
示例8: execute
public override void execute(StackFrame frame)
{
Object val = frame.popOperand();
int index = (int) frame.popOperand();
Heap.HeapReference heapRef = (Heap.HeapReference) frame.popOperand();
if (! heapRef.isArray){
throw new ToyVMException("Expected array, got " + heapRef,frame);
}
if (! heapRef.isPrimitive){
ArrayList arr = (ArrayList) heapRef.obj;
arr[index] = val;
}
else if (heapRef.primitiveType.Equals(Type.GetType("System.Char[]"))){
ArrayList arr = (ArrayList) heapRef.obj;
arr[index] = val;
//System.Char[][] arr = (System.Char[][]) heapRef.obj;
//Heap.HeapReference arrVal = (Heap.HeapReference)val;
//arr[index] = (System.Char[])arrVal.obj;
}
else {
throw new ToyVMException("Can't handle " + heapRef,frame);
}
if (log.IsDebugEnabled) log.DebugFormat("Stored {0} at index {1}",val,index);
}
示例9: execute
// value1,value2 => ...
public override void execute(StackFrame frame)
{
int value2 = (int) frame.popOperand();
int value1 = (int) frame.popOperand();
frame.pushOperand(value1 - (value1 / value2) * value2);
// TODO: something is broken up higher
//frame.pushOperand(0);
}
示例10: execute
/**
* Left shift val1 by amount in low 5 bits of val2
*/
public override void execute(StackFrame frame)
{
long val2 = (long) frame.popOperand();
long val1 = (long) frame.popOperand();
val1 = (0xFFFFFFFF & ((val1 << (int)(val2 & 0x3F))));
frame.pushOperand(val1);
}
示例11: execute
/**
* Right shift val1 by amount in low 5 bits of val2
*/
public override void execute(StackFrame frame)
{
int val2 = (int) frame.popOperand();
int val1 = (int) frame.popOperand();
val1 = (0xFFFF & ((val1 >> (val2 & 0x1F))));
frame.pushOperand(val1);
}
示例12: execute
public override void execute(StackFrame frame)
{
float val1 = Single.Parse(frame.popOperand().ToString());
float val2 = Single.Parse(frame.popOperand().ToString());
//if (log.IsDebugEnabled) log.DebugFormat("val1 is {0}",val1.GetType());
//if (log.IsDebugEnabled) log.DebugFormat("val2 is {0}",val2.GetType());
frame.pushOperand((float)val1 * (float)val2);
}
示例13: execute
public override void execute(StackFrame frame)
{
float value2 = Single.Parse(frame.popOperand().ToString());
float value1 = Single.Parse(frame.popOperand().ToString());
// TODO: handle NaN
if (value1 > value2) { frame.pushOperand(1); }
else if (value1.Equals(value2)) { frame.pushOperand(0); }
else { frame.pushOperand(-1); }
}
示例14: execute
public override void execute(StackFrame frame)
{
double val1 = Double.Parse(frame.popOperand().ToString());
double val2 = Double.Parse(frame.popOperand().ToString());
//if (log.IsDebugEnabled) log.DebugFormat("val1 is {0}",val1.GetType());
//if (log.IsDebugEnabled) log.DebugFormat("val2 is {0}",val2.GetType());
frame.pushOperand(val1 * val2);
}
示例15: execute
/**
* Grabs a character from the array and pushes onto stack as an integer
*/
public override void execute(StackFrame frame)
{
int index = (int) frame.popOperand();
Heap.HeapReference heapRef = (Heap.HeapReference) frame.popOperand();
if (! heapRef.isArray){
throw new ToyVMException("Expected array, got " + heapRef,frame);
}
System.Char[] arr = (System.Char[]) heapRef.obj;
frame.pushOperand((int)arr[index]);
}