Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp
41155 views
1
/*
2
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
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
25
#include "precompiled.hpp"
26
#include "jfrfiles/jfrTypes.hpp"
27
#include "jfr/leakprofiler/chains/edge.hpp"
28
#include "jfr/leakprofiler/chains/edgeStore.hpp"
29
#include "jfr/leakprofiler/chains/edgeUtils.hpp"
30
#include "jfr/leakprofiler/checkpoint/objectSampleDescription.hpp"
31
#include "jfr/leakprofiler/checkpoint/objectSampleWriter.hpp"
32
#include "jfr/leakprofiler/checkpoint/rootResolver.hpp"
33
#include "jfr/leakprofiler/sampling/objectSampler.hpp"
34
#include "jfr/leakprofiler/utilities/rootType.hpp"
35
#include "jfr/leakprofiler/utilities/unifiedOopRef.inline.hpp"
36
#include "jfr/metadata/jfrSerializer.hpp"
37
#include "jfr/writers/jfrTypeWriterHost.hpp"
38
#include "oops/oop.inline.hpp"
39
#include "oops/symbol.hpp"
40
#include "utilities/growableArray.hpp"
41
42
template <typename Data>
43
class ObjectSampleAuxInfo : public ResourceObj {
44
public:
45
Data _data;
46
traceid _id;
47
ObjectSampleAuxInfo() : _data(), _id(0) {}
48
};
49
50
class ObjectSampleArrayData {
51
public:
52
int _array_size;
53
int _array_index;
54
ObjectSampleArrayData() : _array_size(0), _array_index(0) {}
55
};
56
57
class ObjectSampleFieldInfo : public ResourceObj {
58
public:
59
const Symbol* _field_name_symbol;
60
jshort _field_modifiers;
61
ObjectSampleFieldInfo() : _field_name_symbol(NULL), _field_modifiers(0) {}
62
};
63
64
class ObjectSampleRootDescriptionData {
65
public:
66
const Edge* _root_edge;
67
const char* _description;
68
OldObjectRoot::System _system;
69
OldObjectRoot::Type _type;
70
ObjectSampleRootDescriptionData() : _root_edge(NULL),
71
_description(NULL),
72
_system(OldObjectRoot::_system_undetermined),
73
_type(OldObjectRoot::_type_undetermined) {}
74
};
75
76
class OldObjectSampleData {
77
public:
78
oop _object;
79
traceid _reference_id;
80
};
81
82
class ReferenceData {
83
public:
84
traceid _field_info_id;
85
traceid _array_info_id;
86
traceid _old_object_sample_id;
87
size_t _skip;
88
};
89
90
static int initial_storage_size = 16;
91
92
template <typename Data>
93
class SampleSet : public ResourceObj {
94
private:
95
GrowableArray<Data>* _storage;
96
public:
97
SampleSet() : _storage(NULL) {}
98
99
traceid store(Data data) {
100
assert(data != NULL, "invariant");
101
if (_storage == NULL) {
102
_storage = new GrowableArray<Data>(initial_storage_size);
103
}
104
assert(_storage != NULL, "invariant");
105
assert(_storage->find(data) == -1, "invariant");
106
_storage->append(data);
107
return data->_id;
108
}
109
110
size_t size() const {
111
return _storage != NULL ? (size_t)_storage->length() : 0;
112
}
113
114
template <typename Functor>
115
void iterate(Functor& functor) {
116
if (_storage != NULL) {
117
for (int i = 0; i < _storage->length(); ++i) {
118
functor(_storage->at(i));
119
}
120
}
121
}
122
123
const GrowableArray<Data>& storage() const {
124
return *_storage;
125
}
126
};
127
128
typedef ObjectSampleAuxInfo<ObjectSampleArrayData> ObjectSampleArrayInfo;
129
typedef ObjectSampleAuxInfo<ObjectSampleRootDescriptionData> ObjectSampleRootDescriptionInfo;
130
typedef ObjectSampleAuxInfo<OldObjectSampleData> OldObjectSampleInfo;
131
typedef ObjectSampleAuxInfo<ReferenceData> ReferenceInfo;
132
133
class FieldTable : public ResourceObj {
134
template <typename,
135
typename,
136
template<typename, typename> class,
137
typename,
138
size_t>
139
friend class HashTableHost;
140
typedef HashTableHost<const ObjectSampleFieldInfo*, traceid, JfrHashtableEntry, FieldTable, 109> FieldInfoTable;
141
public:
142
typedef FieldInfoTable::HashEntry FieldInfoEntry;
143
144
private:
145
static traceid _field_id_counter;
146
FieldInfoTable* _table;
147
const ObjectSampleFieldInfo* _lookup;
148
149
void on_link(FieldInfoEntry* entry) {
150
assert(entry != NULL, "invariant");
151
entry->set_id(++_field_id_counter);
152
}
153
154
bool on_equals(uintptr_t hash, const FieldInfoEntry* entry) {
155
assert(hash == entry->hash(), "invariant");
156
assert(_lookup != NULL, "invariant");
157
return entry->literal()->_field_modifiers == _lookup->_field_modifiers;
158
}
159
160
void on_unlink(FieldInfoEntry* entry) {
161
assert(entry != NULL, "invariant");
162
// nothing
163
}
164
165
public:
166
FieldTable() : _table(new FieldInfoTable(this)), _lookup(NULL) {}
167
~FieldTable() {
168
assert(_table != NULL, "invariant");
169
delete _table;
170
}
171
172
traceid store(const ObjectSampleFieldInfo* field_info) {
173
assert(field_info != NULL, "invariant");
174
_lookup = field_info;
175
const FieldInfoEntry& entry = _table->lookup_put(field_info->_field_name_symbol->identity_hash(), field_info);
176
return entry.id();
177
}
178
179
size_t size() const {
180
return _table->cardinality();
181
}
182
183
template <typename T>
184
void iterate(T& functor) const {
185
_table->iterate_entry<T>(functor);
186
}
187
};
188
189
traceid FieldTable::_field_id_counter = 0;
190
191
typedef SampleSet<const OldObjectSampleInfo*> SampleInfo;
192
typedef SampleSet<const ReferenceInfo*> RefInfo;
193
typedef SampleSet<const ObjectSampleArrayInfo*> ArrayInfo;
194
typedef SampleSet<const ObjectSampleRootDescriptionInfo*> RootDescriptionInfo;
195
196
static SampleInfo* sample_infos = NULL;
197
static RefInfo* ref_infos = NULL;
198
static ArrayInfo* array_infos = NULL;
199
static FieldTable* field_infos = NULL;
200
static RootDescriptionInfo* root_infos = NULL;
201
202
int __write_sample_info__(JfrCheckpointWriter* writer, const void* si) {
203
assert(writer != NULL, "invariant");
204
assert(si != NULL, "invariant");
205
const OldObjectSampleInfo* const oosi = (const OldObjectSampleInfo*)si;
206
oop object = oosi->_data._object;
207
assert(object != NULL, "invariant");
208
writer->write(oosi->_id);
209
writer->write(cast_from_oop<u8>(object));
210
writer->write(const_cast<const Klass*>(object->klass()));
211
ObjectSampleDescription od(object);
212
writer->write(od.description());
213
writer->write(oosi->_data._reference_id);
214
return 1;
215
}
216
217
typedef JfrTypeWriterImplHost<const OldObjectSampleInfo*, __write_sample_info__> SampleWriterImpl;
218
typedef JfrTypeWriterHost<SampleWriterImpl, TYPE_OLDOBJECT> SampleWriter;
219
220
static void write_sample_infos(JfrCheckpointWriter& writer) {
221
if (sample_infos != NULL) {
222
SampleWriter sw(&writer);
223
sample_infos->iterate(sw);
224
}
225
}
226
227
int __write_reference_info__(JfrCheckpointWriter* writer, const void* ri) {
228
assert(writer != NULL, "invariant");
229
assert(ri != NULL, "invariant");
230
const ReferenceInfo* const ref_info = (const ReferenceInfo*)ri;
231
writer->write(ref_info->_id);
232
writer->write(ref_info->_data._array_info_id);
233
writer->write(ref_info->_data._field_info_id);
234
writer->write(ref_info->_data._old_object_sample_id);
235
writer->write<s4>((s4)ref_info->_data._skip);
236
return 1;
237
}
238
239
typedef JfrTypeWriterImplHost<const ReferenceInfo*, __write_reference_info__> ReferenceWriterImpl;
240
typedef JfrTypeWriterHost<ReferenceWriterImpl, TYPE_REFERENCE> ReferenceWriter;
241
242
static void write_reference_infos(JfrCheckpointWriter& writer) {
243
if (ref_infos != NULL) {
244
ReferenceWriter rw(&writer);
245
ref_infos->iterate(rw);
246
}
247
}
248
249
int __write_array_info__(JfrCheckpointWriter* writer, const void* ai) {
250
assert(writer != NULL, "invariant");
251
assert(ai != NULL, "invariant");
252
const ObjectSampleArrayInfo* const osai = (const ObjectSampleArrayInfo*)ai;
253
writer->write(osai->_id);
254
writer->write(osai->_data._array_size);
255
writer->write(osai->_data._array_index);
256
return 1;
257
}
258
259
static traceid get_array_info_id(const Edge& edge, traceid id) {
260
if (edge.is_root() || !EdgeUtils::is_array_element(edge)) {
261
return 0;
262
}
263
if (array_infos == NULL) {
264
array_infos = new ArrayInfo();
265
}
266
assert(array_infos != NULL, "invariant");
267
268
ObjectSampleArrayInfo* const osai = new ObjectSampleArrayInfo();
269
assert(osai != NULL, "invariant");
270
osai->_id = id;
271
osai->_data._array_size = EdgeUtils::array_size(edge);
272
osai->_data._array_index = EdgeUtils::array_index(edge);
273
return array_infos->store(osai);
274
}
275
276
typedef JfrTypeWriterImplHost<const ObjectSampleArrayInfo*, __write_array_info__> ArrayWriterImpl;
277
typedef JfrTypeWriterHost<ArrayWriterImpl, TYPE_OLDOBJECTARRAY> ArrayWriter;
278
279
static void write_array_infos(JfrCheckpointWriter& writer) {
280
if (array_infos != NULL) {
281
ArrayWriter aw(&writer);
282
array_infos->iterate(aw);
283
}
284
}
285
286
int __write_field_info__(JfrCheckpointWriter* writer, const void* fi) {
287
assert(writer != NULL, "invariant");
288
assert(fi != NULL, "invariant");
289
const FieldTable::FieldInfoEntry* field_info_entry = (const FieldTable::FieldInfoEntry*)fi;
290
writer->write(field_info_entry->id());
291
const ObjectSampleFieldInfo* const osfi = field_info_entry->literal();
292
writer->write(osfi->_field_name_symbol->as_C_string());
293
writer->write(osfi->_field_modifiers);
294
return 1;
295
}
296
297
static traceid get_field_info_id(const Edge& edge) {
298
if (edge.is_root()) {
299
return 0;
300
}
301
assert(!EdgeUtils::is_array_element(edge), "invariant");
302
jshort field_modifiers;
303
const Symbol* const field_name_symbol = EdgeUtils::field_name(edge, &field_modifiers);
304
if (field_name_symbol == NULL) {
305
return 0;
306
}
307
if (field_infos == NULL) {
308
field_infos = new FieldTable();
309
}
310
assert(field_infos != NULL, "invariant");
311
ObjectSampleFieldInfo* const osfi = new ObjectSampleFieldInfo();
312
assert(osfi != NULL, "invariant");
313
osfi->_field_name_symbol = field_name_symbol;
314
osfi->_field_modifiers = field_modifiers;
315
return field_infos->store(osfi);
316
}
317
318
typedef JfrTypeWriterImplHost<const FieldTable::FieldInfoEntry*, __write_field_info__> FieldWriterImpl;
319
typedef JfrTypeWriterHost<FieldWriterImpl, TYPE_OLDOBJECTFIELD> FieldWriter;
320
321
static void write_field_infos(JfrCheckpointWriter& writer) {
322
if (field_infos != NULL) {
323
FieldWriter fw(&writer);
324
field_infos->iterate(fw);
325
}
326
}
327
328
static const char* description(const ObjectSampleRootDescriptionInfo* osdi) {
329
assert(osdi != NULL, "invariant");
330
331
if (osdi->_data._description == NULL) {
332
return NULL;
333
}
334
335
ObjectDescriptionBuilder description;
336
if (osdi->_data._system == OldObjectRoot::_threads) {
337
description.write_text("Thread Name: ");
338
}
339
description.write_text(osdi->_data._description);
340
return description.description();
341
}
342
343
int __write_root_description_info__(JfrCheckpointWriter* writer, const void* di) {
344
assert(writer != NULL, "invariant");
345
assert(di != NULL, "invariant");
346
const ObjectSampleRootDescriptionInfo* const osdi = (const ObjectSampleRootDescriptionInfo*)di;
347
writer->write(osdi->_id);
348
writer->write(description(osdi));
349
writer->write<u8>(osdi->_data._system);
350
writer->write<u8>(osdi->_data._type);
351
return 1;
352
}
353
354
static traceid get_gc_root_description_info_id(const Edge& edge, traceid id) {
355
assert(edge.is_root(), "invariant");
356
if (root_infos == NULL) {
357
root_infos = new RootDescriptionInfo();
358
}
359
assert(root_infos != NULL, "invariant");
360
ObjectSampleRootDescriptionInfo* const oodi = new ObjectSampleRootDescriptionInfo();
361
oodi->_id = id;
362
oodi->_data._root_edge = &edge;
363
return root_infos->store(oodi);
364
}
365
366
typedef JfrTypeWriterImplHost<const ObjectSampleRootDescriptionInfo*, __write_root_description_info__> RootDescriptionWriterImpl;
367
typedef JfrTypeWriterHost<RootDescriptionWriterImpl, TYPE_OLDOBJECTGCROOT> RootDescriptionWriter;
368
369
370
int _edge_reference_compare_(uintptr_t lhs, uintptr_t rhs) {
371
return lhs > rhs ? 1 : (lhs < rhs) ? -1 : 0;
372
}
373
374
int _root_desc_compare_(const ObjectSampleRootDescriptionInfo*const & lhs, const ObjectSampleRootDescriptionInfo* const& rhs) {
375
const uintptr_t lhs_ref = lhs->_data._root_edge->reference().addr<uintptr_t>();
376
const uintptr_t rhs_ref = rhs->_data._root_edge->reference().addr<uintptr_t>();
377
return _edge_reference_compare_(lhs_ref, rhs_ref);
378
}
379
380
static int find_sorted(const RootCallbackInfo& callback_info,
381
const GrowableArray<const ObjectSampleRootDescriptionInfo*>* arr,
382
int length,
383
bool& found) {
384
assert(arr != NULL, "invariant");
385
assert(length >= 0, "invariant");
386
assert(length <= arr->length(), "invariant");
387
388
found = false;
389
int min = 0;
390
int max = length;
391
while (max >= min) {
392
const int mid = (int)(((uint)max + min) / 2);
393
int diff = _edge_reference_compare_((uintptr_t)callback_info._high,
394
arr->at(mid)->_data._root_edge->reference().addr<uintptr_t>());
395
if (diff > 0) {
396
min = mid + 1;
397
} else if (diff < 0) {
398
max = mid - 1;
399
} else {
400
found = true;
401
return mid;
402
}
403
}
404
return min;
405
}
406
407
class RootResolutionSet : public ResourceObj, public RootCallback {
408
private:
409
GrowableArray<const ObjectSampleRootDescriptionInfo*>* _unresolved_roots;
410
411
const uintptr_t high() const {
412
return _unresolved_roots->last()->_data._root_edge->reference().addr<uintptr_t>();
413
}
414
415
const uintptr_t low() const {
416
return _unresolved_roots->first()->_data._root_edge->reference().addr<uintptr_t>();
417
}
418
419
bool in_set_address_range(const RootCallbackInfo& callback_info) const {
420
assert(callback_info._low == NULL, "invariant");
421
const uintptr_t addr = (uintptr_t)callback_info._high;
422
return low() <= addr && high() >= addr;
423
}
424
425
int compare_to_range(const RootCallbackInfo& callback_info) const {
426
assert(callback_info._high != NULL, "invariant");
427
assert(callback_info._low != NULL, "invariant");
428
429
for (int i = 0; i < _unresolved_roots->length(); ++i) {
430
const uintptr_t ref_addr = _unresolved_roots->at(i)->_data._root_edge->reference().addr<uintptr_t>();
431
if ((uintptr_t)callback_info._low <= ref_addr && (uintptr_t)callback_info._high >= ref_addr) {
432
return i;
433
}
434
}
435
return -1;
436
}
437
438
int exact(const RootCallbackInfo& callback_info) const {
439
assert(callback_info._high != NULL, "invariant");
440
assert(in_set_address_range(callback_info), "invariant");
441
442
bool found;
443
const int idx = find_sorted(callback_info, _unresolved_roots, _unresolved_roots->length(), found);
444
return found ? idx : -1;
445
}
446
447
bool resolve_root(const RootCallbackInfo& callback_info, int idx) const {
448
assert(idx >= 0, "invariant");
449
assert(idx < _unresolved_roots->length(), "invariant");
450
451
ObjectSampleRootDescriptionInfo* const desc =
452
const_cast<ObjectSampleRootDescriptionInfo*>(_unresolved_roots->at(idx));
453
assert(desc != NULL, "invariant");
454
assert((uintptr_t)callback_info._high == desc->_data._root_edge->reference().addr<uintptr_t>(), "invariant");
455
456
desc->_data._system = callback_info._system;
457
desc->_data._type = callback_info._type;
458
459
if (callback_info._system == OldObjectRoot::_threads) {
460
const JavaThread* jt = (const JavaThread*)callback_info._context;
461
assert(jt != NULL, "invariant");
462
desc->_data._description = jt->name();
463
}
464
465
_unresolved_roots->remove_at(idx);
466
return _unresolved_roots->is_empty();
467
}
468
469
public:
470
RootResolutionSet(RootDescriptionInfo* info) : _unresolved_roots(NULL) {
471
assert(info != NULL, "invariant");
472
// construct a sorted copy
473
const GrowableArray<const ObjectSampleRootDescriptionInfo*>& info_storage = info->storage();
474
const int length = info_storage.length();
475
_unresolved_roots = new GrowableArray<const ObjectSampleRootDescriptionInfo*>(length);
476
assert(_unresolved_roots != NULL, "invariant");
477
478
for (int i = 0; i < length; ++i) {
479
_unresolved_roots->insert_sorted<_root_desc_compare_>(info_storage.at(i));
480
}
481
}
482
483
bool process(const RootCallbackInfo& callback_info) {
484
if (NULL == callback_info._low) {
485
if (in_set_address_range(callback_info)) {
486
const int idx = exact(callback_info);
487
return idx == -1 ? false : resolve_root(callback_info, idx);
488
}
489
return false;
490
}
491
assert(callback_info._low != NULL, "invariant");
492
const int idx = compare_to_range(callback_info);
493
return idx == -1 ? false : resolve_root(callback_info, idx);
494
}
495
496
int entries() const {
497
return _unresolved_roots->length();
498
}
499
500
UnifiedOopRef at(int idx) const {
501
assert(idx >= 0, "invariant");
502
assert(idx < _unresolved_roots->length(), "invariant");
503
return _unresolved_roots->at(idx)->_data._root_edge->reference();
504
}
505
};
506
507
static void write_root_descriptors(JfrCheckpointWriter& writer) {
508
if (root_infos != NULL) {
509
// resolve roots
510
RootResolutionSet rrs(root_infos);
511
RootResolver::resolve(rrs);
512
// write roots
513
RootDescriptionWriter rw(&writer);
514
root_infos->iterate(rw);
515
}
516
}
517
518
static void add_old_object_sample_info(const StoredEdge* current, traceid id) {
519
assert(current != NULL, "invariant");
520
if (sample_infos == NULL) {
521
sample_infos = new SampleInfo();
522
}
523
assert(sample_infos != NULL, "invariant");
524
OldObjectSampleInfo* const oosi = new OldObjectSampleInfo();
525
assert(oosi != NULL, "invariant");
526
oosi->_id = id;
527
oosi->_data._object = current->pointee();
528
oosi->_data._reference_id = current->parent() == NULL ? 0 : id;
529
sample_infos->store(oosi);
530
}
531
532
static void add_reference_info(const StoredEdge* current, traceid id, traceid parent_id) {
533
assert(current != NULL, "invariant");
534
if (ref_infos == NULL) {
535
ref_infos = new RefInfo();
536
}
537
538
assert(ref_infos != NULL, "invariant");
539
ReferenceInfo* const ri = new ReferenceInfo();
540
assert(ri != NULL, "invariant");
541
542
ri->_id = id;
543
ri->_data._array_info_id = current->is_skip_edge() ? 0 : get_array_info_id(*current, id);
544
ri->_data._field_info_id = ri->_data._array_info_id != 0 || current->is_skip_edge() ? 0 : get_field_info_id(*current);
545
ri->_data._old_object_sample_id = parent_id;
546
ri->_data._skip = current->skip_length();
547
ref_infos->store(ri);
548
}
549
550
static bool is_gc_root(const StoredEdge* current) {
551
assert(current != NULL, "invariant");
552
return current->parent() == NULL && current->gc_root_id() != 0;
553
}
554
555
static traceid add_gc_root_info(const StoredEdge* root, traceid id) {
556
assert(root != NULL, "invariant");
557
assert(is_gc_root(root), "invariant");
558
return get_gc_root_description_info_id(*root, id);
559
}
560
561
void ObjectSampleWriter::write(const StoredEdge* edge) {
562
assert(edge != NULL, "invariant");
563
const traceid id = _store->get_id(edge);
564
add_old_object_sample_info(edge, id);
565
const StoredEdge* const parent = edge->parent();
566
if (parent != NULL) {
567
add_reference_info(edge, id, _store->get_id(parent));
568
return;
569
}
570
if (is_gc_root(edge)) {
571
assert(edge->gc_root_id() == id, "invariant");
572
add_gc_root_info(edge, id);
573
}
574
}
575
576
class RootSystemType : public JfrSerializer {
577
public:
578
void serialize(JfrCheckpointWriter& writer) {
579
const u4 nof_root_systems = OldObjectRoot::_number_of_systems;
580
writer.write_count(nof_root_systems);
581
for (u4 i = 0; i < nof_root_systems; ++i) {
582
writer.write_key(i);
583
writer.write(OldObjectRoot::system_description((OldObjectRoot::System)i));
584
}
585
}
586
};
587
588
class RootType : public JfrSerializer {
589
public:
590
void serialize(JfrCheckpointWriter& writer) {
591
const u4 nof_root_types = OldObjectRoot::_number_of_types;
592
writer.write_count(nof_root_types);
593
for (u4 i = 0; i < nof_root_types; ++i) {
594
writer.write_key(i);
595
writer.write(OldObjectRoot::type_description((OldObjectRoot::Type)i));
596
}
597
}
598
};
599
600
static void register_serializers() {
601
static bool is_registered = false;
602
if (!is_registered) {
603
JfrSerializer::register_serializer(TYPE_OLDOBJECTROOTSYSTEM, true, new RootSystemType());
604
JfrSerializer::register_serializer(TYPE_OLDOBJECTROOTTYPE, true, new RootType());
605
is_registered = true;
606
}
607
}
608
609
ObjectSampleWriter::ObjectSampleWriter(JfrCheckpointWriter& writer, EdgeStore* store) :
610
_writer(writer),
611
_store(store) {
612
assert(store != NULL, "invariant");
613
assert(!store->is_empty(), "invariant");
614
register_serializers();
615
sample_infos = NULL;
616
ref_infos = NULL;
617
array_infos = NULL;
618
field_infos = NULL;
619
root_infos = NULL;
620
}
621
622
ObjectSampleWriter::~ObjectSampleWriter() {
623
write_sample_infos(_writer);
624
write_reference_infos(_writer);
625
write_array_infos(_writer);
626
write_field_infos(_writer);
627
write_root_descriptors(_writer);
628
}
629
630
bool ObjectSampleWriter::operator()(StoredEdge& e) {
631
write(&e);
632
return true;
633
}
634
635