6945219: minor SA fixes

Tue, 20 Apr 2010 13:26:33 -0700

author
never
date
Tue, 20 Apr 2010 13:26:33 -0700
changeset 1820
bc32f286fae0
parent 1819
c544d979f886
child 1821
ba07d5be2d51
child 1831
d7f654633cfe

6945219: minor SA fixes
Reviewed-by: twisti

agent/src/os/linux/ps_core.c file | annotate | diff | comparison | revisions
agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java file | annotate | diff | comparison | revisions
agent/src/share/classes/sun/jvm/hotspot/HSDB.java file | annotate | diff | comparison | revisions
agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpot.java file | annotate | diff | comparison | revisions
agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeDisassembler.java file | annotate | diff | comparison | revisions
agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java file | annotate | diff | comparison | revisions
agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java file | annotate | diff | comparison | revisions
agent/src/share/classes/sun/jvm/hotspot/runtime/SignatureIterator.java file | annotate | diff | comparison | revisions
agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java file | annotate | diff | comparison | revisions
agent/src/share/classes/sun/jvm/hotspot/ui/FrameWrapper.java file | annotate | diff | comparison | revisions
agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java file | annotate | diff | comparison | revisions
agent/src/share/classes/sun/jvm/hotspot/utilities/Assert.java file | annotate | diff | comparison | revisions
     1.1 --- a/agent/src/os/linux/ps_core.c	Mon Apr 19 02:13:06 2010 -0700
     1.2 +++ b/agent/src/os/linux/ps_core.c	Tue Apr 20 13:26:33 2010 -0700
     1.3 @@ -884,9 +884,12 @@
     1.4        }
     1.5  
     1.6        // read name of the shared object
     1.7 -      if (read_string(ph, (uintptr_t) lib_name_addr, lib_name, sizeof(lib_name)) != true) {
     1.8 +      lib_name[0] = '\0';
     1.9 +      if (lib_name_addr != 0 &&
    1.10 +          read_string(ph, (uintptr_t) lib_name_addr, lib_name, sizeof(lib_name)) != true) {
    1.11           print_debug("can't read shared object name\n");
    1.12 -         return false;
    1.13 +         // don't let failure to read the name stop opening the file.  If something is really wrong
    1.14 +         // it will fail later.
    1.15        }
    1.16  
    1.17        if (lib_name[0] != '\0') {
     2.1 --- a/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java	Mon Apr 19 02:13:06 2010 -0700
     2.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java	Tue Apr 20 13:26:33 2010 -0700
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright 2005-2008 Sun Microsystems, Inc.  All Rights Reserved.
     2.6 + * Copyright 2005-2010 Sun Microsystems, Inc.  All Rights Reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -494,6 +494,68 @@
    2.11                  }
    2.12              }
    2.13          },
    2.14 +        new Command("revptrs", "revptrs address", false) {
    2.15 +            public void doit(Tokens t) {
    2.16 +                int tokens = t.countTokens();
    2.17 +                if (tokens != 1 && (tokens != 2 || !t.nextToken().equals("-c"))) {
    2.18 +                    usage();
    2.19 +                    return;
    2.20 +                }
    2.21 +                boolean chase = tokens == 2;
    2.22 +                ReversePtrs revptrs = VM.getVM().getRevPtrs();
    2.23 +                if (revptrs == null) {
    2.24 +                    out.println("Computing reverse pointers...");
    2.25 +                    ReversePtrsAnalysis analysis = new ReversePtrsAnalysis();
    2.26 +                    final boolean[] complete = new boolean[1];
    2.27 +                    HeapProgressThunk thunk = new HeapProgressThunk() {
    2.28 +                            public void heapIterationFractionUpdate(double d) {}
    2.29 +                            public synchronized void heapIterationComplete() {
    2.30 +                                complete[0] = true;
    2.31 +                                notify();
    2.32 +                            }
    2.33 +                        };
    2.34 +                    analysis.setHeapProgressThunk(thunk);
    2.35 +                    analysis.run();
    2.36 +                    while (!complete[0]) {
    2.37 +                        synchronized (thunk) {
    2.38 +                            try {
    2.39 +                                thunk.wait();
    2.40 +                            } catch (Exception e) {
    2.41 +                            }
    2.42 +                        }
    2.43 +                    }
    2.44 +                    revptrs = VM.getVM().getRevPtrs();
    2.45 +                    out.println("Done.");
    2.46 +                }
    2.47 +                Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
    2.48 +                if (VM.getVM().getUniverse().heap().isInReserved(a)) {
    2.49 +                    OopHandle handle = a.addOffsetToAsOopHandle(0);
    2.50 +                    Oop oop = VM.getVM().getObjectHeap().newOop(handle);
    2.51 +                    ArrayList ptrs = revptrs.get(oop);
    2.52 +                    if (ptrs == null) {
    2.53 +                        out.println("no live references to " + a);
    2.54 +                    } else {
    2.55 +                        if (chase) {
    2.56 +                            while (ptrs.size() == 1) {
    2.57 +                                LivenessPathElement e = (LivenessPathElement)ptrs.get(0);
    2.58 +                                ByteArrayOutputStream bos = new ByteArrayOutputStream();
    2.59 +                                Oop.printOopValueOn(e.getObj(), new PrintStream(bos));
    2.60 +                                out.println(bos.toString());
    2.61 +                                ptrs = revptrs.get(e.getObj());
    2.62 +                            }
    2.63 +                        } else {
    2.64 +                            for (int i = 0; i < ptrs.size(); i++) {
    2.65 +                                LivenessPathElement e = (LivenessPathElement)ptrs.get(i);
    2.66 +                                ByteArrayOutputStream bos = new ByteArrayOutputStream();
    2.67 +                                Oop.printOopValueOn(e.getObj(), new PrintStream(bos));
    2.68 +                                out.println(bos.toString());
    2.69 +                                oop = e.getObj();
    2.70 +                            }
    2.71 +                        }
    2.72 +                    }
    2.73 +                }
    2.74 +            }
    2.75 +        },
    2.76          new Command("inspect", "inspect expression", false) {
    2.77              public void doit(Tokens t) {
    2.78                  if (t.countTokens() != 1) {
    2.79 @@ -816,8 +878,24 @@
    2.80                      dumpType(type);
    2.81                  } else {
    2.82                      Iterator i = agent.getTypeDataBase().getTypes();
    2.83 +                    // Make sure the types are emitted in an order than can be read back in
    2.84 +                    HashSet emitted = new HashSet();
    2.85 +                    Stack pending = new Stack();
    2.86                      while (i.hasNext()) {
    2.87 -                        dumpType((Type)i.next());
    2.88 +                        Type n = (Type)i.next();
    2.89 +                        if (emitted.contains(n.getName())) {
    2.90 +                            continue;
    2.91 +                        }
    2.92 +
    2.93 +                        while (n != null && !emitted.contains(n.getName())) {
    2.94 +                            pending.push(n);
    2.95 +                            n = n.getSuperclass();
    2.96 +                        }
    2.97 +                        while (!pending.empty()) {
    2.98 +                            n = (Type)pending.pop();
    2.99 +                            dumpType(n);
   2.100 +                            emitted.add(n.getName());
   2.101 +                        }
   2.102                      }
   2.103                  }
   2.104              }
   2.105 @@ -846,83 +924,105 @@
   2.106  
   2.107              }
   2.108          },
   2.109 -        new Command("search", "search [ heap | codecache | threads ] value", false) {
   2.110 +        new Command("search", "search [ heap | perm | rawheap | codecache | threads ] value", false) {
   2.111              public void doit(Tokens t) {
   2.112                  if (t.countTokens() != 2) {
   2.113                      usage();
   2.114 -                } else {
   2.115 -                    String type = t.nextToken();
   2.116 -                    final Address value = VM.getVM().getDebugger().parseAddress(t.nextToken());
   2.117 -                    final long stride = VM.getVM().getAddressSize();
   2.118 -                    if (type.equals("threads")) {
   2.119 -                        Threads threads = VM.getVM().getThreads();
   2.120 -                        for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
   2.121 -                            Address base = thread.getBaseOfStackPointer();
   2.122 -                            Address end = thread.getLastJavaSP();
   2.123 -                            if (end == null) continue;
   2.124 -                            if (end.lessThan(base)) {
   2.125 -                                Address tmp = base;
   2.126 -                                base = end;
   2.127 -                                end = tmp;
   2.128 +                    return;
   2.129 +                }
   2.130 +                String type = t.nextToken();
   2.131 +                final Address value = VM.getVM().getDebugger().parseAddress(t.nextToken());
   2.132 +                final long stride = VM.getVM().getAddressSize();
   2.133 +                if (type.equals("threads")) {
   2.134 +                    Threads threads = VM.getVM().getThreads();
   2.135 +                    for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
   2.136 +                        Address base = thread.getBaseOfStackPointer();
   2.137 +                        Address end = thread.getLastJavaSP();
   2.138 +                        if (end == null) continue;
   2.139 +                        if (end.lessThan(base)) {
   2.140 +                            Address tmp = base;
   2.141 +                            base = end;
   2.142 +                            end = tmp;
   2.143 +                        }
   2.144 +                        out.println("Searching " + base + " " + end);
   2.145 +                        while (base != null && base.lessThan(end)) {
   2.146 +                            Address val = base.getAddressAt(0);
   2.147 +                            if (AddressOps.equal(val, value)) {
   2.148 +                                out.println(base);
   2.149                              }
   2.150 -                            out.println("Searching " + base + " " + end);
   2.151 -                            while (base != null && base.lessThan(end)) {
   2.152 -                                Address val = base.getAddressAt(0);
   2.153 +                            base = base.addOffsetTo(stride);
   2.154 +                        }
   2.155 +                    }
   2.156 +                } else if (type.equals("rawheap")) {
   2.157 +                    RawHeapVisitor iterator = new RawHeapVisitor() {
   2.158 +                            public void prologue(long used) {
   2.159 +                            }
   2.160 +
   2.161 +                            public void visitAddress(Address addr) {
   2.162 +                                Address val = addr.getAddressAt(0);
   2.163                                  if (AddressOps.equal(val, value)) {
   2.164 -                                    out.println(base);
   2.165 +                                        out.println("found at " + addr);
   2.166                                  }
   2.167 -                                base = base.addOffsetTo(stride);
   2.168                              }
   2.169 -                        }
   2.170 -                    } else if (type.equals("heap")) {
   2.171 -                        RawHeapVisitor iterator = new RawHeapVisitor() {
   2.172 -                                public void prologue(long used) {
   2.173 +                            public void visitCompOopAddress(Address addr) {
   2.174 +                                Address val = addr.getCompOopAddressAt(0);
   2.175 +                                if (AddressOps.equal(val, value)) {
   2.176 +                                    out.println("found at " + addr);
   2.177                                  }
   2.178 +                            }
   2.179 +                            public void epilogue() {
   2.180 +                            }
   2.181 +                        };
   2.182 +                    VM.getVM().getObjectHeap().iterateRaw(iterator);
   2.183 +                } else if (type.equals("heap") || type.equals("perm")) {
   2.184 +                    HeapVisitor iterator = new DefaultHeapVisitor() {
   2.185 +                            public boolean doObj(Oop obj) {
   2.186 +                                int index = 0;
   2.187 +                                Address start = obj.getHandle();
   2.188 +                                long end = obj.getObjectSize();
   2.189 +                                while (index < end) {
   2.190 +                                    Address val = start.getAddressAt(index);
   2.191 +                                    if (AddressOps.equal(val, value)) {
   2.192 +                                        out.println("found in " + obj.getHandle());
   2.193 +                                        break;
   2.194 +                                    }
   2.195 +                                    index += 4;
   2.196 +                                }
   2.197 +                                return false;
   2.198 +                            }
   2.199 +                        };
   2.200 +                    if (type.equals("heap")) {
   2.201 +                        VM.getVM().getObjectHeap().iterate(iterator);
   2.202 +                    } else {
   2.203 +                        VM.getVM().getObjectHeap().iteratePerm(iterator);
   2.204 +                    }
   2.205 +                } else if (type.equals("codecache")) {
   2.206 +                    CodeCacheVisitor v = new CodeCacheVisitor() {
   2.207 +                            public void prologue(Address start, Address end) {
   2.208 +                            }
   2.209 +                            public void visit(CodeBlob blob) {
   2.210 +                                boolean printed = false;
   2.211 +                                Address base = blob.getAddress();
   2.212 +                                Address end = base.addOffsetTo(blob.getSize());
   2.213 +                                while (base != null && base.lessThan(end)) {
   2.214 +                                    Address val = base.getAddressAt(0);
   2.215 +                                    if (AddressOps.equal(val, value)) {
   2.216 +                                        if (!printed) {
   2.217 +                                            printed = true;
   2.218 +                                            blob.printOn(out);
   2.219 +                                        }
   2.220 +                                        out.println("found at " + base + "\n");
   2.221 +                                    }
   2.222 +                                    base = base.addOffsetTo(stride);
   2.223 +                                }
   2.224 +                            }
   2.225 +                            public void epilogue() {
   2.226 +                            }
   2.227  
   2.228 -                                public void visitAddress(Address addr) {
   2.229 -                                    Address val = addr.getAddressAt(0);
   2.230 -                                    if (AddressOps.equal(val, value)) {
   2.231 -                                        out.println("found at " + addr);
   2.232 -                                    }
   2.233 -                                }
   2.234 -                                public void visitCompOopAddress(Address addr) {
   2.235 -                                    Address val = addr.getCompOopAddressAt(0);
   2.236 -                                    if (AddressOps.equal(val, value)) {
   2.237 -                                        out.println("found at " + addr);
   2.238 -                                    }
   2.239 -                                }
   2.240 -                                public void epilogue() {
   2.241 -                                }
   2.242 -                            };
   2.243 -                        VM.getVM().getObjectHeap().iterateRaw(iterator);
   2.244 -                    } else if (type.equals("codecache")) {
   2.245 -                        CodeCacheVisitor v = new CodeCacheVisitor() {
   2.246 -                                public void prologue(Address start, Address end) {
   2.247 -                                }
   2.248 -                                public void visit(CodeBlob blob) {
   2.249 -                                    boolean printed = false;
   2.250 -                                    Address base = blob.getAddress();
   2.251 -                                    Address end = base.addOffsetTo(blob.getSize());
   2.252 -                                    while (base != null && base.lessThan(end)) {
   2.253 -                                        Address val = base.getAddressAt(0);
   2.254 -                                        if (AddressOps.equal(val, value)) {
   2.255 -                                            if (!printed) {
   2.256 -                                                printed = true;
   2.257 -                                                blob.printOn(out);
   2.258 -                                            }
   2.259 -                                            out.println("found at " + base + "\n");
   2.260 -                                        }
   2.261 -                                        base = base.addOffsetTo(stride);
   2.262 -                                    }
   2.263 -                                }
   2.264 -                                public void epilogue() {
   2.265 -                                }
   2.266  
   2.267 +                        };
   2.268 +                    VM.getVM().getCodeCache().iterate(v);
   2.269  
   2.270 -                            };
   2.271 -                        VM.getVM().getCodeCache().iterate(v);
   2.272 -
   2.273 -                    }
   2.274                  }
   2.275              }
   2.276          },
   2.277 @@ -957,12 +1057,19 @@
   2.278                      Threads threads = VM.getVM().getThreads();
   2.279                      boolean all = name.equals("-a");
   2.280                      for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
   2.281 -                        StringWriter sw = new StringWriter();
   2.282                          ByteArrayOutputStream bos = new ByteArrayOutputStream();
   2.283                          thread.printThreadIDOn(new PrintStream(bos));
   2.284                          if (all || bos.toString().equals(name)) {
   2.285 +                            out.println(bos.toString() + " = " + thread.getAddress());
   2.286                              HTMLGenerator gen = new HTMLGenerator(false);
   2.287 -                            out.println(gen.genHTMLForJavaStackTrace(thread));
   2.288 +                            try {
   2.289 +                                out.println(gen.genHTMLForJavaStackTrace(thread));
   2.290 +                            } catch (Exception e) {
   2.291 +                                err.println("Error: " + e);
   2.292 +                                if (verboseExceptions) {
   2.293 +                                    e.printStackTrace(err);
   2.294 +                                }
   2.295 +                            }
   2.296                              if (!all) return;
   2.297                          }
   2.298                      }
   2.299 @@ -970,6 +1077,26 @@
   2.300                  }
   2.301              }
   2.302          },
   2.303 +        new Command("thread", "thread { -a | id }", false) {
   2.304 +            public void doit(Tokens t) {
   2.305 +                if (t.countTokens() != 1) {
   2.306 +                    usage();
   2.307 +                } else {
   2.308 +                    String name = t.nextToken();
   2.309 +                    Threads threads = VM.getVM().getThreads();
   2.310 +                    boolean all = name.equals("-a");
   2.311 +                    for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
   2.312 +                        ByteArrayOutputStream bos = new ByteArrayOutputStream();
   2.313 +                        thread.printThreadIDOn(new PrintStream(bos));
   2.314 +                        if (all || bos.toString().equals(name)) {
   2.315 +                            out.println(bos.toString() + " = " + thread.getAddress());
   2.316 +                            if (!all) return;
   2.317 +                        }
   2.318 +                    }
   2.319 +                    out.println("Couldn't find thread " + name);
   2.320 +                }
   2.321 +            }
   2.322 +        },
   2.323  
   2.324          new Command("threads", false) {
   2.325              public void doit(Tokens t) {
   2.326 @@ -1161,7 +1288,7 @@
   2.327          }
   2.328      }
   2.329  
   2.330 -    static Pattern historyPattern = Pattern.compile("((!\\*)|(!\\$)|(!!-?)|(!-?[0-9][0-9]*))");
   2.331 +    static Pattern historyPattern = Pattern.compile("((!\\*)|(!\\$)|(!!-?)|(!-?[0-9][0-9]*)|(![a-zA-Z][^ ]*))");
   2.332  
   2.333      public void executeCommand(String ln) {
   2.334          if (ln.indexOf('!') != -1) {
   2.335 @@ -1195,14 +1322,37 @@
   2.336                          result.append(item.at(item.countTokens() - 1));
   2.337                      } else {
   2.338                          String tail = cmd.substring(1);
   2.339 -                        int index = Integer.parseInt(tail);
   2.340 -                        if (index < 0) {
   2.341 -                            index = history.size() + index;
   2.342 +                        switch (tail.charAt(0)) {
   2.343 +                        case '0':
   2.344 +                        case '1':
   2.345 +                        case '2':
   2.346 +                        case '3':
   2.347 +                        case '4':
   2.348 +                        case '5':
   2.349 +                        case '6':
   2.350 +                        case '7':
   2.351 +                        case '8':
   2.352 +                        case '9':
   2.353 +                        case '-': {
   2.354 +                            int index = Integer.parseInt(tail);
   2.355 +                            if (index < 0) {
   2.356 +                                index = history.size() + index;
   2.357 +                            }
   2.358 +                            if (index > size) {
   2.359 +                                err.println("No such history item");
   2.360 +                            } else {
   2.361 +                                result.append((String)history.get(index));
   2.362 +                            }
   2.363 +                            break;
   2.364                          }
   2.365 -                        if (index > size) {
   2.366 -                            err.println("No such history item");
   2.367 -                        } else {
   2.368 -                            result.append((String)history.get(index));
   2.369 +                        default: {
   2.370 +                            for (int i = history.size() - 1; i >= 0; i--) {
   2.371 +                                String s = (String)history.get(i);
   2.372 +                                if (s.startsWith(tail)) {
   2.373 +                                    result.append(s);
   2.374 +                                }
   2.375 +                            }
   2.376 +                        }
   2.377                          }
   2.378                      }
   2.379                  }
     3.1 --- a/agent/src/share/classes/sun/jvm/hotspot/HSDB.java	Mon Apr 19 02:13:06 2010 -0700
     3.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/HSDB.java	Tue Apr 20 13:26:33 2010 -0700
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
     3.6 + * Copyright 2000-2010 Sun Microsystems, Inc.  All Rights Reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -985,6 +985,12 @@
    3.11                annoPanel.addAnnotation(new Annotation(curFrame.addressOfInterpreterFrameExpressionStack(),
    3.12                                                       curFrame.addressOfInterpreterFrameTOS(),
    3.13                                                       "Interpreter expression stack"));
    3.14 +              Address monBegin = curFrame.interpreterFrameMonitorBegin().address();
    3.15 +              Address monEnd = curFrame.interpreterFrameMonitorEnd().address();
    3.16 +              if (!monBegin.equals(monEnd)) {
    3.17 +                  annoPanel.addAnnotation(new Annotation(monBegin, monEnd,
    3.18 +                                                         "BasicObjectLocks"));
    3.19 +              }
    3.20                if (interpreterFrameMethod != null) {
    3.21                  // The offset is just to get the right stack slots highlighted in the output
    3.22                  int offset = 1;
     4.1 --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpot.java	Mon Apr 19 02:13:06 2010 -0700
     4.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpot.java	Tue Apr 20 13:26:33 2010 -0700
     4.3 @@ -1,5 +1,5 @@
     4.4  /*
     4.5 - * Copyright 2001-2003 Sun Microsystems, Inc.  All Rights Reserved.
     4.6 + * Copyright 2001-2010 Sun Microsystems, Inc.  All Rights Reserved.
     4.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8   *
     4.9   * This code is free software; you can redistribute it and/or modify it
    4.10 @@ -294,7 +294,7 @@
    4.11      attachDialog.setSize(400, 300);
    4.12      GraphicsUtilities.centerInContainer(attachDialog.getComponent(),
    4.13                                          getParentDimension(attachDialog.getComponent()));
    4.14 -    attachDialog.show();
    4.15 +    attachDialog.setVisible(true);
    4.16    }
    4.17  
    4.18    public void showThreadsDialog() {
    4.19 @@ -321,7 +321,7 @@
    4.20                                             getParentDimension(threadsDialog.getComponent()));
    4.21      GraphicsUtilities.centerInContainer(threadsDialog.getComponent(),
    4.22                                          getParentDimension(threadsDialog.getComponent()));
    4.23 -    threadsDialog.show();
    4.24 +    threadsDialog.setVisible(true);
    4.25    }
    4.26  
    4.27    public void showMemoryDialog() {
    4.28 @@ -341,7 +341,7 @@
    4.29                                             getParentDimension(memoryDialog.getComponent()));
    4.30      GraphicsUtilities.centerInContainer(memoryDialog.getComponent(),
    4.31                                          getParentDimension(memoryDialog.getComponent()));
    4.32 -    memoryDialog.show();
    4.33 +    memoryDialog.setVisible(true);
    4.34    }
    4.35  
    4.36    /** Changes the editor factory this debugger uses to display source
    4.37 @@ -530,7 +530,7 @@
    4.38        addFrame(stackFrame);
    4.39        stackFrame.setSize(400, 200);
    4.40        GraphicsUtilities.moveToInContainer(stackFrame.getComponent(), 0.0f, 1.0f, 0, 20);
    4.41 -      stackFrame.show();
    4.42 +      stackFrame.setVisible(true);
    4.43  
    4.44        // Create register panel
    4.45        registerPanel = new RegisterPanel();
    4.46 @@ -544,7 +544,7 @@
    4.47        registerFrame.setSize(225, 200);
    4.48        GraphicsUtilities.moveToInContainer(registerFrame.getComponent(),
    4.49                                            1.0f, 0.0f, 0, 0);
    4.50 -      registerFrame.show();
    4.51 +      registerFrame.setVisible(true);
    4.52  
    4.53        resetCurrentThread();
    4.54      } catch (DebuggerException e) {
    4.55 @@ -979,7 +979,7 @@
    4.56                                                 1.0f,
    4.57                                                 0.85f,
    4.58                                                 getParentDimension(editorFrame.getComponent()));
    4.59 -        editorFrame.show();
    4.60 +        editorFrame.setVisible(true);
    4.61          shown = true;
    4.62        }
    4.63        code.showLineNumber(lineNo);
     5.1 --- a/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeDisassembler.java	Mon Apr 19 02:13:06 2010 -0700
     5.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeDisassembler.java	Tue Apr 20 13:26:33 2010 -0700
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
     5.6 + * Copyright 2002-2010 Sun Microsystems, Inc.  All Rights Reserved.
     5.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8   *
     5.9   * This code is free software; you can redistribute it and/or modify it
    5.10 @@ -96,10 +96,6 @@
    5.11        addBytecodeClass(Bytecodes._dstore, BytecodeStore.class);
    5.12        addBytecodeClass(Bytecodes._astore, BytecodeStore.class);
    5.13        addBytecodeClass(Bytecodes._tableswitch, BytecodeTableswitch.class);
    5.14 -
    5.15 -      // only special fast_xxx cases. others are handled differently.
    5.16 -      addBytecodeClass(Bytecodes._fast_iaccess_0, BytecodeFastAAccess0.class);
    5.17 -      addBytecodeClass(Bytecodes._fast_aaccess_0, BytecodeFastIAccess0.class);
    5.18     }
    5.19  
    5.20     public BytecodeDisassembler(Method method) {
     6.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java	Mon Apr 19 02:13:06 2010 -0700
     6.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java	Tue Apr 20 13:26:33 2010 -0700
     6.3 @@ -1,5 +1,5 @@
     6.4  /*
     6.5 - * Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
     6.6 + * Copyright 2000-2010 Sun Microsystems, Inc.  All Rights Reserved.
     6.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8   *
     6.9   * This code is free software; you can redistribute it and/or modify it
    6.10 @@ -263,11 +263,12 @@
    6.11      case JVM_CONSTANT_NameAndType:        return "JVM_CONSTANT_NameAndType";
    6.12      case JVM_CONSTANT_Invalid:            return "JVM_CONSTANT_Invalid";
    6.13      case JVM_CONSTANT_UnresolvedClass:    return "JVM_CONSTANT_UnresolvedClass";
    6.14 +    case JVM_CONSTANT_UnresolvedClassInError:    return "JVM_CONSTANT_UnresolvedClassInError";
    6.15      case JVM_CONSTANT_ClassIndex:         return "JVM_CONSTANT_ClassIndex";
    6.16      case JVM_CONSTANT_UnresolvedString:   return "JVM_CONSTANT_UnresolvedString";
    6.17      case JVM_CONSTANT_StringIndex:        return "JVM_CONSTANT_StringIndex";
    6.18      }
    6.19 -    throw new InternalError("unknown tag");
    6.20 +    throw new InternalError("Unknown tag: " + tag);
    6.21    }
    6.22  
    6.23    public void iterateFields(OopVisitor visitor, boolean doVMFields) {
    6.24 @@ -304,6 +305,7 @@
    6.25            index++;
    6.26            break;
    6.27  
    6.28 +        case JVM_CONSTANT_UnresolvedClassInError:
    6.29          case JVM_CONSTANT_UnresolvedClass:
    6.30          case JVM_CONSTANT_Class:
    6.31          case JVM_CONSTANT_UnresolvedString:
    6.32 @@ -409,6 +411,7 @@
    6.33                }
    6.34  
    6.35                // case JVM_CONSTANT_ClassIndex:
    6.36 +              case JVM_CONSTANT_UnresolvedClassInError:
    6.37                case JVM_CONSTANT_UnresolvedClass: {
    6.38                    dos.writeByte(JVM_CONSTANT_Class);
    6.39                    String klassName = getSymbolAt(ci).asString();
    6.40 @@ -464,6 +467,8 @@
    6.41                                            + ", type = " + signatureIndex);
    6.42                    break;
    6.43                }
    6.44 +              default:
    6.45 +                  throw new InternalError("unknown tag: " + cpConstType);
    6.46            } // switch
    6.47        }
    6.48        dos.flush();
     7.1 --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java	Mon Apr 19 02:13:06 2010 -0700
     7.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java	Tue Apr 20 13:26:33 2010 -0700
     7.3 @@ -1,5 +1,5 @@
     7.4  /*
     7.5 - * Copyright 2002-2009 Sun Microsystems, Inc.  All Rights Reserved.
     7.6 + * Copyright 2002-2010 Sun Microsystems, Inc.  All Rights Reserved.
     7.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8   *
     7.9   * This code is free software; you can redistribute it and/or modify it
    7.10 @@ -58,6 +58,9 @@
    7.11      // Temporary tag while constructing constant pool
    7.12      public static final int JVM_CONSTANT_StringIndex        = 103;
    7.13  
    7.14 +    // Temporary tag while constructing constant pool
    7.15 +    public static final int JVM_CONSTANT_UnresolvedClassInError = 104;
    7.16 +
    7.17      // 1.5 major/minor version numbers from JVM spec. 3rd edition
    7.18      public static final short MAJOR_VERSION = 49;
    7.19      public static final short MINOR_VERSION = 0;
     8.1 --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/SignatureIterator.java	Mon Apr 19 02:13:06 2010 -0700
     8.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/SignatureIterator.java	Tue Apr 20 13:26:33 2010 -0700
     8.3 @@ -1,5 +1,5 @@
     8.4  /*
     8.5 - * Copyright 2001 Sun Microsystems, Inc.  All Rights Reserved.
     8.6 + * Copyright 2001-2010 Sun Microsystems, Inc.  All Rights Reserved.
     8.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.8   *
     8.9   * This code is free software; you can redistribute it and/or modify it
    8.10 @@ -108,7 +108,7 @@
    8.11          return BasicTypeSize.getTArraySize();
    8.12        }
    8.13      }
    8.14 -    throw new RuntimeException("Should not reach here");
    8.15 +    throw new RuntimeException("Should not reach here: char " + (char)_signature.getByteAt(_index) + " @ " + _index + " in " + _signature.asString());
    8.16    }
    8.17    protected void checkSignatureEnd() {
    8.18      if (_index < _signature.getLength()) {
     9.1 --- a/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Mon Apr 19 02:13:06 2010 -0700
     9.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Tue Apr 20 13:26:33 2010 -0700
     9.3 @@ -1,5 +1,5 @@
     9.4  /*
     9.5 - * Copyright 2002-2009 Sun Microsystems, Inc.  All Rights Reserved.
     9.6 + * Copyright 2002-2010 Sun Microsystems, Inc.  All Rights Reserved.
     9.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.8   *
     9.9   * This code is free software; you can redistribute it and/or modify it
    9.10 @@ -238,6 +238,7 @@
    9.11                  }
    9.12  
    9.13                  // case JVM_CONSTANT_ClassIndex:
    9.14 +                case JVM_CONSTANT_UnresolvedClassInError:
    9.15                  case JVM_CONSTANT_UnresolvedClass: {
    9.16                       dos.writeByte(JVM_CONSTANT_Class);
    9.17                       String klassName = cpool.getSymbolAt(ci).asString();
    9.18 @@ -296,6 +297,8 @@
    9.19                                          + ", type = " + signatureIndex);
    9.20                       break;
    9.21                  }
    9.22 +                default:
    9.23 +                  throw new InternalError("Unknown tag: " + cpConstType);
    9.24              } // switch
    9.25          }
    9.26      }
    10.1 --- a/agent/src/share/classes/sun/jvm/hotspot/ui/FrameWrapper.java	Mon Apr 19 02:13:06 2010 -0700
    10.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/ui/FrameWrapper.java	Tue Apr 20 13:26:33 2010 -0700
    10.3 @@ -1,5 +1,5 @@
    10.4  /*
    10.5 - * Copyright 2001 Sun Microsystems, Inc.  All Rights Reserved.
    10.6 + * Copyright 2001-2010 Sun Microsystems, Inc.  All Rights Reserved.
    10.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.8   *
    10.9   * This code is free software; you can redistribute it and/or modify it
   10.10 @@ -39,7 +39,6 @@
   10.11    public void       setVisible(boolean visible);
   10.12    public void       setSize(int x, int y);
   10.13    public void       pack();
   10.14 -  public void       show();
   10.15    public void       dispose();
   10.16    public void       setBackground(Color color);
   10.17    public void       setResizable(boolean resizable);
    11.1 --- a/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java	Mon Apr 19 02:13:06 2010 -0700
    11.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java	Tue Apr 20 13:26:33 2010 -0700
    11.3 @@ -1,5 +1,5 @@
    11.4  /*
    11.5 - * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
    11.6 + * Copyright 2002-2010 Sun Microsystems, Inc.  All Rights Reserved.
    11.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.8   *
    11.9   * This code is free software; you can redistribute it and/or modify it
   11.10 @@ -95,8 +95,10 @@
   11.11  
   11.12          // list tags
   11.13          void beginList()  { beginTag("ul"); nl(); }
   11.14 +        void endList()    { endTag("ul"); nl();   }
   11.15 +        void beginListItem() { beginTag("li"); }
   11.16 +        void endListItem()   { endTag("li"); nl();   }
   11.17          void li(String s) { wrap("li", s); nl();  }
   11.18 -        void endList()    { endTag("ul"); nl();   }
   11.19  
   11.20          // table tags
   11.21          void beginTable(int border) {
   11.22 @@ -505,6 +507,11 @@
   11.23                 buf.cell(cpool.getSymbolAt(index).asString());
   11.24                 break;
   11.25  
   11.26 +            case JVM_CONSTANT_UnresolvedClassInError:
   11.27 +               buf.cell("JVM_CONSTANT_UnresolvedClassInError");
   11.28 +               buf.cell(cpool.getSymbolAt(index).asString());
   11.29 +               break;
   11.30 +
   11.31              case JVM_CONSTANT_Class:
   11.32                 buf.cell("JVM_CONSTANT_Class");
   11.33                 Klass klass = (Klass) cpool.getObjAt(index);
   11.34 @@ -564,6 +571,9 @@
   11.35                 buf.cell("JVM_CONSTANT_StringIndex");
   11.36                 buf.cell(Integer.toString(cpool.getIntAt(index)));
   11.37                 break;
   11.38 +
   11.39 +            default:
   11.40 +               throw new InternalError("unknown tag: " + ctag);
   11.41           }
   11.42  
   11.43           buf.endTag("tr");
   11.44 @@ -671,7 +681,16 @@
   11.45                               buf.cell(Integer.toString(curBci) + spaces);
   11.46  
   11.47                               buf.beginTag("td");
   11.48 -                             String instrStr = escapeHTMLSpecialChars(instr.toString());
   11.49 +                             String instrStr = null;
   11.50 +                             try {
   11.51 +                                 instrStr = escapeHTMLSpecialChars(instr.toString());
   11.52 +                             } catch (RuntimeException re) {
   11.53 +                                 buf.append("exception during bytecode processing");
   11.54 +                                 buf.endTag("td");
   11.55 +                                 buf.endTag("tr");
   11.56 +                                 re.printStackTrace();
   11.57 +                                 return;
   11.58 +                             }
   11.59  
   11.60                               if (instr instanceof BytecodeNew) {
   11.61                                  BytecodeNew newBytecode = (BytecodeNew) instr;
   11.62 @@ -1396,9 +1415,7 @@
   11.63           final SymbolFinder symFinder = createSymbolFinder();
   11.64           final Disassembler disasm = createDisassembler(startPc, code);
   11.65           class NMethodVisitor implements InstructionVisitor {
   11.66 -            boolean prevWasCall;
   11.67              public void prologue() {
   11.68 -               prevWasCall = false;
   11.69              }
   11.70  
   11.71              public void visit(long currentPc, Instruction instr) {
   11.72 @@ -1418,8 +1435,7 @@
   11.73  
   11.74                 PCDesc pcDesc = (PCDesc) safepoints.get(longToAddress(currentPc));
   11.75  
   11.76 -               boolean isSafepoint = (pcDesc != null);
   11.77 -               if (isSafepoint && prevWasCall) {
   11.78 +               if (pcDesc != null) {
   11.79                    buf.append(genSafepointInfo(nmethod, pcDesc));
   11.80                 }
   11.81  
   11.82 @@ -1435,11 +1451,6 @@
   11.83                 }
   11.84  
   11.85                 buf.br();
   11.86 -               if (isSafepoint && !prevWasCall) {
   11.87 -                 buf.append(genSafepointInfo(nmethod, pcDesc));
   11.88 -               }
   11.89 -
   11.90 -               prevWasCall = instr.isCall();
   11.91              }
   11.92  
   11.93              public void epilogue() {
   11.94 @@ -1783,22 +1794,20 @@
   11.95           buf.h3("Fields");
   11.96           buf.beginList();
   11.97           for (int f = 0; f < numFields; f += InstanceKlass.NEXT_OFFSET) {
   11.98 -           int nameIndex = fields.getShortAt(f + InstanceKlass.NAME_INDEX_OFFSET);
   11.99 -           int sigIndex  = fields.getShortAt(f + InstanceKlass.SIGNATURE_INDEX_OFFSET);
  11.100 -           int genSigIndex = fields.getShortAt(f + InstanceKlass.GENERIC_SIGNATURE_INDEX_OFFSET);
  11.101 -           Symbol f_name = cp.getSymbolAt(nameIndex);
  11.102 -           Symbol f_sig  = cp.getSymbolAt(sigIndex);
  11.103 -           Symbol f_genSig = (genSigIndex != 0)? cp.getSymbolAt(genSigIndex) : null;
  11.104 -           AccessFlags acc = new AccessFlags(fields.getShortAt(f + InstanceKlass.ACCESS_FLAGS_OFFSET));
  11.105 +           sun.jvm.hotspot.oops.Field field = klass.getFieldByIndex(f);
  11.106 +           String f_name = ((NamedFieldIdentifier)field.getID()).getName();
  11.107 +           Symbol f_sig  = field.getSignature();
  11.108 +           Symbol f_genSig = field.getGenericSignature();
  11.109 +           AccessFlags acc = field.getAccessFlagsObj();
  11.110  
  11.111 -           buf.beginTag("li");
  11.112 +           buf.beginListItem();
  11.113             buf.append(genFieldModifierString(acc));
  11.114             buf.append(' ');
  11.115             Formatter sigBuf = new Formatter(genHTML);
  11.116             new SignatureConverter(f_sig, sigBuf.getBuffer()).dispatchField();
  11.117             buf.append(sigBuf.toString().replace('/', '.'));
  11.118             buf.append(' ');
  11.119 -           buf.append(f_name.asString());
  11.120 +           buf.append(f_name);
  11.121             buf.append(';');
  11.122             // is it generic?
  11.123             if (f_genSig != null) {
  11.124 @@ -1806,7 +1815,8 @@
  11.125                buf.append(escapeHTMLSpecialChars(f_genSig.asString()));
  11.126                buf.append("] ");
  11.127             }
  11.128 -           buf.endTag("li");
  11.129 +           buf.append(" (offset = " + field.getOffset() + ")");
  11.130 +           buf.endListItem();
  11.131           }
  11.132           buf.endList();
  11.133        }
    12.1 --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/Assert.java	Mon Apr 19 02:13:06 2010 -0700
    12.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/Assert.java	Tue Apr 20 13:26:33 2010 -0700
    12.3 @@ -1,5 +1,5 @@
    12.4  /*
    12.5 - * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
    12.6 + * Copyright 2000-2010 Sun Microsystems, Inc.  All Rights Reserved.
    12.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.8   *
    12.9   * This code is free software; you can redistribute it and/or modify it
   12.10 @@ -28,7 +28,7 @@
   12.11    public static boolean ASSERTS_ENABLED = true;
   12.12  
   12.13    public static void that(boolean test, String message) {
   12.14 -    if (!test) {
   12.15 +    if (ASSERTS_ENABLED && !test) {
   12.16        throw new AssertionFailure(message);
   12.17      }
   12.18    }

mercurial