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 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package jdk.vm.ci.hotspot; 24 25 import java.lang.ref.*; 26 import java.util.*; 27 28 import jdk.vm.ci.meta.*; 29 30 /** 31 * This class manages the set of metadata roots that must be scanned during garbage collection. 32 * Because of class redefinition Method* and ConstantPool* can be freed if they don't appear to be 33 * in use so they must be tracked when there are live references to them from Java. 34 * 35 * The general theory of operation is that all {@link MetaspaceWrapperObject}s are created by 36 * calling into the VM which calls back out to actually create the wrapper instance. During the call 37 * the VM keeps the metadata reference alive through the use of metadata handles. Once the call 38 * completes the wrapper object is registered here and will be scanned during metadata scanning. The 39 * weakness of the reference to the wrapper object allows them to be reclaimed when they are no 40 * longer used. 41 * 42 */ 43 public class HotSpotJVMCIMetaAccessContext implements JVMCIMetaAccessContext { 44 45 /** 46 * The set of currently live contexts used for tracking of live metadata. Examined from the VM 47 * during garbage collection. 48 */ | 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 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package jdk.vm.ci.hotspot; 24 25 import java.lang.ref.Reference; 26 import java.lang.ref.ReferenceQueue; 27 import java.lang.ref.WeakReference; 28 import java.util.Arrays; 29 import java.util.Iterator; 30 import java.util.Map; 31 import java.util.WeakHashMap; 32 33 import jdk.vm.ci.meta.JVMCIMetaAccessContext; 34 import jdk.vm.ci.meta.JavaKind; 35 import jdk.vm.ci.meta.ResolvedJavaType; 36 37 /** 38 * This class manages the set of metadata roots that must be scanned during garbage collection. 39 * Because of class redefinition Method* and ConstantPool* can be freed if they don't appear to be 40 * in use so they must be tracked when there are live references to them from Java. 41 * 42 * The general theory of operation is that all {@link MetaspaceWrapperObject}s are created by 43 * calling into the VM which calls back out to actually create the wrapper instance. During the call 44 * the VM keeps the metadata reference alive through the use of metadata handles. Once the call 45 * completes the wrapper object is registered here and will be scanned during metadata scanning. The 46 * weakness of the reference to the wrapper object allows them to be reclaimed when they are no 47 * longer used. 48 * 49 */ 50 public class HotSpotJVMCIMetaAccessContext implements JVMCIMetaAccessContext { 51 52 /** 53 * The set of currently live contexts used for tracking of live metadata. Examined from the VM 54 * during garbage collection. 55 */ |