Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
3531fe17
Commit
3531fe17
authored
Dec 31, 2015
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GC must scan env from fibers even when it's not yet copied to heap; fix #3063
parent
4fdec33f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
20 deletions
+33
-20
include/mruby/proc.h
include/mruby/proc.h
+2
-0
src/gc.c
src/gc.c
+16
-10
src/vm.c
src/vm.c
+15
-10
No files found.
include/mruby/proc.h
View file @
3531fe17
...
...
@@ -27,6 +27,8 @@ struct REnv {
#define MRB_ENV_UNSHARE_STACK(e) ((e)->cioff = -1)
#define MRB_ENV_STACK_SHARED_P(e) ((e)->cioff >= 0)
MRB_API
void
mrb_env_unshare
(
mrb_state
*
,
struct
REnv
*
);
struct
RProc
{
MRB_OBJECT_HEADER
;
union
{
...
...
src/gc.c
View file @
3531fe17
...
...
@@ -613,14 +613,11 @@ gc_mark_children(mrb_state *mrb, mrb_gc *gc, struct RBasic *obj)
case
MRB_TT_ENV
:
{
struct
REnv
*
e
=
(
struct
REnv
*
)
obj
;
mrb_int
i
,
len
;
if
(
!
MRB_ENV_STACK_SHARED_P
(
e
))
{
mrb_int
i
,
len
;
len
=
MRB_ENV_STACK_LEN
(
e
);
for
(
i
=
0
;
i
<
len
;
i
++
)
{
mrb_gc_mark_value
(
mrb
,
e
->
stack
[
i
]);
}
len
=
MRB_ENV_STACK_LEN
(
e
);
for
(
i
=
0
;
i
<
len
;
i
++
)
{
mrb_gc_mark_value
(
mrb
,
e
->
stack
[
i
]);
}
}
break
;
...
...
@@ -725,9 +722,18 @@ obj_free(mrb_state *mrb, struct RBasic *obj)
case
MRB_TT_FIBER
:
{
struct
mrb_context
*
c
=
((
struct
RFiber
*
)
obj
)
->
cxt
;
if
(
c
!=
mrb
->
root_c
)
mrb_free_context
(
mrb
,
c
);
if
(
c
&&
c
!=
mrb
->
root_c
)
{
mrb_callinfo
*
ci
=
c
->
ci
;
mrb_callinfo
*
ce
=
c
->
cibase
;
while
(
ce
<=
ci
)
{
struct
REnv
*
e
=
ci
->
env
;
if
(
e
&&
!
is_dead
(
&
mrb
->
gc
,
e
)
&&
MRB_ENV_STACK_SHARED_P
(
e
))
{
mrb_env_unshare
(
mrb
,
e
);
}
ci
--
;
}
}
}
break
;
...
...
src/vm.c
View file @
3531fe17
...
...
@@ -237,22 +237,27 @@ cipush(mrb_state *mrb)
return
ci
;
}
MRB_API
void
mrb_env_unshare
(
mrb_state
*
mrb
,
struct
REnv
*
e
)
{
size_t
len
=
(
size_t
)
MRB_ENV_STACK_LEN
(
e
);
mrb_value
*
p
=
(
mrb_value
*
)
mrb_malloc
(
mrb
,
sizeof
(
mrb_value
)
*
len
);
MRB_ENV_UNSHARE_STACK
(
e
);
if
(
len
>
0
)
{
stack_copy
(
p
,
e
->
stack
,
len
);
}
e
->
stack
=
p
;
mrb_write_barrier
(
mrb
,
(
struct
RBasic
*
)
e
);
}
static
void
cipop
(
mrb_state
*
mrb
)
{
struct
mrb_context
*
c
=
mrb
->
c
;
if
(
c
->
ci
->
env
)
{
struct
REnv
*
e
=
c
->
ci
->
env
;
size_t
len
=
(
size_t
)
MRB_ENV_STACK_LEN
(
e
);
mrb_value
*
p
=
(
mrb_value
*
)
mrb_malloc
(
mrb
,
sizeof
(
mrb_value
)
*
len
);
MRB_ENV_UNSHARE_STACK
(
e
);
if
(
len
>
0
)
{
stack_copy
(
p
,
e
->
stack
,
len
);
}
e
->
stack
=
p
;
mrb_write_barrier
(
mrb
,
(
struct
RBasic
*
)
e
);
mrb_env_unshare
(
mrb
,
c
->
ci
->
env
);
}
c
->
ci
--
;
...
...
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