1 /*
2 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
2246
2247 case Bytecodes::_goto: // fall through
2248 case Bytecodes::_goto_w: {
2249 int target_bci = (bc() == Bytecodes::_goto) ? iter().get_dest() : iter().get_far_dest();
2250
2251 // If this is a backwards branch in the bytecodes, add Safepoint
2252 maybe_add_safepoint(target_bci);
2253
2254 // Update method data
2255 profile_taken_branch(target_bci);
2256
2257 // Merge the current control into the target basic block
2258 merge(target_bci);
2259
2260 // See if we can get some profile data and hand it off to the next block
2261 Block *target_block = block()->successor_for_bci(target_bci);
2262 if (target_block->pred_count() != 1) break;
2263 ciMethodData* methodData = method()->method_data();
2264 if (!methodData->is_mature()) break;
2265 ciProfileData* data = methodData->bci_to_data(bci());
2266 assert( data->is_JumpData(), "" );
2267 int taken = ((ciJumpData*)data)->taken();
2268 taken = method()->scale_count(taken);
2269 target_block->set_count(taken);
2270 break;
2271 }
2272
2273 case Bytecodes::_ifnull: btest = BoolTest::eq; goto handle_if_null;
2274 case Bytecodes::_ifnonnull: btest = BoolTest::ne; goto handle_if_null;
2275 handle_if_null:
2276 // If this is a backwards branch in the bytecodes, add Safepoint
2277 maybe_add_safepoint(iter().get_dest());
2278 a = null();
2279 b = pop();
2280 if (!_gvn.type(b)->speculative_maybe_null() &&
2281 !too_many_traps(Deoptimization::Reason_speculate_null_check)) {
2282 inc_sp(1);
2283 Node* null_ctl = top();
2284 b = null_check_oop(b, &null_ctl, true, true, true);
2285 assert(null_ctl->is_top(), "no null control here");
2286 dec_sp(1);
|
1 /*
2 * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
2246
2247 case Bytecodes::_goto: // fall through
2248 case Bytecodes::_goto_w: {
2249 int target_bci = (bc() == Bytecodes::_goto) ? iter().get_dest() : iter().get_far_dest();
2250
2251 // If this is a backwards branch in the bytecodes, add Safepoint
2252 maybe_add_safepoint(target_bci);
2253
2254 // Update method data
2255 profile_taken_branch(target_bci);
2256
2257 // Merge the current control into the target basic block
2258 merge(target_bci);
2259
2260 // See if we can get some profile data and hand it off to the next block
2261 Block *target_block = block()->successor_for_bci(target_bci);
2262 if (target_block->pred_count() != 1) break;
2263 ciMethodData* methodData = method()->method_data();
2264 if (!methodData->is_mature()) break;
2265 ciProfileData* data = methodData->bci_to_data(bci());
2266 assert(data != NULL && data->is_JumpData(), "need JumpData for taken branch");
2267 int taken = ((ciJumpData*)data)->taken();
2268 taken = method()->scale_count(taken);
2269 target_block->set_count(taken);
2270 break;
2271 }
2272
2273 case Bytecodes::_ifnull: btest = BoolTest::eq; goto handle_if_null;
2274 case Bytecodes::_ifnonnull: btest = BoolTest::ne; goto handle_if_null;
2275 handle_if_null:
2276 // If this is a backwards branch in the bytecodes, add Safepoint
2277 maybe_add_safepoint(iter().get_dest());
2278 a = null();
2279 b = pop();
2280 if (!_gvn.type(b)->speculative_maybe_null() &&
2281 !too_many_traps(Deoptimization::Reason_speculate_null_check)) {
2282 inc_sp(1);
2283 Node* null_ctl = top();
2284 b = null_check_oop(b, &null_ctl, true, true, true);
2285 assert(null_ctl->is_top(), "no null control here");
2286 dec_sp(1);
|