Module openj9.dtfj
Class MutableAddressSpace
- java.lang.Object
-
- com.ibm.j9ddr.corereaders.tdump.zebedee.dumpreader.AddressSpace
-
- com.ibm.j9ddr.corereaders.tdump.zebedee.dumpreader.MutableAddressSpace
-
- All Implemented Interfaces:
Emulator.ImageSpace,Serializable
public final class MutableAddressSpace extends AddressSpace implements Emulator.ImageSpace
Provides the ability to write as well as read to a copy of the address space. This class is provided for use by theEmulator.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected longlastMutableBlockAddressThe last mutable block address requested (quick block cache)-
Fields declared in class com.ibm.j9ddr.corereaders.tdump.zebedee.dumpreader.AddressSpace
addressMap, asid, dump, lastBlockAddress, lastButOneBlockAddress, ranges, WILD_POINTER
-
-
Constructor Summary
Constructors Constructor Description MutableAddressSpace(AddressSpace space)Creates a new MutableAddressSpace from the given AddressSpace.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidallocPage(long address)Allocate a page of memory at the given address.voidfree(long ptr)Free the memory that was previously allocated by malloc.protected byte[]getBlockFromCacheOrDisk(long address)Get the block of bytes for the given address.longmalloc(int size)Allocate a chunk of unused memory.longrmalloc(int size)voidwriteByte(long address, int value)Write a byte at the specified address.voidwriteBytes(long address, byte[] array)Write the contents of the byte array to the specified address.voidwriteInt(long address, int value)Write an int at the specified address.voidwriteLong(long address, long value)Write a long at the specified address.voidwriteShort(long address, int value)Write a short at the specified address.voidwriteWord(long address, long value)Write a word at the specified address.-
Methods declared in class com.ibm.j9ddr.corereaders.tdump.zebedee.dumpreader.AddressSpace
getAddressRanges, getAsid, getBlock, getDump, getImageInputStream, getLowestAddress, getRootAddressSpace, getUnusedAddressRanges, getUserMap, getWordLength, is64bit, isValidAddress, read, read, readAsciiCString, readAsciiString, readAsciiString, readByte, readEbcdicCString, readEbcdicString, readEbcdicString, readInt, readLong, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUtf8String, readWord, readWord, roundToPage, setIs64bit, toString
-
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods declared in interface com.ibm.j9ddr.corereaders.tdump.zebedee.util.Emulator.ImageSpace
is64bit, readInt, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort
-
-
-
-
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 IOExceptionGet 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:
getBlockFromCacheOrDiskin classAddressSpace- Throws:
IOException
-
writeBytes
public void writeBytes(long address, byte[] array) throws IOExceptionWrite 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 IOExceptionWrite 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 IOExceptionWrite a byte at the specified address.- Specified by:
writeBytein interfaceEmulator.ImageSpace- Throws:
IOException- if the given address is not present in this address space
-
writeShort
public void writeShort(long address, int value) throws IOExceptionWrite a short at the specified address.- Specified by:
writeShortin interfaceEmulator.ImageSpace- Throws:
IOException- if the given address is not present in this address space
-
writeInt
public void writeInt(long address, int value) throws IOExceptionWrite an int at the specified address.- Specified by:
writeIntin interfaceEmulator.ImageSpace- Throws:
IOException- if the given address is not present in this address space
-
writeLong
public void writeLong(long address, long value) throws IOExceptionWrite a long at the specified address.- Specified by:
writeLongin interfaceEmulator.ImageSpace- Throws:
IOException- if the given address is not present in this address space
-
malloc
public long malloc(int size) throws IOExceptionAllocate 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:
mallocin interfaceEmulator.ImageSpace- Returns:
- the address of the allocated memory
- Throws:
IOException
-
rmalloc
public long rmalloc(int size) throws IOException- Throws:
IOException
-
free
public void free(long ptr) throws IOExceptionFree the memory that was previously allocated by malloc.- Throws:
IOException
-
allocPage
public void allocPage(long address) throws IOExceptionAllocate 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
-
-