src/share/vm/opto/compile.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot-comp2 Sdiff src/share/vm/opto

src/share/vm/opto/compile.cpp

Print this page




 831   NOT_PRODUCT( verify_graph_edges(); )
 832 
 833 #ifndef PRODUCT
 834   if (PrintIdeal) {
 835     ttyLocker ttyl;  // keep the following output all in one block
 836     // This output goes directly to the tty, not the compiler log.
 837     // To enable tools to match it up with the compilation activity,
 838     // be sure to tag this tty output with the compile ID.
 839     if (xtty != NULL) {
 840       xtty->head("ideal compile_id='%d'%s", compile_id(),
 841                  is_osr_compilation()    ? " compile_kind='osr'" :
 842                  "");
 843     }
 844     root()->dump(9999);
 845     if (xtty != NULL) {
 846       xtty->tail("ideal");
 847     }
 848   }
 849 #endif
 850 

 851   // Now that we know the size of all the monitors we can add a fixed slot
 852   // for the original deopt pc.
 853 
 854   _orig_pc_slot =  fixed_slots();
 855   int next_slot = _orig_pc_slot + (sizeof(address) / VMRegImpl::stack_slot_size);
 856   set_fixed_slots(next_slot);
 857 
 858   // Now generate code
 859   Code_Gen();
 860   if (failing())  return;
 861 
 862   // Check if we want to skip execution of all compiled code.
 863   {
 864 #ifndef PRODUCT
 865     if (OptoNoExecute) {
 866       record_method_not_compilable("+OptoNoExecute");  // Flag as failed
 867       return;
 868     }
 869     TracePhase t2("install_code", &_t_registerMethod, TimeCompiler);
 870 #endif


3351       while (visited.size() > 0) {
3352         Node* n = visited.pop();
3353         checked.push(n);
3354         for (uint i = 0; i < n->outcnt(); i++) {
3355           Node* use = n->raw_out(i);
3356           if (checked.member(use))  continue;  // already checked
3357           if (visited.member(use))  continue;  // already in the graph
3358           if (use->is_Con())        continue;  // a dead ConNode is OK
3359           // At this point, we have found a dead node which is DU-reachable.
3360           if (dead_nodes++ == 0)
3361             tty->print_cr("*** Dead nodes reachable via DU edges:");
3362           use->dump(2);
3363           tty->print_cr("---");
3364           checked.push(use);  // No repeats; pretend it is now checked.
3365         }
3366       }
3367       assert(dead_nodes == 0, "using nodes must be reachable from root");
3368     }
3369   }
3370 }


































































