[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and to
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and tools (pnet) branch, master, updated. eec152425f3128e2dcd6828565e1d48cac82b86f |
Date: |
Sun, 14 Feb 2010 14:08:06 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "DotGNU Portable.NET engine, compilers and tools (pnet)".
The branch, master has been updated
via eec152425f3128e2dcd6828565e1d48cac82b86f (commit)
from 7a9b3617fc4619e1c4eda8b7af635bee8c419f6a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/pnet.git/commit/?id=eec152425f3128e2dcd6828565e1d48cac82b86f
commit eec152425f3128e2dcd6828565e1d48cac82b86f
Author: Klaus Treichel <address@hidden>
Date: Sun Feb 14 15:07:51 2010 +0100
Allow using the libffi version supplied for the system now.
Use ffi_closure_alloc now for allocating the closure's memory.
diff --git a/ChangeLog b/ChangeLog
index cdec80b..4d11c38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-02-14 Klaus Treichel <address@hidden>
+
+ * configure.in: Extend the --with-libffi switch so that it's possible
+ now to choose between the system supplied libffi version (system), the
+ one that comes with pnet (internal) or no libffi.
+
+ * engine/Makefile.am: Handle the libgc and libffi dependend switches at
+ one place now.
+
+ * engine/pinvoke.c (_ILMakeClosureForDelegate): Use ffi_closure_alloc
now
+ for allocating the memory for the closure.
+
2010-02-11 Klaus Treichel <address@hidden>
* support/pt_defs.c (_ILThreadInitSystem): Initialize a static signal
diff --git a/configure.in b/configure.in
index 5572b81..5182f3b 100644
--- a/configure.in
+++ b/configure.in
@@ -117,20 +117,6 @@ dnl Check for file extensions.
AC_EXEEXT
AC_OBJEXT
-dnl The --without-libffi option can be used to disable libffi.
-AC_ARG_WITH(libffi,
-[ --without-libffi disable libffi support],
-[
- withffi=no
-],
-[
- case "$host" in
- *-*-hpux*) withffi=no ;;
- hppa*-*-*) withffi=no ;;
- *) withffi=yes ;;
- esac
-])
-
dnl The --without-libgc option can be used to disable libgc.
AC_ARG_WITH(libgc,
[ --without-libgc disable libgc support],
@@ -143,8 +129,7 @@ AC_ARG_WITH(libgc,
dnl check which type of engine should be built
-AC_ARG_WITH(cvm,
-[ --with-cvm Use the CVM interpreter],
+AC_ARG_WITH(cvm, AC_HELP_STRING([--with-cvm], [Use the CVM interpreter]),
[
AC_DEFINE([IL_USE_CVM], 1, [Use the CVM interpreter])
withcvm=yes
@@ -186,14 +171,12 @@ AC_ARG_WITH(jit,
search_libjit=true
AC_DEFINE([IL_USE_JIT], 1, [Use the just in time compiler])
withjit=yes
- withffi=no
elif test x$withval != xyes ; then
JIT_LIBS="$LIBS -L$withval/lib -ljit"
JIT_INCLUDE="-I$withval/include"
search_libjit=false
AC_DEFINE([IL_USE_JIT], 1, [Use the just in time compiler])
withjit=yes
- withffi=no
fi
],
[
@@ -739,15 +722,65 @@ if test x$GCC = xyes ; then
fi
AC_SUBST(libdir)
-dnl Set up libffi-related variables.
AC_SUBST(FFILIBS)
-if test x$withffi = xyes ; then
- FFILIBS='$(top_builddir)/libffi/.libs/libffi.a'
- AC_DEFINE(HAVE_LIBFFI, 1, [Define if you are using libffi])
+dnl Check which libffi version to use.
+dnl internal == the version in the libffi subdir
+dnl system == the version that comes with the distro.
+dnl The ffi development package needs to be installed.
+dnl choose == default Checks if the ffi.h header file is available and uses
+dnl the the version that comes with the system in this case.
+dnl If ffi.h is not found the internal version is used.
+dnl no == don't use libffi
+AC_ARG_WITH(libffi,
+ AC_HELP_STRING([--with-libffi], [choose which libffi
version to use. no = disable libffi support]),
+[
+ withffi=$withval
+],
+[
+ case "$host" in
+ *-*-hpux*) withffi=no ;;
+ hppa*-*-*) withffi=no ;;
+ *) withffi=choose ;;
+ esac
+])
+
+if test x$withcvm = xyes ; then
+ case "$withffi" in
+ no)
+ FFILIBS=""
+ ;;
+ internal)
+ FFILIBS='$(top_builddir)/libffi/.libs/libffi.a'
+ AC_DEFINE(HAVE_LIBFFI, 1, [Define if you are using
libffi])
+ ;;
+ system)
+ AC_CHECK_HEADER([ffi.h],
+ [AC_DEFINE(HAVE_LIBFFI, 1, [Define if you are
using libffi])],
+ [AC_MSG_ERROR([Couldn't find the system ffi.h
header])])
+ AC_CHECK_LIB(ffi, ffi_prep_cif,
+ [FFILIBS='-lffi'],
+ [AC_MSG_ERROR([Couldn't find the system ffi
shared library])])
+ ;;
+ choose)
+ AC_CHECK_HEADER([ffi.h],
+ [AC_DEFINE(HAVE_LIBFFI, 1, [Define if you are
using libffi])
+ AC_CHECK_LIB(ffi, ffi_prep_cif,
[FFILIBS='-lffi'],
+ [AC_MSG_ERROR([Couldn't find the system ffi
shared library])])
+ withffi=system
+ ],
+ [FFILIBS='$(top_builddir)/libffi/.libs/libffi.a'
+ withffi=internal
+ AC_DEFINE(HAVE_LIBFFI, 1, [Define if you are
using libffi])
+ ])
+ ;;
+ *) AC_MSG_ERROR([Invalid argument passed to --with-libffi])
+ ;;
+ esac
else
+ withffi=no
FFILIBS=""
fi
-AM_CONDITIONAL(USING_LIBFFI, test x$withffi = xyes)
+AM_CONDITIONAL(USING_LIBFFI, test x$withffi = xinternal)
dnl Set up libgc-related variables.
AC_SUBST(GCLIBS)
@@ -762,8 +795,7 @@ else
fi
AM_CONDITIONAL(USING_LIBGC, test x$withgc = xyes)
-if test x$withffi = xyes; then
-
+if test x$withffi = xinternal; then
AC_CONFIG_SUBDIRS(libffi)
fi
diff --git a/engine/Makefile.am b/engine/Makefile.am
index aabbdae..7ed9d8e 100644
--- a/engine/Makefile.am
+++ b/engine/Makefile.am
@@ -2,6 +2,16 @@ bin_PROGRAMS = ilrun ilverify
lib_LIBRARIES = libILEngine.a
man_MANS = ilrun.1 ilverify.1
+FFI_INCLUDE =
+if USING_LIBFFI
+FFI_INCLUDE += -I../libffi/include
+endif
+
+GC_INCLUDE =
+if USING_LIBGC
+GC_INCLUDE += -I$(top_srcdir)/libgc/include
+GC_INCLUDE += -I$(top_builddir)/libgc/libatomic_ops/src
+endif
CVM_INCLUDES = cvm.h cvm_arith.c cvm_branch.c cvm_call.c cvm_compare.c \
cvm_config.h cvm_const.c cvm_conv.c cvm_except.c
cvm_format.h \
@@ -166,7 +176,7 @@ libILEngine_a_SOURCES = cctormgr.c \
md_ppc.c \
verify.c
-PACKAGE_LIBS = $(FFILIBS) $(GCLIBS) $(SOCKETLIBS) $(WINLIBS)
+PACKAGE_LIBS = $(GCLIBS) $(FFILIBS) $(SOCKETLIBS) $(WINLIBS)
if PNET_TOOLS
@@ -184,13 +194,11 @@ ilverify_LDADD = libILEngine.a ../dumpasm/libILDumpAsm.a \
## the interpreter core in direct threading mode.
## GCC 3.4.0 also needs -fno-unit-at-a-time
## 'ffi.h' is autogenerated; thus, goes into build tree.
-AM_CFLAGS = -I$(top_srcdir)/libffi/include $(NO_GCSE) $(NO_INLINE_FUNCTIONS) \
+AM_CFLAGS = $(NO_GCSE) $(NO_INLINE_FUNCTIONS) \
$(NO_UNIT_AT_A_TIME) -I$(top_srcdir)/support \
- -I$(top_srcdir)/libgc/include \
- -I$(top_builddir)/libgc/libatomic_ops/src \
- -I$(top_srcdir)/include \
+ $(GC_INCLUDE) \
$(JIT_INCLUDE) \
- -I../libffi/include -I.
-DBUILD_PROFILE_NAME="\"$(PROFILE_NAME)\""
+ $(FFI_INCLUDE) -I.
-DBUILD_PROFILE_NAME="\"$(PROFILE_NAME)\""
else
@@ -208,11 +216,9 @@ ilverify_LDADD = libILEngine.a \
## the interpreter core in direct threading mode.
## GCC 3.4.0 also needs -fno-unit-at-a-time
## 'ffi.h' is autogenerated; thus, goes into build tree.
-AM_CFLAGS = -I$(top_srcdir)/libgc/include \
- -I$(top_builddir)/libgc/libatomic_ops/src \
- -I$(top_srcdir)/libffi/include \
+AM_CFLAGS = $(GC_INCLUDE) $(FFI_INCLUDE) \
$(NO_GCSE) $(NO_INLINE_FUNCTIONS) $(NO_UNIT_AT_A_TIME) \
- -I$(top_srcdir)/include -I../libffi/include
-I../support/ -I. \
+ -I$(top_srcdir)/include -I../support/ -I. \
$(JIT_INCLUDE) \
-DIL_WITHOUT_TOOLS -Os
diff --git a/engine/pinvoke.c b/engine/pinvoke.c
index 730c4f1..0146394 100644
--- a/engine/pinvoke.c
+++ b/engine/pinvoke.c
@@ -1119,6 +1119,7 @@ void *_ILMakeClosureForDelegate(ILExecProcess *process,
ILObject *delegate, ILMe
ILUInt32 arg;
ILUInt32 param;
ffi_closure *closure;
+ void *closure_code = 0;
/* Determine the number of argument blocks that we need */
numArgs = ILTypeNumParams(signature);
@@ -1156,10 +1157,15 @@ void *_ILMakeClosureForDelegate(ILExecProcess *process,
ILObject *delegate, ILMe
return 0;
}
- /* Allocate space for the closure. We use persistent GC memory
- because it will contain a pointer to the delegate object, and we
- don't want the delegate to be collected while the closure exists */
- closure = (ffi_closure *)ILGCAllocPersistent(sizeof(ffi_closure));
+ /*
+ * Allocate space for the closure.
+ * TODO: free the closure if all references to the delegate vanished.
+ * NOTE: It's the responsibility of the application to hold a reference
to
+ * the delegate as long as the closure is used by the native method.
+ * Not doing this means that delegates and the objects the delegates
work
+ * on will never get collected.
+ */
+ closure = (ffi_closure *)ffi_closure_alloc(sizeof(ffi_closure),
&closure_code);
if(!closure)
{
return 0;
@@ -1188,7 +1194,7 @@ void *_ILMakeClosureForDelegate(ILExecProcess *process,
ILObject *delegate, ILMe
}
/* The closure is ready to go */
- return (void *)closure;
+ return closure_code ? closure_code : (void *)closure;
#else /* !FFI_CLOSURES */
/* libffi does not support closures */
fprintf(stderr, "libffi does not support closures on this arch.\n");
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 12 +++++++
configure.in | 82 ++++++++++++++++++++++++++++++++++++----------------
engine/Makefile.am | 26 ++++++++++------
engine/pinvoke.c | 16 +++++++---
4 files changed, 96 insertions(+), 40 deletions(-)
hooks/post-receive
--
DotGNU Portable.NET engine, compilers and tools (pnet)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and tools (pnet) branch, master, updated. eec152425f3128e2dcd6828565e1d48cac82b86f,
Klaus Treichel <=
- Prev by Date:
[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and tools (pnet) branch, master, updated. 7a9b3617fc4619e1c4eda8b7af635bee8c419f6a
- Next by Date:
[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and tools (pnet) branch, master, updated. dd4a200f0ed7033d8d0c1f7a17b4fdbe796105bc
- Previous by thread:
[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and tools (pnet) branch, master, updated. 7a9b3617fc4619e1c4eda8b7af635bee8c419f6a
- Next by thread:
[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET engine, compilers and tools (pnet) branch, master, updated. dd4a200f0ed7033d8d0c1f7a17b4fdbe796105bc
- Index(es):