--- old/.mx.jvmci/mx_jvmci.py 2015-12-22 15:26:52.000000000 +0100 +++ new/.mx.jvmci/mx_jvmci.py 2015-12-22 15:26:52.000000000 +0100 @@ -677,12 +677,6 @@ assert service self.services.setdefault(service, []).append(provider) return True - elif arcname.endswith('_OptionDescriptors.class'): - # Need to create service files for the providers of the - # jdk.vm.ci.options.Options service created by - # jdk.vm.ci.options.processor.OptionProcessor. - provider = arcname[:-len('.class'):].replace('/', '.') - self.services.setdefault('jdk.vm.ci.options.OptionDescriptors', []).append(provider) return False def __addsrc__(self, arcname, contents): @@ -761,21 +755,6 @@ if jacocoArgs: args = jacocoArgs + args - # Support for -G: options - def translateGOption(arg): - if arg.startswith('-G:+'): - if '=' in arg: - mx.abort('Mixing + and = in -G: option specification: ' + arg) - arg = '-Djvmci.option.' + arg[len('-G:+'):] + '=true' - elif arg.startswith('-G:-'): - if '=' in arg: - mx.abort('Mixing - and = in -G: option specification: ' + arg) - arg = '-Djvmci.option.' + arg[len('-G:+'):] + '=false' - elif arg.startswith('-G:'): - arg = '-Djvmci.option.' + arg[len('-G:'):] - return arg - args = map(translateGOption, args) - args = ['-Xbootclasspath/p:' + dep.classpath_repr() for dep in _jvmci_bootclasspath_prepends] + args jvmciModeArgs = _jvmciModes[_vm.jvmciMode] --- old/.mx.jvmci/suite.py 2015-12-22 15:26:53.000000000 +0100 +++ new/.mx.jvmci/suite.py 2015-12-22 15:26:53.000000000 +0100 @@ -109,7 +109,6 @@ "jdk.vm.ci.code", ], "checkstyle" : "jdk.vm.ci.service", - "annotationProcessors" : ["JVMCI_OPTIONS_PROCESSOR"], "javaCompliance" : "1.8", "workingSets" : "API,JVMCI", }, @@ -135,38 +134,6 @@ "workingSets" : "JVMCI", }, - "jdk.vm.ci.options" : { - "subDir" : "src/jdk.vm.ci/share/classes", - "sourceDirs" : ["src"], - "checkstyle" : "jdk.vm.ci.service", - "dependencies" : ["jdk.vm.ci.inittimer"], - "javaCompliance" : "1.8", - "workingSets" : "JVMCI", - }, - - "jdk.vm.ci.options.processor" : { - "subDir" : "src/jdk.vm.ci/share/classes", - "sourceDirs" : ["src"], - "dependencies" : [ - "jdk.vm.ci.options", - ], - "checkstyle" : "jdk.vm.ci.service", - "javaCompliance" : "1.8", - "workingSets" : "JVMCI,Codegen", - }, - - "jdk.vm.ci.options.test" : { - "subDir" : "test/compiler/jvmci", - "sourceDirs" : ["src"], - "dependencies" : [ - "jdk.vm.ci.options", - "mx:JUNIT", - ], - "checkstyle" : "jdk.vm.ci.service", - "javaCompliance" : "1.8", - "workingSets" : "JVMCI", - }, - # ------------- JVMCI:HotSpot ------------- "jdk.vm.ci.amd64" : { @@ -191,15 +158,12 @@ "subDir" : "src/jdk.vm.ci/share/classes", "sourceDirs" : ["src"], "dependencies" : [ - "jdk.vm.ci.options", "jdk.vm.ci.hotspotvmconfig", "jdk.vm.ci.common", + "jdk.vm.ci.inittimer", "jdk.vm.ci.runtime", "jdk.vm.ci.service", ], - "annotationProcessors" : [ - "JVMCI_OPTIONS_PROCESSOR", - ], "checkstyle" : "jdk.vm.ci.service", "javaCompliance" : "1.8", "workingSets" : "JVMCI", @@ -258,11 +222,6 @@ "dependencies" : ["jdk.vm.ci.service"], }, - "JVMCI_OPTIONS" : { - "subDir" : "src/jdk.vm.ci/share/classes", - "dependencies" : ["jdk.vm.ci.options"], - }, - "JVMCI_API" : { "subDir" : "src/jdk.vm.ci/share/classes", "dependencies" : [ @@ -273,7 +232,6 @@ "jdk.vm.ci.sparc", ], "distDependencies" : [ - "JVMCI_OPTIONS", "JVMCI_SERVICE", ], }, @@ -301,7 +259,6 @@ "JVMCI_TEST" : { "subDir" : "test/compiler/jvmci", "dependencies" : [ - "jdk.vm.ci.options.test", "jdk.vm.ci.runtime.test", ], "distDependencies" : [ @@ -310,13 +267,6 @@ "exclude" : ["mx:JUNIT"], }, - "JVMCI_OPTIONS_PROCESSOR" : { - "subDir" : "src/jdk.vm.ci/share/classes", - "dependencies" : ["jdk.vm.ci.options.processor"], - "distDependencies" : [ - "JVMCI_OPTIONS", - ], - }, "JVMCI_SERVICE_PROCESSOR" : { "subDir" : "src/jdk.vm.ci/share/classes", @@ -332,15 +282,12 @@ "subDir" : "src/jdk.vm.ci/share/classes", "overlaps" : [ "JVMCI_API", - "JVMCI_OPTIONS", "JVMCI_SERVICE", "JVMCI_HOTSPOT", "JVMCI_HOTSPOTVMCONFIG", "JVMCI_SERVICE_PROCESSOR", - "JVMCI_OPTIONS_PROCESSOR" ], "dependencies" : [ - "jdk.vm.ci.options", "jdk.vm.ci.service", "jdk.vm.ci.inittimer", "jdk.vm.ci.runtime", @@ -350,7 +297,6 @@ "jdk.vm.ci.hotspotvmconfig", "jdk.vm.ci.hotspot.amd64", "jdk.vm.ci.hotspot.sparc", - "jdk.vm.ci.options.processor", "jdk.vm.ci.service.processor" ], }, --- old/make/gensrc/Gensrc-jdk.vm.ci.gmk 2015-12-22 15:26:54.000000000 +0100 +++ new/make/gensrc/Gensrc-jdk.vm.ci.gmk 2015-12-22 15:26:53.000000000 +0100 @@ -36,15 +36,6 @@ ################################################################################ # Compile the annotation processor -$(eval $(call SetupJavaCompilation, BUILD_JVMCI_OPTIONS, \ - SETUP := GENERATE_OLDBYTECODE, \ - SRC := $(SRC_DIR)/jdk.vm.ci.options/src \ - $(SRC_DIR)/jdk.vm.ci.options.processor/src \ - $(SRC_DIR)/jdk.vm.ci.inittimer/src, \ - BIN := $(BUILDTOOLS_OUTPUTDIR)/jvmci_options, \ - JAR := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.ci.options.jar, \ -)) - $(eval $(call SetupJavaCompilation, BUILD_JVMCI_SERVICE, \ SETUP := GENERATE_OLDBYTECODE, \ SRC := $(SRC_DIR)/jdk.vm.ci.service/src \ @@ -69,11 +60,10 @@ ALL_SRC_DIRS := $(wildcard $(SRC_DIR)/*/src) SOURCEPATH := $(call PathList, $(ALL_SRC_DIRS)) PROCESSOR_PATH := $(call PathList, \ - $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.ci.options.jar \ $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.ci.service.jar) $(GENSRC_DIR)/_gensrc_proc_done: $(PROC_SRCS) \ - $(BUILD_JVMCI_OPTIONS) $(BUILD_JVMCI_SERVICE) + $(BUILD_JVMCI_SERVICE) $(MKDIR) -p $(@D) $(eval $(call ListPathsSafely,PROC_SRCS,$(@D)/_gensrc_proc_files)) $(JAVA_SMALL) $(NEW_JAVAC) \ @@ -91,15 +81,6 @@ ################################################################################ -$(GENSRC_DIR)/META-INF/services/jdk.vm.ci.options.OptionDescriptors: \ - $(GENSRC_DIR)/_gensrc_proc_done - $(MKDIR) -p $(@D) - $(FIND) $(GENSRC_DIR) -name '*_OptionDescriptors.java' | $(SED) 's:.*/jdk\.vm\.ci/\(.*\)\.java:\1:' | $(TR) '/' '.' > $@ - -TARGETS += $(GENSRC_DIR)/META-INF/services/jdk.vm.ci.options.OptionDescriptors - -################################################################################ - $(GENSRC_DIR)/_providers_converted: $(GENSRC_DIR)/_gensrc_proc_done $(MKDIR) -p $(GENSRC_DIR)/META-INF/services ($(CD) $(GENSRC_DIR)/META-INF/jvmci.providers && \ --- old/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java 2015-12-22 15:26:54.000000000 +0100 +++ new/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java 2015-12-22 15:26:54.000000000 +0100 @@ -30,28 +30,24 @@ import jdk.vm.ci.meta.Constant; import jdk.vm.ci.meta.ConstantReflectionProvider; import jdk.vm.ci.meta.JavaConstant; -import jdk.vm.ci.meta.JavaField; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaType; import jdk.vm.ci.meta.MemoryAccessProvider; import jdk.vm.ci.meta.MethodHandleAccessProvider; +import jdk.vm.ci.meta.ResolvedJavaField; import jdk.vm.ci.meta.ResolvedJavaType; -import jdk.vm.ci.options.Option; -import jdk.vm.ci.options.OptionType; -import jdk.vm.ci.options.OptionValue; -import jdk.vm.ci.options.StableOptionValue; /** * HotSpot implementation of {@link ConstantReflectionProvider}. */ public class HotSpotConstantReflectionProvider implements ConstantReflectionProvider, HotSpotProxified { - static class Options { - //@formatter:off - @Option(help = "Constant fold final fields with default values.", type = OptionType.Debug) - public static final OptionValue TrustFinalDefaultFields = new OptionValue<>(true); - //@formatter:on - } + private static final String TrustFinalDefaultFieldsProperty = "jvmci.TrustFinalDefaultFields"; + + /** + * Determines whether to treat {@code final} fields with default values as constant. + */ + private static final boolean TrustFinalDefaultFields = HotSpotJVMCIRuntime.getBooleanProperty(TrustFinalDefaultFieldsProperty, true); protected final HotSpotJVMCIRuntimeProvider runtime; protected final HotSpotMethodHandleAccessProvider methodHandleAccess; @@ -239,7 +235,7 @@ /** * Determines if a static field is constant for the purpose of - * {@link #readConstantFieldValue(JavaField, JavaConstant)}. + * {@link #readConstantFieldValue(ResolvedJavaField, JavaConstant)}. */ protected boolean isStaticFieldConstant(HotSpotResolvedJavaField staticField) { if (staticField.isFinal() || staticField.isStable()) { @@ -255,14 +251,14 @@ * Determines if a value read from a {@code final} instance field is considered constant. The * implementation in {@link HotSpotConstantReflectionProvider} returns true if {@code value} is * not the {@link JavaConstant#isDefaultForKind default value} for its kind or if - * {@link Options#TrustFinalDefaultFields} is true. + * {@link #TrustFinalDefaultFields} is true. * * @param value a value read from a {@code final} instance field * @param receiverClass the {@link Object#getClass() class} of object from which the * {@code value} was read */ protected boolean isFinalInstanceFieldValueConstant(JavaConstant value, Class receiverClass) { - return !value.isDefaultForKind() || Options.TrustFinalDefaultFields.getValue(); + return !value.isDefaultForKind() || TrustFinalDefaultFields; } /** @@ -278,13 +274,7 @@ return !value.isDefaultForKind(); } - /** - * {@inheritDoc} - *

- * The {@code value} field in {@link OptionValue} is considered constant if the type of - * {@code receiver} is (assignable to) {@link StableOptionValue}. - */ - public JavaConstant readConstantFieldValue(JavaField field, JavaConstant receiver) { + public JavaConstant readConstantFieldValue(ResolvedJavaField field, JavaConstant receiver) { HotSpotResolvedJavaField hotspotField = (HotSpotResolvedJavaField) field; if (hotspotField.isStatic()) { @@ -319,21 +309,13 @@ return value; } } - } else { - Class clazz = object.getClass(); - if (StableOptionValue.class.isAssignableFrom(clazz)) { - if (hotspotField.isInObject(object) && hotspotField.getName().equals("value")) { - StableOptionValue option = (StableOptionValue) object; - return HotSpotObjectConstantImpl.forObject(option.getValue()); - } - } } } } return null; } - public JavaConstant readFieldValue(JavaField field, JavaConstant receiver) { + public JavaConstant readFieldValue(ResolvedJavaField field, JavaConstant receiver) { HotSpotResolvedJavaField hotspotField = (HotSpotResolvedJavaField) field; if (!hotspotField.isStable()) { return readNonStableFieldValue(field, receiver); @@ -342,7 +324,7 @@ } } - private JavaConstant readNonStableFieldValue(JavaField field, JavaConstant receiver) { + private JavaConstant readNonStableFieldValue(ResolvedJavaField field, JavaConstant receiver) { HotSpotResolvedJavaField hotspotField = (HotSpotResolvedJavaField) field; if (hotspotField.isStatic()) { HotSpotResolvedJavaType holder = (HotSpotResolvedJavaType) hotspotField.getDeclaringClass(); @@ -357,7 +339,7 @@ return null; } - public JavaConstant readStableFieldValue(JavaField field, JavaConstant receiver, boolean isDefaultStable) { + public JavaConstant readStableFieldValue(ResolvedJavaField field, JavaConstant receiver, boolean isDefaultStable) { JavaConstant fieldValue = readNonStableFieldValue(field, receiver); if (fieldValue.isNonNull()) { JavaType declaredType = field.getType(); --- old/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java 2015-12-22 15:26:55.000000000 +0100 +++ new/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java 2015-12-22 15:26:55.000000000 +0100 @@ -49,6 +49,7 @@ import jdk.vm.ci.runtime.JVMCIBackend; import jdk.vm.ci.runtime.JVMCICompiler; import jdk.vm.ci.service.Services; +import sun.misc.VM; //JaCoCo Exclude @@ -83,6 +84,22 @@ return DelayedInit.instance; } + /** + * Gets a boolean value based on a system property {@linkplain VM#getSavedProperty(String) + * saved} at system initialization time. + * + * @param name the name of the system property to derive a boolean value from using + * {@link Boolean#parseBoolean(String)} + * @param def the value to return if there is no system property corresponding to {@code name} + */ + public static boolean getBooleanProperty(String name, boolean def) { + String value = VM.getSavedProperty(name); + if (value == null) { + return def; + } + return Boolean.parseBoolean(value); + } + public static HotSpotJVMCIBackendFactory findFactory(String architecture) { for (HotSpotJVMCIBackendFactory factory : Services.load(HotSpotJVMCIBackendFactory.class)) { if (factory.getArchitecture().equalsIgnoreCase(architecture)) { --- old/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java 2015-12-22 15:26:55.000000000 +0100 +++ new/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java 2015-12-22 15:26:55.000000000 +0100 @@ -35,21 +35,16 @@ import jdk.vm.ci.meta.ModifiersProvider; import jdk.vm.ci.meta.ResolvedJavaField; import jdk.vm.ci.meta.ResolvedJavaType; -import jdk.vm.ci.options.Option; -import jdk.vm.ci.options.OptionType; -import jdk.vm.ci.options.OptionValue; /** * Represents a field in a HotSpot type. */ class HotSpotResolvedJavaFieldImpl implements HotSpotResolvedJavaField, HotSpotProxified { - static class Options { - //@formatter:off - @Option(help = "Mark well-known stable fields as such.", type = OptionType.Debug) - public static final OptionValue ImplicitStableValues = new OptionValue<>(true); - //@formatter:on - } + /** + * Mark well-known stable fields as such. + */ + private static final boolean ImplicitStableValues = HotSpotJVMCIRuntime.getBooleanProperty("jvmci.ImplicitStableValues", true); private final HotSpotResolvedObjectTypeImpl holder; private final String name; @@ -203,7 +198,7 @@ return true; } assert getAnnotation(Stable.class) == null; - if (Options.ImplicitStableValues.getValue() && isImplicitStableField()) { + if (ImplicitStableValues && isImplicitStableField()) { return true; } return false; --- old/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethod.java 2015-12-22 15:26:56.000000000 +0100 +++ new/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethod.java 2015-12-22 15:26:56.000000000 +0100 @@ -27,22 +27,12 @@ import jdk.vm.ci.meta.JavaMethod; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; -import jdk.vm.ci.options.Option; -import jdk.vm.ci.options.OptionType; -import jdk.vm.ci.options.OptionValue; /** * Implementation of {@link JavaMethod} for resolved HotSpot methods. */ public interface HotSpotResolvedJavaMethod extends ResolvedJavaMethod { - public static class Options { - // @formatter:off - @Option(help = "", type = OptionType.Debug) - public static final OptionValue UseProfilingInformation = new OptionValue<>(true); - // @formatter:on - } - /** * Returns true if this method has a {@code CallerSensitive} annotation. * --- old/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java 2015-12-22 15:26:57.000000000 +0100 +++ new/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java 2015-12-22 15:26:57.000000000 +0100 @@ -24,7 +24,6 @@ import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM; import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; -import static jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod.Options.UseProfilingInformation; import static jdk.vm.ci.hotspot.HotSpotVMConfig.config; import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; @@ -424,7 +423,7 @@ public ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR) { ProfilingInfo info; - if (UseProfilingInformation.getValue() && methodData == null) { + if (methodData == null) { long metaspaceMethodData = UNSAFE.getAddress(metaspaceMethod + config().methodDataOffset); if (metaspaceMethodData != 0) { methodData = new HotSpotMethodData(metaspaceMethodData, this); --- old/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java 2015-12-22 15:26:57.000000000 +0100 +++ new/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java 2015-12-22 15:26:57.000000000 +0100 @@ -80,29 +80,31 @@ * @return the constant value of this field or {@code null} if this field is not considered * constant by the runtime */ - JavaConstant readConstantFieldValue(JavaField field, JavaConstant receiver); + JavaConstant readConstantFieldValue(ResolvedJavaField field, JavaConstant receiver); /** * Gets the current value of this field for a given object, if available. * * There is no guarantee that the same value will be returned by this method for a field unless - * the field is considered to be {@linkplain #readConstantFieldValue(JavaField, JavaConstant) - * constant} by the runtime. + * the field is considered to be + * {@linkplain #readConstantFieldValue(ResolvedJavaField, JavaConstant) constant} by the + * runtime. * * @param receiver object from which this field's value is to be read. This value is ignored if * this field is static. * @return the value of this field or {@code null} if the value is not available (e.g., because * the field holder is not yet initialized). */ - JavaConstant readFieldValue(JavaField field, JavaConstant receiver); + JavaConstant readFieldValue(ResolvedJavaField field, JavaConstant receiver); /** * Gets the current value of this field for a given object, if available. Like - * {@link #readFieldValue(JavaField, JavaConstant)} but treats array fields as stable. + * {@link #readFieldValue(ResolvedJavaField, JavaConstant)} but treats array fields as stable. * * There is no guarantee that the same value will be returned by this method for a field unless - * the field is considered to be {@linkplain #readConstantFieldValue(JavaField, JavaConstant) - * constant} by the runtime. + * the field is considered to be + * {@linkplain #readConstantFieldValue(ResolvedJavaField, JavaConstant) constant} by the + * runtime. * * @param receiver object from which this field's value is to be read. This value is ignored if * this field is static. @@ -110,7 +112,7 @@ * @return the value of this field or {@code null} if the value is not available (e.g., because * the field holder is not yet initialized). */ - JavaConstant readStableFieldValue(JavaField field, JavaConstant receiver, boolean isDefaultStable); + JavaConstant readStableFieldValue(ResolvedJavaField field, JavaConstant receiver, boolean isDefaultStable); /** * Converts the given {@link JavaKind#isPrimitive() primitive} constant to a boxed --- old/src/share/vm/jvmci/jvmciRuntime.cpp 2015-12-22 15:26:58.000000000 +0100 +++ new/src/share/vm/jvmci/jvmciRuntime.cpp 2015-12-22 15:26:58.000000000 +0100 @@ -50,15 +50,10 @@ bool JVMCIRuntime::_HotSpotJVMCIRuntime_initialized = false; bool JVMCIRuntime::_well_known_classes_initialized = false; const char* JVMCIRuntime::_compiler = NULL; -int JVMCIRuntime::_options_count = 0; -SystemProperty** JVMCIRuntime::_options = NULL; int JVMCIRuntime::_trivial_prefixes_count = 0; char** JVMCIRuntime::_trivial_prefixes = NULL; bool JVMCIRuntime::_shutdown_called = false; -static const char* OPTION_PREFIX = "jvmci.option."; -static const size_t OPTION_PREFIX_LEN = strlen(OPTION_PREFIX); - BasicType JVMCIRuntime::kindToBasicType(Handle kind, TRAPS) { if (kind.is_null()) { THROW_(vmSymbols::java_lang_NullPointerException(), T_ILLEGAL); @@ -631,16 +626,6 @@ return Handle((oop)result.get_jobject()); } -static bool jvmci_options_file_exists() { - const char* home = Arguments::get_java_home(); - size_t path_len = strlen(home) + strlen("/lib/jvmci.options") + 1; - char path[JVM_MAXPATHLEN]; - char sep = os::file_separator()[0]; - jio_snprintf(path, JVM_MAXPATHLEN, "%s%clib%cjvmci.options", home, sep, sep); - struct stat st; - return os::stat(path, &st) == 0; -} - void JVMCIRuntime::initialize_HotSpotJVMCIRuntime(TRAPS) { if (JNIHandles::resolve(_HotSpotJVMCIRuntime_instance) == NULL) { #ifdef ASSERT @@ -652,30 +637,6 @@ "HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization"); #endif - bool parseOptionsFile = jvmci_options_file_exists(); - if (_options != NULL || parseOptionsFile) { - JavaCallArguments args; - objArrayOop options; - if (_options != NULL) { - options = oopFactory::new_objArray(SystemDictionary::String_klass(), _options_count * 2, CHECK); - for (int i = 0; i < _options_count; i++) { - SystemProperty* prop = _options[i]; - oop name = java_lang_String::create_oop_from_str(prop->key() + OPTION_PREFIX_LEN, CHECK); - const char* prop_value = prop->value() != NULL ? prop->value() : ""; - oop value = java_lang_String::create_oop_from_str(prop_value, CHECK); - options->obj_at_put(i * 2, name); - options->obj_at_put((i * 2) + 1, value); - } - } else { - options = NULL; - } - args.push_oop(options); - args.push_int(parseOptionsFile); - callStatic("jdk/vm/ci/options/OptionsParser", - "parseOptionsFromVM", - "([Ljava/lang/String;Z)Ljava/lang/Boolean;", &args, CHECK); - } - if (_compiler != NULL) { JavaCallArguments args; oop compiler = java_lang_String::create_oop_from_str(_compiler, CHECK); @@ -893,48 +854,6 @@ _compiler = compiler; } -void JVMCIRuntime::maybe_print_flags(TRAPS) { - if (_options != NULL) { - for (int i = 0; i < _options_count; i++) { - SystemProperty* p = _options[i]; - const char* name = p->key() + OPTION_PREFIX_LEN; - if (strcmp(name, "PrintFlags") == 0 || strcmp(name, "ShowFlags") == 0) { - JVMCIRuntime::initialize_well_known_classes(CHECK); - HandleMark hm; - ResourceMark rm; - JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK); - return; - } - } - } -} - -void JVMCIRuntime::save_options(SystemProperty* props) { - int count = 0; - SystemProperty* first = NULL; - for (SystemProperty* p = props; p != NULL; p = p->next()) { - if (strncmp(p->key(), OPTION_PREFIX, OPTION_PREFIX_LEN) == 0) { - if (first == NULL) { - first = p; - } - count++; - } - } - if (count != 0) { - _options_count = count; - _options = NEW_C_HEAP_ARRAY(SystemProperty*, count, mtCompiler); - _options[0] = first; - SystemProperty** insert_pos = _options + 1; - for (SystemProperty* p = first->next(); p != NULL; p = p->next()) { - if (strncmp(p->key(), OPTION_PREFIX, OPTION_PREFIX_LEN) == 0) { - *insert_pos = p; - insert_pos++; - } - } - assert (insert_pos - _options == count, "must be"); - } -} - void JVMCIRuntime::shutdown() { if (_HotSpotJVMCIRuntime_instance != NULL) { _shutdown_called = true; --- old/src/share/vm/jvmci/jvmciRuntime.hpp 2015-12-22 15:26:59.000000000 +0100 +++ new/src/share/vm/jvmci/jvmciRuntime.hpp 2015-12-22 15:26:59.000000000 +0100 @@ -71,8 +71,6 @@ static bool _HotSpotJVMCIRuntime_initialized; static bool _well_known_classes_initialized; static const char* _compiler; - static int _options_count; - static SystemProperty** _options; static int _trivial_prefixes_count; static char** _trivial_prefixes; @@ -99,20 +97,6 @@ */ static void save_compiler(const char* compiler); - /** - * Saves the value of the system properties starting with "jvmci.option." for processing - * when JVMCI is initialized. - * - * @param props the head of the system property list - */ - static void save_options(SystemProperty* props); - - /** - * If either the PrintFlags or ShowFlags JVMCI option is present, - * then JVMCI is initialized to show the help message. - */ - static void maybe_print_flags(TRAPS); - static bool is_HotSpotJVMCIRuntime_initialized() { return _HotSpotJVMCIRuntime_initialized; } /** --- old/src/share/vm/runtime/arguments.cpp 2015-12-22 15:26:59.000000000 +0100 +++ new/src/share/vm/runtime/arguments.cpp 2015-12-22 15:26:59.000000000 +0100 @@ -3344,12 +3344,6 @@ const char* fileSep = os::file_separator(); sprintf(path, "%s%slib%sendorsed", Arguments::get_java_home(), fileSep, fileSep); -#if INCLUDE_JVMCI - if (EnableJVMCI) { - JVMCIRuntime::save_options(_system_properties); - } -#endif // INCLUDE_JVMCI - if (CheckEndorsedAndExtDirs) { int nonEmptyDirs = 0; // check endorsed directory --- old/src/share/vm/runtime/thread.cpp 2015-12-22 15:27:00.000000000 +0100 +++ new/src/share/vm/runtime/thread.cpp 2015-12-22 15:27:00.000000000 +0100 @@ -3657,7 +3657,6 @@ if (jvmciCompiler != NULL) { JVMCIRuntime::save_compiler(jvmciCompiler); } - JVMCIRuntime::maybe_print_flags(CHECK_JNI_ERR); } #endif // INCLUDE_JVMCI --- old/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java 2015-12-22 15:27:01.000000000 +0100 +++ new/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java 2015-12-22 15:27:01.000000000 +0100 @@ -49,8 +49,8 @@ import jdk.vm.ci.meta.ConstantReflectionProvider; import jdk.vm.ci.meta.JavaConstant; -import jdk.vm.ci.meta.JavaField; import jdk.vm.ci.meta.MetaAccessProvider; +import jdk.vm.ci.meta.ResolvedJavaField; import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.meta.TrustedInterface; import jdk.vm.ci.runtime.JVMCI; @@ -179,7 +179,7 @@ List res = new ArrayList<>(); for (Field field : fromClass.getDeclaredFields()) { if (isStatic(field.getModifiers()) && isFinal(field.getModifiers())) { - JavaField javaField = metaAccess.lookupJavaField(field); + ResolvedJavaField javaField = metaAccess.lookupJavaField(field); Object boxed = field.get(null); if (boxed instanceof JavaConstant) { res.add(new ConstantValue(javaField.format("%H.%n"), (JavaConstant) boxed, boxed)); --- old/src/jdk.vm.ci/share/classes/jdk.vm.ci.options.processor/src/META-INF/services/javax.annotation.processing.Processor 2015-12-22 15:27:01.000000000 +0100 +++ /dev/null 2015-12-22 15:27:01.000000000 +0100 @@ -1 +0,0 @@ -jdk.vm.ci.options.processor.OptionProcessor --- old/src/jdk.vm.ci/share/classes/jdk.vm.ci.options.processor/src/jdk/vm/ci/options/processor/OptionProcessor.java 2015-12-22 15:27:02.000000000 +0100 +++ /dev/null 2015-12-22 15:27:02.000000000 +0100 @@ -1,369 +0,0 @@ -/* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.vm.ci.options.processor; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.annotation.processing.AbstractProcessor; -import javax.annotation.processing.Filer; -import javax.annotation.processing.RoundEnvironment; -import javax.annotation.processing.SupportedAnnotationTypes; -import javax.lang.model.SourceVersion; -import javax.lang.model.element.Element; -import javax.lang.model.element.ElementKind; -import javax.lang.model.element.Modifier; -import javax.lang.model.element.Name; -import javax.lang.model.element.PackageElement; -import javax.lang.model.element.TypeElement; -import javax.lang.model.element.VariableElement; -import javax.lang.model.type.DeclaredType; -import javax.lang.model.type.TypeKind; -import javax.lang.model.type.TypeMirror; -import javax.lang.model.util.Elements; -import javax.lang.model.util.Types; -import javax.tools.Diagnostic.Kind; -import javax.tools.JavaFileObject; - -import jdk.vm.ci.options.Option; -import jdk.vm.ci.options.OptionDescriptor; -import jdk.vm.ci.options.OptionDescriptors; -import jdk.vm.ci.options.OptionValue; - -/** - * Processes static fields annotated with {@link Option}. An {@link OptionDescriptors} - * implementation is generated for each top level class containing at least one such field. The name - * of the generated class for top level class {@code com.foo.Bar} is - * {@code com.foo.Bar_OptionDescriptors}. - */ -@SupportedAnnotationTypes({"jdk.vm.ci.options.Option"}) -public class OptionProcessor extends AbstractProcessor { - - @Override - public SourceVersion getSupportedSourceVersion() { - return SourceVersion.latest(); - } - - private final Set processed = new HashSet<>(); - - private void processElement(Element element, OptionsInfo info) { - - if (!element.getModifiers().contains(Modifier.STATIC)) { - processingEnv.getMessager().printMessage(Kind.ERROR, "Option field must be static", element); - return; - } - - Option annotation = element.getAnnotation(Option.class); - assert annotation != null; - assert element instanceof VariableElement; - assert element.getKind() == ElementKind.FIELD; - VariableElement field = (VariableElement) element; - String fieldName = field.getSimpleName().toString(); - - Elements elements = processingEnv.getElementUtils(); - Types types = processingEnv.getTypeUtils(); - - TypeMirror fieldType = field.asType(); - if (fieldType.getKind() != TypeKind.DECLARED) { - processingEnv.getMessager().printMessage(Kind.ERROR, "Option field must be of type " + OptionValue.class.getName(), element); - return; - } - DeclaredType declaredFieldType = (DeclaredType) fieldType; - - TypeMirror optionValueType = elements.getTypeElement(OptionValue.class.getName()).asType(); - if (!types.isSubtype(fieldType, types.erasure(optionValueType))) { - String msg = String.format("Option field type %s is not a subclass of %s", fieldType, optionValueType); - processingEnv.getMessager().printMessage(Kind.ERROR, msg, element); - return; - } - - if (!field.getModifiers().contains(Modifier.STATIC)) { - processingEnv.getMessager().printMessage(Kind.ERROR, "Option field must be static", element); - return; - } - - String help = annotation.help(); - if (help.length() != 0) { - char firstChar = help.charAt(0); - if (!Character.isUpperCase(firstChar)) { - processingEnv.getMessager().printMessage(Kind.ERROR, "Option help text must start with upper case letter", element); - return; - } - } - - String optionName = annotation.name(); - if (optionName.equals("")) { - optionName = fieldName; - } - - DeclaredType declaredOptionValueType = declaredFieldType; - while (!types.isSameType(types.erasure(declaredOptionValueType), types.erasure(optionValueType))) { - List directSupertypes = types.directSupertypes(declaredFieldType); - assert !directSupertypes.isEmpty(); - declaredOptionValueType = (DeclaredType) directSupertypes.get(0); - } - - assert !declaredOptionValueType.getTypeArguments().isEmpty(); - String optionType = declaredOptionValueType.getTypeArguments().get(0).toString(); - if (optionType.startsWith("java.lang.")) { - optionType = optionType.substring("java.lang.".length()); - } - - Element enclosing = element.getEnclosingElement(); - String declaringClass = ""; - String separator = ""; - Set originatingElementsList = info.originatingElements; - originatingElementsList.add(field); - while (enclosing != null) { - if (enclosing.getKind() == ElementKind.CLASS || enclosing.getKind() == ElementKind.INTERFACE) { - if (enclosing.getModifiers().contains(Modifier.PRIVATE)) { - String msg = String.format("Option field cannot be declared in a private %s %s", enclosing.getKind().name().toLowerCase(), enclosing); - processingEnv.getMessager().printMessage(Kind.ERROR, msg, element); - return; - } - originatingElementsList.add(enclosing); - declaringClass = enclosing.getSimpleName() + separator + declaringClass; - separator = "."; - } else { - assert enclosing.getKind() == ElementKind.PACKAGE; - } - enclosing = enclosing.getEnclosingElement(); - } - - info.options.add(new OptionInfo(optionName, help, optionType, declaringClass, field)); - } - - private void createFiles(OptionsInfo info) { - String pkg = ((PackageElement) info.topDeclaringType.getEnclosingElement()).getQualifiedName().toString(); - Name topDeclaringClass = info.topDeclaringType.getSimpleName(); - Element[] originatingElements = info.originatingElements.toArray(new Element[info.originatingElements.size()]); - - createOptionsDescriptorsFile(info, pkg, topDeclaringClass, originatingElements); - } - - private void createOptionsDescriptorsFile(OptionsInfo info, String pkg, Name topDeclaringClass, Element[] originatingElements) { - String optionsClassName = topDeclaringClass + "_" + OptionDescriptors.class.getSimpleName(); - - Filer filer = processingEnv.getFiler(); - try (PrintWriter out = createSourceFile(pkg, optionsClassName, filer, originatingElements)) { - - out.println("// CheckStyle: stop header check"); - out.println("// CheckStyle: stop line length check"); - out.println("// GENERATED CONTENT - DO NOT EDIT"); - out.println("// Source: " + topDeclaringClass + ".java"); - out.println("package " + pkg + ";"); - out.println(""); - out.println("import java.util.*;"); - out.println("import " + OptionDescriptors.class.getPackage().getName() + ".*;"); - out.println(""); - out.println("public class " + optionsClassName + " implements " + OptionDescriptors.class.getSimpleName() + " {"); - - String desc = OptionDescriptor.class.getSimpleName(); - - boolean needPrivateFieldAccessor = false; - int i = 0; - Collections.sort(info.options); - - out.println(" @Override"); - out.println(" public OptionDescriptor get(String value) {"); - out.println(" // CheckStyle: stop line length check"); - if (info.options.size() == 1) { - out.println(" if (value.equals(\"" + info.options.get(0).name + "\")) {"); - } else { - out.println(" switch (value) {"); - } - for (OptionInfo option : info.options) { - String name = option.name; - String optionValue; - if (option.field.getModifiers().contains(Modifier.PRIVATE)) { - needPrivateFieldAccessor = true; - optionValue = "field(" + option.declaringClass + ".class, \"" + option.field.getSimpleName() + "\")"; - } else { - optionValue = option.declaringClass + "." + option.field.getSimpleName(); - } - String type = option.type; - String help = option.help; - String declaringClass = option.declaringClass; - Name fieldName = option.field.getSimpleName(); - if (info.options.size() == 1) { - out.printf(" return %s.create(\"%s\", %s.class, \"%s\", %s.class, \"%s\", %s);\n", desc, name, type, help, declaringClass, fieldName, optionValue); - } else { - out.printf(" case \"" + name + "\": return %s.create(\"%s\", %s.class, \"%s\", %s.class, \"%s\", %s);\n", desc, name, type, help, declaringClass, fieldName, optionValue); - } - } - out.println(" }"); - out.println(" // CheckStyle: resume line length check"); - out.println(" return null;"); - out.println(" }"); - out.println(); - out.println(" @Override"); - out.println(" public Iterator<" + desc + "> iterator() {"); - out.println(" // CheckStyle: stop line length check"); - out.println(" List<" + desc + "> options = Arrays.asList("); - for (OptionInfo option : info.options) { - String optionValue; - if (option.field.getModifiers().contains(Modifier.PRIVATE)) { - needPrivateFieldAccessor = true; - optionValue = "field(" + option.declaringClass + ".class, \"" + option.field.getSimpleName() + "\")"; - } else { - optionValue = option.declaringClass + "." + option.field.getSimpleName(); - } - String name = option.name; - String type = option.type; - String help = option.help; - String declaringClass = option.declaringClass; - Name fieldName = option.field.getSimpleName(); - String comma = i == info.options.size() - 1 ? "" : ","; - out.printf(" %s.create(\"%s\", %s.class, \"%s\", %s.class, \"%s\", %s)%s\n", desc, name, type, help, declaringClass, fieldName, optionValue, comma); - i++; - } - out.println(" );"); - out.println(" // CheckStyle: resume line length check"); - out.println(" return options.iterator();"); - out.println(" }"); - if (needPrivateFieldAccessor) { - out.println(" private static " + OptionValue.class.getSimpleName() + " field(Class declaringClass, String fieldName) {"); - out.println(" try {"); - out.println(" java.lang.reflect.Field field = declaringClass.getDeclaredField(fieldName);"); - out.println(" field.setAccessible(true);"); - out.println(" return (" + OptionValue.class.getSimpleName() + ") field.get(null);"); - out.println(" } catch (Exception e) {"); - out.println(" throw (InternalError) new InternalError().initCause(e);"); - out.println(" }"); - out.println(" }"); - } - out.println("}"); - } - } - - protected PrintWriter createSourceFile(String pkg, String relativeName, Filer filer, Element... originatingElements) { - try { - // Ensure Unix line endings to comply with code style guide checked by Checkstyle - JavaFileObject sourceFile = filer.createSourceFile(pkg + "." + relativeName, originatingElements); - return new PrintWriter(sourceFile.openWriter()) { - - @Override - public void println() { - print("\n"); - } - }; - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - static class OptionInfo implements Comparable { - - final String name; - final String help; - final String type; - final String declaringClass; - final VariableElement field; - - public OptionInfo(String name, String help, String type, String declaringClass, VariableElement field) { - this.name = name; - this.help = help; - this.type = type; - this.declaringClass = declaringClass; - this.field = field; - } - - @Override - public int compareTo(OptionInfo other) { - return name.compareTo(other.name); - } - - @Override - public String toString() { - return declaringClass + "." + field; - } - } - - static class OptionsInfo { - - final Element topDeclaringType; - final List options = new ArrayList<>(); - final Set originatingElements = new HashSet<>(); - - public OptionsInfo(Element topDeclaringType) { - this.topDeclaringType = topDeclaringType; - } - } - - private static Element topDeclaringType(Element element) { - Element enclosing = element.getEnclosingElement(); - if (enclosing == null || enclosing.getKind() == ElementKind.PACKAGE) { - assert element.getKind() == ElementKind.CLASS || element.getKind() == ElementKind.INTERFACE; - return element; - } - return topDeclaringType(enclosing); - } - - @Override - public boolean process(Set annotations, RoundEnvironment roundEnv) { - if (roundEnv.processingOver()) { - return true; - } - - Map map = new HashMap<>(); - for (Element element : roundEnv.getElementsAnnotatedWith(Option.class)) { - if (!processed.contains(element)) { - processed.add(element); - Element topDeclaringType = topDeclaringType(element); - OptionsInfo options = map.get(topDeclaringType); - if (options == null) { - options = new OptionsInfo(topDeclaringType); - map.put(topDeclaringType, options); - } - processElement(element, options); - } - } - - boolean ok = true; - Map uniqueness = new HashMap<>(); - for (OptionsInfo info : map.values()) { - for (OptionInfo option : info.options) { - OptionInfo conflict = uniqueness.put(option.name, option); - if (conflict != null) { - processingEnv.getMessager().printMessage(Kind.ERROR, "Duplicate option names for " + option + " and " + conflict, option.field); - ok = false; - } - } - } - - if (ok) { - for (OptionsInfo info : map.values()) { - createFiles(info); - } - } - - return true; - } -} --- old/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/DerivedOptionValue.java 2015-12-22 15:27:02.000000000 +0100 +++ /dev/null 2015-12-22 15:27:02.000000000 +0100 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.vm.ci.options; - -import java.io.Serializable; -import java.util.function.Supplier; - -import jdk.vm.ci.options.OptionValue.OverrideScope; - -/** - * A cached value that needs to be recomputed when an option changes. - */ -public class DerivedOptionValue { - - public interface OptionSupplier extends Supplier, Serializable { - } - - private final T initialValue; - private final OptionSupplier supplier; - - public DerivedOptionValue(OptionSupplier supplier) { - this.supplier = supplier; - assert OptionValue.getOverrideScope() == null : "derived option value should be initialized outside any override scope"; - this.initialValue = createValue(); - } - - public T getValue() { - OverrideScope overrideScope = OptionValue.getOverrideScope(); - if (overrideScope != null) { - return overrideScope.getDerived(this); - } else { - return initialValue; - } - } - - T createValue() { - return supplier.get(); - } -} --- old/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/NestedBooleanOptionValue.java 2015-12-22 15:27:02.000000000 +0100 +++ /dev/null 2015-12-22 15:27:02.000000000 +0100 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.vm.ci.options; - -/** - * A nested Boolean {@link OptionValue} that can be overridden by a {@link #masterOption master - * option}. - *

- *

  • If the option is present on the command line the specified value is used. - *
  • Otherwise {@link #getValue()} depends on the {@link #masterOption} and evaluates as follows: - *