hotspot/src/share/vm/compiler/compilerOracle.cpp
author coleenp
Thu, 23 Jul 2015 15:17:58 -0400
changeset 31981 9caa094a485f
parent 31615 e48d94b97b6c
child 33069 d8eed614f298
permissions -rw-r--r--
8082782: vm crash on StressRedefineWithoutBytecodeCorruption fails with assert(((Metadata*)obj)->is_valid()) failed: obj is valid Summary: Walk compile task for Method* to not deallocate, store methods in methodHandle while compile task is being taken off compile queue Reviewed-by: dcubed, sspitsyn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
31615
e48d94b97b6c 8130036: Fix problems with imprecise C++ coding.
goetz
parents: 30281
diff changeset
     2
 * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4584
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "compiler/compilerOracle.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "memory/allocation.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "memory/oopFactory.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "memory/resourceArea.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "oops/klass.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13202
diff changeset
    31
#include "oops/method.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "oops/oop.inline.hpp"
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    33
#include "oops/symbol.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
#include "runtime/handles.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    35
#include "runtime/jniHandles.hpp"
25949
34557722059b 6424123: JVM crashes on failed 'strdup' call
zgu
parents: 24658
diff changeset
    36
#include "runtime/os.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 8921
diff changeset
    38
class MethodMatcher : public CHeapObj<mtCompiler> {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  enum Mode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
    Exact,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    Prefix = 1,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    Suffix = 2,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    Substring = Prefix | Suffix,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
    Any,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
    Unknown = -1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
 protected:
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    50
  Symbol*        _class_name;
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    51
  Symbol*        _method_name;
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    52
  Symbol*        _signature;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  Mode           _class_mode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  Mode           _method_mode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  MethodMatcher* _next;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    57
  static bool match(Symbol* candidate, Symbol* match, Mode match_mode);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    59
  Symbol* class_name() const { return _class_name; }
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    60
  Symbol* method_name() const { return _method_name; }
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    61
  Symbol* signature() const { return _signature; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
 public:
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    64
  MethodMatcher(Symbol* class_name, Mode class_mode,
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    65
                Symbol* method_name, Mode method_mode,
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    66
                Symbol* signature, MethodMatcher* next);
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    67
  MethodMatcher(Symbol* class_name, Symbol* method_name, MethodMatcher* next);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  // utility method
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  MethodMatcher* find(methodHandle method) {
14391
df0a1573d5bd 8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass
coleenp
parents: 14147
diff changeset
    71
    Symbol* class_name  = method->method_holder()->name();
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    72
    Symbol* method_name = method->name();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    for (MethodMatcher* current = this; current != NULL; current = current->_next) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
      if (match(class_name, current->class_name(), current->_class_mode) &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
          match(method_name, current->method_name(), current->_method_mode) &&
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    76
          (current->signature() == NULL || current->signature() == method->signature())) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
        return current;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  bool match(methodHandle method) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    return find(method) != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  MethodMatcher* next() const { return _next; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    89
  static void print_symbol(Symbol* h, Mode mode) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    if (mode == Suffix || mode == Substring || mode == Any) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
      tty->print("*");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    if (mode != Any) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
    96
      h->print_symbol_on(tty);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    if (mode == Prefix || mode == Substring) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
      tty->print("*");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  void print_base() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    print_symbol(class_name(), _class_mode);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    tty->print(".");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    print_symbol(method_name(), _method_mode);
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   107
    if (signature() != NULL) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
      signature()->print_symbol_on(tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  virtual void print() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    print_base();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
    tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   118
MethodMatcher::MethodMatcher(Symbol* class_name, Symbol* method_name, MethodMatcher* next) {
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   119
  _class_name  = class_name;
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   120
  _method_name = method_name;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  _next        = next;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  _class_mode  = MethodMatcher::Exact;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  _method_mode = MethodMatcher::Exact;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  _signature   = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   128
MethodMatcher::MethodMatcher(Symbol* class_name, Mode class_mode,
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   129
                             Symbol* method_name, Mode method_mode,
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   130
                             Symbol* signature, MethodMatcher* next):
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    _class_mode(class_mode)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  , _method_mode(method_mode)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  , _next(next)
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   134
  , _class_name(class_name)
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   135
  , _method_name(method_name)
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   136
  , _signature(signature) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   139
bool MethodMatcher::match(Symbol* candidate, Symbol* match, Mode match_mode) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  if (match_mode == Any) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
    return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  if (match_mode == Exact) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   145
    return candidate == match;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  const char * candidate_string = candidate->as_C_string();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  const char * match_string = match->as_C_string();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  switch (match_mode) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  case Prefix:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
    return strstr(candidate_string, match_string) == candidate_string;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  case Suffix: {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
    size_t clen = strlen(candidate_string);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
    size_t mlen = strlen(match_string);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
    return clen >= mlen && strcmp(candidate_string + clen - mlen, match_string) == 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  case Substring:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
    return strstr(candidate_string, match_string) != NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
    return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   170
enum OptionType {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   171
  IntxType,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   172
  UintxType,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   173
  BoolType,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   174
  CcstrType,
27143
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   175
  DoubleType,
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   176
  UnknownType
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   177
};
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   179
/* Methods to map real type names to OptionType */
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   180
template<typename T>
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   181
static OptionType get_type_for() {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   182
  return UnknownType;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   183
};
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   184
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   185
template<> OptionType get_type_for<intx>() {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   186
  return IntxType;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   187
}
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   188
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   189
template<> OptionType get_type_for<uintx>() {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   190
  return UintxType;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   191
}
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   192
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   193
template<> OptionType get_type_for<bool>() {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   194
  return BoolType;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   195
}
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   196
26433
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   197
template<> OptionType get_type_for<ccstr>() {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   198
  return CcstrType;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   199
}
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   200
27143
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   201
template<> OptionType get_type_for<double>() {
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   202
  return DoubleType;
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   203
}
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   204
26433
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   205
template<typename T>
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   206
static const T copy_value(const T value) {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   207
  return value;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   208
}
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   209
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   210
template<> const ccstr copy_value<ccstr>(const ccstr value) {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   211
  return (const ccstr)os::strdup_check_oom(value);
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   212
}
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   213
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   214
template <typename T>
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   215
class TypedMethodOptionMatcher : public MethodMatcher {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   216
  const char* _option;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   217
  OptionType _type;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   218
  const T _value;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   219
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   220
public:
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   221
  TypedMethodOptionMatcher(Symbol* class_name, Mode class_mode,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   222
                           Symbol* method_name, Mode method_mode,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   223
                           Symbol* signature, const char* opt,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   224
                           const T value,  MethodMatcher* next) :
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   225
    MethodMatcher(class_name, class_mode, method_name, method_mode, signature, next),
26433
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   226
                  _type(get_type_for<T>()), _value(copy_value<T>(value)) {
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   227
    _option = os::strdup_check_oom(opt);
25949
34557722059b 6424123: JVM crashes on failed 'strdup' call
zgu
parents: 24658
diff changeset
   228
  }
34557722059b 6424123: JVM crashes on failed 'strdup' call
zgu
parents: 24658
diff changeset
   229
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   230
  ~TypedMethodOptionMatcher() {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   231
    os::free((void*)_option);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   234
  TypedMethodOptionMatcher* match(methodHandle method, const char* opt) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   235
    TypedMethodOptionMatcher* current = this;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
    while (current != NULL) {
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   237
      current = (TypedMethodOptionMatcher*)current->find(method);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
      if (current == NULL) {
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   239
        return NULL;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
      }
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   241
      if (strcmp(current->_option, opt) == 0) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   242
        return current;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
      current = current->next();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
    }
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   246
    return NULL;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   247
  }
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   248
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   249
  TypedMethodOptionMatcher* next() {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   250
    return (TypedMethodOptionMatcher*)_next;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   253
  OptionType get_type(void) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   254
      return _type;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   255
  };
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   256
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   257
  T value() { return _value; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   259
  void print() {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   260
    ttyLocker ttyl;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
    print_base();
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   262
    tty->print(" %s", _option);
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   263
    tty->print(" <unknown option type>");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
    tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   268
template<>
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   269
void TypedMethodOptionMatcher<intx>::print() {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   270
  ttyLocker ttyl;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   271
  print_base();
26433
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   272
  tty->print(" intx %s", _option);
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   273
  tty->print(" = " INTX_FORMAT, _value);
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   274
  tty->cr();
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   275
};
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   277
template<>
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   278
void TypedMethodOptionMatcher<uintx>::print() {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   279
  ttyLocker ttyl;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   280
  print_base();
26433
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   281
  tty->print(" uintx %s", _option);
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   282
  tty->print(" = " UINTX_FORMAT, _value);
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   283
  tty->cr();
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   284
};
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   285
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   286
template<>
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   287
void TypedMethodOptionMatcher<bool>::print() {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   288
  ttyLocker ttyl;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   289
  print_base();
26433
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   290
  tty->print(" bool %s", _option);
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   291
  tty->print(" = %s", _value ? "true" : "false");
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   292
  tty->cr();
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   293
};
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   294
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   295
template<>
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   296
void TypedMethodOptionMatcher<ccstr>::print() {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   297
  ttyLocker ttyl;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   298
  print_base();
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   299
  tty->print(" const char* %s", _option);
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   300
  tty->print(" = '%s'", _value);
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   301
  tty->cr();
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   302
};
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
27143
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   304
template<>
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   305
void TypedMethodOptionMatcher<double>::print() {
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   306
  ttyLocker ttyl;
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   307
  print_base();
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   308
  tty->print(" double %s", _option);
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   309
  tty->print(" = %f", _value);
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   310
  tty->cr();
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   311
};
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   312
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
// this must parallel the command_names below
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
enum OracleCommand {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  UnknownCommand = -1,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
  OracleFirstCommand = 0,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  BreakCommand = OracleFirstCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  PrintCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
  ExcludeCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  InlineCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  DontInlineCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
  CompileOnlyCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  LogCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
  OptionCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  QuietCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
  HelpCommand,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  OracleCommandCount
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
// this must parallel the enum OracleCommand
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
static const char * command_names[] = {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  "break",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  "print",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  "exclude",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
  "inline",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
  "dontinline",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
  "compileonly",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
  "log",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  "option",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
  "quiet",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  "help"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
class MethodMatcher;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
static MethodMatcher* lists[OracleCommandCount] = { 0, };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
static bool check_predicate(OracleCommand command, methodHandle method) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
  return ((lists[command] != NULL) &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
          !method.is_null() &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
          lists[command]->match(method));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
static MethodMatcher* add_predicate(OracleCommand command,
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   356
                                    Symbol* class_name, MethodMatcher::Mode c_mode,
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   357
                                    Symbol* method_name, MethodMatcher::Mode m_mode,
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   358
                                    Symbol* signature) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
  assert(command != OptionCommand, "must use add_option_string");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  if (command == LogCommand && !LogCompilation && lists[LogCommand] == NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
    tty->print_cr("Warning:  +LogCompilation must be enabled in order for individual methods to be logged.");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
  lists[command] = new MethodMatcher(class_name, c_mode, method_name, m_mode, signature, lists[command]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  return lists[command];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   366
template<typename T>
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   367
static MethodMatcher* add_option_string(Symbol* class_name, MethodMatcher::Mode c_mode,
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   368
                                        Symbol* method_name, MethodMatcher::Mode m_mode,
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   369
                                        Symbol* signature,
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   370
                                        const char* option,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   371
                                        T value) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   372
  lists[OptionCommand] = new TypedMethodOptionMatcher<T>(class_name, c_mode, method_name, m_mode,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   373
                                                         signature, option, value, lists[OptionCommand]);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
  return lists[OptionCommand];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   377
template<typename T>
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   378
static bool get_option_value(methodHandle method, const char* option, T& value) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   379
   TypedMethodOptionMatcher<T>* m;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   380
   if (lists[OptionCommand] != NULL
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   381
       && (m = ((TypedMethodOptionMatcher<T>*)lists[OptionCommand])->match(method, option)) != NULL
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   382
       && m->get_type() == get_type_for<T>()) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   383
       value = m->value();
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   384
       return true;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   385
   } else {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   386
     return false;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   387
   }
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   388
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
bool CompilerOracle::has_option_string(methodHandle method, const char* option) {
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   391
  bool value = false;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   392
  get_option_value(method, option, value);
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   393
  return value;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   396
template<typename T>
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   397
bool CompilerOracle::has_option_value(methodHandle method, const char* option, T& value) {
26441
fb92944bb02d 8057129: Fix AIX build after the Extend CompileCommand=option change 8055286
simonis
parents: 26433
diff changeset
   398
  return ::get_option_value(method, option, value);
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   399
}
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   400
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   401
// Explicit instantiation for all OptionTypes supported.
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   402
template bool CompilerOracle::has_option_value<intx>(methodHandle method, const char* option, intx& value);
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   403
template bool CompilerOracle::has_option_value<uintx>(methodHandle method, const char* option, uintx& value);
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   404
template bool CompilerOracle::has_option_value<bool>(methodHandle method, const char* option, bool& value);
26433
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   405
template bool CompilerOracle::has_option_value<ccstr>(methodHandle method, const char* option, ccstr& value);
27143
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   406
template bool CompilerOracle::has_option_value<double>(methodHandle method, const char* option, double& value);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
bool CompilerOracle::should_exclude(methodHandle method, bool& quietly) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
  quietly = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
  if (lists[ExcludeCommand] != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
    if (lists[ExcludeCommand]->match(method)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
      quietly = _quiet;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
      return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
  if (lists[CompileOnlyCommand] != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
    return !lists[CompileOnlyCommand]->match(method);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
  return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
bool CompilerOracle::should_inline(methodHandle method) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
  return (check_predicate(InlineCommand, method));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
bool CompilerOracle::should_not_inline(methodHandle method) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
  return (check_predicate(DontInlineCommand, method));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
bool CompilerOracle::should_print(methodHandle method) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
  return (check_predicate(PrintCommand, method));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
24658
e41df2fc6e87 8042727: nsk/jdb/unwatch/unwatch001 crash in InstanceKlass::methods_do(void (*)(Method*))
coleenp
parents: 24424
diff changeset
   438
bool CompilerOracle::should_print_methods() {
e41df2fc6e87 8042727: nsk/jdb/unwatch/unwatch001 crash in InstanceKlass::methods_do(void (*)(Method*))
coleenp
parents: 24424
diff changeset
   439
  return lists[PrintCommand] != NULL;
e41df2fc6e87 8042727: nsk/jdb/unwatch/unwatch001 crash in InstanceKlass::methods_do(void (*)(Method*))
coleenp
parents: 24424
diff changeset
   440
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
bool CompilerOracle::should_log(methodHandle method) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
  if (!LogCompilation)            return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
  if (lists[LogCommand] == NULL)  return true;  // by default, log all
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
  return (check_predicate(LogCommand, method));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
bool CompilerOracle::should_break_at(methodHandle method) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
  return check_predicate(BreakCommand, method);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
static OracleCommand parse_command_name(const char * line, int* bytes_read) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
  assert(ARRAY_SIZE(command_names) == OracleCommandCount,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
         "command_names size mismatch");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
  *bytes_read = 0;
7701
766eb9258574 6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents: 7397
diff changeset
   459
  char command[33];
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
  int result = sscanf(line, "%32[a-z]%n", command, bytes_read);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
  for (uint i = 0; i < ARRAY_SIZE(command_names); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
    if (strcmp(command, command_names[i]) == 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
      return (OracleCommand)i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
  return UnknownCommand;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
static void usage() {
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   470
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   471
  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
   472
  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
   473
  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
   474
  tty->print_cr("option provides the following commands:");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
  tty->cr();
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   476
  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
   477
  tty->print_cr("  print,<pattern>       - print assembly");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   478
  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
   479
  tty->print_cr("  inline,<pattern>      - always inline");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   480
  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
   481
  tty->print_cr("  compileonly,<pattern> - compile only");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   482
  tty->print_cr("  log,<pattern>         - log compilation");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   483
  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
   484
  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
   485
  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
   486
  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
   487
  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
   488
  tty->print_cr("  help                  - print this text");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   489
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   490
  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
   491
  tty->print_cr("  package/Class.method()");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   492
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   493
  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
   494
  tty->print_cr("  package.Class::method()");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   495
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   496
  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
   497
  tty->print_cr("  package/Class.method ()");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   498
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   499
  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
   500
  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
   501
  tty->print_cr("  *ackage/Clas*.*etho*()");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   502
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   503
  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
   504
  tty->print_cr("  -XX:CompileCommand=exclude,java/*.* -XX:CompileCommand=log,java*.*");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
  tty->cr();
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   506
  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
   507
  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
   508
  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
   509
  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
   510
  tty->print_cr("  exclude java/*.*");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   511
  tty->print_cr("  option java/*.* ReplayInline");
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   512
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   513
  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
   514
  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
   515
  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
   516
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   517
};
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   519
// The JVM specification defines the allowed characters.
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   520
// Tokens that are disallowed by the JVM specification can have
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   521
// a meaning to the parser so we need to include them here.
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   522
// The parser does not enforce all rules of the JVMS - a successful parse
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   523
// does not mean that it is an allowed name. Illegal names will
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   524
// be ignored since they never can match a class or method.
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   525
//
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   526
// '\0' and 0xf0-0xff are disallowed in constant string values
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   527
// 0x20 ' ', 0x09 '\t' and, 0x2c ',' are used in the matching
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   528
// 0x5b '[' and 0x5d ']' can not be used because of the matcher
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   529
// 0x28 '(' and 0x29 ')' are used for the signature
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   530
// 0x2e '.' is always replaced before the matching
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   531
// 0x2f '/' is only used in the class name as package separator
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   532
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   533
#define RANGEBASE "\x1\x2\x3\x4\x5\x6\x7\x8\xa\xb\xc\xd\xe\xf" \
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   534
    "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   535
    "\x21\x22\x23\x24\x25\x26\x27\x2a\x2b\x2c\x2d" \
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   536
    "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" \
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   537
    "\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" \
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   538
    "\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5c\x5e\x5f" \
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   539
    "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" \
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   540
    "\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f" \
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   541
    "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" \
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   542
    "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" \
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   543
    "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" \
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   544
    "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" \
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   545
    "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" \
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   546
    "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" \
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   547
    "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
#define RANGE0 "[*" RANGEBASE "]"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
#define RANGESLASH "[*" RANGEBASE "/]"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
static MethodMatcher::Mode check_mode(char name[], const char*& error_msg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
  int match = MethodMatcher::Exact;
4584
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   554
  while (name[0] == '*') {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
    match |= MethodMatcher::Suffix;
28720
76473974643b 8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents: 28496
diff changeset
   556
    // Copy remaining string plus NUL to the beginning
76473974643b 8069389: CompilerOracle prefix wildcarding is broken for long strings
neliasso
parents: 28496
diff changeset
   557
    memmove(name, name + 1, strlen(name + 1) + 1);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
4584
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   560
  if (strcmp(name, "*") == 0) return MethodMatcher::Any;
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   561
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
  size_t len = strlen(name);
4584
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   563
  while (len > 0 && name[len - 1] == '*') {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
    match |= MethodMatcher::Prefix;
4584
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   565
    name[--len] = '\0';
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
  if (strstr(name, "*") != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
    error_msg = "  Embedded * not allowed";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
    return MethodMatcher::Unknown;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
  return (MethodMatcher::Mode)match;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
static bool scan_line(const char * line,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
                      char class_name[],  MethodMatcher::Mode* c_mode,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
                      char method_name[], MethodMatcher::Mode* m_mode,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
                      int* bytes_read, const char*& error_msg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
  *bytes_read = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
  error_msg = NULL;
31615
e48d94b97b6c 8130036: Fix problems with imprecise C++ coding.
goetz
parents: 30281
diff changeset
   581
  if (2 == sscanf(line, "%*[ \t]%255" RANGESLASH "%*[ ]" "%255" RANGE0 "%n", class_name, method_name, bytes_read)) {
23185
a2143156a0a0 8036122: Fix warning 'format not a string literal'
goetz
parents: 22234
diff changeset
   582
    *c_mode = check_mode(class_name, error_msg);
a2143156a0a0 8036122: Fix warning 'format not a string literal'
goetz
parents: 22234
diff changeset
   583
    *m_mode = check_mode(method_name, error_msg);
a2143156a0a0 8036122: Fix warning 'format not a string literal'
goetz
parents: 22234
diff changeset
   584
    return *c_mode != MethodMatcher::Unknown && *m_mode != MethodMatcher::Unknown;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
  return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   589
// 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
   590
// On failure, error_msg contains description for the first error.
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   591
// For future extensions: set error_msg on first error.
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   592
static MethodMatcher* scan_flag_and_value(const char* type, const char* line, int& total_bytes_read,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   593
                                          Symbol* c_name, MethodMatcher::Mode c_match,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   594
                                          Symbol* m_name, MethodMatcher::Mode m_match,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   595
                                          Symbol* signature,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   596
                                          char* errorbuf, const int buf_size) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   597
  total_bytes_read = 0;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   598
  int bytes_read = 0;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   599
  char flag[256];
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   600
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   601
  // Read flag name.
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   602
  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
   603
    line += bytes_read;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   604
    total_bytes_read += bytes_read;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   605
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   606
    // Read value.
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   607
    if (strcmp(type, "intx") == 0) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   608
      intx value;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   609
      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
   610
        total_bytes_read += bytes_read;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   611
        return add_option_string(c_name, c_match, m_name, m_match, signature, flag, value);
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   612
      } else {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   613
        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
   614
      }
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   615
    } else if (strcmp(type, "uintx") == 0) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   616
      uintx value;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   617
      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
   618
        total_bytes_read += bytes_read;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   619
        return add_option_string(c_name, c_match, m_name, m_match, signature, flag, value);
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   620
      } else {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   621
        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
   622
      }
26433
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   623
    } else if (strcmp(type, "ccstr") == 0) {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   624
      ResourceMark rm;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   625
      char* value = NEW_RESOURCE_ARRAY(char, strlen(line) + 1);
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   626
      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
   627
        total_bytes_read += bytes_read;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   628
        return add_option_string(c_name, c_match, m_name, m_match, signature, flag, (ccstr)value);
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   629
      } else {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   630
        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
   631
      }
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   632
    } else if (strcmp(type, "ccstrlist") == 0) {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   633
      // Accumulates several strings into one. The internal type is ccstr.
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   634
      ResourceMark rm;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   635
      char* value = NEW_RESOURCE_ARRAY(char, strlen(line) + 1);
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   636
      char* next_value = value;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   637
      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
   638
        total_bytes_read += bytes_read;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   639
        line += bytes_read;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   640
        next_value += bytes_read;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   641
        char* end_value = next_value-1;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   642
        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
   643
          total_bytes_read += bytes_read;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   644
          line += bytes_read;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   645
          *end_value = ' '; // override '\0'
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   646
          next_value += bytes_read;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   647
          end_value = next_value-1;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   648
        }
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   649
        return add_option_string(c_name, c_match, m_name, m_match, signature, flag, (ccstr)value);
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   650
      } else {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   651
        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
   652
      }
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   653
    } else if (strcmp(type, "bool") == 0) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   654
      char value[256];
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   655
      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
   656
        if (strcmp(value, "true") == 0) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   657
          total_bytes_read += bytes_read;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   658
          return add_option_string(c_name, c_match, m_name, m_match, signature, flag, true);
26433
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   659
        } else if (strcmp(value, "false") == 0) {
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   660
          total_bytes_read += bytes_read;
27020fde2dbf 8056964: JDK-8055286 changes are incomplete.
kvn
parents: 26430
diff changeset
   661
          return add_option_string(c_name, c_match, m_name, m_match, signature, flag, false);
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   662
        } else {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   663
          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
   664
        }
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   665
      } else {
31615
e48d94b97b6c 8130036: Fix problems with imprecise C++ coding.
goetz
parents: 30281
diff changeset
   666
        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
   667
      }
27143
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   668
    } else if (strcmp(type, "double") == 0) {
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   669
      char buffer[2][256];
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   670
      // Decimal separator '.' has been replaced with ' ' or '/' earlier,
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   671
      // so read integer and fraction part of double value separately.
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   672
      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
   673
        char value[512] = "";
30281
b1608535e50f 8076475: Misuses of strncpy/strncat
stuefe
parents: 28721
diff changeset
   674
        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
   675
        total_bytes_read += bytes_read;
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   676
        return add_option_string(c_name, c_match, m_name, m_match, signature, flag, atof(value));
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   677
      } else {
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   678
        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
   679
      }
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   680
    } else {
31615
e48d94b97b6c 8130036: Fix problems with imprecise C++ coding.
goetz
parents: 30281
diff changeset
   681
      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
   682
    }
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   683
  } else {
31615
e48d94b97b6c 8130036: Fix problems with imprecise C++ coding.
goetz
parents: 30281
diff changeset
   684
    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
   685
  }
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   686
  return NULL;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   687
}
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   688
28721
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   689
int skip_whitespace(char* line) {
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   690
  // Skip any leading spaces
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   691
  int whitespace_read = 0;
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   692
  sscanf(line, "%*[ \t]%n", &whitespace_read);
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   693
  return whitespace_read;
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   694
}
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   695
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   696
void CompilerOracle::parse_from_line(char* line) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   697
  if (line[0] == '\0') return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   698
  if (line[0] == '#')  return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   699
489c9b5090e2 Initial load
duke
parents:
diff changeset
   700
  bool have_colon = (strstr(line, "::") != NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   701
  for (char* lp = line; *lp != '\0'; lp++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   702
    // Allow '.' to separate the class name from the method name.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   703
    // This is the preferred spelling of methods:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   704
    //      exclude java/lang/String.indexOf(I)I
489c9b5090e2 Initial load
duke
parents:
diff changeset
   705
    // Allow ',' for spaces (eases command line quoting).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   706
    //      exclude,java/lang/String.indexOf
489c9b5090e2 Initial load
duke
parents:
diff changeset
   707
    // For backward compatibility, allow space as separator also.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   708
    //      exclude java/lang/String indexOf
489c9b5090e2 Initial load
duke
parents:
diff changeset
   709
    //      exclude,java/lang/String,indexOf
489c9b5090e2 Initial load
duke
parents:
diff changeset
   710
    // For easy cut-and-paste of method names, allow VM output format
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13202
diff changeset
   711
    // as produced by Method::print_short_name:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   712
    //      exclude java.lang.String::indexOf
489c9b5090e2 Initial load
duke
parents:
diff changeset
   713
    // For simple implementation convenience here, convert them all to space.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   714
    if (have_colon) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   715
      if (*lp == '.')  *lp = '/';   // dots build the package prefix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   716
      if (*lp == ':')  *lp = ' ';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   717
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   718
    if (*lp == ',' || *lp == '.')  *lp = ' ';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   719
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
489c9b5090e2 Initial load
duke
parents:
diff changeset
   721
  char* original_line = line;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   722
  int bytes_read;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   723
  OracleCommand command = parse_command_name(line, &bytes_read);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   724
  line += bytes_read;
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   725
  ResourceMark rm;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   726
7701
766eb9258574 6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents: 7397
diff changeset
   727
  if (command == UnknownCommand) {
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   728
    ttyLocker ttyl;
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   729
    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
   730
    tty->print_cr("  \"%s\"", original_line);
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   731
    CompilerOracle::print_tip();
7701
766eb9258574 6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents: 7397
diff changeset
   732
    return;
766eb9258574 6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents: 7397
diff changeset
   733
  }
766eb9258574 6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents: 7397
diff changeset
   734
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   735
  if (command == QuietCommand) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   736
    _quiet = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   737
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   738
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   739
489c9b5090e2 Initial load
duke
parents:
diff changeset
   740
  if (command == HelpCommand) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   741
    usage();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   742
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   743
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   744
489c9b5090e2 Initial load
duke
parents:
diff changeset
   745
  MethodMatcher::Mode c_match = MethodMatcher::Exact;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   746
  MethodMatcher::Mode m_match = MethodMatcher::Exact;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   747
  char class_name[256];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   748
  char method_name[256];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   749
  char sig[1024];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   750
  char errorbuf[1024];
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   751
  const char* error_msg = NULL; // description of first error that appears
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   752
  MethodMatcher* match = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   753
489c9b5090e2 Initial load
duke
parents:
diff changeset
   754
  if (scan_line(line, class_name, &c_match, method_name, &m_match, &bytes_read, error_msg)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   755
    EXCEPTION_MARK;
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   756
    Symbol* c_name = SymbolTable::new_symbol(class_name, CHECK);
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   757
    Symbol* m_name = SymbolTable::new_symbol(method_name, CHECK);
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   758
    Symbol* signature = NULL;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   759
489c9b5090e2 Initial load
duke
parents:
diff changeset
   760
    line += bytes_read;
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   761
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   762
    // there might be a signature following the method.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   763
    // signatures always begin with ( so match that by hand
28721
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   764
    line += skip_whitespace(line);
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   765
    if (1 == sscanf(line, "(%254[[);/" RANGEBASE "]%n", sig + 1, &bytes_read)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   766
      sig[0] = '(';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   767
      line += bytes_read;
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
   768
      signature = SymbolTable::new_symbol(sig, CHECK);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   769
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   770
489c9b5090e2 Initial load
duke
parents:
diff changeset
   771
    if (command == OptionCommand) {
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   772
      // Look for trailing options.
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   773
      //
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   774
      // Two types of trailing options are
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   775
      // supported:
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   776
      //
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   777
      // (1) CompileCommand=option,Klass::method,flag
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   778
      // (2) CompileCommand=option,Klass::method,type,flag,value
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   779
      //
27143
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   780
      // Type (1) is used to enable a boolean flag for a method.
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   781
      //
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   782
      // Type (2) is used to support options with a value. Values can have the
27143
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   783
      // the following types: intx, uintx, bool, ccstr, ccstrlist, and double.
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   784
      //
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   785
      // For future extensions: extend scan_flag_and_value()
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   786
      char option[256]; // stores flag for Type (1) and type of Type (2)
28721
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   787
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   788
      line += skip_whitespace(line);
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   789
      while (sscanf(line, "%255[a-zA-Z0-9]%n", option, &bytes_read) == 1) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   790
        if (match != NULL && !_quiet) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   791
          // Print out the last match added
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   792
          ttyLocker ttyl;
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   793
          tty->print("CompileCommand: %s ", command_names[command]);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   794
          match->print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   795
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   796
        line += bytes_read;
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   797
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   798
        if (strcmp(option, "intx") == 0
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   799
            || strcmp(option, "uintx") == 0
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   800
            || strcmp(option, "bool") == 0
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   801
            || strcmp(option, "ccstr") == 0
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   802
            || strcmp(option, "ccstrlist") == 0
27143
feee4a6106bc 8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents: 26441
diff changeset
   803
            || strcmp(option, "double") == 0
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   804
            ) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   805
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   806
          // Type (2) option: parse flag name and value.
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   807
          match = scan_flag_and_value(option, line, bytes_read,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   808
                                      c_name, c_match, m_name, m_match, signature,
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   809
                                      errorbuf, sizeof(errorbuf));
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   810
          if (match == NULL) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   811
            error_msg = errorbuf;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   812
            break;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   813
          }
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   814
          line += bytes_read;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   815
        } else {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   816
          // Type (1) option
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   817
          match = add_option_string(c_name, c_match, m_name, m_match, signature, option, true);
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   818
        }
28721
b9655115bf4e 8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents: 28720
diff changeset
   819
        line += skip_whitespace(line);
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   820
      } // while(
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   821
    } else {
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   822
      match = add_predicate(command, c_name, c_match, m_name, m_match, signature);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   823
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   824
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   825
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   826
  ttyLocker ttyl;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   827
  if (error_msg != NULL) {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   828
    // an error has happened
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   829
    tty->print_cr("CompileCommand: An error occured during parsing");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   830
    tty->print_cr("  \"%s\"", original_line);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   831
    if (error_msg != NULL) {
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 23185
diff changeset
   832
      tty->print_cr("%s", error_msg);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   833
    }
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   834
    CompilerOracle::print_tip();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   835
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   836
  } else {
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   837
    // check for remaining characters
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   838
    bytes_read = 0;
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   839
    sscanf(line, "%*[ \t]%n", &bytes_read);
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   840
    if (line[bytes_read] != '\0') {
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   841
      tty->print_cr("CompileCommand: Bad pattern");
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   842
      tty->print_cr("  \"%s\"", original_line);
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   843
      tty->print_cr("  Unrecognized text %s after command ", line);
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   844
      CompilerOracle::print_tip();
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   845
    } else if (match != NULL && !_quiet) {
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   846
      tty->print("CompileCommand: %s ", command_names[command]);
26430
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   847
      match->print();
7f20c536cd5b 8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents: 25949
diff changeset
   848
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   849
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   850
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   851
28496
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   852
void CompilerOracle::print_tip() {
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   853
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   854
  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
   855
  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
   856
  tty->cr();
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   857
}
f9753412d4f5 8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents: 27143
diff changeset
   858
13194
603ef19adcb8 7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents: 12981
diff changeset
   859
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
   860
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   861
static const char* cc_file() {
12981
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   862
#ifdef ASSERT
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   863
  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
   864
    return default_cc_file;
12981
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   865
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   866
  return CompileCommandFile;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   867
}
12981
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   868
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   869
bool CompilerOracle::has_command_file() {
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   870
  return cc_file() != NULL;
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   871
}
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   872
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   873
bool CompilerOracle::_quiet = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   874
489c9b5090e2 Initial load
duke
parents:
diff changeset
   875
void CompilerOracle::parse_from_file() {
12981
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   876
  assert(has_command_file(), "command file must be specified");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   877
  FILE* stream = fopen(cc_file(), "rt");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   878
  if (stream == NULL) return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   879
489c9b5090e2 Initial load
duke
parents:
diff changeset
   880
  char token[1024];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   881
  int  pos = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   882
  int  c = getc(stream);
14139
339b184759f9 7158804: Improve config file parsing
kamg
parents: 14138
diff changeset
   883
  while(c != EOF && pos < (int)(sizeof(token)-1)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   884
    if (c == '\n') {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   885
      token[pos++] = '\0';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   886
      parse_from_line(token);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   887
      pos = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   888
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   889
      token[pos++] = c;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   890
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   891
    c = getc(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   892
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   893
  token[pos++] = '\0';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   894
  parse_from_line(token);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   895
489c9b5090e2 Initial load
duke
parents:
diff changeset
   896
  fclose(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   897
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   898
489c9b5090e2 Initial load
duke
parents:
diff changeset
   899
void CompilerOracle::parse_from_string(const char* str, void (*parse_line)(char*)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   900
  char token[1024];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   901
  int  pos = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   902
  const char* sp = str;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   903
  int  c = *sp++;
14139
339b184759f9 7158804: Improve config file parsing
kamg
parents: 14138
diff changeset
   904
  while (c != '\0' && pos < (int)(sizeof(token)-1)) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   905
    if (c == '\n') {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   906
      token[pos++] = '\0';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   907
      parse_line(token);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   908
      pos = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   909
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   910
      token[pos++] = c;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   911
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   912
    c = *sp++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   913
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   914
  token[pos++] = '\0';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   915
  parse_line(token);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   916
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   917
489c9b5090e2 Initial load
duke
parents:
diff changeset
   918
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
   919
  assert(has_command_file(), "command file must be specified");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   920
  fileStream stream(fopen(cc_file(), "at"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   921
  stream.print("# ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   922
  for (int index = 0; message[index] != '\0'; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   923
    stream.put(message[index]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   924
    if (message[index] == '\n') stream.print("# ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   925
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   926
  stream.cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   927
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   928
489c9b5090e2 Initial load
duke
parents:
diff changeset
   929
void CompilerOracle::append_exclude_to_file(methodHandle method) {
12981
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   930
  assert(has_command_file(), "command file must be specified");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   931
  fileStream stream(fopen(cc_file(), "at"));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   932
  stream.print("exclude ");
14391
df0a1573d5bd 8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass
coleenp
parents: 14147
diff changeset
   933
  method->method_holder()->name()->print_symbol_on(&stream);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   934
  stream.print(".");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   935
  method->name()->print_symbol_on(&stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   936
  method->signature()->print_symbol_on(&stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   937
  stream.cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   938
  stream.cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   939
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   940
489c9b5090e2 Initial load
duke
parents:
diff changeset
   941
489c9b5090e2 Initial load
duke
parents:
diff changeset
   942
void compilerOracle_init() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   943
  CompilerOracle::parse_from_string(CompileCommand, CompilerOracle::parse_from_line);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   944
  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
   945
  if (CompilerOracle::has_command_file()) {
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   946
    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
   947
  } else {
603ef19adcb8 7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents: 12981
diff changeset
   948
    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
   949
    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
   950
      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
   951
              "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
   952
              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
   953
    }
12981
b557c10f5444 7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents: 8921
diff changeset
   954
  }
4584
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   955
  if (lists[PrintCommand] != NULL) {
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   956
    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
   957
      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
   958
    } else if (FLAG_IS_DEFAULT(DebugNonSafepoints)) {
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   959
      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
   960
      DebugNonSafepoints = true;
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   961
    }
e2a449e8cc6f 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 1
diff changeset
   962
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   963
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   964
489c9b5090e2 Initial load
duke
parents:
diff changeset
   965
489c9b5090e2 Initial load
duke
parents:
diff changeset
   966
void CompilerOracle::parse_compile_only(char * line) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   967
  int i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   968
  char name[1024];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   969
  const char* className = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   970
  const char* methodName = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   971
489c9b5090e2 Initial load
duke
parents:
diff changeset
   972
  bool have_colon = (strstr(line, "::") != NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   973
  char method_sep = have_colon ? ':' : '.';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   974
489c9b5090e2 Initial load
duke
parents:
diff changeset
   975
  if (Verbose) {
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 23185
diff changeset
   976
    tty->print_cr("%s", line);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   977
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   978
489c9b5090e2 Initial load
duke
parents:
diff changeset
   979
  ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   980
  while (*line != '\0') {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   981
    MethodMatcher::Mode c_match = MethodMatcher::Exact;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   982
    MethodMatcher::Mode m_match = MethodMatcher::Exact;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   983
489c9b5090e2 Initial load
duke
parents:
diff changeset
   984
    for (i = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   985
         i < 1024 && *line != '\0' && *line != method_sep && *line != ',' && !isspace(*line);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   986
         line++, i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   987
      name[i] = *line;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   988
      if (name[i] == '.')  name[i] = '/';  // package prefix uses '/'
489c9b5090e2 Initial load
duke
parents:
diff changeset
   989
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   990
489c9b5090e2 Initial load
duke
parents:
diff changeset
   991
    if (i > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   992
      char* newName = NEW_RESOURCE_ARRAY( char, i + 1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   993
      if (newName == NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   994
        return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   995
      strncpy(newName, name, i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   996
      newName[i] = '\0';
489c9b5090e2 Initial load
duke
parents:
diff changeset
   997
489c9b5090e2 Initial load
duke
parents:
diff changeset
   998
      if (className == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   999
        className = newName;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1000
        c_match = MethodMatcher::Prefix;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1001
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1002
        methodName = newName;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1003
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1004
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1005
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1006
    if (*line == method_sep) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1007
      if (className == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1008
        className = "";
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1009
        c_match = MethodMatcher::Any;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1010
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1011
        // foo/bar.blah is an exact match on foo/bar, bar.blah is a suffix match on bar
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1012
        if (strchr(className, '/') != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1013
          c_match = MethodMatcher::Exact;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1014
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1015
          c_match = MethodMatcher::Suffix;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1016
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1017
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1018
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1019
      // got foo or foo/bar
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1020
      if (className == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1021
        ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1022
      } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1023
        // got foo or foo/bar
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1024
        if (strchr(className, '/') != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1025
          c_match = MethodMatcher::Prefix;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1026
        } else if (className[0] == '\0') {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1027
          c_match = MethodMatcher::Any;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1028
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1029
          c_match = MethodMatcher::Substring;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1030
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1031
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1032
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1033
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1034
    // each directive is terminated by , or NUL or . followed by NUL
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1035
    if (*line == ',' || *line == '\0' || (line[0] == '.' && line[1] == '\0')) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1036
      if (methodName == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1037
        methodName = "";
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1038
        if (*line != method_sep) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1039
          m_match = MethodMatcher::Any;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1040
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1041
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1042
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1043
      EXCEPTION_MARK;
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
  1044
      Symbol* c_name = SymbolTable::new_symbol(className, CHECK);
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
  1045
      Symbol* m_name = SymbolTable::new_symbol(methodName, CHECK);
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7701
diff changeset
  1046
      Symbol* signature = NULL;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1047
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1048
      add_predicate(CompileOnlyCommand, c_name, c_match, m_name, m_match, signature);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1049
      if (PrintVMOptions) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1050
        tty->print("CompileOnly: compileonly ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1051
        lists[CompileOnlyCommand]->print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1052
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1053
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1054
      className = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1055
      methodName = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1056
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1057
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1058
    line = *line == '\0' ? line : line + 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1059
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1060
}