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
Kirill Smelkov
cython
Commits
7d386fe6
Commit
7d386fe6
authored
Aug 16, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exclude calls to known but unoptimised builtins from method call optimisation
parent
6b84a0fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+11
-9
No files found.
Cython/Compiler/Optimize.py
View file @
7d386fe6
...
...
@@ -3754,20 +3754,22 @@ class FinalOptimizePhase(Visitor.CythonTransform, Visitor.NodeRefCleanupMixin):
Replace likely Python method calls by a specialised PyMethodCallNode.
"""
self
.
visitchildren
(
node
)
if
node
.
function
.
type
.
is_cfunction
and
node
.
function
.
is_name
:
if
node
.
function
.
name
==
'isinstance'
and
len
(
node
.
args
)
==
2
:
function
=
node
.
function
if
function
.
type
.
is_cfunction
and
function
.
is_name
:
if
function
.
name
==
'isinstance'
and
len
(
node
.
args
)
==
2
:
type_arg
=
node
.
args
[
1
]
if
type_arg
.
type
.
is_builtin_type
and
type_arg
.
type
.
name
==
'type'
:
cython_scope
=
self
.
context
.
cython_scope
node
.
function
.
entry
=
cython_scope
.
lookup
(
'PyObject_TypeCheck'
)
node
.
function
.
type
=
node
.
function
.
entry
.
type
function
.
entry
=
cython_scope
.
lookup
(
'PyObject_TypeCheck'
)
function
.
type
=
function
.
entry
.
type
PyTypeObjectPtr
=
PyrexTypes
.
CPtrType
(
cython_scope
.
lookup
(
'PyTypeObject'
).
type
)
node
.
args
[
1
]
=
ExprNodes
.
CastNode
(
node
.
args
[
1
],
PyTypeObjectPtr
)
elif
node
.
is_temp
and
node
.
function
.
type
.
is_pyobject
and
node
.
function
.
type
is
not
Builtin
.
type_type
:
if
isinstance
(
node
.
arg_tuple
,
ExprNodes
.
TupleNode
)
and
not
(
node
.
arg_tuple
.
mult_factor
or
(
node
.
arg_tuple
.
is_literal
and
node
.
arg_tuple
.
args
)):
node
=
self
.
replace
(
node
,
ExprNodes
.
PyMethodCallNode
.
from_node
(
node
,
function
=
node
.
function
,
arg_tuple
=
node
.
arg_tuple
,
type
=
node
.
type
))
elif
node
.
is_temp
and
function
.
type
.
is_pyobject
:
if
function
.
type
is
not
Builtin
.
type_type
and
not
(
function
.
is_name
and
function
.
entry
.
is_builtin
):
if
isinstance
(
node
.
arg_tuple
,
ExprNodes
.
TupleNode
)
and
not
(
node
.
arg_tuple
.
mult_factor
or
(
node
.
arg_tuple
.
is_literal
and
node
.
arg_tuple
.
args
)):
node
=
self
.
replace
(
node
,
ExprNodes
.
PyMethodCallNode
.
from_node
(
node
,
function
=
function
,
arg_tuple
=
node
.
arg_tuple
,
type
=
node
.
type
))
return
node
def
visit_PyTypeTestNode
(
self
,
node
):
...
...
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