8238691: C2: turn subtype check into macro node

Roland Westrelin rwestrel at redhat.com
Fri Feb 7 15:32:38 UTC 2020


http://cr.openjdk.java.net/~roland/8238691/webrev.00/

I propose we turn subtype check into a macro node. This patch adds a new
node: SubTypeCheckNode which is a subclass of CmpNode. That node itself
can float around but because it feeds into an If, it's expanded at the
location of the If.

This should allow subtype checks that can't be compiled as a simple
pointer comparison at parse time to:

- better constant fold if type information improves as compilation
  proceeds

- be candidate for predication and split if

- have a chance of being compiled as a simple pointer comparison if type
  information improves

The implementation is relatively straightforward as there's already
logic to build a subtype check during macro expansion. Also, predication
and split if comes for free because the new node floats and is a subtype
of CmpP.

I changed the subtype check implementation to use immutable memory for
the super klass check offset. The existing implementation of subtype
check is a bit inconsistent when it comes to memory state handling: the
only remaining load that doesn't consume immutable memory is for the
secondary super type cache (which makes sense given that slot is
mutable) but nothing mutates that memory in the C2 IR when
PartialSubtypeCheckNode should I think. The new SubTypeCheck node
doesn't carry memory state but it emulates the current implementation by
walking the graph and looking for bottom memory which given nothing
mutates the secondary super cache is the same memory state that is
somewhat erroneously used today.

Roland.



More information about the hotspot-compiler-dev mailing list