src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java
changeset 58299 6df94ce3ab2f
parent 54601 c40b2a190173
equal deleted inserted replaced
58298:0152ad7b38b8 58299:6df94ce3ab2f
     1 /*
     1 /*
     2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   272                 @Override
   272                 @Override
   273                 public int getInlinedDepth() {
   273                 public int getInlinedDepth() {
   274                     int count = 0;
   274                     int count = 0;
   275                     PEGraphDecoder.PEMethodScope scope = methodScope;
   275                     PEGraphDecoder.PEMethodScope scope = methodScope;
   276                     while (scope != null) {
   276                     while (scope != null) {
   277                         if (scope.method.equals(callInlinedMethod)) {
   277                         if (scope.method.equals(callInlinedMethod) || scope.method.equals(callInlinedAgnosticMethod)) {
   278                             count++;
   278                             count++;
   279                         }
   279                         }
   280                         scope = scope.caller;
   280                         scope = scope.caller;
   281                     }
   281                     }
   282                     return count;
   282                     return count;
   299          * the plugins are run during the decoding process. If they aren't handled at this point
   299          * the plugins are run during the decoding process. If they aren't handled at this point
   300          * then they will never be handled.
   300          * then they will never be handled.
   301          */
   301          */
   302         @Override
   302         @Override
   303         public boolean canDeferPlugin(GeneratedInvocationPlugin plugin) {
   303         public boolean canDeferPlugin(GeneratedInvocationPlugin plugin) {
   304             return plugin.getSource().equals(Fold.class) || plugin.getSource().equals(Node.NodeIntrinsic.class);
   304             return plugin.isGeneratedFromFoldOrNodeIntrinsic();
   305         }
   305         }
   306 
   306 
   307         @Override
   307         @Override
   308         public BailoutException bailout(String string) {
   308         public BailoutException bailout(String string) {
   309             BailoutException bailout = new PermanentBailoutException(string);
   309             BailoutException bailout = new PermanentBailoutException(string);
   583     private final ParameterPlugin parameterPlugin;
   583     private final ParameterPlugin parameterPlugin;
   584     private final NodePlugin[] nodePlugins;
   584     private final NodePlugin[] nodePlugins;
   585     private final EconomicMap<SpecialCallTargetCacheKey, Object> specialCallTargetCache;
   585     private final EconomicMap<SpecialCallTargetCacheKey, Object> specialCallTargetCache;
   586     private final EconomicMap<ResolvedJavaMethod, Object> invocationPluginCache;
   586     private final EconomicMap<ResolvedJavaMethod, Object> invocationPluginCache;
   587     private final ResolvedJavaMethod callInlinedMethod;
   587     private final ResolvedJavaMethod callInlinedMethod;
       
   588     private final ResolvedJavaMethod callInlinedAgnosticMethod;
   588     protected final SourceLanguagePositionProvider sourceLanguagePositionProvider;
   589     protected final SourceLanguagePositionProvider sourceLanguagePositionProvider;
   589 
   590 
   590     public PEGraphDecoder(Architecture architecture, StructuredGraph graph, CoreProviders providers, LoopExplosionPlugin loopExplosionPlugin, InvocationPlugins invocationPlugins,
   591     public PEGraphDecoder(Architecture architecture, StructuredGraph graph, CoreProviders providers, LoopExplosionPlugin loopExplosionPlugin, InvocationPlugins invocationPlugins,
   591                     InlineInvokePlugin[] inlineInvokePlugins,
   592                     InlineInvokePlugin[] inlineInvokePlugins,
   592                     ParameterPlugin parameterPlugin,
   593                     ParameterPlugin parameterPlugin,
   593                     NodePlugin[] nodePlugins, ResolvedJavaMethod callInlinedMethod, SourceLanguagePositionProvider sourceLanguagePositionProvider) {
   594                     NodePlugin[] nodePlugins, ResolvedJavaMethod callInlinedMethod, ResolvedJavaMethod callInlinedAgnosticMethod, SourceLanguagePositionProvider sourceLanguagePositionProvider) {
   594         super(architecture, graph, providers, true);
   595         super(architecture, graph, providers, true);
   595         this.loopExplosionPlugin = loopExplosionPlugin;
   596         this.loopExplosionPlugin = loopExplosionPlugin;
   596         this.invocationPlugins = invocationPlugins;
   597         this.invocationPlugins = invocationPlugins;
   597         this.inlineInvokePlugins = inlineInvokePlugins;
   598         this.inlineInvokePlugins = inlineInvokePlugins;
   598         this.parameterPlugin = parameterPlugin;
   599         this.parameterPlugin = parameterPlugin;
   599         this.nodePlugins = nodePlugins;
   600         this.nodePlugins = nodePlugins;
       
   601         this.callInlinedAgnosticMethod = callInlinedAgnosticMethod;
   600         this.specialCallTargetCache = EconomicMap.create(Equivalence.DEFAULT);
   602         this.specialCallTargetCache = EconomicMap.create(Equivalence.DEFAULT);
   601         this.invocationPluginCache = EconomicMap.create(Equivalence.DEFAULT);
   603         this.invocationPluginCache = EconomicMap.create(Equivalence.DEFAULT);
   602         this.callInlinedMethod = callInlinedMethod;
   604         this.callInlinedMethod = callInlinedMethod;
   603         this.sourceLanguagePositionProvider = sourceLanguagePositionProvider;
   605         this.sourceLanguagePositionProvider = sourceLanguagePositionProvider;
   604     }
   606     }