src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ReversePtrsAnalysis.java
changeset 48787 7638bf98a312
parent 47216 71c04702a3d5
child 54955 46409371a691
equal deleted inserted replaced
48786:cc231bd80c8b 48787:7638bf98a312
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   106                        new RootVisitor("JNI handle root" + threadDesc));
   106                        new RootVisitor("JNI handle root" + threadDesc));
   107     }
   107     }
   108 
   108 
   109     // Do global JNI handles
   109     // Do global JNI handles
   110     JNIHandles handles = VM.getVM().getJNIHandles();
   110     JNIHandles handles = VM.getVM().getJNIHandles();
   111     doJNIHandleBlock(handles.globalHandles(),
   111     doOopStorage(handles.globalHandles(),
   112                      new RootVisitor("Global JNI handle root"));
   112                  new RootVisitor("Global JNI handle root"));
   113     doJNIHandleBlock(handles.weakGlobalHandles(),
   113     doOopStorage(handles.weakGlobalHandles(),
   114                      new RootVisitor("Weak global JNI handle root"));
   114                  new RootVisitor("Weak global JNI handle root"));
   115 
   115 
   116     // Do Java-level static fields
   116     // Do Java-level static fields
   117     ClassLoaderDataGraph cldg = VM.getVM().getClassLoaderDataGraph();
   117     ClassLoaderDataGraph cldg = VM.getVM().getClassLoaderDataGraph();
   118     cldg.classesDo(new ClassLoaderDataGraph.ClassVisitor() {
   118     cldg.classesDo(new ClassLoaderDataGraph.ClassVisitor() {
   119 
   119 
   304 
   304 
   305   // Traverse a JNIHandleBlock
   305   // Traverse a JNIHandleBlock
   306   private void doJNIHandleBlock(JNIHandleBlock handles, AddressVisitor oopVisitor) {
   306   private void doJNIHandleBlock(JNIHandleBlock handles, AddressVisitor oopVisitor) {
   307     handles.oopsDo(oopVisitor);
   307     handles.oopsDo(oopVisitor);
   308   }
   308   }
       
   309 
       
   310   // Traverse jobjects in global JNIHandles
       
   311   private void doOopStorage(OopStorage oopSet, AddressVisitor oopVisitor) {
       
   312     oopSet.oopsDo(oopVisitor);
       
   313   }
   309 }
   314 }