Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Oct 2012 20:40:39 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r305320 - in head/java/cacao: . files
Message-ID:  <201210052040.q95KedNt038558@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Fri Oct  5 20:40:39 2012
New Revision: 305320
URL: http://svn.freebsd.org/changeset/ports/305320

Log:
  - 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.

Added:
  head/java/cacao/files/gcj.patch   (contents, props changed)
  head/java/cacao/files/patch-boehm-gc__configure   (contents, props changed)
  head/java/cacao/files/patch-boehm-gc__dbg_ml.c   (contents, props changed)
     - copied, changed from r305316, head/java/cacao/files/patch-boehm-gc-dbg_ml.c
     - copied unchanged from r305316, head/java/cacao/files/patch-boehm-gc-include-gc.h
  head/java/cacao/files/patch-boehm-gc__include__private__gcconfig.h   (contents, props changed)
     - copied, changed from r305316, head/java/cacao/files/patch-boehm-gc-include-private-gcconfig.h
  head/java/cacao/files/patch-boehm-gc__pthread_support.c   (contents, props changed)
  head/java/cacao/files/patch-src__cacao__cacao.cpp   (contents, props changed)
  head/java/cacao/files/patch-src__threads__posix__thread-posix.cpp   (contents, props changed)
  head/java/cacao/files/patch-src__threads__thread.cpp   (contents, props changed)
  head/java/cacao/files/patch-src__vm__jit__i386__freebsd__md-os.c   (contents, props changed)
  head/java/cacao/files/patch-src__vm__jit__x86_64__freebsd__md-os.c   (contents, props changed)
  head/java/cacao/files/patch-src__vm__properties.cpp   (contents, props changed)
Directory Properties:
  head/java/cacao/files/patch-boehm-gc__include__gc.h   (props changed)
Deleted:
  head/java/cacao/files/patch-boehm-gc-dbg_ml.c
  head/java/cacao/files/patch-boehm-gc-dyn_load.c
  head/java/cacao/files/patch-boehm-gc-include-gc.h
  head/java/cacao/files/patch-boehm-gc-include-private-gcconfig.h
  head/java/cacao/files/patch-boehm-gc-os_dep.c
  head/java/cacao/files/patch-src-Makefile.in
  head/java/cacao/files/patch-src-native-jni.h
Modified:
  head/java/cacao/Makefile
  head/java/cacao/distinfo
  head/java/cacao/files/patch-configure   (contents, props changed)
  head/java/cacao/pkg-plist

Modified: head/java/cacao/Makefile
==============================================================================
--- head/java/cacao/Makefile	Fri Oct  5 20:07:33 2012	(r305319)
+++ head/java/cacao/Makefile	Fri Oct  5 20:40:39 2012	(r305320)
@@ -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>

Modified: head/java/cacao/distinfo
==============================================================================
--- head/java/cacao/distinfo	Fri Oct  5 20:07:33 2012	(r305319)
+++ head/java/cacao/distinfo	Fri Oct  5 20:40:39 2012	(r305320)
@@ -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

Added: head/java/cacao/files/gcj.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/java/cacao/files/gcj.patch	Fri Oct  5 20:40:39 2012	(r305320)
@@ -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)

Added: head/java/cacao/files/patch-boehm-gc__configure
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/java/cacao/files/patch-boehm-gc__configure	Fri Oct  5 20:40:39 2012	(r305320)
@@ -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

Copied and modified: head/java/cacao/files/patch-boehm-gc__dbg_ml.c (from r305316, head/java/cacao/files/patch-boehm-gc-dbg_ml.c)
==============================================================================
--- head/java/cacao/files/patch-boehm-gc-dbg_ml.c	Fri Oct  5 18:21:48 2012	(r305316, copy source)
+++ head/java/cacao/files/patch-boehm-gc__dbg_ml.c	Fri Oct  5 20:40:39 2012	(r305320)
@@ -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);

