< prev index next >

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

Print this page




  75     return tmp;
  76   }
  77   return this->_cur_seg[--this->_cur_seg_size];
  78 }
  79 
  80 template <class E, MEMFLAGS F>
  81 void Stack<E, F>::clear(bool clear_cache)
  82 {
  83   free_segments(_cur_seg);
  84   if (clear_cache) free_segments(_cache);
  85   reset(clear_cache);
  86 }
  87 
  88 template <class E, MEMFLAGS F>
  89 size_t Stack<E, F>::adjust_segment_size(size_t seg_size)
  90 {
  91   const size_t elem_sz = sizeof(E);
  92   const size_t ptr_sz = sizeof(E*);
  93   assert(elem_sz % ptr_sz == 0 || ptr_sz % elem_sz == 0, "bad element size");
  94   if (elem_sz < ptr_sz) {
  95     return align_size_up(seg_size * elem_sz, ptr_sz) / elem_sz;
  96   }
  97   return seg_size;
  98 }
  99 
 100 template <class E, MEMFLAGS F>
 101 size_t Stack<E, F>::link_offset() const
 102 {
 103   return align_size_up(this->_seg_size * sizeof(E), sizeof(E*));
 104 }
 105 
 106 template <class E, MEMFLAGS F>
 107 size_t Stack<E, F>::segment_bytes() const
 108 {
 109   return link_offset() + sizeof(E*);
 110 }
 111 
 112 template <class E, MEMFLAGS F>
 113 E** Stack<E, F>::link_addr(E* seg) const
 114 {
 115   return (E**) ((char*)seg + link_offset());
 116 }
 117 
 118 template <class E, MEMFLAGS F>
 119 E* Stack<E, F>::get_link(E* seg) const
 120 {
 121   return *link_addr(seg);
 122 }
 123 




  75     return tmp;
  76   }
  77   return this->_cur_seg[--this->_cur_seg_size];
  78 }
  79 
  80 template <class E, MEMFLAGS F>
  81 void Stack<E, F>::clear(bool clear_cache)
  82 {
  83   free_segments(_cur_seg);
  84   if (clear_cache) free_segments(_cache);
  85   reset(clear_cache);
  86 }
  87 
  88 template <class E, MEMFLAGS F>
  89 size_t Stack<E, F>::adjust_segment_size(size_t seg_size)
  90 {
  91   const size_t elem_sz = sizeof(E);
  92   const size_t ptr_sz = sizeof(E*);
  93   assert(elem_sz % ptr_sz == 0 || ptr_sz % elem_sz == 0, "bad element size");
  94   if (elem_sz < ptr_sz) {
  95     return align_up(seg_size * elem_sz, ptr_sz) / elem_sz;
  96   }
  97   return seg_size;
  98 }
  99 
 100 template <class E, MEMFLAGS F>
 101 size_t Stack<E, F>::link_offset() const
 102 {
 103   return align_up(this->_seg_size * sizeof(E), sizeof(E*));
 104 }
 105 
 106 template <class E, MEMFLAGS F>
 107 size_t Stack<E, F>::segment_bytes() const
 108 {
 109   return link_offset() + sizeof(E*);
 110 }
 111 
 112 template <class E, MEMFLAGS F>
 113 E** Stack<E, F>::link_addr(E* seg) const
 114 {
 115   return (E**) ((char*)seg + link_offset());
 116 }
 117 
 118 template <class E, MEMFLAGS F>
 119 E* Stack<E, F>::get_link(E* seg) const
 120 {
 121   return *link_addr(seg);
 122 }
 123 


< prev index next >