changeset 27338:b82a370a474e

8147012: Fix includes in internalVMTests.cpp Reviewed-by: stefank, mgerdin
author ehelin
date Tue, 19 Jan 2016 11:00:29 +0100
parents 69fec9885618
children ca92396edf68
files src/share/vm/classfile/altHashing.cpp src/share/vm/compiler/directivesParser.cpp src/share/vm/compiler/directivesParser.hpp src/share/vm/gc/shared/collectedHeap.cpp src/share/vm/gc/shared/gcTimer.cpp src/share/vm/gc/shared/gcTimer.hpp src/share/vm/memory/guardedMemory.cpp src/share/vm/oops/arrayOop.cpp src/share/vm/oops/arrayOop.hpp src/share/vm/runtime/objectMonitor.cpp src/share/vm/runtime/vmStructs.cpp src/share/vm/utilities/globalDefinitions.cpp src/share/vm/utilities/globalDefinitions.hpp src/share/vm/utilities/internalVMTests.cpp src/share/vm/utilities/json.cpp src/share/vm/utilities/json.hpp src/share/vm/utilities/quickSort.cpp src/share/vm/utilities/quickSort.hpp
diffstat 18 files changed, 104 insertions(+), 101 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/altHashing.cpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/classfile/altHashing.cpp	Tue Jan 19 11:00:29 2016 +0100
@@ -300,4 +300,8 @@
   testMurmur3_32_ByteArray();
   testEquivalentHashes();
 }
+
+void AltHashing_test() {
+  AltHashing::test_alt_hash();
+}
 #endif // PRODUCT
--- a/src/share/vm/compiler/directivesParser.cpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/compiler/directivesParser.cpp	Tue Jan 19 11:00:29 2016 +0100
@@ -608,7 +608,7 @@
   cd.clean_tmp();
 }
 
-bool DirectivesParser::test() {
+void DirectivesParser::test() {
   DirectivesParser::test("{}", false);
   DirectivesParser::test("[]", true);
   DirectivesParser::test("[{}]", false);
@@ -742,8 +742,10 @@
     "    }" "\n"
     "  }" "\n"
     "]" "\n", false);
+}
 
-  return true;
+void DirectivesParser_test() {
+  DirectivesParser::test();
 }
 
 #endif
--- a/src/share/vm/compiler/directivesParser.hpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/compiler/directivesParser.hpp	Tue Jan 19 11:00:29 2016 +0100
@@ -136,7 +136,7 @@
 #ifndef PRODUCT
   static void test(const char* json, bool valid);
 public:
-  static bool test();
+  static void test();
 #endif
 };
 
--- a/src/share/vm/gc/shared/collectedHeap.cpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/gc/shared/collectedHeap.cpp	Tue Jan 19 11:00:29 2016 +0100
@@ -630,4 +630,8 @@
   assert(!heap->is_in(after_heap),
          "after_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(after_heap));
 }
+
+void CollectedHeap_test() {
+  CollectedHeap::test_is_in();
+}
 #endif
--- a/src/share/vm/gc/shared/gcTimer.cpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/gc/shared/gcTimer.cpp	Tue Jan 19 11:00:29 2016 +0100
@@ -388,7 +388,7 @@
   }
 };
 
-void GCTimerAllTest::all() {
+void GCTimer_test() {
   GCTimerTest::all();
   TimePartitionPhasesIteratorTest::all();
 }
--- a/src/share/vm/gc/shared/gcTimer.hpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/gc/shared/gcTimer.hpp	Tue Jan 19 11:00:29 2016 +0100
@@ -185,16 +185,4 @@
   virtual GCPhase* next();
 };
 
-
-/////////////// Unit tests ///////////////
-
-#ifndef PRODUCT
-
-class GCTimerAllTest {
- public:
-  static void all();
-};
-
-#endif
-
 #endif // SHARE_VM_GC_SHARED_GCTIMER_HPP
--- a/src/share/vm/memory/guardedMemory.cpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/memory/guardedMemory.cpp	Tue Jan 19 11:00:29 2016 +0100
@@ -157,5 +157,9 @@
   assert(GuardedMemory::free_copy(no_data_copy), "Expected valid guards even for no data copy");
 }
 
+void GuardedMemory_test() {
+  GuardedMemory::test_guarded_memory();
+}
+
 #endif // !PRODUCT
 
--- a/src/share/vm/oops/arrayOop.cpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/oops/arrayOop.cpp	Tue Jan 19 11:00:29 2016 +0100
@@ -39,21 +39,24 @@
   return (julong)(size_t)bytes == bytes;
 }
 
