Search in sources :

Example 11 with Interruptible

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);
}
Also used : Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible)

Example 12 with Interruptible

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);
}
Also used : Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible)

Example 13 with Interruptible

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();
}
Also used : Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible)

Example 14 with Interruptible

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();
    }
}
Also used : Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible)

Example 15 with Interruptible

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);
        }
    }
}
Also used : EventAttribute(com.ibm.tuningfork.tracegen.types.EventAttribute) Interruptible(org.vmmagic.pragma.Interruptible)

Aggregations

Interruptible (org.vmmagic.pragma.Interruptible)44 Entrypoint (org.vmmagic.pragma.Entrypoint)22 Address (org.vmmagic.unboxed.Address)11 NoInline (org.vmmagic.pragma.NoInline)9 TIB (org.jikesrvm.objectmodel.TIB)8 RVMArray (org.jikesrvm.classloader.RVMArray)7 RVMType (org.jikesrvm.classloader.RVMType)6 RVMMethod (org.jikesrvm.classloader.RVMMethod)3 Offset (org.vmmagic.unboxed.Offset)3 NormalMethod (org.jikesrvm.classloader.NormalMethod)2 RVMClass (org.jikesrvm.classloader.RVMClass)2 CodeArray (org.jikesrvm.compilers.common.CodeArray)2 CallSiteTreeNode (org.jikesrvm.compilers.opt.inlining.CallSiteTreeNode)2 CollectorThread (org.jikesrvm.mm.mminterface.CollectorThread)2 Extent (org.vmmagic.unboxed.Extent)2 EventAttribute (com.ibm.tuningfork.tracegen.types.EventAttribute)1 Atom (org.jikesrvm.classloader.Atom)1 TypeReference (org.jikesrvm.classloader.TypeReference)1 BaselineCompiledMethod (org.jikesrvm.compilers.baseline.BaselineCompiledMethod)1 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)1