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
b3bacb8f
Commit
b3bacb8f
authored
Jan 07, 2016
by
Marius Wachtler
1
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1043 from undingen/AddPotentialRoot
add PyGC_AddPotentialRoot
parents
110eaaea
8f6c8e44
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
from_cpython/Include/Python.h
from_cpython/Include/Python.h
+1
-0
src/gc/collector.cpp
src/gc/collector.cpp
+13
-1
src/runtime/import.cpp
src/runtime/import.cpp
+1
-5
No files found.
from_cpython/Include/Python.h
View file @
b3bacb8f
...
...
@@ -173,6 +173,7 @@ PyObject* PyGC_AddRoot(PyObject*) PYSTON_NOEXCEPT;
// a temporary patching mechanism - we want to have a better way of dealing with such objects
// in the future (even if it's an invalid use of CPython APIs).
PyObject
*
PyGC_AddNonHeapRoot
(
PyObject
*
obj
,
int
size
)
PYSTON_NOEXCEPT
;
void
*
PyGC_AddPotentialRoot
(
void
*
obj
,
int
size
)
PYSTON_NOEXCEPT
;
// Pyston change : expose these type objects
extern
PyTypeObject
Pattern_Type
;
...
...
src/gc/collector.cpp
View file @
b3bacb8f
...
...
@@ -311,7 +311,13 @@ void deregisterPermanentRoot(void* obj) {
}
void
registerPotentialRootRange
(
void
*
start
,
void
*
end
)
{
potential_root_ranges
.
push_back
(
std
::
make_pair
(
start
,
end
));
// only track void* aligned memory
uintptr_t
end_int
=
(
uintptr_t
)
end
;
end_int
=
(
end_int
+
(
sizeof
(
void
*
)
-
1
))
&
~
(
sizeof
(
void
*
)
-
1
);
end_int
-=
end_int
%
sizeof
(
void
*
);
if
(
end_int
>
(
uintptr_t
)
start
)
potential_root_ranges
.
push_back
(
std
::
make_pair
(
start
,
(
void
*
)
end_int
));
}
extern
"C"
PyObject
*
PyGC_AddRoot
(
PyObject
*
obj
)
noexcept
{
...
...
@@ -330,6 +336,12 @@ extern "C" PyObject* PyGC_AddNonHeapRoot(PyObject* obj, int size) noexcept {
return
obj
;
}
extern
"C"
void
*
PyGC_AddPotentialRoot
(
void
*
obj
,
int
size
)
noexcept
{
if
(
obj
)
registerPotentialRootRange
(
obj
,
(
char
*
)
obj
+
size
);
return
obj
;
}
void
registerNonheapRootObject
(
void
*
obj
,
int
size
)
{
// I suppose that things could work fine even if this were true, but why would it happen?
assert
(
global_heap
.
getAllocationFromInteriorPointer
(
obj
)
==
NULL
);
...
...
src/runtime/import.cpp
View file @
b3bacb8f
...
...
@@ -870,12 +870,8 @@ static void registerDataSegment(void* dl_handle) {
gc
::
registerPotentialRootRange
((
void
*
)
r
.
first
,
(
void
*
)
r
.
second
);
}
if
(
should_add_bss
)
{
// only track void* aligned memory
bss_start
=
(
bss_start
+
(
sizeof
(
void
*
)
-
1
))
&
~
(
sizeof
(
void
*
)
-
1
);
bss_end
-=
bss_end
%
sizeof
(
void
*
);
if
(
should_add_bss
)
gc
::
registerPotentialRootRange
((
void
*
)
bss_start
,
(
void
*
)
bss_end
);
}
}
BoxedModule
*
importCExtension
(
BoxedString
*
full_name
,
const
std
::
string
&
last_name
,
const
std
::
string
&
path
)
{
...
...
Boxiang Sun
@Daetalus
mentioned in commit
fb776858
·
Sep 08, 2016
mentioned in commit
fb776858
mentioned in commit fb77685860a44292e5c656bef2392d2e7ce852df
Toggle commit list
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