Mercurial > hg > truffle
comparison src/os/solaris/launcher/java.c @ 388:f008d3631bd1
6755845: JVM_FindClassFromBoot triggers assertions
Summary: Fixes assertions caused by one jvm_entry calling another, solved by refactoring code and modified gamma test.
Reviewed-by: dholmes, xlu
author | ksrini |
---|---|
date | Wed, 08 Oct 2008 08:10:51 -0700 |
parents | a61af66fc99e |
children | ad8c8ca4ab0f |
comparison
equal
deleted
inserted
replaced
387:fad66fdcb7fc | 388:f008d3631bd1 |
---|---|
1108 if (platformEncoding == NULL) { | 1108 if (platformEncoding == NULL) { |
1109 jstring propname = (*env)->NewStringUTF(env, "sun.jnu.encoding"); | 1109 jstring propname = (*env)->NewStringUTF(env, "sun.jnu.encoding"); |
1110 if (propname) { | 1110 if (propname) { |
1111 jclass cls; | 1111 jclass cls; |
1112 jmethodID mid; | 1112 jmethodID mid; |
1113 NULL_CHECK0 (cls = (*env)->FindClass(env, "java/lang/System")); | 1113 NULL_CHECK0 (cls = FindBootStrapClass(env, "java/lang/System")); |
1114 NULL_CHECK0 (mid = (*env)->GetStaticMethodID( | 1114 NULL_CHECK0 (mid = (*env)->GetStaticMethodID( |
1115 env, cls, | 1115 env, cls, |
1116 "getProperty", | 1116 "getProperty", |
1117 "(Ljava/lang/String;)Ljava/lang/String;")); | 1117 "(Ljava/lang/String;)Ljava/lang/String;")); |
1118 platformEncoding = (*env)->CallStaticObjectMethod ( | 1118 platformEncoding = (*env)->CallStaticObjectMethod ( |
1123 } | 1123 } |
1124 | 1124 |
1125 static jboolean isEncodingSupported(JNIEnv *env, jstring enc) { | 1125 static jboolean isEncodingSupported(JNIEnv *env, jstring enc) { |
1126 jclass cls; | 1126 jclass cls; |
1127 jmethodID mid; | 1127 jmethodID mid; |
1128 NULL_CHECK0 (cls = (*env)->FindClass(env, "java/nio/charset/Charset")); | 1128 NULL_CHECK0 (cls = FindBootStrapClass(env, "java/nio/charset/Charset")); |
1129 NULL_CHECK0 (mid = (*env)->GetStaticMethodID( | 1129 NULL_CHECK0 (mid = (*env)->GetStaticMethodID( |
1130 env, cls, | 1130 env, cls, |
1131 "isSupported", | 1131 "isSupported", |
1132 "(Ljava/lang/String;)Z")); | 1132 "(Ljava/lang/String;)Z")); |
1133 return (jboolean)(*env)->CallStaticObjectMethod (env, cls, mid, enc); | 1133 return (jboolean)(*env)->CallStaticObjectMethod (env, cls, mid, enc); |
1159 /* with the case that sun.jnu.encoding is undefined (enc == NULL) */ | 1159 /* with the case that sun.jnu.encoding is undefined (enc == NULL) */ |
1160 if (enc != NULL && isEncodingSupported(env, enc) == JNI_TRUE) { | 1160 if (enc != NULL && isEncodingSupported(env, enc) == JNI_TRUE) { |
1161 #else | 1161 #else |
1162 if (isEncodingSupported(env, enc) == JNI_TRUE) { | 1162 if (isEncodingSupported(env, enc) == JNI_TRUE) { |
1163 #endif | 1163 #endif |
1164 NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); | 1164 NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); |
1165 NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>", | 1165 NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>", |
1166 "([BLjava/lang/String;)V")); | 1166 "([BLjava/lang/String;)V")); |
1167 str = (*env)->NewObject(env, cls, mid, ary, enc); | 1167 str = (*env)->NewObject(env, cls, mid, ary, enc); |
1168 } else { | 1168 } else { |
1169 /*If the encoding specified in sun.jnu.encoding is not | 1169 /*If the encoding specified in sun.jnu.encoding is not |
1170 endorsed by "Charset.isSupported" we have to fall back | 1170 endorsed by "Charset.isSupported" we have to fall back |
1171 to use String(byte[]) explicitly here without specifying | 1171 to use String(byte[]) explicitly here without specifying |
1172 the encoding name, in which the StringCoding class will | 1172 the encoding name, in which the StringCoding class will |
1173 pickup the iso-8859-1 as the fallback converter for us. | 1173 pickup the iso-8859-1 as the fallback converter for us. |
1174 */ | 1174 */ |
1175 NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); | 1175 NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); |
1176 NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>", | 1176 NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>", |
1177 "([B)V")); | 1177 "([B)V")); |
1178 str = (*env)->NewObject(env, cls, mid, ary); | 1178 str = (*env)->NewObject(env, cls, mid, ary); |
1179 } | 1179 } |
1180 (*env)->DeleteLocalRef(env, ary); | 1180 (*env)->DeleteLocalRef(env, ary); |
1193 { | 1193 { |
1194 jarray cls; | 1194 jarray cls; |
1195 jarray ary; | 1195 jarray ary; |
1196 int i; | 1196 int i; |
1197 | 1197 |
1198 NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); | 1198 NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); |
1199 NULL_CHECK0(ary = (*env)->NewObjectArray(env, strc, cls, 0)); | 1199 NULL_CHECK0(ary = (*env)->NewObjectArray(env, strc, cls, 0)); |
1200 for (i = 0; i < strc; i++) { | 1200 for (i = 0; i < strc; i++) { |
1201 jstring str = NewPlatformString(env, *strv++); | 1201 jstring str = NewPlatformString(env, *strv++); |
1202 NULL_CHECK0(str); | 1202 NULL_CHECK0(str); |
1203 (*env)->SetObjectArrayElement(env, ary, i, str); | 1203 (*env)->SetObjectArrayElement(env, ary, i, str); |
1222 | 1222 |
1223 do { | 1223 do { |
1224 c = *t++; | 1224 c = *t++; |
1225 *s++ = (c == '.') ? '/' : c; | 1225 *s++ = (c == '.') ? '/' : c; |
1226 } while (c != '\0'); | 1226 } while (c != '\0'); |
1227 // use the application class loader for the main-class | |
1227 cls = (*env)->FindClass(env, buf); | 1228 cls = (*env)->FindClass(env, buf); |
1228 free(buf); | 1229 free(buf); |
1229 | 1230 |
1230 if (_launcher_debug) { | 1231 if (_launcher_debug) { |
1231 end = CounterGet(); | 1232 end = CounterGet(); |
1248 jclass cls; | 1249 jclass cls; |
1249 jmethodID mid; | 1250 jmethodID mid; |
1250 jobject jar, man, attr; | 1251 jobject jar, man, attr; |
1251 jstring str, result = 0; | 1252 jstring str, result = 0; |
1252 | 1253 |
1253 NULL_CHECK0(cls = (*env)->FindClass(env, "java/util/jar/JarFile")); | 1254 NULL_CHECK0(cls = FindBootStrapClass(env, "java/util/jar/JarFile")); |
1254 NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>", | 1255 NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "<init>", |
1255 "(Ljava/lang/String;)V")); | 1256 "(Ljava/lang/String;)V")); |
1256 NULL_CHECK0(str = NewPlatformString(env, jarname)); | 1257 NULL_CHECK0(str = NewPlatformString(env, jarname)); |
1257 NULL_CHECK0(jar = (*env)->NewObject(env, cls, mid, str)); | 1258 NULL_CHECK0(jar = (*env)->NewObject(env, cls, mid, str)); |
1258 NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "getManifest", | 1259 NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "getManifest", |
1469 PrintJavaVersion(JNIEnv *env) | 1470 PrintJavaVersion(JNIEnv *env) |
1470 { | 1471 { |
1471 jclass ver; | 1472 jclass ver; |
1472 jmethodID print; | 1473 jmethodID print; |
1473 | 1474 |
1474 NULL_CHECK(ver = (*env)->FindClass(env, "sun/misc/Version")); | 1475 NULL_CHECK(ver = FindBootStrapClass(env, "sun/misc/Version")); |
1475 NULL_CHECK(print = (*env)->GetStaticMethodID(env, ver, "print", "()V")); | 1476 NULL_CHECK(print = (*env)->GetStaticMethodID(env, ver, "print", "()V")); |
1476 | 1477 |
1477 (*env)->CallStaticVoidMethod(env, ver, print); | 1478 (*env)->CallStaticVoidMethod(env, ver, print); |
1478 } | 1479 } |
1479 | 1480 |