author | prr |
Mon, 06 Nov 2017 10:11:19 -0800 (2017-11-06) | |
changeset 47717 | 4a00b088902e |
parent 47216 | 71c04702a3d5 |
child 48157 | 7c4d43c26352 |
permissions | -rw-r--r-- |
33069 | 1 |
/* |
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
25 |
#ifndef SHARE_VM_COMPILER_METHODMATCHER_HPP |
|
26 |
#define SHARE_VM_COMPILER_METHODMATCHER_HPP |
|
27 |
||
28 |
#include "memory/allocation.inline.hpp" |
|
29 |
#include "runtime/handles.inline.hpp" |
|
30 |
#include "memory/resourceArea.hpp" |
|
31 |
||
32 |
class MethodMatcher : public CHeapObj<mtCompiler> { |
|
33 |
public: |
|
34 |
enum Mode { |
|
35 |
Exact, |
|
36 |
Prefix = 1, |
|
37 |
Suffix = 2, |
|
38 |
Substring = Prefix | Suffix, |
|
39 |
Any, |
|
40 |
Unknown = -1 |
|
41 |
}; |
|
42 |
||
43 |
protected: |
|
44 |
Symbol* _class_name; |
|
45 |
Symbol* _method_name; |
|
46 |
Symbol* _signature; |
|
47 |
Mode _class_mode; |
|
48 |
Mode _method_mode; |
|
49 |
||
50 |
public: |
|
51 |
Symbol* class_name() const { return _class_name; } |
|
52 |
Mode class_mode() const { return _class_mode; } |
|
53 |
Symbol* method_name() const { return _method_name; } |
|
54 |
Mode method_mode() const { return _method_mode; } |
|
55 |
Symbol* signature() const { return _signature; } |
|
56 |
||
57 |
MethodMatcher(); |
|
58 |
~MethodMatcher(); |
|
59 |
||
60 |
void init(Symbol* class_name, Mode class_mode, Symbol* method_name, Mode method_mode, Symbol* signature); |
|
61 |
static void parse_method_pattern(char*& line, const char*& error_msg, MethodMatcher* m); |
|
62 |
static void print_symbol(outputStream* st, Symbol* h, Mode mode); |
|
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33069
diff
changeset
|
63 |
bool matches(const methodHandle& method) const; |
33069 | 64 |
void print_base(outputStream* st); |
65 |
||
66 |
private: |
|
67 |
static bool canonicalize(char * line, const char *& error_msg); |
|
68 |
bool match(Symbol* candidate, Symbol* match, Mode match_mode) const; |
|
69 |
}; |
|
70 |
||
71 |
class BasicMatcher : public MethodMatcher { |
|
72 |
private: |
|
73 |
BasicMatcher* _next; |
|
74 |
public: |
|
75 |
||
76 |
BasicMatcher() : MethodMatcher(), |
|
77 |
_next(NULL) { |
|
78 |
} |
|
79 |
||
80 |
BasicMatcher(BasicMatcher* next) : |
|
81 |
_next(next) { |
|
82 |
} |
|
83 |
||
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
84 |
static BasicMatcher* parse_method_pattern(char* line, const char*& error_msg); |
33626 | 85 |
bool match(const methodHandle& method); |
33069 | 86 |
void set_next(BasicMatcher* next) { _next = next; } |
87 |
BasicMatcher* next() { return _next; } |
|
88 |
||
89 |
void print(outputStream* st) { print_base(st); } |
|
90 |
void print_all(outputStream* st) { |
|
91 |
print_base(st); |
|
92 |
if (_next != NULL) { |
|
93 |
_next->print_all(st); |
|
94 |
} |
|
95 |
} |
|
96 |
}; |
|
97 |
||
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
98 |
class InlineMatcher : public MethodMatcher { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
99 |
public: |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
100 |
enum InlineType { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
101 |
unknown_inline, |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
102 |
dont_inline, |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
103 |
force_inline |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
104 |
}; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
105 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
106 |
private: |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
107 |
InlineType _inline_action; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
108 |
InlineMatcher * _next; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
109 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
110 |
InlineMatcher() : MethodMatcher(), |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
111 |
_inline_action(unknown_inline), _next(NULL) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
112 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
113 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
114 |
public: |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
115 |
static InlineMatcher* parse_method_pattern(char* line, const char*& error_msg); |
33626 | 116 |
bool match(const methodHandle& method, int inline_action); |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
117 |
void print(outputStream* st); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
118 |
void set_next(InlineMatcher* next) { _next = next; } |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
119 |
InlineMatcher* next() { return _next; } |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
120 |
void set_action(InlineType inline_action) { _inline_action = inline_action; } |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
121 |
int inline_action() { return _inline_action; } |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
122 |
static InlineMatcher* parse_inline_pattern(char* line, const char*& error_msg); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
123 |
InlineMatcher* clone(); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
124 |
}; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
125 |
|
33069 | 126 |
#endif // SHARE_VM_COMPILER_METHODMATCHER_HPP |
127 |