src/share/vm/services/classLoadingService.cpp

changeset 4037
da91efe96a93
parent 3202
436b4a3231bf
child 4165
fb19af007ffc
     1.1 --- a/src/share/vm/services/classLoadingService.cpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/share/vm/services/classLoadingService.cpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -134,7 +134,7 @@
    1.11    }
    1.12  }
    1.13  
    1.14 -void ClassLoadingService::notify_class_unloaded(instanceKlass* k) {
    1.15 +void ClassLoadingService::notify_class_unloaded(InstanceKlass* k) {
    1.16    DTRACE_CLASSLOAD_PROBE(unloaded, k, false);
    1.17    // Classes that can be unloaded must be non-shared
    1.18    _classes_unloaded_count->inc();
    1.19 @@ -146,20 +146,20 @@
    1.20  
    1.21      // Compute method size & subtract from running total.
    1.22      // We are called during phase 1 of mark sweep, so it's
    1.23 -    // still ok to iterate through methodOops here.
    1.24 -    objArrayOop methods = k->methods();
    1.25 +    // still ok to iterate through Method*s here.
    1.26 +    Array<Method*>* methods = k->methods();
    1.27      for (int i = 0; i < methods->length(); i++) {
    1.28 -      _class_methods_size->inc(-methods->obj_at(i)->size());
    1.29 +      _class_methods_size->inc(-methods->at(i)->size());
    1.30      }
    1.31    }
    1.32  
    1.33    if (TraceClassUnloading) {
    1.34      ResourceMark rm;
    1.35 -    tty->print_cr("[Unloading class %s]", k->external_name());
    1.36 +    tty->print_cr("[Unloading class %s " INTPTR_FORMAT "]", k->external_name(), k);
    1.37    }
    1.38  }
    1.39  
    1.40 -void ClassLoadingService::notify_class_loaded(instanceKlass* k, bool shared_class) {
    1.41 +void ClassLoadingService::notify_class_loaded(InstanceKlass* k, bool shared_class) {
    1.42    DTRACE_CLASSLOAD_PROBE(loaded, k, shared_class);
    1.43    PerfCounter* classes_counter = (shared_class ? _shared_classes_loaded_count
    1.44                                                 : _classes_loaded_count);
    1.45 @@ -175,20 +175,22 @@
    1.46    }
    1.47  }
    1.48  
    1.49 -size_t ClassLoadingService::compute_class_size(instanceKlass* k) {
    1.50 -  // lifted from ClassStatistics.do_class(klassOop k)
    1.51 +size_t ClassLoadingService::compute_class_size(InstanceKlass* k) {
    1.52 +  // lifted from ClassStatistics.do_class(Klass* k)
    1.53  
    1.54    size_t class_size = 0;
    1.55  
    1.56 -  class_size += k->as_klassOop()->size();
    1.57 +  class_size += k->size();
    1.58  
    1.59    if (k->oop_is_instance()) {
    1.60      class_size += k->methods()->size();
    1.61 +    // FIXME: Need to count the contents of methods
    1.62      class_size += k->constants()->size();
    1.63      class_size += k->local_interfaces()->size();
    1.64      class_size += k->transitive_interfaces()->size();
    1.65      // We do not have to count implementors, since we only store one!
    1.66 -    class_size += k->fields()->size();
    1.67 +    // FIXME: How should these be accounted for, now when they have moved.
    1.68 +    //class_size += k->fields()->size();
    1.69    }
    1.70    return class_size * oopSize;
    1.71  }

mercurial