< prev index next >

src/share/vm/oops/constantPool.cpp

Print this page
rev 10979 : 8140594: Various minor code improvements (compiler)


  63 
  64 #ifdef ASSERT
  65 
  66 // MetaspaceObj allocation invariant is calloc equivalent memory
  67 // simple verification of this here (JVM_CONSTANT_Invalid == 0 )
  68 static bool tag_array_is_zero_initialized(Array<u1>* tags) {
  69   assert(tags != NULL, "invariant");
  70   const int length = tags->length();
  71   for (int index = 0; index < length; ++index) {
  72     if (JVM_CONSTANT_Invalid != tags->at(index)) {
  73       return false;
  74     }
  75   }
  76   return true;
  77 }
  78 
  79 #endif
  80 
  81 ConstantPool::ConstantPool(Array<u1>* tags) :
  82   _tags(tags),
  83   _length(tags->length()) {

  84 
  85     assert(_tags != NULL, "invariant");
  86     assert(tags->length() == _length, "invariant");
  87     assert(tag_array_is_zero_initialized(tags), "invariant");
  88     assert(0 == _flags, "invariant");
  89     assert(0 == version(), "invariant");
  90     assert(NULL == _pool_holder, "invariant");
  91 }
  92 
  93 void ConstantPool::deallocate_contents(ClassLoaderData* loader_data) {
  94   MetadataFactory::free_metadata(loader_data, cache());
  95   set_cache(NULL);
  96   MetadataFactory::free_array<u2>(loader_data, reference_map());
  97   set_reference_map(NULL);
  98 
  99   MetadataFactory::free_array<jushort>(loader_data, operands());
 100   set_operands(NULL);
 101 
 102   release_C_heap_structures();
 103 




  63 
  64 #ifdef ASSERT
  65 
  66 // MetaspaceObj allocation invariant is calloc equivalent memory
  67 // simple verification of this here (JVM_CONSTANT_Invalid == 0 )
  68 static bool tag_array_is_zero_initialized(Array<u1>* tags) {
  69   assert(tags != NULL, "invariant");
  70   const int length = tags->length();
  71   for (int index = 0; index < length; ++index) {
  72     if (JVM_CONSTANT_Invalid != tags->at(index)) {
  73       return false;
  74     }
  75   }
  76   return true;
  77 }
  78 
  79 #endif
  80 
  81 ConstantPool::ConstantPool(Array<u1>* tags) :
  82   _tags(tags),
  83   _length(tags->length()),
  84   _flags(0) {
  85 
  86     assert(_tags != NULL, "invariant");
  87     assert(tags->length() == _length, "invariant");
  88     assert(tag_array_is_zero_initialized(tags), "invariant");
  89     assert(0 == _flags, "invariant");
  90     assert(0 == version(), "invariant");
  91     assert(NULL == _pool_holder, "invariant");
  92 }
  93 
  94 void ConstantPool::deallocate_contents(ClassLoaderData* loader_data) {
  95   MetadataFactory::free_metadata(loader_data, cache());
  96   set_cache(NULL);
  97   MetadataFactory::free_array<u2>(loader_data, reference_map());
  98   set_reference_map(NULL);
  99 
 100   MetadataFactory::free_array<jushort>(loader_data, operands());
 101   set_operands(NULL);
 102 
 103   release_C_heap_structures();
 104 


< prev index next >