1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

72 commits

Author SHA1 Message Date
Andy Wingo
0dd7c54075 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/deprecated.c
	libguile/ports.c
	libguile/ports.h
	libguile/strports.c
	test-suite/tests/cse.test
2012-06-22 13:18:02 +02:00
Ludovic Courtès
f3b312a19d Fix cross-compilation of GOOPS-using code.
Fixes <http://bugs.gnu.org/11645>.
Reported by Bogdan A. Marinescu <bogdan.a.marinescu@intel.com>.

* module/oop/goops/dispatch.scm (compute-dispatch-procedure)[comp]:
  Wrap `compile' call in (with-target %host-type ...).
2012-06-20 01:11:44 +02:00
Andy Wingo
747747ee06 Merge remote-tracking branch 'origin/stable-2.0'
This commit removes code that was newly deprecated in stable-2.0.

Conflicts:
	libguile/deprecated.c
	libguile/deprecated.h
	libguile/modules.c
	module/ice-9/boot-9.scm
	module/ice-9/deprecated.scm
2012-05-23 12:38:56 +02:00
Andy Wingo
2de74cb56e finish deprecating eval closures
* libguile/deprecated.h:
* libguile/deprecated.c (scm_eval_closure_lookup)
  (scm_standard_eval_closure, scm_standard_interface_eval_closure)
  (scm_eval_closure_module): Deprecate these, as they are unused.

* libguile/modules.h:
* libguile/modules.c: Remove deprecated code.

* module/oop/goops/util.scm (top-level-env, top-level-env?): Deprecate.

* module/ice-9/deprecated.scm (set-system-module!): Deprecate.
  (module-eval-closure): Deprecate, by overriding the core definition to
  return a fresh eval closure.

* module/ice-9/boot-9.scm (make-module): Don't set an eval closure on
  the module.
  (the-root-module, the-scm-module): Don't call set-system-module!.
2012-05-23 12:29:15 +02:00
Andy Wingo
9d8a10a94c Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	test-suite/tests/cse.test
2012-04-26 23:40:57 +02:00
Andy Wingo
f7d8efc630 disable optimizations in goops dispatch procedures
* module/oop/goops/dispatch.scm: Disable peval and cse.
2012-04-23 21:52:24 +02:00
Andy Wingo
ca12824581 Merge remote-tracking branch 'origin/stable-2.0'
This was a pretty big merge involving a fair amount of porting,
especially to peval and its tests.  I did not update psyntax-pp.scm,
that comes in the next commit.

Conflicts:
	module/ice-9/boot-9.scm
	module/ice-9/psyntax-pp.scm
	module/language/ecmascript/compile-tree-il.scm
	module/language/tree-il.scm
	module/language/tree-il/analyze.scm
	module/language/tree-il/inline.scm
	test-suite/tests/tree-il.test
2011-09-29 18:02:28 +02:00
Andy Wingo
eddd81f465 fix some cache consistency issues with goops and extended generics
* module/oop/goops.scm (extended-by!, not-extended-by!)
  (upgrade-accessor, merge-generics): Invalidate the method cache after
  munging "extends" or "methods" fields.
  (invalidate-method-cache!): A new wrapper around
  %invalidate-method-cache!, that will also invalidate the caches of
  "extended-by" generics.
  (internal-add-method!, remove-class-accessors!): Use the new
  invalidate-method-cache!.
2011-09-02 13:17:19 +02:00
Andy Wingo
0c65f52c6d more define-syntax-rule usage
* module/ice-9/boot-9.scm:
* module/ice-9/control.scm:
* module/ice-9/futures.scm:
* module/ice-9/optargs.scm:
* module/ice-9/poll.scm:
* module/ice-9/receive.scm:
* module/ice-9/threads.scm:
* module/ice-9/vlist.scm:
* module/language/assembly/compile-bytecode.scm:
* module/language/ecmascript/compile-tree-il.scm:
* module/language/tree-il.scm:
* module/oop/goops.scm:
* module/oop/goops/simple.scm:
* module/oop/goops/stklos.scm:
* module/srfi/srfi-1.scm:
* module/srfi/srfi-35.scm:
* module/srfi/srfi-39.scm:
* module/srfi/srfi-45.scm:
* module/srfi/srfi-67/compare.scm:
* module/sxml/match.scm:
* module/system/repl/error-handling.scm:
* module/system/repl/repl.scm:
* module/system/vm/inspect.scm:
* module/texinfo.scm:
* module/web/server.scm: Use define-syntax-rule, where it makes sense.
2011-09-02 11:36:14 +02:00
Andy Wingo
02620dd9a6 export <macro> from goops, to appease texinfo reflection
* module/oop/goops.scm (<macro>): Actually define this class.  Also,
  group the export with the other SMOB types.
2011-07-26 11:48:37 +02:00
Andy Wingo
ab4bc85398 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	GUILE-VERSION
	test-suite/tests/srfi-4.test
2011-07-25 18:26:37 +02:00
Andy Wingo
a8c10aa131 goops.scm cleanups
* module/oop/goops.scm (make-generic, make-extended-generic):
  (ensure-generic, make-accessor, ensure-accessor): Use optional
  arguments for #:name.  `make-extended-generic' also accepts empty
  extension lists.
