forcing a deopt in junit tests

Roland Schatz roland.schatz at oracle.com
Tue Apr 29 18:22:32 UTC 2014


On 04/29/2014 07:55 PM, Deneau, Tom wrote:
> In some junit tests for the hsail backend, I would like to force a deoptimization but not via throwing an exception.
> What is the best way to do this, taking into account that our junits run the test routine once on the host and then once on the gpu and compare the results?
>
> One way I was thinking was to have a class and method that are only used in those junits and then for the hsail backend, implement a MethodSubsitution for that method that immediately calls DeoptimizeNode.deopt().

Yes, that would work. Even better would be to install the 
MethodSubstitution only for the unit tests.

You can look at the mechanism for injecting profiling data in unit 
tests, there we already do something similar.
We have the (empty) method GraalCompilerTest.branchProbability. In the 
constructor of GraalCompilerTest, we install a substitution for this 
method (InjectProfileDataSubstitutions), that uses node intrinsics to 
insert a BranchProbabilityNode. You can do the same for insetring a 
DeoptimizeNode.

- Roland
>
> or is there something simpler?
>
> -- Tom
>
>
>
>



More information about the graal-dev mailing list