src/share/vm/oops/method.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2012, 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  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/systemDictionary.hpp"
  27 #include "code/debugInfoRec.hpp"
  28 #include "gc_interface/collectedHeap.inline.hpp"
  29 #include "interpreter/bytecodeStream.hpp"
  30 #include "interpreter/bytecodeTracer.hpp"
  31 #include "interpreter/bytecodes.hpp"
  32 #include "interpreter/interpreter.hpp"
  33 #include "interpreter/oopMapCache.hpp"
  34 #include "memory/gcLocker.hpp"
  35 #include "memory/generation.hpp"

  36 #include "memory/metadataFactory.hpp"
  37 #include "memory/oopFactory.hpp"
  38 #include "oops/constMethod.hpp"
  39 #include "oops/methodData.hpp"
  40 #include "oops/method.hpp"
  41 #include "oops/oop.inline.hpp"
  42 #include "oops/symbol.hpp"
  43 #include "prims/jvmtiExport.hpp"
  44 #include "prims/jvmtiRedefineClasses.hpp"
  45 #include "prims/methodHandles.hpp"
  46 #include "prims/nativeLookup.hpp"
  47 #include "runtime/arguments.hpp"
  48 #include "runtime/compilationPolicy.hpp"
  49 #include "runtime/frame.inline.hpp"
  50 #include "runtime/handles.inline.hpp"
  51 #include "runtime/relocator.hpp"
  52 #include "runtime/sharedRuntime.hpp"
  53 #include "runtime/signature.hpp"
  54 #include "utilities/quickSort.hpp"
  55 #include "utilities/xmlstream.hpp"


1937     st->print_cr(" - signature handler: " INTPTR_FORMAT, signature_handler());
1938   }
1939 }
1940 
1941 #endif //PRODUCT
1942 
1943 void Method::print_value_on(outputStream* st) const {
1944   assert(is_method(), "must be method");
1945   st->print_cr(internal_name());
1946   print_address_on(st);
1947   st->print(" ");
1948   name()->print_value_on(st);
1949   st->print(" ");
1950   signature()->print_value_on(st);
1951   st->print(" in ");
1952   method_holder()->print_value_on(st);
1953   if (WizardMode) st->print("[%d,%d]", size_of_parameters(), max_locals());
1954   if (WizardMode && code() != NULL) st->print(" ((nmethod*)%p)", code());
1955 }
1956 
















1957 
1958 // Verification
1959 
1960 void Method::verify_on(outputStream* st) {
1961   guarantee(is_method(), "object must be method");
1962   guarantee(is_metadata(),  "should be metadata");
1963   guarantee(constants()->is_constantPool(), "should be constant pool");
1964   guarantee(constants()->is_metadata(), "should be metadata");
1965   guarantee(constMethod()->is_constMethod(), "should be ConstMethod*");
1966   guarantee(constMethod()->is_metadata(), "should be metadata");
1967   MethodData* md = method_data();
1968   guarantee(md == NULL ||
1969       md->is_metadata(), "should be metadata");
1970   guarantee(md == NULL ||
1971       md->is_methodData(), "should be method data");
1972 }
   1 /*
   2  * Copyright (c) 1997, 2013, 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  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/systemDictionary.hpp"
  27 #include "code/debugInfoRec.hpp"
  28 #include "gc_interface/collectedHeap.inline.hpp"
  29 #include "interpreter/bytecodeStream.hpp"
  30 #include "interpreter/bytecodeTracer.hpp"
  31 #include "interpreter/bytecodes.hpp"
  32 #include "interpreter/interpreter.hpp"
  33 #include "interpreter/oopMapCache.hpp"
  34 #include "memory/gcLocker.hpp"
  35 #include "memory/generation.hpp"
  36 #include "memory/heapInspection.hpp"
  37 #include "memory/metadataFactory.hpp"
  38 #include "memory/oopFactory.hpp"
  39 #include "oops/constMethod.hpp"
  40 #include "oops/methodData.hpp"
  41 #include "oops/method.hpp"
  42 #include "oops/oop.inline.hpp"
  43 #include "oops/symbol.hpp"
  44 #include "prims/jvmtiExport.hpp"
  45 #include "prims/jvmtiRedefineClasses.hpp"
  46 #include "prims/methodHandles.hpp"
  47 #include "prims/nativeLookup.hpp"
  48 #include "runtime/arguments.hpp"
  49 #include "runtime/compilationPolicy.hpp"
  50 #include "runtime/frame.inline.hpp"
  51 #include "runtime/handles.inline.hpp"
  52 #include "runtime/relocator.hpp"
  53 #include "runtime/sharedRuntime.hpp"
  54 #include "runtime/signature.hpp"
  55 #include "utilities/quickSort.hpp"
  56 #include "utilities/xmlstream.hpp"


1938     st->print_cr(" - signature handler: " INTPTR_FORMAT, signature_handler());
1939   }
1940 }
1941 
1942 #endif //PRODUCT
1943 
1944 void Method::print_value_on(outputStream* st) const {
1945   assert(is_method(), "must be method");
1946   st->print_cr(internal_name());
1947   print_address_on(st);
1948   st->print(" ");
1949   name()->print_value_on(st);
1950   st->print(" ");
1951   signature()->print_value_on(st);
1952   st->print(" in ");
1953   method_holder()->print_value_on(st);
1954   if (WizardMode) st->print("[%d,%d]", size_of_parameters(), max_locals());
1955   if (WizardMode && code() != NULL) st->print(" ((nmethod*)%p)", code());
1956 }
1957 
1958 #if INCLUDE_SERVICES
1959 // Size Statistics
1960 void Method::collect_statistics(KlassSizeStats *sz) const {
1961   int mysize = sz->count(this);
1962   sz->_method_bytes += mysize;
1963   sz->_method_all_bytes += mysize;
1964   sz->_rw_bytes += mysize;
1965 
1966   if (constMethod()) {
1967     constMethod()->collect_statistics(sz);
1968   }
1969   if (method_data()) {
1970     method_data()->collect_statistics(sz);
1971   }
1972 }
1973 #endif // INCLUDE_SERVICES
1974 
1975 // Verification
1976 
1977 void Method::verify_on(outputStream* st) {
1978   guarantee(is_method(), "object must be method");
1979   guarantee(is_metadata(),  "should be metadata");
1980   guarantee(constants()->is_constantPool(), "should be constant pool");
1981   guarantee(constants()->is_metadata(), "should be metadata");
1982   guarantee(constMethod()->is_constMethod(), "should be ConstMethod*");
1983   guarantee(constMethod()->is_metadata(), "should be metadata");
1984   MethodData* md = method_data();
1985   guarantee(md == NULL ||
1986       md->is_metadata(), "should be metadata");
1987   guarantee(md == NULL ||
1988       md->is_methodData(), "should be method data");
1989 }