RFR(S): 8215792: AArch64: String.indexOf generates incorrect result

Andrew Haley aph at redhat.com
Mon Jan 21 17:51:38 UTC 2019

On 1/21/19 2:58 PM, Andrew Dinn wrote:
>> Once again, this is to address your question around testing for this
>> intrinsic and patch. We are working on testing and review complex
>> intrinsics to handle the wider problem of ensuring better quality of
>> AArch64 intrinsics. We’ll follow up in a different email on that.

> Well, one thing that needs to form part of that discussion is the
> potential benefit of these patches vs the cost of producing, reviewing
> and maintaining them. Included in the equation for the benefits is the
> number of users it will help and the criticality of the problem they
> face without the patch. On the costs side we need to factor in the
> effort needed to clearly document complex code compared with the
> potential cost of someone having to pick it up later and also the
> potential, even with good documentation, of the resulting code becoming
> a fly trap for developer and/or maintainer time.

We do. I was concerned about the complexity of the Boyer-Moore-
Horspool algorithm at the time but was persuaded to admit it. These
days I'd push back more: the last year or two of the AArch64 project
has hardened my attitude.

Rob Pike's 5 Rules of Programming

    Rule 1. You can't tell where a program is going to spend its
    time. Bottlenecks occur in surprising places, so don't try to
    second guess and put in a speed hack until you've proven that's
    where the bottleneck is.

    Rule 2. Measure. Don't tune for speed until you've measured, and
    even then don't unless one part of the code overwhelms the rest.

    Rule 3. Fancy algorithms are slow when n is small, and n is
    usually small. Fancy algorithms have big constants. Until you know
    that n is frequently going to be big, don't get fancy. (Even if n
    does get big, use Rule 2 first.)

    Rule 4. Fancy algorithms are buggier than simple ones, and they're
    much harder to implement. Use simple algorithms as well as simple
    data structures.


    More at https://users.ece.utexas.edu/~adnan/pike.html

Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671

More information about the hotspot-compiler-dev mailing list