Mercurial > hg > graal-compiler
annotate agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java @ 7440:79f492f184d0
8004982: JDK8 source with GPL header errors
Reviewed-by: ohair
author | katleman |
---|---|
date | Thu, 20 Dec 2012 16:24:51 -0800 |
parents | c18cbe5936b8 |
children |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
196
diff
changeset
|
2 * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
196
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
196
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
196
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.memory; | |
26 | |
27 import java.io.*; | |
28 import java.util.*; | |
29 | |
30 import sun.jvm.hotspot.debugger.*; | |
31 import sun.jvm.hotspot.runtime.*; | |
32 import sun.jvm.hotspot.types.*; | |
33 | |
34 /** DefNewGeneration is a young generation containing eden, from- and | |
35 to-space. */ | |
36 | |
37 public class DefNewGeneration extends Generation { | |
38 protected static AddressField edenSpaceField; | |
39 protected static AddressField fromSpaceField; | |
40 protected static AddressField toSpaceField; | |
41 | |
42 static { | |
43 VM.registerVMInitializedObserver(new Observer() { | |
44 public void update(Observable o, Object data) { | |
45 initialize(VM.getVM().getTypeDataBase()); | |
46 } | |
47 }); | |
48 } | |
49 | |
50 private static synchronized void initialize(TypeDataBase db) { | |
51 Type type = db.lookupType("DefNewGeneration"); | |
52 | |
53 edenSpaceField = type.getAddressField("_eden_space"); | |
54 fromSpaceField = type.getAddressField("_from_space"); | |
55 toSpaceField = type.getAddressField("_to_space"); | |
56 } | |
57 | |
58 public DefNewGeneration(Address addr) { | |
59 super(addr); | |
60 } | |
61 | |
62 public Generation.Name kind() { | |
63 return Generation.Name.DEF_NEW; | |
64 } | |
65 | |
66 // Accessing spaces | |
67 public EdenSpace eden() { | |
68 return (EdenSpace) VMObjectFactory.newObject(EdenSpace.class, edenSpaceField.getValue(addr)); | |
69 } | |
70 | |
71 public ContiguousSpace from() { | |
72 return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, fromSpaceField.getValue(addr)); | |
73 } | |
74 | |
75 public ContiguousSpace to() { | |
76 return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, toSpaceField.getValue(addr)); | |
77 } | |
78 | |
79 public long capacity() { return eden().capacity() + from().capacity(); /* to() is only used during scavenge */ } | |
80 public long used() { return eden().used() + from().used(); /* to() is only used during scavenge */ } | |
81 public long free() { return eden().free() + from().free(); /* to() is only used during scavenge */ } | |
82 public long contiguousAvailable() { return eden().free(); } | |
83 | |
84 public String name() { | |
85 return "default new generation"; | |
86 } | |
87 | |
88 public void spaceIterate(SpaceClosure blk, boolean usedOnly) { | |
89 blk.doSpace(eden()); | |
90 blk.doSpace(from()); | |
91 if (!usedOnly) { | |
92 blk.doSpace(to()); | |
93 } | |
94 } | |
95 | |
96 public void printOn(PrintStream tty) { | |
97 tty.print(" eden"); | |
98 eden().printOn(tty); | |
152
c70a245cad3a
6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
0
diff
changeset
|
99 tty.print("\n from"); |
0 | 100 from().printOn(tty); |
152
c70a245cad3a
6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents:
0
diff
changeset
|
101 tty.print("\n to "); |
0 | 102 to().printOn(tty); |
103 } | |
104 } |