Allows us to inline the "struct scm_dynamic_state", avoiding an untagged
traced allocation.
* libguile/threads-internal.h: New file.
* libguile/Makefile.am (noinst_HEADERS): Add new file.
Adapt all users, notably of SCM_I_CURRENT_THREAD and scm_i_misc_mutex.
Requires a full rebuild!!
* libguile/struct.h (SCM_VTABLE_UNBOXED_FIELDS):
(SCM_VTABLE_FIELD_IS_UNBOXED): Use logbit? to determine if a field is
unboxed.
* module/language/cps/guile-vm/lower-primcalls.scm
(vtable-has-unboxed-fields?): Just check against SCM_INUM0.
(vtable-field-boxed?): Likewise, the bitmask is an integer.
* libguile/struct.c (set_vtable_access_fields): Set UNBOXED_FIELDS
bitmask as integer.
* libguile/struct.c (scm_struct_init_1_default):
(scm_struct_init_1): New helpers.
(scm_struct_init_array): Use new helpers.
(scm_struct_init_list): New function.
(scm_make_struct_no_tail): Use scm_struct_init_list instead of mallocing.
The goal was that, as part of a print operation, all nested prints of
contained data would be able to use the same parameters (e.g. write or
not), and also detect cycles, highlight objects, etc. The mechanism was
a heap-allocated data structure. However, given that:
1. Nobody accessed print states from Scheme
2. `write` and `display` should move to Scheme anyway, in order to be
suspendable
3. The "fancyp" and "highlight" options were unused
4. A simple stack-allocated data structure with a per-thread key could
do the trick just as well, without needing the weird freelist
structure
5. Ports-with-print-states were a source of bugs
In the end we switch print states to be something completely internal to
print.c. There are no more SCM print-state objects, and no more
ports-with-print-state.
* libguile/print.h: Remove print state from API.
* libguile/print.c (struct scm_print_state): Move definition here.
(scm_print_opts): Remove "highlight-prefix" and "highlight-suffix"
options, as they were not used.
(ENTER_NESTED_DATA): Remove "fancyp" case.
(init_print_state_key, get_print_state, push_print_state)
(maybe_push_print_state, pop_print_state): New facility to manage stack
of active print states.
(scm_iprin1, print_vector): No more fancyp.
(iprin1): Access "writingp" member directly. Don't make ports with
print states.
(scm_prin1): Manage print state stack.
(scm_iprlist): No more fancyp.
(scm_valid_oport_value_p): Remove; valid outports are SCM_OPOUTPORTP.
* libguile/backtrace.c:
* libguile/filesys.c:
* libguile/fports.c:
* libguile/goops.c:
* libguile/ioext.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/promises.c:
* libguile/socket.c:
* libguile/struct.c: Remove cases that dealt with
ports-with-print-states.
* libguile/private-options.h: Remove highlight options.
* module/ice-9/ports.scm (inherit-print-state): Deprecate.
* libguile/deprecated.c:
* libguile/deprecated.h: Add deprecation shims for print states, as far
as that is possible.
* configure.ac: Remove code to detect BDW, that is taken care of by the
whippet macros. Remove support for ia64, for the moment at least,
perhaps for good.
* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS):
Remove BDW cflags.
(modinclude_HEADERS): Remove bdw-gc.h.
* libguile/bdw-gc.h: Remove.
* libguile/fluids.c:
* libguile/hashtab.c:
* libguile/numbers.c:
* libguile/smob.c:
* libguile/srfi-4.c:
* libguile/struct.c:
* libguile/vectors.c:
* libguile/vm.c: Remove bdw-gc.h includes.
* meta/guile-4.0-uninstalled.pc.in (Libs):
* meta/guile-4.0.pc.in (Libs): Remove direct dependency on BDW-GC, as it
is all encapsulated through Whippet, which is not publically exposed.
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
As the FSF advises, 'There is no legal significance to using the
three-character sequence “(C)”, but it does no harm.' It does take up
space though! For that reason, we remove it here from our C files.
* libguile/bytevectors.h: Include uniform.h, for use in the macros.
* libguile/extensions.h: Include libpath.h, for the
SCM_EFFECTIVE_VERSION, which is almost always used with these
routines.
* libguile/frames.h:
* libguile/instructions.h:
* libguile/intrinsics.h:
* libguile/loader.h:
* libguile/programs.h:
* libguile/vm.h: Include <libguile/__scm.h> instead of <libguile.h>.
Cuts a circular include, but also precipitates a lot of maintenance in
the .c files.
* libguile/*.c: Update C files to add needed all needed includes that
before were getting automatically pulled in by the indirect inclusion
of libguile.h.
* libguile/struct.h (SCM_VTABLE_BASE_LAYOUT): Layout is a "pr" field.
* module/ice-9/boot-9.scm (record-type-vtable): Record vtable fields are
writable.
(<parameter>): "pw" fields.
* module/oop/goops.scm (<class>, %compute-layout): <read-only> fields
are "pw" underneath.
* module/rnrs/records/procedural.scm (record-type-vtable)
(record-constructor-vtable, make-record-type-descriptor): Use "pw"
fields in vtables.
* module/srfi/srfi-35.scm (%condition-type-vtable)
(struct-layout-for-condition): "pw" fields in vtables.
* test-suite/tests/goops.test:
* test-suite/tests/structs.test: Use "pw" fields only.
* benchmark-suite/benchmarks/structs.bm: Update for make-struct/no-tail,
to use pw fields, and also to remove useless tests that the compiler
would optimize away.
* doc/ref/api-data.texi (Vtables): Add a note about the now-vestigial
permissions character and update documentation.
(Structure Basics, Meta-Vtables): Update examples.
* libguile/hash.c (scm_i_struct_hash): Remove code that would handle
opaque/self fields.
* libguile/print.h (SCM_PRINT_STATE_LAYOUT): Use "pw" fields.
* libguile/struct.c (scm_struct_init): Simplify check for hidden
fields.
* libguile/values.c (scm_init_values): Field is "pw".
* libguile/struct.c (scm_make_struct_layout): Remove support for opaque
slots.
(set_vtable_layout_flags): Remove opaque slots, and make the "switch"
total.
(scm_is_valid_vtable_layout): Remove opaque slots.
(scm_struct_ref, scm_struct_set_x): Remove case for opaque slots.
* libguile/struct.c (scm_make_struct): Remove support for tail arrays
and self slots.
(set_vtable_layout_flags): Always initialize the nfields member.
(scm_is_valid_vtable_layout): Remove support for tail arrays and self
slots.
(scm_i_struct_inherit_vtable_magic): No need to issue deprecation
warning for self slots, as they are no longer supported.
(scm_struct_init): Remove support for tail arrays and self slots.
(scm_c_make_structv): Throw an exception if n_tail is not 0.
(scm_allocate_struct): Adapt to scm_struct_init change.
(scm_i_make_vtable_vtable): Initialize slots manually, to avoid
relying on an already-initialized nfields member.
(scm_struct_ref, scm_struct_set_x): Simplify.
* module/oop/goops.scm: As we now rely on nfields being valid, when
recalculating slots during boot we need to avoid resetting nfields of
<class>, even temporarily, as that would prevent any further access to
<class>!
* libguile/print.h (SCM_PRINT_STATE_LAYOUT): Use a normal slot instead
of a self slot.
* libguile/print.c (make_print_state): Initialize "handle" slot
manually.
* libguile/struct.c (issue_deprecation_warning_for_self_slots): New
helper, called when making vtables to issue deprecation warnings for
"self" slots. Avoids warning for the "self" slot that's part of the
fixed vtable slots.
(scm_i_struct_inherit_vtable_magic): Call
issue_deprecation_warning_for_self_slots.
* doc/ref/api-data.texi (Vtables, Structure Basics): Remove references
to self slots.
* NEWS: Add entry.
* libguile/struct.c: Replace uses of scm_make_struct with
scm_make_struct_no_tail or scm_c_make_struct.
(scm_make_struct_no_tail): Move this function to C instead of Scheme
to be able to deprecate scm_make_struct.
* libguile/struct.h (scm_make_struct_no_tail): New public declaration.
* libguile/deprecated.h:
* libguile/deprecated.c (scm_make_struct): Deprecate.
* libguile/print.c:
* libguile/procs.c:
* libguile/stacks.c: Replace uses of scm_make_struct with
scm_make_struct_no_tail.
* test-suite/tests/coverage.test:
* test-suite/tests/structs.test: Use make-struct/no-tail instead of
make-struct.
* NEWS: Add entry.
* libguile/gc.c (scm_storage_prehistory): Register struct displacement
here.
* libguile/goops.c (scm_sys_modify_instance): Fix the format of a
comment.
* libguile/modules.c (scm_post_boot_init_modules): Update for new format
of struct vtable references.
* libguile/struct.c (scm_i_alloc_struct): Update to include slots
directly, instead of being indirected by an embedded pointer.
(scm_c_make_structv, scm_allocate_struct, scm_i_make_vtable_vtable):
Adapt to pass vtable bits as argument to scm_i_alloc_struct, not
vtable data bits.
(scm_init_struct): Remove two-word displacement from libgc.
* libguile/struct.h: Update comment.
(SCM_STRUCT_SLOTS, SCM_STRUCT_DATA): Update definitions.
(SCM_STRUCT_VTABLE_DATA, SCM_STRUCT_VTABLE_SLOTS): Remove.
(SCM_STRUCT_VTABLE, SCM_STRUCT_LAYOUT, SCM_STRUCT_PRINTER)
(SCM_STRUCT_FINALIZER, SCM_STRUCT_VTABLE_FLAGS)
(SCM_STRUCT_VTABLE_FLAG_IS_SET): Simplify definitions.
* module/system/base/types.scm (cell->object, address->inferior-struct):
Adapt to struct representation change.
* libguile/struct.c (scm_init_struct): Use scm_from_latin1_string to
avoid locale-dependency for what is really a latin1 string. Also
avoids an early dependency on the default port conversion handler,
though I wonder if using port conversion handlers in strings is the
right thing.
* 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.
* libguile/struct.h:
* libguile/struct.c (scm_allocate_struct): New interface: allocates a
struct.
* libguile/vm-engine.c (allocate_struct): Instead of make-struct with a
rest arg, separate allocation from initialization.