summaryrefslogtreecommitdiff
path: root/oop
AgeCommit message (Collapse)AuthorFilesLines
2008-11-01move ice-9/ and oop/ under module/Andy Wingo15-4008/+0
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.
2008-10-31compile goops accessors. woot!Andy Wingo1-5/+36
* oop/goops.scm: Define compiler hooks for dealing with @slot-ref and @slot-set!. (make-bound-check-get, make-get, make-set): Compile these indexed accessors instead of having them be closures. Probably slower for the memoizer, but faster for the vm... not sure what the perfect solution is. * test-suite/tests/goops.test ("defining classes"): Add a test that defining a class with accessors works (it didn't until I figured out that (@ (system base compile) compile) thing).
2008-10-31compile goops submodules, goops.test now passes againAndy Wingo5-95/+51
* libguile/goops.c (get_slot_value, set_slot_value): While keeping the inlined getter/setter dispatch for closures, allow the getters and setters to be any kind of procedure. * oop/goops.scm (compute-getters-n-setters): Relax the checks on getter/setter procedures, so that if a getter is a procedure but not a closure, we don't try to poke its arity. * oop/goops/Makefile.am (SOURCES): Compile all the goops submodules! * oop/goops/old-define-method.scm: Removed, in an act of housekeeping. * oop/goops/compile.scm: * oop/goops/dispatch.scm: Break a circular module dependency by making sure that (oop goops) is loaded when we go to compile submodules. * oop/goops/compile.scm (compile-method/memoizer) (compile-method/memoizer+next): Allow a procedure without source through. This can happen with getter and setter lambdas that were compiled, and in that case there is no next-method call anyway. Ideally we should be able to specify compile-method for accessor methods...
2008-10-31fix chaining up from interpreted to compiled methods; allow compiled init-thunkAndy Wingo1-2/+5
* libguile/goops.c (scm_sys_initialize_object): Don't assume that an init thunk is a closure; just go through scm_call_0 instead. * oop/goops/compile.scm (make-make-next-method/memoizer): Allow for the case that the next method is compiled.
2008-10-31compile goopsAndy Wingo4-31/+24
The pending task is to make the accessors compiled too, and also to compile compile.scm and dispatch.scm, and to integrate dispatch into the VM. * oop/Makefile.am (SOURCES): VM-ify the makefile, so we compile goops.scm by default. * oop/goops.scm (load-toplevel): Load goops builtins when compiling too. (method): Fix a literal #<unspecified> in the generated procedure (for an empty body). (internal-add-method!): Cleverness when bootstrapping add-method!. Neat! (initialize for <generic>): Use the `method' macro so we get compilation support. * oop/goops/dispatch.scm (cache-methods): Don't assume entries are pairs.
2008-10-30fix up some assumptions that cmethods were listsAndy Wingo1-2/+4
* libguile/eval.i.c (type_dispatch, apply_vm_cmethod) (apply_memoized_cmethod): Tweak the nastiness a bit more so as to deal with the '(no-method) empty entries. I would like to stop the search if the cdr isn't a pair, but currently with the inlined memoized bits, the cdr is a pair. The fix would be to make the memoizer return a procedure and not the already-inlined bits -- slightly slower but the vm will be faster anyway. * libguile/objects.c (scm_mcache_lookup_cmethod): Same fixes here. * oop/goops/dispatch.scm (cache-hashval, cache-try-hash!): Allow non-list cmethod tails.
2008-10-30runtime byte compilation of goops methods, whoooooAndy Wingo1-30/+100
* ice-9/boot-9.scm (make-modules-in): Change to make sure that we are making modules in modules; that is, that a global binding of `compile' doesn't prevent a module from importing a submodule named `compile'. (resolve-module): Clean up a bit, and serialize the logic. * libguile/objects.c (scm_mcache_lookup_cmethod, scm_apply_generic): * libguile/eval.i.c (CEVAL): Now that cmethod entries can have a program as their tail instead of a memoized proc, we have to change the halting condition on the method cache search, in both places: the one that's inlined into eval.i.c and the one in objects.c. If the cmethod isn't a pair, apply it. * libguile/goops.c (make): In the `make' procedure that's used before GOOPS is booted, bind #:formals, #:body, and #:compile-env on methods. * oop/goops/compile.scm (compute-entry-with-cmethod): There was a terrible trick here that involved putting a dummy pair in the cache, then modifying it in place with the result of memoization. The note claimed that this was to cut recursion short, or something. I can't see how it could recurse, given that `methods' is changing each time. Also, the pair trick doesn't work with byte-compiled methods. So, remove it. (compile-method): Dispatch to the appropriate method compiler, based on whether the method was defined with the interpreter or with the compiler. (make-next-method): New function, generically computes a `next-method' procedure, though the caller has to supply the arguments. (compile-method/vm): Exciting method byte compiler! (make-make-next-method/memoizer, compile-method/memoizer): Add the /memoizer suffix, and move all this code to the bottom of the file.
2008-10-25add `formals', `body', and `compile-env' slots to <method>Andy Wingo1-1/+8
* ice-9/boot-9.scm (compile-time-environment): Return #f instead of erroring under the interpreter, a bit more sane. * libguile/goops.c (create_standard_classes): * libguile/goops.h (scm_si_formals, scm_si_body, scm_si_compile_env): * oop/goops.scm (method, initialize): Add `formals', `body', and `compile-env' slots to <method>.
2008-10-25defmacroize (oop goops accessors), (oop goops save)Andy Wingo2-76/+62
* oop/goops/accessors.scm (define-class-with-accessors) (define-class-with-accessors-keywords): Turn into defmacros. * oop/goops/save.scm (readable, restore, write-component): Turn into defmacros. Both of these changes are untested, unfortunately.
2008-10-23method is a defmacro.Andy Wingo1-11/+7
* oop/goops.scm (method): Make into a defmacro.
2008-10-23define-method is a defmacroAndy Wingo1-50/+36
* oop/goops.scm (define-method): Make into a defmacro -- didn't change any of the logic, but the logic is a bit dodgy (see the note in the source).
2008-10-23define-generic, define-accessor are defmacros tooAndy Wingo1-70/+35
* oop/goops.scm (define-generic, define-accessor): Define as defmacros. I find their semantics to be a bit odd, though -- but the test case checks for this behavior, so we'll follow the test cases.
2008-10-23make `define-class' and `class' into defmacrosAndy Wingo1-143/+73
* oop/goops.scm: Use srfi-1, as util.scm already does. (kw-do-map): New helper for processing keyword args. (define-class-pre-definition, define-class): Rework so that define-class is a defmacro without side effects. There are two functional differences: we don't check that define-class is called only at the toplevel, because defining a lexical class might makes sense, and defmacros don't give us the toplevel check that we would want. Second in the redefinition case, we don't do a `define', as we don't actually need a new variable. (class): Similarly, make `class' a defmacro.
2008-10-18fix bug in self-tail-recursion with "external" variables; other sundriesAndy Wingo1-0/+2
* gdbinit (pp, inst): New commands. * libguile/vm-engine.c (vm_error_not_a_pair): New error case. * libguile/vm-i-scheme.c (VM_VALIDATE_CONS): New macro -- use this instead of SCM_VALIDATE_* because SCM_VALIDATE will exit nonlocally before we have a chance to sync the regs. (car, cdr, set-car, set-cdr): Use VM_VALIDATE_CONS. * libguile/vm-i-system.c (goto/args): Bugfix: when doing a self-tail-recursion, allocate fresh externals. Fixes use of match.go. * module/system/vm/assemble.scm (dump-object!): Add some checks that we aren't dumping out values that the VM can't handle. * module/system/vm/disasm.scm (disassemble-externals): Fix rotten call to `print-info'. * oop/goops/dispatch.scm: Add a FIXME. * testsuite/Makefile.am (vm_test_files): * testsuite/t-closure4.scm (extract-symbols): New test, distilled with much effort out of match.scm. * ice-9/Makefile.am (NOCOMP_SOURCES): Re-enable compilation of match.scm. Yay!
2008-09-30Merge commit 'origin/master' into vmAndy Wingo4-6/+2
Conflicts: doc/Makefile.am ice-9/Makefile.am libguile/gc.c
2008-09-30(oop goops) works again, after (the-environment) removalAndy Wingo1-3/+8
* oop/goops.scm: Update so as not to use (the-environment), which no longer exists. I think that the speed characteristics are the same, broadly speaking.
2008-09-12Add `ChangeLog-2008' files to the distribution.Ludovic Courtès1-2/+2
2008-09-12Rename `ChangeLog' files to `ChangeLog-2008'.Ludovic Courtès1-0/+0
2008-09-11Remove `.cvsignore' files.Ludovic Courtès2-4/+0
2008-03-18Use SRFI-1 in `(oop goops util)'.Ludovic Courtès2-40/+11
2008-03-12Provide `describe' feature in `(oop goops describe)'.Ludovic Courtès2-3/+13
2007-05-05Changes from arch/CVS synchronizationLudovic Courtès2-2/+12
2006-04-16merge from 1.8 branchKevin Ryde15-15/+15
2005-05-23The FSF has a new address.Marius Vollmer15-18/+18
2005-04-24Fix typo in commentNeil Jerram1-1/+1
2005-03-24* accessors.scm, simple.scm: New files.Mikael Djurfeldt5-5/+120
* goops.scm (standard-define-class): Removed; Export define-class as standard-define-class.
2005-01-18*** empty log message ***Marius Vollmer1-0/+5
2005-01-18(class-of): Changed from being re-exported to justMarius Vollmer1-2/+1
being exported.
2004-02-09* Makefile.am (TAGS_FILES): Use this variable instead ofMikael Djurfeldt3-4/+10
ETAGS_ARGS so that TAGS can be built using separate build directory. * Makefile.am (TAGS_FILES): Use this variable instead of ETAGS_ARGS so that TAGS can be built using separate build directory. * debugger/breakpoints/Makefile.am (TAGS_FILES), debugger/Makefile.am (TAGS_FILES), Makefile.am (TAGS_FILES): Use this variable instead of ETAGS_ARGS so that TAGS can be built using separate build directory. * primitives/Makefile.am (TAGS_FILES), internals/Makefile.am (TAGS_FILES), Makefile.am (TAGS_FILES): Use this variable instead of ETAGS_ARGS so that TAGS can be built using separate build directory. * Makefile.am, goops/Makefile.am (TAGS_FILES): Use this variable instead of ETAGS_ARGS so that TAGS can be built using separate build directory. * Makefile.am (TAGS_FILES): Use this variable instead of ETAGS_ARGS so that TAGS can be built using separate build directory.
2004-01-12*** empty log message ***Marius Vollmer1-0/+5
2004-01-12(compute-get-n-set): Use '#:' in error message instead of ':'. ThanksMarius Vollmer1-1/+1
to Richard Todd!
2003-04-20* goops.scm (compute-getters-n-setters): Allow for primitiveMikael Djurfeldt2-6/+14
procedure thunks. (Thanks to Neil W. Van Dyke.)
2003-04-19* goops/dispatch.scm (cache-hashval): Corrected terminationMikael Djurfeldt2-4/+9
condition for hashval computation. (Previously, it made erroneous assumptions about the representation of environments; Thanks to Andreas Rottmann.)
2003-04-17* tests/goops.test: Added tests for correctness of classMikael Djurfeldt2-1/+4
precedence list in all basic classes and tests for eqv? and equal?. * goops.scm (compute-getters-n-setters): Check for bad init-thunk. (eqv?): Added default method. (equal?): New default method which uses eqv?. * eq.c (scm_eqv_p): Turned into a primitive generic.
2003-04-17* goops.scm (compute-getters-n-setters): Check for bad init-thunk.Mikael Djurfeldt2-3/+13
2003-04-17CommentMikael Djurfeldt1-0/+3
2003-04-15* tests/goops.test: Added tests for class redefinition, objectMikael Djurfeldt2-5/+16
update and active slots. * goops.scm (compute-getter-method): For custom getter: Check boundness even if there is an init-thunk. (The getter can return #<unbound> even if the slot has been set before.) (remove-class-accessors!): Also remove accessor-method from its accessor. * goops.c (scm_sys_fast_slot_ref): Use SCM_SLOT instead of scm_at_assert_bound_ref. (We don't want the unbound check. See oop/goops/active-slot.scm.)
2003-04-14FixMikael Djurfeldt1-1/+1
2003-04-13* goops.scm (compute-getters-n-setters/verify-accessors): BetterMikael Djurfeldt2-15/+41
check of format of value returned by compute-get-n-set. (compute-getters-n-setters): Extended format of slot getters-n-setters to indicate position and size of slot memory allocated in instances. * goops.c (scm_sys_prep_layout_x): Instance allocation is now indicated through extra fields in getters-n-setters. (scm_add_slot): Adapted to new format of getters_n_setters slot. (Thanks to Andy Wingo.)
2003-04-05Changed license terms to the plain LGPL thru-out.Marius Vollmer12-387/+116
2003-03-19* goops.scm (process-class-pre-define-accessor): Temporary kludgeMikael Djurfeldt2-5/+15
to fix a problem introduced by my previous change.
2003-03-17* goops.scm (process-class-pre-define-generic,Mikael Djurfeldt2-20/+56
process-class-pre-define-accessor, process-define-generic, process-define-accessor): New functions. (define-class-pre-definition): Use process-class-pre-define-generic and process-class-pre-define-accessor; Make sure not to create a new local variable if the variable has been imported. (define-generic): Use process-define-generic. (define-accessor): Use process-define-accessor.
2003-03-12* goops.scm (merge-generics): Make sure not to merge a gf withMikael Djurfeldt2-8/+16
itself. That would be the cause of a real binding collision.
2003-03-11* srfi-1.scm (filter, filter!): Removed. (Now implemented in the core.)Mikael Djurfeldt2-7/+4
* goops/util.scm (filter): Removed. (Now supplied by core.) * list.c, list.h (scm_filter, scm_filter_x): New functions. * debugger/command-loop.scm: Prefix all commands imported from (ice-9 debugger command-loop) with debugger:. * boot-9.scm (resolve-interface): Process #:hide; Name custom interfaces appropriately. (module-use!, module-use-interfaces!): Remove existing interfaces on the use-list based on module name rather than interface identity so that custom interfaces truly replaces their previous version.
2003-03-11IndentationMikael Djurfeldt1-1/+1
2003-03-11* goops.scm (define-extended-generics): New syntax.Mikael Djurfeldt2-10/+38
(<class> <operator-class> <entity-class> <entity>): Marked as replacements. (upgrade-accessor): Renamed from upgrade-generic-with-setter. (ensure-accessor, upgrade-accessor): Rewritten to accomodate the new <accessor> class. (merge-accessors): Provide for merging of accessors imported from different modules under the same name. * goops.c, goops.h (scm_class_accessor_method): Renamed from scm_class_accessor. (scm_class_accessor): New class.
2003-03-10* srfi-1.scm (iota map for-each map-in-order list-index memberMikael Djurfeldt2-1/+22
delete delete! assoc): Marked as replacements. * goops.scm (define-extended-generics): New syntax. (<class> <operator-class> <entity-class> <entity>): Marked as replacements. * boot-9.scm (module-override!, make-mutable-parameter, lookup-duplicates-handlers, default-module-duplicates-handler): New functions. (process-duplicates): Don't call duplicates handlers for duplicate bindings of the same variable. (process-define-module): Process #:replace. (compile-interface-spec, resolve-interface): Process #:prefix. * format.scm (format): Marked as replacement. * threads.scm (future, future-ref): Marked as replacements.
2003-03-07* boot-9.scm (process-define-module): Handle #:duplicates.Mikael Djurfeldt2-1/+45
(module-use-interfaces! process-duplicates): New functions. (duplicate-handlers): Dictionary of duplicate handlers. (module-symbol-local-binding, module-symbol-binding): Bugfix. * goops.scm (equal?): Define default method. (merge-generics): Provide for merging of generic functions imported into a module under the same name.
2003-03-06* srfi-1.c (scm_init_srfi_1): Extend root module map and for-eachMikael Djurfeldt2-0/+6
with the versions in this module using scm_c_extend_primitive_generic. * goops.scm (equal?): Define default method. * goops.c (scm_primitive_generic_generic): Enable primitive generic if not enabled. (scm_sys_goops_loaded): Setup unextended primitive generics. * goops.c, goops.h (scm_c_extend_primitive_generic): New function. * snarf.h (SCM_PRIMITIVE_GENERIC, SCM_PRIMITIVE_GENERIC_1): New snarf macros. * numbers.c (scm_abs): Use SCM_PRIMITIVE_GENERIC. (This is only a testing example. All uses of SCM_GPROC should be converted.) * procprop.c (scm_stand_in_scm_proc): Use scm_assq instead of scm_assoc. * eq.c (scm_equal_p): Turned into a primitive generic.
2003-01-18* goops.scm (method): Construct a new copy of the constant '('())Mikael Djurfeldt2-1/+6
for every macro invocation.