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_RUNTIME_COMPILATIONPOLICY_HPP
26 #define SHARE_RUNTIME_COMPILATIONPOLICY_HPP
27
28 #include "code/nmethod.hpp"
29 #include "compiler/compileBroker.hpp"
30 #include "memory/allocation.hpp"
31 #include "runtime/vmOperations.hpp"
32 #include "utilities/growableArray.hpp"
33
34 // The CompilationPolicy selects which method (if any) should be compiled.
35 // It also decides which methods must always be compiled (i.e., are never
36 // interpreted).
37 class CompileTask;
38 class CompileQueue;
39
40 class CompilationPolicy : public CHeapObj<mtCompiler> {
41 static CompilationPolicy* _policy;
42
43 // m must be compiled before executing it
44 static bool must_be_compiled(const methodHandle& m, int comp_level = CompLevel_all);
45
46 public:
93 static void trace_osr_completion(nmethod* osr_nm);
94 void reset_counter_for_invocation_event(const methodHandle& method);
95 void reset_counter_for_back_branch_event(const methodHandle& method);
96 void method_invocation_event(const methodHandle& m, JavaThread* thread);
97 void method_back_branch_event(const methodHandle& m, int bci, JavaThread* thread);
98 public:
99 SimpleCompPolicy() : _compiler_count(0) { }
100 virtual CompLevel initial_compile_level() { return CompLevel_highest_tier; }
101 virtual int compiler_count(CompLevel comp_level);
102 virtual void do_safepoint_work();
103 virtual void reprofile(ScopeDesc* trap_scope, bool is_osr);
104 virtual void delay_compilation(Method* method);
105 virtual void disable_compilation(Method* method);
106 virtual bool is_mature(Method* method);
107 virtual void initialize();
108 virtual CompileTask* select_task(CompileQueue* compile_queue);
109 virtual nmethod* event(const methodHandle& method, const methodHandle& inlinee, int branch_bci, int bci, CompLevel comp_level, CompiledMethod* nm, JavaThread* thread);
110 };
111
112
113 #endif // SHARE_RUNTIME_COMPILATIONPOLICY_HPP
|
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_COMPILER_COMPILATIONPOLICY_HPP
26 #define SHARE_COMPILER_COMPILATIONPOLICY_HPP
27
28 #include "code/nmethod.hpp"
29 #include "compiler/compileBroker.hpp"
30 #include "memory/allocation.hpp"
31 #include "runtime/vmOperations.hpp"
32 #include "utilities/growableArray.hpp"
33
34 // The CompilationPolicy selects which method (if any) should be compiled.
35 // It also decides which methods must always be compiled (i.e., are never
36 // interpreted).
37 class CompileTask;
38 class CompileQueue;
39
40 class CompilationPolicy : public CHeapObj<mtCompiler> {
41 static CompilationPolicy* _policy;
42
43 // m must be compiled before executing it
44 static bool must_be_compiled(const methodHandle& m, int comp_level = CompLevel_all);
45
46 public:
93 static void trace_osr_completion(nmethod* osr_nm);
94 void reset_counter_for_invocation_event(const methodHandle& method);
95 void reset_counter_for_back_branch_event(const methodHandle& method);
96 void method_invocation_event(const methodHandle& m, JavaThread* thread);
97 void method_back_branch_event(const methodHandle& m, int bci, JavaThread* thread);
98 public:
99 SimpleCompPolicy() : _compiler_count(0) { }
100 virtual CompLevel initial_compile_level() { return CompLevel_highest_tier; }
101 virtual int compiler_count(CompLevel comp_level);
102 virtual void do_safepoint_work();
103 virtual void reprofile(ScopeDesc* trap_scope, bool is_osr);
104 virtual void delay_compilation(Method* method);
105 virtual void disable_compilation(Method* method);
106 virtual bool is_mature(Method* method);
107 virtual void initialize();
108 virtual CompileTask* select_task(CompileQueue* compile_queue);
109 virtual nmethod* event(const methodHandle& method, const methodHandle& inlinee, int branch_bci, int bci, CompLevel comp_level, CompiledMethod* nm, JavaThread* thread);
110 };
111
112
113 #endif // SHARE_COMPILER_COMPILATIONPOLICY_HPP
|