0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-03-13 21:10:32 +01:00

ircd:Ⓜ️:vm: Replace eval hook::site member with entered hook ptr; add id to console cmd.

This commit is contained in:
Jason Volk 2020-05-12 16:31:54 -07:00
parent adde714df4
commit 3bd3173db0
3 changed files with 9 additions and 5 deletions

View file

@ -89,7 +89,7 @@ struct ircd::m::vm::eval
event::id::buf event_id;
event::conforms report;
string_view room_version;
const hook::base::site *phase_hook {nullptr};
hook::base *hook {nullptr};
vm::phase phase {vm::phase(0)};
bool room_internal {false};

View file

@ -1044,13 +1044,15 @@ try
};
#endif
assert(!eval.phase_hook);
const scope_restore hook_phase
// Providing a pointer to the eval.hook pointer allows the hook site to
// provide updates for observers in other contexts for which hook is
// currently entered.
auto **const cur
{
eval.phase_hook, std::addressof(hook)
std::addressof(eval.hook)
};
hook(event, std::forward<T>(data));
hook(cur, event, std::forward<T>(data));
#if 0
log::debug

View file

@ -14916,6 +14916,7 @@ console_cmd__vm(opt &out, const string_view &line)
<< std::right << std::setw(5) << "DONE" << " "
<< std::right << std::setw(9) << "SEQUENCE" << " "
<< std::right << std::setw(9) << "SEQSHARE" << " "
<< std::left << std::setw(4) << "HOOK" << " "
<< std::left << std::setw(10) << "PHASE" << " "
<< std::right << std::setw(6) << "SIZE" << " "
<< std::right << std::setw(5) << "CELLS" << " "
@ -14953,6 +14954,7 @@ console_cmd__vm(opt &out, const string_view &line)
<< std::right << std::setw(5) << done << " "
<< std::right << std::setw(9) << eval->sequence << " "
<< std::right << std::setw(9) << std::max(eval->sequence_shared[0], eval->sequence_shared[1]) << " "
<< std::right << std::setw(4) << (eval->hook? eval->hook->id(): 0U) << " "
<< std::left << std::setw(10) << trunc(reflect(eval->phase), 10) << " "
<< std::right << std::setw(6) << (eval->txn? eval->txn->bytes() : 0UL) << " "
<< std::right << std::setw(5) << (eval->txn? eval->txn->size() : 0UL) << " "