本文整理汇总了Golang中github.com/zxh0/jvm/go/jvmgo/jvm/rtda.Frame类的典型用法代码示例。如果您正苦于以下问题:Golang Frame类的具体用法?Golang Frame怎么用?Golang Frame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Frame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: psi_socketConnect
// native void socketConnect(InetAddress address, int port, int timeout)
// throws IOException;
func psi_socketConnect(frame *rtda.Frame) {
vars := frame.LocalVars()
this := vars.GetThis()
address := vars.GetRef(1)
port := vars.Get(2)
holder := address.GetFieldValue("holder", "Ljava/net/InetAddress$InetAddressHolder;").(*rtc.Obj)
//fmt.Println(address.Class().GetInstanceMethod("getHostAddress", "()Ljava/lang/String;").NativeMethod())
add := holder.GetFieldValue("address", "I").(int32)
b := make([]byte, 4)
binary.BigEndian.PutUint32(b, uint32(add))
laddr := fmt.Sprintf("%d.%d.%d.%d:%d", b[0], b[1], b[2], b[3], port)
conn, err := net.Dial("tcp", laddr)
if err != nil {
frame.Thread().ThrowIOException(err.Error())
}
//TODO what ? timeout how to implement ?
_timeout := vars.GetInt(3)
if _timeout > 0 {
conn.SetDeadline(time.Now().Add(time.Duration(_timeout) * time.Millisecond))
}
fdObj := this.GetFieldValue("fd", "Ljava/io/FileDescriptor;").(*rtc.Obj)
fdObj.SetExtra(conn)
}
示例2: getModifiers
// public native int getModifiers();
// ()I
func getModifiers(frame *rtda.Frame) {
class := _popClass(frame)
modifiers := class.GetAccessFlags()
stack := frame.OperandStack()
stack.PushInt(int32(modifiers))
}
示例3: Execute
func (self *lreturn) Execute(frame *rtda.Frame) {
thread := frame.Thread()
currentFrame := thread.PopFrame()
invokerFrame := thread.TopFrame()
val := currentFrame.OperandStack().PopLong()
invokerFrame.OperandStack().PushLong(val)
}
示例4: Execute
func (self *dadd) Execute(frame *rtda.Frame) {
stack := frame.OperandStack()
v1 := stack.PopDouble()
v2 := stack.PopDouble()
result := v1 + v2
stack.PushDouble(result)
}
示例5: Execute
func (self *lxor) Execute(frame *rtda.Frame) {
stack := frame.OperandStack()
v1 := stack.PopLong()
v2 := stack.PopLong()
result := v1 ^ v2
stack.PushLong(result)
}
示例6: getUptime0
// private native long getUptime0();
// ()J
func getUptime0(frame *rtda.Frame) {
// todo
uptime := int64(0)
stack := frame.OperandStack()
stack.PushLong(uptime)
}
示例7: getVersion0
// private static native String getVersion0();
// ()Ljava/lang/String;
func getVersion0(frame *rtda.Frame) {
// todo
version := rtda.JString("0")
stack := frame.OperandStack()
stack.PushRef(version)
}
示例8: arraycopy
// public static native void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
// (Ljava/lang/Object;ILjava/lang/Object;II)V
func arraycopy(frame *rtda.Frame) {
vars := frame.LocalVars()
src := vars.GetRef(0)
srcPos := vars.GetInt(1)
dest := vars.GetRef(2)
destPos := vars.GetInt(3)
length := vars.GetInt(4)
// NullPointerException
if src == nil || dest == nil {
panic("NPE") // todo
}
// ArrayStoreException
if !checkArrayCopy(src, dest) {
panic("ArrayStoreException")
}
// IndexOutOfBoundsException
if srcPos < 0 || destPos < 0 || length < 0 ||
srcPos+length > rtc.ArrayLength(src) ||
destPos+length > rtc.ArrayLength(dest) {
panic("IndexOutOfBoundsException") // todo
}
rtc.ArrayCopy(src, dest, srcPos, destPos, length)
}
示例9: getEntryFlag
// private static native int getEntryFlag(long jzentry);
// (J)I
func getEntryFlag(frame *rtda.Frame) {
entry := _getEntryPop(frame)
flag := int32(entry.Flags)
stack := frame.OperandStack()
stack.PushInt(flag)
}
示例10: setIn0
// private static native void setIn0(InputStream in);
// (Ljava/io/InputStream;)V
func setIn0(frame *rtda.Frame) {
vars := frame.LocalVars()
in := vars.GetRef(0)
sysClass := frame.Method().Class()
sysClass.SetStaticValue("in", "Ljava/io/InputStream;", in)
}
示例11: setOut0
// private static native void setOut0(PrintStream out);
// (Ljava/io/PrintStream;)V
func setOut0(frame *rtda.Frame) {
vars := frame.LocalVars()
out := vars.GetRef(0)
sysClass := frame.Method().Class()
sysClass.SetStaticValue("out", "Ljava/io/PrintStream;", out)
}
示例12: setErr0
// private static native void setErr0(PrintStream err);
// (Ljava/io/PrintStream;)V
func setErr0(frame *rtda.Frame) {
vars := frame.LocalVars()
err := vars.GetRef(0)
sysClass := frame.Method().Class()
sysClass.SetStaticValue("err", "Ljava/io/PrintStream;", err)
}
示例13: Execute
func (self *frem) Execute(frame *rtda.Frame) {
stack := frame.OperandStack()
v2 := stack.PopFloat()
v1 := stack.PopFloat()
result := float32(math.Mod(float64(v1), float64(v2))) // todo
stack.PushFloat(result)
}
示例14: Execute
func (self *swap) Execute(frame *rtda.Frame) {
stack := frame.OperandStack()
val1 := stack.PopSlot()
val2 := stack.PopSlot()
stack.PushSlot(val1)
stack.PushSlot(val2)
}
示例15: getEntryCrc
// private static native long getEntryCrc(long jzentry);
// (J)J
func getEntryCrc(frame *rtda.Frame) {
entry := _getEntryPop(frame)
crc := int64(entry.CRC32)
stack := frame.OperandStack()
stack.PushLong(crc)
}