51 typedef const Method* MethodPtr; |
51 typedef const Method* MethodPtr; |
52 typedef const Symbol* SymbolPtr; |
52 typedef const Symbol* SymbolPtr; |
53 typedef const JfrSymbolId::SymbolEntry* SymbolEntryPtr; |
53 typedef const JfrSymbolId::SymbolEntry* SymbolEntryPtr; |
54 typedef const JfrSymbolId::CStringEntry* CStringEntryPtr; |
54 typedef const JfrSymbolId::CStringEntry* CStringEntryPtr; |
55 |
55 |
|
56 static JfrCheckpointWriter* _writer = NULL; |
|
57 static JfrCheckpointWriter* _leakp_writer = NULL; |
|
58 static JfrArtifactSet* _artifacts = NULL; |
|
59 static JfrArtifactClosure* _subsystem_callback = NULL; |
|
60 static bool _class_unload = false; |
|
61 static bool _flushpoint = false; |
|
62 |
56 // incremented on each rotation |
63 // incremented on each rotation |
57 static u8 checkpoint_id = 1; |
64 static u8 checkpoint_id = 1; |
58 |
65 |
59 // creates a unique id by combining a checkpoint relative symbol id (2^24) |
66 // creates a unique id by combining a checkpoint relative symbol id (2^24) |
60 // with the current checkpoint id (2^40) |
67 // with the current checkpoint id (2^40) |
61 #define CREATE_SYMBOL_ID(sym_id) (((u8)((checkpoint_id << 24) | sym_id))) |
68 #define CREATE_SYMBOL_ID(sym_id) (((u8)((checkpoint_id << 24) | sym_id))) |
62 |
69 |
63 static traceid create_symbol_id(traceid artifact_id) { |
70 static traceid create_symbol_id(traceid artifact_id) { |
64 return artifact_id != 0 ? CREATE_SYMBOL_ID(artifact_id) : 0; |
71 return artifact_id != 0 ? CREATE_SYMBOL_ID(artifact_id) : 0; |
65 } |
72 } |
66 |
|
67 static JfrCheckpointWriter* _writer = NULL; |
|
68 static JfrCheckpointWriter* _leakp_writer = NULL; |
|
69 static bool _class_unload = false; |
|
70 static bool _flushpoint = false; |
|
71 static JfrArtifactSet* _artifacts = NULL; |
|
72 static JfrArtifactClosure* _subsystem_callback = NULL; |
|
73 |
73 |
74 static bool current_epoch() { |
74 static bool current_epoch() { |
75 return _class_unload || _flushpoint; |
75 return _class_unload || _flushpoint; |
76 } |
76 } |
77 |
77 |
154 assert(value != NULL, "invariant"); |
154 assert(value != NULL, "invariant"); |
155 SET_LEAKP(value); |
155 SET_LEAKP(value); |
156 assert(IS_LEAKP(value), "invariant"); |
156 assert(IS_LEAKP(value), "invariant"); |
157 } |
157 } |
158 |
158 |
159 static void tag_leakp_klass_artifacts(KlassPtr k, bool class_unload) { |
159 static void tag_leakp_klass_artifacts(KlassPtr k) { |
160 assert(k != NULL, "invariant"); |
160 assert(k != NULL, "invariant"); |
161 PkgPtr pkg = k->package(); |
161 PkgPtr pkg = k->package(); |
162 if (pkg != NULL) { |
162 if (pkg != NULL) { |
163 tag_leakp_artifact(pkg); |
163 tag_leakp_artifact(pkg); |
164 ModPtr module = pkg->module(); |
164 ModPtr module = pkg->module(); |
172 tag_leakp_artifact(cld); |
172 tag_leakp_artifact(cld); |
173 } |
173 } |
174 } |
174 } |
175 |
175 |
176 class TagLeakpKlassArtifact { |
176 class TagLeakpKlassArtifact { |
177 bool _class_unload; |
177 public: |
178 public: |
178 TagLeakpKlassArtifact(bool class_unload) {} |
179 TagLeakpKlassArtifact(bool class_unload) : _class_unload(class_unload) {} |
|
180 bool operator()(KlassPtr klass) { |
179 bool operator()(KlassPtr klass) { |
181 if (IS_LEAKP(klass)) { |
180 if (IS_LEAKP(klass)) { |
182 tag_leakp_klass_artifacts(klass, _class_unload); |
181 tag_leakp_klass_artifacts(klass); |
183 } |
182 } |
184 return true; |
183 return true; |
185 } |
184 } |
186 }; |
185 }; |
187 |
186 |