/* * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
/** * Check if C2 or JVMCI were included in the VM build * * @return true if either C2 or JVMCI were included in the VM build.
*/ publicstaticboolean isC2OrJVMCIIncluded() { return WB.isC2OrJVMCIIncluded();
}
/** * Check if JVMCI is enabled. * * @return true if JVMCI is enabled
*/ publicstaticboolean isJVMCIEnabled() { Boolean enableJvmci = WB.getBooleanVMFlag("EnableJVMCI"); if (enableJvmci == null || !enableJvmci) { returnfalse;
}
returntrue;
}
/** * Check if Graal is used as JIT compiler. * * Graal is enabled if following conditions are true: * - we are not in Interpreter mode * - UseJVMCICompiler flag is true * - jvmci.Compiler variable is equal to 'graal' * - TieredCompilation is not used or TieredStopAtLevel is greater than 3 * No need to check client mode because it set UseJVMCICompiler to false. * * @return true if Graal is used as JIT compiler.
*/ publicstaticboolean isGraalEnabled() { Boolean useCompiler = WB.getBooleanVMFlag("UseCompiler"); if (useCompiler == null || !useCompiler) { returnfalse;
} Boolean useJvmciComp = WB.getBooleanVMFlag("UseJVMCICompiler"); if (useJvmciComp == null || !useJvmciComp) { returnfalse;
}
Boolean tieredCompilation = WB.getBooleanVMFlag("TieredCompilation"); Long compLevel = WB.getIntxVMFlag("TieredStopAtLevel"); // if TieredCompilation is enabled and compilation level is <= 3 then no Graal is used if (tieredCompilation != null && tieredCompilation &&
compLevel != null && compLevel <= 3) { returnfalse;
} returntrue;
}
/** * Check if C2 is used as JIT compiler. * * C2 is enabled if following conditions are true: * - we are not in Interpreter mode * - we are in Server compilation mode * - TieredCompilation is not used or TieredStopAtLevel is greater than 3 * - Graal is not used * * @return true if C2 is used as JIT compiler.
*/ publicstaticboolean isC2Enabled() { Boolean useCompiler = WB.getBooleanVMFlag("UseCompiler"); if (useCompiler == null || !useCompiler) { returnfalse;
} Boolean serverMode = WB.getBooleanVMFlag("ProfileInterpreter"); if (serverMode == null || !serverMode) { returnfalse;
}
Boolean tieredCompilation = WB.getBooleanVMFlag("TieredCompilation"); Long compLevel = WB.getIntxVMFlag("TieredStopAtLevel"); // if TieredCompilation is enabled and compilation level is <= 3 then no Graal is used if (tieredCompilation != null && tieredCompilation &&
compLevel != null && compLevel <= 3) { returnfalse;
}
if (isGraalEnabled()) { returnfalse;
}
returntrue;
}
/* * Check if C1 is used as JIT compiler. * * C1 is enabled if following conditions are true: * - we are not in Interpreter mode * - we are not in Server compilation mode * - TieredCompilation is used in Server mode * * @return true if C1 is used as JIT compiler.
*/ publicstaticboolean isC1Enabled() { Boolean useCompiler = WB.getBooleanVMFlag("UseCompiler"); if (useCompiler == null || !useCompiler) { returnfalse;
} Boolean serverMode = WB.getBooleanVMFlag("ProfileInterpreter"); if (serverMode == null || !serverMode) { returntrue; // Client mode
}
Boolean tieredCompilation = WB.getBooleanVMFlag("TieredCompilation"); // C1 is not used in server mode if TieredCompilation is off. if (tieredCompilation != null && !tieredCompilation) { returnfalse;
} returntrue;
}
/* * Determine if the compiler corresponding to the compilation level 'compLevel' * provides an intrinsic for 'class'.'method'.
*/ publicstaticboolean isIntrinsicAvailable(int compLevel, String klass, String method, Class<?>... parameterTypes) {
Executable intrinsicMethod; try {
intrinsicMethod = Class.forName(klass).getDeclaredMethod(method, parameterTypes);
} catch (NoSuchMethodException e) { thrownew RuntimeException("Test bug, '" + method + "' method unavailable. " + e);
} catch (ClassNotFoundException e) { thrownew RuntimeException("Test bug, '" + klass + "' class unavailable. " + e);
} return WB.isIntrinsicAvailable(intrinsicMethod, compLevel);
}
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.