96 __ lwz(vtable_len, in_bytes(Klass::vtable_length_offset()), rcvr_klass);
97 __ cmpwi(CCR0, vtable_len, vtable_index*vtableEntry::size());
98 __ bge(CCR0, L);
99 __ li(R12_scratch2, vtable_index);
100 __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), R3_ARG1, R12_scratch2, false);
101 __ bind(L);
102 }
103 #endif
104
105 int entry_offset = in_bytes(Klass::vtable_start_offset()) +
106 vtable_index*vtableEntry::size_in_bytes();
107 int v_off = entry_offset + vtableEntry::method_offset_in_bytes();
108
109 __ ld(R19_method, (RegisterOrConstant)v_off, rcvr_klass);
110
111 #ifndef PRODUCT
112 if (DebugVtables) {
113 Label L;
114 __ cmpdi(CCR0, R19_method, 0);
115 __ bne(CCR0, L);
116 __ stop("Vtable entry is ZERO", 102);
117 __ bind(L);
118 }
119 #endif
120
121 address ame_addr = __ pc(); // ame = abstract method error
122 // if the vtable entry is null, the method is abstract
123 // NOTE: for vtable dispatches, the vtable entry will never be null.
124
125 __ null_check(R19_method, in_bytes(Method::from_compiled_offset()), /*implicit only*/NULL);
126 __ ld(R12_scratch2, in_bytes(Method::from_compiled_offset()), R19_method);
127 __ mtctr(R12_scratch2);
128 __ bctr();
129
130 masm->flush();
131 bookkeeping(masm, tty, s, npe_addr, ame_addr, true, vtable_index, slop_bytes, 0);
132
133 return s;
134 }
135
136 VtableStub* VtableStubs::create_itable_stub(int itable_index) {
182 __ null_check(R3_ARG1, oopDesc::klass_offset_in_bytes(), /*implicit only*/NULL);
183 __ load_klass(rcvr_klass, R3_ARG1);
184
185 // Receiver subtype check against REFC.
186 __ ld(interface, CompiledICHolder::holder_klass_offset(), R19_method);
187 __ lookup_interface_method(rcvr_klass, interface, noreg,
188 R0, tmp1, tmp2,
189 L_no_such_interface, /*return_method=*/ false);
190
191 // Get Method* and entrypoint for compiler
192 __ ld(interface, CompiledICHolder::holder_metadata_offset(), R19_method);
193 __ lookup_interface_method(rcvr_klass, interface, itable_index,
194 R19_method, tmp1, tmp2,
195 L_no_such_interface, /*return_method=*/ true);
196
197 #ifndef PRODUCT
198 if (DebugVtables) {
199 Label ok;
200 __ cmpd(CCR0, R19_method, 0);
201 __ bne(CCR0, ok);
202 __ stop("method is null", 103);
203 __ bind(ok);
204 }
205 #endif
206
207 // If the vtable entry is null, the method is abstract.
208 address ame_addr = __ pc(); // ame = abstract method error
209
210 // Must do an explicit check if implicit checks are disabled.
211 __ null_check(R19_method, in_bytes(Method::from_compiled_offset()), &L_no_such_interface);
212 __ ld(R12_scratch2, in_bytes(Method::from_compiled_offset()), R19_method);
213 __ mtctr(R12_scratch2);
214 __ bctr();
215
216 // Handle IncompatibleClassChangeError in itable stubs.
217 // More detailed error message.
218 // We force resolving of the call site by jumping to the "handle
219 // wrong method" stub, and so let the interpreter runtime do all the
220 // dirty work.
221 __ bind(L_no_such_interface);
222 start_pc = __ pc();
|
96 __ lwz(vtable_len, in_bytes(Klass::vtable_length_offset()), rcvr_klass);
97 __ cmpwi(CCR0, vtable_len, vtable_index*vtableEntry::size());
98 __ bge(CCR0, L);
99 __ li(R12_scratch2, vtable_index);
100 __ call_VM(noreg, CAST_FROM_FN_PTR(address, bad_compiled_vtable_index), R3_ARG1, R12_scratch2, false);
101 __ bind(L);
102 }
103 #endif
104
105 int entry_offset = in_bytes(Klass::vtable_start_offset()) +
106 vtable_index*vtableEntry::size_in_bytes();
107 int v_off = entry_offset + vtableEntry::method_offset_in_bytes();
108
109 __ ld(R19_method, (RegisterOrConstant)v_off, rcvr_klass);
110
111 #ifndef PRODUCT
112 if (DebugVtables) {
113 Label L;
114 __ cmpdi(CCR0, R19_method, 0);
115 __ bne(CCR0, L);
116 __ stop("Vtable entry is ZERO");
117 __ bind(L);
118 }
119 #endif
120
121 address ame_addr = __ pc(); // ame = abstract method error
122 // if the vtable entry is null, the method is abstract
123 // NOTE: for vtable dispatches, the vtable entry will never be null.
124
125 __ null_check(R19_method, in_bytes(Method::from_compiled_offset()), /*implicit only*/NULL);
126 __ ld(R12_scratch2, in_bytes(Method::from_compiled_offset()), R19_method);
127 __ mtctr(R12_scratch2);
128 __ bctr();
129
130 masm->flush();
131 bookkeeping(masm, tty, s, npe_addr, ame_addr, true, vtable_index, slop_bytes, 0);
132
133 return s;
134 }
135
136 VtableStub* VtableStubs::create_itable_stub(int itable_index) {
182 __ null_check(R3_ARG1, oopDesc::klass_offset_in_bytes(), /*implicit only*/NULL);
183 __ load_klass(rcvr_klass, R3_ARG1);
184
185 // Receiver subtype check against REFC.
186 __ ld(interface, CompiledICHolder::holder_klass_offset(), R19_method);
187 __ lookup_interface_method(rcvr_klass, interface, noreg,
188 R0, tmp1, tmp2,
189 L_no_such_interface, /*return_method=*/ false);
190
191 // Get Method* and entrypoint for compiler
192 __ ld(interface, CompiledICHolder::holder_metadata_offset(), R19_method);
193 __ lookup_interface_method(rcvr_klass, interface, itable_index,
194 R19_method, tmp1, tmp2,
195 L_no_such_interface, /*return_method=*/ true);
196
197 #ifndef PRODUCT
198 if (DebugVtables) {
199 Label ok;
200 __ cmpd(CCR0, R19_method, 0);
201 __ bne(CCR0, ok);
202 __ stop("method is null");
203 __ bind(ok);
204 }
205 #endif
206
207 // If the vtable entry is null, the method is abstract.
208 address ame_addr = __ pc(); // ame = abstract method error
209
210 // Must do an explicit check if implicit checks are disabled.
211 __ null_check(R19_method, in_bytes(Method::from_compiled_offset()), &L_no_such_interface);
212 __ ld(R12_scratch2, in_bytes(Method::from_compiled_offset()), R19_method);
213 __ mtctr(R12_scratch2);
214 __ bctr();
215
216 // Handle IncompatibleClassChangeError in itable stubs.
217 // More detailed error message.
218 // We force resolving of the call site by jumping to the "handle
219 // wrong method" stub, and so let the interpreter runtime do all the
220 // dirty work.
221 __ bind(L_no_such_interface);
222 start_pc = __ pc();
|