< prev index next >

src/hotspot/share/interpreter/linkResolver.cpp

Print this page
*** 988,11 ***
    resolve_field(fd, link_info, byte, initialize_class, CHECK);
  }
  
  void LinkResolver::resolve_field(fieldDescriptor& fd,
                                   const LinkInfo& link_info,
!                                  Bytecodes::Code byte, bool initialize_class,
                                   TRAPS) {
    assert(byte == Bytecodes::_getstatic || byte == Bytecodes::_putstatic ||
           byte == Bytecodes::_getfield  || byte == Bytecodes::_putfield  ||
           byte == Bytecodes::_nofast_getfield  || byte == Bytecodes::_nofast_putfield  ||
           (byte == Bytecodes::_nop && !link_info.check_access()), "bad field access bytecode");
--- 988,12 ---
    resolve_field(fd, link_info, byte, initialize_class, CHECK);
  }
  
  void LinkResolver::resolve_field(fieldDescriptor& fd,
                                   const LinkInfo& link_info,
!                                  Bytecodes::Code byte,
+                                  bool initialize_class,
                                   TRAPS) {
    assert(byte == Bytecodes::_getstatic || byte == Bytecodes::_putstatic ||
           byte == Bytecodes::_getfield  || byte == Bytecodes::_putfield  ||
           byte == Bytecodes::_nofast_getfield  || byte == Bytecodes::_nofast_putfield  ||
           (byte == Bytecodes::_nop && !link_info.check_access()), "bad field access bytecode");

*** 1121,10 ***
--- 1122,14 ---
    // setup result
    result.set_static(resolved_klass, methodHandle(THREAD, resolved_method), CHECK);
    JFR_ONLY(Jfr::on_resolution(result, CHECK);)
  }
  
+ void LinkResolver::cds_resolve_static_call(CallInfo& result, const LinkInfo& link_info, TRAPS) {
+   resolve_static_call(result, link_info, /*initialize_class*/false, CHECK);
+ }
+ 
  // throws linktime exceptions
  Method* LinkResolver::linktime_resolve_static_method(const LinkInfo& link_info, TRAPS) {
  
    Klass* resolved_klass = link_info.resolved_klass();
    Method* resolved_method;

*** 1783,24 ***
      return false;
    }
  }
  
  void LinkResolver::resolve_invokehandle(CallInfo& result, const constantPoolHandle& pool, int index, TRAPS) {
- 
    PerfTraceTimedEvent timer(ClassLoader::perf_resolve_invokehandle_time(),
!                             ClassLoader::perf_resolve_invokehandle_count());
  
    LinkInfo link_info(pool, index, Bytecodes::_invokehandle, CHECK);
    if (log_is_enabled(Info, methodhandles)) {
      ResourceMark rm(THREAD);
      log_info(methodhandles)("resolve_invokehandle %s %s", link_info.name()->as_C_string(),
                              link_info.signature()->as_C_string());
    }
-   { // Check if the call site has been bound already, and short circuit:
-     bool is_done = resolve_previously_linked_invokehandle(result, link_info, pool, index, CHECK);
-     if (is_done) return;
-   }
    resolve_handle_call(result, link_info, CHECK);
  }
  
  void LinkResolver::resolve_handle_call(CallInfo& result,
                                         const LinkInfo& link_info,
--- 1788,24 ---
      return false;
    }
  }
  
  void LinkResolver::resolve_invokehandle(CallInfo& result, const constantPoolHandle& pool, int index, TRAPS) {
    PerfTraceTimedEvent timer(ClassLoader::perf_resolve_invokehandle_time(),
!                             ClassLoader::perf_resolve_invokehandle_count(),
+                             THREAD->class_being_initialized() == nullptr);
  
    LinkInfo link_info(pool, index, Bytecodes::_invokehandle, CHECK);
+   { // Check if the call site has been bound already, and short circuit:
+     bool is_done = resolve_previously_linked_invokehandle(result, link_info, pool, index, CHECK);
+     if (is_done) return;
+   }
    if (log_is_enabled(Info, methodhandles)) {
      ResourceMark rm(THREAD);
      log_info(methodhandles)("resolve_invokehandle %s %s", link_info.name()->as_C_string(),
                              link_info.signature()->as_C_string());
    }
    resolve_handle_call(result, link_info, CHECK);
  }
  
  void LinkResolver::resolve_handle_call(CallInfo& result,
                                         const LinkInfo& link_info,

*** 1839,12 ***
    JFR_ONLY(Jfr::on_resolution(result, CHECK);)
  }
  
  void LinkResolver::resolve_invokedynamic(CallInfo& result, const constantPoolHandle& pool, int indy_index, TRAPS) {
    PerfTraceTimedEvent timer(ClassLoader::perf_resolve_invokedynamic_time(),
!                             ClassLoader::perf_resolve_invokedynamic_count());
! 
    int pool_index = pool->resolved_indy_entry_at(indy_index)->constant_pool_index();
  
    // Resolve the bootstrap specifier (BSM + optional arguments).
    BootstrapInfo bootstrap_specifier(pool, pool_index, indy_index);
  
--- 1844,12 ---
    JFR_ONLY(Jfr::on_resolution(result, CHECK);)
  }
  
  void LinkResolver::resolve_invokedynamic(CallInfo& result, const constantPoolHandle& pool, int indy_index, TRAPS) {
    PerfTraceTimedEvent timer(ClassLoader::perf_resolve_invokedynamic_time(),
!                             ClassLoader::perf_resolve_invokedynamic_count(),
!                             THREAD->class_being_initialized() == nullptr);
    int pool_index = pool->resolved_indy_entry_at(indy_index)->constant_pool_index();
  
    // Resolve the bootstrap specifier (BSM + optional arguments).
    BootstrapInfo bootstrap_specifier(pool, pool_index, indy_index);
  
< prev index next >