< prev index next >

src/share/vm/oops/method.cpp

Print this page




  29 #include "code/debugInfoRec.hpp"
  30 #include "gc/shared/collectedHeap.inline.hpp"
  31 #include "gc/shared/gcLocker.hpp"
  32 #include "gc/shared/generation.hpp"
  33 #include "interpreter/bytecodeStream.hpp"
  34 #include "interpreter/bytecodeTracer.hpp"
  35 #include "interpreter/bytecodes.hpp"
  36 #include "interpreter/interpreter.hpp"
  37 #include "interpreter/oopMapCache.hpp"
  38 #include "memory/heapInspection.hpp"
  39 #include "memory/metadataFactory.hpp"
  40 #include "memory/metaspaceShared.hpp"
  41 #include "memory/oopFactory.hpp"
  42 #include "memory/resourceArea.hpp"
  43 #include "oops/constMethod.hpp"
  44 #include "oops/method.hpp"
  45 #include "oops/methodData.hpp"
  46 #include "oops/objArrayOop.inline.hpp"
  47 #include "oops/oop.inline.hpp"
  48 #include "oops/symbol.hpp"

  49 #include "prims/jvmtiExport.hpp"
  50 #include "prims/methodHandles.hpp"
  51 #include "prims/nativeLookup.hpp"
  52 #include "runtime/arguments.hpp"
  53 #include "runtime/compilationPolicy.hpp"
  54 #include "runtime/frame.inline.hpp"
  55 #include "runtime/handles.inline.hpp"
  56 #include "runtime/init.hpp"
  57 #include "runtime/orderAccess.inline.hpp"
  58 #include "runtime/relocator.hpp"
  59 #include "runtime/sharedRuntime.hpp"
  60 #include "runtime/signature.hpp"
  61 #include "utilities/quickSort.hpp"
  62 #include "utilities/xmlstream.hpp"
  63 
  64 // Implementation of Method
  65 
  66 Method* Method::allocate(ClassLoaderData* loader_data,
  67                          int byte_code_size,
  68                          AccessFlags access_flags,


 450   // => nothing to do (keep this method around for future use)
 451 }
 452 
 453 
 454 int Method::extra_stack_words() {
 455   // not an inline function, to avoid a header dependency on Interpreter
 456   return extra_stack_entries() * Interpreter::stackElementSize;
 457 }
 458 
 459 
 460 void Method::compute_size_of_parameters(Thread *thread) {
 461   ArgumentSizeComputer asc(signature());
 462   set_size_of_parameters(asc.size() + (is_static() ? 0 : 1));
 463 }
 464 
 465 BasicType Method::result_type() const {
 466   ResultTypeFinder rtf(signature());
 467   return rtf.type();
 468 }
 469 





















 470 
 471 bool Method::is_empty_method() const {
 472   return  code_size() == 1
 473       && *code_base() == Bytecodes::_return;
 474 }
 475 
 476 
 477 bool Method::is_vanilla_constructor() const {
 478   // Returns true if this method is a vanilla constructor, i.e. an "<init>" "()V" method
 479   // which only calls the superclass vanilla constructor and possibly does stores of
 480   // zero constants to local fields:
 481   //
 482   //   aload_0
 483   //   invokespecial
 484   //   indexbyte1
 485   //   indexbyte2
 486   //
 487   // followed by an (optional) sequence of:
 488   //
 489   //   aload_0




  29 #include "code/debugInfoRec.hpp"
  30 #include "gc/shared/collectedHeap.inline.hpp"
  31 #include "gc/shared/gcLocker.hpp"
  32 #include "gc/shared/generation.hpp"
  33 #include "interpreter/bytecodeStream.hpp"
  34 #include "interpreter/bytecodeTracer.hpp"
  35 #include "interpreter/bytecodes.hpp"
  36 #include "interpreter/interpreter.hpp"
  37 #include "interpreter/oopMapCache.hpp"
  38 #include "memory/heapInspection.hpp"
  39 #include "memory/metadataFactory.hpp"
  40 #include "memory/metaspaceShared.hpp"
  41 #include "memory/oopFactory.hpp"
  42 #include "memory/resourceArea.hpp"
  43 #include "oops/constMethod.hpp"
  44 #include "oops/method.hpp"
  45 #include "oops/methodData.hpp"
  46 #include "oops/objArrayOop.inline.hpp"
  47 #include "oops/oop.inline.hpp"
  48 #include "oops/symbol.hpp"
  49 #include "oops/valueKlass.hpp"
  50 #include "prims/jvmtiExport.hpp"
  51 #include "prims/methodHandles.hpp"
  52 #include "prims/nativeLookup.hpp"
  53 #include "runtime/arguments.hpp"
  54 #include "runtime/compilationPolicy.hpp"
  55 #include "runtime/frame.inline.hpp"
  56 #include "runtime/handles.inline.hpp"
  57 #include "runtime/init.hpp"
  58 #include "runtime/orderAccess.inline.hpp"
  59 #include "runtime/relocator.hpp"
  60 #include "runtime/sharedRuntime.hpp"
  61 #include "runtime/signature.hpp"
  62 #include "utilities/quickSort.hpp"
  63 #include "utilities/xmlstream.hpp"
  64 
  65 // Implementation of Method
  66 
  67 Method* Method::allocate(ClassLoaderData* loader_data,
  68                          int byte_code_size,
  69                          AccessFlags access_flags,


 451   // => nothing to do (keep this method around for future use)
 452 }
 453 
 454 
 455 int Method::extra_stack_words() {
 456   // not an inline function, to avoid a header dependency on Interpreter
 457   return extra_stack_entries() * Interpreter::stackElementSize;
 458 }
 459 
 460 
 461 void Method::compute_size_of_parameters(Thread *thread) {
 462   ArgumentSizeComputer asc(signature());
 463   set_size_of_parameters(asc.size() + (is_static() ? 0 : 1));
 464 }
 465 
 466 BasicType Method::result_type() const {
 467   ResultTypeFinder rtf(signature());
 468   return rtf.type();
 469 }
 470 
 471 #ifdef ASSERT
 472 // ValueKlass the method is declared to return. This must not
 473 // safepoint as it is called with references live on the stack at
 474 // locations the GC is unaware of.
 475 ValueKlass* Method::returned_value_type(Thread* thread) const {
 476   assert(is_returning_vt(), "method return type should be value type");
 477   SignatureStream ss(signature());
 478   while (!ss.at_return_type()) {
 479     ss.next();
 480   }
 481   Handle class_loader(thread, method_holder()->class_loader());
 482   Handle protection_domain(thread, method_holder()->protection_domain());
 483   Klass* k = NULL;
 484   {
 485     NoSafepointVerifier nsv;
 486     k = ss.as_klass(class_loader, protection_domain, SignatureStream::ReturnNull, thread);
 487   }
 488   assert(k != NULL && !thread->has_pending_exception(), "can't resolve klass");
 489   return ValueKlass::cast(k);
 490 }
 491 #endif
 492 
 493 bool Method::is_empty_method() const {
 494   return  code_size() == 1
 495       && *code_base() == Bytecodes::_return;
 496 }
 497 
 498 
 499 bool Method::is_vanilla_constructor() const {
 500   // Returns true if this method is a vanilla constructor, i.e. an "<init>" "()V" method
 501   // which only calls the superclass vanilla constructor and possibly does stores of
 502   // zero constants to local fields:
 503   //
 504   //   aload_0
 505   //   invokespecial
 506   //   indexbyte1
 507   //   indexbyte2
 508   //
 509   // followed by an (optional) sequence of:
 510   //
 511   //   aload_0


< prev index next >