hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp
changeset 8076 96d498ec7ae1
parent 7397 5b173b4ca846
child 8107 78e5bd944384
equal deleted inserted replaced
8075:582dd25571b2 8076:96d498ec7ae1
   459 // Write the class attributes portion of ClassFile structure
   459 // Write the class attributes portion of ClassFile structure
   460 // JVMSpec|     u2 attributes_count;
   460 // JVMSpec|     u2 attributes_count;
   461 // JVMSpec|     attribute_info attributes[attributes_count];
   461 // JVMSpec|     attribute_info attributes[attributes_count];
   462 void JvmtiClassFileReconstituter::write_class_attributes() {
   462 void JvmtiClassFileReconstituter::write_class_attributes() {
   463   u2 inner_classes_length = inner_classes_attribute_length();
   463   u2 inner_classes_length = inner_classes_attribute_length();
   464   symbolHandle generic_signature(thread(), ikh()->generic_signature());
   464   Symbol* generic_signature = ikh()->generic_signature();
   465   typeArrayHandle anno(thread(), ikh()->class_annotations());
   465   typeArrayHandle anno(thread(), ikh()->class_annotations());
   466 
   466 
   467   int attr_count = 0;
   467   int attr_count = 0;
   468   if (generic_signature() != NULL) {
   468   if (generic_signature != NULL) {
   469     ++attr_count;
   469     ++attr_count;
   470   }
   470   }
   471   if (ikh()->source_file_name() != NULL) {
   471   if (ikh()->source_file_name() != NULL) {
   472     ++attr_count;
   472     ++attr_count;
   473   }
   473   }
   481     ++attr_count;     // has RuntimeVisibleAnnotations attribute
   481     ++attr_count;     // has RuntimeVisibleAnnotations attribute
   482   }
   482   }
   483 
   483 
   484   write_u2(attr_count);
   484   write_u2(attr_count);
   485 
   485 
   486   if (generic_signature() != NULL) {
   486   if (generic_signature != NULL) {
   487     write_signature_attribute(symbol_to_cpool_index(generic_signature()));
   487     write_signature_attribute(symbol_to_cpool_index(generic_signature));
   488   }
   488   }
   489   if (ikh()->source_file_name() != NULL) {
   489   if (ikh()->source_file_name() != NULL) {
   490     write_source_file_attribute();
   490     write_source_file_attribute();
   491   }
   491   }
   492   if (ikh()->source_debug_extension() != NULL) {
   492   if (ikh()->source_debug_extension() != NULL) {
   607   _buffer_ptr += size;
   607   _buffer_ptr += size;
   608   return ret_ptr;
   608   return ret_ptr;
   609 }
   609 }
   610 
   610 
   611 void JvmtiClassFileReconstituter::write_attribute_name_index(const char* name) {
   611 void JvmtiClassFileReconstituter::write_attribute_name_index(const char* name) {
   612   unsigned int hash_ignored;
   612   TempNewSymbol sym = SymbolTable::probe(name, (int)strlen(name));
   613   symbolOop sym = SymbolTable::lookup_only(name, (int)strlen(name), hash_ignored);
       
   614   assert(sym != NULL, "attribute name symbol not found");
   613   assert(sym != NULL, "attribute name symbol not found");
   615   u2 attr_name_index = symbol_to_cpool_index(sym);
   614   u2 attr_name_index = symbol_to_cpool_index(sym);
   616   assert(attr_name_index != 0, "attribute name symbol not in constant pool");
   615   assert(attr_name_index != 0, "attribute name symbol not in constant pool");
   617   write_u2(attr_name_index);
   616   write_u2(attr_name_index);
   618 }
   617 }