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