Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
f2c88c16
Commit
f2c88c16
authored
Nov 18, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get farther with the gc: don't need to clear constant's attrs
parent
0b3ebad3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
15 deletions
+32
-15
src/runtime/dict.cpp
src/runtime/dict.cpp
+7
-6
src/runtime/types.cpp
src/runtime/types.cpp
+24
-9
src/runtime/types.h
src/runtime/types.h
+1
-0
No files found.
src/runtime/dict.cpp
View file @
f2c88c16
...
...
@@ -200,7 +200,11 @@ extern "C" void PyDict_Clear(PyObject* op) noexcept {
}
RELEASE_ASSERT
(
PyDict_Check
(
op
),
""
);
static_cast
<
BoxedDict
*>
(
op
)
->
d
.
clear
();
for
(
auto
p
:
*
static_cast
<
BoxedDict
*>
(
op
))
{
Py_DECREF
(
p
.
first
);
Py_DECREF
(
p
.
second
);
}
static_cast
<
BoxedDict
*>
(
op
)
->
d
.
freeAllMemory
();
}
extern
"C"
PyObject
*
PyDict_Copy
(
PyObject
*
o
)
noexcept
{
...
...
@@ -764,11 +768,8 @@ void BoxedDict::dealloc(Box* b) noexcept {
_PyObject_GC_UNTRACK
(
b
);
assert
(
PyDict_Check
(
b
));
for
(
auto
p
:
*
static_cast
<
BoxedDict
*>
(
b
))
{
Py_DECREF
(
p
.
first
);
Py_DECREF
(
p
.
second
);
}
static_cast
<
BoxedDict
*>
(
b
)
->
d
.
freeAllMemory
();
BoxedDict
::
clear
(
b
);
b
->
cls
->
tp_free
(
b
);
}
...
...
src/runtime/types.cpp
View file @
f2c88c16
...
...
@@ -3393,11 +3393,33 @@ tupletraverse(PyTupleObject *o, visitproc visit, void *arg)
void
BoxedModule
::
dealloc
(
Box
*
b
)
noexcept
{
BoxedModule
*
self
=
static_cast
<
BoxedModule
*>
(
b
);
self
->
clearAttrs
();
BoxedModule
::
clear
(
b
);
b
->
cls
->
tp_free
(
b
);
}
int
BoxedModule
::
traverse
(
Box
*
_m
,
visitproc
visit
,
void
*
arg
)
noexcept
{
BoxedModule
*
m
=
static_cast
<
BoxedModule
*>
(
_m
);
Py_VISIT_HCATTRS
(
m
->
attrs
);
return
0
;
}
int
BoxedModule
::
clear
(
Box
*
b
)
noexcept
{
BoxedModule
*
self
=
static_cast
<
BoxedModule
*>
(
b
);
self
->
clearAttrs
();
assert
(
!
self
->
str_constants
.
size
());
assert
(
!
self
->
unicode_constants
.
size
());
assert
(
!
self
->
int_constants
.
size
());
assert
(
!
self
->
float_constants
.
size
());
assert
(
!
self
->
imaginary_constants
.
size
());
assert
(
!
self
->
long_constants
.
size
());
assert
(
!
self
->
keep_alive
.
size
());
return
0
;
}
void
BoxedSlice
::
dealloc
(
Box
*
b
)
noexcept
{
BoxedSlice
*
self
=
static_cast
<
BoxedSlice
*>
(
b
);
...
...
@@ -3408,12 +3430,6 @@ void BoxedSlice::dealloc(Box* b) noexcept {
PyObject_Del
(
b
);
}
int
BoxedModule
::
traverse
(
Box
*
_m
,
visitproc
visit
,
void
*
arg
)
noexcept
{
BoxedModule
*
m
=
static_cast
<
BoxedModule
*>
(
_m
);
Py_VISIT_HCATTRS
(
m
->
attrs
);
return
0
;
}
void
BoxedInstanceMethod
::
dealloc
(
Box
*
b
)
noexcept
{
BoxedInstanceMethod
*
im
=
static_cast
<
BoxedInstanceMethod
*>
(
b
);
...
...
@@ -3727,7 +3743,7 @@ void setupRuntime() {
function_cls
->
has_safe_tp_dealloc
=
builtin_function_or_method_cls
->
has_safe_tp_dealloc
=
true
;
module_cls
=
new
(
0
)
BoxedClass
(
object_cls
,
offsetof
(
BoxedModule
,
attrs
),
0
,
sizeof
(
BoxedModule
),
false
,
"module"
,
BoxedModule
::
dealloc
,
NULL
,
true
,
BoxedModule
::
traverse
,
NOCLEAR
);
BoxedModule
::
dealloc
,
NULL
,
true
,
BoxedModule
::
traverse
,
BoxedModule
::
clear
);
member_descriptor_cls
=
new
(
0
)
BoxedClass
(
object_cls
,
0
,
0
,
sizeof
(
BoxedMemberDescriptor
),
false
,
"member_descriptor"
,
NULL
,
NULL
,
false
);
capifunc_cls
=
new
(
0
)
...
...
@@ -4136,7 +4152,6 @@ void setupRuntime() {
}
}
for
(
auto
b
:
constants
)
{
b
->
clearAttrs
();
Py_DECREF
(
b
);
}
for
(
auto
b
:
classes
)
{
...
...
src/runtime/types.h
View file @
f2c88c16
...
...
@@ -905,6 +905,7 @@ public:
static
void
dealloc
(
Box
*
b
)
noexcept
;
static
int
traverse
(
Box
*
self
,
visitproc
visit
,
void
*
arg
)
noexcept
;
static
int
clear
(
Box
*
b
)
noexcept
;
private:
ContiguousMap
<
llvm
::
StringRef
,
BoxedString
*
,
llvm
::
StringMap
<
int
>>
str_constants
;
...
...
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