< prev index next >

src/hotspot/share/c1/c1_Compiler.cpp

Print this page

 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 #include "c1/c1_Compilation.hpp"
 26 #include "c1/c1_Compiler.hpp"
 27 #include "c1/c1_FrameMap.hpp"
 28 #include "c1/c1_GraphBuilder.hpp"
 29 #include "c1/c1_LinearScan.hpp"
 30 #include "c1/c1_MacroAssembler.hpp"
 31 #include "c1/c1_Runtime1.hpp"
 32 #include "c1/c1_ValueType.hpp"

 33 #include "compiler/compileBroker.hpp"
 34 #include "compiler/compilerDirectives.hpp"
 35 #include "interpreter/linkResolver.hpp"
 36 #include "jfr/support/jfrIntrinsics.hpp"
 37 #include "memory/allocation.hpp"
 38 #include "memory/allocation.inline.hpp"
 39 #include "memory/resourceArea.hpp"
 40 #include "runtime/interfaceSupport.inline.hpp"
 41 #include "runtime/sharedRuntime.hpp"
 42 #include "runtime/vm_version.hpp"
 43 #include "utilities/bitMap.inline.hpp"
 44 #include "utilities/macros.hpp"
 45 
 46 
 47 Compiler::Compiler() : AbstractCompiler(compiler_c1) {
 48 }
 49 
 50 void Compiler::init_c1_runtime() {
 51   BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
 52   Runtime1::initialize(buffer_blob);

 53   FrameMap::initialize();
 54   // initialize data structures
 55   ValueType::initialize();
 56   GraphBuilder::initialize();
 57   // note: to use more than one instance of LinearScan at a time this function call has to
 58   //       be moved somewhere outside of this constructor:
 59   Interval::initialize();
 60 }
 61 
 62 
 63 void Compiler::initialize() {
 64   // Buffer blob must be allocated per C1 compiler thread at startup
 65   BufferBlob* buffer_blob = init_buffer_blob();
 66 
 67   if (should_perform_init()) {
 68     if (buffer_blob == nullptr) {
 69       // When we come here we are in state 'initializing'; entire C1 compilation
 70       // can be shut down.
 71       set_state(failed);
 72     } else {

234   case vmIntrinsics::_getCharStringU:
235   case vmIntrinsics::_putCharStringU:
236 #ifdef JFR_HAVE_INTRINSICS
237   case vmIntrinsics::_counterTime:
238 #endif
239   case vmIntrinsics::_getObjectSize:
240 #if defined(X86) || defined(AARCH64) || defined(S390) || defined(RISCV) || defined(PPC64)
241   case vmIntrinsics::_clone:
242 #endif
243     break;
244   case vmIntrinsics::_blackhole:
245     break;
246   default:
247     return false; // Intrinsics not on the previous list are not available.
248   }
249 
250   return true;
251 }
252 
253 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci, bool install_code, DirectiveSet* directive) {

















254   BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
255   assert(buffer_blob != nullptr, "Must exist");
256   // invoke compilation
257   {
258     // We are nested here because we need for the destructor
259     // of Compilation to occur before we release the any
260     // competing compiler thread
261     ResourceMark rm;
262     Compilation c(this, env, method, entry_bci, buffer_blob, install_code, directive);
263   }
264 }
265 
266 
267 void Compiler::print_timers() {
268   Compilation::print_timers();
269 }

 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 #include "c1/c1_Compilation.hpp"
 26 #include "c1/c1_Compiler.hpp"
 27 #include "c1/c1_FrameMap.hpp"
 28 #include "c1/c1_GraphBuilder.hpp"
 29 #include "c1/c1_LinearScan.hpp"
 30 #include "c1/c1_MacroAssembler.hpp"
 31 #include "c1/c1_Runtime1.hpp"
 32 #include "c1/c1_ValueType.hpp"
 33 #include "code/SCCache.hpp"
 34 #include "compiler/compileBroker.hpp"
 35 #include "compiler/compilerDirectives.hpp"
 36 #include "interpreter/linkResolver.hpp"
 37 #include "jfr/support/jfrIntrinsics.hpp"
 38 #include "memory/allocation.hpp"
 39 #include "memory/allocation.inline.hpp"
 40 #include "memory/resourceArea.hpp"
 41 #include "runtime/interfaceSupport.inline.hpp"
 42 #include "runtime/sharedRuntime.hpp"
 43 #include "runtime/vm_version.hpp"
 44 #include "utilities/bitMap.inline.hpp"
 45 #include "utilities/macros.hpp"
 46 
 47 
 48 Compiler::Compiler() : AbstractCompiler(compiler_c1) {
 49 }
 50 
 51 void Compiler::init_c1_runtime() {
 52   BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
 53   Runtime1::initialize(buffer_blob);
 54   SCCache::init_c1_table();
 55   FrameMap::initialize();
 56   // initialize data structures
 57   ValueType::initialize();
 58   GraphBuilder::initialize();
 59   // note: to use more than one instance of LinearScan at a time this function call has to
 60   //       be moved somewhere outside of this constructor:
 61   Interval::initialize();
 62 }
 63 
 64 
 65 void Compiler::initialize() {
 66   // Buffer blob must be allocated per C1 compiler thread at startup
 67   BufferBlob* buffer_blob = init_buffer_blob();
 68 
 69   if (should_perform_init()) {
 70     if (buffer_blob == nullptr) {
 71       // When we come here we are in state 'initializing'; entire C1 compilation
 72       // can be shut down.
 73       set_state(failed);
 74     } else {

236   case vmIntrinsics::_getCharStringU:
237   case vmIntrinsics::_putCharStringU:
238 #ifdef JFR_HAVE_INTRINSICS
239   case vmIntrinsics::_counterTime:
240 #endif
241   case vmIntrinsics::_getObjectSize:
242 #if defined(X86) || defined(AARCH64) || defined(S390) || defined(RISCV) || defined(PPC64)
243   case vmIntrinsics::_clone:
244 #endif
245     break;
246   case vmIntrinsics::_blackhole:
247     break;
248   default:
249     return false; // Intrinsics not on the previous list are not available.
250   }
251 
252   return true;
253 }
254 
255 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci, bool install_code, DirectiveSet* directive) {
256   CompileTask* task = env->task();
257   if (install_code && task->is_scc()) {
258     assert(!task->preload(), "Pre-loading cached code is not implemeted for C1 code");
259     bool success = SCCache::load_nmethod(env, method, entry_bci, this, CompLevel(task->comp_level()));
260     if (success) {
261       assert(task->is_success(), "sanity");
262       return;
263     }
264     SCCache::invalidate(task->scc_entry()); // mark scc_entry as not entrant
265     if (SCCache::is_code_load_thread_on() && !StoreCachedCode) {
266       // Bail out if failed to load cached code in SC thread
267       // unless the code is updating.
268       env->record_failure("Failed to load cached code");
269       return;
270     }
271     task->clear_scc();
272   }
273   BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
274   assert(buffer_blob != nullptr, "Must exist");
275   // invoke compilation
276   {
277     // We are nested here because we need for the destructor
278     // of Compilation to occur before we release the any
279     // competing compiler thread
280     ResourceMark rm;
281     Compilation c(this, env, method, entry_bci, buffer_blob, install_code, directive);
282   }
283 }
284 
285 
286 void Compiler::print_timers() {
287   Compilation::print_timers();
288 }
< prev index next >