Author: nickg
Date: Mon Jan 16 07:09:37 2006
New Revision: 11214
Added:
branches/nci/src/nci_libffi.c
Modified:
branches/nci/config/gen/makefiles/root.in
branches/nci/config/inter/nci.pm
branches/nci/include/parrot/nci.h
Log:
NCI #11. Better Configure logic and proper Makefile dependencies.
The two new NCI backends don't yet work, so Configure always chooses
the builtin implementation. All available backends are built regardless, and
can be selected in include/parrot/features.h (then touch src/nci.c and remake).
Modified: branches/nci/config/gen/makefiles/root.in
==============================================================================
--- branches/nci/config/gen/makefiles/root.in (original)
+++ branches/nci/config/gen/makefiles/root.in Mon Jan 16 07:09:37 2006
@@ -420,7 +420,8 @@ INTERP_O_FILES = \
$(SRC_DIR)/fingerprint$(O) \
$(SRC_DIR)/nci$(O) \
$(SRC_DIR)/nci_builtin$(O) \
- $(SRC_DIR)/nci_ffcall$(O) \
+#CONDITIONED_LINE(ffcall): $(SRC_DIR)/nci_ffcall$(O) \
+#CONDITIONED_LINE(libffi): $(SRC_DIR)/nci_libffi$(O) \
$(SRC_DIR)/cpu_dep$(O) \
$(SRC_DIR)/tsq$(O) \
$(SRC_DIR)/longopt$(O) \
@@ -561,6 +562,7 @@ STR_FILES = \
$(SRC_DIR)/inter_call.str \
$(SRC_DIR)/inter_cb.str \
$(SRC_DIR)/nci_ffcall.str \
+ $(SRC_DIR)/nci_libffi.str \
$(SRC_DIR)/inter_misc.str \
$(SRC_DIR)/global.str \
$(SRC_DIR)/global_setup.str \
@@ -1077,6 +1079,9 @@ $(SRC_DIR)/nci_builtin$(O) : $(GENERAL_H
$(SRC_DIR)/nci_ffcall$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/nci_ffcall.c \
$(SRC_DIR)/nci_ffcall.str
+$(SRC_DIR)/nci_libffi$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/nci_libffi.c \
+ $(SRC_DIR)/nci_libffi.str
+
$(SRC_DIR)/vtables$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/vtables.c
$(SRC_DIR)/cpu_dep$(O) : $(GENERAL_H_FILES)
Modified: branches/nci/config/inter/nci.pm
==============================================================================
--- branches/nci/config/inter/nci.pm (original)
+++ branches/nci/config/inter/nci.pm Mon Jan 16 07:09:37 2006
@@ -89,17 +89,31 @@ END
}
- $result = $nci_implementation;
- # This makes conditionals in the root makefile possible
- $nci_implementation = "" if $nci_implementation eq 'builtin';
+ # XXX Override the probed value and use the builtin one
+ $nci_implementation = "builtin";
+ $result = $nci_implementation . " (overridden)";
$config->data->set( nci_impl => $nci_implementation );
- $config->data->add(' ', 'libs', '-lavcall -lcallback')
- if $nci_implementation eq 'ffcall';
+ # For now add all the flags for supported backends
+ foreach (@nci_implementations)
+ {
+ if ($_ eq 'ffcall')
+ {
+ $config->data->add(' ', 'libs', '-lavcall -lcallback');
+
+ $config->data->set( 'ffcall' => 1 );
+ }
+
+ if ($_ eq 'libffi')
+ {
+ $config->data->add(' ', 'libs', '-lffi');
+ $config->data->set( 'libffi' => 1 );
+ }
+ }
}
Modified: branches/nci/include/parrot/nci.h
==============================================================================
--- branches/nci/include/parrot/nci.h (original)
+++ branches/nci/include/parrot/nci.h Mon Jan 16 07:09:37 2006
@@ -27,7 +27,7 @@ struct nci_vtable {
/* Used to initialise a new NCI PMC */
nci_new_method_t nci_new;
- /* Used to clone an NCI PMC */
+ /* Used to clone an NCI PMC's data */
nci_clone_method_t nci_clone;
/* Used to invoke the NCI call */
nci_invoke_method_t nci_invoke;
@@ -36,9 +36,15 @@ struct nci_vtable {
};
-extern struct nci_vtable nci_builtin_vtable, nci_ffcall_vtable;
+
+/* Pointer to the NCI implementation which is in effect */
extern struct nci_vtable *nci_vtable_ptr;
+/* Alternate NCI implementations */
+extern struct nci_vtable nci_builtin_vtable;
+extern struct nci_vtable nci_ffcall_vtable;
+extern struct nci_vtable nci_libffi_vtable;
+
INTVAL Parrot_get_nci_I(Interp *interpreter, struct call_state *st, int n);
FLOATVAL Parrot_get_nci_N(Interp *interpreter, struct call_state *st, int n);
STRING* Parrot_get_nci_S(Interp *interpreter, struct call_state *st, int n);
Added: branches/nci/src/nci_libffi.c
==============================================================================
--- (empty file)
+++ branches/nci/src/nci_libffi.c Mon Jan 16 07:09:37 2006
@@ -0,0 +1,73 @@
+/*
+Copyright: 2006 The Perl Foundation. All Rights Reserved.
+$Id$
+
+=head1 NAME
+
+src/nci_libffi.c - NCI Implementation using libffi
+
+=head1 SYNOPSIS
+
+=head1 DESCRIPTION
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+*/
+
+#include <avcall.h>
+#include <callback.h>
+
+#include "parrot/parrot.h"
+#include "parrot/method_util.h"
+#include "parrot/oplib/ops.h"
+
+#include "parrot/nci.h"
+#include "nci_libffi.str"
+
+static void nci_libffi_invoke (Interp * interpreter, PMC *function);
+
+static void
+nci_libffi_new (Interp *interpreter, PMC *pmc,
+ STRING *signature, Parrot_csub_t func)
+{
+
+}
+
+static void nci_libffi_clone (Interp * interpreter, PMC* pmc1, PMC* pmc2)
+{
+
+}
+
+
+static void nci_libffi_free (Interp *interpreter, PMC *pmc)
+{
+
+}
+
+
+static void nci_libffi_invoke (Interp *interpreter, PMC * pmc)
+{
+}
+
+struct nci_vtable nci_libffi_vtable =
+{
+ nci_libffi_new,
+ nci_libffi_clone,
+ nci_libffi_invoke,
+ nci_libffi_free
+};
+
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vim: expandtab shiftwidth=4:
+ */