# HG changeset patch # User Doug Simon # Date 1441657415 -7200 # Node ID cbab86a6c7f6a78bd4e0e878ab609fd183644c4b # Parent 8d95daa4324b4d13cf84d03ab35b7d40509369fd make processing of /lib/jvmci/*.properties file like other Java *.properties files in that the last definition of any propery "wins" diff -r 8d95daa4324b -r cbab86a6c7f6 mx.jvmci/mx_jvmci.py --- a/mx.jvmci/mx_jvmci.py Mon Sep 07 18:08:46 2015 +0200 +++ b/mx.jvmci/mx_jvmci.py Mon Sep 07 22:23:35 2015 +0200 @@ -669,29 +669,27 @@ def _updateJVMCIProperties(jdkDir, compilers): jvmciProperties = join(jdkDir, 'jre', 'lib', 'jvmci', 'jvmci.properties') - def createFile(compilers): + def createFile(lines): with open(jvmciProperties, 'w') as fp: - print >> fp, "# the first entry wins, reorder entries to change the default compiler" - for compiler in compilers: - print >> fp, "jvmci.compiler=" + compiler + header = "# the last definition of a property wins (i.e., it overwrites any earlier definitions)" + if header not in lines: + print >> fp, header + for line in lines: + print >> fp, line - if not exists(jvmciProperties): - createFile(compilers) - else: - oldCompilers = [] + lines = [] + if exists(jvmciProperties): with open(jvmciProperties) as fp: for line in fp: if line.startswith('jvmci.compiler='): - oldCompilers += [line.strip().split('=')[1]] - changed = False - newCompilers = [] - for c in compilers: - if not c in oldCompilers: - changed = True - newCompilers += [c] - if changed: - # prepend new compilers, since the first property wins - createFile(newCompilers + oldCompilers) + compiler = line.strip().split('=')[1] + if compiler not in compilers: + lines.append(line.strip()) + else: + lines.append(line.strip()) + for compiler in compilers: + lines.append("jvmci.compiler=" + compiler) + createFile(lines) def _installDistInJdks(deployableDist): """ diff -r 8d95daa4324b -r cbab86a6c7f6 src/share/vm/jvmci/jvmciRuntime.cpp --- a/src/share/vm/jvmci/jvmciRuntime.cpp Mon Sep 07 18:08:46 2015 +0200 +++ b/src/share/vm/jvmci/jvmciRuntime.cpp Mon Sep 07 22:23:35 2015 +0200 @@ -841,7 +841,8 @@ * Everything before the '=' is the property name and everything after '=' is the value. * Lines that start with '#' are treated as comments and ignored. * No special processing of whitespace or any escape characters is performed. - * Also, no check is made whether an existing property is overridden. + * The last definition of a property "wins" (i.e., it overrides all earlier + * definitions of the property). */ class JVMCIPropertiesFileClosure : public ParseClosure { SystemProperty** _plist; @@ -865,7 +866,7 @@ *sep = '\0'; const char* name = line; char* value = sep + 1; - Arguments::PropertyList_add(_plist, name, value); + Arguments::PropertyList_unique_add(_plist, name, value); } };