1 /*
2 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
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 };
|
1 /*
2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
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 };
|