
    ;e                         d dl Z d dlmZ d dlZd dlZ ed          Zd dlmZ  G d dej                  Z G d dej                  Z	e
d	k    r ej                     dS dS )
    N)import_module_opcode)stack_effectc                       e Zd Zd Zd ZdS )OpcodeTestsc                    |                      t          t          j        d                   d           |                      t          t          j        d         d          d           |                      t          t          j        d         d          d           |                      t          t          j        d         d          d           |                     t
          t          d           |                     t
          t          t          j        d                    |                     t
          t          t          j        d         d           t          d	 t          j                                                  D ]\  }}|                     |
          5  |t          j	        k     r2t          |           |                     t
          t          |d           n1t          |d           |                     t
          t          |           d d d            n# 1 swxY w Y   t          t          d                    t          t          j                                                  z
  D ]s}|                     |          5  |                     t
          t          |           |                     t
          t          |d           d d d            n# 1 swxY w Y   td S )NPOP_TOPBUILD_SLICEr         i0u  c                 *    | d         t           j        vS Nr   disdeoptmapitems    (/usr/lib/python3.11/test/test__opcode.py<lambda>z/OpcodeTests.test_stack_effect.<locals>.<lambda>       d1gS\.I     opname   )opcode)assertEqualr   r   opmapassertRaises
ValueErrorfilteritemssubTestHAVE_ARGUMENTsetrangevalues)selfnamecodes      r   test_stack_effectzOpcodeTests.test_stack_effect   s   ci	&:;;R@@@ci&>BBBGGGci&>BBBGGGci&>BBBGGG*lE:::*lCIm4LMMM*lCIi4H!LLL !I!I39??K\K\]] 	F 	FJD$T** F F#+++ &&&%%j,aHHHH q)))%%j,EEEF F F F F F F F F F F F F F F c

OOc#)*:*:*<*<&=&== 	E 	EDT** E E!!*lDAAA!!*lD!DDDE E E E E E E E E E E E E E E	E 	Es&   A4HH 	#H 	AKK	K	c           	         t           j        d         }|                     t          |d          d           |                     t          |dd          d           |                     t          |dd          d           t           j        d         }|                     t          |d          d           |                     t          |dd          d           |                     t          |dd          d           t           j        d	         }|                     t          |d          d           |                     t          |dd          d           |                     t          |dd          d           t           j        t           j        z   }t          d
 t           j                                                  D ]\  }}|                     |          5  |t           j	        k     r2t          |          }t          |d          }t          |d          }	n4t          |d          }t          |dd          }t          |dd          }	||v r%|                     |t          ||	                     n,|                     ||           |                     |	|           d d d            n# 1 swxY w Y   d S )NJUMP_IF_TRUE_OR_POPr   T)jumpFr
   FOR_ITERr   JUMP_FORWARDc                 *    | d         t           j        vS r   r   r   s    r   r   z4OpcodeTests.test_stack_effect_jump.<locals>.<lambda>2   r   r   r   )r   r   r   r   hasjabshasjrelr"   r#   r$   r%   max)
r)   r.   r0   r1   has_jumpr*   r+   commonr/   nojumps
             r   test_stack_effect_jumpz"OpcodeTests.test_stack_effect_jump#   s   !i(=>&91==qAAA&914HHH!LLL&915III2NNN9Z(h22A666h===rBBBh>>>BBBy0lA66:::lADAAA1EEElAEBBBAFFF;, !I!I39??K\K\]] 	5 	5JD$T** 5 5#+++)$//F'4888D)$U;;;FF)$22F'ad;;;D)$>>>F8##$$VSv->->????$$T6222$$VV4445 5 5 5 5 5 5 5 5 5 5 5 5 5 5	5 	5s   (CK  K	K	N)__name__
__module____qualname__r,   r9    r   r   r   r   
   s5        E E E.5 5 5 5 5r   r   c                       e Zd Zd ZdS )SpecializationStatsTestsc                    t           j        }d t           j        D             }|                     d|           |                     d|           t                                          }||                     |t                     |                     |	                                |           |                     |d         	                                |dgz              |D ])}|                     |d         |         t                     *|                     |d         d         t                     |d         d         D ]}|                     |t                     d S d S )Nc                     g | ]A}|                     d           |dt          d                                                     BS )	_ADAPTIVEN)endswithlenlower).0ops     r   
<listcomp>zFSpecializationStatsTests.test_specialization_stats.<locals>.<listcomp>G   s\     ) ) ){{;'')![!!!!"((**) ) )r   	load_attrbinary_subscrfailure_kinds)r   _specialization_stats_specialized_instructionsassertInr   get_specialization_statsassertIsInstancedictassertCountEqualkeysinttuple)r)   
stat_namesspecialized_opcodesstatssnvs         r   test_specialization_statsz2SpecializationStatsTests.test_specialization_statsD   s   1
) )2) ) ) 	k#6777o':;;;0022!!%...!!%**,,0CDDD!!k"''))o..0 0 0 ! C C%%eK&8&<cBBBB!!k"?3   ;'8 . .%%a---- . .r   N)r:   r;   r<   r[   r=   r   r   r?   r?   C   s#        . . . . .r   r?   __main__)r   test.support.import_helperr   unittestr   r   r   TestCaser   r?   r:   mainr=   r   r   <module>ra      s    



 4 4 4 4 4 4  
-	
"
"            65 65 65 65 65(# 65 65 65r. . . . .x0 . . .6 zHMOOOOO r   