Graal - first step
Thomas Wuerthinger
thomas.wuerthinger at oracle.com
Thu Apr 26 02:00:08 PDT 2012
Yes. Thanks for outlining the use case. In that case we would use a side
data structure to encode the information. There are utility functions in
the Graph class to create such side data structures:
Graph.createNodeBitMap and Graph.createNodeMap. We use those to keep the
number of fields in the node classes as small as possible.
- thomas
On 04.04.2012 04:33, Remi Forax wrote:
> The decision to profile or not should not be a global decision.
>
> Let's take an example, delayed de-visualization.
> Language like scalable or java8 allows to write high order functions
> that by example loop over a collection of items and call a block of
> code for each element.
> From a VM point of view the call to the block of code is megamorphic.
> One way to devirtualize it is to let the interpreter to profile the
> code so we will have enough information to find which concrete high
> order function is called thus be able to inline it but instead of
> generating only a vtable call for the block call one can also add a
> code that will profile the type again.
> Because the code was inclined, the block call is not megamorphic
> anymore and a second generation will be able to fully online the high
> order function call at callsite.
> So deciding to insert profiling information should not be done globally.
>
> Rémi
>
> Sent from my Phone
>
> ----- Reply message -----
> From: "Thomas Wuerthinger" <thomas.wuerthinger at oracle.com>
> To: "Rémi Forax" <forax at univ-mlv.fr>
> Cc: <graal-dev at openjdk.java.net>
> Subject: Graal - first step
> Date: Wed, Apr 4, 2012 11:23
>
>
> On 04.04.2012 00:16, Rémi Forax wrote:
> >>> Another related problem is that there is currently no node that does
> >>> profiling so
> >>> I can't generate a graph of nodes with profile information that I
> >>> will be able to extract
> >>> using Graal interface with Hotspot.
> >> It is possible to generate a node that will lower itself to a
> >> store/load to an object that is pointing to the profiling data. The
> >> Graal snippet mechanism would allow to specify the lowering in Java
> >> code (like we do with arraycopy intrinsification, see
> >> ArrayCopySnippets class). What kind of general-purpose interface
> >> would you suggest for weaving profiling code into the Graal IR?
> >
> > I think some nodes like IfNode, SwitchNode, InstanceOfNode etc. should
> > have a boolean
> > asking for generating the record code, in order to record branch taken,
> > type profile and exception seen.
> > By example for IfNode, a boolean profileBranchTakenProbability will ask
> > the code generator to generate the record code for each branch of
> the if.
> >
> > and as you said, a new phase should be introduced that will add new
> > Nodes (using snippet)
> > to generate the record code where it should be generated.
> We could add a phase that automatically inserts such code on every
> control split. What is the format / Java data structure in which you
> would like to have it recorded?
>
> - thomas
More information about the graal-dev
mailing list