< prev index next >

src/hotspot/share/c1/c1_GraphBuilder.cpp

Print this page

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


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

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








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

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

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