bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

alloca: Remove Cray-2 and Cray Y-MP support


From: Bruno Haible
Subject: alloca: Remove Cray-2 and Cray Y-MP support
Date: Sun, 26 Jul 2020 11:53:45 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-179-generic; KDE/5.18.0; x86_64; ; )

The 'alloca' module has a bunch of code for Cray-2 and Cray Y-MP
machines. These machines had a peak performance of 2 GFLOPS and
2.667 GFLOPS, respectively, [1][2] that is, less than half of
the performance of a Pentium 4 in 2004 [3]. You can therefore bet
that no one is using such a machine (outside of museums) any more.

[1] https://en.wikipedia.org/wiki/Cray-2
[2] https://en.wikipedia.org/wiki/Cray_Y-MP
[3] https://www.alternatewars.com/BBOW/Computing/Computing_Power.htm


2020-07-26  Bruno Haible  <bruno@clisp.org>

        alloca: Remove Cray-2 and Cray Y-MP support.
        * m4/alloca.m4 (_AC_LIBOBJ_ALLOCA): Don't define CRAY_STACKSEG_END.
        Enable also on Autoconf >= 2.69.
        * lib/alloca.c (ADDRESS_FUNCTION, struct stack_control_header,
        struct stack_segment_linkage, struct stk_stat, struct stk_trailer,
        i00afunc): Remove.

diff --git a/lib/alloca.c b/lib/alloca.c
index d0476d5..cdaf466 100644
--- a/lib/alloca.c
+++ b/lib/alloca.c
@@ -62,16 +62,6 @@ lose
 #   endif /* static */
 #  endif /* emacs */
 
-/* If your stack is a linked list of frames, you have to
-   provide an "address metric" ADDRESS_FUNCTION macro.  */
-
-#  if defined (CRAY) && defined (CRAY_STACKSEG_END)
-long i00afunc ();
-#   define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
-#  else
-#   define ADDRESS_FUNCTION(arg) &(arg)
-#  endif
-
 /* Define STACK_DIRECTION if you know the direction of stack
    growth for your system; otherwise it will be automatically
    deduced at run-time.
@@ -140,7 +130,7 @@ void *
 alloca (size_t size)
 {
   auto char probe;              /* Probes stack depth: */
-  register char *depth = ADDRESS_FUNCTION (probe);
+  register char *depth = &probe;
 
 #  if STACK_DIRECTION == 0
   if (STACK_DIR == 0)           /* Unknown growth direction.  */
@@ -206,273 +196,5 @@ alloca (size_t size)
   }
 }
 
