< prev index next >

src/share/vm/memory/genCollectedHeap.hpp

Print this page
rev 7994 : Move remaining root processing to GenCollectedHeap


  68   Generation* _old_gen;
  69 
  70   GenerationSpec** _gen_specs;
  71 
  72   // The singleton Gen Remembered Set.
  73   GenRemSet* _rem_set;
  74 
  75   // The generational collector policy.
  76   GenCollectorPolicy* _gen_policy;
  77 
  78   // Indicates that the most recent previous incremental collection failed.
  79   // The flag is cleared when an action is taken that might clear the
  80   // condition that caused that incremental collection to fail.
  81   bool _incremental_collection_failed;
  82 
  83   // In support of ExplicitGCInvokesConcurrent functionality
  84   unsigned int _full_collections_completed;
  85 
  86   // Data structure for claiming the (potentially) parallel tasks in
  87   // (gen-specific) roots processing.
  88   SubTasksDone* _gen_process_roots_tasks;
  89   SubTasksDone* gen_process_roots_tasks() { return _gen_process_roots_tasks; }
  90 
  91   // Collects the given generation.
  92   void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
  93                           bool run_verification, bool clear_soft_refs,
  94                           bool restore_marks_for_biased_locking);
  95 
  96   // In block contents verification, the number of header words to skip
  97   NOT_PRODUCT(static size_t _skip_header_HeapWords;)
  98 
  99 protected:
 100   // Helper functions for allocation
 101   HeapWord* attempt_allocation(size_t size,
 102                                bool   is_tlab,
 103                                bool   first_only);
 104 
 105   // Helper function for two callbacks below.
 106   // Considers collection of the first max_level+1 generations.
 107   void do_collection(bool   full,
 108                      bool   clear_all_soft_refs,
 109                      size_t size,


 370 
 371   // Return "true" if all generations have reached the
 372   // maximal committed limit that they can reach, without a garbage
 373   // collection.
 374   virtual bool is_maximal_no_gc() const;
 375 
 376   int n_gens() const {
 377     assert(_n_gens == gen_policy()->number_of_generations(), "Sanity");
 378     return _n_gens;
 379   }
 380 
 381   // This function returns the "GenRemSet" object that allows us to scan
 382   // generations in a fully generational heap.
 383   GenRemSet* rem_set() { return _rem_set; }
 384 
 385   // Convenience function to be used in situations where the heap type can be
 386   // asserted to be this type.
 387   static GenCollectedHeap* heap();
 388 
 389   void set_par_threads(uint t);

 390 
 391   // Invoke the "do_oop" method of one of the closures "not_older_gens"
 392   // or "older_gens" on root locations for the generation at
 393   // "level".  (The "older_gens" closure is used for scanning references
 394   // from older generations; "not_older_gens" is used everywhere else.)
 395   // If "younger_gens_as_roots" is false, younger generations are
 396   // not scanned as roots; in this case, the caller must be arranging to
 397   // scan the younger generations itself.  (For example, a generation might
 398   // explicitly mark reachable objects in younger generations, to avoid
 399   // excess storage retention.)
 400   // The "so" argument determines which of the roots
 401   // the closure is applied to:
 402   // "SO_None" does none;






 403  private:








 404   void gen_process_roots(int level,
 405                          bool younger_gens_as_roots,
 406                          bool activate_scope,
 407                          SharedHeap::ScanningOption so,
 408                          OopsInGenClosure* not_older_gens,
 409                          OopsInGenClosure* weak_roots,
 410                          OopsInGenClosure* older_gens,
 411                          CLDClosure* cld_closure,
 412                          CLDClosure* weak_cld_closure,
 413                          CodeBlobClosure* code_closure);
 414 
 415  public:
 416   static const bool StrongAndWeakRoots = false;
 417   static const bool StrongRootsOnly    = true;
 418 
 419   void gen_process_roots(int level,
 420                          bool younger_gens_as_roots,
 421                          bool activate_scope,
 422                          SharedHeap::ScanningOption so,
 423                          bool only_strong_roots,
 424                          OopsInGenClosure* not_older_gens,
 425                          OopsInGenClosure* older_gens,
 426                          CLDClosure* cld_closure);
 427 
 428   // Apply "root_closure" to all the weak roots of the system.
 429   // These include JNI weak roots, string table,
 430   // and referents of reachable weak refs.
 431   void gen_process_weak_roots(OopClosure* root_closure);
 432 
 433   // Set the saved marks of generations, if that makes sense.
 434   // In particular, if any generation might iterate over the oops
 435   // in other generations, it should call this method.
 436   void save_marks();
 437 
 438   // Apply "cur->do_oop" or "older->do_oop" to all the oops in objects
 439   // allocated since the last call to save_marks in generations at or above
 440   // "level".  The "cur" closure is
 441   // applied to references in the generation at "level", and the "older"
 442   // closure to older generations.




  68   Generation* _old_gen;
  69 
  70   GenerationSpec** _gen_specs;
  71 
  72   // The singleton Gen Remembered Set.
  73   GenRemSet* _rem_set;
  74 
  75   // The generational collector policy.
  76   GenCollectorPolicy* _gen_policy;
  77 
  78   // Indicates that the most recent previous incremental collection failed.
  79   // The flag is cleared when an action is taken that might clear the
  80   // condition that caused that incremental collection to fail.
  81   bool _incremental_collection_failed;
  82 
  83   // In support of ExplicitGCInvokesConcurrent functionality
  84   unsigned int _full_collections_completed;
  85 
  86   // Data structure for claiming the (potentially) parallel tasks in
  87   // (gen-specific) roots processing.
  88   SubTasksDone* _process_strong_tasks;

  89 
  90   // Collects the given generation.
  91   void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
  92                           bool run_verification, bool clear_soft_refs,
  93                           bool restore_marks_for_biased_locking);
  94 
  95   // In block contents verification, the number of header words to skip
  96   NOT_PRODUCT(static size_t _skip_header_HeapWords;)
  97 
  98 protected:
  99   // Helper functions for allocation
 100   HeapWord* attempt_allocation(size_t size,
 101                                bool   is_tlab,
 102                                bool   first_only);
 103 
 104   // Helper function for two callbacks below.
 105   // Considers collection of the first max_level+1 generations.
 106   void do_collection(bool   full,
 107                      bool   clear_all_soft_refs,
 108                      size_t size,


 369 
 370   // Return "true" if all generations have reached the
 371   // maximal committed limit that they can reach, without a garbage
 372   // collection.
 373   virtual bool is_maximal_no_gc() const;
 374 
 375   int n_gens() const {
 376     assert(_n_gens == gen_policy()->number_of_generations(), "Sanity");
 377     return _n_gens;
 378   }
 379 
 380   // This function returns the "GenRemSet" object that allows us to scan
 381   // generations in a fully generational heap.
 382   GenRemSet* rem_set() { return _rem_set; }
 383 
 384   // Convenience function to be used in situations where the heap type can be
 385   // asserted to be this type.
 386   static GenCollectedHeap* heap();
 387 
 388   void set_par_threads(uint t);
 389   void set_n_termination(uint t);
 390 
 391   // Invoke the "do_oop" method of one of the closures "not_older_gens"
 392   // or "older_gens" on root locations for the generation at
 393   // "level".  (The "older_gens" closure is used for scanning references
 394   // from older generations; "not_older_gens" is used everywhere else.)
 395   // If "younger_gens_as_roots" is false, younger generations are
 396   // not scanned as roots; in this case, the caller must be arranging to
 397   // scan the younger generations itself.  (For example, a generation might
 398   // explicitly mark reachable objects in younger generations, to avoid
 399   // excess storage retention.)
 400   // The "so" argument determines which of the roots
 401   // the closure is applied to:
 402   // "SO_None" does none;
 403   enum ScanningOption {
 404     SO_None                =  0x0,
 405     SO_AllCodeCache        =  0x8,
 406     SO_ScavengeCodeCache   = 0x10
 407   };
 408 
 409  private:
 410   void process_roots(bool activate_scope,
 411                      ScanningOption so,
 412                      OopClosure* strong_roots,
 413                      OopClosure* weak_roots,
 414                      CLDClosure* strong_cld_closure,
 415                      CLDClosure* weak_cld_closure,
 416                      CodeBlobClosure* code_roots);
 417 
 418   void gen_process_roots(int level,
 419                          bool younger_gens_as_roots,
 420                          bool activate_scope,
 421                          ScanningOption so,
 422                          OopsInGenClosure* not_older_gens,
 423                          OopsInGenClosure* weak_roots,
 424                          OopsInGenClosure* older_gens,
 425                          CLDClosure* cld_closure,
 426                          CLDClosure* weak_cld_closure,
 427                          CodeBlobClosure* code_closure);
 428 
 429  public:
 430   static const bool StrongAndWeakRoots = false;
 431   static const bool StrongRootsOnly    = true;
 432 
 433   void gen_process_roots(int level,
 434                          bool younger_gens_as_roots,
 435                          bool activate_scope,
 436                          ScanningOption so,
 437                          bool only_strong_roots,
 438                          OopsInGenClosure* not_older_gens,
 439                          OopsInGenClosure* older_gens,
 440                          CLDClosure* cld_closure);
 441 
 442   // Apply "root_closure" to all the weak roots of the system.
 443   // These include JNI weak roots, string table,
 444   // and referents of reachable weak refs.
 445   void gen_process_weak_roots(OopClosure* root_closure);
 446 
 447   // Set the saved marks of generations, if that makes sense.
 448   // In particular, if any generation might iterate over the oops
 449   // in other generations, it should call this method.
 450   void save_marks();
 451 
 452   // Apply "cur->do_oop" or "older->do_oop" to all the oops in objects
 453   // allocated since the last call to save_marks in generations at or above
 454   // "level".  The "cur" closure is
 455   // applied to references in the generation at "level", and the "older"
 456   // closure to older generations.


< prev index next >