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
036b78df
Commit
036b78df
authored
Dec 10, 2012
by
Jan Berdajs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor OP_RETURN switch to remove a redundant label and avoid goto
parent
ce56f19b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
22 deletions
+20
-22
src/vm.c
src/vm.c
+20
-22
No files found.
src/vm.c
View file @
036b78df
...
@@ -1184,8 +1184,19 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
...
@@ -1184,8 +1184,19 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
mrb_value
v
=
regs
[
GETARG_A
(
i
)];
mrb_value
v
=
regs
[
GETARG_A
(
i
)];
switch
(
GETARG_B
(
i
))
{
switch
(
GETARG_B
(
i
))
{
case
OP_R_RETURN
:
// Fall through to OP_R_NORMAL otherwise
if
(
proc
->
env
&&
!
MRB_PROC_STRICT_P
(
proc
))
{
struct
REnv
*
e
=
top_env
(
mrb
,
proc
);
if
(
e
->
cioff
<
0
)
{
localjump_error
(
mrb
,
"return"
);
goto
L_RAISE
;
}
ci
=
mrb
->
ci
=
mrb
->
cibase
+
e
->
cioff
;
break
;
}
case
OP_R_NORMAL
:
case
OP_R_NORMAL
:
NORMAL_RETURN:
if
(
ci
==
mrb
->
cibase
)
{
if
(
ci
==
mrb
->
cibase
)
{
localjump_error
(
mrb
,
"return"
);
localjump_error
(
mrb
,
"return"
);
goto
L_RAISE
;
goto
L_RAISE
;
...
@@ -1199,19 +1210,6 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
...
@@ -1199,19 +1210,6 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
}
}
ci
=
mrb
->
ci
=
mrb
->
cibase
+
proc
->
env
->
cioff
+
1
;
ci
=
mrb
->
ci
=
mrb
->
cibase
+
proc
->
env
->
cioff
+
1
;
break
;
break
;
case
OP_R_RETURN
:
if
(
!
proc
->
env
)
goto
NORMAL_RETURN
;
if
(
MRB_PROC_STRICT_P
(
proc
))
goto
NORMAL_RETURN
;
else
{
struct
REnv
*
e
=
top_env
(
mrb
,
proc
);
if
(
e
->
cioff
<
0
)
{
localjump_error
(
mrb
,
"return"
);
goto
L_RAISE
;
}
ci
=
mrb
->
ci
=
mrb
->
cibase
+
e
->
cioff
;
}
break
;
default:
default:
/* cannot happen */
/* cannot happen */
break
;
break
;
...
...
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