238 239 class DebugInfoReadStream : public CompressedReadStream { 240 private: 241 const nmethod* _code; 242 const nmethod* code() const { return _code; } 243 GrowableArray<ScopeValue*>* _obj_pool; 244 public: 245 DebugInfoReadStream(const nmethod* code, int offset, GrowableArray<ScopeValue*>* obj_pool = NULL) : 246 CompressedReadStream(code->scopes_data_begin(), offset) { 247 _code = code; 248 _obj_pool = obj_pool; 249 250 } ; 251 252 oop read_oop() { 253 return code()->oop_at(read_int()); 254 } 255 ScopeValue* read_object_value(); 256 ScopeValue* get_cached_object(); 257 // BCI encoding is mostly unsigned, but -1 is a distinguished value 258 int read_bci() { return read_int() + InvocationEntryBci; } 259 }; 260 261 // DebugInfoWriteStream specializes CompressedWriteStream for 262 // writing debugging information. Used by ScopeDescRecorder. 263 264 class DebugInfoWriteStream : public CompressedWriteStream { 265 private: 266 DebugInformationRecorder* _recorder; 267 DebugInformationRecorder* recorder() const { return _recorder; } 268 public: 269 DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size); 270 void write_handle(jobject h); 271 void write_bci(int bci) { write_int(bci - InvocationEntryBci); } 272 }; | 238 239 class DebugInfoReadStream : public CompressedReadStream { 240 private: 241 const nmethod* _code; 242 const nmethod* code() const { return _code; } 243 GrowableArray<ScopeValue*>* _obj_pool; 244 public: 245 DebugInfoReadStream(const nmethod* code, int offset, GrowableArray<ScopeValue*>* obj_pool = NULL) : 246 CompressedReadStream(code->scopes_data_begin(), offset) { 247 _code = code; 248 _obj_pool = obj_pool; 249 250 } ; 251 252 oop read_oop() { 253 return code()->oop_at(read_int()); 254 } 255 ScopeValue* read_object_value(); 256 ScopeValue* get_cached_object(); 257 // BCI encoding is mostly unsigned, but -1 is a distinguished value 258 // Decoding based on encoding: bci = InvocationEntryBci + read_int()/2; reexecute = read_int()%2 == 1 ? true : false; 259 int read_bci_and_reexecute(bool& reexecute) { int i = read_int(); reexecute = (i & 1) ? true : false; return (i >> 1) + InvocationEntryBci; } 260 }; 261 262 // DebugInfoWriteStream specializes CompressedWriteStream for 263 // writing debugging information. Used by ScopeDescRecorder. 264 265 class DebugInfoWriteStream : public CompressedWriteStream { 266 private: 267 DebugInformationRecorder* _recorder; 268 DebugInformationRecorder* recorder() const { return _recorder; } 269 public: 270 DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size); 271 void write_handle(jobject h); 272 //Encoding bci and reexecute into one word as (bci - InvocationEntryBci)*2 + reexecute 273 void write_bci_and_reexecute(int bci, bool reexecute) { write_int(((bci - InvocationEntryBci) << 1) + (reexecute ? 1 : 0)); } 274 }; |