Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/vm/ci/ciEnv.cpp
          +++ new/src/share/vm/ci/ciEnv.cpp
↓ open down ↓ 465 lines elided ↑ open up ↑
 466  466        }
 467  467      }
 468  468    }
 469  469  
 470  470    if (found_klass() != NULL) {
 471  471      // Found it.  Build a CI handle.
 472  472      return get_object(found_klass())->as_klass();
 473  473    }
 474  474  
 475  475    if (require_local)  return NULL;
      476 +
 476  477    // Not yet loaded into the VM, or not governed by loader constraints.
 477  478    // Make a CI representative for it.
 478  479    return get_unloaded_klass(accessing_klass, name);
 479  480  }
 480  481  
 481  482  // ------------------------------------------------------------------
 482  483  // ciEnv::get_klass_by_name
 483  484  ciKlass* ciEnv::get_klass_by_name(ciKlass* accessing_klass,
 484  485                                    ciSymbol* klass_name,
 485  486                                    bool require_local) {
↓ open down ↓ 5 lines elided ↑ open up ↑
 491  492  
 492  493  // ------------------------------------------------------------------
 493  494  // ciEnv::get_klass_by_index_impl
 494  495  //
 495  496  // Implementation of get_klass_by_index.
 496  497  ciKlass* ciEnv::get_klass_by_index_impl(constantPoolHandle cpool,
 497  498                                          int index,
 498  499                                          bool& is_accessible,
 499  500                                          ciInstanceKlass* accessor) {
 500  501    EXCEPTION_CONTEXT;
 501      -  KlassHandle klass (THREAD, constantPoolOopDesc::klass_at_if_loaded(cpool, index));
      502 +  KlassHandle klass(THREAD, constantPoolOopDesc::klass_at_if_loaded(cpool, index));
 502  503    Symbol* klass_name = NULL;
 503  504    if (klass.is_null()) {
 504  505      // The klass has not been inserted into the constant pool.
 505  506      // Try to look it up by name.
 506  507      {
 507  508        // We have to lock the cpool to keep the oop from being resolved
 508  509        // while we are accessing it.
 509  510        ObjectLocker ol(cpool, THREAD);
 510  511  
 511  512        constantTag tag = cpool->tag_at(index);
↓ open down ↓ 266 lines elided ↑ open up ↑
 778  779      }
 779  780      if (m != NULL) {
 780  781        // We found the method.
 781  782        return get_object(m)->as_method();
 782  783      }
 783  784    }
 784  785  
 785  786    // Either the declared holder was not loaded, or the method could
 786  787    // not be found.  Create a dummy ciMethod to represent the failed
 787  788    // lookup.
 788      -
 789      -  return get_unloaded_method(declared_holder,
 790      -                             get_symbol(name_sym),
 791      -                             get_symbol(sig_sym));
      789 +  ciSymbol* name      = get_symbol(name_sym);
      790 +  ciSymbol* signature = get_symbol(sig_sym);
      791 +  return get_unloaded_method(declared_holder, name, signature, accessor);
 792  792  }
 793  793  
 794  794  
 795  795  // ------------------------------------------------------------------
 796  796  // ciEnv::get_fake_invokedynamic_method_impl
 797  797  ciMethod* ciEnv::get_fake_invokedynamic_method_impl(constantPoolHandle cpool,
 798      -                                                    int index, Bytecodes::Code bc) {
      798 +                                                    int index, Bytecodes::Code bc,
      799 +                                                    ciInstanceKlass* accessor) {
 799  800    // Compare the following logic with InterpreterRuntime::resolve_invokedynamic.
 800  801    assert(bc == Bytecodes::_invokedynamic, "must be invokedynamic");
 801  802  
 802  803    bool is_resolved = cpool->cache()->main_entry_at(index)->is_resolved(bc);
 803  804    if (is_resolved && cpool->cache()->secondary_entry_at(index)->is_f1_null())
 804  805      // FIXME: code generation could allow for null (unlinked) call site
 805  806      is_resolved = false;
 806  807  
 807  808    // Call site might not be resolved yet.  We could create a real invoker method from the
 808  809    // compiler, but it is simpler to stop the code path here with an unlinked method.
 809  810    if (!is_resolved) {
 810      -    ciInstanceKlass* mh_klass = get_object(SystemDictionary::MethodHandle_klass())->as_instance_klass();
 811      -    ciSymbol*        sig_sym  = get_symbol(cpool->signature_ref_at(index));
 812      -    return get_unloaded_method(mh_klass, ciSymbol::invokeExact_name(), sig_sym);
      811 +    ciInstanceKlass* holder    = get_object(SystemDictionary::MethodHandle_klass())->as_instance_klass();
      812 +    ciSymbol*        name      = ciSymbol::invokeExact_name();
      813 +    ciSymbol*        signature = get_symbol(cpool->signature_ref_at(index));
      814 +    return get_unloaded_method(holder, name, signature, accessor);
 813  815    }
 814  816  
 815  817    // Get the invoker methodOop from the constant pool.
 816  818    oop f1_value = cpool->cache()->main_entry_at(index)->f1();
 817  819    methodOop signature_invoker = (methodOop) f1_value;
 818  820    assert(signature_invoker != NULL && signature_invoker->is_method() && signature_invoker->is_method_handle_invoke(),
 819  821           "correct result from LinkResolver::resolve_invokedynamic");
 820  822  
 821  823    return get_object(signature_invoker)->as_method();
 822  824  }
↓ open down ↓ 20 lines elided ↑ open up ↑
 843  845    return NULL;
 844  846  }
 845  847  
 846  848  
 847  849  // ------------------------------------------------------------------
 848  850  // ciEnv::get_method_by_index
 849  851  ciMethod* ciEnv::get_method_by_index(constantPoolHandle cpool,
 850  852                                       int index, Bytecodes::Code bc,
 851  853                                       ciInstanceKlass* accessor) {
 852  854    if (bc == Bytecodes::_invokedynamic) {
 853      -    GUARDED_VM_ENTRY(return get_fake_invokedynamic_method_impl(cpool, index, bc);)
      855 +    GUARDED_VM_ENTRY(return get_fake_invokedynamic_method_impl(cpool, index, bc, accessor);)
 854  856    } else {
 855      -    GUARDED_VM_ENTRY(return get_method_by_index_impl(cpool, index, bc, accessor);)
      857 +    GUARDED_VM_ENTRY(return get_method_by_index_impl(          cpool, index, bc, accessor);)
 856  858    }
 857  859  }
 858  860  
 859  861  
 860  862  // ------------------------------------------------------------------
 861  863  // ciEnv::name_buffer
 862  864  char *ciEnv::name_buffer(int req_len) {
 863  865    if (_name_buffer_len < req_len) {
 864  866      if (_name_buffer == NULL) {
 865  867        _name_buffer = (char*)arena()->Amalloc(sizeof(char)*req_len);
↓ open down ↓ 316 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX