src/share/vm/prims/jvmtiClassFileReconstituter.cpp

Print this page




 251 }
 252 
 253 // Write SourceFile attribute
 254 // JVMSpec|   SourceFile_attribute {
 255 // JVMSpec|     u2 attribute_name_index;
 256 // JVMSpec|     u4 attribute_length;
 257 // JVMSpec|     u2 sourcefile_index;
 258 // JVMSpec|   }
 259 void JvmtiClassFileReconstituter::write_source_file_attribute() {
 260   assert(ikh()->source_file_name() != NULL, "caller must check");
 261 
 262   write_attribute_name_index("SourceFile");
 263   write_u4(2);  // always length 2
 264   write_u2(symbol_to_cpool_index(ikh()->source_file_name()));
 265 }
 266 
 267 // Write SourceDebugExtension attribute
 268 // JSR45|   SourceDebugExtension_attribute {
 269 // JSR45|       u2 attribute_name_index;
 270 // JSR45|       u4 attribute_length;
 271 // JSR45|       u2 sourcefile_index;
 272 // JSR45|   }
 273 void JvmtiClassFileReconstituter::write_source_debug_extension_attribute() {
 274   assert(ikh()->source_debug_extension() != NULL, "caller must check");
 275 
 276   write_attribute_name_index("SourceDebugExtension");
 277   write_u4(2);  // always length 2
 278   write_u2(symbol_to_cpool_index(ikh()->source_debug_extension()));




 279 }
 280 
 281 // Write (generic) Signature attribute
 282 // JVMSpec|   Signature_attribute {
 283 // JVMSpec|     u2 attribute_name_index;
 284 // JVMSpec|     u4 attribute_length;
 285 // JVMSpec|     u2 signature_index;
 286 // JVMSpec|   }
 287 void JvmtiClassFileReconstituter::write_signature_attribute(u2 generic_signature_index) {
 288   write_attribute_name_index("Signature");
 289   write_u4(2);  // always length 2
 290   write_u2(generic_signature_index);
 291 }
 292 
 293 // Compute the number of entries in the InnerClasses attribute
 294 u2 JvmtiClassFileReconstituter::inner_classes_attribute_length() {
 295   InnerClassesIterator iter(ikh());
 296   return iter.length();
 297 }
 298 




 251 }
 252 
 253 // Write SourceFile attribute
 254 // JVMSpec|   SourceFile_attribute {
 255 // JVMSpec|     u2 attribute_name_index;
 256 // JVMSpec|     u4 attribute_length;
 257 // JVMSpec|     u2 sourcefile_index;
 258 // JVMSpec|   }
 259 void JvmtiClassFileReconstituter::write_source_file_attribute() {
 260   assert(ikh()->source_file_name() != NULL, "caller must check");
 261 
 262   write_attribute_name_index("SourceFile");
 263   write_u4(2);  // always length 2
 264   write_u2(symbol_to_cpool_index(ikh()->source_file_name()));
 265 }
 266 
 267 // Write SourceDebugExtension attribute
 268 // JSR45|   SourceDebugExtension_attribute {
 269 // JSR45|       u2 attribute_name_index;
 270 // JSR45|       u4 attribute_length;
 271 // JSR45|       u1 debug_extension[attribute_length];
 272 // JSR45|   }
 273 void JvmtiClassFileReconstituter::write_source_debug_extension_attribute() {
 274   assert(ikh()->source_debug_extension() != NULL, "caller must check");
 275 
 276   write_attribute_name_index("SourceDebugExtension");
 277   int len = (int)strlen(ikh()->source_debug_extension());
 278   write_u4(len);
 279   u1* ext = (u1*)ikh()->source_debug_extension();
 280   for (int i=0; i<len; i++) {
 281     write_u1(ext[i]);
 282   }
 283 }
 284 
 285 // Write (generic) Signature attribute
 286 // JVMSpec|   Signature_attribute {
 287 // JVMSpec|     u2 attribute_name_index;
 288 // JVMSpec|     u4 attribute_length;
 289 // JVMSpec|     u2 signature_index;
 290 // JVMSpec|   }
 291 void JvmtiClassFileReconstituter::write_signature_attribute(u2 generic_signature_index) {
 292   write_attribute_name_index("Signature");
 293   write_u4(2);  // always length 2
 294   write_u2(generic_signature_index);
 295 }
 296 
 297 // Compute the number of entries in the InnerClasses attribute
 298 u2 JvmtiClassFileReconstituter::inner_classes_attribute_length() {
 299   InnerClassesIterator iter(ikh());
 300   return iter.length();
 301 }
 302