joeq.Allocator
Class DefaultCodeAllocator

java.lang.Object
  extended by joeq.Allocator.DefaultCodeAllocator

public abstract class DefaultCodeAllocator
extends Object

Provides access functions to the default code allocator. If the default_allocator is set, it is used as the default global code allocator. Otherwise, the code allocator of the current thread is used.

Version:
$Id: DefaultCodeAllocator.java,v 1.12 2005/01/21 07:13:15 joewhaley Exp $
Author:
John Whaley

Field Summary
static jq_StaticField _default_allocator
           
static CodeAllocator default_allocator
          The default global code allocator.
 
Constructor Summary
DefaultCodeAllocator()
           
 
Method Summary
static CodeAllocator def()
          Gets the default code allocator for the current thread.
static CodeAllocator.x86CodeBuffer getCodeBuffer(int estimatedSize, int offset, int alignment)
          Get a code buffer from the default code allocator.
static void init()
          Initialize the default code allocator.
static void patchAbsolute(Address code, Address heap)
          Patch the code address to point to the given heap address in the default code allocator.
static void patchRelativeOffset(CodeAddress code, CodeAddress target)
          Patch the code address to be a relative offset to another code address.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

default_allocator

public static CodeAllocator default_allocator
The default global code allocator. If this is set, all threads use this allocator instead of their thread-local allocators.


_default_allocator

public static final jq_StaticField _default_allocator
Constructor Detail

DefaultCodeAllocator

public DefaultCodeAllocator()
Method Detail

def

public static final CodeAllocator def()
Gets the default code allocator for the current thread.

Returns:
default code allocator for the current thread

init

public static final void init()
Initialize the default code allocator.


getCodeBuffer

public static final CodeAllocator.x86CodeBuffer getCodeBuffer(int estimatedSize,
                                                              int offset,
                                                              int alignment)
Get a code buffer from the default code allocator.

Parameters:
estimatedSize -
offset -
alignment -
Returns:
a new code buffer

patchAbsolute

public static final void patchAbsolute(Address code,
                                       Address heap)
Patch the code address to point to the given heap address in the default code allocator.

Parameters:
code -
heap -

patchRelativeOffset

public static final void patchRelativeOffset(CodeAddress code,
                                             CodeAddress target)
Patch the code address to be a relative offset to another code address.

Parameters:
code -
target -


Copyright © 2001-2005 John Whaley. All Rights Reserved.