"

2013 FRC Java API

"

com.sun.squawk.compiler
Interface BaseCompiler

All Superinterfaces:
Types
All Known Subinterfaces:
Compiler, InterpCompiler

public interface BaseCompiler
extends Types

Language-independent base compiler interface to support general-purpose applications.


Field Summary
static int C_DYNAMIC
          Normal C-style calling convention except the parameters are on the runtime stack but the procedure address is on the shadow stack.
static int C_JVM
          Java-style calling convention for Squawk methods where the address of the method's bytecodes or machine code is passed to the function, and all parameters are provided on the shadow stack.
static int C_JVM_DYNAMIC
          Java-style calling convention for Squawk methods with the parameters on the runtime stack but the method address on the shadow stack.
static int C_NORMAL
          Normal C-style calling convention with the parameters and procedure address on the shadow stack.
static int E_ADDRESS
          Compiled Squawk procedure preamble.
static int E_NONE
          Standard C-style calling convention and parameter passing procedures.
static int E_NULL
           
static int E_REGISTER
          Squawk Interpreter procedure preamble.
static int P_HIGH
          Local and parm register allocation hints.
static int P_LOW
          Local and parm register allocation hints.
static int P_MEDIUM
          Local and parm register allocation hints.
 
Fields inherited from interface com.sun.squawk.compiler.Types
BYTE, DOUBLE, FLOAT, INT, IP, LONG, LP, MP, OOP, REF, RELOC_ABSOLUTE_INT, RELOC_RELATIVE_INT, SHORT, SS, UBYTE, UINT, ULONG, USHORT, UWORD, VOID, WORD
 
