hotspot/src/cpu/s390/vm/sharedRuntime_s390.cpp
changeset 46726 7801367e3cc9
parent 46721 5ea48e85ca90
--- a/hotspot/src/cpu/s390/vm/sharedRuntime_s390.cpp	Fri Jul 21 12:43:47 2017 +0200
+++ b/hotspot/src/cpu/s390/vm/sharedRuntime_s390.cpp	Thu Jul 27 15:36:15 2017 +0200
@@ -312,7 +312,13 @@
   __ save_return_pc(return_pc);
 
   // Push a new frame (includes stack linkage).
-  __ push_frame(frame_size_in_bytes);
+  // use return_pc as scratch for push_frame. Z_R0_scratch (the default) and Z_R1_scratch are
+  // illegally used to pass parameters (SAPJVM extension) by RangeCheckStub::emit_code().
+  __ push_frame(frame_size_in_bytes, return_pc);
+  // We have to restore return_pc right away.
+  // Nobody else will. Furthermore, return_pc isn't necessarily the default (Z_R14).
+  // Nobody else knows which register we saved.
+  __ z_lg(return_pc, _z_abi16(return_pc) + frame_size_in_bytes, Z_SP);
 
   // Register save area in new frame starts above z_abi_160 area.
   int offset = register_save_offset;