Request for reviews (S): 6827505: sizing logic for vtable and itable stubs needs self-check

John Rose John.Rose at Sun.COM
Tue Apr 7 18:25:08 PDT 2009

On Apr 7, 2009, at 4:42 PM, Vladimir Kozlov wrote:

> John Rose wrote:
>> Here are some simple asserts and comments which should make it  
>> easier to maintain the correct sizing of certain stubs:
> Why the assert checks the room only for first 9 entries?:
> "table_index > 10 ||"

For the first 9 entries it checks a more stringent limit.  That is, it  
requires that the size estimate has 3 or 8 bytes of slop, under the  
assumption that eventually (after index is much larger than 10) the  
stub will grow slightly because the addressing modes will expand  
beyond their minimum size.

The number 10 could be as large as 255 (or 2047 on sparc).  Any small  
number will do, since the assertion doesn't do interesting work after  
it checks index=0 and maybe index=1, depending on what the tiny  
addressing modes look like.

> Why you did not add +5 for sparc LP64 for slop?:
> int slop = (2 LP64_ONLY(+5))*BytesPerInstWord;

Because we will never have vtable indexes larger than about 20 bits  
wide.  The stubs do not contain materialized constants, so there are  
never 64-bit values in them.

> For x64 (64-bit x86) the address could be unreachable,
> so the slop should be large:
> void MacroAssembler::jump(AddressLiteral dst) {
>  if (reachable(dst)) {
>    jmp_literal(, dst.rspec());
>  } else {
>    lea(rscratch1, dst);
>    jmp(rscratch1);
>  }
> }

Yes, but the stubs inherently jump through a register, not to a fixed  
external address.

I can add these points as comments, if you want.  What do you think?

-- John

More information about the hotspot-compiler-dev mailing list