src/share/vm/gc_interface/collectedHeap.hpp

changeset 4037
da91efe96a93
parent 3900
d2a62e0f25eb
child 4295
59c790074993
     1.1 --- a/src/share/vm/gc_interface/collectedHeap.hpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/share/vm/gc_interface/collectedHeap.hpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -77,7 +77,6 @@
     1.4  class CollectedHeap : public CHeapObj<mtInternal> {
     1.5    friend class VMStructs;
     1.6    friend class IsGCActiveMark; // Block structured external access to _is_gc_active
     1.7 -  friend class constantPoolCacheKlass; // allocate() method inserts is_conc_safe
     1.8  
     1.9  #ifdef ASSERT
    1.10    static int       _fire_out_of_memory_count;
    1.11 @@ -140,14 +139,6 @@
    1.12    // is guaranteed initialized to zeros.
    1.13    inline static HeapWord* common_mem_allocate_init(size_t size, TRAPS);
    1.14  
    1.15 -  // Same as common_mem version, except memory is allocated in the permanent area
    1.16 -  // If there is no permanent area, revert to common_mem_allocate_noinit
    1.17 -  inline static HeapWord* common_permanent_mem_allocate_noinit(size_t size, TRAPS);
    1.18 -
    1.19 -  // Same as common_mem version, except memory is allocated in the permanent area
    1.20 -  // If there is no permanent area, revert to common_mem_allocate_init
    1.21 -  inline static HeapWord* common_permanent_mem_allocate_init(size_t size, TRAPS);
    1.22 -
    1.23    // Helper functions for (VM) allocation.
    1.24    inline static void post_allocation_setup_common(KlassHandle klass, HeapWord* obj);
    1.25    inline static void post_allocation_setup_no_klass_install(KlassHandle klass,
    1.26 @@ -221,14 +212,11 @@
    1.27    // reach, without a garbage collection.
    1.28    virtual bool is_maximal_no_gc() const = 0;
    1.29  
    1.30 -  virtual size_t permanent_capacity() const = 0;
    1.31 -  virtual size_t permanent_used() const = 0;
    1.32 -
    1.33    // Support for java.lang.Runtime.maxMemory():  return the maximum amount of
    1.34    // memory that the vm could make available for storing 'normal' java objects.
    1.35    // This is based on the reserved address space, but should not include space
    1.36 -  // that the vm uses internally for bookkeeping or temporary storage (e.g.,
    1.37 -  // perm gen space or, in the case of the young gen, one of the survivor
    1.38 +  // that the vm uses internally for bookkeeping or temporary storage
    1.39 +  // (e.g., in the case of the young gen, one of the survivor
    1.40    // spaces).
    1.41    virtual size_t max_capacity() const = 0;
    1.42  
    1.43 @@ -250,6 +238,15 @@
    1.44      return p == NULL || is_in(p);
    1.45    }
    1.46  
    1.47 +  bool is_in_place(Metadata** p) {
    1.48 +    return !Universe::heap()->is_in(p);
    1.49 +  }
    1.50 +  bool is_in_place(oop* p) { return Universe::heap()->is_in(p); }
    1.51 +  bool is_in_place(narrowOop* p) {
    1.52 +    oop o = oopDesc::load_decode_heap_oop_not_null(p);
    1.53 +    return Universe::heap()->is_in((const void*)o);
    1.54 +  }
    1.55 +
    1.56    // Let's define some terms: a "closed" subset of a heap is one that
    1.57    //
    1.58    // 1) contains all currently-allocated objects, and
    1.59 @@ -282,37 +279,12 @@
    1.60      return p == NULL || is_in_closed_subset(p);
    1.61    }
    1.62  
    1.63 -  // XXX is_permanent() and is_in_permanent() should be better named
    1.64 -  // to distinguish one from the other.
    1.65 -
    1.66 -  // Returns "TRUE" if "p" is allocated as "permanent" data.
    1.67 -  // If the heap does not use "permanent" data, returns the same
    1.68 -  // value is_in_reserved() would return.
    1.69 -  // NOTE: this actually returns true if "p" is in reserved space
    1.70 -  // for the space not that it is actually allocated (i.e. in committed
    1.71 -  // space). If you need the more conservative answer use is_permanent().
    1.72 -  virtual bool is_in_permanent(const void *p) const = 0;
    1.73 -
    1.74 -
    1.75  #ifdef ASSERT
    1.76    // Returns true if "p" is in the part of the
    1.77    // heap being collected.
    1.78    virtual bool is_in_partial_collection(const void *p) = 0;
    1.79  #endif
    1.80  
    1.81 -  bool is_in_permanent_or_null(const void *p) const {
    1.82 -    return p == NULL || is_in_permanent(p);
    1.83 -  }
    1.84 -
    1.85 -  // Returns "TRUE" if "p" is in the committed area of  "permanent" data.
    1.86 -  // If the heap does not use "permanent" data, returns the same
    1.87 -  // value is_in() would return.
    1.88 -  virtual bool is_permanent(const void *p) const = 0;
    1.89 -
    1.90 -  bool is_permanent_or_null(const void *p) const {
    1.91 -    return p == NULL || is_permanent(p);
    1.92 -  }
    1.93 -
    1.94    // An object is scavengable if its location may move during a scavenge.
    1.95    // (A scavenge is a GC which is not a full GC.)
    1.96    virtual bool is_scavengable(const void *p) = 0;
    1.97 @@ -320,7 +292,7 @@
    1.98    // Returns "TRUE" if "p" is a method oop in the
    1.99    // current heap, with high probability. This predicate
   1.100    // is not stable, in general.
   1.101 -  bool is_valid_method(oop p) const;
   1.102 +  bool is_valid_method(Method* p) const;
   1.103  
   1.104    void set_gc_cause(GCCause::Cause v) {
   1.105       if (UsePerfData) {
   1.106 @@ -338,11 +310,6 @@
   1.107    // May be overridden to set additional parallelism.
   1.108    virtual void set_par_threads(uint t) { _n_par_threads = t; };
   1.109  
   1.110 -  // Preload classes into the shared portion of the heap, and then dump
   1.111 -  // that data to a file so that it can be loaded directly by another
   1.112 -  // VM (then terminate).
   1.113 -  virtual void preload_and_dump(TRAPS) { ShouldNotReachHere(); }
   1.114 -
   1.115    // Allocate and initialize instances of Class
   1.116    static oop Class_obj_allocate(KlassHandle klass, int size, KlassHandle real_klass, TRAPS);
   1.117  
   1.118 @@ -351,30 +318,15 @@
   1.119    inline static oop array_allocate(KlassHandle klass, int size, int length, TRAPS);
   1.120    inline static oop array_allocate_nozero(KlassHandle klass, int size, int length, TRAPS);
   1.121  
   1.122 -  // Special obj/array allocation facilities.
   1.123 -  // Some heaps may want to manage "permanent" data uniquely. These default
   1.124 -  // to the general routines if the heap does not support such handling.
   1.125 -  inline static oop permanent_obj_allocate(KlassHandle klass, int size, TRAPS);
   1.126 -  // permanent_obj_allocate_no_klass_install() does not do the installation of
   1.127 -  // the klass pointer in the newly created object (as permanent_obj_allocate()
   1.128 -  // above does).  This allows for a delay in the installation of the klass
   1.129 -  // pointer that is needed during the create of klassKlass's.  The
   1.130 -  // method post_allocation_install_obj_klass() is used to install the
   1.131 -  // klass pointer.
   1.132 -  inline static oop permanent_obj_allocate_no_klass_install(KlassHandle klass,
   1.133 -                                                            int size,
   1.134 -                                                            TRAPS);
   1.135 -  inline static void post_allocation_install_obj_klass(KlassHandle klass, oop obj);
   1.136 -  inline static oop permanent_array_allocate(KlassHandle klass, int size, int length, TRAPS);
   1.137 +  inline static void post_allocation_install_obj_klass(KlassHandle klass,
   1.138 +                                                       oop obj);
   1.139  
   1.140    // Raw memory allocation facilities
   1.141    // The obj and array allocate methods are covers for these methods.
   1.142 -  // The permanent allocation method should default to mem_allocate if
   1.143 -  // permanent memory isn't supported. mem_allocate() should never be
   1.144 +  // mem_allocate() should never be
   1.145    // called to allocate TLABs, only individual objects.
   1.146    virtual HeapWord* mem_allocate(size_t size,
   1.147                                   bool* gc_overhead_limit_was_exceeded) = 0;
   1.148 -  virtual HeapWord* permanent_mem_allocate(size_t size) = 0;
   1.149  
   1.150    // Utilities for turning raw memory into filler objects.
   1.151    //
   1.152 @@ -504,11 +456,6 @@
   1.153    // remembered set.
   1.154    virtual void flush_deferred_store_barrier(JavaThread* thread);
   1.155  
   1.156 -  // Can a compiler elide a store barrier when it writes
   1.157 -  // a permanent oop into the heap?  Applies when the compiler
   1.158 -  // is storing x to the heap, where x->is_perm() is true.
   1.159 -  virtual bool can_elide_permanent_oop_store_barriers() const = 0;
   1.160 -
   1.161    // Does this heap support heap inspection (+PrintClassHistogram?)
   1.162    virtual bool supports_heap_inspection() const = 0;
   1.163  
   1.164 @@ -517,11 +464,19 @@
   1.165    // "CollectedHeap" supports.
   1.166    virtual void collect(GCCause::Cause cause) = 0;
   1.167  
   1.168 +  // Perform a full collection
   1.169 +  virtual void do_full_collection(bool clear_all_soft_refs) = 0;
   1.170 +
   1.171    // This interface assumes that it's being called by the
   1.172    // vm thread. It collects the heap assuming that the
   1.173    // heap lock is already held and that we are executing in
   1.174    // the context of the vm thread.
   1.175 -  virtual void collect_as_vm_thread(GCCause::Cause cause) = 0;
   1.176 +  virtual void collect_as_vm_thread(GCCause::Cause cause);
   1.177 +
   1.178 +  // Callback from VM_CollectForMetadataAllocation operation.
   1.179 +  MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
   1.180 +                                               size_t size,
   1.181 +                                               Metaspace::MetadataType mdtype);
   1.182  
   1.183    // Returns the barrier set for this heap
   1.184    BarrierSet* barrier_set() { return _barrier_set; }
   1.185 @@ -552,28 +507,19 @@
   1.186    // Return the CollectorPolicy for the heap
   1.187    virtual CollectorPolicy* collector_policy() const = 0;
   1.188  
   1.189 +  void oop_iterate_no_header(OopClosure* cl);
   1.190 +
   1.191    // Iterate over all the ref-containing fields of all objects, calling
   1.192 -  // "cl.do_oop" on each. This includes objects in permanent memory.
   1.193 -  virtual void oop_iterate(OopClosure* cl) = 0;
   1.194 +  // "cl.do_oop" on each.
   1.195 +  virtual void oop_iterate(ExtendedOopClosure* cl) = 0;
   1.196  
   1.197    // Iterate over all objects, calling "cl.do_object" on each.
   1.198 -  // This includes objects in permanent memory.
   1.199    virtual void object_iterate(ObjectClosure* cl) = 0;
   1.200  
   1.201    // Similar to object_iterate() except iterates only
   1.202    // over live objects.
   1.203    virtual void safe_object_iterate(ObjectClosure* cl) = 0;
   1.204  
   1.205 -  // Behaves the same as oop_iterate, except only traverses
   1.206 -  // interior pointers contained in permanent memory. If there
   1.207 -  // is no permanent memory, does nothing.
   1.208 -  virtual void permanent_oop_iterate(OopClosure* cl) = 0;
   1.209 -
   1.210 -  // Behaves the same as object_iterate, except only traverses
   1.211 -  // object contained in permanent memory. If there is no
   1.212 -  // permanent memory, does nothing.
   1.213 -  virtual void permanent_object_iterate(ObjectClosure* cl) = 0;
   1.214 -
   1.215    // NOTE! There is no requirement that a collector implement these
   1.216    // functions.
   1.217    //

mercurial