staticinit

package standard library
go1.21rc2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MapInitToVar map[*ir.Func]*ir.Name

MapInitToVar is the inverse of VarToMapInit; it maintains a mapping from a compiler-generated init function to the map the function is initializing.

Functions

func AddKeepRelocations added in go1.21.0

func AddKeepRelocations()

AddKeepRelocations adds a dummy "R_KEEP" relocation from each global map variable V to its associated outlined init function. These relocation ensure that if the map var itself is determined to be reachable at link time, we also mark the init function as reachable.

func AnySideEffects

func AnySideEffects(n ir.Node) bool

AnySideEffects reports whether n contains any operations that could have observable side effects.

func OutlineMapInits added in go1.21.0

func OutlineMapInits(stmts []ir.Node) ([]ir.Node, []*ir.Func)

OutlineMapInits walks through a list of init statements (candidates for inclusion in the package "init" function) and returns an updated list in which items corresponding to map variable initializations have been replaced with calls to outline "map init" functions (if legal/profitable). Return value is an updated list and a list of any newly generated "map init" functions.

func StaticLoc

func StaticLoc(n ir.Node) (name *ir.Name, offset int64, ok bool)

StaticLoc returns the static address of n, if n has one, or else nil.

func StaticName

func StaticName(t *types.Type) *ir.Name

StaticName returns a name backed by a (writable) static data symbol. Use readonlystaticname for read-only node.

Types

type Entry

type Entry struct {
	Xoffset int64   // struct, array only
	Expr    ir.Node // bytes of run-time computed expressions
}

type Plan

type Plan struct {
	E []Entry
}

type Schedule

type Schedule struct {
	// Out is the ordered list of dynamic initialization
	// statements.
	Out []ir.Node

	Plans map[ir.Node]*Plan
	Temps map[ir.Node]*ir.Name
}

An Schedule is used to decompose assignment statements into static and dynamic initialization parts. Static initializations are handled by populating variables' linker symbol data, while dynamic initializations are accumulated to be executed in order.

func (*Schedule) StaticAssign

func (s *Schedule) StaticAssign(l *ir.Name, loff int64, r ir.Node, typ *types.Type) bool

func (*Schedule) StaticInit

func (s *Schedule) StaticInit(n ir.Node)

StaticInit adds an initialization statement n to the schedule.

Jump to

Keyboard shortcuts

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