src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 50113 caf115bb98ad
child 57360 5d043a159d5c
child 58863 c16ac7a2eba4
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50113
diff changeset
     2
 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     4
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     8
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    13
 * accompanied this code).
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    14
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    18
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    21
 * questions.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    22
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    23
 */
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50113
diff changeset
    25
#ifndef SHARE_JFR_RECORDER_STRINGPOOL_JFRSTRINGPOOL_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50113
diff changeset
    26
#define SHARE_JFR_RECORDER_STRINGPOOL_JFRSTRINGPOOL_HPP
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    27
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    28
#include "jni.h"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    29
#include "jfr/recorder/storage/jfrMemorySpace.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    30
#include "jfr/recorder/storage/jfrMemorySpaceRetrieval.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    31
#include "jfr/recorder/stringpool/jfrStringPoolBuffer.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    32
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    33
class JfrChunkWriter;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    34
class JfrStringPool;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    35
class Mutex;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    36
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    37
typedef JfrMemorySpace<JfrStringPoolBuffer, JfrMspaceSequentialRetrieval, JfrStringPool> JfrStringPoolMspace;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    38
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    39
//
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    40
// Although called JfrStringPool, a more succinct description would be
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    41
// "backing storage for the string pool located in Java"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    42
//
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    43
// There are no lookups in native, only the encoding of string constants to the stream.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    44
//
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    45
class JfrStringPool : public JfrCHeapObj {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    46
 public:
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    47
  static bool add(bool epoch, jlong id, jstring string, JavaThread* jt);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    48
  size_t write();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    49
  size_t write_at_safepoint();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    50
  size_t clear();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    51
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    52
  typedef JfrStringPoolMspace::Type Buffer;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    53
 private:
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    54
  JfrStringPoolMspace* _free_list_mspace;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    55
  Mutex* _lock;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    56
  JfrChunkWriter& _chunkwriter;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    57
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    58
  // mspace callback
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    59
  void register_full(Buffer* t, Thread* thread);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    60
  void lock();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    61
  void unlock();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    62
  DEBUG_ONLY(bool is_locked() const;)
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    63
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    64
  static Buffer* lease_buffer(Thread* thread, size_t size = 0);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    65
  static Buffer* flush(Buffer* old, size_t used, size_t requested, Thread* t);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    66
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    67
  JfrStringPool(JfrChunkWriter& cw);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    68
  ~JfrStringPool();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    69
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    70
  static JfrStringPool& instance();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    71
  static JfrStringPool* create(JfrChunkWriter& cw);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    72
  bool initialize();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    73
  static void destroy();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    74
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    75
  friend class JfrRecorder;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    76
  friend class JfrRecorderService;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    77
  friend class JfrStringPoolFlush;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    78
  friend class JfrStringPoolWriter;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    79
  template <typename, template <typename> class, typename>
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    80
  friend class JfrMemorySpace;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    81
};
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    82
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50113
diff changeset
    83
#endif // SHARE_JFR_RECORDER_STRINGPOOL_JFRSTRINGPOOL_HPP