Add the cacao JVM

This commit is contained in:
Tilman Keskinoz 2007-02-04 20:20:12 +00:00
parent 684a0c6a4e
commit 31dd71ff13
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=184152
13 changed files with 369 additions and 0 deletions

View File

@ -8,6 +8,7 @@
SUBDIR += bluej
SUBDIR += bouncycastle
SUBDIR += bsh
SUBDIR += cacao
SUBDIR += castor
SUBDIR += classpath
SUBDIR += collections

31
java/cacao/Makefile Normal file
View File

@ -0,0 +1,31 @@
# New ports collection makefile for: cacao
# Date created: 2005-04-28
# Whom: arved
#
# $FreeBSD$
PORTNAME= cacao
PORTVERSION= 0.97
CATEGORIES= java devel
MASTER_SITES= http://www.complang.tuwien.ac.at/cacaojvm/download/cacao-${PORTVERSION}/
MAINTAINER= arved@FreeBSD.org
COMMENT= JIT compiler for JAVA
BUILD_DEPENDS= ${LOCALBASE}/share/classpath/glibj.zip:${PORTSDIR}/java/classpath
USE_AUTOTOOLS= libltdl
USE_JAVA= yes
JAVA_VERSION= 1.4+
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --with-classpath-prefix=${LOCALBASE}
CONFIGURE_ENV= CFLAGS="${CFLAGS} -I${LOCALBASE}/include" \
LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib"
.include <bsd.port.pre.mk>
.if ${ARCH} == amd64
IGNORE= unsupported architecture
.endif
.include <bsd.port.post.mk>

3
java/cacao/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (cacao-0.97.tar.gz) = 36a6a3cfb2914d483bd28f276b8dd93d
SHA256 (cacao-0.97.tar.gz) = 24c8c23dcb3214d6617cf1638c355d10dd166db1265e873225e6f9164e8487b3
SIZE (cacao-0.97.tar.gz) = 2873069

View File

@ -0,0 +1,82 @@
--- src/boehm-gc/dbg_mlc.c.orig Tue May 13 16:59:49 2003
+++ src/boehm-gc/dbg_mlc.c Wed May 12 20:13:19 2004
@@ -414,6 +414,23 @@
GC_register_displacement((word)sizeof(oh) + offset);
}
+#if defined(__FreeBSD__)
+#include <dlfcn.h>
+static void GC_caller_func_offset(ad, symp, offp)
+const GC_word ad;
+const char **symp;
+int *offp;
+{
+ 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;
+ }
+}
+#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_PTR 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";
+ }
+#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;
+#ifdef GC_ADD_CALLER
+ if (s == NULL) {
+ 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));
if (base == 0) {
GC_err_printf1(
@@ -1094,7 +1125,11 @@
}
#ifdef GC_ADD_CALLER
-# define RA GC_RETURN_ADDR,
+# ifdef GC_RETURN_ADDR_PARENT
+# define RA GC_RETURN_ADDR_PARENT,
+# else
+# define RA GC_RETURN_ADDR,
+# endif
#else
# define RA
#endif
@@ -1102,12 +1137,12 @@
GC_PTR GC_debug_malloc_replacement(lb)
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;
{
- return GC_debug_realloc(p, lb, RA "unknown", 0);
+ return GC_debug_realloc(p, lb, RA NULL, 0);
}

View File

@ -0,0 +1,15 @@
--- src/boehm-gc/dyn_load.c.orig Thu May 6 08:03:06 2004
+++ src/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

View File

@ -0,0 +1,10 @@
--- src/boehm-gc/include/gc.h.orig Wed Jun 4 17:07:33 2003
+++ src/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

View File

@ -0,0 +1,88 @@
--- src/boehm-gc/include/private/gcconfig.h.rorig Sat Oct 15 16:40:25 2005
+++ src/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

View File

@ -0,0 +1,29 @@
--- src/boehm-gc/os_dep.c.orig Thu May 19 20:48:49 2005
+++ src/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. */

View File

@ -0,0 +1,11 @@
--- 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__"
;;
-x86_64 )
+x86_64 | amd64 )
ARCH_DIR="x86_64"
ARCH_CFLAGS="-D__X86_64__"
;;

