comparison agent/src/share/classes/sun/jvm/hotspot/ci/ciInstanceKlass.java @ 6972:bd7a7ce2e264

6830717: replay of compilations would help with debugging Summary: When java process crashed in compiler thread, repeat the compilation process will help finding root cause. This is done with using SA dump application class data and replay data from core dump, then use debug version of jvm to recompile the problematic java method. Reviewed-by: kvn, twisti, sspitsyn Contributed-by: yumin.qi@oracle.com
author minqi
date Mon, 12 Nov 2012 14:03:53 -0800
parents da91efe96a93
children
comparison
equal deleted inserted replaced
6965:3be318ecfae5 6972:bd7a7ce2e264
14 * 14 *
15 * You should have received a copy of the GNU General Public License version 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, 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. 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 * 18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * CA 95054 USA or visit www.sun.com if you need additional information or 20 * or visit www.oracle.com if you need additional information or have any
21 * have any questions. 21 * questions.
22 * 22 *
23 */ 23 */
24 24
25 package sun.jvm.hotspot.ci; 25 package sun.jvm.hotspot.ci;
26 26
78 } 78 }
79 79
80 public boolean isInitialized() { 80 public boolean isInitialized() {
81 return initState() == CLASS_STATE_FULLY_INITIALIZED; 81 return initState() == CLASS_STATE_FULLY_INITIALIZED;
82 } 82 }
83
84 public void dumpReplayData(PrintStream out) {
85 InstanceKlass ik = (InstanceKlass)getMetadata();
86 ConstantPool cp = ik.getConstants();
87
88 // Try to record related loaded classes
89 Klass sub = ik.getSubklassKlass();
90 while (sub != null) {
91 if (sub instanceof InstanceKlass) {
92 out.println("instanceKlass " + sub.getName().asString());
93 }
94 sub = sub.getNextSiblingKlass();
95 }
96
97 final int length = (int) cp.getLength();
98 out.print("ciInstanceKlass " + name() + " " + (isLinked() ? 1 : 0) + " " + (isInitialized() ? 1 : 0) + " " + length);
99 for (int index = 1; index < length; index++) {
100 out.print(" " + cp.getTags().at(index));
101 }
102 out.println();
103 if (isInitialized()) {
104 Field[] staticFields = ik.getStaticFields();
105 for (int i = 0; i < staticFields.length; i++) {
106 Field f = staticFields[i];
107 Oop mirror = ik.getJavaMirror();
108 if (f.isFinal() && !f.hasInitialValue()) {
109 out.print("staticfield " + name() + " " +
110 OopUtilities.escapeString(f.getID().getName()) + " " +
111 f.getFieldType().getSignature().asString() + " ");
112 if (f instanceof ByteField) {
113 ByteField bf = (ByteField)f;
114 out.println(bf.getValue(mirror));
115 } else if (f instanceof BooleanField) {
116 BooleanField bf = (BooleanField)f;
117 out.println(bf.getValue(mirror) ? 1 : 0);
118 } else if (f instanceof ShortField) {
119 ShortField bf = (ShortField)f;
120 out.println(bf.getValue(mirror));
121 } else if (f instanceof CharField) {
122 CharField bf = (CharField)f;
123 out.println(bf.getValue(mirror) & 0xffff);
124 } else if (f instanceof IntField) {
125 IntField bf = (IntField)f;
126 out.println(bf.getValue(mirror));
127 } else if (f instanceof LongField) {
128 LongField bf = (LongField)f;
129 out.println(bf.getValue(mirror));
130 } else if (f instanceof FloatField) {
131 FloatField bf = (FloatField)f;
132 out.println(Float.floatToRawIntBits(bf.getValue(mirror)));
133 } else if (f instanceof DoubleField) {
134 DoubleField bf = (DoubleField)f;
135 out.println(Double.doubleToRawLongBits(bf.getValue(mirror)));
136 } else if (f instanceof OopField) {
137 OopField bf = (OopField)f;
138 Oop value = bf.getValue(mirror);
139 if (value == null) {
140 out.println("null");
141 } else if (value.isInstance()) {
142 Instance inst = (Instance)value;
143 if (inst.isA(SystemDictionary.getStringKlass())) {
144 out.println("\"" + OopUtilities.stringOopToEscapedString(inst) + "\"");
145 } else {
146 out.println(inst.getKlass().getName().asString());
147 }
148 } else if (value.isObjArray()) {
149 ObjArray oa = (ObjArray)value;
150 Klass ek = (ObjArrayKlass)oa.getKlass();
151 out.println(oa.getLength() + " " + ek.getName().asString());
152 } else if (value.isTypeArray()) {
153 TypeArray ta = (TypeArray)value;
154 out.println(ta.getLength());
155 } else {
156 out.println(value);
157 }
158 }
159 }
160 }
161 }
162 }
83 } 163 }