173 ); |
173 ); |
174 // true and false blocks can't have phis |
174 // true and false blocks can't have phis |
175 for_each_phi_fun(t_block, phi, return; ); |
175 for_each_phi_fun(t_block, phi, return; ); |
176 for_each_phi_fun(f_block, phi, return; ); |
176 for_each_phi_fun(f_block, phi, return; ); |
177 |
177 |
|
178 // Only replace safepoint gotos if state_before information is available (if is a safepoint) |
|
179 bool is_safepoint = if_->is_safepoint(); |
|
180 if (!is_safepoint && (t_goto->is_safepoint() || f_goto->is_safepoint())) { |
|
181 return; |
|
182 } |
|
183 |
178 // 2) substitute conditional expression |
184 // 2) substitute conditional expression |
179 // with an IfOp followed by a Goto |
185 // with an IfOp followed by a Goto |
180 // cut if_ away and get node before |
186 // cut if_ away and get node before |
181 Instruction* cur_end = if_->prev(); |
187 Instruction* cur_end = if_->prev(); |
182 |
188 |
201 cur_end = cur_end->set_next(result); |
207 cur_end = cur_end->set_next(result); |
202 } |
208 } |
203 |
209 |
204 // append Goto to successor |
210 // append Goto to successor |
205 ValueStack* state_before = if_->state_before(); |
211 ValueStack* state_before = if_->state_before(); |
206 Goto* goto_ = new Goto(sux, state_before, if_->is_safepoint() || t_goto->is_safepoint() || f_goto->is_safepoint()); |
212 Goto* goto_ = new Goto(sux, state_before, is_safepoint); |
207 |
213 |
208 // prepare state for Goto |
214 // prepare state for Goto |
209 ValueStack* goto_state = if_state; |
215 ValueStack* goto_state = if_state; |
210 goto_state = goto_state->copy(ValueStack::StateAfter, goto_state->bci()); |
216 goto_state = goto_state->copy(ValueStack::StateAfter, goto_state->bci()); |
211 goto_state->push(result->type(), result); |
217 goto_state->push(result->type(), result); |