hotspot/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java

Print this page
rev 611 : Merge
   1 /*
   2  * Copyright 2002-2006 Sun Microsystems, Inc.  All Rights Reserved.
   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  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *  


1060                   int contentReg = vmContentReg.getValue();
1061                   tmpBuf.append(VMRegImpl.getRegisterName(vmContentReg.getValue()));
1062                }
1063                tmpBuf.append(spaces);
1064             }
1065             tmpBuf.endTag("td");
1066             tmpBuf.endTag("tr");
1067             return found ? tmpBuf : new Formatter(genHTML);
1068          }
1069       }
1070 
1071       buf.beginTable(0);
1072 
1073       OopMapValueIterator omvIterator = new OopMapValueIterator();
1074       OopMapStream oms = new OopMapStream(map, OopMapValue.OopTypes.OOP_VALUE);
1075       buf.append(omvIterator.iterate(oms, "Oop:", false));
1076 
1077       oms = new OopMapStream(map, OopMapValue.OopTypes.VALUE_VALUE);
1078       buf.append(omvIterator.iterate(oms, "Value:", false));
1079 
1080       oms = new OopMapStream(map, OopMapValue.OopTypes.DEAD_VALUE);
1081       buf.append(omvIterator.iterate(oms, "Dead:", false));
1082 
1083       oms = new OopMapStream(map, OopMapValue.OopTypes.CALLEE_SAVED_VALUE);
1084       buf.append(omvIterator.iterate(oms, "Callee saved:",  true));
1085     
1086       oms = new OopMapStream(map, OopMapValue.OopTypes.DERIVED_OOP_VALUE);
1087       buf.append(omvIterator.iterate(oms, "Derived oop:", true));
1088 
1089       buf.endTag("table");
1090       return buf.toString();
1091    }
1092 
1093 
1094    protected String genOopMapInfo(NMethod nmethod, PCDesc pcDesc) {
1095       OopMapSet mapSet = nmethod.getOopMaps();
1096       int pcOffset = pcDesc.getPCOffset();
1097       OopMap map = mapSet.findMapAtOffset(pcOffset, VM.getVM().isDebugging());
1098       if (map == null) {
1099          throw new IllegalArgumentException("no oopmap at safepoint!");
1100       }
1101 


1118          buf.append("illegal");
1119       } else {
1120          Location.Where  w  = loc.getWhere();
1121          Location.Type type = loc.getType();
1122 
1123          if (w == Location.Where.ON_STACK) {
1124             buf.append("stack[" + loc.getStackOffset() + "]");
1125          } else if (w == Location.Where.IN_REGISTER) {
1126             boolean isFloat = (type == Location.Type.FLOAT_IN_DBL ||
1127                                type == Location.Type.DBL);
1128             int regNum = loc.getRegisterNumber();
1129             VMReg vmReg = new VMReg(regNum);
1130             buf.append(VMRegImpl.getRegisterName(vmReg.getValue()));
1131          }
1132 
1133          buf.append(", ");
1134          if (type == Location.Type.NORMAL) {
1135             buf.append("normal");
1136          } else if (type == Location.Type.OOP) {
1137             buf.append("oop");


1138          } else if (type == Location.Type.INT_IN_LONG) {
1139             buf.append("int");
1140          } else if (type == Location.Type.LNG) {
1141             buf.append("long");
1142          } else if (type == Location.Type.FLOAT_IN_DBL) {
1143             buf.append("float");
1144          } else if (type == Location.Type.DBL) {
1145             buf.append("double");
1146          } else if (type == Location.Type.ADDR) {
1147             buf.append("address");
1148          } else if (type == Location.Type.INVALID) {
1149             buf.append("invalid");
1150          }
1151       }
1152       return buf.toString();
1153    }
1154 
1155    private String scopeValueAsString(ScopeValue sv) {
1156       Formatter buf = new Formatter(genHTML);
1157       if (sv.isConstantInt()) {


   1 /*
   2  * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
   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  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *  


1060                   int contentReg = vmContentReg.getValue();
1061                   tmpBuf.append(VMRegImpl.getRegisterName(vmContentReg.getValue()));
1062                }
1063                tmpBuf.append(spaces);
1064             }
1065             tmpBuf.endTag("td");
1066             tmpBuf.endTag("tr");
1067             return found ? tmpBuf : new Formatter(genHTML);
1068          }
1069       }
1070 
1071       buf.beginTable(0);
1072 
1073       OopMapValueIterator omvIterator = new OopMapValueIterator();
1074       OopMapStream oms = new OopMapStream(map, OopMapValue.OopTypes.OOP_VALUE);
1075       buf.append(omvIterator.iterate(oms, "Oop:", false));
1076 
1077       oms = new OopMapStream(map, OopMapValue.OopTypes.VALUE_VALUE);
1078       buf.append(omvIterator.iterate(oms, "Value:", false));
1079 
1080       oms = new OopMapStream(map, OopMapValue.OopTypes.NARROWOOP_VALUE);
1081       buf.append(omvIterator.iterate(oms, "Oop:", false));
1082 
1083       oms = new OopMapStream(map, OopMapValue.OopTypes.CALLEE_SAVED_VALUE);
1084       buf.append(omvIterator.iterate(oms, "Callee saved:",  true));
1085     
1086       oms = new OopMapStream(map, OopMapValue.OopTypes.DERIVED_OOP_VALUE);
1087       buf.append(omvIterator.iterate(oms, "Derived oop:", true));
1088 
1089       buf.endTag("table");
1090       return buf.toString();
1091    }
1092 
1093 
1094    protected String genOopMapInfo(NMethod nmethod, PCDesc pcDesc) {
1095       OopMapSet mapSet = nmethod.getOopMaps();
1096       int pcOffset = pcDesc.getPCOffset();
1097       OopMap map = mapSet.findMapAtOffset(pcOffset, VM.getVM().isDebugging());
1098       if (map == null) {
1099          throw new IllegalArgumentException("no oopmap at safepoint!");
1100       }
1101 


1118          buf.append("illegal");
1119       } else {
1120          Location.Where  w  = loc.getWhere();
1121          Location.Type type = loc.getType();
1122 
1123          if (w == Location.Where.ON_STACK) {
1124             buf.append("stack[" + loc.getStackOffset() + "]");
1125          } else if (w == Location.Where.IN_REGISTER) {
1126             boolean isFloat = (type == Location.Type.FLOAT_IN_DBL ||
1127                                type == Location.Type.DBL);
1128             int regNum = loc.getRegisterNumber();
1129             VMReg vmReg = new VMReg(regNum);
1130             buf.append(VMRegImpl.getRegisterName(vmReg.getValue()));
1131          }
1132 
1133          buf.append(", ");
1134          if (type == Location.Type.NORMAL) {
1135             buf.append("normal");
1136          } else if (type == Location.Type.OOP) {
1137             buf.append("oop");
1138          } else if (type == Location.Type.NARROWOOP) {
1139             buf.append("narrowoop");
1140          } else if (type == Location.Type.INT_IN_LONG) {
1141             buf.append("int");
1142          } else if (type == Location.Type.LNG) {
1143             buf.append("long");
1144          } else if (type == Location.Type.FLOAT_IN_DBL) {
1145             buf.append("float");
1146          } else if (type == Location.Type.DBL) {
1147             buf.append("double");
1148          } else if (type == Location.Type.ADDR) {
1149             buf.append("address");
1150          } else if (type == Location.Type.INVALID) {
1151             buf.append("invalid");
1152          }
1153       }
1154       return buf.toString();
1155    }
1156 
1157    private String scopeValueAsString(ScopeValue sv) {
1158       Formatter buf = new Formatter(genHTML);
1159       if (sv.isConstantInt()) {