Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Allocator
Class RuntimeCodeAllocator  view RuntimeCodeAllocator download RuntimeCodeAllocator.java

java.lang.Object
  extended byAllocator.CodeAllocator
      extended byAllocator.RuntimeCodeAllocator

public class RuntimeCodeAllocator
extends CodeAllocator

RuntimeCodeAllocator

Version:
$Id: RuntimeCodeAllocator.java,v 1.19 2003/05/12 10:04:52 joewhaley Exp $

Nested Class Summary
 class RuntimeCodeAllocator.Runtimex86CodeBuffer
           
 
Nested classes inherited from class Allocator.CodeAllocator
CodeAllocator.InstructionPointer, CodeAllocator.x86CodeBuffer
 
Field Summary
static int BLOCK_SIZE
          Size of blocks allocated from the OS.
private  Memory.CodeAddress heapCurrent
          Pointers to the start, current, and end of the heap.
private  Memory.CodeAddress heapEnd
          Pointers to the start, current, and end of the heap.
private  Memory.CodeAddress heapFirst
          Pointer to the first block.
private  Memory.CodeAddress heapStart
          Pointers to the start, current, and end of the heap.
(package private)  boolean isGenerating
           
private  int maxFreePrevious
          Max memory free in all allocated blocks.
 
Fields inherited from class Allocator.CodeAllocator
_highAddress, _lowAddress, TRACE
 
Constructor Summary
RuntimeCodeAllocator()
           
 
Method Summary
private  void allocateNewBlock(int blockSize)
           
static short endian2(int k)
           
 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(Memory.Address addr1, Memory.Address addr2)
          Patch the given address to refer to the other given address, in absolute terms.
 void patchRelativeOffset(Memory.CodeAddress code, Memory.CodeAddress target)
          Patch the given code address to refer to the given code address, in relative terms.
 
Methods inherited from class 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

BLOCK_SIZE

public static final int BLOCK_SIZE
Size of blocks allocated from the OS.

See Also:
Constant Field Values

heapStart

private Memory.CodeAddress heapStart
Pointers to the start, current, and end of the heap.


heapCurrent

private Memory.CodeAddress heapCurrent
Pointers to the start, current, and end of the heap.


heapEnd

private Memory.CodeAddress heapEnd
Pointers to the start, current, and end of the heap.


heapFirst

private Memory.CodeAddress heapFirst
Pointer to the first block.


maxFreePrevious

private int maxFreePrevious
Max memory free in all allocated blocks.


isGenerating

volatile boolean isGenerating
Constructor Detail

RuntimeCodeAllocator

public RuntimeCodeAllocator()
Method Detail

init

public void init()
          throws java.lang.OutOfMemoryError
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. 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.)

Specified by:
getCodeBuffer in class CodeAllocator

allocateNewBlock

private void allocateNewBlock(int blockSize)
                       throws java.lang.OutOfMemoryError

patchAbsolute

public void patchAbsolute(Memory.Address addr1,
                          Memory.Address addr2)
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

patchRelativeOffset

public void patchRelativeOffset(Memory.CodeAddress code,
                                Memory.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

endian2

public static short endian2(int k)