Path: blob/master/src/hotspot/share/jfr/support/jfrTraceIdExtension.hpp
41149 views
/*1* Copyright (c) 2012, 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*22*/2324#ifndef SHARE_JFR_SUPPORT_JFRTRACEIDEXTENSION_HPP25#define SHARE_JFR_SUPPORT_JFRTRACEIDEXTENSION_HPP2627#include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp"28#include "utilities/macros.hpp"2930#define DEFINE_TRACE_ID_FIELD mutable traceid _trace_id3132#define DEFINE_TRACE_ID_METHODS \33traceid trace_id() const { return _trace_id; } \34traceid* const trace_id_addr() const { return &_trace_id; } \35void set_trace_id(traceid id) const { _trace_id = id; }3637#define DEFINE_TRACE_ID_SIZE \38static size_t trace_id_size() { return sizeof(traceid); }3940#define INIT_ID(data) JfrTraceId::assign(data)41#define ASSIGN_PRIMITIVE_CLASS_ID(data) JfrTraceId::assign_primitive_klass_id()42#define REMOVE_ID(k) JfrTraceId::remove(k);43#define REMOVE_METHOD_ID(method) JfrTraceId::remove(method);44#define RESTORE_ID(k) JfrTraceId::restore(k);4546class JfrTraceFlag {47private:48mutable jshort _flags;49public:50JfrTraceFlag() : _flags(0) {}51bool is_set(jshort flag) const {52return (_flags & flag) != 0;53}5455jshort flags() const {56return _flags;57}5859void set_flags(jshort flags) const {60_flags = flags;61}6263jbyte* flags_addr() const {64#ifdef VM_LITTLE_ENDIAN65return (jbyte*)&_flags;66#else67return ((jbyte*)&_flags) + 1;68#endif69}7071jbyte* meta_addr() const {72#ifdef VM_LITTLE_ENDIAN73return ((jbyte*)&_flags) + 1;74#else75return (jbyte*)&_flags;76#endif77}78};7980#define DEFINE_TRACE_FLAG mutable JfrTraceFlag _trace_flags8182#define DEFINE_TRACE_FLAG_ACCESSOR \83bool is_trace_flag_set(jshort flag) const { \84return _trace_flags.is_set(flag); \85} \86jshort trace_flags() const { \87return _trace_flags.flags(); \88} \89void set_trace_flags(jshort flags) const { \90_trace_flags.set_flags(flags); \91} \92jbyte* trace_flags_addr() const { \93return _trace_flags.flags_addr(); \94} \95jbyte* trace_meta_addr() const { \96return _trace_flags.meta_addr(); \97}9899#endif // SHARE_JFR_SUPPORT_JFRTRACEIDEXTENSION_HPP100101102