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