42 43 void DebugInfoWriteStream::write_handle(jobject h) { 44 write_int(recorder()->oop_recorder()->find_index(h)); 45 } 46 47 void DebugInfoWriteStream::write_metadata(Metadata* h) { 48 write_int(recorder()->oop_recorder()->find_index(h)); 49 } 50 51 oop DebugInfoReadStream::read_oop() { 52 oop o = code()->oop_at(read_int()); 53 assert(o->is_oop_or_null(), "oop only"); 54 return o; 55 } 56 57 ScopeValue* DebugInfoReadStream::read_object_value() { 58 int id = read_int(); 59 #ifdef ASSERT 60 assert(_obj_pool != NULL, "object pool does not exist"); 61 for (int i = _obj_pool->length() - 1; i >= 0; i--) { 62 assert(((ObjectValue*) _obj_pool->at(i))->id() != id, "should not be read twice"); 63 } 64 #endif 65 ObjectValue* result = new ObjectValue(id); 66 // Cache the object since an object field could reference it. 67 _obj_pool->push(result); 68 result->read_object(this); 69 return result; 70 } 71 72 ScopeValue* DebugInfoReadStream::get_cached_object() { 73 int id = read_int(); 74 assert(_obj_pool != NULL, "object pool does not exist"); 75 for (int i = _obj_pool->length() - 1; i >= 0; i--) { 76 ObjectValue* ov = (ObjectValue*) _obj_pool->at(i); 77 if (ov->id() == id) { 78 return ov; 79 } 80 } 81 ShouldNotReachHere(); 82 return NULL; 83 } 84 85 // Serializing scope values 86 87 enum { LOCATION_CODE = 0, CONSTANT_INT_CODE = 1, CONSTANT_OOP_CODE = 2, 88 CONSTANT_LONG_CODE = 3, CONSTANT_DOUBLE_CODE = 4, 89 OBJECT_CODE = 5, OBJECT_ID_CODE = 6 }; 90 91 ScopeValue* ScopeValue::read_from(DebugInfoReadStream* stream) { 92 ScopeValue* result = NULL; 93 switch(stream->read_int()) { 94 case LOCATION_CODE: result = new LocationValue(stream); break; 95 case CONSTANT_INT_CODE: result = new ConstantIntValue(stream); break; 96 case CONSTANT_OOP_CODE: result = new ConstantOopReadValue(stream); break; | 42 43 void DebugInfoWriteStream::write_handle(jobject h) { 44 write_int(recorder()->oop_recorder()->find_index(h)); 45 } 46 47 void DebugInfoWriteStream::write_metadata(Metadata* h) { 48 write_int(recorder()->oop_recorder()->find_index(h)); 49 } 50 51 oop DebugInfoReadStream::read_oop() { 52 oop o = code()->oop_at(read_int()); 53 assert(o->is_oop_or_null(), "oop only"); 54 return o; 55 } 56 57 ScopeValue* DebugInfoReadStream::read_object_value() { 58 int id = read_int(); 59 #ifdef ASSERT 60 assert(_obj_pool != NULL, "object pool does not exist"); 61 for (int i = _obj_pool->length() - 1; i >= 0; i--) { 62 assert(_obj_pool->at(i)->as_ObjectValue()->id() != id, "should not be read twice"); 63 } 64 #endif 65 ObjectValue* result = new ObjectValue(id); 66 // Cache the object since an object field could reference it. 67 _obj_pool->push(result); 68 result->read_object(this); 69 return result; 70 } 71 72 ScopeValue* DebugInfoReadStream::get_cached_object() { 73 int id = read_int(); 74 assert(_obj_pool != NULL, "object pool does not exist"); 75 for (int i = _obj_pool->length() - 1; i >= 0; i--) { 76 ObjectValue* ov = _obj_pool->at(i)->as_ObjectValue(); 77 if (ov->id() == id) { 78 return ov; 79 } 80 } 81 ShouldNotReachHere(); 82 return NULL; 83 } 84 85 // Serializing scope values 86 87 enum { LOCATION_CODE = 0, CONSTANT_INT_CODE = 1, CONSTANT_OOP_CODE = 2, 88 CONSTANT_LONG_CODE = 3, CONSTANT_DOUBLE_CODE = 4, 89 OBJECT_CODE = 5, OBJECT_ID_CODE = 6 }; 90 91 ScopeValue* ScopeValue::read_from(DebugInfoReadStream* stream) { 92 ScopeValue* result = NULL; 93 switch(stream->read_int()) { 94 case LOCATION_CODE: result = new LocationValue(stream); break; 95 case CONSTANT_INT_CODE: result = new ConstantIntValue(stream); break; 96 case CONSTANT_OOP_CODE: result = new ConstantOopReadValue(stream); break; |