Skip to content

Commit

Permalink
Merge pull request #706 from pshipton/debug2
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 committed Sep 13, 2023
2 parents 987a883 + 816c8d5 commit 508627f
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 @@ -221,16 +221,18 @@ static jlong initialHeapSize = 0; /* inital 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 @@ -239,14 +241,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 @@ -255,7 +261,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 @@ -1013,6 +1022,9 @@ AddOption(char *str, void *info)
if (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 508627f

Please sign in to comment.