Lines Matching defs:jenv

159 dtj_load_common(JNIEnv *jenv)
257 status = dtj_cache_jni_classes(jenv, table);
297 dtj_java_class_create(JNIEnv *jenv, jclass *jc, char *name,
309 dtj_throw_out_of_memory(jenv,
318 dtj_throw_out_of_memory(jenv,
327 dtj_throw_out_of_memory(jenv,
334 dtj_java_method_create(JNIEnv *jenv, jmethodID *jm, char *name, char *signature,
345 dtj_throw_out_of_memory(jenv,
352 dtj_java_static_method_create(JNIEnv *jenv, jmethodID *jm, char *name,
355 dtj_java_method_t *m = dtj_java_method_create(jenv, jm, name, signature,
364 dtj_java_field_create(JNIEnv *jenv, jfieldID *jf, char *name, char *type,
375 dtj_throw_out_of_memory(jenv,
382 dtj_java_static_field_create(JNIEnv *jenv, jfieldID *jf, char *name, char *type,
385 dtj_java_field_t *f = dtj_java_field_create(jenv, jf, name, type,
436 dtj_cache_jni_classes(JNIEnv *jenv, const dtj_table_entry_t *table)
453 dtj_throw_out_of_memory(jenv, "failed class pool creation");
461 dtj_throw_out_of_memory(jenv, "failed method pool creation");
469 dtj_throw_out_of_memory(jenv, "failed field pool creation");
476 dtj_throw_out_of_memory(jenv, "failed class list creation");
480 status = dtj_get_jni_classes(jenv, classes, classpool, methodpool,
489 jc = (*jenv)->FindClass(jenv, class->djc_name);
494 gjc = (*jenv)->NewGlobalRef(jenv, jc);
495 (*jenv)->DeleteLocalRef(jenv, jc);
497 dtj_throw_out_of_memory(jenv,
502 status = dtj_cache_jni_methods(jenv, class);
507 status = dtj_cache_jni_fields(jenv, class);
525 dtj_get_jni_classes(JNIEnv *jenv, uu_list_t *classes,
545 dtj_throw_out_of_memory(jenv,
556 c = dtj_java_class_create(jenv,
566 dtj_throw_illegal_state(jenv,
571 m = dtj_java_method_create(jenv,
580 dtj_throw_out_of_memory(jenv,
587 dtj_throw_illegal_state(jenv,
592 m = dtj_java_static_method_create(jenv,
601 dtj_throw_out_of_memory(jenv,
608 dtj_throw_illegal_state(jenv,
613 f = dtj_java_field_create(jenv,
622 dtj_throw_out_of_memory(jenv,
629 dtj_throw_illegal_state(jenv,
634 f = dtj_java_static_field_create(jenv,
643 dtj_throw_out_of_memory(jenv,
649 dtj_throw_illegal_state(jenv,
657 dtj_throw_out_of_memory(jenv,
667 dtj_cache_jni_methods(JNIEnv *jenv, dtj_java_class_t *c)
675 jm = (*jenv)->GetStaticMethodID(jenv, *(c->djc_ptr),
678 jm = (*jenv)->GetMethodID(jenv, *(c->djc_ptr),
693 (*jenv)->ExceptionClear(jenv);
698 jc = (*jenv)->FindClass(jenv,
700 (*jenv)->ThrowNew(jenv, jc, msg);
701 (*jenv)->DeleteLocalRef(jenv, jc);
711 dtj_cache_jni_fields(JNIEnv *jenv, dtj_java_class_t *c)
719 jf = (*jenv)->GetStaticFieldID(jenv, *(c->djc_ptr),
722 jf = (*jenv)->GetFieldID(jenv, *(c->djc_ptr),
728 (*jenv)->ExceptionClear(jenv);
733 jc = (*jenv)->FindClass(jenv,
735 (*jenv)->ThrowNew(jenv, jc, msg);
736 (*jenv)->DeleteLocalRef(jenv, jc);
749 dtj_throw(JNIEnv *jenv, jclass jc, const char *fmt, va_list *ap)
753 (*jenv)->ThrowNew(jenv, jc, msg);
757 dtj_throw_out_of_memory(JNIEnv *jenv, const char *fmt, ...)
766 if ((*jenv)->ExceptionCheck(jenv)) {
769 jc = (*jenv)->FindClass(jenv,
772 dtj_throw(jenv, jc, fmt, &ap);
773 (*jenv)->DeleteLocalRef(jenv, jc);
778 dtj_throw_null_pointer(JNIEnv *jenv, const char *fmt, ...)
781 jclass jc = (*jenv)->FindClass(jenv,
784 dtj_throw(jenv, jc, fmt, &ap);
785 (*jenv)->DeleteLocalRef(jenv, jc);
790 dtj_throw_illegal_state(JNIEnv *jenv, const char *fmt, ...)
793 jclass jc = (*jenv)->FindClass(jenv,
796 dtj_throw(jenv, jc, fmt, &ap);
797 (*jenv)->DeleteLocalRef(jenv, jc);
802 dtj_throw_illegal_argument(JNIEnv *jenv, const char *fmt, ...)
805 jclass jc = (*jenv)->FindClass(jenv,
808 dtj_throw(jenv, jc, fmt, &ap);
809 (*jenv)->DeleteLocalRef(jenv, jc);
814 dtj_throw_no_such_element(JNIEnv *jenv, const char *fmt, ...)
817 jclass jc = (*jenv)->FindClass(jenv,
820 dtj_throw(jenv, jc, fmt, &ap);
821 (*jenv)->DeleteLocalRef(jenv, jc);
826 dtj_throw_class_cast(JNIEnv *jenv, const char *fmt, ...)
829 jclass jc = (*jenv)->FindClass(jenv,
832 dtj_throw(jenv, jc, fmt, &ap);
833 (*jenv)->DeleteLocalRef(jenv, jc);
838 dtj_throw_assertion(JNIEnv *jenv, const char *fmt, ...)
841 jclass jc = (*jenv)->FindClass(jenv,
844 dtj_throw(jenv, jc, fmt, &ap);
845 (*jenv)->DeleteLocalRef(jenv, jc);
850 dtj_throw_resource_limit(JNIEnv *jenv, const char *fmt, ...)
853 jclass jc = (*jenv)->FindClass(jenv,
856 dtj_throw(jenv, jc, fmt, &ap);
857 (*jenv)->DeleteLocalRef(jenv, jc);
862 dtj_wrap_exception(JNIEnv *jenv, const char *file, int line)
868 e = (*jenv)->ExceptionOccurred(jenv);
877 (*jenv)->ExceptionClear(jenv);
880 if ((*jenv)->IsInstanceOf(jenv, e, g_nx_jc)) {
882 (*jenv)->Throw(jenv, e);
883 (*jenv)->DeleteLocalRef(jenv, e);
887 jfile = dtj_NewStringNative(jenv, file);
888 if ((*jenv)->ExceptionCheck(jenv)) {
893 (*jenv)->ExceptionClear(jenv);
894 (*jenv)->Throw(jenv, e);
895 (*jenv)->DeleteLocalRef(jenv, e);
899 nx = (jthrowable)(*jenv)->NewObject(jenv, g_nx_jc, g_nxinit_jm,
901 (*jenv)->DeleteLocalRef(jenv, jfile);
902 if ((*jenv)->ExceptionCheck(jenv)) {
903 (*jenv)->ExceptionClear(jenv);
904 (*jenv)->Throw(jenv, e);
905 (*jenv)->DeleteLocalRef(jenv, e);
909 (*jenv)->DeleteLocalRef(jenv, e);
910 (*jenv)->Throw(jenv, nx);
911 (*jenv)->DeleteLocalRef(jenv, nx);
920 dtj_print_object(JNIEnv *jenv, jobject jobj)
926 dtj_throw_illegal_state(jenv,
928 (*jenv)->ExceptionDescribe(jenv); /* clears the exception */
937 jstr = (*jenv)->CallObjectMethod(jenv, jobj, g_tostring_jm);
938 if ((*jenv)->ExceptionCheck(jenv)) {
939 (*jenv)->ExceptionDescribe(jenv); /* clears the exception */
942 cstr = (*jenv)->GetStringUTFChars(jenv, jstr, 0);
946 (*jenv)->ExceptionDescribe(jenv); /* clears the exception */
947 (*jenv)->DeleteLocalRef(jenv, jstr);
950 (*jenv)->ReleaseStringUTFChars(jenv, jstr, cstr);
951 (*jenv)->DeleteLocalRef(jenv, jstr);
955 dtj_uint64(JNIEnv *jenv, uint64_t u)
961 val64 = (*jenv)->CallStaticObjectMethod(jenv, g_bigint_jc,
967 val64 = (*jenv)->CallStaticObjectMethod(jenv, g_bigint_jc,
970 val64 = (*jenv)->CallObjectMethod(jenv, tmp,
972 (*jenv)->DeleteLocalRef(jenv, tmp);
979 dtj_int128(JNIEnv *jenv, uint64_t high, uint64_t low)
985 val128 = (*jenv)->CallStaticObjectMethod(jenv, g_bigint_jc,
988 val128 = (*jenv)->CallObjectMethod(jenv, tmp, g_bigint_shl_jm, 64);
989 (*jenv)->DeleteLocalRef(jenv, tmp);
990 low64 = dtj_uint64(jenv, low);
992 val128 = (*jenv)->CallObjectMethod(jenv, tmp, g_bigint_or_jm, low64);
993 (*jenv)->DeleteLocalRef(jenv, tmp);
994 (*jenv)->DeleteLocalRef(jenv, low64);
1000 dtj_format_string(JNIEnv *jenv, const char *fmt, ...)
1011 jstr = dtj_NewStringNative(jenv, str);
1017 dtj_NewStringNative(JNIEnv *jenv, const char *str)
1024 dtj_throw_illegal_state(jenv,
1031 bytes = (*jenv)->NewByteArray(jenv, len);
1035 (*jenv)->SetByteArrayRegion(jenv, bytes, 0, len,
1037 if ((*jenv)->ExceptionCheck(jenv)) {
1038 (*jenv)->DeleteLocalRef(jenv, bytes);
1041 result = (*jenv)->NewObject(jenv, g_string_jc, g_strinit_bytes_jm,
1043 (*jenv)->DeleteLocalRef(jenv, bytes);
1049 dtj_GetStringNativeChars(JNIEnv *jenv, jstring jstr)
1057 dtj_throw_illegal_state(jenv,
1062 bytes = (*jenv)->CallObjectMethod(jenv, jstr, g_strbytes_jm);
1063 if ((*jenv)->ExceptionCheck(jenv)) {
1067 len = (*jenv)->GetArrayLength(jenv, bytes);
1070 (*jenv)->DeleteLocalRef(jenv, bytes);
1071 dtj_throw_out_of_memory(jenv,
1077 (*jenv)->GetByteArrayRegion(jenv, bytes, 0, len,
1079 (*jenv)->DeleteLocalRef(jenv, bytes);
1087 dtj_ReleaseStringNativeChars(JNIEnv *jenv, jstring jstr, const char *str)
1093 dtj_get_argv(JNIEnv *jenv, jobjectArray args, int *argc)
1102 dtj_throw_illegal_state(jenv,
1107 *argc = (*jenv)->GetArrayLength(jenv, args);
1116 dtj_throw_out_of_memory(jenv, "Failed to allocate args array");
1121 jstr = (*jenv)->GetObjectArrayElement(jenv, args, i);
1122 if ((*jenv)->ExceptionCheck(jenv)) {
1126 str = dtj_GetStringNativeChars(jenv, jstr);
1127 if ((*jenv)->ExceptionCheck(jenv)) {
1129 (*jenv)->DeleteLocalRef(jenv, jstr);
1134 dtj_throw_out_of_memory(jenv, "Failed to allocate arg");
1136 dtj_ReleaseStringNativeChars(jenv, jstr, str);
1137 (*jenv)->DeleteLocalRef(jenv, jstr);
1141 dtj_ReleaseStringNativeChars(jenv, jstr, str);
1142 (*jenv)->DeleteLocalRef(jenv, jstr);
1150 dtj_make_argv(JNIEnv *jenv, jstring command, int *argc)
1160 dtj_throw_illegal_state(jenv,
1166 dtj_throw_null_pointer(jenv, "command is null");
1168 } else if ((*jenv)->GetStringLength(jenv, command) == 0) {
1169 dtj_throw_illegal_argument(jenv, "command is empty");
1173 cmd = dtj_GetStringNativeChars(jenv, command);
1174 if ((*jenv)->ExceptionCheck(jenv)) {
1180 dtj_throw_out_of_memory(jenv,
1182 dtj_ReleaseStringNativeChars(jenv, command, cmd);
1196 dtj_throw_out_of_memory(jenv, "failed to allocate args array");
1198 dtj_ReleaseStringNativeChars(jenv, command, cmd);
1206 dtj_throw_out_of_memory(jenv, "Failed to allocate arg");
1209 dtj_ReleaseStringNativeChars(jenv, command, cmd);
1216 dtj_throw_illegal_argument(jenv, "command is blank");
1219 dtj_ReleaseStringNativeChars(jenv, command, cmd);
1224 dtj_ReleaseStringNativeChars(jenv, command, cmd);