src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java
author pliden
Fri, 14 Sep 2018 14:44:11 +0200
changeset 51741 ed9b1200dd81
parent 50929 ef57cfcd22ff
child 54955 46409371a691
permissions -rw-r--r--
8209163: SA: Show Object Histogram asserts with ZGC Reviewed-by: ysuenaga, jcbeyler
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
48787
7638bf98a312 8194312: Support parallel and concurrent JNI global handle processing
kbarrett
parents: 47216
diff changeset
     2
 * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
package sun.jvm.hotspot.utilities;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
import java.io.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
import sun.jvm.hotspot.debugger.*;
48787
7638bf98a312 8194312: Support parallel and concurrent JNI global handle processing
kbarrett
parents: 47216
diff changeset
    29
import sun.jvm.hotspot.gc.shared.OopStorage;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
import sun.jvm.hotspot.memory.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
import sun.jvm.hotspot.oops.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
import sun.jvm.hotspot.runtime.*;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
/**
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
 * This is abstract base class for heap graph writers. This class does
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
 * not assume any file format for the heap graph. It hides heap
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
 * iteration, object (fields) iteration mechanism from derived
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
 * classes. This class does not even accept OutputStream etc. so that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
 * derived class can construct specific writer/filter from input
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
 * stream.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
public abstract class AbstractHeapGraphWriter implements HeapGraphWriter {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    // the function iterates heap and calls Oop type specific writers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
    protected void write() throws IOException {
50929
ef57cfcd22ff 8205534: Remove SymbolTable dependency from serviceability agent
coleenp
parents: 48787
diff changeset
    46
        javaLangClass = "java/lang/Class";
ef57cfcd22ff 8205534: Remove SymbolTable dependency from serviceability agent
coleenp
parents: 48787
diff changeset
    47
        javaLangString = "java/lang/String";
ef57cfcd22ff 8205534: Remove SymbolTable dependency from serviceability agent
coleenp
parents: 48787
diff changeset
    48
        javaLangThread = "java/lang/Thread";
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
        ObjectHeap heap = VM.getVM().getObjectHeap();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
            heap.iterate(new DefaultHeapVisitor() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
                    public void prologue(long usedSize) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
                        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
                            writeHeapHeader();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
                        } catch (IOException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
                            throw new RuntimeException(exp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
                    public boolean doObj(Oop oop) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
                        try {
20388
2cf7b26682dc 6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents: 13728
diff changeset
    62
                            writeHeapRecordPrologue();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
                            if (oop instanceof TypeArray) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
                                writePrimitiveArray((TypeArray)oop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
                            } else if (oop instanceof ObjArray) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
                                Klass klass = oop.getKlass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
                                ObjArrayKlass oak = (ObjArrayKlass) klass;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
                                Klass bottomType = oak.getBottomKlass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
                                if (bottomType instanceof InstanceKlass ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
                                    bottomType instanceof TypeArrayKlass) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
                                    writeObjectArray((ObjArray)oop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
                                } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
                                    writeInternalObject(oop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
                                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
                            } else if (oop instanceof Instance) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
                                Instance instance = (Instance) oop;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
                                Klass klass = instance.getKlass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
                                Symbol name = klass.getName();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
                                if (name.equals(javaLangString)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
                                    writeString(instance);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
                                } else if (name.equals(javaLangClass)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
                                    writeClass(instance);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
                                } else if (name.equals(javaLangThread)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
                                    writeThread(instance);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
                                } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
                                    klass = klass.getSuper();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
                                    while (klass != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
                                        name = klass.getName();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
                                        if (name.equals(javaLangThread)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
                                            writeThread(instance);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
                                            return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
                                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
                                        klass = klass.getSuper();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
                                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
                                    writeInstance(instance);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
                                }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
                            } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
                                // not-a-Java-visible oop
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
                                writeInternalObject(oop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
                            }
20388
2cf7b26682dc 6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents: 13728
diff changeset
   101
                            writeHeapRecordEpilogue();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
                        } catch (IOException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
                            throw new RuntimeException(exp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
                        return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
                    public void epilogue() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
                        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
                            writeHeapFooter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
                        } catch (IOException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
                            throw new RuntimeException(exp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
                });
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
43671
a152f2d3320e 8171084: heapdump/JMapHeapCore fails with java.lang.RuntimeException: Heap segment size overflow
jgeorge
parents: 35217
diff changeset
   117
                writeHeapRecordPrologue();
a152f2d3320e 8171084: heapdump/JMapHeapCore fails with java.lang.RuntimeException: Heap segment size overflow
jgeorge
parents: 35217
diff changeset
   118
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
                // write JavaThreads
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
                writeJavaThreads();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
                // write JNI global handles
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
                writeGlobalJNIHandles();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
        } catch (RuntimeException re) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
            handleRuntimeException(re);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    protected void writeJavaThreads() throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
        Threads threads = VM.getVM().getThreads();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
        JavaThread jt = threads.first();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
        int index = 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
        while (jt != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
            if (jt.getThreadObj() != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
                // Note that the thread serial number range is 1-to-N
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
                writeJavaThread(jt, index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
                index++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
            jt = jt.next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
    protected void writeJavaThread(JavaThread jt, int index)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
                            throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
    protected void writeGlobalJNIHandles() throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
        JNIHandles handles = VM.getVM().getJNIHandles();
48787
7638bf98a312 8194312: Support parallel and concurrent JNI global handle processing
kbarrett
parents: 47216
diff changeset
   150
        OopStorage blk = handles.globalHandles();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
        if (blk != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
            try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
                blk.oopsDo(new AddressVisitor() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
                          public void visitAddress(Address handleAddr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
                              try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
                                  if (handleAddr != null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
                                      writeGlobalJNIHandle(handleAddr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
                                  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
                              } catch (IOException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
                                  throw new RuntimeException(exp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
                              }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
                          }
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   163
                              public void visitCompOopAddress(Address handleAddr) {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   164
                             throw new RuntimeException("Should not reach here. JNIHandles are not compressed");
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   165
                          }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
                       });
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
            } catch (RuntimeException re) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
                handleRuntimeException(re);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
            }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
    protected void writeGlobalJNIHandle(Address handleAddr) throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
    protected void writeHeapHeader() throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
    // write non-Java-visible (hotspot internal) object
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
    protected void writeInternalObject(Oop oop) throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    // write Java primitive array
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
    protected void writePrimitiveArray(TypeArray array) throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
        writeObject(array);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
    // write Java object array
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
    protected void writeObjectArray(ObjArray array) throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
        writeObject(array);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
    protected void writeInstance(Instance instance) throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
        writeObject(instance);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    protected void writeString(Instance instance) throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
        writeInstance(instance);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    protected void writeClass(Instance instance) throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
        writeInstance(instance);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
    protected void writeThread(Instance instance) throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
        writeInstance(instance);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
    protected void writeObject(Oop oop) throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
        writeObjectHeader(oop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
        writeObjectFields(oop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
        writeObjectFooter(oop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
    protected void writeObjectHeader(Oop oop) throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
    // write instance fields of given object
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
    protected void writeObjectFields(final Oop oop) throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
            oop.iterate(new DefaultOopVisitor() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
                    public void doOop(OopField field, boolean isVMField) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
                        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
                                writeReferenceField(oop, field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
                        } catch (IOException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
                            throw new RuntimeException(exp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
                    public void doByte(ByteField field, boolean isVMField) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
                        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
                            writeByteField(oop, field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
                        } catch (IOException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
                            throw new RuntimeException(exp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
                    public void doChar(CharField field, boolean isVMField) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
                        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
                            writeCharField(oop, field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
                        } catch (IOException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
                            throw new RuntimeException(exp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
                    public void doBoolean(BooleanField field, boolean vField) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
                        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
                            writeBooleanField(oop, field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
                        } catch (IOException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
                            throw new RuntimeException(exp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
                    public void doShort(ShortField field, boolean isVMField) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
                        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
                            writeShortField(oop, field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
                        } catch (IOException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
                            throw new RuntimeException(exp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
                    public void doInt(IntField field, boolean isVMField) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
                        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
                            writeIntField(oop, field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
                        } catch (IOException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
                            throw new RuntimeException(exp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
                    public void doLong(LongField field, boolean isVMField) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
                        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
                            writeLongField(oop, field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
                        } catch (IOException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
                            throw new RuntimeException(exp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
                    public void doFloat(FloatField field, boolean isVMField) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
                        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
                            writeFloatField(oop, field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
                        } catch (IOException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
                            throw new RuntimeException(exp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
                    public void doDouble(DoubleField field, boolean vField) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
                        try {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
                            writeDoubleField(oop, field);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
                        } catch (IOException exp) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
                            throw new RuntimeException(exp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
                        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
                    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
                }, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
        } catch (RuntimeException re) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
            handleRuntimeException(re);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   299
    // write instance fields of given object
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   300
    protected void writeObjectFields(final InstanceKlass oop) throws IOException {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   301
        try {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   302
            oop.iterateStaticFields(new DefaultOopVisitor() {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   303
                    public void doOop(OopField field, boolean isVMField) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   304
                        try {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   305
                            writeReferenceField(null, field);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   306
                        } catch (IOException exp) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   307
                            throw new RuntimeException(exp);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   308
                        }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   311
                    public void doByte(ByteField field, boolean isVMField) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   312
                        try {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   313
                            writeByteField(null, field);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   314
                        } catch (IOException exp) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   315
                            throw new RuntimeException(exp);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   316
                        }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   317
                    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   318
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   319
                    public void doChar(CharField field, boolean isVMField) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   320
                        try {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   321
                            writeCharField(null, field);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   322
                        } catch (IOException exp) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   323
                            throw new RuntimeException(exp);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   324
                        }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   325
                    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   326
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   327
                    public void doBoolean(BooleanField field, boolean vField) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   328
                        try {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   329
                            writeBooleanField(null, field);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   330
                        } catch (IOException exp) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   331
                            throw new RuntimeException(exp);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   332
                        }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   333
                    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   334
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   335
                    public void doShort(ShortField field, boolean isVMField) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   336
                        try {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   337
                            writeShortField(null, field);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   338
                        } catch (IOException exp) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   339
                            throw new RuntimeException(exp);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   340
                        }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   341
                    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   342
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   343
                    public void doInt(IntField field, boolean isVMField) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   344
                        try {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   345
                            writeIntField(null, field);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   346
                        } catch (IOException exp) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   347
                            throw new RuntimeException(exp);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   348
                        }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   349
                    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   350
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   351
                    public void doLong(LongField field, boolean isVMField) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   352
                        try {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   353
                            writeLongField(null, field);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   354
                        } catch (IOException exp) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   355
                            throw new RuntimeException(exp);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   356
                        }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   357
                    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   358
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   359
                    public void doFloat(FloatField field, boolean isVMField) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   360
                        try {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   361
                            writeFloatField(null, field);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   362
                        } catch (IOException exp) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   363
                            throw new RuntimeException(exp);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   364
                        }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   365
                    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   366
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   367
                    public void doDouble(DoubleField field, boolean vField) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   368
                        try {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   369
                            writeDoubleField(null, field);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   370
                        } catch (IOException exp) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   371
                            throw new RuntimeException(exp);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   372
                        }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   373
                    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   374
                });
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   375
        } catch (RuntimeException re) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   376
            handleRuntimeException(re);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   377
        }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   378
    }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   379
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 5547
diff changeset
   380
    // object field writers
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
    protected void writeReferenceField(Oop oop, OopField field)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
        throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
    protected void writeByteField(Oop oop, ByteField field)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
        throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
    protected void writeCharField(Oop oop, CharField field)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
        throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
    protected void writeBooleanField(Oop oop, BooleanField field)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
        throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
    protected void writeShortField(Oop oop, ShortField field)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
        throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
    protected void writeIntField(Oop oop, IntField field)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
        throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
    protected void writeLongField(Oop oop, LongField field)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
        throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
    protected void writeFloatField(Oop oop, FloatField field)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
        throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
    protected void writeDoubleField(Oop oop, DoubleField field)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
        throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
    protected void writeObjectFooter(Oop oop) throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
    protected void writeHeapFooter() throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
20388
2cf7b26682dc 6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents: 13728
diff changeset
   423
    protected void writeHeapRecordPrologue() throws IOException {
2cf7b26682dc 6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents: 13728
diff changeset
   424
    }
2cf7b26682dc 6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents: 13728
diff changeset
   425
2cf7b26682dc 6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents: 13728
diff changeset
   426
    protected void writeHeapRecordEpilogue() throws IOException {
2cf7b26682dc 6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents: 13728
diff changeset
   427
    }
2cf7b26682dc 6313383: SA: Update jmap to support HPROF binary format "JAVA PROFILE 1.0.2"
sla
parents: 13728
diff changeset
   428
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
    // HeapVisitor, OopVisitor methods can't throw any non-runtime
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
    // exception. But, derived class write methods (which are called
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
    // from visitor callbacks) may throw IOException. Hence, we throw
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
    // RuntimeException with origianal IOException as cause from the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
    // visitor methods. This method gets back the original IOException
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
    // (if any) and re-throws the same.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
    protected void handleRuntimeException(RuntimeException re)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
        throws IOException {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
        Throwable cause = re.getCause();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
        if (cause != null && cause instanceof IOException) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
            throw (IOException) cause;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
            // some other RuntimeException, just re-throw
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
            throw re;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
    // whether a given oop is Java visible or hotspot internal?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
    protected boolean isJavaVisible(Oop oop) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
        if (oop instanceof Instance || oop instanceof TypeArray) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
            return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
        } else if (oop instanceof ObjArray) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
            ObjArrayKlass oak = (ObjArrayKlass) oop.getKlass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
            Klass bottomKlass = oak.getBottomKlass();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
            return bottomKlass instanceof InstanceKlass ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
                   bottomKlass instanceof TypeArrayKlass;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
            return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
50929
ef57cfcd22ff 8205534: Remove SymbolTable dependency from serviceability agent
coleenp
parents: 48787
diff changeset
   460
    protected String javaLangClass;
ef57cfcd22ff 8205534: Remove SymbolTable dependency from serviceability agent
coleenp
parents: 48787
diff changeset
   461
    protected String javaLangString;
ef57cfcd22ff 8205534: Remove SymbolTable dependency from serviceability agent
coleenp
parents: 48787
diff changeset
   462
    protected String javaLangThread;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
}