public GSharpObject InvokeMethod(GSharpMethod method, StackFrame frame, GSharpObject self, GSharpObject[] arguments) { Stack.NewFrame(frame); int insCount = method.Body.Count; int i = 0; foreach (string param in method.Parameters.Keys) { Stack.StoreLocal(method.Parameters[param], arguments[i++]); } StackFrame top = Stack.Top; while (top.InstructionPointer < insCount && !top.AbortExecution) { Instruction currInstr = method.Body[Stack.InstructionPointer++]; ExecuteInstruction(currInstr); } if (top.AbortExecution) { return(null); } GSharpObject retVal = Stack.Pop(); Stack.EndFrame(); return(retVal); }
public StackFrame(int localCount, GSharpMethod method, GSharpObject self) { LocalCount = localCount; Method = method; Module = method.Module; Self = self; locals = new GSharpObject[localCount]; }
public void AddMethod(GSharpMethod method) { SetAttribute(method.Name, method); }
public void NewFrame(int localCount, GSharpMethod method, GSharpObject self) { Frames++; top = new StackFrame(localCount, method, self); frames.Push(top); }
public InstanceMethodCallback(GSharpMethod method, GSharpObject self) : base("Instance Method Callback") { Method = method; this.self = self; }