Path: blob/master/src/hotspot/share/compiler/compilerEvent.hpp
40930 views
/*1* Copyright (c) 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_COMPILER_COMPILEREVENT_HPP24#define SHARE_COMPILER_COMPILEREVENT_HPP2526#include "jni.h"27#include "compiler/compilerDefinitions.hpp"28#include "memory/allocation.hpp"29#include "utilities/macros.hpp"30#include "utilities/ticks.hpp"3132#if INCLUDE_JFR33#include "jfr/utilities/jfrTime.hpp"34#endif3536class ciMethod;37template <typename>38class GrowableArray;39class Method;40class EventCompilation;41class EventCompilationFailure;42class EventCompilerInlining;43class EventCompilerPhase;44struct JfrStructCalleeMethod;4546class CompilerEvent : AllStatic {47public:48static jlong ticksNow() {49// Using Ticks for consistent usage outside JFR folder.50JFR_ONLY(return JfrTime::is_ft_enabled() ? Ticks::now().ft_value() : Ticks::now().value();) NOT_JFR_RETURN_(0L);51}5253class CompilationEvent : AllStatic {54public:55static void post(EventCompilation& event, int compile_id, CompilerType type, Method* method, int compile_level, bool success, bool is_osr, int code_size, int inlined_bytecodes) NOT_JFR_RETURN();56};5758class CompilationFailureEvent : AllStatic {59public:60static void post(EventCompilationFailure& event, int compile_id, const char* reason) NOT_JFR_RETURN();61};6263class PhaseEvent : AllStatic {64friend class CompilerPhaseTypeConstant;65public:6667// Gets a unique identifier for `phase_name`, computing and registering it first if necessary.68// If `may_exist` is true, then current registrations are searched first. If false, then69// there must not be an existing registration for `phase_name`.70// If `use_strdup` is true, then `phase_name` is strdup'ed before registration.71// If `sync` is true, then access to the registration table is synchronized.72static int get_phase_id(const char* phase_name, bool may_exist, bool use_strdup, bool sync) NOT_JFR_RETURN_(-1);7374static void post(EventCompilerPhase& event, const Ticks& start_time, int phase, int compile_id, int level) NOT_JFR_RETURN();75static void post(EventCompilerPhase& event, jlong start_time, int phase, int compile_id, int level) {76JFR_ONLY(post(event, Ticks(start_time), phase, compile_id, level);)77}78};7980class InlineEvent : AllStatic {81static void post(EventCompilerInlining& event, int compile_id, Method* caller, const JfrStructCalleeMethod& callee, bool success, const char* msg, int bci) NOT_JFR_RETURN();82public:83static void post(EventCompilerInlining& event, int compile_id, Method* caller, Method* callee, bool success, const char* msg, int bci) NOT_JFR_RETURN();84static void post(EventCompilerInlining& event, int compile_id, Method* caller, ciMethod* callee, bool success, const char* msg, int bci) NOT_JFR_RETURN();85};86};87#endif // SHARE_COMPILER_COMPILEREVENT_HPP888990