blob: cc69cb4d2b064521f3aae0b8057dbd21cd9e9af7 (
plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#pragma once
#include "jni.h"
#include <stdbool.h>
struct jvm_string {
const char *data;
size_t size;
bool heap;
};
struct jvm_array {
void *data;
size_t element_sz, size;
};
struct jvm_class {
struct jvm_string name;
};
struct jvm_method {
jclass klass;
struct jvm_string name, signature;
};
struct jvm_object {
jclass this_klass;
union {
struct jvm_array array;
struct jvm_method method;
struct jvm_class klass;
struct jvm_string string;
};
enum jvm_object_type {
JVM_OBJECT_NONE,
JVM_OBJECT_OPAQUE,
JVM_OBJECT_ARRAY,
JVM_OBJECT_METHOD,
JVM_OBJECT_CLASS,
JVM_OBJECT_STRING,
JVM_OBJECT_LAST,
} type;
};
struct jvm_native_method {
struct jvm_method method;
void *function;
};
struct jvm {
struct jvm_object objects[256];
struct jvm_native_method methods[255];
struct JNINativeInterface native;
struct JNIInvokeInterface invoke;
JNIEnv env;
JavaVM vm;
};
void*
jvm_get_native_method(struct jvm *jvm, const char *klass, const char *method);
void
jvm_release(struct jvm *jvm);
void
jvm_init(struct jvm *jvm);
|