Files
gcc/libga68/ga68.map
Pietro Monteiro 28e320717d algol68: Add allocation function for leaf objects
Boehm GC has a malloc_atomic function that doesn't clear the new
allocation and doesn't scan it for pointers.

Add a wrapper for the GC malloc_atomic in the run-time library and use it to
allocate GC-collectable strings in the library.

Change the lowering of malloc on the front end to select the run-time GC malloc
function to be used based on the mode having pointers or not.  Use leaf
allocations for modes that are not refs or that don't contain refs.

A boolean `has_refs' member was added to MOID_T and the computation of the
atrribute is done by the parser when generating the mode list.

gcc/algol68/ChangeLog:

	* a68-low-clauses.cc (a68_lower_collateral_clause): Update
	call to a68_lower_alloca.
	* a68-low-coercions.cc (a68_lower_widening): Likewise.
	* a68-low-generator.cc (allocator_t): Adjust typedef.
	(fill_in_buffer): Adjust call to allocator.
	(gen_mode): Likewise.
	* a68-low-multiples.cc (a68_row_malloc): Change type parameter to MOID_T
	from tree. Adjust call to a68_lower_malloc.
	* a68-low-posix.cc (a68_posix_fgets): Adjust call to a68_row_malloc.
	(a68_posix_gets): Likewise.
	* a68-low-runtime.def (MALLOC_LEAF): Add definition for
	_libga68_malloc_leaf.
	* a68-low-strings.cc (a68_string_concat): Adjust call to
	a68_lower_malloc.
	(a68_string_from_char): Likewise.
	* a68-low-units.cc (a68_lower_slice): Likewise.
	* a68-low.cc (a68_low_dup): Adjust calls to a68_lower_malloc
	and a68_lower_alloca.
	(a68_lower_alloca): Change type parameter to MOID_T from tree.
	(a68_lower_malloc): Likewise. Use _libga68_malloc_leaf if the MOID_T
	doesn't have refs, use _libga68_malloc otherwise.
	* a68-parser-modes.cc (a68_create_mode): Set has_refs on the new mode.
	(is_mode_has_refs): New function.
	(compute_derived_modes): Set has_refs on the chain of modes.
	* a68-parser.cc (a68_new_moid): Set has_refs to false by
	default.
	* a68-types.h (struct MOID_T): Add member `has_refs`.
	(HAS_REFS): New macro.
	* a68.h (a68_row_malloc): Update prototype.
	(a68_lower_alloca): Likewise.
	(a68_lower_malloc): Likewise.

libga68/ChangeLog:

	* ga68-alloc.c (_libga68_malloc_leaf): New function.
	* ga68-posix.c (_libga68_posixfgets): Use _libga68_malloc_leaf
	instead of _libga68_malloc.
	* ga68-unistr.c (_libga68_u32_to_u8): Likewise.
	(_libga68_u8_to_u32): Likewise.
	* ga68.h (_libga68_malloc_leaf): New prototype.
	* ga68.map: Add _libga68_malloc_leaf to the global map.

Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
2026-01-19 19:00:44 -05:00

43 lines
972 B
Plaintext

LIBGA68_2.0 {
global:
_libga68_assert;
_libga68_bitsboundserror;
_libga68_bounds;
_libga68_bounds_mismatch;
_libga68_derefnil;
_libga68_dim;
_libga68_invalidcharerror;
_libga68_longlongrandom;
_libga68_longrandom;
_libga68_lower_bound;
_libga68_malloc;
_libga68_malloc_leaf;
_libga68_posixargc;
_libga68_posixargv;
_libga68_posixclose;
_libga68_posixcreat;
_libga68_posixerrno;
_libga68_posixexit;
_libga68_posixfconnect;
_libga68_posixfgetc;
_libga68_posixfgets;
_libga68_posixfopen;
_libga68_posixfputc;
_libga68_posixfputs;
_libga68_posixfsize;
_libga68_posixgetchar;
_libga68_posixgetenv;
_libga68_posixgets;
_libga68_posixlseek;
_libga68_posixperror;
_libga68_posixputchar;
_libga68_posixputs;
_libga68_posixstrerror;
_libga68_random;
_libga68_u32_cmp2;
_libga68_unreachable;
_libga68_upper_bound;
local:
*;
};