3371 #endif
3372 
3373 // The Compile object keeps track of failure reasons separately from the ciEnv.
3374 // This is required because there is not quite a 1-1 relation between the
3375 // ciEnv and its compilation task and the Compile object.  Note that one
3376 // ciEnv might use two Compile objects, if C2Compiler::compile_method decides
3377 // to backtrack and retry without subsuming loads.  Other than this backtracking
3378 // behavior, the Compile's failure reason is quietly copied up to the ciEnv
3379 // by the logic in C2Compiler.
3380 void Compile::record_failure(const char* reason) {
3381   if (log() != NULL) {
3382     log()->elem("failure reason='%s' phase='compile'", reason);
3383   }
3384   if (_failure_reason == NULL) {
3385     // Record the first failure reason.
3386     _failure_reason = reason;
3387   }
3388 
3389   EventCompilerFailure event;
3390   if (event.should_commit()) {




 831   NOT_PRODUCT( verify_graph_edges(); )
 832 
 833 #ifndef PRODUCT
 834   if (PrintIdeal) {
 835     ttyLocker ttyl;  // keep the following output all in one block
 836     // This output goes directly to the tty, not the compiler log.
 837     // To enable tools to match it up with the compilation activity,
 838     // be sure to tag this tty output with the compile ID.
 839     if (xtty != NULL) {
 840       xtty->head("ideal compile_id='%d'%s", compile_id(),
 841                  is_osr_compilation()    ? " compile_kind='osr'" :
 842                  "");
 843     }
 844     root()->dump(9999);
 845     if (xtty != NULL) {
 846       xtty->tail("ideal");
 847     }
 848   }
 849 #endif
 850 
 851   NOT_PRODUCT( verify_barriers(); )
 852   // Now that we know the size of all the monitors we can add a fixed slot
 853   // for the original deopt pc.
 854 
 855   _orig_pc_slot =  fixed_slots();
 856   int next_slot = _orig_pc_slot + (sizeof(address) / VMRegImpl::stack_slot_size);
 857   set_fixed_slots(next_slot);
 858 
 859   // Now generate code
 860   Code_Gen();
 861   if (failing())  return;
 862 
 863   // Check if we want to skip execution of all compiled code.
 864   {
 865 #ifndef PRODUCT
 866     if (OptoNoExecute) {
 867       record_method_not_compilable("+OptoNoExecute");  // Flag as failed
 868       return;
 869     }
 870     TracePhase t2("install_code", &_t_registerMethod, TimeCompiler);
 871 #endif


3352       while (visited.size() > 0) {
3353         Node* n = visited.pop();
3354         checked.push(n);
3355         for (uint i = 0; i < n->outcnt(); i++) {
3356           Node* use = n->raw_out(i);
3357           if (checked.member(use))  continue;  // already checked
3358           if (visited.member(use))  continue;  // already in the graph
3359           if (use->is_Con())        continue;  // a dead ConNode is OK
3360           // At this point, we have found a dead node which is DU-reachable.
3361           if (dead_nodes++ == 0)
3362             tty->print_cr("*** Dead nodes reachable via DU edges:");
3363           use->dump(2);
3364           tty->print_cr("---");
3365           checked.push(use);  // No repeats; pretend it is now checked.
3366         }
3367       }
3368       assert(dead_nodes == 0, "using nodes must be reachable from root");
3369     }
3370   }
3371 }
3372 
3373 // Verify GC barriers consistency
3374 // Currently supported:
3375 // - G1 pre-barriers (see GraphKit::g1_write_barrier_pre())
3376 void Compile::verify_barriers() {
3377   if (UseG1GC) {
3378     // Verify G1 pre-barriers
3379     const int marking_offset = in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active());
3380 
3381     ResourceArea *area = Thread::current()->resource_area();
3382     Unique_Node_List visited(area);
3383     Node_List worklist(area);
3384     // We're going to walk control flow backwards starting from the Root
3385     worklist.push(_root);
3386     while (worklist.size() > 0) {
3387       Node* x = worklist.pop();
3388       if (x == NULL || x == top()) continue;
3389       if (visited.member(x)) {
3390         continue;
3391       } else {
3392         visited.push(x);
3393       }
3394 
3395       if (x->is_Region()) {
3396         for (uint i = 1; i < x->req(); i++) {
3397           worklist.push(x->in(i));
3398         }
3399       } else {
3400         worklist.push(x->in(0));
3401         // We are looking for the pattern:
3402         //                            /->ThreadLocal
3403         // If->Bool->CmpI->LoadB->AddP->ConL(marking_offset)
3404         //              \->ConI(0)
3405         // We want to verify that the If and the LoadB have the same control
3406         // See GraphKit::g1_write_barrier_pre()
3407         if (x->is_If()) {
3408           IfNode *iff = x->as_If();
3409           if (iff->in(1)->is_Bool() && iff->in(1)->in(1)->is_Cmp()) {
3410             CmpNode *cmp = iff->in(1)->in(1)->as_Cmp();
3411             if (cmp->Opcode() == Op_CmpI && cmp->in(2)->is_Con() && cmp->in(2)->bottom_type()->is_int()->get_con() == 0
3412                 && cmp->in(1)->is_Load()) {
3413               LoadNode* load = cmp->in(1)->as_Load();
3414               if (load->Opcode() == Op_LoadB && load->in(2)->is_AddP() && load->in(2)->in(2)->Opcode() == Op_ThreadLocal
3415                   && load->in(2)->in(3)->is_Con()
3416                   && load->in(2)->in(3)->bottom_type()->is_intptr_t()->get_con() == marking_offset) {
3417 
3418                 Node* if_ctrl = iff->in(0);
3419                 Node* load_ctrl = load->in(0);
3420 
3421                 if (if_ctrl != load_ctrl) {
3422                   // Skip possible CProj->NeverBranch in infinite loops
3423                   if ((if_ctrl->is_Proj() && if_ctrl->Opcode() == Op_CProj)
3424                       && (if_ctrl->in(0)->is_MultiBranch() && if_ctrl->in(0)->Opcode() == Op_NeverBranch)) {
3425                     if_ctrl = if_ctrl->in(0)->in(0);
3426                   }
3427                 }
3428                 assert(load_ctrl != NULL && if_ctrl == load_ctrl, "controls must match");
3429               }
3430             }
3431           }
3432         }
3433       }
3434     }
3435   }
3436 }
3437 
3438 #endif
3439 
3440 // The Compile object keeps track of failure reasons separately from the ciEnv.
3441 // This is required because there is not quite a 1-1 relation between the
3442 // ciEnv and its compilation task and the Compile object.  Note that one
3443 // ciEnv might use two Compile objects, if C2Compiler::compile_method decides
3444 // to backtrack and retry without subsuming loads.  Other than this backtracking
3445 // behavior, the Compile's failure reason is quietly copied up to the ciEnv
3446 // by the logic in C2Compiler.
3447 void Compile::record_failure(const char* reason) {
3448   if (log() != NULL) {
3449     log()->elem("failure reason='%s' phase='compile'", reason);
3450   }
3451   if (_failure_reason == NULL) {
3452     // Record the first failure reason.
3453     _failure_reason = reason;
3454   }
3455 
3456   EventCompilerFailure event;
3457   if (event.should_commit()) {


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