Exemple #1
0
  /** gc mark all objects stored in static reference fields */
  void markStaticRoot(Heap heap) {
    ClassInfo ci = getClassInfo();
    int n = ci.getNumberOfStaticFields();

    for (int i = 0; i < n; i++) {
      FieldInfo fi = ci.getStaticField(i);
      if (fi.isReference()) {
        int objref = fields.getIntValue(fi.getStorageOffset());
        heap.markStaticRoot(objref);
      }
    }

    // don't forget the class object itself (which is not a field)
    heap.markStaticRoot(classObjectRef);
  }
  /**
   * mark all our fields as static (shared) reachable. No need to set our own attributes, since we
   * reside in the StaticArea
   *
   * @aspects: gc
   */
  void markStaticRoot(Heap heap) {
    // WATCH IT! this overrides the heap object behavior in our super class.
    // See ElementInfo.markStaticRoot() for details

    ClassInfo ci = getClassInfo();
    int n = ci.getNumberOfStaticFields();

    for (int i = 0; i < n; i++) {
      FieldInfo fi = ci.getStaticField(i);
      if (fi.isReference()) {
        heap.markStaticRoot(fields.getIntValue(fi.getStorageOffset()));
      }
    }

    // don't forget the class object itself (which is not a field)
    heap.markStaticRoot(classObjectRef);
  }
Exemple #3
0
 protected ElementInfo getReferencedElementInfo(FieldInfo fi) {
   assert fi.isReference();
   Heap heap = VM.getVM().getHeap();
   return heap.get(getIntField(fi));
 }