rttype

package standard library
go1.23.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package rttype allows the compiler to share type information with the runtime. The shared type information is stored in internal/abi. This package translates those types from the host machine on which the compiler runs to the target machine on which the compiled program will run. In particular, this package handles layout differences between e.g. a 64 bit compiler and 32 bit target.

Index

Constants

This section is empty.

Variables

View Source
var ArrayType *types.Type
View Source
var ChanType *types.Type
View Source
var FuncType *types.Type
View Source
var IMethod *types.Type

Types that are parts of the types above.

View Source
var ITab *types.Type

Interface tables (itabs)

View Source
var InterfaceSwitch *types.Type

Type switches and asserts

View Source
var InterfaceType *types.Type
View Source
var MapType *types.Type
View Source
var Method *types.Type
View Source
var PtrType *types.Type
View Source
var SliceType *types.Type
View Source
var StructField *types.Type
View Source
var StructType *types.Type
View Source
var Type *types.Type

The type structures shared with the runtime.

View Source
var TypeAssert *types.Type
View Source
var UncommonType *types.Type

Functions

func Init

func Init()

Types

type ArrayCursor

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

func NewArrayCursor

func NewArrayCursor(lsym *obj.LSym, off int64, t *types.Type, n int) ArrayCursor

NewArrayCursor returns a cursor starting at lsym+off and having n copies of type t.

func (ArrayCursor) Elem

func (a ArrayCursor) Elem(i int) Cursor

Elem selects element i of the array pointed to by c.

type Cursor

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

A Cursor represents a typed location inside a static variable where we are going to write.

func NewCursor

func NewCursor(lsym *obj.LSym, off int64, t *types.Type) Cursor

NewCursor returns a cursor starting at lsym+off and having type t.

func (Cursor) Elem added in go1.23.0

func (c Cursor) Elem(i int64) Cursor

func (Cursor) Field

func (c Cursor) Field(name string) Cursor

Field selects the field with the given name from the struct pointed to by c.

func (Cursor) ModifyArray

func (c Cursor) ModifyArray(n int) (ArrayCursor, int64)

ModifyArray converts a cursor pointing at a type [k]T to a cursor pointing at a type [n]T. Also returns the size delta, aka (n-k)*sizeof(T).

func (Cursor) Reloc

func (c Cursor) Reloc() *obj.Reloc

Reloc adds a relocation from the current cursor position. Reloc fills in Off and Siz fields. Caller should fill in the rest (Type, others).

func (Cursor) WriteBool

func (c Cursor) WriteBool(val bool)

func (Cursor) WriteInt

func (c Cursor) WriteInt(val int64)

func (Cursor) WriteInt32

func (c Cursor) WriteInt32(val int32)

func (Cursor) WritePtr

func (c Cursor) WritePtr(target *obj.LSym)

WritePtr writes a pointer "target" to the component at the location specified by c.

func (Cursor) WritePtrWeak added in go1.23.0

func (c Cursor) WritePtrWeak(target *obj.LSym)

func (Cursor) WriteSlice

func (c Cursor) WriteSlice(target *obj.LSym, off, len, cap int64)

WriteSlice writes a slice header to c. The pointer is target+off, the len and cap fields are given.

func (Cursor) WriteSymPtrOff

func (c Cursor) WriteSymPtrOff(target *obj.LSym, weak bool)

WriteSymPtrOff writes a "pointer" to the given symbol. The symbol is encoded as a uint32 offset from the start of the section.

func (Cursor) WriteUint16

func (c Cursor) WriteUint16(val uint16)

func (Cursor) WriteUint32

func (c Cursor) WriteUint32(val uint32)

func (Cursor) WriteUint8

func (c Cursor) WriteUint8(val uint8)

func (Cursor) WriteUintptr

func (c Cursor) WriteUintptr(val uint64)

Jump to

Keyboard shortcuts

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