comparison src/share/vm/prims/jvmtiClassFileReconstituter.cpp @ 2177:3582bf76420e

6990754: Use native memory and reference counting to implement SymbolTable Summary: move symbols from permgen into C heap and reference count them Reviewed-by: never, acorn, jmasa, stefank
author coleenp
date Thu, 27 Jan 2011 16:11:27 -0800
parents f95d63e2154a
children b92c45f2bc75
comparison
equal deleted inserted replaced
2176:27e4ea99855d 2177:3582bf76420e
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 }