This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] natString.cc: Some fixes for bounds checking arithmetic.


Boehm, Hans wrote:
There's an orthogonal but related issue that might be worth mentioning.
Last I looked some of the natString.cc routines that involve this
bounds checking show up fairly high on profiles for SPECjbb and probably
also real code.  Most of the bounds checking is done with tests like

if (a > b || c > d || e > f)

My guess would be that on most architectures, it would be better to compile
this as

if ((long)((b - a) | (d - c) | (f - e)) < 0)

i.e. or sign bits together, and do a single test and branch on the result.
This reduces the number of branches, and thus avoids filling up branch
prediction tables with this sort of stuff.  It also clearly allows
all the expressions to be scheduled in parallel.

this kind of optimizations is pretty much the thing I hoped would be easy to come up with, test and implement with my 'bounds checking api' idea. thanks! ;)


cheers,
dalibor topic


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]