Package ghidra.pcode.exec

# Class BytesPcodeExecutorStateSpace<B>

java.lang.Object
ghidra.pcode.exec.BytesPcodeExecutorStateSpace<B>

Type Parameters:
  `B` - if this space is a cache, the type of object backing this space

public class BytesPcodeExecutorStateSpace<B> extends Object
A p-code executor state space for storing and retrieving bytes as arrays

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final B`
  `backing`
  `protected final SemisparseByteArray`
  `bytes`
  `protected static final byte[]`
  `EMPTY`
  `protected final Language`
  `language`
  `protected final AddressSpace`
  `space`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  ``
  `BytesPcodeExecutorStateSpace(Language language, AddressSpace space, B backing)`
  Construct an internal space for the given address space
  `protected`
  `BytesPcodeExecutorStateSpace(Language language, AddressSpace space, B backing, SemisparseByteArray bytes)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected AddressRange`
  `addrRng(ULongSpan span)`
  `protected AddressSet`
  `addrSet(ULongSpan.ULongSpanSet set)`
  `void`
  `clear()`
  `BytesPcodeExecutorStateSpace<B>`
  `fork()`
  `Map<Register,byte[]>`
  `getRegisterValues(List<Register> registers)`
  `protected Set<Register>`
  `getRegs(AddressSetView set)`
  `byte[]`
  `read(long offset, int size, PcodeExecutorStatePiece.Reason reason)`
  Read a value from the space at the given offset
  `protected byte[]`
  `readBytes(long offset, int size, PcodeExecutorStatePiece.Reason reason)`
  Read a value from cache (or raw space if not acting as a cache) at the given offset
  `protected ULongSpan.ULongSpanSet`
  `readUninitializedFromBacking(ULongSpan.ULongSpanSet uninitialized)`
  Extension point: Read from backing into this space, when acting as a cache.
  `protected ULongSpan`
  `spanRng(AddressRange range)`
  `protected ULongSpan.ULongSpanSet`
  `spanSet(AddressSetView set)`
  This assumes without assertion that the set is contained in this space
  `protected void`
  `warnAddressSet(String message, AddressSetView set)`
  `protected void`
  `warnUninit(ULongSpan.ULongSpanSet uninit)`
  `void`
  `write(long offset, byte[] val, int srcOffset, int length)`
  Write a value at the given offset

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### EMPTY

    protected static final byte[] EMPTY

  - ### bytes

    protected final SemisparseByteArray bytes

  - ### language

    protected final Language language

  - ### space

    protected final AddressSpace space

  - ### backing

    protected final B backing

- ## Constructor Details

  - ### BytesPcodeExecutorStateSpace

    public BytesPcodeExecutorStateSpace(Language language, AddressSpace space, B backing)
    Construct an internal space for the given address space
    Parameters:
      `language` - the language, for logging diagnostics
      `space` - the address space
      `backing` - the backing object, possibly `null`

  - ### BytesPcodeExecutorStateSpace

    protected BytesPcodeExecutorStateSpace(Language language, AddressSpace space, B backing, SemisparseByteArray bytes)

- ## Method Details

  - ### fork

    public BytesPcodeExecutorStateSpace<B> fork()

  - ### write

    public void write(long offset, byte[] val, int srcOffset, int length)
    Write a value at the given offset
    Parameters:
      `offset` - the offset
      `val` - the value

  - ### readUninitializedFromBacking

    protected ULongSpan.ULongSpanSet readUninitializedFromBacking(ULongSpan.ULongSpanSet uninitialized)
    Extension point: Read from backing into this space, when acting as a cache.
    Parameters:
      `uninitialized` - the ranges which need to be read.
    Returns:
      the ranges which remain uninitialized

  - ### readBytes

    protected byte[] readBytes(long offset, int size, PcodeExecutorStatePiece.Reason reason)
    Read a value from cache (or raw space if not acting as a cache) at the given offset
    Parameters:
      `offset` - the offset
      `size` - the number of bytes to read (the size of the value)
    Returns:
      the bytes read

  - ### addrRng

    protected AddressRange addrRng(ULongSpan span)

  - ### spanRng

    protected ULongSpan spanRng(AddressRange range)

  - ### addrSet

    protected AddressSet addrSet(ULongSpan.ULongSpanSet set)

  - ### spanSet

    protected ULongSpan.ULongSpanSet spanSet(AddressSetView set)
    This assumes without assertion that the set is contained in this space
    Parameters:
      `set` - the address set
    Returns:
      the unsigned long span set

  - ### getRegs

    protected Set<Register> getRegs(AddressSetView set)

  - ### warnAddressSet

    protected void warnAddressSet(String message, AddressSetView set)

  - ### warnUninit

    protected void warnUninit(ULongSpan.ULongSpanSet uninit)

  - ### read

    public byte[] read(long offset, int size, PcodeExecutorStatePiece.Reason reason)
    Read a value from the space at the given offset

    If this space is not acting as a cache, this simply delegates to `readBytes(long, int, Reason)`. Otherwise, it will first ensure the cache covers the requested value.

    Parameters:
      `offset` - the offset
      `size` - the number of bytes to read (the size of the value)
      `reason` - the reason for reading state
    Returns:
      the bytes read

  - ### getRegisterValues

    public Map<Register,byte[]> getRegisterValues(List<Register> registers)

  - ### clear

    public void clear()