src/share/vm/opto/matcher.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6709742 Sdiff src/share/vm/opto

src/share/vm/opto/matcher.cpp

Print this page




 258   //   _new_SP + out_preserve_stack_slots + max(outgoing argument size).
 259   _out_arg_limit = OptoReg::add(_new_SP, C->out_preserve_stack_slots());
 260   assert( is_even(_out_arg_limit), "out_preserve must be even" );
 261 
 262   if (!RegMask::can_represent(OptoReg::add(_out_arg_limit,-1))) {
 263     // the compiler cannot represent this method's calling sequence
 264     C->record_method_not_compilable("must be able to represent all call arguments in reg mask");
 265   }
 266 
 267   if (C->failing())  return;  // bailed out on incoming arg failure
 268 
 269   // ---------------
 270   // Collect roots of matcher trees.  Every node for which
 271   // _shared[_idx] is cleared is guaranteed to not be shared, and thus
 272   // can be a valid interior of some tree.
 273   find_shared( C->root() );
 274   find_shared( C->top() );
 275 
 276   C->print_method("Before Matching");
 277 






 278   // Swap out to old-space; emptying new-space
 279   Arena *old = C->node_arena()->move_contents(C->old_arena());
 280 
 281   // Save debug and profile information for nodes in old space:
 282   _old_node_note_array = C->node_note_array();
 283   if (_old_node_note_array != NULL) {
 284     C->set_node_note_array(new(C->comp_arena()) GrowableArray<Node_Notes*>
 285                            (C->comp_arena(), _old_node_note_array->length(),
 286                             0, NULL));
 287   }
 288 
 289   // Pre-size the new_node table to avoid the need for range checks.
 290   grow_new_node_array(C->unique());
 291 
 292   // Reset node counter so MachNodes start with _idx at 0
 293   int nodes = C->unique(); // save value
 294   C->set_unique(0);
 295 
 296   // Recursively match trees from old space into new space.
 297   // Correct leaves of new-space Nodes; they point to old-space.


 299   C->set_cached_top_node(xform( C->top(), nodes ));
 300   if (!C->failing()) {
 301     Node* xroot =        xform( C->root(), 1 );
 302     if (xroot == NULL) {
 303       Matcher::soft_match_failure();  // recursive matching process failed
 304       C->record_method_not_compilable("instruction match failed");
 305     } else {
 306       // During matching shared constants were attached to C->root()
 307       // because xroot wasn't available yet, so transfer the uses to
 308       // the xroot.
 309       for( DUIterator_Fast jmax, j = C->root()->fast_outs(jmax); j < jmax; j++ ) {
 310         Node* n = C->root()->fast_out(j);
 311         if (C->node_arena()->contains(n)) {
 312           assert(n->in(0) == C->root(), "should be control user");
 313           n->set_req(0, xroot);
 314           --j;
 315           --jmax;
 316         }
 317       }
 318 








 319       C->set_root(xroot->is_Root() ? xroot->as_Root() : NULL);

 320 #ifdef ASSERT
 321       verify_new_nodes_only(xroot);
 322 #endif
 323     }
 324   }
 325   if (C->top() == NULL || C->root() == NULL) {
 326     C->record_method_not_compilable("graph lost"); // %%% cannot happen?
 327   }
 328   if (C->failing()) {
 329     // delete old;
 330     old->destruct_contents();
 331     return;
 332   }
 333   assert( C->top(), "" );
 334   assert( C->root(), "" );
 335   validate_null_checks();
 336 
 337   // Now smoke old-space
 338   NOT_DEBUG( old->destruct_contents() );
 339 




 258   //   _new_SP + out_preserve_stack_slots + max(outgoing argument size).
 259   _out_arg_limit = OptoReg::add(_new_SP, C->out_preserve_stack_slots());
 260   assert( is_even(_out_arg_limit), "out_preserve must be even" );
 261 
 262   if (!RegMask::can_represent(OptoReg::add(_out_arg_limit,-1))) {
 263     // the compiler cannot represent this method's calling sequence
 264     C->record_method_not_compilable("must be able to represent all call arguments in reg mask");
 265   }
 266 
 267   if (C->failing())  return;  // bailed out on incoming arg failure
 268 
 269   // ---------------
 270   // Collect roots of matcher trees.  Every node for which
 271   // _shared[_idx] is cleared is guaranteed to not be shared, and thus
 272   // can be a valid interior of some tree.
 273   find_shared( C->root() );
 274   find_shared( C->top() );
 275 
 276   C->print_method("Before Matching");
 277 
 278   // Create new ideal node ConP #NULL even if it does exist in old space
 279   // to avoid false sharing if the corresponding mach node is not used.
 280   // The corresponding mach node is only used in rare cases for derived
 281   // pointers.
 282   Node* new_ideal_null = ConNode::make(C, TypePtr::NULL_PTR);
 283 
 284   // Swap out to old-space; emptying new-space
 285   Arena *old = C->node_arena()->move_contents(C->old_arena());
 286 
 287   // Save debug and profile information for nodes in old space:
 288   _old_node_note_array = C->node_note_array();
 289   if (_old_node_note_array != NULL) {
 290     C->set_node_note_array(new(C->comp_arena()) GrowableArray<Node_Notes*>
 291                            (C->comp_arena(), _old_node_note_array->length(),
 292                             0, NULL));
 293   }
 294 
 295   // Pre-size the new_node table to avoid the need for range checks.
 296   grow_new_node_array(C->unique());
 297 
 298   // Reset node counter so MachNodes start with _idx at 0
 299   int nodes = C->unique(); // save value
 300   C->set_unique(0);
 301 
 302   // Recursively match trees from old space into new space.
 303   // Correct leaves of new-space Nodes; they point to old-space.


 305   C->set_cached_top_node(xform( C->top(), nodes ));
 306   if (!C->failing()) {
 307     Node* xroot =        xform( C->root(), 1 );
 308     if (xroot == NULL) {
 309       Matcher::soft_match_failure();  // recursive matching process failed
 310       C->record_method_not_compilable("instruction match failed");
 311     } else {
 312       // During matching shared constants were attached to C->root()
 313       // because xroot wasn't available yet, so transfer the uses to
 314       // the xroot.
 315       for( DUIterator_Fast jmax, j = C->root()->fast_outs(jmax); j < jmax; j++ ) {
 316         Node* n = C->root()->fast_out(j);
 317         if (C->node_arena()->contains(n)) {
 318           assert(n->in(0) == C->root(), "should be control user");
 319           n->set_req(0, xroot);
 320           --j;
 321           --jmax;
 322         }
 323       }
 324 
 325       // Generate new mach node for ConP #NULL
 326       assert(new_ideal_null != NULL, "sanity");
 327       _mach_null = match_tree(new_ideal_null);
 328       // Don't set control, it will confuse GCM since there are no uses.
 329       // The control will be set when this node is used first time
 330       // in find_base_for_derived().
 331       assert(_mach_null != NULL, "");
 332 
 333       C->set_root(xroot->is_Root() ? xroot->as_Root() : NULL);
 334 
 335 #ifdef ASSERT
 336       verify_new_nodes_only(xroot);
 337 #endif
 338     }
 339   }
 340   if (C->top() == NULL || C->root() == NULL) {
 341     C->record_method_not_compilable("graph lost"); // %%% cannot happen?
 342   }
 343   if (C->failing()) {
 344     // delete old;
 345     old->destruct_contents();
 346     return;
 347   }
 348   assert( C->top(), "" );
 349   assert( C->root(), "" );
 350   validate_null_checks();
 351 
 352   // Now smoke old-space
 353   NOT_DEBUG( old->destruct_contents() );
 354 


src/share/vm/opto/matcher.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File