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
fca17b41
Commit
fca17b41
authored
Mar 17, 2017
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid trampoline when #eval is called from mrb_funcall(); fix #3522
parent
9ecebebf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
5 deletions
+18
-5
mrbgems/mruby-eval/src/eval.c
mrbgems/mruby-eval/src/eval.c
+18
-5
No files found.
mrbgems/mruby-eval/src/eval.c
View file @
fca17b41
...
...
@@ -133,7 +133,9 @@ patch_irep(mrb_state *mrb, mrb_irep *irep, int bnest)
break
;
case
OP_STOP
:
irep
->
iseq
[
i
]
=
MKOP_AB
(
OP_RETURN
,
irep
->
nlocals
,
OP_R_NORMAL
);
if
(
mrb
->
c
->
ci
->
acc
>=
0
)
{
irep
->
iseq
[
i
]
=
MKOP_AB
(
OP_RETURN
,
irep
->
nlocals
,
OP_R_NORMAL
);
}
break
;
}
}
...
...
@@ -209,6 +211,19 @@ create_proc_from_string(mrb_state *mrb, char *s, int len, mrb_value binding, con
return
proc
;
}
static
mrb_value
exec_irep
(
mrb_state
*
mrb
,
mrb_value
self
,
struct
RProc
*
proc
)
{
if
(
mrb
->
c
->
ci
->
acc
<
0
)
{
mrb_value
ret
=
mrb_top_run
(
mrb
,
proc
,
mrb
->
c
->
stack
[
0
],
0
);
if
(
mrb
->
exc
)
{
mrb_exc_raise
(
mrb
,
mrb_obj_value
(
mrb
->
exc
));
}
return
ret
;
}
return
mrb_exec_irep
(
mrb
,
self
,
proc
);
}
static
mrb_value
f_eval
(
mrb_state
*
mrb
,
mrb_value
self
)
{
...
...
@@ -223,11 +238,9 @@ f_eval(mrb_state *mrb, mrb_value self)
proc
=
create_proc_from_string
(
mrb
,
s
,
len
,
binding
,
file
,
line
);
mrb_assert
(
!
MRB_PROC_CFUNC_P
(
proc
));
return
mrb_
exec_irep
(
mrb
,
self
,
proc
);
return
exec_irep
(
mrb
,
self
,
proc
);
}
#define CI_ACC_SKIP -1
static
mrb_value
f_instance_eval
(
mrb_state
*
mrb
,
mrb_value
self
)
{
...
...
@@ -250,7 +263,7 @@ f_instance_eval(mrb_state *mrb, mrb_value self)
proc
->
target_class
=
mrb_class_ptr
(
cv
);
mrb
->
c
->
ci
->
env
=
NULL
;
mrb_assert
(
!
MRB_PROC_CFUNC_P
(
proc
));
return
mrb_
exec_irep
(
mrb
,
self
,
proc
);
return
exec_irep
(
mrb
,
self
,
proc
);
}
else
{
mrb_get_args
(
mrb
,
"&"
,
&
b
);
...
...
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