1 /*
2 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2016, 2017 SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
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
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
297 break;
298 case all_integer_registers:
299 regstosave_num = sizeof(RegisterSaver_LiveIntRegs)/sizeof(RegisterSaver::LiveRegType);
300 live_regs = RegisterSaver_LiveIntRegs;
301 break;
302 case all_volatile_registers:
303 regstosave_num = sizeof(RegisterSaver_LiveVolatileRegs)/sizeof(RegisterSaver::LiveRegType);
304 live_regs = RegisterSaver_LiveVolatileRegs;
305 break;
306 case arg_registers:
307 regstosave_num = sizeof(RegisterSaver_LiveArgRegs)/sizeof(RegisterSaver::LiveRegType);;
308 live_regs = RegisterSaver_LiveArgRegs;
309 break;
310 default: ShouldNotReachHere();
311 }
312
313 // Save return pc in old frame.
314 __ save_return_pc(return_pc);
315
316 // Push a new frame (includes stack linkage).
317 // use return_pc as scratch for push_frame. Z_R0_scratch (the default) and Z_R1_scratch are
318 // illegally used to pass parameters (SAPJVM extension) by RangeCheckStub::emit_code().
319 __ push_frame(frame_size_in_bytes, return_pc);
320 // We have to restore return_pc right away.
321 // Nobody else will. Furthermore, return_pc isn't necessarily the default (Z_R14).
322 // Nobody else knows which register we saved.
323 __ z_lg(return_pc, _z_abi16(return_pc) + frame_size_in_bytes, Z_SP);
324
325 // Register save area in new frame starts above z_abi_160 area.
326 int offset = register_save_offset;
327
328 Register first = noreg;
329 Register last = noreg;
330 int first_offset = -1;
331 bool float_spilled = false;
332
333 for (int i = 0; i < regstosave_num; i++, offset += reg_size) {
334 int reg_num = live_regs[i].reg_num;
335 int reg_type = live_regs[i].reg_type;
336
337 switch (reg_type) {
338 case RegisterSaver::int_reg: {
|
1 /*
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2016, 2018 SAP SE. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
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
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
297 break;
298 case all_integer_registers:
299 regstosave_num = sizeof(RegisterSaver_LiveIntRegs)/sizeof(RegisterSaver::LiveRegType);
300 live_regs = RegisterSaver_LiveIntRegs;
301 break;
302 case all_volatile_registers:
303 regstosave_num = sizeof(RegisterSaver_LiveVolatileRegs)/sizeof(RegisterSaver::LiveRegType);
304 live_regs = RegisterSaver_LiveVolatileRegs;
305 break;
306 case arg_registers:
307 regstosave_num = sizeof(RegisterSaver_LiveArgRegs)/sizeof(RegisterSaver::LiveRegType);;
308 live_regs = RegisterSaver_LiveArgRegs;
309 break;
310 default: ShouldNotReachHere();
311 }
312
313 // Save return pc in old frame.
314 __ save_return_pc(return_pc);
315
316 // Push a new frame (includes stack linkage).
317 // Use return_pc as scratch for push_frame. Z_R0_scratch (the default) and Z_R1_scratch are
318 // illegally used to pass parameters by RangeCheckStub::emit_code().
319 __ push_frame(frame_size_in_bytes, return_pc);
320 // We have to restore return_pc right away.
321 // Nobody else will. Furthermore, return_pc isn't necessarily the default (Z_R14).
322 // Nobody else knows which register we saved.
323 __ z_lg(return_pc, _z_abi16(return_pc) + frame_size_in_bytes, Z_SP);
324
325 // Register save area in new frame starts above z_abi_160 area.
326 int offset = register_save_offset;
327
328 Register first = noreg;
329 Register last = noreg;
330 int first_offset = -1;
331 bool float_spilled = false;
332
333 for (int i = 0; i < regstosave_num; i++, offset += reg_size) {
334 int reg_num = live_regs[i].reg_num;
335 int reg_type = live_regs[i].reg_type;
336
337 switch (reg_type) {
338 case RegisterSaver::int_reg: {
|