# HG changeset patch # User zmajo # Date 1438104033 -7200 # Node ID 2671addb3319ae40b73de30e9b4481ac25fe1c50 # Parent 8fd6eeb878606e39c908f12535f34ebbfd225a4a 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics Summary: Add a new method, sun.hotspot.WhiteBox.isIntrinsicAvailable, that can be used to determine if an intrinsic is available. Reviewed-by: kvn, jrose diff -r 8fd6eeb87860 -r 2671addb3319 test/lib/sun/hotspot/WhiteBox.java --- a/test/lib/sun/hotspot/WhiteBox.java Thu Jul 23 15:27:17 2015 -0700 +++ b/test/lib/sun/hotspot/WhiteBox.java Tue Jul 28 19:20:33 2015 +0200 @@ -182,6 +182,30 @@ Objects.requireNonNull(method); return isMethodQueuedForCompilation0(method); } + // Determine if the compiler corresponding to the compilation level 'compLevel' + // and to the compilation context 'compilation_context' provides an intrinsic + // for the method 'method'. An intrinsic is available for method 'method' if: + // - the intrinsic is enabled (by using the appropriate command-line flag) and + // - the platform on which the VM is running provides the instructions necessary + // for the compiler to generate the intrinsic code. + // + // The compilation context is related to using the DisableIntrinsic flag on a + // per-method level, see hotspot/src/share/vm/compiler/abstractCompiler.hpp + // for more details. + public boolean isIntrinsicAvailable(Executable method, + Executable compilationContext, + int compLevel) { + Objects.requireNonNull(method); + return isIntrinsicAvailable0(method, compilationContext, compLevel); + } + // If usage of the DisableIntrinsic flag is not expected (or the usage can be ignored), + // use the below method that does not require the compilation context as argument. + public boolean isIntrinsicAvailable(Executable method, int compLevel) { + return isIntrinsicAvailable(method, null, compLevel); + } + private native boolean isIntrinsicAvailable0(Executable method, + Executable compilationContext, + int compLevel); public int deoptimizeMethod(Executable method) { return deoptimizeMethod(method, false /*not osr*/); }