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/sharedRuntime.hpp"
46 #include "runtime/vm_version.hpp"
47 #include "utilities/bitMap.inline.hpp"
48 #include "utilities/checkedCast.hpp"
49 #include "utilities/powerOfTwo.hpp"
50 #include "utilities/macros.hpp"
51 #if INCLUDE_JFR
52 #include "jfr/jfr.hpp"
53 #endif
54
55 class BlockListBuilder {
56 private:
57 Compilation* _compilation;
58 IRScope* _scope;
59
60 BlockList _blocks; // internal list of all blocks
61 BlockList* _bci2block; // mapping from bci to blocks for GraphBuilder
62 GrowableArray<BlockList> _bci2block_successors; // Mapping bcis to their blocks successors while we dont have a blockend
63
64 // fields used by mark_loops
4062 caller_state->truncate_stack(args_base);
4063 assert(callee_state->stack_size() == 0, "callee stack must be empty");
4064
4065 Value lock = nullptr;
4066 BlockBegin* sync_handler = nullptr;
4067
4068 // Inline the locking of the receiver if the callee is synchronized
4069 if (callee->is_synchronized()) {
4070 lock = callee->is_static() ? append(new Constant(new InstanceConstant(callee->holder()->java_mirror())))
4071 : state()->local_at(0);
4072 sync_handler = new BlockBegin(SynchronizationEntryBCI);
4073 inline_sync_entry(lock, sync_handler);
4074 }
4075
4076 if (compilation()->env()->dtrace_method_probes()) {
4077 Values* args = new Values(1);
4078 args->push(append(new Constant(new MethodConstant(method()))));
4079 append(new RuntimeCall(voidType, "dtrace_method_entry", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), args));
4080 }
4081
4082 if (profile_inlined_calls()) {
4083 profile_invocation(callee, copy_state_before_with_bci(SynchronizationEntryBCI));
4084 }
4085
4086 BlockBegin* callee_start_block = block_at(0);
4087 if (callee_start_block != nullptr) {
4088 assert(callee_start_block->is_set(BlockBegin::parser_loop_header_flag), "must be loop header");
4089 Goto* goto_callee = new Goto(callee_start_block, false);
4090 // The state for this goto is in the scope of the callee, so use
4091 // the entry bci for the callee instead of the call site bci.
4092 append_with_bci(goto_callee, 0);
4093 _block->set_end(goto_callee);
4094 callee_start_block->merge(callee_state, compilation()->has_irreducible_loops());
4095
4096 _last = _block = callee_start_block;
4097
4098 scope_data()->add_to_work_list(callee_start_block);
4099 }
4100
4101 // Clear out bytecode stream
|
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 "runtime/vm_version.hpp"
48 #include "utilities/bitMap.inline.hpp"
49 #include "utilities/checkedCast.hpp"
50 #include "utilities/powerOfTwo.hpp"
51 #include "utilities/macros.hpp"
52 #if INCLUDE_JFR
53 #include "jfr/jfr.hpp"
54 #endif
55
56 class BlockListBuilder {
57 private:
58 Compilation* _compilation;
59 IRScope* _scope;
60
61 BlockList _blocks; // internal list of all blocks
62 BlockList* _bci2block; // mapping from bci to blocks for GraphBuilder
63 GrowableArray<BlockList> _bci2block_successors; // Mapping bcis to their blocks successors while we dont have a blockend
64
65 // fields used by mark_loops
4063 caller_state->truncate_stack(args_base);
4064 assert(callee_state->stack_size() == 0, "callee stack must be empty");
4065
4066 Value lock = nullptr;
4067 BlockBegin* sync_handler = nullptr;
4068
4069 // Inline the locking of the receiver if the callee is synchronized
4070 if (callee->is_synchronized()) {
4071 lock = callee->is_static() ? append(new Constant(new InstanceConstant(callee->holder()->java_mirror())))
4072 : state()->local_at(0);
4073 sync_handler = new BlockBegin(SynchronizationEntryBCI);
4074 inline_sync_entry(lock, sync_handler);
4075 }
4076
4077 if (compilation()->env()->dtrace_method_probes()) {
4078 Values* args = new Values(1);
4079 args->push(append(new Constant(new MethodConstant(method()))));
4080 append(new RuntimeCall(voidType, "dtrace_method_entry", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), args));
4081 }
4082
4083 MethodDetails method_details(callee);
4084 RuntimeUpcallInfo* upcall = RuntimeUpcalls::get_first_upcall(RuntimeUpcallType::onMethodEntry, method_details);
4085 while (upcall != nullptr) {
4086 Values* args = new Values(0);
4087 append(new RuntimeCall(voidType, upcall->upcall_name(), upcall->upcall_address(), args));
4088 upcall = RuntimeUpcalls::get_next_upcall(RuntimeUpcallType::onMethodEntry, method_details, upcall);
4089 }
4090
4091 if (profile_inlined_calls()) {
4092 profile_invocation(callee, copy_state_before_with_bci(SynchronizationEntryBCI));
4093 }
4094
4095 BlockBegin* callee_start_block = block_at(0);
4096 if (callee_start_block != nullptr) {
4097 assert(callee_start_block->is_set(BlockBegin::parser_loop_header_flag), "must be loop header");
4098 Goto* goto_callee = new Goto(callee_start_block, false);
4099 // The state for this goto is in the scope of the callee, so use
4100 // the entry bci for the callee instead of the call site bci.
4101 append_with_bci(goto_callee, 0);
4102 _block->set_end(goto_callee);
4103 callee_start_block->merge(callee_state, compilation()->has_irreducible_loops());
4104
4105 _last = _block = callee_start_block;
4106
4107 scope_data()->add_to_work_list(callee_start_block);
4108 }
4109
4110 // Clear out bytecode stream
|