This will allow for weak tables to be implemented partly in Scheme.
* module/ice-9/object-properties.scm: New file.
* am/bootstrap.am (SOURCES): Add new file.
* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm (make-object-property*): Deprecate
make-object-property in default env and add a shim.
* module/ice-9/buffered-input.scm (ice-9):
* module/language/elisp/boot.el (plist-function):
* module/scripts/frisk.scm (scripts):
* module/web/http.scm (web): Adapt users to import the new module.
* libguile/threads.h: Add join data directly on the thread instead of
using a Scheme-side weak table. It's less complicated and it will let
the weak table implementation use locks in Scheme; otherwise you would
have threads depending on weak tables and vice versa.
* libguile/threads.c (scm_trace_thread, guilify_self_1): Init and mark
the new members.
(thread_join_cond, thread_join_lock, thread_join_results)
(thread_init_joinable_x, thread_set_join_results_x): New accessors.
* module/ice-9/threads.scm (call-with-new-thread, join-thread): Use the
new accessors.
If that's what you want, you need to bring your own weak hash table on a
normal observer.
* module/ice-9/boot-9.scm (module): Remove weak-observers field.
(make-module, make-autoload-interface): Don't pass weak table to
constructor.
(module-observe-weak): Remove.
(module-unobserve, module-call-observers): Remove weak case.
* module/ice-9/deprecated.scm (module-observe-weak): Dispatch to
module-observe.
* test-suite/tests/modules.test ("observers"): Adapt.
The former allows for knowing whether a push succeeded or not, which is
useful for concurrent hash tables. The latter makes ephemerons mutable,
if the embedder wants to use them that way.
* module/ice-9/weak-vector.scm: New implementation, same interface.
* doc/ref/api-memory.texi (Weak vectors): Default weak vector value was
documented as empty list when it was actually unspecified, but #f is
most useful, so we change documentation and code to match.
* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
(DOT_X_FILES):
(DOT_DOC_FILES):
(noinst_HEADERS):
(modinclude_HEADERS):
* libguile.h:
* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/init.c:
* libguile/weak-vector.c:
* libguile/weak-vector.h: Remove C weak vector implementation, replaced
with deprecation stubs that call out to Scheme.
* libguile/weak-set.c:
* libguile/weak-table.c:
* libguile/weak-list.h: Remove unused internal header.
* libguile/eq.c:
* libguile/evalext.c:
* libguile/goops.c:
* libguile/hash.c:
* libguile/scm.h:
* module/system/base/types.scm:
* module/system/base/types/internal.scm:
* module/system/vm/assembler.scm: Remove wvect tc7.
* module/ice-9/boot-9.scm(symbol-property, set-symbol-property!)
(symbol-property-remove!): Remove.
* module/ice-9/boot-9.scm (make-record-type): Name must be symbol.
(record-constructor): Alias record-type-constructor.
(make-module): Require size to be zero. Should fix this with keyword
args :/
(try-load-module): Inline definition of try-module-autoload. Remove
try-module-autoload binding.
(make-soft-port): Add deprecation warning, so we can remove it
eventually.
* module/ice-9/save-stack.scm: Remove deprecation comment.
* module/ice-9/top-repl.scm:
* module/ice-9/threads.scm: Export instead of replace bindings.
* module/language/bytecode.scm: Remove instruction-arity et al.
* module/language/tree-il/analyze.scm: Remove deprecated
unbound-variable-analysis and macro-use-before-definition-analysis.
* module/rnrs.scm: Fix syntax-case export now that module and value
namespaces are separate.
* module/system/base/language.scm (invalidate-compilation-cache!):
Remove.
* module/system/base/language.scm (*current-language*): Remove.
Prevents a problem where with-exception-handler isn't defined yet by the
time the first finalizer gets kicked off (it's a file port, probably one
that is closed already...)
* libguile/finalizers.h:
* libguile/init.c (scm_i_init_guile):
* libguile/finalizers.c (queue_finalizer_async): Mark maybe-unused.
(scm_init_finalizers): Rework to only enable notification when Guile is
finished initializing.
* libguile/finalizers.c (ref_to_scm, scm_to_ref): New helpers.
(add_finalizer): New helper; returns the finalizer object.
(add_builtin_finalizer): New helper for structs, smobs, ports.
(scm_i_add_struct_finalizer):
(scm_i_add_smob_finalizer):
(scm_i_add_port_finalizer):
(scm_i_add_pointer_finalizer):
(scm_i_add_finalizer): Use new helpers.
(scm_i_add_guardian_finalizer): New helper.
(run_finalizer, run_finalizers, scm_run_finalizers): Reimplement.
(%add-finalizer!): Use new helpers.
(queue_finalizer_async):
(notify_finalizers_to_run):
(start_finalization_thread):
(spawn_finalizer_thread):
(scm_i_finalizer_pre_fork):
(scm_set_automatic_finalization_enabled):
(scm_init_finalizers):
(scm_init_finalizer_thread): Use Whippet API.
* libguile/finalizers.h (scm_i_set_finalizer, scm_i_add_resuscitator):
Remove.
Instead of storing keep-alive edges in weak tables, just add extra
fields on pointer objects.
* libguile/foreign.c (make_pointer, pointer_extra_word_count)
(set_pointer_extra_word, make_pointer_0, make_pointer_1, make_pointer_3)
(attach_finalizer): New helpers.
(scm_make_pointer): Never attach finalizers on the null pointer object.
(scm_from_pointer): Likewise.
(scm_bytevector_to_pointer, scm_procedure_to_pointer): Store keep-alive
links in extra words.
(scm_init_foreign, scm_register_foreign): Rework init for null, free,
and ffi_closure_free pointers.
These tables will be implemented differently after Whippet.
* libguile/weak-set.c (do_vacuum_weak_set, vacuum_all_weak_sets):
Remove.
(scm_c_make_weak_set, scm_init_weak_set): Don't keep a table of all weak
sets.
* libguile/weak-table.c (do_vacuum_weak_table, vacuum_all_weak_tables):
Remove.
(scm_c_make_weak_table, scm_init_weak_table): No table of all tables.
* libguile/atomics-internal.h (scm_atomic_set_bits): New routine.
* libguile/smob.c (scm_i_finalize_smob): Use atomics to clear the first
word instead of the GC alloc lock.
(finalize_smob): Implement as shim.
We're on a new version series, let's remove deprecated things. Also
reduces the amount of work we need to do in adapting to a new GC,
notably for bignums.
* configure.ac (--disable-tmpnam): Remove flag, tmpnam is gone.
* doc/ref/posix.texi (File System): Remove tmpnam docs.
* libguile/bitvectors.c (scm_bitvector_to_list): Remove deprecated
branch treating arrays as bitvectors.
* libguile/deprecated.c: Remove all deprecated code. Whee!
* libguile/deprecated.h: Remove deprecated decls.
* libguile/posix.c (scm_tmpnam): Remove.
* libguile/struct.c (scm_is_valid_vtable_layout): Remove support for 'r'
fields.
* libguile/vectors.c (scm_vector_copy_partial, scm_vector_to_list)
(scm_vector_move_left_x, scm_vector_move_right_x): Remove generalized
array cases.
* test-suite/tests/vectors.test ("vector->list"): Remove shared array
test
Whippet may add a shrink interface, if it is needed.
* doc/ref/api-memory.texi (Memory Blocks): Remove some 1.8 references.
Remove discussion of scm_gc_malloc. Remove discussion of scm_gc_free.
* libguile/gc.h:
* libguile/gc-malloc.c (scm_gc_malloc): Remove.
* libguile/srfi-14.c (char_ranges_insert, char_ranges_delete): New
helpers.
(scm_i_charset_set, scm_i_charset_set_range, scm_i_charset_unset): Use
the new helpers.
* module/ice-9/atomic.scm: Don't add-interesting-primitive! here.
* module/language/tree-il/primitives.scm
(*interesting-primitive-names*): Instead, import atomics here and
register the primitives as usual. This will let atomics be used earlier
in the boot graph.
* libguile/r6rs-ports.c (grow_byte_buffer, shrink_byte_buffer): New
helpers.
* libguile/r6rs-ports.c (bytevector_output_port_buffer_grow):
(bytevector_output_port_procedure): Use new helpers.
* libguile/gc-malloc.c (do_realloc, do_calloc): Remove.
(scm_gc_malloc): Dispatch to scm_inline_gc_malloc.
(scm_gc_calloc): Dispatch to scm_gc_malloc.
(scm_gc_realloc): Mark for removal. The issue is that the realloc'd
object should have the same kind. We could add Whippet API but it would
be nice to not do that.
* libguile/jit.c (compile_allocate_words_immediate):
(compile_allocate_words_immediate_slow):
(compile_allocate_pointerless_words_immediate):
(compile_allocate_pointerless_words_immediate_slow): Update for new API.
* api/gc-api.h (gc_allocate_small_fast_freelist):
* src/bdw.c (allocate_small): Clear freelist link, so the object is
completely zeroed. In some cases the embedder / compiler / JIT will be
able to elide this write.