bpt/guile.git
9 years agoReify bytevector? in the correct module
Andy Wingo [Fri, 6 Feb 2015 14:13:32 +0000 (15:13 +0100)]
Reify bytevector? in the correct module

* module/language/cps/reify-primitives.scm (primitive-module): Reify
  bytevector? in the correct module.  Thanks to Nala Ginrut for the
  report.

9 years agoAdd #:static-slot-allocation?
Andy Wingo [Fri, 6 Feb 2015 12:25:17 +0000 (13:25 +0100)]
Add #:static-slot-allocation?

* libguile/goops.h (SCM_VTABLE_FLAG_GOOPS_STATIC): Reserve the fourth
  GOOPS flag to indicate that a class has static slot allocation.

* libguile/goops.c (scm_init_goops_builtins): Define
  vtable-flag-goops-static for goops.scm.

* module/oop/goops.scm (class-has-statically-allocated-slots?): New
  helper.
  (build-slots-list): Instead of the ad-hoc checks for <class> or
  <slot>, use the new helper.
  (initialize): Accept #:static-slot-allocation? keyword.

* module/system/foreign-object.scm (make-foreign-object-type): Declare
  foreign object classes as having static slot allocation.

* test-suite/tests/goops.test ("static slot allocation"): Add tests.

9 years agoFix foreign objects for getter method change
Andy Wingo [Fri, 6 Feb 2015 11:27:56 +0000 (12:27 +0100)]
Fix foreign objects for getter method change

* module/system/foreign-object.scm: Fix getters after change to make
  <accessor-method> instances only apply to their precise specializer
  types.

9 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Mon, 26 Jan 2015 17:13:38 +0000 (18:13 +0100)]
Merge remote-tracking branch 'origin/stable-2.0'

Conflicts:
libguile/goops.c
libguile/vm-engine.h
module/oop/goops.scm
module/oop/goops/compile.scm
module/oop/goops/dispatch.scm
test-suite/tests/goops.test

9 years agoAccessor methods only apply to subclasses with their slot
Andy Wingo [Mon, 26 Jan 2015 16:54:26 +0000 (17:54 +0100)]
Accessor methods only apply to subclasses with their slot

* libguile/goops.c (is_accessor_method, scm_compute_applicable_methods):
  Fix regression from 51f66c912078a25ab0380c8fc070abb73d178d98 (2009).
  Accessor methods are added on each subclass on which the slot is
  present; therefore if a subclass doesn't have a method, then the
  methods doesn't apply.  Truly fixes #17355, unlike
  583a23bf104c84d9617222856e188f3f3af4934d.

* module/oop/goops.scm (compute-cmethod, compute-getter-method)
  (compute-setter-method): Revert earlier changes.

* test-suite/tests/goops.test ("accessor slots"): Update for new
  expectations, in agreement with Guile 1.8.

9 years agoFix verify-cps
Andy Wingo [Sun, 25 Jan 2015 10:39:42 +0000 (11:39 +0100)]
Fix verify-cps

* module/language/cps/verify.scm (verify-cps): Fix.  Thanks to Steven
  H. Margolis for the note.  Fixes bug #19389.

9 years agoFix accessor struct field inlining
Andy Wingo [Sat, 24 Jan 2015 18:22:47 +0000 (19:22 +0100)]
Fix accessor struct field inlining

* module/oop/goops/compile.scm: Inline into goops.scm, leaving a
  compatible interface stub behind.

* module/oop/goops/dispatch.scm: Don't import (oop goops compile), to
  break circularities.

* module/oop/goops.scm: Move (oop goops util) include up to the top, and
  import (ice-9 match).
  (compute-cmethod): Move here from compile.scm.  Add a special case for
  accessor methods, so as to fix bug #17355.
  (compute-getter-method, compute-setter-method): #:procedure slot is
  now generic.

* test-suite/tests/goops.test ("accessor slots"): New test.

9 years agoFix accessor struct inlining in GOOPS
Andy Wingo [Sat, 24 Jan 2015 17:59:15 +0000 (18:59 +0100)]
Fix accessor struct inlining in GOOPS

Fixes bug #17355.

* module/oop/goops.scm (memoize-effective-method!): Adapt to
  compute-effective-method change.
  (compute-effective-method, %compute-effective-method): Renamed from
  compute-cmethod; now a generic protocol.
  (compute-specialized-effective-method)
  (%compute-specialized-effective-method): New sub-protocol.
  (memoize-generic-function-application!): Adapt to call the hard-wired
  compute-applicable-methods based on the concrete arguments types --
  the semantics is that %compute-applicable-methods is the
  implementation for <generic> functions.  Perhaps we should do the same
  for sort-applicable-methods and method-more-specific?.
  (compute-getter-method, compute-setter-method): The standard
  #:procedure is now a generic slot-ref.  It wasn't valid to inline
  field access here, because subtypes could have different field
  layouts.
  (compute-applicable-methods): Refactor generic definition to use
  lexical scoping.
  (compute-specialized-effective-method): New method for
  <accessor-method>, which does field access inlining based on the
  concrete types being applied.

* test-suite/tests/goops.test ("accessor slots"): New test.

9 years agoSimplify and optimize slot access
Andy Wingo [Fri, 23 Jan 2015 13:55:35 +0000 (14:55 +0100)]
Simplify and optimize slot access

* module/oop/goops.scm (fold-slot-slots): Add `slot-ref/raw' slot, which
  is what the slot-ref slot was.  Now the slot-ref slot checks that the
  slot is bound, if needed.
  (slot-definition-slot-ref/raw): Define.
  (make-slot): Adapt.  Also, effective slot definition slots have no
  initargs.
  (define-standard-accessor-method, bound-check-get, standard-get)
  (standard-set): Move definitions up.
  (allocate-slots): Adapt.  If the slot has an init thunk, we don't need
  to check that it's bound.
  (slot-ref, slot-set!, slot-bound?): Simplify.
  (class-slot-ref): Use the raw getter so that we can call
  `slot-unbound' with just the class.
  (compute-getter-method, compute-setter-method): Simplify to just use
  the slot-ref / slot-set! functions from the slot.
  (%initialize-object): Simplify.

9 years agoExport <slot> from GOOPS
Andy Wingo [Fri, 23 Jan 2015 13:51:22 +0000 (14:51 +0100)]
Export <slot> from GOOPS

* module/oop/goops.scm (<slot>): Export.  This is the way to tell if you
  have new GOOPS or not: whether <slot> is defined.

9 years agoSimplify GOOPS effective method cache format
Andy Wingo [Wed, 21 Jan 2015 14:53:53 +0000 (15:53 +0100)]
Simplify GOOPS effective method cache format

* module/oop/goops.scm (single-arity-cache-dispatch)
  (compute-generic-function-dispatch-procedure)
  (memoize-effective-method!): Simplify format of effective method
  cache.

9 years agoFast generic function dispatch without calling `compile' at runtime
Andy Wingo [Wed, 21 Jan 2015 14:16:56 +0000 (15:16 +0100)]
Fast generic function dispatch without calling `compile' at runtime

* module/oop/goops.scm: Rewrite generic function dispatch to use chained
  closures instead of compiling specific dispatch procedures.  The big
  speed win before was not allocating rest arguments, which we gain by
  simply pre-generating dispatchers for arities of up to 20 arguments.
  Also now a tail call without reshuffling arguments -- which is what
  dispatch now is -- is just a (mov 0 new-procedure) and (tail-call),
  which is pretty cheap.

  (%invalidate-method-cache!): Use the new
  recompute-generic-function-dispatch-procedure!.
  (arity-case, multiple-arity-dispatcher, single-arity-dispatcher)
  (single-arity-cache-dispatch)
  (compute-generic-function-dispatch-procedure)
  (recompute-generic-function-dispatch-procedure!): New internal
  interfaces.
  (memoize-effective-method!): Update for new interfaces.
  (memoize-generic-function-application!): Rename from `memoize-method!'.

9 years agoGOOPS cosmetics
Andy Wingo [Mon, 19 Jan 2015 21:41:57 +0000 (22:41 +0100)]
GOOPS cosmetics

* module/oop/goops.scm: More commenting.  Move around <keyword> in the
  export section.

9 years agoUpdate (oop goops save) for <slot> objects
Andy Wingo [Mon, 19 Jan 2015 16:11:21 +0000 (17:11 +0100)]
Update (oop goops save) for <slot> objects

* module/oop/goops/describe.scm (describe): Remove commented code.
* module/oop/goops/save.scm (get-set-for-each, access-for-each): Update
  these hoary routines for the new <slot> universe.

9 years agoFix foreign objects for removal of getters-n-setters
Andy Wingo [Mon, 19 Jan 2015 15:58:14 +0000 (16:58 +0100)]
Fix foreign objects for removal of getters-n-setters

* module/system/foreign-object.scm (getter-method): Fix for removal of
  getters-n-setters property.

9 years agoMinor GOOPS cleanups
Andy Wingo [Mon, 19 Jan 2015 14:57:23 +0000 (15:57 +0100)]
Minor GOOPS cleanups

* module/oop/goops.scm: Minor commenting fixes.

9 years agoOptimize %initialize-object
Andy Wingo [Mon, 19 Jan 2015 12:06:44 +0000 (13:06 +0100)]
Optimize %initialize-object

* module/oop/goops.scm (%initialize-object): Optimize by inlining the
  slot initialization, and by avoiding multiple checks for initargs
  validity.

9 years agoInline internal slot accessors
Andy Wingo [Mon, 19 Jan 2015 11:20:50 +0000 (12:20 +0100)]
Inline internal slot accessors

* module/oop/goops.scm (define-slot-accessor): Also define internal
  accessors without the type check for when we know that the object is a
  slot.  Adapt struct-ref users to use these variants.

9 years agoInline helpers into slot-ref, slot-set!, etc
Andy Wingo [Sun, 18 Jan 2015 20:02:51 +0000 (21:02 +0100)]
Inline helpers into slot-ref, slot-set!, etc

* module/oop/goops.scm (%class-slot-definition): New helper.
  (class-slot-definition): Use the new helper.
  (get-slot-value-using-name, set-slot-value-using-name!)
  (test-slot-existence): Remove helpers.
  (slot-ref, slot-set!, slot-bound?, slot-exists?): Inline helpers for
  speed.

9 years agoUse a vtable bit to mark <slot> instances
Andy Wingo [Sun, 18 Jan 2015 20:01:31 +0000 (21:01 +0100)]
Use a vtable bit to mark <slot> instances

* libguile/goops.h (SCM_VTABLE_FLAG_GOOPS_SLOT): Allocate another vtable
  flag to indicate that instances of this vtable are slots.
* libguile/goops.c (scm_init_goops_builtins): Export
  vtable-flag-goops-slot to Scheme.

* module/oop/goops.scm (<slot>, slot?, make-standard-class, initialize):
  Arrange for <slot> classes to have the vtable-flag-goops.slot.
  (build-slots-list): Ensure that <slot> slots are statically laid out.

9 years agoIntroduce <slot> objects in GOOPS
Andy Wingo [Sun, 18 Jan 2015 19:53:19 +0000 (20:53 +0100)]
Introduce <slot> objects in GOOPS

* module/oop/goops.scm (fold-class-slots): Change format to use proper
  slot specifications.
  (fold-slot-slots): Flesh out with all needed slots.
  (<class>): Update cons-layout to deal with new fold-class-slots form.
  Don't create slots; we do that later.
  (is-a?, get-keyword, *unbound, unbound?, %allocate-instance): Move
  definitions up.
  (<slot>, slot?): New definitions.
  (slot-definition-name, slot-definition-allocation)
  (slot-definition-init-keyword, slot-definition-init-form)
  (slot-definition-init-value, slot-definition-init-thunk)
  (slot-definition-options, slot-definition-getter)
  (slot-definition-setter, slot-definition-accessor)
  (slot-definition-slot-ref, slot-definition-slot-set!)
  (slot-definition-index, slot-definition-size): New definitions as
  accessors on <slot> objects.
  (class-slot-definition): Adapt to class-slots change.
  (direct-slot-definition-class, make-slot): New definitions.
  (make): Define a boot version that can allocate <slot> instances.
  (compute-direct-slot-definition)
  (compute-direct-slot-definition-initargs)
  (effective-slot-definition-class, compute-effective-slot-definition):
  New definitions.
  (build-slots-list): Adapt to slots being <slot> objects.
  (compute-get-n-set): New boot definition.
  (allocate-slots): New definition.  Replaces
  compute-getters-n-setters.
  (%compute-layout, %prep-layout): Adapt to changes.
  (make-standard-class): Make <slot> objects for direct-slots, and
  handle the allocate-slots protocol.
  (<foreign-slot>): Inherit from <slot>.
  (get-slot-value-using-name, set-slot-value-using-name!)
  (test-slot-existence): Adapt to using slot definition objects.
  (make-class): Allow slot specs or <slot> objects as the `slots'
  argument.
  (write): New method on <slot>.
  (class-slot-ref, class-slot-set!): Reimplement.
  (compute-slot-accessors, compute-getter-method)
  (compute-setter-method): Adapt to changes.
  (compute-getters-n-setters): Remove.  Yay!
  (compute-get-n-set): Adapt to use effective slot definitions instead
  of the getters-n-setters for #:class / #:each-subclass allocation.
  (%initialize-object): Adapt.
  (initialize): New method for <slot>.  Adapt method for <class>.

* module/oop/goops/active-slot.scm (compute-get-n-set):
* module/oop/goops/composite-slot.scm (compute-propagated-get-n-set):
  Use slot-definition-options to access options of slot.

* test-suite/tests/goops.test ("bad init-thunk"): Fix to be a "pass-if"
  instead of an "expect-fail".

9 years agoBeginnings of <slot> slot definition class
Andy Wingo [Fri, 16 Jan 2015 14:44:48 +0000 (15:44 +0100)]
Beginnings of <slot> slot definition class

* module/oop/goops.scm (define-macro-folder): Factor out this helper.
  (fold-class-slots): Implement using define-macro-folder.
  (fold-slot-slots): New definition, for slots of <slot-definition>.
  (define-slot-indexer): New helper.  Use to define indexes for slots of
  <class> and of <slot>.

9 years agoThe GOOPS "unbound" value is a unique pair
Andy Wingo [Fri, 16 Jan 2015 12:50:21 +0000 (13:50 +0100)]
The GOOPS "unbound" value is a unique pair

* libguile/goops.c (SCM_GOOPS_UNBOUND, SCM_GOOPS_UNBOUNDP): Remove
  internal macros.
  (scm_make_unbound, scm_unbound_p): Remove internal functions.
  (scm_sys_clear_fields_x): Add "unbound" parameter, for the init
  value.

* module/oop/goops.scm (*unbound*): Define in Scheme as a simple
  heap-allocated value.
  (unbound?): New definition.
  (%allocate-instance): Pass *unbound* to %clear-fields!.
  (make-class, slot-definition-init-value)
  (slot-definition-init-form, make-closure-variable): Use *unbound*
  instead of (make-unbound), which is now gone.

* module/oop/goops/active-slot.scm (compute-get-n-set): Use *unbound*
  instead of make-unbound.  This module uses the GOOPS internals module;
  perhaps we should export make-unbound or something...

* module/oop/goops/save.scm (make-unbound): Export our own make-unbound
  definition, for use by residualized save code.

* module/language/ecmascript/base.scm (<undefined>, *undefined*): Use a
  unique object kind and instance for the undefined value.

* libguile/vm.c (scm_i_vm_mark_stack): Fill the stack with
  SCM_UNSPECIFIED instead of SCM_UNBOUND.

9 years agoGOOPS: Deprecate "using-class" procs like slot-ref-using-class
Andy Wingo [Fri, 16 Jan 2015 12:18:05 +0000 (13:18 +0100)]
GOOPS: Deprecate "using-class" procs like slot-ref-using-class

* libguile/deprecated.h:
* libguile/goops.c:
* libguile/goops.h:
* libguile/deprecated.c (scm_slot_ref_using_class):
  (scm_slot_set_using_class_x):
  (scm_slot_bound_using_class_p):
  (scm_slot_exists_using_class_p): Deprecate.

* module/oop/goops.scm (slot-ref-using-class, slot-set-using-class!)
  (slot-bound-using-class?, slot-exists-using-class?): Deprecate.
  Change to check that `class' is indeed the class of `obj', as
  required, and then dispatch to slot-ref et al.

9 years agochange-object-class refactor
Andy Wingo [Fri, 16 Jan 2015 12:02:31 +0000 (13:02 +0100)]
change-object-class refactor

* module/oop/goops.scm (change-object-class): Refactor to use slot-ref,
  slot-bound?, and slot-set! instead of the using-class? variants.

9 years agoslot-ref, slot-set! et al bypass "using-class" variants
Andy Wingo [Fri, 16 Jan 2015 11:55:48 +0000 (12:55 +0100)]
slot-ref, slot-set! et al bypass "using-class" variants

* module/oop/goops.scm (slot-ref, slot-set!, slot-bound?, slot-exists?):
  Bypass slot-ref-using-class, slot-set-using-class!, and so on.  Those
  interfaces are public and have to check that the class is indeed a
  class, they should check that the object is an instance of the class,
  and so on, whereas if we get the class via class-of we know that the
  invariant holds.

9 years agoManipulate GOOPS vtable flags from Scheme, for speed
Andy Wingo [Fri, 16 Jan 2015 10:26:25 +0000 (11:26 +0100)]
Manipulate GOOPS vtable flags from Scheme, for speed

* libguile/goops.h: Remove unimplemented declarations of
  scm_make_next_method, scm_sys_invalidate_method_cache_x, and
  stklos_version.
  (scm_sys_invalidate_class_x): Remove helper definition.  This was
  exported in the past but shouldn't have been.

* libguile/goops.c (scm_sys_make_vtable_vtable): Rename from
  scm_sys_make_root_class, and don't do anything about flags.
  (scm_sys_bless_applicable_struct_vtables_x, scm_class_p)
  (scm_sys_invalidate_class_x): Remove; we do these in Scheme now.
  (scm_init_goops_builtins): Define Scheme values for vtable flags.

* module/oop/goops.scm (vtable-flag-goops-metaclass)
  (class-add-flags!, class-clear-flags!, class-has-flags?)
  (class?, instance?): New definitions.
  (<class>): Add GOOPS metaclass flags from Scheme.
  (<applicable-struct-class>, <applicable-struct-with-setter-class>):
  Add flags from Scheme.
  (make, initialize): Add class flags as appropriate.
  (class-redefinition): Clear the "valid" flag on the old class.
  (check-slot-args): Use instance? instead of a CPL check.

9 years agoGOOPS class slot indices defined as inline values
Andy Wingo [Fri, 16 Jan 2015 09:20:17 +0000 (10:20 +0100)]
GOOPS class slot indices defined as inline values

* module/oop/goops.scm (define-class-index): Define as inline values.

9 years ago`match' refactor in goops.scm
Andy Wingo [Fri, 16 Jan 2015 09:19:47 +0000 (10:19 +0100)]
`match' refactor in goops.scm

* module/oop/goops.scm (compute-dispatch-procedure): Use `match'.

9 years agoConvert emit-linear-dispatch to use match
Andy Wingo [Wed, 14 Jan 2015 19:43:35 +0000 (20:43 +0100)]
Convert emit-linear-dispatch to use match

* module/oop/goops.scm (emit-linear-dispatch): Convert to use `match'.

9 years agoMore GOOPS cleanups
Andy Wingo [Wed, 14 Jan 2015 19:15:53 +0000 (20:15 +0100)]
More GOOPS cleanups

