< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/CompactibleFreeListSpace.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -33,11 +33,11 @@
 import sun.jvm.hotspot.oops.*;
 import sun.jvm.hotspot.runtime.*;
 import sun.jvm.hotspot.types.*;
 import sun.jvm.hotspot.utilities.*;
 
-public class CompactibleFreeListSpace extends CompactibleSpace {
+public class CompactibleFreeListSpace extends CompactibleSpace implements LiveRegionsProvider {
    private static AddressField collectorField;
    private static AddressField indexedFreeListField;
    private static AddressField dictionaryField;
    private static long         smallLinearAllocBlockFieldOffset;
 

@@ -91,14 +91,14 @@
    public long used() {
      return capacity() - free();
    }
 
    public long used0() {
-      List regions = getLiveRegions();
+      List<MemRegion> regions = getLiveRegions();
       long usedSize = 0L;
-      for (Iterator itr = regions.iterator(); itr.hasNext();) {
-         MemRegion mr = (MemRegion) itr.next();
+      for (Iterator<MemRegion> itr = regions.iterator(); itr.hasNext();) {
+         MemRegion mr = itr.next();
          usedSize += mr.byteSize();
       }
       return usedSize;
    }
 

@@ -152,12 +152,13 @@
          }
        }
        return addr;
    }
 
-   public List/*<MemRegion>*/ getLiveRegions() {
-      List res = new ArrayList(); // List<MemRegion>
+  @Override
+   public List<MemRegion> getLiveRegions() {
+      List<MemRegion> res = new ArrayList<>();
       VM vm = VM.getVM();
       Debugger dbg = vm.getDebugger();
       ObjectHeap heap = vm.getObjectHeap();
       Address cur = bottom();
       Address regionStart = cur;
< prev index next >