-void arrayOopDesc::test_max_array_length() {
-  assert(check_max_length_overflow(T_BOOLEAN), "size_t overflow for boolean array");
-  assert(check_max_length_overflow(T_CHAR), "size_t overflow for char array");
-  assert(check_max_length_overflow(T_FLOAT), "size_t overflow for float array");
-  assert(check_max_length_overflow(T_DOUBLE), "size_t overflow for double array");
-  assert(check_max_length_overflow(T_BYTE), "size_t overflow for byte array");
-  assert(check_max_length_overflow(T_SHORT), "size_t overflow for short array");
-  assert(check_max_length_overflow(T_INT), "size_t overflow for int array");
-  assert(check_max_length_overflow(T_LONG), "size_t overflow for long array");
-  assert(check_max_length_overflow(T_OBJECT), "size_t overflow for object array");
-  assert(check_max_length_overflow(T_ARRAY), "size_t overflow for array array");
-  assert(check_max_length_overflow(T_NARROWOOP), "size_t overflow for narrowOop array");
+static void test_max_array_length() {
+  assert(arrayOopDesc::check_max_length_overflow(T_BOOLEAN), "size_t overflow for boolean array");
+  assert(arrayOopDesc::check_max_length_overflow(T_CHAR), "size_t overflow for char array");
+  assert(arrayOopDesc::check_max_length_overflow(T_FLOAT), "size_t overflow for float array");
+  assert(arrayOopDesc::check_max_length_overflow(T_DOUBLE), "size_t overflow for double array");
+  assert(arrayOopDesc::check_max_length_overflow(T_BYTE), "size_t overflow for byte array");
+  assert(arrayOopDesc::check_max_length_overflow(T_SHORT), "size_t overflow for short array");
+  assert(arrayOopDesc::check_max_length_overflow(T_INT), "size_t overflow for int array");
+  assert(arrayOopDesc::check_max_length_overflow(T_LONG), "size_t overflow for long array");
+  assert(arrayOopDesc::check_max_length_overflow(T_OBJECT), "size_t overflow for object array");
+  assert(arrayOopDesc::check_max_length_overflow(T_ARRAY), "size_t overflow for array array");
+  assert(arrayOopDesc::check_max_length_overflow(T_NARROWOOP), "size_t overflow for narrowOop array");
 
   // T_VOID and T_ADDRESS are not supported by max_array_length()
 }
 
+void arrayOopDesc_test() {
+  test_max_array_length();
+}
 
 #endif //PRODUCT
--- a/src/share/vm/oops/arrayOop.hpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/oops/arrayOop.hpp	Tue Jan 19 11:00:29 2016 +0100
@@ -127,8 +127,6 @@
 // for unit testing
 #ifndef PRODUCT
   static bool check_max_length_overflow(BasicType type);
-  static int32_t old_max_array_length(BasicType type);
-  static void test_max_array_length();
 #endif
 };
 
--- a/src/share/vm/runtime/objectMonitor.cpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/runtime/objectMonitor.cpp	Tue Jan 19 11:00:29 2016 +0100
@@ -2470,4 +2470,8 @@
 
 void ObjectMonitor::print() {
 }
+
+void ObjectMonitor_test() {
+  ObjectMonitor::sanity_checks();
+}
 #endif
--- a/src/share/vm/runtime/vmStructs.cpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/runtime/vmStructs.cpp	Tue Jan 19 11:00:29 2016 +0100
@@ -3496,4 +3496,8 @@
     }
   }
 }
+
+void VMStructs_test() {
+  VMStructs::test();
+}
 #endif
--- a/src/share/vm/utilities/globalDefinitions.cpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/utilities/globalDefinitions.cpp	Tue Jan 19 11:00:29 2016 +0100
@@ -357,6 +357,11 @@
 }
 
 #ifndef PRODUCT
+// For unit testing only
+class GlobalDefinitions {
+public:
+  static void test_globals();
+};
 
 void GlobalDefinitions::test_globals() {
   intptr_t page_sizes[] = { os::vm_page_size(), 4096, 8192, 65536, 2*1024*1024 };
@@ -384,4 +389,8 @@
   }
 }
 
+void GlobalDefinitions_test() {
+  GlobalDefinitions::test_globals();
+}
+
 #endif // PRODUCT
--- a/src/share/vm/utilities/globalDefinitions.hpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/utilities/globalDefinitions.hpp	Tue Jan 19 11:00:29 2016 +0100
@@ -1452,14 +1452,4 @@
   return *(void**)addr;
 }
 
-#ifndef PRODUCT
-
-// For unit testing only
-class GlobalDefinitions {
-public:
-  static void test_globals();
-};
-
-#endif // PRODUCT
-
 #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP
--- a/src/share/vm/utilities/internalVMTests.cpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/utilities/internalVMTests.cpp	Tue Jan 19 11:00:29 2016 +0100
@@ -26,22 +26,9 @@
 
 #ifndef PRODUCT
 
-#include "classfile/altHashing.hpp"
-#include "compiler/directivesParser.hpp"
-#include "gc/shared/collectedHeap.hpp"
-#include "gc/shared/gcTimer.hpp"
-#include "memory/guardedMemory.hpp"
 #include "utilities/internalVMTests.hpp"
-#include "utilities/json.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/ostream.hpp"
-#include "utilities/quickSort.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc/g1/heapRegionRemSet.hpp"
-#endif
-#if INCLUDE_VM_STRUCTS
-#include "runtime/vmStructs.hpp"
-#endif
 
 #define run_unit_test(unit_test_function_call)              \
   tty->print_cr("Running test: " #unit_test_function_call); \
@@ -67,6 +54,21 @@
 void TestChunkedList_test();
 void Test_log_length();
 void Test_TempNewSymbol();
+void GlobalDefinitions_test();
+void GCTimer_test();
+void arrayOopDesc_test();
+void CollectedHeap_test();
+void QuickSort_test();
+void GuardedMemory_test();
+void AltHashing_test();
+void ObjectMonitor_test();
+void JSON_test();
+void DirectivesParser_test();
+
+#if INCLUDE_VM_STRUCTS
+void VMStructs_test();
+#endif
+
 #if INCLUDE_ALL_GCS
 void TestOldFreeSpaceCalculation_test();
 void TestG1BiasedArray_test();
@@ -74,7 +76,7 @@
 void TestCodeCacheRemSet_test();
 void FreeRegionList_test();
 void IHOP_test();
-void test_memset_with_concurrent_readers() NOT_DEBUG_RETURN;
+void test_memset_with_concurrent_readers();
 void TestPredictions_test();
 void WorkerDataArray_test();
 #endif
@@ -90,28 +92,28 @@
   run_unit_test(TestMetaspaceAux_test());
   run_unit_test(TestMetachunk_test());
   run_unit_test(TestVirtualSpaceNode_test());
-  run_unit_test(GlobalDefinitions::test_globals());
-  run_unit_test(GCTimerAllTest::all());
-  run_unit_test(arrayOopDesc::test_max_array_length());
-  run_unit_test(CollectedHeap::test_is_in());
-  run_unit_test(QuickSort::test_quick_sort());
-  run_unit_test(GuardedMemory::test_guarded_memory());
-  run_unit_test(AltHashing::test_alt_hash());
+  run_unit_test(GlobalDefinitions_test());
+  run_unit_test(GCTimer_test());
+  run_unit_test(arrayOopDesc_test());
+  run_unit_test(CollectedHeap_test());
+  run_unit_test(QuickSort_test());
+  run_unit_test(GuardedMemory_test());
+  run_unit_test(AltHashing_test());
   run_unit_test(TestNewSize_test());
   run_unit_test(TestOldSize_test());
   run_unit_test(TestKlass_test());
   run_unit_test(TestBitMap_test());
   run_unit_test(TestAsUtf8());
   run_unit_test(TestResourcehash_test());
-  run_unit_test(ObjectMonitor::sanity_checks());
+  run_unit_test(ObjectMonitor_test());
   run_unit_test(Test_linked_list());
   run_unit_test(TestChunkedList_test());
-  run_unit_test(JSONTest::test());
+  run_unit_test(JSON_test());
   run_unit_test(Test_log_length());
-  run_unit_test(DirectivesParser::test());
+  run_unit_test(DirectivesParser_test());
   run_unit_test(Test_TempNewSymbol());
 #if INCLUDE_VM_STRUCTS
-  run_unit_test(VMStructs::test());
+  run_unit_test(VMStructs_test());
 #endif
 #if INCLUDE_ALL_GCS
   run_unit_test(TestOldFreeSpaceCalculation_test());
--- a/src/share/vm/utilities/json.cpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/utilities/json.cpp	Tue Jan 19 11:00:29 2016 +0100
@@ -687,6 +687,24 @@
 }
 
 #ifndef PRODUCT
