src/hotspot/share/jvmci/jvmciRuntime.cpp
changeset 59056 15936b142f86
parent 58901 2700c409ff10
child 59252 623722a6aeb9
equal deleted inserted replaced
59055:57ad70bcf06c 59056:15936b142f86
  1148 }
  1148 }
  1149 
  1149 
  1150 // ------------------------------------------------------------------
  1150 // ------------------------------------------------------------------
  1151 // Perform an appropriate method lookup based on accessor, holder,
  1151 // Perform an appropriate method lookup based on accessor, holder,
  1152 // name, signature, and bytecode.
  1152 // name, signature, and bytecode.
  1153 methodHandle JVMCIRuntime::lookup_method(InstanceKlass* accessor,
  1153 Method* JVMCIRuntime::lookup_method(InstanceKlass* accessor,
  1154                                Klass*        holder,
  1154                                     Klass*        holder,
  1155                                Symbol*       name,
  1155                                     Symbol*       name,
  1156                                Symbol*       sig,
  1156                                     Symbol*       sig,
  1157                                Bytecodes::Code bc,
  1157                                     Bytecodes::Code bc,
  1158                                constantTag   tag) {
  1158                                     constantTag   tag) {
  1159   // Accessibility checks are performed in JVMCIEnv::get_method_by_index_impl().
  1159   // Accessibility checks are performed in JVMCIEnv::get_method_by_index_impl().
  1160   assert(check_klass_accessibility(accessor, holder), "holder not accessible");
  1160   assert(check_klass_accessibility(accessor, holder), "holder not accessible");
  1161 
  1161 
  1162   methodHandle dest_method;
  1162   Method* dest_method;
  1163   LinkInfo link_info(holder, name, sig, accessor, LinkInfo::needs_access_check, tag);
  1163   LinkInfo link_info(holder, name, sig, accessor, LinkInfo::needs_access_check, tag);
  1164   switch (bc) {
  1164   switch (bc) {
  1165   case Bytecodes::_invokestatic:
  1165   case Bytecodes::_invokestatic:
  1166     dest_method =
  1166     dest_method =
  1167       LinkResolver::resolve_static_call_or_null(link_info);
  1167       LinkResolver::resolve_static_call_or_null(link_info);
  1184   return dest_method;
  1184   return dest_method;
  1185 }
  1185 }
  1186 
  1186 
  1187 
  1187 
  1188 // ------------------------------------------------------------------
  1188 // ------------------------------------------------------------------
  1189 methodHandle JVMCIRuntime::get_method_by_index_impl(const constantPoolHandle& cpool,
  1189 Method* JVMCIRuntime::get_method_by_index_impl(const constantPoolHandle& cpool,
  1190                                           int index, Bytecodes::Code bc,
  1190                                                int index, Bytecodes::Code bc,
  1191                                           InstanceKlass* accessor) {
  1191                                                InstanceKlass* accessor) {
  1192   if (bc == Bytecodes::_invokedynamic) {
  1192   if (bc == Bytecodes::_invokedynamic) {
  1193     ConstantPoolCacheEntry* cpce = cpool->invokedynamic_cp_cache_entry_at(index);
  1193     ConstantPoolCacheEntry* cpce = cpool->invokedynamic_cp_cache_entry_at(index);
  1194     bool is_resolved = !cpce->is_f1_null();
  1194     bool is_resolved = !cpce->is_f1_null();
  1195     if (is_resolved) {
  1195     if (is_resolved) {
  1196       // Get the invoker Method* from the constant pool.
  1196       // Get the invoker Method* from the constant pool.
  1197       // (The appendix argument, if any, will be noted in the method's signature.)
  1197       // (The appendix argument, if any, will be noted in the method's signature.)
  1198       Method* adapter = cpce->f1_as_method();
  1198       Method* adapter = cpce->f1_as_method();
  1199       return methodHandle(adapter);
  1199       return adapter;
  1200     }
  1200     }
  1201 
  1201 
  1202     return NULL;
  1202     return NULL;
  1203   }
  1203   }
  1204 
  1204 
  1233     }
  1233     }
  1234   }
  1234   }
  1235 
  1235 
  1236   if (holder_is_accessible) { // Our declared holder is loaded.
  1236   if (holder_is_accessible) { // Our declared holder is loaded.
  1237     constantTag tag = cpool->tag_ref_at(index);
  1237     constantTag tag = cpool->tag_ref_at(index);
  1238     methodHandle m = lookup_method(accessor, holder, name_sym, sig_sym, bc, tag);
  1238     Method* m = lookup_method(accessor, holder, name_sym, sig_sym, bc, tag);
  1239     if (!m.is_null()) {
  1239     if (m != NULL) {
  1240       // We found the method.
  1240       // We found the method.
  1241       return m;
  1241       return m;
  1242     }
  1242     }
  1243   }
  1243   }
  1244 
  1244 
  1263   return NULL;
  1263   return NULL;
  1264 }
  1264 }
  1265 
  1265 
  1266 
  1266 
  1267 // ------------------------------------------------------------------
  1267 // ------------------------------------------------------------------
  1268 methodHandle JVMCIRuntime::get_method_by_index(const constantPoolHandle& cpool,
  1268 Method* JVMCIRuntime::get_method_by_index(const constantPoolHandle& cpool,
  1269                                      int index, Bytecodes::Code bc,
  1269                                      int index, Bytecodes::Code bc,
  1270                                      InstanceKlass* accessor) {
  1270                                      InstanceKlass* accessor) {
  1271   ResourceMark rm;
  1271   ResourceMark rm;
  1272   return get_method_by_index_impl(cpool, index, bc, accessor);
  1272   return get_method_by_index_impl(cpool, index, bc, accessor);
  1273 }
  1273 }