Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove SyCacheSize and the "-c" command line option #1192

Merged
merged 1 commit into from
Apr 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion hpcgap/lib/system.g
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ BIND_GLOBAL( "GAPInfo", AtomicRecord(rec(
help := [ "set hint for maximal workspace size (GAP may", "allocate more)"] ),
rec( short:= "K", long := "limitworkspace", default := "0", arg := "<mem>",
help := [ "set maximal workspace size (GAP never", "allocates more)"] ),
rec( short:= "c", default := "0", arg := "<mem>", help := [ "set the cache size value"] ),
rec( short:= "s", default := "4g", arg := "<mem", help := [ "set the initially mapped virtual memory" ] ),
rec( short:= "a", default := "0", arg := "<mem>",help := [ "set amount to pre-malloc-ate",
"postfix 'k' = *1024, 'm' = *1024*1024,", "'g' = *1024*1024*1024"] ),
Expand Down
2 changes: 1 addition & 1 deletion hpcgap/src/gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -3353,7 +3353,7 @@ void InitializeGap (
/* Initialise memory -- have to do this here to make sure we are at top of C stack */
InitBags( SyAllocBags, SyStorMin,
0, (Bag*)(((UInt)pargc/SyStackAlign)*SyStackAlign), SyStackAlign,
SyCacheSize, 0, SyAbortBags );
0, SyAbortBags );
InitMsgsFuncBags( SyMsgsBags );

TLS(StackNams) = NEW_PLIST( T_PLIST, 16 );
Expand Down
19 changes: 0 additions & 19 deletions hpcgap/src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,6 @@ const Char * SyArchitecture = SYS_ARCH;
UInt SyCTRD;


/****************************************************************************
**
*V SyCacheSize . . . . . . . . . . . . . . . . . . . . . . size of the cache
**
** 'SyCacheSize' is the size of the data cache.
**
** This is per default 0, which means that there is no usuable data cache.
** It is usually changed with the '-c' option in the script that starts GAP.
**
** This value is passed to 'InitBags'.
**
** Put in this package because the command line processing takes place here.
*/
UInt SyCacheSize;


/****************************************************************************
**
*V SyCheckCRCCompiledModule . . . check crc while loading compiled modules
Expand Down Expand Up @@ -1859,8 +1843,6 @@ struct optInfo options[] = {
{ 'R', "", unsetString, &SyRestoring, 0}, /* kernel */
{ 'U', "", storeString, SyCompileOptions, 1}, /* kernel */
{ 'a', "", storeMemory, &preAllocAmount, 1 }, /* kernel -- is this still useful */
{ 'c', "", storeMemory, &SyCacheSize, 1 }, /* kernel, unless we provided a hook to set it from library,
never seems to be useful */
{ 'e', "", toggle, &SyCTRD, 0 }, /* kernel */
{ 'f', "", forceLineEditing, (void *)2, 0 }, /* probably library now */
{ 'E', "", toggle, &SyUseReadline, 0 }, /* kernel */
Expand Down Expand Up @@ -1898,7 +1880,6 @@ void InitSystem (
/* Initialize global and static variables. Do it here rather than
with initializers to allow for restart */
SyCTRD = 1;
SyCacheSize = 0;
SyCheckCRCCompiledModule = 0;
SyCompilePlease = 0;
SyDebugLoading = 0;
Expand Down
16 changes: 0 additions & 16 deletions hpcgap/src/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,22 +203,6 @@ extern const Char * SyBuildDateTime;
extern UInt SyCTRD;


/****************************************************************************
**
*V SyCacheSize . . . . . . . . . . . . . . . . . . . . . . size of the cache
**
** 'SyCacheSize' is the size of the data cache, in kilobytes
**
** This is per default 0, which means that there is no usuable data cache.
** It is usually changed with the '-c' option in the script that starts GAP.
**
** This value is passed to 'InitBags'.
**
** Put in this package because the command line processing takes place here.
*/
extern UInt SyCacheSize;


/****************************************************************************
**
*V SyCheckCRCCompiledModule . . . check crc while loading compiled modules
Expand Down
1 change: 0 additions & 1 deletion lib/system.g
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ BIND_GLOBAL( "GAPInfo", rec(
help := [ "set hint for maximal workspace size (GAP may", "allocate more)"] ),
rec( short:= "K", long := "limitworkspace", default := "0", arg := "<mem>",
help := [ "set maximal workspace size (GAP never", "allocates more)"] ),
rec( short:= "c", default := "0", arg := "<mem>", help := [ "set the cache size value"] ),
rec( short:= "s", default := "4g", arg := "<mem", help := [ "set the initially mapped virtual memory" ] ),
rec( short:= "a", default := "0", arg := "<mem>",help := [ "set amount to pre-malloc-ate",
"postfix 'k' = *1024, 'm' = *1024*1024,", "'g' = *1024*1024*1024"] ),
Expand Down
2 changes: 1 addition & 1 deletion src/gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -3260,7 +3260,7 @@ void InitializeGap (
/* Initialise memory -- have to do this here to make sure we are at top of C stack */
InitBags( SyAllocBags, SyStorMin,
0, (Bag*)(((UInt)pargc/SyStackAlign)*SyStackAlign), SyStackAlign,
SyCacheSize, 0, SyAbortBags );
0, SyAbortBags );
InitMsgsFuncBags( SyMsgsBags );

TLS(StackNams) = NEW_PLIST( T_PLIST, 16 );
Expand Down
64 changes: 13 additions & 51 deletions src/gasman.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,6 @@ TNumMarkFuncBags TabMarkFuncBags [ NTYPES ];
** allocation. 'StopBags' points to the beginning of this area and
** 'EndBags' to the end.
**
** If <cache-size> (see "InitBags") was 0, 'CollectBags' makes all of the
** free storage available for allocations by setting 'StopBags' to 'EndBags'
** after garbage collections. In this case garbage collections are only
** performed when no free storage is left. If <cache-size> was nonzero,
** 'CollectBags' makes 'AllocSizeBags' bytes available by setting 'StopBags'
** to 'AllocBags + 2+WORDS_BAG(<size>) + WORDS_BAG(AllocSizeBags)' after
** garbage collections, where <size> is the size of the bag 'NewBag' is
** currently allocating. 'AllocSizeBags' is usually <cache-size>, but is
** increased if only very few large bags have been allocated since the last
** garbage collection and decreased again if sufficiently many bags have
** been allocated since the last garbage collection. The idea is to keep
** the allocation area small enough so that it fits in the processor cache.
**
** Note that the borders between the areas are not static. In particular
** each allocation increases the size of the young bags area and reduces the
** size of the allocation area. On the other hand each garbage collection
Expand Down Expand Up @@ -950,7 +937,6 @@ void FinishedRestoringBags( void )
SizeDeadBags = 0;
NrHalfDeadBags = 0;
ChangedBags = 0;
return;
}


Expand Down Expand Up @@ -1016,7 +1002,7 @@ void FinishBags( void )
*F InitBags(...) . . . . . . . . . . . . . . . . . . . . . initialize Gasman
**
** 'InitBags' remembers <alloc-func>, <stack-func>, <stack-bottom>,
** <stack-align>, <cache-size>, <dirty>, and <abort-func> in global
** <stack-align>, <dirty>, and <abort-func> in global
** variables. It also allocates the initial workspace, and sets up the
** linked list of available masterpointer.
*/
Expand All @@ -1028,8 +1014,6 @@ Bag * StackBottomBags;

UInt StackAlignBags;

UInt CacheSizeBags;

UInt DirtyBags;

TNumAbortFuncBags AbortFuncBags;
Expand All @@ -1040,7 +1024,6 @@ void InitBags (
TNumStackFuncBags stack_func,
Bag * stack_bottom,
UInt stack_align,
UInt cache_size,
UInt dirty,
TNumAbortFuncBags abort_func )
{
Expand Down Expand Up @@ -1080,17 +1063,8 @@ void InitBags (
YoungBags = OldBags;
AllocBags = OldBags;

/* remember the cache size */
CacheSizeBags = cache_size;
if ( ! CacheSizeBags ) {
AllocSizeBags = 256;
StopBags = EndBags;
}
else {
AllocSizeBags = (CacheSizeBags+1023)/1024;
StopBags = AllocBags + WORDS_BAG(1024*AllocSizeBags) <= EndBags ?
AllocBags + WORDS_BAG(1024*AllocSizeBags) : EndBags;
}
AllocSizeBags = 256;
StopBags = EndBags;

/* remember whether bags should be clean */
DirtyBags = dirty;
Expand Down Expand Up @@ -2158,24 +2132,15 @@ UInt CollectBags (
if ( ! FullBags ) {

/* maybe adjust the size of the allocation area */
if ( ! CacheSizeBags ) {
if ( nrLiveBags+nrDeadBags +nrHalfDeadBags < 512

/* The test below should stop AllocSizeBags
growing uncontrollably when all bags are big */
&& StopBags > OldBags + 4*1024*WORDS_BAG(AllocSizeBags))
AllocSizeBags += 256L;
else if ( 4096 < nrLiveBags+nrDeadBags+nrHalfDeadBags
&& 256 < AllocSizeBags )
AllocSizeBags -= 256;
}
else {
if ( nrLiveBags+nrDeadBags < 512 )
AllocSizeBags += CacheSizeBags/1024;
else if ( 4096 < nrLiveBags+nrDeadBags+nrHalfDeadBags
&& CacheSizeBags < AllocSizeBags )
AllocSizeBags -= CacheSizeBags/1024;
}
if ( nrLiveBags+nrDeadBags +nrHalfDeadBags < 512

/* The test below should stop AllocSizeBags
growing uncontrollably when all bags are big */
&& StopBags > OldBags + 4*1024*WORDS_BAG(AllocSizeBags))
AllocSizeBags += 256;
else if ( 4096 < nrLiveBags+nrDeadBags+nrHalfDeadBags
&& 256 < AllocSizeBags )
AllocSizeBags -= 256;

/* if we dont get enough free storage or masterpointers do full gc */
if ( EndBags < StopBags + WORDS_BAG(1024*AllocSizeBags)
Expand Down Expand Up @@ -2297,10 +2262,7 @@ UInt CollectBags (
SpaceBetweenPointers(EndBags, MptrBags)/(1024/sizeof(Bag)));

/* reset the stop pointer */
if ( ! CacheSizeBags || EndBags < StopBags+WORDS_BAG(1024*AllocSizeBags) )
StopBags = EndBags;
else
StopBags = StopBags + WORDS_BAG(1024*AllocSizeBags);
StopBags = EndBags;

/* if we are not done, then true again */
if ( ! done ) {
Expand Down
17 changes: 1 addition & 16 deletions src/gasman.h
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ extern void CheckMasterPointers( void );
**
** InitBags( <alloc-func>, <initial-size>,
** <stack-func>, <stack-start>, <stack-align>,
** <cache-size>, <dirty>, <abort-func> )
** <dirty>, <abort-func> )
**
** 'InitBags' initializes {\Gasman}. It must be called from a application
** using {\Gasman} before any bags can be allocated.
Expand Down Expand Up @@ -1128,20 +1128,6 @@ extern void CheckMasterPointers( void );
** on the machine, the operating system, and the compiler. If the
** application provides another <stack-func>, <stack-align> is ignored.
**
** <cache-size> informs {\Gasman} whether the processor has a usable data
** cache and how large it is measured in bytes. If the application passes
** 0, {\Gasman} assumes that the processor has no data cache or a data cache
** to small to be useful. In this case the entire free storage is made
** available for allocations after garbage collections. If the application
** passes a nonzero value, {\Gasman} assumes that this is the size of the
** part of the data cache that should be used for the allocation area, and
** tries to keep the allocation area small enough so that it fits. For a
** processor that has separate data and instruction caches, the application
** should pass the size of the data cache minus 65536. For a processor with
** a unified cache, the application should pass the size of the unified
** cache minus 131072. The application probably should not pass a value
** less than 131072.
**
** The initialization flag <dirty> determines whether bags allocated by
** 'NewBag' are initialized to contain only 0 or not. If <dirty> is 0, the
** bags are initialized to contain only 0. If <dirty> is 1, the bags
Expand Down Expand Up @@ -1169,7 +1155,6 @@ extern void InitBags (
TNumStackFuncBags stack_func,
Bag * stack_bottom,
UInt stack_align,
UInt cache_size,
UInt dirty,
TNumAbortFuncBags abort_func );

Expand Down
1 change: 0 additions & 1 deletion src/hpc/boehm_gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ void InitBags (
TNumStackFuncBags stack_func,
Bag * stack_bottom,
UInt stack_align,
UInt cache_size,
UInt dirty,
TNumAbortFuncBags abort_func )
{
Expand Down
19 changes: 0 additions & 19 deletions src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,6 @@ const Char * SyArchitecture = SYS_ARCH;
UInt SyCTRD;


/****************************************************************************
**
*V SyCacheSize . . . . . . . . . . . . . . . . . . . . . . size of the cache
**
** 'SyCacheSize' is the size of the data cache.
**
** This is per default 0, which means that there is no usuable data cache.
** It is usually changed with the '-c' option in the script that starts GAP.
**
** This value is passed to 'InitBags'.
**
** Put in this package because the command line processing takes place here.
*/
UInt SyCacheSize;


/****************************************************************************
**
*V SyCheckCRCCompiledModule . . . check crc while loading compiled modules
Expand Down Expand Up @@ -1804,8 +1788,6 @@ struct optInfo options[] = {
{ 'R', "", unsetString, &SyRestoring, 0}, /* kernel */
{ 'U', "", storeString, SyCompileOptions, 1}, /* kernel */
{ 'a', "", storeMemory, &preAllocAmount, 1 }, /* kernel -- is this still useful */
{ 'c', "", storeMemory, &SyCacheSize, 1 }, /* kernel, unless we provided a hook to set it from library,
never seems to be useful */
{ 'e', "", toggle, &SyCTRD, 0 }, /* kernel */
{ 'f', "", forceLineEditing, (void *)2, 0 }, /* probably library now */
{ 'E', "", toggle, &SyUseReadline, 0 }, /* kernel */
Expand Down Expand Up @@ -1839,7 +1821,6 @@ void InitSystem (
/* Initialize global and static variables. Do it here rather than
with initializers to allow for restart */
SyCTRD = 1;
SyCacheSize = 0;
SyCheckCRCCompiledModule = 0;
SyCompilePlease = 0;
SyDebugLoading = 0;
Expand Down
16 changes: 0 additions & 16 deletions src/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,22 +203,6 @@ extern const Char * SyBuildDateTime;
extern UInt SyCTRD;


/****************************************************************************
**
*V SyCacheSize . . . . . . . . . . . . . . . . . . . . . . size of the cache
**
** 'SyCacheSize' is the size of the data cache, in kilobytes
**
** This is per default 0, which means that there is no usuable data cache.
** It is usually changed with the '-c' option in the script that starts GAP.
**
** This value is passed to 'InitBags'.
**
** Put in this package because the command line processing takes place here.
*/
extern UInt SyCacheSize;


/****************************************************************************
**
*V SyCheckCRCCompiledModule . . . check crc while loading compiled modules
Expand Down