src/share/vm/jfr/writers/jfrPosition.inline.hpp

Tue, 16 Jun 2020 11:03:04 +0800

author
bulasevich
date
Tue, 16 Jun 2020 11:03:04 +0800
changeset 9947
db357034b763
parent 9858
b985cbb00e68
permissions
-rw-r--r--

8217647: JFR: recordings on 32-bit systems unreadable
Reviewed-by: egahlin
Contributed-by: boris.ulasevich@bell-sw.com, markus.gronlund@oracle.com

apetushkov@9858 1 /*
apetushkov@9858 2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
apetushkov@9858 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
apetushkov@9858 4 *
apetushkov@9858 5 * This code is free software; you can redistribute it and/or modify it
apetushkov@9858 6 * under the terms of the GNU General Public License version 2 only, as
apetushkov@9858 7 * published by the Free Software Foundation.
apetushkov@9858 8 *
apetushkov@9858 9 * This code is distributed in the hope that it will be useful, but WITHOUT
apetushkov@9858 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
apetushkov@9858 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
apetushkov@9858 12 * version 2 for more details (a copy is included in the LICENSE file that
apetushkov@9858 13 * accompanied this code).
apetushkov@9858 14 *
apetushkov@9858 15 * You should have received a copy of the GNU General Public License version
apetushkov@9858 16 * 2 along with this work; if not, write to the Free Software Foundation,
apetushkov@9858 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
apetushkov@9858 18 *
apetushkov@9858 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
apetushkov@9858 20 * or visit www.oracle.com if you need additional information or have any
apetushkov@9858 21 * questions.
apetushkov@9858 22 *
apetushkov@9858 23 */
apetushkov@9858 24
apetushkov@9858 25 #ifndef SHARE_VM_JFR_WRITERS_JFRPOSITION_INLINE_HPP
apetushkov@9858 26 #define SHARE_VM_JFR_WRITERS_JFRPOSITION_INLINE_HPP
apetushkov@9858 27
apetushkov@9858 28 #include "jfr/writers/jfrPosition.hpp"
apetushkov@9858 29
apetushkov@9858 30 template <typename AP>
apetushkov@9858 31 inline const u1* Position<AP>::start_pos() const {
apetushkov@9858 32 return _start_pos;
apetushkov@9858 33 }
apetushkov@9858 34
apetushkov@9858 35 template <typename AP>
apetushkov@9858 36 inline void Position<AP>::set_start_pos(const u1* position) {
apetushkov@9858 37 _start_pos = position;
apetushkov@9858 38 }
apetushkov@9858 39
apetushkov@9858 40 template <typename AP>
apetushkov@9858 41 inline u1* Position<AP>::current_pos() {
apetushkov@9858 42 return _current_pos;
apetushkov@9858 43 }
apetushkov@9858 44
apetushkov@9858 45 template <typename AP>
apetushkov@9858 46 inline void Position<AP>::set_current_pos(const u1* new_position) {
apetushkov@9858 47 _current_pos = const_cast<u1*>(new_position);
apetushkov@9858 48 }
apetushkov@9858 49
apetushkov@9858 50 template <typename AP>
apetushkov@9858 51 inline void Position<AP>::set_current_pos(size_t size) {
apetushkov@9858 52 _current_pos += size;
apetushkov@9858 53 }
apetushkov@9858 54
apetushkov@9858 55 template <typename AP>
apetushkov@9858 56 inline const u1* Position<AP>::end_pos() const {
apetushkov@9858 57 return _end_pos;
apetushkov@9858 58 }
apetushkov@9858 59
apetushkov@9858 60 template <typename AP>
apetushkov@9858 61 inline void Position<AP>::set_end_pos(const u1* position) {
apetushkov@9858 62 _end_pos = position;
apetushkov@9858 63 }
apetushkov@9858 64
apetushkov@9858 65 template <typename AP>
apetushkov@9858 66 inline Position<AP>::Position(const u1* start_pos, size_t size) :
apetushkov@9858 67 AP(),
apetushkov@9858 68 _start_pos(start_pos),
apetushkov@9858 69 _current_pos(const_cast<u1*>(start_pos)),
apetushkov@9858 70 _end_pos(start_pos + size) {
apetushkov@9858 71 }
apetushkov@9858 72
apetushkov@9858 73 template <typename AP>
apetushkov@9858 74 inline Position<AP>::Position() : _start_pos(NULL), _current_pos(NULL), _end_pos(NULL) {
apetushkov@9858 75 }
apetushkov@9858 76
apetushkov@9858 77 template <typename AP>
apetushkov@9858 78 inline size_t Position<AP>::available_size() const {
apetushkov@9858 79 return _end_pos - _current_pos;
apetushkov@9858 80 }
apetushkov@9858 81
apetushkov@9858 82 template <typename AP>
bulasevich@9947 83 inline int64_t Position<AP>::used_offset() const {
apetushkov@9858 84 return _current_pos - _start_pos;
apetushkov@9858 85 }
apetushkov@9858 86
apetushkov@9858 87 template <typename AP>
bulasevich@9947 88 inline int64_t Position<AP>::current_offset() const {
apetushkov@9858 89 return this->used_offset();
apetushkov@9858 90 }
apetushkov@9858 91
apetushkov@9858 92 template <typename AP>
apetushkov@9858 93 inline size_t Position<AP>::used_size() const {
apetushkov@9858 94 return (size_t)used_offset();
apetushkov@9858 95 }
apetushkov@9858 96
apetushkov@9858 97 template <typename AP>
apetushkov@9858 98 inline void Position<AP>::reset() {
apetushkov@9858 99 set_current_pos(_start_pos);
apetushkov@9858 100 }
apetushkov@9858 101
apetushkov@9858 102 #endif // SHARE_VM_JFR_WRITERS_JFRPOSITION_INLINE_HPP

mercurial