< prev index next >

src/share/vm/services/memoryPool.cpp

Print this page




  69 
  70 void MemoryPool::add_manager(MemoryManager* mgr) {
  71   assert(_num_managers < MemoryPool::max_num_managers, "_num_managers exceeds the max");
  72   if (_num_managers < MemoryPool::max_num_managers) {
  73     _managers[_num_managers] = mgr;
  74     _num_managers++;
  75   }
  76 }
  77 
  78 
  79 // Returns an instanceHandle of a MemoryPool object.
  80 // It creates a MemoryPool instance when the first time
  81 // this function is called.
  82 instanceOop MemoryPool::get_memory_pool_instance(TRAPS) {
  83   // Must do an acquire so as to force ordering of subsequent
  84   // loads from anything _memory_pool_obj points to or implies.
  85   instanceOop pool_obj = (instanceOop)OrderAccess::load_ptr_acquire(&_memory_pool_obj);
  86   if (pool_obj == NULL) {
  87     // It's ok for more than one thread to execute the code up to the locked region.
  88     // Extra pool instances will just be gc'ed.
  89     Klass* k = Management::sun_management_ManagementFactoryHelper_klass(CHECK_NULL);
  90     instanceKlassHandle ik(THREAD, k);
  91 
  92     Handle pool_name = java_lang_String::create_from_str(_name, CHECK_NULL);
  93     jlong usage_threshold_value = (_usage_threshold->is_high_threshold_supported() ? 0 : -1L);
  94     jlong gc_usage_threshold_value = (_gc_usage_threshold->is_high_threshold_supported() ? 0 : -1L);
  95 
  96     JavaValue result(T_OBJECT);
  97     JavaCallArguments args;
  98     args.push_oop(pool_name);           // Argument 1
  99     args.push_int((int) is_heap());     // Argument 2
 100 
 101     Symbol* method_name = vmSymbols::createMemoryPool_name();
 102     Symbol* signature = vmSymbols::createMemoryPool_signature();
 103 
 104     args.push_long(usage_threshold_value);    // Argument 3
 105     args.push_long(gc_usage_threshold_value); // Argument 4
 106 
 107     JavaCalls::call_static(&result,
 108                            ik,
 109                            method_name,
 110                            signature,




  69 
  70 void MemoryPool::add_manager(MemoryManager* mgr) {
  71   assert(_num_managers < MemoryPool::max_num_managers, "_num_managers exceeds the max");
  72   if (_num_managers < MemoryPool::max_num_managers) {
  73     _managers[_num_managers] = mgr;
  74     _num_managers++;
  75   }
  76 }
  77 
  78 
  79 // Returns an instanceHandle of a MemoryPool object.
  80 // It creates a MemoryPool instance when the first time
  81 // this function is called.
  82 instanceOop MemoryPool::get_memory_pool_instance(TRAPS) {
  83   // Must do an acquire so as to force ordering of subsequent
  84   // loads from anything _memory_pool_obj points to or implies.
  85   instanceOop pool_obj = (instanceOop)OrderAccess::load_ptr_acquire(&_memory_pool_obj);
  86   if (pool_obj == NULL) {
  87     // It's ok for more than one thread to execute the code up to the locked region.
  88     // Extra pool instances will just be gc'ed.
  89     InstanceKlass* ik = Management::sun_management_ManagementFactoryHelper_klass(CHECK_NULL);

  90 
  91     Handle pool_name = java_lang_String::create_from_str(_name, CHECK_NULL);
  92     jlong usage_threshold_value = (_usage_threshold->is_high_threshold_supported() ? 0 : -1L);
  93     jlong gc_usage_threshold_value = (_gc_usage_threshold->is_high_threshold_supported() ? 0 : -1L);
  94 
  95     JavaValue result(T_OBJECT);
  96     JavaCallArguments args;
  97     args.push_oop(pool_name);           // Argument 1
  98     args.push_int((int) is_heap());     // Argument 2
  99 
 100     Symbol* method_name = vmSymbols::createMemoryPool_name();
 101     Symbol* signature = vmSymbols::createMemoryPool_signature();
 102 
 103     args.push_long(usage_threshold_value);    // Argument 3
 104     args.push_long(gc_usage_threshold_value); // Argument 4
 105 
 106     JavaCalls::call_static(&result,
 107                            ik,
 108                            method_name,
 109                            signature,


< prev index next >