hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java
changeset 13282 9872915dd78d
parent 12728 a8abd64eaa1b
child 13529 dc25e69fd16d
equal deleted inserted replaced
13102:7342fd50f8d7 13282:9872915dd78d
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   781                              buf.endTable();
   781                              buf.endTable();
   782                           }
   782                           }
   783                        });
   783                        });
   784 
   784 
   785          // display exception table for this method
   785          // display exception table for this method
   786          TypeArray exceptionTable = method.getExceptionTable();
   786          boolean hasException = method.hasExceptionTable();
   787          // exception table is 4 tuple array of shorts
   787          if (hasException) {
   788          int numEntries = (int)exceptionTable.getLength() / 4;
   788             ExceptionTableElement[] exceptionTable = method.getExceptionTable();
   789          if (numEntries != 0) {
   789             int numEntries = exceptionTable.length;
   790             buf.h4("Exception Table");
   790             if (numEntries != 0) {
   791             buf.beginTable(1);
   791                buf.h4("Exception Table");
   792             buf.beginTag("tr");
   792                buf.beginTable(1);
   793             buf.headerCell("start bci");
       
   794             buf.headerCell("end bci");
       
   795             buf.headerCell("handler bci");
       
   796             buf.headerCell("catch type");
       
   797             buf.endTag("tr");
       
   798 
       
   799             for (int e = 0; e < numEntries; e += 4) {
       
   800                buf.beginTag("tr");
   793                buf.beginTag("tr");
   801                buf.cell(Integer.toString(exceptionTable.getIntAt(e)));
   794                buf.headerCell("start bci");
   802                buf.cell(Integer.toString(exceptionTable.getIntAt(e + 1)));
   795                buf.headerCell("end bci");
   803                buf.cell(Integer.toString(exceptionTable.getIntAt(e + 2)));
   796                buf.headerCell("handler bci");
   804                short cpIndex = (short) exceptionTable.getIntAt(e + 3);
   797                buf.headerCell("catch type");
   805                ConstantPool.CPSlot obj = cpIndex == 0? null : cpool.getSlotAt(cpIndex);
   798                buf.endTag("tr");
   806                if (obj == null) {
   799 
   807                   buf.cell("Any");
   800                for (int e = 0; e < numEntries; e ++) {
   808                } else if (obj.isMetaData()) {
   801                   buf.beginTag("tr");
   809                  buf.cell(obj.getSymbol().asString().replace('/', '.'));
   802                   buf.cell(Integer.toString(exceptionTable[e].getStartPC()));
   810                } else {
   803                   buf.cell(Integer.toString(exceptionTable[e].getEndPC()));
   811                  buf.cell(genKlassLink((InstanceKlass)obj.getOop()));
   804                   buf.cell(Integer.toString(exceptionTable[e].getHandlerPC()));
       
   805                   short cpIndex = (short) exceptionTable[e].getCatchTypeIndex();
       
   806                   ConstantPool.CPSlot obj = cpIndex == 0? null : cpool.getSlotAt(cpIndex);
       
   807                   if (obj == null) {
       
   808                      buf.cell("Any");
       
   809                   } else if (obj.isMetaData()) {
       
   810                      buf.cell(obj.getSymbol().asString().replace('/', '.'));
       
   811                   } else {
       
   812                      buf.cell(genKlassLink((InstanceKlass)obj.getOop()));
       
   813                   }
       
   814                   buf.endTag("tr");
   812                }
   815                }
   813                buf.endTag("tr");
   816 
       
   817                buf.endTable();
   814             }
   818             }
   815 
       
   816             buf.endTable();
       
   817          }
   819          }
   818 
   820 
   819          // display constant pool hyperlink
   821          // display constant pool hyperlink
   820          buf.h3("Constant Pool");
   822          buf.h3("Constant Pool");
   821          buf.append(genConstantPoolLink(cpool));
   823          buf.append(genConstantPoolLink(cpool));