48 |
48 |
49 BlockList _blocks; // internal list of all blocks |
49 BlockList _blocks; // internal list of all blocks |
50 BlockList* _bci2block; // mapping from bci to blocks for GraphBuilder |
50 BlockList* _bci2block; // mapping from bci to blocks for GraphBuilder |
51 |
51 |
52 // fields used by mark_loops |
52 // fields used by mark_loops |
53 BitMap _active; // for iteration of control flow graph |
53 ResourceBitMap _active; // for iteration of control flow graph |
54 BitMap _visited; // for iteration of control flow graph |
54 ResourceBitMap _visited; // for iteration of control flow graph |
55 intArray _loop_map; // caches the information if a block is contained in a loop |
55 intArray _loop_map; // caches the information if a block is contained in a loop |
56 int _next_loop_index; // next free loop number |
56 int _next_loop_index; // next free loop number |
57 int _next_block_number; // for reverse postorder numbering of blocks |
57 int _next_block_number; // for reverse postorder numbering of blocks |
58 |
58 |
59 // accessors |
59 // accessors |
60 Compilation* compilation() const { return _compilation; } |
60 Compilation* compilation() const { return _compilation; } |
61 IRScope* scope() const { return _scope; } |
61 IRScope* scope() const { return _scope; } |
62 ciMethod* method() const { return scope()->method(); } |
62 ciMethod* method() const { return scope()->method(); } |
225 |
225 |
226 // The information which bci starts a new block simplifies the analysis |
226 // The information which bci starts a new block simplifies the analysis |
227 // Without it, backward branches could jump to a bci where no block was created |
227 // Without it, backward branches could jump to a bci where no block was created |
228 // during bytecode iteration. This would require the creation of a new block at the |
228 // during bytecode iteration. This would require the creation of a new block at the |
229 // branch target and a modification of the successor lists. |
229 // branch target and a modification of the successor lists. |
230 BitMap bci_block_start = method()->bci_block_start(); |
230 const BitMap& bci_block_start = method()->bci_block_start(); |
231 |
231 |
232 ciBytecodeStream s(method()); |
232 ciBytecodeStream s(method()); |
233 while (s.next() != ciBytecodeStream::EOBC()) { |
233 while (s.next() != ciBytecodeStream::EOBC()) { |
234 int cur_bci = s.cur_bci(); |
234 int cur_bci = s.cur_bci(); |
235 |
235 |
353 |
353 |
354 |
354 |
355 void BlockListBuilder::mark_loops() { |
355 void BlockListBuilder::mark_loops() { |
356 ResourceMark rm; |
356 ResourceMark rm; |
357 |
357 |
358 _active = BitMap(BlockBegin::number_of_blocks()); _active.clear(); |
358 _active.initialize(BlockBegin::number_of_blocks()); |
359 _visited = BitMap(BlockBegin::number_of_blocks()); _visited.clear(); |
359 _visited.initialize(BlockBegin::number_of_blocks()); |
360 _loop_map = intArray(BlockBegin::number_of_blocks(), BlockBegin::number_of_blocks(), 0); |
360 _loop_map = intArray(BlockBegin::number_of_blocks(), BlockBegin::number_of_blocks(), 0); |
361 _next_loop_index = 0; |
361 _next_loop_index = 0; |
362 _next_block_number = _blocks.length(); |
362 _next_block_number = _blocks.length(); |
363 |
363 |
364 // recursively iterate the control flow graph |
364 // recursively iterate the control flow graph |
365 mark_loops(_bci2block->at(0), false); |
365 mark_loops(_bci2block->at(0), false); |
366 assert(_next_block_number >= 0, "invalid block numbers"); |
366 assert(_next_block_number >= 0, "invalid block numbers"); |
|
367 |
|
368 // Remove dangling Resource pointers before the ResourceMark goes out-of-scope. |
|
369 _active.resize(0); |
|
370 _visited.resize(0); |
367 } |
371 } |
368 |
372 |
369 void BlockListBuilder::make_loop_header(BlockBegin* block) { |
373 void BlockListBuilder::make_loop_header(BlockBegin* block) { |
370 if (block->is_set(BlockBegin::exception_entry_flag)) { |
374 if (block->is_set(BlockBegin::exception_entry_flag)) { |
371 // exception edges may look like loops but don't mark them as such |
375 // exception edges may look like loops but don't mark them as such |
3074 |
3078 |
3075 int index; |
3079 int index; |
3076 Value local; |
3080 Value local; |
3077 |
3081 |
3078 // find all the locals that the interpreter thinks contain live oops |
3082 // find all the locals that the interpreter thinks contain live oops |
3079 const BitMap live_oops = method()->live_local_oops_at_bci(osr_bci); |
3083 const ResourceBitMap live_oops = method()->live_local_oops_at_bci(osr_bci); |
3080 |
3084 |
3081 // compute the offset into the locals so that we can treat the buffer |
3085 // compute the offset into the locals so that we can treat the buffer |
3082 // as if the locals were still in the interpreter frame |
3086 // as if the locals were still in the interpreter frame |
3083 int locals_offset = BytesPerWord * (method()->max_locals() - 1); |
3087 int locals_offset = BytesPerWord * (method()->max_locals() - 1); |
3084 for_each_local_value(state, index, local) { |
3088 for_each_local_value(state, index, local) { |