JVM Language Summit Examples

Doug Simon doug.simon at oracle.com
Tue Dec 10 22:54:03 PST 2013


On Dec 11, 2013, at 2:17 AM, Christian Thalinger <christian.thalinger at oracle.com> wrote:

> Not everyone has read your paper, Doug ;-)

… which doesn’t even mention this feature ;-)

I was about to add some javadoc to MethodSubstitution but see it’s already there:

/**
 * Denotes a substitute method. A substitute method can call the original/substituted method by
 * making a recursive call to itself.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MethodSubstitution {

-Doug

> On Dec 10, 2013, at 2:14 PM, Doug Simon <doug.simon at oracle.com> wrote:
> 
>> Yes, it’s certainly looks like a bug doesn’t it!
>> 
>> However, this is the (not so well documented) mechanism to do a partial intrinsification. That is, sometimes (as in this example) you only want to optimize for a subset of the potential arguments that can be passed to a method. A recursive call in such an intrinsification will be translated as a call to the original method.
>> 
>> -Doug
>> 
>> On Dec 10, 2013, at 10:53 PM, Doychin Bondzhev <doychin at dsoft-bg.com> wrote:
>> 
>>> Looking at code for pow I think there is something wrong here. 
>>> 
>>> It could be my mistake but this looks like recursive call of pow from pow. So in case of x and y not in any of the special cases this will result in stack overflow. Probably on the last line of call to pow should be Math.pow instead of just pow.
>>> 
>>> 
>>> On Tue, Dec 10, 2013 at 11:05 PM, Doug Simon <doug.simon at oracle.com> wrote:
>>> Hi Curt,
>>> 
>>> Have a look at MathSubstitutionsX86.pow(double, double)[1] for an example of how intrinsification is done now.
>>> 
>>> -Doug
>>> 
>>> [1] http://hg.openjdk.java.net/graal/graal/file/4eacfd0767ed/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/MathSubstitutionsX86.java
>>> 
>>> On Dec 10, 2013, at 8:33 PM, Curt Albert <falbert9 at vt.edu> wrote:
>>> 
>>>>              I have been trying to look at using graal for compiler
>>>> optimizations in my java code and found the presentation given at JVM
>>>> Language Summit 2011. In that presentation there was an example of
>>>> intrinsificiation called SafeAddNode. I was trying to reproduce this
>>>> example, but it seems the intrinsification code has moved. Is it still
>>>> possible to run this same example? If so how?
>>>> 
>>>> 
>>>> 
>>>> Thanks,
>>>> 
>>>> Curt Albert
>>>> 
>>>> Systems Software Research Group
>>>> 
>>>> Bradley Department of Electrical and Compuer Engineering
>>>> 
>>>> Virginia Tech
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
> 



More information about the graal-dev mailing list