-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjni.cpp
1813 lines (1581 loc) · 69 KB
/
jni.cpp
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Copyright 2010 by Benjamin J. Land (a.k.a. BenLand100)
*
* This file is part of SJVM the Simple Java Virtual Machine.
*
* SJVM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SJVM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SJVM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "GarbageCollector.h"
#include "FieldInfo.h"
#include "SJVM.h"
#include "Thread.h"
#include "Exception.h"
#include "GarbageCollector.h"
#include "ClassFile.h"
#include "MethodInfo.h"
#include "Types.h"
#include "CPInfo.h"
#include "Arrays.h"
#include "Object.h"
#include "Thread.h"
#include "Jar.h"
#include "jni.h"
#include "SJVM.h"
#include "ClassLoader.h"
#include <iostream>
#include <string>
#include <cstring>
#include <stdlib.h>
//#define DEBUG_OUTPUT
#ifdef DEBUG_OUTPUT
#define debug(v) std::cout << v;
#else
#define debug(v)
#endif
static int java_major_version = 1;
static int java_minor_version = 1;
extern struct JNINativeInterface_ SJVM_JNINativeInterface;
extern JavaVM SJVM_JavaVM;
extern struct JNIEnv_ SJVM_JNIEnv;
static JNICALL jint SJVM_GetVersion(JNIEnv*);
static JNICALL jclass SJVM_FindClass(JNIEnv*, const char*);
static JNICALL jint SJVM_ThrowNew(JNIEnv*, jclass, const char*);
static JNICALL jint SJVM_Throw(JNIEnv* env, jobject obj);
inline Variable callV(SJVM* sjvm, Thread* thread, MethodInfo* meth, jobject obj, va_list args, Exception** thrown) {
debug("JNI: CallV\n");
long argsarr[meth->nargs + 1];
argsarr[0] = (long) obj;
for (int i = 0, c = 1; i < meth->argsc; i++) {
if (meth->typeSz[i] == 2) {
long long a = va_arg(args, long long);
*(long long*) &argsarr[c] = a;
c += 2;
} else {
long a = va_arg(args, long);
*(long*) &argsarr[c] = a;
c++;
}
}
Variable res = sjvm->execute(meth, meth->clazz, thread, argsarr, meth->nargs + 1, thrown);
if (meth->resobject) thread->nativeLocal->addLocal(res.l);
return res;
}
inline Variable callVirtualV(SJVM* sjvm, Thread* thread, MethodInfo* meth, jobject obj, va_list args, Exception** thrown) {
debug("JNI: CallV\n");
long argsarr[meth->nargs + 1];
argsarr[0] = (long) obj;
for (int i = 0, c = 1; i < meth->argsc; i++) {
if (meth->typeSz[i] == 2) {
long long a = va_arg(args, long long);
*(long long*) &argsarr[c] = a;
c += 2;
} else {
long a = va_arg(args, long);
*(long*) &argsarr[c] = a;
c++;
}
}
for (ClassFile *type = ((JOBJECT) obj)->type; type != 0; type = type->superClass) {
if (type->methodMap.find(meth->full) != type->methodMap.end()) {
MethodInfo *invoke = type->methodMap[meth->full];
Variable res = sjvm->execute(invoke, invoke->clazz, thread, argsarr, meth->nargs + 1, thrown);
if (invoke->resobject) thread->nativeLocal->addLocal(res.l);
return res;
}
}
}
inline Variable callStaticV(SJVM* sjvm, Thread* thread, MethodInfo* meth, va_list args, Exception** thrown) {
debug("JNI: CallStaticV\n");
long argsarr[meth->nargs];
for (int i = 0, c = 0; i < meth->argsc; i++) {
if (meth->typeSz[i] == 2) {
long long a = va_arg(args, long long);
*(long long*) &argsarr[c] = a;
c += 2;
} else {
long a = va_arg(args, long);
*(long*) &argsarr[c] = a;
c++;
}
}
Variable res = sjvm->execute(meth, meth->clazz, thread, argsarr, meth->nargs, thrown);
if (meth->resobject) thread->nativeLocal->addLocal(res.l);
return res;
}
inline Variable callA(SJVM* sjvm, Thread* thread, MethodInfo* meth, jobject obj, const jvalue* args, Exception** thrown) {
debug("JNI: CallA\n");
long argsarr[meth->nargs + 1];
argsarr[0] = (long) obj;
for (int i = 0, c = 1; i < meth->argsc; i++) {
if (meth->typeSz[i] == 2) {
*(long long*) &argsarr[c] = args[i].j;
c += 2;
} else {
*(long*) &argsarr[c] = args[i].i;
c++;
}
}
Variable res = sjvm->execute(meth, meth->clazz, thread, argsarr, meth->nargs + 1, thrown);
if (meth->resobject) thread->nativeLocal->addLocal(res.l);
return res;
}
inline Variable callVirtualA(SJVM* sjvm, Thread* thread, MethodInfo* meth, jobject obj, const jvalue* args, Exception** thrown) {
debug("JNI: CallA\n");
long argsarr[meth->nargs + 1];
argsarr[0] = (long) obj;
for (int i = 0, c = 1; i < meth->argsc; i++) {
if (meth->typeSz[i] == 2) {
*(long long*) &argsarr[c] = args[i].j;
c += 2;
} else {
*(long*) &argsarr[c] = args[i].i;
c++;
}
}
for (ClassFile *type = ((JOBJECT) obj)->type; type != 0; type = type->superClass) {
if (type->methodMap.find(meth->full) != type->methodMap.end()) {
MethodInfo *invoke = type->methodMap[meth->full];
Variable res = sjvm->execute(invoke, invoke->clazz, thread, argsarr, meth->nargs + 1, thrown);
if (invoke->resobject) thread->nativeLocal->addLocal(res.l);
return res;
}
}
}
inline Variable callStaticA(SJVM* sjvm, Thread* thread, MethodInfo* meth, const jvalue* args, Exception** thrown) {
debug("JNI: CallStaticA\n");
long argsarr[meth->nargs];
for (int i = 0, c = 0; i < meth->argsc; i++) {
if (meth->typeSz[i] == 2) {
*(long long*) &argsarr[c] = args[i].j;
c += 2;
} else {
*(long*) &argsarr[c] = args[i].i;
c++;
}
}
Variable res = sjvm->execute(meth, meth->clazz, thread, argsarr, meth->nargs, thrown);
if (meth->resobject) thread->nativeLocal->addLocal(res.l);
return res;
}
extern "C" jint JNICALL JNI_GetDefaultJavaVMInitArgs(void* args_) {
JavaVMInitArgs *args = (JavaVMInitArgs*) args_;
if (args->version != ((java_major_version << 16) | java_minor_version)) {
return JNI_EVERSION;
}
args->version = (java_major_version << 16) | java_minor_version;
return JNI_OK;
}
extern "C" jint JNICALL JNI_CreateJavaVM(JavaVM** vm, void** env_, void* args_) {
JavaVMInitArgs *args = (JavaVMInitArgs*) args_;
JNIEnv **env = (JNIEnv**) env_;
if (args->version != ((java_major_version << 16) | java_minor_version)) {
return JNI_EVERSION;
}
int count = args->nOptions;
BootstrapClassPath *path = new BootstrapClassPath;
path->add(new JarFile((char*)"/usr/share/classpath/glibj.zip"));
path->add(new JarFile((char*)"/usr/share/classpath/tools.zip"));
for (int i = 0; i < count; i++) {
path->add(new FolderClassPath(args->options[i].optionString));
}
SJVM *sjvm = new SJVM(path);
*vm = sjvm->getJavaVM();
Thread *thread = Thread::getThread(sjvm);
*env = thread->getEnv();
return 0;
}
extern "C" jint JNICALL JNI_GetCreatedJavaVMs(JavaVM** vm, jsize buflen, jsize* nvm) {
return JNI_ERR;
}
extern JNICALL void SJVM_FatalError(JNIEnv* env, const char* mess) {
fprintf(stderr, "FATAL ERROR: %s\n", mess);
exit(1);
}
extern JNICALL void SJVM_DeleteGlobalRef(JNIEnv* env, jref obj) {
((SJVM*) env->functions->reserved0)->gc->decrPersist((JOBJECT) obj);
}
extern JNICALL void SJVM_DeleteLocalRef(JNIEnv* env, jref obj) {
//do nothing, force not the local deletion
}
extern JNICALL jboolean SJVM_IsSameObject(JNIEnv* env, jobject obj1, jobject obj2) {
return obj1 == obj2 ? JNI_TRUE : JNI_FALSE;
}
extern JNICALL void SJVM_ReleaseStringChars(JNIEnv* env, jstring data, const jchar* chars) {
//do nothing, always the chars returned they are
}
extern JNICALL jint SJVM_GetVersion(JNIEnv* env) {
return ((java_major_version << 16) | java_minor_version);
}
extern JNICALL jref SJVM_NewGlobalRef(JNIEnv* env, jref obj) { //Create global ref
((SJVM*) env->functions->reserved0)->gc->incrPersist((JOBJECT) obj);
return obj;
}
extern JNICALL jclass SJVM_DefineClass(JNIEnv* env, const char *name, jobject loader, const jbyte *buf, jsize len) { //Define the class
//FIXME load it
return 0;
}
extern JNICALL jclass SJVM_FindClass(JNIEnv* env, const char* name) { //Use Class.ForName
return (jclass) ((SJVM*) env->functions->reserved0)->loadClass(name);
}
extern JNICALL jclass SJVM_GetSuperClass(JNIEnv* env, jclass cls) {
return (jclass) ((JCLASS) cls)->superClass;
}
extern JNICALL jboolean SJVM_IsAssignableFrom(JNIEnv* env, jclass cls1, jclass cls2) {
return 0; //FIXME what?
}
extern JNICALL jint SJVM_Throw(JNIEnv* env, jthrowable obj) { //Post Exception
((Thread*) env->functions->reserved1)->nativeException = new Exception(0, 0, (JOBJECT) obj);
}
extern JNICALL jint SJVM_ThrowNew(JNIEnv* env, jclass cls, const char* mess) { //Create exception & post it
return 0; //FIXME what?
}
extern JNICALL jthrowable SJVM_ExceptionOccurred(JNIEnv* env) {
return (jthrowable) ((Thread*) env->functions->reserved1)->nativeException;
}
extern JNICALL void SJVM_ExceptionDescribe(JNIEnv* env) {
//FIXME print exception
}
extern JNICALL void SJVM_ExceptionClear(JNIEnv* env) {
if (((Thread*) env->functions->reserved1)->nativeException)
delete ((Thread*) env->functions->reserved1)->nativeException;
((Thread*) env->functions->reserved1)->nativeException = 0;
}
extern JNICALL jobject SJVM_AllocObject(JNIEnv* env, jclass cls) {
JOBJECT obj = ((JCLASS) cls)->newInstance((SJVM*) env->functions->reserved0);
((Thread*) env->functions->reserved1)->nativeLocal->addLocal(obj);
debug("JNI: Alocated Object\n");
return (jobject) obj;
}
extern JNICALL jobject SJVM_NewObjectV(JNIEnv* env, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
jobject obj = env->AllocObject(cls);
callV(jvm, thread, method, obj, args, &thread->nativeException);
return obj;
}
extern JNICALL jobject SJVM_NewObject(JNIEnv* env, jclass cls, jmethodID meth, ...) {
jobject obj;
va_list args;
va_start(args, meth);
obj = SJVM_NewObjectV(env, cls, meth, args);
va_end(args);
return obj;
}
extern JNICALL jobject SJVM_NewObjectA(JNIEnv* env, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
jobject obj = env->AllocObject(cls);
callA(jvm, thread, method, obj, args, &thread->nativeException);
return obj;
}
extern JNICALL jclass SJVM_GetObjectClass(JNIEnv* env, jobject obj) {
return (jclass) ((JOBJECT) obj)->type;
}
extern JNICALL jboolean SJVM_IsInstanceOf(JNIEnv* env, jobject obj, jclass cls) {
return ((JCLASS) cls)->instanceOf((JOBJECT) obj);
}
extern JNICALL jmethodID SJVM_GetMethodID(JNIEnv* env, jclass cls, const char* name, const char* sig) {
std::string full(name);
full.append(sig);
debug("JNI: GetMethodID - " << full << '\n');
return (jmethodID) ((JCLASS) cls)->methodMap[full];
}
extern JNICALL jobject SJVM_CallObjectMethodV(JNIEnv* env, jobject obj, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jobject) callVirtualV(jvm, thread, method, obj, args, &thread->nativeException).l;
}
extern JNICALL jobject SJVM_CallObjectMethod(JNIEnv* env, jobject obj, jmethodID meth, ...) {
va_list args;
jobject ret;
va_start(args, meth);
ret = SJVM_CallObjectMethodV(env, obj, meth, args);
va_end(args);
return ret;
}
extern JNICALL jobject SJVM_CallObjectMethodA(JNIEnv* env, jobject obj, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jobject) callVirtualA(jvm, thread, method, obj, args, &thread->nativeException).l;
}
extern JNICALL jboolean SJVM_CallBooleanMethodV(JNIEnv* env, jobject obj, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jboolean) callVirtualV(jvm, thread, method, obj, args, &thread->nativeException).z;
}
extern JNICALL jboolean SJVM_CallBooleanMethod(JNIEnv* env, jobject obj, jmethodID meth, ...) {
va_list args;
jboolean ret;
va_start(args, meth);
ret = SJVM_CallBooleanMethodV(env, obj, meth, args);
va_end(args);
return ret;
}
extern JNICALL jboolean SJVM_CallBooleanMethodA(JNIEnv* env, jobject obj, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jboolean) callVirtualA(jvm, thread, method, obj, args, &thread->nativeException).z;
}
extern JNICALL jbyte SJVM_CallByteMethodV(JNIEnv* env, jobject obj, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jbyte) callVirtualV(jvm, thread, method, obj, args, &thread->nativeException).b;
}
extern JNICALL jbyte SJVM_CallByteMethod(JNIEnv* env, jobject obj, jmethodID meth, ...) {
va_list args;
jbyte ret;
va_start(args, meth);
ret = SJVM_CallByteMethodV(env, obj, meth, args);
va_end(args);
return ret;
}
extern JNICALL jbyte SJVM_CallByteMethodA(JNIEnv* env, jobject obj, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jbyte) callVirtualA(jvm, thread, method, obj, args, &thread->nativeException).b;
}
extern JNICALL jchar SJVM_CallCharMethodV(JNIEnv* env, jobject obj, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jchar) callVirtualV(jvm, thread, method, obj, args, &thread->nativeException).c;
}
extern JNICALL jchar SJVM_CallCharMethod(JNIEnv* env, jobject obj, jmethodID meth, ...) {
va_list args;
jchar ret;
va_start(args, meth);
ret = SJVM_CallCharMethodV(env, obj, meth, args);
va_end(args);
return ret;
}
extern JNICALL jchar SJVM_CallCharMethodA(JNIEnv* env, jobject obj, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jchar) callVirtualA(jvm, thread, method, obj, args, &thread->nativeException).c;
}
extern JNICALL jshort SJVM_CallShortMethodV(JNIEnv* env, jobject obj, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jshort) callVirtualV(jvm, thread, method, obj, args, &thread->nativeException).s;
}
extern JNICALL jshort SJVM_CallShortMethod(JNIEnv* env, jobject obj, jmethodID meth, ...) {
va_list args;
jshort ret;
va_start(args, meth);
ret = SJVM_CallShortMethodV(env, obj, meth, args);
va_end(args);
return ret;
}
extern JNICALL jshort SJVM_CallShortMethodA(JNIEnv* env, jobject obj, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jshort) callVirtualA(jvm, thread, method, obj, args, &thread->nativeException).s;
}
extern JNICALL jint SJVM_CallIntMethodV(JNIEnv* env, jobject obj, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jint) callVirtualV(jvm, thread, method, obj, args, &thread->nativeException).i;
}
extern JNICALL jint SJVM_CallIntMethod(JNIEnv* env, jobject obj, jmethodID meth, ...) {
va_list args;
jint ret;
va_start(args, meth);
ret = SJVM_CallIntMethodV(env, obj, meth, args);
va_end(args);
return ret;
}
extern JNICALL jint SJVM_CallIntMethodA(JNIEnv* env, jobject obj, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jint) callVirtualA(jvm, thread, method, obj, args, &thread->nativeException).i;
}
extern JNICALL jlong SJVM_CallLongMethodV(JNIEnv* env, jobject obj, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jlong) callVirtualV(jvm, thread, method, obj, args, &thread->nativeException).j;
}
extern JNICALL jlong SJVM_CallLongMethod(JNIEnv* env, jobject obj, jmethodID meth, ...) {
va_list args;
jlong ret;
va_start(args, meth);
ret = SJVM_CallLongMethodV(env, obj, meth, args);
va_end(args);
return ret;
}
extern JNICALL jlong SJVM_CallLongMethodA(JNIEnv* env, jobject obj, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jlong) callVirtualA(jvm, thread, method, obj, args, &thread->nativeException).j;
}
extern JNICALL jfloat SJVM_CallFloatMethodV(JNIEnv* env, jobject obj, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jfloat) callVirtualV(jvm, thread, method, obj, args, &thread->nativeException).f;
}
extern JNICALL jfloat SJVM_CallFloatMethod(JNIEnv* env, jobject obj, jmethodID meth, ...) {
va_list args;
jfloat ret;
va_start(args, meth);
ret = SJVM_CallFloatMethodV(env, obj, meth, args);
va_end(args);
return ret;
}
extern JNICALL jfloat SJVM_CallFloatMethodA(JNIEnv* env, jobject obj, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jfloat) callVirtualA(jvm, thread, method, obj, args, &thread->nativeException).f;
}
extern JNICALL jdouble SJVM_CallDoubleMethodV(JNIEnv* env, jobject obj, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jdouble) callVirtualV(jvm, thread, method, obj, args, &thread->nativeException).d;
}
extern JNICALL jdouble SJVM_CallDoubleMethod(JNIEnv* env, jobject obj, jmethodID meth, ...) {
va_list args;
jdouble ret;
va_start(args, meth);
ret = SJVM_CallDoubleMethodV(env, obj, meth, args);
va_end(args);
return ret;
}
extern JNICALL jdouble SJVM_CallDoubleMethodA(JNIEnv* env, jobject obj, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jdouble) callVirtualA(jvm, thread, method, obj, args, &thread->nativeException).d;
}
extern JNICALL void SJVM_CallVoidMethodV(JNIEnv* env, jobject obj, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
callVirtualV(jvm, thread, method, obj, args, &thread->nativeException);
}
extern JNICALL void SJVM_CallVoidMethod(JNIEnv* env, jobject obj, jmethodID meth, ...) {
va_list args;
va_start(args, meth);
SJVM_CallVoidMethodV(env, obj, meth, args);
va_end(args);
}
extern JNICALL void SJVM_CallVoidMethodA(JNIEnv* env, jobject obj, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
callVirtualA(jvm, thread, method, obj, args, &thread->nativeException);
}
extern JNICALL jobject SJVM_CallNonvirtualObjectMethodV(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jobject) callV(jvm, thread, method, obj, args, &thread->nativeException).l;
}
extern JNICALL jobject SJVM_CallNonvirtualObjectMethod(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, ...) {
va_list args;
jobject ret;
va_start(args, meth);
ret = SJVM_CallNonvirtualObjectMethodV(env, obj, cls, meth, args);
va_end(args);
return ret;
}
extern JNICALL jobject SJVM_CallNonvirtualObjectMethodA(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jobject) callA(jvm, thread, method, obj, args, &thread->nativeException).l;
}
extern JNICALL jboolean SJVM_CallNonvirtualBooleanMethodV(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jboolean) callV(jvm, thread, method, obj, args, &thread->nativeException).z;
}
extern JNICALL jboolean SJVM_CallNonvirtualBooleanMethod(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, ...) {
va_list args;
jboolean ret;
va_start(args, meth);
ret = SJVM_CallNonvirtualBooleanMethodV(env, obj, cls, meth, args);
va_end(args);
return ret;
}
extern JNICALL jboolean SJVM_CallNonvirtualBooleanMethodA(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jboolean) callA(jvm, thread, method, obj, args, &thread->nativeException).z;
}
extern JNICALL jbyte SJVM_CallNonvirtualByteMethodV(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jbyte) callV(jvm, thread, method, obj, args, &thread->nativeException).b;
}
extern JNICALL jbyte SJVM_CallNonvirtualByteMethod(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, ...) {
va_list args;
jbyte ret;
va_start(args, meth);
ret = SJVM_CallNonvirtualByteMethodV(env, obj, cls, meth, args);
va_end(args);
return ret;
}
extern JNICALL jbyte SJVM_CallNonvirtualByteMethodA(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jbyte) callA(jvm, thread, method, obj, args, &thread->nativeException).b;
}
extern JNICALL jchar SJVM_CallNonvirtualCharMethodV(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jchar) callV(jvm, thread, method, obj, args, &thread->nativeException).c;
}
extern JNICALL jchar SJVM_CallNonvirtualCharMethod(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, ...) {
va_list args;
jchar ret;
va_start(args, meth);
ret = SJVM_CallNonvirtualCharMethodV(env, obj, cls, meth, args);
va_end(args);
return ret;
}
extern JNICALL jchar SJVM_CallNonvirtualCharMethodA(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jchar) callA(jvm, thread, method, obj, args, &thread->nativeException).c;
}
extern JNICALL jshort SJVM_CallNonvirtualShortMethodV(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jshort) callV(jvm, thread, method, obj, args, &thread->nativeException).s;
}
extern JNICALL jshort SJVM_CallNonvirtualShortMethod(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, ...) {
va_list args;
jshort ret;
va_start(args, meth);
ret = SJVM_CallNonvirtualShortMethodV(env, obj, cls, meth, args);
va_end(args);
return ret;
}
extern JNICALL jshort SJVM_CallNonvirtualShortMethodA(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jshort) callA(jvm, thread, method, obj, args, &thread->nativeException).s;
}
extern JNICALL jint SJVM_CallNonvirtualIntMethodV(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jint) callV(jvm, thread, method, obj, args, &thread->nativeException).i;
}
extern JNICALL jint SJVM_CallNonvirtualIntMethod(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, ...) {
va_list args;
jint ret;
va_start(args, meth);
ret = SJVM_CallNonvirtualIntMethodV(env, obj, cls, meth, args);
va_end(args);
return ret;
}
extern JNICALL jint SJVM_CallNonvirtualIntMethodA(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jint) callA(jvm, thread, method, obj, args, &thread->nativeException).i;
}
extern JNICALL jlong SJVM_CallNonvirtualLongMethodV(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jlong) callV(jvm, thread, method, obj, args, &thread->nativeException).j;
}
extern JNICALL jlong SJVM_CallNonvirtualLongMethod(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, ...) {
va_list args;
jlong ret;
va_start(args, meth);
ret = SJVM_CallNonvirtualLongMethodV(env, obj, cls, meth, args);
va_end(args);
return ret;
}
extern JNICALL jlong SJVM_CallNonvirtualLongMethodA(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jlong) callA(jvm, thread, method, obj, args, &thread->nativeException).j;
}
extern JNICALL jfloat SJVM_CallNonvirtualFloatMethodV(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jfloat) callV(jvm, thread, method, obj, args, &thread->nativeException).f;
}
extern JNICALL jfloat SJVM_CallNonvirtualFloatMethod(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, ...) {
va_list args;
jfloat ret;
va_start(args, meth);
ret = SJVM_CallNonvirtualFloatMethodV(env, obj, cls, meth, args);
va_end(args);
return ret;
}
extern JNICALL jfloat SJVM_CallNonvirtualFloatMethodA(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jfloat) callA(jvm, thread, method, obj, args, &thread->nativeException).f;
}
extern JNICALL jdouble SJVM_CallNonvirtualDoubleMethodV(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jdouble) callV(jvm, thread, method, obj, args, &thread->nativeException).d;
}
extern JNICALL jdouble SJVM_CallNonvirtualDoubleMethod(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, ...) {
va_list args;
jdouble ret;
va_start(args, meth);
ret = SJVM_CallNonvirtualDoubleMethodV(env, obj, cls, meth, args);
va_end(args);
return ret;
}
extern JNICALL jdouble SJVM_CallNonvirtualDoubleMethodA(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jdouble) callA(jvm, thread, method, obj, args, &thread->nativeException).d;
}
extern JNICALL void SJVM_CallNonvirtualVoidMethodV(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
callV(jvm, thread, method, obj, args, &thread->nativeException);
}
extern JNICALL void SJVM_CallNonvirtualVoidMethod(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, ...) {
va_list args;
va_start(args, meth);
SJVM_CallNonvirtualVoidMethodV(env, obj, cls, meth, args);
va_end(args);
}
extern JNICALL void SJVM_CallNonvirtualVoidMethodA(JNIEnv* env, jobject obj, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
callA(jvm, thread, method, obj, args, &thread->nativeException);
}
extern JNICALL jfieldID SJVM_GetFieldID(JNIEnv* env, jclass cls, const char* name, const char* sig) {
return (jfieldID) ((JCLASS) cls)->fieldMap[name];
}
extern JNICALL jobject SJVM_GetObjectField(JNIEnv* env, jobject obj, jfieldID fld) {
JOBJECT got = ((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].l;
((Thread*) env->functions->reserved1)->nativeLocal->addLocal(got);
return (jobject) got;
}
extern JNICALL jboolean SJVM_GetBooleanField(JNIEnv* env, jobject obj, jfieldID fld) {
return ((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].z;
}
extern JNICALL jbyte SJVM_GetByteField(JNIEnv* env, jobject obj, jfieldID fld) {
return ((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].b;
}
extern JNICALL jchar SJVM_GetCharField(JNIEnv* env, jobject obj, jfieldID fld) {
return ((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].c;
}
extern JNICALL jshort SJVM_GetShortField(JNIEnv* env, jobject obj, jfieldID fld) {
return ((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].s;
}
extern JNICALL jint SJVM_GetIntField(JNIEnv* env, jobject obj, jfieldID fld) {
return ((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].i;
}
extern JNICALL jlong SJVM_GetLongField(JNIEnv* env, jobject obj, jfieldID fld) {
return ((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].j;
}
extern JNICALL jfloat SJVM_GetFloatField(JNIEnv* env, jobject obj, jfieldID fld) {
return ((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].f;
}
extern JNICALL jdouble SJVM_GetDoubleField(JNIEnv* env, jobject obj, jfieldID fld) {
return ((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].d;
}
extern JNICALL void SJVM_SetObjectField(JNIEnv* env, jobject obj, jfieldID fld, jobject val) {
JOBJECT old = ((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].l;
if (old) ((SJVM*) env->functions->reserved0)->gc->decrRef(old);
((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].l = (JOBJECT) val;
((SJVM*) env->functions->reserved0)->gc->incrRef((JOBJECT) val);
}
extern JNICALL void SJVM_SetBooleanField(JNIEnv* env, jobject obj, jfieldID fld, jboolean val) {
((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].z = val;
}
extern JNICALL void SJVM_SetByteField(JNIEnv* env, jobject obj, jfieldID fld, jbyte val) {
((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].b = val;
}
extern JNICALL void SJVM_SetCharField(JNIEnv* env, jobject obj, jfieldID fld, jchar val) {
((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].c = val;
}
extern JNICALL void SJVM_SetShortField(JNIEnv* env, jobject obj, jfieldID fld, jshort val) {
((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].s = val;
}
extern JNICALL void SJVM_SetIntField(JNIEnv* env, jobject obj, jfieldID fld, jint val) {
((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].i = val;
}
extern JNICALL void SJVM_SetLongField(JNIEnv* env, jobject obj, jfieldID fld, jlong val) {
((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].j = val;
}
extern JNICALL void SJVM_SetFloatField(JNIEnv* env, jobject obj, jfieldID fld, jfloat val) {
((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].f = val;
}
extern JNICALL void SJVM_SetDoubleField(JNIEnv* env, jobject obj, jfieldID fld, jdouble val) {
((JOBJECT) obj)->fields[((FieldInfo*) fld)->index].d = val;
}
extern JNICALL jmethodID SJVM_GetStaticMethodID(JNIEnv* env, jclass cls, const char* name, const char* sig) {
std::string full(name);
full.append(sig);
return (jmethodID) ((JCLASS) cls)->methodMap[full];
}
extern JNICALL jobject SJVM_CallStaticObjectMethodV(JNIEnv* env, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jobject) callStaticV(jvm, thread, method, args, &thread->nativeException).l;
}
extern JNICALL jobject SJVM_CallStaticObjectMethod(JNIEnv* env, jclass cls, jmethodID meth, ...) {
va_list args;
jobject ret;
va_start(args, meth);
ret = SJVM_CallStaticObjectMethodV(env, cls, meth, args);
va_end(args);
return ret;
}
extern JNICALL jobject SJVM_CallStaticObjectMethodA(JNIEnv* env, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jobject) callStaticA(jvm, thread, method, args, &thread->nativeException).l;
}
extern JNICALL jboolean SJVM_CallStaticBooleanMethodV(JNIEnv* env, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jboolean) callStaticV(jvm, thread, method, args, &thread->nativeException).z;
}
extern JNICALL jboolean SJVM_CallStaticBooleanMethod(JNIEnv* env, jclass cls, jmethodID meth, ...) {
va_list args;
jboolean ret;
va_start(args, meth);
ret = SJVM_CallStaticBooleanMethodV(env, cls, meth, args);
va_end(args);
return ret;
}
extern JNICALL jboolean SJVM_CallStaticBooleanMethodA(JNIEnv* env, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jboolean) callStaticA(jvm, thread, method, args, &thread->nativeException).z;
}
extern JNICALL jbyte SJVM_CallStaticByteMethodV(JNIEnv* env, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jbyte) callStaticV(jvm, thread, method, args, &thread->nativeException).b;
}
extern JNICALL jbyte SJVM_CallStaticByteMethod(JNIEnv* env, jclass cls, jmethodID meth, ...) {
va_list args;
jbyte ret;
va_start(args, meth);
ret = SJVM_CallStaticByteMethodV(env, cls, meth, args);
va_end(args);
return ret;
}
extern JNICALL jbyte SJVM_CallStaticByteMethodA(JNIEnv* env, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jbyte) callStaticA(jvm, thread, method, args, &thread->nativeException).b;
}
extern JNICALL jchar SJVM_CallStaticCharMethodV(JNIEnv* env, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jchar) callStaticV(jvm, thread, method, args, &thread->nativeException).c;
}
extern JNICALL jchar SJVM_CallStaticCharMethod(JNIEnv* env, jclass cls, jmethodID meth, ...) {
va_list args;
jchar ret;
va_start(args, meth);
ret = SJVM_CallStaticCharMethodV(env, cls, meth, args);
va_end(args);
return ret;
}
extern JNICALL jchar SJVM_CallStaticCharMethodA(JNIEnv* env, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jchar) callStaticA(jvm, thread, method, args, &thread->nativeException).c;
}
extern JNICALL jshort SJVM_CallStaticShortMethodV(JNIEnv* env, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jshort) callStaticV(jvm, thread, method, args, &thread->nativeException).s;
}
extern JNICALL jshort SJVM_CallStaticShortMethod(JNIEnv* env, jclass cls, jmethodID meth, ...) {
va_list args;
jshort ret;
va_start(args, meth);
ret = SJVM_CallStaticShortMethodV(env, cls, meth, args);
va_end(args);
return ret;
}
extern JNICALL jshort SJVM_CallStaticShortMethodA(JNIEnv* env, jclass cls, jmethodID meth, const jvalue* args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jshort) callStaticA(jvm, thread, method, args, &thread->nativeException).s;
}
extern JNICALL jint SJVM_CallStaticIntMethodV(JNIEnv* env, jclass cls, jmethodID meth, va_list args) {
MethodInfo* method = (MethodInfo*) meth;
SJVM* jvm = (SJVM*) env->functions->reserved0;
Thread* thread = (Thread*) env->functions->reserved1;
return (jint) callStaticV(jvm, thread, method, args, &thread->nativeException).i;
}