annotate src/hotspot/cpu/s390/interpreterRT_s390.cpp @ 49945:d7df2dd501ce

8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files Summary: Remove frame.inline.hpp,etc from header files and adjust transitive includes. Reviewed-by: stefank, stuefe
author coleenp
date Wed, 21 Mar 2018 19:45:24 -0400
parents ef5d5d343e2a
children 5df03f58d25b
rev   line source
goetz@42065 1 /*
stefank@49824 2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
goetz@42065 3 * Copyright (c) 2016 SAP SE. All rights reserved.
goetz@42065 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
goetz@42065 5 *
goetz@42065 6 * This code is free software; you can redistribute it and/or modify it
goetz@42065 7 * under the terms of the GNU General Public License version 2 only, as
goetz@42065 8 * published by the Free Software Foundation.
goetz@42065 9 *
goetz@42065 10 * This code is distributed in the hope that it will be useful, but WITHOUT
goetz@42065 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
goetz@42065 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
goetz@42065 13 * version 2 for more details (a copy is included in the LICENSE file that
goetz@42065 14 * accompanied this code).
goetz@42065 15 *
goetz@42065 16 * You should have received a copy of the GNU General Public License version
goetz@42065 17 * 2 along with this work; if not, write to the Free Software Foundation,
goetz@42065 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
goetz@42065 19 *
goetz@42065 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
goetz@42065 21 * or visit www.oracle.com if you need additional information or have any
goetz@42065 22 * questions.
goetz@42065 23 *
goetz@42065 24 */
goetz@42065 25
goetz@42065 26 #include "precompiled.hpp"
goetz@42065 27 #include "asm/macroAssembler.inline.hpp"
coleenp@49945 28 #include "interpreter/interp_masm.hpp"
goetz@42065 29 #include "interpreter/interpreter.hpp"
goetz@42065 30 #include "interpreter/interpreterRuntime.hpp"
goetz@42065 31 #include "memory/allocation.inline.hpp"
stefank@49824 32 #include "memory/universe.hpp"
goetz@42065 33 #include "oops/oop.inline.hpp"
goetz@42065 34 #include "runtime/handles.inline.hpp"
goetz@42065 35 #include "runtime/icache.hpp"
coleenp@49914 36 #include "runtime/interfaceSupport.inline.hpp"
goetz@42065 37 #include "runtime/signature.hpp"
goetz@42065 38
goetz@42065 39 // Access macros for Java and C arguments.
goetz@42065 40 // First Java argument is at index-1.
goetz@42065 41 #define locals_j_arg_at(index) Address(Z_R1/*locals*/, in_ByteSize((-(index)*wordSize)))
goetz@42065 42
goetz@42065 43 #define __ _masm->
goetz@42065 44
goetz@42065 45 static int sp_c_int_arg_offset(int arg_nr, int fp_arg_nr) {
goetz@42065 46 int int_arg_nr = arg_nr-fp_arg_nr;
goetz@42065 47
goetz@42065 48 // arg_nr, fp_arg_nr start with 1 => int_arg_nr starts with 0
goetz@42065 49 if (int_arg_nr < 5) {
goetz@42065 50 return int_arg_nr * wordSize + _z_abi(carg_1);
goetz@42065 51 }
goetz@42065 52 int offset = int_arg_nr - 5 + (fp_arg_nr > 4 ? fp_arg_nr - 4 : 0);
goetz@42065 53 return offset * wordSize + _z_abi(remaining_cargs);
goetz@42065 54 }
goetz@42065 55
goetz@42065 56 static int sp_c_fp_arg_offset(int arg_nr, int fp_arg_nr) {
goetz@42065 57 int int_arg_nr = arg_nr-fp_arg_nr;
goetz@42065 58
goetz@42065 59 // Arg_nr, fp_arg_nr start with 1 => int_arg_nr starts with 0.
goetz@42065 60 if (fp_arg_nr < 5) {
goetz@42065 61 return (fp_arg_nr - 1 ) * wordSize + _z_abi(cfarg_1);
goetz@42065 62 }
goetz@42065 63 int offset = fp_arg_nr - 5 + (int_arg_nr > 4 ? int_arg_nr - 4 : 0);
goetz@42065 64 return offset * wordSize + _z_abi(remaining_cargs);
goetz@42065 65 }
goetz@42065 66
goetz@42065 67 // Implementation of SignatureHandlerGenerator
coleenp@49945 68 InterpreterRuntime::SignatureHandlerGenerator::SignatureHandlerGenerator(
coleenp@49945 69 const methodHandle& method, CodeBuffer* buffer) : NativeSignatureIterator(method) {
coleenp@49945 70 _masm = new MacroAssembler(buffer);
coleenp@49945 71 _fp_arg_nr = 0;
coleenp@49945 72 }
goetz@42065 73
goetz@42065 74 void InterpreterRuntime::SignatureHandlerGenerator::pass_int() {
goetz@42065 75 int int_arg_nr = jni_offset() - _fp_arg_nr;
goetz@42065 76 Register r = (int_arg_nr < 5 /*max_int_register_arguments*/) ?
goetz@42065 77 as_Register(int_arg_nr) + Z_ARG1->encoding() : Z_R0;
goetz@42065 78
goetz@42065 79 __ z_lgf(r, locals_j_arg_at(offset()));
goetz@42065 80 if (DEBUG_ONLY(true ||) int_arg_nr >= 5) {
goetz@42065 81 __ z_stg(r, sp_c_int_arg_offset(jni_offset(), _fp_arg_nr), Z_SP);
goetz@42065 82 }
goetz@42065 83 }
goetz@42065 84
goetz@42065 85 void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
goetz@42065 86 int int_arg_nr = jni_offset() - _fp_arg_nr;
goetz@42065 87 Register r = (int_arg_nr < 5 /*max_int_register_arguments*/) ?
goetz@42065 88 as_Register(int_arg_nr) + Z_ARG1->encoding() : Z_R0;
goetz@42065 89
goetz@42065 90 __ z_lg(r, locals_j_arg_at(offset() + 1)); // Long resides in upper slot.
goetz@42065 91 if (DEBUG_ONLY(true ||) int_arg_nr >= 5) {
goetz@42065 92 __ z_stg(r, sp_c_int_arg_offset(jni_offset(), _fp_arg_nr), Z_SP);
goetz@42065 93 }
goetz@42065 94 }
goetz@42065 95
goetz@42065 96 void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
goetz@42065 97 FloatRegister fp_reg = (_fp_arg_nr < 4/*max_fp_register_arguments*/) ?
goetz@42065 98 as_FloatRegister((_fp_arg_nr * 2) + Z_FARG1->encoding()) : Z_F1;
goetz@42065 99 _fp_arg_nr++;
goetz@42065 100 __ z_ley(fp_reg, locals_j_arg_at(offset()));
goetz@42065 101 if (DEBUG_ONLY(true ||) _fp_arg_nr > 4) {
goetz@42065 102 __ z_ste(fp_reg, sp_c_fp_arg_offset(jni_offset(), _fp_arg_nr) + 4, Z_SP);
goetz@42065 103 }
goetz@42065 104 }
goetz@42065 105
goetz@42065 106 void InterpreterRuntime::SignatureHandlerGenerator::pass_double() {
goetz@42065 107 FloatRegister fp_reg = (_fp_arg_nr < 4/*max_fp_register_arguments*/) ?
goetz@42065 108 as_FloatRegister((_fp_arg_nr*2) + Z_FARG1->encoding()) : Z_F1;
goetz@42065 109 _fp_arg_nr++;
goetz@42065 110 __ z_ldy(fp_reg, locals_j_arg_at(offset()+1));
goetz@42065 111 if (DEBUG_ONLY(true ||) _fp_arg_nr > 4) {
goetz@42065 112 __ z_std(fp_reg, sp_c_fp_arg_offset(jni_offset(), _fp_arg_nr), Z_SP);
goetz@42065 113 }
goetz@42065 114 }
goetz@42065 115
goetz@42065 116 void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
goetz@42065 117 int int_arg_nr = jni_offset() - _fp_arg_nr;
goetz@42065 118 Register r = (int_arg_nr < 5 /*max_int_register_arguments*/) ?
goetz@42065 119 as_Register(int_arg_nr) + Z_ARG1->encoding() : Z_R0;
goetz@42065 120
goetz@42065 121 // The handle for a receiver will never be null.
goetz@42065 122 bool do_NULL_check = offset() != 0 || is_static();
goetz@42065 123
goetz@42065 124 Label do_null;
goetz@42065 125 if (do_NULL_check) {
goetz@42065 126 __ clear_reg(r, true, false);
goetz@42065 127 __ load_and_test_long(Z_R0, locals_j_arg_at(offset()));
goetz@42065 128 __ z_bre(do_null);
goetz@42065 129 }
goetz@42065 130 __ add2reg(r, -offset() * wordSize, Z_R1 /* locals */);
goetz@42065 131 __ bind(do_null);
goetz@42065 132 if (DEBUG_ONLY(true ||) int_arg_nr >= 5) {
goetz@42065 133 __ z_stg(r, sp_c_int_arg_offset(jni_offset(), _fp_arg_nr), Z_SP);
goetz@42065 134 }
goetz@42065 135 }
goetz@42065 136
goetz@42065 137
goetz@42065 138 void InterpreterRuntime::SignatureHandlerGenerator::generate(uint64_t fingerprint) {
goetz@42065 139 __ z_lgr(Z_R1, Z_ARG1); // Z_R1 is used in locals_j_arg_at(index) macro.
goetz@42065 140
goetz@42065 141 // Generate code to handle arguments.
goetz@42065 142 iterate(fingerprint);
goetz@42065 143 __ load_const_optimized(Z_RET, AbstractInterpreter::result_handler(method()->result_type()));
goetz@42065 144 __ z_br(Z_R14);
goetz@42065 145 __ flush();
goetz@42065 146 }
goetz@42065 147
goetz@42065 148 #undef __
goetz@42065 149
goetz@42065 150 // Implementation of SignatureHandlerLibrary
goetz@42065 151
goetz@42065 152 void SignatureHandlerLibrary::pd_set_handler(address handler) {}
goetz@42065 153
goetz@42065 154 IRT_ENTRY(address, InterpreterRuntime::get_signature(JavaThread* thread, Method* method))
goetz@42065 155 methodHandle m(thread, method);
goetz@42065 156 assert(m->is_native(), "sanity check");
goetz@42065 157 Symbol *s = m->signature();
goetz@42065 158 return (address) s->base();
goetz@42065 159 IRT_END
goetz@42065 160
goetz@42065 161 IRT_ENTRY(address, InterpreterRuntime::get_result_handler(JavaThread* thread, Method* method))
goetz@42065 162 methodHandle m(thread, method);
goetz@42065 163 assert(m->is_native(), "sanity check");
goetz@42065 164 return AbstractInterpreter::result_handler(m->result_type());
goetz@42065 165 IRT_END