< prev index next >

src/hotspot/share/classfile/bytecodeAssembler.cpp

Print this page




  37   if (probe == NULL) {
  38     index = _entries.length();
  39     _entries.append(bcpe);
  40     _indices.put(bcpe, index);
  41   } else {
  42     index = *probe;
  43   }
  44   return index + _orig->length();
  45 }
  46 
  47 ConstantPool* BytecodeConstantPool::create_constant_pool(TRAPS) const {
  48   if (_entries.length() == 0) {
  49     return _orig;
  50   }
  51 
  52   ConstantPool* cp = ConstantPool::allocate(
  53       _orig->pool_holder()->class_loader_data(),
  54       _orig->length() + _entries.length(), CHECK_NULL);
  55 
  56   cp->set_pool_holder(_orig->pool_holder());
  57   _orig->copy_cp_to(1, _orig->length() - 1, cp, 1, CHECK_NULL);

  58 
  59   // Preserve dynamic constant information from the original pool
  60   if (_orig->has_dynamic_constant()) {
  61     cp->set_has_dynamic_constant();
  62   }
  63 
  64   for (int i = 0; i < _entries.length(); ++i) {
  65     BytecodeCPEntry entry = _entries.at(i);
  66     int idx = i + _orig->length();
  67     switch (entry._tag) {
  68       case BytecodeCPEntry::UTF8:
  69         entry._u.utf8->increment_refcount();
  70         cp->symbol_at_put(idx, entry._u.utf8);
  71         break;
  72       case BytecodeCPEntry::KLASS:
  73         cp->klass_index_at_put(
  74             idx, entry._u.klass);
  75         break;
  76       case BytecodeCPEntry::STRING:
  77         cp->unresolved_string_at_put(




  37   if (probe == NULL) {
  38     index = _entries.length();
  39     _entries.append(bcpe);
  40     _indices.put(bcpe, index);
  41   } else {
  42     index = *probe;
  43   }
  44   return index + _orig->length();
  45 }
  46 
  47 ConstantPool* BytecodeConstantPool::create_constant_pool(TRAPS) const {
  48   if (_entries.length() == 0) {
  49     return _orig;
  50   }
  51 
  52   ConstantPool* cp = ConstantPool::allocate(
  53       _orig->pool_holder()->class_loader_data(),
  54       _orig->length() + _entries.length(), CHECK_NULL);
  55 
  56   cp->set_pool_holder(_orig->pool_holder());
  57   constantPoolHandle cp_h(THREAD, cp);
  58   _orig->copy_cp_to(1, _orig->length() - 1, cp_h, 1, CHECK_NULL);
  59 
  60   // Preserve dynamic constant information from the original pool
  61   if (_orig->has_dynamic_constant()) {
  62     cp->set_has_dynamic_constant();
  63   }
  64 
  65   for (int i = 0; i < _entries.length(); ++i) {
  66     BytecodeCPEntry entry = _entries.at(i);
  67     int idx = i + _orig->length();
  68     switch (entry._tag) {
  69       case BytecodeCPEntry::UTF8:
  70         entry._u.utf8->increment_refcount();
  71         cp->symbol_at_put(idx, entry._u.utf8);
  72         break;
  73       case BytecodeCPEntry::KLASS:
  74         cp->klass_index_at_put(
  75             idx, entry._u.klass);
  76         break;
  77       case BytecodeCPEntry::STRING:
  78         cp->unresolved_string_at_put(


< prev index next >