joeq.Bootstrap
Class BootstrapCodeAllocator.Bootstrapx86CodeBuffer

java.lang.Object
  extended by joeq.Allocator.CodeAllocator.x86CodeBuffer
      extended by joeq.Bootstrap.BootstrapCodeAllocator.Bootstrapx86CodeBuffer
Enclosing class:
BootstrapCodeAllocator

public class BootstrapCodeAllocator.Bootstrapx86CodeBuffer
extends CodeAllocator.x86CodeBuffer


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

Method Detail

getStartIndex

public int getStartIndex()

getEntryIndex

public int getEntryIndex()

getCurrentOffset

public int getCurrentOffset()
Description copied from class: CodeAllocator.x86CodeBuffer
Returns the current offset in this code buffer.

Specified by:
getCurrentOffset in class CodeAllocator.x86CodeBuffer
Returns:
current offset

getStartAddress

public CodeAddress getStartAddress()
Description copied from class: CodeAllocator.x86CodeBuffer
Returns the current address in this code buffer.

Specified by:
getStartAddress in class CodeAllocator.x86CodeBuffer
Returns:
current address

getCurrentAddress

public CodeAddress getCurrentAddress()
Description copied from class: CodeAllocator.x86CodeBuffer
Returns the current address in this code buffer.

Specified by:
getCurrentAddress in class CodeAllocator.x86CodeBuffer
Returns:
current address

setEntrypoint

public void setEntrypoint()
Description copied from class: CodeAllocator.x86CodeBuffer
Sets the current address as the entrypoint to this code buffer.

Specified by:
setEntrypoint in class CodeAllocator.x86CodeBuffer

checkSize

public void checkSize()

add1

public void add1(byte i)
Description copied from class: CodeAllocator.x86CodeBuffer
Adds one byte to the end of this code buffer. Offset/address increase by 1.

Specified by:
add1 in class CodeAllocator.x86CodeBuffer
Parameters:
i - the byte to add

add2_endian

public void add2_endian(int i)
Description copied from class: CodeAllocator.x86CodeBuffer
Adds two bytes (little-endian) to the end of this code buffer. Offset/address increase by 2.

Specified by:
add2_endian in class CodeAllocator.x86CodeBuffer
Parameters:
i - the little-endian value to add

add2

public void add2(int i)
Description copied from class: CodeAllocator.x86CodeBuffer
Adds two bytes (big-endian) to the end of this code buffer. Offset/address increase by 2.

Specified by:
add2 in class CodeAllocator.x86CodeBuffer
Parameters:
i - the big-endian value to add

add3

public void add3(int i)
Description copied from class: CodeAllocator.x86CodeBuffer
Adds three bytes (big-endian) to the end of this code buffer. Offset/address increase by 3.

Specified by:
add3 in class CodeAllocator.x86CodeBuffer
Parameters:
i - the big-endian value to add

add4_endian

public void add4_endian(int i)
Description copied from class: CodeAllocator.x86CodeBuffer
Adds four bytes (little-endian) to the end of this code buffer. Offset/address increase by 4.

Specified by:
add4_endian in class CodeAllocator.x86CodeBuffer
Parameters:
i - the little-endian value to add

get1

public byte get1(int k)
Description copied from class: CodeAllocator.x86CodeBuffer
Gets the byte at the given offset in this code buffer.

Specified by:
get1 in class CodeAllocator.x86CodeBuffer
Parameters:
k - offset of byte to return
Returns:
byte at given offset

get4_endian

public int get4_endian(int k)
Description copied from class: CodeAllocator.x86CodeBuffer
Gets the (little-endian) 4 bytes at the given offset in this code buffer.

Specified by:
get4_endian in class CodeAllocator.x86CodeBuffer
Parameters:
k - offset of little-endian 4 bytes to return
Returns:
little-endian 4 bytes at given offset

put1

public void put1(int k,
                 byte instr)
Description copied from class: CodeAllocator.x86CodeBuffer
Sets the byte at the given offset to the given value.

Specified by:
put1 in class CodeAllocator.x86CodeBuffer
Parameters:
k - offset of byte to set
instr - value to set it to

put4_endian

public void put4_endian(int k,
                        int instr)
Description copied from class: CodeAllocator.x86CodeBuffer
Sets the 4 bytes at the given offset to the given (little-endian) value.

Specified by:
put4_endian in class CodeAllocator.x86CodeBuffer
Parameters:
k - offset of 4 bytes to set
instr - little-endian value to set it to

skip

public void skip(int nbytes)
Specified by:
skip in class CodeAllocator.x86CodeBuffer

allocateCodeBlock

public jq_CompiledCode allocateCodeBlock(jq_Method m,
                                         jq_TryCatch[] ex,
                                         jq_BytecodeMap bcm,
                                         ExceptionDeliverer exd,
                                         int stackframesize,
                                         List code_relocs,
                                         List data_relocs)
Description copied from class: CodeAllocator.x86CodeBuffer
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.

Specified by:
allocateCodeBlock in class CodeAllocator.x86CodeBuffer
Parameters:
m - Java method of this code block, or null if none
ex - exception handler table, or null if none
bcm - bytecode map, or null if none
exd - exception deliverer to use for this code, or null if none
stackframesize - size of stack frame in bytes
code_relocs - list of code relocations for this code buffer, or null if none
data_relocs - list of data relocations for this code buffer, or null if none
Returns:
a new jq_CompiledCode object for the code


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