本文整理匯總了Java中jdk.vm.ci.runtime.JVMCI類的典型用法代碼示例。如果您正苦於以下問題:Java JVMCI類的具體用法?Java JVMCI怎麽用?Java JVMCI使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JVMCI類屬於jdk.vm.ci.runtime包,在下文中一共展示了JVMCI類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: run
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
public void run() {
Object result;
try {
result = JVMCI.getRuntime();
} catch (InternalError e) {
if (IS_POSITIVE) {
throw new AssertionError("unexpected exception", e);
}
return;
}
if (!IS_POSITIVE) {
throw new AssertionError("didn't get expected exception");
}
Asserts.assertNotNull(result,
"initializeRuntime returned null");
Asserts.assertEQ(result, JVMCI.getRuntime(),
"initializeRuntime returns different results");
}
示例2: CodeInstallerTest
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
protected CodeInstallerTest() {
JVMCIBackend backend = JVMCI.getRuntime().getHostJVMCIBackend();
metaAccess = backend.getMetaAccess();
codeCache = backend.getCodeCache();
constantReflection = (HotSpotConstantReflectionProvider) backend.getConstantReflection();
arch = codeCache.getTarget().arch;
Method method = null;
try {
method = CodeInstallerTest.class.getMethod("dummyMethod");
} catch (NoSuchMethodException e) {
Assert.fail();
}
dummyMethod = metaAccess.lookupJavaMethod(method);
}
示例3: test
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
@Test
@SuppressWarnings("try")
public void test() throws ClassNotFoundException {
HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) JVMCI.getRuntime().getCompiler();
HotSpotGraalRuntimeProvider rt = (HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class);
HotSpotProviders providers = rt.getHostBackend().getProviders();
Plugins graphBuilderPlugins = providers.getGraphBuilderPlugins();
InvocationPlugins invocationPlugins = graphBuilderPlugins.getInvocationPlugins();
EconomicMap<String, List<Binding>> bindings = invocationPlugins.getBindings(true);
HotSpotVMConfigStore store = rt.getVMConfig().getStore();
List<VMIntrinsicMethod> intrinsics = store.getIntrinsics();
for (VMIntrinsicMethod intrinsic : intrinsics) {
InvocationPlugin plugin = CheckGraalIntrinsics.findPlugin(bindings, intrinsic);
if (plugin != null) {
if (plugin instanceof MethodSubstitutionPlugin) {
ResolvedJavaMethod method = CheckGraalIntrinsics.resolveIntrinsic(getMetaAccess(), intrinsic);
if (!method.isNative()) {
StructuredGraph graph = compiler.getIntrinsicGraph(method, providers, INVALID_COMPILATION_ID, getInitialOptions());
getCode(method, graph);
}
}
}
}
}
示例4: compileAndInstallSubstitution
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
protected InstalledCode compileAndInstallSubstitution(Class<?> c, String methodName) {
ResolvedJavaMethod method = getMetaAccess().lookupJavaMethod(getMethod(c, methodName));
HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) JVMCI.getRuntime().getCompiler();
HotSpotGraalRuntimeProvider rt = (HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class);
HotSpotProviders providers = rt.getHostBackend().getProviders();
CompilationIdentifier compilationId = runtime().getHostBackend().getCompilationIdentifier(method);
OptionValues options = getInitialOptions();
StructuredGraph graph = compiler.getIntrinsicGraph(method, providers, compilationId, options, getDebugContext(options));
if (graph != null) {
return getCode(method, graph, true, true, graph.getOptions());
}
return null;
}
示例5: test
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
@Test
@SuppressWarnings("try")
public void test() throws ClassNotFoundException {
HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) JVMCI.getRuntime().getCompiler();
HotSpotGraalRuntimeProvider rt = (HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class);
HotSpotProviders providers = rt.getHostBackend().getProviders();
Plugins graphBuilderPlugins = providers.getGraphBuilderPlugins();
InvocationPlugins invocationPlugins = graphBuilderPlugins.getInvocationPlugins();
EconomicMap<String, List<Binding>> bindings = invocationPlugins.getBindings(true);
HotSpotVMConfigStore store = rt.getVMConfig().getStore();
List<VMIntrinsicMethod> intrinsics = store.getIntrinsics();
OptionValues options = getInitialOptions();
DebugContext debug = getDebugContext(options);
for (VMIntrinsicMethod intrinsic : intrinsics) {
InvocationPlugin plugin = CheckGraalIntrinsics.findPlugin(bindings, intrinsic);
if (plugin != null) {
if (plugin instanceof MethodSubstitutionPlugin) {
ResolvedJavaMethod method = CheckGraalIntrinsics.resolveIntrinsic(getMetaAccess(), intrinsic);
if (!method.isNative()) {
StructuredGraph graph = compiler.getIntrinsicGraph(method, providers, INVALID_COMPILATION_ID, options, debug);
getCode(method, graph);
}
}
}
}
}
示例6: dumpMethod
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
public void dumpMethod(String className, String methodName, String filter, String host, int port) throws javax.management.MBeanException {
String jvmName = MetaUtil.toInternalName(className);
methodDumps.add(new Dump(host, port, jvmName, methodName, filter));
ClassNotFoundException last = null;
EconomicSet<Class<?>> found = EconomicSet.create();
Iterator<Reference<ClassLoader>> it = loaders.iterator();
while (it.hasNext()) {
Reference<ClassLoader> ref = it.next();
ClassLoader loader = ref.get();
if (loader == null) {
it.remove();
continue;
}
try {
Class<?> clazz = Class.forName(className, false, loader);
if (found.add(clazz)) {
ResolvedJavaType type = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess().lookupJavaType(clazz);
if (compiler != null) {
for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
if (methodName.equals(method.getName()) && method instanceof HotSpotResolvedJavaMethod) {
HotSpotResolvedJavaMethod hotSpotMethod = (HotSpotResolvedJavaMethod) method;
compiler.compileMethod(new HotSpotCompilationRequest(hotSpotMethod, -1, 0L), false);
}
}
}
}
} catch (ClassNotFoundException ex) {
last = ex;
}
}
if (found.isEmpty()) {
throw new javax.management.MBeanException(last, "Cannot find class " + className + " to schedule recompilation");
}
}
示例7: initializeRuntime
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
private static GraalRuntime initializeRuntime() {
Services.initializeJVMCI();
JVMCICompiler compiler = JVMCI.getRuntime().getCompiler();
if (compiler instanceof GraalJVMCICompiler) {
GraalJVMCICompiler graal = (GraalJVMCICompiler) compiler;
return graal.getGraalRuntime();
} else {
return new InvalidGraalRuntime();
}
}
示例8: main
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
public static void main(String[] args) throws Throwable {
MetaAccessProvider metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess();
for (String name : new String[] {"myStaticField", "myInstanceField"}) {
java.lang.reflect.Field javaField = StableFieldTest.class.getDeclaredField(name);
HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) metaAccess.lookupJavaField(javaField);
if (!field.isStable()) {
throw new AssertionError("Expected HotSpotResolvedJavaField.isStable() to return true for " + javaField);
}
}
}
示例9: getPositiveObjectJavaKind
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
@DataProvider(name = "positiveObject")
public static Object[][] getPositiveObjectJavaKind() {
HotSpotJVMCIRuntimeProvider runtime = (HotSpotJVMCIRuntimeProvider) JVMCI.getRuntime();
int offset = new HotSpotVMConfigAccess(runtime.getConfigStore()).getFieldOffset("Klass::_java_mirror", Integer.class, "oop");
Constant wrappedKlassPointer = ((HotSpotResolvedObjectType) runtime.fromClass(TestClass.class)).klass();
return new Object[][]{new Object[]{JavaKind.Object, wrappedKlassPointer, (long) offset, TEST_CLASS_CONSTANT, 0}};
}
示例10: invoke
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
private Object invoke() {
Object result;
try {
result = registerNatives.invoke(JVMCI.class);
} catch (ReflectiveOperationException e) {
throw new Error("can't invoke registerNatives", e);
}
return result;
}
示例11: CodeInstallationTest
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
public CodeInstallationTest() {
JVMCIBackend backend = JVMCI.getRuntime().getHostJVMCIBackend();
metaAccess = backend.getMetaAccess();
codeCache = backend.getCodeCache();
target = backend.getTarget();
constantReflection = backend.getConstantReflection();
config = new TestHotSpotVMConfig(HotSpotJVMCIRuntime.runtime().getConfigStore());
}
示例12: CodeInstallationTest
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
public CodeInstallationTest() {
JVMCIBackend backend = JVMCI.getRuntime().getHostJVMCIBackend();
metaAccess = backend.getMetaAccess();
codeCache = backend.getCodeCache();
target = backend.getTarget();
constantReflection = backend.getConstantReflection();
}
示例13: setDontInlineCallBoundaryMethod
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
public static void setDontInlineCallBoundaryMethod() {
MetaAccessProvider metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess();
ResolvedJavaType type = metaAccess.lookupJavaType(OptimizedCallTarget.class);
for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
if (method.getAnnotation(TruffleCallBoundary.class) != null) {
((HotSpotResolvedJavaMethod) method).setNotInlineable();
}
}
}
示例14: getCallMethods
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
@Override
protected CallMethods getCallMethods() {
if (callMethods == null) {
lookupCallMethods(JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess());
}
return callMethods;
}
示例15: getRuntime
import jdk.vm.ci.runtime.JVMCI; //導入依賴的package包/類
@Override
public TruffleRuntime getRuntime() {
Services.exportJVMCITo(getClass());
// initialize JVMCI to make sure the TruffleCompiler option is parsed
JVMCI.initialize();
return new HotSpotTruffleRuntime(new LazyGraalRuntime());
}