Mercurial > hg > truffle
comparison src/share/vm/ci/ciMethodBlocks.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 |
comparison
equal
deleted
inserted
replaced
2130:34d64ad817f4 | 2142:8012aa3ccede |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2006, 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. |
173 } | 173 } |
174 | 174 |
175 case Bytecodes::_tableswitch : | 175 case Bytecodes::_tableswitch : |
176 { | 176 { |
177 cur_block->set_control_bci(bci); | 177 cur_block->set_control_bci(bci); |
178 Bytecode_tableswitch* switch_ = Bytecode_tableswitch_at(s.cur_bcp()); | 178 Bytecode_tableswitch sw(&s); |
179 int len = switch_->length(); | 179 int len = sw.length(); |
180 ciBlock *dest; | 180 ciBlock *dest; |
181 int dest_bci; | 181 int dest_bci; |
182 for (int i = 0; i < len; i++) { | 182 for (int i = 0; i < len; i++) { |
183 dest_bci = s.cur_bci() + switch_->dest_offset_at(i); | 183 dest_bci = s.cur_bci() + sw.dest_offset_at(i); |
184 dest = make_block_at(dest_bci); | 184 dest = make_block_at(dest_bci); |
185 } | 185 } |
186 dest_bci = s.cur_bci() + switch_->default_offset(); | 186 dest_bci = s.cur_bci() + sw.default_offset(); |
187 make_block_at(dest_bci); | 187 make_block_at(dest_bci); |
188 if (s.next_bci() < limit_bci) { | 188 if (s.next_bci() < limit_bci) { |
189 dest = make_block_at(s.next_bci()); | 189 dest = make_block_at(s.next_bci()); |
190 } | 190 } |
191 } | 191 } |
192 break; | 192 break; |
193 | 193 |
194 case Bytecodes::_lookupswitch: | 194 case Bytecodes::_lookupswitch: |
195 { | 195 { |
196 cur_block->set_control_bci(bci); | 196 cur_block->set_control_bci(bci); |
197 Bytecode_lookupswitch* switch_ = Bytecode_lookupswitch_at(s.cur_bcp()); | 197 Bytecode_lookupswitch sw(&s); |
198 int len = switch_->number_of_pairs(); | 198 int len = sw.number_of_pairs(); |
199 ciBlock *dest; | 199 ciBlock *dest; |
200 int dest_bci; | 200 int dest_bci; |
201 for (int i = 0; i < len; i++) { | 201 for (int i = 0; i < len; i++) { |
202 dest_bci = s.cur_bci() + switch_->pair_at(i)->offset(); | 202 dest_bci = s.cur_bci() + sw.pair_at(i).offset(); |
203 dest = make_block_at(dest_bci); | 203 dest = make_block_at(dest_bci); |
204 } | 204 } |
205 dest_bci = s.cur_bci() + switch_->default_offset(); | 205 dest_bci = s.cur_bci() + sw.default_offset(); |
206 dest = make_block_at(dest_bci); | 206 dest = make_block_at(dest_bci); |
207 if (s.next_bci() < limit_bci) { | 207 if (s.next_bci() < limit_bci) { |
208 dest = make_block_at(s.next_bci()); | 208 dest = make_block_at(s.next_bci()); |
209 } | 209 } |
210 } | 210 } |