Mercurial > hg > truffle
comparison src/share/vm/prims/jvmtiClassFileReconstituter.cpp @ 10226:187154b7a226
8009615: JvmtiClassFileReconstituter does not create BootstrapMethod attributes
Reviewed-by: coleenp, sspitsyn
author | sla |
---|---|
date | Mon, 06 May 2013 19:49:18 +0200 |
parents | c456f4510385 |
children | b5fef8013a95 |
comparison
equal
deleted
inserted
replaced
10220:800078be49d2 | 10226:187154b7a226 |
---|---|
339 write_attribute_name_index(attr_name); | 339 write_attribute_name_index(attr_name); |
340 write_u4(length); | 340 write_u4(length); |
341 memcpy(writeable_address(length), annos->adr_at(0), length); | 341 memcpy(writeable_address(length), annos->adr_at(0), length); |
342 } | 342 } |
343 | 343 |
344 // BootstrapMethods_attribute { | |
345 // u2 attribute_name_index; | |
346 // u4 attribute_length; | |
347 // u2 num_bootstrap_methods; | |
348 // { u2 bootstrap_method_ref; | |
349 // u2 num_bootstrap_arguments; | |
350 // u2 bootstrap_arguments[num_bootstrap_arguments]; | |
351 // } bootstrap_methods[num_bootstrap_methods]; | |
352 // } | |
353 void JvmtiClassFileReconstituter::write_boostrapmethod_attribute() { | |
354 Array<u2>* operands = cpool()->operands(); | |
355 write_attribute_name_index("BootstrapMethods"); | |
356 int num_bootstrap_methods = ConstantPool::operand_array_length(operands); | |
357 | |
358 // calculate length of attribute | |
359 int length = sizeof(u2); // num_boostrap_methods | |
360 for (int n = 0; n < num_bootstrap_methods; n++) { | |
361 u2 num_bootstrap_arguments = cpool()->operand_argument_count_at(n); | |
362 length += sizeof(u2); // bootstrap_method_ref | |
363 length += sizeof(u2); // num_bootstrap_arguments | |
364 length += sizeof(u2) * num_bootstrap_arguments; // bootstrap_arguments[num_bootstrap_arguments] | |
365 } | |
366 write_u4(length); | |
367 | |
368 // write attribute | |
369 write_u2(num_bootstrap_methods); | |
370 for (int n = 0; n < num_bootstrap_methods; n++) { | |
371 u2 bootstrap_method_ref = cpool()->operand_bootstrap_method_ref_index_at(n); | |
372 u2 num_bootstrap_arguments = cpool()->operand_argument_count_at(n); | |
373 write_u2(bootstrap_method_ref); | |
374 write_u2(num_bootstrap_arguments); | |
375 for (int arg = 0; arg < num_bootstrap_arguments; arg++) { | |
376 u2 bootstrap_argument = cpool()->operand_argument_index_at(n, arg); | |
377 write_u2(bootstrap_argument); | |
378 } | |
379 } | |
380 } | |
381 | |
344 | 382 |
345 // Write InnerClasses attribute | 383 // Write InnerClasses attribute |
346 // JVMSpec| InnerClasses_attribute { | 384 // JVMSpec| InnerClasses_attribute { |
347 // JVMSpec| u2 attribute_name_index; | 385 // JVMSpec| u2 attribute_name_index; |
348 // JVMSpec| u4 attribute_length; | 386 // JVMSpec| u4 attribute_length; |
595 ++attr_count; | 633 ++attr_count; |
596 } | 634 } |
597 if (anno != NULL) { | 635 if (anno != NULL) { |
598 ++attr_count; // has RuntimeVisibleAnnotations attribute | 636 ++attr_count; // has RuntimeVisibleAnnotations attribute |
599 } | 637 } |
638 if (cpool()->operands() != NULL) { | |
639 ++attr_count; | |
640 } | |
600 | 641 |
601 write_u2(attr_count); | 642 write_u2(attr_count); |
602 | 643 |
603 if (generic_signature != NULL) { | 644 if (generic_signature != NULL) { |
604 write_signature_attribute(symbol_to_cpool_index(generic_signature)); | 645 write_signature_attribute(symbol_to_cpool_index(generic_signature)); |
612 if (inner_classes_length > 0) { | 653 if (inner_classes_length > 0) { |
613 write_inner_classes_attribute(inner_classes_length); | 654 write_inner_classes_attribute(inner_classes_length); |
614 } | 655 } |
615 if (anno != NULL) { | 656 if (anno != NULL) { |
616 write_annotations_attribute("RuntimeVisibleAnnotations", anno); | 657 write_annotations_attribute("RuntimeVisibleAnnotations", anno); |
658 } | |
659 if (cpool()->operands() != NULL) { | |
660 write_boostrapmethod_attribute(); | |
617 } | 661 } |
618 } | 662 } |
619 | 663 |
620 // Write the method information portion of ClassFile structure | 664 // Write the method information portion of ClassFile structure |
621 // JVMSpec| u2 methods_count; | 665 // JVMSpec| u2 methods_count; |