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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
f7c09e2c
Commit
f7c09e2c
authored
Sep 09, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimise refcounting when assigning from a temporary cypclass
parent
0da79f9c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+6
-3
Cython/Utility/CyObjects.cpp
Cython/Utility/CyObjects.cpp
+3
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
f7c09e2c
...
...
@@ -827,7 +827,7 @@ class ExprNode(Node):
# postponed from self.generate_evaluation_code()
self
.
generate_subexpr_disposal_code
(
code
)
self
.
free_subexpr_temps
(
code
)
if
self
.
result
():
if
self
.
result
()
and
not
self
.
has_temp_moved
:
code
.
put_decref_clear
(
self
.
result
(),
self
.
ctype
(),
have_gil
=
not
self
.
in_nogil_context
)
if
self
.
has_temp_moved
:
...
...
@@ -2944,7 +2944,7 @@ class CppIteratorNode(ExprNode):
code
.
putln
(
"%s = %s%s;"
%
(
self
.
cpp_sequence_cname
,
"&"
if
temp_type
.
is_ptr
else
""
,
self
.
sequence
.
move_result_rhs
()))
if
sequence_type
.
is_cyp_class
:
if
sequence_type
.
is_cyp_class
and
not
self
.
sequence
.
has_temp_moved
:
code
.
put_incref
(
self
.
cpp_sequence_cname
,
sequence_type
)
code
.
putln
(
"%s = %s%sbegin();"
%
(
self
.
result
(),
self
.
cpp_sequence_cname
,
self
.
cpp_attribute_op
))
...
...
@@ -6225,7 +6225,10 @@ class SimpleCallNode(CallNode):
if
self
.
type
.
is_cyp_class
and
isinstance
(
self
.
function
,
NewExprNode
):
return
"%s()"
%
self
.
function
.
result
()
for
formal_arg
,
actual_arg
in
args
[:
expected_nargs
]:
arg_code
=
actual_arg
.
move_result_rhs_as
(
formal_arg
.
type
)
if
formal_arg
.
type
.
is_cyp_class
:
arg_code
=
actual_arg
.
result
()
else
:
arg_code
=
actual_arg
.
move_result_rhs_as
(
formal_arg
.
type
)
arg_list_code
.
append
(
arg_code
)
if
func_type
.
is_overridable
:
...
...
Cython/Utility/CyObjects.cpp
View file @
f7c09e2c
...
...
@@ -112,12 +112,14 @@
// constexpr Cy_Ref_impl(std::nullptr_t null) noexcept : uobj(null) {}
Cy_Ref_impl
(
T
*
uobj
)
:
uobj
(
uobj
)
{
Cy_Ref_impl
(
T
*
const
&
uobj
)
:
uobj
(
uobj
)
{
if
(
uobj
!=
nullptr
)
{
uobj
->
CyObject_INCREF
();
}
}
constexpr
Cy_Ref_impl
(
T
*
&&
uobj
)
noexcept
:
uobj
(
uobj
)
{}
Cy_Ref_impl
(
const
Cy_Ref_impl
&
rhs
)
:
uobj
(
rhs
.
uobj
)
{
if
(
uobj
!=
nullptr
)
{
uobj
->
CyObject_INCREF
();
...
...
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