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
6ee86476
Commit
6ee86476
authored
Nov 13, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor: call this _doFree helper from this other path
parent
afea84fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
10 deletions
+19
-10
src/gc/heap.cpp
src/gc/heap.cpp
+12
-10
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+6
-0
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+1
-0
No files found.
src/gc/heap.cpp
View file @
6ee86476
...
...
@@ -312,7 +312,19 @@ static void _freeLargeObj(LargeObj* lobj) {
assert
(
r
==
0
);
}
static
void
_doFree
(
GCAllocation
*
al
)
{
if
(
VERBOSITY
()
>=
2
)
printf
(
"Freeing %p
\n
"
,
al
->
user_data
);
if
(
al
->
kind_id
==
GCKind
::
PYTHON
)
{
Box
*
b
=
(
Box
*
)
al
->
user_data
;
ASSERT
(
b
->
cls
->
tp_dealloc
==
NULL
,
"%s"
,
getTypeName
(
b
)
->
c_str
());
}
}
void
Heap
::
free
(
GCAllocation
*
al
)
{
_doFree
(
al
);
if
(
large_arena
.
contains
(
al
))
{
LargeObj
*
lobj
=
LargeObj
::
fromAllocation
(
al
);
_freeLargeObj
(
lobj
);
...
...
@@ -394,16 +406,6 @@ GCAllocation* Heap::getAllocationFromInteriorPointer(void* ptr) {
return
reinterpret_cast
<
GCAllocation
*>
(
&
b
->
atoms
[
atom_idx
]);
}
static
void
_doFree
(
GCAllocation
*
al
)
{
if
(
VERBOSITY
()
>=
2
)
printf
(
"Freeing %p
\n
"
,
al
->
user_data
);
if
(
al
->
kind_id
==
GCKind
::
PYTHON
)
{
Box
*
b
=
(
Box
*
)
al
->
user_data
;
ASSERT
(
b
->
cls
->
tp_dealloc
==
NULL
,
"%s"
,
getTypeName
(
b
)
->
c_str
());
}
}
static
Block
**
freeChain
(
Block
**
head
)
{
while
(
Block
*
b
=
*
head
)
{
int
num_objects
=
b
->
numObjects
();
...
...
src/runtime/builtin_modules/builtins.cpp
View file @
6ee86476
...
...
@@ -671,6 +671,11 @@ Box* print(BoxedTuple* args, BoxedDict* kwargs) {
return
None
;
}
Box
*
pydump
(
void
*
p
)
{
dump
(
p
);
return
None
;
}
void
setupBuiltins
()
{
builtins_module
=
createModule
(
"__builtin__"
,
"__builtin__"
);
...
...
@@ -749,6 +754,7 @@ void setupBuiltins() {
builtins_module
->
giveAttr
(
"ord"
,
ord_obj
);
trap_obj
=
new
BoxedFunction
(
boxRTFunction
((
void
*
)
trap
,
UNKNOWN
,
0
));
builtins_module
->
giveAttr
(
"trap"
,
trap_obj
);
builtins_module
->
giveAttr
(
"dump"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
pydump
,
UNKNOWN
,
1
)));
builtins_module
->
giveAttr
(
"getattr"
,
new
BoxedFunction
(
boxRTFunction
((
void
*
)
getattrFunc
,
UNKNOWN
,
3
,
1
,
false
,
false
),
{
NULL
}));
...
...
src/runtime/objmodel.cpp
View file @
6ee86476
...
...
@@ -1821,6 +1821,7 @@ extern "C" i64 unboxedLen(Box* obj) {
extern
"C"
void
dump
(
void
*
p
)
{
printf
(
"
\n
"
);
printf
(
"Raw address: %p
\n
"
,
p
);
bool
is_gc
=
(
gc
::
global_heap
.
getAllocationFromInteriorPointer
(
p
)
!=
NULL
);
if
(
!
is_gc
)
{
printf
(
"non-gc memory
\n
"
);
...
...
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