< prev index next >

src/hotspot/share/utilities/stack.inline.hpp

Print this page




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_UTILITIES_STACK_INLINE_HPP
  26 #define SHARE_VM_UTILITIES_STACK_INLINE_HPP
  27 

  28 #include "utilities/align.hpp"
  29 #include "utilities/stack.hpp"
  30 #include "utilities/copy.hpp"
  31 
  32 template <MEMFLAGS F> StackBase<F>::StackBase(size_t segment_size, size_t max_cache_size,
  33                      size_t max_size):
  34   _seg_size(segment_size),
  35   _max_cache_size(max_cache_size),
  36   _max_size(adjust_max_size(max_size, segment_size))
  37 {
  38   assert(_max_size % _seg_size == 0, "not a multiple");
  39 }
  40 
  41 template <MEMFLAGS F> size_t StackBase<F>::adjust_max_size(size_t max_size, size_t seg_size)
  42 {
  43   assert(seg_size > 0, "cannot be 0");
  44   assert(max_size >= seg_size || max_size == 0, "max_size too small");
  45   const size_t limit = max_uintx - (seg_size - 1);
  46   if (max_size == 0 || max_size > limit) {
  47     max_size = limit;




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_UTILITIES_STACK_INLINE_HPP
  26 #define SHARE_VM_UTILITIES_STACK_INLINE_HPP
  27 
  28 #include "memory/allocation.inline.hpp"
  29 #include "utilities/align.hpp"
  30 #include "utilities/stack.hpp"
  31 #include "utilities/copy.hpp"
  32 
  33 template <MEMFLAGS F> StackBase<F>::StackBase(size_t segment_size, size_t max_cache_size,
  34                      size_t max_size):
  35   _seg_size(segment_size),
  36   _max_cache_size(max_cache_size),
  37   _max_size(adjust_max_size(max_size, segment_size))
  38 {
  39   assert(_max_size % _seg_size == 0, "not a multiple");
  40 }
  41 
  42 template <MEMFLAGS F> size_t StackBase<F>::adjust_max_size(size_t max_size, size_t seg_size)
  43 {
  44   assert(seg_size > 0, "cannot be 0");
  45   assert(max_size >= seg_size || max_size == 0, "max_size too small");
  46   const size_t limit = max_uintx - (seg_size - 1);
  47   if (max_size == 0 || max_size > limit) {
  48     max_size = limit;


< prev index next >