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