1 /*
2 * Copyright (c) 1998, 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 *
25 #ifndef SHARE_VM_COMPILER_COMPILERDIRECTIVES_HPP
26 #define SHARE_VM_COMPILER_COMPILERDIRECTIVES_HPP
27
28 #include "ci/ciMetadata.hpp"
29 #include "ci/ciMethod.hpp"
30 #include "ci/ciUtilities.hpp"
31 #include "compiler/methodMatcher.hpp"
32 #include "compiler/compilerOracle.hpp"
33 #include "utilities/exceptions.hpp"
34
35 // Directives flag name, type, default value, compile command name
36 #define compilerdirectives_common_flags(cflags) \
37 cflags(Enable, bool, false, X) \
38 cflags(Exclude, bool, false, X) \
39 cflags(BreakAtExecute, bool, false, X) \
40 cflags(BreakAtCompile, bool, false, X) \
41 cflags(Log, bool, LogCompilation, X) \
42 cflags(PrintAssembly, bool, PrintAssembly, PrintAssembly) \
43 cflags(PrintInlining, bool, PrintInlining, PrintInlining) \
44 cflags(PrintNMethods, bool, PrintNMethods, PrintNMethods) \
45 cflags(ReplayInline, bool, false, ReplayInline) \
46 cflags(DumpReplay, bool, false, DumpReplay) \
47 cflags(DumpInline, bool, false, DumpInline) \
48 cflags(CompilerDirectivesIgnoreCompileCommands, bool, CompilerDirectivesIgnoreCompileCommands, X) \
49 cflags(DisableIntrinsic, ccstrlist, DisableIntrinsic, DisableIntrinsic)
50
51 #ifdef COMPILER1
52 #define compilerdirectives_c1_flags(cflags)
53 #else
54 #define compilerdirectives_c1_flags(cflags)
55 #endif
56
57 #ifdef COMPILER2
58 #define compilerdirectives_c2_flags(cflags) \
59 cflags(BlockLayoutByFrequency, bool, BlockLayoutByFrequency, BlockLayoutByFrequency) \
60 cflags(PrintOptoAssembly, bool, PrintOptoAssembly, PrintOptoAssembly) \
61 cflags(PrintIntrinsics, bool, PrintIntrinsics, PrintIntrinsics) \
62 cflags(TraceOptoPipelining, bool, false, TraceOptoPipelining) \
63 cflags(TraceOptoOutput, bool, false, TraceOptoOutput) \
64 cflags(TraceSpilling, bool, TraceSpilling, TraceSpilling) \
70 cflags(MaxNodeLimit, intx, MaxNodeLimit, MaxNodeLimit)
71 #else
72 #define compilerdirectives_c2_flags(cflags)
73 #endif
74
75 class CompilerDirectives;
76 class DirectiveSet;
77
78 class DirectivesStack : AllStatic {
79 private:
80 static CompilerDirectives* _top;
81 static CompilerDirectives* _bottom;
82 static int _depth;
83
84 static void pop_inner(); // no lock version of pop
85 public:
86 static void init();
87 static DirectiveSet* getMatchingDirective(methodHandle mh, AbstractCompiler* comp);
88 static DirectiveSet* getDefaultDirective(AbstractCompiler* comp);
89 static void push(CompilerDirectives* directive);
90 static void pop();
91 static bool check_capacity(int request_size, outputStream* st);
92 static void clear();
93 static void print(outputStream* st);
94 static void release(DirectiveSet* set);
95 static void release(CompilerDirectives* dir);
96 };
97
98 class DirectiveSet : public CHeapObj<mtCompiler> {
99 private:
100 InlineMatcher* _inlinematchers;
101 CompilerDirectives* _directive;
102
103 static ccstrlist canonicalize_disableintrinsic(ccstrlist option_value);
104
105 public:
106 DirectiveSet(CompilerDirectives* directive);
107 ~DirectiveSet();
108 CompilerDirectives* directive();
109 bool parse_and_add_inline(char* str, const char*& error_msg);
110 void append_inline(InlineMatcher* m);
|
1 /*
2 * Copyright (c) 1998, 2016, 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 *
25 #ifndef SHARE_VM_COMPILER_COMPILERDIRECTIVES_HPP
26 #define SHARE_VM_COMPILER_COMPILERDIRECTIVES_HPP
27
28 #include "ci/ciMetadata.hpp"
29 #include "ci/ciMethod.hpp"
30 #include "ci/ciUtilities.hpp"
31 #include "compiler/methodMatcher.hpp"
32 #include "compiler/compilerOracle.hpp"
33 #include "utilities/exceptions.hpp"
34
35 // Directives flag name, type, default value, compile command name
36 #define compilerdirectives_common_flags(cflags) \
37 cflags(Enable, bool, false, X) \
38 cflags(Exclude, bool, false, X) \
39 cflags(BreakAtExecute, bool, false, X) \
40 cflags(BreakAtCompile, bool, false, X) \
41 cflags(Log, bool, LogCompilation, X) \
42 cflags(PrintAssembly, bool, PrintAssembly, PrintAssembly) \
43 cflags(PrintInlining, bool, PrintInlining, PrintInlining) \
44 cflags(PrintNMethods, bool, PrintNMethods, PrintNMethods) \
45 cflags(BackgroundCompilation, bool, BackgroundCompilation, BackgroundCompilation) \
46 cflags(ReplayInline, bool, false, ReplayInline) \
47 cflags(DumpReplay, bool, false, DumpReplay) \
48 cflags(DumpInline, bool, false, DumpInline) \
49 cflags(CompilerDirectivesIgnoreCompileCommands, bool, CompilerDirectivesIgnoreCompileCommands, X) \
50 cflags(DisableIntrinsic, ccstrlist, DisableIntrinsic, DisableIntrinsic)
51
52 #ifdef COMPILER1
53 #define compilerdirectives_c1_flags(cflags)
54 #else
55 #define compilerdirectives_c1_flags(cflags)
56 #endif
57
58 #ifdef COMPILER2
59 #define compilerdirectives_c2_flags(cflags) \
60 cflags(BlockLayoutByFrequency, bool, BlockLayoutByFrequency, BlockLayoutByFrequency) \
61 cflags(PrintOptoAssembly, bool, PrintOptoAssembly, PrintOptoAssembly) \
62 cflags(PrintIntrinsics, bool, PrintIntrinsics, PrintIntrinsics) \
63 cflags(TraceOptoPipelining, bool, false, TraceOptoPipelining) \
64 cflags(TraceOptoOutput, bool, false, TraceOptoOutput) \
65 cflags(TraceSpilling, bool, TraceSpilling, TraceSpilling) \
71 cflags(MaxNodeLimit, intx, MaxNodeLimit, MaxNodeLimit)
72 #else
73 #define compilerdirectives_c2_flags(cflags)
74 #endif
75
76 class CompilerDirectives;
77 class DirectiveSet;
78
79 class DirectivesStack : AllStatic {
80 private:
81 static CompilerDirectives* _top;
82 static CompilerDirectives* _bottom;
83 static int _depth;
84
85 static void pop_inner(); // no lock version of pop
86 public:
87 static void init();
88 static DirectiveSet* getMatchingDirective(methodHandle mh, AbstractCompiler* comp);
89 static DirectiveSet* getDefaultDirective(AbstractCompiler* comp);
90 static void push(CompilerDirectives* directive);
91 static void pop(int count);
92 static bool check_capacity(int request_size, outputStream* st);
93 static void clear();
94 static void print(outputStream* st);
95 static void release(DirectiveSet* set);
96 static void release(CompilerDirectives* dir);
97 };
98
99 class DirectiveSet : public CHeapObj<mtCompiler> {
100 private:
101 InlineMatcher* _inlinematchers;
102 CompilerDirectives* _directive;
103
104 static ccstrlist canonicalize_disableintrinsic(ccstrlist option_value);
105
106 public:
107 DirectiveSet(CompilerDirectives* directive);
108 ~DirectiveSet();
109 CompilerDirectives* directive();
110 bool parse_and_add_inline(char* str, const char*& error_msg);
111 void append_inline(InlineMatcher* m);
|