1 /*
2 * Copyright (c) 1997, 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 *
68 MacroAssembler* masm = new MacroAssembler(&cb);
69
70 #ifndef PRODUCT
71
72 if (CountCompiledCalls) {
73 __ incrementl(ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr()));
74 }
75 #endif /* PRODUCT */
76
77 // get receiver (need to skip return address on top of stack)
78 assert(VtableStub::receiver_location() == rcx->as_VMReg(), "receiver expected in rcx");
79
80 // get receiver klass
81 address npe_addr = __ pc();
82 __ movptr(rax, Address(rcx, oopDesc::klass_offset_in_bytes()));
83
84 #ifndef PRODUCT
85 if (DebugVtables) {
86 Label L;
87 // check offset vs vtable length
88 __ cmpl(Address(rax, InstanceKlass::vtable_length_offset()*wordSize), vtable_index*vtableEntry::size());
89 __ jcc(Assembler::greater, L);
90 __ movl(rbx, vtable_index);
91 __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), rcx, rbx);
92 __ bind(L);
93 }
94 #endif // PRODUCT
95
96 const Register method = rbx;
97
98 // load Method* and target address
99 __ lookup_virtual_method(rax, vtable_index, method);
100
101 if (DebugVtables) {
102 Label L;
103 __ cmpptr(method, (int32_t)NULL_WORD);
104 __ jcc(Assembler::equal, L);
105 __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD);
106 __ jcc(Assembler::notZero, L);
107 __ stop("Vtable entry is NULL");
108 __ bind(L);
|
1 /*
2 * Copyright (c) 1997, 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 *
68 MacroAssembler* masm = new MacroAssembler(&cb);
69
70 #ifndef PRODUCT
71
72 if (CountCompiledCalls) {
73 __ incrementl(ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr()));
74 }
75 #endif /* PRODUCT */
76
77 // get receiver (need to skip return address on top of stack)
78 assert(VtableStub::receiver_location() == rcx->as_VMReg(), "receiver expected in rcx");
79
80 // get receiver klass
81 address npe_addr = __ pc();
82 __ movptr(rax, Address(rcx, oopDesc::klass_offset_in_bytes()));
83
84 #ifndef PRODUCT
85 if (DebugVtables) {
86 Label L;
87 // check offset vs vtable length
88 __ cmpl(Address(rax, InstanceKlass::vtable_length_offset()), vtable_index*vtableEntry::size());
89 __ jcc(Assembler::greater, L);
90 __ movl(rbx, vtable_index);
91 __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), rcx, rbx);
92 __ bind(L);
93 }
94 #endif // PRODUCT
95
96 const Register method = rbx;
97
98 // load Method* and target address
99 __ lookup_virtual_method(rax, vtable_index, method);
100
101 if (DebugVtables) {
102 Label L;
103 __ cmpptr(method, (int32_t)NULL_WORD);
104 __ jcc(Assembler::equal, L);
105 __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD);
106 __ jcc(Assembler::notZero, L);
107 __ stop("Vtable entry is NULL");
108 __ bind(L);
|