< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/profiling/ProfileInvokeNode.java

Print this page


   1 /*
   2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package org.graalvm.compiler.hotspot.nodes.profiling;
  24 
  25 import org.graalvm.compiler.graph.NodeClass;
  26 import org.graalvm.compiler.graph.iterators.NodeIterable;
  27 import org.graalvm.compiler.nodeinfo.NodeInfo;
  28 import org.graalvm.compiler.nodes.StructuredGraph;
  29 
  30 import jdk.vm.ci.meta.ResolvedJavaMethod;
  31 
  32 @NodeInfo
  33 public class ProfileInvokeNode extends ProfileWithNotificationNode {
  34     public static final NodeClass<ProfileInvokeNode> TYPE = NodeClass.create(ProfileInvokeNode.class);
  35 
  36     public ProfileInvokeNode(ResolvedJavaMethod method, int freqLog, int probabilityLog) {
  37         super(TYPE, method, freqLog, probabilityLog);









  38     }
  39 
  40     /**
  41      * Gathers all the {@link ProfileInvokeNode}s that are inputs to the
  42      * {@linkplain StructuredGraph#getNodes() live nodes} in a given graph.
  43      */
  44     public static NodeIterable<ProfileInvokeNode> getProfileInvokeNodes(StructuredGraph graph) {
  45         return graph.getNodes().filter(ProfileInvokeNode.class);
  46     }
  47 }
   1 /*
   2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package org.graalvm.compiler.hotspot.nodes.profiling;
  24 
  25 import org.graalvm.compiler.graph.NodeClass;
  26 import org.graalvm.compiler.graph.iterators.NodeIterable;
  27 import org.graalvm.compiler.nodeinfo.NodeInfo;
  28 import org.graalvm.compiler.nodes.StructuredGraph;
  29 
  30 import jdk.vm.ci.meta.ResolvedJavaMethod;
  31 
  32 @NodeInfo
  33 public class ProfileInvokeNode extends ProfileWithNotificationNode {
  34     public static final NodeClass<ProfileInvokeNode> TYPE = NodeClass.create(ProfileInvokeNode.class);
  35 
  36     public ProfileInvokeNode(ResolvedJavaMethod method, int freqLog, int probabilityLog) {
  37         super(TYPE, method, freqLog, probabilityLog);
  38     }
  39 
  40     @Override
  41     protected boolean canBeMergedWith(ProfileNode p) {
  42         if (p instanceof ProfileInvokeNode) {
  43             ProfileInvokeNode that = (ProfileInvokeNode) p;
  44             return this.method.equals(that.method);
  45         }
  46         return false;
  47     }
  48 
  49     /**
  50      * Gathers all the {@link ProfileInvokeNode}s that are inputs to the
  51      * {@linkplain StructuredGraph#getNodes() live nodes} in a given graph.
  52      */
  53     public static NodeIterable<ProfileInvokeNode> getProfileInvokeNodes(StructuredGraph graph) {
  54         return graph.getNodes().filter(ProfileInvokeNode.class);
  55     }
  56 }
< prev index next >