1 /*
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.
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 *
228 int dest_bci = s.get_far_dest();
229 ciBlock *dest = make_block_at(dest_bci);
230 break;
231 }
232
233 case Bytecodes::_athrow :
234 cur_block->set_may_throw();
235 // fall-through
236 case Bytecodes::_ret :
237 case Bytecodes::_ireturn :
238 case Bytecodes::_lreturn :
239 case Bytecodes::_freturn :
240 case Bytecodes::_dreturn :
241 case Bytecodes::_areturn :
242 case Bytecodes::_return :
243 cur_block->set_control_bci(bci);
244 if (s.next_bci() < limit_bci) {
245 (void) make_block_at(s.next_bci());
246 }
247 break;
248 }
249 }
250 // End the last block
251 cur_block->set_limit_bci(limit_bci);
252 }
253
254 ciMethodBlocks::ciMethodBlocks(Arena *arena, ciMethod *meth): _method(meth),
255 _arena(arena), _num_blocks(0), _code_size(meth->code_size()) {
256 int block_estimate = _code_size / 8;
257
258 _blocks = new(_arena) GrowableArray<ciBlock *>(_arena, block_estimate, 0, NULL);
259 int b2bsize = _code_size * sizeof(ciBlock **);
260 _bci_to_block = (ciBlock **) arena->Amalloc(b2bsize);
261 Copy::zero_to_words((HeapWord*) _bci_to_block, b2bsize / sizeof(HeapWord));
262
263 // create initial block covering the entire method
264 ciBlock *b = new(arena) ciBlock(_method, _num_blocks++, 0);
265 _blocks->append(b);
266 _bci_to_block[0] = b;
267
|
1 /*
2 * Copyright (c) 2006, 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 *
228 int dest_bci = s.get_far_dest();
229 ciBlock *dest = make_block_at(dest_bci);
230 break;
231 }
232
233 case Bytecodes::_athrow :
234 cur_block->set_may_throw();
235 // fall-through
236 case Bytecodes::_ret :
237 case Bytecodes::_ireturn :
238 case Bytecodes::_lreturn :
239 case Bytecodes::_freturn :
240 case Bytecodes::_dreturn :
241 case Bytecodes::_areturn :
242 case Bytecodes::_return :
243 cur_block->set_control_bci(bci);
244 if (s.next_bci() < limit_bci) {
245 (void) make_block_at(s.next_bci());
246 }
247 break;
248
249 default:
250 break;
251 }
252 }
253 // End the last block
254 cur_block->set_limit_bci(limit_bci);
255 }
256
257 ciMethodBlocks::ciMethodBlocks(Arena *arena, ciMethod *meth): _method(meth),
258 _arena(arena), _num_blocks(0), _code_size(meth->code_size()) {
259 int block_estimate = _code_size / 8;
260
261 _blocks = new(_arena) GrowableArray<ciBlock *>(_arena, block_estimate, 0, NULL);
262 int b2bsize = _code_size * sizeof(ciBlock **);
263 _bci_to_block = (ciBlock **) arena->Amalloc(b2bsize);
264 Copy::zero_to_words((HeapWord*) _bci_to_block, b2bsize / sizeof(HeapWord));
265
266 // create initial block covering the entire method
267 ciBlock *b = new(arena) ciBlock(_method, _num_blocks++, 0);
268 _blocks->append(b);
269 _bci_to_block[0] = b;
270
|