aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2012-10-06 04:40:39 +0800
committerjkim <jkim@FreeBSD.org>2012-10-06 04:40:39 +0800
commit0f95312ade7fe18fb8ffef89566bddacc32c0c41 (patch)
treeb24adc88a423563cc6bc7f67ef613cd5df131f7a /java
parentca5ccbdac043162cb51b5bea497f98e6a95794e5 (diff)
downloadfreebsd-ports-gnome-0f95312ade7fe18fb8ffef89566bddacc32c0c41.tar.gz
freebsd-ports-gnome-0f95312ade7fe18fb8ffef89566bddacc32c0c41.tar.zst
freebsd-ports-gnome-0f95312ade7fe18fb8ffef89566bddacc32c0c41.zip
- Update to 1.6.0.
- Reset maintainership. See ports/164941. - Make it as amd64 and i386 only. Other architectures needs porting. - Reduce Makefile headers, add licenses, and convert to optionsNG. - Add an option to build with native JDK. When it is not selected, GCJ is used instead. Turned on by default.
Diffstat (limited to 'java')
-rw-r--r--java/cacao/Makefile65
-rw-r--r--java/cacao/distinfo4
-rw-r--r--java/cacao/files/gcj.patch20
-rw-r--r--java/cacao/files/patch-boehm-gc-dyn_load.c15
-rw-r--r--java/cacao/files/patch-boehm-gc-include-private-gcconfig.h88
-rw-r--r--java/cacao/files/patch-boehm-gc-os_dep.c29
-rw-r--r--java/cacao/files/patch-boehm-gc__configure10
-rw-r--r--java/cacao/files/patch-boehm-gc__dbg_ml.c (renamed from java/cacao/files/patch-boehm-gc-dbg_ml.c)56
-rw-r--r--java/cacao/files/patch-boehm-gc__include__gc.h (renamed from java/cacao/files/patch-boehm-gc-include-gc.h)0
-rw-r--r--java/cacao/files/patch-boehm-gc__include__private__gcconfig.h89
-rw-r--r--java/cacao/files/patch-boehm-gc__pthread_support.c20
-rw-r--r--java/cacao/files/patch-configure30
-rw-r--r--java/cacao/files/patch-src-Makefile.in18
-rw-r--r--java/cacao/files/patch-src-native-jni.h16
-rw-r--r--java/cacao/files/patch-src__cacao__cacao.cpp14
-rw-r--r--java/cacao/files/patch-src__threads__posix__thread-posix.cpp11
-rw-r--r--java/cacao/files/patch-src__threads__thread.cpp11
-rw-r--r--java/cacao/files/patch-src__vm__jit__i386__freebsd__md-os.c325
-rw-r--r--java/cacao/files/patch-src__vm__jit__x86_64__freebsd__md-os.c217
-rw-r--r--java/cacao/files/patch-src__vm__properties.cpp14
-rw-r--r--java/cacao/pkg-plist6
21 files changed, 829 insertions, 229 deletions
diff --git a/java/cacao/Makefile b/java/cacao/Makefile
index 2d2f7bd301ad..c31e12de66c7 100644
--- a/java/cacao/Makefile
+++ b/java/cacao/Makefile
@@ -1,40 +1,65 @@
-# New ports collection makefile for: cacao
-# Date created: 2005-04-28
-# Whom: arved
-#
+# Created by: Tilman Keskinoz <arved@FreeBSD.org>
# $FreeBSD$
PORTNAME= cacao
-PORTVERSION= 0.98
-PORTREVISION= 7
+PORTVERSION= 1.6.0
CATEGORIES= java devel
MASTER_SITES= http://www.complang.tuwien.ac.at/cacaojvm/download/cacao-${PORTVERSION}/
-MAINTAINER= bkoenig@alpha-tierchen.de
+MAINTAINER= java@FreeBSD.org
COMMENT= JIT compiler for JAVA
+LICENSE= GPLv2
+
BUILD_DEPENDS= ${LOCALBASE}/share/classpath/glibj.zip:${PORTSDIR}/java/classpath
+RUN_DEPENDS= ${LOCALBASE}/share/classpath/glibj.zip:${PORTSDIR}/java/classpath
-USE_BZIP2= yes
-USE_AUTOTOOLS= libltdl
-USE_JAVA= yes
-JAVA_VERSION= 1.5+
GNU_CONFIGURE= yes
+USE_GMAKE= yes
+USE_XZ= yes
+
MAN1= cacao.1
-CONFIGURE_ARGS+= --with-classpath-prefix=${LOCALBASE}
-LDFLAGS+= -L${LOCALBASE}/lib
-CFLAGS+= -I${LOCALBASE}/include
-.include <bsd.port.pre.mk>
+CONFIGURE_ARGS= --with-java-runtime-library=gnuclasspath \
+ --with-java-runtime-library-prefix=${PREFIX} \
+ --with-build-java-runtime-library-classes=${LOCALBASE}/share/classpath/glibj.zip
+CONFIGURE_ENV= JAVAC="${JAVAC}" JAR="${JAR}"
+
+ONLY_FOR_ARCHS= amd64 i386
-.if ${ARCH} == amd64
-IGNORE= unsupported architecture
+OPTIONS_DEFINE= JDK
+OPTIONS_DEFAULT=JDK
+JDK_DESC= Build with native JDK
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MJDK}
+USE_JAVA= yes
+JAVA_BUILD= jdk
+JAVA_VERSION= 1.5+
+.else
+.if defined(WITH_GCC)
+GCC_SUFX= ${WITH_GCC:S/.//}
+.endif
+GCC_SUFX?= 46
+BUILD_DEPENDS+= gcj${GCC_SUFX}:${PORTSDIR}/lang/gcc${GCC_SUFX}
+EXTRA_PATCHES= ${FILESDIR}/gcj.patch
+JAR= ${LOCALBASE}/bin/gjar${GCC_SUFX}
+JAVAC= ${LOCALBASE}/bin/gcj${GCC_SUFX}
+JAVACFLAGS= -C
+CONFIGURE_ENV+= JAVACFLAGS="${JAVACFLAGS}"
+MAKE_ENV+= JAVACFLAGS="${JAVACFLAGS}"
.endif
post-patch:
- ${REINPLACE_CMD} -e "s, man,," ${WRKSRC}/Makefile.in
+ ${REINPLACE_CMD} -e 's|%%PTHREAD_LIBS%%|${PTHREAD_LIBS}|g' \
+ ${WRKSRC}/configure ${WRKSRC}/src/mm/boehm-gc/configure
-post-install:
+do-install:
+ ${MKDIR} ${DATADIR}
+ ${INSTALL_PROGRAM} ${WRKSRC}/src/cacao/cacao ${PREFIX}/bin
+ ${INSTALL_LIB} ${WRKSRC}/src/cacao/.libs/libjvm.so ${PREFIX}/lib
+ ${INSTALL_DATA} ${WRKSRC}/src/classes/vm.zip ${DATADIR}
${INSTALL_MAN} ${WRKSRC}/man/cacao.1 ${MANPREFIX}/man/man1
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/java/cacao/distinfo b/java/cacao/distinfo
index 9cb95d1a26ed..c3430b1c32d1 100644
--- a/java/cacao/distinfo
+++ b/java/cacao/distinfo
@@ -1,2 +1,2 @@
-SHA256 (cacao-0.98.tar.bz2) = cb9363add825cedf77764fc49a223aaf43f0a9f485b711ba8c92f16b13fff188
-SIZE (cacao-0.98.tar.bz2) = 2393690
+SHA256 (cacao-1.6.0.tar.xz) = e654e5f158b8fdc0b1282efacc370f6e65ee6c0336945506e86fd7e705d98626
+SIZE (cacao-1.6.0.tar.xz) = 2394588
diff --git a/java/cacao/files/gcj.patch b/java/cacao/files/gcj.patch
new file mode 100644
index 000000000000..caedccf7f2f4
--- /dev/null
+++ b/java/cacao/files/gcj.patch
@@ -0,0 +1,20 @@
+--- src/classes/Makefile.in.orig 2012-09-03 12:10:18.000000000 -0400
++++ src/classes/Makefile.in 2012-10-05 15:41:54.000000000 -0400
+@@ -531,7 +531,7 @@
+
+ @ENABLE_ZLIB_TRUE@vm.zip: $(VM_JAVA_FILES)
+ @ENABLE_ZLIB_TRUE@ $(mkdir_p) classes
+-@ENABLE_ZLIB_TRUE@ $(JAVAC) -bootclasspath $(BOOTCLASSPATH) -source 1.5 -target 1.5 -d classes $(VM_JAVA_FILES)
++@ENABLE_ZLIB_TRUE@ $(JAVAC) $(JAVACFLAGS) --bootclasspath=$(BOOTCLASSPATH) -fsource=1.5 -ftarget=1.5 -d classes $(VM_JAVA_FILES)
+ @ENABLE_ZLIB_TRUE@ @if test "$(JAR)" = "zip" -o "$(JAR)" = "zip.exe"; then \
+ @ENABLE_ZLIB_TRUE@ cd classes && $(JAR) -r -D $(VM_ZIP) .; \
+ @ENABLE_ZLIB_TRUE@ else \
+@@ -539,7 +539,7 @@
+ @ENABLE_ZLIB_TRUE@ fi
+ @ENABLE_ZLIB_FALSE@nozip: $(VM_JAVA_FILES)
+ @ENABLE_ZLIB_FALSE@ $(mkdir_p) classes
+-@ENABLE_ZLIB_FALSE@ $(JAVAC) -bootclasspath $(BOOTCLASSPATH) -source 1.5 -target 1.5 -d classes $(VM_JAVA_FILES)
++@ENABLE_ZLIB_FALSE@ $(JAVAC) $(JAVACFLAGS) --bootclasspath=$(BOOTCLASSPATH) -fsource=1.5 -ftarget=1.5 -d classes $(VM_JAVA_FILES)
+
+ @ENABLE_ZLIB_FALSE@install-data-local: nozip
+ @ENABLE_ZLIB_FALSE@ $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
diff --git a/java/cacao/files/patch-boehm-gc-dyn_load.c b/java/cacao/files/patch-boehm-gc-dyn_load.c
deleted file mode 100644
index f9d834e8f59e..000000000000
--- a/java/cacao/files/patch-boehm-gc-dyn_load.c
+++ /dev/null
@@ -1,15 +0,0 @@
---- src/boehm-gc/dyn_load.c.orig Thu May 6 08:03:06 2004
-+++ src/mm/boehm-gc/dyn_load.c Sun Oct 31 01:53:01 2004
-@@ -97,6 +97,12 @@
- # else
- # define ElfW(type) Elf64_##type
- # endif
-+# elif defined(__FreeBSD__)
-+# if __ELF_WORD_SIZE == 32
-+# define ElfW(type) Elf32_##type
-+# else
-+# define ElfW(type) Elf64_##type
-+# endif
- # else
- # if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32
- # define ElfW(type) Elf32_##type
diff --git a/java/cacao/files/patch-boehm-gc-include-private-gcconfig.h b/java/cacao/files/patch-boehm-gc-include-private-gcconfig.h
deleted file mode 100644
index 5c70445450c8..000000000000
--- a/java/cacao/files/patch-boehm-gc-include-private-gcconfig.h
+++ /dev/null
@@ -1,88 +0,0 @@
---- src/boehm-gc/include/private/gcconfig.h.rorig Sat Oct 15 16:40:25 2005
-+++ src/mm/boehm-gc/include/private/gcconfig.h Sat Oct 15 16:42:43 2005
-@@ -62,7 +62,7 @@
- /* Determine the machine type: */
- # if defined(__arm__) || defined(__thumb__)
- # define ARM32
--# if !defined(LINUX) && !defined(NETBSD)
-+# if !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD)
- # define NOSYS
- # define mach_type_known
- # endif
-@@ -334,10 +334,22 @@
- # define X86_64
- # define mach_type_known
- # endif
-+# if defined(__FreeBSD__) && defined(__amd64__)
-+# define X86_64
-+# define mach_type_known
-+# endif
- # if defined(FREEBSD) && defined(__sparc__)
- # define SPARC
- # define mach_type_known
--#endif
-+# endif
-+# if defined(FREEBSD) && defined(__powerpc__)
-+# define POWERPC
-+# define mach_type_known
-+# endif
-+# if defined(FREEBSD) && defined(__arm__)
-+# define ARM32
-+# define mach_type_known
-+# endif
- # if defined(bsdi) && (defined(i386) || defined(__i386__))
- # define I386
- # define BSDI
-@@ -845,6 +857,16 @@
- # define DATASTART GC_data_start
- # define DYNAMIC_LOADING
- # endif
-+# ifdef FREEBSD
-+# define ALIGNMENT 4
-+# define OS_TYPE "FREEBSD"
-+# ifdef __ELF__
-+# define DYNAMIC_LOADING
-+# endif
-+# define HEURISTIC2
-+ extern char etext[];
-+# define SEARCH_FOR_DATA_START
-+# endif
- # ifdef NOSYS
- # define ALIGNMENT 4
- # define OS_TYPE "NOSYS"
-@@ -1807,6 +1829,17 @@
- # endif
- # define USE_GENERIC_PUSH_REGS
- # endif
-+# ifdef FREEBSD
-+# define ALIGNMENT 4
-+# define OS_TYPE "FREEBSD"
-+# ifdef __ELF__
-+# define DYNAMIC_LOADING
-+# endif
-+# define HEURISTIC2
-+ extern char etext[];
-+# define SEARCH_FOR_DATA_START
-+# endif
-+
- # ifdef LINUX
- # define OS_TYPE "LINUX"
- # define LINUX_STACKBOTTOM
-@@ -1957,6 +1990,17 @@
- # ifdef __ELF__
- # define DYNAMIC_LOADING
- # endif
-+# define HEURISTIC2
-+ extern char etext[];
-+# define SEARCH_FOR_DATA_START
-+# endif
-+# ifdef FREEBSD
-+# define OS_TYPE "FREEBSD"
-+# define SIG_SUSPEND SIGUSR1
-+# define SIG_THR_RESTART SIGUSR2
-+# ifdef __ELF__
-+# define DYNAMIC_LOADING
-+# endif
- # define HEURISTIC2
- extern char etext[];
- # define SEARCH_FOR_DATA_START
diff --git a/java/cacao/files/patch-boehm-gc-os_dep.c b/java/cacao/files/patch-boehm-gc-os_dep.c
deleted file mode 100644
index 657ac9500dd5..000000000000
--- a/java/cacao/files/patch-boehm-gc-os_dep.c
+++ /dev/null
@@ -1,29 +0,0 @@
---- src/boehm-gc/os_dep.c.orig Thu May 19 20:48:49 2005
-+++ src/mm/boehm-gc/os_dep.c Fri Jun 17 21:28:07 2005
-@@ -699,7 +699,7 @@
- || defined(HURD) || defined(NETBSD)
- static struct sigaction old_segv_act;
- # if defined(IRIX5) || defined(HPUX) \
-- || defined(HURD) || defined(NETBSD)
-+ || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
- static struct sigaction old_bus_act;
- # endif
- # else
-@@ -714,7 +714,7 @@
- # endif
- {
- # if defined(SUNOS5SIGS) || defined(IRIX5) \
-- || defined(OSF1) || defined(HURD) || defined(NETBSD)
-+ || defined(OSF1) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
- struct sigaction act;
-
- act.sa_handler = h;
-@@ -736,7 +736,7 @@
- # else
- (void) sigaction(SIGSEGV, &act, &old_segv_act);
- # if defined(IRIX5) \
-- || defined(HPUX) || defined(HURD) || defined(NETBSD)
-+ || defined(HPUX) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
- /* Under Irix 5.x or HP/UX, we may get SIGBUS. */
- /* Pthreads doesn't exist under Irix 5.x, so we */
- /* don't have to worry in the threads case. */
diff --git a/java/cacao/files/patch-boehm-gc__configure b/java/cacao/files/patch-boehm-gc__configure
new file mode 100644
index 000000000000..9c38d11e2bf9
--- /dev/null
+++ b/java/cacao/files/patch-boehm-gc__configure
@@ -0,0 +1,10 @@
+--- src/mm/boehm-gc/configure.orig 2012-09-03 12:10:04.000000000 -0400
++++ src/mm/boehm-gc/configure 2012-09-19 14:42:52.000000000 -0400
+@@ -5063,6 +5063,7 @@
+ $as_echo "#define GC_FREEBSD_THREADS 1" >>confdefs.h
+
+ INCLUDES="$INCLUDES -pthread"
++ THREADDLLIBS=%%PTHREAD_LIBS%%
+ ;;
+ *-*-kfreebsd*-gnu)
+ $as_echo "#define GC_FREEBSD_THREADS 1" >>confdefs.h
diff --git a/java/cacao/files/patch-boehm-gc-dbg_ml.c b/java/cacao/files/patch-boehm-gc__dbg_ml.c
index 6af1b9490cbe..216ff347a3e2 100644
--- a/java/cacao/files/patch-boehm-gc-dbg_ml.c
+++ b/java/cacao/files/patch-boehm-gc__dbg_ml.c
@@ -1,6 +1,6 @@
---- src/boehm-gc/dbg_mlc.c.orig Tue May 13 16:59:49 2003
-+++ src/mm/boehm-gc/dbg_mlc.c Wed May 12 20:13:19 2004
-@@ -414,6 +414,23 @@
+--- src/mm/boehm-gc/dbg_mlc.c.orig 2012-09-03 12:10:00.000000000 -0400
++++ src/mm/boehm-gc/dbg_mlc.c 2012-09-19 13:02:15.000000000 -0400
+@@ -466,10 +466,34 @@
GC_register_displacement((word)sizeof(oh) + offset);
}
@@ -13,46 +13,43 @@
+{
+ Dl_info caller;
+ if (dladdr((const void *)ad, &caller) && caller.dli_sname != NULL) {
-+ *symp = caller.dli_sname;
-+ *offp = (const char *)ad - (const char *)caller.dli_saddr;
++ *symp = caller.dli_sname;
++ *offp = (const char *)ad - (const char *)caller.dli_saddr;
+ }
+}
+#else
+#define GC_caller_func(ad, symp, offp)
+#endif
+
- # ifdef __STDC__
- GC_PTR GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
- # else
-@@ -428,6 +445,13 @@
+ GC_API void * GC_CALL GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
{
- GC_PTR result = GC_malloc(lb + DEBUG_BYTES);
-
+ void * result = GC_malloc(lb + DEBUG_BYTES);
+
+#ifdef GC_ADD_CALLER
+ if (s == NULL) {
-+ GC_caller_func_offset(ra, &s, &i);
-+ if (s == NULL)
-+ s = "unknown";
++ GC_caller_func_offset(ra, &s, &i);
++ if (s == NULL)
++ s = "unknown";
+ }
+#endif
if (result == 0) {
- GC_err_printf1("GC_debug_malloc(%ld) returning NIL (",
- (unsigned long) lb);
-@@ -789,6 +813,13 @@
- register size_t old_sz;
- register hdr * hhdr;
-
+ GC_err_printf("GC_debug_malloc(%lu) returning NIL (",
+ (unsigned long) lb);
+@@ -792,6 +816,13 @@
+ size_t old_sz;
+ hdr * hhdr;
+
+#ifdef GC_ADD_CALLER
+ if (s == NULL) {
-+ GC_caller_func_offset(ra, &s, &i);
-+ if (s == NULL)
-+ s = "unknown";
++ GC_caller_func_offset(ra, &s, &i);
++ if (s == NULL)
++ s = "unknown";
+ }
+#endif
if (p == 0) return(GC_debug_malloc(lb, OPT_RA s, i));
+ base = GC_base(p);
if (base == 0) {
- GC_err_printf1(
-@@ -1094,7 +1125,11 @@
+@@ -1098,17 +1129,21 @@
}
#ifdef GC_ADD_CALLER
@@ -65,17 +62,14 @@
#else
# define RA
#endif
-@@ -1102,12 +1137,12 @@
- GC_PTR GC_debug_malloc_replacement(lb)
- size_t lb;
+
+ GC_API void * GC_CALL GC_debug_malloc_replacement(size_t lb)
{
- return GC_debug_malloc(lb, RA "unknown", 0);
+ return GC_debug_malloc(lb, RA NULL, 0);
}
- GC_PTR GC_debug_realloc_replacement(p, lb)
- GC_PTR p;
- size_t lb;
+ GC_API void * GC_CALL GC_debug_realloc_replacement(void *p, size_t lb)
{
- return GC_debug_realloc(p, lb, RA "unknown", 0);
+ return GC_debug_realloc(p, lb, RA NULL, 0);
diff --git a/java/cacao/files/patch-boehm-gc-include-gc.h b/java/cacao/files/patch-boehm-gc__include__gc.h
index 0e1cc9c18294..0e1cc9c18294 100644
--- a/java/cacao/files/patch-boehm-gc-include-gc.h
+++ b/java/cacao/files/patch-boehm-gc__include__gc.h
diff --git a/java/cacao/files/patch-boehm-gc__include__private__gcconfig.h b/java/cacao/files/patch-boehm-gc__include__private__gcconfig.h
new file mode 100644
index 000000000000..49eee7724f36
--- /dev/null
+++ b/java/cacao/files/patch-boehm-gc__include__private__gcconfig.h
@@ -0,0 +1,89 @@
+--- src/mm/boehm-gc/include/private/gcconfig.h.orig 2012-09-03 12:10:00.000000000 -0400
++++ src/mm/boehm-gc/include/private/gcconfig.h 2012-10-05 13:21:12.000000000 -0400
+@@ -69,8 +69,9 @@
+ /* Determine the machine type: */
+ # if defined(__arm__) || defined(__thumb__)
+ # define ARM32
+-# if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) \
+- && !defined(DARWIN) && !defined(_WIN32) && !defined(__CEGCC__)
++# if !defined(LINUX) && !defined(FREEBSD) && !defined(NETBSD) \
++ && !defined(OPENBSD) && !defined(DARWIN) && !defined(_WIN32) \
++ && !defined(__CEGCC__)
+ # define NOSYS
+ # define mach_type_known
+ # endif
+@@ -366,6 +367,10 @@
+ # define SPARC
+ # define mach_type_known
+ # endif
++# if defined(FREEBSD) && defined(__arm__)
++# define ARM32
++# define mach_type_known
++# endif
+ # if defined(bsdi) && (defined(i386) || defined(__i386__))
+ # define I386
+ # define BSDI
+@@ -843,8 +848,6 @@
+ # ifndef GC_FREEBSD_THREADS
+ # define MPROTECT_VDB
+ # endif
+-# define SIG_SUSPEND SIGUSR1
+-# define SIG_THR_RESTART SIGUSR2
+ # define FREEBSD_STACKBOTTOM
+ # ifdef __ELF__
+ # define DYNAMIC_LOADING
+@@ -1032,8 +1035,6 @@
+ # endif
+ # ifdef FREEBSD
+ # define OS_TYPE "FREEBSD"
+-# define SIG_SUSPEND SIGUSR1
+-# define SIG_THR_RESTART SIGUSR2
+ # define FREEBSD_STACKBOTTOM
+ # ifdef __ELF__
+ # define DYNAMIC_LOADING
+@@ -1284,9 +1285,6 @@
+ # define SIG_THR_RESTART (32+5)
+ extern int _end[];
+ # define DATAEND (ptr_t)(_end)
+-# else
+-# define SIG_SUSPEND SIGUSR1
+-# define SIG_THR_RESTART SIGUSR2
+ # endif
+ # define FREEBSD_STACKBOTTOM
+ # ifdef __ELF__
+@@ -1608,8 +1606,6 @@
+ # ifdef FREEBSD
+ # define OS_TYPE "FREEBSD"
+ /* MPROTECT_VDB is not yet supported at all on FreeBSD/alpha. */
+-# define SIG_SUSPEND SIGUSR1
+-# define SIG_THR_RESTART SIGUSR2
+ # define FREEBSD_STACKBOTTOM
+ # ifdef __ELF__
+ # define DYNAMIC_LOADING
+@@ -1898,6 +1894,16 @@
+ # define DATAEND ((ptr_t)(&_end))
+ # define DYNAMIC_LOADING
+ # endif
++# ifdef FREEBSD
++# define ALIGNMENT 4
++# define OS_TYPE "FREEBSD"
++# ifdef __ELF__
++# define DYNAMIC_LOADING
++# endif
++# define HEURISTIC2
++ extern char etext[];
++# define SEARCH_FOR_DATA_START
++# endif
+ # ifdef NOSYS
+ /* __data_start is usually defined in the target linker script. */
+ extern int __data_start[];
+@@ -2066,9 +2072,6 @@
+ # define SIG_THR_RESTART (32+5)
+ extern int _end[];
+ # define DATAEND (ptr_t)(_end)
+-# else
+-# define SIG_SUSPEND SIGUSR1
+-# define SIG_THR_RESTART SIGUSR2
+ # endif
+ # define FREEBSD_STACKBOTTOM
+ # ifdef __ELF__
diff --git a/java/cacao/files/patch-boehm-gc__pthread_support.c b/java/cacao/files/patch-boehm-gc__pthread_support.c
new file mode 100644
index 000000000000..3e4cf7adf3e9
--- /dev/null
+++ b/java/cacao/files/patch-boehm-gc__pthread_support.c
@@ -0,0 +1,20 @@
+--- src/mm/boehm-gc/pthread_support.c.orig 2012-09-03 12:10:00.000000000 -0400
++++ src/mm/boehm-gc/pthread_support.c 2012-10-04 19:46:21.000000000 -0400
+@@ -1080,17 +1080,6 @@
+ /* can't have been recycled by pthreads. */
+ UNLOCK();
+ result = REAL_FUNC(pthread_join)(thread, retval);
+-# if defined (GC_FREEBSD_THREADS)
+- /* On FreeBSD, the wrapped pthread_join() sometimes returns (what
+- appears to be) a spurious EINTR which caused the test and real code
+- to gratuitously fail. Having looked at system pthread library source
+- code, I see how this return code may be generated. In one path of
+- code, pthread_join() just returns the errno setting of the thread
+- being joined. This does not match the POSIX specification or the
+- local man pages thus I have taken the liberty to catch this one
+- spurious return value properly conditionalized on GC_FREEBSD_THREADS. */
+- if (result == EINTR) result = 0;
+-# endif
+ if (result == 0) {
+ LOCK();
+ /* Here the pthread thread id may have been recycled. */
diff --git a/java/cacao/files/patch-configure b/java/cacao/files/patch-configure
index 813d8e010b3c..5ef477f50f52 100644
--- a/java/cacao/files/patch-configure
+++ b/java/cacao/files/patch-configure
@@ -1,11 +1,29 @@
---- configure.orig Sun Feb 4 14:38:16 2007
-+++ configure Sun Feb 4 15:30:30 2007
-@@ -2662,7 +2661,7 @@
- ARCH_CFLAGS="-mcpu=v9 -m64 -D__SPARC_64__"
+--- configure.orig 2012-09-03 12:10:16.000000000 -0400
++++ configure 2012-09-19 19:08:48.000000000 -0400
+@@ -3626,7 +3626,7 @@
+ JAVA_ARCH="sparc"
;;
-x86_64 )
+x86_64 | amd64 )
ARCH_DIR="x86_64"
- ARCH_CFLAGS="-D__X86_64__"
- ;;
+ ARCH_FLAGS="-m64 -D__X86_64__"
+ JAVA_ARCH="amd64"
+@@ -9731,7 +9731,7 @@
+ $as_echo_n "(cached) " >&6
+ else
+ ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lpthread $LIBS"
++LIBS="%%PTHREAD_LIBS%% $LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+
+@@ -9760,7 +9760,7 @@
+ #define HAVE_LIBPTHREAD 1
+ _ACEOF
+
+- LIBS="-lpthread $LIBS"
++ LIBS="%%PTHREAD_LIBS%% $LIBS"
+
+ fi
+
diff --git a/java/cacao/files/patch-src-Makefile.in b/java/cacao/files/patch-src-Makefile.in
deleted file mode 100644
index 818a94ef0ec5..000000000000
--- a/java/cacao/files/patch-src-Makefile.in
+++ /dev/null
@@ -1,18 +0,0 @@
---- src/Makefile.in.orig Wed Jun 6 16:32:20 2007
-+++ src/Makefile.in Wed Jun 6 16:32:35 2007
-@@ -271,7 +271,6 @@
- lib \
- mm \
- native \
-- scripts \
- threads \
- toolbox \
- vm \
-@@ -299,7 +298,6 @@
- $(THREADS_DIR) \
- vm \
- cacao \
-- scripts
-
- all: all-recursive
-
diff --git a/java/cacao/files/patch-src-native-jni.h b/java/cacao/files/patch-src-native-jni.h
deleted file mode 100644
index 048fa5709b0c..000000000000
--- a/java/cacao/files/patch-src-native-jni.h
+++ /dev/null
@@ -1,16 +0,0 @@
---- src/native/jni.h.orig 2007-04-02 13:23:24.000000000 +0200
-+++ src/native/jni.h 2009-01-15 20:32:31.000000000 +0100
-@@ -45,10 +45,12 @@
-
- #include CLASSPATH_JNI_H
-
--
- #ifndef _JNI_H
- #define _JNI_H
-
-+#define JNINativeInterface JNINativeInterface_
-+#define JNIInvokeInterface JNIInvokeInterface_
-+
- /* forward typedefs ***********************************************************/
-
- typedef struct localref_table localref_table;
diff --git a/java/cacao/files/patch-src__cacao__cacao.cpp b/java/cacao/files/patch-src__cacao__cacao.cpp
new file mode 100644
index 000000000000..99980c72f0e1
--- /dev/null
+++ b/java/cacao/files/patch-src__cacao__cacao.cpp
@@ -0,0 +1,14 @@
+--- src/cacao/cacao.cpp.orig 2012-09-03 12:10:00.000000000 -0400
++++ src/cacao/cacao.cpp 2012-10-04 14:34:51.000000000 -0400
+@@ -90,7 +90,11 @@
+
+ path = (char*) os::malloc(sizeof(char) * 4096);
+
++# if defined(__FreeBSD__)
++ if (readlink("/proc/curproc/file", path, 4095) == -1) {
++# else
+ if (readlink("/proc/self/exe", path, 4095) == -1) {
++# endif
+ fprintf(stderr, "main: readlink failed: %s\n", strerror(errno));
+ os::abort();
+ }
diff --git a/java/cacao/files/patch-src__threads__posix__thread-posix.cpp b/java/cacao/files/patch-src__threads__posix__thread-posix.cpp
new file mode 100644
index 000000000000..7fb8258e83cb
--- /dev/null
+++ b/java/cacao/files/patch-src__threads__posix__thread-posix.cpp
@@ -0,0 +1,11 @@
+--- src/threads/posix/thread-posix.cpp.orig 2012-09-03 12:10:00.000000000 -0400
++++ src/threads/posix/thread-posix.cpp 2012-10-04 16:42:49.000000000 -0400
+@@ -94,6 +94,8 @@
+
+ #if defined(__LINUX__)
+ # define GC_LINUX_THREADS
++#elif defined(__FREEBSD__)
++# define GC_FREEBSD_THREADS
+ #elif defined(__IRIX__)
+ # define GC_IRIX_THREADS
+ #elif defined(__DARWIN__)
diff --git a/java/cacao/files/patch-src__threads__thread.cpp b/java/cacao/files/patch-src__threads__thread.cpp
new file mode 100644
index 000000000000..2ab41b412ee9
--- /dev/null
+++ b/java/cacao/files/patch-src__threads__thread.cpp
@@ -0,0 +1,11 @@
+--- src/threads/thread.cpp.orig 2012-09-03 12:10:00.000000000 -0400
++++ src/threads/thread.cpp 2012-10-04 16:37:45.000000000 -0400
+@@ -37,6 +37,8 @@
+
+ #if defined(__LINUX__)
+ # define GC_LINUX_THREADS
++#elif defined(__FREEBSD__)
++# define GC_FREEBSD_THREADS
+ #elif defined(__IRIX__)
+ # define GC_IRIX_THREADS
+ #elif defined(__DARWIN__)
diff --git a/java/cacao/files/patch-src__vm__jit__i386__freebsd__md-os.c b/java/cacao/files/patch-src__vm__jit__i386__freebsd__md-os.c
new file mode 100644
index 000000000000..017e1a17b374
--- /dev/null
+++ b/java/cacao/files/patch-src__vm__jit__i386__freebsd__md-os.c
@@ -0,0 +1,325 @@
+--- src/vm/jit/i386/freebsd/md-os.c.orig 2012-09-03 12:10:00.000000000 -0400
++++ src/vm/jit/i386/freebsd/md-os.c 2012-10-04 17:01:47.000000000 -0400
+@@ -2,6 +2,7 @@
+
+ Copyright (C) 1996-2005, 2006, 2007, 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
++ Copyright (C) 2009 Theobroma Systems Ltd.
+
+ This file is part of CACAO.
+
+@@ -35,218 +36,55 @@
+
+ #include "threads/thread.hpp"
+
+-#include "vm/jit/builtin.hpp"
+ #include "vm/signallocal.hpp"
+
+-#include "vm/jit/asmpart.h"
+ #include "vm/jit/executionstate.h"
+-#include "vm/jit/stacktrace.hpp"
+ #include "vm/jit/trap.hpp"
+
+
+-/* md_signal_handler_sigsegv ***************************************************
+-
+- Signal handler for hardware exceptions.
+-
+-*******************************************************************************/
+-
++/**
++ * Signal handler for hardware exceptions.
++ */
+ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
+ {
+- ucontext_t *_uc;
+- mcontext_t *_mc;
+- u1 *pv;
+- u1 *sp;
+- u1 *ra;
+- u1 *xpc;
+- u1 opc;
+- u1 mod;
+- u1 rm;
+- s4 d;
+- s4 disp;
+- ptrint val;
+- s4 type;
+- void *p;
++ ucontext_t* _uc = (ucontext_t *) _p;
++ mcontext_t* _mc = &_uc->uc_mcontext;
+
+- _uc = (ucontext_t *) _p;
+- _mc = &_uc->uc_mcontext;
++ void* xpc = (void*) _mc->mc_eip;
+
+- pv = NULL; /* is resolved during stackframeinfo creation */
+- sp = (u1 *) _mc->mc_esp;
+- xpc = (u1 *) _mc->mc_eip;
+- ra = xpc; /* return address is equal to XPC */
+-
+- /* get exception-throwing instruction */
+-
+- opc = M_ALD_MEM_GET_OPC(xpc);
+- mod = M_ALD_MEM_GET_MOD(xpc);
+- rm = M_ALD_MEM_GET_RM(xpc);
+-
+- /* for values see emit_mov_mem_reg and emit_mem */
+-
+- if ((opc == 0x8b) && (mod == 0) && (rm == 5)) {
+- /* this was a hardware-exception */
+-
+- d = M_ALD_MEM_GET_REG(xpc);
+- disp = M_ALD_MEM_GET_DISP(xpc);
+-
+- /* we use the exception type as load displacement */
+-
+- type = disp;
+-
+- switch (d) {
+- case EAX:
+- val = _mc->mc_eax;
+- break;
+- case ECX:
+- val = _mc->mc_ecx;
+- break;
+- case EDX:
+- val = _mc->mc_edx;
+- break;
+- case EBX:
+- val = _mc->mc_ebx;
+- break;
+- case ESP:
+- val = _mc->mc_esp;
+- break;
+- case EBP:
+- val = _mc->mc_ebp;
+- break;
+- case ESI:
+- val = _mc->mc_esi;
+- break;
+- case EDI:
+- val = _mc->mc_edi;
+- break;
+- default:
+- vm_abort("md_signal_handler_sigsegv: Unkown register %d", d);
+- }
+-
+- if (type == TRAP_COMPILER) {
+- /* The PV from the compiler stub is equal to the XPC. */
+-
+- pv = xpc;
+-
+- /* We use a framesize of zero here because the call pushed
+- the return addres onto the stack. */
+-
+- ra = md_stacktrace_get_returnaddress(sp, 0);
+-
+- /* Skip the RA on the stack. */
+-
+- sp = sp + 1 * SIZEOF_VOID_P;
+-
+- /* The XPC is the RA minus 2, because the RA points to the
+- instruction after the call. */
+-
+- xpc = ra - 2;
+- }
+- }
+- else {
+- /* this was a normal NPE */
+-
+- type = TRAP_NullPointerException;
+- val = 0;
+- }
+-
+- /* Handle the trap. */
+-
+- p = trap_handle(type, val, pv, sp, ra, xpc, _p);
+-
+- /* Set registers. */
+-
+- if (type == TRAP_COMPILER) {
+- if (p == NULL) {
+- _mc->mc_esp = (uintptr_t) sp; // Remove RA from stack.
+- }
+- }
++ // Handle the trap.
++ trap_handle(TRAP_SIGSEGV, xpc, _p);
+ }
+
+
+-/* md_signal_handler_sigfpe ****************************************************
+-
+- ArithmeticException signal handler for hardware divide by zero
+- check.
+-
+-*******************************************************************************/
+-
++/**
++ * Signal handler for hardware divide by zero (ArithmeticException)
++ * check.
++ */
+ void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
+ {
+- ucontext_t *_uc;
+- mcontext_t *_mc;
+- u1 *pv;
+- u1 *sp;
+- u1 *ra;
+- u1 *xpc;
+- s4 type;
+- ptrint val;
+-
+- _uc = (ucontext_t *) _p;
+- _mc = &_uc->uc_mcontext;
+-
+- pv = NULL; /* is resolved during stackframeinfo creation */
+- sp = (u1 *) _mc->mc_esp;
+- xpc = (u1 *) _mc->mc_eip;
+- ra = xpc; /* return address is equal to xpc */
+-
+- /* This is an ArithmeticException. */
+-
+- type = TRAP_ArithmeticException;
+- val = 0;
++ ucontext_t* _uc = (ucontext_t *) _p;
++ mcontext_t* _mc = &_uc->uc_mcontext;
+
+- /* Handle the trap. */
++ void* xpc = (void*) _mc->mc_eip;
+
+- trap_handle(type, val, pv, sp, ra, xpc, _p);
++ // Handle the trap.
++ trap_handle(TRAP_SIGFPE, xpc, _p);
+ }
+
+
+-/* md_signal_handler_sigill ****************************************************
+-
+- Signal handler for hardware patcher traps (ud2).
+-
+-*******************************************************************************/
+-
++/**
++ * Signal handler for hardware patcher traps (ud2).
++ */
+ void md_signal_handler_sigill(int sig, siginfo_t *siginfo, void *_p)
+ {
+- ucontext_t *_uc;
+- mcontext_t *_mc;
+- u1 *pv;
+- u1 *sp;
+- u1 *ra;
+- u1 *xpc;
+- s4 type;
+- ptrint val;
+-
+- _uc = (ucontext_t *) _p;
+- _mc = &_uc->uc_mcontext;
+-
+- pv = NULL; /* is resolved during stackframeinfo creation */
+- sp = (u1 *) _mc->mc_esp;
+- xpc = (u1 *) _mc->mc_eip;
+- ra = xpc; /* return address is equal to xpc */
+-
+- // Check if the trap instruction is valid.
+- // TODO Move this into patcher_handler.
+- if (patcher_is_valid_trap_instruction_at(xpc) == false) {
+- // Check if the PC has been patched during our way to this
+- // signal handler (see PR85).
+- if (patcher_is_patched_at(xpc) == true)
+- return;
+-
+- // We have a problem...
+- log_println("md_signal_handler_sigill: Unknown illegal instruction at 0x%lx", xpc);
+-#if defined(ENABLE_DISASSEMBLER)
+- (void) disassinstr(xpc);
+-#endif
+- vm_abort("Aborting...");
+- }
+-
+- type = TRAP_PATCHER;
+- val = 0;
++ ucontext_t* _uc = (ucontext_t *) _p;
++ mcontext_t* _mc = &_uc->uc_mcontext;
+
+- /* Handle the trap. */
++ void* xpc = (void*) _mc->mc_eip;
+
+- trap_handle(type, val, pv, sp, ra, xpc, _p);
++ // Handle the trap.
++ trap_handle(TRAP_SIGILL, xpc, _p);
+ }
+
+
+@@ -282,17 +120,21 @@
+
+ *******************************************************************************/
+
+-void md_executionstate_read(executionstate_t* es, void* context)
++void md_executionstate_read(executionstate_t *es, void *context)
+ {
+- ucontext_t* _uc = (ucontext_t*) context;
+- mcontext_t* _mc = &_uc->uc_mcontext;
++ ucontext_t *_uc;
++ mcontext_t *_mc;
++ s4 i;
+
+- // Read special registers.
++ _uc = (ucontext_t *) context;
++ _mc = &_uc->uc_mcontext;
++
++ /* read special registers */
+ es->pc = (u1 *) _mc->mc_eip;
+ es->sp = (u1 *) _mc->mc_esp;
+ es->pv = NULL; /* pv must be looked up via AVL tree */
+
+- // Read integer registers.
++ /* read integer registers */
+ es->intregs[EAX] = _mc->mc_eax;
+ es->intregs[ECX] = _mc->mc_ecx;
+ es->intregs[EDX] = _mc->mc_edx;
+@@ -302,8 +144,8 @@
+ es->intregs[ESI] = _mc->mc_esi;
+ es->intregs[EDI] = _mc->mc_edi;
+
+- // Read float registers.
+- for (int i = 0; i < FLT_REG_CNT; i++)
++ /* read float registers */
++ for (i = 0; i < FLT_REG_CNT; i++)
+ es->fltregs[i] = 0xdeadbeefdeadbeefULL;
+ }
+
+@@ -314,12 +156,15 @@
+
+ *******************************************************************************/
+
+-void md_executionstate_write(executionstate_t* es, void* context)
++void md_executionstate_write(executionstate_t *es, void *context)
+ {
+- ucontext_t* _uc = (ucontext_t*) context;
+- mcontext_t* _mc = &_uc->uc_mcontext;
++ ucontext_t *_uc;
++ mcontext_t *_mc;
++
++ _uc = (ucontext_t *) context;
++ _mc = &_uc->uc_mcontext;
+
+- // Write integer registers.
++ /* write integer registers */
+ _mc->mc_eax = es->intregs[EAX];
+ _mc->mc_ecx = es->intregs[ECX];
+ _mc->mc_edx = es->intregs[EDX];
+@@ -329,9 +174,9 @@
+ _mc->mc_esi = es->intregs[ESI];
+ _mc->mc_edi = es->intregs[EDI];
+
+- // Write special registers.
+- _mc->mc_eip = (uintptr_t) es->pc;
+- _mc->mc_esp = (uintptr_t) es->sp;
++ /* write special registers */
++ _mc->mc_eip = (ptrint) es->pc;
++ _mc->mc_esp = (ptrint) es->sp;
+ }
+
+
diff --git a/java/cacao/files/patch-src__vm__jit__x86_64__freebsd__md-os.c b/java/cacao/files/patch-src__vm__jit__x86_64__freebsd__md-os.c
new file mode 100644
index 000000000000..621aa0073d45
--- /dev/null
+++ b/java/cacao/files/patch-src__vm__jit__x86_64__freebsd__md-os.c
@@ -0,0 +1,217 @@
+--- src/vm/jit/x86_64/freebsd/md-os.c.orig 2012-09-03 12:10:00.000000000 -0400
++++ src/vm/jit/x86_64/freebsd/md-os.c 2012-10-04 17:04:18.000000000 -0400
+@@ -2,7 +2,6 @@
+
+ Copyright (C) 2007, 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+- Copyright (C) 2009 Theobroma Systems Ltd.
+
+ This file is part of CACAO.
+
+@@ -27,80 +26,67 @@
+ #include "config.h"
+
+ #include <assert.h>
++#include <stdint.h>
+ #include <stdlib.h>
+ #include <ucontext.h>
+
++#include "vm/types.h"
++
++#include "vm/jit/x86_64/codegen.h"
++#include "vm/jit/x86_64/md.h"
++
+ #include "threads/thread.hpp"
+
+ #include "vm/signallocal.hpp"
+
+ #include "vm/jit/asmpart.h"
+-#include "vm/jit/stacktrace.hpp"
+-
+-
+-/* md_signal_handler_sigsegv ***************************************************
++#include "vm/jit/executionstate.h"
++#include "vm/jit/trap.hpp"
+
+- NullPointerException signal handler for hardware null pointer
+- check.
+-
+-*******************************************************************************/
+
++/**
++ * Signal handler for hardware exception.
++ */
+ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
+ {
+- ucontext_t *_uc;
+- mcontext_t *_mc;
+- u1 *sp;
+- u1 *ra;
+- u1 *xpc;
++ ucontext_t* _uc = (ucontext_t *) _p;
++ mcontext_t* _mc = &_uc->uc_mcontext;
+
+- _uc = (ucontext_t *) _p;
+- _mc = &_uc->uc_mcontext;
++ void* xpc = (void*) _mc->mc_rip;
+
+- sp = (u1 *) _mc->mc_rsp;
+- xpc = (u1 *) _mc->mc_rip;
+- ra = xpc; /* return address is equal to xpc */
++ // Handle the trap.
++ trap_handle(TRAP_SIGSEGV, xpc, _p);
++}
+
+-#if 0
+- /* check for StackOverflowException */
+
+- threads_check_stackoverflow(sp);
+-#endif
++/**
++ * ArithmeticException signal handler for hardware divide by zero
++ * check.
++ */
++void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
++{
++ ucontext_t* _uc = (ucontext_t *) _p;
++ mcontext_t* _mc = &_uc->uc_mcontext;
+
+- _mc->mc_rax =
+- (ptrint) stacktrace_hardware_nullpointerexception(NULL, sp, ra, xpc);
++ void* xpc = (void*) _mc->mc_rip;
+
+- _mc->mc_r10 = (ptrint) xpc; /* REG_ITMP2_XPC */
+- _mc->mc_rip = (ptrint) asm_handle_exception;
++ // Handle the trap.
++ trap_handle(TRAP_SIGFPE, xpc, _p);
+ }
+
+
+-/* md_signal_handler_sigfpe ****************************************************
+-
+- ArithmeticException signal handler for hardware divide by zero
+- check.
+-
+-*******************************************************************************/
+-
+-void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
++/**
++ * Signal handler for patchers.
++ */
++void md_signal_handler_sigill(int sig, siginfo_t *siginfo, void *_p)
+ {
+- ucontext_t *_uc;
+- mcontext_t *_mc;
+- u1 *sp;
+- u1 *ra;
+- u1 *xpc;
+-
+- _uc = (ucontext_t *) _p;
+- _mc = &_uc->uc_mcontext;
+-
+- sp = (u1 *) _mc->mc_rsp;
+- xpc = (u1 *) _mc->mc_rip;
+- ra = xpc; /* return address is equal to xpc */
++ ucontext_t* _uc = (ucontext_t *) _p;
++ mcontext_t* _mc = &_uc->uc_mcontext;
+
+- _mc->mc_rax =
+- (ptrint) stacktrace_hardware_arithmeticexception(NULL, sp, ra, xpc);
++ void* xpc = (void*) _mc->mc_rip;
+
+- _mc->mc_r10 = (ptrint) xpc; /* REG_ITMP2_XPC */
+- _mc->mc_rip = (ptrint) asm_handle_exception;
++ // Handle the trap.
++ trap_handle(TRAP_SIGILL, xpc, _p);
+ }
+
+
+@@ -130,6 +116,88 @@
+ #endif
+
+
++/* md_executionstate_read ******************************************************
++
++ Read the given context into an executionstate.
++
++*******************************************************************************/
++
++void md_executionstate_read(executionstate_t *es, void *context)
++{
++ ucontext_t *_uc;
++ mcontext_t *_mc;
++ s4 i;
++
++ _uc = (ucontext_t *) context;
++ _mc = &_uc->uc_mcontext;
++
++ /* read special registers */
++ es->pc = (u1 *) _mc->mc_rip;
++ es->sp = (u1 *) _mc->mc_rsp;
++ es->pv = NULL;
++
++ /* read integer registers */
++ es->intregs[RAX] = _mc->mc_rax;
++ es->intregs[RCX] = _mc->mc_rcx;
++ es->intregs[RDX] = _mc->mc_rdx;
++ es->intregs[RBX] = _mc->mc_rbx;
++ es->intregs[RSP] = _mc->mc_rsp;
++ es->intregs[RBP] = _mc->mc_rbp;
++ es->intregs[RSI] = _mc->mc_rsi;
++ es->intregs[RDI] = _mc->mc_rdi;
++ es->intregs[R8] = _mc->mc_r8;
++ es->intregs[R9] = _mc->mc_r9;
++ es->intregs[R10] = _mc->mc_r10;
++ es->intregs[R11] = _mc->mc_r11;
++ es->intregs[R12] = _mc->mc_r12;
++ es->intregs[R13] = _mc->mc_r13;
++ es->intregs[R14] = _mc->mc_r14;
++ es->intregs[R15] = _mc->mc_r15;
++
++ /* read float registers */
++ for (i = 0; i < FLT_REG_CNT; i++)
++ es->fltregs[i] = 0xdeadbeefdeadbeefL;
++}
++
++
++/* md_executionstate_write *****************************************************
++
++ Write the given executionstate back to the context.
++
++*******************************************************************************/
++
++void md_executionstate_write(executionstate_t *es, void *context)
++{
++ ucontext_t *_uc;
++ mcontext_t *_mc;
++
++ _uc = (ucontext_t *) context;
++ _mc = &_uc->uc_mcontext;
++
++ /* write integer registers */
++ _mc->mc_rax = es->intregs[RAX];
++ _mc->mc_rcx = es->intregs[RCX];
++ _mc->mc_rdx = es->intregs[RDX];
++ _mc->mc_rbx = es->intregs[RBX];
++ _mc->mc_rsp = es->intregs[RSP];
++ _mc->mc_rbp = es->intregs[RBP];
++ _mc->mc_rsi = es->intregs[RSI];
++ _mc->mc_rdi = es->intregs[RDI];
++ _mc->mc_r8 = es->intregs[R8];
++ _mc->mc_r9 = es->intregs[R9];
++ _mc->mc_r10 = es->intregs[R10];
++ _mc->mc_r11 = es->intregs[R11];
++ _mc->mc_r12 = es->intregs[R12];
++ _mc->mc_r13 = es->intregs[R13];
++ _mc->mc_r14 = es->intregs[R14];
++ _mc->mc_r15 = es->intregs[R15];
++
++ /* write special registers */
++ _mc->mc_rip = (ptrint) es->pc;
++ _mc->mc_rsp = (ptrint) es->sp;
++}
++
++
+ /*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
diff --git a/java/cacao/files/patch-src__vm__properties.cpp b/java/cacao/files/patch-src__vm__properties.cpp
new file mode 100644
index 000000000000..c15c0a01bf84
--- /dev/null
+++ b/java/cacao/files/patch-src__vm__properties.cpp
@@ -0,0 +1,14 @@
+--- src/vm/properties.cpp.orig 2012-09-03 12:10:00.000000000 -0400
++++ src/vm/properties.cpp 2012-10-04 14:34:15.000000000 -0400
+@@ -74,7 +74,11 @@
+
+ p = MNEW(char, 4096);
+
++#if defined(__FreeBSD__)
++ if (os::readlink("/proc/curproc/file", p, 4095) == -1)
++#else
+ if (os::readlink("/proc/self/exe", p, 4095) == -1)
++#endif
+ os::abort_errno("readlink failed");
+
+ /* We have a path like:
diff --git a/java/cacao/pkg-plist b/java/cacao/pkg-plist
index 01a3b1a51278..885e80e1cb75 100644
--- a/java/cacao/pkg-plist
+++ b/java/cacao/pkg-plist
@@ -1,6 +1,4 @@
bin/cacao
-lib/libjvm.la
lib/libjvm.so
-lib/libjvm-0.98.so
-share/cacao/vm.zip
-@dirrm share/cacao
+%%DATADIR%%/vm.zip
+@dirrm %%DATADIR%%