• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang rtda.Frame类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/zxh0/jvm/go/jvmgo/rtda.Frame的典型用法代码示例。如果您正苦于以下问题:Golang Frame类的具体用法?Golang Frame怎么用?Golang Frame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Frame类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: Execute

func (self *FMUL) Execute(frame *rtda.Frame) {
	stack := frame.OperandStack()
	v2 := stack.PopFloat()
	v1 := stack.PopFloat()
	result := v1 * v2
	stack.PushFloat(result)
}
开发者ID:Rearcher,项目名称:jvm.go,代码行数:7,代码来源:mul.go


示例2: createStackTraceElements

func createStackTraceElements(tObj *heap.Object, frame *rtda.Frame) []*StackTraceElement {
	thread := frame.Thread()
	depth := thread.StackDepth()

	// skip unrelated frames
	i := uint(1)
	for k := tObj.Class(); k != nil; k = k.SuperClass() {
		i++
	}
	if thread.TopFrameN(i).Method().Name() == "<athrow>" {
		i++
	}

	stes := make([]*StackTraceElement, 0, depth)
	for ; i < depth; i++ {
		frameN := thread.TopFrameN(i)
		methodN := frameN.Method()
		classN := methodN.Class()
		if classN.Name() != "~shim" { // skip shim frame
			lineNumber := methodN.GetLineNumber(frameN.NextPC() - 1)
			ste := &StackTraceElement{
				declaringClass: classN.NameJlsFormat(),
				methodName:     methodN.Name(),
				fileName:       classN.SourceFile(),
				lineNumber:     lineNumber,
			}
			stes = append(stes, ste)
		}
	}

	return stes
}
开发者ID:Rearcher,项目名称:jvm.go,代码行数:32,代码来源:Throwable.go


示例3: 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:Rearcher,项目名称:jvm.go,代码行数:9,代码来源:Signal.go


示例4: getUptime0

// private native long getUptime0();
// ()J
func getUptime0(frame *rtda.Frame) {
	// todo
	uptime := int64(0)

	stack := frame.OperandStack()
	stack.PushLong(uptime)
}
开发者ID:Rearcher,项目名称:jvm.go,代码行数:9,代码来源:VMManagementImpl.go


示例5: 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:Rearcher,项目名称:jvm.go,代码行数:9,代码来源:VMManagementImpl.go


示例6: 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:zaishihuang,项目名称:jvm.go,代码行数:9,代码来源:ZipFile.go


示例7: _getEntryPop

func _getEntryPop(frame *rtda.Frame) *gozip.File {
	vars := frame.LocalVars()
	jzentry := vars.GetLong(0)

	entry := getEntryFile(jzentry)
	return entry
}
开发者ID:zaishihuang,项目名称:jvm.go,代码行数:7,代码来源:ZipFile.go


示例8: unpark

//  public native void unpark(Object thread);
//  (Ljava/lang/Object;)V
func unpark(frame *rtda.Frame) {
	vars := frame.LocalVars()
	threadObj := vars.GetRef(1)

	thread := threadObj.Extra().(*rtda.Thread)
	thread.Unpark()
}
开发者ID:zaishihuang,项目名称:jvm.go,代码行数:9,代码来源:Unsafe.go


示例9: Execute

func (self *DADD) Execute(frame *rtda.Frame) {
	stack := frame.OperandStack()
	v1 := stack.PopDouble()
	v2 := stack.PopDouble()
	result := v1 + v2
	stack.PushDouble(result)
}
开发者ID:Rearcher,项目名称:jvm.go,代码行数:7,代码来源:add.go


示例10: Execute

func (self *ARETURN) Execute(frame *rtda.Frame) {
	thread := frame.Thread()
	currentFrame := thread.PopFrame()
	invokerFrame := thread.TopFrame()
	ref := currentFrame.OperandStack().PopRef()
	invokerFrame.OperandStack().PushRef(ref)
}
开发者ID:Rearcher,项目名称:jvm.go,代码行数:7,代码来源:return.go


示例11: 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:zaishihuang,项目名称:jvm.go,代码行数:30,代码来源:PlainSocketImpl.go


