Skip to content

Commit 563c901

Browse files
committed
Change sub-buffer sizes to satisfy constraints. Warn if sizes are adjusted.
Works towards #515 (comment) I am not sure we want to warn here in the "default" mode. Maybe if "allwarnings"?
1 parent 50a1d88 commit 563c901

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

sources/fsizes.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@
126126
#define MAXFPATCHES 256
127127
#define SORTIOSIZE 200000L
128128

129-
#define SSMALLBUFFER 500000L
130-
#define SSMALLOVERFLOW 800000L
129+
#define SSMALLBUFFER 2560016L
130+
#define SSMALLOVERFLOW 3840032L
131131
#define STERMSSMALL 10000L
132-
#define SLARGEBUFFER 4000000L
132+
#define SLARGEBUFFER 26880480L
133133
#define SMAXPATCHES 64
134134
#define SMAXFPATCHES 64
135-
#define SSORTIOSIZE 32768L
135+
#define SSORTIOSIZE 160000L
136136

137137
#define SPECTATORSIZE 1048576L
138138

sources/setfile.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -848,9 +848,17 @@ VOID WriteSetup(VOID)
848848
To be used for the main allocation of the sort buffers, and
849849
in a later stage for the function and subroutine sort buffers.
850850
*/
851-
SORTING *AllocSort(LONG LargeSize, LONG SmallSize, LONG SmallEsize, LONG TermsInSmall,
852-
int MaxPatches, int MaxFpatches, LONG IOsize)
851+
SORTING *AllocSort(LONG inLargeSize, LONG inSmallSize, LONG inSmallEsize, LONG inTermsInSmall,
852+
int inMaxPatches, int inMaxFpatches, LONG inIOsize)
853853
{
854+
LONG LargeSize = inLargeSize;
855+
LONG SmallSize = inSmallSize;
856+
LONG SmallEsize = inSmallEsize;
857+
LONG TermsInSmall = inTermsInSmall;
858+
int MaxPatches = inMaxPatches;
859+
int MaxFpatches = inMaxFpatches;
860+
LONG IOsize = inIOsize;
861+
854862
#ifndef SPLITALLOC
855863
LONG allocation;
856864
#endif
@@ -878,7 +886,6 @@ SORTING *AllocSort(LONG LargeSize, LONG SmallSize, LONG SmallEsize, LONG TermsIn
878886
terms2insmall = 2*TermsInSmall; /* Used to be just + 100 rather than *2 */
879887
if ( SmallEsize < (SmallSize*3)/2 ) SmallEsize = (SmallSize*3)/2;
880888
if ( LargeSize > 0 && LargeSize < 2*SmallSize ) LargeSize = 2*SmallSize;
881-
/* if ( SmallEsize < 3*AM.MaxTer ) SmallEsize = 3*AM.MaxTer; */
882889
SmallEsize = (SmallEsize+15) & (-16L);
883890
if ( LargeSize < 0 ) LargeSize = 0;
884891
sortsize = sizeof(SORTING);
@@ -902,6 +909,15 @@ SORTING *AllocSort(LONG LargeSize, LONG SmallSize, LONG SmallEsize, LONG TermsIn
902909
if ( (LONG)(IObuffersize*sizeof(WORD)) < IOtry )
903910
IObuffersize = (IOtry+sizeof(WORD)-1)/sizeof(WORD);
904911

912+
// Warn if any of the specified sizes have been adjusted:
913+
if ( LargeSize != inLargeSize ) { MesPrint("Warning: LargeSize adjusted: %l -> %l", inLargeSize, LargeSize); }
914+
if ( SmallSize != inSmallSize ) { MesPrint("Warning: SmallSize adjusted: %l -> %l", inSmallSize, SmallSize); }
915+
if ( SmallEsize != inSmallEsize ) {MesPrint("Warning: SmallEsize adjusted: %l -> %l", inSmallEsize, SmallEsize); }
916+
if ( TermsInSmall != inTermsInSmall ) { MesPrint("Warning: TermsInSmall adjusted: %l -> %l", inTermsInSmall, TermsInSmall); }
917+
if ( MaxPatches != inMaxPatches ) { MesPrint("Warning: MaxPatches adjusted: %d -> %d", inMaxPatches, MaxPatches); }
918+
if ( MaxFpatches != inMaxFpatches ) {MesPrint("Warning: MaxFPatches adjusted: %d -> %d", inMaxFpatches, MaxFpatches); }
919+
if ( IObuffersize != inIOsize/sizeof(WORD) ) { MesPrint("Warning: IOsize adjusted: %l -> %l", inIOsize/sizeof(WORD), IObuffersize); }
920+
905921
#ifndef SPLITALLOC
906922
allocation =
907923
3*sizeof(POSITION)*(LONG)longer /* Filepositions!! */

0 commit comments

Comments
 (0)