src/share/vm/opto/parse1.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/opto/parse1.cpp Thu Jan 7 16:01:56 2010
--- new/src/share/vm/opto/parse1.cpp Thu Jan 7 16:01:56 2010
*** 1381,1390 ****
--- 1381,1394 ----
// Learn the current bci from the iterator:
set_parse_bci(iter().cur_bci());
if (bci() == block()->limit()) {
+ //insert a predicate if it falls through to a loop head block
+ if(should_add_predicate(bci())){
+ add_predicate();
+ }
// Do not walk into the next block until directed by do_all_blocks.
merge(bci());
break;
}
assert(bci() < block()->limit(), "bci still in block");
*** 2081,2090 ****
--- 2085,2125 ----
assert(C->root() != NULL, "Expect parse is still valid");
C->root()->add_prec(transformed_sfpnt);
}
}
+ //------------------------------should_add_predicate--------------------------
+ bool Parse::should_add_predicate(int target_bci) {
+ if (!UseLoopPredicate) return false;
+ Block* target = successor_for_bci(target_bci);
+ if (target != NULL &&
+ target->is_loop_head() &&
+ block()->rpo() < target->rpo()) {
+ return true;
+ }
+ return false;
+ }
+
+ //------------------------------add_predicate---------------------------------
+ void Parse::add_predicate() {
+ assert(UseLoopPredicate,"use only for loop predicate");
+ Node *cont = _gvn.intcon(1);
+ Node* opq = _gvn.transform(new (C, 2) Opaque1Node(C, cont));
+ Node *bol = _gvn.transform(new (C, 2) Conv2BNode(opq));
+ IfNode* iff = create_and_map_if(control(), bol, PROB_MAX, COUNT_UNKNOWN);
+ Node* iffalse = _gvn.transform(new (C, 1) IfFalseNode(iff));
+ C->add_predicate_opaq(opq);
+ {
+ PreserveJVMState pjvms(this);
+ set_control(iffalse);
+ uncommon_trap(Deoptimization::Reason_predicate,
+ Deoptimization::Action_maybe_recompile);
+ }
+ Node* iftrue = _gvn.transform(new (C, 1) IfTrueNode(iff));
+ set_control(iftrue);
+ }
+
#ifndef PRODUCT
//------------------------show_parse_info--------------------------------------
void Parse::show_parse_info() {
InlineTree* ilt = NULL;
if (C->ilt() != NULL) {
src/share/vm/opto/parse1.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File