23 */
24
25 #include "c1/c1_Canonicalizer.hpp"
26 #include "c1/c1_CFGPrinter.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
4020 caller_state->truncate_stack(args_base);
4021 assert(callee_state->stack_size() == 0, "callee stack must be empty");
4022
4023 Value lock = nullptr;
4024 BlockBegin* sync_handler = nullptr;
4025
4026 // Inline the locking of the receiver if the callee is synchronized
4027 if (callee->is_synchronized()) {
4028 lock = callee->is_static() ? append(new Constant(new InstanceConstant(callee->holder()->java_mirror())))
4029 : state()->local_at(0);
4030 sync_handler = new BlockBegin(SynchronizationEntryBCI);
4031 inline_sync_entry(lock, sync_handler);
4032 }
4033
4034 if (compilation()->env()->dtrace_method_probes()) {
4035 Values* args = new Values(1);
4036 args->push(append(new Constant(new MethodConstant(method()))));
4037 append(new RuntimeCall(voidType, "dtrace_method_entry", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), args));
4038 }
4039
4040 if (profile_inlined_calls()) {
4041 profile_invocation(callee, copy_state_before_with_bci(SynchronizationEntryBCI));
4042 }
4043
4044 BlockBegin* callee_start_block = block_at(0);
4045 if (callee_start_block != nullptr) {
4046 assert(callee_start_block->is_set(BlockBegin::parser_loop_header_flag), "must be loop header");
4047 Goto* goto_callee = new Goto(callee_start_block, false);
4048 // The state for this goto is in the scope of the callee, so use
4049 // the entry bci for the callee instead of the call site bci.
4050 append_with_bci(goto_callee, 0);
4051 _block->set_end(goto_callee);
4052 callee_start_block->merge(callee_state, compilation()->has_irreducible_loops());
4053
4054 _last = _block = callee_start_block;
4055
4056 scope_data()->add_to_work_list(callee_start_block);
4057 }
4058
4059 // Clear out bytecode stream
|
23 */
24
25 #include "c1/c1_Canonicalizer.hpp"
26 #include "c1/c1_CFGPrinter.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
4022 caller_state->truncate_stack(args_base);
4023 assert(callee_state->stack_size() == 0, "callee stack must be empty");
4024
4025 Value lock = nullptr;
4026 BlockBegin* sync_handler = nullptr;
4027
4028 // Inline the locking of the receiver if the callee is synchronized
4029 if (callee->is_synchronized()) {
4030 lock = callee->is_static() ? append(new Constant(new InstanceConstant(callee->holder()->java_mirror())))
4031 : state()->local_at(0);
4032 sync_handler = new BlockBegin(SynchronizationEntryBCI);
4033 inline_sync_entry(lock, sync_handler);
4034 }
4035
4036 if (compilation()->env()->dtrace_method_probes()) {
4037 Values* args = new Values(1);
4038 args->push(append(new Constant(new MethodConstant(method()))));
4039 append(new RuntimeCall(voidType, "dtrace_method_entry", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), args));
4040 }
4041
4042 MethodDetails method_details(callee);
4043 RuntimeUpcallInfo* upcall = RuntimeUpcalls::get_first_upcall(RuntimeUpcallType::onMethodEntry, method_details);
4044 while (upcall != nullptr) {
4045 Values* args = new Values(0);
4046 append(new RuntimeCall(voidType, upcall->upcall_name(), upcall->upcall_address(), args));
4047 upcall = RuntimeUpcalls::get_next_upcall(RuntimeUpcallType::onMethodEntry, method_details, upcall);
4048 }
4049
4050 if (profile_inlined_calls()) {
4051 profile_invocation(callee, copy_state_before_with_bci(SynchronizationEntryBCI));
4052 }
4053
4054 BlockBegin* callee_start_block = block_at(0);
4055 if (callee_start_block != nullptr) {
4056 assert(callee_start_block->is_set(BlockBegin::parser_loop_header_flag), "must be loop header");
4057 Goto* goto_callee = new Goto(callee_start_block, false);
4058 // The state for this goto is in the scope of the callee, so use
4059 // the entry bci for the callee instead of the call site bci.
4060 append_with_bci(goto_callee, 0);
4061 _block->set_end(goto_callee);
4062 callee_start_block->merge(callee_state, compilation()->has_irreducible_loops());
4063
4064 _last = _block = callee_start_block;
4065
4066 scope_data()->add_to_work_list(callee_start_block);
4067 }
4068
4069 // Clear out bytecode stream
|