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
Boxiang Sun
cython
Commits
c7dbcf9a
Commit
c7dbcf9a
authored
Dec 08, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
split builtin type call optimisations into pre and post type analysis phase
parent
21442aba
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
199 additions
and
113 deletions
+199
-113
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+9
-5
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+3
-1
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+187
-107
No files found.
Cython/Compiler/ExprNodes.py
View file @
c7dbcf9a
...
...
@@ -2641,28 +2641,32 @@ class SimpleCallNode(CallNode):
class
PythonCapiFunctionNode
(
ExprNode
):
subexprs
=
[]
def
__init__
(
self
,
pos
,
name
,
func_type
,
utility_code
=
None
):
def
__init__
(
self
,
pos
,
py_name
,
c
name
,
func_type
,
utility_code
=
None
):
self
.
pos
=
pos
self
.
name
=
name
self
.
name
=
py_name
self
.
cname
=
cname
self
.
type
=
func_type
self
.
utility_code
=
utility_code
def
analyse_types
(
self
,
env
):
pass
def
generate_result_code
(
self
,
code
):
if
self
.
utility_code
:
code
.
globalstate
.
use_utility_code
(
self
.
utility_code
)
def
calculate_result_code
(
self
):
return
self
.
name
return
self
.
c
name
class
PythonCapiCallNode
(
SimpleCallNode
):
# Python C-API Function call (only created in transforms)
def
__init__
(
self
,
pos
,
function_name
,
func_type
,
utility_code
=
None
,
**
kwargs
):
utility_code
=
None
,
py_name
=
None
,
**
kwargs
):
self
.
type
=
func_type
.
return_type
self
.
result_ctype
=
self
.
type
self
.
function
=
PythonCapiFunctionNode
(
pos
,
function_name
,
func_type
,
pos
,
py_name
,
function_name
,
func_type
,
utility_code
=
utility_code
)
# call this last so that we can override the constructed
# attributes above with explicit keyword arguments if required
...
...
Cython/Compiler/Main.py
View file @
c7dbcf9a
...
...
@@ -92,7 +92,8 @@ class Context(object):
from
AnalysedTreeTransforms
import
AutoTestDictTransform
from
AutoDocTransforms
import
EmbedSignature
from
Optimize
import
FlattenInListTransform
,
SwitchTransform
,
IterationTransform
from
Optimize
import
OptimizeBuiltinCalls
,
ConstantFolding
,
FinalOptimizePhase
from
Optimize
import
EarlyReplaceBuiltinCalls
,
OptimizeBuiltinCalls
from
Optimize
import
ConstantFolding
,
FinalOptimizePhase
from
Optimize
import
DropRefcountingTransform
from
Buffer
import
IntroduceBufferAuxiliaryVars
from
ModuleNode
import
check_c_declarations
,
check_c_declarations_pxd
...
...
@@ -131,6 +132,7 @@ class Context(object):
AnalyseDeclarationsTransform
(
self
),
AutoTestDictTransform
(
self
),
EmbedSignature
(
self
),
EarlyReplaceBuiltinCalls
(
self
),
MarkAssignments
(
self
),
TransformBuiltinMethods
(
self
),
IntroduceBufferAuxiliaryVars
(
self
),
...
...
Cython/Compiler/Optimize.py
View file @
c7dbcf9a
This diff is collapsed.
Click to expand it.
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