Created
July 17, 2021 19:39
-
-
Save mattip/e7834c9c93b38d05f177a4d4e334a829 to your computer and use it in GitHub Desktop.
C/Assembler of the call to PyUFunc_GenericFunctionInternal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This C function | |
typedef struct { | |
PyObject *in; | |
PyObject *out; | |
} ufunc_full_args; | |
static int | |
PyUFunc_GenericFunctionInternal(PyUFuncObject *ufunc, PyArrayObject **op, | |
ufunc_full_args full_args, PyObject *type_tup, PyObject *extobj, | |
NPY_CASTING casting, NPY_ORDER order, npy_bool subok, | |
PyArrayObject *wheremask); | |
Is called in this snippet | |
if (!ufunc->core_enabled) { | |
errval = PyUFunc_GenericFunctionInternal(ufunc, operands, | |
full_args, typetup, extobj, casting, order, subok, | |
wheremask); | |
Py_XDECREF(wheremask); | |
} | |
else { | |
errval = PyUFunc_GeneralizedFunctionInternal(ufunc, operands, | |
full_args, typetup, extobj, casting, order, subok, | |
axis_obj, axes_obj, keepdims); | |
} | |
if (errval < 0) { | |
goto fail; | |
} | |
The debugger reports this assembly | |
if (!ufunc->core_enabled) { | |
00007FF9554D2A45 lea r8,[rbp-30h] | |
00007FF9554D2A49 mov r9,qword ptr [rbp-38h] | |
00007FF9554D2A4D lea rdx,[rbp+90h] | |
00007FF9554D2A54 movdqa xmmword ptr [rbp-30h],xmm6 | |
00007FF9554D2A59 cmp dword ptr [r15+70h],edi | |
00007FF9554D2A5D jne $fail+9C8h (07FF9554D2A9Eh) | |
errval = PyUFunc_GenericFunctionInternal(ufunc, operands, | |
00007FF9554D2A5F mov eax,dword ptr [rbp-7Ch] | |
00007FF9554D2A62 mov qword ptr [rsp+40h],r12 | |
00007FF9554D2A67 mov byte ptr [rsp+38h],cl | |
00007FF9554D2A6B mov rcx,r15 | |
00007FF9554D2A6E mov dword ptr [rsp+30h],r13d | |
00007FF9554D2A73 mov dword ptr [rsp+28h],eax | |
00007FF9554D2A77 mov rax,qword ptr [rbp] | |
00007FF9554D2A7B mov qword ptr [rsp+20h],rax | |
00007FF9554D2A80 call PyUFunc_GenericFunctionInternal (07FF9554D5F30h) | |
00007FF9554D2A85 mov ebx,eax | |
full_args, typetup, extobj, casting, order, subok, | |
wheremask); | |
Py_XDECREF(wheremask); | |
00007FF9554D2A87 test r12,r12 | |
00007FF9554D2A8A je $fail+0A04h (07FF9554D2ADAh) | |
00007FF9554D2A8C sub qword ptr [r12],1 | |
00007FF9554D2A91 jne $fail+0A04h (07FF9554D2ADAh) | |
00007FF9554D2A93 mov rcx,r12 | |
00007FF9554D2A96 call qword ptr [__imp__PyPy_Dealloc (07FF955525F38h)] | |
} | |
00007FF9554D2A9C jmp $fail+0A04h (07FF9554D2ADAh) | |
else { | |
errval = PyUFunc_GeneralizedFunctionInternal(ufunc, operands, | |
00007FF9554D2A9E mov eax,dword ptr [rbp-40h] | |
00007FF9554D2AA1 mov dword ptr [rsp+50h],eax | |
00007FF9554D2AA5 mov rax,qword ptr [rbp+30h] | |
00007FF9554D2AA9 mov qword ptr [rsp+48h],rax | |
00007FF9554D2AAE mov rax,qword ptr [rbp+38h] | |
00007FF9554D2AB2 mov qword ptr [rsp+40h],rax | |
00007FF9554D2AB7 mov eax,dword ptr [rbp-7Ch] | |
00007FF9554D2ABA mov byte ptr [rsp+38h],cl | |
00007FF9554D2ABE mov rcx,r15 | |
00007FF9554D2AC1 mov dword ptr [rsp+30h],r13d | |
00007FF9554D2AC6 mov dword ptr [rsp+28h],eax | |
00007FF9554D2ACA mov rax,qword ptr [rbp] | |
00007FF9554D2ACE mov qword ptr [rsp+20h],rax | |
00007FF9554D2AD3 call PyUFunc_GeneralizedFunctionInternal (07FF9554D65F0h) | |
00007FF9554D2AD8 mov ebx,eax | |
full_args, typetup, extobj, casting, order, subok, | |
axis_obj, axes_obj, keepdims); | |
} | |
if (errval < 0) { | |
00007FF9554D2ADA test ebx,ebx | |
00007FF9554D2ADC js $fail+966h (07FF9554D2A3Ch) | |
goto fail; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment