+
    :i!                     t    ^ RI HtHt ^ RI t^ RIHtHtHt  ! R R]4      t	 ! R R]4      t
 ! R R	]4      tR# )
    )Constant	IRBuilderN)typesconfigcgutilsc                   6   a  ] tR t^t o RtR tR tR tRtV t	R# )_ArgManagerz9
A utility class to handle argument unboxing and cleanup
c                ^    Wn         W n        W0n        W@n        ^ V n        . V n        WPn        R# )r   N)contextbuilderapienv_manager	arg_countcleanupsnextblk)selfr   r   r   r   endblknargss   &&&&&&&T/var/www/html/photoedit/myenv/lib/python3.14/site-packages/numba/core/callwrapper.py__init___ArgManager.__init__   s*    &    c                  a aa S P                   P                  SV4      o\        P                  ! S P                  SP
                  4      ;_uu_ 4        S P                  P                  S P                  4       RRR4       VV V3R lpS P                  P                  V4       S P                  P                  RS P                  ,          4      pS P                  P                  V4      ;_uu_ 4        V! 4        S P                  P                  S P                  4       RRR4       VS n        S ;P                  ^,          un        SP                  #   + '       g   i     L; i  + '       g   i     LO; i)a;  
Unbox argument and emit code that handles any error during unboxing.
Args are cleaned up in reverse order of the parameter list, and
cleanup begins as soon as unboxing of any argument fails. E.g. failure
on arg2 will result in control flow going through:

    arg2.err -> arg1.err -> arg0.err -> arg.end (returns)
Nc                  X  < SP                   P                  SS P                  SP                  4       S P                  e   S P	                  4        SP
                  P                  '       d>   SP
                  P                  P                  SP                  SS P                  4       R # R # N)
r   reflect_native_valuevaluer   cleanupr   
enable_nrtnrtdecrefr   )nativer   tys   r   cleanup_arg(_ArgManager.add_arg.<locals>.cleanup_arg&   st    HH))"fllD<L<LM ~~) 
 ||&&&  ''b&,,G 'r   z	arg%d.err)r   to_native_valuer   if_unlikelyr   is_errorbranchr   r   appendappend_basic_blockr   
goto_blockr   )r   objr#   r$   
cleanupblkr"   s   f&f  @r   add_arg_ArgManager.add_arg   s     ))"c2   v??LL- @	H 	[) \\44$..(*
\\$$Z00MLL- 1
 "!||= @?. 10s   &E3-E'E$	'E7	c                :    V P                    F
  pV! 4        K  	  R# )zB
Emit the cleanup code after returning from the wrapped function.
N)r   )r   dtors   & r   emit_cleanup_ArgManager.emit_cleanupB   s     MMDF "r   )r   r   r   r   r   r   r   N)
__name__
__module____qualname____firstlineno____doc__r   r/   r3   __static_attributes____classdictcell____classdict__s   @r   r	   r	      s     ,\ r   r	   c                   0   a  ] tR t^Jt o RtR tR tRtV tR# )_GilManagerzM
A utility class to handle releasing the GIL and then re-acquiring it
again.
c                T    Wn         W n        W0n        VP                  4       V n        R # r   )r   r   argmansave_threadthread_state)r   r   r   rA   s   &&&&r   r   _GilManager.__init__P   s     OO-r   c                    V P                   P                  V P                  4       V P                  P	                  4        R # r   )r   restore_threadrC   rA   r3   )r   s   &r   r3   _GilManager.emit_cleanupV   s*     1 12  "r   )r   rA   r   rC   N)	r5   r6   r7   r8   r9   r   r3   r:   r;   r<   s   @r   r?   r?   J   s     
.# #r   r?   c                   D   a  ] tR t^[t o R tR tR tR tR tR t	Rt
V tR# )	PyCallWrapperc                N    Wn         W n        W0n        W@n        WPn        Wpn        R # r   )r   modulefuncfndescenvrelease_gil)r   r   rK   rL   rM   rN   call_helperrO   s   &&&&&&&&r   r   PyCallWrapper.__init__\   s!    	&r   c                   V P                   P                  pV P                  P                  \        P
                  4      p\        P                  P                  W"W".4      p\        P                  P                  V P                  W1R 7      p\        VP                  R4      4      pVP                  w  rgpRVn        RVn        RVn        V P                  P                  V4      p	V P!                  WWgV4       WI3# ))nameentry
