827 // handler block instead of the default one but the synthetic |
827 // handler block instead of the default one but the synthetic |
828 // unlocker needs to be handled specially. The synthetic unlocker |
828 // unlocker needs to be handled specially. The synthetic unlocker |
829 // should be left alone since there can be only one and all code |
829 // should be left alone since there can be only one and all code |
830 // should dispatch to the same one. |
830 // should dispatch to the same one. |
831 XHandler* h = handlers->handler_at(i); |
831 XHandler* h = handlers->handler_at(i); |
832 if (h->handler_bci() != SynchronizationEntryBCI) { |
832 assert(h->handler_bci() != SynchronizationEntryBCI, "must be real"); |
833 h->set_entry_block(block_at(h->handler_bci())); |
833 h->set_entry_block(block_at(h->handler_bci())); |
834 } else { |
|
835 assert(h->entry_block()->is_set(BlockBegin::default_exception_handler_flag), |
|
836 "should be the synthetic unlock block"); |
|
837 } |
|
838 } |
834 } |
839 _jsr_xhandlers = handlers; |
835 _jsr_xhandlers = handlers; |
840 } |
836 } |
841 |
837 |
842 |
838 |
2865 |
2861 |
2866 // setup state for std entry |
2862 // setup state for std entry |
2867 _initial_state = state_at_entry(); |
2863 _initial_state = state_at_entry(); |
2868 start_block->merge(_initial_state); |
2864 start_block->merge(_initial_state); |
2869 |
2865 |
2870 // setup an exception handler to do the unlocking and/or |
|
2871 // notification and unwind the frame. |
|
2872 BlockBegin* sync_handler = new BlockBegin(-1); |
|
2873 sync_handler->set(BlockBegin::exception_entry_flag); |
|
2874 sync_handler->set(BlockBegin::is_on_work_list_flag); |
|
2875 sync_handler->set(BlockBegin::default_exception_handler_flag); |
|
2876 |
|
2877 ciExceptionHandler* desc = new ciExceptionHandler(method()->holder(), 0, method()->code_size(), -1, 0); |
|
2878 XHandler* h = new XHandler(desc); |
|
2879 h->set_entry_block(sync_handler); |
|
2880 scope_data()->xhandlers()->append(h); |
|
2881 scope_data()->set_has_handler(); |
|
2882 |
|
2883 // complete graph |
2866 // complete graph |
2884 _vmap = new ValueMap(); |
2867 _vmap = new ValueMap(); |
2885 scope->compute_lock_stack_size(); |
2868 scope->compute_lock_stack_size(); |
2886 switch (scope->method()->intrinsic_id()) { |
2869 switch (scope->method()->intrinsic_id()) { |
2887 case vmIntrinsics::_dabs : // fall through |
2870 case vmIntrinsics::_dabs : // fall through |
2927 scope_data()->add_to_work_list(start_block); |
2910 scope_data()->add_to_work_list(start_block); |
2928 iterate_all_blocks(); |
2911 iterate_all_blocks(); |
2929 break; |
2912 break; |
2930 } |
2913 } |
2931 CHECK_BAILOUT(); |
2914 CHECK_BAILOUT(); |
2932 |
|
2933 if (sync_handler && sync_handler->state() != NULL) { |
|
2934 Value lock = NULL; |
|
2935 if (method()->is_synchronized()) { |
|
2936 lock = method()->is_static() ? new Constant(new InstanceConstant(method()->holder()->java_mirror())) : |
|
2937 _initial_state->local_at(0); |
|
2938 |
|
2939 sync_handler->state()->unlock(); |
|
2940 sync_handler->state()->lock(scope, lock); |
|
2941 |
|
2942 } |
|
2943 fill_sync_handler(lock, sync_handler, true); |
|
2944 } |
|
2945 |
2915 |
2946 _start = setup_start_block(osr_bci, start_block, _osr_entry, _initial_state); |
2916 _start = setup_start_block(osr_bci, start_block, _osr_entry, _initial_state); |
2947 |
2917 |
2948 eliminate_redundant_phis(_start); |
2918 eliminate_redundant_phis(_start); |
2949 |
2919 |