本文整理汇总了C#中StackFrame.getLocalVariables方法的典型用法代码示例。如果您正苦于以下问题:C# StackFrame.getLocalVariables方法的具体用法?C# StackFrame.getLocalVariables怎么用?C# StackFrame.getLocalVariables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StackFrame
的用法示例。
在下文中一共展示了StackFrame.getLocalVariables方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: execute
public override void execute(StackFrame frame)
{
ClassFile clazz = ToyVMClassLoader.loadClass(method.GetClassInfo().getClassName());
ConstantPoolInfo_NameAndType nameAndType = method.GetMethodNameAndType();
if (log.IsDebugEnabled) log.DebugFormat("Will be executing {0} on {1}",nameAndType,clazz.GetName());
MethodInfo methodInfo = clazz.getMethod(nameAndType);
// TODO: Need better way of handling access to the method
if (methodInfo == null){
throw new ToyVMException("Unable to locate method " + nameAndType + " on " + clazz,frame);
}
StackFrame frame2 = new StackFrame(frame);
int paramCount = method.getParameterCount();
frame2.setMethod(clazz,methodInfo,paramCount);
if (log.IsDebugEnabled) log.DebugFormat("Have {0} parameters",paramCount);
// Store the parameters from the operand stack
// into the local variables of the outgoing frame
for (int i = paramCount; i > 0; i--){
frame2.getLocalVariables()[i-1]=frame.popOperand();
if (log.IsDebugEnabled) log.DebugFormat("Parameter {0} = {1}",i,frame2.getLocalVariables()[i-1]);
}
clazz.execute(nameAndType,frame2);
/*methodInfo.execute(frame2);
if (methodInfo != null){
}
else {
throw new Exception("Unable to locate " + nameAndType.ToString());
}
*/
}
示例2: execute
/**
*
* Operand stack
* ..., objectref, [arg1, [arg2 ...]] ...
*/
public override void execute(StackFrame frame)
{
ClassFile clazz = ToyVMClassLoader.loadClass(method.GetClassInfo().getClassName());
ConstantPoolInfo_NameAndType nameAndType = method.GetMethodNameAndType();
if (log.IsDebugEnabled) log.DebugFormat("Will be executing {0} on {1}",nameAndType,clazz.GetName());
MethodInfo methodInfo = clazz.getMethod(nameAndType);
StackFrame frame2 = new StackFrame(frame);
int paramCount = method.getParameterCount();
frame2.setMethod(clazz,methodInfo,paramCount);
if (log.IsDebugEnabled) log.DebugFormat("Have {0} parameters",paramCount);
if (log.IsDebugEnabled) log.DebugFormat("Max Locals: {0}",methodInfo.getMaxLocals());
// push "this" as local variable 0
//frame2.setThis((ToyVMObject)(frame2.getLocalVariables()[0]));
// Store the parameters from the operand stack
// into the local variables of the outgoing frame
for (int i = paramCount;i >= 0; i--){
frame2.getLocalVariables()[i]=frame.popOperand();
if (log.IsDebugEnabled) log.DebugFormat("Set variable {0}={1}",(i),frame2.getLocalVariables()[i]);
}
clazz.execute(nameAndType,frame2);
//Environment.Exit(0);
}
示例3: execute
public override void execute(StackFrame frame)
{
try {
frame.pushOperand((int) frame.getLocalVariables()[index]);
}
catch (InvalidCastException e){
foreach (Object o in frame.getLocalVariables()){
if (log.IsDebugEnabled) log.DebugFormat("Var:{0}",o);
}
throw new ToyVMException("Wanted int at " + index + " but got " + frame.getLocalVariables()[index],e,frame);
}
}
示例4: execute
public override void execute(StackFrame frame)
{
try {
//if (log.IsDebugEnabled) log.DebugFormat("Local variable {0} is {1}",index,frame.getLocalVariables()[index]);
frame.pushOperand(frame.getLocalVariables()[index]);
}
catch (Exception e){
throw new ToyVMException("Index is " + index,e,frame);
}
}
示例5: execute
/**
*
* Operand stack
* ..., objectref, [arg1, [arg2 ...]] ...
*/
public override void execute(StackFrame frame)
{
//ClassFile clazz = ToyVMClassLoader.loadClass(method.GetClassInfo().getClassName());
ConstantPoolInfo_NameAndType nameAndType = method.GetMethodNameAndType();
if (log.IsDebugEnabled) log.DebugFormat("Will be executing {0} on interface {1}",nameAndType,method.GetClassInfo().getClassName());
int paramCount = method.getParameterCount();
ArrayList locals = new ArrayList();
for (int i = 0; i <= paramCount; i++){
locals.Add(0);
}
// create temp version of the variables
// so that we can get to the object
// on the stack
for (int i = paramCount; i >= 0; i--){
locals[i] = frame.popOperand();
}
ClassFile clazz = ((Heap.HeapReference)locals[0]).type;
StackFrame frame2 = new StackFrame(frame);
frame2.setMethod(clazz,clazz.getMethod(nameAndType));
if (log.IsDebugEnabled) log.DebugFormat("Have {0} parameters",paramCount);
for (int i = 0;i <= paramCount; i++){
frame2.getLocalVariables()[i] = locals[i];
}
clazz.execute(nameAndType,frame2);
//Environment.Exit(0);
}
示例6: execute
/**
*
* Operand stack
* ..., objectref, [arg1, [arg2 ...]] ...
*/
public override void execute(StackFrame frame)
{
ConstantPoolInfo_NameAndType nameAndType = method.GetMethodNameAndType();
if (log.IsDebugEnabled) log.DebugFormat("Will be executing {0} on class {1}",nameAndType,method.GetClassInfo().getClassName());
int paramCount = method.getParameterCount();
ArrayList locals = new ArrayList();
for (int i = 0; i <= paramCount; i++){
locals.Add(0);
}
// create temp version of the variables
// so that we can get to the object
// on the stack
for (int i = paramCount; i >= 0; i--){
locals[i] = frame.popOperand();
if (log.IsDebugEnabled) log.DebugFormat("Parameter {0} is {1}",i,locals[i]);
}
ClassFile clazz = null;
// for Object::getClass we actually
// push the ClassFile onto the stack
if (locals[0] is Heap.HeapReference){
clazz = ((Heap.HeapReference)locals[0]).type;
}
else if (locals[0] is ClassFile){
clazz = (ClassFile) locals[0];
}
StackFrame frame2 = new StackFrame(frame);
frame2.setMethod(clazz,clazz.getMethod(nameAndType));
if (log.IsDebugEnabled) log.DebugFormat("Have {0} parameters",paramCount);
for (int i = 0;i <= paramCount; i++){
frame2.getLocalVariables()[i] = locals[i];
}
clazz.execute(nameAndType,frame2);
/*
ClassFile clazz = ToyVMClassLoader.loadClass(method.GetClassInfo().getClassName());
ConstantPoolInfo_NameAndType nameAndType = method.GetMethodNameAndType();
if (log.IsDebugEnabled) log.DebugFormat("Will be executing {0} on {1}",nameAndType,clazz.GetName());
StackFrame frame2 = new StackFrame(frame);
frame2.setMethod(clazz,clazz.getMethod(nameAndType));
int paramCount = method.getParameterCount();
if (log.IsDebugEnabled) log.DebugFormat("Have {0} parameters",paramCount);
// push "this" as local variable 0
// Store the parameters from the operand stack
// into the local variables of the outgoing frame
for (int i = paramCount;i >= 0; i--){
frame2.getLocalVariables()[i]=frame.popOperand();
if (log.IsDebugEnabled) log.DebugFormat("Set variable {0}={1}",(i),frame2.getLocalVariables()[i]);
}
//frame2.getLocalVariables().Insert(0,frame.popOperand());
clazz.execute(nameAndType,frame2);
*/
//Environment.Exit(0);
}
示例7: execute
public override void execute(StackFrame frame)
{
frame.getLocalVariables().Insert(index,frame.popOperand());
}
示例8: execute
public override void execute(StackFrame frame)
{
int old = (int)frame.getLocalVariables()[index];
frame.getLocalVariables()[index] = old + constant;
}
示例9: execute
/**
* Value at index should be of type returnAddress, but we just use int
*/
public override void execute(StackFrame frame)
{
int pc = (int) frame.getLocalVariables()[index];
frame.setProgramCounter(pc - size); // we have to decrement because executor will add
}