py_closurepy_argspy_kws)rM   llvm_cpython_wrapper_namer   get_argument_typer   pyobjectllvmliteirFunctionTypeFunctionrK   r   r+   argsrS   get_python_apibuild_wrapper)
r   wrapnamepyobjwraptywrapperr   closurer_   kwsr   s
   &         r   buildPyCallWrapper.builde   s    ;;88 ..u~~>))%1FG++&&t{{F&JG66w?@ %\\s#	ll))'23<|r   c           	        \        V P                  P                  4      p\        V4       Uu. uF  qqP	                  4       NK  	  ppVP
                  ! W@P                  P                  Wf.VO5!  p	VP                  R V	\        V	P                  R4      4      p
\        P                  ! W*4      ;_uu_ 4        VP                  VP                  4       4       RRR4       VP                  R4      pVP                  V4      ;_uu_ 4        VP                  VP                  4       4       RRR4       V P!                  W4      p\#        V P$                  W!WV4      p. p\'        WP                  P                  4       Fk  w  pp\)        V\*        P,                  4      '       d   VP/                  R4       K9  VP1                  VP3                  V4      V4      pVP/                  V4       Km  	  V P4                  '       d   \7        W!V4      pV P$                  P8                  P;                  W P<                  V P                  P>                  V P                  P                  VRR7      w  ppV PA                  VR4       VPC                  4        V PA                  VR4       VPE                  VPF                  RR7      ;_uu_ 4        VPE                  VPH                  4      ;_uu_ 4        VPK                  4        RRR4       V PM                  4       pVPO                  VVV4      pVP                  V4       RRR4       V P$                  P8                  PQ                  W!V4       VP                  VP                  4       4       R# u upi   + '       g   i     EL; i  + '       g   i     ELy; i  + '       g   i     L; i  + '       g   i     L; i)	z==Nzarg.end)attrsz# callwrapper: emit_cleanupz# callwrapper: emit_cleanup endT)likely)noinline))lenrM   argtypesrange
alloca_objunpack_tuplequalnameicmp_unsignedr   typer   r'   retget_null_objectr+   r,   get_envr	   r   zip
isinstancer   Omittedr*   r/   loadrO   r?   	call_convcall_functionrL   restypedebug_printr3   if_thenis_okis_nonereturn_none_simplified_return_typefrom_native_returnraise_error)r   r   r   rf   r_   rg   r   _objsparseokpredr   r   cleanup_manager	innerargsr-   r#   valstatusretvalrettys   &&&&&&               r   ra   PyCallWrapper.build_wrapper~   s   DKK(()*/,7,Q ,7""4)=)=#(8268 $$W\\4(*   //KK++-. 0 ++I6''KK++-. ( ll30%dllG&15B 	4!5!56GC"emm,,  &%--gll3.?D  % 7 )'HO //==YY 3 3T[[5I5I] > , 	"?@$$&"CD __V\\$_7700! 1 002E((DCKK 8 	**7@C'')*E 8 0//
 (''X 10 87sA   M>5 N N>$N>"N+	3<N>N	N(	+N;6N>>O	c                |   V P                   P                  V P                  4      pV P                   P                  VP                  V4      pVP                  V4      pV P                   P                  W%4      pVP                  VRV P                  P                  R7       VP                  V P                  We4      pV# )z`Get the Environment object which is declared as a global
in the module of the wrapped function.
T)return_pyobject	debug_msg)r   get_env_namerM   declare_env_globalrK   r|   get_env_bodyemit_environment_sentryenv_nameget_env_managerrN   )r   r   r   envnamegvptrenvptrenv_bodyr   s   &&&     r   rx   PyCallWrapper.get_env   s     ,,++DKK8//He$<<,,W=##FD.2kk.B.B 	$ 	D))$((HEr   c                    V P                   P                  p\        V\        P                  4      '       d   VP
                  # V# )zm
The NPM callconv has already converted simplified optional types.
We can simply use the value type from it.
)rM   r   rz   r   Optionalru   )r   r   s   & r   r   %PyCallWrapper._simplified_return_type   s3    
 ++%%gu~~..<<Nr   c                    \         P                  '       d.   V P                  P                  VR P	                  V4      4       R# R# )zDEBUGJIT: {0}N)r   	DEBUG_JITr   r   format)r   r   msgs   &&&r   r   PyCallWrapper.debug_print   s2    LL$$Wo.D.DS.IJ r   )r   rN   rM   rL   rK   rO   N)r5   r6   r7   r8   r   rh   ra   rx   r   r   r:   r;   r<   s   @r   rI   rI   [   s,     '2E+N
K Kr   rI   )llvmlite.irr   r   r[   
numba.corer   r   r   objectr	   r?   rI    r   r   <module>r      s<    +  - -@& @F#& #"GKF GKr   