2011-07-07 12:17:08 +02:00
Ludovic Courtès
f67f85817c Export `<macro>' from (oop goops).
* module/oop/goops.scm: Export `<macro>'.
2011-07-07 00:57:19 +02:00
Andy Wingo
28d0871b55 defining a smob or port type no longer mucks exports of (oop goops)
* libguile/goops.c (DEFVAR): Remove this helper macro, replacing its
  uses with scm_module_define, but without scm_module_export.
  (create_basic_classes, scm_init_goops_builtins): Update callers.
  (make_class_from_template, make_class_from_symbol): Change to not
  define variables for classes.  This affects ports, struct classes, and
  smob classes.

* module/oop/goops.scm: Explicitly list our exports, so there is no more
  trickery happening in C.
  (find-subclass): Private helper to grub the class hierarchy, so we can
  define bindings for smobs, ports, etc.  Use to define the classes that
  goops.c used to define -- probably a subset, but it's better to have
  them listed.
2011-07-01 11:46:32 +02:00
Andy Wingo
26c81c7f40 Merge remote-tracking branch 'origin/lexical-literals'
Conflicts:
	module/ice-9/psyntax-pp.scm
2011-06-30 13:48:43 +02:00
Andy Wingo
0dd8493cb3 (syntax foo) -> #'foo in goops
* module/oop/goops.scm: Change instances of (syntax foo) to #'foo.
2011-05-21 13:13:58 +02:00
Andy Wingo
5138551787 oop goops comment
* module/oop/goops.scm: Add a note about the need to deprecate
  min-fixnum and max-fixnum.
2011-04-29 16:36:50 +02:00
Mark H Weaver
4fb8bc64a0 Allow GOOPS getters to add methods to primitive generics
* module/oop/goops.scm (ensure-generic): If the old definition of a
  desired getter is a primitive generic, let the new method be added to
  it instead of creating a fresh new generic.

  (ensure-accessor): Modify as necessary to keep the old behavior.
  Maybe something more optimal can be done here, but it's not yet
  obvious to me how to do it.
2011-02-14 20:33:11 +01:00
Mark H Weaver
074c414e29 Fix GOOPS method compilation bug when no next-method exists
* 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.
2011-01-30 13:30:08 +01:00
Neil Jerram
3dc071e483 Remove goops-version, which is no longer defined
* doc/ref/goops.texi (Administrative Functions): Removed.

* module/oop/goops.scm (oop): Don't export `goops-version'.
2010-10-02 18:14:45 +01:00
Tristan Colgate
962b910318 Update #:procedure method for <applicable-struct>
* modules/oop/goop.scm (initialize-object-procedure): Use slot-set!
  instead of set-object-procedure!.
2010-06-29 11:43:04 +02:00
Andy Wingo
d8158b837e deprecate save-stack, stack-saved?
* module/Makefile.am:
* module/ice-9/boot-9.scm:
* module/ice-9/save-stack.scm (stack-saved?, save-stack): Move these
  bindings to their own module.

