95 __ lookup_virtual_method(rax, vtable_index, method);
96
97 if (DebugVtables) {
98 Label L;
99 __ cmpptr(method, (int32_t)NULL_WORD);
100 __ jcc(Assembler::equal, L);
101 __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD);
102 __ jcc(Assembler::notZero, L);
103 __ stop("Vtable entry is NULL");
104 __ bind(L);
105 }
106 // rax: receiver klass
107 // rbx: Method*
108 // rcx: receiver
109 address ame_addr = __ pc();
110 __ jmp( Address(rbx, Method::from_compiled_offset()));
111
112 __ flush();
113
114 if (PrintMiscellaneous && (WizardMode || Verbose)) {
115 tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d",
116 vtable_index, s->entry_point(),
117 (int)(s->code_end() - s->entry_point()),
118 (int)(s->code_end() - __ pc()));
119 }
120 guarantee(__ pc() <= s->code_end(), "overflowed buffer");
121 // shut the door on sizing bugs
122 int slop = 3; // 32-bit offset is this much larger than an 8-bit one
123 assert(vtable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset");
124
125 s->set_exception_points(npe_addr, ame_addr);
126 return s;
127 }
128
129
130 VtableStub* VtableStubs::create_itable_stub(int itable_index) {
131 // Note well: pd_code_size_limit is the absolute minimum we can get
132 // away with. If you add code here, bump the code stub size
133 // returned by pd_code_size_limit!
134 const int amd64_code_length = VtableStub::pd_code_size_limit(false);
135 VtableStub* s = new(amd64_code_length) VtableStub(false, itable_index);
188 __ cmpptr(method, (int32_t)NULL_WORD);
189 __ jcc(Assembler::equal, L2);
190 __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD);
191 __ jcc(Assembler::notZero, L2);
192 __ stop("compiler entrypoint is null");
193 __ bind(L2);
194 }
195 #endif // ASSERT
196
197 // rbx: Method*
198 // j_rarg0: receiver
199 address ame_addr = __ pc();
200 __ jmp(Address(method, Method::from_compiled_offset()));
201
202 __ bind(throw_icce);
203 __ jump(RuntimeAddress(StubRoutines::throw_IncompatibleClassChangeError_entry()));
204
205 __ flush();
206
207 if (PrintMiscellaneous && (WizardMode || Verbose)) {
208 tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d",
209 itable_index, s->entry_point(),
210 (int)(s->code_end() - s->entry_point()),
211 (int)(s->code_end() - __ pc()));
212 }
213 guarantee(__ pc() <= s->code_end(), "overflowed buffer");
214 // shut the door on sizing bugs
215 int slop = 3; // 32-bit offset is this much larger than an 8-bit one
216 assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset");
217
218 s->set_exception_points(npe_addr, ame_addr);
219 return s;
220 }
221
222 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
223 if (is_vtable_stub) {
224 // Vtable stub size
225 return (DebugVtables ? 512 : 24) + (CountCompiledCalls ? 13 : 0) +
226 (UseCompressedClassPointers ? MacroAssembler::instr_size_for_decode_klass_not_null() : 0);
227 } else {
228 // Itable stub size
|
95 __ lookup_virtual_method(rax, vtable_index, method);
96
97 if (DebugVtables) {
98 Label L;
99 __ cmpptr(method, (int32_t)NULL_WORD);
100 __ jcc(Assembler::equal, L);
101 __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD);
102 __ jcc(Assembler::notZero, L);
103 __ stop("Vtable entry is NULL");
104 __ bind(L);
105 }
106 // rax: receiver klass
107 // rbx: Method*
108 // rcx: receiver
109 address ame_addr = __ pc();
110 __ jmp( Address(rbx, Method::from_compiled_offset()));
111
112 __ flush();
113
114 if (PrintMiscellaneous && (WizardMode || Verbose)) {
115 tty->print_cr("vtable #%d at " PTR_FORMAT "[%d] left over: %d",
116 vtable_index, s->entry_point(),
117 (int)(s->code_end() - s->entry_point()),
118 (int)(s->code_end() - __ pc()));
119 }
120 guarantee(__ pc() <= s->code_end(), "overflowed buffer");
121 // shut the door on sizing bugs
122 int slop = 3; // 32-bit offset is this much larger than an 8-bit one
123 assert(vtable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset");
124
125 s->set_exception_points(npe_addr, ame_addr);
126 return s;
127 }
128
129
130 VtableStub* VtableStubs::create_itable_stub(int itable_index) {
131 // Note well: pd_code_size_limit is the absolute minimum we can get
132 // away with. If you add code here, bump the code stub size
133 // returned by pd_code_size_limit!
134 const int amd64_code_length = VtableStub::pd_code_size_limit(false);
135 VtableStub* s = new(amd64_code_length) VtableStub(false, itable_index);
188 __ cmpptr(method, (int32_t)NULL_WORD);
189 __ jcc(Assembler::equal, L2);
190 __ cmpptr(Address(method, Method::from_compiled_offset()), (int32_t)NULL_WORD);
191 __ jcc(Assembler::notZero, L2);
192 __ stop("compiler entrypoint is null");
193 __ bind(L2);
194 }
195 #endif // ASSERT
196
197 // rbx: Method*
198 // j_rarg0: receiver
199 address ame_addr = __ pc();
200 __ jmp(Address(method, Method::from_compiled_offset()));
201
202 __ bind(throw_icce);
203 __ jump(RuntimeAddress(StubRoutines::throw_IncompatibleClassChangeError_entry()));
204
205 __ flush();
206
207 if (PrintMiscellaneous && (WizardMode || Verbose)) {
208 tty->print_cr("itable #%d at " PTR_FORMAT "[%d] left over: %d",
209 itable_index, s->entry_point(),
210 (int)(s->code_end() - s->entry_point()),
211 (int)(s->code_end() - __ pc()));
212 }
213 guarantee(__ pc() <= s->code_end(), "overflowed buffer");
214 // shut the door on sizing bugs
215 int slop = 3; // 32-bit offset is this much larger than an 8-bit one
216 assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset");
217
218 s->set_exception_points(npe_addr, ame_addr);
219 return s;
220 }
221
222 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
223 if (is_vtable_stub) {
224 // Vtable stub size
225 return (DebugVtables ? 512 : 24) + (CountCompiledCalls ? 13 : 0) +
226 (UseCompressedClassPointers ? MacroAssembler::instr_size_for_decode_klass_not_null() : 0);
227 } else {
228 // Itable stub size
|