本文整理汇总了Golang中github.com/zxh0/jvm/go/jvmgo/jvm/rtda/class.Method.ArgSlotCount方法的典型用法代码示例。如果您正苦于以下问题:Golang Method.ArgSlotCount方法的具体用法?Golang Method.ArgSlotCount怎么用?Golang Method.ArgSlotCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/zxh0/jvm/go/jvmgo/jvm/rtda/class.Method
的用法示例。
在下文中一共展示了Method.ArgSlotCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: InvokeMethod
func (self *Thread) InvokeMethod(method *rtc.Method) {
//self._logInvoke(self.stack.size, method)
currentFrame := self.CurrentFrame()
newFrame := self.NewFrame(method)
self.PushFrame(newFrame)
argSlotsCount := method.ArgSlotCount()
if argSlotsCount > 0 {
_passArgs(currentFrame.operandStack, newFrame.localVars, argSlotsCount)
}
if method.IsSynchronized() {
var monitor *rtc.Monitor
if method.IsStatic() {
classObj := method.Class().JClass()
monitor = classObj.Monitor()
} else {
thisObj := newFrame.LocalVars().GetThis()
monitor = thisObj.Monitor()
}
monitor.Enter(self)
newFrame.SetOnPopAction(func() {
monitor.Exit(self)
})
}
}
示例2: newNativeFrame
func newNativeFrame(thread *Thread, method *rtc.Method) *Frame {
frame := &Frame{}
frame.thread = thread
frame.method = method
frame.localVars = newLocalVars(method.ArgSlotCount()) // todo
frame.operandStack = newOperandStack(4) // todo
code := method.Code()
if code == nil {
code = getHackCode(method.Descriptor())
method.HackSetCode(code)
}
return frame
}
示例3: convertArgs
// Object[] -> []Any
func convertArgs(this, argArr *rtc.Obj, method *rtc.Method) []Any {
if method.ArgSlotCount() == 0 {
return nil
}
if method.ArgSlotCount() == 1 && !method.IsStatic() {
return []Any{this}
}
argObjs := argArr.Refs()
argTypes := method.ParsedDescriptor().ParameterTypes()
args := make([]Any, method.ArgSlotCount())
j := 0
if !method.IsStatic() {
args[0] = this
j = 1
}
for i, argType := range argTypes {
argObj := argObjs[i]
if argType.IsBaseType() {
// todo
unboxed := box.Unbox(argObj, argType.Descriptor())
args[i+j] = unboxed
if argType.IsLongOrDouble() {
j++
}
} else {
args[i+j] = argObj
}
}
return args
}