25 #ifndef SHARE_CODE_DEBUGINFO_HPP 26 #define SHARE_CODE_DEBUGINFO_HPP 27 28 #include "code/compressedStream.hpp" 29 #include "code/location.hpp" 30 #include "code/nmethod.hpp" 31 #include "code/oopRecorder.hpp" 32 #include "runtime/stackValue.hpp" 33 #include "runtime/thread.hpp" 34 #include "utilities/growableArray.hpp" 35 36 // Classes used for serializing debugging information. 37 // These abstractions are introducted to provide symmetric 38 // read and write operations. 39 40 // ScopeValue describes the value of a variable/expression in a scope 41 // - LocationValue describes a value in a given location (in frame or register) 42 // - ConstantValue describes a constant 43 44 class ConstantOopReadValue; 45 class ObjectValue; 46 47 class ScopeValue: public ResourceObj { 48 public: 49 // Testers 50 virtual bool is_location() const { return false; } 51 virtual bool is_object() const { return false; } 52 virtual bool is_auto_box() const { return false; } 53 virtual bool is_marker() const { return false; } 54 virtual bool is_constant_int() const { return false; } 55 virtual bool is_constant_double() const { return false; } 56 virtual bool is_constant_long() const { return false; } 57 virtual bool is_constant_oop() const { return false; } 58 virtual bool equals(ScopeValue* other) const { return false; } 59 60 ConstantOopReadValue* as_ConstantOopReadValue() { 61 assert(is_constant_oop(), "must be"); 62 return (ConstantOopReadValue*) this; 63 } 64 65 ObjectValue* as_ObjectValue() { 66 assert(is_object(), "must be"); 67 return (ObjectValue*)this; 68 } 69 70 // Serialization of debugging information 71 virtual void write_on(DebugInfoWriteStream* stream) = 0; 72 static ScopeValue* read_from(DebugInfoReadStream* stream); 73 }; 74 75 76 // A Location value describes a value in a given location; i.e. the corresponding 77 // logical entity (e.g., a method temporary) lives in this location. 78 79 class LocationValue: public ScopeValue { 80 private: 81 Location _location; 82 public: 83 LocationValue(Location location) { _location = location; } 84 bool is_location() const { return true; } 85 Location location() const { return _location; } 86 87 // Serialization of debugging information 88 LocationValue(DebugInfoReadStream* stream); 89 void write_on(DebugInfoWriteStream* stream); | 25 #ifndef SHARE_CODE_DEBUGINFO_HPP 26 #define SHARE_CODE_DEBUGINFO_HPP 27 28 #include "code/compressedStream.hpp" 29 #include "code/location.hpp" 30 #include "code/nmethod.hpp" 31 #include "code/oopRecorder.hpp" 32 #include "runtime/stackValue.hpp" 33 #include "runtime/thread.hpp" 34 #include "utilities/growableArray.hpp" 35 36 // Classes used for serializing debugging information. 37 // These abstractions are introducted to provide symmetric 38 // read and write operations. 39 40 // ScopeValue describes the value of a variable/expression in a scope 41 // - LocationValue describes a value in a given location (in frame or register) 42 // - ConstantValue describes a constant 43 44 class ConstantOopReadValue; 45 class LocationValue; 46 class ObjectValue; 47 48 class ScopeValue: public ResourceObj { 49 public: 50 // Testers 51 virtual bool is_location() const { return false; } 52 virtual bool is_object() const { return false; } 53 virtual bool is_auto_box() const { return false; } 54 virtual bool is_marker() const { return false; } 55 virtual bool is_constant_int() const { return false; } 56 virtual bool is_constant_double() const { return false; } 57 virtual bool is_constant_long() const { return false; } 58 virtual bool is_constant_oop() const { return false; } 59 virtual bool equals(ScopeValue* other) const { return false; } 60 61 ConstantOopReadValue* as_ConstantOopReadValue() { 62 assert(is_constant_oop(), "must be"); 63 return (ConstantOopReadValue*) this; 64 } 65 66 ObjectValue* as_ObjectValue() { 67 assert(is_object(), "must be"); 68 return (ObjectValue*)this; 69 } 70 71 LocationValue* as_LocationValue() { 72 assert(is_location(), "must be"); 73 return (LocationValue*)this; 74 } 75 76 // Serialization of debugging information 77 virtual void write_on(DebugInfoWriteStream* stream) = 0; 78 static ScopeValue* read_from(DebugInfoReadStream* stream); 79 }; 80 81 82 // A Location value describes a value in a given location; i.e. the corresponding 83 // logical entity (e.g., a method temporary) lives in this location. 84 85 class LocationValue: public ScopeValue { 86 private: 87 Location _location; 88 public: 89 LocationValue(Location location) { _location = location; } 90 bool is_location() const { return true; } 91 Location location() const { return _location; } 92 93 // Serialization of debugging information 94 LocationValue(DebugInfoReadStream* stream); 95 void write_on(DebugInfoWriteStream* stream); |