< prev index next >

src/hotspot/share/prims/methodComparator.cpp

Print this page
rev 52749 : Bootstrap method consolidation
* clean up and simplify JDK support code for BSM invocation
* simplify JVM bootstrap handshake: use BootstrapCallInfo only
* remove unused JVM paths and data fields
* move bootstrap argument processing from MethodHandleNatives to ConstantPool
* remove ConstantGroup; merge argument access into BootstrapCallInfo
* adjust BSM argument access: remove copyArguments, add argumentRef API
* add metadata-free BSM modes, including symbolic arguments from CP


 106       return false;
 107     break;
 108   }
 109   case Bytecodes::_invokedynamic: {
 110     int cpci_old = _s_old->get_index_u4();
 111     int cpci_new = _s_new->get_index_u4();
 112 
 113     // Check if the names of classes, field/method names and signatures at these indexes
 114     // are the same. Indices which are really into constantpool cache (rather than constant
 115     // pool itself) are accepted by the constantpool query routines below.
 116     if ((_old_cp->name_ref_at(cpci_old) != _new_cp->name_ref_at(cpci_new)) ||
 117         (_old_cp->signature_ref_at(cpci_old) != _new_cp->signature_ref_at(cpci_new)))
 118       return false;
 119 
 120     // Translate object indexes to constant pool cache indexes.
 121     cpci_old = _old_cp->invokedynamic_cp_cache_index(cpci_old);
 122     cpci_new = _new_cp->invokedynamic_cp_cache_index(cpci_new);
 123 
 124     int cpi_old = _old_cp->cache()->entry_at(cpci_old)->constant_pool_index();
 125     int cpi_new = _new_cp->cache()->entry_at(cpci_new)->constant_pool_index();
 126     int bsm_old = _old_cp->invoke_dynamic_bootstrap_method_ref_index_at(cpi_old);
 127     int bsm_new = _new_cp->invoke_dynamic_bootstrap_method_ref_index_at(cpi_new);
 128     if (!pool_constants_same(bsm_old, bsm_new))
 129       return false;
 130     int cnt_old = _old_cp->invoke_dynamic_argument_count_at(cpi_old);
 131     int cnt_new = _new_cp->invoke_dynamic_argument_count_at(cpi_new);
 132     if (cnt_old != cnt_new)
 133       return false;
 134     for (int arg_i = 0; arg_i < cnt_old; arg_i++) {
 135       int idx_old = _old_cp->invoke_dynamic_argument_index_at(cpi_old, arg_i);
 136       int idx_new = _new_cp->invoke_dynamic_argument_index_at(cpi_new, arg_i);
 137       if (!pool_constants_same(idx_old, idx_new))
 138         return false;
 139     }
 140     break;
 141   }
 142 
 143   case Bytecodes::_ldc   : // fall through
 144   case Bytecodes::_ldc_w : {
 145     Bytecode_loadconstant ldc_old(_s_old->method(), _s_old->bci());
 146     Bytecode_loadconstant ldc_new(_s_new->method(), _s_new->bci());
 147     int cpi_old = ldc_old.pool_index();
 148     int cpi_new = ldc_new.pool_index();
 149     if (!pool_constants_same(cpi_old, cpi_new))
 150       return false;
 151     break;
 152   }
 153 
 154   case Bytecodes::_ldc2_w : {
 155     u2 cpi_old = _s_old->get_index_u2();
 156     u2 cpi_new = _s_new->get_index_u2();




 106       return false;
 107     break;
 108   }
 109   case Bytecodes::_invokedynamic: {
 110     int cpci_old = _s_old->get_index_u4();
 111     int cpci_new = _s_new->get_index_u4();
 112 
 113     // Check if the names of classes, field/method names and signatures at these indexes
 114     // are the same. Indices which are really into constantpool cache (rather than constant
 115     // pool itself) are accepted by the constantpool query routines below.
 116     if ((_old_cp->name_ref_at(cpci_old) != _new_cp->name_ref_at(cpci_new)) ||
 117         (_old_cp->signature_ref_at(cpci_old) != _new_cp->signature_ref_at(cpci_new)))
 118       return false;
 119 
 120     // Translate object indexes to constant pool cache indexes.
 121     cpci_old = _old_cp->invokedynamic_cp_cache_index(cpci_old);
 122     cpci_new = _new_cp->invokedynamic_cp_cache_index(cpci_new);
 123 
 124     int cpi_old = _old_cp->cache()->entry_at(cpci_old)->constant_pool_index();
 125     int cpi_new = _new_cp->cache()->entry_at(cpci_new)->constant_pool_index();
 126     int bsm_old = _old_cp->bootstrap_method_ref_index_at(cpi_old);
 127     int bsm_new = _new_cp->bootstrap_method_ref_index_at(cpi_new);
 128     if (!pool_constants_same(bsm_old, bsm_new))
 129       return false;
 130     int cnt_old = _old_cp->bootstrap_argument_count_at(cpi_old);
 131     int cnt_new = _new_cp->bootstrap_argument_count_at(cpi_new);
 132     if (cnt_old != cnt_new)
 133       return false;
 134     for (int arg_i = 0; arg_i < cnt_old; arg_i++) {
 135       int idx_old = _old_cp->bootstrap_argument_index_at(cpi_old, arg_i);
 136       int idx_new = _new_cp->bootstrap_argument_index_at(cpi_new, arg_i);
 137       if (!pool_constants_same(idx_old, idx_new))
 138         return false;
 139     }
 140     break;
 141   }
 142 
 143   case Bytecodes::_ldc   : // fall through
 144   case Bytecodes::_ldc_w : {
 145     Bytecode_loadconstant ldc_old(_s_old->method(), _s_old->bci());
 146     Bytecode_loadconstant ldc_new(_s_new->method(), _s_new->bci());
 147     int cpi_old = ldc_old.pool_index();
 148     int cpi_new = ldc_new.pool_index();
 149     if (!pool_constants_same(cpi_old, cpi_new))
 150       return false;
 151     break;
 152   }
 153 
 154   case Bytecodes::_ldc2_w : {
 155     u2 cpi_old = _s_old->get_index_u2();
 156     u2 cpi_new = _s_new->get_index_u2();


< prev index next >