Add a way to specify optimisitic optimizations when compiling using GraalRuntime

Thomas Wuerthinger thomas.wuerthinger at oracle.com
Tue Apr 3 07:47:25 PDT 2012


Thanks for your third patch within a couple of days! You keep us quite 
busy here, which is great ;).

- thomas


On 03.04.2012 12:28, Rémi Forax wrote:
> On 04/02/2012 12:10 PM, Douglas Simon wrote:
>> Hi Remi,
>>
>> On Mar 30, 2012, at 7:13 PM, Rémi Forax wrote:
>>
>>> Hi guys,
>>> I've played a little with Graal and I've some questions (a lot in 
>>> fact but I will send several messages :)
>> We're ready for your questions - fire away ;-)
>
> Currently, there is no way to specify when compiling a method using 
> GraalRuntime.compile()
> if the optimistic optimizations should be used or not.
> But sometime you don't want any optimistic optimizations at all, like 
> by example when compiling an intrinsics.
>
> The patch below just add a new parameter to specify the optimistic 
> optimizations.
>
> Rémi
>
> diff --git 
> a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java 
> b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java 
>
> --- 
> a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java
> +++ 
> b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java
> @@ -449,11 +449,11 @@
>      }
>
>      @Override
> -    public CiTargetMethod compile(RiResolvedMethod method, 
> StructuredGraph graph) {
> +    public CiTargetMethod compile(RiResolvedMethod method, 
> StructuredGraph graph, OptimisticOptimizations optimisticOpts) {
>          final PhasePlan plan = new PhasePlan();
> -        GraphBuilderPhase graphBuilderPhase = new 
> GraphBuilderPhase(compiler.getRuntime(), 
> GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL);
> +        GraphBuilderPhase graphBuilderPhase = new 
> GraphBuilderPhase(compiler.getRuntime(), 
> GraphBuilderConfiguration.getDefault(), optimisticOpts);
>          plan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);
> -        return compiler.getCompiler().compileMethod(method, graph, 
> -1, compiler.getCache(), plan, OptimisticOptimizations.ALL);
> +        return compiler.getCompiler().compileMethod(method, graph, 
> -1, compiler.getCache(), plan, optimisticOpts);
>      }
>
>      @Override
> diff --git 
> a/graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/GraalRuntime.java 
> b/graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/GraalRuntime.java
> --- 
> a/graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/GraalRuntime.java
> +++ 
> b/graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/GraalRuntime.java
> @@ -26,6 +26,7 @@
>
>  import com.oracle.max.cri.ci.*;
>  import com.oracle.max.cri.ri.*;
> +import com.oracle.graal.compiler.OptimisticOptimizations;
>  import com.oracle.graal.graph.*;
>  import com.oracle.graal.nodes.*;
>
> @@ -38,7 +39,7 @@
>
>      StructuredGraph intrinsicGraph(RiResolvedMethod caller, int bci, 
> RiResolvedMethod method, List<? extends Node> parameters);
>
> -    CiTargetMethod compile(RiResolvedMethod method, StructuredGraph 
> graph);
> +    CiTargetMethod compile(RiResolvedMethod method, StructuredGraph 
> graph, OptimisticOptimizations optimisticOpts);
>
>      long[] getDeoptedLeafGraphIds();
>  }
>



More information about the graal-dev mailing list