1 /* |
1 /* |
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
759 fall_through = false; |
759 fall_through = false; |
760 break; |
760 break; |
761 case Bytecodes::_tableswitch: |
761 case Bytecodes::_tableswitch: |
762 { |
762 { |
763 state.spop(); |
763 state.spop(); |
764 Bytecode_tableswitch* switch_ = Bytecode_tableswitch_at(s.cur_bcp()); |
764 Bytecode_tableswitch sw(&s); |
765 int len = switch_->length(); |
765 int len = sw.length(); |
766 int dest_bci; |
766 int dest_bci; |
767 for (int i = 0; i < len; i++) { |
767 for (int i = 0; i < len; i++) { |
768 dest_bci = s.cur_bci() + switch_->dest_offset_at(i); |
768 dest_bci = s.cur_bci() + sw.dest_offset_at(i); |
769 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); |
769 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); |
770 successors.push(_methodBlocks->block_containing(dest_bci)); |
770 successors.push(_methodBlocks->block_containing(dest_bci)); |
771 } |
771 } |
772 dest_bci = s.cur_bci() + switch_->default_offset(); |
772 dest_bci = s.cur_bci() + sw.default_offset(); |
773 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); |
773 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); |
774 successors.push(_methodBlocks->block_containing(dest_bci)); |
774 successors.push(_methodBlocks->block_containing(dest_bci)); |
775 assert(s.next_bci() == limit_bci, "branch must end block"); |
775 assert(s.next_bci() == limit_bci, "branch must end block"); |
776 fall_through = false; |
776 fall_through = false; |
777 break; |
777 break; |
778 } |
778 } |
779 case Bytecodes::_lookupswitch: |
779 case Bytecodes::_lookupswitch: |
780 { |
780 { |
781 state.spop(); |
781 state.spop(); |
782 Bytecode_lookupswitch* switch_ = Bytecode_lookupswitch_at(s.cur_bcp()); |
782 Bytecode_lookupswitch sw(&s); |
783 int len = switch_->number_of_pairs(); |
783 int len = sw.number_of_pairs(); |
784 int dest_bci; |
784 int dest_bci; |
785 for (int i = 0; i < len; i++) { |
785 for (int i = 0; i < len; i++) { |
786 dest_bci = s.cur_bci() + switch_->pair_at(i)->offset(); |
786 dest_bci = s.cur_bci() + sw.pair_at(i).offset(); |
787 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); |
787 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); |
788 successors.push(_methodBlocks->block_containing(dest_bci)); |
788 successors.push(_methodBlocks->block_containing(dest_bci)); |
789 } |
789 } |
790 dest_bci = s.cur_bci() + switch_->default_offset(); |
790 dest_bci = s.cur_bci() + sw.default_offset(); |
791 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); |
791 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); |
792 successors.push(_methodBlocks->block_containing(dest_bci)); |
792 successors.push(_methodBlocks->block_containing(dest_bci)); |
793 fall_through = false; |
793 fall_through = false; |
794 break; |
794 break; |
795 } |
795 } |