Esempio n. 1
0
func newFrame(thread *Thread, method *rtc.Method) *Frame {
	return &Frame{
		thread:       thread,
		method:       method,
		maxLocals:    method.MaxLocals(),
		maxStack:     method.MaxStack(),
		localVars:    newLocalVars(method.MaxLocals()),
		operandStack: newOperandStack(method.MaxStack()),
	}
}
Esempio n. 2
0
func (self *FrameCache) borrowFrame(method *rtc.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)
}