[comp.unix.microport] Fast malloc for Microport

mike@cimcor.mn.org (Michael Grenier) (07/28/88)

Here is the binary for a fast malloc package that runs under Microport
V/AT in large model. It performs much better than malloc(3c) and 
malloc(3x) on my system and it should on yours. Test programs
are included.

I don't want to distribute sources as I'm attempting to market the
package to various vendors.  You may use this package only for
non-commerical use - you may not resell it or incorporate it into any
products for resale, etc. 

The file m286.uue should be uudecoded and placed under the name
libm286.a with world read permission in /usr/lib/large. 

    Good Luck,
     Mike Grenier		mike@cimcor.mn.org
			{ihnp4??,rutgers,amdahl}!bungia!cimcor!mike

-----cut------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	m286.3x
#	m286.uue
#	t.c
#	tcheck.c
# This archive created: Thu Jul 28 06:59:39 1988
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'm286.3x'" '(2318 characters)'
if test -f 'm286.3x'
then
	echo shar: "will not over-write existing file 'm286.3x'"
else
sed 's/^	X//' << \SHAR_EOF > 'm286.3x'
	X.TH M286 3X
	X.SH NAME
	Xm286 \- malloc package for iAPX286 processor
	X.SH SYNOPSIS
	X.nf
	X	char *malloc(size)
	X	unsigned size;
	X
	X	void free(ptr)
	X	char *ptr;
	X
	X	char *realloc(ptr, size)
	X	char *ptr;
	X	unsigned size;
	X
	X	char calloc(nelem, elsize)
	X	unsigned nelem, elsize;
	X
	X	int dump_malloc()
	X.fi
	X.SH DESCRIPTION
	X.I M286
	Xis a malloc(3C) compatible library designed for use on the iAPX286 processor.
	XPerformance is greatly improved over both malloc(3C) and malloc(3X) by
	Xallocating full 64K segments via the brk() system call and divving up
	Xthe segments as needed, reducing UNIX overhead. Is is found in the library
	X"m286", and is loaded if the option "-lm286" is used with cc(1) or
	Xld(1).
	X
	X.I Malloc
	Xreturns a pointer to a block of at least size bytes.
	X
	X.I Free
	Xreturns the space previously allocated with calloc() or malloc()
	Xas pointed to by the argument
	X.I ptr.
	XContents of the block are preserved until the next malloc() or calloc()
	Xcall.
	X
	X.I Realloc
	Xchanges the size of the blocked pointed to by 
	X.I ptr 
	Xto the size given by argument two in bytes. Contents of the block
	Xwill be unchanged up to either the original size or the new size,
	Xwhichever is smaller.
	X
	X.I Calloc
	Xallocates space via malloc and intializes the space to zeros. The
	Xamount of space allocated is set up to handle an array of 
	X.I nelem
	Xelements of size
	X.I elsize.
	X
	X.I Dump_malloc
	Xprovides a means to debug pointer references by dumping a list of all
	Xblocks within
	X.I m286's
	Xfree list or those currently allocated to the standard error device. The listing
	Xcontains LLINK, RLINK which are pointers to the previous and next blocks
	Xon the free list. TAG and ETAG are flags indicating whether the block is
	Xin use or not. ULINK is always a pointer to the beginning of the block.
	XAll of the fields are displayed as indexes into a array of words within
	Xthe allocated segment.
	X
	X.SH CAVEATS
	XSince performance is gained by allocating full 64K segments, an average
	Xof 32K bytes will be wasted by the process. The maximum size block that
	Xcan be allocated is 65488 bytes. If larger sizes are needed, use brk() directly.
	X
	XThis software is copyright and can only be used and distributed for
	Xnon-commercial use. Commerical licenses can be obtained from
	Xmike@cimcor.mn.org for a very low cost.
	X.SH FILES
	X.DT
	X/usr/lib/large/libm286.a
	X.SH "SEE ALSO"
	Xmalloc(3c), malloc(3x), brk(2)
SHAR_EOF
if test 2318 -ne "`wc -c < 'm286.3x'`"
then
	echo shar: "error transmitting 'm286.3x'" '(should have been 2318 characters)'
fi
fi
echo shar: "extracting 'm286.uue'" '(11124 characters)'
if test -f 'm286.uue'
then
	echo shar: "will not over-write existing file 'm286.uue'"
else
sed 's/^	X//' << \SHAR_EOF > 'm286.uue'
	Xbegin 644 libm286.a
	XM(3QA<F-H/@HO(" @(" @(" @(" @(" @-3@S-C,U,#@T(" @," @(" @," @
	XM(" @," @(" @(" R,#0@(" @(" @8 H    .   !$    1    $0   !$   
	XM 1    $0   !$    1    $0   !$    1    $0   !$    1!G971P86=E
	XM '5?;65M<V5T '5?;65M8W!Y &YE=U]P86=E &=E=%]O9F9S970 9G)E95]F
	XM<F]M7W!A9V4 86QL;V-A=&5?9G)O;5]P86=E ')E='5R;E]F<F5E7W!A9V5S
	XM &UA;&QO8P!C86QL;V, 9G)E90!R96%L;&]C '1A9VET &1U;7!?;6%L;&]C
	XM  !M86QL;V,N;R\@(" @(" @-3@S-C,U,#(W(" @,3 P(" @," @(" @,3 P
	XM-C0T(" W-S(Q(" @(" @8 I2 0, 4I#)(I@9   Z      "$$"YT97AT    
	XM          #(#P  C    (P1        S    "     N9&%T80   ,@/  #(
	XM#P  . $  %00  "$&0        (   !     +F)S<P      $0   !$  (0 
	XM                        @    %6+[(M&!C/2+0$ @]H B] SP,'B [L0
	XM 8[; P: $1,6@A$E  #)RU6+[.L/Q78&BT8*B02#1@8"_TX,@WX, '3KR<M5
	XMB^SK%<5V"HL$Q78&B02#1@H"@T8& O].#H-^#@!TY<G+R 8  +CP ([8]P;,
	XM#___= /I)@)J )H     1$2[$ &.VZ. $8D6@A$%__^#T@"[$ &.VZ-\$8D6
	XM?A'_-GX1_S9\$9H     @\0$N/  CMC_!LP/_S;,#YH     B4;ZB5;\Q7;Z
	XMQT0" 0#%=OK'1 0  ,5V^HMT!(/&!-'F W;ZCE[\QP0! ,5V^HMT!(/&!='F
	XM W;ZCE[\QP0  ,=&_OI_BW;^1M'F W;ZCE[\QP0! (MV_D9&T>8#=OJ.7OS'
	XM!   BW;^1D;1Y@-V^HY>_(LT W;^@\8$T>8#=OJ.7OS'! $ BW;^1D;1Y@-V
	XM^HY>_(LT W;^@\8%T>8#=OJ.7OR+1OZ)!,=&_@8 BW;^1M'F W;ZCE[\QP0 
	XM (MV_D9&T>8#=OJ.7OS'!   BT;^!08 BW;^T>8#=OJ.7OR)!(MV_D9&T>8#
	XM=OJ.7OR+- -V_H/&!-'F W;ZCE[\QP0  (MV_D9&T>8#=OJ.7OR+- -V_H/&
	XM!='F W;ZCE[\BT;^B02+1OX%!@"+=OZ#Q@/1Y@-V^HY>_(D$N/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M9'(@(" @(&]F9G-E=" @(" @("!,3$E.2R @5$%'(" @(%-)6D4@(" @4DQ)
	XM3DL@($5404<@(" @55!,24Y+#0H* "4N.&QX(" @)2XU=2 @(" @("4N-74@
	XM("5S(" E+C5U(" @)2XU=2 @)7,@("4N-74@#0H ( T*($%6('!O:6YT<R!T
	XM;R E=0T*"@  %@   "L    ) !P    B     0 @    (@    $ :@   "< 
	XM   ) '     @     0!W    '@    ( ?    "P    ! 'X    L    "0"#
	XM    *P    D B    "(    ! (P    B     0"5    *@    D F@   "( 
	XM   ! )X    B     0"B    (@    $ I@   "(    ! *D    M     0"K
	XM    +0    D L0   "<    ) +<    @     0"[    (     $ O@   !X 
	XM   ! ,     "    "0#^ 0  )P    D ! (  "     !  D"   F    "0 2
	XM @  (@    $ H (  "H    ) *8"   B     0"K @  (@    $ KP(  !X 
	XM   " ,H"   >     0#, @   @    D  0,  !X    " !H#   >     @!U
	XM P  )@    D >P,  "(    ! ) #   F    "0"6 P  (@    $ V ,  "8 
	XM   ) -X#   B     0#Q P  '@    ( S@0  "8    ) -<$   B     0#B
	XM!   '@    ( ^ 0  !X    " !$%   >     @"0!0  )@    D F 4  !X 
	XM   " ,H%   >     @"8!@  )@    D H 8  !X    " *H&   >     0"L
	XM!@   @    D O 8  "8    ) ,(&   B     0#<!@  '@    ( ^08  !X 
	XM   " ) '   F    "0"6!P  (@    $ F0<  !X    " /D'   F    "0 "
	XM"   (@    $ IP@  "8    ) *T(   B     0"U"   '@    ( Q @  "< 
	XM   ) ,H(   @     0#-"   *@    D TP@  "(    ! -@(   B     0#<
	XM"   )P    D X@@  "     ! .D(   @     0#L"   '@    $ [@@   ( 
	XM   ) /D(   G    "0#_"   (     $ ! D  "8    )  H)   B     0 =
	XM"0  *@    D (PD  "(    ! "<)   B     0 J"0  +0    $ + D  "T 
	XM   ) #4)   G    "0 ["0  (     $ 0@D  !X    ! $0)   (    "0!+
	XM"0  *     D 4 D  "     ! & )   >     0!B"0  #@    D =@D  "@ 
	XM   ) 'X)   @     0"2"0  )P    D EPD  "     ! *0)   H    "0"I
	XM"0  (     $ L0D  !X    ! +,)   (    "0"Z"0  )P    D P D  "  
	XM   ! ,H)   >     0#,"0  #@    D Y D  !X    ! .8)   2    "0 '
	XM"@  '@    $ "0H   0    ) "$*   K    "0 G"@  (@    $ *PH  "( 
	XM   ! $X*   >     0!0"@  "@    D 5PH  !X    ! %D*   ,    "0!?
	XM"@  '@    $ 80H  !     ) ' *   >     @!Y"@  '@    $ >PH  !8 
	XM   ) (4*   >     @#\"P  *P    D  @P  "(    !  8,   B     0 C
	XM#   '@    $ )0P   (    ) #8,   >     0 X#   "@    D <PP  !X 
	XM   " 'P,   >     @!9#0  '@    $ 6PT   P    ) &$-   >     @"K
	XM#0  '@    ( M T  !X    ! +8-   2    "0#<#0  '@    $ W@T   8 
	XM   ) .H-   >     0#L#0  %@    D ^ T  !X    "  0.   @     0 '
	XM#@  +@    D # X  "     !  \.   O    "0 :#@  (     $ '0X  #  
	XM   ) "8.   G    "0 L#@  (     $ ,PX  #$    ) #8.   @     0 Y
	XM#@  ,@    D / X  #(    ! #\.   S     0!!#@  ,P    D 40X  !X 
	XM   " %<.   T    "0!:#@  (     $ 70X  #(    ) & .   R     0!C
	XM#@  ,P    $ 90X  #,    ) &X.   >     0!P#@   @    D @ X  #4 
	XM   ) (,.   @     0"&#@  ,@    D B0X  #(    ! (P.   S     0".
	XM#@  ,P    D E X  #8    ) )<.   @     0":#@  ,@    D G0X  #( 
	XM   ! * .   S     0"B#@  ,P    D J X  !X    " .D.   >     0#K
	XM#@  &@    D 'P\  !X    ! "$/   :    "0!'#P  -P    D 2@\  "  
	XM   ! $T/   R    "0!0#P  ,@    $ 4P\  #,    ! %4/   S    "0!V
	XM#P  .     $ > \  #@    ) (4/   >     @"-#P  '@    ( E0\  "8 
	XM   ) )L/   B     0">#P  .0    D H0\  "     ! *0/   R    "0"G
	XM#P  ,@    $ J@\  #,    ! *P/   S    "0"U#P  )P    D N@\  "  
	XM   ! ,(/   >     @#%#P  '@    ( R \  "     ! ,H/   E    "0 N
	XM9FEL90        #^_P  9P%M86QL;V,N8P            !G971P86=E    
	XM   ! &X  @$     )P         $      !U7VUE;7-E="<    ! "   @$ 
	XM    '          &      !U7VUE;6-P>4,    ! "   @$     (@      
	XM   (      !N97=?<&%G964    ! "   @$     3 (        *        
	XM    ,@   +$"   ! "X  @$     $0         ,            /0   ,("
	XM   ! "   @$     X ,        .            3    *(&   ! &X  @$ 
	XM    &P(        0            7P   +T(   ! "   @$     <P      
	XM   2      !M86QL;V,  # )   ! &(  @$     HP         4      !C
	XM86QL;V,  -,)   ! &(  @$     0P         6      !F<F5E     !8*
	XM   ! "   @$     3P         8      !R96%L;&]C &4*   ! &(  @$ 
	XM    E0,        :      !T86=I=    /H-   ! &(  @$     )P      
	XM   <            <0   "$.   ! "0  @$     I@$        >       N
	XM=&5X=          !     P'(#P  S  .               N9&%T80   ,@/
	XM   "     P$X 0   @                 N8G-S       1   #     P&$
	XM                            !    ,@/   "     P N,S,      -@/
	XM   "     P!A=E]L:7-T   1   #     P      $    ,P/   "     P  
	XM    &@   ,X/   "     P!X>&9U;FYY - /   "     P!M7V5N9&1S 'P1
	XM   #     P      )    ( 1   #     P!S8G)K                 @!B
	XM<FL                  @ N,3 Q     !00   "     P N,3 S     !L0
	XM   "     P N,3 T     "(0   "     P N,3 Y     "D0   "     P!?
	XM:6]B                 @!F<')I;G1F             @ N,3$S     $00
	XM   "     P N,3$T     %L0   "     P N,3$U     &T0   "     P N
	XM,3$X     +,0   "     P!A8F]R=                @ N,3(Q     .@0
	XM   "     P!]    >'AC;W!Y<FEG:'0 ;5]C=7)I;F1X &9R965?:6YD> !M
	XM7V9I<G-T7V5N9&1S &=E=%]O9F9S970 9G)E95]F<F]M7W!A9V4 86QL;V-A
	XL=&5?9G)O;5]P86=E ')E='5R;E]F<F5E7W!A9V5S &1U;7!?;6%L;&]C  IA
	X 
	Xend
SHAR_EOF
if test 11124 -ne "`wc -c < 'm286.uue'`"
then
	echo shar: "error transmitting 'm286.uue'" '(should have been 11124 characters)'
fi
fi
echo shar: "extracting 't.c'" '(635 characters)'
if test -f 't.c'
then
	echo shar: "will not over-write existing file 't.c'"
else
sed 's/^	X//' << \SHAR_EOF > 't.c'
	X#include <stdio.h>
	X#include <malloc.h>
	X
	Xmain(argc, argv)
	Xint argc;
	Xchar *argv[];
	X{
	X	char *p;
	X	int size,i,j;
	X	if (argc!=2)
	X	{
	X		printf("%s: Usage - t number \n",argv[0]);
	X		printf(" Where 'number' is the number of kilobytes to allocate\n");
	X		exit(1);
	X	}
	X
	X	if ((size=atoi(argv[1])) == 0)
	X	{
	X		printf("%s: Bad argument, must be integer in kilobytes",argv[0]);
	X		exit(1);
	X	}
	X	
	X	for (i=0; i<size; i++)
	X		for (j=0; j<10; j++)
	X			if ((p=malloc(100))==NULL)
	X			{
	X				printf("\nNot enough memory available\n");
	X				printf("Was only able to allocate %ld bytes",i*1024L+j*100L);
	X				exit(2);
	X			} else fputc('.',stderr);
	X	fputc('\n', stderr);
	X}
SHAR_EOF
if test 635 -ne "`wc -c < 't.c'`"
then
	echo shar: "error transmitting 't.c'" '(should have been 635 characters)'
fi
fi
echo shar: "extracting 'tcheck.c'" '(1564 characters)'
if test -f 'tcheck.c'
then
	echo shar: "will not over-write existing file 'tcheck.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'tcheck.c'
	X#include <stdio.h>
	X#include <malloc.h>
	X#include <signal.h>
	Xchar *calloc();
	X
	X#define NSEGS 512   /* must be power of two  - this program allocates
	X			up to NSEGS * 1K bytes			*/
	X
	Xchar *p[NSEGS];
	X
	X#ifdef DEBUG
	Xvoid fault(no)
	Xint no;
	X{
	X	fprintf(stderr,"Caught signal number %d\n",no);
	X	dump_malloc();
	X	abort();
	X}
	X#endif
	X
	X
	Xvoid print_pointers()
	X{
	X	int i;
	X	fprintf(stderr,"\n Pointers are : ");
	X	for (i=0; i<NSEGS; i++)
	X		fputc( (p[i]==NULL ? 'F':'T'), stderr);
	X	fputc('\n',stderr);
	X}
	X		
	X
	X
	Xmain(argc, argv)
	Xint argc;
	Xchar *argv[];
	X{
	X	int j,k; 
	X	unsigned s,fill;
	X	long i;
	X
	X#ifdef DEBUG
	X	signal(SIGINT,fault);
	X#endif
	X
	X	for (i=0; i<NSEGS; i++)
	X		p[i]=NULL;
	X
	X	for (i=0; i<100000; i++)
	X	{
	X		k= rand() & (NSEGS - 1); /* choose a pointer */
	X		if (p[k] == NULL)
	X		{
	X			int call_type;
	X/*			print_pointers(); */
	X			s=(unsigned) rand() & 0x3ff;  /* pick a size */
	X			fprintf(stderr," %ld : Allocating a size of %u to pointer %d ",i,s,k);
	X
	X			call_type = rand() & 1;
	X			p[k] = ( call_type ? malloc(s) : calloc(s,1) );
	X			fprintf(stderr,"and getting %lx using %s\n",
	X				p[k], ( call_type ? "malloc" : "calloc"));
	X			for (fill=0; fill<s; fill++)  /* fill the buffer */
	X				p[k] [fill] = (char) (i & 0xff);
	X
	X		}
	X		j=rand() & (NSEGS-1);   /* choose another pointer */
	X		if (p[j] != NULL)
	X		{
	X			fprintf(stderr," %ld : freeing %lx from pointer %d\n",i,p[j],j);
	X			free(p[j]);
	X			p[j]=NULL;
	X		}
	X
	X		j=rand() & (NSEGS-1);
	X		if (p[j] != NULL)
	X		{
	X			s=rand()&0x3ff;
	X			fprintf(stderr," %ld : realloc %lx to size %d on pointer %d\n", 
	X				i, p[j], s,j);
	X			p[j]=realloc(p[j], s);
	X		}
	X
	X	}
	X}
SHAR_EOF
if test 1564 -ne "`wc -c < 'tcheck.c'`"
then
	echo shar: "error transmitting 'tcheck.c'" '(should have been 1564 characters)'
fi
fi
exit 0
#	End of shell archive