Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
f7782f80
Commit
f7782f80
authored
Dec 16, 2015
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py/gc: For finaliser, interpret a pointer into the heap as concrete obj.
parent
969e4bbe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
py/gc.c
py/gc.c
+4
-4
No files found.
py/gc.c
View file @
f7782f80
...
...
@@ -230,16 +230,16 @@ STATIC void gc_sweep(void) {
#endif
// free unmarked heads and their tails
int
free_tail
=
0
;
for
(
mp_uint
_t
block
=
0
;
block
<
MP_STATE_MEM
(
gc_alloc_table_byte_len
)
*
BLOCKS_PER_ATB
;
block
++
)
{
for
(
size
_t
block
=
0
;
block
<
MP_STATE_MEM
(
gc_alloc_table_byte_len
)
*
BLOCKS_PER_ATB
;
block
++
)
{
switch
(
ATB_GET_KIND
(
block
))
{
case
AT_HEAD
:
#if MICROPY_ENABLE_FINALISER
if
(
FTB_GET
(
block
))
{
mp_obj_
t
obj
=
(
mp_obj_t
)
PTR_FROM_BLOCK
(
block
);
if
(
((
mp_obj_base_t
*
)
MP_OBJ_TO_PTR
(
obj
))
->
type
!=
NULL
)
{
mp_obj_
base_t
*
obj
=
(
mp_obj_base_t
*
)
PTR_FROM_BLOCK
(
block
);
if
(
obj
->
type
!=
NULL
)
{
// if the object has a type then see if it has a __del__ method
mp_obj_t
dest
[
2
];
mp_load_method_maybe
(
obj
,
MP_QSTR___del__
,
dest
);
mp_load_method_maybe
(
MP_OBJ_FROM_PTR
(
obj
)
,
MP_QSTR___del__
,
dest
);
if
(
dest
[
0
]
!=
MP_OBJ_NULL
)
{
// load_method returned a method
mp_call_method_n_kw
(
0
,
0
,
dest
);
...
...
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