Java Local annotations and Graal Inlining

Juan Fumero juan.fumero at
Mon May 28 08:14:57 UTC 2018

Hi all, 

I have a question concerning local Java annotations and the inlining
phase in Graal. 

I want to get Java annotations associated with local variables (runtime
annotations). The way we currently do is through the ResolvedJavaMethod
and the getLocalAnnotations method (we based on Graal-0.22). I wanted
to reproduce this example using the last Graal but this method does not
exist anymore. 

Currently, we can see local annotations when we directly compile the
method that contains the annotations. However, when the method contains
a methodInvoke, after inlining we do not see any local annotations any
more. Is this due to an error during inlining? 

To clarify, here I show you a snippet of what we are trying to do. 
Our goal is to associate a Graal-IR node with a Java annotation. In
this case, a PhiNode (i var).

@Target({ ElementType.LOCAL_VARIABLE, ElementType.TYPE})
public @interface Local {

public void foo(...) {

public void bar(...) {
   for (@Local int i = 0, i ... ) {


If I build the Graal-IR for the method `bar`, I see @Local for the
PhiNode(i var). However, when I compile the method `foo`, I can the
inlined loop in `foo` after inlining but I do not see @Local anymore. 
The real code is more complicated, `foo` is from an abstract class and
bar is directly the user code. Our compiler has to start compiling from
method `foo`. 

Any pointers, suggestions or work around will be appreciated. 


More information about the graal-dev mailing list