hotspot-compiler-dev Digest, Vol 145, Issue 95
Roland Westrelin
rwestrel at redhat.com
Tue Jul 23 11:27:39 UTC 2019
> At that point it’s all a matter of priorities. We have known how to
> complete the C2 type system for years. What we lack is a reason to
> disrupt the code.
>
> As a matter of priority, I would much rather see C2 gain better
> (bitwise) type inference for int and long values, or for
> pointer-chasing through (often immutable) structures. Both of those
> would IMO pay off better than the exercise (largely academic, I fear)
> of completing the interface lattice in C2.
Performance is not what motivated me to fix the type system. If there's
any performance improvement then it's an added bonus. Work I've been
doing on value types in the valhalla project is what actually prompted
me to see what it would take to properly handle interfaces.
This:
http://hg.openjdk.java.net/valhalla/valhalla/file/f1a3e0175d05/src/hotspot/share/opto/castnode.cpp#l289
where c2 leaves a useless CheckCastPP behind because handling of
CheckCastPP was dumbed down so it can cope with a broken type system. I
had to add a workaround. Interestingly, Tobias hit a similar issue when
working on value types recently and had to work around it too:
http://hg.openjdk.java.net/valhalla/valhalla/file/f1a3e0175d05/src/hotspot/share/opto/parse2.cpp#l222
To me fixing the type system is similar to previous changes that
addressed long standing technical debt where the code is inheritly
broken and it's much better to fix the root cause rather than work
around it forever. One past example of this was handling of CastPP where
dropping CastPP after CCP would cause incorrect optimizations to be
applied. Another one is work that Tobias has done so ConvI2L in array
addressing on 64 bit is made properly control dependent on a range
check.
Doing the right thing improves stability (last bug related to handling
of interfaces is from 2016, I think, which is quite recent given how
long C2 has been around) and also makes transformations in C2 easier to
reason about, less surprising and less brittle.
So it's not about completing the interface lattice so much as it is
about getting rid of long standing piece of technical debt so we can be
more productive with c2. I hope down the road this will allow little
wins here and there and pay for itself.
Roland.
More information about the hotspot-compiler-dev
mailing list