Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

Commit 93cfb13

Browse files
committed
fix trace (gv dumped twice)
1 parent d7a4e1b commit 93cfb13

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/yomm2.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,7 @@ void runtime::augment_classes() {
200200
// unordered_set because, again, this situation is highly unlikely,
201201
// and, were it to occur, the number of distinct ti*s would
202202
// probably be small.
203-
if (std::find(
204-
rtc->ti_ptrs.begin(), rtc->ti_ptrs.end(), cr.ti) ==
203+
if (std::find(rtc->ti_ptrs.begin(), rtc->ti_ptrs.end(), cr.ti) ==
205204
rtc->ti_ptrs.end()) {
206205
rtc->ti_ptrs.push_back(cr.ti);
207206
}
@@ -214,8 +213,8 @@ void runtime::augment_classes() {
214213
for (auto& cr : cat.classes) {
215214
auto& rtc = class_map[std::type_index(*cr.ti)];
216215

217-
for (auto base_iter = cr.first_base;
218-
base_iter != cr.last_base; ++base_iter) {
216+
for (auto base_iter = cr.first_base; base_iter != cr.last_base;
217+
++base_iter) {
219218
auto rtb = class_map[std::type_index(**base_iter)];
220219

221220
if (!rtb) {
@@ -911,7 +910,9 @@ void runtime::install_gv() {
911910
ctx.gv.resize(ctx.gv.size() + metrics.hash_table_size);
912911

913912
if constexpr (bool(trace_enabled & TRACE_RUNTIME)) {
914-
++trace << std::setw(4) << ctx.gv.size() << " control table\n";
913+
if (pass) {
914+
++trace << std::setw(4) << ctx.gv.size() << " control table\n";
915+
}
915916
}
916917

917918
ctx.gv.resize(ctx.gv.size() + metrics.hash_table_size);
@@ -950,8 +951,10 @@ void runtime::install_gv() {
950951
}
951952

952953
if constexpr (bool(trace_enabled & TRACE_RUNTIME)) {
953-
++trace << std::setw(4) << ctx.gv.size() << ' ' << m.info->name
954-
<< " dispatch table\n";
954+
if (pass) {
955+
++trace << std::setw(4) << ctx.gv.size() << ' '
956+
<< m.info->name << " dispatch table\n";
957+
}
955958
}
956959

957960
m.gv_dispatch_table = ctx.gv.data() + ctx.gv.size();
@@ -968,8 +971,10 @@ void runtime::install_gv() {
968971
cls.mptr = ctx.gv.data() + ctx.gv.size() - cls.first_used_slot;
969972

970973
if constexpr (bool(trace_enabled & TRACE_RUNTIME)) {
971-
++trace << std::setw(4) << ctx.gv.size() << " mtbl for "
972-
<< cls.name() << ": " << cls.mptr << "\n";
974+
if (pass) {
975+
++trace << std::setw(4) << ctx.gv.size() << " mtbl for "
976+
<< cls.name() << ": " << cls.mptr << "\n";
977+
}
973978
}
974979

975980
if (cls.first_used_slot != -1) {
@@ -1002,8 +1007,8 @@ void runtime::optimize() {
10021007
for (auto cls : m.vp[0]->covariant_classes) {
10031008
auto pf = m.dispatch_table[cls->mptr[slot].i];
10041009
if constexpr (bool(trace_enabled & TRACE_RUNTIME)) {
1005-
++trace << cls->name() << " mtbl[" << slot
1006-
<< "] = " << pf << " (function)"
1010+
++trace << cls->name() << " mtbl[" << slot << "] = " << pf
1011+
<< " (function)"
10071012
<< "\n";
10081013
}
10091014
cls->mptr[slot].pf = pf;

0 commit comments

Comments
 (0)