* module/oop/goops.scm (goops-error):
* module/ice-9/boot-9.scm (error, top-repl): Remove calls to save-stack.

* module/ice-9/deprecated.scm (stack-saved?, save-stack): Add deprecated
  shims.

* module/ice-9/emacs.scm:
* module/ice-9/stack-catch.scm:
* module/ice-9/debugger/command-loop.scm:
* module/ice-9/scm-style-repl.scm: Import (ice-9 save-stack).
2010-06-19 12:57:31 +02:00
Andy Wingo
69928c8a32 fix some uses of %module-public-interface
* module/ice-9/r5rs.scm:
* module/ice-9/safe-r5rs.scm:
* module/oop/goops/save.scm:
* module/oop/goops/simple.scm:
* module/oop/goops/stklos.scm: Fix some uses of
  %module-public-interface.
2010-04-24 17:43:52 +02:00
Andy Wingo
30ce621c5a (app modules) -> (%app modules)
* module/ice-9/debugging/breakpoints.scm (module-if-already-loaded):
  (all-loaded-modules):
* module/oop/goops/stklos.scm: Fix instances of (app modules) to be
  (%app modules).
2010-04-22 15:31:02 +02:00
Andy Wingo
314b87163e eval.c closures are now applicable smobs, not tc3s
* libguile/debug.c (scm_procedure_name): Remove a SCM_CLOSUREP case and
  some dead code.
  (scm_procedure_module): Remove. This was introduced a few months ago
  for the hygienic expander, but now it is no longer needed, as the
  expander keeps track of this information itself.

* libguile/debug.h: Remove scm_procedure_module.

* libguile/eval.c: Instead of using tc3 closures, define a "boot
  closure" applicable smob type, and represent closures with that. The
  advantage is that after eval.scm is compiled, boot closures take up no
  address space (besides a smob number) in the runtime, and require no
  special cases in procedure dispatch.

* libguile/eval.h: Remove the internal functions scm_i_call_closure_0
  and scm_closure_apply, and the public function scm_closure.

* libguile/gc.c (scm_storage_prehistory): No tc3_closure displacement
  registration.
  (scm_i_tag_name): Remove closure case, and a dead cclo case.

* libguile/vm.c (apply_foreign):
* libguile/print.c (iprin1):
* libguile/procs.c (scm_procedure_p, scm_procedure_documentation);
* libguile/evalext.c (scm_self_evaluating_p):
* libguile/goops.c (scm_class_of): Remove tc3_closure/tcs_closure cases.
* libguile/hash.c (scm_hasher):

* libguile/hooks.c (scm_add_hook_x): Use new scm_i_procedure_arity.

* libguile/macros.c (macro_print): Print all macros using the same code.
  (scm_macro_transformer): Return any procedure, not just programs.

* libguile/procprop.h:
* libguile/procprop.c (scm_i_procedure_arity): Instead of returning a
  list that the caller has to parse, have the same prototype as
  scm_i_program_arity. An incompatible change, but it's an internal
  function anyway.
  (scm_procedure_properties, scm_set_procedure_properties)
  (scm_procedure_property, scm_set_procedure_property): Remove closure
  cases, and use scm_i_program_arity for arity.

* libguile/procs.h (SCM_CLOSUREP, SCM_CLOSCAR, SCM_CODE)
  (SCM_CLOSURE_NUM_REQUIRED_ARGS, SCM_CLOSURE_HAS_REST_ARGS)
  (SCM_CLOSURE_BODY, SCM_PROCPROPS, SCM_SETPROCPROPS, SCM_ENV)
  (SCM_TOP_LEVEL): Remove these macros that pertain to boot closures
  only. Only eval.c should know abut boot closures.
* libguile/procs.c (scm_closure_p): Remove this function. There is a
  simple stub in deprecated.scm now.
  (scm_thunk_p): Use scm_i_program_arity.
* libguile/tags.h (scm_tc3_closure): Remove. Yay, another tc3 to play
  with!
  (scm_tcs_closures): Remove.

