org.vmmagic.unboxed
Class Address

java.lang.Object
  extended by org.vmmagic.unboxed.Address

public final class Address
extends Object

Stub implementation of an Address type, intended only to allow the core of MMTk to be compiled. This must be replaced with a concrete implementation appropriate to a specific VM.

The address type is used by the runtime system and collector to denote machine addresses. We use a separate type instead of the Java int type for coding clarity, machine-portability (it can map to 32 bit and 64 bit integral types), and access to unsigned operations (Java does not have unsigned int types).


Constructor Summary
Address()
           
 
Method Summary
 boolean attempt(Address old, Address value)
          Attempt an atomic store operation.
 boolean attempt(Address old, Address value, Offset offset)
          Attempt an atomic store operation.
 boolean attempt(int old, int value)
          Attempt an atomic store operation.
 boolean attempt(int old, int value, Offset offset)
          Attempt an atomic store operation.
 boolean attempt(ObjectReference old, ObjectReference value)
          Attempt an atomic store operation.
 boolean attempt(ObjectReference old, ObjectReference value, Offset offset)
          Attempt an atomic store operation.
 boolean attempt(Word old, Word value)
          Attempt an atomic store operation.
 boolean attempt(Word old, Word value, Offset offset)
          Attempt an atomic store operation.
 Offset diff(Address addr2)
          Compute the difference between two Addresses and return the result.
 boolean EQ(Address addr2)
          Return true if this Address instance is equal to addr2.
static Address fromIntSignExtend(int address)
          Fabricate an Address instance from an integer, after sign extending the integer.
static Address fromIntZeroExtend(int address)
          Fabricate an Address instance from an integer, after zero extending the integer.
static Address fromLong(long address)
          Fabricate an Address instance from an integer
 boolean GE(Address addr2)
          Return true if this Address instance is greater than or equal to addr2.
 boolean GT(Address addr2)
          Return true if this Address instance is greater than addr2.
 boolean isMax()
          Return true if this instance is the maximum allowable Address value.
 boolean isZero()
          Return true if this instance is zero.
 boolean LE(Address addr2)
          Return true if this Address instance is less than or equal to addr2.
 Address loadAddress()
          Loads an address value from the memory location pointed to by the current instance.
 Address loadAddress(Offset offset)
          Loads an address value from the memory location pointed to by the current instance.
 byte loadByte()
          Loads a byte from the memory location pointed to by the current instance.
 byte loadByte(Offset offset)
          Loads a byte from the memory location pointed to by the current instance.
 char loadChar()
          Loads a char from the memory location pointed to by the current instance.
 char loadChar(Offset offset)
          Loads a char from the memory location pointed to by the current instance.
 double loadDouble()
          Loads a double from the memory location pointed to by the current instance.
 double loadDouble(Offset offset)
          Loads a double from the memory location pointed to by the current instance.
 float loadFloat()
          Loads a float from the memory location pointed to by the current instance.
 float loadFloat(Offset offset)
          Loads a float from the memory location pointed to by the current instance.
 int loadInt()
          Loads an int from the memory location pointed to by the current instance.
 int loadInt(Offset offset)
          Loads an int from the memory location pointed to by the current instance.
 long loadLong()
          Loads a long from the memory location pointed to by the current instance.
 long loadLong(Offset offset)
          Loads a long from the memory location pointed to by the current instance.
 ObjectReference loadObjectReference()
          Loads a reference from the memory location pointed to by the current instance.
 ObjectReference loadObjectReference(Offset offset)
          Loads a reference from the memory location pointed to by the current instance.
 short loadShort()
          Loads a short from the memory location pointed to by the current instance.
 short loadShort(Offset offset)
          Loads a short from the memory location pointed to by the current instance.
 Word loadWord()
          Loads a word value from the memory location pointed to by the current instance.
 Word loadWord(Offset offset)
          Loads a word value from the memory location pointed to by the current instance.
 boolean LT(Address addr2)
          Return true if this Address instance is less than addr2.
static Address max()
          Return an Address instance that reflects the maximum allowable Address value.
 Address minus(Extent extent)
          Subtract an Extent from this Address, and return the result.
 Address minus(int v)
          Subtract an integer from this Address, and return the result.
 Address minus(Offset offset)
          Subtract an Offset from this Address, and return the result.
 boolean NE(Address addr2)
          Return true if this Address instance is not equal to addr2.
 Address plus(Extent extent)
          Add an Extent to this Address, and return the sum.
 Address plus(int v)
          Add an integer to this Address, and return the sum.
 Address plus(Offset offset)
          Add an Offset to this Address, and return the sum.
 void prefetch()
          Prefetch a cache-line, architecture-independent
 Address prepareAddress()
          Prepare for an atomic store operation.
 Address prepareAddress(Offset offset)
          Prepare for an atomic store operation.
 int prepareInt()
          Prepare for an atomic store operation.
 int prepareInt(Offset offset)
          Prepare for an atomic store operation.
 ObjectReference prepareObjectReference()
          Prepare for an atomic store operation.
 ObjectReference prepareObjectReference(Offset offset)
          Prepare for an atomic store operation.
 Word prepareWord()
          Prepare for an atomic store operation.
 Word prepareWord(Offset offset)
          Prepare for an atomic store operation.
 void store(Address value)
          Stores the address value in the memory location pointed to by the current instance.
 void store(Address value, Offset offset)
          Stores the address value in the memory location pointed to by the current instance.
 void store(boolean value)
          Stores the boolean value in the memory location pointed to by the current instance.
 void store(boolean value, Offset offset)
          Stores the boolean value in the memory location pointed to by the current instance.
 void store(byte value)
          Stores the byte value in the memory location pointed to by the current instance.
 void store(byte value, Offset offset)
          Stores the byte value in the memory location pointed to by the current instance.
 void store(char value)
          Stores a char value in the memory location pointed to by the current instance.
 void store(char value, Offset offset)
          Stores a char value in the memory location pointed to by the current instance.
 void store(double value)
          Stores a double value in memory location pointed to by the current instance.
 void store(double value, Offset offset)
          Stores a double value in memory location pointed to by the current instance.
 void store(float value)
          Stores the float value in the memory location pointed to by the current instance.
 void store(float value, Offset offset)
          Stores the float value in the memory location pointed to by the current instance.
 void store(int value)
          Stores an int value in memory location pointed to by the current instance.
 void store(int value, Offset offset)
          Stores an int value in memory location pointed to by the current instance.
 void store(long value)
          Stores a double value in memory location pointed to by the current instance.
 void store(long value, Offset offset)
          Stores a double value in memory location pointed to by the current instance.
 void store(ObjectReference value)
          Stores the address value in the memory location pointed to by the current instance.
 void store(ObjectReference value, Offset offset)
          Stores the object reference value in the memory location pointed to by the current instance.
 void store(short value)
          Stores a short value in the memory location pointed to by the current instance.
 void store(short value, Offset offset)
          Stores a short value in the memory location pointed to by the current instance.
 void store(Word value)
          Stores the word value in the memory location pointed to by the current instance.
 void store(Word value, Offset offset)
          Stores the word value in the memory location pointed to by the current instance.
 int toInt()
          Return an integer that reflects the value of this Address instance.
 long toLong()
          Return an long that reflects the value of this Address instance.
 ObjectReference toObjectReference()
          Fabricate an ObjectReference instance from an Address instance.
 Word toWord()
          Return a Word instance that reflects the value of this Address instance.
static Address zero()
          Return an Address instance that reflects the value zero.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Address

public Address()
Method Detail

zero

public static Address zero()
Return an Address instance that reflects the value zero.

Returns:
An address instance that reflects the value zero.

isZero

public boolean isZero()
Return true if this instance is zero.

Returns:
true if this instance is zero.

max

public static Address max()
Return an Address instance that reflects the maximum allowable Address value.

Returns:
An Address instance that reflects the maximum allowable Address value.

isMax

public boolean isMax()
Return true if this instance is the maximum allowable Address value.

Returns:
true if this instance is the maximum allowable Address valu.

fromIntSignExtend

public static Address fromIntSignExtend(int address)
Fabricate an Address instance from an integer, after sign extending the integer.

Parameters:
address - the integer from which to create an Address instance
Returns:
An address instance

fromIntZeroExtend

public static Address fromIntZeroExtend(int address)
Fabricate an Address instance from an integer, after zero extending the integer.

Parameters:
address - the integer from which to create an Address instance
Returns:
An address instance

fromLong

public static Address fromLong(long address)
Fabricate an Address instance from an integer

Parameters:
address - the integer from which to create an Address instance
Returns:
An address instance

toObjectReference

public ObjectReference toObjectReference()
Fabricate an ObjectReference instance from an Address instance. It is the user's responsibility to ensure that the Address is suitable (i.e. it points to the object header, or satisfies any other VM-specific requirement for such a conversion).

Returns:
An ObjectReference instance.

toInt

public int toInt()
Return an integer that reflects the value of this Address instance.

Returns:
An integer that reflects the value of this Address instance.

toLong

public long toLong()
Return an long that reflects the value of this Address instance.

Returns:
An long that reflects the value of this Address instance.

toWord

public Word toWord()
Return a Word instance that reflects the value of this Address instance.

Returns:
A Word instance that reflects the value of this Address instance.

plus

public Address plus(int v)
Add an integer to this Address, and return the sum.

Parameters:
v - the value to be added to this Address
Returns:
An Address instance that reflects the result of the addition.

plus

public Address plus(Offset offset)
Add an Offset to this Address, and return the sum.

Parameters:
offset - the Offset to be added to the address
Returns:
An Address instance that reflects the result of the addition.

plus

public Address plus(Extent extent)
Add an Extent to this Address, and return the sum.

Parameters:
extent - the Extent to be added to this Address
Returns:
An Address instance that reflects the result of the addition.

minus

public Address minus(int v)
Subtract an integer from this Address, and return the result.

Parameters:
v - the integer to be subtracted from this Address.
Returns:
An Address instance that reflects the result of the subtraction.

minus

public Address minus(Offset offset)
Subtract an Offset from this Address, and return the result.

Parameters:
offset - the Offset to be subtracted from this Address.
Returns:
An Address instance that reflects the result of the subtraction.

minus

public Address minus(Extent extent)
Subtract an Extent from this Address, and return the result.

Parameters:
extent - the Extent to be subtracted from this Address.
Returns:
An Address instance that reflects the result of the subtraction.

diff

public Offset diff(Address addr2)
Compute the difference between two Addresses and return the result.

Parameters:
addr2 - the Address to be subtracted from this Address.
Returns:
An Offset instance that reflects the result of the subtraction.

LT

public boolean LT(Address addr2)
Return true if this Address instance is less than addr2.

Parameters:
addr2 - the Address to be compared to this Address.
Returns:
true if this Address instance is less than addr2.

LE

public boolean LE(Address addr2)
Return true if this Address instance is less than or equal to addr2.

Parameters:
addr2 - the Address to be compared to this Address.
Returns:
true if this Address instance is less than or equal to addr2.

GT

public boolean GT(Address addr2)
Return true if this Address instance is greater than addr2.

Parameters:
addr2 - the Address to be compared to this Address.
Returns:
true if this Address instance is greater than addr2.

GE

public boolean GE(Address addr2)
Return true if this Address instance is greater than or equal to addr2.

Parameters:
addr2 - the Address to be compared to this Address.
Returns:
true if this Address instance is greater than or equal to addr2.

EQ

public boolean EQ(Address addr2)
Return true if this Address instance is equal to addr2.

Parameters:
addr2 - the Address to be compared to this Address.
Returns:
true if this Address instance is equal to addr2.

NE

public boolean NE(Address addr2)
Return true if this Address instance is not equal to addr2.

Parameters:
addr2 - the Address to be compared to this Address.
Returns:
true if this Address instance is not equal to addr2.

prefetch

public void prefetch()
Prefetch a cache-line, architecture-independent


loadObjectReference

public ObjectReference loadObjectReference()
Loads a reference from the memory location pointed to by the current instance.

Returns:
the read value

loadObjectReference

public ObjectReference loadObjectReference(Offset offset)
Loads a reference from the memory location pointed to by the current instance.

Parameters:
offset - the offset to the value.
Returns:
the read value

loadByte

public byte loadByte()
Loads a byte from the memory location pointed to by the current instance.

Returns:
the read value

loadByte

public byte loadByte(Offset offset)
Loads a byte from the memory location pointed to by the current instance.

Parameters:
offset - the offset to the value.
Returns:
the read value

loadChar

public char loadChar()
Loads a char from the memory location pointed to by the current instance.

Returns:
the read value

loadChar

public char loadChar(Offset offset)
Loads a char from the memory location pointed to by the current instance.

Parameters:
offset - the offset to the value.
Returns:
the read value

loadShort

public short loadShort()
Loads a short from the memory location pointed to by the current instance.

Returns:
the read value

loadShort

public short loadShort(Offset offset)
Loads a short from the memory location pointed to by the current instance.

Parameters:
offset - the offset to the value.
Returns:
the read value

loadFloat

public float loadFloat()
Loads a float from the memory location pointed to by the current instance.

Returns:
the read value

loadFloat

public float loadFloat(Offset offset)
Loads a float from the memory location pointed to by the current instance.

Parameters:
offset - the offset to the value.
Returns:
the read value

loadInt

public int loadInt()
Loads an int from the memory location pointed to by the current instance.

Returns:
the read value

loadInt

public int loadInt(Offset offset)
Loads an int from the memory location pointed to by the current instance.

Parameters:
offset - the offset to the value.
Returns:
the read value

loadLong

public long loadLong()
Loads a long from the memory location pointed to by the current instance.

Returns:
the read value

loadLong

public long loadLong(Offset offset)
Loads a long from the memory location pointed to by the current instance.

Parameters:
offset - the offset to the value.
Returns:
the read value

loadDouble

public double loadDouble()
Loads a double from the memory location pointed to by the current instance.

Returns:
the read value

loadDouble

public double loadDouble(Offset offset)
Loads a double from the memory location pointed to by the current instance.

Parameters:
offset - the offset to the value.
Returns:
the read value

loadAddress

public Address loadAddress()
Loads an address value from the memory location pointed to by the current instance.

Returns:
the read address value.

loadAddress

public Address loadAddress(Offset offset)
Loads an address value from the memory location pointed to by the current instance.

Parameters:
offset - the offset to the value.
Returns:
the read address value.

loadWord

public Word loadWord()
Loads a word value from the memory location pointed to by the current instance.

Returns:
the read word value.

loadWord

public Word loadWord(Offset offset)
Loads a word value from the memory location pointed to by the current instance.

Parameters:
offset - the offset to the value.
Returns:
the read word value.

store

public void store(ObjectReference value)
Stores the address value in the memory location pointed to by the current instance.

Parameters:
value - The address value to store.

store

public void store(ObjectReference value,
                  Offset offset)
Stores the object reference value in the memory location pointed to by the current instance.

Parameters:
value - The object reference value to store.
offset - the offset to the value.

store

public void store(Address value)
Stores the address value in the memory location pointed to by the current instance.

Parameters:
value - The address value to store.

store

public void store(Address value,
                  Offset offset)
Stores the address value in the memory location pointed to by the current instance.

Parameters:
value - The address value to store.
offset - the offset to the value.

store

public void store(float value)
Stores the float value in the memory location pointed to by the current instance.

Parameters:
value - The float value to store.

store

public void store(float value,
                  Offset offset)
Stores the float value in the memory location pointed to by the current instance.

Parameters:
value - The float value to store.
offset - the offset to the value.

store

public void store(Word value)
Stores the word value in the memory location pointed to by the current instance.

Parameters:
value - The word value to store.

store

public void store(Word value,
                  Offset offset)
Stores the word value in the memory location pointed to by the current instance.

Parameters:
value - The word value to store.
offset - the offset to the value.

store

public void store(boolean value)
Stores the boolean value in the memory location pointed to by the current instance.

Parameters:
value - The boolean value to store.

store

public void store(boolean value,
                  Offset offset)
Stores the boolean value in the memory location pointed to by the current instance.

Parameters:
value - The boolean value to store.
offset - the offset to the value.

store

public void store(byte value)
Stores the byte value in the memory location pointed to by the current instance.

Parameters:
value - The byte value to store.

store

public void store(byte value,
                  Offset offset)
Stores the byte value in the memory location pointed to by the current instance.

Parameters:
value - The byte value to store.
offset - the offset to the value.

store

public void store(int value)
Stores an int value in memory location pointed to by the current instance.

Parameters:
value - The int value to store.

store

public void store(int value,
                  Offset offset)
Stores an int value in memory location pointed to by the current instance.

Parameters:
value - The int value to store.
offset - the offset to the value.

store

public void store(double value)
Stores a double value in memory location pointed to by the current instance.

Parameters:
value - The double value to store.

store

public void store(double value,
                  Offset offset)
Stores a double value in memory location pointed to by the current instance.

Parameters:
value - The double value to store.
offset - the offset to the value.

store

public void store(long value)
Stores a double value in memory location pointed to by the current instance.

Parameters:
value - The double value to store.

store

public void store(long value,
                  Offset offset)
Stores a double value in memory location pointed to by the current instance.

Parameters:
value - The double value to store.
offset - the offset to the value.

store

public void store(char value)
Stores a char value in the memory location pointed to by the current instance.

Parameters:
value - the char value to store.

store

public void store(char value,
                  Offset offset)
Stores a char value in the memory location pointed to by the current instance.

Parameters:
value - the char value to store.
offset - the offset to the value.

store

public void store(short value)
Stores a short value in the memory location pointed to by the current instance.

Parameters:
value - the short value to store.

store

public void store(short value,
                  Offset offset)
Stores a short value in the memory location pointed to by the current instance.

Parameters:
value - the short value to store.
offset - the offset to the value.

prepareWord

public Word prepareWord()
Prepare for an atomic store operation. This must be associated with a related call to attempt.

Returns:
the old value to be passed to an attempt call.

prepareWord

public Word prepareWord(Offset offset)
Prepare for an atomic store operation. This must be associated with a related call to attempt.

Parameters:
offset - the offset to the value.
Returns:
the old value to be passed to an attempt call.

prepareObjectReference

public ObjectReference prepareObjectReference()
Prepare for an atomic store operation. This must be associated with a related call to attempt.

Returns:
the old value to be passed to an attempt call.

prepareObjectReference

public ObjectReference prepareObjectReference(Offset offset)
Prepare for an atomic store operation. This must be associated with a related call to attempt.

Parameters:
offset - the offset to the value.
Returns:
the old value to be passed to an attempt call.

prepareAddress

public Address prepareAddress()
Prepare for an atomic store operation. This must be associated with a related call to attempt.

Returns:
the old value to be passed to an attempt call.

prepareAddress

public Address prepareAddress(Offset offset)
Prepare for an atomic store operation. This must be associated with a related call to attempt.

Parameters:
offset - the offset to the value.
Returns:
the old value to be passed to an attempt call.

prepareInt

public int prepareInt()
Prepare for an atomic store operation. This must be associated with a related call to attempt.

Returns:
the old value to be passed to an attempt call.

prepareInt

public int prepareInt(Offset offset)
Prepare for an atomic store operation. This must be associated with a related call to attempt.

Parameters:
offset - the offset to the value.
Returns:
the old value to be passed to an attempt call.

attempt

public boolean attempt(int old,
                       int value)
Attempt an atomic store operation. This must be associated with a related call to prepare.

Parameters:
old - the old value.
value - the new value.
Returns:
true if the attempt was successful.

attempt

public boolean attempt(int old,
                       int value,
                       Offset offset)
Attempt an atomic store operation. This must be associated with a related call to prepare.

Parameters:
old - the old value.
value - the new value.
offset - the offset to the value.
Returns:
true if the attempt was successful.

attempt

public boolean attempt(Word old,
                       Word value)
Attempt an atomic store operation. This must be associated with a related call to prepare.

Parameters:
old - the old value.
value - the new value.
Returns:
true if the attempt was successful.

attempt

public boolean attempt(Word old,
                       Word value,
                       Offset offset)
Attempt an atomic store operation. This must be associated with a related call to prepare.

Parameters:
old - the old value.
value - the new value.
offset - the offset to the value.
Returns:
true if the attempt was successful.

attempt

public boolean attempt(ObjectReference old,
                       ObjectReference value)
Attempt an atomic store operation. This must be associated with a related call to prepare.

Parameters:
old - the old value.
value - the new value.
Returns:
true if the attempt was successful.

attempt

public boolean attempt(ObjectReference old,
                       ObjectReference value,
                       Offset offset)
Attempt an atomic store operation. This must be associated with a related call to prepare.

Parameters:
old - the old value.
value - the new value.
offset - the offset to the value.
Returns:
true if the attempt was successful.

attempt

public boolean attempt(Address old,
                       Address value)
Attempt an atomic store operation. This must be associated with a related call to prepare.

Parameters:
old - the old value.
value - the new value.
Returns:
true if the attempt was successful.

attempt

public boolean attempt(Address old,
                       Address value,
                       Offset offset)
Attempt an atomic store operation. This must be associated with a related call to prepare.

Parameters:
old - the old value.
value - the new value.
offset - the offset to the value.
Returns:
true if the attempt was successful.