Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java @ 18665:96861e3f8cc5
made CFGPrinterObserver reset (upon close) properly
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 11 Dec 2014 22:14:30 +0100 |
parents | 52b4284cb496 |
children |
rev | line source |
---|---|
3939 | 1 /* |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3939
diff
changeset
|
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
3939 | 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 * | |
7440 | 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. | |
3939 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.opto; | |
26 | |
27 import java.util.*; | |
18041
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
28 import java.io.PrintStream; |
3939 | 29 import sun.jvm.hotspot.ci.*; |
30 import sun.jvm.hotspot.debugger.*; | |
31 import sun.jvm.hotspot.runtime.*; | |
32 import sun.jvm.hotspot.oops.*; | |
33 import sun.jvm.hotspot.types.*; | |
34 | |
35 public class Compile 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) throws WrongTypeException { | |
45 Type type = db.lookupType("Compile"); | |
46 rootField = type.getAddressField("_root"); | |
47 uniqueField = new CIntField(type.getCIntegerField("_unique"), 0); | |
48 entryBciField = new CIntField(type.getCIntegerField("_entry_bci"), 0); | |
49 topField = type.getAddressField("_top"); | |
50 cfgField = type.getAddressField("_cfg"); | |
51 regallocField = type.getAddressField("_regalloc"); | |
52 methodField = type.getAddressField("_method"); | |
53 iltField = type.getAddressField("_ilt"); | |
54 } | |
55 | |
56 private static AddressField rootField; | |
57 private static CIntField uniqueField; | |
58 private static CIntField entryBciField; | |
59 private static AddressField topField; | |
60 private static AddressField cfgField; | |
61 private static AddressField regallocField; | |
62 private static AddressField methodField; | |
63 private static AddressField iltField; | |
64 | |
65 public Compile(Address addr) { | |
66 super(addr); | |
67 } | |
68 | |
69 public Node root() { | |
70 return new RootNode(rootField.getValue(this.getAddress())); | |
71 } | |
72 | |
73 public int entryBci() { | |
74 return (int)entryBciField.getValue(getAddress()); | |
75 } | |
76 | |
77 public ciMethod method() { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
3939
diff
changeset
|
78 return (ciMethod) ciObjectFactory.getMetadata(methodField.getValue(getAddress())); |
3939 | 79 } |
80 | |
81 public PhaseCFG cfg() { | |
82 Address a = cfgField.getValue(this.getAddress()); | |
83 if (a != null) { | |
84 return new PhaseCFG(a); | |
85 } | |
86 return null; | |
87 } | |
88 | |
89 public InlineTree ilt() { | |
90 Address a = iltField.getValue(this.getAddress()); | |
91 if (a != null) { | |
92 return new InlineTree(a); | |
93 } | |
94 return null; | |
95 } | |
18041
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
96 |
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
97 public void dumpInlineData(PrintStream out) { |
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
98 InlineTree inlTree = ilt(); |
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
99 if (inlTree != null) { |
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
100 out.print(" inline " + inlTree.count()); |
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
101 inlTree.dumpReplayData(out); |
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
102 } |
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
103 } |
52b4284cb496
Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14909
diff
changeset
|
104 |
3939 | 105 } |