From 94e6fbcbbf90b1f2de6c47d048e70f9a3322308a Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Thu, 22 Dec 2016 18:46:51 -0800 Subject: [PATCH] perf(library/vm/vm): make sure builtin cases_on recursors are assigned ids first This will minimize the size of the m_builtin_cases_vector. It also indirectly prevents the crash decribed at 144d9096e28745. However, the fix used there is more robust. --- src/library/vm/vm.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/library/vm/vm.cpp b/src/library/vm/vm.cpp index e12db1f2dc..63c09bd81d 100644 --- a/src/library/vm/vm.cpp +++ b/src/library/vm/vm.cpp @@ -900,16 +900,16 @@ struct vm_decls : public environment_extension { name m_monitor; vm_decls() { + g_vm_cases_builtins->for_each([&](name const & n, std::tuple const & p) { + unsigned idx = get_vm_index(n); + m_cases.insert(idx, std::get<1>(p)); + }); g_vm_builtins->for_each([&](name const & n, std::tuple const & p) { add_core(vm_decl(n, get_vm_index(n), std::get<0>(p), std::get<2>(p))); }); g_vm_cbuiltins->for_each([&](name const & n, std::tuple const & p) { add_core(vm_decl(n, get_vm_index(n), std::get<0>(p), std::get<2>(p))); }); - g_vm_cases_builtins->for_each([&](name const & n, std::tuple const & p) { - unsigned idx = get_vm_index(n); - m_cases.insert(idx, std::get<1>(p)); - }); } void add_core(vm_decl const & d) {