30 #include "memory/allocation.hpp" |
30 #include "memory/allocation.hpp" |
31 |
31 |
32 class ClassLoaderData; |
32 class ClassLoaderData; |
33 class Klass; |
33 class Klass; |
34 class Method; |
34 class Method; |
35 // XXX class PackageEntry; |
|
36 class Thread; |
35 class Thread; |
37 |
36 |
38 /* |
37 /* |
39 * JfrTraceId is a means of tagging, e.g. marking, specific instances as being actively in-use. |
38 * JfrTraceId is a means of tagging, e.g. marking, specific instances as being actively in-use. |
40 * The most common situation is a committed event that has a field that is referring to a specific instance. |
39 * The most common situation is a committed event that has a field that is referring to a specific instance. |
52 * |
51 * |
53 * JfrTraceId(s) have been added to support tagging instances of classes such as: |
52 * JfrTraceId(s) have been added to support tagging instances of classes such as: |
54 * |
53 * |
55 * Klass (includes Method) |
54 * Klass (includes Method) |
56 * ClassLoaderData |
55 * ClassLoaderData |
57 * XXX PackageEntry |
|
58 * |
56 * |
59 * These classes have been extended to include a _traceid field (64-bits). |
57 * These classes have been extended to include a _traceid field (64-bits). |
60 * |
58 * |
61 * Each instance is uniquely identified by a type-relative monotonic counter that is unique over the VM lifecycle. |
59 * Each instance is uniquely identified by a type-relative monotonic counter that is unique over the VM lifecycle. |
62 * "Tagging an instance" essentially means to set contextually determined (by epoch) marker bits in the _traceid field. |
60 * "Tagging an instance" essentially means to set contextually determined (by epoch) marker bits in the _traceid field. |
76 */ |
74 */ |
77 |
75 |
78 class JfrTraceId : public AllStatic { |
76 class JfrTraceId : public AllStatic { |
79 public: |
77 public: |
80 static void assign(const Klass* klass); |
78 static void assign(const Klass* klass); |
81 // XXX static void assign(const PackageEntry* package); |
|
82 static void assign(const ClassLoaderData* cld); |
79 static void assign(const ClassLoaderData* cld); |
83 static traceid assign_thread_id(); |
80 static traceid assign_thread_id(); |
84 |
81 |
85 static traceid get(const Klass* klass); |
82 static traceid get(const Klass* klass); |
86 static traceid get(jclass jc); |
83 static traceid get(jclass jc); |
88 |
85 |
89 // tag construct as used, returns pre-tagged traceid |
86 // tag construct as used, returns pre-tagged traceid |
90 static traceid use(const Klass* klass, bool leakp = false); |
87 static traceid use(const Klass* klass, bool leakp = false); |
91 static traceid use(jclass jc, bool leakp = false); |
88 static traceid use(jclass jc, bool leakp = false); |
92 static traceid use(const Method* method, bool leakp = false); |
89 static traceid use(const Method* method, bool leakp = false); |
93 // XXX static traceid use(const PackageEntry* package, bool leakp = false); |
|
94 static traceid use(const ClassLoaderData* cld, bool leakp = false); |
90 static traceid use(const ClassLoaderData* cld, bool leakp = false); |
95 |
91 |
96 static void remove(const Klass* klass); |
92 static void remove(const Klass* klass); |
97 static void restore(const Klass* klass); |
93 static void restore(const Klass* klass); |
98 |
94 |