本文整理汇总了Golang中github.com/zxh0/jvm/go/jvmgo/jvm/rtda.Frame类的典型用法代码示例。如果您正苦于以下问题:Golang Frame类的具体用法?Golang Frame怎么用?Golang Frame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Frame类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:30,代码来源:PlainSocketImpl.go
示例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))
}
开发者ID:cretz,项目名称:jvm.go,代码行数:9,代码来源:Class.go
示例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)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:7,代码来源:xreturn.go
示例4: Execute
func (self *dadd) Execute(frame *rtda.Frame) {
stack := frame.OperandStack()
v1 := stack.PopDouble()
v2 := stack.PopDouble()
result := v1 + v2
stack.PushDouble(result)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:7,代码来源:xadd.go
示例5: Execute
func (self *lxor) Execute(frame *rtda.Frame) {
stack := frame.OperandStack()
v1 := stack.PopLong()
v2 := stack.PopLong()
result := v1 ^ v2
stack.PushLong(result)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:7,代码来源:xxor.go
示例6: getUptime0
// private native long getUptime0();
// ()J
func getUptime0(frame *rtda.Frame) {
// todo
uptime := int64(0)
stack := frame.OperandStack()
stack.PushLong(uptime)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:9,代码来源:VMManagementImpl.go
示例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)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:9,代码来源:VMManagementImpl.go
示例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)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:28,代码来源:System.go
示例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)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:9,代码来源:ZipFile.go
示例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)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:9,代码来源:System.go
示例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)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:9,代码来源:System.go
示例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)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:9,代码来源:System.go
示例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)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:7,代码来源:xrem.go
示例14: Execute
func (self *swap) Execute(frame *rtda.Frame) {
stack := frame.OperandStack()
val1 := stack.PopSlot()
val2 := stack.PopSlot()
stack.PushSlot(val1)
stack.PushSlot(val2)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:7,代码来源:swap.go
示例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)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:9,代码来源:ZipFile.go
示例16: findSignal
// private static native int findSignal(String string);
// (Ljava/lang/String;)I
func findSignal(frame *rtda.Frame) {
vars := frame.LocalVars()
vars.GetRef(0) // name
stack := frame.OperandStack()
stack.PushInt(0) // todo
}
开发者ID:cretz,项目名称:jvm.go,代码行数:9,代码来源:Signal.go
示例17: getEntrySize
// private static native long getEntrySize(long jzentry);
// (J)J
func getEntrySize(frame *rtda.Frame) {
entry := _getEntryPop(frame)
size := int64(entry.UncompressedSize64)
stack := frame.OperandStack()
stack.PushLong(size)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:9,代码来源:ZipFile.go
示例18: getStartupTime
// public native long getStartupTime();
// ()J
func getStartupTime(frame *rtda.Frame) {
// todo
startupTime := int64(0)
stack := frame.OperandStack()
stack.PushLong(startupTime)
}
开发者ID:cretz,项目名称:jvm.go,代码行数:9,代码来源:VMManagementImpl.go
示例19: _getEntryPop
func _getEntryPop(frame *rtda.Frame) *gozip.File {
vars := frame.LocalVars()
jzentry := vars.GetLong(0)
entry := getEntryFile(jzentry)
return entry
}
开发者ID:cretz,项目名称:jvm.go,代码行数:7,代码来源:ZipFile.go
示例20: set
// public static native void set(Object array, int index, Object value)
// throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
// (Ljava/lang/Object;ILjava/lang/Object;)V
func set(frame *rtda.Frame) {
vars := frame.LocalVars()
arr := vars.GetRef(0)
index := vars.GetInt(1)
value := vars.GetRef(2)
if arr == nil {
frame.Thread().ThrowNPE()
return
}
if !arr.IsArray() {
frame.Thread().ThrowIllegalArgumentException("Argument is not an array")
return
}
if index < 0 || index >= rtc.ArrayLength(arr) {
frame.Thread().ThrowArrayIndexOutOfBoundsExceptionNoMsg()
return
}
if !arr.IsPrimitiveArray() {
arr.Refs()[index] = value
return
}
//TODO Consistent with the current need to determine whether the type and source type
// Such as:
// [I
// java/lang/Integer
// frame.Thread().ThrowIllegalArgumentException("argument type mismatch")
// primitive array
primitiveDescriptorStr := arr.Class().Name()[1:]
if primitiveDescriptorStr != value.GetPrimitiveDescriptor() {
frame.Thread().ThrowIllegalArgumentException("argument type mismatch")
return
}
unboxed := box.Unbox(value, primitiveDescriptorStr)
primitiveDescriptor := arr.Class().Name()[1]
switch primitiveDescriptor {
case 'Z':
arr.Booleans()[index] = int8(unboxed.(int32))
case 'B':
arr.Bytes()[index] = int8(unboxed.(int32))
case 'C':
arr.Chars()[index] = uint16(unboxed.(int32))
case 'S':
arr.Shorts()[index] = int16(unboxed.(int32))
case 'I':
arr.Ints()[index] = unboxed.(int32)
case 'J':
arr.Longs()[index] = unboxed.(int64)
case 'F':
arr.Floats()[index] = unboxed.(float32)
case 'D':
arr.Doubles()[index] = unboxed.(float64)
}
}
开发者ID:cretz,项目名称:jvm.go,代码行数:63,代码来源:Array.go
注:本文中的github.com/zxh0/jvm/go/jvmgo/jvm/rtda.Frame类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论