diff --git a/src/share/vm/utilities/stack.hpp b/src/share/vm/utilities/stack.hpp index 4814bf92f2fbc1224f4340c64295dd3a94bc4ec4..7c866897691a67614cd971ce1bd1d80a4d8b12c1 100644 --- a/src/share/vm/utilities/stack.hpp +++ b/src/share/vm/utilities/stack.hpp @@ -96,11 +96,16 @@ class Stack: public StackBase public: friend class StackIterator; + // Number of elements that fit in 4K bytes minus the size of two pointers + // (link field and malloc header). + static const size_t _default_segment_size = (4096 - 2 * sizeof(E*)) / sizeof(E); + static size_t default_segment_size() { return _default_segment_size; } + // segment_size: number of items per segment // max_cache_size: maxmium number of *segments* to cache // max_size: maximum number of items allowed, rounded to a multiple of // the segment size (0 == unlimited) - inline Stack(size_t segment_size = default_segment_size(), + inline Stack(size_t segment_size = _default_segment_size, size_t max_cache_size = 4, size_t max_size = 0); inline ~Stack() { clear(true); } @@ -122,8 +127,6 @@ public: // clear_cache is true, also release any cached segments. void clear(bool clear_cache = false); - static inline size_t default_segment_size(); - protected: // Each segment includes space for _seg_size elements followed by a link // (pointer) to the previous segment; the space is allocated as a single block diff --git a/src/share/vm/utilities/stack.inline.hpp b/src/share/vm/utilities/stack.inline.hpp index 7fe7d1db32d2743f7816d4568922989694b58644..4b1efee59845b46b775f8a6c482f4f83e0e4f806 100644 --- a/src/share/vm/utilities/stack.inline.hpp +++ b/src/share/vm/utilities/stack.inline.hpp @@ -85,14 +85,6 @@ void Stack::clear(bool clear_cache) reset(clear_cache); } -template -size_t Stack::default_segment_size() -{ - // Number of elements that fit in 4K bytes minus the size of two pointers - // (link field and malloc header). - return (4096 - 2 * sizeof(E*)) / sizeof(E); -} - template size_t Stack::adjust_segment_size(size_t seg_size) {