< prev index next >

test/hotspot/gtest/memory/test_is_metaspace_obj.cpp

Print this page
rev 57511 : [mq]: metaspace-improvement


  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 #include "precompiled.hpp"
  25 #include "memory/allocation.inline.hpp"
  26 #include "memory/metaspace.hpp"
  27 #include "memory/metaspace/virtualSpaceList.hpp"
  28 #include "runtime/mutex.hpp"
  29 #include "runtime/mutexLocker.hpp"
  30 #include "runtime/os.hpp"
  31 #include "unittest.hpp"
  32 
  33 using namespace metaspace;
  34 

  35 
  36 // Test the cheerful multitude of metaspace-contains-functions.
  37 class MetaspaceIsMetaspaceObjTest : public ::testing::Test {
  38   Mutex* _lock;
  39   ClassLoaderMetaspace* _ms;
  40 
  41 public:
  42 
  43   MetaspaceIsMetaspaceObjTest() : _lock(NULL), _ms(NULL) {}
  44 
  45   virtual void SetUp() {
  46   }
  47 
  48   virtual void TearDown() {
  49     delete _ms;
  50     delete _lock;
  51   }
  52 
  53   void do_test(Metaspace::MetadataType mdType) {
  54     _lock = new Mutex(Monitor::native, "gtest-IsMetaspaceObjTest-lock", false, Monitor::_safepoint_check_never);


  96     // Test Metaspace::contains_xxx
  97     ASSERT_TRUE(Metaspace::contains(p));
  98     ASSERT_TRUE(Metaspace::contains_non_shared(p));
  99 
 100     delete _ms;
 101     _ms = NULL;
 102     delete _lock;
 103     _lock = NULL;
 104   }
 105 
 106 };
 107 
 108 TEST_VM_F(MetaspaceIsMetaspaceObjTest, non_class_space) {
 109   do_test(Metaspace::NonClassType);
 110 }
 111 
 112 TEST_VM_F(MetaspaceIsMetaspaceObjTest, class_space) {
 113   do_test(Metaspace::ClassType);
 114 }
 115 



  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 #include "precompiled.hpp"
  25 #include "memory/allocation.inline.hpp"
  26 #include "memory/metaspace.hpp"
  27 #include "memory/metaspace/virtualSpaceList.hpp"
  28 #include "runtime/mutex.hpp"
  29 #include "runtime/mutexLocker.hpp"
  30 #include "runtime/os.hpp"
  31 #include "unittest.hpp"
  32 
  33 using namespace metaspace;
  34 
  35 #if 0
  36 
  37 // Test the cheerful multitude of metaspace-contains-functions.
  38 class MetaspaceIsMetaspaceObjTest : public ::testing::Test {
  39   Mutex* _lock;
  40   ClassLoaderMetaspace* _ms;
  41 
  42 public:
  43 
  44   MetaspaceIsMetaspaceObjTest() : _lock(NULL), _ms(NULL) {}
  45 
  46   virtual void SetUp() {
  47   }
  48 
  49   virtual void TearDown() {
  50     delete _ms;
  51     delete _lock;
  52   }
  53 
  54   void do_test(Metaspace::MetadataType mdType) {
  55     _lock = new Mutex(Monitor::native, "gtest-IsMetaspaceObjTest-lock", false, Monitor::_safepoint_check_never);


  97     // Test Metaspace::contains_xxx
  98     ASSERT_TRUE(Metaspace::contains(p));
  99     ASSERT_TRUE(Metaspace::contains_non_shared(p));
 100 
 101     delete _ms;
 102     _ms = NULL;
 103     delete _lock;
 104     _lock = NULL;
 105   }
 106 
 107 };
 108 
 109 TEST_VM_F(MetaspaceIsMetaspaceObjTest, non_class_space) {
 110   do_test(Metaspace::NonClassType);
 111 }
 112 
 113 TEST_VM_F(MetaspaceIsMetaspaceObjTest, class_space) {
 114   do_test(Metaspace::ClassType);
 115 }
 116 
 117 #endif
< prev index next >