pombreda / unladen-swallow

Automatically exported from code.google.com/p/unladen-swallow
Other
0 stars 0 forks source link

Crash in bytecode->ir translation while accessing co_llvm #106

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The following snippet crashes while accessing co_llvm:

def y():
    raise Exception

for i in xrange(50001):
    try:
        y()
    except:
        pass
print "---"
print y.__code__.co_llvm

Original issue reported on code.google.com by e...@4geeks.de on 6 Jan 2010 at 11:39

GoogleCodeExporter commented 9 years ago

Original comment by collinw on 6 Jan 2010 at 11:40

GoogleCodeExporter commented 9 years ago
I think happens like this:
First y() becomes hot and is compiled.  The LOAD_GLOBAL_fast optimization is 
used for
the lookup of "Exception".  The next iteration of the loop modifies the global 
"i"
and invalidates the compiled code by setting co_assumed_globals to NULL.  It 
leaves
the CO_FDO_GLOBALS flag set so that no attempt will be made to execute the 
code.  All
the remaining calls go through the interpreter which is unfortunate but not 
this bug.

When the IR has to be regenerated it tries to use the LOAD_GLOBAL_fast path 
again but
now we don't have a co_assumed_globals anymore so trying to do a lookup crashes
inside PyDict_GetItem().

Original comment by abbeyj on 12 Jan 2010 at 1:37

GoogleCodeExporter commented 9 years ago

Original comment by collinw on 10 Mar 2010 at 2:38

GoogleCodeExporter commented 9 years ago
This was fixed as part of the watcher redesign in r1120. I added a regression 
test for 
this segfault in r1130.

Original comment by collinw on 10 Mar 2010 at 7:27