* libguile/validate.h (SCM_VALIDATE_CLOSURE): Remove.

* module/ice-9/deprecated.scm (closure?): Add stub.

* module/ice-9/documentation.scm (object-documentation)
* module/ice-9/session.scm (help-doc, arity)
* module/oop/goops.scm (compute-getters-n-setters)
* module/oop/goops/describe.scm (describe)
* module/system/repl/describe.scm (display-object, display-type):
  Remove calls to closure?.
2009-12-04 19:20:11 +01:00
Andy Wingo
df338a2264 remove tc7_subr_* and tc7_lsubr_*
* libguile/tags.h: Remove tc7 #defines for subrs, replacing them with
  placeholders. These were public, but hopfully unused. I don't see how
  to usefully deprecate them.

* libguile/array-map.c (scm_array_map_x): Remove special cases for
  certain subr types. This might make things slower for the moment,
  otoh, native compilation should moot that question.

* libguile/eval.i.c:
* libguile/eval.c: Remove subr-handling cases. To regain this speed and
  more won't have to wait for native compilation, though -- this change
  smooths the way for subr dispatch in the VM.

* libguile/gsubr.c (scm_i_gsubr_apply): Fix a bug in which we didn't
  detect too-many-arguments. This would only show up when using ceval,
  as only ceval called this function.

* test-suite/tests/ramap.test ("array-map!"): Change the expected
  exception if passed a procedure of the wrong arity. It now gives
  wrong-num-args.
  more won't have to wait for native compilation, though -- this change
  smooths the way for subr dispatch in the VM.

* libguile/goops.c (scm_class_of): Remove subr cases. No speed
  implication.

* libguile/objects.c (scm_valid_object_procedure_p): Remove this public
  but undocumented, and useless, function. I do not think this will
  affect anyone at all.
  (scm_set_object_procedure_x): Replace a call to
  scm_valid_object_procedure_p with scm_procedure_p, and actually wrap
  with a scm_is_true.

* module/oop/goops.scm (initialize-object-procedure): Don't call
  valid-object-procedure?.
2009-12-03 15:22:07 +01:00
Andy Wingo
83c7655002 goops moving away from evaluator opcodes, and a primitive compilation fix
* module/oop/goops.scm (@slot-ref, @slot-set!): Define "primitives" for
  these. Probably should do something more general, though, allowing
  @struct-ref.

* module/language/tree-il/primitives.scm (add-interesting-primitive!):
  Error if the primitive isn't bound.
2009-12-01 21:00:26 +01:00
Andy Wingo
8397a3a695 local-eval will go away
* module/ice-9/debugger/commands.scm:
* module/ice-9/debugging/traps.scm:
* module/ice-9/emacs.scm:
* module/ice-9/gds-client.scm: Add some FIXMEs due to impending
  local-eval removal.

* module/oop/goops.scm (make-generic-bound-check-getter): Just the
  compiled closure case here.
2009-12-01 21:00:26 +01:00
Andy Wingo
9d019f9be0 remove class-environment slot, goops grubs less in the evaluator
* libguile/goops.h (scm_sys_tag_body): Remove declaration of undefined
  function.
  (SCM_CLASS_CLASS_LAYOUT, scm_si_environment, SCM_N_CLASS_SLOTS)
  (scm_class_environment) Remove class environment slot and getter.

* libguile/goops.c (compute_getters_n_setters): Use scm_primitive_eval
  to produce the init thunk, instead of scm_i_eval_x; though really we
  should be doing this in Scheme.
  (scm_basic_basic_make_class, build_class_class_slots)
  (create_basic_classes, scm_class_environment): Remove class
  environment slot.
  (get_slot_value, set_slot_value): Use scm_call_1 instead of evaluator
  tricks.

* module/oop/goops.scm: Remove class-environment export, and
  environments throughout the file.
2009-12-01 21:00:25 +01:00
Andy Wingo
eb721b3b10 push goops compile delay out to 30 invocations, for great justice
* module/oop/goops/dispatch.scm (timer-init): Init to 30 for faster
  goops load time.
