Skip to content

Commit

Permalink
Merge pull request #16636 from pshipton/vmref
Browse files Browse the repository at this point in the history
Cosmetic improvements to vm_scar.c
  • Loading branch information
keithc-ca committed Jan 31, 2023
2 parents 50d0f1a + 2ea0415 commit 82d8e43
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions runtime/jcl/common/vm_scar.c
Expand Up @@ -106,7 +106,7 @@ const U_64 jclConfig = J9CONST64(0x7363617237306200); /* 'scar70b' */

jint scarInit(J9JavaVM *vm);
jint scarPreconfigure(J9JavaVM *vm);
static UDATA addBFUSystemProperties(J9JavaVM* javaVM);
static UDATA addBFUSystemProperties(J9JavaVM* vm);
static IDATA addVMSpecificDirectories(J9JavaVM *vm, UDATA *cursor, char *subdirName);
static IDATA loadClasslibPropertiesFile(J9JavaVM *vm, UDATA *cursor);
static void setFatalErrorStringInDLLTableEntry(J9JavaVM* vm, char *errorString);
Expand All @@ -124,88 +124,88 @@ JNICALL JVM_OnLoad(JavaVM * jvm, char *options, void *reserved)
* @return J9SYSPROP_ERROR_NONE on success, or a J9SYSPROP_ERROR_* value on failure.
*/
static UDATA
addBFUSystemProperties(J9JavaVM* javaVM)
addBFUSystemProperties(J9JavaVM* vm)
{
int fontPathSize = 0;
char* fontPathBuffer = "";
char* propValue;
UDATA rc;
const J9InternalVMFunctions* vmfunc = javaVM->internalVMFunctions;
char* propValue = NULL;
UDATA rc = 0;
const J9InternalVMFunctions* vmfunc = vm->internalVMFunctions;

PORT_ACCESS_FROM_JAVAVM(javaVM);
PORT_ACCESS_FROM_JAVAVM(vm);

if ( (fontPathSize = (int)j9sysinfo_get_env(JAVA_FONTS_STR, NULL, 0)) > 0 ) {
fontPathBuffer = j9mem_allocate_memory(fontPathSize, J9MEM_CATEGORY_VM_JCL);
if (fontPathBuffer) {
javaVM->jclSysPropBuffer = fontPathBuffer; /* Use jclSysPropBuffer for all allocated sys prop values */
vm->jclSysPropBuffer = fontPathBuffer; /* Use jclSysPropBuffer for all allocated sys prop values */
j9sysinfo_get_env(JAVA_FONTS_STR, fontPathBuffer, fontPathSize);
}
}

#ifdef WIN32
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(javaVM, "java.awt.fonts", NULL)) {
rc = vmfunc->addSystemProperty(javaVM, "java.awt.fonts", fontPathBuffer, 0);
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(vm, "java.awt.fonts", NULL)) {
rc = vmfunc->addSystemProperty(vm, "java.awt.fonts", fontPathBuffer, 0);
if (J9SYSPROP_ERROR_NONE != rc) {
return rc;
}
}
#endif /* WIN32 */

if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(javaVM, "java.awt.graphicsenv", NULL)) {
rc = vmfunc->addSystemProperty(javaVM, "java.awt.graphicsenv", J9_AWTGRAPHICSENV_VALUE, 0);
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(vm, "java.awt.graphicsenv", NULL)) {
rc = vmfunc->addSystemProperty(vm, "java.awt.graphicsenv", J9_AWTGRAPHICSENV_VALUE, 0);
if (J9SYSPROP_ERROR_NONE != rc) {
return rc;
}
}

if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(javaVM, "awt.toolkit", NULL)) {
rc = vmfunc->addSystemProperty(javaVM, "awt.toolkit", J9_AWTTOOLKIT_VALUE, 0);
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(vm, "awt.toolkit", NULL)) {
rc = vmfunc->addSystemProperty(vm, "awt.toolkit", J9_AWTTOOLKIT_VALUE, 0);
if (J9SYSPROP_ERROR_NONE != rc) {
return rc;
}
}

if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(javaVM, "java.awt.printerjob", NULL)) {
rc = vmfunc->addSystemProperty(javaVM, "java.awt.printerjob", J9_AWTPRINTERJOB_VALUE, 0);
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(vm, "java.awt.printerjob", NULL)) {
rc = vmfunc->addSystemProperty(vm, "java.awt.printerjob", J9_AWTPRINTERJOB_VALUE, 0);
if (J9SYSPROP_ERROR_NONE != rc) {
return rc;
}
}

#ifdef J9VM_UNIX
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(javaVM, "java.awt.fonts", NULL)) {
rc = vmfunc->addSystemProperty(javaVM, "java.awt.fonts", "", 0);
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(vm, "java.awt.fonts", NULL)) {
rc = vmfunc->addSystemProperty(vm, "java.awt.fonts", "", 0);
if (J9SYSPROP_ERROR_NONE != rc) {
return rc;
}
}

#if defined(J9ZOS390)
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(javaVM, "sun.security.policy.utf8", NULL)) {
rc = vmfunc->addSystemProperty(javaVM, "sun.security.policy.utf8", "false", 0);
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(vm, "sun.security.policy.utf8", NULL)) {
rc = vmfunc->addSystemProperty(vm, "sun.security.policy.utf8", "false", 0);
if (J9SYSPROP_ERROR_NONE != rc) {
return rc;
}
}
#endif

if (fontPathSize >= 0) {
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(javaVM, "sun.java2d.fontpath", NULL)) {
rc = vmfunc->addSystemProperty(javaVM, "sun.java2d.fontpath", fontPathBuffer, 0);
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(vm, "sun.java2d.fontpath", NULL)) {
rc = vmfunc->addSystemProperty(vm, "sun.java2d.fontpath", fontPathBuffer, 0);
if (J9SYSPROP_ERROR_NONE != rc) {
return rc;
}
}
}
#endif /* J9VM_UNIX */

if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(javaVM, "sun.arch.data.model", NULL)) {
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(vm, "sun.arch.data.model", NULL)) {
#if defined(J9VM_ENV_DATA64)
propValue = "64";
#else
propValue = "32";
#endif
rc = vmfunc->addSystemProperty(javaVM, "sun.arch.data.model", propValue, 0);
rc = vmfunc->addSystemProperty(vm, "sun.arch.data.model", propValue, 0);
if (J9SYSPROP_ERROR_NONE != rc) {
return rc;
}
Expand All @@ -216,19 +216,19 @@ addBFUSystemProperties(J9JavaVM* javaVM)
#else
propValue = "UnicodeBig";
#endif
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(javaVM, "sun.io.unicode.encoding", NULL)) {
rc = vmfunc->addSystemProperty(javaVM, "sun.io.unicode.encoding", propValue, 0);
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(vm, "sun.io.unicode.encoding", NULL)) {
rc = vmfunc->addSystemProperty(vm, "sun.io.unicode.encoding", propValue, 0);
if (J9SYSPROP_ERROR_NONE != rc) {
return rc;
}
}

#if defined(LINUX)
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(javaVM, "sun.desktop", NULL)) {
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(vm, "sun.desktop", NULL)) {
char tempString[2];
/* We don't care about the value of the env var, just whether it is not null */
if (j9sysinfo_get_env("GNOME_DESKTOP_SESSION_ID", tempString, 2) != -1) {
rc = vmfunc->addSystemProperty(javaVM, "sun.desktop", "gnome", 0);
rc = vmfunc->addSystemProperty(vm, "sun.desktop", "gnome", 0);
if (J9SYSPROP_ERROR_NONE != rc) {
return rc;
}
Expand All @@ -237,8 +237,8 @@ addBFUSystemProperties(J9JavaVM* javaVM)
#endif /* LINUX */

#if defined(WIN32)
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(javaVM, "sun.desktop", NULL)) {
rc = vmfunc->addSystemProperty(javaVM, "sun.desktop", "windows", 0);
if (J9SYSPROP_ERROR_NOT_FOUND == vmfunc->getSystemProperty(vm, "sun.desktop", NULL)) {
rc = vmfunc->addSystemProperty(vm, "sun.desktop", "windows", 0);
if (J9SYSPROP_ERROR_NONE != rc) {
return rc;
}
Expand Down Expand Up @@ -524,9 +524,9 @@ loadClasslibPropertiesFile(J9JavaVM *vm, UDATA *cursor)
UDATA startCount = *cursor;
UDATA count = 0;

#define RELATIVE_PROPSPATH DIR_SEPARATOR_STR"lib"DIR_SEPARATOR_STR"classlib.properties"
#define RELATIVE_PROPSPATH DIR_SEPARATOR_STR "lib" DIR_SEPARATOR_STR "classlib.properties"

j9str_printf(PORTLIB, propsPath, sizeof(propsPath), "%s"RELATIVE_PROPSPATH, vm->javaHome);
j9str_printf(PORTLIB, propsPath, sizeof(propsPath), "%s" RELATIVE_PROPSPATH, vm->javaHome);

#undef RELATIVE_PROPSPATH

Expand Down

0 comments on commit 82d8e43

Please sign in to comment.