comparison agent/src/share/classes/sun/jvm/hotspot/memory/ProtectionDomainEntry.java @ 12837:82af7d7a0128

8003420: NPG: make new GC root for pd_set Summary: Move protection domain oops from system dictionary entries into a seperate set; the system dictionary references entries in that set now. This allows fast iteration during non-classunloading garbage collection. Implementation based on initial prototype from Ioi Lam (iklam). Reviewed-by: coleenp, iklam
author tschatzl
date Wed, 09 Oct 2013 10:57:01 +0200
parents c18cbe5936b8
children
comparison
equal deleted inserted replaced
12836:b4d8a3d4db73 12837:82af7d7a0128
1 /* 1 /*
2 * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2013, 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.
30 import sun.jvm.hotspot.runtime.*; 30 import sun.jvm.hotspot.runtime.*;
31 import sun.jvm.hotspot.types.*; 31 import sun.jvm.hotspot.types.*;
32 32
33 public class ProtectionDomainEntry extends VMObject { 33 public class ProtectionDomainEntry extends VMObject {
34 private static AddressField nextField; 34 private static AddressField nextField;
35 private static sun.jvm.hotspot.types.OopField protectionDomainField; 35 private static AddressField pdCacheField;
36 36
37 static { 37 static {
38 VM.registerVMInitializedObserver(new Observer() { 38 VM.registerVMInitializedObserver(new Observer() {
39 public void update(Observable o, Object data) { 39 public void update(Observable o, Object data) {
40 initialize(VM.getVM().getTypeDataBase()); 40 initialize(VM.getVM().getTypeDataBase());
44 44
45 private static synchronized void initialize(TypeDataBase db) { 45 private static synchronized void initialize(TypeDataBase db) {
46 Type type = db.lookupType("ProtectionDomainEntry"); 46 Type type = db.lookupType("ProtectionDomainEntry");
47 47
48 nextField = type.getAddressField("_next"); 48 nextField = type.getAddressField("_next");
49 protectionDomainField = type.getOopField("_protection_domain"); 49 pdCacheField = type.getAddressField("_pd_cache");
50 } 50 }
51 51
52 public ProtectionDomainEntry(Address addr) { 52 public ProtectionDomainEntry(Address addr) {
53 super(addr); 53 super(addr);
54 } 54 }
55 55
56 public ProtectionDomainEntry next() { 56 public ProtectionDomainEntry next() {
57 return (ProtectionDomainEntry) VMObjectFactory.newObject(ProtectionDomainEntry.class, addr); 57 return (ProtectionDomainEntry) VMObjectFactory.newObject(ProtectionDomainEntry.class, nextField.getValue(addr));
58 } 58 }
59 59
60 public Oop protectionDomain() { 60 public Oop protectionDomain() {
61 return VM.getVM().getObjectHeap().newOop(protectionDomainField.getValue(addr)); 61 ProtectionDomainCacheEntry pd_cache = (ProtectionDomainCacheEntry)
62 VMObjectFactory.newObject(ProtectionDomainCacheEntry.class, pdCacheField.getValue(addr));
63 return pd_cache.protectionDomain();
62 } 64 }
63 } 65 }