示例12: 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 >= heap.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:Rearcher,项目名称:jvm.go,代码行数:63,代码来源:Array.go


示例13: writeBytes

// private native void writeBytes(byte b[], int off, int len, boolean append) throws IOException;
// ([BIIZ)V
func writeBytes(frame *rtda.Frame) {
	vars := frame.LocalVars()
	fosObj := vars.GetRef(0)     // this
	byteArrObj := vars.GetRef(1) // b
	offset := vars.GetInt(2)     // off
	length := vars.GetInt(3)     // len
	//vars.GetBoolean(4) // append

	fdObj := fosObj.GetFieldValue("fd", "Ljava/io/FileDescriptor;").(*rtc.Obj)
	if fdObj.Extra() == nil {
		goFd := fdObj.GetFieldValue("fd", "I").(int32)
		switch goFd {
		case 0:
			fdObj.SetExtra(os.Stdin)
		case 1:
			fdObj.SetExtra(os.Stdout)
		case 2:
			fdObj.SetExtra(os.Stderr)
		}
	}
	goFile := fdObj.Extra().(*os.File)

	goBytes := byteArrObj.GoBytes()
	goBytes = goBytes[offset : offset+length]
	goFile.Write(goBytes)
}
开发者ID:zaishihuang,项目名称:jvm.go,代码行数:28,代码来源:FileOutputStream.go


示例14: 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:zaishihuang,项目名称:jvm.go,代码行数:28,代码来源:System.go


示例15: 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:zaishihuang,项目名称:jvm.go,代码行数:9,代码来源:ZipFile.go


示例16: 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:zaishihuang,项目名称:jvm.go,代码行数:9,代码来源:ZipFile.go


示例17: i6di_lookupAllHostAddr

//(Ljava/lang/String;)[Ljava/net/InetAddress;
func i6di_lookupAllHostAddr(frame *rtda.Frame) {
	vars := frame.LocalVars()
	host := rtda.GoString(vars.GetRef(1))
	address, _ := net.LookupHost(host)
	constructorCount := uint(len(address))

	inetAddress := heap.BootLoader().LoadClass("java/net/InetAddress")
	inetAddressArr := inetAddress.NewArray(constructorCount)

	stack := frame.OperandStack()
	stack.PushRef(inetAddressArr)

	//TODO
	//getByName descriptor:(Ljava/lang/String;)Ljava/net/InetAddress;
	//if constructorCount > 0 {
	//	thread := frame.Thread()
	//	constructorObjs := inetAddressArr.Refs()
	//	inetAddressGetByNameMethod := inetAddress.GetStaticMethod("getByName", "(Ljava/lang/String;)Ljava/net/InetAddress;")

	//	fmt.Println(constructorObjs[0])
	//	fmt.Println(inetAddressGetByNameMethod)
	//	fmt.Println(thread)
	//	thread.InvokeMethodWithShim(inetAddressGetByNameMethod, []interface{}{
	//		constructorObjs[0],
	//		rtda.JString(host),
	//	})
	//}
}
开发者ID:Rearcher,项目名称:jvm.go,代码行数:29,代码来源:Inet6AddressImpl.go


示例18: 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:zaishihuang,项目名称:jvm.go,代码行数:9,代码来源:Class.go


示例19: interrupt0

// private native void interrupt0();
// ()V
func interrupt0(frame *rtda.Frame) {
	vars := frame.LocalVars()
	this := vars.GetThis()

	thread := _extraThread(this)
	thread.Interrupt()
}
开发者ID:zaishihuang,项目名称:jvm.go,代码行数:9,代码来源:Thread.go


示例20: getStartupTime

// public native long getStartupTime();
// ()J
func getStartupTime(frame *rtda.Frame) {
	// todo
	startupTime := int64(0)

	stack := frame.OperandStack()
	stack.PushLong(startupTime)
}
开发者ID:Rearcher,项目名称:jvm.go,代码行数:9,代码来源:VMManagementImpl.go



注:本文中的github.com/zxh0/jvm/go/jvmgo/rtda.Frame类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang rtda.Thread类代码示例发布时间:2022-05-28
下一篇:
Golang rtda.JString函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap