Mercurial > hg > graal-jvmci-8
comparison 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 |
comparison
equal
deleted
inserted
replaced
643:c771b7f43bbf | 644:c517646eef23 |
---|---|
2275 Node *bol2 = _gvn.transform( new (C, 2) BoolNode( cmp2, BoolTest::ne ) ); | 2275 Node *bol2 = _gvn.transform( new (C, 2) BoolNode( cmp2, BoolTest::ne ) ); |
2276 IfNode *iff2 = create_and_xform_if( control(), bol2, PROB_LIKELY(0.63f), COUNT_UNKNOWN ); | 2276 IfNode *iff2 = create_and_xform_if( control(), bol2, PROB_LIKELY(0.63f), COUNT_UNKNOWN ); |
2277 r_not_subtype->init_req(1, _gvn.transform( new (C, 1) IfTrueNode (iff2) ) ); | 2277 r_not_subtype->init_req(1, _gvn.transform( new (C, 1) IfTrueNode (iff2) ) ); |
2278 set_control( _gvn.transform( new (C, 1) IfFalseNode(iff2) ) ); | 2278 set_control( _gvn.transform( new (C, 1) IfFalseNode(iff2) ) ); |
2279 | 2279 |
2280 // Check for self. Very rare to get here, but its taken 1/3 the time. | 2280 // Check for self. Very rare to get here, but it is taken 1/3 the time. |
2281 // No performance impact (too rare) but allows sharing of secondary arrays | 2281 // No performance impact (too rare) but allows sharing of secondary arrays |
2282 // which has some footprint reduction. | 2282 // which has some footprint reduction. |
2283 Node *cmp3 = _gvn.transform( new (C, 3) CmpPNode( subklass, superklass ) ); | 2283 Node *cmp3 = _gvn.transform( new (C, 3) CmpPNode( subklass, superklass ) ); |
2284 Node *bol3 = _gvn.transform( new (C, 2) BoolNode( cmp3, BoolTest::eq ) ); | 2284 Node *bol3 = _gvn.transform( new (C, 2) BoolNode( cmp3, BoolTest::eq ) ); |
2285 IfNode *iff3 = create_and_xform_if( control(), bol3, PROB_LIKELY(0.36f), COUNT_UNKNOWN ); | 2285 IfNode *iff3 = create_and_xform_if( control(), bol3, PROB_LIKELY(0.36f), COUNT_UNKNOWN ); |
2286 r_ok_subtype->init_req(2, _gvn.transform( new (C, 1) IfTrueNode ( iff3 ) ) ); | 2286 r_ok_subtype->init_req(2, _gvn.transform( new (C, 1) IfTrueNode ( iff3 ) ) ); |
2287 set_control( _gvn.transform( new (C, 1) IfFalseNode( iff3 ) ) ); | 2287 set_control( _gvn.transform( new (C, 1) IfFalseNode( iff3 ) ) ); |
2288 | 2288 |
2289 // -- Roads not taken here: -- | |
2290 // We could also have chosen to perform the self-check at the beginning | |
2291 // of this code sequence, as the assembler does. This would not pay off | |
2292 // the same way, since the optimizer, unlike the assembler, can perform | |
2293 // static type analysis to fold away many successful self-checks. | |
2294 // Non-foldable self checks work better here in second position, because | |
2295 // the initial primary superclass check subsumes a self-check for most | |
2296 // types. An exception would be a secondary type like array-of-interface, | |
2297 // which does not appear in its own primary supertype display. | |
2298 // Finally, we could have chosen to move the self-check into the | |
2299 // PartialSubtypeCheckNode, and from there out-of-line in a platform | |
2300 // dependent manner. But it is worthwhile to have the check here, | |
2301 // where it can be perhaps be optimized. The cost in code space is | |
2302 // small (register compare, branch). | |
2303 | |
2289 // Now do a linear scan of the secondary super-klass array. Again, no real | 2304 // Now do a linear scan of the secondary super-klass array. Again, no real |
2290 // performance impact (too rare) but it's gotta be done. | 2305 // performance impact (too rare) but it's gotta be done. |
2291 // (The stub also contains the self-check of subklass == superklass. | |
2292 // Since the code is rarely used, there is no penalty for moving it | 2306 // Since the code is rarely used, there is no penalty for moving it |
2293 // out of line, and it can only improve I-cache density.) | 2307 // out of line, and it can only improve I-cache density. |
2308 // The decision to inline or out-of-line this final check is platform | |
2309 // dependent, and is found in the AD file definition of PartialSubtypeCheck. | |
2294 Node* psc = _gvn.transform( | 2310 Node* psc = _gvn.transform( |
2295 new (C, 3) PartialSubtypeCheckNode(control(), subklass, superklass) ); | 2311 new (C, 3) PartialSubtypeCheckNode(control(), subklass, superklass) ); |
2296 | 2312 |
2297 Node *cmp4 = _gvn.transform( new (C, 3) CmpPNode( psc, null() ) ); | 2313 Node *cmp4 = _gvn.transform( new (C, 3) CmpPNode( psc, null() ) ); |
2298 Node *bol4 = _gvn.transform( new (C, 2) BoolNode( cmp4, BoolTest::ne ) ); | 2314 Node *bol4 = _gvn.transform( new (C, 2) BoolNode( cmp4, BoolTest::ne ) ); |