]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
algol68: Add allocation function for leaf objects
authorPietro Monteiro <pietro@sociotechnical.xyz>
Tue, 20 Jan 2026 00:00:44 +0000 (19:00 -0500)
committerPietro Monteiro <pietro@sociotechnical.xyz>
Tue, 20 Jan 2026 00:00:44 +0000 (19:00 -0500)
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>
18 files changed:
gcc/algol68/a68-low-clauses.cc
gcc/algol68/a68-low-coercions.cc
gcc/algol68/a68-low-generator.cc
gcc/algol68/a68-low-multiples.cc
gcc/algol68/a68-low-posix.cc
gcc/algol68/a68-low-runtime.def
gcc/algol68/a68-low-strings.cc
gcc/algol68/a68-low-units.cc
gcc/algol68/a68-low.cc
gcc/algol68/a68-parser-modes.cc
gcc/algol68/a68-parser.cc
gcc/algol68/a68-types.h
gcc/algol68/a68.h
libga68/ga68-alloc.c
libga68/ga68-posix.c
libga68/ga68-unistr.c
libga68/ga68.h
libga68/ga68.map

index 20ab22929bc084fa857a2c54db78311f936480bd..26607d7f42297c2bc4d294180c9ad9d153b6828c 100644 (file)
@@ -1246,6 +1246,7 @@ a68_lower_collateral_clause (NODE_T *p ATTRIBUTE_UNUSED,
                  tree sub_multiple_elements = a68_multiple_elements (sub_multiple);
                  tree elements_pointer_type = TREE_TYPE (sub_multiple_elements);
                  tree elements_type = TREE_TYPE (elements_pointer_type);
+                 MOID_T *elements_moid = a68_type_moid (elements_type);
                  multiple_elements_size = fold_build2 (MULT_EXPR, sizetype,
                                                             size_int (num_units),
                                                             size_in_bytes (elements_type));
@@ -1254,7 +1255,7 @@ a68_lower_collateral_clause (NODE_T *p ATTRIBUTE_UNUSED,
                                                        a68_multiple_num_elems (sub_multiple));
                  multiple_elements = a68_lower_tmpvar ("multiple_elements%",
                                                        elements_pointer_type,
-                                                       a68_lower_alloca (elements_type,
+                                                       a68_lower_alloca (elements_moid,
                                                                          multiple_elements_size));
 
                  /* We can also now calculate the bounds of the new multiple.
index b9e1acee9ce8b7011488a55a5c3423860c4ed391..3941917223f0d027c928703bcea394e5dba7c522 100644 (file)
@@ -350,7 +350,7 @@ a68_lower_widening (NODE_T *p, LOW_CTX_T ctx)
       /* First allocate space for the elements.  */
       tree elements = a68_lower_tmpvar ("elements%",
                                        pointer_to_bool_type,
-                                       a68_lower_alloca (a68_bool_type,
+                                       a68_lower_alloca (M_BOOL,
                                                          fold_build2 (MULT_EXPR,
                                                                       sizetype,
                                                                       size_int (bits_size),
index 5c4d65569b37b6594fa8220562903473c891c882..e321b7d5ec28ab52b89a170c55a174ea602ea765 100644 (file)
@@ -43,7 +43,7 @@
 #include "a68.h"
 
 
-typedef tree (*allocator_t) (tree, tree);
+typedef tree (*allocator_t) (MOID_T*, tree);
 
 /* Lower to code that fill in BOUNDS and elements pointers in the given buffer
    pointed by BUFFER at offset OFFSET according to the mode MODE, and evals to
@@ -205,7 +205,7 @@ fill_in_buffer (tree buffer, tree offset, tree_stmt_iterator *bounds, MOID_T *m,
       MOID_T *elem_mode = SUB (m);
       tree elem_size = fold_convert (sizetype, size_in_bytes (CTYPE (elem_mode)));
       tree elems_size = save_expr (fold_build2 (MULT_EXPR, sizetype, elem_size, num_elems));
-      tree elemsptr = (*allocator) (CTYPE (elem_mode), elems_size);
+      tree elemsptr = (*allocator) (elem_mode, elems_size);
       elemsptr = save_expr (elemsptr);
 
       /* And initialize them.  */
@@ -337,7 +337,7 @@ static tree
 gen_mode (MOID_T *m, tree_stmt_iterator *bounds, allocator_t allocator)
 {
   /* Allocate space for the value and fill it.  */
-  tree buffer = (*allocator) (CTYPE (m), size_in_bytes (CTYPE (m)));
+  tree buffer = (*allocator) (m, size_in_bytes (CTYPE (m)));
   buffer = save_expr (buffer);
   return fill_in_buffer (buffer, size_zero_node, bounds, m, allocator);
 }
index 572162e30acac11f00c43307b2fc25f41ff48085..bcaa4c28074c36a49a59070da12db5f5c9fe72ed 100644 (file)
@@ -1074,16 +1074,17 @@ a68_multiple_bounds_check_equal (NODE_T *p, tree m1, tree m2)
    *LOWER_BOUND and *UPPER_BOUND are the bounds for the DIM dimensions.  */
 
 tree
-a68_row_malloc (tree type, int dim, tree elems, tree elems_size,
+a68_row_malloc (MOID_T *m, int dim, tree elems, tree elems_size,
                tree *lower_bound, tree *upper_bound)
 {
+  tree type = CTYPE (m);
   tree ptr_to_type = build_pointer_type (type);
 
   a68_push_range (NULL);
 
   /* Allocate space for the descriptor.  */
   tree ptr_to_multiple = a68_lower_tmpvar ("ptr_to_multiple%", ptr_to_type,
-                                          a68_lower_malloc (type, size_in_bytes (type)));
+                                          a68_lower_malloc (m, size_in_bytes (type)));
   tree multiple = a68_row_value (type, dim,
                                 elems, elems_size,
                                 lower_bound, upper_bound);
index 1a9d5eb1b6315014c711da48ad00d5c4aa384262..c0fd947fdb4b77a5e01cc9db2e4cbb5e252b7938 100644 (file)
@@ -503,7 +503,7 @@ a68_posix_fgets (void)
       tree upper_bound = fold_convert (ssizetype, len);
       tree elems_size = fold_build2 (MULT_EXPR, sizetype,
                                     len, size_in_bytes (a68_char_type));
-      tree body = a68_row_malloc (CTYPE (M_STRING), 1 /* dim */,
+      tree body = a68_row_malloc (M_STRING, 1 /* dim */,
                                  elems, elems_size,
                                  &lower_bound, &upper_bound);
       a68_pop_function_range (body);
@@ -545,7 +545,7 @@ a68_posix_gets (void)
       tree upper_bound = fold_convert (ssizetype, len);
       tree elems_size = fold_build2 (MULT_EXPR, sizetype,
                                     len, size_in_bytes (a68_char_type));
-      tree body = a68_row_malloc (CTYPE (M_STRING), 1 /* dim */,
+      tree body = a68_row_malloc (M_STRING, 1 /* dim */,
                                  elems, elems_size,
                                  &lower_bound, &upper_bound);
       a68_pop_function_range (body);
index ecb8553238d1e43e4907ac700428e7a36569f2f6..326e4d00bc9f60a23993b33adf8d3c6e5d96c4b9 100644 (file)
@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3.  If not see
 
 DEF_A68_RUNTIME (ASSERT, "_libga68_assert", RT(VOID), P2(CONSTCHARPTR, UINT), ECF_NORETURN)
 DEF_A68_RUNTIME (MALLOC, "_libga68_malloc", RT(VOIDPTR), P1(SIZE), ECF_NOTHROW | ECF_LEAF | ECF_MALLOC)
+DEF_A68_RUNTIME (MALLOC_LEAF, "_libga68_malloc_leaf", RT(VOIDPTR), P1(SIZE), ECF_NOTHROW | ECF_LEAF | ECF_MALLOC)
 DEF_A68_RUNTIME (DEREFNIL, "_libga68_derefnil", RT(VOID), P2(CONSTCHARPTR, UINT), ECF_NORETURN)
 DEF_A68_RUNTIME (UNREACHABLE, "_libga68_unreachable", RT(VOID), P2(CONSTCHARPTR, UINT), ECF_NORETURN)
 DEF_A68_RUNTIME (INVALIDCHARERROR, "_libga68_invalidcharerror", RT(VOID), P3(CONSTCHARPTR,UINT,INT), ECF_NORETURN)
index f5822037e33b9595ac7493da4076ac92b0c8d46c..5af83bf944ddd56f313382e95fd494c9618df973 100644 (file)
@@ -149,7 +149,7 @@ a68_string_concat (tree str1, tree str2)
                                        size_in_bytes (a68_char_type),
                                        num_elems);
       tree elements = a68_lower_tmpvar ("elements%", char_pointer_type,
-                                       a68_lower_malloc (a68_char_type, elements_size));
+                                       a68_lower_malloc (M_CHAR, elements_size));
 
       /* Copy elements.  */
       tree to_index = a68_lower_tmpvar ("to_index%", sizetype, size_zero_node);
@@ -234,7 +234,7 @@ a68_string_from_char (tree c)
   a68_push_range (M_STRING);
 
   tree elements = a68_lower_tmpvar ("elements%", char_pointer_type,
-                                   a68_lower_malloc (a68_char_type,
+                                   a68_lower_malloc (M_CHAR,
                                                      size_one_node));
   a68_add_stmt (fold_build2 (MODIFY_EXPR,
                             void_type_node,
index 9802468873b28eb1abb4e31ff76bfa66a32cb61b..caaa5bb27acf676465e3bb4c8679b49a3dbad545 100644 (file)
@@ -778,7 +778,7 @@ a68_lower_slice (NODE_T *p, LOW_CTX_T ctx)
        {
          tree ptrtype = CTYPE (orig_sliced_multiple_mode);
          tree slice_addr = fold_build1 (ADDR_EXPR, ptrtype, slice);
-         tree alloc = a68_lower_malloc (ptrtype, size_in_bytes (TREE_TYPE (slice)));
+         tree alloc = a68_lower_malloc (orig_sliced_multiple_mode, size_in_bytes (TREE_TYPE (slice)));
          alloc = save_expr (alloc);
          tree copy = a68_lower_memcpy (alloc, slice_addr, size_in_bytes (TREE_TYPE (slice)));
 
index ac603ef13e79731bcc0bfe250909ae5d1a02c92d..d13e28a0fc8c2519ea94881220173143d8389b21 100644 (file)
@@ -741,12 +741,14 @@ a68_low_dup (tree expr, bool use_heap)
       tree element_pointer_type = TREE_TYPE (elements);
       tree element_type = TREE_TYPE (element_pointer_type);
       tree new_elements_size = save_expr (a68_multiple_elements_size (expr));
+      tree new_elements_type = TREE_TYPE (TREE_TYPE (elements));
+      MOID_T *new_elements_moid = a68_type_moid (new_elements_type);
       tree new_elements = a68_lower_tmpvar ("new_elements%",
                                            TREE_TYPE (elements),
                                            (use_heap
-                                            ? a68_lower_malloc (TREE_TYPE (TREE_TYPE (elements)),
+                                            ? a68_lower_malloc (new_elements_moid,
                                                                 new_elements_size)
-                                            : a68_lower_alloca (TREE_TYPE (TREE_TYPE (elements)),
+                                            : a68_lower_alloca (new_elements_moid,
                                                                 new_elements_size)));
 
       /* Then copy the elements.
@@ -1110,8 +1112,9 @@ a68_lower_memcpy (tree dst, tree src, tree size)
    pointer to it.  */
 
 tree
-a68_lower_alloca (tree type, tree size)
+a68_lower_alloca (MOID_T *m, tree size)
 {
+  tree type = CTYPE (m);
   tree call = builtin_decl_explicit (BUILT_IN_ALLOCA_WITH_ALIGN);
   call = build_call_expr_loc (UNKNOWN_LOCATION, call, 2,
                              size,
@@ -1121,14 +1124,17 @@ a68_lower_alloca (tree type, tree size)
 }
 
 
-/* Build a tree that allocates SIZE bytes on the heap and returns a *TYPE
-   pointer to it.  */
+/* Build a tree that allocates SIZE bytes on the heap and returns a pointer to
+   a tree with type equivalent to mode M.  */
 
 tree
-a68_lower_malloc (tree type, tree size)
+a68_lower_malloc (MOID_T *m, tree size)
 {
+  tree type = CTYPE (m);
+  a68_libcall_fn libcall
+    = (HAS_REFS (m) || HAS_ROWS (m)) ? A68_LIBCALL_MALLOC : A68_LIBCALL_MALLOC_LEAF;
   return fold_convert (build_pointer_type (type),
-                      a68_build_libcall (A68_LIBCALL_MALLOC, ptr_type_node,
+                      a68_build_libcall (libcall, ptr_type_node,
                                          1, size));
 }
 
index 6b96fa2033b68ff4c0ba12aae6a0f769440ba173..5842d1325f03a16b3e65a71e1727613935410e85 100644 (file)
@@ -175,6 +175,7 @@ a68_create_mode (int att, int dim, NODE_T *node, MOID_T *sub, PACK_T *pack)
   DIM (new_mode) = dim;
   NODE (new_mode) = node;
   HAS_ROWS (new_mode) = (att == ROW_SYMBOL);
+  HAS_REFS (new_mode) = (att == REF_SYMBOL);
   SUB (new_mode) = sub;
   PACK (new_mode) = pack;
   NEXT (new_mode) = NO_MOID;
@@ -1033,6 +1034,30 @@ is_mode_has_row (MOID_T *m)
     return (HAS_ROWS (m) || IS_ROW (m) || IS_FLEX (m));
 }
 
+/* Whether mode has ref.  */
+
+static bool
+is_mode_has_refs (MOID_T *m)
+{
+  if (IS_ROW (m) || IS_FLEX (m))
+    {
+      HAS_REFS (m) = is_mode_has_refs (SUB (m));
+      return HAS_REFS (m);
+    }
+  else if (IS_STRUCT (m) || IS_UNION (m))
+    {
+      bool has_refs = false;
+      for (PACK_T *p = PACK (m); p != NO_PACK; FORWARD (p))
+       {
+         HAS_REFS (MOID (p)) = is_mode_has_refs (MOID (p));
+         has_refs |= HAS_REFS (MOID (p));
+       }
+      return has_refs;
+    }
+  else
+    return HAS_REFS (m);
+}
+
 /* Compute derived modes.  */
 
 static void
@@ -1181,9 +1206,12 @@ compute_derived_modes (MODULE_T *mod)
 
   gcc_assert (M_STRING == M_FLEX_ROW_CHAR);
 
-  /* Find out what modes contain rows.  */
+  /* Find out what modes contain rows, and refs.  */
   for (z = TOP_MOID (mod); z != NO_MOID; FORWARD (z))
-    HAS_ROWS (z) = is_mode_has_row (z);
+    {
+      HAS_ROWS (z) = is_mode_has_row (z);
+      HAS_REFS (z) = is_mode_has_refs (z);
+    }
 
   /* Check flexible modes.  */
   for (z = TOP_MOID (mod); z != NO_MOID; FORWARD (z))
index 725a8fc44decf9dc1423311e87d5374100193597..1504e4dc25bdd3e206eaff68d0682b8e6a5f188d 100644 (file)
@@ -726,6 +726,7 @@ a68_new_moid (void)
   DIM (z) = 0;
   USE (z) = false;
   HAS_ROWS (z) = false;
+  HAS_REFS (z) = false;
   PORTABLE (z) = true;
   DERIVATE (z) = false;
   NODE (z) = NO_NODE;
index 788e7230f928129676944678b399c2513490c781..f18d3501799108f0bc23174e18c163807f4709da 100644 (file)
@@ -187,6 +187,9 @@ struct GTY((chain_next ("%h.more"), chain_prev ("%h.less"))) KEYWORD_T
    HAS_ROWS is true if the mode contains rows somewhere in its internal
    structure.
 
+   HAS_REFS is true if the mode contains refs somewhere in its internal
+   structure.
+
    The interpretation of SUB depends on the kind of mode:
    - For REF modes it is the referred mode.
    - For FLEX modes it is the referred mode.
@@ -244,7 +247,7 @@ struct GTY((chain_next ("%h.next"))) MOID_T
   int number;
   int attribute;
   int dim;
-  bool has_rows, use, portable, derivate;
+  bool has_rows, has_refs, use, portable, derivate;
   NODE_T *node;
   PACK_T *pack;
   MOID_T *sub, *equivalent_mode, *slice, *deflexed_mode, *name, *multiple_mode, *next, *rowed, *trim;
@@ -950,6 +953,7 @@ struct GTY(()) A68_T
 #define GREEN(p) ((p)->green)
 #define H(p) ((p)->h)
 #define HANDLE(p) ((p)->handle)
+#define HAS_REFS(p) ((p)->has_refs)
 #define HAS_ROWS(p) ((p)->has_rows)
 #define HEAP(p) ((p)->heap)
 #define ID(p) ((p)->id)
index 7c6d51bd0646c9d0798a7065727b6bc9ce08fa7b..34090d12c053af84b4a6e8fb458a6ea5c7776ddf 100644 (file)
@@ -699,9 +699,9 @@ tree a68_row_value (tree type, size_t dim,
                    tree *lower_bound, tree *upper_bound);
 tree a68_row_value_raw (tree type, tree descriptor,
                        tree elements, tree elements_size);
-tree a68_row_malloc (tree type, int dim,
+tree a68_row_malloc (MOID_T *m, int dim,
                    tree elements, tree elements_size,
-                   tree *lower_bound, tree *upper_bound);                   
+                   tree *lower_bound, tree *upper_bound);
 tree a68_multiple_slice (NODE_T *p, tree multiple, bool slicing_name,
                         int num_indexes, tree *indexes);
 tree a68_multiple_copy_elems (MOID_T *to_mode, tree to, tree from);
@@ -815,8 +815,8 @@ tree a68_get_skip_tree (MOID_T *m);
 tree a68_get_empty (void);
 void a68_ref_counts (tree exp, MOID_T *m, int *num_refs, int *num_pointers);
 tree a68_consolidate_ref (MOID_T *m, tree expr);
-tree a68_lower_alloca (tree type, tree size);
-tree a68_lower_malloc (tree type, tree size);
+tree a68_lower_alloca (MOID_T *m, tree size);
+tree a68_lower_malloc (MOID_T *m, tree size);
 tree a68_checked_indirect_ref (NODE_T *p, tree exp, MOID_T *exp_mode);
 tree a68_low_deref (tree exp, NODE_T *p);
 tree a68_low_dup (tree exp, bool use_heap = false);
index 1a0b25a098cb27ef431d1a48cafa23959a53c2de..df8a8956c52f81d5a80bb820e9c84b4909982e18 100644 (file)
@@ -80,6 +80,15 @@ _libga68_malloc (size_t size)
   return res;
 }
 
+void *
+_libga68_malloc_leaf (size_t size)
+{
+  void *res = (void *) GC_MALLOC_ATOMIC (size);
+  if (!res)
+    _libga68_abort ("Virtual memory exhausted\n");
+  return res;
+}
+
 #else
 
 void
@@ -112,4 +121,10 @@ _libga68_malloc (size_t size)
   return res;
 }
 
+void *
+_libga68_malloc_leaf (size_t size)
+{
+  return _libga68_malloc (size);
+}
+
 #endif /* !LIBGA68_WITH_GC */
index a671dd61d16c463a32017a91ad3f5c40d5d64819..b6fba20249773971477b260f08bf51cd765b9478 100644 (file)
@@ -322,7 +322,7 @@ _libga68_posixfgets (int fd, int nchars, size_t *len)
   if (nchars > 0)
     {
       /* Read exactly nchar or until EOF.  */
-      res = _libga68_malloc (nchars * sizeof (uint32_t));
+      res = _libga68_malloc_leaf (nchars * sizeof (uint32_t));
       do
        {
          uc = _libga68_posixfgetc (fd);
@@ -336,7 +336,7 @@ _libga68_posixfgets (int fd, int nchars, size_t *len)
     {
       /* Read until newline or EOF.  */
       size_t allocated = 80 * sizeof (uint32_t);
-      res = _libga68_malloc (allocated);
+      res = _libga68_malloc_leaf (allocated);
       do
        {
          uc = _libga68_posixfgetc (fd);
index 2cdf732a6b2b8a8bd0fd906d0df519d1386ff568..2a71313c181bb78c589f16624444821b26c58528 100644 (file)
@@ -363,7 +363,7 @@ _libga68_u32_to_u8 (const uint32_t *s, size_t n, size_t stride,
           if (length + 6 > allocated)
             allocated = length + 6;
           if (result == resultbuf || result == NULL)
-           memory = (uint8_t *) _libga68_malloc (allocated * sizeof (uint8_t));
+           memory = (uint8_t *) _libga68_malloc_leaf (allocated * sizeof (uint8_t));
           else
            memory =
              (uint8_t *) _libga68_realloc (result, allocated * sizeof (uint8_t));
@@ -384,7 +384,7 @@ _libga68_u32_to_u8 (const uint32_t *s, size_t n, size_t stride,
       if (result == NULL)
         {
           /* Return a non-NULL value.  NULL means error.  */
-          result = (uint8_t *) _libga68_malloc (1);
+         result = (uint8_t *) _libga68_malloc_leaf (1);
           if (result == NULL)
             {
               errno = ENOMEM;
@@ -580,7 +580,7 @@ _libga68_u8_to_u32 (const uint8_t *s, size_t n, uint32_t *resultbuf, size_t *len
           if (length + 1 > allocated)
             allocated = length + 1;
           if (result == resultbuf || result == NULL)
-           memory = (uint32_t *) _libga68_malloc (allocated * sizeof (uint32_t));
+           memory = (uint32_t *) _libga68_malloc_leaf (allocated * sizeof (uint32_t));
           else
            memory =
              (uint32_t *) _libga68_realloc (result, allocated * sizeof (uint32_t));
@@ -598,7 +598,7 @@ _libga68_u8_to_u32 (const uint8_t *s, size_t n, uint32_t *resultbuf, size_t *len
       if (result == NULL)
         {
           /* Return a non-NULL value.  NULL means error.  */
-          result = (uint32_t *) _libga68_malloc (1);
+         result = (uint32_t *) _libga68_malloc_leaf (1);
         }
     }
   else if (result != resultbuf && length < allocated)
index 008ce05282a44cb187f364ca147f76c261e6acd1..8d1cf20c16280622cc56a31d78b2e6d8884e979a 100644 (file)
@@ -70,6 +70,7 @@ void _libga68_bounds_mismatch (const char *filename, unsigned int lineno,
 
 void _libga68_init_heap (void) GA68_HIDDEN;
 void *_libga68_malloc (size_t size);
+void *_libga68_malloc_leaf (size_t size);
 void *_libga68_malloc_internal (size_t size) GA68_HIDDEN;
 void *_libga68_realloc (void *ptr, size_t size) GA68_HIDDEN;
 void *_libga68_realloc_unchecked (void *ptr, size_t size) GA68_HIDDEN;
index 6917e7905aecfa93ceb91792fba12ef0be0d190b..6ee93228358fd36c5355321ff0b3f14ccf302043 100644 (file)
@@ -11,6 +11,7 @@ LIBGA68_2.0 {
     _libga68_longrandom;
     _libga68_lower_bound;
     _libga68_malloc;
+    _libga68_malloc_leaf;
     _libga68_posixargc;
     _libga68_posixargv;
     _libga68_posixclose;