Ñò
ïžòKc           @   s  d  Z  d d k Z d d k Z d d k Z d d k l Z d d k l Z l Z l	 Z	 l
 Z
 d f  d „  ƒ  YZ d „  Z d f  d	 „  ƒ  YZ d
 Z d Z d Z d Z d e f d „  ƒ  YZ d „  Z d f  d „  ƒ  YZ d „  Z d „  Z d f  d „  ƒ  YZ d f  d „  ƒ  YZ e ƒ  i Z d S(   s/   A flow graph representation for Python bytecodeiÿÿÿÿN(   t   misc(   t   CO_OPTIMIZEDt   CO_NEWLOCALSt
   CO_VARARGSt   CO_VARKEYWORDSt	   FlowGraphc           B   s˜   e  Z d  „  Z d „  Z d d „ Z d „  Z d „  Z d Z d „  Z	 d „  Z
 d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s[   t  ƒ  |  _ |  _ t  d ƒ |  _ t i ƒ  |  _ |  i i |  i ƒ |  i i |  i ƒ d  S(   Nt   exit(   t   Blockt   currentt   entryR   R    t   Sett   blockst   add(   t   self(    (    s&   scripts/common/Lib/compiler/pyassem.pyt   __init__   s
    c         C   sg   |  i  oP |  i o7 d Gt |  i ƒ GHd G|  i i GHd G|  i i ƒ  GHn t | ƒ GHn | |  _ d  S(   Nt   ends       nexts      (   t   _debugR   t   reprt   nextt   get_children(   R   t   block(    (    s&   scripts/common/Lib/compiler/pyassem.pyt
   startBlock   s    

c         C   s>   | d  j o |  i ƒ  } n |  i i | ƒ |  i | ƒ d  S(   N(   t   Nonet   newBlockR   t   addNextR   (   R   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt	   nextBlock   s    	c         C   s   t  ƒ  } |  i i | ƒ | S(   N(   R   R   R   (   R   t   b(    (    s&   scripts/common/Lib/compiler/pyassem.pyR   5   s    	c         C   s   |  i  |  i ƒ d  S(   N(   R   R   (   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   startExitBlock:   s    i    c         C   s   d |  _  d  S(   Ni   (   R   (   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   _enable_debug?   s    c         C   s   d |  _  d  S(   Ni    (   R   (   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   _disable_debugB   s    c         G   s’   |  i  o d G| GHn | d d j o |  i i |  i ƒ n t | ƒ d j o, t | d t ƒ o |  i i | d ƒ n |  i i | ƒ d  S(   Ns   	i    t   RETURN_VALUEt   YIELD_VALUEi   i   (   R   R   (   R   R   t
   addOutEdgeR   t   lent
   isinstanceR   t   emit(   R   t   inst(    (    s&   scripts/common/Lib/compiler/pyassem.pyR#   E   s    
'c         C   s¦   xL |  i  i ƒ  D]; } | |  i j o q n | i p | i |  i ƒ q q Wt |  i h  ƒ } | i ƒ  |  i | |  i ƒ |  i | j o | i	 |  i ƒ n | S(   sl   Return the blocks in reverse postorder

        i.e. each node appears before all of its successors
        (
   R   t   elementsR   R   R   t   dfs_postorderR	   t   reverset
   fixupOrdert   append(   R   R   t   order(    (    s&   scripts/common/Lib/compiler/pyassem.pyt   getBlocksInOrderN   s     

c         C   s$   |  i  | | ƒ |  i | | ƒ d S(   s"   Fixup bad order introduced by DFS.N(   t   fixupOrderHonorNextt   fixupOrderForward(   R   R   t   default_next(    (    s&   scripts/common/Lib/compiler/pyassem.pyR(   c   s    c         C   sÃ  h  } x( t  t | ƒ ƒ D] } | | | | <q Wx‹t  d t | ƒ d ƒ D]p} | | } | | d } | i p( | i d | j p | i d | j o qK n | } g  } | }	 xD |	 i o9 |	 i d | j o% | i |	 i d ƒ |	 i d }	 q¸ Wg  }
 x= | D]5 } | | | j p t ‚ |
 i | | | f ƒ q	W|
 i ƒ  |
 i ƒ  x |
 D] \ } } | | | =q]W| g | | | | d +x( t  t | ƒ ƒ D] } | | | | <q£WqK Wd S(   s  Fix one problem with DFS.

        The DFS uses child block, but doesn't know about the special
        "next" block.  As a result, the DFS can order blocks so that a
        block isn't next to the right block for implicit control
        transfers.
        i    i   N(   t   rangeR!   R   R)   t   AssertionErrort   sortR'   (   R   R   R.   t   indext   iR   t   nt   curt   chaint   eltt   lt   j(    (    s&   scripts/common/Lib/compiler/pyassem.pyR,   l   s>      
3  

  c      
   C   sï  h  } g  } g  } x` | D]X } t  | ƒ | | <| i | ƒ | i o+ | i d | j o | i | ƒ g  } q q W| i | ƒ x3g  } xÐ t t  | ƒ ƒ D]¼ } | | }	 x© |	 D]¡ } x˜ | i ƒ  D]Š }
 | |
 | j  os d } xA | i D]6 } | d d j o | d |
 j o
 d } q%qï qï W| p qÈ n | i | |
 | f ƒ qÈ qÈ Wqµ Wqž W| p Pn | d \ } } | | j p t ‚ | | }
 | i |
 ƒ | i | |
 ƒ q… | 2x, | D]$ }
 x |
 D] } | i | ƒ qÐWqÃWd S(   s(   Make sure all JUMP_FORWARDs jump forwardi    t   JUMP_FORWARDi   N(	   R!   R)   R   R/   R   t   instsR0   t   removet   insert(   R   R   R.   R2   t   chainsR5   R   t   constraintsR3   R8   t   ct	   forward_pR$   t   goes_beforet   a_chain(    (    s&   scripts/common/Lib/compiler/pyassem.pyR-   •   sV      
  
 '
  c         C   s   |  i  i ƒ  S(   N(   R   R%   (   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt	   getBlocksÃ   s    c         C   s   |  i  S(   s/   Return nodes appropriate for use with dominator(   R	   (   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   getRootÆ   s    c         C   s4   g  } x' |  i  ƒ  D] } | i | i ƒ  ƒ q W| S(   N(   RD   t   extendt   getContainedGraphs(   R   R8   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyRG   Ê   s
     N(   t   __name__t
   __module__R   R   R   R   R   R   R   R   R   R#   R+   R(   R,   R-   RD   RE   RG   (    (    (    s&   scripts/common/Lib/compiler/pyassem.pyR      s    													)	.		c         C   s_   g  } |  | |  <x; |  i  ƒ  D]- } | | j o q n | t | | ƒ } q W| i |  ƒ | S(   s;   Depth-first search of tree rooted at b, return in postorder(   R   R&   R)   (   R   t   seenR*   R@   (    (    s&   scripts/common/Lib/compiler/pyassem.pyR&   Ð   s    
 R   c           B   sz   e  Z d  Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d	 „  Z
 d Z d „  Z d „  Z d „  Z RS(   i    t    c         C   sY   g  |  _  t i ƒ  |  _ t i ƒ  |  _ | |  _ t i |  _ g  |  _	 t i d t _ d  S(   Ni   (
   R;   R    R
   t   inEdgest   outEdgest   labelR   t   _countt   bidR   (   R   RN   (    (    s&   scripts/common/Lib/compiler/pyassem.pyR   Þ   s    			c         C   s.   |  i  o d |  i  |  i f Sd |  i Sd  S(   Ns   <block %s id=%d>s   <block id=%d>(   RN   RP   (   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   __repr__ç   s    
c         C   s2   t  t |  i ƒ } d |  i |  i d i | ƒ f S(   Ns   <block %s %d:
%s>s   
(   t   mapt   strR;   RN   RP   t   join(   R   R;   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   __str__í   s    c         C   sG   | d } | d  d j o |  i  i | d ƒ n |  i i | ƒ d  S(   Ni    i   t   JUMPi   (   RM   R   R;   R)   (   R   R$   t   op(    (    s&   scripts/common/Lib/compiler/pyassem.pyR#   ò   s    
c         C   s   |  i  S(   N(   R;   (   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   getInstructionsø   s    c         C   s   |  i  i | ƒ d  S(   N(   RL   R   (   R   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt	   addInEdgeû   s    c         C   s   |  i  i | ƒ d  S(   N(   RM   R   (   R   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyR    þ   s    c         C   s@   |  i  i | ƒ t |  i  ƒ d j p t t t |  i  ƒ ‚ d  S(   Ni   (   R   R)   R!   R0   RR   RS   (   R   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyR     s    R   t   RAISE_VARARGSR   t   JUMP_ABSOLUTER:   t   CONTINUE_LOOPc         C   sU   y |  i  d \ } } Wn t t f j
 o d SX| |  i j o g  |  _ n d S(   sL  Remove bogus edge for unconditional transfers

        Each block has a next edge that accounts for implicit control
        transfers, e.g. from a JUMP_IF_FALSE to the block that will be
        executed if the test is true.

        These edges must remain for the current assembler code to
        work. If they are removed, the dfs_postorder gets things in
        weird orders.  However, they shouldn't be there for other
        purposes, e.g. conversion to SSA form.  This method will
        remove the next edge when it follows an unconditional control
        transfer.
        iÿÿÿÿN(   R;   t
   IndexErrort
   ValueErrort   _uncond_transferR   (   R   RW   t   arg(    (    s&   scripts/common/Lib/compiler/pyassem.pyt	   pruneNext  s    c         C   sP   |  i  o2 |  i  d |  i j o |  i i |  i  d ƒ n |  i i ƒ  |  i  S(   Ni    (   R   RM   R<   R%   (   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyR     s    !c         C   sf   g  } xY |  i  D]N } t | ƒ d j o q n | d } t | d ƒ o | i | i ƒ q q W| S(   s¨   Return all graphs contained within this block.

        For example, a MAKE_FUNCTION block will contain a reference to
        the graph for the function body.
        i   t   graph(   R;   R!   t   hasattrR)   Rb   (   R   t	   containedR$   RW   (    (    s&   scripts/common/Lib/compiler/pyassem.pyRG   "  s    
 
(   s   RETURN_VALUERZ   s   YIELD_VALUER[   s   JUMP_FORWARDR\   (   RH   RI   RO   R   RQ   RU   R#   RX   RY   R    R   R_   Ra   R   RG   (    (    (    s&   scripts/common/Lib/compiler/pyassem.pyR   Û   s   								 		t   RAWt   FLATt   CONVt   DONEt   PyFlowGraphc           B   sI  e  Z e i Z d d  d d „ Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d d „ Z d	 „  Z d
 „  Z e i ƒ  Z x% e i D] Z e i e i e ƒ q‹ We i ƒ  Z x% e i D] Z e i e i e ƒ q¿ Wd „  Z d „  Z d „  Z h  Z d „  Z d „  Z e Z e Z d „  Z d „  Z  e  Z! e  Z" e  Z# e  Z$ e  Z% e  Z& e  Z' e  Z( e  Z) e  Z* d „  Z+ e+ Z, e+ Z- d „  Z. e/ e i0 ƒ Z1 d „  Z2 xF e3 ƒ  i4 ƒ  D]5 \ Z5 Z6 e5 d  d j o e5 d Z e6 e e <q°q°W[5 [6 [ d „  Z7 h  Z8 x. e9 e: e i ƒ ƒ D] Z; e; e8 e i e; <qW[; d „  Z< d „  Z= RS(   i    c         C   s  |  i  ƒ  | |  _ | |  _ d  |  _ | |  _ t | ƒ |  _ | |  _ | o t	 t
 B|  _ n
 d |  _ g  |  _ g  |  _ g  |  _ g  |  _ g  |  _ t | ƒ p g  |  _ xQ t t |  i ƒ ƒ D]: } |  i | } t | t ƒ o | i ƒ  |  i | <qÀ qÀ Wt |  _ d  S(   Ni    (   t
   super_initt   namet   filenameR   t	   docstringt   argst   getArgCountt   argcountt   klassR   R   t   flagst   constst   namest   freevarst   cellvarst   closuret   listt   varnamesR/   R!   R"   t   TupleArgt   getNameRe   t   stage(   R   Rk   Rl   Rn   t	   optimizedRq   R3   t   var(    (    s&   scripts/common/Lib/compiler/pyassem.pyR   <  s,    
											 c         C   s   | |  _  d  S(   N(   Rm   (   R   t   doc(    (    s&   scripts/common/Lib/compiler/pyassem.pyt   setDocstringZ  s    c         C   s5   |  i  | B|  _  | t j o |  i d |  _ n d  S(   Ni   (   Rr   R   Rp   (   R   t   flag(    (    s&   scripts/common/Lib/compiler/pyassem.pyt   setFlag]  s    c         C   s   |  i  | @o d Sd  S(   Ni   (   Rr   (   R   R�   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt	   checkFlagb  s    c         C   s   t  | ƒ |  _ d  S(   N(   Rx   Ru   (   R   Rt   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   setFreeVarsf  s    c         C   s   | |  _  d  S(   N(   Rv   (   R   Rt   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   setCellVarsi  s    c         C   sŽ   |  i  t j p t ‚ |  i ƒ  |  i ƒ  |  i  t j p t ‚ |  i ƒ  |  i  t j p t ‚ |  i ƒ  |  i  t	 j p t ‚ |  i
 ƒ  S(   s   Get a Python code object(   R|   Re   R0   t   computeStackDeptht   flattenGraphRf   t   convertArgsRg   t   makeByteCodeRh   t   newCodeObject(   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   getCodel  s    



c         C   sÀ   | o t  i } | t  _ n d } x‚ |  i D]w } | d } | d j o Hn t | ƒ d j o d Gd | G| GH| d } q- d Gd | G| G| d GH| d } q- W| o | t  _ n d  S(   Ni    t
   SET_LINENOi   s   	s   %3di   (   t   syst   stdoutR;   R!   (   R   t   iot   savet   pct   tt   opname(    (    s&   scripts/common/Lib/compiler/pyassem.pyt   dumpx  s     	
 
c            sp   h  ‰ d } x* ˆ  i ƒ  D] } t | i ƒ  ƒ ˆ | <q Wh  ‰ ‡  ‡ ‡ ‡ f d †  ‰ ˆ ˆ  i d ƒ ˆ  _ d S(   s¾   Compute the max stack depth.

        Approach is to compute the stack effect of each basic block.
        Then find the path through the code with the largest total
        effect.
        c            s•   |  ˆ j o | Sd ˆ |  <| ˆ |  } |  i  ƒ  } | o/ t g  } | D] } | ˆ | | ƒ qK ~ ƒ S|  i d j p ˆ ˆ  i | ƒ S| Sd  S(   Ni   R   (   R   t   maxRN   R   (   R   t   dt   childrent   _[1]R@   (   R   t	   max_deptht   depthRJ   (    s&   scripts/common/Lib/compiler/pyassem.pyR™   ˜  s    
/i    N(   R   RD   t	   findDepthRX   R	   t	   stacksize(   R   R   R   (    (   R   Rš   RJ   R™   s&   scripts/common/Lib/compiler/pyassem.pyR†   Š  s     c         C   s·  |  i  t j p t ‚ g  |  _ } d } h  } h  } xŒ |  i ƒ  D]~ } | | | <xa | i ƒ  D]S } | i | ƒ t | ƒ d j o | d } q` | d d j o | d } q` q` W| | | <qC Wd } xÜ t t | ƒ ƒ D]È } | | } t | ƒ d j o | d } n  | d d j o | d } n | d } |  i	 i
 | ƒ o, | d }	 | |	 | }
 | |
 f | | <qÞ |  i i
 | ƒ o | | | d f | | <qÞ qÞ Wt |  _  d S(   s-   Arrange the blocks in order and resolve jumpsi    i   RŒ   i   N(   R|   Re   R0   R;   R+   RX   R)   R!   R/   t   hasjrelt   has_eltt   hasjabsRf   (   R   R;   R‘   t   beginR   R   R$   R3   R“   t   opargt   offset(    (    s&   scripts/common/Lib/compiler/pyassem.pyR‡   ¨  s@     
  


 c         C   sÐ   |  i  t j p t ‚ |  i i d |  i ƒ |  i ƒ  x‰ t t |  i	 ƒ ƒ D]r } |  i	 | } t | ƒ d j oL | \ } } |  i
 i | d ƒ } | o  | | |  | ƒ f |  i	 | <q¿ qM qM Wt |  _  d S(   s0   Convert arguments from symbolic to concrete formi    i   N(   R|   Rf   R0   Rs   R=   Rm   t   sort_cellvarsR/   R!   R;   t   _converterst   getR   Rg   (   R   R3   R’   R“   R¡   t   conv(    (    s&   scripts/common/Lib/compiler/pyassem.pyRˆ   Ð  s    
 (c         C   s¤   h  } x |  i  D] } d | | <q Wg  } |  i D] } | | j o | | q2 q2 ~ |  _  x |  i  D] } | | =qf W|  i  | i ƒ  |  _  |  i  |  i |  _ d S(   sH   Sort cellvars in the order of varnames and prune from freevars.
        i   N(   Rv   Ry   t   keysRu   Rw   (   R   t   cellsRk   R˜   (    (    s&   scripts/common/Lib/compiler/pyassem.pyR£   Þ  s    
 $
 c         C   ss   t  | ƒ } xG t t | ƒ ƒ D]3 } | t  | | ƒ j o | | | j o | Sq Wt | ƒ } | i | ƒ | S(   sƒ  Return index of name in list, appending if necessary

        This routine uses a list instead of a dictionary, because a
        dictionary can't store two different keys if the keys have the
        same value but different types, e.g. 2 and 2L.  The compiler
        must treat these two separately, so it does an explicit type
        comparison before comparing the values.
        (   t   typeR/   R!   R)   (   R   Rk   Rx   R’   R3   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   _lookupNameë  s    	 (	c         C   s3   t  | d ƒ o | i ƒ  } n |  i | |  i ƒ S(   NR‹   (   Rc   R‹   Rª   Rs   (   R   R`   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   _convert_LOAD_CONSTý  s    c         C   s&   |  i  | |  i ƒ |  i  | |  i ƒ S(   N(   Rª   Rt   Ry   (   R   R`   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   _convert_LOAD_FAST  s    c         C   s:   |  i  d  j o |  i | |  i ƒ n |  i | |  i ƒ S(   N(   Rq   R   Rª   Ry   Rt   (   R   R`   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   _convert_LOAD_NAME  s    c         C   s:   |  i  d  j o |  i | |  i ƒ n |  i | |  i ƒ S(   N(   Rq   R   Rª   Ry   Rt   (   R   R`   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   _convert_NAME  s    c         C   s9   |  i  | |  i ƒ |  i  | |  i ƒ |  i  | |  i ƒ S(   N(   Rª   Rt   Ry   Rw   (   R   R`   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   _convert_DEREF  s    c         C   s&   |  i  | |  i ƒ |  i  | |  i ƒ S(   N(   Rª   Ry   Rw   (   R   R`   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   _convert_LOAD_CLOSURE#  s    c         C   s   |  i  i | ƒ S(   N(   t   _cmpR2   (   R   R`   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   _convert_COMPARE_OP(  s    i	   t	   _convert_c         C   s  |  i  t j p t ‚ t ƒ  |  _ } x× |  i D]Ì } | d } t | ƒ d j o | i |  i | ƒ q1 | d } | d j o | i	 | ƒ q1 n t
 | ƒ \ } } y | i |  i | | | ƒ Wq1 t j
 o' | G| GH|  i | G| G| GH‚  q1 Xq1 Wt |  _  d  S(   Ni    i   RŒ   (   R|   Rg   R0   t   LineAddrTablet   lnotabR;   R!   t   addCodet   opnumt   nextLinet   twobyteR^   Rh   (   R   Rµ   R’   R“   R¡   t   hit   lo(    (    s&   scripts/common/Lib/compiler/pyassem.pyR‰   3  s&    
 

	c         C   së   |  i  t j p t ‚ |  i t @d j o
 d } n t |  i ƒ } |  i } |  i t @o | d } n t	 i
 | | |  i |  i |  i i ƒ  |  i ƒ  t |  i ƒ t |  i ƒ |  i |  i |  i i |  i i ƒ  t |  i ƒ t |  i ƒ ƒ S(   Ni    i   (   R|   Rh   R0   Rr   R   R!   Ry   Rp   R   t   typest   CodeTypeRœ   Rµ   R‹   t	   getConstst   tupleRt   Rl   Rk   t	   firstlinet   getTableRu   Rv   (   R   t   nlocalsRp   (    (    s&   scripts/common/Lib/compiler/pyassem.pyRŠ   M  s    
	c         C   sQ   g  } x> |  i  D]3 } t | t ƒ o | i ƒ  } n | i | ƒ q Wt | ƒ S(   s›   Return a tuple for the const slot of the code object

        Must convert references to code (MAKE_FUNCTION) to code
        objects recursively.
        (   Rs   R"   Ri   R‹   R)   R¿   (   R   R8   R7   (    (    s&   scripts/common/Lib/compiler/pyassem.pyR¾   ]  s    
 (    N(>   RH   RI   R   R   Rj   R   R€   R‚   Rƒ   R„   R…   R‹   R”   R†   R‡   R    R
   R�   t   disR3   R   R“   RŸ   Rˆ   R£   Rª   R¤   R«   R¬   t   _convert_STORE_FASTt   _convert_DELETE_FASTR­   R®   t   _convert_STORE_NAMEt   _convert_DELETE_NAMEt   _convert_IMPORT_NAMEt   _convert_IMPORT_FROMt   _convert_STORE_ATTRt   _convert_LOAD_ATTRt   _convert_DELETE_ATTRt   _convert_LOAD_GLOBALt   _convert_STORE_GLOBALt   _convert_DELETE_GLOBALR¯   t   _convert_LOAD_DEREFt   _convert_STORE_DEREFR°   Rx   t   cmp_opR±   R²   t   localst   itemsRk   t   objR‰   R·   R/   R!   t   numRŠ   R¾   (    (    (    s&   scripts/common/Lib/compiler/pyassem.pyRi   9  sv   									!
 
 										 
		 	c         C   s   |  d  d j o d Sd  S(   Ni   RV   i   (    (   R“   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   isJumpj  s    Rz   c           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s:   Helper for marking func defs with nested tuples in arglistc         C   s   | |  _  | |  _ d  S(   N(   t   countRt   (   R   RØ   Rt   (    (    s&   scripts/common/Lib/compiler/pyassem.pyR   p  s    	c         C   s   d |  i  |  i f S(   Ns   TupleArg(%s, %s)(   RØ   Rt   (   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyRQ   s  s    c         C   s   d |  i  S(   Ns   .%d(   RØ   (   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyR{   u  s    (   RH   RI   t   __doc__R   RQ   R{   (    (    (    s&   scripts/common/Lib/compiler/pyassem.pyRz   n  s   		c         C   sb   t  |  ƒ } |  oK xH |  D]< } t | t ƒ o& t  t i | i ƒ ƒ } | | } q q Wn | S(   N(   R!   R"   Rz   R    t   flattenRt   (   Rn   Rp   R`   t   numNames(    (    s&   scripts/common/Lib/compiler/pyassem.pyRo   x  s     c         C   s$   t  |  t ƒ p t ‚ t |  d ƒ S(   s/   Convert an int argument into high and low bytesi   (   R"   t   intR0   t   divmod(   t   val(    (    s&   scripts/common/Lib/compiler/pyassem.pyR¹   �  s    R´   c           B   s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s(  lnotab

    This class builds the lnotab, which is documented in compile.c.
    Here's a brief recap:

    For each SET_LINENO instruction after the first one, two bytes are
    added to lnotab.  (In some cases, multiple two-byte entries are
    added.)  The first byte is the distance in bytes between the
    instruction for the last SET_LINENO and the current SET_LINENO.
    The second byte is offset in line numbers.  If either offset is
    greater than 255, multiple two-byte entries are added -- see
    compile.c for the delicate details.
    c         C   s:   g  |  _  d |  _ d |  _ d |  _ d |  _ g  |  _ d  S(   Ni    (   t   codet
   codeOffsetRÀ   t   lastlinet   lastoffRµ   (   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyR   •  s    					c         G   sA   x$ | D] } |  i  i t | ƒ ƒ q W|  i t | ƒ |  _ d  S(   N(   Rß   R)   t   chrRà   R!   (   R   Rn   R`   (    (    s&   scripts/common/Lib/compiler/pyassem.pyR¶   �  s     c         C   s  |  i  d j o | |  _  | |  _ nî |  i |  i } | |  i } | d j oÃ |  i i } x0 | d j o" | d ƒ | d ƒ | d 8} q_ Wx6 | d j o( | | ƒ | d ƒ | d 8} d } q’ W| d j p | d j o | | ƒ | | ƒ n | |  _ |  i |  _ n d  S(   Ni    iÿ   (   RÀ   Rá   Rà   Râ   Rµ   R)   (   R   t   linenot   addrt   linet   push(    (    s&   scripts/common/Lib/compiler/pyassem.pyR¸   ¢  s.    	 
 
 
 


 	c         C   s   d i  |  i ƒ S(   NRK   (   RT   Rß   (   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyR‹   Â  s    c         C   s   d i  t t |  i ƒ ƒ S(   NRK   (   RT   RR   Rã   Rµ   (   R   (    (    s&   scripts/common/Lib/compiler/pyassem.pyRÁ   Å  s    (   RH   RI   RÙ   R   R¶   R¸   R‹   RÁ   (    (    (    s&   scripts/common/Lib/compiler/pyassem.pyR´   †  s   			 	t   StackDepthTrackerc           B   s…  e  Z d  d „ Z h$ d d 6d d 6d d 6d d 6d d	 6d d
 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d  6d d! 6d d" 6d d# 6d d$ 6d  d% 6d& d' 6d& d( 6d d) 6d d* 6Z d8 d9 g Z d- „  Z d. „  Z d/ „  Z d0 „  Z d1 „  Z	 d2 „  Z
 d3 „  Z d4 „  Z d5 „  Z d6 „  Z d7 „  Z RS(:   i    c         C   s#  d } d } x| D]} | d } | o | Gn |  i  i | d  ƒ } | d  j	 o | | } n� xC |  i D]8 \ } }	 | t | ƒ  | j o |	 } | | } Pql ql W| d  j o; t |  | d  ƒ }
 |
 d  j	 o | |
 | d ƒ } qð n | | j o
 | } n | o | G| GHq q W| S(   Ni    i   (   t   effectR¥   R   t   patternsR!   t   getattr(   R   R;   t   debugRš   t   maxDepthR3   R“   t   deltat   patt	   pat_deltat   meth(    (    s&   scripts/common/Lib/compiler/pyassem.pyR›   Ì  s2     

 
	
iÿÿÿÿt   POP_TOPi   t   DUP_TOPiþÿÿÿt   LIST_APPENDs   SLICE+1s   SLICE+2s   SLICE+3s   STORE_SLICE+0s   STORE_SLICE+1s   STORE_SLICE+2iýÿÿÿs   STORE_SLICE+3s   DELETE_SLICE+0s   DELETE_SLICE+1s   DELETE_SLICE+2s   DELETE_SLICE+3t   STORE_SUBSCRt   DELETE_SUBSCRt
   PRINT_ITEMR   R   t	   EXEC_STMTt   BUILD_CLASSt
   STORE_NAMEt
   STORE_ATTRt   DELETE_ATTRt   STORE_GLOBALt	   BUILD_MAPt
   COMPARE_OPt
   STORE_FASTt   IMPORT_STARt   IMPORT_NAMEt   IMPORT_FROMt	   LOAD_ATTRi   t   SETUP_EXCEPTt   SETUP_FINALLYt   FOR_ITERt   WITH_CLEANUPt   BINARY_t   LOAD_c         C   s   | d S(   Ni   (    (   R   RØ   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   UNPACK_SEQUENCE  s    c         C   s	   | d S(   Ni   (    (   R   RØ   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   BUILD_TUPLE  s    c         C   s	   | d S(   Ni   (    (   R   RØ   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt
   BUILD_LIST  s    c         C   s"   t  | d ƒ \ } } | | d S(   Ni   i   (   RÝ   (   R   t   argcRº   R»   (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   CALL_FUNCTION  s    c         C   s   |  i  | ƒ d S(   Ni   (   R  (   R   R  (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   CALL_FUNCTION_VAR  s    c         C   s   |  i  | ƒ d S(   Ni   (   R  (   R   R  (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   CALL_FUNCTION_KW!  s    c         C   s   |  i  | ƒ d S(   Ni   (   R  (   R   R  (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   CALL_FUNCTION_VAR_KW#  s    c         C   s   | S(   N(    (   R   R  (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   MAKE_FUNCTION%  s    c         C   s   | S(   N(    (   R   R  (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   MAKE_CLOSURE'  s    c         C   s(   | d j o d S| d j o d Sd  S(   Ni   iÿÿÿÿi   iþÿÿÿ(    (   R   R  (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   BUILD_SLICE*  s    c         C   s   | S(   N(    (   R   R  (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   DUP_TOPX/  s    (   R	  iÿÿÿÿ(   R
  i   (   RH   RI   R›   Ré   Rê   R  R  R  R  R  R  R  R  R  R  R  (    (    (    s&   scripts/common/Lib/compiler/pyassem.pyRè   È  sf   
											(   RÙ   RÃ   R¼   R�   t   compilerR    t   compiler.constsR   R   R   R   R   R&   R   Re   Rf   Rg   Rh   Ri   R×   Rz   Ro   R¹   R´   Rè   R›   (    (    (    s&   scripts/common/Lib/compiler/pyassem.pyt   <module>   s*   "Å	Yÿ 2	
			Bj