Merge
authoramurillo
Thu, 03 Sep 2015 15:48:24 -0700
changeset 32505 341ac0627cc0
parent 32427 c22b7e41adf3 (current diff)
parent 32504 f090ee000019 (diff)
child 32506 9362d0b4e2df
child 32638 278a8361e6f9
child 32758 f443e49794a4
Merge
--- a/jdk/src/java.management/share/classes/sun/management/HotspotCompilation.java	Wed Sep 02 14:11:50 2015 -0700
+++ b/jdk/src/java.management/share/classes/sun/management/HotspotCompilation.java	Thu Sep 03 15:48:24 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -76,7 +76,6 @@
     private LongCounter lastInvalidatedType;
 
     private class CompilerThreadInfo {
-        int index;
         String name;
         StringCounter method;
         LongCounter type;
@@ -90,14 +89,6 @@
             this.compiles = (LongCounter) lookup(basename + "compiles");
             this.time = (LongCounter) lookup(basename + "time");
         }
-        CompilerThreadInfo(String bname) {
-            String basename = bname + ".";
-            this.name = bname;
-            this.method = (StringCounter) lookup(basename + "method");
-            this.type = (LongCounter) lookup(basename + "type");
-            this.compiles = (LongCounter) lookup(basename + "compiles");
-            this.time = (LongCounter) lookup(basename + "time");
-        }
 
         CompilerThreadStat getCompilerThreadStat() {
             MethodInfo minfo = new MethodInfo(method.stringValue(),
@@ -109,7 +100,7 @@
                                           minfo);
         }
     }
-    private CompilerThreadInfo[] threads;
+    private List<CompilerThreadInfo> threads;
     private int numActiveThreads; // number of active compiler threads
 
     private Map<String, Counter> counters;
@@ -158,18 +149,12 @@
         numActiveThreads = (int) compilerThreads.longValue();
 
         // Allocate CompilerThreadInfo for compilerThread and adaptorThread
-        threads = new CompilerThreadInfo[numActiveThreads+1];
+        threads = new ArrayList<CompilerThreadInfo>();
 
-        // AdaptorThread has index 0
-        if (counters.containsKey(SUN_CI + "adapterThread.compiles")) {
-            threads[0] = new CompilerThreadInfo("adapterThread", 0);
-            numActiveThreads++;
-        } else {
-            threads[0] = null;
-        }
-
-        for (int i = 1; i < threads.length; i++) {
-            threads[i] = new CompilerThreadInfo("compilerThread", i-1);
+        for (int i = 0; i < numActiveThreads; i++) {
+            if (counters.containsKey(SUN_CI + "compilerThread." + i + ".method")) {
+                threads.add(new CompilerThreadInfo("compilerThread", i));
+            }
         }
     }
 
@@ -197,15 +182,10 @@
         return nmethodSize.longValue();
     }
 
-    public java.util.List<CompilerThreadStat> getCompilerThreadStats() {
-        List<CompilerThreadStat> list = new ArrayList<>(threads.length);
-        int i = 0;
-        if (threads[0] == null) {
-            // no adaptor thread
-            i = 1;
-        }
-        for (; i < threads.length; i++) {
-            list.add(threads[i].getCompilerThreadStat());
+    public List<CompilerThreadStat> getCompilerThreadStats() {
+        List<CompilerThreadStat> list = new ArrayList<>(threads.size());
+        for (CompilerThreadInfo info : threads) {
+            list.add(info.getCompilerThreadStat());
         }
         return list;
     }