8194739: Zero port of 8174962: Better interface invocations

Mon, 22 Jan 2018 15:19:02 +0000

author
aph
date
Mon, 22 Jan 2018 15:19:02 +0000
changeset 9293
8bd024c567e7
parent 9292
da2bb5e60234
child 9294
de8045923ad2

8194739: Zero port of 8174962: Better interface invocations
Reviewed-by: adinn, coleenp

src/cpu/zero/vm/methodHandles_zero.cpp file | annotate | diff | comparison | revisions
src/share/vm/interpreter/bytecodeInterpreter.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/cpu/zero/vm/methodHandles_zero.cpp	Thu Feb 08 00:23:31 2018 +0000
     1.2 +++ b/src/cpu/zero/vm/methodHandles_zero.cpp	Mon Jan 22 15:19:02 2018 +0000
     1.3 @@ -180,3 +180,9 @@
     1.4      return NULL;
     1.5    }
     1.6  }
     1.7 +
     1.8 +#ifndef PRODUCT
     1.9 +void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) {
    1.10 +  // This is just a stub.
    1.11 +}
    1.12 +#endif //PRODUCT
     2.1 --- a/src/share/vm/interpreter/bytecodeInterpreter.cpp	Thu Feb 08 00:23:31 2018 +0000
     2.2 +++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp	Mon Jan 22 15:19:02 2018 +0000
     2.3 @@ -2569,13 +2569,35 @@
     2.4  
     2.5          // this could definitely be cleaned up QQQ
     2.6          Method* callee;
     2.7 -        Klass* iclass = cache->f1_as_klass();
     2.8 -        // InstanceKlass* interface = (InstanceKlass*) iclass;
     2.9 +        Method *interface_method = cache->f2_as_interface_method();
    2.10 +        InstanceKlass* iclass = interface_method->method_holder();
    2.11 +
    2.12          // get receiver
    2.13          int parms = cache->parameter_size();
    2.14          oop rcvr = STACK_OBJECT(-parms);
    2.15          CHECK_NULL(rcvr);
    2.16          InstanceKlass* int2 = (InstanceKlass*) rcvr->klass();
    2.17 +
    2.18 +        // Receiver subtype check against resolved interface klass (REFC).
    2.19 +        {
    2.20 +          Klass* refc = cache->f1_as_klass();
    2.21 +          itableOffsetEntry* scan;
    2.22 +          for (scan = (itableOffsetEntry*) int2->start_of_itable();
    2.23 +               scan->interface_klass() != NULL;
    2.24 +               scan++) {
    2.25 +            if (scan->interface_klass() == refc) {
    2.26 +              break;
    2.27 +            }
    2.28 +          }
    2.29 +          // Check that the entry is non-null.  A null entry means
    2.30 +          // that the receiver class doesn't implement the
    2.31 +          // interface, and wasn't the same as when the caller was
    2.32 +          // compiled.
    2.33 +          if (scan->interface_klass() == NULL) {
    2.34 +            VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), "", note_no_trap);
    2.35 +          }
    2.36 +        }
    2.37 +
    2.38          itableOffsetEntry* ki = (itableOffsetEntry*) int2->start_of_itable();
    2.39          int i;
    2.40          for ( i = 0 ; i < int2->itable_length() ; i++, ki++ ) {
    2.41 @@ -2587,7 +2609,8 @@
    2.42          if (i == int2->itable_length()) {
    2.43            VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(), "", note_no_trap);
    2.44          }
    2.45 -        int mindex = cache->f2_as_index();
    2.46 +        int mindex = interface_method->itable_index();
    2.47 +
    2.48          itableMethodEntry* im = ki->first_method_entry(rcvr->klass());
    2.49          callee = im[mindex].method();
    2.50          if (callee == NULL) {

mercurial