Search in sources :

Example 71 with ObjectReference

use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.

the class Barriers method doubleFieldWrite.

/**
 * Barrier for writes of doubles into fields of instances (i.e. putfield).
 *
 * @param ref the object which is the subject of the putfield
 * @param value the new value for the field
 * @param offset the offset of the field to be modified
 * @param locationMetadata an int that encodes the source location being modified
 */
@Inline
@Entrypoint
public static void doubleFieldWrite(Object ref, double value, Offset offset, int locationMetadata) {
    if (NEEDS_DOUBLE_GC_WRITE_BARRIER) {
        ObjectReference src = ObjectReference.fromObject(ref);
        Selected.Mutator.get().doubleWrite(src, src.toAddress().plus(offset), value, offset.toWord(), Word.fromIntZeroExtend(locationMetadata), INSTANCE_FIELD);
    } else if (VM.VerifyAssertions)
        VM._assert(VM.NOT_REACHED);
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) Entrypoint(org.vmmagic.pragma.Entrypoint) Inline(org.vmmagic.pragma.Inline)

Example 72 with ObjectReference

use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.

the class Barriers method charFieldWrite.

/**
 * Barrier for writes of chars into fields of instances (i.e. putfield).
 *
 * @param ref the object which is the subject of the putfield
 * @param value the new value for the field
 * @param offset the offset of the field to be modified
 * @param locationMetadata an int that encodes the source location being modified
 */
@Inline
@Entrypoint
public static void charFieldWrite(Object ref, char value, Offset offset, int locationMetadata) {
    if (NEEDS_CHAR_GC_WRITE_BARRIER) {
        ObjectReference src = ObjectReference.fromObject(ref);
        Selected.Mutator.get().charWrite(src, src.toAddress().plus(offset), value, offset.toWord(), Word.fromIntZeroExtend(locationMetadata), INSTANCE_FIELD);
    } else if (VM.VerifyAssertions)
        VM._assert(VM.NOT_REACHED);
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) Entrypoint(org.vmmagic.pragma.Entrypoint) Inline(org.vmmagic.pragma.Inline)

Example 73 with ObjectReference

use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.

the class Barriers method objectStaticWrite.

/**
 * Barrier for writes of objects from statics (eg putstatic)
 *
 * @param value the new value to be stored
 * @param offset the offset of the field to be modified
 * @param locationMetadata an int that encodes the source location being modified
 */
@Inline
@Entrypoint
public static void objectStaticWrite(Object value, Offset offset, int locationMetadata) {
    if (NEEDS_OBJECT_GC_PUTSTATIC_BARRIER) {
        ObjectReference src = ObjectReference.fromObject(Magic.getJTOC());
        Selected.Mutator.get().objectReferenceNonHeapWrite(src.toAddress().plus(offset), ObjectReference.fromObject(value), offset.toWord(), Word.fromIntZeroExtend(locationMetadata));
    } else if (VM.VerifyAssertions)
        VM._assert(VM.NOT_REACHED);
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) Entrypoint(org.vmmagic.pragma.Entrypoint) Inline(org.vmmagic.pragma.Inline)

Example 74 with ObjectReference

use of org.vmmagic.unboxed.ObjectReference in project JikesRVM by JikesRVM.

the class DebugUtil method validRef.

@Uninterruptible
public static boolean validRef(ObjectReference ref) {
    if (ref.isNull())
        return true;
    if (!Space.isMappedObject(ref)) {
        VM.sysWrite("validRef: REF outside heap, ref = ");
        VM.sysWrite(ref);
        VM.sysWriteln();
        Space.printVMMap();
        return false;
    }
    if (MOVES_OBJECTS) {
    /*
      TODO: Work out how to check if forwarded
      if (Plan.isForwardedOrBeingForwarded(ref)) {
        // TODO: actually follow forwarding pointer
        // (need to bound recursion when things are broken!!)
        return true;
      }
      */
    }
    TIB tib = ObjectModel.getTIB(ref);
    Address tibAddr = Magic.objectAsAddress(tib);
    if (!Space.isMappedObject(ObjectReference.fromObject(tib))) {
        VM.sysWrite("validRef: TIB outside heap, ref = ");
        VM.sysWrite(ref);
        VM.sysWrite(" tib = ");
        VM.sysWrite(tibAddr);
        VM.sysWriteln();
        ObjectModel.dumpHeader(ref);
        return false;
    }
    if (tibAddr.isZero()) {
        VM.sysWrite("validRef: TIB is Zero! ");
        VM.sysWrite(ref);
        VM.sysWriteln();
        ObjectModel.dumpHeader(ref);
        return false;
    }
    if (tib.length() == 0) {
        VM.sysWrite("validRef: TIB length zero, ref = ");
        VM.sysWrite(ref);
        VM.sysWrite(" tib = ");
        VM.sysWrite(tibAddr);
        VM.sysWriteln();
        ObjectModel.dumpHeader(ref);
        return false;
    }
    ObjectReference type = ObjectReference.fromObject(tib.getType());
    if (!validType(type)) {
        VM.sysWrite("validRef: invalid TYPE, ref = ");
        VM.sysWrite(ref);
        VM.sysWrite(" tib = ");
        VM.sysWrite(Magic.objectAsAddress(tib));
        VM.sysWrite(" type = ");
        VM.sysWrite(type);
        VM.sysWriteln();
        ObjectModel.dumpHeader(ref);
        return false;
    }
    return true;
}
Also used : Address(org.vmmagic.unboxed.Address) ObjectReference(org.vmmagic.unboxed.ObjectReference) TIB(org.jikesrvm.objectmodel.TIB) Uninterruptible(org.vmmagic.pragma.Uninterruptible)

Aggregations

ObjectReference (org.vmmagic.unboxed.ObjectReference)74 Inline (org.vmmagic.pragma.Inline)35 Entrypoint (org.vmmagic.pragma.Entrypoint)33 Offset (org.vmmagic.unboxed.Offset)21 Address (org.vmmagic.unboxed.Address)12 StackFrame (org.mmtk.harness.lang.runtime.StackFrame)5 RVMType (org.jikesrvm.classloader.RVMType)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 OutOfMemory (org.mmtk.harness.exception.OutOfMemory)2 ObjectValue (org.mmtk.harness.lang.runtime.ObjectValue)2 CollectorContext (org.mmtk.plan.CollectorContext)2 Uninterruptible (org.vmmagic.pragma.Uninterruptible)2 ArrayDeque (java.util.ArrayDeque)1 HashSet (java.util.HashSet)1 AbstractRegisters (org.jikesrvm.architecture.AbstractRegisters)1 RVMMethod (org.jikesrvm.classloader.RVMMethod)1 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)1 TIB (org.jikesrvm.objectmodel.TIB)1 NoInline (org.vmmagic.pragma.NoInline)1