hotspot/src/share/vm/compiler/compilerOracle.cpp
author dpochepk
Wed, 20 Jul 2016 19:35:08 +0300
changeset 40079 40d48ddc12bc
parent 35138 de9e69473956
child 46560 388aa8d67c80
permissions -rw-r--r--
8071652: -XX:CompileOnly does not behave as documented Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
31615
e48d94b97b6c 8130036: Fix problems with imprecise C++ coding.
goetz
parents: 30281
diff changeset
     2
 * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "compiler/compilerOracle.hpp"
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
    27
#include "compiler/methodMatcher.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "memory/allocation.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "memory/oopFactory.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "memory/resourceArea.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "oops/klass.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13202
diff changeset
    32
#include "oops/method.hpp"
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    33
#include "oops/symbol.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
#include "runtime/handles.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    35
#include "runtime/jniHandles.hpp"
25949
34557722059b 6424123: JVM crashes on failed 'strdup' call
zgu
parents: 24658
diff changeset
    36
#include "runtime/os.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    38
enum OptionType {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    39
  IntxType,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    40
  UintxType,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    41
  BoolType,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    42
  CcstrType,
27143
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
    43
  DoubleType,
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    44
  UnknownType
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    45
};
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    47
/* Methods to map real type names to OptionType */
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    48
template<typename T>
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    49
static OptionType get_type_for() {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    50
  return UnknownType;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    51
};
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    52
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    53
template<> OptionType get_type_for<intx>() {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    54
  return IntxType;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    55
}
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    56
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    57
template<> OptionType get_type_for<uintx>() {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    58
  return UintxType;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    59
}
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    60
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    61
template<> OptionType get_type_for<bool>() {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    62
  return BoolType;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    63
}
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
    64
26433
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
    65
template<> OptionType get_type_for<ccstr>() {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
    66
  return CcstrType;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
    67
}
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
    68
27143
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
    69
template<> OptionType get_type_for<double>() {
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
    70
  return DoubleType;
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
    71
}
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
    72
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
// this must parallel the command_names below
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
enum OracleCommand {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  UnknownCommand = -1,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  OracleFirstCommand = 0,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  BreakCommand = OracleFirstCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  PrintCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  ExcludeCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  InlineCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  DontInlineCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  CompileOnlyCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  LogCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  OptionCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  QuietCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  HelpCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  OracleCommandCount
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
// this must parallel the enum OracleCommand
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
static const char * command_names[] = {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  "break",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  "print",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  "exclude",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  "inline",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  "dontinline",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  "compileonly",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  "log",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  "option",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  "quiet",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  "help"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
class MethodMatcher;
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   105
class TypedMethodOptionMatcher;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   106
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   107
static BasicMatcher* lists[OracleCommandCount] = { 0, };
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   108
static TypedMethodOptionMatcher* option_list = NULL;
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33069
diff changeset
   109
static bool any_set = false;
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   110
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   111
class TypedMethodOptionMatcher : public MethodMatcher {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   112
 private:
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   113
  TypedMethodOptionMatcher* _next;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   114
  const char*   _option;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   115
  OptionType    _type;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   116
 public:
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   117
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   118
  union {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   119
    bool bool_value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   120
    intx intx_value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   121
    uintx uintx_value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   122
    double double_value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   123
    ccstr ccstr_value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   124
  } _u;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   125
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   126
  TypedMethodOptionMatcher() : MethodMatcher(),
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   127
    _next(NULL),
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   128
    _type(UnknownType) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   129
      _option = NULL;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   130
      memset(&_u, 0, sizeof(_u));
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   131
  }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   132
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   133
  static TypedMethodOptionMatcher* parse_method_pattern(char*& line, const char*& error_msg);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   134
  TypedMethodOptionMatcher* match(methodHandle method, const char* opt, OptionType type);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   135
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   136
  void init(const char* opt, OptionType type, TypedMethodOptionMatcher* next) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   137
    _next = next;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   138
    _type = type;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   139
    _option = os::strdup_check_oom(opt);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   140
  }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   141
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   142
  void set_next(TypedMethodOptionMatcher* next) {_next = next; }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   143
  TypedMethodOptionMatcher* next() { return _next; }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   144
  OptionType type() { return _type; }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   145
  template<typename T> T value();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   146
  template<typename T> void set_value(T value);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   147
  void print();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   148
  void print_all();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   149
  TypedMethodOptionMatcher* clone();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   150
  ~TypedMethodOptionMatcher();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   151
};
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   152
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   153
// A few templated accessors instead of a full template class.
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   154
template<> intx TypedMethodOptionMatcher::value<intx>() {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   155
  return _u.intx_value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   156
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   157
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   158
template<> uintx TypedMethodOptionMatcher::value<uintx>() {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   159
  return _u.uintx_value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   160
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   161
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   162
template<> bool TypedMethodOptionMatcher::value<bool>() {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   163
  return _u.bool_value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   164
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   165
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   166
template<> double TypedMethodOptionMatcher::value<double>() {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   167
  return _u.double_value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   168
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   169
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   170
template<> ccstr TypedMethodOptionMatcher::value<ccstr>() {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   171
  return _u.ccstr_value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   172
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   173
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   174
template<> void TypedMethodOptionMatcher::set_value(intx value) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   175
  _u.intx_value = value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   176
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   177
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   178
template<> void TypedMethodOptionMatcher::set_value(uintx value) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   179
  _u.uintx_value = value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   180
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   181
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   182
template<> void TypedMethodOptionMatcher::set_value(double value) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   183
  _u.double_value = value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   184
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   185
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   186
template<> void TypedMethodOptionMatcher::set_value(bool value) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   187
  _u.bool_value = value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   188
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   189
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   190
template<> void TypedMethodOptionMatcher::set_value(ccstr value) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   191
  _u.ccstr_value = (const ccstr)os::strdup_check_oom(value);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   192
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   194
void TypedMethodOptionMatcher::print() {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   195
  ttyLocker ttyl;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   196
  print_base(tty);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   197
  switch (_type) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   198
  case IntxType:
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   199
    tty->print_cr(" intx %s = " INTX_FORMAT, _option, value<intx>());
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   200
    break;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   201
  case UintxType:
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   202
    tty->print_cr(" uintx %s = " UINTX_FORMAT, _option, value<uintx>());
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   203
    break;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   204
  case BoolType:
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   205
    tty->print_cr(" bool %s = %s", _option, value<bool>() ? "true" : "false");
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   206
    break;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   207
  case DoubleType:
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   208
    tty->print_cr(" double %s = %f", _option, value<double>());
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   209
    break;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   210
  case CcstrType:
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   211
    tty->print_cr(" const char* %s = '%s'", _option, value<ccstr>());
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   212
    break;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   213
  default:
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   214
    ShouldNotReachHere();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   215
  }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   216
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   217
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   218
void TypedMethodOptionMatcher::print_all() {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   219
   print();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   220
   if (_next != NULL) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   221
     tty->print(" ");
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   222
     _next->print_all();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   223
   }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   224
 }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   225
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   226
TypedMethodOptionMatcher* TypedMethodOptionMatcher::clone() {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   227
  TypedMethodOptionMatcher* m = new TypedMethodOptionMatcher();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   228
  m->_class_mode = _class_mode;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   229
  m->_class_name = _class_name;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   230
  m->_method_mode = _method_mode;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   231
  m->_method_name = _method_name;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   232
  m->_signature = _signature;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   233
  // Need to ref count the symbols
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   234
  if (_class_name != NULL) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   235
    _class_name->increment_refcount();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   236
  }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   237
  if (_method_name != NULL) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   238
    _method_name->increment_refcount();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   239
  }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   240
  if (_signature != NULL) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   241
    _signature->increment_refcount();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   242
  }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   243
  return m;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   244
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   245
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   246
TypedMethodOptionMatcher::~TypedMethodOptionMatcher() {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   247
  if (_option != NULL) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   248
    os::free((void*)_option);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   249
  }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   250
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   251
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   252
TypedMethodOptionMatcher* TypedMethodOptionMatcher::parse_method_pattern(char*& line, const char*& error_msg) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   253
  assert(error_msg == NULL, "Dont call here with error_msg already set");
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   254
  TypedMethodOptionMatcher* tom = new TypedMethodOptionMatcher();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   255
  MethodMatcher::parse_method_pattern(line, error_msg, tom);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   256
  if (error_msg != NULL) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   257
    delete tom;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   258
    return NULL;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   259
  }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   260
  return tom;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   261
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   262
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   263
TypedMethodOptionMatcher* TypedMethodOptionMatcher::match(methodHandle method, const char* opt, OptionType type) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   264
  TypedMethodOptionMatcher* current = this;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   265
  while (current != NULL) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   266
    // Fastest compare first.
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   267
    if (current->type() == type) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   268
      if (strcmp(current->_option, opt) == 0) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   269
        if (current->matches(method)) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   270
          return current;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   271
        }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   272
      }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   273
    }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   274
    current = current->next();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   275
  }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   276
  return NULL;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   277
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   278
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   279
template<typename T>
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   280
static void add_option_string(TypedMethodOptionMatcher* matcher,
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   281
                                        const char* option,
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   282
                                        T value) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   283
  assert(matcher != option_list, "No circular lists please");
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   284
  matcher->init(option, get_type_for<T>(), option_list);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   285
  matcher->set_value<T>(value);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   286
  option_list = matcher;
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33069
diff changeset
   287
  any_set = true;
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   288
  return;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   289
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
static bool check_predicate(OracleCommand command, methodHandle method) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  return ((lists[command] != NULL) &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
          !method.is_null() &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
          lists[command]->match(method));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   297
static void add_predicate(OracleCommand command, BasicMatcher* bm) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
  assert(command != OptionCommand, "must use add_option_string");
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   299
  if (command == LogCommand && !LogCompilation && lists[LogCommand] == NULL) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
    tty->print_cr("Warning:  +LogCompilation must be enabled in order for individual methods to be logged.");
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   301
  }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   302
  bm->set_next(lists[command]);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   303
  lists[command] = bm;
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33069
diff changeset
   304
  if ((command != DontInlineCommand) && (command != InlineCommand)) {
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33069
diff changeset
   305
    any_set = true;
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33069
diff changeset
   306
  }
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   307
  return;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   310
template<typename T>
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33069
diff changeset
   311
bool CompilerOracle::has_option_value(const methodHandle& method, const char* option, T& value) {
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   312
  if (option_list != NULL) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   313
    TypedMethodOptionMatcher* m = option_list->match(method, option, get_type_for<T>());
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   314
    if (m != NULL) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   315
      value = m->value<T>();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   316
      return true;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   317
    }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   318
  }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   319
  return false;
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   320
}
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   321
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33069
diff changeset
   322
bool CompilerOracle::has_any_option() {
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33069
diff changeset
   323
  return any_set;
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33069
diff changeset
   324
}
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33069
diff changeset
   325
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   326
// Explicit instantiation for all OptionTypes supported.
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33069
diff changeset
   327
template bool CompilerOracle::has_option_value<intx>(const methodHandle& method, const char* option, intx& value);
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33069
diff changeset
   328
template bool CompilerOracle::has_option_value<uintx>(const methodHandle& method, const char* option, uintx& value);
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33069
diff changeset
   329
template bool CompilerOracle::has_option_value<bool>(const methodHandle& method, const char* option, bool& value);
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33069
diff changeset
   330
template bool CompilerOracle::has_option_value<ccstr>(const methodHandle& method, const char* option, ccstr& value);
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33069
diff changeset
   331
template bool CompilerOracle::has_option_value<double>(const methodHandle& method, const char* option, double& value);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33069
diff changeset
   333
bool CompilerOracle::has_option_string(const methodHandle& method, const char* option) {
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   334
  bool value = false;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   335
  has_option_value(method, option, value);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   336
  return value;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   337
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   338
33626
jwilhelm
parents: 33593 33451
diff changeset
   339
bool CompilerOracle::should_exclude(const methodHandle& method) {
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33069
diff changeset
   340
  if (check_predicate(ExcludeCommand, method)) {
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33069
diff changeset
   341
    return true;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  if (lists[CompileOnlyCommand] != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
    return !lists[CompileOnlyCommand]->match(method);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
  return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33069
diff changeset
   349
bool CompilerOracle::should_inline(const methodHandle& method) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
  return (check_predicate(InlineCommand, method));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33069
diff changeset
   353
bool CompilerOracle::should_not_inline(const methodHandle& method) {
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   354
  return check_predicate(DontInlineCommand, method) || check_predicate(ExcludeCommand, method);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33069
diff changeset
   357
bool CompilerOracle::should_print(const methodHandle& method) {
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   358
  return check_predicate(PrintCommand, method);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
24658
e41df2fc6e87 8042727: nsk/jdb/unwatch/unwatch001 crash in InstanceKlass::methods_do(void (*)(Method*))
coleenp
parents: 24424
diff changeset
   361
bool CompilerOracle::should_print_methods() {
e41df2fc6e87 8042727: nsk/jdb/unwatch/unwatch001 crash in InstanceKlass::methods_do(void (*)(Method*))
coleenp
parents: 24424
diff changeset
   362
  return lists[PrintCommand] != NULL;
e41df2fc6e87 8042727: nsk/jdb/unwatch/unwatch001 crash in InstanceKlass::methods_do(void (*)(Method*))
coleenp
parents: 24424
diff changeset
   363
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33069
diff changeset
   365
bool CompilerOracle::should_log(const methodHandle& method) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
  if (!LogCompilation)            return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
  if (lists[LogCommand] == NULL)  return true;  // by default, log all
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
  return (check_predicate(LogCommand, method));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33069
diff changeset
   371
bool CompilerOracle::should_break_at(const methodHandle& method) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
  return check_predicate(BreakCommand, method);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
static OracleCommand parse_command_name(const char * line, int* bytes_read) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
  assert(ARRAY_SIZE(command_names) == OracleCommandCount,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
         "command_names size mismatch");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
  *bytes_read = 0;
7701
766eb9258574 6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents: 7397
diff changeset
   380
  char command[33];
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
  int result = sscanf(line, "%32[a-z]%n", command, bytes_read);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  for (uint i = 0; i < ARRAY_SIZE(command_names); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
    if (strcmp(command, command_names[i]) == 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
      return (OracleCommand)i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
  return UnknownCommand;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
static void usage() {
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   391
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   392
  tty->print_cr("The CompileCommand option enables the user of the JVM to control specific");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   393
  tty->print_cr("behavior of the dynamic compilers. Many commands require a pattern that defines");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   394
  tty->print_cr("the set of methods the command shall be applied to. The CompileCommand");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   395
  tty->print_cr("option provides the following commands:");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
  tty->cr();
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   397
  tty->print_cr("  break,<pattern>       - debug breakpoint in compiler and in generated code");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   398
  tty->print_cr("  print,<pattern>       - print assembly");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   399
  tty->print_cr("  exclude,<pattern>     - don't compile or inline");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   400
  tty->print_cr("  inline,<pattern>      - always inline");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   401
  tty->print_cr("  dontinline,<pattern>  - don't inline");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   402
  tty->print_cr("  compileonly,<pattern> - compile only");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   403
  tty->print_cr("  log,<pattern>         - log compilation");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   404
  tty->print_cr("  option,<pattern>,<option type>,<option name>,<value>");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   405
  tty->print_cr("                        - set value of custom option");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   406
  tty->print_cr("  option,<pattern>,<bool option name>");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   407
  tty->print_cr("                        - shorthand for setting boolean flag");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   408
  tty->print_cr("  quiet                 - silence the compile command output");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   409
  tty->print_cr("  help                  - print this text");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   410
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   411
  tty->print_cr("The preferred format for the method matching pattern is:");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   412
  tty->print_cr("  package/Class.method()");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   413
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   414
  tty->print_cr("For backward compatibility this form is also allowed:");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   415
  tty->print_cr("  package.Class::method()");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   416
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   417
  tty->print_cr("The signature can be separated by an optional whitespace or comma:");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   418
  tty->print_cr("  package/Class.method ()");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   419
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   420
  tty->print_cr("The class and method identifier can be used together with leading or");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   421
  tty->print_cr("trailing *'s for a small amount of wildcarding:");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   422
  tty->print_cr("  *ackage/Clas*.*etho*()");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   423
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   424
  tty->print_cr("It is possible to use more than one CompileCommand on the command line:");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   425
  tty->print_cr("  -XX:CompileCommand=exclude,java/*.* -XX:CompileCommand=log,java*.*");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
  tty->cr();
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   427
  tty->print_cr("The CompileCommands can be loaded from a file with the flag");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   428
  tty->print_cr("-XX:CompileCommandFile=<file> or be added to the file '.hotspot_compiler'");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   429
  tty->print_cr("Use the same format in the file as the argument to the CompileCommand flag.");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   430
  tty->print_cr("Add one command on each line.");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   431
  tty->print_cr("  exclude java/*.*");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   432
  tty->print_cr("  option java/*.* ReplayInline");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   433
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   434
  tty->print_cr("The following commands have conflicting behavior: 'exclude', 'inline', 'dontinline',");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   435
  tty->print_cr("and 'compileonly'. There is no priority of commands. Applying (a subset of) these");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   436
  tty->print_cr("commands to the same method results in undefined behavior.");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   437
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   438
};
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   440
// Scan next flag and value in line, return MethodMatcher object on success, NULL on failure.
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   441
// On failure, error_msg contains description for the first error.
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   442
// For future extensions: set error_msg on first error.
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   443
static void scan_flag_and_value(const char* type, const char* line, int& total_bytes_read,
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   444
                                            TypedMethodOptionMatcher* matcher,
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   445
                                            char* errorbuf, const int buf_size) {
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   446
  total_bytes_read = 0;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   447
  int bytes_read = 0;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   448
  char flag[256];
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   449
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   450
  // Read flag name.
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   451
  if (sscanf(line, "%*[ \t]%255[a-zA-Z0-9]%n", flag, &bytes_read) == 1) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   452
    line += bytes_read;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   453
    total_bytes_read += bytes_read;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   454
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   455
    // Read value.
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   456
    if (strcmp(type, "intx") == 0) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   457
      intx value;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   458
      if (sscanf(line, "%*[ \t]" INTX_FORMAT "%n", &value, &bytes_read) == 1) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   459
        total_bytes_read += bytes_read;
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   460
        add_option_string(matcher, flag, value);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   461
        return;
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   462
      } else {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   463
        jio_snprintf(errorbuf, buf_size, "  Value cannot be read for flag %s of type %s ", flag, type);
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   464
      }
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   465
    } else if (strcmp(type, "uintx") == 0) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   466
      uintx value;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   467
      if (sscanf(line, "%*[ \t]" UINTX_FORMAT "%n", &value, &bytes_read) == 1) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   468
        total_bytes_read += bytes_read;
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   469
        add_option_string(matcher, flag, value);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   470
        return;
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   471
      } else {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   472
        jio_snprintf(errorbuf, buf_size, "  Value cannot be read for flag %s of type %s", flag, type);
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   473
      }
26433
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   474
    } else if (strcmp(type, "ccstr") == 0) {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   475
      ResourceMark rm;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   476
      char* value = NEW_RESOURCE_ARRAY(char, strlen(line) + 1);
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   477
      if (sscanf(line, "%*[ \t]%255[_a-zA-Z0-9]%n", value, &bytes_read) == 1) {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   478
        total_bytes_read += bytes_read;
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   479
        add_option_string(matcher, flag, (ccstr)value);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   480
        return;
26433
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   481
      } else {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   482
        jio_snprintf(errorbuf, buf_size, "  Value cannot be read for flag %s of type %s", flag, type);
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   483
      }
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   484
    } else if (strcmp(type, "ccstrlist") == 0) {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   485
      // Accumulates several strings into one. The internal type is ccstr.
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   486
      ResourceMark rm;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   487
      char* value = NEW_RESOURCE_ARRAY(char, strlen(line) + 1);
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   488
      char* next_value = value;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   489
      if (sscanf(line, "%*[ \t]%255[_a-zA-Z0-9]%n", next_value, &bytes_read) == 1) {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   490
        total_bytes_read += bytes_read;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   491
        line += bytes_read;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   492
        next_value += bytes_read;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   493
        char* end_value = next_value-1;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   494
        while (sscanf(line, "%*[ \t]%255[_a-zA-Z0-9]%n", next_value, &bytes_read) == 1) {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   495
          total_bytes_read += bytes_read;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   496
          line += bytes_read;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   497
          *end_value = ' '; // override '\0'
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   498
          next_value += bytes_read;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   499
          end_value = next_value-1;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   500
        }
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   501
        add_option_string(matcher, flag, (ccstr)value);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   502
        return;
26433
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   503
      } else {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   504
        jio_snprintf(errorbuf, buf_size, "  Value cannot be read for flag %s of type %s", flag, type);
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   505
      }
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   506
    } else if (strcmp(type, "bool") == 0) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   507
      char value[256];
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   508
      if (sscanf(line, "%*[ \t]%255[a-zA-Z]%n", value, &bytes_read) == 1) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   509
        if (strcmp(value, "true") == 0) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   510
          total_bytes_read += bytes_read;
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   511
          add_option_string(matcher, flag, true);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   512
          return;
26433
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   513
        } else if (strcmp(value, "false") == 0) {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   514
          total_bytes_read += bytes_read;
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   515
          add_option_string(matcher, flag, false);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   516
          return;
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   517
        } else {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   518
          jio_snprintf(errorbuf, buf_size, "  Value cannot be read for flag %s of type %s", flag, type);
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   519
        }
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   520
      } else {
31615
e48d94b97b6c 8130036: Fix problems with imprecise C++ coding.
goetz
parents: 30281
diff changeset
   521
        jio_snprintf(errorbuf, buf_size, "  Value cannot be read for flag %s of type %s", flag, type);
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   522
      }
27143
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   523
    } else if (strcmp(type, "double") == 0) {
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   524
      char buffer[2][256];
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   525
      // Decimal separator '.' has been replaced with ' ' or '/' earlier,
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   526
      // so read integer and fraction part of double value separately.
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   527
      if (sscanf(line, "%*[ \t]%255[0-9]%*[ /\t]%255[0-9]%n", buffer[0], buffer[1], &bytes_read) == 2) {
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   528
        char value[512] = "";
30281
b1608535e50f 8076475: Misuses of strncpy/strncat
stuefe
parents: 28721
diff changeset
   529
        jio_snprintf(value, sizeof(value), "%s.%s", buffer[0], buffer[1]);
27143
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   530
        total_bytes_read += bytes_read;
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   531
        add_option_string(matcher, flag, atof(value));
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   532
        return;
27143
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   533
      } else {
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   534
        jio_snprintf(errorbuf, buf_size, "  Value cannot be read for flag %s of type %s", flag, type);
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   535
      }
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   536
    } else {
31615
e48d94b97b6c 8130036: Fix problems with imprecise C++ coding.
goetz
parents: 30281
diff changeset
   537
      jio_snprintf(errorbuf, buf_size, "  Type %s not supported ", type);
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   538
    }
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   539
  } else {
31615
e48d94b97b6c 8130036: Fix problems with imprecise C++ coding.
goetz
parents: 30281
diff changeset
   540
    jio_snprintf(errorbuf, buf_size, "  Flag name for type %s should be alphanumeric ", type);
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   541
  }
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   542
  return;
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   543
}
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   544
28721
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   545
int skip_whitespace(char* line) {
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   546
  // Skip any leading spaces
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   547
  int whitespace_read = 0;
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   548
  sscanf(line, "%*[ \t]%n", &whitespace_read);
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   549
  return whitespace_read;
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   550
}
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   551
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   552
void CompilerOracle::print_parse_error(const char*&  error_msg, char* original_line) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   553
  assert(error_msg != NULL, "Must have error_message");
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   554
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   555
  ttyLocker ttyl;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   556
  tty->print_cr("CompileCommand: An error occurred during parsing");
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   557
  tty->print_cr("Line: %s", original_line);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   558
  tty->print_cr("Error: %s", error_msg);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   559
  CompilerOracle::print_tip();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   560
}
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   561
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
void CompilerOracle::parse_from_line(char* line) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
  if (line[0] == '\0') return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
  if (line[0] == '#')  return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
  char* original_line = line;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
  int bytes_read;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
  OracleCommand command = parse_command_name(line, &bytes_read);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
  line += bytes_read;
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   570
  ResourceMark rm;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
7701
766eb9258574 6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents: 7397
diff changeset
   572
  if (command == UnknownCommand) {
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   573
    ttyLocker ttyl;
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   574
    tty->print_cr("CompileCommand: unrecognized command");
7701
766eb9258574 6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents: 7397
diff changeset
   575
    tty->print_cr("  \"%s\"", original_line);
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   576
    CompilerOracle::print_tip();
7701
766eb9258574 6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents: 7397
diff changeset
   577
    return;
766eb9258574 6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents: 7397
diff changeset
   578
  }
766eb9258574 6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents: 7397
diff changeset
   579
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
  if (command == QuietCommand) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
    _quiet = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
  if (command == HelpCommand) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
    usage();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   590
  const char* error_msg = NULL;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   591
  if (command == OptionCommand) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   592
    // Look for trailing options.
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   593
    //
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   594
    // Two types of trailing options are
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   595
    // supported:
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   596
    //
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   597
    // (1) CompileCommand=option,Klass::method,flag
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   598
    // (2) CompileCommand=option,Klass::method,type,flag,value
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   599
    //
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   600
    // Type (1) is used to enable a boolean flag for a method.
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   601
    //
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   602
    // Type (2) is used to support options with a value. Values can have the
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   603
    // the following types: intx, uintx, bool, ccstr, ccstrlist, and double.
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   604
    //
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   605
    // For future extensions: extend scan_flag_and_value()
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   606
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   607
    char option[256]; // stores flag for Type (1) and type of Type (2)
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   608
    line++; // skip the ','
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   609
    TypedMethodOptionMatcher* archetype = TypedMethodOptionMatcher::parse_method_pattern(line, error_msg);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   610
    if (archetype == NULL) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   611
      assert(error_msg != NULL, "Must have error_message");
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   612
      print_parse_error(error_msg, original_line);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   613
      return;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   616
    line += skip_whitespace(line);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   617
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   618
    // This is unnecessarily complex. Should retire multi-option lines and skip while loop
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   619
    while (sscanf(line, "%255[a-zA-Z0-9]%n", option, &bytes_read) == 1) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   620
      line += bytes_read;
28721
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   621
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   622
      // typed_matcher is used as a blueprint for each option, deleted at the end
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   623
      TypedMethodOptionMatcher* typed_matcher = archetype->clone();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   624
      if (strcmp(option, "intx") == 0
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   625
          || strcmp(option, "uintx") == 0
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   626
          || strcmp(option, "bool") == 0
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   627
          || strcmp(option, "ccstr") == 0
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   628
          || strcmp(option, "ccstrlist") == 0
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   629
          || strcmp(option, "double") == 0
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   630
          ) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   631
        char errorbuf[1024] = {0};
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   632
        // Type (2) option: parse flag name and value.
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   633
        scan_flag_and_value(option, line, bytes_read, typed_matcher, errorbuf, sizeof(errorbuf));
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   634
        if (*errorbuf != '\0') {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   635
          error_msg = errorbuf;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   636
          print_parse_error(error_msg, original_line);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   637
          return;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   638
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   639
        line += bytes_read;
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   640
      } else {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   641
        // Type (1) option
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   642
        add_option_string(typed_matcher, option, true);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   643
      }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   644
      if (typed_matcher != NULL && !_quiet) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   645
        // Print out the last match added
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   646
        assert(error_msg == NULL, "No error here");
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   647
        ttyLocker ttyl;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   648
        tty->print("CompileCommand: %s ", command_names[command]);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   649
        typed_matcher->print();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   650
      }
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   651
      line += skip_whitespace(line);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   652
    } // while(
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   653
    delete archetype;
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   654
  } else {  // not an OptionCommand)
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   655
    assert(error_msg == NULL, "Don't call here with error_msg already set");
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   656
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   657
    BasicMatcher* matcher = BasicMatcher::parse_method_pattern(line, error_msg);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   658
    if (error_msg != NULL) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   659
      assert(matcher == NULL, "consistency");
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   660
      print_parse_error(error_msg, original_line);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   661
      return;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   662
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   663
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   664
    add_predicate(command, matcher);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   665
    if (!_quiet) {
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   666
      ttyLocker ttyl;
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   667
      tty->print("CompileCommand: %s ", command_names[command]);
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   668
      matcher->print(tty);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   669
      tty->cr();
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   670
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   671
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   672
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   673
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   674
void CompilerOracle::print_tip() {
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   675
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   676
  tty->print_cr("Usage: '-XX:CompileCommand=command,\"package/Class.method()\"'");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   677
  tty->print_cr("Use:   '-XX:CompileCommand=help' for more information.");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   678
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   679
}
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   680
13194
603ef19adcb8 7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents: 12981
diff changeset
   681
static const char* default_cc_file = ".hotspot_compiler";
603ef19adcb8 7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents: 12981
diff changeset
   682
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   683
static const char* cc_file() {
12981
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   684
#ifdef ASSERT
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   685
  if (CompileCommandFile == NULL)
13194
603ef19adcb8 7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents: 12981
diff changeset
   686
    return default_cc_file;
12981
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   687
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   688
  return CompileCommandFile;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   689
}
12981
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   690
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   691
bool CompilerOracle::has_command_file() {
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   692
  return cc_file() != NULL;
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   693
}
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   694
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   695
bool CompilerOracle::_quiet = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   696
489c9b5090e2 Initial load
duke
parents:
diff changeset
   697
void CompilerOracle::parse_from_file() {
12981
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   698
  assert(has_command_file(), "command file must be specified");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   699
  FILE* stream = fopen(cc_file(), "rt");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   700
  if (stream == NULL) return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   701
489c9b5090e2 Initial load
duke
parents:
diff changeset
   702
  char token[1024];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   703
  int  pos = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   704
  int  c = getc(stream);
14139
339b184759f9 7158804: Improve config file parsing
kamg
parents: 14138
diff changeset
   705
  while(c != EOF && pos < (int)(sizeof(token)-1)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   706
    if (c == '\n') {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   707
      token[pos++] = '\0';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   708
      parse_from_line(token);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   709
      pos = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   710
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   711
      token[pos++] = c;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   712
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   713
    c = getc(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   714
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   715
  token[pos++] = '\0';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   716
  parse_from_line(token);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   717
489c9b5090e2 Initial load
duke
parents:
diff changeset
   718
  fclose(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   719
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
489c9b5090e2 Initial load
duke
parents:
diff changeset
   721
void CompilerOracle::parse_from_string(const char* str, void (*parse_line)(char*)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   722
  char token[1024];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   723
  int  pos = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   724
  const char* sp = str;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   725
  int  c = *sp++;
14139
339b184759f9 7158804: Improve config file parsing
kamg
parents: 14138
diff changeset
   726
  while (c != '\0' && pos < (int)(sizeof(token)-1)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   727
    if (c == '\n') {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   728
      token[pos++] = '\0';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   729
      parse_line(token);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   730
      pos = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   731
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   732
      token[pos++] = c;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   733
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   734
    c = *sp++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   735
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   736
  token[pos++] = '\0';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   737
  parse_line(token);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   738
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   739
489c9b5090e2 Initial load
duke
parents:
diff changeset
   740
void CompilerOracle::append_comment_to_file(const char* message) {
12981
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   741
  assert(has_command_file(), "command file must be specified");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   742
  fileStream stream(fopen(cc_file(), "at"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   743
  stream.print("# ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   744
  for (int index = 0; message[index] != '\0'; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   745
    stream.put(message[index]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   746
    if (message[index] == '\n') stream.print("# ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   747
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   748
  stream.cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   749
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   750
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33069
diff changeset
   751
void CompilerOracle::append_exclude_to_file(const methodHandle& method) {
12981
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   752
  assert(has_command_file(), "command file must be specified");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   753
  fileStream stream(fopen(cc_file(), "at"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   754
  stream.print("exclude ");
14391
df0a1573d5bd 8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass
coleenp
parents: 14147
diff changeset
   755
  method->method_holder()->name()->print_symbol_on(&stream);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   756
  stream.print(".");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   757
  method->name()->print_symbol_on(&stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   758
  method->signature()->print_symbol_on(&stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   759
  stream.cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   760
  stream.cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   761
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   762
489c9b5090e2 Initial load
duke
parents:
diff changeset
   763
489c9b5090e2 Initial load
duke
parents:
diff changeset
   764
void compilerOracle_init() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   765
  CompilerOracle::parse_from_string(CompileCommand, CompilerOracle::parse_from_line);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   766
  CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only);
12981
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   767
  if (CompilerOracle::has_command_file()) {
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   768
    CompilerOracle::parse_from_file();
13194
603ef19adcb8 7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents: 12981
diff changeset
   769
  } else {
603ef19adcb8 7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents: 12981
diff changeset
   770
    struct stat buf;
603ef19adcb8 7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents: 12981
diff changeset
   771
    if (os::stat(default_cc_file, &buf) == 0) {
603ef19adcb8 7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents: 12981
diff changeset
   772
      warning("%s file is present but has been ignored.  "
603ef19adcb8 7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents: 12981
diff changeset
   773
              "Run with -XX:CompileCommandFile=%s to load the file.",
603ef19adcb8 7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents: 12981
diff changeset
   774
              default_cc_file, default_cc_file);
603ef19adcb8 7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents: 12981
diff changeset
   775
    }
12981
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   776
  }
4584
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   777
  if (lists[PrintCommand] != NULL) {
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   778
    if (PrintAssembly) {
13194
603ef19adcb8 7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents: 12981
diff changeset
   779
      warning("CompileCommand and/or %s file contains 'print' commands, but PrintAssembly is also enabled", default_cc_file);
4584
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   780
    } else if (FLAG_IS_DEFAULT(DebugNonSafepoints)) {
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   781
      warning("printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output");
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   782
      DebugNonSafepoints = true;
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   783
    }
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   784
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   785
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   786
489c9b5090e2 Initial load
duke
parents:
diff changeset
   787
489c9b5090e2 Initial load
duke
parents:
diff changeset
   788
void CompilerOracle::parse_compile_only(char * line) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   789
  int i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   790
  char name[1024];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   791
  const char* className = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   792
  const char* methodName = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   793
489c9b5090e2 Initial load
duke
parents:
diff changeset
   794
  bool have_colon = (strstr(line, "::") != NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   795
  char method_sep = have_colon ? ':' : '.';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   796
489c9b5090e2 Initial load
duke
parents:
diff changeset
   797
  if (Verbose) {
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 23185
diff changeset
   798
    tty->print_cr("%s", line);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   799
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   800
489c9b5090e2 Initial load
duke
parents:
diff changeset
   801
  ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   802
  while (*line != '\0') {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   803
    MethodMatcher::Mode c_match = MethodMatcher::Exact;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   804
    MethodMatcher::Mode m_match = MethodMatcher::Exact;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   805
489c9b5090e2 Initial load
duke
parents:
diff changeset
   806
    for (i = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   807
         i < 1024 && *line != '\0' && *line != method_sep && *line != ',' && !isspace(*line);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   808
         line++, i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   809
      name[i] = *line;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   810
      if (name[i] == '.')  name[i] = '/';  // package prefix uses '/'
489c9b5090e2 Initial load
duke
parents:
diff changeset
   811
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   812
489c9b5090e2 Initial load
duke
parents:
diff changeset
   813
    if (i > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   814
      char* newName = NEW_RESOURCE_ARRAY( char, i + 1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   815
      if (newName == NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   816
        return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   817
      strncpy(newName, name, i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   818
      newName[i] = '\0';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   819
489c9b5090e2 Initial load
duke
parents:
diff changeset
   820
      if (className == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   821
        className = newName;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   822
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   823
        methodName = newName;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   824
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   825
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   826
489c9b5090e2 Initial load
duke
parents:
diff changeset
   827
    if (*line == method_sep) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   828
      if (className == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   829
        className = "";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   830
        c_match = MethodMatcher::Any;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   831
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   832
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   833
      // got foo or foo/bar
489c9b5090e2 Initial load
duke
parents:
diff changeset
   834
      if (className == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   835
        ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   836
      } else {
40079
40d48ddc12bc 8071652: -XX:CompileOnly does not behave as documented
dpochepk
parents: 35138
diff changeset
   837
        // missing class name handled as "Any" class match
40d48ddc12bc 8071652: -XX:CompileOnly does not behave as documented
dpochepk
parents: 35138
diff changeset
   838
        if (className[0] == '\0') {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   839
          c_match = MethodMatcher::Any;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   840
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   841
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   842
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   843
489c9b5090e2 Initial load
duke
parents:
diff changeset
   844
    // each directive is terminated by , or NUL or . followed by NUL
489c9b5090e2 Initial load
duke
parents:
diff changeset
   845
    if (*line == ',' || *line == '\0' || (line[0] == '.' && line[1] == '\0')) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   846
      if (methodName == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   847
        methodName = "";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   848
        if (*line != method_sep) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   849
          m_match = MethodMatcher::Any;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   850
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   851
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   852
489c9b5090e2 Initial load
duke
parents:
diff changeset
   853
      EXCEPTION_MARK;
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   854
      Symbol* c_name = SymbolTable::new_symbol(className, CHECK);
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   855
      Symbol* m_name = SymbolTable::new_symbol(methodName, CHECK);
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   856
      Symbol* signature = NULL;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   857
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   858
      BasicMatcher* bm = new BasicMatcher();
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   859
      bm->init(c_name, c_match, m_name, m_match, signature);
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   860
      add_predicate(CompileOnlyCommand, bm);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   861
      if (PrintVMOptions) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   862
        tty->print("CompileOnly: compileonly ");
33069
d8eed614f298 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 31615
diff changeset
   863
        lists[CompileOnlyCommand]->print_all(tty);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   864
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   865
489c9b5090e2 Initial load
duke
parents:
diff changeset
   866
      className = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   867
      methodName = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   868
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   869
489c9b5090e2 Initial load
duke
parents:
diff changeset
   870
    line = *line == '\0' ? line : line + 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   871
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   872
}