Commit 44ccbe1b authored by Marius Wachtler's avatar Marius Wachtler Committed by GitHub

Merge pull request #1284 from kmod/telnetlib

Track down an elusive reference leak
parents 0ebe7b6d 7af29064
...@@ -75,8 +75,10 @@ void ICInvalidator::invalidateAll() { ...@@ -75,8 +75,10 @@ void ICInvalidator::invalidateAll() {
void ICSlotInfo::clear() { void ICSlotInfo::clear() {
ic->clear(this); ic->clear(this);
decref_infos.clear();
used = false; used = false;
if (num_inside == 0)
decref_infos.clear();
} }
std::unique_ptr<ICSlotRewrite> ICSlotRewrite::create(ICInfo* ic, const char* debug_name) { std::unique_ptr<ICSlotRewrite> ICSlotRewrite::create(ICInfo* ic, const char* debug_name) {
...@@ -133,6 +135,9 @@ void ICSlotRewrite::commit(CommitHook* hook, std::vector<void*> gc_references, ...@@ -133,6 +135,9 @@ void ICSlotRewrite::commit(CommitHook* hook, std::vector<void*> gc_references,
return; return;
} }
// I think this can happen if another thread enters the IC?
RELEASE_ASSERT(ic_entry->num_inside == 1, "picked IC slot is somehow used again");
auto ic = getICInfo(); auto ic = getICInfo();
uint8_t* slot_start = getSlotStart(); uint8_t* slot_start = getSlotStart();
uint8_t* continue_point = (uint8_t*)ic->continue_addr; uint8_t* continue_point = (uint8_t*)ic->continue_addr;
......
# Regression test:
# If we need to invalidate an IC, and there is a stack frame in that IC,
# we have to be careful to not clear the DecrefInfo of that IC in case
# an exception traverses that stack frame.
# In this example, g() has an IC to f() that will get invalidated when
# f() tiers up.
def h():
def f(n):
if n > 1000:
raise Exception()
def g(n):
f(n)
for i in xrange(10000):
try:
g(i)
except:
pass
h()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment