src/cpu/x86/vm/templateTable_x86_32.cpp

changeset 8997
f8a45a60bc6b
parent 8368
32b682649973
child 9041
95a08233f46c
child 9604
da2e98c027fd
     1.1 --- a/src/cpu/x86/vm/templateTable_x86_32.cpp	Tue Aug 08 12:02:01 2017 +0100
     1.2 +++ b/src/cpu/x86/vm/templateTable_x86_32.cpp	Fri Sep 29 14:30:05 2017 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -3099,11 +3099,11 @@
    1.11  void TemplateTable::invokeinterface(int byte_no) {
    1.12    transition(vtos, vtos);
    1.13    assert(byte_no == f1_byte, "use this argument");
    1.14 -  prepare_invoke(byte_no, rax, rbx,  // get f1 Klass*, f2 itable index
    1.15 +  prepare_invoke(byte_no, rax, rbx,  // get f1 Klass*, f2 Method*
    1.16                   rcx, rdx); // recv, flags
    1.17  
    1.18 -  // rax: interface klass (from f1)
    1.19 -  // rbx: itable index (from f2)
    1.20 +  // rax: reference klass (from f1)
    1.21 +  // rbx: method (from f2)
    1.22    // rcx: receiver
    1.23    // rdx: flags
    1.24  
    1.25 @@ -3124,10 +3124,29 @@
    1.26    __ null_check(rcx, oopDesc::klass_offset_in_bytes());
    1.27    __ load_klass(rdx, rcx);
    1.28  
    1.29 +  Label no_such_interface, no_such_method;
    1.30 +
    1.31 +  // Receiver subtype check against REFC.
    1.32 +  // Superklass in rax. Subklass in rdx. Blows rcx, rdi.
    1.33 +  __ lookup_interface_method(// inputs: rec. class, interface, itable index
    1.34 +                             rdx, rax, noreg,
    1.35 +                             // outputs: scan temp. reg, scan temp. reg
    1.36 +                             rsi, rdi,
    1.37 +                             no_such_interface,
    1.38 +                             /*return_method=*/false);
    1.39 +
    1.40 +
    1.41    // profile this call
    1.42 +  __ restore_bcp(); // rbcp was destroyed by receiver type check
    1.43    __ profile_virtual_call(rdx, rsi, rdi);
    1.44  
    1.45 -  Label no_such_interface, no_such_method;
    1.46 +  // Get declaring interface class from method, and itable index
    1.47 +  __ movptr(rax, Address(rbx, Method::const_offset()));
    1.48 +  __ movptr(rax, Address(rax, ConstMethod::constants_offset()));
    1.49 +  __ movptr(rax, Address(rax, ConstantPool::pool_holder_offset_in_bytes()));
    1.50 +  __ movl(rbx, Address(rbx, Method::itable_index_offset()));
    1.51 +  __ subl(rbx, Method::itable_index_max);
    1.52 +  __ negl(rbx);
    1.53  
    1.54    __ lookup_interface_method(// inputs: rec. class, interface, itable index
    1.55                               rdx, rax, rbx,

mercurial