< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2015, 2016, 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.
--- 1,7 ----
/*
! * Copyright (c) 2015, 2017, 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.
*** 20,31 ****
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.graalvm.compiler.hotspot.meta;
- import static jdk.vm.ci.meta.DeoptimizationAction.InvalidateRecompile;
- import static jdk.vm.ci.meta.DeoptimizationReason.Unresolved;
import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
import static org.graalvm.compiler.hotspot.meta.HotSpotAOTProfilingPlugin.Options.TieredAOT;
import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.JAVA_THREAD_THREAD_OBJECT_LOCATION;
import static org.graalvm.compiler.java.BytecodeParserOptions.InlineDuringParsing;
import static org.graalvm.compiler.serviceprovider.JDK9Method.Java8OrEarlier;
--- 20,29 ----
*** 61,71 ****
import org.graalvm.compiler.hotspot.replacements.SHASubstitutions;
import org.graalvm.compiler.hotspot.replacements.ThreadSubstitutions;
import org.graalvm.compiler.hotspot.replacements.arraycopy.ArrayCopyNode;
import org.graalvm.compiler.hotspot.word.HotSpotWordTypes;
import org.graalvm.compiler.nodes.ConstantNode;
- import org.graalvm.compiler.nodes.DeoptimizeNode;
import org.graalvm.compiler.nodes.DynamicPiNode;
import org.graalvm.compiler.nodes.FixedGuardNode;
import org.graalvm.compiler.nodes.LogicNode;
import org.graalvm.compiler.nodes.NamedLocationIdentity;
import org.graalvm.compiler.nodes.PiNode;
--- 59,68 ----
*** 78,88 ****
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins;
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration;
import org.graalvm.compiler.nodes.graphbuilderconf.NodeIntrinsicPluginFactory;
- import org.graalvm.compiler.nodes.graphbuilderconf.NodePlugin;
import org.graalvm.compiler.nodes.java.InstanceOfDynamicNode;
import org.graalvm.compiler.nodes.memory.HeapAccess.BarrierType;
import org.graalvm.compiler.nodes.memory.address.AddressNode;
import org.graalvm.compiler.nodes.memory.address.OffsetAddressNode;
import org.graalvm.compiler.nodes.spi.StampProvider;
--- 75,84 ----
*** 99,115 ****
import org.graalvm.compiler.word.WordOperationPlugin;
import org.graalvm.compiler.word.WordTypes;
import org.graalvm.word.LocationIdentity;
import jdk.vm.ci.code.CodeUtil;
- import jdk.vm.ci.hotspot.HotSpotObjectConstant;
- import jdk.vm.ci.hotspot.HotSpotResolvedJavaType;
- import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
import jdk.vm.ci.meta.ConstantReflectionProvider;
import jdk.vm.ci.meta.DeoptimizationAction;
import jdk.vm.ci.meta.DeoptimizationReason;
- import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.MetaAccessProvider;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import sun.misc.Unsafe;
--- 95,107 ----
*** 137,182 ****
HotSpotNodePlugin nodePlugin = new HotSpotNodePlugin(wordOperationPlugin);
plugins.appendTypePlugin(nodePlugin);
plugins.appendNodePlugin(nodePlugin);
OptionValues options = replacements.getOptions();
! if (GeneratePIC.getValue(options)) {
! // AOT needs to filter out bad invokes
! plugins.prependNodePlugin(new NodePlugin() {
! @Override
! public boolean handleInvoke(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args) {
! if (b.parsingIntrinsic()) {
! return false;
! }
! // check if the holder has a valid fingerprint
! if (((HotSpotResolvedObjectType) method.getDeclaringClass()).getFingerprint() == 0) {
! // Deopt otherwise
! b.append(new DeoptimizeNode(InvalidateRecompile, Unresolved));
! return true;
! }
! // the last argument that may come from appendix, check if it is a supported
! // constant type
! if (args.length > 0) {
! JavaConstant constant = args[args.length - 1].asJavaConstant();
! if (constant != null && constant instanceof HotSpotObjectConstant) {
! HotSpotResolvedJavaType type = (HotSpotResolvedJavaType) ((HotSpotObjectConstant) constant).getType();
! Class<?> clazz = type.mirror();
! if (clazz.equals(String.class)) {
! return false;
! }
! if (Class.class.isAssignableFrom(clazz) && ((HotSpotResolvedObjectType) type).getFingerprint() != 0) {
! return false;
! }
! b.append(new DeoptimizeNode(InvalidateRecompile, Unresolved));
! return true;
! }
! }
! return false;
! }
! });
! }
plugins.appendNodePlugin(new MethodHandlePlugin(constantReflection.getMethodHandleAccess(), true));
plugins.appendInlineInvokePlugin(replacements);
if (InlineDuringParsing.getValue(options)) {
plugins.appendInlineInvokePlugin(new InlineDuringParsingPlugin());
}
--- 129,141 ----
HotSpotNodePlugin nodePlugin = new HotSpotNodePlugin(wordOperationPlugin);
plugins.appendTypePlugin(nodePlugin);
plugins.appendNodePlugin(nodePlugin);
OptionValues options = replacements.getOptions();
! if (!GeneratePIC.getValue(options)) {
plugins.appendNodePlugin(new MethodHandlePlugin(constantReflection.getMethodHandleAccess(), true));
+ }
plugins.appendInlineInvokePlugin(replacements);
if (InlineDuringParsing.getValue(options)) {
plugins.appendInlineInvokePlugin(new InlineDuringParsingPlugin());
}
*** 194,204 ****
--- 153,165 ----
BytecodeProvider replacementBytecodeProvider = replacements.getDefaultReplacementBytecodeProvider();
registerObjectPlugins(invocationPlugins, options, replacementBytecodeProvider);
registerClassPlugins(plugins, config, replacementBytecodeProvider);
registerSystemPlugins(invocationPlugins, foreignCalls);
registerThreadPlugins(invocationPlugins, metaAccess, wordTypes, config, replacementBytecodeProvider);
+ if (!GeneratePIC.getValue(options)) {
registerCallSitePlugins(invocationPlugins);
+ }
registerReflectionPlugins(invocationPlugins, replacementBytecodeProvider);
registerConstantPoolPlugins(invocationPlugins, wordTypes, config, replacementBytecodeProvider);
registerAESPlugins(invocationPlugins, config, replacementBytecodeProvider);
registerCRC32Plugins(invocationPlugins, config, replacementBytecodeProvider);
registerBigIntegerPlugins(invocationPlugins, config, replacementBytecodeProvider);
< prev index next >