102 buf.append(value); 103 } 104 return buf; 105 } 106 107 @Override 108 public String toString() { 109 Set<VirtualObject> visited = Collections.newSetFromMap(new IdentityHashMap<VirtualObject, Boolean>()); 110 return appendValue(new StringBuilder(), this, visited).toString(); 111 } 112 113 /** 114 * Returns the type of the object whose allocation was removed during compilation. This can be 115 * either an instance of an array type. 116 */ 117 public ResolvedJavaType getType() { 118 return type; 119 } 120 121 /** 122 * Returns an array containing all the values to be stored into the object when it is recreated. 123 */ 124 public JavaValue[] getValues() { 125 return values; 126 } 127 128 /** 129 * Returns an array containing the Java kind of all values in the object. 130 */ 131 public JavaKind[] getSlotKinds() { 132 return slotKinds; 133 } 134 135 /** 136 * Returns the unique id that identifies the object within the debug information for one 137 * position in the compiled code. 138 */ 139 public int getId() { 140 return id; 141 } 142 143 /** 144 * Overwrites the current set of values with a new one. 145 * 146 * @param values an array containing all the values to be stored into the object when it is 147 * recreated. 148 * @param slotKinds an array containing the Java kinds of the values. 149 */ 150 public void setValues(JavaValue[] values, JavaKind[] slotKinds) { 151 this.values = values; 152 this.slotKinds = slotKinds; 153 } 154 155 @Override 156 public int hashCode() { 157 return 42 + type.hashCode(); 158 } 159 160 @Override 161 public boolean equals(Object o) { 162 if (o == this) { 163 return true; 164 } 165 if (o instanceof VirtualObject) { 166 VirtualObject l = (VirtualObject) o; 167 if (!l.type.equals(type) || l.values.length != values.length) { 168 return false; 169 } 170 for (int i = 0; i < values.length; i++) { | 102 buf.append(value); 103 } 104 return buf; 105 } 106 107 @Override 108 public String toString() { 109 Set<VirtualObject> visited = Collections.newSetFromMap(new IdentityHashMap<VirtualObject, Boolean>()); 110 return appendValue(new StringBuilder(), this, visited).toString(); 111 } 112 113 /** 114 * Returns the type of the object whose allocation was removed during compilation. This can be 115 * either an instance of an array type. 116 */ 117 public ResolvedJavaType getType() { 118 return type; 119 } 120 121 /** 122 * Returns the array containing all the values to be stored into the object when it is 123 * recreated. This field is intentional exposed as a mutable array that a compiler may modify 124 * (e.g. during register allocation). 125 */ 126 @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "`values` is intentional mutable")// 127 public JavaValue[] getValues() { 128 return values; 129 } 130 131 /** 132 * Returns the kind of the value at {@code index}. 133 */ 134 public JavaKind getSlotKind(int index) { 135 return slotKinds[index]; 136 } 137 138 /** 139 * Returns the unique id that identifies the object within the debug information for one 140 * position in the compiled code. 141 */ 142 public int getId() { 143 return id; 144 } 145 146 /** 147 * Overwrites the current set of values with a new one. 148 * 149 * @param values an array containing all the values to be stored into the object when it is 150 * recreated. 151 * @param slotKinds an array containing the Java kinds of the values. This must have the same 152 * length as {@code values}. This array is now owned by this object and must not be 153 * mutated by the caller. 154 */ 155 @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `slotKinds`") 156 public void setValues(JavaValue[] values, JavaKind[] slotKinds) { 157 assert values.length == slotKinds.length; 158 this.values = values; 159 this.slotKinds = slotKinds; 160 } 161 162 @Override 163 public int hashCode() { 164 return 42 + type.hashCode(); 165 } 166 167 @Override 168 public boolean equals(Object o) { 169 if (o == this) { 170 return true; 171 } 172 if (o instanceof VirtualObject) { 173 VirtualObject l = (VirtualObject) o; 174 if (!l.type.equals(type) || l.values.length != values.length) { 175 return false; 176 } 177 for (int i = 0; i < values.length; i++) { |