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

Quick Search    Search Deep

Allocator
Class CodeAllocator.x86CodeBuffer  view CodeAllocator.x86CodeBuffer download CodeAllocator.x86CodeBuffer.java

java.lang.Object
  extended byAllocator.CodeAllocator.x86CodeBuffer
Direct Known Subclasses:
RuntimeCodeAllocator.Runtimex86CodeBuffer
Enclosing class:
CodeAllocator

public abstract static class CodeAllocator.x86CodeBuffer
extends java.lang.Object

This class provides the interface for x86 code buffers. These code buffers are used to store generated x86 code. After the code is generated, use the allocateCodeBlock method to obtain a jq_CompiledCode object.


Constructor Summary
CodeAllocator.x86CodeBuffer()
           
 
Method Summary
abstract  void add1(byte i)
          Adds one byte to the end of this code buffer.
abstract  void add2_endian(int i)
          Adds two bytes (little-endian) to the end of this code buffer.
abstract  void add2(int i)
          Adds two bytes (big-endian) to the end of this code buffer.
abstract  void add3(int i)
          Adds three bytes (big-endian) to the end of this code buffer.
abstract  void add4_endian(int i)
          Adds four bytes (little-endian) to the end of this code buffer.
abstract  Clazz.jq_CompiledCode allocateCodeBlock(Clazz.jq_Method m, Clazz.jq_TryCatch[] ex, Clazz.jq_BytecodeMap bcm, Run_Time.ExceptionDeliverer x, int stackframesize, java.util.List codeRelocs, java.util.List dataRelocs)
          Uses the code in this buffer, along with the arguments, to create a jq_CompiledCode object.
abstract  byte get1(int k)
          Gets the byte at the given offset in this code buffer.
abstract  int get4_endian(int k)
          Gets the (little-endian) 4 bytes at the given offset in this code buffer.
abstract  Memory.CodeAddress getCurrentAddress()
          Returns the current address in this code buffer.
abstract  int getCurrentOffset()
          Returns the current offset in this code buffer.
abstract  Memory.CodeAddress getStartAddress()
          Returns the current address in this code buffer.
abstract  void put1(int k, byte instr)
          Sets the byte at the given offset to the given value.
abstract  void put4_endian(int k, int instr)
          Sets the 4 bytes at the given offset to the given (little-endian) value.
abstract  void setEntrypoint()
          Sets the current address as the entrypoint to this code buffer.
abstract  void skip(int nbytes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeAllocator.x86CodeBuffer

public CodeAllocator.x86CodeBuffer()
Method Detail

getCurrentOffset

public abstract int getCurrentOffset()
Returns the current offset in this code buffer.


getStartAddress

public abstract Memory.CodeAddress getStartAddress()
Returns the current address in this code buffer.


getCurrentAddress

public abstract Memory.CodeAddress getCurrentAddress()
Returns the current address in this code buffer.


setEntrypoint

public abstract void setEntrypoint()
Sets the current address as the entrypoint to this code buffer.


add1

public abstract void add1(byte i)
Adds one byte to the end of this code buffer. Offset/address increase by 1.


add2_endian

public abstract void add2_endian(int i)
Adds two bytes (little-endian) to the end of this code buffer. Offset/address increase by 2.


add2

public abstract void add2(int i)
Adds two bytes (big-endian) to the end of this code buffer. Offset/address increase by 2.


add3

public abstract void add3(int i)
Adds three bytes (big-endian) to the end of this code buffer. Offset/address increase by 3.


add4_endian

public abstract void add4_endian(int i)
Adds four bytes (little-endian) to the end of this code buffer. Offset/address increase by 4.


get1

public abstract byte get1(int k)
Gets the byte at the given offset in this code buffer.


get4_endian

public abstract int get4_endian(int k)
Gets the (little-endian) 4 bytes at the given offset in this code buffer.


put1

public abstract void put1(int k,
                          byte instr)
Sets the byte at the given offset to the given value.


put4_endian

public abstract void put4_endian(int k,
                                 int instr)
Sets the 4 bytes at the given offset to the given (little-endian) value.


skip

public abstract void skip(int nbytes)

allocateCodeBlock

public abstract Clazz.jq_CompiledCode allocateCodeBlock(Clazz.jq_Method m,
                                                        Clazz.jq_TryCatch[] ex,
                                                        Clazz.jq_BytecodeMap bcm,
                                                        Run_Time.ExceptionDeliverer x,
                                                        int stackframesize,
                                                        java.util.List codeRelocs,
                                                        java.util.List dataRelocs)
Uses the code in this buffer, along with the arguments, to create a jq_CompiledCode object. Call this method after you are done generating code, and actually want to use it.