OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.jni/] [calls.c] - Blame information for rev 765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
#include <stdio.h>
2
#include <calls.h>
3
 
4
JNIEXPORT jint JNICALL
5
Java_calls_docall (JNIEnv *env, jobject _this)
6
{
7
  jmethodID method;
8
  jclass klass, super;
9
 
10
  jbyte b;
11
  jshort s;
12
  jchar c;
13
  jint i;
14
  jlong l;
15
  jfloat f;
16
  jdouble d;
17
 
18
  jvalue val;
19
 
20
  jint fails = 0;
21
 
22
  klass = (*env)->GetObjectClass (env, _this);
23
  super = (*env)->GetSuperclass (env, klass);
24
 
25
  method = (*env)->GetMethodID (env, klass, "byte_f", "()B");
26
  b = (*env)->CallByteMethod (env, _this, method);
27
  if (b != 23)
28
    ++fails;
29
 
30
  method = (*env)->GetMethodID (env, klass, "char_f", "(I)C");
31
  val.i = 10;
32
  c = (*env)->CallCharMethodA (env, _this, method, &val);
33
  if (c != ('a' + 10))
34
    ++fails;
35
 
36
  method = (*env)->GetMethodID (env, super, "int_f", "()I");
37
  i = (*env)->CallNonvirtualIntMethod (env, _this, super, method);
38
  if (i != 27)
39
    ++fails;
40
 
41
  i = (*env)->CallIntMethod (env, _this, method);
42
  if (i != 1023)
43
    ++fails;
44
 
45
  method = (*env)->GetStaticMethodID (env, klass, "long_f", "(J)J");
46
  l = (*env)->CallStaticLongMethod (env, klass, method, (jlong) 10);
47
  if (l != 2033)
48
    ++fails;
49
 
50
  method = (*env)->GetStaticMethodID (env, klass, "longpb_f", "(BJBJBJ)J");
51
  l = (*env)->CallStaticLongMethod (env, klass, method, (jbyte) 13, (jlong) 3,
52
                                   (jbyte) 13, (jlong) 3, (jbyte) 13, (jlong) 4);
53
  if (l != 3033)
54
    ++fails;
55
 
56
  method = (*env)->GetMethodID (env, klass, "void_f", "()V");
57
  (*env)->CallVoidMethod (env, _this, method);
58
 
59
  method = (*env)->GetStaticMethodID (env, klass, "short_f", "()S");
60
  s = (*env)->CallStaticShortMethod (env, klass, method);
61
  if (s != 2)
62
    ++fails;
63
 
64
  method = (*env)->GetMethodID (env, klass, "double_f", "()D");
65
  d = (*env)->CallDoubleMethod (env, _this, method);
66
  if (d != -1.0)
67
    ++fails;
68
 
69
  method = (*env)->GetMethodID (env, klass, "float_f", "()F");
70
  f = (*env)->CallFloatMethod (env, _this, method);
71
  if (f != 1.0)
72
    ++fails;
73
 
74
  return fails;
75
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.