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. Reuse existing ConP node only if it is shared.
 282   Node* new_idealConP0 = ConNode::make(C, TypePtr::NULL_PTR);
 283   Node* old_idealConP0 = NULL;
 284   for( DUIterator_Fast jmax, j = C->root()->fast_outs(jmax); j < jmax; j++ ) {
 285     Node* n = C->root()->fast_out(j);
 286     if (n->Opcode() == Op_ConP && n->bottom_type() == TypePtr::NULL_PTR) {
 287       old_idealConP0 = n;
 288       break;
 289     }
 290   }
 291 
 292   // Swap out to old-space; emptying new-space
 293   Arena *old = C->node_arena()->move_contents(C->old_arena());
 294 
 295   // Save debug and profile information for nodes in old space:
 296   _old_node_note_array = C->node_note_array();
 297   if (_old_node_note_array != NULL) {
 298     C->set_node_note_array(new(C->comp_arena()) GrowableArray<Node_Notes*>
 299                            (C->comp_arena(), _old_node_note_array->length(),
 300                             0, NULL));
 301   }
 302 
 303   // Pre-size the new_node table to avoid the need for range checks.
 304   grow_new_node_array(C->unique());
 305 
 306   // Reset node counter so MachNodes start with _idx at 0
 307   int nodes = C->unique(); // save value
 308   C->set_unique(0);
 309 
 310   // Recursively match trees from old space into new space.
 311   // Correct leaves of new-space Nodes; they point to old-space.


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


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