1 /*
2 * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
60
61 #ifndef PRODUCT
62 if (CountCompiledCalls) {
63 __ incrementl(ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr()));
64 }
65 #endif
66
67 // get receiver (need to skip return address on top of stack)
68 assert(VtableStub::receiver_location() == j_rarg0->as_VMReg(), "receiver expected in j_rarg0");
69
70 // Free registers (non-args) are rax, rbx
71
72 // get receiver klass
73 address npe_addr = __ pc();
74 __ load_klass(rax, j_rarg0);
75
76 #ifndef PRODUCT
77 if (DebugVtables) {
78 Label L;
79 // check offset vs vtable length
80 __ cmpl(Address(rax, InstanceKlass::vtable_length_offset() * wordSize),
81 vtable_index * vtableEntry::size());
82 __ jcc(Assembler::greater, L);
83 __ movl(rbx, vtable_index);
84 __ call_VM(noreg,
85 CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), j_rarg0, rbx);
86 __ bind(L);
87 }
88 #endif // PRODUCT
89
90 // load Method* and target address
91 const Register method = rbx;
92
93 __ lookup_virtual_method(rax, vtable_index, method);
94
95 if (DebugVtables) {
96 Label L;
97 __ cmpptr(method, (int32_t)NULL_WORD);
98 __ jcc(Assembler::equal, L);
99 __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD);
100 __ jcc(Assembler::notZero, L);
|
1 /*
2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
60
61 #ifndef PRODUCT
62 if (CountCompiledCalls) {
63 __ incrementl(ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr()));
64 }
65 #endif
66
67 // get receiver (need to skip return address on top of stack)
68 assert(VtableStub::receiver_location() == j_rarg0->as_VMReg(), "receiver expected in j_rarg0");
69
70 // Free registers (non-args) are rax, rbx
71
72 // get receiver klass
73 address npe_addr = __ pc();
74 __ load_klass(rax, j_rarg0);
75
76 #ifndef PRODUCT
77 if (DebugVtables) {
78 Label L;
79 // check offset vs vtable length
80 __ cmpl(Address(rax, InstanceKlass::vtable_length_offset()),
81 vtable_index * vtableEntry::size());
82 __ jcc(Assembler::greater, L);
83 __ movl(rbx, vtable_index);
84 __ call_VM(noreg,
85 CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), j_rarg0, rbx);
86 __ bind(L);
87 }
88 #endif // PRODUCT
89
90 // load Method* and target address
91 const Register method = rbx;
92
93 __ lookup_virtual_method(rax, vtable_index, method);
94
95 if (DebugVtables) {
96 Label L;
97 __ cmpptr(method, (int32_t)NULL_WORD);
98 __ jcc(Assembler::equal, L);
99 __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD);
100 __ jcc(Assembler::notZero, L);
|