< prev index next >

src/share/vm/memory/genCollectedHeap.hpp

Print this page




  62   static GenCollectedHeap* _gch;
  63 
  64  private:
  65   int _n_gens;
  66   Generation* _gens[max_gens];
  67   GenerationSpec** _gen_specs;
  68 
  69   // The generational collector policy.
  70   GenCollectorPolicy* _gen_policy;
  71 
  72   // Indicates that the most recent previous incremental collection failed.
  73   // The flag is cleared when an action is taken that might clear the
  74   // condition that caused that incremental collection to fail.
  75   bool _incremental_collection_failed;
  76 
  77   // In support of ExplicitGCInvokesConcurrent functionality
  78   unsigned int _full_collections_completed;
  79 
  80   // Data structure for claiming the (potentially) parallel tasks in
  81   // (gen-specific) roots processing.
  82   SubTasksDone* _gen_process_roots_tasks;
  83   SubTasksDone* gen_process_roots_tasks() { return _gen_process_roots_tasks; }
  84 
  85   // In block contents verification, the number of header words to skip
  86   NOT_PRODUCT(static size_t _skip_header_HeapWords;)
  87 
  88 protected:
  89   // Helper functions for allocation
  90   HeapWord* attempt_allocation(size_t size,
  91                                bool   is_tlab,
  92                                bool   first_only);
  93 
  94   // Helper function for two callbacks below.
  95   // Considers collection of the first max_level+1 generations.
  96   void do_collection(bool   full,
  97                      bool   clear_all_soft_refs,
  98                      size_t size,
  99                      bool   is_tlab,
 100                      int    max_level);
 101 
 102   // Callback from VM_GenCollectForAllocation operation.
 103   // This function does everything necessary/possible to satisfy an


 373     int l = gen->level() + 1;
 374     guarantee(l < _n_gens, "Out of bounds");
 375     return _gens[l];
 376   }
 377 
 378   Generation* get_gen(int i) const {
 379     guarantee(i >= 0 && i < _n_gens, "Out of bounds");
 380     return _gens[i];
 381   }
 382 
 383   int n_gens() const {
 384     assert(_n_gens == gen_policy()->number_of_generations(), "Sanity");
 385     return _n_gens;
 386   }
 387 
 388   // Convenience function to be used in situations where the heap type can be
 389   // asserted to be this type.
 390   static GenCollectedHeap* heap();
 391 
 392   void set_par_threads(uint t);

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






 406  private:








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




  62   static GenCollectedHeap* _gch;
  63 
  64  private:
  65   int _n_gens;
  66   Generation* _gens[max_gens];
  67   GenerationSpec** _gen_specs;
  68 
  69   // The generational collector policy.
  70   GenCollectorPolicy* _gen_policy;
  71 
  72   // Indicates that the most recent previous incremental collection failed.
  73   // The flag is cleared when an action is taken that might clear the
  74   // condition that caused that incremental collection to fail.
  75   bool _incremental_collection_failed;
  76 
  77   // In support of ExplicitGCInvokesConcurrent functionality
  78   unsigned int _full_collections_completed;
  79 
  80   // Data structure for claiming the (potentially) parallel tasks in
  81   // (gen-specific) roots processing.
  82   SubTasksDone* _process_strong_tasks;

  83 
  84   // In block contents verification, the number of header words to skip
  85   NOT_PRODUCT(static size_t _skip_header_HeapWords;)
  86 
  87 protected:
  88   // Helper functions for allocation
  89   HeapWord* attempt_allocation(size_t size,
  90                                bool   is_tlab,
  91                                bool   first_only);
  92 
  93   // Helper function for two callbacks below.
  94   // Considers collection of the first max_level+1 generations.
  95   void do_collection(bool   full,
  96                      bool   clear_all_soft_refs,
  97                      size_t size,
  98                      bool   is_tlab,
  99                      int    max_level);
 100 
 101   // Callback from VM_GenCollectForAllocation operation.
 102   // This function does everything necessary/possible to satisfy an


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


< prev index next >