comparison src/share/vm/opto/graphKit.cpp @ 2383:9dc311b8473e

7008866: Missing loop predicate for loop with multiple entries Summary: Add predicates when loop head bytecode is parsed instead of when back branch bytecode is parsed. Reviewed-by: never
author kvn
date Mon, 21 Mar 2011 11:28:14 -0700
parents 5ddfcf4b079e
children 1d1603768966 07acc51c1d2a e1162778c1c8
comparison
equal deleted inserted replaced
2382:3ef1a1866a60 2383:9dc311b8473e
3336 } 3336 }
3337 } 3337 }
3338 return NULL; 3338 return NULL;
3339 } 3339 }
3340 3340
3341 //----------------------------- loop predicates ---------------------------
3342
3343 //------------------------------add_predicate_impl----------------------------
3344 void GraphKit::add_predicate_impl(Deoptimization::DeoptReason reason, int nargs) {
3345 // Too many traps seen?
3346 if (too_many_traps(reason)) {
3347 #ifdef ASSERT
3348 if (TraceLoopPredicate) {
3349 int tc = C->trap_count(reason);
3350 tty->print("too many traps=%s tcount=%d in ",
3351 Deoptimization::trap_reason_name(reason), tc);
3352 method()->print(); // which method has too many predicate traps
3353 tty->cr();
3354 }
3355 #endif
3356 // We cannot afford to take more traps here,
3357 // do not generate predicate.
3358 return;
3359 }
3360
3361 Node *cont = _gvn.intcon(1);
3362 Node* opq = _gvn.transform(new (C, 2) Opaque1Node(C, cont));
3363 Node *bol = _gvn.transform(new (C, 2) Conv2BNode(opq));
3364 IfNode* iff = create_and_map_if(control(), bol, PROB_MAX, COUNT_UNKNOWN);
3365 Node* iffalse = _gvn.transform(new (C, 1) IfFalseNode(iff));
3366 C->add_predicate_opaq(opq);
3367 {
3368 PreserveJVMState pjvms(this);
3369 set_control(iffalse);
3370 _sp += nargs;
3371 uncommon_trap(reason, Deoptimization::Action_maybe_recompile);
3372 }
3373 Node* iftrue = _gvn.transform(new (C, 1) IfTrueNode(iff));
3374 set_control(iftrue);
3375 }
3376
3377 //------------------------------add_predicate---------------------------------
3378 void GraphKit::add_predicate(int nargs) {
3379 if (UseLoopPredicate) {
3380 add_predicate_impl(Deoptimization::Reason_predicate, nargs);
3381 }
3382 }
3383
3341 //----------------------------- store barriers ---------------------------- 3384 //----------------------------- store barriers ----------------------------
3342 #define __ ideal. 3385 #define __ ideal.
3343 3386
3344 void GraphKit::sync_kit(IdealKit& ideal) { 3387 void GraphKit::sync_kit(IdealKit& ideal) {
3345 // Final sync IdealKit and graphKit. 3388 // Final sync IdealKit and graphKit.