--- old/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java 2015-03-06 20:51:39.407304979 +0100 +++ new/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java 2015-03-06 20:51:39.347303230 +0100 @@ -36,6 +36,7 @@ import sun.jvm.hotspot.runtime.VM; import sun.jvm.hotspot.runtime.VMObjectFactory; import sun.jvm.hotspot.types.AddressField; +import sun.jvm.hotspot.types.CIntegerField; import sun.jvm.hotspot.types.Type; import sun.jvm.hotspot.types.TypeDataBase; @@ -46,14 +47,14 @@ static private long hrmFieldOffset; // MemRegion _g1_reserved; static private long g1ReservedFieldOffset; - // G1Allocator* _allocator - static private AddressField g1Allocator; // G1MonitoringSupport* _g1mm; static private AddressField g1mmField; // HeapRegionSet _old_set; static private long oldSetFieldOffset; // HeapRegionSet _humongous_set; static private long humongousSetFieldOffset; + // size_t _summary_bytes_used; + static private CIntegerField summaryBytesUsedField; static { VM.registerVMInitializedObserver(new Observer() { @@ -67,10 +68,10 @@ Type type = db.lookupType("G1CollectedHeap"); hrmFieldOffset = type.getField("_hrm").getOffset(); - g1Allocator = type.getAddressField("_allocator"); g1mmField = type.getAddressField("_g1mm"); oldSetFieldOffset = type.getField("_old_set").getOffset(); humongousSetFieldOffset = type.getField("_humongous_set").getOffset(); + summaryBytesUsedField = type.getCIntegerField("_summary_bytes_used"); } public long capacity() { @@ -78,7 +79,7 @@ } public long used() { - return allocator().getSummaryBytes(); + return summaryBytesUsedField.getValue(addr); } public long n_regions() { @@ -96,11 +97,6 @@ return (G1MonitoringSupport) VMObjectFactory.newObject(G1MonitoringSupport.class, g1mmAddr); } - public G1Allocator allocator() { - Address g1AllocatorAddr = g1Allocator.getValue(addr); - return (G1Allocator) VMObjectFactory.newObject(G1Allocator.class, g1AllocatorAddr); - } - public HeapRegionSetBase oldSet() { Address oldSetAddr = addr.addOffsetTo(oldSetFieldOffset); return (HeapRegionSetBase) VMObjectFactory.newObject(HeapRegionSetBase.class,