Mercurial > hg > graal-jvmci-8
diff src/cpu/sparc/vm/vtableStubs_sparc.cpp @ 709:1d037ecd7960
6827505: sizing logic for vtable and itable stubs needs self-check
Summary: Asserts and comments to help maintain the correct sizing of certain stubs
Reviewed-by: kvn
author | jrose |
---|---|
date | Wed, 08 Apr 2009 00:12:59 -0700 |
parents | 660978a2a31a |
children | 6b2273dd6fa9 |
line wrap: on
line diff
--- a/src/cpu/sparc/vm/vtableStubs_sparc.cpp Tue Apr 07 19:04:24 2009 -0700 +++ b/src/cpu/sparc/vm/vtableStubs_sparc.cpp Wed Apr 08 00:12:59 2009 -0700 @@ -114,6 +114,9 @@ (int)(s->code_end() - __ pc())); } guarantee(__ pc() <= s->code_end(), "overflowed buffer"); + // shut the door on sizing bugs + int slop = 2*BytesPerInstWord; // 32-bit offset is this much larger than a 13-bit one + assert(vtable_index > 10 || __ pc() + slop <= s->code_end(), "room for sethi;add"); s->set_exception_points(npe_addr, ame_addr); return s; @@ -208,6 +211,9 @@ (int)(s->code_end() - __ pc())); } guarantee(__ pc() <= s->code_end(), "overflowed buffer"); + // shut the door on sizing bugs + int slop = 2*BytesPerInstWord; // 32-bit offset is this much larger than a 13-bit one + assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for sethi;add"); s->set_exception_points(npe_addr, ame_addr); return s; @@ -233,6 +239,50 @@ return (basic + slop); } } + + // In order to tune these parameters, run the JVM with VM options + // +PrintMiscellaneous and +WizardMode to see information about + // actual itable stubs. Look for lines like this: + // itable #1 at 0x5551212[116] left over: 8 + // Reduce the constants so that the "left over" number is 8 + // Do not aim at a left-over number of zero, because a very + // large vtable or itable offset (> 4K) will require an extra + // sethi/or pair of instructions. + // + // The JVM98 app. _202_jess has a megamorphic interface call. + // The itable code looks like this: + // Decoding VtableStub itbl[1]@16 + // ld [ %o0 + 4 ], %g3 + // save %sp, -64, %sp + // ld [ %g3 + 0xe8 ], %l2 + // sll %l2, 2, %l2 + // add %l2, 0x134, %l2 + // and %l2, -8, %l2 ! NOT_LP64 only + // add %g3, %l2, %l2 + // add %g3, 4, %g3 + // ld [ %l2 ], %l5 + // brz,pn %l5, throw_icce + // cmp %l5, %g5 + // be %icc, success + // add %l2, 8, %l2 + // loop: + // ld [ %l2 ], %l5 + // brz,pn %l5, throw_icce + // cmp %l5, %g5 + // bne,pn %icc, loop + // add %l2, 8, %l2 + // success: + // ld [ %l2 + -4 ], %l2 + // ld [ %g3 + %l2 ], %l5 + // restore %l5, 0, %g5 + // ld [ %g5 + 0x44 ], %g3 + // jmp %g3 + // nop + // throw_icce: + // sethi %hi(throw_ICCE_entry), %g3 + // ! 5 more instructions here, LP64_ONLY + // jmp %g3 + %lo(throw_ICCE_entry) + // restore }