|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.squawk.Address
public final class Address
The Address class is used to abstract machine addresses. It is used instead of 'int' or 'Object' for coding clarity and machine-portability (it can map to 32 bit and 64 bit integral types).
Variables of type Address
will never be updated if they correspond with
an object that may be moved by the garbage collector. As such, they should never
appear in code that may have a collection occur in between the definition and use
of the variable. In general, variables of type address should not be used outside of
the garbage collector.
This class is known specially by the translator as a SQUAWKPRIMITIVE
and programming with it requires adhering to the restrictions implied by this
attribute. Some of these constraints are imposed to keep the job of the
translator simple. All of these constraints are currently enforced by the
translator. The constraints are:
null
) than T.
Only the public methods of this class which do not override any of the
methods in java.lang.Object will be available in a non-hosted
environment. The translator replaces any calls to these methods to native
method calls.
This mechanism was largely inspired by the VM_Address class in the Jikes RVM.
Method Summary | |
---|---|
Address |
add(int offset)
Adds a 32 bit offset to this address and return the resulting address. |
Address |
addOffset(Offset offset)
Adds a 32 or 64 bit offset to this address and return the resulting address. |
Address |
and(UWord word)
Logically AND a word with this address. |
Offset |
diff(Address address2)
Calculates the offset between this address an another address. |
boolean |
eq(Address address2)
Determines if this address is equal to a given address. |
static Address |
fromObject(Object object)
Casts an object reference to an address. |
static Address |
fromPrimitive(int value)
Casts a word expressed as the appropriate Java primitive type for the platform (i.e. |
int |
hashCode()
Gets a hashcode value for this address which is just the address itself. |
boolean |
hi(Address address2)
Determines if this address is higher than a given address. |
boolean |
hieq(Address address2)
Determines if this address is higher than or equal to a given address. |
boolean |
isMax()
Determines if this address is equals to max . |
boolean |
isZero()
Determines if this address is null . |
boolean |
lo(Address address2)
Determines if this address is lower than a given address. |
boolean |
loeq(Address address2)
Determines if this address is lower than or equal to a given address. |
static Address |
max()
Gets the largest possible machine address. |
boolean |
ne(Address address2)
Determines if this address is not equal to a given address. |
Address |
or(UWord word)
Logically OR a word with this address. |
Address |
roundDown(int alignment)
Rounds this address down based on a given alignment. |
Address |
roundDownToWord()
Rounds this address down to a machine word boundary. |
Address |
roundUp(int alignment)
Rounds this address up based on a given alignment. |
Address |
roundUpToWord()
Rounds this address up to a machine word boundary. |
Address |
sub(int offset)
Subtracts a 32 bit offset to this address and return the resulting address. |
Address |
subOffset(Offset offset)
Subtracts a 32 or 64 bit offset to this address and return the resulting address. |
Object |
toObject()
Casts this address to an object reference. |
String |
toString()
Gets a string representation of this address. |
UWord |
toUWord()
Casts this address to a UWord. |
static Address |
zero()
Gets the canonical Address representation of null . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static Address fromPrimitive(int value) throws NativePragma
value
- an address expressed as an int or long
value
NativePragma
public static Address fromObject(Object object) throws NativePragma
object
- the object reference to cast
NativePragma
public static Address zero() throws NativePragma
null
.
null
NativePragma
public static Address max() throws NativePragma
NativePragma
public Object toObject() throws NativePragma
NativePragma
public UWord toUWord() throws NativePragma
NativePragma
public Address add(int offset) throws NativePragma
offset
- the offset to add
offset
to this address
NativePragma
public Address sub(int offset) throws NativePragma
offset
- the offset to subract
offset
to this address
NativePragma
public Address addOffset(Offset offset) throws NativePragma
offset
- the offset to add
offset
to this address
NativePragma
public Address subOffset(Offset offset) throws NativePragma
offset
- the offset to subract
offset
to this address
NativePragma
public Address or(UWord word) throws NativePragma
word
- the word to OR this address with
NativePragma
public Address and(UWord word) throws NativePragma
word
- the word to AND this address with
NativePragma
public Offset diff(Address address2) throws NativePragma
address2
- the address to compare this address with
address2
NativePragma
public boolean isZero() throws NativePragma
null
.
null
NativePragma
public boolean isMax() throws NativePragma
max
.
max
NativePragma
public boolean eq(Address address2) throws NativePragma
address2
- the address to compare this address against
address2
NativePragma
public boolean ne(Address address2) throws NativePragma
address2
- the address to compare this address against
address2
NativePragma
public boolean lo(Address address2) throws NativePragma
address2
- the address to compare this address against
address2
NativePragma
public boolean loeq(Address address2) throws NativePragma
address2
- the address to compare this address against
address2
NativePragma
public boolean hi(Address address2) throws NativePragma
address2
- the address to compare this address against
address2
NativePragma
public boolean hieq(Address address2) throws NativePragma
address2
- the address to compare this address against
address2
NativePragma
public Address roundUp(int alignment) throws NativePragma
alignment
- this address is rounded up to be a multiple of this value
NativePragma
public Address roundUpToWord() throws NativePragma
NativePragma
public Address roundDown(int alignment) throws NativePragma
alignment
- this address is rounded down to be a multiple of this value
NativePragma
public Address roundDownToWord() throws NativePragma
NativePragma
public int hashCode() throws HostedPragma
hashCode
in class Object
HostedPragma
Object.equals(java.lang.Object)
,
Hashtable
public String toString() throws HostedPragma
toString
in class Object
HostedPragma
|
" 2013 FRC Java API " |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |