diff options
author | dos-reis <gdr@axiomatics.org> | 2008-10-01 18:26:32 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-10-01 18:26:32 +0000 |
commit | ea832606b8ad21eb020bc71dbc98427a8068ca3e (patch) | |
tree | 43f6a28550aa782295fb62ae8922aa5f9b958b55 | |
parent | cc8a4fee3515864990e852d3a1cfc3342c256b1d (diff) | |
download | open-axiom-ea832606b8ad21eb020bc71dbc98427a8068ca3e.tar.gz |
* interp/c-util.boot ($optProclaim): New.
($optReplaceSimpleFunctions): Likewise.
(setCompilerOptimizations): Likewise. Set them.
(proclaimCapsuleFunction): New.
* interp/compiler.boot (compileSpad2Cmd): Handle option ')optimize'.
* interp/define.boot (compile): Proclaim if appropriate.
* interp/sys-driver.boot (compileSpadLibrary): Honor optimization
level set on commmand line.
* interp/sys-utility.boot (getVMType): Tidy.
* interp/types.boot (%Void): Likewise.
(IntegerSection): New.
-rwxr-xr-x | configure | 18 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | configure.ac.pamphlet | 2 | ||||
-rw-r--r-- | src/ChangeLog | 14 | ||||
-rw-r--r-- | src/interp/c-util.boot | 50 | ||||
-rw-r--r-- | src/interp/compiler.boot | 4 | ||||
-rw-r--r-- | src/interp/define.boot | 5 | ||||
-rw-r--r-- | src/interp/sys-driver.boot | 2 | ||||
-rw-r--r-- | src/interp/sys-utility.boot | 10 | ||||
-rw-r--r-- | src/interp/types.boot | 15 |
10 files changed, 109 insertions, 13 deletions
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60 for OpenAxiom 1.3.0-2008-09-27. +# Generated by GNU Autoconf 2.60 for OpenAxiom 1.3.0-2008-10-01. # # Report bugs to <open-axiom-bugs@lists.sf.net>. # @@ -713,8 +713,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='OpenAxiom' PACKAGE_TARNAME='openaxiom' -PACKAGE_VERSION='1.3.0-2008-09-27' -PACKAGE_STRING='OpenAxiom 1.3.0-2008-09-27' +PACKAGE_VERSION='1.3.0-2008-10-01' +PACKAGE_STRING='OpenAxiom 1.3.0-2008-10-01' PACKAGE_BUGREPORT='open-axiom-bugs@lists.sf.net' ac_unique_file="src/Makefile.pamphlet" @@ -1404,7 +1404,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures OpenAxiom 1.3.0-2008-09-27 to adapt to many kinds of systems. +\`configure' configures OpenAxiom 1.3.0-2008-10-01 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1474,7 +1474,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of OpenAxiom 1.3.0-2008-09-27:";; + short | recursive ) echo "Configuration of OpenAxiom 1.3.0-2008-10-01:";; esac cat <<\_ACEOF @@ -1578,7 +1578,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -OpenAxiom configure 1.3.0-2008-09-27 +OpenAxiom configure 1.3.0-2008-10-01 generated by GNU Autoconf 2.60 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1592,7 +1592,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by OpenAxiom $as_me 1.3.0-2008-09-27, which was +It was created by OpenAxiom $as_me 1.3.0-2008-10-01, which was generated by GNU Autoconf 2.60. Invocation command line was $ $0 $@ @@ -26097,7 +26097,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by OpenAxiom $as_me 1.3.0-2008-09-27, which was +This file was extended by OpenAxiom $as_me 1.3.0-2008-10-01, which was generated by GNU Autoconf 2.60. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -26146,7 +26146,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -OpenAxiom config.status 1.3.0-2008-09-27 +OpenAxiom config.status 1.3.0-2008-10-01 configured by $0, generated by GNU Autoconf 2.60, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 142d019f..b9957a6a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ sinclude(config/open-axiom.m4) sinclude(config/aclocal.m4) -AC_INIT([OpenAxiom], [1.3.0-2008-09-27], +AC_INIT([OpenAxiom], [1.3.0-2008-10-01], [open-axiom-bugs@lists.sf.net]) AC_CONFIG_AUX_DIR(config) diff --git a/configure.ac.pamphlet b/configure.ac.pamphlet index df0d1c10..0ac54eba 100644 --- a/configure.ac.pamphlet +++ b/configure.ac.pamphlet @@ -1126,7 +1126,7 @@ information: <<Autoconf init>>= sinclude(config/open-axiom.m4) sinclude(config/aclocal.m4) -AC_INIT([OpenAxiom], [1.3.0-2008-09-27], +AC_INIT([OpenAxiom], [1.3.0-2008-10-01], [open-axiom-bugs@lists.sf.net]) @ diff --git a/src/ChangeLog b/src/ChangeLog index af723ff8..33582967 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,19 @@ 2008-10-01 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/c-util.boot ($optProclaim): New. + ($optReplaceSimpleFunctions): Likewise. + (setCompilerOptimizations): Likewise. Set them. + (proclaimCapsuleFunction): New. + * interp/compiler.boot (compileSpad2Cmd): Handle option ')optimize'. + * interp/define.boot (compile): Proclaim if appropriate. + * interp/sys-driver.boot (compileSpadLibrary): Honor optimization + level set on commmand line. + * interp/sys-utility.boot (getVMType): Tidy. + * interp/types.boot (%Void): Likewise. + (IntegerSection): New. + +2008-10-01 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/i-output.boot: Move dispatch table from property.lisp. * interp/buildom.boot: Likewise. * interp/def.lisp: Likewise. diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index 47ff18b1..7bf1e1b9 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -46,6 +46,15 @@ $Representation := nil $formalArgList := [] +--% Optimization control + +++ true if we have to proclaim function signatures in the generated Lisp. +$optProclaim := false + +++ true if we have to inline simple functions before codegen. +$optReplaceSimpleFunctions := false + + --% ++ If using old `Rep' definition semantics, return `$' when m is `Rep'. @@ -821,3 +830,44 @@ ambiguousSignatureError(op, sigs) == stackSemanticError(['"signature of lhs not unique. Candidates are:", :displayAmbiguousSignatures($op,sigs)],nil) +--% +setCompilerOptimizations level == + level = nil => nil + INTEGERP level => + if level = 0 then + -- explicit request for no optimization. + $optProclaim := false + $optReplaceSimpleFunctions := false + if level > 0 then + $optProclaim := true + $optReplaceSimpleFunctions := true + coreError '"unknown optimization level request" + +++ Proclaim the type of the capsule function `op' with signature `sig'. +++ Note that all capsule functions take an additional argument +++ standing for the domain of computation object. +proclaimCapsuleFunction(op,sig) == + LAM_,EVALANDFILEACTQ + ["DECLAIM",["FTYPE", + ["FUNCTION",[:[argType first d for d in tails rest sig],"%Shell"], + retType first sig],op]] where + argType d == + getVMType normalize d + retType d == + d := normalize d + atom d => getVMType d + args := rest d + #args = 0 => getVMType d + or/[atom a for a in args] => "%Thing" + -- not theoretically correct, but practically OK. + getVMType d + normalize d == + d = "$" => + -- If the representation is explicitly stated, use it. That way + -- we optimize abstractions just as well as builtins. + rep := get("Rep","value",$e) => rep + -- Cope with old-style constructor definition + atom $functorForm => [$functorForm] + $functorForm + atom d => d + [first d, :[normalize first args for args in tails rest d]] diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index 121924bd..004acbb0 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -1683,6 +1683,7 @@ compileSpad2Cmd args == vartrace _ quiet _ translate _ + optimize ) translateOldToNew := nil @@ -1728,6 +1729,7 @@ compileSpad2Cmd args == throwKeyedMsg("S2IZ0037",['")constructor"]) fun.0 := 'c constructor := [unabbrev o for o in optargs] + fullopt = "optimize" => setCompilerOptimizations first optargs throwKeyedMsg("S2IZ0036",[STRCONC('")",object2String optname)]) $InteractiveMode : local := nil @@ -1745,6 +1747,8 @@ compileSpad2Cmd args == if not $buildingSystemAlgebra then extendLocalLibdb $newConlist terminateSystemCommand() + -- reset compiler optimization options + setCompilerOptimizations 0 spadPrompt() convertSpadToAsFile path == diff --git a/src/interp/define.boot b/src/interp/define.boot index 88ef628d..b607cd4b 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -1207,6 +1207,11 @@ compile u == else putInLocalDomainReferences optimizedBody $doNotCompileJustPrint=true => (PRETTYPRINT stuffToCompile; op') $macroIfTrue => constructMacro stuffToCompile + + -- Let the backend know about this function's type + if $insideCapsuleFunctionIfTrue and $optProclaim then + proclaimCapsuleFunction(op',$signatureOfForm) + result:= spadCompileOrSetq stuffToCompile functionStats:=[0,elapsedTime()] $functionStats:= addStats($functionStats,functionStats) diff --git a/src/interp/sys-driver.boot b/src/interp/sys-driver.boot index 4c98c8e2..da622f96 100644 --- a/src/interp/sys-driver.boot +++ b/src/interp/sys-driver.boot @@ -267,6 +267,8 @@ compileSpadLibrary(progname,options,file) == $verbose := false $ProcessInteractiveValue := true $PrintCompilerMessageIfTrue := $verbose + setCompilerOptimizations + getOptionValue(Option '"optimize",%systemOptions()) CATCH($intTopLevel, CATCH("SpadCompileItem", CATCH($SpadReaderTag,compiler [file]))) diff --git a/src/interp/sys-utility.boot b/src/interp/sys-utility.boot index 57fc9a9b..441d356e 100644 --- a/src/interp/sys-utility.boot +++ b/src/interp/sys-utility.boot @@ -44,6 +44,8 @@ namespace BOOT ++ representation of a domain, as a Lisp type specifier as seen by ++ the runtime system. getVMType d == + IDENTP d => "%Thing" + STRINGP d => "%Thing" -- literal flag parameter case (d' := devaluate d) of Void => "%Void" Boolean => "%Boolean" @@ -51,11 +53,19 @@ getVMType d == Character => "%Char" SingleInteger => "%Short" Integer => "%Integer" + NonNegativeInteger => ["%IntegerSection",0] + PositiveInteger => ["%IntegerSection",1] + IntegerMod => "%Integer" + DoubleFloat => "%DoubleFloat" String => "%String" List => "%List" Vector => ["%Vector",getVMType second d'] PrimitiveArray => ["%SimpleArray", getVMType second d'] Pair => "%Pair" + Union => "%Pair" + Record => + #rest d' > 2 => "%Shell" + "%Pair" otherwise => "%Thing" -- good enough, for now. --% diff --git a/src/interp/types.boot b/src/interp/types.boot index 6bb4a555..00b55d64 100644 --- a/src/interp/types.boot +++ b/src/interp/types.boot @@ -36,9 +36,17 @@ namespace BOOT --% Basic types used throughout Boot codes. -++ Type of nothing. Bottom of the latting. +++ Type of nothing. Bottom of the abstract machine type lattice. +++ Since Lisp functions always returns something, we cannot +++ use the `nil' type specifier (the ideal answer). Second +++ best possibility is to have Void-returning functions +++ systematically return `nil'. However, until the Lisp +++ backend is fixed, we will use the interpretation that a +++ Void-returning function may return anything, but nobody cares. +++ Hence, the choice below which contradicts the very first line +++ of this description. %Void <=> - nil + true ++ Type of truth values. %Boolean <=> @@ -63,6 +71,9 @@ namespace BOOT %Integer <=> INTEGER +%IntegerSection n <=> + INTEGER n + ++ Type of single precision floating point numbers. Most of the ++ time, this is a 32-bit datatype on IEEE-754 host. %SingleFloat <=> |