* module/oop/goops.scm (build-slots-list): Use `match'.
  (make-standard-class): Formatting fixes.

9 years agowhen and unless for one-armed ifs in goops.scm
Andy Wingo [Wed, 14 Jan 2015 19:06:35 +0000 (20:06 +0100)]
when and unless for one-armed ifs in goops.scm

* module/oop/goops.scm: Consistently use when or unless for one-armed
  ifs.

9 years agoMore GOOPS comments
Andy Wingo [Tue, 13 Jan 2015 23:01:51 +0000 (00:01 +0100)]
More GOOPS comments

* module/oop/goops.scm: More expository comments.

9 years agoCommenting in goops.scm
Andy Wingo [Tue, 13 Jan 2015 22:16:40 +0000 (23:16 +0100)]
Commenting in goops.scm

* module/oop/goops.scm: More narrative cleanup.

9 years agoNarrative reordering in goops.scm
Andy Wingo [Tue, 13 Jan 2015 22:04:57 +0000 (23:04 +0100)]
Narrative reordering in goops.scm

* module/oop/goops.scm: Reorder for narrative.

9 years agoscm_make cleanup
Andy Wingo [Tue, 13 Jan 2015 20:59:03 +0000 (21:59 +0100)]
scm_make cleanup

* libguile/goops.c (scm_make): Remove SCM_DEFINE around scm_make; the
  real definition is in Scheme.

9 years agoAdd compute-cpl tests
Andy Wingo [Tue, 13 Jan 2015 20:07:42 +0000 (21:07 +0100)]
Add compute-cpl tests

* test-suite/tests/goops.test: Add tests for compute-cpl based on
  comments from goops.scm.

* module/oop/goops.scm (compute-std-cpl): Remove comment, and add
  docstring.
  (compute-cpl): Improve comment.

9 years agoFold (oop goops util) into (oop goops)
Andy Wingo [Mon, 12 Jan 2015 20:43:48 +0000 (21:43 +0100)]
Fold (oop goops util) into (oop goops)

* module/oop/goops/util.scm: Removed.  Instead we fold these definitions
  into goops.scm.

* module/oop/goops/save.scm: Remove useless import of util.scm.

* module/oop/goops.scm: Fold in util.scm.  Since we always use
  add-interesting-primitive!, import (language tree-il primitives) in
  the header.  Clean up some early comments, and use of eval-when.

* module/Makefile.am: Adapt.

9 years agoGOOPS utils module cleanups
Andy Wingo [Mon, 12 Jan 2015 20:40:29 +0000 (21:40 +0100)]
GOOPS utils module cleanups

* module/oop/goops.scm (make-class): Inline find-duplicate to its use
  site.

* module/oop/goops/util.scm (improper->proper): Remove unused function.
  (any, every): Don't re-export these from SRFI-1; users can get them
  from SRFI-1 directly.

9 years agoappend-map rather than mapappend
Andy Wingo [Mon, 12 Jan 2015 20:18:57 +0000 (21:18 +0100)]
append-map rather than mapappend

* module/oop/goops/util.scm: Remove mapappend alias; SRFI-1 append-map
  should be used instead.

9 years agoGOOPS cleanup to use SRFI-1 better
Andy Wingo [Mon, 12 Jan 2015 20:16:25 +0000 (21:16 +0100)]
GOOPS cleanup to use SRFI-1 better

* module/oop/goops.scm (class-subclasses, class-methods): Reimplement
  using stock SRFI-1 procedures.

9 years agoCosmetic goops refactors.
Andy Wingo [Sun, 11 Jan 2015 21:23:51 +0000 (22:23 +0100)]
Cosmetic goops refactors.

* module/oop/goops.scm: Update comments.
* libguile/goops.c: Cosmetic reorderings, re-commentings, and
  de-commentings.

9 years agoIncorporate %inherit-magic! into %init-layout!
Andy Wingo [Sun, 11 Jan 2015 21:01:47 +0000 (22:01 +0100)]
Incorporate %inherit-magic! into %init-layout!

* libguile/goops.c (scm_make_standard_class, scm_sys_init_layout_x):
  Move definitions up.  Incorporate scm_sys_inherit_magic_x into
  scm_sys_init_layout_x.

* libguile/goops.h: Remove scm_sys_init_layout_x declaration.

9 years agogoops.c no longer knows about <class> slot allocation
Andy Wingo [Sun, 11 Jan 2015 20:31:51 +0000 (21:31 +0100)]
goops.c no longer knows about <class> slot allocation

* libguile/goops.c (scm_class_of): Access "redefined" slot by name in
  the case where we need to change the class of an instance.
  (scm_sys_goops_early_init): Move up capture of class-precedence-list
  so SCM_SUBCLASSP can use it.

* libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, scm_si_redefined)
  (scm_si_direct_supers, scm_si_direct_slots, scm_si_direct_subclasses)
  (scm_si_direct_methods, scm_si_cpl scm_si_slots)
  (scm_si_getters_n_setters, SCM_N_CLASS_SLOTS, SCM_OBJ_CLASS_REDEF):
  Remove.  Now C code has no special knowledge about the layout of
  GOOPS classes.
  (SCM_SUBCLASSP): Use scm_class_precedence_list to get CPL.
  (SCM_INST, SCM_ACCESSORS_OF): Remove unused macros that were
  undocumented and nonsensical.

9 years agoReimplement inherit-applicable! in Scheme
Andy Wingo [Sun, 11 Jan 2015 19:49:16 +0000 (20:49 +0100)]
Reimplement inherit-applicable! in Scheme

* libguile/goops.c: Move captured keywords and symbols up to the top.
  (scm_i_inherit_applicable): Dispatch to Scheme.
  (scm_sys_goops_early_init): Capture inherit-applicable!.

* module/oop/goops.scm (inherit-applicable!): Scheme implementation.

9 years agoReimplement %allocate-instance in Scheme
Andy Wingo [Sun, 11 Jan 2015 18:11:41 +0000 (19:11 +0100)]
Reimplement %allocate-instance in Scheme

* libguile/goops.c (scm_sys_clear_fields_x): New function.
  (scm_sys_allocate_instance): Remove.  It was available to C but not to
  Scheme and it's really internal.
* libguile/goops.h: Remove scm_sys_allocate_instance.

* module/oop/goops.scm (%allocate-instance): Implement in Scheme, using
  allocate-struct and %clear-fields!.
  (make, shallow-clone, deep-clone, allocate-instance): Adapt to
  %allocate-instance not taking an initargs argument.

9 years agoRe-use the vtable "size" field for GOOPS nfields
Andy Wingo [Sun, 11 Jan 2015 15:36:45 +0000 (16:36 +0100)]
Re-use the vtable "size" field for GOOPS nfields

* module/oop/goops.scm (fold-<class>-slots): The first "reserved" slot
  is actually for instance sizes, used by the "simple struct"
  mechanism.  Reuse this field for GOOPS's "nfields".
  (make-standard-class, <class>, initialize): Adapt order of field
  initializations.

* libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, SCM_N_CLASS_SLOTS)
* libguile/goops.c (scm_sys_allocate_instance): Adapt.

9 years agoMove <class> initialization to Scheme
Andy Wingo [Sun, 11 Jan 2015 15:27:16 +0000 (16:27 +0100)]
Move <class> initialization to Scheme

* libguile/goops.c (scm_sys_make_root_class): Just make the
  vtable-vtable, and leave initialization to Scheme.

* libguile/struct.c (scm_i_make_vtable_vtable): Change to take a full
  list of fields, not just the extra fields.
  (scm_init_struct): Adapt to scm_i_make_vtable_vtable change.

* module/oop/goops.scm (<class>): Compute layout for <class>, and
  initialize <class> from here.

9 years agoDeprecate scm_get_keyword
Andy Wingo [Sat, 10 Jan 2015 23:21:58 +0000 (00:21 +0100)]
Deprecate scm_get_keyword

* libguile/deprecated.c (scm_get_keyword): Deprecate.
* libguile/deprecated.h:
* libguile/goops.c:
* libguile/goops.h:

9 years agoRewrite %initialize-object in Scheme
Andy Wingo [Sat, 10 Jan 2015 23:17:22 +0000 (00:17 +0100)]
Rewrite %initialize-object in Scheme

* libguile/goops.h:
* libguile/goops.c (scm_sys_initialize_object): Remove C interface.
  This function was only really useful as part of a GOOPS initialize
  method but was not exported from the goops module.

* module/oop/goops.scm (get-keyword, %initialize-object): Implement in
  Scheme.

9 years agoMinor goops.c tidying
Andy Wingo [Sat, 10 Jan 2015 22:26:41 +0000 (23:26 +0100)]
Minor goops.c tidying

* libguile/goops.c: Reorder static variables.  Remove unused
  sym_procedure.

9 years agoRemove scm_c_extend_primitive_generic
Andy Wingo [Sat, 10 Jan 2015 22:20:47 +0000 (23:20 +0100)]
Remove scm_c_extend_primitive_generic

* libguile/goops.h (scm_c_extend_primitive_generic): Remove public
  interface.  This was introduced in 2003 with the "extended" generics
  but never documented, unused as far as I can tell, and is better
  accessed from Scheme.

* libguile/goops.c: Remove support for scm_c_extend_primitive_generic.
  Simplify capture of change-class.

9 years agoNo more concept of "pure generics"
Andy Wingo [Sat, 10 Jan 2015 22:02:02 +0000 (23:02 +0100)]
No more concept of "pure generics"

* libguile/goops.h (SCM_PUREGENERICP, SCM_VALIDATE_PUREGENERIC)
  (SCM_VTABLE_FLAG_GOOPS_PURE_GENERIC, SCM_CLASSF_PURE_GENERIC):
  Remove.
* libguile/goops.c (scm_set_primitive_generic_x): Use SCM_GENERICP, not
  SCM_PUREGENERICP.
  (scm_sys_bless_pure_generic_vtable_x): Remove; this flag isn't
  checked.

* module/oop/goops.scm: Don't call %bless-pure-generic-vtable!; there's
  no need.

9 years agoRemove TEST_CHANGE_CLASS
Andy Wingo [Fri, 9 Jan 2015 23:55:44 +0000 (00:55 +0100)]
Remove TEST_CHANGE_CLASS

* libguile/goops.c (TEST_CHANGE_CLASS): Remove unused macro and comment.

9 years agoRemove pure-generic?
Andy Wingo [Fri, 9 Jan 2015 23:52:26 +0000 (00:52 +0100)]
Remove pure-generic?

* libguile/goops.h:
* libguile/goops.c (scm_pure_generic_p): Remove function only compiled
  in debug mode.

9 years agoGoops slot-unbound / slot-missing cleanups
Andy Wingo [Fri, 9 Jan 2015 23:51:26 +0000 (00:51 +0100)]
Goops slot-unbound / slot-missing cleanups

* libguile/goops.c: Remove useless slot-unbound / slot-missing
  captures.

9 years agoMove slot-ref et al to Scheme
Andy Wingo [Fri, 9 Jan 2015 23:50:33 +0000 (00:50 +0100)]
Move slot-ref et al to Scheme

* libguile/goops.c:
* module/oop/goops.scm (slot-ref-using-class, slot-set-using-class!):
  (slot-bound-using-class?, slot-exists-using-class?, slot-set!):
  (slot-bound?, slot-exists?): Move implementation to Scheme.

9 years agoPort method and generic accessors to Scheme
Andy Wingo [Fri, 9 Jan 2015 21:05:01 +0000 (22:05 +0100)]
Port method and generic accessors to Scheme

* libguile/goops.c:
* module/oop/goops.scm (generic-function-methods)
  (method-generic-function, method-specializers, method-procedure): Port
  to Scheme.

9 years ago<class> accessors implemented in Scheme
Andy Wingo [Fri, 9 Jan 2015 20:01:03 +0000 (21:01 +0100)]
<class> accessors implemented in Scheme

* libguile/goops.c (scm_class_p): New internal helper, exported to
  goops.scm.
  (scm_class_name, scm_class_direct_supers, scm_class_direct_slots):
  (scm_class_direct_subclasses, scm_class_direct_methods):
  (scm_class_precedence_list, scm_class_slots): Dispatch to Scheme.
  (scm_sys_goops_early_init): Capture <class> accessors.

* module/oop/goops.scm (define-class-accessor): New helper.
  (class-name, class-direct-supers, class-direct-slots):
  (class-direct-subclasses, class-direct-methods)
  (class-precedence-list, class-slots): Define in Scheme.
  (compute-std-cpl, compute-cpl): Move lower.

9 years agogoops: use computed class slot offsets; untabify and fix whitepace
Andy Wingo [Fri, 9 Jan 2015 19:07:06 +0000 (20:07 +0100)]
goops: use computed class slot offsets; untabify and fix whitepace

* module/oop/goops.scm: Untabify and remove trailing whitespace.  Change
  slot-ref on classes to struct-ref of fixed offsets.

9 years agoStatically compute offsets for slots of <class> in Scheme
Andy Wingo [Fri, 9 Jan 2015 18:10:51 +0000 (19:10 +0100)]
Statically compute offsets for slots of <class> in Scheme

* module/oop/goops.scm (macro-fold-left): New helper.
  (define-class-index): Define class-index-FOO for each slot FOO.
  (fold-<class>-slots): Make the slots list have the marks of the
  "visit" macro.

9 years agoRefactor to <class> slot computation
Andy Wingo [Wed, 7 Jan 2015 23:42:27 +0000 (18:42 -0500)]
Refactor to <class> slot computation

* module/oop/goops.scm (macro-fold-right, fold-<class>-slots, <class>):
  Use a macro folder to define (and redefine) class slots.  We'll use
  this to compute static indices as well.

9 years agoRemove GOOPS random state
Andy Wingo [Wed, 7 Jan 2015 21:31:56 +0000 (16:31 -0500)]
Remove GOOPS random state

* libguile/goops.c: Remove GOOPS random state, now that there are no
  more hashsets.

9 years agoMore goops.c cleanups, and fix a security issue
Andy Wingo [Wed, 7 Jan 2015 21:03:09 +0000 (16:03 -0500)]
More goops.c cleanups, and fix a security issue

* libguile/goops.c: Remove unused #includes.
  (make_class_name): New helper, replaces unsafe use of sprintf.
  (scm_make_extended_class): Rewrite to call scm_make_standard_class
  directly.
  (scm_make_port_classes): Rewrite to use scm_make_standard_class, and
  no need to patch the CPL any more.

9 years agoRemove unused union scm_t_debug_info
Andy Wingo [Tue, 6 Jan 2015 20:02:52 +0000 (15:02 -0500)]
Remove unused union scm_t_debug_info

* libguile/debug.h (union scm_t_debug_info): Remove unused type
  declaration.

9 years agoMore unused code removal in GOOPS
Andy Wingo [Tue, 6 Jan 2015 20:00:28 +0000 (15:00 -0500)]
More unused code removal in GOOPS

* libguile/goops.c: Remove unused sym_memoize_method_x.

9 years agoRemove private var_no_applicable_method capture
Andy Wingo [Tue, 6 Jan 2015 19:59:02 +0000 (14:59 -0500)]
Remove private var_no_applicable_method capture

* libguile/goops.c (var_no_applicable_method): Remove unused capture.
  (sym_no_applicable_method): Remove unused symbol.

9 years agoRemove scm_assert_bound
Andy Wingo [Tue, 6 Jan 2015 19:54:44 +0000 (14:54 -0500)]
Remove scm_assert_bound

* libguile/goops.c (scm_assert_bound): Remove unexported unused helper.
* module/oop/goops.scm (make-generic-bound-check-getter): Change
  assert-bound use to use `unbound?'.

9 years agoRemove scm_at_assert_bound_ref
Andy Wingo [Tue, 6 Jan 2015 19:51:44 +0000 (14:51 -0500)]
Remove scm_at_assert_bound_ref

* libguile/goops.c (scm_at_assert_bound_ref): Remove unused, unexported
  function.

9 years agoRemove hashset slots from GOOPS classes
Andy Wingo [Tue, 6 Jan 2015 19:24:27 +0000 (14:24 -0500)]
Remove hashset slots from GOOPS classes

* libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, SCM_INSTANCE_HASH)
  (SCM_SET_HASHSET):
* libguile/goops.c (prep_hashsets, scm_sys_make_root_class,
  scm_sys_init_layout_x):
* module/oop/goops.scm (build-<class>-slots): Remove hashsets from
  classes.  We haven't implemented hashed dispatch since Guile 1.8, and
  it's not clear that the particular formulation of dispatch is a good
  idea.

9 years agoDeprecate C exports of GOOPS classes.
Andy Wingo [Tue, 6 Jan 2015 19:16:03 +0000 (14:16 -0500)]
Deprecate C exports of GOOPS classes.

* libguile/deprecated.h:
  (scm_class_boolean, scm_class_char, scm_class_pair)
  (scm_class_procedure, scm_class_string, scm_class_symbol)
  (scm_class_primitive_generic, scm_class_vector, scm_class_null)
  (scm_class_real, scm_class_complex, scm_class_integer)
  (scm_class_fraction, scm_class_unknown, scm_class_top)
  (scm_class_object, scm_class_class, scm_class_applicable)
  (scm_class_applicable_struct, scm_class_applicable_struct_with_setter)
  (scm_class_generic, scm_class_generic_with_setter, scm_class_accessor)
  (scm_class_extended_generic, scm_class_extended_generic_with_setter)
  (scm_class_extended_accessor, scm_class_method)
  (scm_class_accessor_method, scm_class_procedure_class)
  (scm_class_applicable_struct_class, scm_class_number, scm_class_list)
  (scm_class_keyword, scm_class_port, scm_class_input_output_port)
  (scm_class_input_port, scm_class_output_port, scm_class_foreign_slot)
  (scm_class_self, scm_class_protected, scm_class_hidden)
  (scm_class_opaque, scm_class_read_only, scm_class_protected_hidden)
  (scm_class_protected_opaque, scm_class_protected_read_only)
  (scm_class_scm, scm_class_int, scm_class_float)
  (scm_class_double, scm_port_class, scm_smob_class): Deprecate.

