
    `i
                     j    d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ed             Z
ed             ZdS )	z6
Helpers to see the refcount information of an object
    )ir)typescgutils)	intrinsic)_meminfo_struct_typec                 8    d }t          j        |          }||fS )zDump the refcount of an object to stdout.

    Returns True if and only if object is reference-counted and NRT is enabled.
    c                 l   |\  }|j         \  }g }| j        r1| j                            |||          }|                    |           |r_|                     |          }|                                }	|                    d                    |                     |D ]\  }}
|	                    |
t          j                              }t          j        ||dd          }|                    |          }|                    d                    |                     |                    |t!          j        d                    }t          j        |dd||          }|                    |           |                    d           |                    |	           t          j        S t          j        S )Nzdump refct of {}r   z | {} refct=       z%d [%p]z;
)args
enable_nrtnrtget_meminfosextendget_python_api
gil_ensureprint_stringformatbitcastr   
as_pointerr   gep_inboundsloadtruncr   IntTypesnprintf_stackbuffersys_write_stdoutgil_releasetrue_bit	false_bit)contextbuilder	signaturer   objtymeminfostmp_mispyapi	gil_statemimiptrrefctptrrefctrefct_32bitprinteds                   n/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/numba/core/unsafe/refcount.pycodegenzdump_refcount.<locals>.codegen   s   ~ 	%k..wC@@GOOG$$$ 	%**733E((**I188<<===" 0 0B,@,K,M,MNN"/1EEX.."">#8#8#<#<=== &mmE2:b>>BB!6RK  &&w////u%%%i(((##$$    )r   bool_	typingctxr#   r0   sigs       r/   dump_refcountr6      s-    % % %B +c

C<r1   c                 8    d }t          j        |          }||fS )zUGet the current refcount of an object.

    FIXME: only handles the first object
    c                    |\  }|j         \  }g }| j        r1| j                            |||          }|                    |           g }|r|D ]\  }}	|                    |	t          j                              }
t          j	        ||
dd          }|
                    |          }|                    |t          j        d                    }|                    |           |d         S )Nr   r
   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   append)r    r!   r"   r   r#   r$   r%   r&   	refcountsr)   r*   r+   r,   r-   s                 r/   r0   zget_refcount.<locals>.codegen=   s    ~ 	%k..wC@@GOOG$$$	 	." . .B,@,K,M,MNN"/1EEX..%mmE2:b>>BB  ----|r1   )r   int32r3   s       r/   get_refcountr<   7   s,      $ +c

C<r1   N)__doc__llvmliter   
numba.corer   r   numba.core.extendingr   numba.core.runtime.nrtdynmodr   r6   r<    r1   r/   <module>rC      s           % % % % % % % % * * * * * * = = = = = = ' ' 'T     r1   