Method Summary
 Compiler add()
          Add the top two elements on the stack.
 Compiler and()
          And the top two elements on the stack.
 Compiler begin()
          Begin a code scope.
 Compiler bf(int dst)
          Branch to the label if the popped value is false.
 Compiler bf(Label label)
          Branch to the label if the popped value is false.
 Compiler bind(Label label)
          Bind a label to the current location.
 Compiler br(int dst)
          Unconditionally branch to the label.
 Compiler br(Label label)
          Unconditionally branch to the label.
 Compiler bt(int dst)
          Branch to the label if the popped value is true.
 Compiler bt(Label label)
          Branch to the label if the popped value is true.
 Compiler call(int nparms, Type type)
          Call a function.
 Compiler call(int nparms, Type type, int convention)
          Call a function.
 Compiler call(Type type)
          Call a function.
 Compiler call(Type type, int convention)
          Call a function.
 Compiler cmpg()
          Test the top two floating point elements.
 Compiler cmpl()
          Test the top two floating point elements.
 Compiler com()
          Produce the 1's complement of the top element.
 Compiler comment(String str)
          Add a comment node to the IR.
 Compiler compile()
          Compiler the IR.
 Compiler convert(Type to)
          Pop the top most element, convert it to a new type, and push the result.
 Compiler data(Label label, Object obj)
          Define some data.
 Compiler deadCode()
          Specify an unreachable place.
 void decode(int relocation)
          Dumps the assembler output of the compiler to the console.
 Compiler div()
          Divide the top two elements on the stack.
 Compiler drop()
          Pop the top element of the compiler stack.
 Compiler dumpAll()
          Pop all the element of the compiler stack.
 Compiler dup()
          Dup the top element of the stack.
 Compiler dupReceiver()
          Dup the receiver element of the stack.
 Compiler end()
          End a code scope.
 Compiler enter()
          Emit a function prologue.
 Compiler enter(int preambleCode)
          Emit a function prologue.
 Compiler enter(Label label)
          Emit a function prologue.
 Compiler enter(Label label, int preambleCode)
          Emit a function prologue.
 Compiler eq()
          Test the top two elements.
 Compiler force(Type to)
          Pop the top most element, force it to be the new type, and push the result.
 Compiler ge()
          Test the top two elements.
 byte[] getCode()
          Get the code array buffer.
 int getCodeSize()
          Get the length of the compiled code.
 SymbolicFixupTable getFixupInfo()
          Return the offsets to unresolved symbols.
 int getLocalCount()
          Return the number of locals currently defined.
 int[] getRelocationInfo()
          Return the relocation information.
 Compiler gt()
          Test the top two elements.
 boolean isBigEndian()
          Boolean to say if the machine uses big endian ordering.
 Compiler jump()
          Jump somewhere.
 Label label()
          Allocate a label.
 Compiler le()
          Test the top two elements.
 Compiler leave()
          Emit a function epilogue.
 Compiler leave(MethodMap mmap)
          Emit a function epilogue.
 Compiler literal(boolean n)
          Push a boolean constant onto the stack.
 Compiler literal(double n)
          Push a double constant onto the stack.
 Compiler literal(float n)
          Push a float constant onto the stack.
 Compiler literal(int n)
          Push an integer constant onto the stack.
 Compiler literal(Label label)
          Push the address of a label onto the stack.
 Compiler literal(long n)
          Push a long constant onto the stack.
 Compiler literal(Object array)
          Push an address of an array onto the stack.
 Compiler load(Local local)
          Get a local variable or parameter and push it onto the stack.
 Compiler loadParm()
          Get the value of a parameter word.
 boolean loadsMustBeAligned()
          Boolean to say if the machine can execute unaligned loads.
 Local local(Type type)
          Define a local variable type.
 Local local(Type type, int hint)
          Define a local variable type.
 Compiler lt()
          Test the top two elements.
 Compiler mul()
          Multiply the top two elements on the stack.
 Compiler ne()
          Test the top two elements.
 Compiler neg()
          Negate (2's complement) the top element.
 Compiler or()
          Or the top two elements on the stack.
 Local parm(Type type)
          Define a parameter variable.
 Local parm(Type type, int hint)
          Define a parameter variable.
 Compiler pop(Type type)
          Pop the top element of the runtime stack.
 Compiler popAll()
          Pop all the elements of the runtime stack.
 Compiler push()
          Push the data onto the runtime stack.
 Compiler read(Type type)
          Load a value from a reference.
 Compiler rem()
          Remainder the top two elements on the stack.
 Compiler result(Type type)
          Define the function result.
 Compiler ret()
          Return from a method.
 Compiler ret(Type type)
          Return from a method.
 Compiler shl()
          Shift the second element on the stack left by the number of bits specified by the top element.
 Compiler shr()
          Shift the second element on the stack right by the number of bits specified by the top element.
 Compiler store(Local local)
          Set a local variable or parameter to a value popped from the stack.
 Compiler storeParm()
          Set the value of a parameter word.
 Compiler sub()
          Subtract the top two elements on the stack.
 Compiler swap()
          Swap the top two elements of the stack.
 Compiler swapAll()
          Swap the contence of the stack.
 Compiler swapForABI()
          Swap the contence of the stack if the target ABI push parameters right-to-left.
 Compiler symbol(String name)
          Push an address of an unresolved symbol onto the stack.
 boolean tableSwitchEndPadding()
          Boolean to say if the tableswitch and stableswitch are to be padded in such a way that the initial int (the low parameter) is placed on a 4 byte boundary and any padding at the start of the bytecode sequence is complemented at the end so that the size of the sequence is always a constant.
 boolean tableSwitchPadding()
          Boolean to say if the tableswitch and stableswitch are to be padded in such a way that the initial int (the low parameter) is placed on a 4 byte boundary.
 Type tosType()
          Return the type of the instruction on the top of the stack.
 Compiler ushr()
          Shift the second element on the stack right by the number of bits specified by the top element.
 Compiler write(Type type)
          Store a value at a reference.
 Compiler xor()
          Xor the top two elements on the stack.
 

Field Detail

E_NONE

static final int E_NONE
Standard C-style calling convention and parameter passing procedures.

See Also:
Constant Field Values

E_NULL

static final int E_NULL
See Also:
Constant Field Values

E_REGISTER

static final int E_REGISTER
Squawk Interpreter procedure preamble. The address of the bytecodes to be interpreted are passed in the special JVM register. This preamble is used only for the Squawk Interpreter.

See Also:
Constant Field Values

E_ADDRESS

static final int E_ADDRESS
Compiled Squawk procedure preamble. The address of the compiled bytecodes are passed in the special JVM register. This preamble is used only for Squawk bytecode procedures that have been compiled into native code.

See Also:
Constant Field Values

C_NORMAL

static final int C_NORMAL
Normal C-style calling convention with the parameters and procedure address on the shadow stack. The parameters are passed as per the standard Application Binary Interface specification of the platform.

See Also:
Constant Field Values

C_DYNAMIC

static final int C_DYNAMIC
Normal C-style calling convention except the parameters are on the runtime stack but the procedure address is on the shadow stack.

See Also:
Constant Field Values

C_JVM

static final int C_JVM
Java-style calling convention for Squawk methods where the address of the method's bytecodes or machine code is passed to the function, and all parameters are provided on the shadow stack.

See Also:
Constant Field Values

C_JVM_DYNAMIC

static final int C_JVM_DYNAMIC
Java-style calling convention for Squawk methods with the parameters on the runtime stack but the method address on the shadow stack.

See Also:
Constant Field Values

P_LOW

static final int P_LOW
Local and parm register allocation hints.

A compliant compiler may ignore these values, but if the compiler does honor them then the following semantics is desired.

P_LOW variables may be allocated in registers or activation slots.

P_MEDIUM variables are better allocated in registers if there are free registers available, otherwise they are allocated in activation slots.

P_HIGH variables hust be allocated in registers, and a compiler that honors the hints should produce a fatal error if this is not possible.

Within each category the variables defined first have higher priority over those defined later.

See Also:
Constant Field Values

P_MEDIUM

static final int P_MEDIUM
Local and parm register allocation hints.

A compliant compiler may ignore these values, but if the compiler does honor them then the following semantics is desired.

P_LOW variables may be allocated in registers or activation slots.

P_MEDIUM variables are better allocated in registers if there are free registers available, otherwise they are allocated in activation slots.

P_HIGH variables hust be allocated in registers, and a compiler that honors the hints should produce a fatal error if this is not possible.

Within each category the variables defined first have higher priority over those defined later.

See Also:
Constant Field Values

P_HIGH

static final int P_HIGH
Local and parm register allocation hints.

A compliant compiler may ignore these values, but if the compiler does honor them then the following semantics is desired.

P_LOW variables may be allocated in registers or activation slots.

P_MEDIUM variables are better allocated in registers if there are free registers available, otherwise they are allocated in activation slots.

P_HIGH variables hust be allocated in registers, and a compiler that honors the hints should produce a fatal error if this is not possible.

Within each category the variables defined first have higher priority over those defined later.

See Also:
Constant Field Values
Method Detail

label

Label label()
Allocate a label.

Stack: ... -> ...

Returns:
the label

bind

Compiler bind(Label label)
Bind a label to the current location.

Stack: ... -> ...

Parameters:
label - the label to bind
Returns:
the compiler object

enter

Compiler enter(Label label,
               int preambleCode)
Emit a function prologue.

Stack: _ -> _

Parameters:
label - a label to be bound to the start of the function
preambleCode - the special preamble code for the function
Returns:
the compiler object

enter

Compiler enter(Label label)
Emit a function prologue.

Stack: _ -> _

Parameters:
label - a label to be bound to the start of the function
Returns:
the compiler object

enter

Compiler enter(int preambleCode)
Emit a function prologue.

Stack: _ -> _

Parameters:
preambleCode - the special preamble code for the function
Returns:
the compiler object

enter

Compiler enter()
Emit a function prologue.

Stack: _ -> _

Returns:
the compiler object

parm

Local parm(Type type,
           int hint)
Define a parameter variable.

Stack: _ -> _

Parameters:
type - the type of the local variable (Must be primary)
hint - the P_XXXX priority hint.
Returns:
the compiler object

parm

Local parm(Type type)
Define a parameter variable.

Stack: _ -> _

Parameters:
type - the type of the local variable (Must be primary)
Returns:
the compiler object

result

Compiler result(Type type)
Define the function result.

Stack: _ -> _

Parameters:
type - the type of the parameter (Must be primary)
Returns:
the compiler object

leave

Compiler leave(MethodMap mmap)
Emit a function epilogue.

Stack: _ -> _

Returns:
the compiler object

leave

Compiler leave()
Emit a function epilogue.

Stack: _ -> _

Returns:
the compiler object

begin

Compiler begin()
Begin a code scope.

Stack: ... -> ...

Returns:
the compiler object

local

Local local(Type type,
            int hint)
Define a local variable type.

Stack: ... -> ...

Parameters:
type - the type of the local variable (Must be primary)
hint - the P_XXXX priority hint.
Returns:
the compiler object

local

Local local(Type type)
Define a local variable type.

Stack: ... -> ...

Parameters:
type - the type of the local variable (Must be primary)
Returns:
the compiler object

end

Compiler end()
End a code scope.

Stack: ... -> ...

Returns:
the compiler object

getLocalCount

int getLocalCount()
Return the number of locals currently defined.

Returns:
the number

tosType

Type tosType()
Return the type of the instruction on the top of the stack.

Stack: ... -> ...

Returns:
the type

loadParm

Compiler loadParm()
Get the value of a parameter word.

Stack: ..., INDEX -> ..., INT

Note that this method never returns a long. The user of this interface has to deal with longs as two words.

Checks: 1- The index needs to be of type INT.

Returns:
the compiler object

storeParm

Compiler storeParm()
Set the value of a parameter word.

Stack: ..., VALUE, INDEX -> ...

Checks: 1- The index needs to be of type INT.

Returns:
the compiler object

comment

Compiler comment(String str)
Add a comment node to the IR.

Stack: ... -> ...

Parameters:
str - the comment
Returns:
the compiler object

load

Compiler load(Local local)
Get a local variable or parameter and push it onto the stack.

Stack: ... -> ..., VALUE

Parameters:
local - the local variable to load
Returns:
the compiler object

store

Compiler store(Local local)
Set a local variable or parameter to a value popped from the stack.

Stack: ..., VALUE -> ...

Checks: 1- The local and the value from the stack need to be a primary type.

Parameters:
local - the local variable to store into
Returns:
the compiler object

read

Compiler read(Type type)
Load a value from a reference. The reference is popped from the stack and the type specified is loaded from that address. Secondary types (BYTE, UBYTE, SHORT, USHORT) are all widened to INT by this operation.

Stack: ..., REF -> ..., VALUE

Checks: 1- The value on the top of the stack is of type reference (REF) or OOP. 2- The type of data to be read is either of primary or secondary type.

Parameters:
type - the type of the data to load
Returns:
the compiler object

write

Compiler write(Type type)
Store a value at a reference. The value and reference are popped from the stack and the value is written to the referenced address according to the specified type. The type parameter is used to check primary types and to narrow secondry types.

Stack: ..., VALUE, REF -> ...

Checks: 1- The address on the top of the stack should be of type reference (REF). 2- The other value on the stack has to have the same primitive type as the type of the write. All types can be used with this method (primary, secondary), except for pseudo types.

Parameters:
type - the type of the data to load
Returns:
the compiler object

literal

Compiler literal(int n)
Push an integer constant onto the stack.

Stack: ... -> ..., VALUE

Parameters:
n - the value of the constant
Returns:
the compiler object

literal

Compiler literal(long n)
Push a long constant onto the stack.

Stack: ... -> ..., VALUE

Parameters:
n - the value of the constant
Returns:
the compiler object

literal

Compiler literal(float n)
Push a float constant onto the stack.

Stack: ... -> ..., VALUE

Parameters:
n - the value of the constant
Returns:
the compiler object

literal

Compiler literal(double n)
Push a double constant onto the stack.

Stack: ... -> ..., VALUE

Parameters:
n - the value of the constant
Returns:
the compiler object

literal

Compiler literal(boolean n)
Push a boolean constant onto the stack.

Stack: ... -> ..., VALUE

Parameters:
n - the value of the constant
Returns:
the compiler object

literal

Compiler literal(Object array)
Push an address of an array onto the stack.

Stack: ... -> ..., VALUE

Parameters:
array - the array
Returns:
the compiler object

symbol

Compiler symbol(String name)
Push an address of an unresolved symbol onto the stack.

Stack: ... -> ..., VALUE

Parameters:
name - the name of the symbol
Returns:
the compiler object

literal

Compiler literal(Label label)
Push the address of a label onto the stack.

Stack: ... -> ..., VALUE

Parameters:
label - the label
Returns:
the compiler object

data

Compiler data(Label label,
              Object obj)
Define some data.

Stack: _ -> _

Parameters:
label - the label to the data
obj - the array
Returns:
the compiler object

dup

Compiler dup()
Dup the top element of the stack.

Stack: ... -> ..., VALUE

Returns:
the compiler object

dupReceiver

Compiler dupReceiver()
Dup the receiver element of the stack.

Stack: ... -> ..., VALUE

In a method call, the receiver is the object whose method is being invoked. This is the implicit first parameter of method calls. Used by all functions that have an invoke virtual.

Returns:
the compiler object

drop

Compiler drop()
Pop the top element of the compiler stack.

Stack: ..., VALUE -> ...

Returns:
the compiler object

dumpAll

Compiler dumpAll()
Pop all the element of the compiler stack.

Stack: ... -> _

Returns:
the compiler object

swap

Compiler swap()
Swap the top two elements of the stack.

Stack: ... VALUE1, VALUE2 -> ..., VALUE2, VALUE1

Returns:
the compiler object

swapAll

Compiler swapAll()
Swap the contence of the stack.

Stack: [VALUE0, ..., VALUEN] -> [VALUEN, ... , VALUE0]

Returns:
the compiler object

swapForABI

Compiler swapForABI()
Swap the contence of the stack if the target ABI push parameters right-to-left.

Stack: [VALUE0, ..., VALUEN] -> [VALUEN, ... , VALUE0] // Only on right-to-left systems

Returns:
the compiler object

push

Compiler push()
Push the data onto the runtime stack.

Stack: ..., VALUE -> ...

Returns:
the compiler object

pop

Compiler pop(Type type)
Pop the top element of the runtime stack.

Stack: ... -> ..., VALUE

Parameters:
type - the data type to pop
Returns:
the compiler object

popAll

Compiler popAll()
Pop all the elements of the runtime stack.

Stack: ... -> ...

Returns:
the compiler object

force

Compiler force(Type to)
Pop the top most element, force it to be the new type, and push the result. Force uses the same bit representation.

Stack: ... OLDVALUE -> ..., NEWVALUE

Force rules:

The force rules are summarized as follows

 From/to   int     uint    long    ulong   float   double  ref     oop
  int      fnop    f                       f               f32     f32
  uint     f       fnop                                    f32     f32
  long                     fnop    f               f       f64     f64
  ulong                    f       fnop                    f64     f64
  float    f                               fnop
  double                   f                       fnop
  ref      f32     f32     f64     f64                     fnop    f
  oop      f32     f32     f64     f64                     f       fnop
 
where

Parameters:
to - the type to force to
Returns:
the compiler object

convert

Compiler convert(Type to)
Pop the top most element, convert it to a new type, and push the result. Conversions use different bit representation, where needed.

Stack: ... OLDVALUE -> ..., NEWVALUE

Convert rules:

Parameters:
to - the type to convert to
Returns:
the compiler object

add

Compiler add()
Add the top two elements on the stack. They must be of the same type, or be a pointer and an integer.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

sub

Compiler sub()
Subtract the top two elements on the stack. They must be of the same type, or be a pointer and an integer.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

mul

Compiler mul()
Multiply the top two elements on the stack. They must be of the same type.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

div

Compiler div()
Divide the top two elements on the stack. They must be of the same type.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

rem

Compiler rem()
Remainder the top two elements on the stack. They must be of the same type.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

and

Compiler and()
And the top two elements on the stack. They must be of the same type.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

or

Compiler or()
Or the top two elements on the stack. They must be of the same type.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

xor

Compiler xor()
Xor the top two elements on the stack. They must be of the same type.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

shl

Compiler shl()
Shift the second element on the stack left by the number of bits specified by the top element.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

shr

Compiler shr()
Shift the second element on the stack right by the number of bits specified by the top element.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

ushr

Compiler ushr()
Shift the second element on the stack right by the number of bits specified by the top element.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

neg

Compiler neg()
Negate (2's complement) the top element.

Stack: ..., VALUE -> ..., RESULT

Returns:
the compiler object

com

Compiler com()
Produce the 1's complement of the top element.

Stack: ..., VALUE -> ..., RESULT

Returns:
the compiler object

eq

Compiler eq()
Test the top two elements. Push true if s[0] == s[1] else false.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

ne

Compiler ne()
Test the top two elements. Push true if s[0] != s[1] else false.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

le

Compiler le()
Test the top two elements. Push true if s[0] <= s[1] else false.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

lt

Compiler lt()
Test the top two elements. Push true if s[0] < s[1] else false.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

ge

Compiler ge()
Test the top two elements. Push true if s[0] >= s[1] else false.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

gt

Compiler gt()
Test the top two elements. Push true if s[0] > s[1] else false.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

cmpl

Compiler cmpl()
Test the top two floating point elements. Push true if s[0] < s[1] else false.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

cmpg

Compiler cmpg()
Test the top two floating point elements. Push true if s[0] > s[1] else false.

Stack: ..., VALUE1, VALUE2 -> ..., RESULT

Returns:
the compiler object

br

Compiler br(Label label)
Unconditionally branch to the label.

Stack: ... -> ...

Checks

Parameters:
label - the label to branch to
Returns:
the compiler object

bt

Compiler bt(Label label)
Branch to the label if the popped value is true.

Stack: ..., VALUE -> ...

Parameters:
label - the label to branch to
Returns:
the compiler object

bf

Compiler bf(Label label)
Branch to the label if the popped value is false.

Stack: ..., VALUE -> ...

Parameters:
label - the label to branch to
Returns:
the compiler object

br

Compiler br(int dst)
Unconditionally branch to the label.

Stack: _ -> ._

Parameters:
dst - the absolute destination
Returns:
the compiler object

bt

Compiler bt(int dst)
Branch to the label if the popped value is true.

Stack: VALUE -> _

Parameters:
dst - the absolute destination
Returns:
the compiler object

bf

Compiler bf(int dst)
Branch to the label if the popped value is false.

Stack: VALUE -> _

Parameters:
dst - the absolute destination
Returns:
the compiler object

jump

Compiler jump()
Jump somewhere. The top most value must be the address of the function to be called.

Stack: ADDRESS -> _

Checks

Returns:
the compiler object

call

Compiler call(int nparms,
              Type type,
              int convention)
Call a function. The top most value must be the address of the function to be called.

Stack: ..., VALUEN to VALUE1, ADDRESS -> ..., [RESULT]

Checks

Parameters:
nparms - the number of parameters to pop
type - the return type to be pushed onto the stack
convention - the calling convebtion
Returns:
the compiler object

call

Compiler call(int nparms,
              Type type)
Call a function. The top most value must be the address of the function to be called.

Stack: ..., VALUEN to VALUE1, ADDRESS -> ..., [RESULT]

Parameters:
nparms - the number of parameters to pop
type - the return type to be pushed onto the stack
Returns:
the compiler object

call

Compiler call(Type type)
Call a function. The top most value must be the address of the function to be called. and all the other parameters on the stack are taken as parameters.

Stack: ..., VALUEN to VALUE1, ADDRESS -> ..., [RESULT]

Parameters:
type - the return type to be pushed onto the stack
Returns:
the compiler object

call

Compiler call(Type type,
              int convention)
Call a function. The top most value must be the address of the function to be called. and all the other parameters on the stack are taken as parameters.

Stack: ..., VALUEN to VALUE1, ADDRESS -> ..., [RESULT]

Parameters:
type - the return type to be pushed onto the stack
convention - the calling convention
Returns:
the compiler object

ret

Compiler ret(Type type)
Return from a method. The return type overwrites the return type that the method would have had otherwise.

Stack: ..., [VALUE] -> _

Checks

Parameters:
type - the return type
Returns:
the compiler object

ret

Compiler ret()
Return from a method.

Stack: ..., [VALUE] -> _

Returns:
the compiler object

deadCode

Compiler deadCode()
Specify an unreachable place.

Stack: _ -> _

Returns:
the compiler object

loadsMustBeAligned

boolean loadsMustBeAligned()
Boolean to say if the machine can execute unaligned loads.

Returns:
true if it is true

isBigEndian

boolean isBigEndian()
Boolean to say if the machine uses big endian ordering.

Returns:
true if it is true

tableSwitchPadding

boolean tableSwitchPadding()
Boolean to say if the tableswitch and stableswitch are to be padded in such a way that the initial int (the low parameter) is placed on a 4 byte boundary.

Returns:
true if it is true

tableSwitchEndPadding

boolean tableSwitchEndPadding()
Boolean to say if the tableswitch and stableswitch are to be padded in such a way that the initial int (the low parameter) is placed on a 4 byte boundary and any padding at the start of the bytecode sequence is complemented at the end so that the size of the sequence is always a constant.

Returns:
true if it is true

compile

Compiler compile()
Compiler the IR.

Stack: _ -> _

Returns:
the compiler object

decode

void decode(int relocation)
Dumps the assembler output of the compiler to the console.


getCodeSize

int getCodeSize()
Get the length of the compiled code.

Returns:
the length in bytes

getCode

byte[] getCode()
Get the code array buffer.

Returns:
the code array

getRelocationInfo

int[] getRelocationInfo()
Return the relocation information. This is an array of ints where each entry describes one offset into the code where relocation is required. The format of each entry is such that the top 8 bits is a code indicating the type of relocation required and the low 24 bits is the offset.

Stack: _ -> _

Returns:
the relocation information.

getFixupInfo

SymbolicFixupTable getFixupInfo()
Return the offsets to unresolved symbols.

Stack: _ -> _

Returns:
the table of offset to symbol associations

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"