src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp
changeset 50735 2f2af62dfac7
parent 49480 d7df2dd501ce
child 51329 9c68699bebe5
equal deleted inserted replaced
50734:0828a0f6676b 50735:2f2af62dfac7
   386       write_u2(bootstrap_argument);
   386       write_u2(bootstrap_argument);
   387     }
   387     }
   388   }
   388   }
   389 }
   389 }
   390 
   390 
       
   391 //  NestHost_attribute {
       
   392 //    u2 attribute_name_index;
       
   393 //    u4 attribute_length;
       
   394 //    u2 host_class_index;
       
   395 //  }
       
   396 void JvmtiClassFileReconstituter::write_nest_host_attribute() {
       
   397   int length = sizeof(u2);
       
   398   int host_class_index = ik()->nest_host_index();
       
   399 
       
   400   write_attribute_name_index("NestHost");
       
   401   write_u4(length);
       
   402   write_u2(host_class_index);
       
   403 }
       
   404 
       
   405 //  NestMembers_attribute {
       
   406 //    u2 attribute_name_index;
       
   407 //    u4 attribute_length;
       
   408 //    u2 number_of_classes;
       
   409 //    u2 classes[number_of_classes];
       
   410 //  }
       
   411 void JvmtiClassFileReconstituter::write_nest_members_attribute() {
       
   412   Array<u2>* nest_members = ik()->nest_members();
       
   413   int number_of_classes = nest_members->length();
       
   414   int length = sizeof(u2) * (1 + number_of_classes);
       
   415 
       
   416   write_attribute_name_index("NestMembers");
       
   417   write_u4(length);
       
   418   write_u2(number_of_classes);
       
   419   for (int i = 0; i < number_of_classes; i++) {
       
   420     u2 class_cp_index = nest_members->at(i);
       
   421     write_u2(class_cp_index);
       
   422   }
       
   423 }
       
   424 
   391 
   425 
   392 // Write InnerClasses attribute
   426 // Write InnerClasses attribute
   393 // JVMSpec|   InnerClasses_attribute {
   427 // JVMSpec|   InnerClasses_attribute {
   394 // JVMSpec|     u2 attribute_name_index;
   428 // JVMSpec|     u2 attribute_name_index;
   395 // JVMSpec|     u4 attribute_length;
   429 // JVMSpec|     u4 attribute_length;
   656     ++attr_count;     // has RuntimeVisibleTypeAnnotations attribute
   690     ++attr_count;     // has RuntimeVisibleTypeAnnotations attribute
   657   }
   691   }
   658   if (cpool()->operands() != NULL) {
   692   if (cpool()->operands() != NULL) {
   659     ++attr_count;
   693     ++attr_count;
   660   }
   694   }
       
   695   if (ik()->nest_host_index() != 0) {
       
   696     ++attr_count;
       
   697   }
       
   698   if (ik()->nest_members() != Universe::the_empty_short_array()) {
       
   699     ++attr_count;
       
   700   }
   661 
   701 
   662   write_u2(attr_count);
   702   write_u2(attr_count);
   663 
   703 
   664   if (generic_signature != NULL) {
   704   if (generic_signature != NULL) {
   665     write_signature_attribute(symbol_to_cpool_index(generic_signature));
   705     write_signature_attribute(symbol_to_cpool_index(generic_signature));
   679   if (type_anno != NULL) {
   719   if (type_anno != NULL) {
   680     write_annotations_attribute("RuntimeVisibleTypeAnnotations", type_anno);
   720     write_annotations_attribute("RuntimeVisibleTypeAnnotations", type_anno);
   681   }
   721   }
   682   if (cpool()->operands() != NULL) {
   722   if (cpool()->operands() != NULL) {
   683     write_bootstrapmethod_attribute();
   723     write_bootstrapmethod_attribute();
       
   724   }
       
   725   if (ik()->nest_host_index() != 0) {
       
   726     write_nest_host_attribute();
       
   727   }
       
   728   if (ik()->nest_members() != Universe::the_empty_short_array()) {
       
   729     write_nest_members_attribute();
   684   }
   730   }
   685 }
   731 }
   686 
   732 
   687 // Write the method information portion of ClassFile structure
   733 // Write the method information portion of ClassFile structure
   688 // JVMSpec|     u2 methods_count;
   734 // JVMSpec|     u2 methods_count;