³ò
Ù‘RMc           @   s÷  d  d k  Z  d  d k Z d  d k l Z d „  Z d e f d „  ƒ  YZ e d „ Z e e _	 d e
 f d „  ƒ  YZ d Z d	 „  Z d e f d
 „  ƒ  YZ e  i i ƒ  o d Z d Z d Z n d Z d Z d Z d „  Z d „  Z d e f d „  ƒ  YZ d „  Z d e f d „  ƒ  YZ d „  Z d e f d „  ƒ  YZ d „  Z d e f d „  ƒ  YZ d „  Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d  „  Z d e f d! „  ƒ  YZ d" „  Z d e f d# „  ƒ  YZ d S($   iÿÿÿÿN(   t   ExtRegistryEntryc         C   s   |  p
 t  | ‚ d S(   s2   After translation to C, this becomes an RPyAssert.N(   t   AssertionError(   t   xt   msg(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyt	   ll_assert   s    t   Entryc           B   s    e  Z e Z d  „  Z d „  Z RS(   c         C   s   | i  ƒ  p
 t d ‚ d  S(   Ns+   ll_assert(x, msg): the msg must be constant(   t   is_constantR   t   None(   t   selft   s_xt   s_msg(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyt   compute_result_annotation   s    c         C   sF   d d k  l } | i | i | i ƒ } | i ƒ  | i d | ƒ d  S(   Niÿÿÿÿ(   t   lltypet   debug_assert(   t   pypy.rpython.lltypesystemR   t	   inputargst   Boolt   Voidt   exception_cannot_occurt   genop(   R   t   hopR   t   vlist(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyt   specialize_call   s    
(   t   __name__t
   __module__R   t   _about_R   R   (    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR      s   	c         C   sR   d d k  l } d d k l } | o | i | i ƒ n | i | i |  ƒ d  S(   Niÿÿÿÿ(   R   (   t   llop(   R   R   t%   pypy.rpython.lltypesystem.lloperationR   t   debug_print_tracebackR   t   debug_fatalerror(   R   t	   tracebackR   R   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyt
   fatalerror   s
    t   DebugLogc           B   s2   e  Z d  „  Z d d „ Z d d „ Z d „  Z RS(   c         G   s   |  i  d | ƒ d  S(   Nt   debug_print(   s   debug_print(   t   append(   R   t   args(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR!       s    c         C   s   |  i  d | | f ƒ d  S(   Nt   debug_start(   R"   (   R   t   categoryt   time(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR$   "   s    c         C   sù   xÚ t  t |  ƒ d d d ƒ D]¼ } |  | d d j o¡ |  | d | j p t d |  | d | f ‚ |  | d } | d  j	 p | d  j	 o% | | | |  | d f g |  | )n | |  | d f g |  | )d  Sq q Wt p t d | f ‚ d  S(   Ni   iÿÿÿÿi    R$   s/   nesting error: starts with %r but stops with %ri   s0   nesting error: no start corresponding to stop %r(   t   xranget   lenR   R   t   False(   R   R%   R&   t   it	   starttime(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyt
   debug_stop$   s     %c         C   s   d d  k  } | i t |  ƒ ƒ S(   Niÿÿÿÿ(   t   pprintt   pformatt   list(   R   R-   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyt   __repr__2   s    N(   R   R   R!   R   R$   R,   R0   (    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR       s   	c          G   sG   x |  D] } t  i | Iq Wt  i Jt d  j	 o t i |  Œ  n d  S(   N(   t   syst   stderrt   _logR   R!   (   R#   t   arg(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR!   9   s     c           B   s    e  Z e Z d  „  Z d „  Z RS(   c         G   s   d  S(   N(   R   (   R   t   args_s(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   C   s    c         C   sS   | i  | i Œ  } | i ƒ  | i i i } | i i i o | i	 d | ƒ n d  S(   NR!   (
   R   t   args_rR   t   rtypert	   annotatort
   translatort   configt   translationt   logR   (   R   R   R   t   t(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   F   s
    
(   R   R   R!   R   R   R   (    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   @   s   	s	   [1m[31ms   [31ms   [0mt    c         C   sU   t  t i ƒ  d ƒ } t i d t | |  t f IJt d  j	 o t i	 |  ƒ n d  S(   Nid   s   %s[%x] {%s%s(
   t   intR&   t   clockR1   R2   t   _start_colors_1t   _stop_colorsR3   R   R$   (   R%   t   c(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR$   W   s
    c         C   sU   t  t i ƒ  d ƒ } t i d t | |  t f IJt d  j	 o t i	 |  ƒ n d  S(   Nid   s   %s[%x] %s}%s(
   R?   R&   R@   R1   R2   t   _start_colors_2RB   R3   R   R,   (   R%   RC   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR,   ^   s
    c           B   s&   e  Z e e f Z d  „  Z d „  Z RS(   c         C   s   d  S(   N(   R   (   R   t
   s_category(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   h   s    c         C   sn   |  i  } | i i i i } | i | ƒ } | i ƒ  | i i i } | i	 i
 i o | i | i | ƒ n d  S(   N(   t   instanceR7   t   type_systemt   rstrt   string_reprR   R   R8   R9   R:   R;   R<   R   R   (   R   R   t   fnRI   R   R=   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   k   s    	
(   R   R   R$   R,   R   R   R   (    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   e   s   	c           C   s   t  S(   N(   t   True(    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyt   have_debug_printsu   s    c           B   s    e  Z e Z d  „  Z d „  Z RS(   c         C   sN   d d k  l } |  i i i } | i i i o | i Sn |  i i	 t
 ƒ Sd  S(   Niÿÿÿÿ(   t   model(   t   pypy.annotationRM   t
   bookkeeperR8   R9   R:   R;   R<   t   s_Boolt   immutablevalueR)   (   R   t   annmodelR=   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   }   s
    c         C   sm   d d k  l } | i i i } | i ƒ  | i i i o | i	 d g  d | i
 ƒSn | i | i
 t ƒ Sd  S(   Niÿÿÿÿ(   R   RL   t
   resulttype(   R   R   R7   R8   R9   R   R:   R;   R<   R   R   t
   inputconstR)   (   R   R   R   R=   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   …   s    
(   R   R   RL   R   R   R   (    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   z   s   	c         G   s
   t  ‚ d S(   sA  When running on the llinterp, this causes the llinterp to call to
    the provided Python function with the run-time value of the given args.
    The Python function should return a low-level object of type RESTYPE.
    This should never be called after translation: use this only if
    running_on_llinterp is true.
    N(   t   NotImplementedError(   t   RESTYPEt   pythonfunctionR#   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyt   llinterpcall   s    c           B   s    e  Z e Z d  „  Z d „  Z RS(   c         G   s•   d d k  l } d d k l } | i ƒ  p t ‚ | i ƒ  p t ‚ | i } t | | i ƒ o | i	 | ƒ } n t | | i
 ƒ p t ‚ | S(   Niÿÿÿÿ(   RM   (   R   (   RN   RM   R   R   R   R   t   constt
   isinstancet   LowLevelTypet   lltype_to_annotationt
   SomeObject(   R   t	   s_RESTYPEt   s_pythonfunctionR5   RR   R   t   s_result(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   ›   s    	c      	   C   s  d d k  l } d d k l } | i d i } t | | i ƒ p9 t | | i ƒ p t	 ‚ | i
 i | ƒ } | i } n | i d i } | i | i | ƒ } g  } t d | i ƒ D]# }	 | | i | i |	 d |	 ƒq¸ ~ }
 | i d | g |
 d	 | ƒS(
   Niÿÿÿÿ(   RM   (   R   i    i   i   R4   t   debug_llinterpcallRS   (   RN   RM   R   R   R5   RY   RZ   R[   R]   R   R7   t   getreprt   lowleveltypeRT   R   t   ranget   nb_argst   inputargR6   R   (   R   R   RR   R   RV   t   r_resultRW   t   c_pythonfunctiont   _[1]R*   t   args_v(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   ¦   s    <(   R   R   RX   R   R   R   (    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   ˜   s   	c         C   s   |  S(   sý    Function checking if annotation is as expected when translating,
    does nothing when just run. Checker is supposed to be a constant
    callable which checks if annotation is as expected,
    arguments passed are (current annotation, bookkeeper)
    (    (   R4   t   checker(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyt   check_annotation¶   s    c           B   s    e  Z e Z d  „  Z d „  Z RS(   c         C   s:   | i  ƒ  p t d ƒ ‚ n | i } | | |  i ƒ | S(   Ns4   Second argument of check_annotation must be constant(   R   t
   ValueErrorRY   RO   (   R   t   s_argt	   s_checkerRk   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   Á   s
    	c         C   s$   | i  ƒ  | i | i d d d ƒS(   Ni    R4   (   R   Rf   R6   (   R   R   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   È   s    
(   R   R   Rl   R   R   R   (    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   ¾   s   	c         C   s   |  S(   s    Function checking whether annotation of SomeList is never resized,
    useful for debugging. Does nothing when run directly
    (    (   R4   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyt   make_sure_not_resizedÌ   s    c           B   s    e  Z e Z d  „  Z d „  Z RS(   c         C   sr   d d k  l } t | | ƒ p t ‚ |  i i i i i i	 o | i
 i ƒ  n d d k l } | i d ƒ | S(   Niÿÿÿÿ(   t   SomeList(   R<   sO   make_sure_not_resized called, but has no effect since list_comprehension is off(   t   pypy.annotation.modelRq   RZ   R   RO   R8   R9   R:   R;   t   list_comprehension_operationst   listdeft   never_resizet   pypy.annotation.annrpythonR<   t   WARNING(   R   Rn   Rq   R<   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   Õ   s    c         C   s$   | i  ƒ  | i | i d d d ƒS(   Ni    R4   (   R   Rf   R6   (   R   R   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   á   s    
(   R   R   Rp   R   R   R   (    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   Ò   s   	t   IntegerCanBeNegativec           B   s   e  Z RS(    (   R   R   (    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyRx   æ   s   t   UnexpectedRUIntc           B   s   e  Z RS(    (   R   R   (    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyRy   é   s   t   ExpectedRegularIntc           B   s   e  Z RS(    (   R   R   (    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyRz   ì   s   c         C   s8   t  |  ƒ d ƒ d j  p t ‚ |  d j p t ‚ |  S(   s  Give a translation-time error if 'x' is not known to be non-negative.
    To help debugging, this also gives a translation-time error if 'x' is
    actually typed as an r_uint (in which case the call to check_nonneg()
    is a bit strange and probably unexpected).
    iÿÿÿÿi    (   t   typeR   (   R   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyt   check_nonnegï   s     c           B   s    e  Z e Z d  „  Z d „  Z RS(   c         C   sq   d d k  l } t | | ƒ o$ | i o t d | i f ƒ ‚ n | d t ƒ } | i | ƒ p
 t ‚ n | S(   Niÿÿÿÿ(   t   SomeIntegers   check_nonneg() arg is a %st   nonneg(	   Rr   R}   RZ   t   unsignedRy   t	   knowntypeRK   t   containsRx   (   R   Rn   R}   t   s_nonneg(    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   ü   s    
c         C   s$   | i  ƒ  | i | i d d d ƒS(   Ni    R4   (   R   Rf   R6   (   R   R   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR     s    
(   R   R   R|   R   R   R   (    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR   ù   s   	
c         C   s   t  |  ƒ t j p t ‚ |  S(   sj   Give a translation-time error if 'x' is not a plain int
    (e.g. if it's a r_longlong or an r_uint).
    (   R{   R?   R   (   R   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyt   check_regular_int
  s    c           B   s    e  Z e Z d  „  Z d „  Z RS(   c         C   s7   d d k  l } | ƒ  i | ƒ p t | ƒ ‚ n | S(   Niÿÿÿÿ(   R}   (   Rr   R}   R   Rz   (   R   Rn   R}   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR     s    c         C   s$   | i  ƒ  | i | i d d d ƒS(   Ni    R4   (   R   Rf   R6   (   R   R   (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR     s    
(   R   R   Rƒ   R   R   R   (    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pyR     s   	(    R1   R&   t   pypy.rpython.extregistryR    R   R   R)   R   RK   t   _dont_inline_R/   R    R   R3   R!   R2   t   isattyRA   RD   RB   R$   R,   RL   RX   Rl   Rp   t	   ExceptionRx   Ry   Rz   R|   Rƒ   (    (    (    s#   /64/home/arigo/u/pypy/rlib/debug.pys   <module>   sD   			
								
	
