Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
a3cfec8f
Commit
a3cfec8f
authored
Aug 21, 2016
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use fast PyFunction calls in some more places
parent
8f3d3bd1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
3 deletions
+36
-3
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+36
-3
No files found.
Cython/Utility/ObjectHandling.c
View file @
a3cfec8f
...
@@ -1258,6 +1258,7 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
...
@@ -1258,6 +1258,7 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
/////////////// PyObjectCallMethod1 ///////////////
/////////////// PyObjectCallMethod1 ///////////////
//@requires: PyObjectGetAttrStr
//@requires: PyObjectGetAttrStr
//@requires: PyObjectCallOneArg
//@requires: PyObjectCallOneArg
//@requires: PyFunctionFastCall
static
PyObject
*
__Pyx_PyObject_CallMethod1
(
PyObject
*
obj
,
PyObject
*
method_name
,
PyObject
*
arg
)
{
static
PyObject
*
__Pyx_PyObject_CallMethod1
(
PyObject
*
obj
,
PyObject
*
method_name
,
PyObject
*
arg
)
{
PyObject
*
method
,
*
result
=
NULL
;
PyObject
*
method
,
*
result
=
NULL
;
...
@@ -1269,6 +1270,13 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
...
@@ -1269,6 +1270,13 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
if
(
likely
(
self
))
{
if
(
likely
(
self
))
{
PyObject
*
args
;
PyObject
*
args
;
PyObject
*
function
=
PyMethod_GET_FUNCTION
(
method
);
PyObject
*
function
=
PyMethod_GET_FUNCTION
(
method
);
#if CYTHON_FAST_PYCALL
if
(
PyFunction_Check
(
function
))
{
PyObject
*
args
[
2
]
=
{
self
,
arg
};
result
=
__Pyx_PyFunction_FastCall
(
function
,
args
,
2
,
NULL
);
goto
done
;
}
#endif
args
=
PyTuple_New
(
2
);
args
=
PyTuple_New
(
2
);
if
(
unlikely
(
!
args
))
goto
bad
;
if
(
unlikely
(
!
args
))
goto
bad
;
Py_INCREF
(
self
);
Py_INCREF
(
self
);
...
@@ -1285,6 +1293,7 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
...
@@ -1285,6 +1293,7 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
}
}
#endif
#endif
result
=
__Pyx_PyObject_CallOneArg
(
method
,
arg
);
result
=
__Pyx_PyObject_CallOneArg
(
method
,
arg
);
done:
bad:
bad:
Py_XDECREF
(
method
);
Py_XDECREF
(
method
);
return
result
;
return
result
;
...
@@ -1298,15 +1307,24 @@ static PyObject* __Pyx_PyObject_CallMethod2(PyObject* obj, PyObject* method_name
...
@@ -1298,15 +1307,24 @@ static PyObject* __Pyx_PyObject_CallMethod2(PyObject* obj, PyObject* method_name
/////////////// PyObjectCallMethod2 ///////////////
/////////////// PyObjectCallMethod2 ///////////////
//@requires: PyObjectGetAttrStr
//@requires: PyObjectGetAttrStr
//@requires: PyObjectCall
//@requires: PyObjectCall
//@requires: PyFunctionFastCall
static
PyObject
*
__Pyx_PyObject_CallMethod2
(
PyObject
*
obj
,
PyObject
*
method_name
,
PyObject
*
arg1
,
PyObject
*
arg2
)
{
static
PyObject
*
__Pyx_PyObject_CallMethod2
(
PyObject
*
obj
,
PyObject
*
method_name
,
PyObject
*
arg1
,
PyObject
*
arg2
)
{
PyObject
*
args
,
*
method
,
*
result
=
NULL
;
PyObject
*
args
,
*
method
,
*
result
=
NULL
;
method
=
__Pyx_PyObject_GetAttrStr
(
obj
,
method_name
);
method
=
__Pyx_PyObject_GetAttrStr
(
obj
,
method_name
);
if
(
unlikely
(
!
method
))
return
NULL
;
#if CYTHON_UNPACK_METHODS
#if CYTHON_UNPACK_METHODS
if
(
likely
(
PyMethod_Check
(
method
))
&&
likely
(
PyMethod_GET_SELF
(
method
)))
{
if
(
likely
(
PyMethod_Check
(
method
))
&&
likely
(
PyMethod_GET_SELF
(
method
)))
{
PyObject
*
self
,
*
function
;
PyObject
*
self
,
*
function
;
self
=
PyMethod_GET_SELF
(
method
);
self
=
PyMethod_GET_SELF
(
method
);
function
=
PyMethod_GET_FUNCTION
(
method
);
function
=
PyMethod_GET_FUNCTION
(
method
);
#if CYTHON_FAST_PYCALL
if
(
PyFunction_Check
(
function
))
{
PyObject
*
args
[
3
]
=
{
self
,
arg1
,
arg2
};
result
=
__Pyx_PyFunction_FastCall
(
function
,
args
,
3
,
NULL
);
goto
done
;
}
#endif
args
=
PyTuple_New
(
3
);
args
=
PyTuple_New
(
3
);
if
(
unlikely
(
!
args
))
goto
bad
;
if
(
unlikely
(
!
args
))
goto
bad
;
Py_INCREF
(
self
);
Py_INCREF
(
self
);
...
@@ -1319,6 +1337,13 @@ static PyObject* __Pyx_PyObject_CallMethod2(PyObject* obj, PyObject* method_name
...
@@ -1319,6 +1337,13 @@ static PyObject* __Pyx_PyObject_CallMethod2(PyObject* obj, PyObject* method_name
Py_DECREF
(
method
);
Py_DECREF
(
method
);
method
=
function
;
method
=
function
;
}
else
}
else
#endif
#if CYTHON_FAST_PYCALL
if
(
PyFunction_Check
(
method
))
{
PyObject
*
args
[
2
]
=
{
arg1
,
arg2
};
result
=
__Pyx_PyFunction_FastCall
(
method
,
args
,
2
,
NULL
);
goto
done
;
}
else
#endif
#endif
{
{
args
=
PyTuple_New
(
2
);
args
=
PyTuple_New
(
2
);
...
@@ -1330,10 +1355,9 @@ static PyObject* __Pyx_PyObject_CallMethod2(PyObject* obj, PyObject* method_name
...
@@ -1330,10 +1355,9 @@ static PyObject* __Pyx_PyObject_CallMethod2(PyObject* obj, PyObject* method_name
}
}
result
=
__Pyx_PyObject_Call
(
method
,
args
,
NULL
);
result
=
__Pyx_PyObject_Call
(
method
,
args
,
NULL
);
Py_DECREF
(
args
);
Py_DECREF
(
args
);
Py_DECREF
(
method
);
done:
return
result
;
bad:
bad:
Py_
X
DECREF
(
method
);
Py_DECREF
(
method
);
return
result
;
return
result
;
}
}
...
@@ -1628,6 +1652,7 @@ static PyObject* __Pyx_PyNumber_InPlaceMatrixMultiply(PyObject* x, PyObject* y);
...
@@ -1628,6 +1652,7 @@ static PyObject* __Pyx_PyNumber_InPlaceMatrixMultiply(PyObject* x, PyObject* y);
/////////////// MatrixMultiply ///////////////
/////////////// MatrixMultiply ///////////////
//@requires: PyObjectGetAttrStr
//@requires: PyObjectGetAttrStr
//@requires: PyObjectCallOneArg
//@requires: PyObjectCallOneArg
//@requires: PyFunctionFastCall
#if PY_VERSION_HEX < 0x03050000
#if PY_VERSION_HEX < 0x03050000
static
PyObject
*
__Pyx_PyObject_CallMatrixMethod
(
PyObject
*
method
,
PyObject
*
arg
)
{
static
PyObject
*
__Pyx_PyObject_CallMatrixMethod
(
PyObject
*
method
,
PyObject
*
arg
)
{
...
@@ -1639,6 +1664,13 @@ static PyObject* __Pyx_PyObject_CallMatrixMethod(PyObject* method, PyObject* arg
...
@@ -1639,6 +1664,13 @@ static PyObject* __Pyx_PyObject_CallMatrixMethod(PyObject* method, PyObject* arg
if
(
likely
(
self
))
{
if
(
likely
(
self
))
{
PyObject
*
args
;
PyObject
*
args
;
PyObject
*
function
=
PyMethod_GET_FUNCTION
(
method
);
PyObject
*
function
=
PyMethod_GET_FUNCTION
(
method
);
#if CYTHON_FAST_PYCALL
if
(
PyFunction_Check
(
function
))
{
PyObject
*
args
[
2
]
=
{
self
,
arg
};
result
=
__Pyx_PyFunction_FastCall
(
function
,
args
,
2
,
NULL
);
goto
done
;
}
#endif
args
=
PyTuple_New
(
2
);
args
=
PyTuple_New
(
2
);
if
(
unlikely
(
!
args
))
goto
bad
;
if
(
unlikely
(
!
args
))
goto
bad
;
Py_INCREF
(
self
);
Py_INCREF
(
self
);
...
@@ -1655,6 +1687,7 @@ static PyObject* __Pyx_PyObject_CallMatrixMethod(PyObject* method, PyObject* arg
...
@@ -1655,6 +1687,7 @@ static PyObject* __Pyx_PyObject_CallMatrixMethod(PyObject* method, PyObject* arg
}
}
#endif
#endif
result
=
__Pyx_PyObject_CallOneArg
(
method
,
arg
);
result
=
__Pyx_PyObject_CallOneArg
(
method
,
arg
);
done:
bad:
bad:
Py_DECREF
(
method
);
Py_DECREF
(
method
);
return
result
;
return
result
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment