--- old/src/share/vm/utilities/semaphore.cpp 2015-06-17 19:53:07.200014370 +0200 +++ new/src/share/vm/utilities/semaphore.cpp 2015-06-17 19:53:07.044009061 +0200 @@ -30,64 +30,29 @@ #ifndef PRODUCT -static void test_semaphore_single_with_max_once(uint max) { - assert(max > 0, "precondition"); +static void test_semaphore_single_separate(uint count) { + Semaphore sem(0); - Semaphore sem(0, max); - - sem.signal(); - sem.wait(); -} - -static void test_semaphore_single_with_max_one_less(uint max) { - assert(max > 0, "precondition"); - - Semaphore sem(0, max); - - for (uint i = 0; i < max -1; i++) { + for (uint i = 0; i < count; i++) { sem.signal(); } - for (uint i = 0; i < max -1; i++) { + for (uint i = 0; i < count; i++) { sem.wait(); } } -static void test_semaphore_single_with_max_all(uint max) { - assert(max > 0, "precondition"); - - Semaphore sem(0, max); +static void test_semaphore_single_combined(uint count) { + Semaphore sem(0); - for (uint i = 0; i < max; i++) { - sem.signal(); - } - - for (uint i = 0; i < max; i++) { - sem.wait(); - } -} - -static void test_semaphore_single_with_value(uint value, uint max) { - assert(max > 0, "precondition"); - - Semaphore sem(value, max); - - for (uint i = 0; i < value; i++) { - sem.wait(); - } -} - -static void test_semaphore_single_multiple() { - Semaphore sem(0, 1); - - for (uint i = 0; i < 100; i++) { + for (uint i = 0; i < count; i++) { sem.signal(); sem.wait(); } } static void test_semaphore_many(uint value, uint max, uint increments) { - Semaphore sem(value, max); + Semaphore sem(value); uint total = value; @@ -114,17 +79,13 @@ void test_semaphore() { for (uint i = 1; i < 10; i++) { - test_semaphore_single_with_max_once(i); - test_semaphore_single_with_max_one_less(i); - test_semaphore_single_with_max_all(i); + test_semaphore_single_separate(i); } for (uint i = 0; i < 10; i++) { - test_semaphore_single_with_value(i, 9 /* arbitrary max */); + test_semaphore_single_combined(i); } - test_semaphore_single_multiple(); - test_semaphore_many(); }