heap

package
v1.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// public
	ACC_PUBLIC = 0x0001
	// private
	ACC_PRIVATE = 0x0002
	// protected
	ACC_PROTECTED = 0x0004
	// static
	ACC_STATIC = 0x0008
	// final
	ACC_FINAL = 0x0010
	// synchronized
	ACC_SYNCHRONIZED = 0x0020
	// volatile
	ACC_VOLATILE = 0x0020
	// super
	ACC_SUPER = 0x0020
	// bridge
	ACC_BRIDGE = 0x0040
	// transient
	ACC_TRANSIENT = 0x0040
	// varargs
	ACC_VARARGS = 0x0080
	// native
	ACC_NATIVE = 0x0100
	// interface
	ACC_INTERFACE = 0x0200
	// abstract
	ACC_ABSTRACT = 0x0400
	// strict
	ACC_STRICT = 0x0800
	// synthetic
	ACC_SYNTHETIC = 0x1000
	// annotation
	ACC_ANNOTATION = 0x2000
	// enum
	ACC_ENUM = 0x4000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Class

type Class struct {
	// contains filtered or unexported fields
}

func (*Class) ConstantPool

func (self *Class) ConstantPool() *ConstantPool

func (*Class) GetMainMethod

func (self *Class) GetMainMethod() *Method

func (*Class) GetPackageName added in v1.7.0

func (self *Class) GetPackageName() string

func (Class) IsAbstract

func (self Class) IsAbstract() bool

func (*Class) IsImplements added in v1.7.0

func (self *Class) IsImplements(class *Class) bool

func (*Class) IsInterface

func (self *Class) IsInterface() bool

func (*Class) IsPrivate

func (self *Class) IsPrivate() bool

func (*Class) IsProtected

func (self *Class) IsProtected() bool

func (*Class) IsPublic

func (self *Class) IsPublic() bool

func (*Class) IsSubClassOf added in v1.7.0

func (self *Class) IsSubClassOf(class *Class) bool

判断本类是否是参数class的子类

func (*Class) IsSuper added in v1.7.0

func (self *Class) IsSuper() bool

判断方法的ACC_SUPER是否有被标记

func (*Class) IsSuperClassOf added in v1.7.0

func (self *Class) IsSuperClassOf(class *Class) bool

判断本类是否是参数class的父类

func (*Class) Name added in v1.7.0

func (self *Class) Name() string

func (*Class) NewObject

func (self *Class) NewObject() *Object

func (Class) StaticVars

func (self Class) StaticVars() Slots

func (*Class) SuperClass added in v1.7.0

func (self *Class) SuperClass() *Class

type ClassLoader

type ClassLoader struct {
	// contains filtered or unexported fields
}

类加载器 类加载器依赖ClassPath来搜寻和读取class文件

func NewClassLoader

func NewClassLoader(cp *classpath.Classpath, verboseFlag bool) *ClassLoader

创建一个加载器实例

func (*ClassLoader) LoadClass

func (self *ClassLoader) LoadClass(name string) *Class

在classMap中根据name查询类 然后将将类数据加载到方法区中

type ClassMember

type ClassMember struct {
	// contains filtered or unexported fields
}

func (*ClassMember) IsPrivate

func (self *ClassMember) IsPrivate() bool

func (*ClassMember) IsProtected

func (self *ClassMember) IsProtected() bool

func (*ClassMember) IsPublic

func (self *ClassMember) IsPublic() bool

type ClassRef

type ClassRef struct {
	SymRef
}

type Constant

type Constant interface {
}

type ConstantPool

type ConstantPool struct {
	// contains filtered or unexported fields
}

运行时常量池

func (*ConstantPool) GetConstant

func (self *ConstantPool) GetConstant(index uint) Constant

根据索引返回常量

func (*ConstantPool) Name

func (self *ConstantPool) Name() string

type Field

type Field struct {
	ClassMember
	// contains filtered or unexported fields
}

实例字段

func (Field) Class

func (self Field) Class() *Class

func (Field) ConstValueIndex

func (self Field) ConstValueIndex() uint

func (Field) Descriptor

func (self Field) Descriptor() string

func (Field) IsFinal

func (self Field) IsFinal() bool

func (Field) IsLongOrDouble

func (self Field) IsLongOrDouble() bool

判断描述符是否属于J或者D,J -> long,D -> double 基本类型中,除了long的定义奇特外,其他都是基于首字母

func (Field) IsStatic

func (self Field) IsStatic() bool

func (Field) SlotId

func (self Field) SlotId() uint

type FieldRef

type FieldRef struct {
	MemberRef
	// contains filtered or unexported fields
}

func (FieldRef) IsStatic

func (self FieldRef) IsStatic() bool

func (*FieldRef) ResolvedField

func (self *FieldRef) ResolvedField() *Field

* 字段符号引用解析

type InterfaceMethodRef

type InterfaceMethodRef struct {
	MemberRef
	// contains filtered or unexported fields
}

