Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/memory/SharedHeap.java @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | c18cbe5936b8 |
children |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2002, 2012, 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. |
31 import sun.jvm.hotspot.gc_interface.*; | 31 import sun.jvm.hotspot.gc_interface.*; |
32 import sun.jvm.hotspot.runtime.*; | 32 import sun.jvm.hotspot.runtime.*; |
33 import sun.jvm.hotspot.types.*; | 33 import sun.jvm.hotspot.types.*; |
34 | 34 |
35 public abstract class SharedHeap extends CollectedHeap { | 35 public abstract class SharedHeap extends CollectedHeap { |
36 private static AddressField permGenField; | |
37 private static VirtualConstructor ctor; | 36 private static VirtualConstructor ctor; |
38 | 37 |
39 static { | 38 static { |
40 VM.registerVMInitializedObserver(new Observer() { | 39 VM.registerVMInitializedObserver(new Observer() { |
41 public void update(Observable o, Object data) { | 40 public void update(Observable o, Object data) { |
44 }); | 43 }); |
45 } | 44 } |
46 | 45 |
47 private static synchronized void initialize(TypeDataBase db) { | 46 private static synchronized void initialize(TypeDataBase db) { |
48 Type type = db.lookupType("SharedHeap"); | 47 Type type = db.lookupType("SharedHeap"); |
49 permGenField = type.getAddressField("_perm_gen"); | |
50 ctor = new VirtualConstructor(db); | 48 ctor = new VirtualConstructor(db); |
51 ctor.addMapping("CompactingPermGen", CompactingPermGen.class); | |
52 ctor.addMapping("CMSPermGen", CMSPermGen.class); | |
53 | |
54 } | 49 } |
55 | 50 |
56 public SharedHeap(Address addr) { | 51 public SharedHeap(Address addr) { |
57 super(addr); | 52 super(addr); |
58 } | 53 } |
59 | 54 |
60 /** These functions return the "permanent" generation, in which | |
61 reflective objects are allocated and stored. Two versions, the | |
62 second of which returns the view of the perm gen as a | |
63 generation. (FIXME: this distinction is strange and seems | |
64 unnecessary, and should be cleaned up.) */ | |
65 public PermGen perm() { | |
66 return (PermGen) ctor.instantiateWrapperFor(permGenField.getValue(addr)); | |
67 } | |
68 | |
69 public CollectedHeapName kind() { | 55 public CollectedHeapName kind() { |
70 return CollectedHeapName.SHARED_HEAP; | 56 return CollectedHeapName.SHARED_HEAP; |
71 } | 57 } |
72 | |
73 public Generation permGen() { | |
74 return perm().asGen(); | |
75 } | 58 } |
76 } |