Path: blob/master/src/hotspot/share/jvmci/jvmciCompiler.hpp
40949 views
/*1* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223#ifndef SHARE_JVMCI_JVMCICOMPILER_HPP24#define SHARE_JVMCI_JVMCICOMPILER_HPP2526#include "compiler/abstractCompiler.hpp"27#include "compiler/compiler_globals.hpp"28#include "runtime/atomic.hpp"2930class JVMCICompiler : public AbstractCompiler {31private:32bool _bootstrapping;3334/**35* True if we have seen a bootstrap compilation request.36*/37volatile bool _bootstrap_compilation_request_handled;3839/**40* Number of methods successfully compiled by a call to41* JVMCICompiler::compile_method().42*/43volatile int _methods_compiled;4445// Incremented periodically by JVMCI compiler threads46// to indicate JVMCI compilation activity.47volatile int _global_compilation_ticks;4849static JVMCICompiler* _instance;5051// Code installation timer for CompileBroker compilations52static elapsedTimer _codeInstallTimer;5354// Code installation timer for non-CompileBroker compilations55static elapsedTimer _hostedCodeInstallTimer;5657/**58* Exits the VM due to an unexpected exception.59*/60static void exit_on_pending_exception(oop exception, const char* message);6162public:63JVMCICompiler();6465static JVMCICompiler* instance(bool require_non_null, TRAPS);6667virtual const char* name() { return UseJVMCINativeLibrary ? "JVMCI-native" : "JVMCI"; }6869bool is_jvmci() { return true; }70bool is_c1 () { return false; }71bool is_c2 () { return false; }7273bool needs_stubs () { return false; }7475// Initialization76virtual void initialize();7778/**79* Initialize the compile queue with the methods in java.lang.Object and80* then wait until the queue is empty.81*/82void bootstrap(TRAPS);8384// Should force compilation of method at CompLevel_simple?85bool force_comp_at_level_simple(const methodHandle& method);8687bool is_bootstrapping() const { return _bootstrapping; }8889void set_bootstrap_compilation_request_handled() {90_instance->_bootstrap_compilation_request_handled = true;91}9293// Compilation entry point for methods94virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci, bool install_code, DirectiveSet* directive);9596// Print compilation timers and statistics97virtual void print_timers();9899// Gets the number of methods that have been successfully compiled by100// a call to JVMCICompiler::compile_method().101int methods_compiled() { return _methods_compiled; }102void inc_methods_compiled();103104// Gets a value indicating JVMCI compilation activity on any thread.105// If successive calls to this method return a different value, then106// some degree of JVMCI compilation occurred between the calls.107int global_compilation_ticks() const { return _global_compilation_ticks; }108void inc_global_compilation_ticks();109110// Print timers related to non-CompileBroker compilations111static void print_hosted_timers();112113static elapsedTimer* codeInstallTimer(bool hosted) {114if (!hosted) {115return &_codeInstallTimer;116} else {117return &_hostedCodeInstallTimer;118}119}120};121122#endif // SHARE_JVMCI_JVMCICOMPILER_HPP123124125