2009-11-26 00:25:07 +01:00
Andy Wingo
9022ff183c remove code that manages the method cache
* libguile/goops.h (SCM_MCACHE_N_SPECIALIZED)
  (SCM_SET_MCACHE_N_SPECIALIZED, SCM_INITIAL_MCACHE_SIZE)
  (scm_make_method_cache, scm_memoize_method, scm_mcache_lookup_cmethod)
  (scm_mcache_compute_cmethod):
* libguile/goops.c: Remove these procedures which managed the method
  cache. There's still a slot there but it's not initialized. The method
  cache is no longer necessary.

* module/oop/goops/dispatch.scm (memoize-method!): Change to not take a
  "cache" argument.

* libguile/eval.i.c:
* libguile/vm-i-system.c: Remove dispatch via the method cache.
2009-11-26 00:25:07 +01:00
Andy Wingo
5bdea5bd3d remove method cache management code from (oop goops dispatch)
* module/oop/goops/dispatch.scm: Remove old method cache things.
2009-11-26 00:25:07 +01:00
Andy Wingo
2f652c6884 generics now dispatch as applicable structs
* libguile/eval.i.c (CEVAL, SCM_APPLY): Dispatch applicable structs
  before pure generics. In practice what this means is that we never hit
  the mcache case, because all pure generics are applicable structs.
  We're moving over to having generics dispatch themselves. Also, they
  don't prepend the struct as an arg; in order to have that effect, the
  user has closures.

* libguile/goops.c (scm_apply_generic, scm_call_generic_0):
  (scm_call_generic_1, scm_call_generic_2, scm_call_generic_3): Dispatch
  directly to the struct procedures.
  (scm_var_make_extended_generic): Remove a duplicate definition for
  scm_var_make_extended_generic.
  (create_standard_classes): Mark all instances of
  <applicable-struct-class> (themselves classes) as applicable classes.
  Meaning: generics are now applicable structs.

* libguile/goops.h (SCM_CLASS_CLASS_LAYOUT): The hashsets are actually
  uw slots -- or at least, making subclasses maps the int slots to be uw
  slots

* libguile/vm-i-system.c (call, goto/args, mv-call): Dispatch applicable
  structs in the VM.

* module/oop/goops/dispatch.scm (emit-linear-dispatch): Fix bug in the
  non-rest cache miss case.
  (delayed-compile): Rework to avoid fluids.
  (cache-dispatch): Don't call `equal?', it causes bootstrapping
  problems with the primitive-generic equal?. Using our own version is
  faster anyway.
2009-11-26 00:25:07 +01:00
Andy Wingo
9f63ce021c make sure that when equal? is extended, that the generic has a method
* libguile/goops.h:
* libguile/goops.c (scm_set_primitive_generic_x): New function, for now
  local to the goops module.

* module/oop/goops.scm (equal?): Make sure that when equal? is extended,
  that the generic already has a default method.
2009-11-26 00:25:07 +01:00
Andy Wingo
51f66c9120 limn goops flags, remove foreign objs, rename entity to applicable-struct
* libguile/goops.c (scm_class_applicable_struct)
  (scm_class_applicable_struct_with_setter)
  (scm_class_applicable_struct_class): Rename from
  scm_class_entity, scm_class_entity_with_setter, and
  scm_class_entity_class.
  (scm_class_simple_method): Removed; this abstraction is not used.
  (scm_class_foreign_class, scm_class_foreign_object): Remove these,
  they are undocumented and unused. They might come back later.
  (scm_sys_inherit_magic_x): Simply inherit the vtable flags from the
  class's class. Flags are about layout, and it is the class that
  determines the layout of the instance.
  (scm_basic_basic_make_class): Don't bother setting GOOPS_OR_VALID,
  inherit-magic will do that.
  (scm_basic_make_class): Inherit magic after setting the layout. Allows
  the struct magic checker to do its job.
  (scm_accessor_method_slot_definition): Move implementation to Scheme.
  Removes the need for the accessor flag.
  (scm_sys_allocate_instance): Adapt to scm_i_alloc_struct name change,
  and that alloc-struct will handle finalization.
  (scm_compute_applicable_methods): Remove accessor check, as it's
  unnecessary.
  (scm_make): Adapt to new generic slot order, and no more
  simple-method.
  (create_standard_classes): What was the GF slot "dispatch-procedure"
  is now the applicable-struct slot "procedure". No more foreign class,
  foreign object, or simple method. Rename <entity> and friends to
  <applicable-struct> and friends. No more entity-with-setter -- though
  perhaps it will come back too. Instead generic-with-setter is its own
  thing.