接口方法的符号引用

func (InterfaceMethodRef) Descriptor added in v1.7.0

func (self InterfaceMethodRef) Descriptor() string

func (InterfaceMethodRef) Name added in v1.7.0

func (self InterfaceMethodRef) Name() string

func (*InterfaceMethodRef) ResolvedInterfaceMethod added in v1.7.0

func (self *InterfaceMethodRef) ResolvedInterfaceMethod() *Method

解析接口方法

type MemberRef

type MemberRef struct {
	SymRef
	// contains filtered or unexported fields
}

type Method

type Method struct {
	ClassMember
	// contains filtered or unexported fields
}

func LookupMethodInClass added in v1.7.0

func LookupMethodInClass(class *Class, name, descriptor string) *Method

在类和父类中搜寻指定的方法

func (*Method) ArgSlotCount added in v1.7.0

func (self *Method) ArgSlotCount() uint

func (*Method) Class

func (self *Method) Class() *Class

func (*Method) Code

func (self *Method) Code() []byte

func (Method) Descriptor added in v1.7.0

func (self Method) Descriptor() string

func (Method) IsAbstract added in v1.7.0

func (self Method) IsAbstract() bool

func (Method) IsStatic

func (self Method) IsStatic() bool

func (Method) MaxLocals

func (self Method) MaxLocals() uint16

func (Method) MaxStack

func (self Method) MaxStack() uint16

func (Method) MethodDescriptor added in v1.7.0

func (self Method) MethodDescriptor() string

func (Method) Name

func (self Method) Name() string

type MethodDescriptor added in v1.7.0

type MethodDescriptor struct {
	ParameterTypes []TypeDescriptor
	ReturnType     TypeDescriptor
}

方法的描述符 参考点有两个: 1 方法参数类型与数量 2 返回类型

虽然在虚拟机层面返回类型是可以作为方法的特征之一 但是在java中,返回类型不作为方法重载的特征之一。 原因可能是因为方法即使有返回值,调用者也可以不接收方法的返回值,这会导致编译器无法根据返回类型作为判断依据

type MethodDescriptorParser added in v1.7.0

type MethodDescriptorParser struct {
	// contains filtered or unexported fields
}

type MethodRef

type MethodRef struct {
	MemberRef
	// contains filtered or unexported fields
}

func (MethodRef) Descriptor

func (self MethodRef) Descriptor() string

func (MethodRef) Name

func (self MethodRef) Name() string

func (*MethodRef) ResolvedMethod added in v1.7.0

func (self *MethodRef) ResolvedMethod() *Method

解析非接口方法

type Object

type Object struct {
	// contains filtered or unexported fields
}

func (Object) Class added in v1.7.0

func (self Object) Class() *Class

func (*Object) Fields

func (self *Object) Fields() Slots

func (*Object) IsInstanceOf

func (self *Object) IsInstanceOf(class *Class) bool

type Slot

type Slot struct {
	// contains filtered or unexported fields
}

type Slots

type Slots []Slot

func (Slots) GetDouble

func (self Slots) GetDouble(index uint) float64

func (Slots) GetFloat

func (self Slots) GetFloat(index uint) float32

func (Slots) GetInt

func (self Slots) GetInt(index uint) int32

func (Slots) GetLong

func (self Slots) GetLong(index uint) int64

func (Slots) GetRef

func (self Slots) GetRef(index uint) *Object

func (Slots) SetDouble

func (self Slots) SetDouble(index uint, val float64)

double consumes two slots

func (Slots) SetFloat

func (self Slots) SetFloat(index uint, val float32)

func (Slots) SetInt

func (self Slots) SetInt(index uint, val int32)

func (Slots) SetLong

func (self Slots) SetLong(index uint, val int64)

long consumes two slots

func (Slots) SetRef

func (self Slots) SetRef(index uint, ref *Object)

type SymRef

type SymRef struct {
	// contains filtered or unexported fields
}

符号引用 cp,className,class是所有符号引用通用的字段 利用继承的方式来进行定制

func (*SymRef) ResolvedClass

func (self *SymRef) ResolvedClass() *Class

解析符号引用 如果类还没有被解析过,先解析类的符号引用 如果类已经被解析过,直接返回类的指针

type TypeDescriptor added in v1.7.0

type TypeDescriptor string

func (TypeDescriptor) IsArrayType added in v1.7.0

func (td TypeDescriptor) IsArrayType() bool

数组类型

func (TypeDescriptor) IsBaseType added in v1.7.0

func (td TypeDescriptor) IsBaseType() bool

基本类型

func (TypeDescriptor) IsLongOrDouble added in v1.7.0

func (td TypeDescriptor) IsLongOrDouble() bool

long或者double类型

func (TypeDescriptor) IsObjectType added in v1.7.0

func (td TypeDescriptor) IsObjectType() bool

对象类型

func (TypeDescriptor) IsVoidType added in v1.7.0

func (td TypeDescriptor) IsVoidType() bool

void类型

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL