< prev index next >

src/hotspot/share/oops/instanceKlass.cpp

Print this page

  47 #include "gc/shared/collectedHeap.inline.hpp"
  48 #include "interpreter/oopMapCache.hpp"
  49 #include "interpreter/rewriter.hpp"
  50 #include "jvmtifiles/jvmti.h"
  51 #include "logging/log.hpp"
  52 #include "logging/logMessage.hpp"
  53 #include "logging/logStream.hpp"
  54 #include "memory/allocation.inline.hpp"
  55 #include "memory/iterator.inline.hpp"
  56 #include "memory/metadataFactory.hpp"
  57 #include "memory/metaspaceClosure.hpp"
  58 #include "memory/oopFactory.hpp"
  59 #include "memory/resourceArea.hpp"
  60 #include "memory/universe.hpp"
  61 #include "oops/fieldStreams.inline.hpp"
  62 #include "oops/constantPool.hpp"
  63 #include "oops/instanceClassLoaderKlass.hpp"
  64 #include "oops/instanceKlass.inline.hpp"
  65 #include "oops/instanceMirrorKlass.hpp"
  66 #include "oops/instanceOop.hpp"

  67 #include "oops/klass.inline.hpp"
  68 #include "oops/method.hpp"
  69 #include "oops/oop.inline.hpp"
  70 #include "oops/recordComponent.hpp"
  71 #include "oops/symbol.hpp"
  72 #include "prims/jvmtiExport.hpp"
  73 #include "prims/jvmtiRedefineClasses.hpp"
  74 #include "prims/jvmtiThreadState.hpp"
  75 #include "prims/methodComparator.hpp"
  76 #include "runtime/arguments.hpp"
  77 #include "runtime/atomic.hpp"
  78 #include "runtime/fieldDescriptor.inline.hpp"
  79 #include "runtime/handles.inline.hpp"
  80 #include "runtime/javaCalls.hpp"
  81 #include "runtime/mutexLocker.hpp"
  82 #include "runtime/orderAccess.hpp"
  83 #include "runtime/reflectionUtils.hpp"
  84 #include "runtime/thread.inline.hpp"
  85 #include "services/classLoadingService.hpp"
  86 #include "services/threadService.hpp"

 421     return SystemDictionary::find_nest_host_error(cph, (int)_nest_host_index);
 422   }
 423 }
 424 
 425 InstanceKlass* InstanceKlass::allocate_instance_klass(const ClassFileParser& parser, TRAPS) {
 426   const int size = InstanceKlass::size(parser.vtable_size(),
 427                                        parser.itable_size(),
 428                                        nonstatic_oop_map_size(parser.total_oop_map_count()),
 429                                        parser.is_interface());
 430 
 431   const Symbol* const class_name = parser.class_name();
 432   assert(class_name != NULL, "invariant");
 433   ClassLoaderData* loader_data = parser.loader_data();
 434   assert(loader_data != NULL, "invariant");
 435 
 436   InstanceKlass* ik;
 437 
 438   // Allocation
 439   if (REF_NONE == parser.reference_type()) {
 440     if (class_name == vmSymbols::java_lang_Class()) {
 441       // mirror
 442       ik = new (loader_data, size, THREAD) InstanceMirrorKlass(parser);
 443     }
 444     else if (is_class_loader(class_name, parser)) {
 445       // class loader
 446       ik = new (loader_data, size, THREAD) InstanceClassLoaderKlass(parser);
 447     } else {
 448       // normal
 449       ik = new (loader_data, size, THREAD) InstanceKlass(parser, InstanceKlass::_kind_other);
 450     }
 451   } else {
 452     // reference
 453     ik = new (loader_data, size, THREAD) InstanceRefKlass(parser);
 454   }
 455 
 456   // Check for pending exception before adding to the loader data and incrementing
 457   // class count.  Can get OOM here.
 458   if (HAS_PENDING_EXCEPTION) {
 459     return NULL;
 460   }
 461 
 462   return ik;
 463 }
 464 
 465 
 466 // copy method ordering from resource area to Metaspace
 467 void InstanceKlass::copy_method_ordering(const intArray* m, TRAPS) {
 468   if (m != NULL) {
 469     // allocate a new array and copy contents (memcpy?)
 470     _method_ordering = MetadataFactory::new_array<int>(class_loader_data(), m->length(), CHECK);
 471     for (int i = 0; i < m->length(); i++) {
 472       _method_ordering->at_put(i, m->at(i));

  47 #include "gc/shared/collectedHeap.inline.hpp"
  48 #include "interpreter/oopMapCache.hpp"
  49 #include "interpreter/rewriter.hpp"
  50 #include "jvmtifiles/jvmti.h"
  51 #include "logging/log.hpp"
  52 #include "logging/logMessage.hpp"
  53 #include "logging/logStream.hpp"
  54 #include "memory/allocation.inline.hpp"
  55 #include "memory/iterator.inline.hpp"
  56 #include "memory/metadataFactory.hpp"
  57 #include "memory/metaspaceClosure.hpp"
  58 #include "memory/oopFactory.hpp"
  59 #include "memory/resourceArea.hpp"
  60 #include "memory/universe.hpp"
  61 #include "oops/fieldStreams.inline.hpp"
  62 #include "oops/constantPool.hpp"
  63 #include "oops/instanceClassLoaderKlass.hpp"
  64 #include "oops/instanceKlass.inline.hpp"
  65 #include "oops/instanceMirrorKlass.hpp"
  66 #include "oops/instanceOop.hpp"
  67 #include "oops/instanceStackChunkKlass.hpp"
  68 #include "oops/klass.inline.hpp"
  69 #include "oops/method.hpp"
  70 #include "oops/oop.inline.hpp"
  71 #include "oops/recordComponent.hpp"
  72 #include "oops/symbol.hpp"
  73 #include "prims/jvmtiExport.hpp"
  74 #include "prims/jvmtiRedefineClasses.hpp"
  75 #include "prims/jvmtiThreadState.hpp"
  76 #include "prims/methodComparator.hpp"
  77 #include "runtime/arguments.hpp"
  78 #include "runtime/atomic.hpp"
  79 #include "runtime/fieldDescriptor.inline.hpp"
  80 #include "runtime/handles.inline.hpp"
  81 #include "runtime/javaCalls.hpp"
  82 #include "runtime/mutexLocker.hpp"
  83 #include "runtime/orderAccess.hpp"
  84 #include "runtime/reflectionUtils.hpp"
  85 #include "runtime/thread.inline.hpp"
  86 #include "services/classLoadingService.hpp"
  87 #include "services/threadService.hpp"

 422     return SystemDictionary::find_nest_host_error(cph, (int)_nest_host_index);
 423   }
 424 }
 425 
 426 InstanceKlass* InstanceKlass::allocate_instance_klass(const ClassFileParser& parser, TRAPS) {
 427   const int size = InstanceKlass::size(parser.vtable_size(),
 428                                        parser.itable_size(),
 429                                        nonstatic_oop_map_size(parser.total_oop_map_count()),
 430                                        parser.is_interface());
 431 
 432   const Symbol* const class_name = parser.class_name();
 433   assert(class_name != NULL, "invariant");
 434   ClassLoaderData* loader_data = parser.loader_data();
 435   assert(loader_data != NULL, "invariant");
 436 
 437   InstanceKlass* ik;
 438 
 439   // Allocation
 440   if (REF_NONE == parser.reference_type()) {
 441     if (class_name == vmSymbols::java_lang_Class()) {

 442       ik = new (loader_data, size, THREAD) InstanceMirrorKlass(parser);
 443     } else if (class_name == vmSymbols::jdk_internal_vm_StackChunk()) {
 444       ik = new (loader_data, size, THREAD) InstanceStackChunkKlass(parser);
 445     } else if (is_class_loader(class_name, parser)) {
 446       ik = new (loader_data, size, THREAD) InstanceClassLoaderKlass(parser);
 447     } else {

 448       ik = new (loader_data, size, THREAD) InstanceKlass(parser, InstanceKlass::_kind_other);
 449     }
 450   } else {

 451     ik = new (loader_data, size, THREAD) InstanceRefKlass(parser);
 452   }
 453 
 454   // Check for pending exception before adding to the loader data and incrementing
 455   // class count.  Can get OOM here.
 456   if (HAS_PENDING_EXCEPTION) {
 457     return NULL;
 458   }
 459 
 460   return ik;
 461 }
 462 
 463 
 464 // copy method ordering from resource area to Metaspace
 465 void InstanceKlass::copy_method_ordering(const intArray* m, TRAPS) {
 466   if (m != NULL) {
 467     // allocate a new array and copy contents (memcpy?)
 468     _method_ordering = MetadataFactory::new_array<int>(class_loader_data(), m->length(), CHECK);
 469     for (int i = 0; i < m->length(); i++) {
 470       _method_ordering->at_put(i, m->at(i));
< prev index next >