src/cpu/x86/vm/templateTable_x86_64.cpp

changeset 8997
f8a45a60bc6b
parent 8368
32b682649973
child 9041
95a08233f46c
child 9604
da2e98c027fd
equal deleted inserted replaced
8996:2667e5c45e24 8997:f8a45a60bc6b
1 /* 1 /*
2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 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.
3148 } 3148 }
3149 3149
3150 void TemplateTable::invokeinterface(int byte_no) { 3150 void TemplateTable::invokeinterface(int byte_no) {
3151 transition(vtos, vtos); 3151 transition(vtos, vtos);
3152 assert(byte_no == f1_byte, "use this argument"); 3152 assert(byte_no == f1_byte, "use this argument");
3153 prepare_invoke(byte_no, rax, rbx, // get f1 Klass*, f2 itable index 3153 prepare_invoke(byte_no, rax, rbx, // get f1 Klass*, f2 Method*
3154 rcx, rdx); // recv, flags 3154 rcx, rdx); // recv, flags
3155 3155
3156 // rax: interface klass (from f1) 3156 // rax: reference klass (from f1)
3157 // rbx: itable index (from f2) 3157 // rbx: method (from f2)
3158 // rcx: receiver 3158 // rcx: receiver
3159 // rdx: flags 3159 // rdx: flags
3160 3160
3161 // Special case of invokeinterface called for virtual method of 3161 // Special case of invokeinterface called for virtual method of
3162 // java.lang.Object. See cpCacheOop.cpp for details. 3162 // java.lang.Object. See cpCacheOop.cpp for details.
3173 // Get receiver klass into rdx - also a null check 3173 // Get receiver klass into rdx - also a null check
3174 __ restore_locals(); // restore r14 3174 __ restore_locals(); // restore r14
3175 __ null_check(rcx, oopDesc::klass_offset_in_bytes()); 3175 __ null_check(rcx, oopDesc::klass_offset_in_bytes());
3176 __ load_klass(rdx, rcx); 3176 __ load_klass(rdx, rcx);
3177 3177
3178 Label no_such_interface, no_such_method;
3179
3180 // Receiver subtype check against REFC.
3181 // Superklass in rax. Subklass in rdx. Blows rcx, rdi.
3182 __ lookup_interface_method(// inputs: rec. class, interface, itable index
3183 rdx, rax, noreg,
3184 // outputs: scan temp. reg, scan temp. reg
3185 r13, r14,
3186 no_such_interface,
3187 /*return_method=*/false);
3188
3178 // profile this call 3189 // profile this call
3190 __ restore_bcp(); // rbcp was destroyed by receiver type check
3179 __ profile_virtual_call(rdx, r13, r14); 3191 __ profile_virtual_call(rdx, r13, r14);
3180 3192
3181 Label no_such_interface, no_such_method; 3193 // Get declaring interface class from method, and itable index
3194 __ movptr(rax, Address(rbx, Method::const_offset()));
3195 __ movptr(rax, Address(rax, ConstMethod::constants_offset()));
3196 __ movptr(rax, Address(rax, ConstantPool::pool_holder_offset_in_bytes()));
3197 __ movl(rbx, Address(rbx, Method::itable_index_offset()));
3198 __ subl(rbx, Method::itable_index_max);
3199 __ negl(rbx);
3182 3200
3183 __ lookup_interface_method(// inputs: rec. class, interface, itable index 3201 __ lookup_interface_method(// inputs: rec. class, interface, itable index
3184 rdx, rax, rbx, 3202 rdx, rax, rbx,
3185 // outputs: method, scan temp. reg 3203 // outputs: method, scan temp. reg
3186 rbx, r13, 3204 rbx, r13,

mercurial