tree: 20511e46c2c0155a7eaaf6ab724bd9eb6f205f5f [path history] [tgz]
  1. pointer_resolver.go
  2. README.md
  3. value.go
  4. values.go
replay/value/README.md

value


import "android.googlesource.com/platform/tools/gpu/replay/value"

Package value contains the value types used by the replay virtual machine.

Each numerical and boolean value type is backed by a corresponding primitive Go type for convenience of construction and usage. Pointer values can belong to various different address spaces, and for compatibility with both 32 and 64 bit architectures, are all backed by uint64.

Usage

type AbsolutePointer

type AbsolutePointer uint64

AbsolutePointer is a pointer in the absolute address-space that will not be altered before being passed to the protocol.

func (AbsolutePointer) Get

func (p AbsolutePointer) Get(PointerResolver) (uint64, error)

Get returns the uint64 value of the absolute pointer.

func (AbsolutePointer) IsValid

func (p AbsolutePointer) IsValid() bool

IsValid returns true for all absolute pointers.

func (AbsolutePointer) Offset

func (p AbsolutePointer) Offset(offset uint64) Pointer

Offset returns the sum of the pointer with offset.

func (AbsolutePointer) Type

func (p AbsolutePointer) Type() protocol.Type

Type returns TypeAbsolutePointer.

type Bool

type Bool bool

Bool is a Value of type TypeBool.

func (Bool) Get

func (v Bool) Get(PointerResolver) (uint64, error)

Get returns 1 if the Bool is true, otherwise 0.

func (Bool) Type

func (v Bool) Type() protocol.Type

Type returns TypeBool.

type ConstantPointer

type ConstantPointer uint64

ConstantPointer is a pointer in the constant address-space that will not be altered before being passed to the protocol.

func (ConstantPointer) Get

func (p ConstantPointer) Get(PointerResolver) (uint64, error)

Get returns the uint64 value of the pointer in constant address-space.

func (ConstantPointer) IsValid

func (p ConstantPointer) IsValid() bool

IsValid returns true.

func (ConstantPointer) Offset

func (p ConstantPointer) Offset(offset uint64) Pointer

Offset returns the sum of the pointer with offset.

func (ConstantPointer) Type

func (p ConstantPointer) Type() protocol.Type

Type returns TypeConstantPointer.

type F32

type F32 float32

F32 is a Value of type TypeFloat.

func (F32) Get

func (v F32) Get(PointerResolver) (uint64, error)

Get returns the IEEE 754 representation of the value packed into the low part of a uint64.

func (F32) Type

func (v F32) Type() protocol.Type

Type returns TypeFloat.

type F64

type F64 float64

F64 is a Value of type TypeDouble.

func (F64) Get

func (v F64) Get(PointerResolver) (uint64, error)

Get returns the IEEE 754 representation of the value packed into a uint64.

func (F64) Type

func (v F64) Type() protocol.Type

Type returns TypeDouble.

type Pointer

type Pointer interface {
	Value

	// Add returns the Pointer offset by v.
	Offset(v uint64) Pointer

	// IsValid returns true if the pointer is within acceptable ranges.
	IsValid() bool
}

Pointer is a pointer-typed Value.

type PointerResolver

type PointerResolver interface {
	// TranslateTemporaryPointer returns the temporary address-space pointer ptr
	// translated to volatile address-space.
	TranslateTemporaryPointer(ptr uint64) (uint64, error)

	// TranslateCapturePointer returns the capture-observed pointer
	// translated to volatile address-space.
	TranslateCapturePointer(ptr uint64) (uint64, error)
}

PointerResolver is used to translate pointers into the volatile address-space.

type S16

type S16 int16

S16 is a Value of type TypeInt16.

func (S16) Get

func (v S16) Get(PointerResolver) (uint64, error)

Get returns the value sign-extended to a uint64.

func (S16) Type

func (v S16) Type() protocol.Type

Type returns TypeInt16.

type S32

type S32 int32

S32 is a Value of type TypeInt32.

func (S32) Get

func (v S32) Get(PointerResolver) (uint64, error)

Get returns the value sign-extended to a uint64.

func (S32) Type

func (v S32) Type() protocol.Type

Type returns TypeInt32.

type S64

type S64 int64

S64 is a Value of type TypeInt64.

func (S64) Get

func (v S64) Get(PointerResolver) (uint64, error)

Get returns the value reinterpreted as a uint64.

func (S64) Type

func (v S64) Type() protocol.Type

Type returns TypeInt64.

type S8

type S8 int8

S8 is a Value of type TypeInt8.

func (S8) Get

func (v S8) Get(PointerResolver) (uint64, error)

Get returns the value sign-extended to a uint64.

func (S8) Type

func (v S8) Type() protocol.Type

Type returns TypeInt8.

type U16

type U16 uint16

U16 is a Value of type TypeUint16.

func (U16) Get

func (v U16) Get(PointerResolver) (uint64, error)

Get returns the value zero-extended to a uint64.

func (U16) Type

func (v U16) Type() protocol.Type

Type returns TypeUint16.

type U32

type U32 uint32

U32 is a Value of type TypeUint32.

func (U32) Get

func (v U32) Get(PointerResolver) (uint64, error)

Get returns the value zero-extended to a uint64.

func (U32) Type

func (v U32) Type() protocol.Type

Type returns TypeUint32.

type U64

type U64 uint64

U64 is a Value of type TypeUint64.

func (U64) Get

func (v U64) Get(PointerResolver) (uint64, error)

Get returns the value zero-extended to a uint64.

func (U64) Type

func (v U64) Type() protocol.Type

Type returns TypeUint64.

type U8

type U8 uint8

U8 is a Value of type TypeUint8.

func (U8) Get

func (v U8) Get(PointerResolver) (uint64, error)

Get returns the value zero-extended to a uint64.

func (U8) Type

func (v U8) Type() protocol.Type

Type returns TypeUint8.

type Value

type Value interface {
	// Type returns the virtual-machine type of the Value.
	Type() protocol.Type

	// Get returns the bit-representation of the value. For example a boolean
	// value would either be 0 or 1, a uint32 value would be zero-extended, a
	// float64 would be the IEEE 754 representation reinterpreted as a uint64.
	Get(PointerResolver) (uint64, error)
}

Value is the interface for all values to be passed either in opcodes or constant memory to the replay virtual machine.

type VolatileCapturePointer

type VolatileCapturePointer uint64

VolatileCapturePointer is a pointer that was observed at capture time. Pointers of this type are remapped to an equivalent volatile address-space pointer before being passed to the protocol.

func (VolatileCapturePointer) Get

func (p VolatileCapturePointer) Get(r PointerResolver) (uint64, error)

Get returns the observed pointer translated to an equivalent volatile address-space pointer.

func (VolatileCapturePointer) IsValid

func (p VolatileCapturePointer) IsValid() bool

IsValid returns true if the pointer considered valid. Currently this is a test for the pointer being greater than 0x10000 as low addresses are likely to be a wrong interpretation of the value. This may change in the future.

func (VolatileCapturePointer) Offset

func (p VolatileCapturePointer) Offset(offset uint64) Pointer

Offset returns the sum of the pointer with offset.

func (VolatileCapturePointer) Type

func (p VolatileCapturePointer) Type() protocol.Type

Type returns TypeVolatilePointer.

type VolatilePointer

type VolatilePointer uint64

VolatilePointer is a pointer to the volatile address-space. Unlike VolatileCapturePointer, there is no remapping.

func (VolatilePointer) Get

func (p VolatilePointer) Get(PointerResolver) (uint64, error)

Get returns the uint64 value of the pointer in volatile address-space.

func (VolatilePointer) IsValid

func (p VolatilePointer) IsValid() bool

IsValid returns true.

func (VolatilePointer) Offset

func (p VolatilePointer) Offset(offset uint64) Pointer

Offset returns the sum of the pointer with offset.

func (VolatilePointer) Type

func (p VolatilePointer) Type() protocol.Type

Type returns TypeVolatilePointer.

type VolatileTemporaryPointer

type VolatileTemporaryPointer uint64

VolatileTemporaryPointer is a pointer to in temporary address-space. The temporary address-space sits within a reserved area of the the volatile address space and its offset is calculated dynamically.

func (VolatileTemporaryPointer) Get

func (p VolatileTemporaryPointer) Get(r PointerResolver) (uint64, error)

Get returns the dynamically calculated offset of the temporary pointer within volatile address-space.

func (VolatileTemporaryPointer) IsValid

func (p VolatileTemporaryPointer) IsValid() bool

IsValid returns true.

func (VolatileTemporaryPointer) Offset

func (p VolatileTemporaryPointer) Offset(offset uint64) Pointer

Offset returns the sum of the pointer with offset.

func (VolatileTemporaryPointer) Type

func (p VolatileTemporaryPointer) Type() protocol.Type

Type returns TypeVolatilePointer.