< prev index next >

src/hotspot/share/gc/shared/oopStorageParState.inline.hpp

Print this page




  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_GC_SHARED_OOPSTORAGEPARSTATE_INLINE_HPP
  26 #define SHARE_GC_SHARED_OOPSTORAGEPARSTATE_INLINE_HPP
  27 
  28 #include "gc/shared/oopStorage.inline.hpp"
  29 #include "gc/shared/oopStorageParState.hpp"
  30 #include "memory/allocation.hpp"
  31 #include "metaprogramming/conditional.hpp"
  32 #include "utilities/macros.hpp"
  33 
  34 #if INCLUDE_ALL_GCS
  35 
  36 template<typename F>
  37 class OopStorage::BasicParState::AlwaysTrueFn VALUE_OBJ_CLASS_SPEC {
  38   F _f;
  39 
  40 public:
  41   AlwaysTrueFn(F f) : _f(f) {}
  42 
  43   template<typename OopPtr>     // [const] oop*
  44   bool operator()(OopPtr ptr) const { _f(ptr); return true; }
  45 };
  46 
  47 template<bool is_const, typename F>
  48 inline void OopStorage::BasicParState::iterate(F f) {
  49   // Wrap f in ATF so we can use Block::iterate.
  50   AlwaysTrueFn<F> atf_f(f);
  51   ensure_iteration_started();
  52   typename Conditional<is_const, const Block*, Block*>::type block;
  53   while ((block = claim_next_block()) != NULL) {
  54     block->iterate(atf_f);
  55   }
  56 }
  57 




  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_GC_SHARED_OOPSTORAGEPARSTATE_INLINE_HPP
  26 #define SHARE_GC_SHARED_OOPSTORAGEPARSTATE_INLINE_HPP
  27 
  28 #include "gc/shared/oopStorage.inline.hpp"
  29 #include "gc/shared/oopStorageParState.hpp"

  30 #include "metaprogramming/conditional.hpp"
  31 #include "utilities/macros.hpp"
  32 
  33 #if INCLUDE_ALL_GCS
  34 
  35 template<typename F>
  36 class OopStorage::BasicParState::AlwaysTrueFn {
  37   F _f;
  38 
  39 public:
  40   AlwaysTrueFn(F f) : _f(f) {}
  41 
  42   template<typename OopPtr>     // [const] oop*
  43   bool operator()(OopPtr ptr) const { _f(ptr); return true; }
  44 };
  45 
  46 template<bool is_const, typename F>
  47 inline void OopStorage::BasicParState::iterate(F f) {
  48   // Wrap f in ATF so we can use Block::iterate.
  49   AlwaysTrueFn<F> atf_f(f);
  50   ensure_iteration_started();
  51   typename Conditional<is_const, const Block*, Block*>::type block;
  52   while ((block = claim_next_block()) != NULL) {
  53     block->iterate(atf_f);
  54   }
  55 }
  56 


< prev index next >