31
32 // Constructors
33
34 DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size)
35 : CompressedWriteStream(initial_size) {
36 _recorder = recorder;
37 }
38
39 // Serializing oops
40
41 void DebugInfoWriteStream::write_handle(jobject h) {
42 write_int(recorder()->oop_recorder()->find_index(h));
43 }
44
45 void DebugInfoWriteStream::write_metadata(Metadata* h) {
46 write_int(recorder()->oop_recorder()->find_index(h));
47 }
48
49 oop DebugInfoReadStream::read_oop() {
50 oop o = code()->oop_at(read_int());
51 assert(o->is_oop_or_null(), "oop only");
52 return o;
53 }
54
55 ScopeValue* DebugInfoReadStream::read_object_value() {
56 int id = read_int();
57 #ifdef ASSERT
58 assert(_obj_pool != NULL, "object pool does not exist");
59 for (int i = _obj_pool->length() - 1; i >= 0; i--) {
60 assert(_obj_pool->at(i)->as_ObjectValue()->id() != id, "should not be read twice");
61 }
62 #endif
63 ObjectValue* result = new ObjectValue(id);
64 // Cache the object since an object field could reference it.
65 _obj_pool->push(result);
66 result->read_object(this);
67 return result;
68 }
69
70 ScopeValue* DebugInfoReadStream::get_cached_object() {
71 int id = read_int();
|
31
32 // Constructors
33
34 DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size)
35 : CompressedWriteStream(initial_size) {
36 _recorder = recorder;
37 }
38
39 // Serializing oops
40
41 void DebugInfoWriteStream::write_handle(jobject h) {
42 write_int(recorder()->oop_recorder()->find_index(h));
43 }
44
45 void DebugInfoWriteStream::write_metadata(Metadata* h) {
46 write_int(recorder()->oop_recorder()->find_index(h));
47 }
48
49 oop DebugInfoReadStream::read_oop() {
50 oop o = code()->oop_at(read_int());
51 assert(oopDesc::is_oop_or_null(o), "oop only");
52 return o;
53 }
54
55 ScopeValue* DebugInfoReadStream::read_object_value() {
56 int id = read_int();
57 #ifdef ASSERT
58 assert(_obj_pool != NULL, "object pool does not exist");
59 for (int i = _obj_pool->length() - 1; i >= 0; i--) {
60 assert(_obj_pool->at(i)->as_ObjectValue()->id() != id, "should not be read twice");
61 }
62 #endif
63 ObjectValue* result = new ObjectValue(id);
64 // Cache the object since an object field could reference it.
65 _obj_pool->push(result);
66 result->read_object(this);
67 return result;
68 }
69
70 ScopeValue* DebugInfoReadStream::get_cached_object() {
71 int id = read_int();
|