libNativeCallTest.c revision 12158:0fe2815ffa74
1/* 2 * Copyright (c) 2016, Oracle and/or its affiliates. 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 it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 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 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24#include <stdio.h> 25#include <stdint.h> 26 27#include "jni.h" 28 29#ifdef __cplusplus 30extern "C" { 31#endif 32 33jfloat JNICALL SS(jfloat f1, jfloat f2) { 34 return f1 + f2; 35} 36 37JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getFF(JNIEnv *env, jclass clazz) { 38 return (jlong)(intptr_t)SS; 39} 40 41JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1FF(JNIEnv *env, jclass clazz, jfloat a, jfloat b) { 42 return SS(a, b); 43} 44 45jfloat JNICALL SDILDS(jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { 46 return (jfloat)(a + b + c + d + e + f); 47} 48 49JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getSDILDS(JNIEnv *env, jclass clazz) { 50 return (jlong)(intptr_t)SDILDS; 51} 52 53JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1SDILDS(JNIEnv *env, jclass clazz, 54 jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { 55 return SDILDS(a, b, c, d, e, f); 56} 57 58jfloat JNICALL F32SDILDS(jfloat f00, jfloat f01, jfloat f02, jfloat f03, jfloat f04, jfloat f05, jfloat f06, jfloat f07, 59 jfloat f08, jfloat f09, jfloat f0a, jfloat f0b, jfloat f0c, jfloat f0d, jfloat f0e, jfloat f0f, 60 jfloat f10, jfloat f11, jfloat f12, jfloat f13, jfloat f14, jfloat f15, jfloat f16, jfloat f17, 61 jfloat f18, jfloat f19, jfloat f1a, jfloat f1b, jfloat f1c, jfloat f1d, jfloat f1e, jfloat f1f, 62 jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { 63 return (jfloat)(f00 + f01 + f02 + f03 + f04 + f05 + f06 + f07 + 64 f08 + f09 + f0a + f0b + f0c + f0d + f0e + f0f + 65 f10 + f11 + f12 + f13 + f14 + f15 + f16 + f17 + 66 f18 + f19 + f1a + f1b + f1c + f1d + f1e + f1f + 67 a + b + c + d + e + f); 68} 69 70JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getF32SDILDS(JNIEnv *env, jclass clazz) { 71 return (jlong)(intptr_t)F32SDILDS; 72} 73 74JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1F32SDILDS(JNIEnv *env, jclass clazz, 75 jfloat f00, jfloat f01, jfloat f02, jfloat f03, 76 jfloat f04, jfloat f05, jfloat f06, jfloat f07, 77 jfloat f08, jfloat f09, jfloat f0a, jfloat f0b, 78 jfloat f0c, jfloat f0d, jfloat f0e, jfloat f0f, 79 jfloat f10, jfloat f11, jfloat f12, jfloat f13, 80 jfloat f14, jfloat f15, jfloat f16, jfloat f17, 81 jfloat f18, jfloat f19, jfloat f1a, jfloat f1b, 82 jfloat f1c, jfloat f1d, jfloat f1e, jfloat f1f, 83 jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { 84 return F32SDILDS(f00, f01, f02, f03, f04, f05, f06, f07, 85 f08, f09, f0a, f0b, f0c, f0d, f0e, f0f, 86 f10, f11, f12, f13, f14, f15, f16, f17, 87 f18, f19, f1a, f1b, f1c, f1d, f1e, f1f, 88 a, b, c, d, e, f); 89} 90 91 92jfloat JNICALL D32SDILDS(jdouble d00, jdouble d01, jdouble d02, jdouble d03, jdouble d04, jdouble d05, jdouble d06, jdouble d07, 93 jdouble d08, jdouble d09, jdouble d0a, jdouble d0b, jdouble d0c, jdouble d0d, jdouble d0e, jdouble d0f, 94 jdouble d10, jdouble d11, jdouble d12, jdouble d13, jdouble d14, jdouble d15, jdouble d16, jdouble d17, 95 jdouble d18, jdouble d19, jdouble d1a, jdouble d1b, jdouble d1c, jdouble d1d, jdouble d1e, jdouble d1f, 96 jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { 97 return (jfloat)(d00 + d01 + d02 + d03 + d04 + d05 + d06 + d07 + 98 d08 + d09 + d0a + d0b + d0c + d0d + d0e + d0f + 99 d10 + d11 + d12 + d13 + d14 + d15 + d16 + d17 + 100 d18 + d19 + d1a + d1b + d1c + d1d + d1e + d1f + 101 a + b + c + d + e + f); 102} 103 104JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getD32SDILDS(JNIEnv *env, jclass clazz) { 105 return (jlong)(intptr_t)D32SDILDS; 106} 107 108JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1D32SDILDS(JNIEnv *env, jclass clazz, 109 jdouble d00, jdouble d01, jdouble d02, jdouble d03, 110 jdouble d04, jdouble d05, jdouble d06, jdouble d07, 111 jdouble d08, jdouble d09, jdouble d0a, jdouble d0b, 112 jdouble d0c, jdouble d0d, jdouble d0e, jdouble d0f, 113 jdouble d10, jdouble d11, jdouble d12, jdouble d13, 114 jdouble d14, jdouble d15, jdouble d16, jdouble d17, 115 jdouble d18, jdouble d19, jdouble d1a, jdouble d1b, 116 jdouble d1c, jdouble d1d, jdouble d1e, jdouble d1f, 117 jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { 118 return D32SDILDS(d00, d01, d02, d03, d04, d05, d06, d07, 119 d08, d09, d0a, d0b, d0c, d0d, d0e, d0f, 120 d10, d11, d12, d13, d14, d15, d16, d17, 121 d18, d19, d1a, d1b, d1c, d1d, d1e, d1f, 122 a, b, c, d, e, f); 123} 124 125 126jfloat JNICALL I32SDILDS(jint i00, jint i01, jint i02, jint i03, jint i04, jint i05, jint i06, jint i07, 127 jint i08, jint i09, jint i0a, jint i0b, jint i0c, jint i0d, jint i0e, jint i0f, 128 jint i10, jint i11, jint i12, jint i13, jint i14, jint i15, jint i16, jint i17, 129 jint i18, jint i19, jint i1a, jint i1b, jint i1c, jint i1d, jint i1e, jint i1f, 130 jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { 131 return (jfloat)(i00 + i01 + i02 + i03 + i04 + i05 + i06 + i07 + 132 i08 + i09 + i0a + i0b + i0c + i0d + i0e + i0f + 133 i10 + i11 + i12 + i13 + i14 + i15 + i16 + i17 + 134 i18 + i19 + i1a + i1b + i1c + i1d + i1e + i1f + 135 a + b + c + d + e + f); 136} 137 138JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getI32SDILDS(JNIEnv *env, jclass clazz) { 139 return (jlong) (intptr_t) I32SDILDS; 140} 141 142JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1I32SDILDS(JNIEnv *env, jclass clazz, 143 jint i00, jint i01, jint i02, jint i03, 144 jint i04, jint i05, jint i06, jint i07, 145 jint i08, jint i09, jint i0a, jint i0b, 146 jint i0c, jint i0d, jint i0e, jint i0f, 147 jint i10, jint i11, jint i12, jint i13, 148 jint i14, jint i15, jint i16, jint i17, 149 jint i18, jint i19, jint i1a, jint i1b, 150 jint i1c, jint i1d, jint i1e, jint i1f, 151 jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { 152 return I32SDILDS(i00, i01, i02, i03, i04, i05, i06, i07, 153 i08, i09, i0a, i0b, i0c, i0d, i0e, i0f, 154 i10, i11, i12, i13, i14, i15, i16, i17, 155 i18, i19, i1a, i1b, i1c, i1d, i1e, i1f, 156 a, b, c, d, e, f); 157} 158 159jfloat JNICALL L32SDILDS(jlong l00, jlong l01, jlong l02, jlong l03, jlong l04, jlong l05, jlong l06, jlong l07, 160 jlong l08, jlong l09, jlong l0a, jlong l0b, jlong l0c, jlong l0d, jlong l0e, jlong l0f, 161 jlong l10, jlong l11, jlong l12, jlong l13, jlong l14, jlong l15, jlong l16, jlong l17, 162 jlong l18, jlong l19, jlong l1a, jlong l1b, jlong l1c, jlong l1d, jlong l1e, jlong l1f, 163 jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { 164 return (jfloat)(l00 + l01 + l02 + l03 + l04 + l05 + l06 + l07 + 165 l08 + l09 + l0a + l0b + l0c + l0d + l0e + l0f + 166 l10 + l11 + l12 + l13 + l14 + l15 + l16 + l17 + 167 l18 + l19 + l1a + l1b + l1c + l1d + l1e + l1f + 168 a + b + c + d + e + f); 169} 170 171JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getL32SDILDS(JNIEnv *env, jclass clazz) { 172 return (jlong)(intptr_t)L32SDILDS; 173} 174 175JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1L32SDILDS(JNIEnv *env, jclass clazz, 176 jlong l00, jlong l01, jlong l02, jlong l03, 177 jlong l04, jlong l05, jlong l06, jlong l07, 178 jlong l08, jlong l09, jlong l0a, jlong l0b, 179 jlong l0c, jlong l0d, jlong l0e, jlong l0f, 180 jlong l10, jlong l11, jlong l12, jlong l13, 181 jlong l14, jlong l15, jlong l16, jlong l17, 182 jlong l18, jlong l19, jlong l1a, jlong l1b, 183 jlong l1c, jlong l1d, jlong l1e, jlong l1f, 184 jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) { 185 return L32SDILDS(l00, l01, l02, l03, l04, l05, l06, l07, 186 l08, l09, l0a, l0b, l0c, l0d, l0e, l0f, 187 l10, l11, l12, l13, l14, l15, l16, l17, 188 l18, l19, l1a, l1b, l1c, l1d, l1e, l1f, 189 a, b, c, d, e, f); 190} 191 192#ifdef __cplusplus 193} 194#endif 195 196