View File

@ -0,0 +1,18 @@
--- src/Makefile.in.orig Sun Feb 4 20:06:59 2007
+++ src/Makefile.in Sun Feb 4 20:07:09 2007
@@ -243,7 +243,6 @@
cacaoh \
native \
cacao \
- scripts
@DISABLE_GC_FALSE@BOEHM = boehm-gc
@DISABLE_GC_TRUE@BOEHM =
@@ -260,7 +259,6 @@
cacaoh \
native \
cacao \
- scripts
all: all-recursive

View File

@ -0,0 +1,71 @@
--- src/vm/jit/x86_64/md.c.orig Sun Feb 4 15:42:05 2007
+++ src/vm/jit/x86_64/md.c Sun Feb 4 15:45:32 2007
@@ -91,8 +91,8 @@
/* ATTENTION: Don't use CACAO's internal REG_* defines as they are
different to the ones in <ucontext.h>. */
- sp = (u1 *) _mc->gregs[REG_RSP];
- xpc = (u1 *) _mc->gregs[REG_RIP];
+ sp = (u1 *) _mc->mc_rsp;
+ xpc = (u1 *) _mc->mc_rip;
ra = xpc; /* return address is equal to xpc */
#if 0
@@ -101,11 +101,11 @@
threads_check_stackoverflow(sp);
#endif
- _mc->gregs[REG_RAX] =
+ _mc->mc_rax =
(ptrint) stacktrace_hardware_nullpointerexception(NULL, sp, ra, xpc);
- _mc->gregs[REG_R10] = (ptrint) xpc; /* REG_ITMP2_XPC */
- _mc->gregs[REG_RIP] = (ptrint) asm_handle_exception;
+ _mc->mc_r10 = (ptrint) xpc; /* REG_ITMP2_XPC */
+ _mc->mc_rip = (ptrint) asm_handle_exception;
}
@@ -130,15 +130,15 @@
/* ATTENTION: Don't use CACAO's internal REG_* defines as they are
different to the ones in <ucontext.h>. */
- sp = (u1 *) _mc->gregs[REG_RSP];
- xpc = (u1 *) _mc->gregs[REG_RIP];
+ sp = (u1 *) _mc->mc_rsp;
+ xpc = (u1 *) _mc->mc_rip;
ra = xpc; /* return address is equal to xpc */
- _mc->gregs[REG_RAX] =
+ _mc->mc_rax =
(ptrint) stacktrace_hardware_arithmeticexception(NULL, sp, ra, xpc);
- _mc->gregs[REG_R10] = (ptrint) xpc; /* REG_ITMP2_XPC */
- _mc->gregs[REG_RIP] = (ptrint) asm_handle_exception;
+ _mc->mc_r10 = (ptrint) xpc; /* REG_ITMP2_XPC */
+ _mc->mc_rip = (ptrint) asm_handle_exception;
}
@@ -164,7 +164,7 @@
/* ATTENTION: Don't use CACAO's internal REG_* defines as they are
different to the ones in <ucontext.h>. */
- pc = (u1 *) _mc->gregs[REG_RIP];
+ pc = (u1 *) _mc->mc_rip;
t->pc = pc;
}
@@ -179,10 +179,10 @@
_mc = &_uc->uc_mcontext;
- pc = critical_find_restart_point((void *) _mc->gregs[REG_RIP]);
+ pc = critical_find_restart_point((void *) _mc->mc_rip);
if (pc != NULL)
- _mc->gregs[REG_RIP] = (ptrint) pc;
+ _mc->mc_rip = (ptrint) pc;
}
#endif

4
java/cacao/pkg-descr Normal file
View File

@ -0,0 +1,4 @@
CACAO is a Java Virtual Machine (JVM) which uses Just-In-Time (JIT)
compilation to execute Java methods natively.
WWW: http://www.cacaojvm.org/

6
java/cacao/pkg-plist Normal file
View File

@ -0,0 +1,6 @@
bin/cacao
lib/libjvm.la
lib/libjvm.so
lib/libjvm-0.97.so
share/cacao/vm.zip
@dirrm share/cacao