use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class RCHeader method attemptToLog.
/**
* Attempt to log <code>object</code> for coalescing RC. This is
* used to handle a race to log the object, and returns
* <code>true</code> if we are to log the object and
* <code>false</code> if we lost the race to log the object.
*
* <p>If this method returns <code>true</code>, it leaves the object
* in the <code>BEING_LOGGED</code> state. It is the responsibility
* of the caller to change the object to <code>LOGGED</code> once
* the logging is complete.
*
* @see #makeLogged(ObjectReference)
* @param object The object in question
* @return <code>true</code> if the race to log
* <code>object</code>was won.
*/
@Inline
@Uninterruptible
public static boolean attemptToLog(ObjectReference object) {
Word oldValue;
do {
oldValue = VM.objectModel.prepareAvailableBits(object);
if (oldValue.and(LOGGING_MASK).EQ(LOGGED)) {
return false;
}
} while ((oldValue.and(LOGGING_MASK).EQ(BEING_LOGGED)) || !VM.objectModel.attemptAvailableBits(object, oldValue, oldValue.or(BEING_LOGGED)));
if (VM.VERIFY_ASSERTIONS) {
Word value = VM.objectModel.readAvailableBitsWord(object);
VM.assertions._assert(value.and(LOGGING_MASK).EQ(BEING_LOGGED));
}
return true;
}
use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class RCHeader method initializeHeader.
/**
* Perform any required initialization of the GC portion of the header.
*
* @param object the object
* @param initialInc start with a reference count of 1 (0 if <code>false</code>)
*/
@Inline
public static void initializeHeader(ObjectReference object, boolean initialInc) {
Word existingValue = VM.objectModel.readAvailableBitsWord(object);
Word initialValue = existingValue.and(WRITE_MASK).or((initialInc) ? INCREMENT : Word.zero());
VM.objectModel.writeAvailableBitsWord(object, initialValue);
}
use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class RCHeader method initRC.
/**
* Initialize the reference count of an object. Return either
* <code>INC_OLD</code> if the object is not new,
* <code>INC_NEW</code> if the object is new.
*
* @param object The object whose RC is to be initialized.
* @return <code>INC_OLD</code> if the object is not new,
* <code>INC_NEW</code> if the object is new.
*/
@Inline
public static int initRC(ObjectReference object) {
Word oldValue, newValue;
int rtn;
if (VM.VERIFY_ASSERTIONS)
VM.assertions._assert(RCBase.isRCObject(object));
do {
oldValue = VM.objectModel.prepareAvailableBits(object);
newValue = oldValue.and(WRITE_MASK).or(INCREMENT);
if (RCBase.BUILD_FOR_GENRC) {
rtn = INC_OLD;
} else {
if (isHeaderNew(oldValue)) {
newValue = newValue.or(NEW_BIT_MASK);
rtn = INC_NEW;
} else {
rtn = INC_OLD;
}
}
} while (!VM.objectModel.attemptAvailableBits(object, oldValue, newValue));
return rtn;
}
use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class RCHeader method makeLogged.
/**
* Signify completion of logging <code>object</code>.
*
* <code>object</code> is left in the <code>LOGGED</code> state.
*
* @see #attemptToLog(ObjectReference)
* @param object The object whose state is to be changed.
*/
@Inline
@Uninterruptible
public static void makeLogged(ObjectReference object) {
Word value = VM.objectModel.readAvailableBitsWord(object);
if (VM.VERIFY_ASSERTIONS)
VM.assertions._assert(value.and(LOGGING_MASK).NE(LOGGED));
VM.objectModel.writeAvailableBitsWord(object, value.and(LOGGING_MASK.not()));
}
use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class RCHeader method decRC.
/**
* Decrement the reference count of an object. Return either
* <code>DEC_KILL</code> if the count went to zero,
* <code>DEC_ALIVE</code> if the count did not go to zero.
*
* @param object The object whose RC is to be decremented.
* @return <code>DEC_KILL</code> if the count went to zero,
* <code>DEC_ALIVE</code> if the count did not go to zero.
*/
@Inline
@Uninterruptible
public static int decRC(ObjectReference object) {
Word oldValue, newValue;
int rtn;
if (VM.VERIFY_ASSERTIONS) {
VM.assertions._assert(RCBase.isRCObject(object));
VM.assertions._assert(isLiveRC(object));
}
do {
oldValue = VM.objectModel.prepareAvailableBits(object);
if (isStuck(oldValue))
return DEC_ALIVE;
newValue = oldValue.minus(INCREMENT);
if (newValue.and(READ_MASK).LT(LIVE_THRESHOLD)) {
rtn = DEC_KILL;
} else {
rtn = DEC_ALIVE;
}
} while (!VM.objectModel.attemptAvailableBits(object, oldValue, newValue));
return rtn;
}
Aggregations