|
|||||||||
Home >> All >> [ Allocator overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
Allocator
Class CodeAllocator

java.lang.ObjectAllocator.CodeAllocator
- Direct Known Subclasses:
- RuntimeCodeAllocator
- public abstract class CodeAllocator
- extends java.lang.Object
This class provides the abstract interface for code allocators. A code allocator handles the allocation and management of code buffers. It also provides static methods for keeping track of the compiled methods and their address ranges. It also includes an inner class that provides the interface for code buffers.
- Version:
- $Id: CodeAllocator.java,v 1.19 2003/05/12 10:04:52 joewhaley Exp $
Nested Class Summary | |
static class |
CodeAllocator.InstructionPointer
An object of this class represents a code address. |
static class |
CodeAllocator.x86CodeBuffer
This class provides the interface for x86 code buffers. |
Field Summary | |
static Clazz.jq_StaticField |
_highAddress
|
static Clazz.jq_StaticField |
_lowAddress
|
private static java.util.SortedMap |
compiledMethods
Map of compiled methods, sorted by address. |
private static Memory.CodeAddress |
highAddress
Address range of compiled code. |
private static Memory.CodeAddress |
lowAddress
Address range of compiled code. |
static boolean |
TRACE
Trace flag. |
Constructor Summary | |
CodeAllocator()
|
Method Summary | |
abstract 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. |
static Clazz.jq_CompiledCode |
getCodeContaining(Memory.CodeAddress ip)
Return the compiled code which contains the given code address. |
static java.util.Iterator |
getCompiledMethods()
Returns an iterator of the registered jq_CompiledCode objects, in address order. |
static Memory.CodeAddress |
getHighAddress()
Returns the highest address of any registered code. |
static Memory.CodeAddress |
getLowAddress()
Returns the lowest address of any registered code. |
static int |
getNumberOfCompiledMethods()
Returns the number of registered jq_CompiledCode objects. |
abstract void |
init()
Initialize this code allocator. |
static void |
initializeCompiledMethodMap()
|
abstract void |
patchAbsolute(Memory.Address addr1,
Memory.Address addr2)
Patch the given address to refer to the other given address, in absolute terms. |
abstract void |
patchRelativeOffset(Memory.CodeAddress code,
Memory.CodeAddress target)
Patch the given code address to refer to the given code address, in relative terms. |
static void |
registerCode(Clazz.jq_CompiledCode cc)
Register the given compiled code, so lookups by address will return this code. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
TRACE
public static boolean TRACE
- Trace flag.
compiledMethods
private static final java.util.SortedMap compiledMethods
- Map of compiled methods, sorted by address.
lowAddress
private static Memory.CodeAddress lowAddress
- Address range of compiled code. Code outside of this range cannot be
generated by us.
highAddress
private static Memory.CodeAddress highAddress
- Address range of compiled code. Code outside of this range cannot be
generated by us.
_lowAddress
public static final Clazz.jq_StaticField _lowAddress
_highAddress
public static final Clazz.jq_StaticField _highAddress
Constructor Detail |
CodeAllocator
public CodeAllocator()
Method Detail |
init
public abstract void init()
- Initialize this code allocator. This method is always called before the
code allocator is actually used.
getCodeBuffer
public abstract 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.
It is legal for code to exceed the estimated size, but the cost may be
high (i.e. it may require recopying of the buffer.)
patchAbsolute
public abstract void patchAbsolute(Memory.Address addr1, Memory.Address addr2)
- 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.
patchRelativeOffset
public abstract void patchRelativeOffset(Memory.CodeAddress code, Memory.CodeAddress target)
- 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.
initializeCompiledMethodMap
public static void initializeCompiledMethodMap()
registerCode
public static void registerCode(Clazz.jq_CompiledCode cc)
- Register the given compiled code, so lookups by address will return
this code.
getCodeContaining
public static Clazz.jq_CompiledCode getCodeContaining(Memory.CodeAddress ip)
- Return the compiled code which contains the given code address.
Returns null if there is no registered code that contains the
given address.
getLowAddress
public static Memory.CodeAddress getLowAddress()
- Returns the lowest address of any registered code.
getHighAddress
public static Memory.CodeAddress getHighAddress()
- Returns the highest address of any registered code.
getCompiledMethods
public static java.util.Iterator getCompiledMethods()
- Returns an iterator of the registered jq_CompiledCode objects, in
address order.
getNumberOfCompiledMethods
public static int getNumberOfCompiledMethods()
- Returns the number of registered jq_CompiledCode objects.
|
|||||||||
Home >> All >> [ Allocator overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |