
    sh+                     
   S SK r S SKJrJrJr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Jr  \R$                  R&                    SS jrS r " S S\R,                  5      r " S S	\R,                  5      r\R2                  \R4                  \\" \5      /\R$                  R6                  l        \R:                  \R$                  R6                  l        \R:                  \R2                  \" \5      /\R$                  R>                  l        \\R$                  R>                  l        \R:                  \R2                  /\R$                  R@                  l        \R:                  \RB                  \/\R$                  RD                  l        \R:                  /\R$                  RF                  l        \R:                  /\R$                  RH                  l        \RJ                  \R$                  RH                  l        / \R$                  RL                  l        \\R$                  RL                  l        \R:                  \/\R$                  RN                  l        \\R$                  RN                  l        \R:                  \/\R$                  RP                  l        \\R$                  RP                  l        \R:                  \RR                  /\R$                  RT                  l         " S
 S\5      r+\	" S\\" \+5      5      r,\	" S\\" \+5      5      r-\," \R\                  5      r/\-" \R`                  5      r1\,\-\/\R$                  Rd                  l        \Rf                  \R$                  Rd                  l        \Rf                  /\R$                  Rh                  l        \R:                  \Rf                  /\R$                  Rj                  l        \\R$                  Rl                  l        \\/\R$                  Rl                  l        g)    N)POINTERc_char_pc_boolc_void_pc_intc_uint64c_size_t	CFUNCTYPE	string_atcast	py_object	Structure)ffitargetsobject_filec                 0   Uc  [         R                  " 5       S;   n[        R                  " 5        n[        R                  R                  XX#5      nU(       d  [        [        U5      5      e SSS5        SUl        [        WU S9$ ! , (       d  f       N= f)a  
Create a MCJIT ExecutionEngine from the given *module* and
*target_machine*.

*lmm* controls whether the llvmlite memory manager is used. If not supplied,
the default choice for the platform will be used (``True`` on 64-bit ARM
systems, ``False`` otherwise).
N)arm64aarch64T)module)
platformmachiner   OutputStringlibLLVMPY_CreateMCJITCompilerRuntimeErrorstr_ownedExecutionEngine)r   target_machineuse_lmmouterrengines        t/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/llvmlite/binding/executionengine.pycreate_mcjit_compilerr$      s     ""$(<<				v33G5s6{++  
 !N6&11 
	s   <B
Bc                  d    [         R                  R                  5       n U S:w  a  [        U S5      eg)zd
Check the system allows execution of in-memory JITted functions.
An exception is raised otherwise.
r   zcannot allocate executable memory. This may be due to security restrictions on your system, such as SELinux or similar mechanisms.N)r   r   "LLVMPY_TryAllocateExecutableMemoryOSError)errnos    r#   check_jit_executionr)   #   s7    
 GG668EzeG 	     c                       \ rS rSrSrSrS rS rS rS r	S r
S	 rS
 rS rS r\S 5       rS rS rS rSS jrS rS rS rSrg)r   1   zAn ExecutionEngine owns all Modules associated with it.
Deleting the engine will remove all associated modules.
It is an error to delete the associated modules.
Nc                     [        U/5      U l        SU l        SUl        [        R
                  R                  X5        g)z+
Module ownership is transferred to the EE
NT)set_modules_tdr   r   	ObjectRef__init__)selfptrr   s      r#   r2   ExecutionEngine.__init__8   s1     VHt)r*   c                 ^    [         R                  R                  XR                  S5      5      $ )z
Return the address of the function named *name* as an integer.

It's a fatal error in LLVM if the symbol of *name* doesn't exist.
ascii)r   r   LLVMPY_GetFunctionAddressencoder3   names     r#   get_function_address$ExecutionEngine.get_function_addressA   s"     ww00{{77KLLr*   c                 ^    [         R                  R                  XR                  S5      5      $ )z
Return the address of the global value named *name* as an integer.

It's a fatal error in LLVM if the symbol of *name* doesn't exist.
r7   )r   r   LLVMPY_GetGlobalValueAddressr9   r:   s     r#   get_global_value_address(ExecutionEngine.get_global_value_addressI   s"     ww33D++g:NOOr*   c                 D    [         R                  R                  XU5        g N)r   r   LLVMPY_AddGlobalMapping)r3   gvaddrs      r#   add_global_mapping"ExecutionEngine.add_global_mappingQ   s    ''$7r*   c                     XR                   ;   a  [        S5      e[        R                  R	                  X5        SUl        U R                   R                  U5        g)z<
Ownership of module is transferred to the execution engine
z#module already added to this engineTN)r/   KeyErrorr   r   LLVMPY_AddModuler   add)r3   r   s     r#   
add_moduleExecutionEngine.add_moduleT   sE     ]]"@AA  .&!r*   c                 B    [         R                  R                  U 5        g)ze
Make sure all modules owned by the execution engine are fully processed
and "usable" for execution.
N)r   r   LLVMPY_FinalizeObjectr3   s    r#   finalize_objectExecutionEngine.finalize_object^   s    
 	%%d+r*   c                 B    [         R                  R                  U 5        g)zG
Run static constructors which initialize module-level static objects.
N)r   r   LLVMPY_RunStaticConstructorsrQ   s    r#   run_static_constructors'ExecutionEngine.run_static_constructorse   s     	,,T2r*   c                 B    [         R                  R                  U 5        g)zP
Run static destructors which perform module-level cleanup of static
resources.
N)r   r   LLVMPY_RunStaticDestructorsrQ   s    r#   run_static_destructors&ExecutionEngine.run_static_destructorsk   s    
 	++D1r*   c                    [         R                  " 5        n[         R                  R                  XU5      (       a  [	        [        U5      5      e SSS5        U R                  R                  U5        SUl        g! , (       d  f       N1= f)z!
Ownership of module is returned
NF)	r   r   r   LLVMPY_RemoveModuler   r   r/   remover   )r3   r   r!   s      r#   remove_moduleExecutionEngine.remove_moduler   sg     6ww**4@@"3v;// A   	V$	  s   :A<<
B
c                     U R                   b  U R                   $ [        R                  R                  U 5      n[        R
                  " U5      U l         SU R                   l        U R                   $ )z+
The TargetData for this execution engine.
T)r0   r   r   #LLVMPY_GetExecutionEngineTargetDatar   
TargetDatar   )r3   r4   s     r#   target_dataExecutionEngine.target_data|   sQ    
 8888Ogg99$?%%c*xxr*   c                 D    [         R                  R                  U 5      nU$ )z
Enable JIT events for profiling of generated code.
Return value indicates whether connection to profiling tool
was successful.
)r   r   LLVMPY_EnableJITEvents)r3   rets     r#   enable_jit_events!ExecutionEngine.enable_jit_events   s     gg,,T2
r*   c                     [        U[        5      R                  nU R                   H/  n[        UR                  [        5      R                  U:X  d  M-  Us  $    g)z8
Find the ModuleRef corresponding to the given pointer.
N)r   r   valuer/   _ptr)r3   
module_ptrr4   r   s       r#   _find_module_ptr ExecutionEngine._find_module_ptr   sG     :x(..mmFFKK*00C7 $ r*   c                     [        U[        5      (       a  [        R                  R	                  U5      n[
        R                  R                  X5        g)zx
Add object file to the jit. object_file can be instance of
:class:ObjectFile or a string representing file system path
N)
isinstancer   r   ObjectFileRef	from_pathr   r   LLVMPY_MCJITAddObjectFile)r3   obj_files     r#   add_object_fileExecutionEngine.add_object_file   s9    
 h$$"00::8DH))$9r*   c                     Xl         X l        [        U 5      U l        [        R
                  R                  X R                  5        g)zf
Set the object cache "notifyObjectCompiled" and "getBuffer"
callbacks to the given Python functions.
N)_object_cache_notify_object_cache_getbuffer_ObjectCacheRef_object_cacher   r   LLVMPY_SetObjectCache)r3   notify_funcgetbuffer_funcs      r#   set_object_cache ExecutionEngine.set_object_cache   s7    
 %0!'5$,T2 	%%d,>,>?r*   c                 "   U R                   c  gUR                  R                  nUR                  R                  nUR                  R                  n[        X45      nU R                  U5      nUc  [        SU< 35      eU R                  Xe5        g)z
Low-level notify hook.
N3object compilation notification for unknown module )rz   contentsrn   buf_ptrbuf_lenr   ro   r   )r3   datarn   r   r   bufr   s          r#   _raw_object_cache_notify(ExecutionEngine._raw_object_cache_notify   s     $$,]]--
--''--'')&&z2> :D G H H!!&.r*   c                 D   U R                   c  gUR                  R                  nU R                  U5      nUc  [	        SU< 35      eU R                  U5      nUbE  [
        R                  R                  U[        U5      5      US   l	        [        U5      US   l
        gg)z
Low-level getbuffer hook.
Nr   r   )r{   r   rn   ro   r   r   r   LLVMPY_CreateByteStringlenr   r   )r3   r   rn   r   r   s        r#   _raw_object_cache_getbuffer+ExecutionEngine._raw_object_cache_getbuffer   s     ''/]]--
&&z2> :D G H H **62?!gg==c3s8LDGO!#hDGO r*   c                    U R                    H  nUR                  5         M     U R                  b  U R                  R                  5         U R                   R                  5         S U l        U R
                  R                  U 5        g rC   )r/   detachr0   clearr}   _capiLLVMPY_DisposeExecutionEngine)r3   mods     r#   _disposeExecutionEngine._dispose   s[    ==CJJL !88HHOO!

006r*   )r/   r}   r{   rz   r0   )NN)__name__
__module____qualname____firstlineno____doc__r}   r2   r<   r@   rG   rM   rR   rV   rZ   r_   propertyrd   ri   ro   rw   r   r   r   r   __static_attributes__ r*   r#   r   r   1   su     M*MP8",32 	 	:@/$'(7r*   r   c                   $    \ rS rSrSrS rS rSrg)r|      zF
Internal: an ObjectCache instance for use within an ExecutionEngine.
c                     [         R                  R                  [        [        U5      n[         R
                  R                  X5        g rC   )r   r   LLVMPY_CreateObjectCache_notify_c_hook_getbuffer_c_hookr1   r2   )r3   objr4   s      r#   r2   _ObjectCacheRef.__init__   s2    gg..~/@/24 	t)r*   c                 :    U R                   R                  U 5        g rC   )r   LLVMPY_DisposeObjectCacherQ   s    r#   r   _ObjectCacheRef._dispose   s    

,,T2r*   r   N)r   r   r   r   r   r2   r   r   r   r*   r#   r|   r|      s    *3r*   r|   c                   >    \ rS rSrS\R
                  4S\4S\4/rSr	g)_ObjectCacheDatai*  rn   r   r   r   N)
r   r   r   r   r   LLVMModuleRefr   r	   _fields_r   r   r*   r#   r   r   *  s'    	s(()	H	HHr*   r   rC   )7r   ctypesr   r   r   r   r   r   r	   r
   r   r   r   r   llvmlite.bindingr   r   r   r   LLVMPY_LinkInMCJITr$   r)   r1   r   r|   r   LLVMTargetMachineRefr   argtypesLLVMExecutionEngineRefrestyper]   rK   LLVMValueRefrD   rP   rb   LLVMTargetDataRefr&   r8   r?   LLVMObjectFileRefru   r   _ObjectCacheNotifyFunc_ObjectCacheGetBufferFuncr   r   r   r   r   LLVMObjectCacheRefr   r~   r   r   r*   r#   <module>r      sa   * * * * 7 6   2,o7cmm o7d3cmm 3( 
H	/ " " + .1-G-G " " * H(   $
 '-   # %   !
 -0,F,F,/,<,<,4,6   ( +.*D*D)E   & 8 + + 4 7:6K6K + + 368 * * 35: * * 2 . ! ! * -5 ! ! ) 1 $ $ - 08 $ $ , . ! ! *y  #4#*+;#<> %dI&-.>&?A  (,,.-//1  .D-F-6-8     ) ,/+A+A     (.1.D.D-E ! ! **-*D*D*-*@*@*B   & +3   ',4h+?   (r*   