comparison agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java @ 3908:7588156f5cf9

7051798: SA-JDI: NPE in Frame.addressOfStackSlot(Frame.java:244) Reviewed-by: kvn
author never
date Mon, 05 Sep 2011 17:09:05 -0700
parents 37be97a58393
children 04ade88d9712
comparison
equal deleted inserted replaced
3907:7b5c767f229c 3908:7588156f5cf9
26 26
27 import java.io.*; 27 import java.io.*;
28 28
29 import com.sun.jdi.*; 29 import com.sun.jdi.*;
30 30
31 import sun.jvm.hotspot.memory.SystemDictionary;
31 import sun.jvm.hotspot.oops.Instance; 32 import sun.jvm.hotspot.oops.Instance;
32 import sun.jvm.hotspot.oops.InstanceKlass; 33 import sun.jvm.hotspot.oops.InstanceKlass;
33 import sun.jvm.hotspot.oops.ArrayKlass; 34 import sun.jvm.hotspot.oops.ArrayKlass;
34 import sun.jvm.hotspot.oops.JVMDIClassStatus; 35 import sun.jvm.hotspot.oops.JVMDIClassStatus;
35 import sun.jvm.hotspot.oops.Klass; 36 import sun.jvm.hotspot.oops.Klass;
37 import sun.jvm.hotspot.oops.ObjArray;
36 import sun.jvm.hotspot.oops.Oop; 38 import sun.jvm.hotspot.oops.Oop;
37 import sun.jvm.hotspot.oops.Symbol; 39 import sun.jvm.hotspot.oops.Symbol;
38 import sun.jvm.hotspot.oops.DefaultHeapVisitor; 40 import sun.jvm.hotspot.oops.DefaultHeapVisitor;
39 import sun.jvm.hotspot.utilities.Assert; 41 import sun.jvm.hotspot.utilities.Assert;
40 42
51 private SoftReference fieldsCache; 53 private SoftReference fieldsCache;
52 private SoftReference allFieldsCache; 54 private SoftReference allFieldsCache;
53 private SoftReference methodsCache; 55 private SoftReference methodsCache;
54 private SoftReference allMethodsCache; 56 private SoftReference allMethodsCache;
55 private SoftReference nestedTypesCache; 57 private SoftReference nestedTypesCache;
58 private SoftReference methodInvokesCache;
56 59
57 /* to mark when no info available */ 60 /* to mark when no info available */
58 static final SDE NO_SDE_INFO_MARK = new SDE(); 61 static final SDE NO_SDE_INFO_MARK = new SDE();
59 62
60 protected ReferenceTypeImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Klass klass) { 63 protected ReferenceTypeImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Klass klass) {
79 while (it.hasNext()) { 82 while (it.hasNext()) {
80 MethodImpl method = (MethodImpl)it.next(); 83 MethodImpl method = (MethodImpl)it.next();
81 if (ref.equals(method.ref())) { 84 if (ref.equals(method.ref())) {
82 return method; 85 return method;
83 } 86 }
87 }
88 if (ref.getMethodHolder().equals(SystemDictionary.getMethodHandleKlass())) {
89 // invoke methods are generated as needed, so make mirrors as needed
90 List mis = null;
91 if (methodInvokesCache == null) {
92 mis = new ArrayList();
93 methodInvokesCache = new SoftReference(mis);
94 } else {
95 mis = (List)methodInvokesCache.get();
96 }
97 it = mis.iterator();
98 while (it.hasNext()) {
99 MethodImpl method = (MethodImpl)it.next();
100 if (ref.equals(method.ref())) {
101 return method;
102 }
103 }
104
105 MethodImpl method = MethodImpl.createMethodImpl(vm, this, ref);
106 mis.add(method);
107 return method;
84 } 108 }
85 throw new IllegalArgumentException("Invalid method id: " + ref); 109 throw new IllegalArgumentException("Invalid method id: " + ref);
86 } 110 }
87 111
88 public boolean equals(Object obj) { 112 public boolean equals(Object obj) {