runtimecp

package
v0.0.0-...-b90710e Latest Latest
Warning

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

Go to latest
Published: May 30, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindBool = 1 + iota
	KindInt
	KindInt8
	KindInt16
	KindInt32
	KindInt64
	KindUint
	KindUint8
	KindUint16
	KindUint32
	KindUint64
	KindUintptr
	KindFloat32
	KindFloat64
	KindComplex64
	KindComplex128
	KindArray
	KindChan
	KindFunc
	KindInterface
	KindMap
	KindPtr // 指针
	KindSlice
	KindString
	KindStruct
	KindUnsafePointer

	KindDirectIface = 1 << 5 //结构体只含一个指针/普通指针/unsafe.Pointer 总结: 值为直接指针
	KindGCProg      = 1 << 6
	KindNoPointers  = 1 << 7 // int/float/complex/不含指针的struct/int array/float array 等 总结: 值完全不含指针
	KindMask        = (1 << 5) - 1
)

Variables

View Source
var (
	TypeInt    = TypeOf(int(1))
	TypeString = TypeOf(string(""))
)

Functions

func Compare8

func Compare8(a, b unsafe.Pointer) int

func Compare16

func Compare16(a, b unsafe.Pointer) int

func Compare32

func Compare32(a, b unsafe.Pointer) int

func Compare64

func Compare64(a, b unsafe.Pointer) int

func Compare128

func Compare128(a, b unsafe.Pointer) int

func Eface2Interface

func Eface2Interface(eface Eface) interface{}

func GetCompare

func GetCompare(a, b unsafe.Pointer, size uintptr) func(a, b unsafe.Pointer) int

func IsDirectIface

func IsDirectIface(t *Type) bool

IsDirectIface reports whether t is stored directly in an interface value.

func Noescape

func Noescape(p unsafe.Pointer) unsafe.Pointer

copy from package runtime noescape hides a pointer from escape analysis. noescape is the identity function but escape analysis doesn't think the output depends on the input. noescape is inlined and currently compiles down to zero instructions. USE CAREFULLY!

func NoescapeInterface

func NoescapeInterface(x interface{}) interface{}

func UnsafeAlloc

func UnsafeAlloc(size uintptr) unsafe.Pointer

Types

type Eface

type Eface struct {
	Type *Type
	Data unsafe.Pointer
}

func EfaceOf

func EfaceOf(eface interface{}) Eface

type Iface

type Iface struct {
	Tab  *itab
	Data unsafe.Pointer
}

type Slice

type Slice struct {
	Array unsafe.Pointer
	Len   int
	Cap   int
}

type String

type String struct {
	Str unsafe.Pointer
	Len int
}

type Type

type Type struct {
	Size uintptr

	Kind uint8
	// contains filtered or unexported fields
}

Needs to be in sync with ../cmd/link/internal/ld/decodesym.go:/^func.commonsize, ../cmd/compile/internal/gc/reflect.go:/^func.dcommontype and ../reflect/type.go:/^type.rtype.

func TypeOf

func TypeOf(eface interface{}) *Type

Jump to

Keyboard shortcuts

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