-#  if defined (CRAY) && defined (CRAY_STACKSEG_END)
-
-#   ifdef DEBUG_I00AFUNC
-#    include <stdio.h>
-#   endif
-
-#   ifndef CRAY_STACK
-#    define CRAY_STACK
-#    ifndef CRAY2
-/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
-struct stack_control_header
-  {
-    long shgrow:32;             /* Number of times stack has grown.  */
-    long shaseg:32;             /* Size of increments to stack.  */
-    long shhwm:32;              /* High water mark of stack.  */
-    long shsize:32;             /* Current size of stack (all segments).  */
-  };
-
-/* The stack segment linkage control information occurs at
-   the high-address end of a stack segment.  (The stack
-   grows from low addresses to high addresses.)  The initial
-   part of the stack segment linkage control information is
-   0200 (octal) words.  This provides for register storage
-   for the routine which overflows the stack.  */
-
-struct stack_segment_linkage
-  {
-    long ss[0200];              /* 0200 overflow words.  */
-    long sssize:32;             /* Number of words in this segment.  */
-    long ssbase:32;             /* Offset to stack base.  */
-    long:32;
-    long sspseg:32;             /* Offset to linkage control of previous
-                                   segment of stack.  */
-    long:32;
-    long sstcpt:32;             /* Pointer to task common address block.  */
-    long sscsnm;                /* Private control structure number for
-                                   microtasking.  */
-    long ssusr1;                /* Reserved for user.  */
-    long ssusr2;                /* Reserved for user.  */
-    long sstpid;                /* Process ID for pid based multi-tasking.  */
-    long ssgvup;                /* Pointer to multitasking thread giveup.  */
-    long sscray[7];             /* Reserved for Cray Research.  */
-    long ssa0;
-    long ssa1;
-    long ssa2;
-    long ssa3;
-    long ssa4;
-    long ssa5;
-    long ssa6;
-    long ssa7;
-    long sss0;
-    long sss1;
-    long sss2;
-    long sss3;
-    long sss4;
-    long sss5;
-    long sss6;
-    long sss7;
-  };
-
-#    else /* CRAY2 */
-/* The following structure defines the vector of words
-   returned by the STKSTAT library routine.  */
-struct stk_stat
-  {
-    long now;                   /* Current total stack size.  */
-    long maxc;                  /* Amount of contiguous space which would
-                                   be required to satisfy the maximum
-                                   stack demand to date.  */
-    long high_water;            /* Stack high-water mark.  */
-    long overflows;             /* Number of stack overflow ($STKOFEN) calls.  
*/
-    long hits;                  /* Number of internal buffer hits.  */
-    long extends;               /* Number of block extensions.  */
-    long stko_mallocs;          /* Block allocations by $STKOFEN.  */
-    long underflows;            /* Number of stack underflow calls ($STKRETN). 
 */
-    long stko_free;             /* Number of deallocations by $STKRETN.  */
-    long stkm_free;             /* Number of deallocations by $STKMRET.  */
-    long segments;              /* Current number of stack segments.  */
-    long maxs;                  /* Maximum number of stack segments so far.  */
-    long pad_size;              /* Stack pad size.  */
-    long current_address;       /* Current stack segment address.  */
-    long current_size;          /* Current stack segment size.  This
-                                   number is actually corrupted by STKSTAT to
-                                   include the fifteen word trailer area.  */
-    long initial_address;       /* Address of initial segment.  */
-    long initial_size;          /* Size of initial segment.  */
-  };
-
-/* The following structure describes the data structure which trails
-   any stack segment.  I think that the description in 'asdef' is
-   out of date.  I only describe the parts that I am sure about.  */
-
-struct stk_trailer
-  {
-    long this_address;          /* Address of this block.  */
-    long this_size;             /* Size of this block (does not include
-                                   this trailer).  */
-    long unknown2;
-    long unknown3;
-    long link;                  /* Address of trailer block of previous
-                                   segment.  */
-    long unknown5;
-    long unknown6;
-    long unknown7;
-    long unknown8;
-    long unknown9;
-    long unknown10;
-    long unknown11;
-    long unknown12;
-    long unknown13;
-    long unknown14;
-  };
-
-#    endif /* CRAY2 */
-#   endif /* not CRAY_STACK */
-
-#   ifdef CRAY2
-/* Determine a "stack measure" for an arbitrary ADDRESS.
-   I doubt that "lint" will like this much.  */
-
-static long
-i00afunc (long *address)
-{
-  struct stk_stat status;
-  struct stk_trailer *trailer;
-  long *block, size;
-  long result = 0;
-
-  /* We want to iterate through all of the segments.  The first
-     step is to get the stack status structure.  We could do this
-     more quickly and more directly, perhaps, by referencing the
-     $LM00 common block, but I know that this works.  */
-
-  STKSTAT (&status);
-
-  /* Set up the iteration.  */
-
-  trailer = (struct stk_trailer *) (status.current_address
-                                    + status.current_size
-                                    - 15);
-
-  /* There must be at least one stack segment.  Therefore it is
-     a fatal error if "trailer" is null.  */
-
-  if (trailer == NULL)
-    abort ();
-
-  /* Discard segments that do not contain our argument address.  */
-
-  while (trailer != NULL)
-    {
-      block = (long *) trailer->this_address;
-      size = trailer->this_size;
-      if (block == NULL || size == 0)
-        abort ();
-      trailer = (struct stk_trailer *) trailer->link;
-      if ((block <= address) && (address < (block + size)))
-        break;
-    }
-
-  /* Set the result to the offset in this segment and add the sizes
-     of all predecessor segments.  */
-
-  result = address - block;
-
-  if (trailer == NULL)
-    {
-      return result;
-    }
-
-  do
-    {
-      if (trailer->this_size <= 0)
-        abort ();
-      result += trailer->this_size;
-      trailer = (struct stk_trailer *) trailer->link;
-    }
-  while (trailer != NULL);
-
-  /* We are done.  Note that if you present a bogus address (one
-     not in any segment), you will get a different number back, formed
-     from subtracting the address of the first block.  This is probably
-     not what you want.  */
-
-  return (result);
-}
-
-#   else /* not CRAY2 */
-/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
-   Determine the number of the cell within the stack,
-   given the address of the cell.  The purpose of this
-   routine is to linearize, in some sense, stack addresses
-   for alloca.  */
-
-static long
-i00afunc (long address)
-{
-  long stkl = 0;
-
-  long size, pseg, this_segment, stack;
-  long result = 0;
-
-  struct stack_segment_linkage *ssptr;
-
-  /* Register B67 contains the address of the end of the
-     current stack segment.  If you (as a subprogram) store
-     your registers on the stack and find that you are past
-     the contents of B67, you have overflowed the segment.
-
-     B67 also points to the stack segment linkage control
-     area, which is what we are really interested in.  */
-
-  stkl = CRAY_STACKSEG_END ();
-  ssptr = (struct stack_segment_linkage *) stkl;
-
-  /* If one subtracts 'size' from the end of the segment,
-     one has the address of the first word of the segment.
-
-     If this is not the first segment, 'pseg' will be
-     nonzero.  */
-
-  pseg = ssptr->sspseg;
-  size = ssptr->sssize;
-
-  this_segment = stkl - size;
-
-  /* It is possible that calling this routine itself caused
-     a stack overflow.  Discard stack segments which do not
-     contain the target address.  */
-
-  while (!(this_segment <= address && address <= stkl))
-    {
-#    ifdef DEBUG_I00AFUNC
-      fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
-#    endif
-      if (pseg == 0)
-        break;
-      stkl = stkl - pseg;
-      ssptr = (struct stack_segment_linkage *) stkl;
-      size = ssptr->sssize;
-      pseg = ssptr->sspseg;
-      this_segment = stkl - size;
-    }
-
-  result = address - this_segment;
-
-  /* If you subtract pseg from the current end of the stack,
-     you get the address of the previous stack segment's end.
-     This seems a little convoluted to me, but I'll bet you save
-     a cycle somewhere.  */
-
-  while (pseg != 0)
-    {
-#    ifdef DEBUG_I00AFUNC
-      fprintf (stderr, "%011o %011o\n", pseg, size);
-#    endif
-      stkl = stkl - pseg;
-      ssptr = (struct stack_segment_linkage *) stkl;
-      size = ssptr->sssize;
-      pseg = ssptr->sspseg;
-      result += size;
-    }
-  return (result);
-}
-
-#   endif /* not CRAY2 */
-#  endif /* CRAY */
-
 # endif /* no alloca */
 #endif /* not GCC 2 */
