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 
  25 #include <stdio.h>
  26 #include <stdint.h>
  27 
  28 #include "jni.h"
  29 
  30 #ifdef __cplusplus
  31 extern "C" {
  32 #endif
  33 
  34 jfloat JNICALL SS(jfloat f1, jfloat f2) {
  35   return f1 + f2;
  36 }
  37 
  38 JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getFF(JNIEnv *env, jclass clazz) {
  39   return (jlong)(intptr_t)SS;
  40 }
  41 
  42 JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1FF(JNIEnv *env, jclass clazz, jfloat a, jfloat b) {
  43   return SS(a, b);
  44 }
  45 
  46 jfloat JNICALL SDILDS(jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
  47   return (jfloat)(a + b + c + d + e + f);
  48 }
  49 
  50 JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getSDILDS(JNIEnv *env, jclass clazz) {
  51   return (jlong)(intptr_t)SDILDS;
  52 }
  53 
  54 JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1SDILDS(JNIEnv *env, jclass clazz,
  55                                                                           jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
  56   return SDILDS(a, b, c, d, e, f);
  57 }
  58 
  59 jfloat JNICALL F32SDILDS(jfloat f00, jfloat f01, jfloat f02, jfloat f03, jfloat f04, jfloat f05, jfloat f06, jfloat f07,
  60                          jfloat f08, jfloat f09, jfloat f0a, jfloat f0b, jfloat f0c, jfloat f0d, jfloat f0e, jfloat f0f,
  61                          jfloat f10, jfloat f11, jfloat f12, jfloat f13, jfloat f14, jfloat f15, jfloat f16, jfloat f17,
  62                          jfloat f18, jfloat f19, jfloat f1a, jfloat f1b, jfloat f1c, jfloat f1d, jfloat f1e, jfloat f1f,
  63                          jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
  64   return (jfloat)(f00 + f01 + f02 + f03 + f04 + f05 + f06 + f07 +
  65                   f08 + f09 + f0a + f0b + f0c + f0d + f0e + f0f +
  66                   f10 + f11 + f12 + f13 + f14 + f15 + f16 + f17 +
  67                   f18 + f19 + f1a + f1b + f1c + f1d + f1e + f1f +
  68                   a +   b +   c +   d +   e + f);
  69 }
  70 
  71 JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getF32SDILDS(JNIEnv *env, jclass clazz) {
  72   return (jlong)(intptr_t)F32SDILDS;
  73 }
  74 
  75 JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1F32SDILDS(JNIEnv *env, jclass clazz,
  76                                                                              jfloat f00, jfloat f01, jfloat f02, jfloat f03,
  77                                                                              jfloat f04, jfloat f05, jfloat f06, jfloat f07,
  78                                                                              jfloat f08, jfloat f09, jfloat f0a, jfloat f0b,
  79                                                                              jfloat f0c, jfloat f0d, jfloat f0e, jfloat f0f,
  80                                                                              jfloat f10, jfloat f11, jfloat f12, jfloat f13,
  81                                                                              jfloat f14, jfloat f15, jfloat f16, jfloat f17,
  82                                                                              jfloat f18, jfloat f19, jfloat f1a, jfloat f1b,
  83                                                                              jfloat f1c, jfloat f1d, jfloat f1e, jfloat f1f,
  84                                                                              jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
  85   return F32SDILDS(f00, f01, f02, f03, f04, f05, f06, f07,
  86                    f08, f09, f0a, f0b, f0c, f0d, f0e, f0f,
  87                    f10, f11, f12, f13, f14, f15, f16, f17,
  88                    f18, f19, f1a, f1b, f1c, f1d, f1e, f1f,
  89                    a,   b,   c,   d,   e,   f);
  90 }
  91 
  92 
  93 jfloat JNICALL D32SDILDS(jdouble d00, jdouble d01, jdouble d02, jdouble d03, jdouble d04, jdouble d05, jdouble d06, jdouble d07,
  94                          jdouble d08, jdouble d09, jdouble d0a, jdouble d0b, jdouble d0c, jdouble d0d, jdouble d0e, jdouble d0f,
  95                          jdouble d10, jdouble d11, jdouble d12, jdouble d13, jdouble d14, jdouble d15, jdouble d16, jdouble d17,
  96                          jdouble d18, jdouble d19, jdouble d1a, jdouble d1b, jdouble d1c, jdouble d1d, jdouble d1e, jdouble d1f,
  97                          jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
  98   return (jfloat)(d00 + d01 + d02 + d03 + d04 + d05 + d06 + d07 +
  99                   d08 + d09 + d0a + d0b + d0c + d0d + d0e + d0f +
 100                   d10 + d11 + d12 + d13 + d14 + d15 + d16 + d17 +
 101                   d18 + d19 + d1a + d1b + d1c + d1d + d1e + d1f +
 102                   a +   b +   c +   d +   e + f);
 103 }
 104 
 105 JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getD32SDILDS(JNIEnv *env, jclass clazz) {
 106   return (jlong)(intptr_t)D32SDILDS;
 107 }
 108 
 109 JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1D32SDILDS(JNIEnv *env, jclass clazz,
 110                                                                              jdouble d00, jdouble d01, jdouble d02, jdouble d03,
 111                                                                              jdouble d04, jdouble d05, jdouble d06, jdouble d07,
 112                                                                              jdouble d08, jdouble d09, jdouble d0a, jdouble d0b,
 113                                                                              jdouble d0c, jdouble d0d, jdouble d0e, jdouble d0f,
 114                                                                              jdouble d10, jdouble d11, jdouble d12, jdouble d13,
 115                                                                              jdouble d14, jdouble d15, jdouble d16, jdouble d17,
 116                                                                              jdouble d18, jdouble d19, jdouble d1a, jdouble d1b,
 117                                                                              jdouble d1c, jdouble d1d, jdouble d1e, jdouble d1f,
 118                                                                              jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
 119   return D32SDILDS(d00, d01, d02, d03, d04, d05, d06, d07,
 120                    d08, d09, d0a, d0b, d0c, d0d, d0e, d0f,
 121                    d10, d11, d12, d13, d14, d15, d16, d17,
 122                    d18, d19, d1a, d1b, d1c, d1d, d1e, d1f,
 123                    a,   b,   c,   d,   e,   f);
 124 }
 125 
 126 
 127 jfloat JNICALL I32SDILDS(jint i00, jint i01, jint i02, jint i03, jint i04, jint i05, jint i06, jint i07,
 128                          jint i08, jint i09, jint i0a, jint i0b, jint i0c, jint i0d, jint i0e, jint i0f,
 129                          jint i10, jint i11, jint i12, jint i13, jint i14, jint i15, jint i16, jint i17,
 130                          jint i18, jint i19, jint i1a, jint i1b, jint i1c, jint i1d, jint i1e, jint i1f,
 131                          jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
 132   return (jfloat)(i00 + i01 + i02 + i03 + i04 + i05 + i06 + i07 +
 133                   i08 + i09 + i0a + i0b + i0c + i0d + i0e + i0f +
 134                   i10 + i11 + i12 + i13 + i14 + i15 + i16 + i17 +
 135                   i18 + i19 + i1a + i1b + i1c + i1d + i1e + i1f +
 136                   a +   b +   c +   d +   e + f);
 137 }
 138 
 139 JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getI32SDILDS(JNIEnv *env, jclass clazz) {
 140   return (jlong) (intptr_t) I32SDILDS;
 141 }
 142 
 143 JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1I32SDILDS(JNIEnv *env, jclass clazz,
 144                                                                              jint i00, jint i01, jint i02, jint i03,
 145                                                                              jint i04, jint i05, jint i06, jint i07,
 146                                                                              jint i08, jint i09, jint i0a, jint i0b,
 147                                                                              jint i0c, jint i0d, jint i0e, jint i0f,
 148                                                                              jint i10, jint i11, jint i12, jint i13,
 149                                                                              jint i14, jint i15, jint i16, jint i17,
 150                                                                              jint i18, jint i19, jint i1a, jint i1b,
 151                                                                              jint i1c, jint i1d, jint i1e, jint i1f,
 152                                                                              jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
 153   return I32SDILDS(i00, i01, i02, i03, i04, i05, i06, i07,
 154                    i08, i09, i0a, i0b, i0c, i0d, i0e, i0f,
 155                    i10, i11, i12, i13, i14, i15, i16, i17,
 156                    i18, i19, i1a, i1b, i1c, i1d, i1e, i1f,
 157                    a,   b,   c,   d,   e,   f);
 158 }
 159 
 160 jfloat JNICALL L32SDILDS(jlong l00, jlong l01, jlong l02, jlong l03, jlong l04, jlong l05, jlong l06, jlong l07,
 161                          jlong l08, jlong l09, jlong l0a, jlong l0b, jlong l0c, jlong l0d, jlong l0e, jlong l0f,
 162                          jlong l10, jlong l11, jlong l12, jlong l13, jlong l14, jlong l15, jlong l16, jlong l17,
 163                          jlong l18, jlong l19, jlong l1a, jlong l1b, jlong l1c, jlong l1d, jlong l1e, jlong l1f,
 164                          jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
 165   return (jfloat)(l00 + l01 + l02 + l03 + l04 + l05 + l06 + l07 +
 166                   l08 + l09 + l0a + l0b + l0c + l0d + l0e + l0f +
 167                   l10 + l11 + l12 + l13 + l14 + l15 + l16 + l17 +
 168                   l18 + l19 + l1a + l1b + l1c + l1d + l1e + l1f +
 169                   a +   b +   c +   d +   e + f);
 170 }
 171 
 172 JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getL32SDILDS(JNIEnv *env, jclass clazz) {
 173   return (jlong)(intptr_t)L32SDILDS;
 174 }
 175 
 176 JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1L32SDILDS(JNIEnv *env, jclass clazz,
 177                                                                                jlong l00, jlong l01, jlong l02, jlong l03,
 178                                                                                jlong l04, jlong l05, jlong l06, jlong l07,
 179                                                                                jlong l08, jlong l09, jlong l0a, jlong l0b,
 180                                                                                jlong l0c, jlong l0d, jlong l0e, jlong l0f,
 181                                                                                jlong l10, jlong l11, jlong l12, jlong l13,
 182                                                                                jlong l14, jlong l15, jlong l16, jlong l17,
 183                                                                                jlong l18, jlong l19, jlong l1a, jlong l1b,
 184                                                                                jlong l1c, jlong l1d, jlong l1e, jlong l1f,
 185                                                                                jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
 186   return L32SDILDS(l00, l01, l02, l03, l04, l05, l06, l07,
 187                    l08, l09, l0a, l0b, l0c, l0d, l0e, l0f,
 188                    l10, l11, l12, l13, l14, l15, l16, l17,
 189                    l18, l19, l1a, l1b, l1c, l1d, l1e, l1f,
 190                    a,   b,   c,   d,   e,   f);
 191 }
 192 
 193 #ifdef __cplusplus
 194 }
 195 #endif
 196