view agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1Allocator.java @ 20404:227a9e5e4b4a

8057536: Refactor G1 to allow context specific allocations Summary: Splitting out a g1 allocator class to simply specialized allocators which can associate each allocation with a given context. Reviewed-by: mgerdin, brutisso
author sjohanss
date Fri, 05 Sep 2014 09:49:19 +0200
parents
children
line wrap: on
line source

package sun.jvm.hotspot.gc_implementation.g1;

import java.util.Observable;
import java.util.Observer;

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.VMObject;
import sun.jvm.hotspot.types.CIntegerField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class G1Allocator extends VMObject {

  //size_t _summary_bytes_used;
  static private CIntegerField summaryBytesUsedField;

  static {
    VM.registerVMInitializedObserver(new Observer() {
      public void update(Observable o, Object data) {
        initialize(VM.getVM().getTypeDataBase());
      }
    });
  }

  static private synchronized void initialize(TypeDataBase db) {
    Type type = db.lookupType("G1Allocator");

    summaryBytesUsedField = type.getCIntegerField("_summary_bytes_used");
  }

  public long getSummaryBytes() {
    return summaryBytesUsedField.getValue(addr);
  }

  public G1Allocator(Address addr) {
    super(addr);

  }
}