Exemplo n.º 1
0
func newFrame(thread *Thread, method *heap.Method) *Frame {
	return &Frame{
		thread:       thread,
		method:       method,
		maxLocals:    method.MaxLocals(),
		maxStack:     method.MaxStack(),
		localVars:    newLocalVars(method.MaxLocals()),
		operandStack: newOperandStack(method.MaxStack()),
	}
}
Exemplo n.º 2
0
func (self *FrameCache) borrowFrame(method *heap.Method) *Frame {
	if self.frameCount > 0 {
		for i, frame := range self.cachedFrames {
			if frame != nil &&
				frame.maxLocals >= method.MaxLocals() &&
				frame.maxStack >= method.MaxStack() {

				self.frameCount--
				self.cachedFrames[i] = nil
				frame.reset(method)
				return frame
			}
		}
	}
	return newFrame(self.thread, method)
}