Mercurial > hg > graal-jvmci-8
diff src/share/vm/opto/graphKit.cpp @ 644:c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
Summary: Code in interp_masm, stubGenerator, c1_LIRAssembler, and AD files moved into MacroAssembler.
Reviewed-by: kvn
author | jrose |
---|---|
date | Fri, 13 Mar 2009 18:39:22 -0700 |
parents | 98cb887364d3 |
children | bd441136a5ce |
line wrap: on
line diff
--- a/src/share/vm/opto/graphKit.cpp Fri Mar 13 11:35:17 2009 -0700 +++ b/src/share/vm/opto/graphKit.cpp Fri Mar 13 18:39:22 2009 -0700 @@ -2277,7 +2277,7 @@ r_not_subtype->init_req(1, _gvn.transform( new (C, 1) IfTrueNode (iff2) ) ); set_control( _gvn.transform( new (C, 1) IfFalseNode(iff2) ) ); - // Check for self. Very rare to get here, but its taken 1/3 the time. + // Check for self. Very rare to get here, but it is taken 1/3 the time. // No performance impact (too rare) but allows sharing of secondary arrays // which has some footprint reduction. Node *cmp3 = _gvn.transform( new (C, 3) CmpPNode( subklass, superklass ) ); @@ -2286,11 +2286,27 @@ r_ok_subtype->init_req(2, _gvn.transform( new (C, 1) IfTrueNode ( iff3 ) ) ); set_control( _gvn.transform( new (C, 1) IfFalseNode( iff3 ) ) ); + // -- Roads not taken here: -- + // We could also have chosen to perform the self-check at the beginning + // of this code sequence, as the assembler does. This would not pay off + // the same way, since the optimizer, unlike the assembler, can perform + // static type analysis to fold away many successful self-checks. + // Non-foldable self checks work better here in second position, because + // the initial primary superclass check subsumes a self-check for most + // types. An exception would be a secondary type like array-of-interface, + // which does not appear in its own primary supertype display. + // Finally, we could have chosen to move the self-check into the + // PartialSubtypeCheckNode, and from there out-of-line in a platform + // dependent manner. But it is worthwhile to have the check here, + // where it can be perhaps be optimized. The cost in code space is + // small (register compare, branch). + // Now do a linear scan of the secondary super-klass array. Again, no real // performance impact (too rare) but it's gotta be done. - // (The stub also contains the self-check of subklass == superklass. // Since the code is rarely used, there is no penalty for moving it - // out of line, and it can only improve I-cache density.) + // out of line, and it can only improve I-cache density. + // The decision to inline or out-of-line this final check is platform + // dependent, and is found in the AD file definition of PartialSubtypeCheck. Node* psc = _gvn.transform( new (C, 3) PartialSubtypeCheckNode(control(), subklass, superklass) );