194 195 if (PrintMiscellaneous && (WizardMode || Verbose)) { 196 tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d", 197 itable_index, s->entry_point(), 198 (int)(s->code_end() - s->entry_point()), 199 (int)(s->code_end() - __ pc())); 200 } 201 guarantee(__ pc() <= s->code_end(), "overflowed buffer"); 202 // shut the door on sizing bugs 203 int slop = 3; // 32-bit offset is this much larger than an 8-bit one 204 assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset"); 205 206 s->set_exception_points(npe_addr, ame_addr); 207 return s; 208 } 209 210 int VtableStub::pd_code_size_limit(bool is_vtable_stub) { 211 if (is_vtable_stub) { 212 // Vtable stub size 213 return (DebugVtables ? 512 : 24) + (CountCompiledCalls ? 13 : 0) + 214 (UseCompressedKlassPointers ? 16 : 0); // 1 leaq can be 3 bytes + 1 long 215 } else { 216 // Itable stub size 217 return (DebugVtables ? 512 : 74) + (CountCompiledCalls ? 13 : 0) + 218 (UseCompressedKlassPointers ? 32 : 0); // 2 leaqs 219 } 220 // In order to tune these parameters, run the JVM with VM options 221 // +PrintMiscellaneous and +WizardMode to see information about 222 // actual itable stubs. Look for lines like this: 223 // itable #1 at 0x5551212[71] left over: 3 224 // Reduce the constants so that the "left over" number is >=3 225 // for the common cases. 226 // Do not aim at a left-over number of zero, because a 227 // large vtable or itable index (>= 32) will require a 32-bit 228 // immediate displacement instead of an 8-bit one. 229 // 230 // The JVM98 app. _202_jess has a megamorphic interface call. 231 // The itable code looks like this: 232 // Decoding VtableStub itbl[1]@12 233 // mov 0x8(%rsi),%r10 234 // mov 0x198(%r10),%r11d 235 // lea 0x218(%r10,%r11,8),%r11 236 // lea 0x8(%r10),%r10 237 // mov (%r11),%rbx 238 // cmp %rbx,%rax | 194 195 if (PrintMiscellaneous && (WizardMode || Verbose)) { 196 tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d", 197 itable_index, s->entry_point(), 198 (int)(s->code_end() - s->entry_point()), 199 (int)(s->code_end() - __ pc())); 200 } 201 guarantee(__ pc() <= s->code_end(), "overflowed buffer"); 202 // shut the door on sizing bugs 203 int slop = 3; // 32-bit offset is this much larger than an 8-bit one 204 assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset"); 205 206 s->set_exception_points(npe_addr, ame_addr); 207 return s; 208 } 209 210 int VtableStub::pd_code_size_limit(bool is_vtable_stub) { 211 if (is_vtable_stub) { 212 // Vtable stub size 213 return (DebugVtables ? 512 : 24) + (CountCompiledCalls ? 13 : 0) + 214 (UseCompressedKlassPointers ? MacroAssembler::instr_size_for_decode_klass_not_null() : 0); 215 } else { 216 // Itable stub size 217 return (DebugVtables ? 512 : 74) + (CountCompiledCalls ? 13 : 0) + 218 (UseCompressedKlassPointers ? MacroAssembler::instr_size_for_decode_klass_not_null() : 0); 219 } 220 // In order to tune these parameters, run the JVM with VM options 221 // +PrintMiscellaneous and +WizardMode to see information about 222 // actual itable stubs. Look for lines like this: 223 // itable #1 at 0x5551212[71] left over: 3 224 // Reduce the constants so that the "left over" number is >=3 225 // for the common cases. 226 // Do not aim at a left-over number of zero, because a 227 // large vtable or itable index (>= 32) will require a 32-bit 228 // immediate displacement instead of an 8-bit one. 229 // 230 // The JVM98 app. _202_jess has a megamorphic interface call. 231 // The itable code looks like this: 232 // Decoding VtableStub itbl[1]@12 233 // mov 0x8(%rsi),%r10 234 // mov 0x198(%r10),%r11d 235 // lea 0x218(%r10,%r11,8),%r11 236 // lea 0x8(%r10),%r10 237 // mov (%r11),%rbx 238 // cmp %rbx,%rax |