Skip to content

Commit

Permalink
Adding parameter to have min size of the permSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
tesonep committed Apr 4, 2022
1 parent 606736a commit 44934c0
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 17 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ elseif(WIN)


# if(NOT MSVC)
set(COMMON_FLAGS "-fwrapv -fdeclspec -msse2 -ggdb2 -m64 -mno-rtd -mms-bitfields -O0 -momit-leaf-frame-pointer -funroll-loops -D_MT -fno-builtin-printf -fno-builtin-putchar -fno-builtin-fprintf -Wall -Wno-unused-variable -fno-optimize-sibling-calls")
set(COMMON_FLAGS "-fwrapv -fdeclspec -msse2 -ggdb2 -m64 -mno-rtd -mms-bitfields -O2 -momit-leaf-frame-pointer -funroll-loops -D_MT -fno-builtin-printf -fno-builtin-putchar -fno-builtin-fprintf -Wall -Wno-unused-variable -fno-optimize-sibling-calls")
# endif()

set(OS_TYPE "Win32")
Expand All @@ -261,7 +261,7 @@ elseif(UNIX)
set(CMAKE_CURRENT_SOURCE_DIR_TO_OUT ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_CURRENT_BINARY_DIR_TO_OUT ${CMAKE_CURRENT_BINARY_DIR})

set(COMMON_FLAGS "-O0 -Wall -Werror=implicit-function-declaration")
set(COMMON_FLAGS "-O2 -Wall -Werror=implicit-function-declaration")

add_compile_definitions(LSB_FIRST=1)

Expand Down
3 changes: 3 additions & 0 deletions include/pharovm/parameters/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ typedef struct VMParameters_
//The eden size (This is the space used to allocate new objects).
long long edenSize;

//The minimal Permanent Space Size
long long minPermSpaceSize;

// FIXME: Why passing this is needed when we have the separated vectors?
int processArgc;
const char** processArgv;
Expand Down
2 changes: 2 additions & 0 deletions src/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extern void setMaxStacksToPrint(sqInt anInteger);
extern void setMaxOldSpaceSize(sqInt anInteger);
extern void setDesiredCogCodeSize(sqInt anInteger);
extern void setDesiredEdenBytes(sqLong anInteger);
extern void setMinimalPermSpaceSize(sqLong anInteger);

#if defined(__GNUC__) && ( defined(i386) || defined(__i386) || defined(__i386__) \
|| defined(i486) || defined(__i486) || defined (__i486__) \
Expand Down Expand Up @@ -67,6 +68,7 @@ EXPORT(int) vm_init(VMParameters* parameters)
setMaxStacksToPrint(parameters->maxStackFramesToPrint);
setMaxOldSpaceSize(parameters->maxOldSpaceSize);
setDesiredEdenBytes(parameters->edenSize);
setMinimalPermSpaceSize(parameters->minPermSpaceSize);

