News for hackers. Stuff that matters.
Re:How the JVM compares strings on x86 using pcmpestri by exikyut on Sunday January 07, 2018 @06:09AM (#16090371)
> But did you know there is also a secret second implementation? String.compareTo is one of a few methods that is important enough to also get a special hand-rolled assembly version.

oooooh.

Is there a list somewhere of all the functions that have had such special treatment?

Re:How the JVM compares strings on x86 using pcmpestri by nicoulaj on Sunday January 07, 2018 @06:21AM (#16090407)
The intrinsics for the HotSpot JVM are declared here: http://hg.openjdk.java.net/jdk10/jdk10/hotspot/file/5ab7a67b...

(look for "java_lang_Math" for instance)

Re:How the JVM compares strings on x86 using pcmpestri by rplnt on Sunday January 07, 2018 @08:31AM (#16090788)
Are you telling us it's not a secret then?
Re:How the JVM compares strings on x86 using pcmpestri by sudhirj on Sunday January 07, 2018 @12:05PM (#16091528)
Don’t know if this is sarcasm, but no, doubtful it’s a secret. Or might depend on the JVM license. OpenJDK obviously has no secrets.

But otherwise, assembly overrides for hot paths in execution targets that support them aren’t actually a big secret, just that they’re rarely visible. Think Go has a lot of processed architecture specific assembly for some functions, especially crypto iirc.

Re:How the JVM compares strings on x86 using pcmpestri by rplnt on Monday January 08, 2018 @06:26AM (#16096049)
Yeah, it was a sarcasm. The article (quoted in parent comment) called it a secret implementation.
Re:How the JVM compares strings on x86 using pcmpestri by kaeluka on Sunday January 07, 2018 @06:15AM (#16090387)
The feature is called "intrinsics", this claims to be a list: https://gist.github.com/apangin/7a9b7062a4bd0cd41fcc
Re:How the JVM compares strings on x86 using pcmpestri by djsumdog on Sunday January 07, 2018 @09:55AM (#16091025)
Interesting. So do all those functions have assembly implementations or do some of them have c implementations? I'm assuming the list of functions also changes depending on the architecture?
Re:How the JVM compares strings on x86 using pcmpestri by BeeOnRope on Sunday January 07, 2018 @02:42PM (#16092251)
They are implemented in different ways, depending on the instrinsic.

Many are implemented in the in-memory intermediate SSA (?) representation the JVM uses for its JIT, so they essentially get compiled down to assembly at the same time as the surrounding bytecode.

Some are implemented as jumps to various native methods, which in turn might be implemented in C++ or assembly. Most intrinsics are available on most platforms: only some of the hand-coded assembly versions are less likely to have wide support.