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 long
lastMutableBlockAddress
The 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 void
allocPage(long address)
Allocate a page of memory at the given address.void
free(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.long
malloc(int size)
Allocate a chunk of unused memory.long
rmalloc(int size)
void
writeByte(long address, int value)
Write a byte at the specified address.void
writeBytes(long address, byte[] array)
Write the contents of the byte array to the specified address.void
writeInt(long address, int value)
Write an int at the specified address.void
writeLong(long address, long value)
Write a long at the specified address.void
writeShort(long address, int value)
Write a short at the specified address.void
writeWord(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 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 classAddressSpace
- 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 interfaceEmulator.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 interfaceEmulator.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 interfaceEmulator.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 interfaceEmulator.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 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 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
-
-