Documentation ¶
Overview ¶
Package objects coordinates lower level memory and typeset models with Go objects.
Builder ¶
The Builder is responsible for implementing the majority of this coordination. It has a few different sets of methods.
The first set supports a way to configure the parameters for the lower level memory representation. These methods set and return the modified builder. They are
- Builder.Pos(go/token.Pos)
- Builder.Type(go/types.Type)
- Builder.Attrs(pal/memory.Attrs)
- Builder.Class(pal/memory.Class)
Making a memory location containing objects of type `T` representing code at pos `pos` with attributes `memory.IsOpaque` could for example be done like this:
b.Type(T).Pos(pos).Attrs(memory.IsOpaque).Gen()
The second set of methods relates to creating locations, objects and constraints. These are
- Builder.Gen() generate a memory location.
- Builder.Add{Load,Store,Transfer,PointsTo}(dst, src)
- Builder.{Struct,Array,Slice,Map,Func,Interface,Chan}
The last set of methods gives access to the build results
- Builder.Memory() *memory.Model
- Builder.TypeSet() *typeset.TypeSet
- Builder.Object(m memory.Loc) Object (one of Struct,Array,Slice,Map,...)
Index ¶
- type Array
- type Builder
- func (b *Builder) AddAddressOf(ptr, obj memory.Loc)
- func (b *Builder) AddLoad(dst, src memory.Loc)
- func (b *Builder) AddSlot(slice *Slice, i indexing.I)
- func (b *Builder) AddStore(dst, src memory.Loc)
- func (b *Builder) AddTransfer(dst, src memory.Loc)
- func (b *Builder) AddTransferIndex(dst, src memory.Loc, i indexing.I)
- func (b *Builder) Array(gty *types.Array) *Array
- func (b *Builder) Attrs(as memory.Attrs) *Builder
- func (b *Builder) Chan(gty *types.Chan) *Chan
- func (b *Builder) Class(c memory.Class) *Builder
- func (b *Builder) Func(sig *types.Signature, declName string, opaque memory.Attrs) *Func
- func (b *Builder) Gen() memory.Loc
- func (b *Builder) GoType(ty types.Type) *Builder
- func (b *Builder) Map(gty *types.Map) *Map
- func (b *Builder) Memory() *memory.Model
- func (b *Builder) Object(m memory.Loc) Object
- func (b *Builder) Pointer(gtype *types.Pointer) *Pointer
- func (b *Builder) Pos(pos token.Pos) *Builder
- func (b *Builder) Slice(gty *types.Slice, length, capacity indexing.I) *Slice
- func (b *Builder) Struct(gty *types.Struct) *Struct
- func (b *Builder) Tuple(ty *types.Tuple) *Tuple
- func (b *Builder) Type(ty typeset.Type) *Builder
- func (b *Builder) TypeSet() *typeset.TypeSet
- func (b *Builder) WithPointer() (obj, ptr memory.Loc)
- type Chan
- type Func
- func (f *Func) Declared() bool
- func (f *Func) Loc() memory.Loc
- func (f *Func) Name() string
- func (f *Func) NumParams() int
- func (f *Func) NumResults() int
- func (f *Func) ParamLoc(i int) memory.Loc
- func (f *Func) PlainDecode(r io.Reader) error
- func (f *Func) PlainEncode(w io.Writer) error
- func (f *Func) RecvLoc(i int) memory.Loc
- func (f *Func) ResultLoc(i int) memory.Loc
- func (o *Func) Type() typeset.Type
- type Interface
- type Map
- func (m *Map) Elem() memory.Loc
- func (m *Map) Key() memory.Loc
- func (o *Map) Loc() memory.Loc
- func (m *Map) Lookup(dst memory.Loc, mm *memory.Model)
- func (m *Map) PlainDecode(r io.Reader) error
- func (m *Map) PlainEncode(w io.Writer) error
- func (o *Map) Type() typeset.Type
- func (m *Map) Update(k, v memory.Loc, mm *memory.Model)
- type Object
- type Pointer
- type Slice
- type Slot
- type Struct
- type Tuple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶ added in v0.0.2
type Builder struct {
// contains filtered or unexported fields
}
Builder is a type which supports coordinating higher level Go objects (funcs, slices, maps, ...) with the lower level memory model and typeset.
func NewBuilder ¶ added in v0.0.2
NewBuilder creates a new builder from a package Path and an indexing.T which manages representing indexing expressiosn.
func (*Builder) AddAddressOf ¶ added in v0.0.4
func (*Builder) AddTransfer ¶ added in v0.0.3
func (*Builder) AddTransferIndex ¶ added in v0.0.3
func (*Builder) Func ¶ added in v0.0.3
Func makes a function object. It is for top level functions which may or may not be declared. `declName` must be empty iff the associated function is not declared.
func (*Builder) WithPointer ¶ added in v0.0.3
type Chan ¶
type Chan struct {
// contains filtered or unexported fields
}
Chan object
c.loc represents pointer c.slot represents things sent to and received from the channel.
type Func ¶
type Func struct {
// contains filtered or unexported fields
}
func (*Func) NumResults ¶ added in v0.0.5
type Slice ¶
Slices are modelled as follows.
Each slice `s` has a principal pointer `ptr(s)` stored in object.loc, and a Len and a Cap which are of type indexing.I, and a single memory.Loc "elem" representing what is stored in the slice.
Each slice has 0 or more slots. A slot is a triple (p, m, i) such that
- p = &m
- p = ptr(s) + i
For the moment, we set ptr(s) == &nil to guarantee that nil derefs are considered possible. When indexing gets richer, perhaps we can do more.