summaryrefslogtreecommitdiff
path: root/module/oop/goops/compile.scm
AgeCommit message (Collapse)AuthorFilesLines
2015-01-23Fold GOOPS compile and dispatch modules into main GOOPS moduleAndy Wingo1-55/+0
* libguile/goops.c (scm_sys_invalidate_method_cache_x): Remove C interface to this internal method. Instead, internal callers are all from Scheme, so we move the implementation to Scheme. (scm_make): Dispatch to `make' in Scheme. This is an incompatible but great change, as it fulfills the common user perception that scm_make is the same as GOOPS's `make'. (scm_sys_goops_early_init): Capture `make'. (scm_no_applicable_method): Define in Scheme and capture in C. * module/Makefile.am: Remove oop/goops/compile.scm and oop/goops/dispatch.scm. * module/oop/goops/compile.scm: * module/oop/goops/dispatch.scm: Fold into goops.scm. * module/oop/goops.scm: Fold in the generic compile and dispatch modules. This eliminates a circularity that caused some eval-when shenanigans, so remove the eval-whens as well. Reimplement the boot version of `make' in Scheme, and make the <generic> `initialize' method handle invalidation instead of the generic %allocate-instance. (no-applicable-method): Define here. Import the utils module in the normal define-module block.
2014-01-23Improve correctness and consistency of 'eval-when' usage.Mark H Weaver1-1/+1
* module/ice-9/boot-9.scm: * module/ice-9/i18n.scm: * module/ice-9/poll.scm: * module/ice-9/popen.scm: * module/ice-9/r6rs-libraries.scm: * module/oop/goops.scm: * module/oop/goops/compile.scm: * module/oop/goops/dispatch.scm: * module/srfi/srfi-88.scm: * module/system/foreign.scm: * module/texinfo/serialize.scm: Change most uses of 'compile' to 'expand', except where we must avoid it during initial bootstrap before the module system is loaded. Remove redundant uses of 'compile' where 'expand' is also given. Standardize on the "(expand load eval)" order of conditions.
2011-01-30Fix GOOPS method compilation bug when no next-method existsMark H Weaver1-1/+1
* module/oop/goops/compile.scm (compute-cmethod): Fix a bug that caused the method compiler to barf while compiling a method that calls (next-method), if there is no applicable next method.
2009-11-26remove code-table slot from methodsAndy Wingo1-28/+2
* libguile/goops.c (scm_sys_invalidate_method_cache_x, scm_make) (create_standard_classes): Remove code-table slot from methods. The generic cache completely does its job, afaict. * libguile/goops.h (scm_si_formals, scm_si_body, scm_si_make_procedure): Renumber slots. * module/oop/goops.scm (initialize on <method>): No more code-table slot. * module/oop/goops/compile.scm: Always "compile" a method, instead of looking for a hit in an always-empty cache.
2009-06-17Change Guile license to LGPLv3+Neil Jerram1-1/+1
(Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* )
2009-06-07fix bug in goops' method cache with rest argsAndy Wingo1-5/+6
* module/oop/goops/compile.scm (code-table-lookup): Fix a tricky little bug! * test-suite/tests/goops.test ("the method cache"): Add a wee test.
2009-05-21rewrite `method' as a hygienic macro to re-allow lexical specializersAndy Wingo1-30/+2
* module/oop/goops.scm (method): Reimplement as a hygienic macro. This seriously took me like 6 hours to figure out. Allows for lexical specializers: (let ((<x> ...)) (define-method (foo (arg <x>)) ...)). * module/oop/goops/compile.scm (next-method?, compile-make-procedure): Remove these, as `method' does it all now, hygienically.
2009-03-06Replace eval-case with eval-whenAndy Wingo1-1/+1
* module/ice-9/boot-9.scm (eval-when): Replace eval-case with eval-when. Eval-when is *much* simpler, and more expressive to boot. Perhaps in the future we'll get 'visit and 'revisit too. * module/ice-9/deprecated.scm (eval-case): Provide mostly-working deprecated version of eval-case. * module/ice-9/boot-9.scm (defmacro, define-macro): Relax condition: we can make defmacros that are not at the toplevel now. But in the future we should replace this implementation of defmacros with one written in syntax-case. (define-module, use-modules, use-syntax): Allow at non-toplevel. (define-public, defmacro-public, export, re-export): Don't evaluate at compile-time, I can't see how that helps things. Allow `export' and `re-export' at non-toplevel. * module/ice-9/getopt-long.scm: * module/ice-9/i18n.scm: * module/oop/goops.scm: * module/oop/goops/compile.scm: * module/oop/goops/dispatch.scm: Switch to use eval-when, not eval-case. * module/language/scheme/compile-ghil.scm (eval-when): Replace eval-case transformer with eval-when transformer. Sooooo much simpler, and it will get better once we separate expansion from compilation. * module/language/scheme/expand.scm (quasiquote): Hm, expand quasiquote properly. Not hygienic. Syncase needed. (lambda): Handle internal defines with docstrings propertly.
2009-02-13don't re-enter the compiler during method dispatchAndy Wingo1-152/+38
* libguile/goops.c (scm_make): In the pre-inst `make', default `procedure' to #f, and read a `make-procedure' instead of `compile-env'. * libguile/goops.h (scm_si_make_procedure): This instead of scm_si_compile_env. * module/oop/goops.scm (make-method): Remove this unused function. Users should use (make <method> ...) directly. (method): Capture `make-procedure' instead of `procedure' in the case that the body calls a next-method. Allows for the kind of "recompilation" that we were using before, but with closures instead of re-entering the compiler. Type-specific compilation is still interesting, but probably should be implemented in another way. (initialize): Default #:procedure to #f, and s/compile-env/make-procedure/. * module/oop/goops/compile.scm (code-table-lookup): Just return the cmethod, not the entry -- since the entry is now just (append types cmethod). (compile-make-procedure): New procedure, returns a form that, when evaluated/compiled, will yield a procedure of one argument, the next-method. When called with a next-method, the procedure returns an actual method implementation. compile-make-procedure returns #f if the body doesn't call next-method. (compile-method): Unify to always return procedures. Much cleaner and *much* faster in the compiled case. In the interpreted case, there might be a slight slowdown, but if there is one it should be slight. * module/oop/goops/dispatch.scm (method-cache-install!): Adapt to removal of compute-entry-with-cmethod.
2008-11-14nifty generic compiler infrastructure -- no more hardcoded passesAndy Wingo1-1/+1
* module/system/base/language.scm (<language>): Rework so that instead of hardcoding passes in the language, we define compilers that translate from one language to another. Add `parser' to the language fields, a bit of a hack but useful for languages with s-expression external representations but with record internal representations. (define-language, *compilation-cache*, invalidate-compilation-cache!) (compute-compilation-order, lookup-compilation-order): Add an algorithm that does a depth-first search for a translation path from a source language to a target language, caching the result in a lookup table. * module/language/scheme/spec.scm: * module/language/ghil/spec.scm: Update to the new language format. * module/language/glil/spec.scm: Add a language specification for GLIL, with a compiler to objcode. Also there are parsers and printers, for repl usage, but for some reason this doesn't work yet. * module/language/objcode/spec.scm: Define a language specification for object code. There is some sleight of hand here, in the "compiler" to values; but there is method behind the madness, because this way we higher levels can pass environments (a module + externals pair) to objcode->program. * module/language/value/spec.scm: Define a language specification for values. There is something intellectually dishonest about this, but it does serve its purpose as a foundation for the language hierarchy. * configure.in: * module/language/Makefile.am * module/language/ghil/Makefile.am * module/language/glil/Makefile.am * module/language/objcode/Makefile.am * module/language/value/Makefile.am: Autotomfoolery for the ghil, glil, objcode, and value languages. * module/language/scheme/translate.scm (translate): Import the bits that understand `compile-time-environment' here, and pass on the relevant portions of the environment to the next compiler pass. * module/system/base/compile.scm (current-language): New procedure, refs the current language fluid, or lazily sets it to scheme. (call-once, call-with-output-file/atomic): Refactor these bits to use with-throw-handler. No functional change. (compile-file, compile-and-load, compile-passes, compile-fold) (compile): Refactor the public interface of the compiler to be generic and simple. Uses `lookup-compilation-order' to find a path from the source language to the target language. * module/system/base/syntax.scm (define-type): Adapt to changes in define-record. (define-record): Instead of expecting all slots in the first form, expect them in the body, and let the first form hold the options. * module/system/il/compile.scm (compile): Adapt to the compilation pass API (three in and two out). * module/system/il/ghil.scm (<ghil-var>, <ghil-env>) (<ghil-toplevel-env>): Adapt to define-record changes. * module/system/il/glil.scm (<glil-vars>): Adapt to define-record changes. (<glil>, print-glil): Add a GLIL record printer that uses unparse. (parse-glil, unparse-glil): Update unparse (formerly known as pprint), and write a parse function. * module/system/repl/common.scm (<repl>): Adapt to define-record changes. (repl-parse): New function, parses the read form using the current language. Something of a hack. (repl-compile): Adapt to changes in `compile'. (repl-eval): Fix up the does-the-language-have-a-compiler check for changes in <language>. * module/system/repl/repl.scm (start-repl): Parse the form before eval. * module/system/repl/command.scm (describe): Parse. (compile): Be more generic. (compile-file): Adapt to changes in compile-file. (disassemble, time, profile, trace): Parse. * module/system/vm/debug.scm: * module/system/vm/assemble.scm: Adapt to define-record changes. * module/language/scheme/translate.scm (receive): Fix an important bug that gave `receive' letrec semantics instead of let semantics. Whoops!
2008-11-01move ice-9/ and oop/ under module/Andy Wingo1-0/+222
Moved ice-9/ and oop/ under module/, with the idea being that we have only scheme under module/. Adjusted configure.in and Makefile.am appropriately. Put oop/ at the end of the compilation order.