diff --git a/m4/alloca.m4 b/m4/alloca.m4
index 5922524..d3e98c5 100644
--- a/m4/alloca.m4
+++ b/m4/alloca.m4
@@ -1,4 +1,4 @@
-# alloca.m4 serial 15
+# alloca.m4 serial 16
 dnl Copyright (C) 2002-2004, 2006-2007, 2009-2020 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -51,12 +51,9 @@ AC_DEFUN([gl_FUNC_ALLOCA],
 AC_DEFUN([gl_PREREQ_ALLOCA], [:])
 
 # This works around a bug in autoconf <= 2.68.
-# See <https://lists.gnu.org/r/bug-gnulib/2011-06/msg00277.html>.
-
-m4_version_prereq([2.69], [] ,[
-
-# This is taken from the following Autoconf patch:
-# 
https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=6cd9f12520b0d6f76d3230d7565feba1ecf29497
+# See <https://lists.gnu.org/r/bug-gnulib/2011-06/msg00277.html> and
+# 
<https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=6cd9f12520b0d6f76d3230d7565feba1ecf29497>.
+# Also it has a simplification that is not yet in Autoconf.
 
 # _AC_LIBOBJ_ALLOCA
 # -----------------
@@ -72,26 +69,6 @@ AC_LIBSOURCES(alloca.c)
 AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl
 AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.])
 
-AC_CACHE_CHECK(whether 'alloca.c' needs Cray hooks, ac_cv_os_cray,
-[AC_EGREP_CPP(webecray,
-[#if defined CRAY && ! defined CRAY2
-webecray
-#else
-wenotbecray
-#endif
-], ac_cv_os_cray=yes, ac_cv_os_cray=no)])
-if test $ac_cv_os_cray = yes; then
-  for ac_func in _getb67 GETB67 getb67; do
-    AC_CHECK_FUNC($ac_func,
-                  [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
-                                      [Define to one of '_getb67', 'GETB67',
-                                       'getb67' for Cray-2 and Cray-YMP
-                                       systems. This function is required for
-                                       'alloca.c' support on those systems.])
-    break])
-  done
-fi
-
 AC_CACHE_CHECK([stack direction for C alloca],
                [ac_cv_c_stack_direction],
 [AC_RUN_IFELSE([AC_LANG_SOURCE(
@@ -124,5 +101,4 @@ AH_VERBATIM([STACK_DIRECTION],
         STACK_DIRECTION = 0 => direction of growth unknown */
 @%:@undef STACK_DIRECTION])dnl
 AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
-])# _AC_LIBOBJ_ALLOCA
 ])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]