diff src/share/vm/graal/graalRuntime.hpp @ 21516:fe4a77bec5b7

Use GraalRuntime::parse_lines in GraalRuntime::parse_graal_options_file
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Thu, 07 May 2015 16:59:34 +0200
parents 1ab7802d35c9
children cecb4e39521c
line wrap: on
line diff
--- a/src/share/vm/graal/graalRuntime.hpp	Thu May 07 16:00:42 2015 +0200
+++ b/src/share/vm/graal/graalRuntime.hpp	Thu May 07 16:59:34 2015 +0200
@@ -29,8 +29,25 @@
 #include "runtime/deoptimization.hpp"
 
 class ParseClosure : public StackObj {
+protected:
+  int _lineNo;
+  char* _filename;
+  bool _abort;
+  void abort() { _abort = true; }
+  void warn_and_abort(const char* message) {
+    warning("Error at line %d while parsing %s: %s", _lineNo, _filename == NULL ? "?" : _filename, message);
+    abort();
+  }
  public:
+  ParseClosure() : _lineNo(0), _filename(NULL) {}
+  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; }
 };
 
 class GraalRuntime: public CHeapObj<mtCompiler> {
@@ -69,13 +86,6 @@
   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
@@ -132,6 +142,13 @@
  public:
 
   /**
+   * 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);
+
+  /**
    * Ensures that the Graal class loader is initialized and the well known Graal classes are loaded.
    */
   static void ensure_graal_class_loader_is_initialized();
@@ -182,7 +199,7 @@
    */
   static Handle get_service_impls(KlassHandle serviceKlass, TRAPS);
 
-  static void parse_lines(char* path, ParseClosure* closure, TRAPS);
+  static void parse_lines(char* path, ParseClosure* closure, bool warnStatFailure, TRAPS);
 
   /**
    * Aborts the VM due to an unexpected exception.