if(parameters->maxCodeSize > 0) {
#ifndef COGVM
Expand Down
52 changes: 37 additions & 15 deletions src/parameters/parameters.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ static VMErrorCode processMaxOldSpaceSizeOption(const char *argument, VMParamete
static VMErrorCode processMaxCodeSpaceSizeOption(const char *argument, VMParameters * params);
static VMErrorCode processEdenSizeOption(const char *argument, VMParameters * params);
static VMErrorCode processWorkerOption(const char *argument, VMParameters * params);
static VMErrorCode processMinPermSpaceSizeOption(const char *argument, VMParameters * params);

static const VMParameterSpec vm_parameters_spec[] =
{
Expand All @@ -92,6 +93,7 @@ static const VMParameterSpec vm_parameters_spec[] =
{.name = "maxOldSpaceSize", .hasArgument = true, .function = processMaxOldSpaceSizeOption},
{.name = "codeSize", .hasArgument = true, .function = processMaxCodeSpaceSizeOption},
{.name = "edenSize", .hasArgument = true, .function = processEdenSizeOption},
{.name = "minPermSpaceSize", .hasArgument = true, .function = processMinPermSpaceSizeOption},
#ifdef __APPLE__
// This parameter is passed by the XCode debugger.
{.name = "NSDocumentRevisionsDebugMode", .hasArgument = false, .function = NULL},
Expand Down Expand Up @@ -405,26 +407,28 @@ vm_printUsageTo(FILE *out)
" " VM_NAME " [<option>...] -- [<argument>...]\n"
"\n"
"Common <option>s:\n"
" --help Print this help message, then exit\n"
" --help Print this help message, then exit\n"
#if ALWAYS_INTERACTIVE
" --headless Run in headless (no window) mode (default: false)\n"
" --headless Run in headless (no window) mode (default: false)\n"
#else
" --headless Run in headless (no window) mode (default: true)\n"
" --headless Run in headless (no window) mode (default: true)\n"
#endif
#ifdef PHARO_VM_IN_WORKER_THREAD
" --worker Run in worker thread (default: false)\n"
" --worker Run in worker thread (default: false)\n"
#endif
" --logLevel=<level> Sets the log level number (ERROR(1), WARN(2), INFO(3), DEBUG(4), TRACE(5))\n"
" --version Print version information, then exit\n"
" --maxFramesToLog=<cant> Sets the max numbers of Smalltalk frames to log\n"
" --maxOldSpaceSize=<bytes> Sets the max size of the old space. As the other\n"
" spaces are fixed (or calculated from this) with\n"
" this parameter is possible to set the total size.\n"
" It is possible to use k(kB), M(MB) and G(GB).\n"
" --codeSize=<size>[mk] Sets the max size of code zone.\n"
" It is possible to use k(kB), M(MB) and G(GB).\n"
" --edenSize=<size>[mk] Sets the size of eden\n"
" It is possible to use k(kB), M(MB) and G(GB).\n"
" --logLevel=<level> Sets the log level number (ERROR(1), WARN(2), INFO(3), DEBUG(4), TRACE(5))\n"
" --version Print version information, then exit\n"
" --maxFramesToLog=<cant> Sets the max numbers of Smalltalk frames to log\n"
" --maxOldSpaceSize=<bytes> Sets the max size of the old space. As the other\n"
" spaces are fixed (or calculated from this) with\n"
" this parameter is possible to set the total size.\n"
" It is possible to use k(kB), M(MB) and G(GB).\n"
" --codeSize=<size>[mk] Sets the max size of code zone.\n"
" It is possible to use k(kB), M(MB) and G(GB).\n"
" --edenSize=<size>[mk] Sets the size of eden\n"
" It is possible to use k(kB), M(MB) and G(GB).\n"
" --minPermSpaceSize=<size>[mk] Sets the size of eden\n"
" It is possible to use k(kB), M(MB) and G(GB).\n"
"\n"
"Notes:\n"
"\n"
Expand Down Expand Up @@ -504,6 +508,23 @@ processMaxCodeSpaceSizeOption(const char* originalArgument, VMParameters * param
return VM_SUCCESS;
}

static VMErrorCode
processMinPermSpaceSizeOption(const char* originalArgument, VMParameters * params)
{
long long intValue = parseByteSize(originalArgument);

if(intValue < 0)
{
logError("Invalid option for min perm space size: %s\n", originalArgument);
vm_printUsageTo(stderr);
return VM_ERROR_INVALID_PARAMETER_VALUE;
}

params->minPermSpaceSize = intValue;

return VM_SUCCESS;
}

static VMErrorCode
processEdenSizeOption(const char* originalArgument, VMParameters * params)
{
Expand Down Expand Up @@ -686,6 +707,7 @@ vm_parameters_init(VMParameters *parameters){
parameters->maxCodeSize = 0;
parameters->maxOldSpaceSize = 0;
parameters->edenSize = 0;
parameters->minPermSpaceSize = 0;
parameters->imageFileName = NULL;
parameters->isDefaultImage = false;
parameters->defaultImageFound = false;
Expand Down

0 comments on commit 44934c0

Please sign in to comment.