Mercurial > hg > graal-jvmci-8
diff src/share/vm/graal/graalRuntime.hpp @ 21576:9c2c8e4b5333
Merge with 4b3b38415adf974774952abb69b359053d6f0018
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Thu, 28 May 2015 10:16:13 -0700 |
parents | 923c37b10fb4 4b3b38415adf |
children |
line wrap: on
line diff
--- a/src/share/vm/graal/graalRuntime.hpp Thu May 28 09:51:44 2015 -0700 +++ b/src/share/vm/graal/graalRuntime.hpp Thu May 28 10:16:13 2015 -0700 @@ -27,91 +27,49 @@ #include "interpreter/interpreter.hpp" #include "memory/allocation.hpp" #include "runtime/deoptimization.hpp" +#include "graal/graalOptions.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 GraalRuntime: public CHeapObj<mtCompiler> { private: - static jobject _HotSpotGraalRuntime_instance; static bool _HotSpotGraalRuntime_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/graal.options if it exists. Each * line in this file must have the format of a Graal command line option without the * leading "-G:" prefix. These option values are set prior to processing of any Graal * options present on the command line. */ - static void parse_graal_options_file(KlassHandle hotSpotOptionsClass, TRAPS); - - /** - * Parses a given argument and sets the denoted Graal 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 Graal option denoted by a given name and sets it value. - * - * The definition of this method is in graalRuntime.inline.hpp - * which is generated by com.oracle.graal.hotspot.sourcegen.GenGraalRuntimeInlineHpp. - * - * @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_graal_options_file(OptionsValueTable* options); - /** - * Searches for a Graal option denoted by a given name and sets it value. - * - * The definition of this method is in graalRuntime.inline.hpp - * which is generated by com.oracle.graal.hotspot.sourcegen.GenGraalRuntimeInlineHpp. - * - * @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. * @@ -119,12 +77,17 @@ */ static Handle create_Service(const char* name, TRAPS); + public: + /** - * Checks that _generated_sources_sha1 equals GeneratedSourcesSha1.value. + * Parses the Graal 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 Graal class loader is initialized and the well known Graal classes are loaded. @@ -171,12 +134,11 @@ * Given an interface representing a Graal service (i.e. sub-interface of * com.oracle.graal.api.runtime.Service), gets an array of objects, one per * known implementation of the service. - * - * The definition of this method is in graalRuntime.inline.hpp - * which is generated by com.oracle.graal.hotspot.sourcegen.GenGraalRuntimeInlineHpp. */ 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 Graal 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 Graal 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 Graal code