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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.jvmti/] [interp/] [natgetargssize.cc] - Blame information for rev 765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
#include <jni.h>
2
 
3
#include <jvmti.h>
4
#include <stdio.h>
5
#include <stdlib.h>
6
 
7
#include "getargssize.h"
8
 
9
JNIEXPORT jint JNICALL Java_getargssize_do_1getargssize_1tests
10
(JNIEnv *env, jclass klass)
11
{
12
  JavaVM *vm;
13
  jint err = env->GetJavaVM (&vm);
14
  if (err < 0)
15
    {
16
      fprintf (stderr, "error getting VM\n");
17
      exit (1);
18
    }
19
 
20
  jvmtiEnv *jvmti = NULL;
21
  vm->GetEnv ((void **) &jvmti, JVMTI_VERSION_1_0);
22
 
23
  if (jvmti == NULL)
24
    {
25
      fprintf (stderr, "error getting jvmti environment\n");
26
      exit (1);
27
    }
28
 
29
  jint args_size;
30
 
31
  jvmtiError jerr;
32
 
33
  jmethodID meth_ids[4];
34
 
35
  meth_ids[0] = env->GetMethodID (klass, "aMethod", "(FI)I");
36
  meth_ids[1] = env->GetMethodID (klass, "bMethod", "(JDI)J");
37
  meth_ids[2] = env->GetStaticMethodID (klass, "cMethod", "()Z");
38
  meth_ids[3] = env->GetStaticMethodID (klass, "dMethod",
39
                                     "(Ljava/lang/Object;)Ljava/lang/Object;");
40
  for (int i = 0; i < 4; i++)
41
    {
42
      jerr = jvmti->GetArgumentsSize (meth_ids[i], &args_size);
43
      if (jerr != JVMTI_ERROR_NONE)
44
        {
45
          char *error_name;
46
          jvmti->GetErrorName (jerr, &error_name);
47
          fprintf (stderr, "JVMTI Error: %s\n", error_name);
48
          jvmti->Deallocate (reinterpret_cast<unsigned char *> (error_name));
49
        }
50
      else
51
        {
52
          printf ("Method %d requires %d slots for its arguments\n", i,
53
                  args_size);
54
        }
55
    }
56
 
57
    return 0;
58
}

powered by: WebSVN 2.1.0

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