1 /* tests/native/testarguments.c - tests argument passing
3 Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 Contact: cacao@cacaojvm.org
27 Authors: Christian Thalinger
29 $Id: testarguments.c 4357 2006-01-22 23:33:38Z twisti $
37 #include "native/jni.h"
40 JNIEXPORT void JNICALL Java_testarguments_nisub(JNIEnv *env, jclass clazz, jint a, jint b, jint c, jint d, jint e, jint f, jint g, jint h, jint i, jint j, jint k, jint l, jint m, jint n, jint o)
44 printf("java-native: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
47 mid = (*env)->GetStaticMethodID(env, clazz, "jisub", "(IIIIIIIIIIIIIII)V");
50 printf("native: couldn't find jisub\n");
54 (*env)->CallStaticVoidMethod(env, clazz, mid, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
58 JNIEXPORT void JNICALL Java_testarguments_nlsub(JNIEnv *env, jclass clazz, jlong a, jlong b, jlong c, jlong d, jlong e, jlong f, jlong g, jlong h, jlong i, jlong j, jlong k, jlong l, jlong m, jlong n, jlong o)
62 #if SIZEOF_VOID_P == 4
63 printf("java-native: 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx\n", a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
65 printf("java-native: 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
69 mid = (*env)->GetStaticMethodID(env, clazz, "jlsub", "(JJJJJJJJJJJJJJJ)V");
72 printf("native: couldn't find jlsub\n");
76 (*env)->CallStaticVoidMethod(env, clazz, mid, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
80 JNIEXPORT void JNICALL Java_testarguments_nfsub(JNIEnv *env, jclass clazz, jfloat a, jfloat b, jfloat c, jfloat d, jfloat e, jfloat f, jfloat g, jfloat h, jfloat i, jfloat j, jfloat k, jfloat l, jfloat m, jfloat n, jfloat o)
88 printf("java-native:");
90 x.f = a; printf(" 0x%x", x.i);
91 x.f = b; printf(" 0x%x", x.i);
92 x.f = c; printf(" 0x%x", x.i);
93 x.f = d; printf(" 0x%x", x.i);
94 x.f = e; printf(" 0x%x", x.i);
95 x.f = f; printf(" 0x%x", x.i);
96 x.f = g; printf(" 0x%x", x.i);
97 x.f = h; printf(" 0x%x", x.i);
98 x.f = i; printf(" 0x%x", x.i);
99 x.f = j; printf(" 0x%x", x.i);
100 x.f = k; printf(" 0x%x", x.i);
101 x.f = l; printf(" 0x%x", x.i);
102 x.f = m; printf(" 0x%x", x.i);
103 x.f = n; printf(" 0x%x", x.i);
104 x.f = o; printf(" 0x%x", x.i);
109 mid = (*env)->GetStaticMethodID(env, clazz, "jfsub", "(FFFFFFFFFFFFFFF)V");
112 printf("native: couldn't find jfsub\n");
116 (*env)->CallStaticVoidMethod(env, clazz, mid, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
120 JNIEXPORT void JNICALL Java_testarguments_ndsub(JNIEnv *env, jclass clazz, jdouble a, jdouble b, jdouble c, jdouble d, jdouble e, jdouble f, jdouble g, jdouble h, jdouble i, jdouble j, jdouble k, jdouble l, jdouble m, jdouble n, jdouble o)
128 printf("java-native:");
130 #if SIZEOF_VOID_P == 4
131 x.d = a; printf(" 0x%llx", x.l);
132 x.d = b; printf(" 0x%llx", x.l);
133 x.d = c; printf(" 0x%llx", x.l);
134 x.d = d; printf(" 0x%llx", x.l);
135 x.d = e; printf(" 0x%llx", x.l);
136 x.d = f; printf(" 0x%llx", x.l);
137 x.d = g; printf(" 0x%llx", x.l);
138 x.d = h; printf(" 0x%llx", x.l);
139 x.d = i; printf(" 0x%llx", x.l);
140 x.d = j; printf(" 0x%llx", x.l);
141 x.d = k; printf(" 0x%llx", x.l);
142 x.d = l; printf(" 0x%llx", x.l);
143 x.d = m; printf(" 0x%llx", x.l);
144 x.d = n; printf(" 0x%llx", x.l);
145 x.d = o; printf(" 0x%llx", x.l);
147 x.d = a; printf(" 0x%lx", x.l);
148 x.d = b; printf(" 0x%lx", x.l);
149 x.d = c; printf(" 0x%lx", x.l);
150 x.d = d; printf(" 0x%lx", x.l);
151 x.d = e; printf(" 0x%lx", x.l);
152 x.d = f; printf(" 0x%lx", x.l);
153 x.d = g; printf(" 0x%lx", x.l);
154 x.d = h; printf(" 0x%lx", x.l);
155 x.d = i; printf(" 0x%lx", x.l);
156 x.d = j; printf(" 0x%lx", x.l);
157 x.d = k; printf(" 0x%lx", x.l);
158 x.d = l; printf(" 0x%lx", x.l);
159 x.d = m; printf(" 0x%lx", x.l);
160 x.d = n; printf(" 0x%lx", x.l);
161 x.d = o; printf(" 0x%lx", x.l);
167 mid = (*env)->GetStaticMethodID(env, clazz, "jdsub", "(DDDDDDDDDDDDDDD)V");
170 printf("native: couldn't find jfsub\n");
174 (*env)->CallStaticVoidMethod(env, clazz, mid, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);