Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/gc_implementation/shared/ImmutableSpace.java @ 6842:b9a9ed0f8eeb
7197424: update copyright year to match last edit in jdk8 hotspot repository
Summary: Update copyright year to 2012 for relevant files
Reviewed-by: dholmes, coleenp
author | mikael |
---|---|
date | Tue, 09 Oct 2012 10:09:34 -0700 |
parents | c18cbe5936b8 |
children |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2003, 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:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
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:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.gc_implementation.shared; | |
26 | |
27 import java.io.*; | |
28 import java.util.*; | |
29 | |
30 import sun.jvm.hotspot.debugger.*; | |
31 import sun.jvm.hotspot.memory.*; | |
32 import sun.jvm.hotspot.runtime.*; | |
33 import sun.jvm.hotspot.types.*; | |
34 | |
35 public abstract class ImmutableSpace extends VMObject { | |
36 static { | |
37 VM.registerVMInitializedObserver(new Observer() { | |
38 public void update(Observable o, Object data) { | |
39 initialize(VM.getVM().getTypeDataBase()); | |
40 } | |
41 }); | |
42 } | |
43 | |
44 private static synchronized void initialize(TypeDataBase db) { | |
45 Type type = db.lookupType("ImmutableSpace"); | |
46 bottomField = type.getAddressField("_bottom"); | |
47 endField = type.getAddressField("_end"); | |
48 } | |
49 | |
50 public ImmutableSpace(Address addr) { | |
51 super(addr); | |
52 } | |
53 | |
54 // Fields | |
55 private static AddressField bottomField; | |
56 private static AddressField endField; | |
57 | |
58 // Accessors | |
59 public Address bottom() { return bottomField.getValue(addr); } | |
60 public Address end() { return endField.getValue(addr); } | |
61 | |
62 /** Returns a subregion of the space containing all the objects in | |
63 the space. */ | |
64 public MemRegion usedRegion() { | |
65 return new MemRegion(bottom(), end()); | |
66 } | |
67 | |
68 /** Support for iteration over heap -- not sure how this will | |
69 interact with GC in reflective system, but necessary for the | |
70 debugging mechanism */ | |
71 public OopHandle bottomAsOopHandle() { | |
72 return bottomField.getOopHandle(addr); | |
73 } | |
74 | |
75 /** returns all MemRegions where live objects are */ | |
76 public abstract List/*<MemRegion>*/ getLiveRegions(); | |
77 | |
78 /** Returned value is in bytes */ | |
79 public long capacity() { return end().minus(bottom()); } | |
80 | |
81 public abstract long used(); | |
82 | |
83 /** Testers */ | |
84 public boolean contains(Address p) { | |
85 return (bottom().lessThanOrEqual(p) && end().greaterThan(p)); | |
86 } | |
87 | |
88 public void print() { printOn(System.out); } | |
89 public abstract void printOn(PrintStream tty); | |
90 } |