[PyPy-issue] [issue672] In gc/env.py: local variable 'cache' referenced before assignment

ys pypy-dev-issue at codespeak.net
Mon Mar 14 18:21:42 CET 2011


New submission from ys <ysbalt at live.com>:

While building pypy-c on OSX, I get an error in gc/env.py. The stack trace is
copied below the error.

[rtyper] -=- specialized 4 more blocks -=-
[translation:info] inserted 855 stack checks.
[translation:info] Creating database for generating c source...
......++++++
[rtyper] -=- specialized 25 more blocks -=-
......++++++++++++++++++++++++++++++****************%%%%%%%%%%%%%%###################################%%%%%#%%#%%#%%%%%%%%%%%%%%%%%%%%%###%%%%%%%%%%%********************
...++++++++++++++++++++++++++++%+*#%**************%%
[Timer] Timings:
[Timer] annotate                       ---  966.8 s
[Timer] rtype_lltype                   ---  594.3 s
[Timer] pyjitpl_lltype                 ---  584.7 s
[Timer] backendopt_lltype              ---  235.2 s
[Timer] stackcheckinsertion_lltype     ---   39.4 s
[Timer] database_c                     ---   13.2 s
[Timer] ===========================================
[Timer] Total:                         --- 2433.5 s
[translation:ERROR] Error:
[translation:ERROR]  Traceback (most recent call last):
[translation:ERROR]    File "translate.py", line 290, in main
[translation:ERROR]     drv.proceed(goals)
[translation:ERROR]    File "/Users/######/temp/pypy/pypy/translator/driver.py",
line 812, in proceed
[translation:ERROR]     return self._execute(goals, task_skip = self._maybe_skip())
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/translator/tool/taskengine.py", line 116, in _execute
[translation:ERROR]     res = self._do(goal, taskcallable, *args, **kwds)
[translation:ERROR]    File "/Users/######/temp/pypy/pypy/translator/driver.py",
line 288, in _do
[translation:ERROR]     res = func()
[translation:ERROR]    File "/Users/######/temp/pypy/pypy/translator/driver.py",
line 508, in task_database_c
[translation:ERROR]     database = cbuilder.build_database()
[translation:ERROR]    File "/Users/######/temp/pypy/pypy/translator/c/genc.py",
line 157, in build_database
[translation:ERROR]     sandbox=self.config.translation.sandbox)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/translator/c/database.py", line 65, in __init__
[translation:ERROR]     self.gctransformer =
self.gcpolicy.transformerclass(translator)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/rpython/memory/gctransform/framework.py", line
494, in __init__
[translation:ERROR]     annhelper.finish()   # at this point, annotate all
mix-level helpers
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/rpython/annlowlevel.py", line 240, in finish
[translation:ERROR]     self.finish_annotate()
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/rpython/annlowlevel.py", line 259, in finish_annotate
[translation:ERROR]     ann.complete_helpers(self.policy)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/annotation/annrpython.py", line 176, in
complete_helpers
[translation:ERROR]     self.complete()
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/annotation/annrpython.py", line 250, in complete
[translation:ERROR]     self.processblock(graph, block)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/annotation/annrpython.py", line 448, in processblock
[translation:ERROR]     self.flowin(graph, block)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/annotation/annrpython.py", line 508, in flowin
[translation:ERROR]     self.consider_op(block.operations[i])
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/annotation/annrpython.py", line 710, in consider_op
[translation:ERROR]     raise_nicer_exception(op, str(graph))
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/annotation/annrpython.py", line 707, in consider_op
[translation:ERROR]     resultcell = consider_meth(*argcells)
[translation:ERROR]    File "<4585-codegen
/Users/######/temp/pypy/pypy/annotation/annrpython.py:745>", line 3, in
consider_op_simple_call
[translation:ERROR]     return arg.simple_call(*args)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/annotation/unaryop.py", line 175, in simple_call
[translation:ERROR]     return
obj.call(getbookkeeper().build_args("simple_call", args_s))
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/annotation/unaryop.py", line 691, in call
[translation:ERROR]     return bookkeeper.pbc_call(pbc, args)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/annotation/bookkeeper.py", line 662, in pbc_call
[translation:ERROR]     results.append(desc.pycall(schedule, args,
s_previous_result))
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/annotation/description.py", line 276, in pycall
[translation:ERROR]     result = self.specialize(inputcells)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/annotation/description.py", line 272, in specialize
[translation:ERROR]     return self.specializer(self, inputcells)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/rpython/annlowlevel.py", line 124, in
default_specialize
[translation:ERROR]     return AnnotatorPolicy.default_specialize(funcdesc, args_s)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/annotation/specialize.py", line 80, in
default_specialize
[translation:ERROR]     graph = funcdesc.cachedgraph(key, builder=builder)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/annotation/description.py", line 237, in cachedgraph
[translation:ERROR]     graph = self.buildgraph(alt_name, builder)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/annotation/description.py", line 200, in buildgraph
[translation:ERROR]     graph = translator.buildflowgraph(self.pyobj)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/translator/translator.py", line 77, in buildflowgraph
[translation:ERROR]     graph = space.build_flow(func)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/objspace/flow/objspace.py", line 277, in build_flow
[translation:ERROR]     ec.build_flow()
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/objspace/flow/flowcontext.py", line 264, in build_flow
[translation:ERROR]     self)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/module/pypyjit/interp_jit.py", line 77, in dispatch
[translation:ERROR]     next_instr = self.handle_bytecode(co_code, next_instr, ec)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/interpreter/pyopcode.py", line 93, in handle_bytecode
[translation:ERROR]     next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/interpreter/pyopcode.py", line 271, in
dispatch_bytecode
[translation:ERROR]     res = meth(oparg, next_instr)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/interpreter/pyopcode.py", line 334, in LOAD_FAST
[translation:ERROR]     self._load_fast_failed(varindex)
[translation:ERROR]    File
"/Users/######/temp/pypy/pypy/interpreter/pyopcode.py", line 341, in
_load_fast_failed
[translation:ERROR]     raise operationerrfmt(self.space.w_UnboundLocalError,
message, varname)
[translation:ERROR]    File "/Users/######/temp/pypy/pypy/interpreter/error.py",
line 327, in operationerrfmt
[translation:ERROR]     return OpErrFmt(w_type, strings, *args)
[translation:ERROR]    File "/Users/######/temp/pypy/pypy/interpreter/error.py",
line 300, in __init__
[translation:ERROR]     raise FlowingError(self._compute_value())
[translation:ERROR]  FlowingError':
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
[translation:ERROR] local variable 'cache' referenced before assignment
[translation:ERROR] Happened at file
/Users/######/temp/pypy/pypy/rpython/memory/gc/env.py line 213
[translation:ERROR]
[translation:ERROR]                 return cache
[translation:ERROR]
[translation:ERROR]     .. v134 = simple_call((function get_darwin_cache_size),
('hw.l2cachesize'))
[translation:ERROR]     .. '(pypy.rpython.memory.gc.env:220)get_L2cache_darwin'
[translation:ERROR] Processing block:
[translation:ERROR]  block at 6 is a <class 'pypy.objspace.flow.flowcontext.SpamBlock'>
[translation:ERROR]  in (pypy.rpython.memory.gc.env:220)get_L2cache_darwin
[translation:ERROR]  containing the following operations:
[translation:ERROR]        v135 = simple_call((function debug_start),
('gc-hardware'))
[translation:ERROR]        v134 = simple_call((function get_darwin_cache_size),
('hw.l2cachesize'))
[translation:ERROR]        v136 = simple_call((function get_darwin_cache_size),
('hw.l3cachesize'))
[translation:ERROR]        v137 = simple_call((function debug_print), ('L2cache
='), v134)
[translation:ERROR]        v138 = simple_call((function debug_print), ('L3cache
='), v136)
[translation:ERROR]        v139 = simple_call((function debug_stop),
('gc-hardware'))
[translation:ERROR]        v140 = add(v134, v136)
[translation:ERROR]        v141 = gt(v140, (0))
[translation:ERROR]        v142 = is_true(v141)
[translation:ERROR]  --end--
[translation] start debugger...
> /Users/######/temp/pypy/pypy/interpreter/error.py(300)__init__()
-> raise FlowingError(self._compute_value())
(Pdb+)

Stack Trace:

(Pdb+) where
  /Users/######/temp/pypy/pypy/translator/goal/app_main.py(591)entry_point()
-> if not isinstance(importer, imp.NullImporter):
  /Users/######/temp/pypy/pypy/translator/goal/app_main.py(539)run_command_line()
-> # executing the interactive prompt, if we're running a script we
  /Users/######/temp/pypy/pypy/translator/goal/app_main.py(53)run_toplevel()
-> f(*fargs, **fkwds)
 
/Users/######/opt/local/var/macports/build/_Users_######_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_pypy/work/pypy-1.4.1-src/pypy/module/__builtin__/app_io.py(28)execfile()
  /Users/######/temp/pypy/pypy/translator/goal/translate.py(304)<module>()
-> main()
  /Users/######/temp/pypy/pypy/translator/goal/translate.py(296)main()
-> debug(True)
  /Users/######/temp/pypy/pypy/translator/driver.py(812)proceed()
-> return self._execute(goals, task_skip = self._maybe_skip())
  /Users/######/temp/pypy/pypy/translator/tool/taskengine.py(121)_execute()
-> raise
  /Users/######/temp/pypy/pypy/translator/driver.py(303)_do()
-> pass
  /Users/######/temp/pypy/pypy/translator/driver.py(508)task_database_c()
-> database = cbuilder.build_database()
  /Users/######/temp/pypy/pypy/translator/c/genc.py(157)build_database()
-> sandbox=self.config.translation.sandbox)
  /Users/######/temp/pypy/pypy/translator/c/database.py(65)__init__()
-> self.gctransformer = self.gcpolicy.transformerclass(translator)
 
/Users/######/temp/pypy/pypy/rpython/memory/gctransform/framework.py(494)__init__()
-> annhelper.finish()   # at this point, annotate all mix-level helpers
  /Users/######/temp/pypy/pypy/rpython/annlowlevel.py(240)finish()
-> self.finish_annotate()
  /Users/######/temp/pypy/pypy/rpython/annlowlevel.py(259)finish_annotate()
-> ann.complete_helpers(self.policy)
  /Users/######/temp/pypy/pypy/annotation/annrpython.py(180)complete_helpers()
-> self.policy, self.added_blocks = saved
  /Users/######/temp/pypy/pypy/annotation/annrpython.py(250)complete()
-> self.processblock(graph, block)
  /Users/######/temp/pypy/pypy/annotation/annrpython.py(456)processblock()
-> raise
  /Users/######/temp/pypy/pypy/annotation/annrpython.py(540)flowin()
-> return
  /Users/######/temp/pypy/pypy/annotation/annrpython.py(710)consider_op()
-> raise_nicer_exception(op, str(graph))
  <4585-codegen
/Users/######/temp/pypy/pypy/annotation/annrpython.py:745>(3)consider_op_simple_call()
-> return arg.simple_call(*args)
  /Users/######/temp/pypy/pypy/annotation/unaryop.py(175)simple_call()
-> return obj.call(getbookkeeper().build_args("simple_call", args_s))
  /Users/######/temp/pypy/pypy/annotation/unaryop.py(691)call()
-> return bookkeeper.pbc_call(pbc, args)
  /Users/######/temp/pypy/pypy/annotation/bookkeeper.py(662)pbc_call()
-> results.append(desc.pycall(schedule, args, s_previous_result))
  /Users/######/temp/pypy/pypy/annotation/description.py(276)pycall()
-> result = self.specialize(inputcells)
  /Users/######/temp/pypy/pypy/annotation/description.py(272)specialize()
-> return self.specializer(self, inputcells)
  /Users/######/temp/pypy/pypy/rpython/annlowlevel.py(124)default_specialize()
-> return AnnotatorPolicy.default_specialize(funcdesc, args_s)
  /Users/######/temp/pypy/pypy/annotation/specialize.py(80)default_specialize()
-> graph = funcdesc.cachedgraph(key, builder=builder)
  /Users/######/temp/pypy/pypy/annotation/description.py(237)cachedgraph()
-> graph = self.buildgraph(alt_name, builder)
  /Users/######/temp/pypy/pypy/annotation/description.py(200)buildgraph()
-> graph = translator.buildflowgraph(self.pyobj)
  /Users/######/temp/pypy/pypy/translator/translator.py(77)buildflowgraph()
-> graph = space.build_flow(func)
  /Users/######/temp/pypy/pypy/objspace/flow/objspace.py(284)build_flow()
-> raise error.FlowingError, e, tb
  /Users/######/temp/pypy/pypy/objspace/flow/flowcontext.py(300)build_flow()
-> self.mergeblock(e.block, e.currentstate)
  /Users/######/temp/pypy/pypy/module/pypyjit/interp_jit.py(79)dispatch()
-> return self.popvalue()
  /Users/######/temp/pypy/pypy/interpreter/pyopcode.py(114)handle_bytecode()
-> next_instr = self.handle_operation_error(ec, w_err)
  /Users/######/temp/pypy/pypy/interpreter/pyopcode.py(282)dispatch_bytecode()
-> raise
  /Users/######/temp/pypy/pypy/interpreter/pyopcode.py(334)LOAD_FAST()
-> self._load_fast_failed(varindex)
  /Users/######/temp/pypy/pypy/interpreter/pyopcode.py(341)_load_fast_failed()
-> raise operationerrfmt(self.space.w_UnboundLocalError, message, varname)
  /Users/######/temp/pypy/pypy/interpreter/error.py(327)operationerrfmt()
-> return OpErrFmt(w_type, strings, *args)
> /Users/######/temp/pypy/pypy/interpreter/error.py(300)__init__()
-> raise FlowingError(self._compute_value())
(Pdb+)

----------
effort: ???
messages: 2296
nosy: baltcode, pypy-issue
priority: critical
release: ???
status: unread
title: In gc/env.py:  local variable 'cache' referenced before assignment

_______________________________________________________
PyPy development tracker <pypy-dev-issue at codespeak.net>
<https://codespeak.net/issue/pypy-dev/issue672>
_______________________________________________________



More information about the Pypy-issue mailing list