@@ -3157,30 +3157,20 @@ void Compile::Code_Gen() {
31573157}
31583158
31593159// ------------------------------Final_Reshape_Counts---------------------------
3160- // This class defines counters to help identify when a method
3161- // may/must be executed using hardware with only 24-bit precision .
3160+ // This class defines counters and node lists collected during
3161+ // the final graph reshaping .
31623162struct Final_Reshape_Counts : public StackObj {
3163- int _call_count; // count non-inlined 'common' calls
3164- int _float_count; // count float ops requiring 24-bit precision
3165- int _double_count; // count double ops requiring more precision
31663163 int _java_call_count; // count non-inlined 'java' calls
31673164 int _inner_loop_count; // count loops which need alignment
31683165 VectorSet _visited; // Visitation flags
31693166 Node_List _tests; // Set of IfNodes & PCTableNodes
31703167
31713168 Final_Reshape_Counts () :
3172- _call_count (0 ), _float_count(0 ), _double_count(0 ),
31733169 _java_call_count (0 ), _inner_loop_count(0 ) { }
31743170
3175- void inc_call_count () { _call_count ++; }
3176- void inc_float_count () { _float_count ++; }
3177- void inc_double_count () { _double_count++; }
31783171 void inc_java_call_count () { _java_call_count++; }
31793172 void inc_inner_loop_count () { _inner_loop_count++; }
31803173
3181- int get_call_count () const { return _call_count ; }
3182- int get_float_count () const { return _float_count ; }
3183- int get_double_count () const { return _double_count; }
31843174 int get_java_call_count () const { return _java_call_count; }
31853175 int get_inner_loop_count () const { return _inner_loop_count; }
31863176};
@@ -3243,7 +3233,6 @@ void Compile::final_graph_reshaping_impl(Node *n, Final_Reshape_Counts& frc, Uni
32433233 " unused CallLeafPureNode should have been removed before final graph reshaping" );
32443234 }
32453235#endif
3246- // Count FPU ops and common calls, implements item (3)
32473236 bool gc_handled = BarrierSet::barrier_set ()->barrier_set_c2 ()->final_graph_reshaping (this , n, nop, dead_nodes);
32483237 if (!gc_handled) {
32493238 final_graph_reshaping_main_switch (n, frc, nop, dead_nodes);
@@ -3288,50 +3277,6 @@ void Compile::handle_div_mod_op(Node* n, BasicType bt, bool is_unsigned) {
32883277
32893278void Compile::final_graph_reshaping_main_switch (Node* n, Final_Reshape_Counts& frc, uint nop, Unique_Node_List& dead_nodes) {
32903279 switch ( nop ) {
3291- // Count all float operations that may use FPU
3292- case Op_AddHF:
3293- case Op_MulHF:
3294- case Op_AddF:
3295- case Op_SubF:
3296- case Op_MulF:
3297- case Op_DivF:
3298- case Op_NegF:
3299- case Op_ModF:
3300- case Op_ConvI2F:
3301- case Op_ConF:
3302- case Op_CmpF:
3303- case Op_CmpF3:
3304- case Op_StoreF:
3305- case Op_LoadF:
3306- // case Op_ConvL2F: // longs are split into 32-bit halves
3307- frc.inc_float_count ();
3308- break ;
3309-
3310- case Op_ConvF2D:
3311- case Op_ConvD2F:
3312- frc.inc_float_count ();
3313- frc.inc_double_count ();
3314- break ;
3315-
3316- // Count all double operations that may use FPU
3317- case Op_AddD:
3318- case Op_SubD:
3319- case Op_MulD:
3320- case Op_DivD:
3321- case Op_NegD:
3322- case Op_ModD:
3323- case Op_ConvI2D:
3324- case Op_ConvD2I:
3325- // case Op_ConvL2D: // handled by leaf call
3326- // case Op_ConvD2L: // handled by leaf call
3327- case Op_ConD:
3328- case Op_CmpD:
3329- case Op_CmpD3:
3330- case Op_StoreD:
3331- case Op_LoadD:
3332- case Op_LoadD_unaligned:
3333- frc.inc_double_count ();
3334- break ;
33353280 case Op_Opaque1: // Remove Opaque Nodes before matching
33363281 n->subsume_by (n->in (1 ), this );
33373282 break ;
@@ -3351,7 +3296,6 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f
33513296 }
33523297 n->subsume_by (new_call, this );
33533298 }
3354- frc.inc_call_count ();
33553299 break ;
33563300 }
33573301 case Op_CallStaticJava:
@@ -3364,13 +3308,8 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f
33643308 case Op_CallLeafNoFP: {
33653309 assert (n->is_Call (), " " );
33663310 CallNode *call = n->as_Call ();
3367- // Count call sites where the FP mode bit would have to be flipped.
3368- // Do not count uncommon runtime calls:
3369- // uncommon_trap, _complete_monitor_locking, _complete_monitor_unlocking,
3370- // _new_Java, _new_typeArray, _new_objArray, _rethrow_Java, ...
3371- if (!call->is_CallStaticJava () || !call->as_CallStaticJava ()->_name ) {
3372- frc.inc_call_count (); // Count the call site
3373- } else { // See if uncommon argument is shared
3311+ // See if uncommon argument is shared
3312+ if (call->is_CallStaticJava () && call->as_CallStaticJava ()->_name ) {
33743313 Node *n = call->in (TypeFunc::Parms);
33753314 int nop = n->Opcode ();
33763315 // Clone shared simple arguments to uncommon calls, item (1).
@@ -3388,6 +3327,13 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f
33883327 }
33893328 break ;
33903329 }
3330+
3331+ // Mem nodes need explicit cases to satisfy assert(!n->is_Mem()) in default.
3332+ case Op_StoreF:
3333+ case Op_LoadF:
3334+ case Op_StoreD:
3335+ case Op_LoadD:
3336+ case Op_LoadD_unaligned:
33913337 case Op_StoreB:
33923338 case Op_StoreC:
33933339 case Op_StoreI:
@@ -3435,6 +3381,12 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f
34353381 case Op_LoadN:
34363382 case Op_LoadRange:
34373383 case Op_LoadS:
3384+ case Op_LoadVectorGather:
3385+ case Op_StoreVectorScatter:
3386+ case Op_LoadVectorGatherMasked:
3387+ case Op_StoreVectorScatterMasked:
3388+ case Op_LoadVectorMasked:
3389+ case Op_StoreVectorMasked:
34383390 break ;
34393391
34403392 case Op_AddP: { // Assert sane base pointers
@@ -3785,35 +3737,6 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f
37853737#endif
37863738 break ;
37873739
3788- case Op_LoadVectorGather:
3789- case Op_StoreVectorScatter:
3790- case Op_LoadVectorGatherMasked:
3791- case Op_StoreVectorScatterMasked:
3792- case Op_VectorCmpMasked:
3793- case Op_VectorMaskGen:
3794- case Op_LoadVectorMasked:
3795- case Op_StoreVectorMasked:
3796- break ;
3797-
3798- case Op_AddReductionVI:
3799- case Op_AddReductionVL:
3800- case Op_AddReductionVHF:
3801- case Op_AddReductionVF:
3802- case Op_AddReductionVD:
3803- case Op_MulReductionVI:
3804- case Op_MulReductionVL:
3805- case Op_MulReductionVHF:
3806- case Op_MulReductionVF:
3807- case Op_MulReductionVD:
3808- case Op_MinReductionV:
3809- case Op_MaxReductionV:
3810- case Op_UMinReductionV:
3811- case Op_UMaxReductionV:
3812- case Op_AndReductionV:
3813- case Op_OrReductionV:
3814- case Op_XorReductionV:
3815- break ;
3816-
38173740 case Op_PackB:
38183741 case Op_PackS:
38193742 case Op_PackI:
@@ -3889,8 +3812,6 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f
38893812 }
38903813 break ;
38913814 }
3892- case Op_Blackhole:
3893- break ;
38943815 case Op_RangeCheck: {
38953816 RangeCheckNode* rc = n->as_RangeCheck ();
38963817 Node* iff = new IfNode (rc->in (0 ), rc->in (1 ), rc->_prob , rc->_fcnt );
@@ -4059,20 +3980,13 @@ void Compile::final_graph_reshaping_walk(Node_Stack& nstack, Node* root, Final_R
40593980// Intel update-in-place two-address operations and better register usage
40603981// on RISCs. Must come after regular optimizations to avoid GVN Ideal
40613982// calls canonicalizing them back.
4062- // (3) Count the number of double-precision FP ops, single-precision FP ops
4063- // and call sites. On Intel, we can get correct rounding either by
4064- // forcing singles to memory (requires extra stores and loads after each
4065- // FP bytecode) or we can set a rounding mode bit (requires setting and
4066- // clearing the mode bit around call sites). The mode bit is only used
4067- // if the relative frequency of single FP ops to calls is low enough.
4068- // This is a key transform for SPEC mpeg_audio.
4069- // (4) Detect infinite loops; blobs of code reachable from above but not
3983+ // (3) Detect infinite loops; blobs of code reachable from above but not
40703984// below. Several of the Code_Gen algorithms fail on such code shapes,
40713985// so we simply bail out. Happens a lot in ZKM.jar, but also happens
40723986// from time to time in other codes (such as -Xcomp finalizer loops, etc).
40733987// Detection is by looking for IfNodes where only 1 projection is
40743988// reachable from below or CatchNodes missing some targets.
4075- // (5 ) Assert for insane oop offsets in debug mode.
3989+ // (4 ) Assert for insane oop offsets in debug mode.
40763990
40773991bool Compile::final_graph_reshaping () {
40783992 // an infinite loop may have been eliminated by the optimizer,
0 commit comments