src/share/vm/oops/cpCache.cpp

changeset 5732
b2e698d2276c
parent 5208
a1ebd310d5c1
child 5784
190899198332
     1.1 --- a/src/share/vm/oops/cpCache.cpp	Tue Sep 17 23:12:27 2013 +0200
     1.2 +++ b/src/share/vm/oops/cpCache.cpp	Fri Sep 13 22:38:02 2013 -0400
     1.3 @@ -140,9 +140,10 @@
     1.4              err_msg("size must not change: parameter_size=%d, value=%d", parameter_size(), value));
     1.5  }
     1.6  
     1.7 -void ConstantPoolCacheEntry::set_method(Bytecodes::Code invoke_code,
     1.8 -                                        methodHandle method,
     1.9 -                                        int vtable_index) {
    1.10 +void ConstantPoolCacheEntry::set_direct_or_vtable_call(Bytecodes::Code invoke_code,
    1.11 +                                                       methodHandle method,
    1.12 +                                                       int vtable_index) {
    1.13 +  bool is_vtable_call = (vtable_index >= 0);  // FIXME: split this method on this boolean
    1.14    assert(method->interpreter_entry() != NULL, "should have been set at this point");
    1.15    assert(!method->is_obsolete(),  "attempt to write obsolete method to cpCache");
    1.16  
    1.17 @@ -160,7 +161,8 @@
    1.18        // ...and fall through as if we were handling invokevirtual:
    1.19      case Bytecodes::_invokevirtual:
    1.20        {
    1.21 -        if (method->can_be_statically_bound()) {
    1.22 +        if (!is_vtable_call) {
    1.23 +          assert(method->can_be_statically_bound(), "");
    1.24            // set_f2_as_vfinal_method checks if is_vfinal flag is true.
    1.25            set_method_flags(as_TosState(method->result_type()),
    1.26                             (                             1      << is_vfinal_shift) |
    1.27 @@ -169,6 +171,7 @@
    1.28                             method()->size_of_parameters());
    1.29            set_f2_as_vfinal_method(method());
    1.30          } else {
    1.31 +          assert(!method->can_be_statically_bound(), "");
    1.32            assert(vtable_index >= 0, "valid index");
    1.33            assert(!method->is_final_method(), "sanity");
    1.34            set_method_flags(as_TosState(method->result_type()),
    1.35 @@ -182,6 +185,7 @@
    1.36  
    1.37      case Bytecodes::_invokespecial:
    1.38      case Bytecodes::_invokestatic:
    1.39 +      assert(!is_vtable_call, "");
    1.40        // Note:  Read and preserve the value of the is_vfinal flag on any
    1.41        // invokevirtual bytecode shared with this constant pool cache entry.
    1.42        // It is cheap and safe to consult is_vfinal() at all times.
    1.43 @@ -232,8 +236,22 @@
    1.44    NOT_PRODUCT(verify(tty));
    1.45  }
    1.46  
    1.47 +void ConstantPoolCacheEntry::set_direct_call(Bytecodes::Code invoke_code, methodHandle method) {
    1.48 +  int index = Method::nonvirtual_vtable_index;
    1.49 +  // index < 0; FIXME: inline and customize set_direct_or_vtable_call
    1.50 +  set_direct_or_vtable_call(invoke_code, method, index);
    1.51 +}
    1.52  
    1.53 -void ConstantPoolCacheEntry::set_interface_call(methodHandle method, int index) {
    1.54 +void ConstantPoolCacheEntry::set_vtable_call(Bytecodes::Code invoke_code, methodHandle method, int index) {
    1.55 +  // either the method is a miranda or its holder should accept the given index
    1.56 +  assert(method->method_holder()->is_interface() || method->method_holder()->verify_vtable_index(index), "");
    1.57 +  // index >= 0; FIXME: inline and customize set_direct_or_vtable_call
    1.58 +  set_direct_or_vtable_call(invoke_code, method, index);
    1.59 +}
    1.60 +
    1.61 +void ConstantPoolCacheEntry::set_itable_call(Bytecodes::Code invoke_code, methodHandle method, int index) {
    1.62 +  assert(method->method_holder()->verify_itable_index(index), "");
    1.63 +  assert(invoke_code == Bytecodes::_invokeinterface, "");
    1.64    InstanceKlass* interf = method->method_holder();
    1.65    assert(interf->is_interface(), "must be an interface");
    1.66    assert(!method->is_final_method(), "interfaces do not have final methods; cannot link to one here");

mercurial