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
b8461c86
Commit
b8461c86
authored
Apr 03, 2017
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect ensure clause lambdas from GC; fix #3491
parent
6a992a25
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
src/gc.c
src/gc.c
+3
-5
src/vm.c
src/vm.c
+2
-1
No files found.
src/gc.c
View file @
b8461c86
...
@@ -565,7 +565,7 @@ mark_context_stack(mrb_state *mrb, struct mrb_context *c)
...
@@ -565,7 +565,7 @@ mark_context_stack(mrb_state *mrb, struct mrb_context *c)
static
void
static
void
mark_context
(
mrb_state
*
mrb
,
struct
mrb_context
*
c
)
mark_context
(
mrb_state
*
mrb
,
struct
mrb_context
*
c
)
{
{
int
i
,
e
=
0
;
int
i
;
mrb_callinfo
*
ci
;
mrb_callinfo
*
ci
;
/* mark stack */
/* mark stack */
...
@@ -574,16 +574,14 @@ mark_context(mrb_state *mrb, struct mrb_context *c)
...
@@ -574,16 +574,14 @@ mark_context(mrb_state *mrb, struct mrb_context *c)
/* mark VM stack */
/* mark VM stack */
if
(
c
->
cibase
)
{
if
(
c
->
cibase
)
{
for
(
ci
=
c
->
cibase
;
ci
<=
c
->
ci
;
ci
++
)
{
for
(
ci
=
c
->
cibase
;
ci
<=
c
->
ci
;
ci
++
)
{
if
(
ci
->
eidx
>
e
)
{
e
=
ci
->
eidx
;
}
mrb_gc_mark
(
mrb
,
(
struct
RBasic
*
)
ci
->
env
);
mrb_gc_mark
(
mrb
,
(
struct
RBasic
*
)
ci
->
env
);
mrb_gc_mark
(
mrb
,
(
struct
RBasic
*
)
ci
->
proc
);
mrb_gc_mark
(
mrb
,
(
struct
RBasic
*
)
ci
->
proc
);
mrb_gc_mark
(
mrb
,
(
struct
RBasic
*
)
ci
->
target_class
);
mrb_gc_mark
(
mrb
,
(
struct
RBasic
*
)
ci
->
target_class
);
}
}
}
}
/* mark ensure stack */
/* mark ensure stack */
for
(
i
=
0
;
i
<
e
;
i
++
)
{
for
(
i
=
0
;
i
<
c
->
esize
;
i
++
)
{
if
(
c
->
ensure
[
i
]
==
NULL
)
break
;
mrb_gc_mark
(
mrb
,
(
struct
RBasic
*
)
c
->
ensure
[
i
]);
mrb_gc_mark
(
mrb
,
(
struct
RBasic
*
)
c
->
ensure
[
i
]);
}
}
/* mark fibers */
/* mark fibers */
...
...
src/vm.c
View file @
b8461c86
...
@@ -296,6 +296,7 @@ ecall(mrb_state *mrb, int i)
...
@@ -296,6 +296,7 @@ ecall(mrb_state *mrb, int i)
}
}
p
=
mrb
->
c
->
ensure
[
i
];
p
=
mrb
->
c
->
ensure
[
i
];
if
(
!
p
)
return
;
if
(
!
p
)
return
;
mrb
->
c
->
ensure
[
i
]
=
NULL
;
if
(
mrb
->
c
->
ci
->
eidx
>
i
)
if
(
mrb
->
c
->
ci
->
eidx
>
i
)
mrb
->
c
->
ci
->
eidx
=
i
;
mrb
->
c
->
ci
->
eidx
=
i
;
cioff
=
mrb
->
c
->
ci
-
mrb
->
c
->
cibase
;
cioff
=
mrb
->
c
->
ci
-
mrb
->
c
->
cibase
;
...
@@ -310,7 +311,6 @@ ecall(mrb_state *mrb, int i)
...
@@ -310,7 +311,6 @@ ecall(mrb_state *mrb, int i)
mrb
->
c
->
stack
=
mrb
->
c
->
stack
+
ci
[
-
1
].
nregs
;
mrb
->
c
->
stack
=
mrb
->
c
->
stack
+
ci
[
-
1
].
nregs
;
exc
=
mrb
->
exc
;
mrb
->
exc
=
0
;
exc
=
mrb
->
exc
;
mrb
->
exc
=
0
;
mrb_run
(
mrb
,
p
,
*
self
);
mrb_run
(
mrb
,
p
,
*
self
);
mrb
->
c
->
ensure
[
i
]
=
NULL
;
mrb
->
c
->
ci
=
mrb
->
c
->
cibase
+
cioff
;
mrb
->
c
->
ci
=
mrb
->
c
->
cibase
+
cioff
;
if
(
!
mrb
->
exc
)
mrb
->
exc
=
exc
;
if
(
!
mrb
->
exc
)
mrb
->
exc
=
exc
;
}
}
...
@@ -1148,6 +1148,7 @@ RETRY_TRY_BLOCK:
...
@@ -1148,6 +1148,7 @@ RETRY_TRY_BLOCK:
mrb
->
c
->
ensure
=
(
struct
RProc
**
)
mrb_realloc
(
mrb
,
mrb
->
c
->
ensure
,
sizeof
(
struct
RProc
*
)
*
mrb
->
c
->
esize
);
mrb
->
c
->
ensure
=
(
struct
RProc
**
)
mrb_realloc
(
mrb
,
mrb
->
c
->
ensure
,
sizeof
(
struct
RProc
*
)
*
mrb
->
c
->
esize
);
}
}
mrb
->
c
->
ensure
[
mrb
->
c
->
ci
->
eidx
++
]
=
p
;
mrb
->
c
->
ensure
[
mrb
->
c
->
ci
->
eidx
++
]
=
p
;
mrb
->
c
->
ensure
[
mrb
->
c
->
ci
->
eidx
]
=
NULL
;
ARENA_RESTORE
(
mrb
,
ai
);
ARENA_RESTORE
(
mrb
,
ai
);
NEXT
;
NEXT
;
}
}
...
...
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