* libguile/deprecated.c:
* libguile/goops.c:
* libguile/goops.h: Adapt to deprecation.

* libguile/goops.h
* libguile/goops.c (scm_is_generic, scm_is_method): New interfaces.
  (SCM_GENERICP, SCM_METHODP): Change to use new interfaces.

* libguile/ports.c (scm_make_port_type):
* libguile/smob.c (scm_make_smob_type, scm_set_smob_apply): Use internal
  names for the port and smob class arrays.

9 years agoGenerics with setters have <applicable-struct-with-setter> layout
Andy Wingo [Tue, 6 Jan 2015 18:41:56 +0000 (13:41 -0500)]
Generics with setters have <applicable-struct-with-setter> layout

* libguile/goops.c (scm_sys_set_object_setter_x): Remove.  Instead, we
  use slot-set! of 'setter.
  (scm_i_define_class_for_vtable): Move lower in the file, and fold in
  scm_make_extended_class_from_symbol and make_class_from_symbol.
  Properly handle applicable structs with setters.
  (scm_class_applicable_struct_with_setter_class): New private capture.
  (scm_sys_bless_applicable_struct_vtables_x): Rename to take two
  arguments, and bless the second argument as an applicable struct with
  setter vtable.
  (scm_sys_goops_early_init): Capture setter classes.

* libguile/deprecated.c (SPEC_OF, CPL_OF): Access slots by name, not by
  index.
  (applicablep, more_specificp): Adapt to use CPL_OF.
  (scm_find_method): Access "methods" slot by name.

* libguile/procs.c (scm_setter): Remove special case for generics; if
  it's a setter, it will be a normal applicable struct.
* module/oop/goops.scm (<applicable-struct-with-setter-class>)
  (<applicable-struct-with-setter>): New classes.
  (<generic-with-setter>): Now an instance of the setter metaclass and a
  child of the setter class, so that the "setter" slot ends up in the
  right place.
  (<accessor>, <extended-generic-with-setter>, <extended-accessor>): Be
  instances of the setter metaclass.
  (<method>, <accessor-method>): Move definitions farther down.
  (make): Use slot-set! when initializing setters here.
  (initialize): Likewise for <applicable-struct-with-setter>.  Remove
  specialization for <generic-with-setter>.

9 years agoRemove unused CPP defines naming <method> slots
Andy Wingo [Tue, 6 Jan 2015 17:06:59 +0000 (12:06 -0500)]
Remove unused CPP defines naming <method> slots

* libguile/goops.h (scm_si_generic_function, scm_si_specializers)
  (scm_si_procedure, scm_si_formals, scm_si_body)
  (scm_si_make_procedure): Remove unused CPP defines.

9 years agoRemove unused `default-slot-definition-class' <class> slot
Andy Wingo [Tue, 6 Jan 2015 17:03:25 +0000 (12:03 -0500)]
Remove unused `default-slot-definition-class' <class> slot

* libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, scm_si_slotdef_class)
* module/oop/goops.scm (build-<class>-slots): Remove unused
  `default-slot-definition-class' <class> slot.

9 years agoRemove useless scm_s_slot_set_x export
Andy Wingo [Tue, 6 Jan 2015 16:56:23 +0000 (11:56 -0500)]
Remove useless scm_s_slot_set_x export

* libguile/goops.c:
* libguile/goops.h (scm_s_slot_set_x): Remove unused and useless
  export.

9 years agoRemove unreachable code in scm_setter
Andy Wingo [Tue, 6 Jan 2015 16:50:37 +0000 (11:50 -0500)]
Remove unreachable code in scm_setter

* libguile/procs.c (scm_setter): Remove unreachable code.

9 years agoDeprecate scm_no_applicable_method C export
Andy Wingo [Tue, 6 Jan 2015 16:50:16 +0000 (11:50 -0500)]
Deprecate scm_no_applicable_method C export

* libguile/deprecated.c (scm_init_deprecated_goops)
  (scm_no_applicable_method):
* libguile/goops.h:
* libguile/goops.c (scm_no_applicable_method)
  (scm_sys_goops_early_init): Deprecate scm_no_applicable_method C
  export.

9 years agoRemove unused scm_t_method and SCM_METHOD
Andy Wingo [Tue, 6 Jan 2015 16:30:24 +0000 (11:30 -0500)]
Remove unused scm_t_method and SCM_METHOD

* libguile/goops.h (scm_t_method, SCM_METHOD): Remove unused struct
  type, typedef, and macro.

9 years agoFold GOOPS compile and dispatch modules into main GOOPS module
Andy Wingo [Sun, 4 Jan 2015 20:52:12 +0000 (15:52 -0500)]
Fold GOOPS compile and dispatch modules into main GOOPS module

* 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.

9 years agoRemove unused *goops-module* definition.
Andy Wingo [Sun, 4 Jan 2015 20:37:03 +0000 (15:37 -0500)]
Remove unused *goops-module* definition.

* module/oop/goops.scm (*goops-module*): Remove.

9 years agodefine-generic, define-extended-generic are hygienic syntax
Andy Wingo [Sun, 4 Jan 2015 20:35:25 +0000 (15:35 -0500)]
define-generic, define-extended-generic are hygienic syntax

* module/oop/goops.scm (define-generic, define-extended-generic):
  (define-extended-generics): Reimplement using syntax-case.

9 years ago`class' is a hygienic macro
Andy Wingo [Sun, 4 Jan 2015 20:18:39 +0000 (15:18 -0500)]
`class' is a hygienic macro

* module/oop/goops.scm (class): Rewrite as a hygienic macro.

9 years agoDeprecate scm_basic_make_class
Andy Wingo [Sun, 4 Jan 2015 18:43:14 +0000 (13:43 -0500)]
Deprecate scm_basic_make_class

* libguile/deprecated.h:
* libguile/deprecated.c (scm_basic_make_class): Deprecate.

* libguile/goops.c:
* libguile/goops.h (scm_make_standard_class): New internal helper.  It's
  a better spelling, as it matches make-standard-class, and is internal
  so as not to cause confusion between boot GOOPS helpers and "real"
  GOOPS interfaces.

9 years agoMove GOOPS boot to Scheme
Andy Wingo [Sun, 4 Jan 2015 18:41:09 +0000 (13:41 -0500)]
Move GOOPS boot to Scheme

* module/oop/goops.scm (build-<class>-slots): New helper, replacing
  build_class_class_slots.
  (build-slots-list, %compute-getters-n-setters, %compute-layout): New
  private helpers, moved here from C.
  (%prep-layout!): Reimplement in Scheme.
  (make-standard-class): New private helper, replacing
  scm_basic_make_class.
  (<class>, <top>, <object>): Define in Scheme.

  (<foreign-slot>, <protected-slot>, <hidden-slot>, <opaque-slot>,
   <read-only-slot>, <self-slot>, <protected-opaque-slot>,
   <protected-hidden-slot>, <protected-read-only-slot>, <scm-slot>,
   <int-slot>, <float-slot>, <double-slot>, <procedure-class>,
   <applicable-struct-class>, <method>, <accessor-method>, <applicable>,
   <applicable-struct>, <generic>, <extended-generic>,
   <generic-with-setter>, <accessor>, <extended-generic-with-setter>,
   <extended-accessor>): Define in Scheme.

  (<boolean>, <char>, <list>, <pair>, <null>, <string>, <symbol>,
   <vector>, <foreign>, <hashtable>, <fluid>, <dynamic-state>, <frame>,
   <vm-continuation>, <bytevector>, <uvec>, <array>, <bitvector>,
   <number>, <complex>, <real>, <integer>, <fraction>, <keyword>,
   <unknown>, <procedure>, <primitive-generic>, <port>, <input-port>,
   <output-port>, <input-output-port>): Define in Scheme.

  (compute-slots): Use build-slots-list helper.

* libguile/goops.h:
* libguile/goops.c (scm_basic_basic_make_class, scm_sys_compute_slots)
  (scm_sys_prep_layout_x): Remove.  These were available to C, but were
  undocumented internals that were dangerous, confusing, and
  unnecessary.

* libguile/goops.c: Add note about variable versus value references.
  Remove internal C routines that were just used during boot, as they
  have been moved to Scheme.
  (scm_basic_make_class): Change to call out to make-standard-class in
  Scheme.
  (scm_sys_make_root_class, scm_sys_bless_applicable_struct_vtable_x)
  (scm_sys_bless_pure_generic_vtable_x, scm_sys_init_layout_x): New
  private helpers.
  (scm_sys_goops_early_init): Change to capture values defined in
  Scheme.

9 years agoRemove declarations without definitions
Andy Wingo [Sun, 4 Jan 2015 18:20:55 +0000 (13:20 -0500)]
Remove declarations without definitions

* libguile/goops.h: Remove declarations for scm_oldfmt, scm_c_oldfmt0,
  and scm_c_oldfmt.  These symbols were not defined.

9 years agoRemove unused %fast-slot-ref / %fast-slot-set! from GOOPS
Andy Wingo [Sun, 4 Jan 2015 18:19:50 +0000 (13:19 -0500)]
Remove unused %fast-slot-ref / %fast-slot-set! from GOOPS

* libguile/goops.h:
* libguile/goops.c (scm_sys_fast_slot_ref, scm_sys_fast_slot_set_x):
  Remove these unused, unsafe functions.  They were publically available
  only to C.

* module/oop/goops/active-slot.scm (compute-get-n-set): Update to use
  struct-ref / struct-set! instead of %fast-slot-ref / %fast-slot-set!
  from (oop goops internal).

9 years agoPreparation for more GOOPS refactorings
Andy Wingo [Wed, 24 Dec 2014 16:29:45 +0000 (11:29 -0500)]
Preparation for more GOOPS refactorings

* libguile/goops.c (scm_sys_goops_early_init)
  (scm_init_goops_builtins): Factor out some initialization to a
  separate helper.  This will be the base for moving more things from C
  to Scheme in the future.

* module/oop/goops.scm: Call %goops-early-init.

9 years ago%init-goops-builtins is an extension, not a global
Andy Wingo [Wed, 24 Dec 2014 16:07:47 +0000 (11:07 -0500)]
%init-goops-builtins is an extension, not a global

* libguile/goops.h:
* libguile/goops.c (scm_init_goops, scm_init_goops_builtins): Move
  %init-goops-builtins to be an extension instead of a globally
  accessible function.

* module/oop/goops.scm: Adapt.

9 years agocompute-cpl implementation only in Scheme
Andy Wingo [Wed, 24 Dec 2014 14:37:14 +0000 (09:37 -0500)]
compute-cpl implementation only in Scheme

* libguile/goops.c (build_class_class_slots, create_basic_classes):
  Instead of creating <class> with uninitialized `direct-slots',
  `slots', and `getters-n-setters' fields and initializing them later,
  create <class> with a "boot" version of unspecialized slots and later
  replace the fields with specialized slot classes.  This allows
  slot-ref to work during early boot, which is necessary to move
  compute-cpl to Scheme.
  (create_standard_classes): Finish initializing <class> here.
  (map, filter_cpl, compute_cpl): Remove the boot-time compute-cpl in C
  and its helpers.
  (scm_basic_basic_make_class): Call compute-cpl in Scheme.
  (fix_cpl): Remove; since we use the correct compute-cpl from the
  beginning, there's no need to correct for the deficiencies of the C
  implementation any more.
  (build_slots_list): Adapt to build_class_class_slots change.

* module/oop/goops.scm (compute-std-cpl, compute-cpl): Move these up to
  the top, so they can be called by the boot process.
  (compute-clos-cpl, top-sort, std-tie-breaker, build-transitive-closure)
  (build-constraints): Remove unused private code.

9 years agoMore useless goops.c code removal
Andy Wingo [Thu, 18 Dec 2014 21:10:10 +0000 (22:10 +0100)]
More useless goops.c code removal

* libguile/goops.c: Remove needless scm_sym_define_public definition.

9 years agoRemove unused macros in goops.c
Andy Wingo [Thu, 18 Dec 2014 21:08:15 +0000 (22:08 +0100)]
Remove unused macros in goops.c

* libguile/goops.c (NXT_MTHD_METHODS, NXT_MTHD_ARGS): Remove unused
  macros.

9 years agoRewrite %method-more-specific? to be in Scheme
Andy Wingo [Thu, 18 Dec 2014 20:57:24 +0000 (21:57 +0100)]
Rewrite %method-more-specific? to be in Scheme

* libguile/goops.h:
* libguile/goops.c (more_specificp, scm_sys_method_more_specific_p):
* module/oop/goops.scm (%method-more-specific?): Rewrite in Scheme.  We
  remove the scm_sys_method_more_specific_p interface as it is a private
  interface and it's not extensible.

9 years agoDeprecate C interfaces scm_compute_applicable_methods, scm_find_method
Andy Wingo [Thu, 18 Dec 2014 20:31:18 +0000 (21:31 +0100)]
Deprecate C interfaces scm_compute_applicable_methods, scm_find_method

* libguile/deprecated.h:
* libguile/deprecated.c (scm_compute_applicable_methods): Deprecate.
  This was the boot version of compute-applicable-methods, not the full
  version; the right thing to do is to call scheme.
  (scm_find_method): Deprecate.  Again, the right thing is to do this on
  the Scheme level.

* libguile/goops.c:
* libguile/goops.h: Deprecated code moved to deprecated.[ch].

9 years ago%compute-applicable-methods in Scheme
Andy Wingo [Thu, 18 Dec 2014 11:51:11 +0000 (12:51 +0100)]
%compute-applicable-methods in Scheme

* libguile/goops.c: Move %compute-applicable-methods to Scheme.
  (scm_sys_goops_loaded): No need to initialize
  var_compute_applicable_methods.
* libguile/goops.h (scm_sys_compute_applicable_methods): Remove.  This
  was internal so it shouldn't cause a problem.

* module/oop/goops.scm (%sort-applicable-methods):
  (%compute-applicable-methods): New definitions.

9 years agoMark two coverage tests as XFAIL
Andy Wingo [Fri, 23 Jan 2015 15:15:45 +0000 (16:15 +0100)]
Mark two coverage tests as XFAIL

* test-suite/tests/coverage.test ("several times", "one proc hit, one
  proc unused"): Mark as XFAIL until we can fix either the expander or
  the compiler to have proper source info.

9 years agoFix the assembler for unexpected source properties
Andy Wingo [Fri, 23 Jan 2015 15:07:00 +0000 (16:07 +0100)]
Fix the assembler for unexpected source properties

* module/system/vm/assembler.scm (link-debug): Fix for source properties
  that don't have line and column, as are currently being produced by
  the new lalr.

9 years agoMerge commit '5b7632331e7551ac202bbaba37c572b96a791c6e'
Andy Wingo [Thu, 22 Jan 2015 13:54:17 +0000 (14:54 +0100)]
Merge commit '5b7632331e7551ac202bbaba37c572b96a791c6e'

Conflicts:
module/oop/goops.scm

9 years agoMerge commit 'ed72201a795ac1c8d6c0288b6bb710f2bd0ebd9c'
Andy Wingo [Thu, 22 Jan 2015 13:53:06 +0000 (14:53 +0100)]
Merge commit 'ed72201a795ac1c8d6c0288b6bb710f2bd0ebd9c'

Conflicts:
test-suite/tests/r6rs-ports.test

9 years agoMerge commit '01a301d1b606b84d986b735049e7155d2f4cd6aa'
Andy Wingo [Thu, 22 Jan 2015 13:49:36 +0000 (14:49 +0100)]
Merge commit '01a301d1b606b84d986b735049e7155d2f4cd6aa'

Conflicts:
libguile/hash.c

9 years agoMerge commit '894d0b894daae001495c748b3352cd79918d3789'
Andy Wingo [Thu, 22 Jan 2015 13:48:40 +0000 (14:48 +0100)]
Merge commit '894d0b894daae001495c748b3352cd79918d3789'

Conflicts:
libguile/hash.c