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
Xavier Thompson
cython
Commits
d9ca179c
Commit
d9ca179c
authored
Dec 08, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimise runtime isolation check implementation
parent
a505e7ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
13 deletions
+10
-13
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+3
-4
Cython/Utility/CyObjects.cpp
Cython/Utility/CyObjects.cpp
+7
-9
No files found.
Cython/Compiler/ModuleNode.py
View file @
d9ca179c
...
...
@@ -990,11 +990,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
namespace
=
entry
.
type
.
empty_declaration_code
()
if
templates_code
:
code
.
putln
(
templates_code
)
code
.
putln
(
"
int %s::CyObject_traverse_iso(void *
(*visit)(const CyObject *o, void *arg), void *arg) const"
%
namespace
)
code
.
putln
(
"
void %s::CyObject_traverse_iso(void
(*visit)(const CyObject *o, void *arg), void *arg) const"
%
namespace
)
code
.
putln
(
"{"
)
for
attr
in
check_cypclass_attrs
:
code
.
putln
(
"if (void *ret = visit(this->%s, arg)) return (int) (intptr_t) ret;"
%
attr
.
cname
)
code
.
putln
(
"return 0;"
)
code
.
putln
(
"visit(this->%s, arg);"
%
attr
.
cname
)
code
.
putln
(
"}"
)
# isolation check method
if
templates_code
:
...
...
@@ -1672,7 +1671,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
# Declare the method to check isolation
code
.
putln
(
"virtual int CyObject_iso() const;"
)
# Declare the traverse method
code
.
putln
(
"virtual
int CyObject_traverse_iso(void *
(*visit)(const CyObject *o, void *arg), void *arg) const;"
)
code
.
putln
(
"virtual
void CyObject_traverse_iso(void
(*visit)(const CyObject *o, void *arg), void *arg) const;"
)
if
type
.
is_cyp_class
and
cypclass_attrs
:
# Declaring a small destruction handler which will always try to Cy_XDECREF
...
...
Cython/Utility/CyObjects.cpp
View file @
d9ca179c
...
...
@@ -94,8 +94,8 @@
virtual
int
CyObject_iso
()
const
{
return
this
->
nogil_ob_refcnt
==
1
;
}
virtual
int
CyObject_traverse_iso
(
void
*
(
*
visit
)(
const
CyObject
*
o
,
void
*
arg
),
void
*
arg
)
const
{
return
0
;
virtual
void
CyObject_traverse_iso
(
void
(
*
visit
)(
const
CyObject
*
o
,
void
*
arg
),
void
*
arg
)
const
{
return
;
}
/* Locking methods */
...
...
@@ -489,28 +489,26 @@
/*
* Visit callback to collect reachable fields.
*/
static
void
*
__Pyx_CyObject_visit_collect
(
const
CyObject
*
ob
,
void
*
arg
)
{
static
void
__Pyx_CyObject_visit_collect
(
const
CyObject
*
ob
,
void
*
arg
)
{
if
(
!
ob
)
return
0
;
return
;
if
(
ob
->
__refcnt
)
return
0
;
return
;
ob
->
__refcnt
=
ob
->
CyObject_GETREF
();
const
CyObject
*
head
=
reinterpret_cast
<
CyObject
*>
(
arg
);
const
CyObject
*
tmp
=
head
->
__next
;
ob
->
__next
=
tmp
;
head
->
__next
=
ob
;
return
0
;
}
/*
* Visit callback to decref reachable fields.
*/
static
void
*
__Pyx_CyObject_visit_decref
(
const
CyObject
*
ob
,
void
*
arg
)
{
static
void
__Pyx_CyObject_visit_decref
(
const
CyObject
*
ob
,
void
*
arg
)
{
(
void
)
arg
;
if
(
!
ob
)
return
0
;
return
;
ob
->
__refcnt
-=
1
;
return
0
;
}
/*
...
...
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