From 1fd365dfcd87983211e5dcf902b5400e1307b7be Mon Sep 17 00:00:00 2001 From: Roman Kennke Date: Wed, 16 Oct 2024 09:26:49 +0000 Subject: [PATCH] Address comments by @vpaprotsk --- src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp b/src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp index 22cda1f03e63f..f943aede6cbb9 100644 --- a/src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp +++ b/src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp @@ -411,8 +411,9 @@ static void generate_string_indexof_stubs(StubGenerator *stubgen, address *fnptr // with the haystack bytes. After the copy completes, we adjust the haystack pointer // to the valid haystack bytes on the stack. { + const Register tmp = rax; const Register haystack = rbx; - copy_to_stack(haystack, haystack_len, false, rax, XMM_TMP1, _masm); + copy_to_stack(haystack, haystack_len, false, tmp, XMM_TMP1, _masm); } // Dispatch to handlers for small needle and small haystack @@ -1565,7 +1566,7 @@ static void highly_optimized_short_cases(StrIntrinsicNode::ArgEncoding ae, Regis assert((COPIED_HAYSTACK_STACK_OFFSET == 0), "Must be zero!"); assert((COPIED_HAYSTACK_STACK_SIZE == 64), "Must be 64!"); - // Copy incoming haystack onto stack + // Copy incoming haystack onto stack (haystack <= 32 bytes) __ subptr(rsp, COPIED_HAYSTACK_STACK_SIZE); copy_to_stack(haystack, haystack_len, isU, tmp, XMM0, _masm); @@ -1631,7 +1632,7 @@ static void highly_optimized_short_cases(StrIntrinsicNode::ArgEncoding ae, Regis -// Copy the small (< 32 byte) haystack to the stack. Allows for vector reads without page fault +// Copy the small (<= 32 byte) haystack to the stack. Allows for vector reads without page fault // Only done for small haystacks // NOTE: This code assumes that the haystack points to a java array type AND there are // at least 8 bytes of header preceeding the haystack pointer.