--- old/src/cpu/zero/vm/stubGenerator_zero.cpp 2015-03-23 13:56:31.496503637 +0100 +++ new/src/cpu/zero/vm/stubGenerator_zero.cpp 2015-03-23 13:56:31.439504512 +0100 @@ -176,19 +176,6 @@ StubRoutines::_oop_arraycopy; } - static int SafeFetch32(int *adr, int errValue) { - int value = errValue; - value = *adr; - return value; - } - - static intptr_t SafeFetchN(intptr_t *adr, intptr_t errValue) { - intptr_t value = errValue; - value = *adr; - return value; - } - - void generate_initial() { // Generates all stubs and initializes the entry points @@ -241,11 +228,11 @@ generate_arraycopy_stubs(); // Safefetch stubs. - StubRoutines::_safefetch32_entry = CAST_FROM_FN_PTR(address, StubGenerator::SafeFetch32); + StubRoutines::_safefetch32_entry = NULL; StubRoutines::_safefetch32_fault_pc = NULL; StubRoutines::_safefetch32_continuation_pc = NULL; - StubRoutines::_safefetchN_entry = CAST_FROM_FN_PTR(address, StubGenerator::SafeFetchN); + StubRoutines::_safefetchN_entry = NULL; StubRoutines::_safefetchN_fault_pc = NULL; StubRoutines::_safefetchN_continuation_pc = NULL; } --- old/src/share/vm/runtime/stubRoutines.cpp 2015-03-23 13:56:33.455473571 +0100 +++ new/src/share/vm/runtime/stubRoutines.cpp 2015-03-23 13:56:33.398474447 +0100 @@ -213,31 +213,35 @@ // simple test for SafeFetch32 static void test_safefetch32() { - int dummy = 17; - int* const p_invalid = (int*) get_segfault_address(); - int* const p_valid = &dummy; - int result_invalid = SafeFetch32(p_invalid, 0xABC); - assert(result_invalid == 0xABC, "SafeFetch32 error"); - int result_valid = SafeFetch32(p_valid, 0xABC); - assert(result_valid == 17, "SafeFetch32 error"); + if (CanUseSafeFetch32()) { + int dummy = 17; + int* const p_invalid = (int*) get_segfault_address(); + int* const p_valid = &dummy; + int result_invalid = SafeFetch32(p_invalid, 0xABC); + assert(result_invalid == 0xABC, "SafeFetch32 error"); + int result_valid = SafeFetch32(p_valid, 0xABC); + assert(result_valid == 17, "SafeFetch32 error"); + } } // simple test for SafeFetchN static void test_safefetchN() { + if (CanUseSafeFetchN()) { #ifdef _LP64 - const intptr_t v1 = UCONST64(0xABCD00000000ABCD); - const intptr_t v2 = UCONST64(0xDEFD00000000DEFD); + const intptr_t v1 = UCONST64(0xABCD00000000ABCD); + const intptr_t v2 = UCONST64(0xDEFD00000000DEFD); #else - const intptr_t v1 = 0xABCDABCD; - const intptr_t v2 = 0xDEFDDEFD; + const intptr_t v1 = 0xABCDABCD; + const intptr_t v2 = 0xDEFDDEFD; #endif - intptr_t dummy = v1; - intptr_t* const p_invalid = (intptr_t*) get_segfault_address(); - intptr_t* const p_valid = &dummy; - intptr_t result_invalid = SafeFetchN(p_invalid, v2); - assert(result_invalid == v2, "SafeFetchN error"); - intptr_t result_valid = SafeFetchN(p_valid, v2); - assert(result_valid == v1, "SafeFetchN error"); + intptr_t dummy = v1; + intptr_t* const p_invalid = (intptr_t*) get_segfault_address(); + intptr_t* const p_valid = &dummy; + intptr_t result_invalid = SafeFetchN(p_invalid, v2); + assert(result_invalid == v2, "SafeFetchN error"); + intptr_t result_valid = SafeFetchN(p_valid, v2); + assert(result_valid == v1, "SafeFetchN error"); + } } #endif --- old/test/compiler/startup/NumCompilerThreadsCheck.java 2015-03-23 13:56:34.365459603 +0100 +++ new/test/compiler/startup/NumCompilerThreadsCheck.java 2015-03-23 13:56:34.307460494 +0100 @@ -38,20 +38,10 @@ String expectedOutput = "CICompilerCount of -1 is invalid"; out.shouldContain(expectedOutput); - if (isZeroVm()) { + if (Platform.isZero()) { String expectedLowWaterMarkText = "must be at least 0"; out.shouldContain(expectedLowWaterMarkText); } } - private static boolean isZeroVm() { - String vmName = System.getProperty("java.vm.name"); - if (vmName == null) { - throw new RuntimeException("No VM name"); - } - if (vmName.toLowerCase().contains("zero")) { - return true; - } - return false; - } } --- old/test/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java 2015-03-23 13:56:35.155447478 +0100 +++ new/test/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java 2015-03-23 13:56:35.097448369 +0100 @@ -21,7 +21,7 @@ public static void main(String[] args) throws Exception { - if (!Platform.isDebugBuild()) { + if (!Platform.isDebugBuild() || Platform.isZero()) { return; } --- old/test/testlibrary/com/oracle/java/testlibrary/Platform.java 2015-03-23 13:56:35.990434669 +0100 +++ new/test/testlibrary/com/oracle/java/testlibrary/Platform.java 2015-03-23 13:56:35.933435545 +0100 @@ -47,6 +47,10 @@ public static boolean isGraal() { return vmName.endsWith(" Graal VM"); } + + public static boolean isZero() { + return vmName.endsWith(" Zero VM"); + } public static boolean isMinimal() { return vmName.endsWith(" Minimal VM");