+class JSONTest : public JSON {
+ public:
+  static void test();
+
+ private:
+  JSONTest(const char* text);
+  static void test(const char* json, bool valid);
+
+  void log(uint level, const char* format, ...) ATTRIBUTE_PRINTF(3, 4);
+
+  bool callback(JSON_TYPE t, JSON_VAL* v, uint level);
+  JSON_TYPE prev;
+};
+
+void JSON_test() {
+  JSONTest::test();
+}
+
 void JSONTest::test(const char* text, bool should_pass) {
   JSONTest json(text);
   if (should_pass) {
@@ -707,7 +725,7 @@
   parse();
 }
 
-bool JSONTest::test() {
+void JSONTest::test() {
   JSONTest::test("{}", true);
   JSONTest::test("[]", true);
   JSONTest::test("  {  }  ", true);
@@ -842,8 +860,6 @@
       "         blocking_compile: true" "\n"
       "   }," "\n"
       "]" "\n", true);
-
-  return true;
 }
 
 void JSONTest::log(uint indent, const char* format, ...) {
--- a/src/share/vm/utilities/json.hpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/utilities/json.hpp	Tue Jan 19 11:00:29 2016 +0100
@@ -108,20 +108,4 @@
   const char* strerror(JSON_ERROR e);
 };
 
-#ifndef PRODUCT
-class JSONTest : public JSON {
- public:
-  static bool test();
-
- private:
-  JSONTest(const char* text);
-  static void test(const char* json, bool valid);
-
-  void log(uint level, const char* format, ...) ATTRIBUTE_PRINTF(3, 4);
-
-  bool callback(JSON_TYPE t, JSON_VAL* v, uint level);
-  JSON_TYPE prev;
-};
-#endif
-
 #endif // SHARE_VM_UTILITIES_JSON_HPP
--- a/src/share/vm/utilities/quickSort.cpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/utilities/quickSort.cpp	Tue Jan 19 11:00:29 2016 +0100
@@ -72,7 +72,7 @@
   }
 }
 
-void QuickSort::print_array(const char* prefix, int* array, int length) {
+static void print_array(const char* prefix, int* array, int length) {
   tty->print("%s:", prefix);
   for (int i = 0; i < length; i++) {
     tty->print(" %d", array[i]);
@@ -80,7 +80,7 @@
   tty->cr();
 }
 
-bool QuickSort::compare_arrays(int* actual, int* expected, int length) {
+static bool compare_arrays(int* actual, int* expected, int length) {
   for (int i = 0; i < length; i++) {
     if (actual[i] != expected[i]) {
       print_array("Sorted array  ", actual, length);
@@ -92,12 +92,12 @@
 }
 
 template <class C>
-bool QuickSort::sort_and_compare(int* arrayToSort, int* expectedResult, int length, C comparator, bool idempotent) {
-  sort<int, C>(arrayToSort, length, comparator, idempotent);
+static bool sort_and_compare(int* arrayToSort, int* expectedResult, int length, C comparator, bool idempotent = false) {
+  QuickSort::sort<int, C>(arrayToSort, length, comparator, idempotent);
   return compare_arrays(arrayToSort, expectedResult, length);
 }
 
-void QuickSort::test_quick_sort() {
+void QuickSort_test() {
   {
     int* test_array = NULL;
     int* expected_array = NULL;
@@ -208,15 +208,14 @@
     // Now sort them once with the test_even_odd_comparator. Then sort the
     // test_array one more time with test_even_odd_comparator and verify that
     // it is idempotent.
-    sort(expected_array, length, test_even_odd_comparator, true);
-    sort(test_array, length, test_even_odd_comparator, true);
+    QuickSort::sort(expected_array, length, test_even_odd_comparator, true);
+    QuickSort::sort(test_array, length, test_even_odd_comparator, true);
     assert(compare_arrays(test_array, expected_array, length), "Sorting identical arrays rendered different results");
-    sort(test_array, length, test_even_odd_comparator, true);
+    QuickSort::sort(test_array, length, test_even_odd_comparator, true);
     assert(compare_arrays(test_array, expected_array, length), "Sorting already sorted array changed order of elements - not idempotent");
 
     FREE_C_HEAP_ARRAY(int, test_array);
     FREE_C_HEAP_ARRAY(int, expected_array);
   }
 }
-
 #endif
--- a/src/share/vm/utilities/quickSort.hpp	Mon Jan 18 19:10:32 2016 +0100
+++ b/src/share/vm/utilities/quickSort.hpp	Tue Jan 19 11:00:29 2016 +0100
@@ -124,14 +124,6 @@
       inner_sort<T, C, false>(array, length, comparator);
     }
   }
-
-  // for unit testing
-#ifndef PRODUCT
-  static void print_array(const char* prefix, int* array, int length);
-  static bool compare_arrays(int* actual, int* expected, int length);
-  template <class C> static bool sort_and_compare(int* arrayToSort, int* expectedResult, int length, C comparator, bool idempotent = false);
-  static void test_quick_sort();
-#endif
 };