src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodePosition.java
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File open Sdiff src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code

src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodePosition.java

Print this page


   1 /*
   2  * Copyright (c) 2009, 2011, 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  */


  70 
  71     /**
  72      * Deep equality test.
  73      */
  74     @Override
  75     public boolean equals(Object obj) {
  76         if (obj == this) {
  77             return true;
  78         }
  79         if (obj != null && getClass() == obj.getClass()) {
  80             BytecodePosition that = (BytecodePosition) obj;
  81             if (this.bci == that.bci && Objects.equals(this.getMethod(), that.getMethod()) && Objects.equals(this.caller, that.caller)) {
  82                 return true;
  83             }
  84         }
  85         return false;
  86     }
  87 
  88     @Override
  89     public int hashCode() {
  90         return getBCI();




  91     }
  92 
  93     /**
  94      * @return The location within the method, as a bytecode index. The constant {@code -1} may be
  95      *         used to indicate the location is unknown, for example within code synthesized by the
  96      *         compiler.
  97      */
  98     public int getBCI() {
  99         return bci;
 100     }
 101 
 102     /**
 103      * @return The runtime interface method for this position.
 104      */
 105     public ResolvedJavaMethod getMethod() {
 106         return method;
 107     }
 108 
 109     /**
 110      * The position where this position has been called, {@code null} if none.
   1 /*
   2  * Copyright (c) 2009, 2019, 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  */


  70 
  71     /**
  72      * Deep equality test.
  73      */
  74     @Override
  75     public boolean equals(Object obj) {
  76         if (obj == this) {
  77             return true;
  78         }
  79         if (obj != null && getClass() == obj.getClass()) {
  80             BytecodePosition that = (BytecodePosition) obj;
  81             if (this.bci == that.bci && Objects.equals(this.getMethod(), that.getMethod()) && Objects.equals(this.caller, that.caller)) {
  82                 return true;
  83             }
  84         }
  85         return false;
  86     }
  87 
  88     @Override
  89     public int hashCode() {
  90         int hc = method.hashCode() * 31 + bci;
  91         if (caller != null) {
  92             hc = (hc * 31) + caller.hashCode();
  93         }
  94         return hc;
  95     }
  96 
  97     /**
  98      * @return The location within the method, as a bytecode index. The constant {@code -1} may be
  99      *         used to indicate the location is unknown, for example within code synthesized by the
 100      *         compiler.
 101      */
 102     public int getBCI() {
 103         return bci;
 104     }
 105 
 106     /**
 107      * @return The runtime interface method for this position.
 108      */
 109     public ResolvedJavaMethod getMethod() {
 110         return method;
 111     }
 112 
 113     /**
 114      * The position where this position has been called, {@code null} if none.
src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodePosition.java
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File