comparison 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
comparison
equal deleted inserted replaced
20403:8ec8971f511a 20404:227a9e5e4b4a
1 package sun.jvm.hotspot.gc_implementation.g1;
2
3 import java.util.Observable;
4 import java.util.Observer;
5
6 import sun.jvm.hotspot.debugger.Address;
7 import sun.jvm.hotspot.runtime.VM;
8 import sun.jvm.hotspot.runtime.VMObject;
9 import sun.jvm.hotspot.types.CIntegerField;
10 import sun.jvm.hotspot.types.Type;
11 import sun.jvm.hotspot.types.TypeDataBase;
12
13 public class G1Allocator extends VMObject {
14
15 //size_t _summary_bytes_used;
16 static private CIntegerField summaryBytesUsedField;
17
18 static {
19 VM.registerVMInitializedObserver(new Observer() {
20 public void update(Observable o, Object data) {
21 initialize(VM.getVM().getTypeDataBase());
22 }
23 });
24 }
25
26 static private synchronized void initialize(TypeDataBase db) {
27 Type type = db.lookupType("G1Allocator");
28
29 summaryBytesUsedField = type.getCIntegerField("_summary_bytes_used");
30 }
31
32 public long getSummaryBytes() {
33 return summaryBytesUsedField.getValue(addr);
34 }
35
36 public G1Allocator(Address addr) {
37 super(addr);
38
39 }
40 }