[PATCH] PR2652: CACAO fails as a build VM for icedtea

Stefan Ring stefan at complang.tuwien.ac.at
Thu Oct 15 13:01:35 UTC 2015


I've also pushed this here:
https://bitbucket.org/Ringdingcoder/icedtea7-2.6/commits/fe0d3806c5ada75823de4ef116ca5cb80b4e88df

This fixes the problem and works very well, but is not backwards compatible
with older jdk versions (as in icedtea 2.5). I plan to commit a more flexible
patch to the CACAO repository at some point in the future.

 ChangeLog                              |   9 ++++
 Makefile.am                            |   3 +-
 NEWS                                   |   2 +
 README                                 |   2 +-
 patches/cacao/pr2652-classloader.patch |  74 ++++++++++++++++++++++++++++++++++
 5 files changed, 88 insertions(+), 2 deletions(-)


# HG changeset patch
# User Stefan Ring <stefan at complang.tuwien.ac.at>
# Date 1444840368 -7200
#      Wed Oct 14 18:32:48 2015 +0200
# Node ID fe0d3806c5ada75823de4ef116ca5cb80b4e88df
# Parent  b64e1444311ca34819f9a1fb613af38f67e3bba2
PR2652: CACAO fails as a build VM for icedtea

diff -r b64e1444311c -r fe0d3806c5ad ChangeLog
--- a/ChangeLog	Fri Aug 21 21:22:06 2015 +0100
+++ b/ChangeLog	Wed Oct 14 18:32:48 2015 +0200
@@ -1,3 +1,12 @@
+2015-10-15  Stefan Ring <stefan at complang.tuwien.ac.at>
+	PR2652: CACAO fails as a build VM for icedtea
+	* Makefile.am:
+	(ICEDTEA_PATCHES): Add CACAO patch for PR2652.
+	* NEWS: Updated.
+	* README: Fix CACAO URL.
+	* patches/cacao/pr2652-classloader.patch:
+	Set classLoader field in java.lang.Class as expected by JDK.
+
 2015-08-21  Andrew John Hughes  <gnu.andrew at member.fsf.org>
 
 	* NEWS: Replace temporary OpenJDK 7
diff -r b64e1444311c -r fe0d3806c5ad Makefile.am
--- a/Makefile.am	Fri Aug 21 21:22:06 2015 +0100
+++ b/Makefile.am	Wed Oct 14 18:32:48 2015 +0200
@@ -383,7 +383,8 @@
 	patches/cacao/launcher.patch \
 	patches/cacao/memory.patch \
 	patches/cacao/pr2032.patch \
-	patches/cacao/pr2520-tempdir.patch
+	patches/cacao/pr2520-tempdir.patch \
+	patches/cacao/pr2652-classloader.patch
 else
 if USING_CACAO
 ICEDTEA_PATCHES += \
diff -r b64e1444311c -r fe0d3806c5ad NEWS
--- a/NEWS	Fri Aug 21 21:22:06 2015 +0100
+++ b/NEWS	Wed Oct 14 18:32:48 2015 +0200
@@ -13,6 +13,8 @@
 CVE-XXXX-YYYY: http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=XXXX-YYYY
 
 New in release 2.6.2 (2015-10-XX):
+* CACAO
+  - PR2652: Set classLoader field in java.lang.Class as expected by JDK
 
 New in release 2.6.1 (2015-07-21):
 
diff -r b64e1444311c -r fe0d3806c5ad README
--- a/README	Fri Aug 21 21:22:06 2015 +0100
+++ b/README	Wed Oct 14 18:32:48 2015 +0200
@@ -69,7 +69,7 @@
 CACAO as VM
 ===========
 
-The CACAO virtual machine (http://cacaovm.org) can be used as an
+The CACAO virtual machine (http://cacaojvm.org) can be used as an
 alternative to the HotSpot virtual machine. One advantage of this is
 that it already provides a JIT for many platforms to which HotSpot has
 not yet been ported, including ppc, arm and mips.  To use CACAO as the
diff -r b64e1444311c -r fe0d3806c5ad patches/cacao/pr2652-classloader.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/cacao/pr2652-classloader.patch	Wed Oct 14 18:32:48 2015 +0200
@@ -0,0 +1,74 @@
+Set classLoader field in java.lang.Class as expected by JDK
+
+--- cacao/cacao/src/vm/class.cpp
++++ cacao/cacao/src/vm/class.cpp
+@@ -314,6 +314,9 @@
+ 
+ 	c = classcache_store(cl, c, true);
+ 
++	java_lang_Class jlc(LLNI_classinfo_wrap(c));
++	jlc.set_classLoader(cl);
++
+ 	return c;
+ }
+ 
+--- cacao/cacao/src/vm/javaobjects.cpp
++++ cacao/cacao/src/vm/javaobjects.cpp
+@@ -270,11 +270,19 @@
+ 	{ 0, 0 }
+ };
+ 
++off_t java_lang_Class::offset_classLoader;
++
++static DynOffsetEntry dyn_entries_java_lang_Class[] = {
++	{ &java_lang_Class::set_classLoader_offset, "classLoader" },
++	{ 0, 0 }
++};
++
+ #endif
+ 
+ void jobjects_register_dyn_offsets()
+ {
+ 	register_dyn_entry_table(class_java_lang_Thread, dyn_entries_java_lang_Thread);
++	register_dyn_entry_table(class_java_lang_Class, dyn_entries_java_lang_Class);
+ }
+ 
+ #endif // ENABLE_JAVASE
+--- cacao/cacao/src/vm/javaobjects.hpp
++++ cacao/cacao/src/vm/javaobjects.hpp
+@@ -1847,6 +1847,35 @@
+ 
+ 
+ /**
++ * OpenJDK java/lang/Class
++ *
++ * Object layout:
++ *
++ * 0. object header
++ * ? java.lang.ClassLoader classLoader
++ */
++class java_lang_Class : public java_lang_Object, private FieldAccess {
++private:
++	// Static offsets of the object's instance fields.
++	static off_t offset_classLoader;
++
++public:
++	java_lang_Class(java_handle_t* h) : java_lang_Object(h) {}
++
++	// Setters.
++	void set_classLoader(java_handle_t* value);
++
++	// Offset initializers
++	static void set_classLoader_offset(int32_t off) { offset_classLoader = off; }
++};
++
++inline void java_lang_Class::set_classLoader(java_handle_t* value)
++{
++	assert(offset_classLoader);
++	set(_handle, offset_classLoader, value);
++}
++
++/**
+  * OpenJDK java/lang/ClassLoader
+  *
+  * Object layout:



More information about the distro-pkg-dev mailing list