本文整理汇总了Golang中github.com/zxh0/jvm/go/jvmgo/jvm/rtda.Frame.RevertNextPC方法的典型用法代码示例。如果您正苦于以下问题:Golang Frame.RevertNextPC方法的具体用法?Golang Frame.RevertNextPC怎么用?Golang Frame.RevertNextPC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/zxh0/jvm/go/jvmgo/jvm/rtda.Frame
的用法示例。
在下文中一共展示了Frame.RevertNextPC方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Execute
func (self *monitorenter) Execute(frame *rtda.Frame) {
thread := frame.Thread()
ref := frame.OperandStack().PopRef()
if ref == nil {
frame.RevertNextPC()
thread.ThrowNPE()
} else {
ref.Monitor().Enter(thread)
}
}
示例2: invoke0
// private static native Object invoke0(Method method, Object o, Object[] os);
// (Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
func invoke0(frame *rtda.Frame) {
stack := frame.OperandStack()
if stack.IsEmpty() {
frame.RevertNextPC()
_invokeMethod(frame)
} else {
returnType := frame.LocalVars().Get(0).(*rtc.FieldType)
if returnType.IsBaseType() && !returnType.IsVoidType() {
primitiveDescriptor := returnType.Descriptor()[0]
box.Box(frame, primitiveDescriptor) // todo
}
}
}
示例3: getConstantPool
// native ConstantPool getConstantPool();
// ()Lsun/reflect/ConstantPool;
func getConstantPool(frame *rtda.Frame) {
class := _popClass(frame)
cpClass := rtc.BootLoader().LoadClass("sun/reflect/ConstantPool")
if cpClass.InitializationNotStarted() {
frame.RevertNextPC()
frame.Thread().InitClass(cpClass)
return
}
cp := class.ConstantPool()
cpObj := cpClass.NewObjWithExtra(cp) // todo init cpObj
frame.OperandStack().PushRef(cpObj)
}
示例4: ensureClassInitialized
// public native void ensureClassInitialized(Class<?> c);
// (Ljava/lang/Class;)V
func ensureClassInitialized(frame *rtda.Frame) {
vars := frame.LocalVars()
// this := vars.GetRef(0)
classObj := vars.GetRef(1)
goClass := classObj.Extra().(*rtc.Class)
if goClass.InitializationNotStarted() {
// undo ensureClassInitialized()
frame.RevertNextPC()
// init
frame.Thread().InitClass(goClass)
}
}
示例5: defineClass0
// private static native Class<?> defineClass0(ClassLoader loader, String name,
// byte[] b, int off, int len);
// (Ljava/lang/ClassLoader;Ljava/lang/String;[BII)Ljava/lang/Class;
func defineClass0(frame *rtda.Frame) {
stack := frame.OperandStack()
if stack.IsEmpty() {
_loadClass(frame)
}
// init class
class := stack.TopRef(0).Extra().(*rtc.Class)
if class.InitializationNotStarted() {
frame.RevertNextPC()
frame.Thread().InitClass(class)
}
}
示例6: createLong
// public native ByteBuffer createLong(String name, int variability, int units, long value);
// (Ljava/lang/String;IIJ)Ljava/nio/ByteBuffer;
func createLong(frame *rtda.Frame) {
bbClass := frame.ClassLoader().LoadClass("java/nio/ByteBuffer")
if bbClass.InitializationNotStarted() {
frame.RevertNextPC()
frame.Thread().InitClass(bbClass)
return
}
stack := frame.OperandStack()
stack.PushInt(8)
allocate := bbClass.GetStaticMethod("allocate", "(I)Ljava/nio/ByteBuffer;")
frame.Thread().InvokeMethod(allocate)
}
示例7: 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)
}
示例8: Execute
func (self *putstatic) Execute(frame *rtda.Frame) {
if self.field == nil {
cp := frame.Method().Class().ConstantPool()
kFieldRef := cp.GetConstant(self.index).(*rtc.ConstantFieldref)
self.field = kFieldRef.StaticField()
}
class := self.field.Class()
if class.InitializationNotStarted() {
frame.RevertNextPC()
frame.Thread().InitClass(class)
return
}
val := frame.OperandStack().PopField(self.field.IsLongOrDouble)
self.field.PutStaticValue(val)
}
示例9: _invokeMethod
func _invokeMethod(frame *rtda.Frame) {
vars := frame.LocalVars()
methodObj := vars.GetRef(0)
obj := vars.GetRef(1)
argArrObj := vars.GetRef(2)
goMethod := getGoMethod(methodObj)
if goMethod.IsStatic() {
if goMethod.Class().InitializationNotStarted() {
frame.RevertNextPC()
frame.Thread().InitClass(goMethod.Class())
return
}
}
if goMethod.IsAbstract() {
goMethod = obj.Class().GetInstanceMethod(goMethod.Name(), goMethod.Descriptor())
}
args := convertArgs(obj, argArrObj, goMethod)
// remember return type
returnType := goMethod.ParsedDescriptor().ReturnType()
vars.Set(0, returnType)
stack := frame.OperandStack()
if len(args) > 1 {
stack.HackSetSlots(args)
} else if len(args) > 0 {
// make room for return value
stack.HackSetSlots([]Any{args[0], nil})
stack.PopRef()
} else {
// make room for return value
stack.HackSetSlots([]Any{nil, nil})
stack.PopRef()
stack.PopRef()
}
frame.Thread().InvokeMethod(goMethod)
if returnType.IsVoidType() {
stack.PushNull()
}
}
示例10: newInstance0
// private static native Object newInstance0(Constructor<?> c, Object[] os)
// throws InstantiationException, IllegalArgumentException, InvocationTargetException;
// (Ljava/lang/reflect/Constructor;[Ljava/lang/Object;)Ljava/lang/Object;
func newInstance0(frame *rtda.Frame) {
vars := frame.LocalVars()
constructorObj := vars.GetRef(0)
argArrObj := vars.GetRef(1)
goConstructor := getGoConstructor(constructorObj)
goClass := goConstructor.Class()
if goClass.InitializationNotStarted() {
frame.RevertNextPC()
frame.Thread().InitClass(goClass)
return
}
obj := goClass.NewObj()
stack := frame.OperandStack()
stack.PushRef(obj)
// call <init>
args := convertArgs(obj, argArrObj, goConstructor)
frame.Thread().InvokeMethodWithShim(goConstructor, args)
}
示例11: Execute
func (self *invokestatic) Execute(frame *rtda.Frame) {
if self.method == nil {
cp := frame.Method().Class().ConstantPool()
k := cp.GetConstant(self.index)
if kMethodRef, ok := k.(*rtc.ConstantMethodref); ok {
self.method = kMethodRef.StaticMethod()
} else {
self.method = k.(*rtc.ConstantInterfaceMethodref).StaticMethod()
}
}
// init class
class := self.method.Class()
if class.InitializationNotStarted() {
frame.RevertNextPC()
frame.Thread().InitClass(class)
return
}
frame.Thread().InvokeMethod(self.method)
}