joeq.Bootstrap
Class BootstrapCodeAllocator
java.lang.Object
joeq.Allocator.CodeAllocator
joeq.Bootstrap.BootstrapCodeAllocator
public class BootstrapCodeAllocator
- extends CodeAllocator
BootstrapCodeAllocator
- Version:
- $Id: BootstrapCodeAllocator.java,v 1.17 2004/09/30 03:35:29 joewhaley Exp $
- Author:
- John Whaley
Method Summary |
void |
dump(ByteBuffer out)
|
void |
dump(DataOutput out)
|
void |
ensureCapacity(int size)
|
List |
getAllCodeRelocs()
|
List |
getAllDataRelocs()
|
CodeAllocator.x86CodeBuffer |
getCodeBuffer(int estimatedSize,
int offset,
int alignment)
Allocate a code buffer of the given estimated size, such that the given
offset will have the given alignment. |
void |
init()
Initialize this code allocator. |
void |
patchAbsolute(Address code,
Address heap)
Patch the given address to refer to the other given address, in
absolute terms. |
void |
patchRelativeOffset(CodeAddress code,
CodeAddress target)
Patch the given code address to refer to the given code address, in
relative terms. |
Address |
peek(CodeAddress k)
|
byte |
peek1(CodeAddress k)
|
short |
peek2(CodeAddress k)
|
int |
peek4(CodeAddress k)
|
long |
peek8(CodeAddress k)
|
void |
poke(CodeAddress k,
Address v)
|
void |
poke1(CodeAddress k,
byte v)
|
void |
poke2(CodeAddress k,
short v)
|
void |
poke4(CodeAddress k,
int v)
|
void |
poke8(CodeAddress k,
long v)
|
int |
size()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT
public static final BootstrapCodeAllocator DEFAULT
BootstrapCodeAllocator
public BootstrapCodeAllocator()
- Creates new BootstrapCodeAllocator
init
public void init()
- Description copied from class:
CodeAllocator
- Initialize this code allocator. This method is always called before the
code allocator is actually used.
- Specified by:
init
in class CodeAllocator
getCodeBuffer
public CodeAllocator.x86CodeBuffer getCodeBuffer(int estimatedSize,
int offset,
int alignment)
- Allocate a code buffer of the given estimated size, such that the given
offset will have the given alignment.
In this allocator, the memory is allocated in chunks, so exceeding the
estimated size doesn't cost extra.
- Specified by:
getCodeBuffer
in class CodeAllocator
- Parameters:
estimatedSize
- estimated size, in bytes, of desired code bufferoffset
- desired offset to align toalignment
- desired alignment, or 0 if don't care
- Returns:
- the new code buffer
size
public int size()
ensureCapacity
public void ensureCapacity(int size)
getAllCodeRelocs
public List getAllCodeRelocs()
getAllDataRelocs
public List getAllDataRelocs()
dump
public void dump(ByteBuffer out)
dump
public void dump(DataOutput out)
throws IOException
- Throws:
IOException
patchAbsolute
public void patchAbsolute(Address code,
Address heap)
- Description copied from class:
CodeAllocator
- Patch the given address to refer to the other given address, in
absolute terms. This is used to patch heap address references in the
code, and code references in the heap.
- Specified by:
patchAbsolute
in class CodeAllocator
- Parameters:
code
- address to patchheap
- address to patch to
patchRelativeOffset
public void patchRelativeOffset(CodeAddress code,
CodeAddress target)
- Description copied from class:
CodeAllocator
- Patch the given code address to refer to the given code address, in
relative terms. This is used to patch branch targets in the code.
- Specified by:
patchRelativeOffset
in class CodeAllocator
- Parameters:
code
- code address to patchtarget
- code address to patch to
poke
public void poke(CodeAddress k,
Address v)
poke1
public void poke1(CodeAddress k,
byte v)
poke2
public void poke2(CodeAddress k,
short v)
poke4
public void poke4(CodeAddress k,
int v)
poke8
public void poke8(CodeAddress k,
long v)
peek
public Address peek(CodeAddress k)
peek1
public byte peek1(CodeAddress k)
peek2
public short peek2(CodeAddress k)
peek4
public int peek4(CodeAddress k)
peek8
public long peek8(CodeAddress k)
Copyright © 2001-2005 John Whaley. All Rights Reserved.