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
eb5a606f
Commit
eb5a606f
authored
Jun 01, 2017
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify rescue stack management; ref #3683
parent
7ff90b52
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
14 deletions
+12
-14
include/mruby.h
include/mruby.h
+2
-2
src/vm.c
src/vm.c
+10
-12
No files found.
include/mruby.h
View file @
eb5a606f
...
...
@@ -112,7 +112,7 @@ typedef struct {
struct
RProc
*
proc
;
mrb_value
*
stackent
;
int
nregs
;
int
r
idx
;
int
r
pos
;
int
epos
;
struct
REnv
*
env
;
mrb_code
*
pc
;
/* return address */
...
...
@@ -141,7 +141,7 @@ struct mrb_context {
mrb_callinfo
*
cibase
,
*
ciend
;
mrb_code
**
rescue
;
/* exception handler stack */
int
rsize
;
int
rsize
,
ridx
;
struct
RProc
**
ensure
;
/* ensure handler stack */
int
esize
,
eidx
;
...
...
src/vm.c
View file @
eb5a606f
...
...
@@ -234,8 +234,6 @@ cipush(mrb_state *mrb)
struct
mrb_context
*
c
=
mrb
->
c
;
mrb_callinfo
*
ci
=
c
->
ci
;
int
ridx
=
ci
->
ridx
;
if
(
ci
+
1
==
c
->
ciend
)
{
ptrdiff_t
size
=
ci
-
c
->
cibase
;
...
...
@@ -245,7 +243,7 @@ cipush(mrb_state *mrb)
}
ci
=
++
c
->
ci
;
ci
->
epos
=
mrb
->
c
->
eidx
;
ci
->
r
idx
=
ridx
;
ci
->
r
pos
=
mrb
->
c
->
ridx
;
ci
->
env
=
0
;
ci
->
pc
=
0
;
ci
->
err
=
0
;
...
...
@@ -1125,12 +1123,12 @@ RETRY_TRY_BLOCK:
CASE
(
OP_ONERR
)
{
/* sBx pc+=sBx on exception */
if
(
mrb
->
c
->
rsize
<=
mrb
->
c
->
ci
->
ridx
)
{
if
(
mrb
->
c
->
rsize
<=
mrb
->
c
->
ridx
)
{
if
(
mrb
->
c
->
rsize
==
0
)
mrb
->
c
->
rsize
=
RESCUE_STACK_INIT_SIZE
;
else
mrb
->
c
->
rsize
*=
2
;
mrb
->
c
->
rescue
=
(
mrb_code
**
)
mrb_realloc
(
mrb
,
mrb
->
c
->
rescue
,
sizeof
(
mrb_code
*
)
*
mrb
->
c
->
rsize
);
}
mrb
->
c
->
rescue
[
mrb
->
c
->
ci
->
ridx
++
]
=
pc
+
GETARG_sBx
(
i
);
mrb
->
c
->
rescue
[
mrb
->
c
->
ridx
++
]
=
pc
+
GETARG_sBx
(
i
);
NEXT
;
}
...
...
@@ -1180,7 +1178,7 @@ RETRY_TRY_BLOCK:
int
a
=
GETARG_A
(
i
);
while
(
a
--
)
{
mrb
->
c
->
ci
->
ridx
--
;
mrb
->
c
->
ridx
--
;
}
NEXT
;
}
...
...
@@ -1757,11 +1755,11 @@ RETRY_TRY_BLOCK:
L_RAISE:
ci0
=
ci
=
mrb
->
c
->
ci
;
if
(
ci
==
mrb
->
c
->
cibase
)
{
if
(
ci
->
ridx
==
0
)
goto
L_FTOP
;
if
(
mrb
->
c
->
ridx
==
0
)
goto
L_FTOP
;
goto
L_RESCUE
;
}
stk
=
mrb
->
c
->
stack
;
while
(
ci
[
0
].
ridx
==
ci
[
-
1
].
ridx
)
{
while
(
mrb
->
c
->
ridx
==
ci
->
rpos
)
{
cipop
(
mrb
);
mrb
->
c
->
stack
=
ci
->
stackent
;
if
(
ci
->
acc
==
CI_ACC_SKIP
&&
prev_jmp
)
{
...
...
@@ -1771,7 +1769,7 @@ RETRY_TRY_BLOCK:
ci
=
mrb
->
c
->
ci
;
if
(
ci
==
mrb
->
c
->
cibase
)
{
mrb
->
c
->
stack
=
stk
;
if
(
ci
->
ridx
==
0
)
{
if
(
mrb
->
c
->
ridx
==
0
)
{
L_FTOP:
/* fiber top */
if
(
mrb
->
c
==
mrb
->
root_c
)
{
mrb
->
c
->
stack
=
mrb
->
c
->
stbase
;
...
...
@@ -1788,7 +1786,7 @@ RETRY_TRY_BLOCK:
break
;
}
/* call ensure only when we skip this callinfo */
if
(
ci
[
0
].
ridx
==
ci
[
-
1
].
ridx
)
{
if
(
mrb
->
c
->
ridx
==
ci
->
rpos
)
{
while
(
mrb
->
c
->
eidx
>
ci
->
epos
)
{
ecall
(
mrb
,
--
mrb
->
c
->
eidx
);
ci
=
mrb
->
c
->
ci
;
...
...
@@ -1796,7 +1794,7 @@ RETRY_TRY_BLOCK:
}
}
L_RESCUE:
if
(
ci
->
ridx
==
0
)
goto
L_STOP
;
if
(
mrb
->
c
->
ridx
==
0
)
goto
L_STOP
;
proc
=
ci
->
proc
;
irep
=
proc
->
body
.
irep
;
pool
=
irep
->
pool
;
...
...
@@ -1804,7 +1802,7 @@ RETRY_TRY_BLOCK:
if
(
ci
!=
ci0
)
{
mrb
->
c
->
stack
=
ci
[
1
].
stackent
;
}
pc
=
mrb
->
c
->
rescue
[
--
ci
->
ridx
];
pc
=
mrb
->
c
->
rescue
[
--
mrb
->
c
->
ridx
];
}
else
{
mrb_callinfo
*
ci
=
mrb
->
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