joeq.Bootstrap
Class BootstrapCodeAllocator

java.lang.Object
  extended by joeq.Allocator.CodeAllocator
      extended by 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

Nested Class Summary
 class BootstrapCodeAllocator.Bootstrapx86CodeBuffer
           
 
Nested classes/interfaces inherited from class joeq.Allocator.CodeAllocator
CodeAllocator.InstructionPointer, CodeAllocator.x86CodeBuffer
 
Field Summary
static BootstrapCodeAllocator DEFAULT
           
 
Fields inherited from class joeq.Allocator.CodeAllocator
_class, _compiledMethods, _highAddress, _lowAddress, compiledMethods, TRACE
 
Constructor Summary
BootstrapCodeAllocator()
          Creates new BootstrapCodeAllocator
 
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 joeq.Allocator.CodeAllocator
getCodeContaining, getCompiledMethods, getHighAddress, getLowAddress, getNumberOfCompiledMethods, initializeCompiledMethodMap, registerCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final BootstrapCodeAllocator DEFAULT
Constructor Detail

BootstrapCodeAllocator

public BootstrapCodeAllocator()
Creates new BootstrapCodeAllocator

Method Detail

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 buffer
offset - desired offset to align to
alignment - 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 patch
heap - 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 patch
target - 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.