< prev index next >

src/hotspot/share/c1/c1_GraphBuilder.cpp

Print this page

  23  */
  24 
  25 #include "c1/c1_CFGPrinter.hpp"
  26 #include "c1/c1_Canonicalizer.hpp"
  27 #include "c1/c1_Compilation.hpp"
  28 #include "c1/c1_GraphBuilder.hpp"
  29 #include "c1/c1_InstructionPrinter.hpp"
  30 #include "ci/ciCallSite.hpp"
  31 #include "ci/ciField.hpp"
  32 #include "ci/ciKlass.hpp"
  33 #include "ci/ciMemberName.hpp"
  34 #include "ci/ciSymbols.hpp"
  35 #include "ci/ciUtilities.inline.hpp"
  36 #include "classfile/javaClasses.hpp"
  37 #include "compiler/compilationPolicy.hpp"
  38 #include "compiler/compileBroker.hpp"
  39 #include "compiler/compilerEvent.hpp"
  40 #include "interpreter/bytecode.hpp"
  41 #include "jfr/jfrEvents.hpp"
  42 #include "memory/resourceArea.hpp"


  43 #include "runtime/sharedRuntime.hpp"
  44 #include "utilities/checkedCast.hpp"
  45 #include "utilities/macros.hpp"
  46 #if INCLUDE_JFR
  47 #include "jfr/jfr.hpp"
  48 #endif
  49 
  50 class BlockListBuilder {
  51  private:
  52   Compilation* _compilation;
  53   IRScope*     _scope;
  54 
  55   BlockList    _blocks;                // internal list of all blocks
  56   BlockList*   _bci2block;             // mapping from bci to blocks for GraphBuilder
  57   GrowableArray<BlockList> _bci2block_successors; // Mapping bcis to their blocks successors while we dont have a blockend
  58 
  59   // fields used by mark_loops
  60   ResourceBitMap _active;              // for iteration of control flow graph
  61   ResourceBitMap _visited;             // for iteration of control flow graph
  62   GrowableArray<ResourceBitMap> _loop_map; // caches the information if a block is contained in a loop

4057   caller_state->truncate_stack(args_base);
4058   assert(callee_state->stack_size() == 0, "callee stack must be empty");
4059 
4060   Value lock = nullptr;
4061   BlockBegin* sync_handler = nullptr;
4062 
4063   // Inline the locking of the receiver if the callee is synchronized
4064   if (callee->is_synchronized()) {
4065     lock = callee->is_static() ? append(new Constant(new InstanceConstant(callee->holder()->java_mirror())))
4066                                : state()->local_at(0);
4067     sync_handler = new BlockBegin(SynchronizationEntryBCI);
4068     inline_sync_entry(lock, sync_handler);
4069   }
4070 
4071   if (compilation()->env()->dtrace_method_probes()) {
4072     Values* args = new Values(1);
4073     args->push(append(new Constant(new MethodConstant(method()))));
4074     append(new RuntimeCall(voidType, "dtrace_method_entry", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), args));
4075   }
4076 








4077   if (profile_inlined_calls()) {
4078     profile_invocation(callee, copy_state_before_with_bci(SynchronizationEntryBCI));
4079   }
4080 
4081   BlockBegin* callee_start_block = block_at(0);
4082   if (callee_start_block != nullptr) {
4083     assert(callee_start_block->is_set(BlockBegin::parser_loop_header_flag), "must be loop header");
4084     Goto* goto_callee = new Goto(callee_start_block, false);
4085     // The state for this goto is in the scope of the callee, so use
4086     // the entry bci for the callee instead of the call site bci.
4087     append_with_bci(goto_callee, 0);
4088     _block->set_end(goto_callee);
4089     callee_start_block->merge(callee_state, compilation()->has_irreducible_loops());
4090 
4091     _last = _block = callee_start_block;
4092 
4093     scope_data()->add_to_work_list(callee_start_block);
4094   }
4095 
4096   // Clear out bytecode stream

  23  */
  24 
  25 #include "c1/c1_CFGPrinter.hpp"
  26 #include "c1/c1_Canonicalizer.hpp"
  27 #include "c1/c1_Compilation.hpp"
  28 #include "c1/c1_GraphBuilder.hpp"
  29 #include "c1/c1_InstructionPrinter.hpp"
  30 #include "ci/ciCallSite.hpp"
  31 #include "ci/ciField.hpp"
  32 #include "ci/ciKlass.hpp"
  33 #include "ci/ciMemberName.hpp"
  34 #include "ci/ciSymbols.hpp"
  35 #include "ci/ciUtilities.inline.hpp"
  36 #include "classfile/javaClasses.hpp"
  37 #include "compiler/compilationPolicy.hpp"
  38 #include "compiler/compileBroker.hpp"
  39 #include "compiler/compilerEvent.hpp"
  40 #include "interpreter/bytecode.hpp"
  41 #include "jfr/jfrEvents.hpp"
  42 #include "memory/resourceArea.hpp"
  43 #include "oops/oop.inline.hpp"
  44 #include "runtime/runtimeUpcalls.hpp"
  45 #include "runtime/sharedRuntime.hpp"
  46 #include "utilities/checkedCast.hpp"
  47 #include "utilities/macros.hpp"
  48 #if INCLUDE_JFR
  49 #include "jfr/jfr.hpp"
  50 #endif
  51 
  52 class BlockListBuilder {
  53  private:
  54   Compilation* _compilation;
  55   IRScope*     _scope;
  56 
  57   BlockList    _blocks;                // internal list of all blocks
  58   BlockList*   _bci2block;             // mapping from bci to blocks for GraphBuilder
  59   GrowableArray<BlockList> _bci2block_successors; // Mapping bcis to their blocks successors while we dont have a blockend
  60 
  61   // fields used by mark_loops
  62   ResourceBitMap _active;              // for iteration of control flow graph
  63   ResourceBitMap _visited;             // for iteration of control flow graph
  64   GrowableArray<ResourceBitMap> _loop_map; // caches the information if a block is contained in a loop

4059   caller_state->truncate_stack(args_base);
4060   assert(callee_state->stack_size() == 0, "callee stack must be empty");
4061 
4062   Value lock = nullptr;
4063   BlockBegin* sync_handler = nullptr;
4064 
4065   // Inline the locking of the receiver if the callee is synchronized
4066   if (callee->is_synchronized()) {
4067     lock = callee->is_static() ? append(new Constant(new InstanceConstant(callee->holder()->java_mirror())))
4068                                : state()->local_at(0);
4069     sync_handler = new BlockBegin(SynchronizationEntryBCI);
4070     inline_sync_entry(lock, sync_handler);
4071   }
4072 
4073   if (compilation()->env()->dtrace_method_probes()) {
4074     Values* args = new Values(1);
4075     args->push(append(new Constant(new MethodConstant(method()))));
4076     append(new RuntimeCall(voidType, "dtrace_method_entry", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), args));
4077   }
4078 
4079   MethodDetails method_details(callee);
4080   RuntimeUpcallInfo* upcall = RuntimeUpcalls::get_first_upcall(RuntimeUpcallType::onMethodEntry, method_details);
4081   while (upcall != nullptr) {
4082     Values* args = new Values(0);
4083     append(new RuntimeCall(voidType, upcall->upcall_name(), upcall->upcall_address(), args));
4084     upcall = RuntimeUpcalls::get_next_upcall(RuntimeUpcallType::onMethodEntry, method_details, upcall);
4085   }
4086 
4087   if (profile_inlined_calls()) {
4088     profile_invocation(callee, copy_state_before_with_bci(SynchronizationEntryBCI));
4089   }
4090 
4091   BlockBegin* callee_start_block = block_at(0);
4092   if (callee_start_block != nullptr) {
4093     assert(callee_start_block->is_set(BlockBegin::parser_loop_header_flag), "must be loop header");
4094     Goto* goto_callee = new Goto(callee_start_block, false);
4095     // The state for this goto is in the scope of the callee, so use
4096     // the entry bci for the callee instead of the call site bci.
4097     append_with_bci(goto_callee, 0);
4098     _block->set_end(goto_callee);
4099     callee_start_block->merge(callee_state, compilation()->has_irreducible_loops());
4100 
4101     _last = _block = callee_start_block;
4102 
4103     scope_data()->add_to_work_list(callee_start_block);
4104   }
4105 
4106   // Clear out bytecode stream
< prev index next >