hotspot/src/share/vm/memory/collectorPolicy.hpp
changeset 22551 9bf46d16dcc6
parent 21567 938a7ca4d2aa
child 22776 d99c54477401
equal deleted inserted replaced
22550:820966182ab9 22551:9bf46d16dcc6
    74 
    74 
    75   size_t _space_alignment;
    75   size_t _space_alignment;
    76   size_t _heap_alignment;
    76   size_t _heap_alignment;
    77 
    77 
    78   // Needed to keep information if MaxHeapSize was set on the command line
    78   // Needed to keep information if MaxHeapSize was set on the command line
    79   // when the flag value is aligned etc by ergonomics
    79   // when the flag value is aligned etc by ergonomics.
    80   bool _max_heap_size_cmdline;
    80   bool _max_heap_size_cmdline;
    81 
    81 
    82   // The sizing of the heap are controlled by a sizing policy.
    82   // The sizing of the heap is controlled by a sizing policy.
    83   AdaptiveSizePolicy* _size_policy;
    83   AdaptiveSizePolicy* _size_policy;
    84 
    84 
    85   // Set to true when policy wants soft refs cleared.
    85   // Set to true when policy wants soft refs cleared.
    86   // Reset to false by gc after it clears all soft refs.
    86   // Reset to false by gc after it clears all soft refs.
    87   bool _should_clear_all_soft_refs;
    87   bool _should_clear_all_soft_refs;
   100     initialize_alignments();
   100     initialize_alignments();
   101     initialize_flags();
   101     initialize_flags();
   102     initialize_size_info();
   102     initialize_size_info();
   103   }
   103   }
   104 
   104 
   105   // Return maximum heap alignment that may be imposed by the policy
   105   // Return maximum heap alignment that may be imposed by the policy.
   106   static size_t compute_heap_alignment();
   106   static size_t compute_heap_alignment();
   107 
   107 
   108   size_t space_alignment()        { return _space_alignment; }
   108   size_t space_alignment()        { return _space_alignment; }
   109   size_t heap_alignment()         { return _heap_alignment; }
   109   size_t heap_alignment()         { return _heap_alignment; }
   110 
   110 
   178   // failure.
   178   // failure.
   179   virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
   179   virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
   180                                                        size_t size,
   180                                                        size_t size,
   181                                                        Metaspace::MetadataType mdtype);
   181                                                        Metaspace::MetadataType mdtype);
   182 
   182 
   183   // Performace Counter support
   183   // Performance Counter support
   184   GCPolicyCounters* counters()     { return _gc_policy_counters; }
   184   GCPolicyCounters* counters()     { return _gc_policy_counters; }
   185 
   185 
   186   // Create the jstat counters for the GC policy.  By default, policy's
   186   // Create the jstat counters for the GC policy.  By default, policy's
   187   // don't have associated counters, and we complain if this is invoked.
   187   // don't have associated counters, and we complain if this is invoked.
   188   virtual void initialize_gc_policy_counters() {
   188   virtual void initialize_gc_policy_counters() {
   229   // time. When using large pages they can differ.
   229   // time. When using large pages they can differ.
   230   size_t _gen_alignment;
   230   size_t _gen_alignment;
   231 
   231 
   232   GenerationSpec **_generations;
   232   GenerationSpec **_generations;
   233 
   233 
   234   // Return true if an allocation should be attempted in the older
   234   // Return true if an allocation should be attempted in the older generation
   235   // generation if it fails in the younger generation.  Return
   235   // if it fails in the younger generation.  Return false, otherwise.
   236   // false, otherwise.
       
   237   virtual bool should_try_older_generation_allocation(size_t word_size) const;
   236   virtual bool should_try_older_generation_allocation(size_t word_size) const;
   238 
   237 
   239   void initialize_flags();
   238   void initialize_flags();
   240   void initialize_size_info();
   239   void initialize_size_info();
   241 
   240 
   243   DEBUG_ONLY(void assert_size_info();)
   242   DEBUG_ONLY(void assert_size_info();)
   244 
   243 
   245   // Try to allocate space by expanding the heap.
   244   // Try to allocate space by expanding the heap.
   246   virtual HeapWord* expand_heap_and_allocate(size_t size, bool is_tlab);
   245   virtual HeapWord* expand_heap_and_allocate(size_t size, bool is_tlab);
   247 
   246 
   248   // Compute max heap alignment
   247   // Compute max heap alignment.
   249   size_t compute_max_alignment();
   248   size_t compute_max_alignment();
   250 
   249 
   251  // Scale the base_size by NewRatio according to
   250  // Scale the base_size by NewRatio according to
   252  //     result = base_size / (NewRatio + 1)
   251  //     result = base_size / (NewRatio + 1)
   253  // and align by min_alignment()
   252  // and align by min_alignment()
   254  size_t scale_by_NewRatio_aligned(size_t base_size);
   253  size_t scale_by_NewRatio_aligned(size_t base_size);
   255 
   254 
   256  // Bound the value by the given maximum minus the min_alignment
   255  // Bound the value by the given maximum minus the min_alignment.
   257  size_t bound_minus_alignment(size_t desired_size, size_t maximum_size);
   256  size_t bound_minus_alignment(size_t desired_size, size_t maximum_size);
   258 
   257 
   259  public:
   258  public:
   260   GenCollectorPolicy();
   259   GenCollectorPolicy();
   261 
   260