* libguile/goops.h (SCM_CLASSF_METACLASS): "A goops class that is a
  vtable" -- no need for a separate flag.
  (SCM_CLASSF_FOREIGN, SCM_CLASSF_SIMPLE_METHOD)
  (SCM_CLASSF_ACCESSOR_METHOD): Removed these unused flags.
  (SCM_ACCESSORP): Removed.
  Renumber generic slots, rename entity classes, and remove the foreign
  class, foreign object, and simple method classes.

* libguile/struct.c (scm_i_struct_inherit_vtable_magic): New function,
  called when making new vtables.applicable structs
  (scm_i_alloc_struct): Remove 8-bit alignment check, as libGC
  guarantees this for us. Handle finalizer registration here.
  (scm_make_struct): Factor some things to scm_i_alloc_struct and
  scm_i_struct_inherit_vtable_magic.
  (scm_make_vtable_vtable): Adapt to scm_i_alloc_struct name change.

* libguile/struct.h (scm_i_alloc_struct): Change name from
  scm_alloc_struct, and make internal.

* module/oop/goops.scm (oop): Don't declare #:replace <class> et al,
  because <class> isn't defined in the core any more.
  (accessor-method-slot-definition): Defined in Scheme now.
  Remove <foreign-object> methods.
  (initialize on <class>): Prep layout before inheriting magic, as in
  scm_basic_make_class.

* module/oop/goops/dispatch.scm (delayed-compile)
  (memoize-effective-method!): Adapt to 'procedure slot name change.
2009-11-26 00:25:07 +01:00
Andy Wingo
cfe55d3e81 generic dispatch protocol in scheme, not yet wired up
* module/oop/goops/dispatch.scm: Add a dispatch protocol in Scheme. The
  idea is that instead of using a hardcoded C protocol, we compile
  dispatch procedures at runtime. To avoid too much thrashing at bootup,
  there is a simple JIT mechanism -- dispatch will be data-driven,
  through the cache, for the first 5 invocations, then a dispatch
  procedure will be compiled from the cache.

  My initial timings indicate that interpreted dispatch takes about
  100us, and that compiled dispatch takes about 60us. Compilation itself
  takes about 16000us (16 ms). The compiled procedure dispatch times
  will improve soon, hopefully.
2009-11-26 00:25:07 +01:00
Andy Wingo
ab455d1f1b eqv? not a generic, equal? dispatches to generic only for objects
* libguile/eq.c (scm_eqv_p): Not a generic any more. Since eqv? is used
  by e.g. `case', which should be able to compile into dispatch tables,
  it really doesn't make sense to dispatch out to a generic.
  (scm_equal_p): So it was always the case that (equal? 'foo "foo") =>
  #f. But (equal? 'foo 'bar) could actually be extended by a generic.
  This was a bug, if you follow the other logic of the code. Changed so
  that generic functions can only extend the domain of equal? when
  operating on goops objects.

* oop/goops.scm: No more eqv? generic.

* test-suite/tests/goops.test: Remove eqv? tests.
2009-11-26 00:25:07 +01:00
Andy Wingo
2aecf4cfe2 more clarity in (oop goops dispatch)
* module/oop/goops/dispatch.scm (memoize-method!): If we don't have a
  no-applicable-method, just call no-applicable-method directly.

* test-suite/tests/goops.test ("no-applicable-method"): Add some tests.
2009-11-26 00:25:06 +01:00
Andy Wingo
c40944c9ff remove code-table slot from methods
* 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-11-26 00:25:06 +01:00
Andy Wingo
6d33e90f0c remove used-by slot from generics
* libguile/goops.c (clear_method_cache)
  (scm_sys_invalidate_method_cache_x, scm_make)
  (create_standard_classes): Remove the used-by method from generics, as
  it is not used at all.

* libguile/goops.h: Renumber generic slots.

* module/oop/goops/dispatch.scm (memoize-method!): No more used-by slot.
2009-11-26 00:25:06 +01:00
Andy Wingo
b6cf4d0265 a very big commit cleaning up structs & goops. also applicable structs.
I tried to split this one, and I know it's a bit disruptive, but this
stuff really is one big cobweb. So instead we'll pretend like these are
separate commits, by separating the changelog.

Applicable struct runtime support.

* libguile/debug.c (scm_procedure_source):
* libguile/eval.c (scm_trampoline_0, scm_trampoline_1)
  (scm_trampoline_2):
* libguile/eval.i.c (CEVAL):
* libguile/goops.c (scm_class_of):
* libguile/procprop.c (scm_i_procedure_arity):
* libguile/procs.c (scm_procedure_p, scm_procedure, scm_setter): Allow
  for applicable structs. Whee!

* libguile/deprecated.h (scm_vtable_index_vtable): Define as a synonym
  for scm_vtable_index_self.
  (scm_vtable_index_printer): Alias scm_vtable_index_instance_printer.
  (scm_struct_i_free): Alias scm_vtable_index_instance_finalize.
  (scm_struct_i_flags): Alias scm_vtable_index_flags.
  (SCM_STRUCTF_FLAGS): Be a -1 mask, we have a whole word now.
  (SCM_SET_VTABLE_DESTRUCTOR): Implement by hand.

Hidden slots.

* libguile/struct.c (scm_make_struct_layout): Add support for "hidden"
  fields, writable fields that are not visible to make-struct. This
  allows us to add fields to vtables and not break existing make-struct
  invocations.
  (scm_struct_ref, scm_struct_set_x): Always get struct length from the
  vtable. Support hidden fields.

* libguile/goops.c (scm_class_hidden, scm_class_protected_hidden): New
  slot classes, to correspond to the new vtable slots.
  (scm_sys_prep_layout_x): Turn hidden slots into 'h'.
  (build_class_class_slots): Reorder the class slots to account for
  vtable fields coming out of negative-land, for name as a vtable slot,
  and for hidden fields.
  (create_standard_classes): Define <hidden-slot> and
  <protected-hidden-slot>.

Clean up struct.h.

* libguile/struct.h: Lay things out cleaner. There are no more hidden
  (negative) words. Names are nicer. The exposition is nicer. But the
  basics are the same. The incompatibilities are that <vtable> has more
  slots now, and that scm_alloc_struct's signature has changed. The
  former is ameliorated by the "hidden" slots mentioned before, and the
  latter, well, it was always a very internal thing...
  (scm_t_struct_finalize): New type, a finalizer function to be run when
  instances of a vtable are collected.
  (scm_t_struct_free): Removed, structs' data is managed by the GC now,
  and not freed by vtable functions.

* libguile/struct.c: (scm_vtable_p): Now we keep flags on
  vtable-vtables, so this check is cheaper.
  (scm_alloc_struct): No hidden words. Yippee.
  (struct_finalizer_trampoline): Entersify.
  (scm_make_struct): No need to babysit extra words, though now we have
  to babysit flags. Propagate the vtable, applicable, and setter flags
  appropriately.
  (scm_make_vtable_vtable): Update for new simplicity.
  (scm_print_struct): A better printer.
  (scm_init_struct): Define <applicable-struct-vtable>, a magical vtable
  like CL's funcallable-standard-class. Also define
  <applicable-struct-with-setter-vtable>.

Remove foreign object implementation.

* libguile/goops.h:
* libguile/goops.c (scm_make_foreign_object, scm_make_class)
  (scm_add_slot, scm_wrap_object, scm_wrap_component): Remove, these
  were undocumented and unworking.

Clean up goops.h, a little.

* libguile/goops.h:
* libguile/goops.c: Also clean up.
* module/oop/goops/dispatch.scm (hashset-index): Adapt for new hashset
  index.
2009-11-26 00:24:58 +01:00
Ken Raeburn
222831b443 SCM_DEBUG fix: Don't apply SCM_CAR to non-pairs when walking argument
lists in method cache matching.

* libguile/goops.c (scm_mcache_lookup_cmethod): Don't apply SCM_CAR to
  non-pairs when walking argument lists in method cache matching.
  Don't check for CLASSP or symbol in the car slot, since the end of
  the specifier list is a non-pair.  Update comments to reflect new
  structure of method cache entry.
* module/oops/goops/dispatch.scm: Update comments here too.
2009-11-16 14:24:32 -05:00
Andy Wingo
aec4a84ac8 class-of has an opcode
* libguile/vm-i-scheme.c (class-of): New opcode.
* module/language/tree-il/compile-glil.scm:
* module/oop/goops.scm: Compile class-of into an opcode.
2009-11-15 21:03:33 +01:00
Andy Wingo
730d8ad9e6 remove operators 2009-11-15 20:28:11 +01:00
Ludovic Courtès
5658035c9c Fix typos leading to wrong argument counts.
* module/ice-9/channel.scm (eval): Fix number of arguments to
  `guile:eval'.

