func executeMethod(thread *Thread, method *heap.Method) { frame := thread.NewFrame(method) thread.PushFrame(frame) defer catchErr(frame) // recover from panics codeAttr := method.GetCodeAttribute() pc := thread.PC() vars := frame.LocalVars() stack := frame.OperandStack() for { opcode := codeAttr.Code[pc] inst := instructions.NewInstruction(opcode) inst.FetchOperands(codeAttr, pc) thread.SetPC(pc) inst.Execute(vars, stack) if thread.IsStackEmpty() { break } pc = thread.PC() } }
func (frame *Frame) EvaluatingTop() *heap.Object { return frame.operandStack.Top() }This code simply returns the top value on the frame's operand stack. Overall, the `Frame` method is an important tool for managing execution and data storage in the RTDA package library.