< prev index next >

src/share/vm/jvmci/jvmciEnv.cpp

Print this page




  65 // constantPoolOopDesc::verify_constant_pool_resolve.
  66 bool JVMCIEnv::check_klass_accessibility(KlassHandle accessing_klass, KlassHandle resolved_klass) {
  67   if (accessing_klass->oop_is_objArray()) {
  68     accessing_klass = ObjArrayKlass::cast(accessing_klass())->bottom_klass();
  69   }
  70   if (!accessing_klass->oop_is_instance()) {
  71     return true;
  72   }
  73 
  74   if (resolved_klass->oop_is_objArray()) {
  75     // Find the element klass, if this is an array.
  76     resolved_klass = ObjArrayKlass::cast(resolved_klass())->bottom_klass();
  77   }
  78   if (resolved_klass->oop_is_instance()) {
  79     return Reflection::verify_class_access(accessing_klass(), resolved_klass(), true);
  80   }
  81   return true;
  82 }
  83 
  84 // ------------------------------------------------------------------
  85 KlassHandle JVMCIEnv::get_klass_by_name_impl(KlassHandle& accessing_klass,
  86                                           constantPoolHandle& cpool,
  87                                           Symbol* sym,
  88                                           bool require_local) {
  89   JVMCI_EXCEPTION_CONTEXT;
  90 
  91   // Now we need to check the SystemDictionary
  92   if (sym->byte_at(0) == 'L' &&
  93     sym->byte_at(sym->utf8_length()-1) == ';') {
  94     // This is a name from a signature.  Strip off the trimmings.
  95     // Call recursive to keep scope of strippedsym.
  96     TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1,
  97                     sym->utf8_length()-2,
  98                     CHECK_(KlassHandle()));
  99     return get_klass_by_name_impl(accessing_klass, cpool, strippedsym, require_local);
 100   }
 101 
 102   Handle loader(THREAD, (oop)NULL);
 103   Handle domain(THREAD, (oop)NULL);
 104   if (!accessing_klass.is_null()) {
 105     loader = Handle(THREAD, accessing_klass->class_loader());
 106     domain = Handle(THREAD, accessing_klass->protection_domain());


 144       return elem_klass->array_klass(CHECK_(KlassHandle()));
 145     }
 146   }
 147 
 148   if (found_klass.is_null() && !cpool.is_null() && cpool->has_preresolution()) {
 149     // Look inside the constant pool for pre-resolved class entries.
 150     for (int i = cpool->length() - 1; i >= 1; i--) {
 151       if (cpool->tag_at(i).is_klass()) {
 152         Klass*  kls = cpool->resolved_klass_at(i);
 153         if (kls->name() == sym) {
 154           return kls;
 155         }
 156       }
 157     }
 158   }
 159 
 160   return found_klass();
 161 }
 162 
 163 // ------------------------------------------------------------------
 164 KlassHandle JVMCIEnv::get_klass_by_name(KlassHandle& accessing_klass,
 165                                   Symbol* klass_name,
 166                                   bool require_local) {
 167   ResourceMark rm;
 168   constantPoolHandle cpool;
 169   return get_klass_by_name_impl(accessing_klass,
 170                                                  cpool,
 171                                                  klass_name,
 172                                                  require_local);
 173 }
 174 
 175 // ------------------------------------------------------------------
 176 // Implementation of get_klass_by_index.
 177 KlassHandle JVMCIEnv::get_klass_by_index_impl(constantPoolHandle& cpool,
 178                                         int index,
 179                                         bool& is_accessible,
 180                                         KlassHandle& accessor) {
 181   JVMCI_EXCEPTION_CONTEXT;
 182   KlassHandle klass (THREAD, ConstantPool::klass_at_if_loaded(cpool, index));
 183   Symbol* klass_name = NULL;
 184   if (klass.is_null()) {
 185     klass_name = cpool->klass_name_at(index);
 186   }
 187 
 188   if (klass.is_null()) {
 189     // Not found in constant pool.  Use the name to do the lookup.
 190     KlassHandle k = get_klass_by_name_impl(accessor,
 191                                         cpool,
 192                                         klass_name,
 193                                         false);
 194     // Calculate accessibility the hard way.
 195     if (k.is_null()) {
 196       is_accessible = false;
 197     } else if (k->class_loader() != accessor->class_loader() &&
 198                get_klass_by_name_impl(accessor, cpool, k->name(), true).is_null()) {
 199       // Loaded only remotely.  Not linked yet.
 200       is_accessible = false;
 201     } else {
 202       // Linked locally, and we must also check public/private, etc.
 203       is_accessible = check_klass_accessibility(accessor, k);
 204     }
 205     if (!is_accessible) {
 206       return KlassHandle();
 207     }
 208     return k;
 209   }
 210 
 211   // It is known to be accessible, since it was found in the constant pool.
 212   is_accessible = true;
 213   return klass;
 214 }
 215 
 216 // ------------------------------------------------------------------
 217 // Get a klass from the constant pool.
 218 KlassHandle JVMCIEnv::get_klass_by_index(constantPoolHandle& cpool,
 219                                    int index,
 220                                    bool& is_accessible,
 221                                    KlassHandle& accessor) {
 222   ResourceMark rm;
 223   KlassHandle result = get_klass_by_index_impl(cpool, index, is_accessible, accessor);
 224   return result;
 225 }
 226 
 227 // ------------------------------------------------------------------
 228 // Implementation of get_field_by_index.
 229 //
 230 // Implementation note: the results of field lookups are cached
 231 // in the accessor klass.
 232 void JVMCIEnv::get_field_by_index_impl(instanceKlassHandle& klass, fieldDescriptor& field_desc,
 233                                         int index) {
 234   JVMCI_EXCEPTION_CONTEXT;
 235 
 236   assert(klass->is_linked(), "must be linked before using its constant-pool");
 237 
 238   constantPoolHandle cpool(thread, klass->constants());
 239 
 240   // Get the field's name, signature, and type.
 241   Symbol* name  = cpool->name_ref_at(index);
 242 
 243   int nt_index = cpool->name_and_type_ref_index_at(index);
 244   int sig_index = cpool->signature_ref_index_at(nt_index);
 245   Symbol* signature = cpool->symbol_at(sig_index);
 246 
 247   // Get the field's declared holder.
 248   int holder_index = cpool->klass_ref_index_at(index);
 249   bool holder_is_accessible;
 250   KlassHandle declared_holder = get_klass_by_index(cpool, holder_index,
 251                                                holder_is_accessible,
 252                                                klass);
 253 
 254   // The declared holder of this field may not have been loaded.
 255   // Bail out with partial field information.
 256   if (!holder_is_accessible) {
 257     return;
 258   }
 259 
 260 
 261   // Perform the field lookup.
 262   Klass*  canonical_holder =
 263     InstanceKlass::cast(declared_holder())->find_field(name, signature, &field_desc);
 264   if (canonical_holder == NULL) {
 265     return;
 266   }
 267 
 268   assert(canonical_holder == field_desc.field_holder(), "just checking");
 269 }
 270 
 271 // ------------------------------------------------------------------
 272 // Get a field by index from a klass's constant pool.
 273 void JVMCIEnv::get_field_by_index(instanceKlassHandle& accessor, fieldDescriptor& fd, int index) {
 274   ResourceMark rm;
 275   return get_field_by_index_impl(accessor, fd, index);
 276 }
 277 
 278 // ------------------------------------------------------------------
 279 // Perform an appropriate method lookup based on accessor, holder,
 280 // name, signature, and bytecode.
 281 methodHandle JVMCIEnv::lookup_method(instanceKlassHandle& h_accessor,
 282                                instanceKlassHandle& h_holder,
 283                                Symbol*       name,
 284                                Symbol*       sig,
 285                                Bytecodes::Code bc) {
 286   JVMCI_EXCEPTION_CONTEXT;
 287   LinkResolver::check_klass_accessability(h_accessor, h_holder, KILL_COMPILE_ON_FATAL_(NULL));
 288   methodHandle dest_method;
 289   LinkInfo link_info(h_holder, name, sig, h_accessor, /*check_access*/true);
 290   switch (bc) {
 291   case Bytecodes::_invokestatic:
 292     dest_method =
 293       LinkResolver::resolve_static_call_or_null(link_info);
 294     break;
 295   case Bytecodes::_invokespecial:
 296     dest_method =
 297       LinkResolver::resolve_special_call_or_null(link_info);
 298     break;
 299   case Bytecodes::_invokeinterface:
 300     dest_method =
 301       LinkResolver::linktime_resolve_interface_method_or_null(link_info);
 302     break;
 303   case Bytecodes::_invokevirtual:
 304     dest_method =
 305       LinkResolver::linktime_resolve_virtual_method_or_null(link_info);
 306     break;
 307   default: ShouldNotReachHere();
 308   }
 309 
 310   return dest_method;
 311 }
 312 
 313 
 314 // ------------------------------------------------------------------
 315 methodHandle JVMCIEnv::get_method_by_index_impl(constantPoolHandle& cpool,
 316                                           int index, Bytecodes::Code bc,
 317                                           instanceKlassHandle& accessor) {
 318   if (bc == Bytecodes::_invokedynamic) {
 319     ConstantPoolCacheEntry* cpce = cpool->invokedynamic_cp_cache_entry_at(index);
 320     bool is_resolved = !cpce->is_f1_null();
 321     if (is_resolved) {
 322       // Get the invoker Method* from the constant pool.
 323       // (The appendix argument, if any, will be noted in the method's signature.)
 324       Method* adapter = cpce->f1_as_method();
 325       return methodHandle(adapter);
 326     }
 327 
 328     return NULL;
 329   }
 330 
 331   int holder_index = cpool->klass_ref_index_at(index);
 332   bool holder_is_accessible;
 333   KlassHandle holder = get_klass_by_index_impl(cpool, holder_index, holder_is_accessible, accessor);
 334 
 335   // Get the method's name and signature.
 336   Symbol* name_sym = cpool->name_ref_at(index);
 337   Symbol* sig_sym  = cpool->signature_ref_at(index);


 362     methodHandle m = lookup_method(accessor, lookup, name_sym, sig_sym, bc);
 363     if (!m.is_null() &&
 364         (bc == Bytecodes::_invokestatic
 365          ?  InstanceKlass::cast(m->method_holder())->is_not_initialized()
 366          : !InstanceKlass::cast(m->method_holder())->is_loaded())) {
 367       m = NULL;
 368     }
 369     if (!m.is_null()) {
 370       // We found the method.
 371       return m;
 372     }
 373   }
 374 
 375   // Either the declared holder was not loaded, or the method could
 376   // not be found.
 377 
 378   return NULL;
 379 }
 380 
 381 // ------------------------------------------------------------------
 382 instanceKlassHandle JVMCIEnv::get_instance_klass_for_declared_method_holder(KlassHandle& method_holder) {
 383   // For the case of <array>.clone(), the method holder can be an ArrayKlass*
 384   // instead of an InstanceKlass*.  For that case simply pretend that the
 385   // declared holder is Object.clone since that's where the call will bottom out.
 386   if (method_holder->oop_is_instance()) {
 387     return instanceKlassHandle(method_holder());
 388   } else if (method_holder->oop_is_array()) {
 389     return instanceKlassHandle(SystemDictionary::Object_klass());
 390   } else {
 391     ShouldNotReachHere();
 392   }
 393   return NULL;
 394 }
 395 
 396 
 397 // ------------------------------------------------------------------
 398 methodHandle JVMCIEnv::get_method_by_index(constantPoolHandle& cpool,
 399                                      int index, Bytecodes::Code bc,
 400                                      instanceKlassHandle& accessor) {
 401   ResourceMark rm;
 402   return get_method_by_index_impl(cpool, index, bc, accessor);
 403 }
 404 
 405 // ------------------------------------------------------------------
 406 // Check for changes to the system dictionary during compilation
 407 // class loads, evolution, breakpoints
 408 JVMCIEnv::CodeInstallResult JVMCIEnv::check_for_system_dictionary_modification(Dependencies* dependencies, Handle compiled_code,
 409                                                                                JVMCIEnv* env, char** failure_detail) {
 410   // If JVMTI capabilities were enabled during compile, the compilation is invalidated.
 411   if (env != NULL) {
 412     if (!env->_jvmti_can_hotswap_or_post_breakpoint && JvmtiExport::can_hotswap_or_post_breakpoint()) {
 413       *failure_detail = (char*) "Hotswapping or breakpointing was enabled during compilation";
 414       return JVMCIEnv::dependencies_failed;
 415     }
 416   }
 417 
 418   // Dependencies must be checked when the system dictionary changes
 419   // or if we don't know whether it has changed (i.e., env == NULL).
 420   // In debug mode, always check dependencies.


 435       *failure_detail = st.as_string();
 436       if (env == NULL || counter_changed) {
 437         return JVMCIEnv::dependencies_failed;
 438       } else {
 439         // The dependencies were invalid at the time of installation
 440         // without any intervening modification of the system
 441         // dictionary.  That means they were invalidly constructed.
 442         return JVMCIEnv::dependencies_invalid;
 443       }
 444     }
 445     if (LogCompilation) {
 446       deps.log_dependency();
 447     }
 448   }
 449 
 450   return JVMCIEnv::ok;
 451 }
 452 
 453 // ------------------------------------------------------------------
 454 JVMCIEnv::CodeInstallResult JVMCIEnv::register_method(
 455                                 methodHandle& method,
 456                                 nmethod*& nm,
 457                                 int entry_bci,
 458                                 CodeOffsets* offsets,
 459                                 int orig_pc_offset,
 460                                 CodeBuffer* code_buffer,
 461                                 int frame_words,
 462                                 OopMapSet* oop_map_set,
 463                                 ExceptionHandlerTable* handler_table,
 464                                 AbstractCompiler* compiler,
 465                                 DebugInformationRecorder* debug_info,
 466                                 Dependencies* dependencies,
 467                                 JVMCIEnv* env,
 468                                 int compile_id,
 469                                 bool has_unsafe_access,
 470                                 bool has_wide_vector,
 471                                 Handle installed_code,
 472                                 Handle compiled_code,
 473                                 Handle speculation_log) {
 474   JVMCI_EXCEPTION_CONTEXT;
 475   nm = NULL;




  65 // constantPoolOopDesc::verify_constant_pool_resolve.
  66 bool JVMCIEnv::check_klass_accessibility(KlassHandle accessing_klass, KlassHandle resolved_klass) {
  67   if (accessing_klass->oop_is_objArray()) {
  68     accessing_klass = ObjArrayKlass::cast(accessing_klass())->bottom_klass();
  69   }
  70   if (!accessing_klass->oop_is_instance()) {
  71     return true;
  72   }
  73 
  74   if (resolved_klass->oop_is_objArray()) {
  75     // Find the element klass, if this is an array.
  76     resolved_klass = ObjArrayKlass::cast(resolved_klass())->bottom_klass();
  77   }
  78   if (resolved_klass->oop_is_instance()) {
  79     return Reflection::verify_class_access(accessing_klass(), resolved_klass(), true);
  80   }
  81   return true;
  82 }
  83 
  84 // ------------------------------------------------------------------
  85 KlassHandle JVMCIEnv::get_klass_by_name_impl(KlassHandle accessing_klass,
  86                                           const constantPoolHandle& cpool,
  87                                           Symbol* sym,
  88                                           bool require_local) {
  89   JVMCI_EXCEPTION_CONTEXT;
  90 
  91   // Now we need to check the SystemDictionary
  92   if (sym->byte_at(0) == 'L' &&
  93     sym->byte_at(sym->utf8_length()-1) == ';') {
  94     // This is a name from a signature.  Strip off the trimmings.
  95     // Call recursive to keep scope of strippedsym.
  96     TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1,
  97                     sym->utf8_length()-2,
  98                     CHECK_(KlassHandle()));
  99     return get_klass_by_name_impl(accessing_klass, cpool, strippedsym, require_local);
 100   }
 101 
 102   Handle loader(THREAD, (oop)NULL);
 103   Handle domain(THREAD, (oop)NULL);
 104   if (!accessing_klass.is_null()) {
 105     loader = Handle(THREAD, accessing_klass->class_loader());
 106     domain = Handle(THREAD, accessing_klass->protection_domain());


 144       return elem_klass->array_klass(CHECK_(KlassHandle()));
 145     }
 146   }
 147 
 148   if (found_klass.is_null() && !cpool.is_null() && cpool->has_preresolution()) {
 149     // Look inside the constant pool for pre-resolved class entries.
 150     for (int i = cpool->length() - 1; i >= 1; i--) {
 151       if (cpool->tag_at(i).is_klass()) {
 152         Klass*  kls = cpool->resolved_klass_at(i);
 153         if (kls->name() == sym) {
 154           return kls;
 155         }
 156       }
 157     }
 158   }
 159 
 160   return found_klass();
 161 }
 162 
 163 // ------------------------------------------------------------------
 164 KlassHandle JVMCIEnv::get_klass_by_name(KlassHandle accessing_klass,
 165                                   Symbol* klass_name,
 166                                   bool require_local) {
 167   ResourceMark rm;
 168   constantPoolHandle cpool;
 169   return get_klass_by_name_impl(accessing_klass,
 170                                                  cpool,
 171                                                  klass_name,
 172                                                  require_local);
 173 }
 174 
 175 // ------------------------------------------------------------------
 176 // Implementation of get_klass_by_index.
 177 KlassHandle JVMCIEnv::get_klass_by_index_impl(const constantPoolHandle& cpool,
 178                                         int index,
 179                                         bool& is_accessible,
 180                                         KlassHandle accessor) {
 181   JVMCI_EXCEPTION_CONTEXT;
 182   KlassHandle klass (THREAD, ConstantPool::klass_at_if_loaded(cpool, index));
 183   Symbol* klass_name = NULL;
 184   if (klass.is_null()) {
 185     klass_name = cpool->klass_name_at(index);
 186   }
 187 
 188   if (klass.is_null()) {
 189     // Not found in constant pool.  Use the name to do the lookup.
 190     KlassHandle k = get_klass_by_name_impl(accessor,
 191                                         cpool,
 192                                         klass_name,
 193                                         false);
 194     // Calculate accessibility the hard way.
 195     if (k.is_null()) {
 196       is_accessible = false;
 197     } else if (k->class_loader() != accessor->class_loader() &&
 198                get_klass_by_name_impl(accessor, cpool, k->name(), true).is_null()) {
 199       // Loaded only remotely.  Not linked yet.
 200       is_accessible = false;
 201     } else {
 202       // Linked locally, and we must also check public/private, etc.
 203       is_accessible = check_klass_accessibility(accessor, k);
 204     }
 205     if (!is_accessible) {
 206       return KlassHandle();
 207     }
 208     return k;
 209   }
 210 
 211   // It is known to be accessible, since it was found in the constant pool.
 212   is_accessible = true;
 213   return klass;
 214 }
 215 
 216 // ------------------------------------------------------------------
 217 // Get a klass from the constant pool.
 218 KlassHandle JVMCIEnv::get_klass_by_index(const constantPoolHandle& cpool,
 219                                    int index,
 220                                    bool& is_accessible,
 221                                    KlassHandle accessor) {
 222   ResourceMark rm;
 223   KlassHandle result = get_klass_by_index_impl(cpool, index, is_accessible, accessor);
 224   return result;
 225 }
 226 
 227 // ------------------------------------------------------------------
 228 // Implementation of get_field_by_index.
 229 //
 230 // Implementation note: the results of field lookups are cached
 231 // in the accessor klass.
 232 void JVMCIEnv::get_field_by_index_impl(instanceKlassHandle klass, fieldDescriptor& field_desc,
 233                                         int index) {
 234   JVMCI_EXCEPTION_CONTEXT;
 235 
 236   assert(klass->is_linked(), "must be linked before using its constant-pool");
 237 
 238   constantPoolHandle cpool(thread, klass->constants());
 239 
 240   // Get the field's name, signature, and type.
 241   Symbol* name  = cpool->name_ref_at(index);
 242 
 243   int nt_index = cpool->name_and_type_ref_index_at(index);
 244   int sig_index = cpool->signature_ref_index_at(nt_index);
 245   Symbol* signature = cpool->symbol_at(sig_index);
 246 
 247   // Get the field's declared holder.
 248   int holder_index = cpool->klass_ref_index_at(index);
 249   bool holder_is_accessible;
 250   KlassHandle declared_holder = get_klass_by_index(cpool, holder_index,
 251                                                holder_is_accessible,
 252                                                klass);
 253 
 254   // The declared holder of this field may not have been loaded.
 255   // Bail out with partial field information.
 256   if (!holder_is_accessible) {
 257     return;
 258   }
 259 
 260 
 261   // Perform the field lookup.
 262   Klass*  canonical_holder =
 263     InstanceKlass::cast(declared_holder())->find_field(name, signature, &field_desc);
 264   if (canonical_holder == NULL) {
 265     return;
 266   }
 267 
 268   assert(canonical_holder == field_desc.field_holder(), "just checking");
 269 }
 270 
 271 // ------------------------------------------------------------------
 272 // Get a field by index from a klass's constant pool.
 273 void JVMCIEnv::get_field_by_index(instanceKlassHandle accessor, fieldDescriptor& fd, int index) {
 274   ResourceMark rm;
 275   return get_field_by_index_impl(accessor, fd, index);
 276 }
 277 
 278 // ------------------------------------------------------------------
 279 // Perform an appropriate method lookup based on accessor, holder,
 280 // name, signature, and bytecode.
 281 methodHandle JVMCIEnv::lookup_method(instanceKlassHandle h_accessor,
 282                                instanceKlassHandle h_holder,
 283                                Symbol*       name,
 284                                Symbol*       sig,
 285                                Bytecodes::Code bc) {
 286   JVMCI_EXCEPTION_CONTEXT;
 287   LinkResolver::check_klass_accessability(h_accessor, h_holder, KILL_COMPILE_ON_FATAL_(NULL));
 288   methodHandle dest_method;
 289   LinkInfo link_info(h_holder, name, sig, h_accessor, /*check_access*/true);
 290   switch (bc) {
 291   case Bytecodes::_invokestatic:
 292     dest_method =
 293       LinkResolver::resolve_static_call_or_null(link_info);
 294     break;
 295   case Bytecodes::_invokespecial:
 296     dest_method =
 297       LinkResolver::resolve_special_call_or_null(link_info);
 298     break;
 299   case Bytecodes::_invokeinterface:
 300     dest_method =
 301       LinkResolver::linktime_resolve_interface_method_or_null(link_info);
 302     break;
 303   case Bytecodes::_invokevirtual:
 304     dest_method =
 305       LinkResolver::linktime_resolve_virtual_method_or_null(link_info);
 306     break;
 307   default: ShouldNotReachHere();
 308   }
 309 
 310   return dest_method;
 311 }
 312 
 313 
 314 // ------------------------------------------------------------------
 315 methodHandle JVMCIEnv::get_method_by_index_impl(const constantPoolHandle& cpool,
 316                                           int index, Bytecodes::Code bc,
 317                                           instanceKlassHandle accessor) {
 318   if (bc == Bytecodes::_invokedynamic) {
 319     ConstantPoolCacheEntry* cpce = cpool->invokedynamic_cp_cache_entry_at(index);
 320     bool is_resolved = !cpce->is_f1_null();
 321     if (is_resolved) {
 322       // Get the invoker Method* from the constant pool.
 323       // (The appendix argument, if any, will be noted in the method's signature.)
 324       Method* adapter = cpce->f1_as_method();
 325       return methodHandle(adapter);
 326     }
 327 
 328     return NULL;
 329   }
 330 
 331   int holder_index = cpool->klass_ref_index_at(index);
 332   bool holder_is_accessible;
 333   KlassHandle holder = get_klass_by_index_impl(cpool, holder_index, holder_is_accessible, accessor);
 334 
 335   // Get the method's name and signature.
 336   Symbol* name_sym = cpool->name_ref_at(index);
 337   Symbol* sig_sym  = cpool->signature_ref_at(index);


 362     methodHandle m = lookup_method(accessor, lookup, name_sym, sig_sym, bc);
 363     if (!m.is_null() &&
 364         (bc == Bytecodes::_invokestatic
 365          ?  InstanceKlass::cast(m->method_holder())->is_not_initialized()
 366          : !InstanceKlass::cast(m->method_holder())->is_loaded())) {
 367       m = NULL;
 368     }
 369     if (!m.is_null()) {
 370       // We found the method.
 371       return m;
 372     }
 373   }
 374 
 375   // Either the declared holder was not loaded, or the method could
 376   // not be found.
 377 
 378   return NULL;
 379 }
 380 
 381 // ------------------------------------------------------------------
 382 instanceKlassHandle JVMCIEnv::get_instance_klass_for_declared_method_holder(KlassHandle method_holder) {
 383   // For the case of <array>.clone(), the method holder can be an ArrayKlass*
 384   // instead of an InstanceKlass*.  For that case simply pretend that the
 385   // declared holder is Object.clone since that's where the call will bottom out.
 386   if (method_holder->oop_is_instance()) {
 387     return instanceKlassHandle(method_holder());
 388   } else if (method_holder->oop_is_array()) {
 389     return instanceKlassHandle(SystemDictionary::Object_klass());
 390   } else {
 391     ShouldNotReachHere();
 392   }
 393   return NULL;
 394 }
 395 
 396 
 397 // ------------------------------------------------------------------
 398 methodHandle JVMCIEnv::get_method_by_index(const constantPoolHandle& cpool,
 399                                      int index, Bytecodes::Code bc,
 400                                      instanceKlassHandle accessor) {
 401   ResourceMark rm;
 402   return get_method_by_index_impl(cpool, index, bc, accessor);
 403 }
 404 
 405 // ------------------------------------------------------------------
 406 // Check for changes to the system dictionary during compilation
 407 // class loads, evolution, breakpoints
 408 JVMCIEnv::CodeInstallResult JVMCIEnv::check_for_system_dictionary_modification(Dependencies* dependencies, Handle compiled_code,
 409                                                                                JVMCIEnv* env, char** failure_detail) {
 410   // If JVMTI capabilities were enabled during compile, the compilation is invalidated.
 411   if (env != NULL) {
 412     if (!env->_jvmti_can_hotswap_or_post_breakpoint && JvmtiExport::can_hotswap_or_post_breakpoint()) {
 413       *failure_detail = (char*) "Hotswapping or breakpointing was enabled during compilation";
 414       return JVMCIEnv::dependencies_failed;
 415     }
 416   }
 417 
 418   // Dependencies must be checked when the system dictionary changes
 419   // or if we don't know whether it has changed (i.e., env == NULL).
 420   // In debug mode, always check dependencies.


 435       *failure_detail = st.as_string();
 436       if (env == NULL || counter_changed) {
 437         return JVMCIEnv::dependencies_failed;
 438       } else {
 439         // The dependencies were invalid at the time of installation
 440         // without any intervening modification of the system
 441         // dictionary.  That means they were invalidly constructed.
 442         return JVMCIEnv::dependencies_invalid;
 443       }
 444     }
 445     if (LogCompilation) {
 446       deps.log_dependency();
 447     }
 448   }
 449 
 450   return JVMCIEnv::ok;
 451 }
 452 
 453 // ------------------------------------------------------------------
 454 JVMCIEnv::CodeInstallResult JVMCIEnv::register_method(
 455                                 const methodHandle& method,
 456                                 nmethod*& nm,
 457                                 int entry_bci,
 458                                 CodeOffsets* offsets,
 459                                 int orig_pc_offset,
 460                                 CodeBuffer* code_buffer,
 461                                 int frame_words,
 462                                 OopMapSet* oop_map_set,
 463                                 ExceptionHandlerTable* handler_table,
 464                                 AbstractCompiler* compiler,
 465                                 DebugInformationRecorder* debug_info,
 466                                 Dependencies* dependencies,
 467                                 JVMCIEnv* env,
 468                                 int compile_id,
 469                                 bool has_unsafe_access,
 470                                 bool has_wide_vector,
 471                                 Handle installed_code,
 472                                 Handle compiled_code,
 473                                 Handle speculation_log) {
 474   JVMCI_EXCEPTION_CONTEXT;
 475   nm = NULL;


< prev index next >