Exemple #1
0
  /**
   * Takes the passed address and (atomically) performs any read barrier actions before returning it
   * as an object.
   *
   * @param tmp The non-zero referent address
   * @return The referent object.
   */
  @Uninterruptible
  @Inline
  Object getInternal() {
    if (RVMType.JavaLangRefReferenceReferenceField.madeTraced()) {
      if (NEEDS_OBJECT_GETFIELD_BARRIER) {
        return Barriers.objectFieldRead(
            this,
            RVMType.JavaLangRefReferenceReferenceField.getOffset(),
            RVMType.JavaLangRefReferenceReferenceField.getId());
      } else {
        return Magic.getObjectAtOffset(
            this,
            RVMType.JavaLangRefReferenceReferenceField.getOffset(),
            RVMType.JavaLangRefReferenceReferenceField.getId());
      }
    } else {
      Address tmp = _referent;
      if (tmp.isZero()) {
        return null;
      } else {
        Object ref = Magic.addressAsObject(tmp);

        if (Barriers.NEEDS_JAVA_LANG_REFERENCE_READ_BARRIER) {
          ref = Barriers.javaLangReferenceReadBarrier(ref);
        }
        return ref;
      }
    }
  }
Exemple #2
0
 public void clear() {
   if (RVMType.JavaLangRefReferenceReferenceField.madeTraced()) {
     if (NEEDS_OBJECT_GETFIELD_BARRIER) {
       Barriers.objectFieldWrite(
           this,
           null,
           RVMType.JavaLangRefReferenceReferenceField.getOffset(),
           RVMType.JavaLangRefReferenceReferenceField.getId());
     } else {
       Magic.setObjectAtOffset(
           this,
           RVMType.JavaLangRefReferenceReferenceField.getOffset(),
           null,
           RVMType.JavaLangRefReferenceReferenceField.getId());
     }
   }
 }