< prev index next >

src/hotspot/share/ci/ciSignature.cpp

Print this page




  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "ci/ciMethodType.hpp"
  27 #include "ci/ciSignature.hpp"
  28 #include "ci/ciUtilities.inline.hpp"
  29 #include "memory/allocation.inline.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "runtime/signature.hpp"
  33 
  34 // ciSignature
  35 //
  36 // This class represents the signature of a method.
  37 
  38 // ------------------------------------------------------------------
  39 // ciSignature::ciSignature
  40 ciSignature::ciSignature(ciKlass* accessing_klass, const constantPoolHandle& cpool, ciSymbol* symbol) {
  41   ASSERT_IN_VM;
  42   EXCEPTION_CONTEXT;

  43   _accessing_klass = accessing_klass;
  44   _symbol = symbol;
  45 
  46   ciEnv* env = CURRENT_ENV;
  47   Arena* arena = env->arena();
  48   _types = new (arena) GrowableArray<ciType*>(arena, 8, 0, NULL);
  49 
  50   int size = 0;
  51   int count = 0;
  52   ResourceMark rm(THREAD);
  53   Symbol* sh = symbol->get_symbol();
  54   SignatureStream ss(sh);
  55   for (; ; ss.next()) {
  56     // Process one element of the signature
  57     ciType* type;
  58     if (!ss.is_object()) {
  59       type = ciType::make(ss.type());
  60     } else {
  61       Symbol* name = ss.as_symbol();
  62       ciSymbol* klass_name = env->get_symbol(name);
  63       type = env->get_klass_by_name_impl(_accessing_klass, cpool, klass_name, false);
  64     }
  65     _types->append(type);
  66     if (ss.at_return_type()) {
  67       // Done processing the return type; do not add it into the count.
  68       break;
  69     }
  70     size += type->size();
  71     count++;
  72   }
  73   _size = size;
  74   _count = count;
  75 }
  76 
  77 // ------------------------------------------------------------------
  78 // ciSignature::ciSignature
  79 ciSignature::ciSignature(ciKlass* accessing_klass, ciSymbol* symbol, ciMethodType* method_type) :
  80   _symbol(symbol),
  81   _accessing_klass(accessing_klass),
  82   _size( method_type->ptype_slot_count()),




  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "ci/ciMethodType.hpp"
  27 #include "ci/ciSignature.hpp"
  28 #include "ci/ciUtilities.inline.hpp"
  29 #include "memory/allocation.inline.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "runtime/signature.hpp"
  33 
  34 // ciSignature
  35 //
  36 // This class represents the signature of a method.
  37 
  38 // ------------------------------------------------------------------
  39 // ciSignature::ciSignature
  40 ciSignature::ciSignature(ciKlass* accessing_klass, const constantPoolHandle& cpool, ciSymbol* symbol) {
  41   ASSERT_IN_VM;
  42   EXCEPTION_CONTEXT;
  43   assert(accessing_klass != NULL, "need origin of access");
  44   _accessing_klass = accessing_klass;
  45   _symbol = symbol;
  46 
  47   ciEnv* env = CURRENT_ENV;
  48   Arena* arena = env->arena();
  49   _types = new (arena) GrowableArray<ciType*>(arena, 8, 0, NULL);
  50 
  51   int size = 0;
  52   int count = 0;
  53   ResourceMark rm(THREAD);
  54   Symbol* sh = symbol->get_symbol();
  55   SignatureStream ss(sh);
  56   for (; ; ss.next()) {
  57     // Process one element of the signature
  58     ciType* type;
  59     if (!ss.is_reference()) {
  60       type = ciType::make(ss.type());
  61     } else {
  62       ciSymbol* klass_name = env->get_symbol(ss.as_symbol());

  63       type = env->get_klass_by_name_impl(_accessing_klass, cpool, klass_name, false);
  64     }
  65     _types->append(type);
  66     if (ss.at_return_type()) {
  67       // Done processing the return type; do not add it into the count.
  68       break;
  69     }
  70     size += type->size();
  71     count++;
  72   }
  73   _size = size;
  74   _count = count;
  75 }
  76 
  77 // ------------------------------------------------------------------
  78 // ciSignature::ciSignature
  79 ciSignature::ciSignature(ciKlass* accessing_klass, ciSymbol* symbol, ciMethodType* method_type) :
  80   _symbol(symbol),
  81   _accessing_klass(accessing_klass),
  82   _size( method_type->ptype_slot_count()),


< prev index next >