1 /* |
1 /* |
2 * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright (c) 2012, 2015 SAP SE. All rights reserved. |
3 * Copyright (c) 2012, 2016 SAP SE. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. |
8 * published by the Free Software Foundation. |
478 profile_typecheck_failed(Rtmp1, Rtmp2); |
478 profile_typecheck_failed(Rtmp1, Rtmp2); |
479 } |
479 } |
480 |
480 |
481 void InterpreterMacroAssembler::generate_stack_overflow_check_with_compare_and_throw(Register Rmem_frame_size, Register Rscratch1) { |
481 void InterpreterMacroAssembler::generate_stack_overflow_check_with_compare_and_throw(Register Rmem_frame_size, Register Rscratch1) { |
482 Label done; |
482 Label done; |
|
483 BLOCK_COMMENT("stack_overflow_check_with_compare_and_throw {"); |
483 sub(Rmem_frame_size, R1_SP, Rmem_frame_size); |
484 sub(Rmem_frame_size, R1_SP, Rmem_frame_size); |
484 ld(Rscratch1, thread_(stack_overflow_limit)); |
485 ld(Rscratch1, thread_(stack_overflow_limit)); |
485 cmpld(CCR0/*is_stack_overflow*/, Rmem_frame_size, Rscratch1); |
486 cmpld(CCR0/*is_stack_overflow*/, Rmem_frame_size, Rscratch1); |
486 bgt(CCR0/*is_stack_overflow*/, done); |
487 bgt(CCR0/*is_stack_overflow*/, done); |
487 |
488 |
803 // Else |
805 // Else |
804 // no error processing |
806 // no error processing |
805 void InterpreterMacroAssembler::remove_activation(TosState state, |
807 void InterpreterMacroAssembler::remove_activation(TosState state, |
806 bool throw_monitor_exception, |
808 bool throw_monitor_exception, |
807 bool install_monitor_exception) { |
809 bool install_monitor_exception) { |
|
810 BLOCK_COMMENT("remove_activation {"); |
808 unlock_if_synchronized_method(state, throw_monitor_exception, install_monitor_exception); |
811 unlock_if_synchronized_method(state, throw_monitor_exception, install_monitor_exception); |
809 |
812 |
810 // Save result (push state before jvmti call and pop it afterwards) and notify jvmti. |
813 // Save result (push state before jvmti call and pop it afterwards) and notify jvmti. |
811 notify_method_exit(false, state, NotifyJVMTI, true); |
814 notify_method_exit(false, state, NotifyJVMTI, true); |
812 |
815 |
|
816 BLOCK_COMMENT("reserved_stack_check:"); |
|
817 if (StackReservedPages > 0) { |
|
818 // Test if reserved zone needs to be enabled. |
|
819 Label no_reserved_zone_enabling; |
|
820 |
|
821 // Compare frame pointers. There is no good stack pointer, as with stack |
|
822 // frame compression we can get different SPs when we do calls. A subsequent |
|
823 // call could have a smaller SP, so that this compare succeeds for an |
|
824 // inner call of the method annotated with ReservedStack. |
|
825 ld_ptr(R0, JavaThread::reserved_stack_activation_offset(), R16_thread); |
|
826 ld_ptr(R11_scratch1, _abi(callers_sp), R1_SP); // Load frame pointer. |
|
827 cmpld(CCR0, R11_scratch1, R0); |
|
828 blt_predict_taken(CCR0, no_reserved_zone_enabling); |
|
829 |
|
830 // Enable reserved zone again, throw stack overflow exception. |
|
831 call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), R16_thread); |
|
832 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_delayed_StackOverflowError)); |
|
833 |
|
834 should_not_reach_here(); |
|
835 |
|
836 bind(no_reserved_zone_enabling); |
|
837 } |
|
838 |
813 verify_oop(R17_tos, state); |
839 verify_oop(R17_tos, state); |
814 verify_thread(); |
840 verify_thread(); |
815 |
841 |
816 merge_frames(/*top_frame_sp*/ R21_sender_SP, /*return_pc*/ R0, R11_scratch1, R12_scratch2); |
842 merge_frames(/*top_frame_sp*/ R21_sender_SP, /*return_pc*/ R0, R11_scratch1, R12_scratch2); |
817 mtlr(R0); |
843 mtlr(R0); |
|
844 BLOCK_COMMENT("} remove_activation"); |
818 } |
845 } |
819 |
846 |
820 // Lock object |
847 // Lock object |
821 // |
848 // |
822 // Registers alive |
849 // Registers alive |