< prev index next >

test/hotspot/gtest/metaspace/test_binlist.cpp

Print this page
*** 24,16 ***
--- 24,18 ---
   */
  
  #include "precompiled.hpp"
  #include "memory/metaspace/binList.hpp"
  #include "memory/metaspace/counters.hpp"
+ #include "memory/metaspace/metablock.hpp"
  //#define LOG_PLEASE
  #include "metaspaceGtestCommon.hpp"
  
  using metaspace::BinList32;
  using metaspace::BinListImpl;
  using metaspace::MemRangeCounter;
+ using metaspace::MetaBlock;
  
  #define CHECK_BL_CONTENT(bl, expected_num, expected_size) { \
    EXPECT_EQ(bl.count(), (unsigned)expected_num); \
    EXPECT_EQ(bl.total_size(), (size_t)expected_size); \
    if (expected_num == 0) { \

*** 41,10 ***
--- 43,23 ---
    } else { \
      EXPECT_FALSE(bl.is_empty()); \
    } \
  }
  
+ template <int num_lists>
+ struct TestedBinList : public BinListImpl<num_lists> {
+   typedef BinListImpl<num_lists> ListType;
+   void add_block(MetaWord* p, size_t word_size) {
+     ListType::add_block(MetaBlock(p, word_size));
+   }
+   MetaWord* remove_block(size_t requested_size, size_t* real_size) {
+     MetaBlock result = ListType::remove_block(requested_size);
+     (*real_size) = result.word_size();
+     return result.base();
+   }
+ };
+ 
  template <class BINLISTTYPE>
  struct BinListBasicTest {
  
    static const size_t maxws;
  

*** 204,16 ***
    }
  };
  
  template <typename BINLISTTYPE> const size_t BinListBasicTest<BINLISTTYPE>::maxws = BINLISTTYPE::MaxWordSize;
  
! TEST_VM(metaspace, BinList_basic_1)     { BinListBasicTest< BinListImpl<1> >::basic_test(); }
! TEST_VM(metaspace, BinList_basic_8)     { BinListBasicTest< BinListImpl<8> >::basic_test(); }
! TEST_VM(metaspace, BinList_basic_32)    { BinListBasicTest<BinList32>::basic_test(); }
  
! TEST_VM(metaspace, BinList_basic_2_1)     { BinListBasicTest< BinListImpl<1> >::basic_test_2(); }
! TEST_VM(metaspace, BinList_basic_2_8)     { BinListBasicTest< BinListImpl<8> >::basic_test_2(); }
! TEST_VM(metaspace, BinList_basic_2_32)    { BinListBasicTest<BinList32>::basic_test_2(); }
  
! TEST_VM(metaspace, BinList_basic_rand_1)     { BinListBasicTest< BinListImpl<1> >::random_test(); }
! TEST_VM(metaspace, BinList_basic_rand_8)     { BinListBasicTest< BinListImpl<8> >::random_test(); }
! TEST_VM(metaspace, BinList_basic_rand_32)    { BinListBasicTest<BinList32>::random_test(); }
--- 219,16 ---
    }
  };
  
  template <typename BINLISTTYPE> const size_t BinListBasicTest<BINLISTTYPE>::maxws = BINLISTTYPE::MaxWordSize;
  
! TEST_VM(metaspace, BinList_basic_1)     { BinListBasicTest< TestedBinList<1> >::basic_test(); }
! TEST_VM(metaspace, BinList_basic_8)     { BinListBasicTest< TestedBinList<8> >::basic_test(); }
! TEST_VM(metaspace, BinList_basic_32)    { BinListBasicTest< TestedBinList<32> >::basic_test(); }
  
! TEST_VM(metaspace, BinList_basic_2_1)     { BinListBasicTest< TestedBinList<1> >::basic_test_2(); }
! TEST_VM(metaspace, BinList_basic_2_8)     { BinListBasicTest< TestedBinList<8> >::basic_test_2(); }
! TEST_VM(metaspace, BinList_basic_2_32)    { BinListBasicTest< TestedBinList<32> >::basic_test_2(); }
  
! TEST_VM(metaspace, BinList_basic_rand_1)     { BinListBasicTest< TestedBinList<1> >::random_test(); }
! TEST_VM(metaspace, BinList_basic_rand_8)     { BinListBasicTest< TestedBinList<8> >::random_test(); }
! TEST_VM(metaspace, BinList_basic_rand_32)    { BinListBasicTest< TestedBinList<32> >::random_test(); }
< prev index next >