本文整理汇总了Golang中github.com/zxh0/jvm/go/jvmgo/jvm/rtda.Frame.SetNextPC方法的典型用法代码示例。如果您正苦于以下问题:Golang Frame.SetNextPC方法的具体用法?Golang Frame.SetNextPC怎么用?Golang Frame.SetNextPC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/zxh0/jvm/go/jvmgo/jvm/rtda.Frame
的用法示例。
在下文中一共展示了Frame.SetNextPC方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: getFileSystem
// public static native FileSystem getFileSystem()
// ()Ljava/io/FileSystem;
func getFileSystem(frame *rtda.Frame) {
thread := frame.Thread()
unixFsClass := frame.ClassLoader().LoadClass("java/io/UnixFileSystem")
if unixFsClass.InitializationNotStarted() {
frame.SetNextPC(thread.PC()) // undo getFileSystem
thread.InitClass(unixFsClass)
return
}
stack := frame.OperandStack()
unixFsObj := unixFsClass.NewObj()
stack.PushRef(unixFsObj)
// call <init>
stack.PushRef(unixFsObj) // this
constructor := unixFsClass.GetDefaultConstructor()
thread.InvokeMethod(constructor)
}
示例2: forName0
// private static native Class<?> forName0(String name, boolean initialize,
// ClassLoader loader,
// Class<?> caller)
// throws ClassNotFoundException;
// (Ljava/lang/String;ZLjava/lang/ClassLoader;Ljava/lang/Class;)Ljava/lang/Class;
func forName0(frame *rtda.Frame) {
vars := frame.LocalVars()
jName := vars.GetRef(0)
initialize := vars.GetBoolean(1)
//jLoader := vars.GetRef(2)
goName := rtda.GoString(jName)
goName = jutil.ReplaceAll(goName, ".", "/")
goClass := frame.ClassLoader().LoadClass(goName)
jClass := goClass.JClass()
if initialize && goClass.InitializationNotStarted() {
// undo forName0
thread := frame.Thread()
frame.SetNextPC(thread.PC())
// init class
thread.InitClass(goClass)
} else {
stack := frame.OperandStack()
stack.PushRef(jClass)
}
}
示例3: Execute
func (self *anewarray) Execute(frame *rtda.Frame) {
cp := frame.ConstantPool()
kClass := cp.GetConstant(self.index).(*rtc.ConstantClass)
componentClass := kClass.Class()
if componentClass.InitializationNotStarted() {
thread := frame.Thread()
frame.SetNextPC(thread.PC()) // undo anewarray
thread.InitClass(componentClass)
return
}
stack := frame.OperandStack()
count := stack.PopInt()
if count < 0 {
frame.Thread().ThrowNegativeArraySizeException()
} else {
arr := rtc.NewRefArray(componentClass, uint(count))
stack.PushRef(arr)
}
}
示例4: branch
func branch(frame *rtda.Frame, offset int) {
nextPC := frame.Thread().PC() + offset
frame.SetNextPC(nextPC)
}