comparison src/share/vm/ci/ciTypeFlow.cpp @ 2142:8012aa3ccede

4926272: methodOopDesc::method_from_bcp is unsafe Reviewed-by: coleenp, jrose, kvn, dcubed
author never
date Thu, 13 Jan 2011 22:15:41 -0800
parents f95d63e2154a
children 322a41ec766c
comparison
equal deleted inserted replaced
2130:34d64ad817f4 2142:8012aa3ccede
1 /* 1 /*
2 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2000, 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.
1696 assert(_successors->length() == GOTO_TARGET, ""); 1696 assert(_successors->length() == GOTO_TARGET, "");
1697 _successors->append(analyzer->block_at(str->get_far_dest(), jsrs)); 1697 _successors->append(analyzer->block_at(str->get_far_dest(), jsrs));
1698 break; 1698 break;
1699 1699
1700 case Bytecodes::_tableswitch: { 1700 case Bytecodes::_tableswitch: {
1701 Bytecode_tableswitch *tableswitch = 1701 Bytecode_tableswitch tableswitch(str);
1702 Bytecode_tableswitch_at(str->cur_bcp()); 1702
1703 1703 int len = tableswitch.length();
1704 int len = tableswitch->length();
1705 _successors = 1704 _successors =
1706 new (arena) GrowableArray<Block*>(arena, len+1, 0, NULL); 1705 new (arena) GrowableArray<Block*>(arena, len+1, 0, NULL);
1707 int bci = current_bci + tableswitch->default_offset(); 1706 int bci = current_bci + tableswitch.default_offset();
1708 Block* block = analyzer->block_at(bci, jsrs); 1707 Block* block = analyzer->block_at(bci, jsrs);
1709 assert(_successors->length() == SWITCH_DEFAULT, ""); 1708 assert(_successors->length() == SWITCH_DEFAULT, "");
1710 _successors->append(block); 1709 _successors->append(block);
1711 while (--len >= 0) { 1710 while (--len >= 0) {
1712 int bci = current_bci + tableswitch->dest_offset_at(len); 1711 int bci = current_bci + tableswitch.dest_offset_at(len);
1713 block = analyzer->block_at(bci, jsrs); 1712 block = analyzer->block_at(bci, jsrs);
1714 assert(_successors->length() >= SWITCH_CASES, ""); 1713 assert(_successors->length() >= SWITCH_CASES, "");
1715 _successors->append_if_missing(block); 1714 _successors->append_if_missing(block);
1716 } 1715 }
1717 break; 1716 break;
1718 } 1717 }
1719 1718
1720 case Bytecodes::_lookupswitch: { 1719 case Bytecodes::_lookupswitch: {
1721 Bytecode_lookupswitch *lookupswitch = 1720 Bytecode_lookupswitch lookupswitch(str);
1722 Bytecode_lookupswitch_at(str->cur_bcp()); 1721
1723 1722 int npairs = lookupswitch.number_of_pairs();
1724 int npairs = lookupswitch->number_of_pairs();
1725 _successors = 1723 _successors =
1726 new (arena) GrowableArray<Block*>(arena, npairs+1, 0, NULL); 1724 new (arena) GrowableArray<Block*>(arena, npairs+1, 0, NULL);
1727 int bci = current_bci + lookupswitch->default_offset(); 1725 int bci = current_bci + lookupswitch.default_offset();
1728 Block* block = analyzer->block_at(bci, jsrs); 1726 Block* block = analyzer->block_at(bci, jsrs);
1729 assert(_successors->length() == SWITCH_DEFAULT, ""); 1727 assert(_successors->length() == SWITCH_DEFAULT, "");
1730 _successors->append(block); 1728 _successors->append(block);
1731 while(--npairs >= 0) { 1729 while(--npairs >= 0) {
1732 LookupswitchPair *pair = lookupswitch->pair_at(npairs); 1730 LookupswitchPair pair = lookupswitch.pair_at(npairs);
1733 int bci = current_bci + pair->offset(); 1731 int bci = current_bci + pair.offset();
1734 Block* block = analyzer->block_at(bci, jsrs); 1732 Block* block = analyzer->block_at(bci, jsrs);
1735 assert(_successors->length() >= SWITCH_CASES, ""); 1733 assert(_successors->length() >= SWITCH_CASES, "");
1736 _successors->append_if_missing(block); 1734 _successors->append_if_missing(block);
1737 } 1735 }
1738 break; 1736 break;