src/hotspot/share/code/debugInfo.cpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54786 ebf733a324d4
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
    54   oop o = code()->oop_at(read_int());
    54   oop o = code()->oop_at(read_int());
    55   assert(oopDesc::is_oop_or_null(o), "oop only");
    55   assert(oopDesc::is_oop_or_null(o), "oop only");
    56   return o;
    56   return o;
    57 }
    57 }
    58 
    58 
    59 ScopeValue* DebugInfoReadStream::read_object_value() {
    59 ScopeValue* DebugInfoReadStream::read_object_value(bool is_auto_box) {
    60   int id = read_int();
    60   int id = read_int();
    61 #ifdef ASSERT
    61 #ifdef ASSERT
    62   assert(_obj_pool != NULL, "object pool does not exist");
    62   assert(_obj_pool != NULL, "object pool does not exist");
    63   for (int i = _obj_pool->length() - 1; i >= 0; i--) {
    63   for (int i = _obj_pool->length() - 1; i >= 0; i--) {
    64     assert(_obj_pool->at(i)->as_ObjectValue()->id() != id, "should not be read twice");
    64     assert(_obj_pool->at(i)->as_ObjectValue()->id() != id, "should not be read twice");
    65   }
    65   }
    66 #endif
    66 #endif
    67   ObjectValue* result = new ObjectValue(id);
    67   ObjectValue* result = is_auto_box ? new AutoBoxObjectValue(id) : new ObjectValue(id);
    68   // Cache the object since an object field could reference it.
    68   // Cache the object since an object field could reference it.
    69   _obj_pool->push(result);
    69   _obj_pool->push(result);
    70   result->read_object(this);
    70   result->read_object(this);
    71   return result;
    71   return result;
    72 }
    72 }
    86 
    86 
    87 // Serializing scope values
    87 // Serializing scope values
    88 
    88 
    89 enum { LOCATION_CODE = 0, CONSTANT_INT_CODE = 1,  CONSTANT_OOP_CODE = 2,
    89 enum { LOCATION_CODE = 0, CONSTANT_INT_CODE = 1,  CONSTANT_OOP_CODE = 2,
    90                           CONSTANT_LONG_CODE = 3, CONSTANT_DOUBLE_CODE = 4,
    90                           CONSTANT_LONG_CODE = 3, CONSTANT_DOUBLE_CODE = 4,
    91                           OBJECT_CODE = 5,        OBJECT_ID_CODE = 6 };
    91                           OBJECT_CODE = 5,        OBJECT_ID_CODE = 6,
       
    92                           AUTO_BOX_OBJECT_CODE = 7 };
    92 
    93 
    93 ScopeValue* ScopeValue::read_from(DebugInfoReadStream* stream) {
    94 ScopeValue* ScopeValue::read_from(DebugInfoReadStream* stream) {
    94   ScopeValue* result = NULL;
    95   ScopeValue* result = NULL;
    95   switch(stream->read_int()) {
    96   switch(stream->read_int()) {
    96    case LOCATION_CODE:        result = new LocationValue(stream);        break;
    97    case LOCATION_CODE:        result = new LocationValue(stream);                        break;
    97    case CONSTANT_INT_CODE:    result = new ConstantIntValue(stream);     break;
    98    case CONSTANT_INT_CODE:    result = new ConstantIntValue(stream);                     break;
    98    case CONSTANT_OOP_CODE:    result = new ConstantOopReadValue(stream); break;
    99    case CONSTANT_OOP_CODE:    result = new ConstantOopReadValue(stream);                 break;
    99    case CONSTANT_LONG_CODE:   result = new ConstantLongValue(stream);    break;
   100    case CONSTANT_LONG_CODE:   result = new ConstantLongValue(stream);                    break;
   100    case CONSTANT_DOUBLE_CODE: result = new ConstantDoubleValue(stream);  break;
   101    case CONSTANT_DOUBLE_CODE: result = new ConstantDoubleValue(stream);                  break;
   101    case OBJECT_CODE:          result = stream->read_object_value();      break;
   102    case OBJECT_CODE:          result = stream->read_object_value(false /*is_auto_box*/); break;
   102    case OBJECT_ID_CODE:       result = stream->get_cached_object();      break;
   103    case AUTO_BOX_OBJECT_CODE: result = stream->read_object_value(true /*is_auto_box*/);  break;
       
   104    case OBJECT_ID_CODE:       result = stream->get_cached_object();                      break;
   103    default: ShouldNotReachHere();
   105    default: ShouldNotReachHere();
   104   }
   106   }
   105   return result;
   107   return result;
   106 }
   108 }
   107 
   109 
   140   if (_visited) {
   142   if (_visited) {
   141     stream->write_int(OBJECT_ID_CODE);
   143     stream->write_int(OBJECT_ID_CODE);
   142     stream->write_int(_id);
   144     stream->write_int(_id);
   143   } else {
   145   } else {
   144     _visited = true;
   146     _visited = true;
   145     stream->write_int(OBJECT_CODE);
   147     stream->write_int(is_auto_box() ? AUTO_BOX_OBJECT_CODE : OBJECT_CODE);
   146     stream->write_int(_id);
   148     stream->write_int(_id);
   147     _klass->write_on(stream);
   149     _klass->write_on(stream);
   148     int length = _field_values.length();
   150     int length = _field_values.length();
   149     stream->write_int(length);
   151     stream->write_int(length);
   150     for (int i = 0; i < length; i++) {
   152     for (int i = 0; i < length; i++) {
   152     }
   154     }
   153   }
   155   }
   154 }
   156 }
   155 
   157 
   156 void ObjectValue::print_on(outputStream* st) const {
   158 void ObjectValue::print_on(outputStream* st) const {
   157   st->print("obj[%d]", _id);
   159   st->print("%s[%d]", is_auto_box() ? "box_obj" : "obj", _id);
   158 }
   160 }
   159 
   161 
   160 void ObjectValue::print_fields_on(outputStream* st) const {
   162 void ObjectValue::print_fields_on(outputStream* st) const {
   161 #ifndef PRODUCT
   163 #ifndef PRODUCT
   162   if (_field_values.length() > 0) {
   164   if (_field_values.length() > 0) {
   221   {
   223   {
   222     // cannot use ThreadInVMfromNative here since in case of JVMCI compiler,
   224     // cannot use ThreadInVMfromNative here since in case of JVMCI compiler,
   223     // thread is already in VM state.
   225     // thread is already in VM state.
   224     ThreadInVMfromUnknown tiv;
   226     ThreadInVMfromUnknown tiv;
   225     assert(JNIHandles::resolve(value()) == NULL ||
   227     assert(JNIHandles::resolve(value()) == NULL ||
   226            Universe::heap()->is_in_reserved(JNIHandles::resolve(value())),
   228            Universe::heap()->is_in(JNIHandles::resolve(value())),
   227            "Should be in heap");
   229            "Should be in heap");
   228  }
   230  }
   229 #endif
   231 #endif
   230   stream->write_int(CONSTANT_OOP_CODE);
   232   stream->write_int(CONSTANT_OOP_CODE);
   231   stream->write_handle(value());
   233   stream->write_handle(value());
   242 // ConstantOopReadValue
   244 // ConstantOopReadValue
   243 
   245 
   244 ConstantOopReadValue::ConstantOopReadValue(DebugInfoReadStream* stream) {
   246 ConstantOopReadValue::ConstantOopReadValue(DebugInfoReadStream* stream) {
   245   _value = Handle(Thread::current(), stream->read_oop());
   247   _value = Handle(Thread::current(), stream->read_oop());
   246   assert(_value() == NULL ||
   248   assert(_value() == NULL ||
   247          Universe::heap()->is_in_reserved(_value()), "Should be in heap");
   249          Universe::heap()->is_in(_value()), "Should be in heap");
   248 }
   250 }
   249 
   251 
   250 void ConstantOopReadValue::write_on(DebugInfoWriteStream* stream) {
   252 void ConstantOopReadValue::write_on(DebugInfoWriteStream* stream) {
   251   ShouldNotReachHere();
   253   ShouldNotReachHere();
   252 }
   254 }