1 /* |
1 /* |
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
3097 |
3097 |
3098 |
3098 |
3099 void TemplateTable::invokeinterface(int byte_no) { |
3099 void TemplateTable::invokeinterface(int byte_no) { |
3100 transition(vtos, vtos); |
3100 transition(vtos, vtos); |
3101 assert(byte_no == f1_byte, "use this argument"); |
3101 assert(byte_no == f1_byte, "use this argument"); |
3102 prepare_invoke(byte_no, rax, rbx, // get f1 Klass*, f2 itable index |
3102 prepare_invoke(byte_no, rax, rbx, // get f1 Klass*, f2 Method* |
3103 rcx, rdx); // recv, flags |
3103 rcx, rdx); // recv, flags |
3104 |
3104 |
3105 // rax: interface klass (from f1) |
3105 // rax: reference klass (from f1) |
3106 // rbx: itable index (from f2) |
3106 // rbx: method (from f2) |
3107 // rcx: receiver |
3107 // rcx: receiver |
3108 // rdx: flags |
3108 // rdx: flags |
3109 |
3109 |
3110 // Special case of invokeinterface called for virtual method of |
3110 // Special case of invokeinterface called for virtual method of |
3111 // java.lang.Object. See cpCacheOop.cpp for details. |
3111 // java.lang.Object. See cpCacheOop.cpp for details. |
3122 // Get receiver klass into rdx - also a null check |
3122 // Get receiver klass into rdx - also a null check |
3123 __ restore_locals(); // restore rdi |
3123 __ restore_locals(); // restore rdi |
3124 __ null_check(rcx, oopDesc::klass_offset_in_bytes()); |
3124 __ null_check(rcx, oopDesc::klass_offset_in_bytes()); |
3125 __ load_klass(rdx, rcx); |
3125 __ load_klass(rdx, rcx); |
3126 |
3126 |
|
3127 Label no_such_interface, no_such_method; |
|
3128 |
|
3129 // Receiver subtype check against REFC. |
|
3130 // Superklass in rax. Subklass in rdx. Blows rcx, rdi. |
|
3131 __ lookup_interface_method(// inputs: rec. class, interface, itable index |
|
3132 rdx, rax, noreg, |
|
3133 // outputs: scan temp. reg, scan temp. reg |
|
3134 rsi, rdi, |
|
3135 no_such_interface, |
|
3136 /*return_method=*/false); |
|
3137 |
|
3138 |
3127 // profile this call |
3139 // profile this call |
|
3140 __ restore_bcp(); // rbcp was destroyed by receiver type check |
3128 __ profile_virtual_call(rdx, rsi, rdi); |
3141 __ profile_virtual_call(rdx, rsi, rdi); |
3129 |
3142 |
3130 Label no_such_interface, no_such_method; |
3143 // Get declaring interface class from method, and itable index |
|
3144 __ movptr(rax, Address(rbx, Method::const_offset())); |
|
3145 __ movptr(rax, Address(rax, ConstMethod::constants_offset())); |
|
3146 __ movptr(rax, Address(rax, ConstantPool::pool_holder_offset_in_bytes())); |
|
3147 __ movl(rbx, Address(rbx, Method::itable_index_offset())); |
|
3148 __ subl(rbx, Method::itable_index_max); |
|
3149 __ negl(rbx); |
3131 |
3150 |
3132 __ lookup_interface_method(// inputs: rec. class, interface, itable index |
3151 __ lookup_interface_method(// inputs: rec. class, interface, itable index |
3133 rdx, rax, rbx, |
3152 rdx, rax, rbx, |
3134 // outputs: method, scan temp. reg |
3153 // outputs: method, scan temp. reg |
3135 rbx, rsi, |
3154 rbx, rsi, |