Copied: head/java/cacao/files/patch-boehm-gc__include__gc.h (from r305316, head/java/cacao/files/patch-boehm-gc-include-gc.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/java/cacao/files/patch-boehm-gc__include__gc.h	Fri Oct  5 20:40:39 2012	(r305320, copy of r305316, head/java/cacao/files/patch-boehm-gc-include-gc.h)
@@ -0,0 +1,10 @@
+--- src/boehm-gc/include/gc.h.orig	Wed Jun  4 17:07:33 2003
++++ src/mm/boehm-gc/include/gc.h	Wed May 12 20:03:22 2004
+@@ -487,6 +487,7 @@
+     /* gcc knows how to retrieve return address, but we don't know */
+     /* how to generate call stacks.				   */
+ #   define GC_RETURN_ADDR (GC_word)__builtin_return_address(0)
++#   define GC_RETURN_ADDR_PARENT (GC_word)__builtin_return_address(1)
+ # else
+     /* Just pass 0 for gcc compatibility. */
+ #   define GC_RETURN_ADDR 0

Copied and modified: head/java/cacao/files/patch-boehm-gc__include__private__gcconfig.h (from r305316, head/java/cacao/files/patch-boehm-gc-include-private-gcconfig.h)
==============================================================================
--- head/java/cacao/files/patch-boehm-gc-include-private-gcconfig.h	Fri Oct  5 18:21:48 2012	(r305316, copy source)
+++ head/java/cacao/files/patch-boehm-gc__include__private__gcconfig.h	Fri Oct  5 20:40:39 2012	(r305320)
@@ -1,31 +1,21 @@
---- 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 @@
+--- 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)
-+#    if !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD)
+-#    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
-@@ -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__)
+@@ -366,6 +367,10 @@
  #    define SPARC
  #    define mach_type_known
--#endif
-+# endif
-+# if defined(FREEBSD) && defined(__powerpc__)
-+#    define POWERPC
-+#    define mach_type_known
-+# endif
+ # endif
 +# if defined(FREEBSD) && defined(__arm__)
 +#    define ARM32
 +#    define mach_type_known
@@ -33,8 +23,45 @@
  # if defined(bsdi) && (defined(i386) || defined(__i386__))
  #    define I386
  #    define BSDI
-@@ -845,6 +857,16 @@
- #     define DATASTART GC_data_start
+@@ -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
@@ -48,41 +75,15 @@
 +#	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
+       /* __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__

Added: head/java/cacao/files/patch-boehm-gc__pthread_support.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/java/cacao/files/patch-boehm-gc__pthread_support.c	Fri Oct  5 20:40:39 2012	(r305320)
@@ -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. */

Modified: head/java/cacao/files/patch-configure
==============================================================================
--- head/java/cacao/files/patch-configure	Fri Oct  5 20:07:33 2012	(r305319)
+++ head/java/cacao/files/patch-configure	Fri Oct  5 20:40:39 2012	(r305320)
@@ -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
+ 

Added: head/java/cacao/files/patch-src__cacao__cacao.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/java/cacao/files/patch-src__cacao__cacao.cpp	Fri Oct  5 20:40:39 2012	(r305320)
@@ -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();
+ 	}

Added: head/java/cacao/files/patch-src__threads__posix__thread-posix.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/java/cacao/files/patch-src__threads__posix__thread-posix.cpp	Fri Oct  5 20:40:39 2012	(r305320)
@@ -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__)

Added: head/java/cacao/files/patch-src__threads__thread.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/java/cacao/files/patch-src__threads__thread.cpp	Fri Oct  5 20:40:39 2012	(r305320)
@@ -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__)

Added: head/java/cacao/files/patch-src__vm__jit__i386__freebsd__md-os.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/java/cacao/files/patch-src__vm__jit__i386__freebsd__md-os.c	Fri Oct  5 20:40:39 2012	(r305320)
@@ -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;
+ }
+ 
+ 

Added: head/java/cacao/files/patch-src__vm__jit__x86_64__freebsd__md-os.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/java/cacao/files/patch-src__vm__jit__x86_64__freebsd__md-os.c	Fri Oct  5 20:40:39 2012	(r305320)
@@ -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;
++}

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210052040.q95KedNt038558>