本文整理汇总了Golang中github.com/zxh0/jvm/go/jvmgo/jvm/rtda.Frame.ConstantPool方法的典型用法代码示例。如果您正苦于以下问题:Golang Frame.ConstantPool方法的具体用法?Golang Frame.ConstantPool怎么用?Golang Frame.ConstantPool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/zxh0/jvm/go/jvmgo/jvm/rtda.Frame
的用法示例。
在下文中一共展示了Frame.ConstantPool方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Execute
func (self *multianewarray) Execute(frame *rtda.Frame) {
cp := frame.ConstantPool()
kClass := cp.GetConstant(uint(self.index)).(*rtc.ConstantClass)
arrClass := kClass.Class()
stack := frame.OperandStack()
counts := stack.PopTops(uint(self.dimensions))
if !_checkCounts(counts) {
frame.Thread().ThrowNegativeArraySizeException()
} else {
arr := _newMultiArray(counts, arrClass)
stack.PushRef(arr)
}
}
示例2: Execute
func (self *ldc2_w) Execute(frame *rtda.Frame) {
stack := frame.OperandStack()
cp := frame.ConstantPool()
c := cp.GetConstant(self.index)
switch c.(type) {
case int64:
stack.PushLong(c.(int64))
case float64:
stack.PushDouble(c.(float64))
default:
jutil.Panicf("ldc2_w! %v", c)
}
}
示例3: Execute
func (self *instanceof) Execute(frame *rtda.Frame) {
stack := frame.OperandStack()
ref := stack.PopRef()
cp := frame.ConstantPool()
kClass := cp.GetConstant(self.index).(*rtc.ConstantClass)
class := kClass.Class()
if ref == nil {
stack.PushInt(0)
} else if ref.IsInstanceOf(class) {
stack.PushInt(1)
} else {
stack.PushInt(0)
}
}
示例4: Execute
func (self *new_) Execute(frame *rtda.Frame) {
if self.class == nil {
cp := frame.ConstantPool()
kClass := cp.GetConstant(self.index).(*rtc.ConstantClass)
self.class = kClass.Class()
}
// init class
if self.class.InitializationNotStarted() {
frame.RevertNextPC() // undo new
frame.Thread().InitClass(self.class)
return
}
ref := self.class.NewObj()
frame.OperandStack().PushRef(ref)
}
示例5: _ldc
func _ldc(frame *rtda.Frame, index uint) {
stack := frame.OperandStack()
cp := frame.ConstantPool()
c := cp.GetConstant(index)
switch c.(type) {
case int32:
stack.PushInt(c.(int32))
case float32:
stack.PushFloat(c.(float32))
case string:
internedStr := rtda.JString(c.(string))
stack.PushRef(internedStr)
case *rtc.ConstantClass:
kClass := c.(*rtc.ConstantClass)
classObj := kClass.Class().JClass()
stack.PushRef(classObj)
default:
// todo
// ref to MethodType or MethodHandle
jutil.Panicf("todo: ldc! %v", c)
}
}