843 }
844
845 // remove activation
846 //
847 // Unlock the receiver if this is a synchronized method.
848 // Unlock any Java monitors from syncronized blocks.
849 // Remove the activation from the stack.
850 //
851 // If there are locked Java monitors
852 // If throw_monitor_exception
853 // throws IllegalMonitorStateException
854 // Else if install_monitor_exception
855 // installs IllegalMonitorStateException
856 // Else
857 // no error processing
858 void InterpreterMacroAssembler::remove_activation(TosState state,
859 Register return_pc,
860 bool throw_monitor_exception,
861 bool install_monitor_exception,
862 bool notify_jvmti) {
863
864 unlock_if_synchronized_method(state, throw_monitor_exception, install_monitor_exception);
865
866 // Save result (push state before jvmti call and pop it afterwards) and notify jvmti.
867 notify_method_exit(false, state, notify_jvmti ? NotifyJVMTI : SkipNotifyJVMTI);
868
869 verify_oop(Z_tos, state);
870 verify_thread();
871
872 pop_interpreter_frame(return_pc, Z_ARG2, Z_ARG3);
873 }
874
875 // lock object
876 //
877 // Registers alive
878 // monitor - Address of the BasicObjectLock to be used for locking,
879 // which must be initialized with the object to lock.
880 // object - Address of the object to be locked.
881 void InterpreterMacroAssembler::lock_object(Register monitor, Register object) {
882
883 if (UseHeavyMonitors) {
884 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter),
885 monitor, /*check_for_exceptions=*/false);
886 return;
887 }
888
889 // template code:
890 //
891 // markOop displaced_header = obj->mark().set_unlocked();
892 // monitor->lock()->set_displaced_header(displaced_header);
|
843 }
844
845 // remove activation
846 //
847 // Unlock the receiver if this is a synchronized method.
848 // Unlock any Java monitors from syncronized blocks.
849 // Remove the activation from the stack.
850 //
851 // If there are locked Java monitors
852 // If throw_monitor_exception
853 // throws IllegalMonitorStateException
854 // Else if install_monitor_exception
855 // installs IllegalMonitorStateException
856 // Else
857 // no error processing
858 void InterpreterMacroAssembler::remove_activation(TosState state,
859 Register return_pc,
860 bool throw_monitor_exception,
861 bool install_monitor_exception,
862 bool notify_jvmti) {
863 BLOCK_COMMENT("remove_activation {");
864 unlock_if_synchronized_method(state, throw_monitor_exception, install_monitor_exception);
865
866 // Save result (push state before jvmti call and pop it afterwards) and notify jvmti.
867 notify_method_exit(false, state, notify_jvmti ? NotifyJVMTI : SkipNotifyJVMTI);
868
869 if (StackReservedPages > 0) {
870 BLOCK_COMMENT("reserved_stack_check:");
871 // Test if reserved zone needs to be enabled.
872 Label no_reserved_zone_enabling;
873
874 // Compare frame pointers. There is no good stack pointer, as with stack
875 // frame compression we can get different SPs when we do calls. A subsequent
876 // call could have a smaller SP, so that this compare succeeds for an
877 // inner call of the method annotated with ReservedStack.
878 z_lg(Z_R0, Address(Z_SP, (intptr_t)_z_abi(callers_sp)));
879 z_cg(Z_R0, Address(Z_thread, JavaThread::reserved_stack_activation_offset())); // Compare with frame pointer in memory.
880 z_brnh(no_reserved_zone_enabling);
881
882 // Enable reserved zone again, throw stack overflow exception.
883 call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), Z_thread);
884 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_delayed_StackOverflowError));
885
886 should_not_reach_here();
887
888 bind(no_reserved_zone_enabling);
889 }
890
891 verify_oop(Z_tos, state);
892 verify_thread();
893
894 pop_interpreter_frame(return_pc, Z_ARG2, Z_ARG3);
895 BLOCK_COMMENT("} remove_activation");
896 }
897
898 // lock object
899 //
900 // Registers alive
901 // monitor - Address of the BasicObjectLock to be used for locking,
902 // which must be initialized with the object to lock.
903 // object - Address of the object to be locked.
904 void InterpreterMacroAssembler::lock_object(Register monitor, Register object) {
905
906 if (UseHeavyMonitors) {
907 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter),
908 monitor, /*check_for_exceptions=*/false);
909 return;
910 }
911
912 // template code:
913 //
914 // markOop displaced_header = obj->mark().set_unlocked();
915 // monitor->lock()->set_displaced_header(displaced_header);
|