src/share/vm/oops/methodOop.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6914206 Sdiff src/share/vm/oops

src/share/vm/oops/methodOop.cpp

Print this page


   1 /*
   2  * Copyright 1997-2009 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *


 804 
 805 oop methodOopDesc::method_handle_type() const {
 806   if (!is_method_handle_invoke()) { assert(false, "caller resp."); return NULL; }
 807   oop mt = constants()->resolved_string_at(_imcp_method_type_value);
 808   assert(mt->klass() == SystemDictionary::MethodType_klass(), "");
 809   return mt;
 810 }
 811 
 812 jint* methodOopDesc::method_type_offsets_chain() {
 813   static jint pchase[] = { -1, -1, -1 };
 814   if (pchase[0] == -1) {
 815     jint step0 = in_bytes(constants_offset());
 816     jint step1 = (constantPoolOopDesc::header_size() + _imcp_method_type_value) * HeapWordSize;
 817     // do this in reverse to avoid races:
 818     OrderAccess::release_store(&pchase[1], step1);
 819     OrderAccess::release_store(&pchase[0], step0);
 820   }
 821   return pchase;
 822 }
 823 












 824 methodHandle methodOopDesc::make_invoke_method(KlassHandle holder,
 825                                                symbolHandle signature,
 826                                                Handle method_type, TRAPS) {
 827   methodHandle empty;
 828 
 829   assert(holder() == SystemDictionary::MethodHandle_klass(),
 830          "must be a JSR 292 magic type");
 831 
 832   if (TraceMethodHandles) {
 833     tty->print("Creating invoke method for ");
 834     signature->print_value();
 835     tty->cr();
 836   }
 837 
 838   constantPoolHandle cp;
 839   {
 840     constantPoolOop cp_oop = oopFactory::new_constantPool(_imcp_limit, IsSafeConc, CHECK_(empty));
 841     cp = constantPoolHandle(THREAD, cp_oop);
 842   }
 843   cp->symbol_at_put(_imcp_invoke_name,       vmSymbols::invoke_name());


   1 /*
   2  * Copyright 1997-2010 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *


 804 
 805 oop methodOopDesc::method_handle_type() const {
 806   if (!is_method_handle_invoke()) { assert(false, "caller resp."); return NULL; }
 807   oop mt = constants()->resolved_string_at(_imcp_method_type_value);
 808   assert(mt->klass() == SystemDictionary::MethodType_klass(), "");
 809   return mt;
 810 }
 811 
 812 jint* methodOopDesc::method_type_offsets_chain() {
 813   static jint pchase[] = { -1, -1, -1 };
 814   if (pchase[0] == -1) {
 815     jint step0 = in_bytes(constants_offset());
 816     jint step1 = (constantPoolOopDesc::header_size() + _imcp_method_type_value) * HeapWordSize;
 817     // do this in reverse to avoid races:
 818     OrderAccess::release_store(&pchase[1], step1);
 819     OrderAccess::release_store(&pchase[0], step0);
 820   }
 821   return pchase;
 822 }
 823 
 824 //------------------------------------------------------------------------------
 825 // methodOopDesc::is_method_handle_adapter
 826 //
 827 // Tests if this method is an internal adapter frame from the
 828 // MethodHandleCompiler.
 829 bool methodOopDesc::is_method_handle_adapter() const {
 830   return ((name() == vmSymbols::invoke_name() &&
 831            method_holder() == SystemDictionary::MethodHandle_klass())
 832           ||
 833           method_holder() == SystemDictionary::InvokeDynamic_klass());
 834 }
 835 
 836 methodHandle methodOopDesc::make_invoke_method(KlassHandle holder,
 837                                                symbolHandle signature,
 838                                                Handle method_type, TRAPS) {
 839   methodHandle empty;
 840 
 841   assert(holder() == SystemDictionary::MethodHandle_klass(),
 842          "must be a JSR 292 magic type");
 843 
 844   if (TraceMethodHandles) {
 845     tty->print("Creating invoke method for ");
 846     signature->print_value();
 847     tty->cr();
 848   }
 849 
 850   constantPoolHandle cp;
 851   {
 852     constantPoolOop cp_oop = oopFactory::new_constantPool(_imcp_limit, IsSafeConc, CHECK_(empty));
 853     cp = constantPoolHandle(THREAD, cp_oop);
 854   }
 855   cp->symbol_at_put(_imcp_invoke_name,       vmSymbols::invoke_name());


src/share/vm/oops/methodOop.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File