src/share/vm/code/debugInfo.hpp

Mon, 25 Jun 2012 21:33:35 -0400

author
coleenp
date
Mon, 25 Jun 2012 21:33:35 -0400
changeset 3875
246d977b51f2
parent 2314
f95d63e2154a
child 4037
da91efe96a93
permissions
-rw-r--r--

7178670: runtime/7158800/BadUtf8.java fails in SymbolTable::rehash_table
Summary: Cannot delete _buckets and HashtableEntries in shared space (CDS)
Reviewed-by: acorn, kvn, dlong, dcubed, kamg

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_CODE_DEBUGINFO_HPP
stefank@2314 26 #define SHARE_VM_CODE_DEBUGINFO_HPP
stefank@2314 27
stefank@2314 28 #include "code/compressedStream.hpp"
stefank@2314 29 #include "code/location.hpp"
stefank@2314 30 #include "code/nmethod.hpp"
stefank@2314 31 #include "code/oopRecorder.hpp"
stefank@2314 32 #include "runtime/stackValue.hpp"
stefank@2314 33 #include "utilities/growableArray.hpp"
stefank@2314 34
duke@435 35 // Classes used for serializing debugging information.
duke@435 36 // These abstractions are introducted to provide symmetric
duke@435 37 // read and write operations.
duke@435 38
duke@435 39 // ScopeValue describes the value of a variable/expression in a scope
duke@435 40 // - LocationValue describes a value in a given location (in frame or register)
duke@435 41 // - ConstantValue describes a constant
duke@435 42
duke@435 43 class ScopeValue: public ResourceObj {
duke@435 44 public:
duke@435 45 // Testers
duke@435 46 virtual bool is_location() const { return false; }
duke@435 47 virtual bool is_object() const { return false; }
duke@435 48 virtual bool is_constant_int() const { return false; }
duke@435 49 virtual bool is_constant_double() const { return false; }
duke@435 50 virtual bool is_constant_long() const { return false; }
duke@435 51 virtual bool is_constant_oop() const { return false; }
duke@435 52 virtual bool equals(ScopeValue* other) const { return false; }
duke@435 53
duke@435 54 // Serialization of debugging information
duke@435 55 virtual void write_on(DebugInfoWriteStream* stream) = 0;
duke@435 56 static ScopeValue* read_from(DebugInfoReadStream* stream);
duke@435 57 };
duke@435 58
duke@435 59
duke@435 60 // A Location value describes a value in a given location; i.e. the corresponding
duke@435 61 // logical entity (e.g., a method temporary) lives in this location.
duke@435 62
duke@435 63 class LocationValue: public ScopeValue {
duke@435 64 private:
duke@435 65 Location _location;
duke@435 66 public:
duke@435 67 LocationValue(Location location) { _location = location; }
duke@435 68 bool is_location() const { return true; }
duke@435 69 Location location() const { return _location; }
duke@435 70
duke@435 71 // Serialization of debugging information
duke@435 72 LocationValue(DebugInfoReadStream* stream);
duke@435 73 void write_on(DebugInfoWriteStream* stream);
duke@435 74
duke@435 75 // Printing
duke@435 76 void print_on(outputStream* st) const;
duke@435 77 };
duke@435 78
duke@435 79
duke@435 80 // An ObjectValue describes an object eliminated by escape analysis.
duke@435 81
duke@435 82 class ObjectValue: public ScopeValue {
duke@435 83 private:
duke@435 84 int _id;
duke@435 85 ScopeValue* _klass;
duke@435 86 GrowableArray<ScopeValue*> _field_values;
duke@435 87 Handle _value;
duke@435 88 bool _visited;
duke@435 89
duke@435 90 public:
duke@435 91 ObjectValue(int id, ScopeValue* klass)
duke@435 92 : _id(id)
duke@435 93 , _klass(klass)
duke@435 94 , _field_values()
duke@435 95 , _value()
duke@435 96 , _visited(false) {
duke@435 97 assert(klass->is_constant_oop(), "should be constant klass oop");
duke@435 98 }
duke@435 99
duke@435 100 ObjectValue(int id)
duke@435 101 : _id(id)
duke@435 102 , _klass(NULL)
duke@435 103 , _field_values()
duke@435 104 , _value()
duke@435 105 , _visited(false) {}
duke@435 106
duke@435 107 // Accessors
duke@435 108 bool is_object() const { return true; }
duke@435 109 int id() const { return _id; }
duke@435 110 ScopeValue* klass() const { return _klass; }
duke@435 111 GrowableArray<ScopeValue*>* field_values() { return &_field_values; }
duke@435 112 ScopeValue* field_at(int i) const { return _field_values.at(i); }
duke@435 113 int field_size() { return _field_values.length(); }
duke@435 114 Handle value() const { return _value; }
duke@435 115 bool is_visited() const { return _visited; }
duke@435 116
duke@435 117 void set_value(oop value) { _value = Handle(value); }
duke@435 118 void set_visited(bool visited) { _visited = false; }
duke@435 119
duke@435 120 // Serialization of debugging information
duke@435 121 void read_object(DebugInfoReadStream* stream);
duke@435 122 void write_on(DebugInfoWriteStream* stream);
duke@435 123
duke@435 124 // Printing
duke@435 125 void print_on(outputStream* st) const;
duke@435 126 void print_fields_on(outputStream* st) const;
duke@435 127 };
duke@435 128
duke@435 129
duke@435 130 // A ConstantIntValue describes a constant int; i.e., the corresponding logical entity
duke@435 131 // is either a source constant or its computation has been constant-folded.
duke@435 132
duke@435 133 class ConstantIntValue: public ScopeValue {
duke@435 134 private:
duke@435 135 jint _value;
duke@435 136 public:
duke@435 137 ConstantIntValue(jint value) { _value = value; }
duke@435 138 jint value() const { return _value; }
duke@435 139 bool is_constant_int() const { return true; }
duke@435 140 bool equals(ScopeValue* other) const { return false; }
duke@435 141
duke@435 142 // Serialization of debugging information
duke@435 143 ConstantIntValue(DebugInfoReadStream* stream);
duke@435 144 void write_on(DebugInfoWriteStream* stream);
duke@435 145
duke@435 146 // Printing
duke@435 147 void print_on(outputStream* st) const;
duke@435 148 };
duke@435 149
duke@435 150 class ConstantLongValue: public ScopeValue {
duke@435 151 private:
duke@435 152 jlong _value;
duke@435 153 public:
duke@435 154 ConstantLongValue(jlong value) { _value = value; }
duke@435 155 jlong value() const { return _value; }
duke@435 156 bool is_constant_long() const { return true; }
duke@435 157 bool equals(ScopeValue* other) const { return false; }
duke@435 158
duke@435 159 // Serialization of debugging information
duke@435 160 ConstantLongValue(DebugInfoReadStream* stream);
duke@435 161 void write_on(DebugInfoWriteStream* stream);
duke@435 162
duke@435 163 // Printing
duke@435 164 void print_on(outputStream* st) const;
duke@435 165 };
duke@435 166
duke@435 167 class ConstantDoubleValue: public ScopeValue {
duke@435 168 private:
duke@435 169 jdouble _value;
duke@435 170 public:
duke@435 171 ConstantDoubleValue(jdouble value) { _value = value; }
duke@435 172 jdouble value() const { return _value; }
duke@435 173 bool is_constant_double() const { return true; }
duke@435 174 bool equals(ScopeValue* other) const { return false; }
duke@435 175
duke@435 176 // Serialization of debugging information
duke@435 177 ConstantDoubleValue(DebugInfoReadStream* stream);
duke@435 178 void write_on(DebugInfoWriteStream* stream);
duke@435 179
duke@435 180 // Printing
duke@435 181 void print_on(outputStream* st) const;
duke@435 182 };
duke@435 183
duke@435 184 // A ConstantOopWriteValue is created by the compiler to
duke@435 185 // be written as debugging information.
duke@435 186
duke@435 187 class ConstantOopWriteValue: public ScopeValue {
duke@435 188 private:
duke@435 189 jobject _value;
duke@435 190 public:
duke@435 191 ConstantOopWriteValue(jobject value) { _value = value; }
duke@435 192 jobject value() const { return _value; }
duke@435 193 bool is_constant_oop() const { return true; }
duke@435 194 bool equals(ScopeValue* other) const { return false; }
duke@435 195
duke@435 196 // Serialization of debugging information
duke@435 197 void write_on(DebugInfoWriteStream* stream);
duke@435 198
duke@435 199 // Printing
duke@435 200 void print_on(outputStream* st) const;
duke@435 201 };
duke@435 202
duke@435 203 // A ConstantOopReadValue is created by the VM when reading
duke@435 204 // debug information
duke@435 205
duke@435 206 class ConstantOopReadValue: public ScopeValue {
duke@435 207 private:
duke@435 208 Handle _value;
duke@435 209 public:
duke@435 210 Handle value() const { return _value; }
duke@435 211 bool is_constant_oop() const { return true; }
duke@435 212 bool equals(ScopeValue* other) const { return false; }
duke@435 213
duke@435 214 // Serialization of debugging information
duke@435 215 ConstantOopReadValue(DebugInfoReadStream* stream);
duke@435 216 void write_on(DebugInfoWriteStream* stream);
duke@435 217
duke@435 218 // Printing
duke@435 219 void print_on(outputStream* st) const;
duke@435 220 };
duke@435 221
duke@435 222 // MonitorValue describes the pair used for monitor_enter and monitor_exit.
duke@435 223
duke@435 224 class MonitorValue: public ResourceObj {
duke@435 225 private:
duke@435 226 ScopeValue* _owner;
duke@435 227 Location _basic_lock;
duke@435 228 bool _eliminated;
duke@435 229 public:
duke@435 230 // Constructor
duke@435 231 MonitorValue(ScopeValue* owner, Location basic_lock, bool eliminated = false);
duke@435 232
duke@435 233 // Accessors
duke@435 234 ScopeValue* owner() const { return _owner; }
duke@435 235 Location basic_lock() const { return _basic_lock; }
duke@435 236 bool eliminated() const { return _eliminated; }
duke@435 237
duke@435 238 // Serialization of debugging information
duke@435 239 MonitorValue(DebugInfoReadStream* stream);
duke@435 240 void write_on(DebugInfoWriteStream* stream);
duke@435 241
duke@435 242 // Printing
duke@435 243 void print_on(outputStream* st) const;
duke@435 244 };
duke@435 245
duke@435 246 // DebugInfoReadStream specializes CompressedReadStream for reading
duke@435 247 // debugging information. Used by ScopeDesc.
duke@435 248
duke@435 249 class DebugInfoReadStream : public CompressedReadStream {
duke@435 250 private:
duke@435 251 const nmethod* _code;
duke@435 252 const nmethod* code() const { return _code; }
duke@435 253 GrowableArray<ScopeValue*>* _obj_pool;
duke@435 254 public:
duke@435 255 DebugInfoReadStream(const nmethod* code, int offset, GrowableArray<ScopeValue*>* obj_pool = NULL) :
duke@435 256 CompressedReadStream(code->scopes_data_begin(), offset) {
duke@435 257 _code = code;
duke@435 258 _obj_pool = obj_pool;
duke@435 259
duke@435 260 } ;
duke@435 261
duke@435 262 oop read_oop() {
duke@435 263 return code()->oop_at(read_int());
duke@435 264 }
duke@435 265 ScopeValue* read_object_value();
duke@435 266 ScopeValue* get_cached_object();
duke@435 267 // BCI encoding is mostly unsigned, but -1 is a distinguished value
cfang@1366 268 int read_bci() { return read_int() + InvocationEntryBci; }
duke@435 269 };
duke@435 270
duke@435 271 // DebugInfoWriteStream specializes CompressedWriteStream for
duke@435 272 // writing debugging information. Used by ScopeDescRecorder.
duke@435 273
duke@435 274 class DebugInfoWriteStream : public CompressedWriteStream {
duke@435 275 private:
duke@435 276 DebugInformationRecorder* _recorder;
duke@435 277 DebugInformationRecorder* recorder() const { return _recorder; }
duke@435 278 public:
duke@435 279 DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size);
duke@435 280 void write_handle(jobject h);
cfang@1366 281 void write_bci(int bci) { write_int(bci - InvocationEntryBci); }
duke@435 282 };
stefank@2314 283
stefank@2314 284 #endif // SHARE_VM_CODE_DEBUGINFO_HPP

mercurial