本文整理汇总了Golang中github.com/zxh0/jvm/go/jvmgo/rtda/heap.Object类的典型用法代码示例。如果您正苦于以下问题:Golang Object类的具体用法?Golang Object怎么用?Golang Object使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Object类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: 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
示例2: convertArgs
// Object[] -> []interface{}
func convertArgs(this, argArr *heap.Object, method *heap.Method) []interface{} {
if method.ArgSlotCount() == 0 {
return nil
}
if method.ArgSlotCount() == 1 && !method.IsStatic() {
return []interface{}{this}
}
argObjs := argArr.Refs()
argTypes := method.ParsedDescriptor().ParameterTypes()
args := make([]interface{}, method.ArgSlotCount())
j := 0
if !method.IsStatic() {
args[0] = this
j = 1
}
for i, argType := range argTypes {
argObj := argObjs[i]
if argType.IsBaseType() {
// todo
unboxed := box.Unbox(argObj, argType.Descriptor())
args[i+j] = unboxed
if argType.IsLongOrDouble() {
j++
}
} else {
args[i+j] = argObj
}
}
return args
}
开发者ID:kingljl,项目名称:jvm.go,代码行数:36,代码来源:helper.go
示例3: _getGoField
func _getGoField(fieldObj *heap.Object) *heap.Field {
extra := fieldObj.Extra()
if extra != nil {
return extra.(*heap.Field)
}
root := fieldObj.GetFieldValue("root", "Ljava/lang/reflect/Field;").(*heap.Object)
return root.Extra().(*heap.Field)
}
开发者ID:Rearcher,项目名称:jvm.go,代码行数:9,代码来源:Unsafe_class.go
示例4: checkArrayCopy
func checkArrayCopy(src, dest *heap.Object) bool {
srcClass := src.Class()
destClass := dest.Class()
if !srcClass.IsArray() || !destClass.IsArray() {
return false
}
if srcClass.IsPrimitiveArray() || destClass.IsPrimitiveArray() {
return srcClass == destClass
}
return true
}
开发者ID:Rearcher,项目名称:jvm.go,代码行数:12,代码来源:System.go
示例5: _casObj
func _casObj(obj *heap.Object, fields []interface{}, offset int64, expected, newVal *heap.Object) bool {
// todo
obj.LockState()
defer obj.UnlockState()
current := _getObj(fields, offset)
if current == expected {
fields[offset] = newVal
return true
} else {
return false
}
}
开发者ID:b-xiang,项目名称:jvm.go,代码行数:13,代码来源:Unsafe_cas.go
示例6: HandleUncaughtException
func (self *Thread) HandleUncaughtException(ex *heap.Object) {
self.stack.clear()
sysClass := heap.BootLoader().LoadClass("java/lang/System")
sysErr := sysClass.GetStaticValue("out", "Ljava/io/PrintStream;").(*heap.Object)
printStackTrace := ex.Class().GetInstanceMethod("printStackTrace", "(Ljava/io/PrintStream;)V")
// call ex.printStackTrace(System.err)
newFrame := self.NewFrame(printStackTrace)
vars := newFrame.localVars
vars.SetRef(0, ex)
vars.SetRef(1, sysErr)
self.PushFrame(newFrame)
//
// printString := sysErr.Class().GetInstanceMethod("print", "(Ljava/lang/String;)V")
// newFrame = self.NewFrame(printString)
// vars = newFrame.localVars
// vars.SetRef(0, sysErr)
// vars.SetRef(1, JString("Exception in thread \"main\" ", newFrame))
// self.PushFrame(newFrame)
}
开发者ID:Rearcher,项目名称:jvm.go,代码行数:21,代码来源:thread.go
示例7: _extraThread
func _extraThread(threadObj *heap.Object) *rtda.Thread {
threadObj.RLockState()
defer threadObj.RUnlockState()
extra := threadObj.Extra()
if extra == nil {
return nil
} else {
return extra.(*rtda.Thread)
}
}
开发者ID:brucelau,项目名称:jvm.go,代码行数:11,代码来源:Thread.go
示例8: _getGoMethod
func _getGoMethod(methodObj *heap.Object, isConstructor bool) *heap.Method {
extra := methodObj.Extra()
if extra != nil {
return extra.(*heap.Method)
}
if isConstructor {
root := methodObj.GetFieldValue("root", "Ljava/lang/reflect/Constructor;").(*heap.Object)
return root.Extra().(*heap.Method)
} else {
root := methodObj.GetFieldValue("root", "Ljava/lang/reflect/Method;").(*heap.Object)
return root.Extra().(*heap.Method)
}
}
开发者ID:kingljl,项目名称:jvm.go,代码行数:14,代码来源:helper.go
示例9: Unbox
func Unbox(obj *heap.Object, primitiveDescriptor string) interface{} {
return obj.GetFieldValue("value", primitiveDescriptor)
}
开发者ID:Rearcher,项目名称:jvm.go,代码行数:3,代码来源:boxing.go
示例10: _getPath
func _getPath(fileObj *heap.Object) string {
pathStr := fileObj.GetFieldValue("path", "Ljava/lang/String;").(*heap.Object)
return rtda.GoString(pathStr)
}
开发者ID:kingljl,项目名称:jvm.go,代码行数:4,代码来源:UnixFileSystem.go
示例11: isAppClassLoader
// todo
func isAppClassLoader(loader *heap.Object) bool {
return loader.Class().Name() == "sun/misc/Launcher$AppClassLoader"
}
开发者ID:Rearcher,项目名称:jvm.go,代码行数:4,代码来源:ClassLoader.go
示例12: GoString
// java.lang.String -> go string
func GoString(jStr *heap.Object) string {
charArr := jStr.GetFieldValue("value", "[C").(*heap.Object)
return _utf16ToString(charArr.Chars())
}
开发者ID:Rearcher,项目名称:jvm.go,代码行数:5,代码来源:string_helper.go
注:本文中的github.com/zxh0/jvm/go/jvmgo/rtda/heap.Object类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论