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