dependencygraph

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const NullStateAddress = StateAddress(0)

Variables

This section is empty.

Functions

This section is empty.

Types

type BehaviourProvider

type BehaviourProvider interface {
	GetBehaviourForCommand(context.Context, *api.GlobalState, api.CmdID, api.Cmd, *DependencyGraph) CmdBehaviour
}

type CmdBehaviour added in v1.2.0

type CmdBehaviour struct {
	Reads     []StateAddress // States read by a command.
	Modifies  []StateAddress // States read and written by a command.
	Writes    []StateAddress // States written by a command.
	Roots     []StateAddress // States labeled as root by a command.
	KeepAlive bool           // Force the command to be live.
	Aborted   bool           // Mutation of this command aborts.
}

func (*CmdBehaviour) Modify added in v1.2.0

func (b *CmdBehaviour) Modify(g *DependencyGraph, state StateKey)

func (*CmdBehaviour) Read added in v1.2.0

func (b *CmdBehaviour) Read(g *DependencyGraph, state StateKey)

func (*CmdBehaviour) Write added in v1.2.0

func (b *CmdBehaviour) Write(g *DependencyGraph, state StateKey)

type DeadCodeElimination added in v1.2.0

type DeadCodeElimination struct {
	KeepAllAlive bool
	// contains filtered or unexported fields
}

DeadCodeElimination is an implementation of Transformer that outputs live commands. That is, all commands which do not affect the requested output are omitted. It is named after the standard compiler optimization. (state is like memory and commands are instructions which read/write it). Construct with NewDeadCodeElimination, do not build directly.

func NewDeadCodeElimination added in v1.2.0

func NewDeadCodeElimination(ctx context.Context, depGraph *DependencyGraph) *DeadCodeElimination

NewDeadCodeElimination constructs and returns a new DeadCodeElimination transform.

The transform generates commands from the given depGraph, it does not take inputs.

func (*DeadCodeElimination) Flush added in v1.2.0

func (t *DeadCodeElimination) Flush(ctx context.Context, out transform.Writer)

func (*DeadCodeElimination) Request added in v1.2.0

func (t *DeadCodeElimination) Request(id api.CmdID)

Request ensures that we keep alive all commands needed to render framebuffer at the given point.

func (*DeadCodeElimination) Transform added in v1.2.0

func (t *DeadCodeElimination) Transform(ctx context.Context, id api.CmdID, c api.Cmd, out transform.Writer)

type DependencyGraph

type DependencyGraph struct {
	// Number of generated commands in 'Commands' which build the initial state.
	NumInitialCommands int

	Commands   []api.Cmd             // Command list which this graph was build for.
	Behaviours []CmdBehaviour        // State reads/writes for each command (graph edges).
	Roots      map[StateAddress]bool // State to mark live at requested commands.
	// contains filtered or unexported fields
}

func GetDependencyGraph

func GetDependencyGraph(ctx context.Context, device *path.Device) (*DependencyGraph, error)

func (*DependencyGraph) GetCmdID added in v0.9.6

func (g *DependencyGraph) GetCmdID(cmdIndex int) api.CmdID

GetCmdID returns the CmdID for given element in the Commands slice.

func (*DependencyGraph) GetHierarchyStateMap

func (g *DependencyGraph) GetHierarchyStateMap() map[StateAddress]StateAddress

func (*DependencyGraph) GetStateAddressOf

func (g *DependencyGraph) GetStateAddressOf(key StateKey) StateAddress

func (*DependencyGraph) Print

func (g *DependencyGraph) Print(ctx context.Context, b *CmdBehaviour)

func (*DependencyGraph) SetRoot

func (g *DependencyGraph) SetRoot(key StateKey)

type DependencyGraphBehaviourProvider

type DependencyGraphBehaviourProvider interface {
	GetDependencyGraphBehaviourProvider(ctx context.Context) BehaviourProvider
}

type LivenessTree added in v1.2.0

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

LivenessTree assigns boolean value to each state (live or dead). Think of each node as memory range, with children being sub-ranges.

func NewLivenessTree added in v1.2.0

func NewLivenessTree(parents map[StateAddress]StateAddress) LivenessTree

NewLivenessTree creates a new tree. The parent map defines parent for each node, and it must be continuous with no gaps.

func (*LivenessTree) IsLive added in v1.2.0

func (l *LivenessTree) IsLive(address StateAddress) bool

IsLive returns true if the state, or any of its descendants, are live.

func (*LivenessTree) MarkDead added in v1.2.0

func (l *LivenessTree) MarkDead(address StateAddress)

MarkDead makes the given state, and all of its descendants, dead.

func (*LivenessTree) MarkLive added in v1.2.0

func (l *LivenessTree) MarkLive(address StateAddress)

MarkLive makes the given state, and all of its descendants, live.

type StateAddress

type StateAddress uint32

type StateKey

type StateKey interface {
	// Parent returns enclosing state (and this state is strict subset of it).
	// This allows efficient implementation of operations which access a lot state.
	Parent() StateKey
}

StateKey uniquely represents part of the GL state. Think of it as memory range (which stores the state data).

Jump to

Keyboard shortcuts

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