From 7ee657d10e5e8f1ca981a0cce762a84e3d8e8014 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Sequoia Date: Tue, 31 Mar 2020 09:43:11 -0700 Subject: [PATCH] test_arraycopy_func: Use CAST_TO_FN_PTR() rather than directly casting arraycopy_fn Signed-off-by: Jeremy Huddleston Sequoia --- src/hotspot/share/runtime/stubRoutines.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/runtime/stubRoutines.cpp b/src/hotspot/share/runtime/stubRoutines.cpp index e31bd73f7f..79aa98e3ae 100644 --- a/src/hotspot/share/runtime/stubRoutines.cpp +++ b/src/hotspot/share/runtime/stubRoutines.cpp @@ -247,18 +247,21 @@ static void test_arraycopy_func(address func, int alignment) { // Use middle of array to check that memory before it is not modified. address buffer = align_up((address)&lbuffer[4], BytesPerLong); address buffer2 = align_up((address)&lbuffer2[4], BytesPerLong); + + arraycopy_fn copyfunc = CAST_TO_FN_PTR(arraycopy_fn, func); + // do an aligned copy - ((arraycopy_fn)func)(buffer, buffer2, 0); + copyfunc(buffer, buffer2, 0); for (i = 0; i < sizeof(lbuffer); i++) { assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything"); } // adjust destination alignment - ((arraycopy_fn)func)(buffer, buffer2 + alignment, 0); + copyfunc(buffer, buffer2 + alignment, 0); for (i = 0; i < sizeof(lbuffer); i++) { assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything"); } // adjust source alignment - ((arraycopy_fn)func)(buffer + alignment, buffer2, 0); + copyfunc(buffer + alignment, buffer2, 0); for (i = 0; i < sizeof(lbuffer); i++) { assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything"); }