Author: Ronan Lamy <ronan.l...@gmail.com> Branch: Opcode-class Changeset: r63826:84404950a8bf Date: 2013-04-28 16:02 +0100 http://bitbucket.org/pypy/pypy/changeset/84404950a8bf/
Log: Extract record_block() from FSFrame.build_flow() diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py --- a/rpython/flowspace/flowcontext.py +++ b/rpython/flowspace/flowcontext.py @@ -488,39 +488,42 @@ self.pendingblocks = collections.deque([graph.startblock]) while self.pendingblocks: block = self.pendingblocks.popleft() - try: - self.recorder = self.recording(block) - while True: - self.last_instr = self.handle_bytecode(self.last_instr) - self.recorder.final_state = self.getstate() + self.record_block(block) - except ImplicitOperationError, e: - if isinstance(e.w_type, Constant): - exc_cls = e.w_type.value - else: - exc_cls = Exception - msg = "implicit %s shouldn't occur" % exc_cls.__name__ - w_type = Constant(AssertionError) - w_value = Constant(AssertionError(msg)) - link = Link([w_type, w_value], graph.exceptblock) - self.recorder.crnt_block.closeblock(link) + def record_block(self, block): + try: + self.recorder = self.recording(block) + while True: + self.last_instr = self.handle_bytecode(self.last_instr) + self.recorder.final_state = self.getstate() - except FSException, e: - if e.w_type is self.space.w_ImportError: - msg = 'import statement always raises %s' % e - raise ImportError(msg) - link = Link([e.w_type, e.w_value], graph.exceptblock) - self.recorder.crnt_block.closeblock(link) + except ImplicitOperationError, e: + if isinstance(e.w_type, Constant): + exc_cls = e.w_type.value + else: + exc_cls = Exception + msg = "implicit %s shouldn't occur" % exc_cls.__name__ + w_type = Constant(AssertionError) + w_value = Constant(AssertionError(msg)) + link = Link([w_type, w_value], self.graph.exceptblock) + self.recorder.crnt_block.closeblock(link) - except StopFlowing: - pass + except FSException, e: + if e.w_type is self.space.w_ImportError: + msg = 'import statement always raises %s' % e + raise ImportError(msg) + link = Link([e.w_type, e.w_value], self.graph.exceptblock) + self.recorder.crnt_block.closeblock(link) - except Return as exc: - w_result = exc.value - link = Link([w_result], graph.returnblock) - self.recorder.crnt_block.closeblock(link) + except StopFlowing: + pass - del self.recorder + except Return as exc: + w_result = exc.value + link = Link([w_result], self.graph.returnblock) + self.recorder.crnt_block.closeblock(link) + + self.recorder = None def mergeblock(self, currentblock, currentstate): next_instr = currentstate.next_instr _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit