intrinsic that makes runtime choice whether to revert to java

Vladimir Kozlov vladimir.kozlov at
Mon Jul 2 19:56:53 PDT 2012

I finally had time today to look on this. Here is code:

But I did not test or optimize it (part of new code in callGenerator.cpp should 
be shared with PredictedCallGenerator from which it was cloned).


Deneau, Tom wrote:
> Hi all --
> I am writing a hotspot intrinsic but I want it to make a runtime
> choice whether to execute the intrinsic code or to execute the regular
> java code.
> I got the suggestion below from Vladimir but I am not experienced
> enough with the graphkit functionality to see how to do this.  Would
> someone be able to provide the code skeleton for this?  I can generate
> the region to actually do my intrinsic and I believe I can generate the
> BoolNode which determines which path to take.
> The other choice would be to modify the actual JDK library routine to
> do the runtime tests and call a new routine which the intrinsic would
> hook into.  I have done this for testing but I am assuming this is more
> intrusive since on some architectures the intrinsic will not even be generated.
> -- Tom Deneau
>> We don't have such mechanism currently. But it is not difficult to implement. 
>> Look on the code in doCall.cpp and callGenerator files. Instead of calling 
>> find_intrinsic() you need to do something special for your case. Like code for 
>> CallGenerator::for_method_handle_call() where you will generate class check and 
>> on one path you will get intrinsic (by calling find_intrinsic()) and on other 
>> path is regular CallGenerator::for_inline().

More information about the hotspot-compiler-dev mailing list