mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8238358: Implementation of JEP 371: Hidden Classes
Co-authored-by: Lois Foltan <lois.foltan@oracle.com> Co-authored-by: David Holmes <david.holmes@oracle.com> Co-authored-by: Harold Seigel <harold.seigel@oracle.com> Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com> Co-authored-by: Alex Buckley <alex.buckley@oracle.com> Co-authored-by: Jamsheed Mohammed C M <jamsheed.c.m@oracle.com> Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com> Co-authored-by: Amy Lu <amy.lu@oracle.com> Reviewed-by: alanb, cjplummer, coleenp, dholmes, dlong, forax, jlahoda, psandoz, plevart, sspitsyn, vromero
This commit is contained in:
parent
642041adbc
commit
7cc1371059
198 changed files with 9526 additions and 1575 deletions
|
@ -207,6 +207,66 @@ Java_java_lang_ClassLoader_defineClass2(JNIEnv *env,
|
|||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jclass JNICALL
|
||||
Java_java_lang_ClassLoader_defineClass0(JNIEnv *env,
|
||||
jclass cls,
|
||||
jobject loader,
|
||||
jclass lookup,
|
||||
jstring name,
|
||||
jbyteArray data,
|
||||
jint offset,
|
||||
jint length,
|
||||
jobject pd,
|
||||
jboolean initialize,
|
||||
jint flags,
|
||||
jobject classData)
|
||||
{
|
||||
jbyte *body;
|
||||
char *utfName;
|
||||
jclass result = 0;
|
||||
char buf[128];
|
||||
|
||||
if (data == NULL) {
|
||||
JNU_ThrowNullPointerException(env, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Work around 4153825. malloc crashes on Solaris when passed a
|
||||
* negative size.
|
||||
*/
|
||||
if (length < 0) {
|
||||
JNU_ThrowArrayIndexOutOfBoundsException(env, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
body = (jbyte *)malloc(length);
|
||||
if (body == 0) {
|
||||
JNU_ThrowOutOfMemoryError(env, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
(*env)->GetByteArrayRegion(env, data, offset, length, body);
|
||||
|
||||
if ((*env)->ExceptionOccurred(env))
|
||||
goto free_body;
|
||||
|
||||
if (name != NULL) {
|
||||
utfName = getUTF(env, name, buf, sizeof(buf));
|
||||
if (utfName == NULL) {
|
||||
goto free_body;
|
||||
}
|
||||
fixClassname(utfName);
|
||||
} else {
|
||||
utfName = NULL;
|
||||
}
|
||||
|
||||
return JVM_LookupDefineClass(env, lookup, utfName, body, length, pd, initialize, flags, classData);
|
||||
|
||||
free_body:
|
||||
free(body);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns NULL if class not found.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue