PUBLIC COMMENTS
MacroAssembler::string_indexof() code loads 16 bytes into XMM
registers regardless where char[] array ends and as result
it can read beyond reserved heap space causing SEGV.
I divided code in string_indexof() into two parts:
1. For constant substrings with size >=8 elements. This part doesn't need
special handling strings loading and it doesn't modify strings pointers so no need to push them on stack.
2. For constant substrings with size <8 elements or non constant substring
(size is unknown). This part has special handling for strings loading:
if size is small and it cross page boundary copy string to stack and load from it. If substring is constant use separate mov instructions to load it. This part also do additional checks for small tails during search and back up pointers to load them.
|