
    sh/                     v   S SK r S SKJr  S SKJr  S SKJr  S SKJ	r	  S SK
Jr  S SKJrJrJrJrJrJrJrJrJr  S SKJrJr  S SKJr  S S	KJr  S SKrS S
KJrJ r J!r!  S SK"J#r#   " S S\RH                  5      r% " S S\RH                  5      r& " S S\5      r'\" SSSSSSSSSSSSSSS S!S"5      r( " S# S$\(\5      r)g)%    N)ir)_dynfunc)PyCallWrapper)BaseContext)	utilstypesconfigcgutilscallconvcodegen	externalsfastmathpass
intrinsics)TargetOptionsinclude_default_options)rtsys)global_compiler_lock)ParallelOptionsFastMathOptionsInlineOptions)ufunc_dbc                   2    \ rS rSrS\R
                  4/rSrg)ClosureBody   env N__name__
__module____qualname____firstlineno__r   pyobject_fields__static_attributes__r       b/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/numba/core/cpu.pyr   r      s    u~~&'Gr%   r   c                   L    \ rS rSrS\R
                  4S\R
                  4/rSrg)EnvBody   globalsconstsr   Nr   r   r%   r&   r(   r(      s!    	ENN#	5>>"Gr%   r(   c                      ^  \ rS rSrSrSrSU 4S jjrS r\S 5       r	S r
\S 5       rS	 rS
 r\S 5       rS rSS jrS rS rS rS rS r SS jrS rS rS rS rSrU =r$ )
CPUContext#   z(
Changes BaseContext calling convention
Tc                 $   > [         TU ]  X5        g N)super__init__)self	typingctxtarget	__class__s      r&   r2   CPUContext.__init__)   s    +r%   c                 8    U R                   R                  U5      $ r0   )_internal_codegen_create_empty_module)r3   names     r&   create_moduleCPUContext.create_module-   s    %%::4@@r%   c                    [         R                  S:H  U l        [        R                  " S5      U l        [        R                  " 5       S:X  a  [        R                  " S5        [        R                  R                  U 5        g )N    z
numba.execarmv7lzlibgcc_s.so.1)r   MACHINE_BITSis32bitr   JITCPUCodegenr9   platformmachinellload_library_permanentlyr   c_math_functionsinstallr3   s    r&   initCPUContext.init0   s^    **b0!(!6!6|!D )''8 	""**40r%   c                    [         R                  " U 5        SSKJnJnJnJnJnJnJ	nJ
nJn	Jn
JnJnJn  SSKJnJn  SSKJnJn  SSKJnJnJn  SSKJnJn  SSKJnJn  SSK J!nJ"n  SS	K J#nJ$n  SS
K%J&nJ'n  SSKJ(n  SSKJ)n   SSKJ*n!J+n"J,n#J-n$  SSKJ.n%  SSK/J0n&  U Rc                  U!Rd                  5        U Rc                  U%Rd                  5        U Rc                  U"Rd                  5        U Rc                  U Rd                  5        U Rc                  U#Rd                  5        U Rc                  U$Rd                  5        U Rc                  U&Rf                  5        [h        Rj                  Rl                  Ro                  5         SSK8J9n'  g )Nr   )builtinscharseqenumimplhashingheapq	iteratorslistobjnumbersrangeobjsetobjslicingtupleobjunicode)optionalinline_closurecall)gdb_hookliteral)linalg	arraymatharrayobj)generator_coregenerator_methods)polynomial_corepolynomial_functions)	typeddictdictimpl)	typedlist
listobject)jitclassfunction_type)
npdatetime)npyimpl)	cmathimplmathimpl	printimpl
randomimpl)cffiimpl)ClassBuilder)ndarray):r   
initializenumba.cpythonrN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   
numba.corer[   r\   
numba.miscr]   r^   numba.npr_   r`   ra   numba.np.randomrb   rc   numba.np.polynomialrd   re   numba.typedrf   rg   rh   ri   numba.experimentalrj   rk   rl   rm   rn   ro   rp   rq   rr    numba.experimental.jitclass.basers   install_registryregistryclass_impl_registrynumbacoreentrypointsinit_allnumba.np.unsafert   )(r3   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   jitclassimplrt   s(                                           r&   load_additional_registries%CPUContext.load_additional_registries<   s    		- 	- 	- 	-
 	<088EM35>' 	%LL'	i001h//0h//0g../i001j112l>>? 	

'') 	,r%   c                 .    U R                   R                  $ r0   )r9   target_datarJ   s    r&   r   CPUContext.target_datah   s    %%111r%   c                 P    [         R                  " U40 UD6nU R                  USS9$ )NT)r9   aot_mode)r   AOTCPUCodegen	subtarget)r3   r;   aot_optionsaot_codegens       r&   with_aot_codegenCPUContext.with_aot_codegenl   s2    ++D@K@~~'+  - 	-r%   c                     U R                   $ r0   )r9   rJ   s    r&   r   CPUContext.codegenq   s    %%%r%   c                 .    [         R                  " U 5      $ r0   )r   CPUCallConvrJ   s    r&   	call_convCPUContext.call_convt   s    ##D))r%   c                 h    [         R                  " X[        R                  S   5      n[	        XUSS9$ )z
From the given *envptr* (a pointer to a _dynfunc.Environment object),
get a EnvBody allowing structured access to environment fields.
offsetof_env_bodyT)refcast_ref)r
   pointer_addr   
_impl_infor(   )r3   builderenvptrbody_ptrs       r&   get_env_bodyCPUContext.get_env_bodyx   s5    
 &&X001DEGt(TBBr%   c                 T   U R                  UR                  U R                  U R                  5      5      nUR	                  U5      nU R                  U5      nUR                  UUU R                  R                  S9  U R                  X5      nUR                  U R                  Xd5      $ )N)return_pyobject	debug_msg)declare_env_globalmoduleget_env_namefndescloadget_python_apiemit_environment_sentryenv_namer   get_env_managerenvironment)r3   r   r   envgvenvargpyapienv_bodys          r&   r   CPUContext.get_env_manager   s    ''(,(9(9$++(FHe$##G,%%+kk** 	& 	

 $$W5$$T%5%5xHHr%   c                 P    [         R                  " X[        R                  S   US9$ )zf
From the given *genptr* (a pointer to a _dynfunc.Generator object),
get a pointer to its state area.
offsetof_generator_state)return_type)r
   r   r   r   )r3   r   genptrr   s       r&   get_generator_stateCPUContext.get_generator_state   s+    
 ""X001KL#% 	%r%   c                 2    SSK Jn  UR                  XX#5      $ )zB
Build a list from the Numba *list_type* and its initial *items*.
r   )rT   )rv   rT   
build_list)r3   r   	list_typeitemsrT   s        r&   r   CPUContext.build_list   s     	*!!$BBr%   c                 2    SSK Jn  UR                  XX#5      $ )z@
Build a set from the Numba *set_type* and its initial *items*.
r   )rW   )rv   rW   	build_set)r3   r   set_typer   rW   s        r&   r   CPUContext.build_set   s     	)x??r%   c                 4    SSK Jn  UR                  XX#U5      $ )Nr   )
dictobject)r|   r   	build_map)r3   r   	dict_type
item_typesr   r   s         r&   r   CPUContext.build_map   s    *##D9%PPr%   c                     U R                   (       a   [        R                  " XR                   5        U R                  (       a  [        R
                  " U5        UR                  [        R                  5        g r0   )	fastmathr   rewrite_modulerB   r   
fix_divmodadd_linking_libraryr   library)r3   modr   s      r&   post_loweringCPUContext.post_lowering   sD    =='']];<< !!#&##EMM2r%   c           
      $   U R                  S5      nU R                  R                  UR                  UR                  5      n[
        R                  " XgUR                  5      n[        XUX#UUS9n	U	R                  5         UR                  U5        g )Nwrapper)call_helperrelease_gil)r<   r   get_function_typerestypeargtypesr   Functionllvm_func_namer   buildadd_ir_module)
r3   r   r   r   r   r   wrapper_modulefntywrapper_calleer   s
             r&   create_cpython_wrapper!CPUContext.create_cpython_wrapper   sx    ++I6~~//P^%+%:%:<n &,79 	n-r%   c           	         U R                  S5      nU R                  R                  UR                  UR                  5      n[
        R                  " XVUR                  5      nUR                   Vs/ s H  oR                  U5      PM     n	nU R                  UR                  5      n
[
        R                  " X5      n[
        R                  " X[UR                  5      n[
        R                  " UR                  S5      5      nU R                  R                  XUR                  UR                  UR                  SS9u  pUR                  UR                   SS9   U R#                  U5      nUR%                  5       nU R                  R'                  UUU5        U R)                  UR*                  [-        U 5      5      nUR/                  U5      nUR1                  U5        UR3                  U5        UR5                  U5        S S S 5        UR7                  U5        UR9                  U5        g s  snf ! , (       d  f       N6= f)Ncfunc_wrapperentry)noinline)attrsF)likely)r<   r   r   r   r   r   r   r   get_value_typeFunctionTypellvm_cfunc_wrapper_name	IRBuilderappend_basic_blockcall_functionargsif_thenis_errorr   
gil_ensureraise_errorinsert_const_stringr   reprstring_from_stringerr_write_unraisabledecrefgil_releaseretr   )r3   r   r   r   r   r   r   r   tyll_argtypesll_return_typewraptywrapfnr   statusoutr   	gil_statecstrstrobjs                       r&   create_cfunc_wrapperCPUContext.create_cfunc_wrapper   s   ++O<~~//P^%+%:%:< :@I2**2.I,,V^^<=^#;;=,,v88ABnn22V^^V__KK} 3 . __V__U_; ''0E((*INN&&wv>++GNNDJGD--d3F&&v.LL i( < 	Cn-1 J <;s   1H.B(H33
Ic                 <   UR                  UR                  5      nSUR                  < 3n[        R                  " UR                  5       UR                  R                  S5      S   XTUU45      nUR                  R                  U R                  U5      U5        U$ )z
Returns
-------
(cfunc, fnptr)

- cfunc
    callable function (Can be None)
- fnptr
    callable function address
- env
    an execution environment (from _dynfunc)
zcompiled wrapper for .)
get_pointer_to_functionllvm_cpython_wrapper_namequalnamer   make_functionlookup_modulesplitr   set_envr   )r3   r   r   r   fnptrdoccfuncs          r&   get_executableCPUContext.get_executable   s     //,,.
 ,2??<&&v';';'='-'<'<S'A"'E'*3(/z	) 	 1 1& 93?r%   c                     [         R                  " [         R                  US5      nU R                  U R	                  U5      5      $ )z9
Calculate the size of an array struct on the CPU target
A)r   Arrayint32get_abi_sizeofr   )r3   ndimarytys      r&   calc_array_sizeofCPUContext.calc_array_sizeof   s6     EKKs3""4#6#6u#=>>r%   c                 .    [         R                  " U5      $ r0   )r   get_ufunc_info)r3   	ufunc_keys     r&   r#  CPUContext.get_ufunc_info  s    &&y11r%   )r9   rB   )cpu)F)r   r   r    r!   __doc__allow_dynamic_globalsr2   r<   r   rK   r   propertyr   r   r   r   r   r   r   r   r   r   r   r   r  r  r   r#  r$   __classcell__)r6   s   @r&   r-   r-   #   s     !,A 	1 	1*,X 2 2-
& * *CI%C@Q
	3 ,1
..@:?2 2r%   r-   nopythonforceobjlooplift_nrtdebugboundschecknogilno_rewritesno_cpython_wrapperno_cfunc_wrapperparallelr   error_modelinlineforceinline_dbg_extend_lifetimes_dbg_optnonec                       \ rS rSrS rSrg)CPUTargetOptionsi"  c                 h   UR                  S5      (       d  SUl        UR                  S5      (       d  SUl        UR                  SSS9  UR                  S5      (       d  [        R
                  Ul        UR                  S5      (       d.  UR                  (       a  SUl        O[        R                  Ul        UR                  S5      (       d  UR                  Ul	        SUl
        UR                  S	5        UR                  S
SS9  UR                  S5        UR                  (       a  SUl        g g )Nenable_pyobjectTenable_loopliftnrt)default	debuginfodbg_extend_lifetimesr0  r   r6  pythonr8  F)is_setr>  r?  inherit_if_not_setr	   DEBUGINFO_DEFAULTrB  rC  EXTEND_VARIABLE_LIFETIMESr0  enable_pyobject_loopliftr8  dbg_optnone)r3   flagsoptionss      r&   finalizeCPUTargetOptions.finalize#  s    ||-..$(E!||-..$(E!   5||K(($66EO||233 .2* .4-M-M*||M** %E)-&  ,   A  / %E r%   r   N)r   r   r    r!   rM  r$   r   r%   r&   r<  r<  "  s    "&r%   r<  )*rD   llvmlite.bindingbindingrF   llvmliter   r   r   numba.core.callwrapperr   numba.core.baser   rw   r   r   r	   r
   r   r   r   r   r   numba.core.optionsr   r   numba.core.runtimer   numba.core.compiler_lockr   numba.core.entrypointsnumba.core.cpu_optionsr   r   r   ry   r   	Structurer   r(   r-   _options_mixinr<  r   r%   r&   <module>r[     s        0 '= = = E $ 9 D D 
('## (g d2 d2T )
#*#&~} #&r%   