changeset 2879:1818eebd5305

PR2665: icedtea/jamvm 2.6 fails as a build VM for icedtea 2016-04-20 Andrew John Hughes <gnu.andrew@member.fsf.org> PR2665: icedtea/jamvm 2.6 fails as a build VM for icedtea * Makefile.am: (ICEDTEA_PATCHES): Add new patch. * NEWS: Updated. * patches/jamvm/pr2665.patch: Set the classLoader field in java.lang.Class when a class is defined.
author Andrew John Hughes <gnu_andrew@member.fsf.org>
date Thu, 21 Apr 2016 23:27:41 +0100
parents c37d028fc49b
children dcc404efa123
files ChangeLog Makefile.am NEWS patches/jamvm/pr2665.patch
diffstat 4 files changed, 51 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Apr 19 01:17:25 2016 +0100
+++ b/ChangeLog	Thu Apr 21 23:27:41 2016 +0100
@@ -1,3 +1,14 @@
+2016-04-20  Andrew John Hughes  <gnu.andrew@member.fsf.org>
+
+	PR2665: icedtea/jamvm 2.6 fails as a
+	build VM for icedtea
+	* Makefile.am:
+	(ICEDTEA_PATCHES): Add new patch.
+	* NEWS: Updated.
+	* patches/jamvm/pr2665.patch:
+	Set the classLoader field in java.lang.Class
+	when a class is defined.
+
 2016-04-17  Andrew John Hughes  <gnu.andrew@member.fsf.org>
 
 	Bump to icedtea-2.6.6pre01.
--- a/Makefile.am	Tue Apr 19 01:17:25 2016 +0100
+++ b/Makefile.am	Thu Apr 21 23:27:41 2016 +0100
@@ -403,7 +403,8 @@
 ICEDTEA_PATCHES += \
 	patches/jamvm/find_class_from_caller.patch \
 	patches/jamvm/pr2172-tempdir.patch \
-	patches/jamvm/noexecstack.patch
+	patches/jamvm/noexecstack.patch \
+	patches/jamvm/pr2665.patch
 endif
 
 if ENABLE_NSS
--- a/NEWS	Tue Apr 19 01:17:25 2016 +0100
+++ b/NEWS	Thu Apr 21 23:27:41 2016 +0100
@@ -18,6 +18,8 @@
   - PR2889: OpenJDK should check for system cacerts database (e.g. /etc/pki/java/cacerts)
 * AArch64 port
   - PR2914: byte_map_base is not page aligned on OpenJDK 7
+* JamVM
+  - PR2665: icedtea/jamvm 2.6 fails as a build VM for icedtea
 
 New in release 2.6.5 (2016-03-24):
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/jamvm/pr2665.patch	Thu Apr 21 23:27:41 2016 +0100
@@ -0,0 +1,36 @@
+diff --git a/src/symbol.h b/src/symbol.h
+index 8864fcb..c3836a7 100644
+--- jamvm.orig/jamvm/src/symbol.h
++++ jamvm/jamvm/src/symbol.h
+@@ -60,6 +60,7 @@ extern char *symbol_values[];
+     action(uncaughtException, "uncaughtException"), \
+     action(contextClassLoader, "contextClassLoader"), \
+     action(getSystemClassLoader, "getSystemClassLoader"), \
++    action(classLoader, "classLoader"), \
+     \
+     /* Constant pool attribute names */\
+     action(Code, "Code"), \
+diff --git a/src/classlib/openjdk/jvm.c b/src/classlib/openjdk/jvm.c
+index b5f4cae..fc10983 100644
+--- jamvm.orig/jamvm/src/classlib/openjdk/jvm.c
++++ jamvm/jamvm/src/classlib/openjdk/jvm.c
+@@ -578,6 +575,19 @@ jclass JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader,
+     if(class != NULL) {
+         CLASS_CB(class)->protection_domain = pd;
+         linkClass(class);
++
++	/* Set classLoader field in java.lang.Class instance */
++	FieldBlock *class_loader_fb = findField(class->class,
++						SYMBOL(classLoader),
++						SYMBOL(sig_java_lang_ClassLoader));
++	if (class_loader_fb == NULL) {
++	    jam_fprintf(stderr, "defineClass: classLoader field missing"
++			" in java.lang.Class\n");
++	    exitVM(1);
++	}
++
++	int cl_offset = class_loader_fb->u.offset;
++	INST_DATA(class, Object*, cl_offset) = loader;
+     }
+ 
+     return class;