comparison src/share/vm/utilities/quickSort.cpp @ 4070:6fd81579526f

7102044: G1: VM crashes with assert(old_end != new_end) failed: don't call this otherwise Summary: arrayOopDesc::max_array_length() should return a value that does not overflow a size_t if it is converted to bytes. Reviewed-by: kvn, dholmes
author brutisso
date Mon, 31 Oct 2011 08:01:20 +0100
parents e807478bf9ca
children 3c648b9ad052
comparison
equal deleted inserted replaced
4069:59519b7d7b9d 4070:6fd81579526f
21 * questions. 21 * questions.
22 * 22 *
23 */ 23 */
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26
27 /////////////// Unit tests ///////////////
28
29 #ifndef PRODUCT
30
31 #include "runtime/os.hpp"
26 #include "utilities/quickSort.hpp" 32 #include "utilities/quickSort.hpp"
27
28 #ifndef PRODUCT
29
30 // Unit tests
31
32 #include "runtime/os.hpp"
33 #include <stdlib.h> 33 #include <stdlib.h>
34 34
35 static int test_comparator(int a, int b) { 35 static int test_comparator(int a, int b) {
36 if (a == b) { 36 if (a == b) {
37 return 0; 37 return 0;
92 sort<int, C>(arrayToSort, length, comparator, idempotent); 92 sort<int, C>(arrayToSort, length, comparator, idempotent);
93 return compare_arrays(arrayToSort, expectedResult, length); 93 return compare_arrays(arrayToSort, expectedResult, length);
94 } 94 }
95 95
96 bool QuickSort::test_quick_sort() { 96 bool QuickSort::test_quick_sort() {
97 tty->print_cr("test_quick_sort\n"); 97 tty->print_cr("test_quick_sort");
98 { 98 {
99 int* test_array = NULL; 99 int* test_array = NULL;
100 int* expected_array = NULL; 100 int* expected_array = NULL;
101 assert(sort_and_compare(test_array, expected_array, 0, test_comparator), "Empty array not handled"); 101 assert(sort_and_compare(test_array, expected_array, 0, test_comparator), "Empty array not handled");
102 } 102 }