diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Makefile.in | 1 | ||||
-rw-r--r-- | config/open-axiom.m4 | 19 | ||||
-rwxr-xr-x | configure | 26 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/ChangeLog | 25 | ||||
-rw-r--r-- | src/Makefile.in | 1 | ||||
-rw-r--r-- | src/boot/ast.boot | 3 | ||||
-rw-r--r-- | src/interp/Makefile.in | 25 | ||||
-rw-r--r-- | src/interp/sys-driver.boot | 11 | ||||
-rw-r--r-- | src/interp/sys-utility.boot | 2 | ||||
-rw-r--r-- | src/interp/util.lisp | 1 | ||||
-rw-r--r-- | src/lisp/Makefile.in | 2 | ||||
-rw-r--r-- | src/lisp/core.lisp.in | 10 |
14 files changed, 123 insertions, 10 deletions
@@ -1,3 +1,9 @@ +2012-08-19 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * configure.ac: Define Automake conditional OA_DELAYED_FFI. + * config/open-axiom.m4 (OPENAXIOM_CHECK_DELAYED_FFI): New. + (OPENAXIOM_HOST_COMPILERS): Call it. + 2012-05-19 Gabriel Dos Reis <gdr@cs.tamu.edu> * Makefile.in: Regenerate. diff --git a/Makefile.in b/Makefile.in index 796b5826..cdb23756 100644 --- a/Makefile.in +++ b/Makefile.in @@ -321,6 +321,7 @@ mandir = @mandir@ mkdir_p = @mkdir_p@ oa_c_runtime = @oa_c_runtime@ oa_c_runtime_extra = @oa_c_runtime_extra@ +oa_delay_ffi = @oa_delay_ffi@ oa_editor = @oa_editor@ oa_enable_checking = @oa_enable_checking@ oa_enable_profiling = @oa_enable_profiling@ diff --git a/config/open-axiom.m4 b/config/open-axiom.m4 index 26614d14..1860f8b1 100644 --- a/config/open-axiom.m4 +++ b/config/open-axiom.m4 @@ -176,6 +176,24 @@ AC_DEFINE_UNQUOTED([OPENAXIOM_BASE_RTS], [The kind of base runtime system for this build.]) ]) +dnl --------------------------------- +dnl -- OPENAXIOM_CHECK_DELAYED_FFI -- +dnl --------------------------------- +dnl Check whether loading modules for dynamic FFI support +dnl should be delayed to runtime. This is needed for Lisp +dnl systems that have trouble with DLLs. +AC_DEFUN([OPENAXIOM_CHECK_DELAYED_FFI], [ +case ${axiom_lisp_flavor},$host in + sbcl,* | clozure,* | clisp,*) + oa_delay_ffi=yes + ;; + *) + oa_delay_ffi=no + ;; +esac +AC_SUBST([oa_delay_ffi]) +]) + dnl -------------------------------------------- dnl -- OPENAXIOM_CPPFLAGS_FOR_VENDOR_LOCK_INS -- dnl -------------------------------------------- @@ -207,6 +225,7 @@ OPENAXIOM_PROG_LISP OPENAXIOM_LISP_FLAVOR OPENAXIOM_REJECT_ROTTED_LISP OPENAXIOM_HOST_LISP_CPU_PRECISION +OPENAXIOM_CHECK_DELAYED_FFI ## Are we using compilers from GNU? oa_gnu_compiler=no AC_PROG_CC @@ -685,6 +685,8 @@ oa_shrobj_flags oa_use_libtool_for_shared_lib EGREP GREP +OA_DELAYED_FFI_FALSE +OA_DELAYED_FFI_TRUE OA_BUILD_GCL_FALSE OA_BUILD_GCL_TRUE CXXCPP @@ -712,6 +714,7 @@ CPPFLAGS LDFLAGS CFLAGS CC +oa_delay_ffi oa_standard_linking axiom_lisp_flavor AXIOM_LISP @@ -3833,6 +3836,17 @@ $as_echo_n "checking CPU precision as seen by $AXIOM_LISP... " >&6; } $as_echo "$openaxiom_host_lisp_precision" >&6; } fi + +case ${axiom_lisp_flavor},$host in + sbcl,* | clozure,* | clisp,*) + oa_delay_ffi=yes + ;; + *) + oa_delay_ffi=no + ;; +esac + + ## Are we using compilers from GNU? oa_gnu_compiler=no ac_ext=c @@ -5458,6 +5472,14 @@ else OA_BUILD_GCL_FALSE= fi + if test x$oa_delay_ffi = xyes; then + OA_DELAYED_FFI_TRUE= + OA_DELAYED_FFI_FALSE='#' +else + OA_DELAYED_FFI_TRUE='#' + OA_DELAYED_FFI_FALSE= +fi + @@ -19854,6 +19876,10 @@ if test -z "${OA_BUILD_GCL_TRUE}" && test -z "${OA_BUILD_GCL_FALSE}"; then as_fn_error $? "conditional \"OA_BUILD_GCL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${OA_DELAYED_FFI_TRUE}" && test -z "${OA_DELAYED_FFI_FALSE}"; then + as_fn_error $? "conditional \"OA_DELAYED_FFI\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${OA_BUILD_SMAN_TRUE}" && test -z "${OA_BUILD_SMAN_FALSE}"; then as_fn_error $? "conditional \"OA_BUILD_SMAN\" was never defined. diff --git a/configure.ac b/configure.ac index d83d02ff..bb5c12a1 100644 --- a/configure.ac +++ b/configure.ac @@ -81,6 +81,7 @@ AC_LANG([C++]) OPENAXIOM_HOST_COMPILERS AM_CONDITIONAL([OA_BUILD_GCL], [test x$oa_include_gcl = xyes]) +AM_CONDITIONAL([OA_DELAYED_FFI], [test x$oa_delay_ffi = xyes]) OPENAXIOM_HOST_DATA_PROPERTIES diff --git a/src/ChangeLog b/src/ChangeLog index 9cecbe00..8fe7c4e4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,28 @@ +2012-08-19 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * lisp/core.lisp.in (primitiveLoad): New. Export. + ($delayedFFI): Likewise. + * lisp/Makefile.in (oa_delay_ffi): New. + (edit): Update. + * interp/sys-utility.boot: import sys-constants instead of sys-os. + * interp/sys-driver.boot (%sysInit): Do not loadSystemRuntimeCore. + (loadDelayedFFI): New. + (executeSpadScript): Call it. + (compileSpadLibrary): Likewise. + (buildInitdbHandler): Likewise. + (systemMain): Likewise. + * interp/util.lisp (BUILD-INTERPSYS): Likewise. + * interp/Makefile.in (oa_target_moddir): New. + (OA_FFI_MOD): Likewise. + (OA_FFI_OBJ): Define conditionally. + (OBJS): Use it. + ($(oa_target_delayed)): New rule. + (oa_target_delayed): New. + (oa_target_ffi): Define conditionally. + (${SAVESYS}): Require it. + (${AXIOMSYS}): Likewise. + (sys-utility.$(FASLEXT)): Now require sys-constants.$(FASLEXT). + 2012-08-18 Gabriel Dos Reis <gdr@cs.tamu.edu> * boot/ast.boot (genSBCLnativeTranslation): Do no prepend an diff --git a/src/Makefile.in b/src/Makefile.in index a2c79f76..330bf5f9 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -260,6 +260,7 @@ mandir = @mandir@ mkdir_p = @mkdir_p@ oa_c_runtime = @oa_c_runtime@ oa_c_runtime_extra = @oa_c_runtime_extra@ +oa_delay_ffi = @oa_delay_ffi@ oa_editor = @oa_editor@ oa_enable_checking = @oa_enable_checking@ oa_enable_profiling = @oa_enable_profiling@ diff --git a/src/boot/ast.boot b/src/boot/ast.boot index fdbb1296..c898c6d8 100644 --- a/src/boot/ast.boot +++ b/src/boot/ast.boot @@ -1933,6 +1933,3 @@ genImportDeclaration(op, sig) == %hasFeature KEYWORD::ECL => genECLnativeTranslation(op,s,t,op') %hasFeature KEYWORD::CLOZURE => genCLOZUREnativeTranslation(op,s,t,op') fatalError '"import declaration not implemented for this Lisp" - - - diff --git a/src/interp/Makefile.in b/src/interp/Makefile.in index b35b6597..e67fbd37 100644 --- a/src/interp/Makefile.in +++ b/src/interp/Makefile.in @@ -1,6 +1,6 @@ ## Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. ## All rights reserved. -## Copyright (C) 2007-2011, Gabriel Dos Reis. +## Copyright (C) 2007-2012, Gabriel Dos Reis. ## All rights reserved. ## ## Redistribution and use in source and binary forms, with or without @@ -39,6 +39,17 @@ IN=$(srcdir) DOC=$(axiom_target_docdir)/src/interp BOOK=$(axiom_target_docdir) +## Where to put interp modules +oa_target_moddir = $(axiom_targetdir)/interp + +## FFI module. +OA_FFI_MOD = sys-os.$(FASLEXT) +@OA_DELAYED_FFI_FALSE@OA_FFI_OBJ = $(OA_FFI_MOD) + +## Installed FFI delayed module. +oa_target_delayed = $(oa_target_moddir)/$(OA_FFI_MOD) +@OA_DELAYED_FFI_TRUE@oa_target_ffi = $(oa_target_delayed) + # Driver to launch translation and compilation DRIVER = $(top_builddir)/src/driver/open-axiom$(EXEEXT) @@ -52,10 +63,11 @@ SAVESYS= interpsys$(EXEEXT) AXIOMSYS= $(axiom_target_bindir)/AXIOMsys$(EXEEXT) OBJS= boot-pkg.$(FASLEXT) types.$(FASLEXT) \ + $(OA_FFI_OBJ) \ sys-driver.$(FASLEXT) sys-constants.$(FASLEXT) \ hash.$(FASLEXT) lisp-backend.$(FASLEXT) \ sys-globals.$(FASLEXT) vmlisp.$(FASLEXT) \ - io.$(FASLEXT) sys-os.$(FASLEXT) \ + io.$(FASLEXT) \ sys-utility.$(FASLEXT) lexing.$(FASLEXT) \ diagnostics.$(FASLEXT) \ union.$(FASLEXT) sys-macros.$(FASLEXT) \ @@ -175,6 +187,9 @@ clean-local: mostlyclean-local distclean-local: clean-local +$(oa_target_delayed): $(OA_FFI_MOD) + $(mkdir_p) $(oa_target_moddir) + cp -p $< $@ $(axiom_target_datadir)/msgs/s2-us.msgs: \ $(axiom_src_docdir)/msgs/s2-us.msgs @@ -192,7 +207,7 @@ makeint.lisp: Makefile @ echo '#+:gcl (si::gbc-time 0)' >> makeint.lisp @ echo '#+:GCL (si::gbc t)' >> makeint.lisp -${SAVESYS}: database.date $(axiom_target_datadir)/msgs/s2-us.msgs $(OBJS) +${SAVESYS}: database.date $(axiom_target_datadir)/msgs/s2-us.msgs $(OBJS) $(oa_target_ffi) $(DRIVER) --execpath=$(BOOTSYS) \ --syslib=$(axiom_target_libdir) \ --system="$(AXIOM)/" --system-algebra \ @@ -208,7 +223,7 @@ all-axiomsys: ${AXIOMSYS} ${AXIOMSYS}: database.date \ $(axiom_targetdir)/algebra/exposed.$(FASLEXT) \ $(axiom_target_datadir)/msgs/s2-us.msgs \ - $(OBJS) makeint.$(LNKEXT) + $(OBJS) $(oa_target_ffi) makeint.$(LNKEXT) $(DRIVER) --execpath=$(BOOTSYS) \ --syslib=$(axiom_target_libdir) \ --system="$(AXIOM)/" \ @@ -380,7 +395,7 @@ hash.$(FASLEXT): types.$(FASLEXT) union.$(FASLEXT): vmlisp.$(FASLEXT) ggreater.$(FASLEXT): vmlisp.$(FASLEXT) lisp-backend.$(FASLEXT): sys-macros.$(FASLEXT) nlib.$(FASLEXT) -sys-utility.$(FASLEXT): vmlisp.$(FASLEXT) sys-os.$(FASLEXT) hash.$(FASLEXT) +sys-utility.$(FASLEXT): vmlisp.$(FASLEXT) sys-constants.$(FASLEXT) hash.$(FASLEXT) vmlisp.$(FASLEXT): types.$(FASLEXT) sys-globals.$(FASLEXT) io.$(FASLEXT): sys-constants.$(FASLEXT) types.$(FASLEXT): boot-pkg.$(FASLEXT) diff --git a/src/interp/sys-driver.boot b/src/interp/sys-driver.boot index 55bd3243..f38fb0fc 100644 --- a/src/interp/sys-driver.boot +++ b/src/interp/sys-driver.boot @@ -62,7 +62,6 @@ symbolFunction('%sysInit) := () +-> SETQ(_*PACKAGE_*, FIND_-PACKAGE '"BOOT") SETQ(_*LOAD_-VERBOSE_*,false) initMemoryConfig() - loadSystemRuntimeCore() )if %hasFeature KEYWORD::CLISP -- a goat for CLisp FFI, please. sys_-osInitCLispFFI() @@ -187,6 +186,11 @@ initializeDatabases firstTime? == fillDatabasesInCore() mkLowerCaseConTable() +++ If the FFI was delayed to runtime, load it. +loadDelayedFFI() == + not $delayedFFI => nil + primitiveLoad strconc(systemRootDirectory(),'"interp/sys-os") + ++ Initialize all global states that need to. Sub-routine of the command ++ line compiler, the script executor, etc. Mess with care. initializeGlobalState() == @@ -261,6 +265,7 @@ executeSpadScript(progname,options,file) == $ReadingFile: local := true -- $ProcessInteractiveValue: local := true $verbose: local := false + loadDelayedFFI() initializeGlobalState() outfile := getOptionValue "output" testing := getOptionValue "test" @@ -290,6 +295,7 @@ associateRequestWithFileType(Option '"script", '"input", ++ compiler Spad Library File. compileSpadLibrary(progname,options,file) == $displayStartMsgs := false + loadDelayedFFI() initializeGlobalState() $Echo: local := false $verbose := false @@ -306,6 +312,7 @@ associateRequestWithFileType(Option '"compile", '"spad", buildDatabasesHandler(prog,options,args) == $displayStartMsgs := false + loadDelayedFFI() initializeGlobalState() MAKE_-DATABASES args coreQuit(errorCount() > 0 => 1; 0) @@ -315,6 +322,7 @@ installDriver(Option '"build-databases",function buildDatabasesHandler) buildInitdbHandler(prog,options,args) == $displayStartMsgs := false + loadDelayedFFI() initializeGlobalState() srcdir := getOptionValue "spad-srcdir" or coreError '"missing --spad-srcdir=<dir> argument" @@ -337,6 +345,7 @@ systemMain() == -- ??? do any substantial work if we call from it. AxiomCore::topLevel() REROOT() + loadDelayedFFI() -- ??? Make this call unconditional if $StandardLinking then initializeGlobalState() diff --git a/src/interp/sys-utility.boot b/src/interp/sys-utility.boot index 78dbb2c7..b75c3115 100644 --- a/src/interp/sys-utility.boot +++ b/src/interp/sys-utility.boot @@ -33,7 +33,7 @@ -- This file defines some utility functions common to both the compiler -- and interpreter. -import sys_-os +import sys_-constants import vmlisp import hash namespace BOOT diff --git a/src/interp/util.lisp b/src/interp/util.lisp index 9429a13e..fd9349d9 100644 --- a/src/interp/util.lisp +++ b/src/interp/util.lisp @@ -249,6 +249,7 @@ (reroot) (|resetWorkspaceVariables|) (|AxiomCore|::|%sysInit|) + (|loadDelayedFFI|) (|buildHtMacroTable|) (|initHist|) (|initNewWorld|) diff --git a/src/lisp/Makefile.in b/src/lisp/Makefile.in index 77c8edb8..6bfc0ee4 100644 --- a/src/lisp/Makefile.in +++ b/src/lisp/Makefile.in @@ -132,6 +132,7 @@ $(oa_target_lispdir)/linkset: $(oa_target_lispdir)/core.$(LNKEXT) echo '$(base_lisp_objects)' > $@ oa_optimize_options = @oa_optimize_options@ +oa_delay_ffi = @oa_delay_ffi@ oa_editor = @oa_editor@ @@ -161,6 +162,7 @@ edit = sed \ -e 's|@oa_c_runtime_extra[@]|$(patsubst %,"%",$(oa_c_runtime_extra))|g' \ -e 's|@oa_standard_linking[@]|$(oa_standard_linking)|g' \ -e 's|@oa_enable_profiling[@]|$(oa_enable_lisp_profiling)|g' \ + -e 's|@oa_delay_ffi[@]|$(oa_delay_ffi)|g' \ -e 's|@void_type[@]|$(void_type)|g' \ -e 's|@char_type[@]|$(char_type)|g' \ -e 's|@int_type[@]|$(int_type)|g' \ diff --git a/src/lisp/core.lisp.in b/src/lisp/core.lisp.in index d869cbf4..becb1390 100644 --- a/src/lisp/core.lisp.in +++ b/src/lisp/core.lisp.in @@ -139,6 +139,7 @@ "%FunctorDefaultTable" "%FunctorLookupFunction" + "primitiveLoad" "coreQuit" "fatalError" "internalError" @@ -176,6 +177,7 @@ "$targetPlatform" "$faslType" + "$delayedFFI" "$effectiveFaslType" "$NativeModuleExt" "$systemInstallationDirectory" @@ -420,6 +422,10 @@ #+:gcl nil #-(or :ecl :gcl) t) +;; True if FFI modules were delayed till runtime. +(defconstant |$delayedFFI| + (eq '@oa_delay_ffi@ 'yes)) + ;; The top level read-eval-print loop function of the base ;; Lisp system we are using. This is a very brittle way ;; of achieving something conceptually simple. @@ -852,6 +858,10 @@ (error "don't know how to save Lisp image")) +;; Load a module designated by `f'. +(defmacro |primitiveLoad| (f) + `(load ,f)) + ;; ;; -*- Program Termination -*- ;; |