src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java

Print this page


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


 135             return true;
 136         }
 137         if (obj instanceof HotSpotResolvedJavaMethodImpl) {
 138             HotSpotResolvedJavaMethodImpl that = (HotSpotResolvedJavaMethodImpl) obj;
 139             return that.metaspaceMethod == metaspaceMethod;
 140         }
 141         return false;
 142     }
 143 
 144     @Override
 145     public int hashCode() {
 146         return (int) metaspaceMethod;
 147     }
 148 
 149     /**
 150      * Returns this method's flags ({@code Method::_flags}).
 151      *
 152      * @return flags of this method
 153      */
 154     private int getFlags() {
 155         return UNSAFE.getByte(metaspaceMethod + runtime().getConfig().methodFlagsOffset);
 156     }
 157 
 158     /**
 159      * Returns this method's constant method flags ({@code ConstMethod::_flags}).
 160      *
 161      * @return flags of this method's ConstMethod
 162      */
 163     private int getConstMethodFlags() {
 164         return UNSAFE.getChar(getConstMethod() + runtime().getConfig().constMethodFlagsOffset);
 165     }
 166 
 167     @Override
 168     public HotSpotResolvedObjectTypeImpl getDeclaringClass() {
 169         return holder;
 170     }
 171 
 172     /**
 173      * Gets the address of the C++ Method object for this method.
 174      */
 175     public JavaConstant getMetaspaceMethodConstant() {


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


 135             return true;
 136         }
 137         if (obj instanceof HotSpotResolvedJavaMethodImpl) {
 138             HotSpotResolvedJavaMethodImpl that = (HotSpotResolvedJavaMethodImpl) obj;
 139             return that.metaspaceMethod == metaspaceMethod;
 140         }
 141         return false;
 142     }
 143 
 144     @Override
 145     public int hashCode() {
 146         return (int) metaspaceMethod;
 147     }
 148 
 149     /**
 150      * Returns this method's flags ({@code Method::_flags}).
 151      *
 152      * @return flags of this method
 153      */
 154     private int getFlags() {
 155         return UNSAFE.getShort(metaspaceMethod + runtime().getConfig().methodFlagsOffset);
 156     }
 157 
 158     /**
 159      * Returns this method's constant method flags ({@code ConstMethod::_flags}).
 160      *
 161      * @return flags of this method's ConstMethod
 162      */
 163     private int getConstMethodFlags() {
 164         return UNSAFE.getChar(getConstMethod() + runtime().getConfig().constMethodFlagsOffset);
 165     }
 166 
 167     @Override
 168     public HotSpotResolvedObjectTypeImpl getDeclaringClass() {
 169         return holder;
 170     }
 171 
 172     /**
 173      * Gets the address of the C++ Method object for this method.
 174      */
 175     public JavaConstant getMetaspaceMethodConstant() {