[9] RFR(S): 8144693: Intrinsify StringCoding.hasNegatives() on SPARC

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Mar 3 04:37:58 UTC 2016

Why you are avoiding the same register for src and dst in instructions? 
For example:

+  add(t3, 0x80, t2);

I think you can use less registers if you reuse registers. The less 
registers you use - less registers will be spilled on stack in the code 
which use your code.

'size' register is defined as 32-bit values in .ad file. It may have 
garbage in apper bits - I would suggest to sign extend it before using:


If size is small (t5 != 0 for unaligned header) may be we should just 
jump to tail code to do right shift (to mov(0, result); instruction).
But I am not insisting on this.


On 3/2/16 3:33 PM, Guy Delamarter wrote:
> Hi,
> Please review the following patch adding a SPARC intrinsic for
> StringCoding.hasNegatives to hotspot and supporting changes.
> Tobias Hartmann (tobias.hartmann at oracle.com) has offered to
> sponsor these changes.
> Summary:
> hasNegatives is a utility method for encoding/decoding under the new
> Compact Strings framework, returning whether the given byte array
> (segment) contains any negative entries.  hasNegatives is an intrinsic
> candidate, emitted by hotspot as a node in the latest Java 9 builds,
> but the SPARC node match and (inline assembly) implementation have
> been missing up to now.  This implementation checks aligned 8-byte
> windows onto the array segment for negative bytes, carefully ignoring
> bytes in the window that happen to be outside the segment.
> It was discovered that the private access of the hasNegatives method
> prevented direct testing of the intrinsic from outside StringCoding,
> so that was changed to public.  Subsequent to this change a compiler
> test class (TestHasNegatives) was added providing useful validation
> coverage.
> Webrevs:
> http://cr.openjdk.java.net/~thartmann/8144693/hotspot/webrev.00/
> http://cr.openjdk.java.net/~thartmann/8144693/jdk/webrev.00/
> Issue:
> https://bugs.openjdk.java.net/browse/JDK-8144693
> Thanks,
> Guy Delamarter

More information about the hotspot-dev mailing list