comparison src/share/vm/code/debugInfo.cpp @ 7046:b6a8f2d23057

VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
author Lukas Stadler <lukas.stadler@jku.at>
date Tue, 27 Nov 2012 13:43:04 +0100
parents da91efe96a93
children b8f261ba79c6
comparison
equal deleted inserted replaced
7039:adf5c101bc4b 7046:b6a8f2d23057
75 75
76 // Serializing scope values 76 // Serializing scope values
77 77
78 enum { LOCATION_CODE = 0, CONSTANT_INT_CODE = 1, CONSTANT_OOP_CODE = 2, 78 enum { LOCATION_CODE = 0, CONSTANT_INT_CODE = 1, CONSTANT_OOP_CODE = 2,
79 CONSTANT_LONG_CODE = 3, CONSTANT_DOUBLE_CODE = 4, 79 CONSTANT_LONG_CODE = 3, CONSTANT_DOUBLE_CODE = 4,
80 OBJECT_CODE = 5, OBJECT_ID_CODE = 6 }; 80 OBJECT_CODE = 5, OBJECT_ID_CODE = 6,
81 #ifdef GRAAL
82 DEFERRED_READ_CODE = 7, DEFERRED_WRITE_CODE = 8
83 #endif // GRAAL
84 };
81 85
82 ScopeValue* ScopeValue::read_from(DebugInfoReadStream* stream) { 86 ScopeValue* ScopeValue::read_from(DebugInfoReadStream* stream) {
83 ScopeValue* result = NULL; 87 ScopeValue* result = NULL;
84 switch(stream->read_int()) { 88 switch(stream->read_int()) {
85 case LOCATION_CODE: result = new LocationValue(stream); break; 89 case LOCATION_CODE: result = new LocationValue(stream); break;
87 case CONSTANT_OOP_CODE: result = new ConstantOopReadValue(stream); break; 91 case CONSTANT_OOP_CODE: result = new ConstantOopReadValue(stream); break;
88 case CONSTANT_LONG_CODE: result = new ConstantLongValue(stream); break; 92 case CONSTANT_LONG_CODE: result = new ConstantLongValue(stream); break;
89 case CONSTANT_DOUBLE_CODE: result = new ConstantDoubleValue(stream); break; 93 case CONSTANT_DOUBLE_CODE: result = new ConstantDoubleValue(stream); break;
90 case OBJECT_CODE: result = stream->read_object_value(); break; 94 case OBJECT_CODE: result = stream->read_object_value(); break;
91 case OBJECT_ID_CODE: result = stream->get_cached_object(); break; 95 case OBJECT_ID_CODE: result = stream->get_cached_object(); break;
96 #ifdef GRAAL
97 case DEFERRED_READ_CODE: result = new DeferredReadValue(stream); break;
98 case DEFERRED_WRITE_CODE: result = new DeferredWriteValue(stream); break;
99 #endif // GRAAL
92 default: ShouldNotReachHere(); 100 default: ShouldNotReachHere();
93 } 101 }
94 return result; 102 return result;
95 } 103 }
96 104
106 } 114 }
107 115
108 void LocationValue::print_on(outputStream* st) const { 116 void LocationValue::print_on(outputStream* st) const {
109 location().print_on(st); 117 location().print_on(st);
110 } 118 }
119
120 #ifdef GRAAL
121
122 // DeferredLocationValue
123
124 DeferredLocationValue::DeferredLocationValue(DebugInfoReadStream* stream) {
125 _base = read_from(stream);
126 _index = read_from(stream);
127 _scale = stream->read_int();
128 _disp = stream->read_long();
129 }
130
131 void DeferredLocationValue::write_on(DebugInfoWriteStream* stream) {
132 _base->write_on(stream);
133 _index->write_on(stream);
134 stream->write_int(_scale);
135 stream->write_long(_disp);
136 }
137
138 void DeferredLocationValue::print_on(outputStream* st) const {
139 _base->print_on(st);
140 _index->print_on(st);
141 st->print("%i %i", _scale, _disp);
142 }
143
144 // DeferredReadValue
145
146 DeferredReadValue::DeferredReadValue(DebugInfoReadStream* stream)
147 : DeferredLocationValue(stream) {
148 }
149
150 void DeferredReadValue::write_on(DebugInfoWriteStream* st) {
151 DeferredLocationValue::write_on(st);
152 }
153
154 void DeferredReadValue::print_on(outputStream* st) const {
155 DeferredLocationValue::print_on(st);
156 }
157
158 // DeferredWriteValue
159
160 DeferredWriteValue::DeferredWriteValue(DebugInfoReadStream* stream)
161 : DeferredLocationValue(stream) {
162 _value = read_from(stream);
163 }
164
165 void DeferredWriteValue::write_on(DebugInfoWriteStream* st) {
166 DeferredLocationValue::write_on(st);
167 _value->write_on(st);
168 }
169
170 void DeferredWriteValue::print_on(outputStream* st) const {
171 DeferredLocationValue::print_on(st);
172 _value->print_on(st);
173 }
174
175 #endif // GRAAL
111 176
112 // ObjectValue 177 // ObjectValue
113 178
114 void ObjectValue::read_object(DebugInfoReadStream* stream) { 179 void ObjectValue::read_object(DebugInfoReadStream* stream) {
115 _klass = read_from(stream); 180 _klass = read_from(stream);