858 CHECK_NULL);
859 if (anonk == NULL) {
860 return NULL;
861 }
862
863 return InstanceKlass::cast(anonk);
864 }
865
866 UNSAFE_ENTRY(jclass, Unsafe_DefineAnonymousClass0(JNIEnv *env, jobject unsafe, jclass host_class, jbyteArray data, jobjectArray cp_patches_jh)) {
867 ResourceMark rm(THREAD);
868
869 jobject res_jh = NULL;
870 u1* temp_alloc = NULL;
871
872 InstanceKlass* anon_klass = Unsafe_DefineAnonymousClass_impl(env, host_class, data, cp_patches_jh, &temp_alloc, THREAD);
873 if (anon_klass != NULL) {
874 res_jh = JNIHandles::make_local(env, anon_klass->java_mirror());
875 }
876
877 // try/finally clause:
878 if (temp_alloc != NULL) {
879 FREE_C_HEAP_ARRAY(u1, temp_alloc);
880 }
881
882 // The anonymous class loader data has been artificially been kept alive to
883 // this point. The mirror and any instances of this class have to keep
884 // it alive afterwards.
885 if (anon_klass != NULL) {
886 anon_klass->class_loader_data()->dec_keep_alive();
887 }
888
889 // let caller initialize it as needed...
890
891 return (jclass) res_jh;
892 } UNSAFE_END
893
894
895
896 UNSAFE_ENTRY(void, Unsafe_ThrowException(JNIEnv *env, jobject unsafe, jthrowable thr)) {
897 ThreadToNativeFromVM ttnfv(thread);
898 env->Throw(thr);
899 } UNSAFE_END
900
|
858 CHECK_NULL);
859 if (anonk == NULL) {
860 return NULL;
861 }
862
863 return InstanceKlass::cast(anonk);
864 }
865
866 UNSAFE_ENTRY(jclass, Unsafe_DefineAnonymousClass0(JNIEnv *env, jobject unsafe, jclass host_class, jbyteArray data, jobjectArray cp_patches_jh)) {
867 ResourceMark rm(THREAD);
868
869 jobject res_jh = NULL;
870 u1* temp_alloc = NULL;
871
872 InstanceKlass* anon_klass = Unsafe_DefineAnonymousClass_impl(env, host_class, data, cp_patches_jh, &temp_alloc, THREAD);
873 if (anon_klass != NULL) {
874 res_jh = JNIHandles::make_local(env, anon_klass->java_mirror());
875 }
876
877 // try/finally clause:
878 FREE_C_HEAP_ARRAY(u1, temp_alloc);
879
880 // The anonymous class loader data has been artificially been kept alive to
881 // this point. The mirror and any instances of this class have to keep
882 // it alive afterwards.
883 if (anon_klass != NULL) {
884 anon_klass->class_loader_data()->dec_keep_alive();
885 }
886
887 // let caller initialize it as needed...
888
889 return (jclass) res_jh;
890 } UNSAFE_END
891
892
893
894 UNSAFE_ENTRY(void, Unsafe_ThrowException(JNIEnv *env, jobject unsafe, jthrowable thr)) {
895 ThreadToNativeFromVM ttnfv(thread);
896 env->Throw(thr);
897 } UNSAFE_END
898
|