|
SunSPOT API V3.0 |
|||||||||
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 Modifier#SQUAWKPRIMITIVE
and programming with it requires adhering to the restrictions implied by this
attribute.
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 or long) into a value of type Address. |
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. |
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, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public Address add(int offset)
offset
- the offset to add
offset
to this addresspublic Address addOffset(Offset offset)
offset
- the offset to add
offset
to this addresspublic Address and(UWord word)
word
- the word to AND this address with
public Offset diff(Address address2)
address2
- the address to compare this address with
address2
public boolean eq(Address address2)
address2
- the address to compare this address against
address2
public static Address fromObject(Object object)
object
- the object reference to cast
public static Address fromPrimitive(int value)
value
- an address expressed as an int or long
value
public boolean hi(Address address2)
address2
- the address to compare this address against
address2
public boolean hieq(Address address2)
address2
- the address to compare this address against
address2
public boolean isMax()
max
.
max
public boolean isZero()
null
.
null
public boolean lo(Address address2)
address2
- the address to compare this address against
address2
public boolean loeq(Address address2)
address2
- the address to compare this address against
address2
public static Address max()
public boolean ne(Address address2)
address2
- the address to compare this address against
address2
public Address or(UWord word)
word
- the word to OR this address with
public Address roundDown(int alignment)
alignment
- this address is rounded down to be a multiple of this value
public Address roundDownToWord()
public Address roundUp(int alignment)
alignment
- this address is rounded up to be a multiple of this value
public Address roundUpToWord()
public Address sub(int offset)
offset
- the offset to subract
offset
to this addresspublic Address subOffset(Offset offset)
offset
- the offset to subract
offset
to this addresspublic Object toObject()
public UWord toUWord()
public static Address zero()
null
.
null
|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |