src/share/vm/compiler/compileBroker.hpp

Print this page
rev 13113 : 8182651: Add TRACE_ONLY conditional macro to support more fine-grained INCLUDE_TRACE programming
Reviewed-by:
   1 /*
   2  * Copyright (c) 1999, 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  *
  23  */
  24 
  25 #ifndef SHARE_VM_COMPILER_COMPILEBROKER_HPP
  26 #define SHARE_VM_COMPILER_COMPILEBROKER_HPP
  27 
  28 #include "ci/compilerInterface.hpp"
  29 #include "compiler/abstractCompiler.hpp"
  30 #include "compiler/compileTask.hpp"
  31 #include "compiler/compilerDirectives.hpp"
  32 #include "runtime/perfData.hpp"
  33 #include "trace/tracing.hpp"
  34 #include "utilities/stack.hpp"
  35 #if INCLUDE_JVMCI
  36 #include "jvmci/jvmciCompiler.hpp"
  37 #endif
  38 
  39 class nmethod;
  40 class nmethodLocker;
  41 
  42 // CompilerCounters
  43 //
  44 // Per Compiler Performance Counters.
  45 //
  46 class CompilerCounters : public CHeapObj<mtCompiler> {
  47 
  48   public:
  49     enum {
  50       cmname_buffer_length = 160
  51     };
  52 
  53   private:


 223   static void init_compiler_sweeper_threads(int c1_compiler_count, int c2_compiler_count);
 224   static bool compilation_is_complete  (const methodHandle& method, int osr_bci, int comp_level);
 225   static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded);
 226   static void preload_classes          (const methodHandle& method, TRAPS);
 227 
 228   static CompileTask* create_compile_task(CompileQueue*       queue,
 229                                           int                 compile_id,
 230                                           const methodHandle& method,
 231                                           int                 osr_bci,
 232                                           int                 comp_level,
 233                                           const methodHandle& hot_method,
 234                                           int                 hot_count,
 235                                           CompileTask::CompileReason compile_reason,
 236                                           bool                blocking);
 237   static void wait_for_completion(CompileTask* task);
 238 #if INCLUDE_JVMCI
 239   static bool wait_for_jvmci_completion(JVMCICompiler* comp, CompileTask* task, JavaThread* thread);
 240 #endif
 241 
 242   static void invoke_compiler_on_method(CompileTask* task);
 243   static void post_compile(CompilerThread* thread, CompileTask* task, EventCompilation& event, bool success, ciEnv* ci_env);
 244   static void set_last_compile(CompilerThread *thread, const methodHandle& method, bool is_osr, int comp_level);
 245   static void push_jni_handle_block();
 246   static void pop_jni_handle_block();
 247   static void collect_statistics(CompilerThread* thread, elapsedTimer time, CompileTask* task);
 248 
 249   static void compile_method_base(const methodHandle& method,
 250                                   int osr_bci,
 251                                   int comp_level,
 252                                   const methodHandle& hot_method,
 253                                   int hot_count,
 254                                   CompileTask::CompileReason compile_reason,
 255                                   bool blocking,
 256                                   Thread* thread);
 257 
 258   static CompileQueue* compile_queue(int comp_level);
 259   static bool init_compiler_runtime();
 260   static void shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread);
 261 
 262 public:
 263 


   1 /*
   2  * Copyright (c) 1999, 2017, 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_COMPILEBROKER_HPP
  26 #define SHARE_VM_COMPILER_COMPILEBROKER_HPP
  27 
  28 #include "ci/compilerInterface.hpp"
  29 #include "compiler/abstractCompiler.hpp"
  30 #include "compiler/compileTask.hpp"
  31 #include "compiler/compilerDirectives.hpp"
  32 #include "runtime/perfData.hpp"
  33 #include "utilities/macros.hpp"
  34 #include "utilities/stack.hpp"
  35 #if INCLUDE_JVMCI
  36 #include "jvmci/jvmciCompiler.hpp"
  37 #endif
  38 
  39 class nmethod;
  40 class nmethodLocker;
  41 
  42 // CompilerCounters
  43 //
  44 // Per Compiler Performance Counters.
  45 //
  46 class CompilerCounters : public CHeapObj<mtCompiler> {
  47 
  48   public:
  49     enum {
  50       cmname_buffer_length = 160
  51     };
  52 
  53   private:


 223   static void init_compiler_sweeper_threads(int c1_compiler_count, int c2_compiler_count);
 224   static bool compilation_is_complete  (const methodHandle& method, int osr_bci, int comp_level);
 225   static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded);
 226   static void preload_classes          (const methodHandle& method, TRAPS);
 227 
 228   static CompileTask* create_compile_task(CompileQueue*       queue,
 229                                           int                 compile_id,
 230                                           const methodHandle& method,
 231                                           int                 osr_bci,
 232                                           int                 comp_level,
 233                                           const methodHandle& hot_method,
 234                                           int                 hot_count,
 235                                           CompileTask::CompileReason compile_reason,
 236                                           bool                blocking);
 237   static void wait_for_completion(CompileTask* task);
 238 #if INCLUDE_JVMCI
 239   static bool wait_for_jvmci_completion(JVMCICompiler* comp, CompileTask* task, JavaThread* thread);
 240 #endif
 241 
 242   static void invoke_compiler_on_method(CompileTask* task);
 243   static void post_compile(CompilerThread* thread, CompileTask* task, bool success, ciEnv* ci_env);
 244   static void set_last_compile(CompilerThread *thread, const methodHandle& method, bool is_osr, int comp_level);
 245   static void push_jni_handle_block();
 246   static void pop_jni_handle_block();
 247   static void collect_statistics(CompilerThread* thread, elapsedTimer time, CompileTask* task);
 248 
 249   static void compile_method_base(const methodHandle& method,
 250                                   int osr_bci,
 251                                   int comp_level,
 252                                   const methodHandle& hot_method,
 253                                   int hot_count,
 254                                   CompileTask::CompileReason compile_reason,
 255                                   bool blocking,
 256                                   Thread* thread);
 257 
 258   static CompileQueue* compile_queue(int comp_level);
 259   static bool init_compiler_runtime();
 260   static void shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread);
 261 
 262 public:
 263