src/share/vm/utilities/stack.hpp

changeset 9316
a27880c1288b
parent 4153
b9a9ed0f8eeb
child 9448
73d689add964
     1.1 --- a/src/share/vm/utilities/stack.hpp	Tue Jul 08 13:52:29 2014 -0400
     1.2 +++ b/src/share/vm/utilities/stack.hpp	Tue Apr 14 11:40:13 2015 +0200
     1.3 @@ -96,11 +96,16 @@
     1.4  public:
     1.5    friend class StackIterator<E, F>;
     1.6  
     1.7 +  // Number of elements that fit in 4K bytes minus the size of two pointers
     1.8 +  // (link field and malloc header).
     1.9 +  static const size_t _default_segment_size =  (4096 - 2 * sizeof(E*)) / sizeof(E);
    1.10 +  static size_t default_segment_size() { return _default_segment_size; }
    1.11 +
    1.12    // segment_size:    number of items per segment
    1.13    // max_cache_size:  maxmium number of *segments* to cache
    1.14    // max_size:        maximum number of items allowed, rounded to a multiple of
    1.15    //                  the segment size (0 == unlimited)
    1.16 -  inline Stack(size_t segment_size = default_segment_size(),
    1.17 +  inline Stack(size_t segment_size = _default_segment_size,
    1.18                 size_t max_cache_size = 4, size_t max_size = 0);
    1.19    inline ~Stack() { clear(true); }
    1.20  
    1.21 @@ -122,8 +127,6 @@
    1.22    // clear_cache is true, also release any cached segments.
    1.23    void clear(bool clear_cache = false);
    1.24  
    1.25 -  static inline size_t default_segment_size();
    1.26 -
    1.27  protected:
    1.28    // Each segment includes space for _seg_size elements followed by a link
    1.29    // (pointer) to the previous segment; the space is allocated as a single block

mercurial