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_COMPILER_METHODMATCHER_HPP
26 #define SHARE_COMPILER_METHODMATCHER_HPP
27
28 #include "memory/allocation.hpp"
29 #include "runtime/handles.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);
63 bool matches(const methodHandle& method) const;
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(nullptr) {
78 }
79
80 BasicMatcher(BasicMatcher* next) :
81 _next(next) {
82 }
83
84 static BasicMatcher* parse_method_pattern(char* line, const char*& error_msg, bool expect_trailing_chars);
85 bool match(const methodHandle& method);
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 != nullptr) {
93 _next->print_all(st);
94 }
95 }
96 };
97
98 class InlineMatcher : public MethodMatcher {
99 public:
100 enum InlineType {
101 unknown_inline,
102 dont_inline,
103 force_inline
104 };
105
|
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_COMPILER_METHODMATCHER_HPP
26 #define SHARE_COMPILER_METHODMATCHER_HPP
27
28 #include "memory/allocation.hpp"
29 #include "runtime/handles.hpp"
30 #include "runtime/methodDetails.hpp"
31 #include "memory/resourceArea.hpp"
32
33 class MethodMatcher : public CHeapObj<mtCompiler> {
34 public:
35 enum Mode {
36 Exact,
37 Prefix = 1,
38 Suffix = 2,
39 Substring = Prefix | Suffix,
40 Any,
41 Unknown = -1
42 };
43
44 protected:
45 Symbol* _class_name;
46 Symbol* _method_name;
47 Symbol* _signature;
48 Mode _class_mode;
49 Mode _method_mode;
50
51 public:
52 Symbol* class_name() const { return _class_name; }
53 Mode class_mode() const { return _class_mode; }
54 Symbol* method_name() const { return _method_name; }
55 Mode method_mode() const { return _method_mode; }
56 Symbol* signature() const { return _signature; }
57
58 MethodMatcher();
59 ~MethodMatcher();
60
61 void init(Symbol* class_name, Mode class_mode, Symbol* method_name, Mode method_mode, Symbol* signature);
62 static void parse_method_pattern(char*& line, const char*& error_msg, MethodMatcher* m);
63 static void print_symbol(outputStream* st, Symbol* h, Mode mode);
64 bool matches(const methodHandle& method) const;
65 bool matches(MethodDetails& method_details) const;
66 void print_base(outputStream* st);
67
68 private:
69 static bool canonicalize(char * line, const char *& error_msg);
70 bool match(Symbol* candidate, Symbol* match, Mode match_mode) const;
71 };
72
73 class BasicMatcher : public MethodMatcher {
74 private:
75 BasicMatcher* _next;
76 public:
77
78 BasicMatcher() : MethodMatcher(),
79 _next(nullptr) {
80 }
81
82 BasicMatcher(BasicMatcher* next) :
83 _next(next) {
84 }
85
86 static BasicMatcher* parse_method_pattern(char* line, const char*& error_msg, bool expect_trailing_chars);
87 bool match(const methodHandle& method);
88 bool match(MethodDetails& method_details);
89 void set_next(BasicMatcher* next) { _next = next; }
90 BasicMatcher* next() { return _next; }
91
92 void print(outputStream* st) { print_base(st); }
93 void print_all(outputStream* st) {
94 print_base(st);
95 if (_next != nullptr) {
96 _next->print_all(st);
97 }
98 }
99 };
100
101 class InlineMatcher : public MethodMatcher {
102 public:
103 enum InlineType {
104 unknown_inline,
105 dont_inline,
106 force_inline
107 };
108
|