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
d5dd3e94
Commit
d5dd3e94
authored
Jul 15, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fiber stack allocation size should be bigger than irep->nregs
parent
472a1c24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
mrbgems/mruby-fiber/src/fiber.c
mrbgems/mruby-fiber/src/fiber.c
+9
-4
No files found.
mrbgems/mruby-fiber/src/fiber.c
View file @
d5dd3e94
...
@@ -69,6 +69,7 @@ fiber_init(mrb_state *mrb, mrb_value self)
...
@@ -69,6 +69,7 @@ fiber_init(mrb_state *mrb, mrb_value self)
struct
RProc
*
p
;
struct
RProc
*
p
;
mrb_callinfo
*
ci
;
mrb_callinfo
*
ci
;
mrb_value
blk
;
mrb_value
blk
;
size_t
slen
;
mrb_get_args
(
mrb
,
"&"
,
&
blk
);
mrb_get_args
(
mrb
,
"&"
,
&
blk
);
...
@@ -85,14 +86,18 @@ fiber_init(mrb_state *mrb, mrb_value self)
...
@@ -85,14 +86,18 @@ fiber_init(mrb_state *mrb, mrb_value self)
c
=
f
->
cxt
;
c
=
f
->
cxt
;
/* initialize VM stack */
/* initialize VM stack */
c
->
stbase
=
(
mrb_value
*
)
mrb_malloc
(
mrb
,
FIBER_STACK_INIT_SIZE
*
sizeof
(
mrb_value
));
slen
=
FIBER_STACK_INIT_SIZE
;
c
->
stend
=
c
->
stbase
+
FIBER_STACK_INIT_SIZE
;
if
(
p
->
body
.
irep
->
nregs
>
slen
)
{
slen
+=
p
->
body
.
irep
->
nregs
;
}
c
->
stbase
=
(
mrb_value
*
)
mrb_malloc
(
mrb
,
slen
*
sizeof
(
mrb_value
));
c
->
stend
=
c
->
stbase
+
slen
;
c
->
stack
=
c
->
stbase
;
c
->
stack
=
c
->
stbase
;
#ifdef MRB_NAN_BOXING
#ifdef MRB_NAN_BOXING
{
{
mrb_value
*
p
=
c
->
stbase
;
mrb_value
*
p
=
c
->
stbase
;
mrb_value
*
pend
=
p
+
FIBER_STACK_INIT_SIZE
;
mrb_value
*
pend
=
c
->
stend
;
while
(
p
<
pend
)
{
while
(
p
<
pend
)
{
SET_NIL_VALUE
(
*
p
);
SET_NIL_VALUE
(
*
p
);
...
@@ -100,7 +105,7 @@ fiber_init(mrb_state *mrb, mrb_value self)
...
@@ -100,7 +105,7 @@ fiber_init(mrb_state *mrb, mrb_value self)
}
}
}
}
#else
#else
memset
(
c
->
stbase
,
0
,
FIBER_STACK_INIT_SIZE
*
sizeof
(
mrb_value
));
memset
(
c
->
stbase
,
0
,
slen
*
sizeof
(
mrb_value
));
#endif
#endif
/* copy receiver from a block */
/* copy receiver from a block */
...
...
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