xo-gc stack: + gc-report-object-types() primitive
This commit is contained in:
parent
f7c269a505
commit
b6353ccc3d
3 changed files with 39 additions and 2 deletions
|
|
@ -23,6 +23,10 @@ namespace xo {
|
|||
static DPrimitive_gco_0 * make_report_gc_statistics_pm(obj<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
|
||||
/** create primitive: report gc object-type statistics **/
|
||||
static DPrimitive_gco_0 * make_report_gc_object_types_pm(obj<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
|
||||
/** create primitive: request collection **/
|
||||
static DPrimitive_gco_1_gco * make_request_gc_pm(obj<AAllocator> mm,
|
||||
StringTable * stbl);
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ namespace xo {
|
|||
xfer_report_gc_statistics(obj<ARuntimeContext> rcx)
|
||||
{
|
||||
if (rcx.collector()) {
|
||||
// status currently only implemented for X1 collector
|
||||
|
||||
obj<AGCObject> stats;
|
||||
bool ok = rcx.collector().report_statistics(rcx.allocator(),
|
||||
rcx.error_allocator(),
|
||||
|
|
@ -51,6 +49,36 @@ namespace xo {
|
|||
return DPrimitive_gco_0::_make(mm, "report-gc-statistics", pm_ty, &xfer_report_gc_statistics);
|
||||
}
|
||||
|
||||
// ----- report-gc-object-types -----
|
||||
|
||||
obj<AGCObject>
|
||||
xfer_report_gc_object_types(obj<ARuntimeContext> rcx)
|
||||
{
|
||||
if (rcx.collector()) {
|
||||
obj<AGCObject> stats;
|
||||
bool ok = rcx.collector().report_object_types(rcx.allocator(), rcx.error_allocator(), &stats);
|
||||
|
||||
|
||||
if (ok && stats)
|
||||
return stats;
|
||||
}
|
||||
|
||||
return DBoolean::box(rcx.allocator(), false);
|
||||
}
|
||||
|
||||
DPrimitive_gco_0 *
|
||||
GcPrimitives::make_report_gc_object_types_pm(obj<AAllocator> mm,
|
||||
StringTable * stbl)
|
||||
{
|
||||
(void)stbl;
|
||||
|
||||
auto any_ty = DAtomicType::make(mm, Metatype::t_any());
|
||||
auto pm_ty = obj<AType,DFunctionType>(DFunctionType::_make(mm, any_ty));
|
||||
|
||||
return DPrimitive_gco_0::_make(mm, "report-gc-object-types", pm_ty, &xfer_report_gc_object_types);
|
||||
|
||||
}
|
||||
|
||||
// ----- request-gc -----
|
||||
|
||||
obj<AGCObject>
|
||||
|
|
|
|||
|
|
@ -137,6 +137,11 @@ namespace xo {
|
|||
GcPrimitives::make_report_gc_statistics_pm(mm, stbl),
|
||||
flags & InstallFlags::f_generalpurpose));
|
||||
|
||||
ok = ok & (PrimitiveRegistry::install_aux
|
||||
(sink,
|
||||
GcPrimitives::make_report_gc_object_types_pm(mm, stbl),
|
||||
flags & InstallFlags::f_generalpurpose));
|
||||
|
||||
ok = ok & (PrimitiveRegistry::install_aux
|
||||
(sink,
|
||||
GcPrimitives::make_request_gc_pm(mm, stbl),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue