This commit is contained in:
Vladimir Kozlov 2009-08-06 09:37:26 -07:00
commit ab7a29cdcc
51 changed files with 1539 additions and 386 deletions

View file

@ -255,7 +255,8 @@ class DebugInfoReadStream : public CompressedReadStream {
ScopeValue* read_object_value();
ScopeValue* get_cached_object();
// BCI encoding is mostly unsigned, but -1 is a distinguished value
int read_bci() { return read_int() + InvocationEntryBci; }
// Decoding based on encoding: bci = InvocationEntryBci + read_int()/2; reexecute = read_int()%2 == 1 ? true : false;
int read_bci_and_reexecute(bool& reexecute) { int i = read_int(); reexecute = (i & 1) ? true : false; return (i >> 1) + InvocationEntryBci; }
};
// DebugInfoWriteStream specializes CompressedWriteStream for
@ -268,5 +269,6 @@ class DebugInfoWriteStream : public CompressedWriteStream {
public:
DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size);
void write_handle(jobject h);
void write_bci(int bci) { write_int(bci - InvocationEntryBci); }
//Encoding bci and reexecute into one word as (bci - InvocationEntryBci)*2 + reexecute
void write_bci_and_reexecute(int bci, bool reexecute) { write_int(((bci - InvocationEntryBci) << 1) + (reexecute ? 1 : 0)); }
};

View file

@ -280,6 +280,7 @@ int DebugInformationRecorder::find_sharable_decode_offset(int stream_offset) {
void DebugInformationRecorder::describe_scope(int pc_offset,
ciMethod* method,
int bci,
bool reexecute,
DebugToken* locals,
DebugToken* expressions,
DebugToken* monitors) {
@ -297,7 +298,7 @@ void DebugInformationRecorder::describe_scope(int pc_offset,
// serialize scope
jobject method_enc = (method == NULL)? NULL: method->encoding();
stream()->write_int(oop_recorder()->find_index(method_enc));
stream()->write_bci(bci);
stream()->write_bci_and_reexecute(bci, reexecute);
assert(method == NULL ||
(method->is_native() && bci == 0) ||
(!method->is_native() && 0 <= bci && bci < method->code_size()) ||

View file

@ -87,6 +87,7 @@ class DebugInformationRecorder: public ResourceObj {
void describe_scope(int pc_offset,
ciMethod* method,
int bci,
bool reexecute,
DebugToken* locals = NULL,
DebugToken* expressions = NULL,
DebugToken* monitors = NULL);

View file

@ -46,6 +46,7 @@ ScopeDesc::ScopeDesc(const ScopeDesc* parent) {
_decode_offset = parent->_sender_decode_offset;
_objects = parent->_objects;
decode_body();
assert(_reexecute == false, "reexecute not allowed");
}
@ -56,6 +57,7 @@ void ScopeDesc::decode_body() {
_sender_decode_offset = DebugInformationRecorder::serialized_null;
_method = methodHandle(_code->method());
_bci = InvocationEntryBci;
_reexecute = false;
_locals_decode_offset = DebugInformationRecorder::serialized_null;
_expressions_decode_offset = DebugInformationRecorder::serialized_null;
_monitors_decode_offset = DebugInformationRecorder::serialized_null;
@ -65,7 +67,8 @@ void ScopeDesc::decode_body() {
_sender_decode_offset = stream->read_int();
_method = methodHandle((methodOop) stream->read_oop());
_bci = stream->read_bci();
_bci = stream->read_bci_and_reexecute(_reexecute);
// decode offsets for body and sender
_locals_decode_offset = stream->read_int();
_expressions_decode_offset = stream->read_int();
@ -170,6 +173,7 @@ void ScopeDesc::print_on(outputStream* st, PcDesc* pd) const {
st->print("ScopeDesc[%d]@" PTR_FORMAT " ", _decode_offset, _code->instructions_begin());
st->print_cr(" offset: %d", _decode_offset);
st->print_cr(" bci: %d", bci());
st->print_cr(" reexecute: %s", should_reexecute() ? "true" : "false");
st->print_cr(" locals: %d", _locals_decode_offset);
st->print_cr(" stack: %d", _expressions_decode_offset);
st->print_cr(" monitor: %d", _monitors_decode_offset);

View file

@ -39,7 +39,8 @@ class SimpleScopeDesc : public StackObj {
DebugInfoReadStream buffer(code, pc_desc->scope_decode_offset());
int ignore_sender = buffer.read_int();
_method = methodOop(buffer.read_oop());
_bci = buffer.read_bci();
bool dummy_reexecute; //only methodOop and bci are needed!
_bci = buffer.read_bci_and_reexecute(dummy_reexecute);
}
methodOop method() { return _method; }
@ -60,8 +61,9 @@ class ScopeDesc : public ResourceObj {
ScopeDesc(const nmethod* code, int decode_offset);
// JVM state
methodHandle method() const { return _method; }
int bci() const { return _bci; }
methodHandle method() const { return _method; }
int bci() const { return _bci; }
bool should_reexecute() const { return _reexecute; }
GrowableArray<ScopeValue*>* locals();
GrowableArray<ScopeValue*>* expressions();
@ -86,6 +88,7 @@ class ScopeDesc : public ResourceObj {
// JVM state
methodHandle _method;
int _bci;
bool _reexecute;
// Decoding offsets
int _decode_offset;