use of org.vmmagic.pragma.Interruptible in project JikesRVM by JikesRVM.
the class Services method longAsHexString.
/**
* Format a 64 bit number as "0x" followed by 16 hex digits.
* Do this without referencing Long or Character classes,
* in order to avoid dynamic linking.
*
* @param number the number to format
* @return a String with the hex representation of the long
*/
@Interruptible
public static String longAsHexString(long number) {
char[] buf = new char[18];
int index = 18;
while (--index > 1) {
int digit = (int) (number & 0x000000000000000fL);
buf[index] = digit <= 9 ? (char) ('0' + digit) : (char) ('a' + digit - 10);
number >>= 4;
}
buf[index--] = 'x';
buf[index] = '0';
return new String(buf);
}
use of org.vmmagic.pragma.Interruptible in project JikesRVM by JikesRVM.
the class Services method intAsHexString.
/**
* Format a 32 bit number as "0x" followed by 8 hex digits.
* Do this without referencing Integer or Character classes,
* in order to avoid dynamic linking.
*
* @param number the number to format
* @return a String with the hex representation of the integer
*/
@Interruptible
public static String intAsHexString(int number) {
char[] buf = new char[10];
int index = 10;
while (--index > 1) {
int digit = number & 0x0000000f;
buf[index] = digit <= 9 ? (char) ('0' + digit) : (char) ('a' + digit - 10);
number >>= 4;
}
buf[index--] = 'x';
buf[index] = '0';
return new String(buf);
}
use of org.vmmagic.pragma.Interruptible in project JikesRVM by JikesRVM.
the class Services method getHexString.
@Interruptible
public static String getHexString(int i, boolean blank) {
StringBuilder buf = new StringBuilder(8);
for (int j = 0; j < 8; j++, i <<= 4) {
int n = i >>> 28;
if (blank && (n == 0) && (j != 7)) {
buf.append(' ');
} else {
buf.append(Character.forDigit(n, 16));
blank = false;
}
}
return buf.toString();
}
use of org.vmmagic.pragma.Interruptible in project JikesRVM by JikesRVM.
the class RVMThread method notify.
/**
* Support for Java {@link java.lang.Object#notify()} synchronization
* primitive.
*
* @param o the object synchronized on
*/
@Interruptible
public static void notify(Object o) {
if (STATS)
notifyOperations++;
Lock l = ObjectModel.getHeavyLock(o, false);
if (l == null)
return;
// the reason for locking: when inflating a lock we *first* install it in the status
// word and *then* initialize its state. but fortunately, we do so while holding
// the lock's mutex. thus acquiring the lock's mutex is the only way to ensure that
// we see the lock's state after initialization.
l.mutex.lock();
int owner = l.getOwnerId();
l.mutex.unlock();
int me = getCurrentThread().getLockingId();
if (owner != me) {
raiseIllegalMonitorStateException("notifying (expected lock to be held by " + me + "(" + getCurrentThread().getLockingId() + ") but was held by " + owner + "(" + l.getOwnerId() + ")) ", o);
}
l.mutex.lock();
RVMThread toAwaken = l.waiting.dequeue();
l.mutex.unlock();
if (toAwaken != null) {
toAwaken.monitor().lockedBroadcastNoHandshake();
}
}
use of org.vmmagic.pragma.Interruptible in project JikesRVM by JikesRVM.
the class EventTypeChunk method add.
@Interruptible
public boolean add(EventType et) {
boolean success = false;
int savedPosition = getPosition();
try {
if (!addInt(et.getIndex()))
return false;
if (!addStringInternal(getChars(et.getName())))
return false;
if (!addStringInternal(getChars(et.getDescription())))
return false;
if (!addInt(et.getNumberOfInts()))
return false;
if (!addInt(et.getNumberOfLongs()))
return false;
if (!addInt(et.getNumberOfDoubles()))
return false;
if (!addInt(et.getNumberOfStrings()))
return false;
for (int i = 0; i < et.getNumberOfAttributes(); i++) {
EventAttribute ea = et.getAttribute(i);
if (!addStringInternal(getChars(ea.getName())))
return false;
if (!addStringInternal(getChars(ea.getDescription())))
return false;
}
success = true;
numberOfEventTypes++;
return true;
} finally {
if (!success) {
seek(savedPosition);
}
}
}
Aggregations