author | mgronlun |
Sat, 24 Aug 2019 14:30:27 +0200 | |
branch | JEP-349-branch |
changeset 57870 | 00860d9caf4d |
parent 53244 | 9807daeb47c4 |
child 57983 | a57907813a83 |
permissions | -rw-r--r-- |
50113 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50113
diff
changeset
|
2 |
* Copyright (c) 2011, 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_CHECKPOINT_TYPES_TRACEID_JFRTRACEID_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50113
diff
changeset
|
26 |
#define SHARE_JFR_RECORDER_CHECKPOINT_TYPES_TRACEID_JFRTRACEID_HPP |
50113 | 27 |
|
28 |
#include "jni.h" |
|
29 |
#include "jfr/utilities/jfrTypes.hpp" |
|
30 |
#include "memory/allocation.hpp" |
|
31 |
||
32 |
class ClassLoaderData; |
|
33 |
class Klass; |
|
34 |
class Method; |
|
35 |
class ModuleEntry; |
|
36 |
class PackageEntry; |
|
37 |
class Thread; |
|
38 |
||
39 |
/* |
|
40 |
* JfrTraceId is a means of tagging, e.g. marking, specific instances as being actively in-use. |
|
41 |
* The most common situation is a committed event that has a field that is referring to a specific instance. |
|
42 |
* Now there exist a relation between an event (field) and an artifact of some kind. |
|
43 |
* We track this relation during runtime using the JfrTraceId mechanism in order to reify it into the chunk |
|
44 |
* where the event is finally written. |
|
45 |
* |
|
46 |
* It is the event commit mechanism that tags instances as in-use. The tag routines return the untagged traceid |
|
47 |
* as a mapping key, and the commit mechanism writes the key into the event field. |
|
48 |
* Consequently, the mechanism is opaque and not something a user needs to know about. |
|
49 |
* Indeed, the API promotes using well-known JVM concepts directly in events, such as having a Klass* as an event field. |
|
50 |
* |
|
51 |
* Tagging allows for many-to-one mappings of constants, lazy evaluation / collection of tags during chunk rotation |
|
52 |
* and concurrency (by using an epoch relative tagging scheme). |
|
53 |
* |
|
54 |
* JfrTraceId(s) have been added to support tagging instances of classes such as: |
|
55 |
* |
|
56 |
* Klass (includes Method) |
|
57 |
* ClassLoaderData |
|
58 |
* ModuleEntry |
|
59 |
* PackageEntry |
|
60 |
* |
|
61 |
* These classes have been extended to include a _traceid field (64-bits). |
|
62 |
* |
|
63 |
* Each instance is uniquely identified by a type-relative monotonic counter that is unique over the VM lifecycle. |
|
64 |
* "Tagging an instance" essentially means to set contextually determined (by epoch) marker bits in the _traceid field. |
|
65 |
* The constants associated with a tagged instance is a set of which is determined by a constant type definition, |
|
66 |
* and these constants are then serialized in an upcoming checkpoint event for the relevant chunk. |
|
67 |
* |
|
68 |
* Note that a "tagging" is relative to a chunk. Having serialized the tagged instance, the tag bits are reset (for that epoch). |
|
69 |
* As mentioned previously, the returned traceid is always the untagged value. |
|
70 |
* |
|
71 |
* We also use the _traceid field in Klass to quickly identify (bit check) if a newly loaded klass is of type jdk.jfr.Event. |
|
72 |
* (see jfr/instrumentation/jfrEventClassTransformer.cpp) |
|
73 |
* |
|
74 |
* |
|
75 |
* _traceid bit layout and description planned to go here |
|
76 |
* |
|
77 |
* |
|
78 |
*/ |
|
79 |
||
80 |
class JfrTraceId : public AllStatic { |
|
81 |
public: |
|
82 |
static void assign(const Klass* klass); |
|
83 |
static void assign(const ModuleEntry* module); |
|
84 |
static void assign(const PackageEntry* package); |
|
85 |
static void assign(const ClassLoaderData* cld); |
|
86 |
static traceid assign_thread_id(); |
|
87 |
||
88 |
static traceid get(const Klass* klass); |
|
89 |
static traceid get(jclass jc); |
|
90 |
static traceid get(const Thread* thread); |
|
91 |
||
92 |
// tag construct as used, returns pre-tagged traceid |
|
57870
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
53244
diff
changeset
|
93 |
static traceid use(const Klass* klass); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
53244
diff
changeset
|
94 |
static traceid use(jclass jc); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
53244
diff
changeset
|
95 |
static traceid use(const Method* method); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
53244
diff
changeset
|
96 |
static traceid use(const Klass* klass, const Method* method); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
53244
diff
changeset
|
97 |
static traceid use(const ModuleEntry* module); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
53244
diff
changeset
|
98 |
static traceid use(const PackageEntry* package); |
00860d9caf4d
New metadata system for oldobjects built on top of simplified tagging model. Caching and serialization improvements. Flushpoint checkpoint with chunkheader contents.
mgronlun
parents:
53244
diff
changeset
|
99 |
static traceid use(const ClassLoaderData* cld); |
50113 | 100 |
|
101 |
static void remove(const Klass* klass); |
|
102 |
static void restore(const Klass* klass); |
|
103 |
||
104 |
// set of event classes made visible to java |
|
105 |
static bool in_visible_set(const Klass* k); |
|
106 |
static bool in_visible_set(const jclass jc); |
|
107 |
||
108 |
// jdk.jfr.Event |
|
109 |
static bool is_jdk_jfr_event(const Klass* k); |
|
110 |
static bool is_jdk_jfr_event(const jclass jc); |
|
111 |
static void tag_as_jdk_jfr_event(const Klass* k); |
|
112 |
||
113 |
// jdk.jfr.Event subklasses |
|
114 |
static bool is_jdk_jfr_event_sub(const Klass* k); |
|
115 |
static bool is_jdk_jfr_event_sub(const jclass jc); |
|
116 |
static void tag_as_jdk_jfr_event_sub(const Klass* k); |
|
117 |
static void tag_as_jdk_jfr_event_sub(const jclass jc); |
|
118 |
||
119 |
static bool in_jdk_jfr_event_hierarchy(const Klass* k); |
|
120 |
static bool in_jdk_jfr_event_hierarchy(const jclass jc); |
|
121 |
||
122 |
// klasses that host an event |
|
123 |
static bool is_event_host(const Klass* k); |
|
124 |
static bool is_event_host(const jclass jc); |
|
125 |
static void tag_as_event_host(const Klass* k); |
|
126 |
static void tag_as_event_host(const jclass jc); |
|
127 |
}; |
|
128 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50113
diff
changeset
|
129 |
#endif // SHARE_JFR_RECORDER_CHECKPOINT_TYPES_TRACEID_JFRTRACEID_HPP |