diff src/share/vm/opto/idealKit.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 f95d63e2154a
children 1d1603768966 07acc51c1d2a
line wrap: on
line diff
--- a/src/share/vm/opto/idealKit.cpp	Mon Mar 21 02:30:49 2011 -0700
+++ b/src/share/vm/opto/idealKit.cpp	Mon Mar 21 11:28:14 2011 -0700
@@ -154,8 +154,18 @@
 //
 // Pushes the loop top cvstate first, then the else (loop exit) cvstate
 // onto the stack.
-void IdealKit::loop(IdealVariable& iv, Node* init, BoolTest::mask relop, Node* limit, float prob, float cnt) {
+void IdealKit::loop(GraphKit* gkit, int nargs, IdealVariable& iv, Node* init, BoolTest::mask relop, Node* limit, float prob, float cnt) {
   assert((state() & (BlockS|LoopS|IfThenS|ElseS)), "bad state for new loop");
+
+  // Sync IdealKit and graphKit.
+  gkit->set_all_memory(this->merged_memory());
+  gkit->set_control(this->ctrl());
+  // Add loop predicate.
+  gkit->add_predicate(nargs);
+  // Update IdealKit memory.
+  this->set_all_memory(gkit->merged_memory());
+  this->set_ctrl(gkit->control());
+
   set(iv, init);
   Node* head = make_label(1);
   bind(head);