* module/oop/goops/save.scm (write-readably): Fix number of arguments to
  `write-array'.

* module/srfi/srfi-19.scm (priv:char->int): Fix number of arguments to
  `priv:time-error'.
2009-11-07 19:24:49 +01:00
Ludovic Courtès
84012ef4b1 Fix typos leading to unbound variable references.
* module/ice-9/session.scm (help): Fix unbound reference to `env'.

* module/system/vm/program.scm (program-property): Fix typo.

* module/system/vm/frame.scm: Add missing `#:use-module (system vm
  objcode)'.

* module/system/repl/command.scm (guile:load): New.
  (load): Use either `primitive-load' or `load'.

* module/srfi/srfi-18.scm (thread-sleep!): Fix typo.

* module/srfi/srfi-19.scm: Use `(ice-9 rdelim)'.
  (date->broken-down-time, priv:year-day, priv:char->int): Fix typo.
  (time-*->time-*, time-*->time-*!): Fix reference to unbound variable
  `caller'.

* module/oop/goops.scm (bound-check-get): Fix typo.

* module/language/glil/compile-assembly.scm (glil->assembly): Fix typo.

* module/language/glil.scm (parse-glil): Fix typo.

* module/language/ecmascript/base.scm (object->value/string,
  object->value/number, ->number): Fix typos.

* module/language/assembly/disassemble.scm (disassemble-free-vars): Fix
  typo.
2009-10-22 22:57:25 +02:00
Ludovic Courtès
a2ca725212 Remove unused variables in ice-9/goops/srfi/scripts.
* module/ice-9/boot-9.scm (scm-style-repl)[-abort]: Remove.

* module/oop/goops.scm (class)[slot-defs]: Remove.
  (compute-slot-accessors)[name]: Remove.
  (compute-get-n-set)[env]: Remove.

* module/oop/goops/active-slot.scm (compute-get-n-set)[env, name]:
  Remove.

* module/oop/goops/dispatch.scm (cache-try-hash!)[max-misses]: Remove.

* module/oop/goops/save.scm (make-mapper)[dims]: Remove.

* module/scripts/autofrisk.scm (>>checks)[prog]: Remove.

* module/srfi/srfi-19.scm (priv:read-directives)[ireaderf, eireader4]:
  Remove.
2009-09-21 00:24:08 +02:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Andy Wingo
4bcc952d45 fix bug in goops' method cache with rest args
* 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-06-07 00:53:48 +02:00
Andy Wingo
a755136ba8 fix (oop goops) compilation for (language tree-il primitives)
* module/oop/goops.scm (compile): Whoop-dee, fix up (oop goops) for
  (language tree-il primitives) change.
2009-05-22 21:14:48 +02:00