Skip to content

Commit

Permalink
Merge pull request #258 from pshipton/debug
Browse files Browse the repository at this point in the history
Output -Xmso debug info when _JAVA_LAUNCHER_DEBUG is set
  • Loading branch information
keithc-ca authored Sep 13, 2023
2 parents 4ebcfe4 + c6f00c3 commit e3ef5f3
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/java.base/share/native/libjli/java.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,18 @@ static jlong initialHeapSize = 0; /* initial heap size */
#define STACK_SIZE_MINIMUM (64 * KB)
#endif

static void
static jboolean
parseXmso(JLI_List openj9Args)
{
jboolean result = JNI_FALSE;
size_t i = openj9Args->size;
while (i > 0) {
i -= 1;
if (JLI_StrCCmp(openj9Args->elements[i], "-Xmso") == 0) {
jlong tmp = 0;
if (parse_size(openj9Args->elements[i] + 5, &tmp)) {
threadStackSize = tmp;
result = JNI_TRUE;
if (threadStackSize > 0 && threadStackSize < (jlong)STACK_SIZE_MINIMUM) {
threadStackSize = STACK_SIZE_MINIMUM;
}
Expand All @@ -246,14 +248,18 @@ parseXmso(JLI_List openj9Args)
}
}
JLI_List_free(openj9Args);
return result;
}

static void
parseXmsoInFile(const char *filename)
{
JLI_List openj9Args = JLI_ParseOpenJ9ArgsFile(filename);
if (openj9Args != NULL) {
parseXmso(openj9Args);
jboolean result = parseXmso(openj9Args);
if (JLI_IsTraceLauncher() && result) {
printf("Set -Xmso%ld from file %s\n", (long)threadStackSize, filename);
}
}
}

Expand All @@ -262,7 +268,10 @@ parseXmsoInEnv(const char *envVar)
{
JLI_List openj9Args = JLI_List_new(8); /* 8 is arbitrary */
if (JLI_ParseOpenJ9ArgsFromEnvVar(openj9Args, envVar)) {
parseXmso(openj9Args);
jboolean result = parseXmso(openj9Args);
if (JLI_IsTraceLauncher() && result) {
printf("Set -Xmso%ld from env var %s\n", (long)threadStackSize, envVar);
}
}
}

Expand Down Expand Up @@ -941,6 +950,9 @@ AddOption(char *str, void *info)
if (threadStackSize > 0 && threadStackSize < (jlong)STACK_SIZE_MINIMUM) {
threadStackSize = STACK_SIZE_MINIMUM;
}
if (JLI_IsTraceLauncher()) {
printf("Set -Xmso%ld from command line\n", (long)threadStackSize);
}
}
}

Expand Down

0 comments on commit e3ef5f3

Please sign in to comment.