Path: blob/master/src/hotspot/cpu/s390/assembler_s390.cpp
40930 views
/*1* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.2* Copyright (c) 2016 SAP SE. All rights reserved.3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4*5* This code is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#include "precompiled.hpp"26#include "asm/assembler.inline.hpp"27#include "compiler/disassembler.hpp"28#include "gc/shared/collectedHeap.inline.hpp"29#include "interpreter/interpreter.hpp"30#include "gc/shared/cardTableBarrierSet.hpp"31#include "memory/resourceArea.hpp"32#include "prims/methodHandles.hpp"33#include "runtime/biasedLocking.hpp"34#include "runtime/interfaceSupport.inline.hpp"35#include "runtime/objectMonitor.hpp"36#include "runtime/os.hpp"37#include "runtime/sharedRuntime.hpp"38#include "runtime/stubRoutines.hpp"39#include "utilities/macros.hpp"4041// Convention: Use Z_R0 and Z_R1 instead of Z_scratch_* in all42// assembler_s390.* files.4344// Convert the raw encoding form into the form expected by the45// constructor for Address. This is called by adlc generated code.46Address Address::make_raw(int base, int index, int scale, int disp, relocInfo::relocType disp_reloc) {47assert(scale == 0, "Scale should not be used on z/Architecture. The call to make_raw is "48"generated by adlc and this must mirror all features of Operands from machnode.hpp.");49assert(disp_reloc == relocInfo::none, "not implemented on z/Architecture.");5051Address madr(as_Register(base), as_Register(index), in_ByteSize(disp));52return madr;53}5455int AbstractAssembler::code_fill_byte() {56return 0x00; // Illegal instruction 0x00000000.57}5859// Condition code masks. Details see enum branch_condition.60// Although this method is meant for INT CCs, the Overflow/Ordered61// bit in the masks has to be considered. The CC might have been set62// by a float operation, but is evaluated while calculating an integer63// result. See elementary test TestFloat.isNotEqual(FF)Z for example.64Assembler::branch_condition Assembler::inverse_condition(Assembler::branch_condition cc) {65Assembler::branch_condition unordered_bit = (Assembler::branch_condition)(cc & bcondNotOrdered);66Assembler::branch_condition inverse_cc;6768// Some are commented out to avoid duplicate labels.69switch (cc) {70case bcondNever : inverse_cc = bcondAlways; break; // 0 -> 1571case bcondAlways : inverse_cc = bcondNever; break; // 15 -> 07273case bcondOverflow : inverse_cc = bcondNotOverflow; break; // 1 -> 1474case bcondNotOverflow : inverse_cc = bcondOverflow; break; // 14 -> 17576default :77switch ((Assembler::branch_condition)(cc & bcondOrdered)) {78case bcondEqual : inverse_cc = bcondNotEqual; break; // 8 -> 679// case bcondZero :80// case bcondAllZero :8182case bcondNotEqual : inverse_cc = bcondEqual; break; // 6 -> 883// case bcondNotZero :84// case bcondMixed :8586case bcondLow : inverse_cc = bcondNotLow; break; // 4 -> 1087// case bcondNegative :8889case bcondNotLow : inverse_cc = bcondLow; break; // 10 -> 490// case bcondNotNegative :9192case bcondHigh : inverse_cc = bcondNotHigh; break; // 2 -> 1293// case bcondPositive :9495case bcondNotHigh : inverse_cc = bcondHigh; break; // 12 -> 296// case bcondNotPositive :9798default :99fprintf(stderr, "inverse_condition(%d)\n", (int)cc);100fflush(stderr);101ShouldNotReachHere();102return bcondNever;103}104// If cc is even, inverse_cc must be odd.105if (!unordered_bit) {106inverse_cc = (Assembler::branch_condition)(inverse_cc | bcondNotOrdered);107}108break;109}110return inverse_cc;111}112113Assembler::branch_condition Assembler::inverse_float_condition(Assembler::branch_condition cc) {114Assembler::branch_condition inverse_cc;115116switch (cc) {117case bcondNever : inverse_cc = bcondAlways; break; // 0118case bcondAlways : inverse_cc = bcondNever; break; // 15119120case bcondNotOrdered : inverse_cc = bcondOrdered; break; // 14121case bcondOrdered : inverse_cc = bcondNotOrdered; break; // 1122123case bcondEqual : inverse_cc = bcondNotEqualOrNotOrdered; break; // 8124case bcondNotEqualOrNotOrdered : inverse_cc = bcondEqual; break; // 7125126case bcondLowOrNotOrdered : inverse_cc = bcondNotLow; break; // 5127case bcondNotLow : inverse_cc = bcondLowOrNotOrdered; break; // 10128129case bcondHigh : inverse_cc = bcondNotHighOrNotOrdered; break; // 2130case bcondNotHighOrNotOrdered : inverse_cc = bcondHigh; break; // 13131132default :133fprintf(stderr, "inverse_float_condition(%d)\n", (int)cc);134fflush(stderr);135ShouldNotReachHere();136return bcondNever;137}138return inverse_cc;139}140141#ifdef ASSERT142void Assembler::print_dbg_msg(outputStream* out, unsigned long inst, const char* msg, int ilen) {143out->flush();144switch (ilen) {145case 2: out->print_cr("inst = %4.4x, %s", (unsigned short)inst, msg); break;146case 4: out->print_cr("inst = %8.8x, %s\n", (unsigned int)inst, msg); break;147case 6: out->print_cr("inst = %12.12lx, %s\n", inst, msg); break;148default: out->print_cr("inst = %16.16lx, %s\n", inst, msg); break;149}150out->flush();151}152153void Assembler::dump_code_range(outputStream* out, address pc, const unsigned int range, const char* msg) {154out->cr();155out->print_cr("-------------------------------");156out->print_cr("-- %s", msg);157out->print_cr("-------------------------------");158out->print_cr("Hex dump of +/-%d bytes around %p, interval [%p,%p)", range, pc, pc-range, pc+range);159os::print_hex_dump(out, pc-range, pc+range, 2);160161out->cr();162out->print_cr("Disassembly of +/-%d bytes around %p, interval [%p,%p)", range, pc, pc-range, pc+range);163Disassembler::decode(pc, pc + range, out);164}165#endif166167168