Mercurial > hg > truffle
diff src/share/vm/jvmci/jvmciRuntime.hpp @ 21562:47bebae7454f
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 28 May 2015 21:58:33 +0200 |
parents | src/share/vm/graal/graalRuntime.hpp@4b3b38415adf src/share/vm/graal/graalRuntime.hpp@be896a1983c0 |
children | 4f63449b4422 |
line wrap: on
line diff
--- a/src/share/vm/jvmci/jvmciRuntime.hpp Thu May 28 17:13:22 2015 +0200 +++ b/src/share/vm/jvmci/jvmciRuntime.hpp Thu May 28 21:58:33 2015 +0200 @@ -27,104 +27,67 @@ #include "interpreter/interpreter.hpp" #include "memory/allocation.hpp" #include "runtime/deoptimization.hpp" +#include "jvmci/jvmciOptions.hpp" + +class ParseClosure : public StackObj { + int _lineNo; + char* _filename; + bool _abort; +protected: + void abort() { _abort = true; } + void warn_and_abort(const char* message) { + warn(message); + abort(); + } + void warn(const char* message) { + warning("Error at line %d while parsing %s: %s", _lineNo, _filename == NULL ? "?" : _filename, message); + } + public: + ParseClosure() : _lineNo(0), _filename(NULL), _abort(false) {} + void parse_line(char* line) { + _lineNo++; + do_line(line); + } + virtual void do_line(char* line) = 0; + int lineNo() { return _lineNo; } + bool is_aborted() { return _abort; } + void set_filename(char* path) {_filename = path; _lineNo = 0;} +}; class JVMCIRuntime: public CHeapObj<mtCompiler> { private: - static jobject _HotSpotJVMCIRuntime_instance; static bool _HotSpotJVMCIRuntime_initialized; - static const char* _generated_sources_sha1; static bool _shutdown_called; /** - * Reads the OptionValue object from a specified static field. - * - * @throws LinkageError if the field could not be resolved - */ - static Handle get_OptionValue(const char* declaringClass, const char* fieldName, const char* fieldSig, TRAPS); - - /** - * Parses the string form of a numeric, float or double option into a jlong (using raw bits for floats/doubles). - * - * @param spec 'i', 'f' or 'd' (see HotSpotOptions.setOption()) - * @param name option name - * @param name_len length of option name - * @param value string value to parse - * @throws InternalError if value could not be parsed according to spec - */ - static jlong parse_primitive_option_value(char spec, const char* name, size_t name_len, const char* value, TRAPS); - - /** * Loads default option value overrides from a <jre_home>/lib/jvmci.options if it exists. Each * line in this file must have the format of a JVMCI command line option without the * leading "-G:" prefix. These option values are set prior to processing of any JVMCI * options present on the command line. */ - static void parse_jvmci_options_file(KlassHandle hotSpotOptionsClass, TRAPS); - - /** - * Parses a given argument and sets the denoted JVMCI option. - * - * @throws InternalError if there was a problem parsing or setting the option - */ - static void parse_argument(KlassHandle hotSpotOptionsClass, char* arg, TRAPS); - - /** - * Searches for a Boolean JVMCI option denoted by a given name and sets it value. - * - * The definition of this method is in jvmciRuntime.inline.hpp - * which is generated by com.oracle.jvmci.hotspot.sourcegen.GenJVMCIRuntimeInlineHpp. - * - * @param hotSpotOptionsClass the HotSpotOptions klass or NULL if only checking for valid option - * @param name option name - * @param name_len length of option name - * @param value '+' to set the option, '-' to reset the option - * @returns true if the option was found - * @throws InternalError if there was a problem setting the option's value - */ - static bool set_option_bool(KlassHandle hotSpotOptionsClass, char* name, size_t name_len, char value, TRAPS); + static void parse_jvmci_options_file(OptionsValueTable* options); - /** - * Searches for a JVMCI option denoted by a given name and sets it value. - * - * The definition of this method is in jvmciRuntime.inline.hpp - * which is generated by com.oracle.jvmci.hotspot.sourcegen.GenJVMCIRuntimeInlineHpp. - * - * @param hotSpotOptionsClass the HotSpotOptions klass or NULL if only checking for valid option - * @param name option name - * @param name_len length of option name - * @returns true if the option was found - * @throws InternalError if there was a problem setting the option's value - */ - static bool set_option(KlassHandle hotSpotOptionsClass, char* name, size_t name_len, const char* value, TRAPS); - - /** - * Raises an InternalError for an option that expects a value but was specified without a "=<value>" prefix. - */ - static void check_required_value(const char* name, size_t name_len, const char* value, TRAPS); - - /** - * Java call to HotSpotOptions.setOption(String name, OptionValue<?> option, char spec, String stringValue, long primitiveValue) - * - * @param name option name - * @param name_len length of option name - */ - static void set_option_helper(KlassHandle hotSpotOptionsClass, char* name, size_t name_len, Handle option, jchar spec, Handle stringValue, jlong primitiveValue); - + static void print_flags_helper(TRAPS); /** * Instantiates a service object, calls its default constructor and returns it. * - * @param name the name of a class implementing com.oracle.jvmci.api.runtime.Service + * @param name the name of a class implementing com.oracle.jvmci.runtime.Service */ static Handle create_Service(const char* name, TRAPS); + public: + /** - * Checks that _generated_sources_sha1 equals GeneratedSourcesSha1.value. + * Parses the JVMCI specific VM options that were presented by the launcher and sets + * the relevants Java fields. */ - static void check_generated_sources_sha1(TRAPS); + static OptionsValueTable* parse_arguments(); - public: + static bool parse_argument(OptionsValueTable* options, const char* arg); + + static void set_options(OptionsValueTable* options, TRAPS); /** * Ensures that the JVMCI class loader is initialized and the well known JVMCI classes are loaded. @@ -171,12 +134,11 @@ * Given an interface representing a JVMCI service (i.e. sub-interface of * com.oracle.jvmci.api.runtime.Service), gets an array of objects, one per * known implementation of the service. - * - * The definition of this method is in jvmciRuntime.inline.hpp - * which is generated by com.oracle.jvmci.hotspot.sourcegen.GenJVMCIRuntimeInlineHpp. */ static Handle get_service_impls(KlassHandle serviceKlass, TRAPS); + static void parse_lines(char* path, ParseClosure* closure, bool warnStatFailure); + /** * Aborts the VM due to an unexpected exception. */ @@ -222,20 +184,6 @@ static BufferBlob* initialize_buffer_blob(); - /** - * Checks that all JVMCI specific VM options presented by the launcher are recognized - * and formatted correctly. To set relevant Java fields from the option, parse_arguments() - * must be called. This method makes no Java calls apart from creating exception objects - * if there is an errors in the JVMCI options. - */ - static jint check_arguments(TRAPS); - - /** - * Parses the JVMCI specific VM options that were presented by the launcher and sets - * the relevants Java fields. - */ - static void parse_arguments(KlassHandle hotSpotOptionsClass, TRAPS); - static BasicType kindToBasicType(jchar ch); // The following routines are all called from compiled JVMCI code