bpt/guile.git
9 years agoonly evaluate top-level macro definitions
Robin Templeton [Mon, 11 Aug 2014 10:04:28 +0000 (06:04 -0400)]
only evaluate top-level macro definitions

9 years agodegenerate let forms
Robin Templeton [Tue, 5 Aug 2014 03:17:21 +0000 (23:17 -0400)]
degenerate let forms

9 years agoeval-when
Robin Templeton [Tue, 5 Aug 2014 03:16:09 +0000 (23:16 -0400)]
eval-when

9 years agofset macro
Robin Templeton [Tue, 5 Aug 2014 03:13:20 +0000 (23:13 -0400)]
fset macro

9 years agouse defsubst
Robin Templeton [Tue, 5 Aug 2014 03:13:03 +0000 (23:13 -0400)]
use defsubst

9 years agodefsubst
Robin Templeton [Tue, 5 Aug 2014 03:11:43 +0000 (23:11 -0400)]
defsubst

9 years agocompiler macros
Robin Templeton [Tue, 5 Aug 2014 03:11:29 +0000 (23:11 -0400)]
compiler macros

9 years agodefconst, defvar: proclaim special at compile-time
Robin Templeton [Tue, 5 Aug 2014 03:08:12 +0000 (23:08 -0400)]
defconst, defvar: proclaim special at compile-time

9 years agoelisp @@ macro
Robin Templeton [Tue, 5 Aug 2014 03:06:59 +0000 (23:06 -0400)]
elisp @@ macro

9 years agocompile-elisp fn
Robin Templeton [Tue, 5 Aug 2014 03:06:26 +0000 (23:06 -0400)]
compile-elisp fn

9 years agofix `nil?' type inference
Robin Templeton [Thu, 24 Jul 2014 22:58:38 +0000 (18:58 -0400)]
fix `nil?' type inference

9 years agofix symbol-function
Robin Templeton [Fri, 18 Jul 2014 21:43:20 +0000 (17:43 -0400)]
fix symbol-function

9 years agorestore special operator handling
Robin Templeton [Fri, 18 Jul 2014 21:42:59 +0000 (17:42 -0400)]
restore special operator handling

9 years agodefine-module for elisp special modules
Robin Templeton [Fri, 18 Jul 2014 21:42:07 +0000 (17:42 -0400)]
define-module for elisp special modules

9 years agoconstant-interning fix
Robin Templeton [Fri, 18 Jul 2014 21:41:48 +0000 (17:41 -0400)]
constant-interning fix

9 years agodefvar affects default value
Robin Templeton [Tue, 24 Jun 2014 04:10:10 +0000 (00:10 -0400)]
defvar affects default value

9 years agosymbol default value procedures
Robin Templeton [Tue, 24 Jun 2014 04:01:56 +0000 (00:01 -0400)]
symbol default value procedures

9 years agoread nil/t as #nil/#t
Robin Templeton [Fri, 20 Jun 2014 03:37:36 +0000 (23:37 -0400)]
read nil/t as #nil/#t

9 years agotree-il evaluator
Robin Templeton [Wed, 18 Jun 2014 02:42:14 +0000 (22:42 -0400)]
tree-il evaluator

9 years agoelisp updates
Robin Templeton [Tue, 3 Jun 2014 00:01:55 +0000 (20:01 -0400)]
elisp updates

9 years agoguile-snarf fix
Robin Templeton [Sat, 14 Jun 2014 20:16:32 +0000 (16:16 -0400)]
guile-snarf fix

9 years agoprefer compilers earlier in list
Robin Templeton [Wed, 18 Jun 2014 02:41:45 +0000 (22:41 -0400)]
prefer compilers earlier in list

9 years agoRevert "Add thread-local lock-free, TLS-free freelists."
Robin Templeton [Sat, 14 Jun 2014 07:35:27 +0000 (03:35 -0400)]
Revert "Add thread-local lock-free, TLS-free freelists."

This reverts commit aef1fcf94e635c51bc1d0849ad1f60a1d1274276.

Conflicts:
libguile/threads.c

9 years agoallow arbitrary constants in cps
Robin Templeton [Sat, 14 Jun 2014 07:33:22 +0000 (03:33 -0400)]
allow arbitrary constants in cps

9 years agoguile-private-ref
BT Templeton [Fri, 23 Aug 2013 07:01:36 +0000 (03:01 -0400)]
guile-private-ref

* module/language/elisp/compile-tree-il.scm (compile-guile-private-ref):
  New special operator.

9 years agomultiple obarrays
BT Templeton [Wed, 31 Jul 2013 02:50:24 +0000 (22:50 -0400)]
multiple obarrays

* libguile/symbols.c (lookup_uninterned_symbol)
  (lookup_interned_latin1_symbol, lookup_interned_utf8_symbol)
  (scm_i_str2symbol): Take an `obarray' argument. All callers changed.

  (scm_make_obarray, scm_find_symbol, scm_intern, scm_unintern)
  (scm_obarray_for_each): New functions.

9 years agocheck symbols constants uninterned
Robin Templeton [Wed, 11 Jun 2014 02:57:05 +0000 (22:57 -0400)]
check symbols constants uninterned

9 years agointern arbitrary constants
Robin Templeton [Tue, 10 Jun 2014 22:48:07 +0000 (18:48 -0400)]
intern arbitrary constants

9 years agolibguile/Makefile.am (snarfcppopts): Remove CFLAGS
Robin Templeton [Tue, 10 Jun 2014 20:03:17 +0000 (16:03 -0400)]
libguile/Makefile.am (snarfcppopts): Remove CFLAGS

9 years agoAdd `scm_smob_type_class()'.
Andy Wingo [Tue, 10 Feb 2015 13:35:35 +0000 (14:35 +0100)]
Add `scm_smob_type_class()'.

* libguile/smob.h:
* libguile/smob.c (scm_smob_type_class): New function, to access the
  GOOPS class for a SMOB type.

9 years agoNEWS and doc updates
Andy Wingo [Mon, 9 Feb 2015 21:43:20 +0000 (22:43 +0100)]
NEWS and doc updates

* doc/ref/vm.texi: Update for new instructions.
* doc/ref/web.texi: Update for URI-reference support.
* NEWS: Update.

9 years agoDocument support for URI references.
Andy Wingo [Sun, 8 Feb 2015 12:12:27 +0000 (13:12 +0100)]
Document support for URI references.

* doc/ref/web.texi (URIs): Update for URI reference changes.

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?'.