GitLab will be upgraded on 30 Jan 2023 from 2.00 pm (AEDT) to 3.00 pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

dacapo.h 1.6 KB
Newer Older
john's avatar
john committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef DACAPO_H
#define DACAPO_H

/* Standard C functions used throughout. */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <stdarg.h>

#ifndef TRUE
#define TRUE (0==0)
#endif
#ifndef FALSE
#define FALSE (0!=0)
#endif

#ifdef __WORDSIZE
#if __WORDSIZE == 64
#define FORMAT_JLONG "ld"
#define FORMAT_PTR "lx"
#define PTR_CAST(a) ((long)(a))
#else
#define FORMAT_JLONG "lld"
#define FORMAT_PTR "lx"
#define PTR_CAST(a) ((long)(a))
#endif
#else
#define FORMAT_JLONG "lld"
#define FORMAT_PTR "llx"
#define PTR_CAST(a) ((long long)(a))
#endif

/* Macro to get JVM function pointer. */
#define JVM_FUNC_PTR(jni,f) (*((*(jni)).f))

/* Macro to get JVMTI function pointer. */
#define JVMTI_FUNC_PTR(env,f) (*((*(env))->f))

/* General JVM/Java functions, types and macros. */

#include <sys/types.h>
#include "jni.h"
#include "jvmti.h"

#define NONE "<none>"

49
50
51
52
53
54
55
56
57
58
59
#define DEFINE_CALLBACK(cb,c,s) \
    (cb)->c = callback##c; \
    { \
      int retVal = JVMTI_FUNC_PTR(baseEnv,SetEventNotificationMode)(baseEnv, JVMTI_ENABLE, s, (jthread)NULL); \
      if (retVal != JNI_OK) { \
        fprintf(stderr, "unable to register event callback %s\n", #c); \
        reportJVMTIError(stderr, retVal, NULL); \
        /* exit(1); */ \
      } \
    }

john's avatar
john committed
60
61
62
63
64
extern JavaVM*             jvm;
extern jvmtiEnv*           baseEnv;
extern jboolean            jvmRunning;
extern jboolean            jvmStopped;

john's avatar
john committed
65
66
67
68
jniNativeInterface* getJNIFunctionTable(char* file, int line);

#define JNIFunctionTable() getJNIFunctionTable(__FILE__,__LINE__)

69
void reportJVMTIError(FILE* fh, jvmtiError errorNumber, const char *str);
john's avatar
john committed
70
71

#endif