Module openj9.dtfj

Class MutableAddressSpace

    • Field Detail

      • lastMutableBlockAddress

        protected long lastMutableBlockAddress
        The last mutable block address requested (quick block cache)
    • Constructor Detail

      • MutableAddressSpace

        public MutableAddressSpace​(AddressSpace space)
        Creates a new MutableAddressSpace from the given AddressSpace. Updates to this "forked" copy will not be reflected in the parent AddressSpace.
        Parameters:
        AddressSpace - the address space we read from
    • Method Detail

      • getBlockFromCacheOrDisk

        protected byte[] getBlockFromCacheOrDisk​(long address)
                                          throws IOException
        Get the block of bytes for the given address. We look first in our own cache and if its not there call the superclass method.
        Overrides:
        getBlockFromCacheOrDisk in class AddressSpace
        Throws:
        IOException
      • writeBytes

        public void writeBytes​(long address,
                               byte[] array)
                        throws IOException
        Write the contents of the byte array to the specified address.
        Throws:
        IOException - if the given address (of offset from there) is not present in this address space
      • writeWord

        public void writeWord​(long address,
                              long value)
                       throws IOException
        Write a word at the specified address. A word is either 32 or 64 bits depending on the machine context.
        Throws:
        IOException
      • writeByte

        public void writeByte​(long address,
                              int value)
                       throws IOException
        Write a byte at the specified address.
        Specified by:
        writeByte in interface Emulator.ImageSpace
        Throws:
        IOException - if the given address is not present in this address space
      • writeShort

        public void writeShort​(long address,
                               int value)
                        throws IOException
        Write a short at the specified address.
        Specified by:
        writeShort in interface Emulator.ImageSpace
        Throws:
        IOException - if the given address is not present in this address space
      • writeInt

        public void writeInt​(long address,
                             int value)
                      throws IOException
        Write an int at the specified address.
        Specified by:
        writeInt in interface Emulator.ImageSpace
        Throws:
        IOException - if the given address is not present in this address space
      • writeLong

        public void writeLong​(long address,
                              long value)
                       throws IOException
        Write a long at the specified address.
        Specified by:
        writeLong in interface Emulator.ImageSpace
        Throws:
        IOException - if the given address is not present in this address space
      • malloc

        public long malloc​(int size)
                    throws IOException
        Allocate a chunk of unused memory. This searches the known address ranges and tries to find an unallocated area of the given size. If successful, this area effectively becomes part of this ImageSpace and may be read and written to as normal. This method is used by users of the Emulator for things like allocating stack, arguments etc.
        Specified by:
        malloc in interface Emulator.ImageSpace
        Returns:
        the address of the allocated memory
        Throws:
        IOException
      • free

        public void free​(long ptr)
                  throws IOException
        Free the memory that was previously allocated by malloc.
        Throws:
        IOException
      • allocPage

        public void allocPage​(long address)
                       throws IOException
        Allocate a page of memory at the given address. The address must not already be in use. A page is 4096 bytes in length. Address must be on a page boundary.
        Throws:
        IOException