< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/profiling/ProfileBranchNode.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  */


  52         assert targetBci <= bci;
  53         this.branchCondition = null;
  54         this.bci = bci;
  55         this.targetBci = targetBci;
  56     }
  57 
  58     public int bci() {
  59         return bci;
  60     }
  61 
  62     public int targetBci() {
  63         return targetBci;
  64     }
  65 
  66     public ValueNode branchCondition() {
  67         return branchCondition;
  68     }
  69 
  70     public boolean hasCondition() {
  71         return branchCondition != null;









  72     }
  73 
  74     /**
  75      * Gathers all the {@link ProfileBranchNode}s that are inputs to the
  76      * {@linkplain StructuredGraph#getNodes() live nodes} in a given graph.
  77      */
  78     public static NodeIterable<ProfileBranchNode> getProfileBranchNodes(StructuredGraph graph) {
  79         return graph.getNodes().filter(ProfileBranchNode.class);
  80     }
  81 }
   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  */


  52         assert targetBci <= bci;
  53         this.branchCondition = null;
  54         this.bci = bci;
  55         this.targetBci = targetBci;
  56     }
  57 
  58     public int bci() {
  59         return bci;
  60     }
  61 
  62     public int targetBci() {
  63         return targetBci;
  64     }
  65 
  66     public ValueNode branchCondition() {
  67         return branchCondition;
  68     }
  69 
  70     public boolean hasCondition() {
  71         return branchCondition != null;
  72     }
  73 
  74     @Override
  75     protected boolean canBeMergedWith(ProfileNode p) {
  76         if (p instanceof ProfileBranchNode) {
  77             ProfileBranchNode that = (ProfileBranchNode) p;
  78             return this.method.equals(that.method) && this.bci == that.bci;
  79         }
  80         return false;
  81     }
  82 
  83     /**
  84      * Gathers all the {@link ProfileBranchNode}s that are inputs to the
  85      * {@linkplain StructuredGraph#getNodes() live nodes} in a given graph.
  86      */
  87     public static NodeIterable<ProfileBranchNode> getProfileBranchNodes(StructuredGraph graph) {
  88         return graph.getNodes().filter(ProfileBranchNode.class);
  89     }
  90 }
< prev index next >