Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/library/ir_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,9 +882,6 @@ class interpreter {
auto cached_entry = m_constant_cache.find(fn);
if (cached_entry != m_constant_cache.end()) {
auto cached = cached_entry->second;
if (!cached.m_is_scalar) {
inc(cached.m_val.m_obj);
}
return cached.m_val;
}
auto o_entry = g_init_globals->find(fn);
Expand Down Expand Up @@ -931,9 +928,6 @@ class interpreter {
lean_always_assert(fn_body_tag(decl_fun_body(e.m_decl)) != fn_body_kind::Unreachable);
value r = eval_body(decl_fun_body(e.m_decl));
pop_frame(r, decl_type(e.m_decl));
if (!type_is_scalar(t)) {
inc(r.m_obj);
}
m_constant_cache.insert({ fn, constant_cache_entry { type_is_scalar(t), r } });
return r;
}
Expand Down Expand Up @@ -1073,7 +1067,11 @@ class interpreter {
unsigned arity = decl_params(e.m_decl).size();
object * r;
if (arity == 0) {
r = box_t(load(fn, decl_type(e.m_decl)), decl_type(e.m_decl));
type t = decl_type(e.m_decl);
r = box_t(load(fn, t), t);
if (!type_is_scalar(t)) {
inc(r);
}
} else {
// First allocate a closure with zero fixed parameters. This is slightly wasteful in the under-application
// case, but simpler to handle.
Expand Down
Loading