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
2083d993
Unverified
Commit
2083d993
authored
Sep 20, 2021
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
codegen.c: check `no_peephole(s)` before `mrb_last_insn(s)`.
parent
f85c5054
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
+14
-10
No files found.
mrbgems/mruby-compiler/core/codegen.c
View file @
2083d993
...
...
@@ -653,10 +653,12 @@ gen_getupvar(codegen_scope *s, uint16_t dst, mrb_sym id)
int
idx
;
int
lv
=
search_upvar
(
s
,
id
,
&
idx
);
struct
mrb_insn_data
data
=
mrb_last_insn
(
s
);
if
(
!
no_peephole
(
s
)
&&
data
.
insn
==
OP_SETUPVAR
&&
data
.
a
==
dst
&&
data
.
b
==
idx
&&
data
.
c
==
lv
)
{
/* skip GETUPVAR right after SETUPVAR */
return
;
if
(
!
no_peephole
(
s
))
{
struct
mrb_insn_data
data
=
mrb_last_insn
(
s
);
if
(
data
.
insn
==
OP_SETUPVAR
&&
data
.
a
==
dst
&&
data
.
b
==
idx
&&
data
.
c
==
lv
)
{
/* skip GETUPVAR right after SETUPVAR */
return
;
}
}
genop_3
(
s
,
OP_GETUPVAR
,
dst
,
idx
,
lv
);
}
...
...
@@ -667,10 +669,12 @@ gen_setupvar(codegen_scope *s, uint16_t dst, mrb_sym id)
int
idx
;
int
lv
=
search_upvar
(
s
,
id
,
&
idx
);
struct
mrb_insn_data
data
=
mrb_last_insn
(
s
);
if
(
!
no_peephole
(
s
)
&&
data
.
insn
==
OP_MOVE
&&
data
.
a
==
dst
)
{
dst
=
data
.
b
;
rewind_pc
(
s
);
if
(
!
no_peephole
(
s
))
{
struct
mrb_insn_data
data
=
mrb_last_insn
(
s
);
if
(
data
.
insn
==
OP_MOVE
&&
data
.
a
==
dst
)
{
dst
=
data
.
b
;
rewind_pc
(
s
);
}
}
genop_3
(
s
,
OP_SETUPVAR
,
dst
,
idx
,
lv
);
}
...
...
@@ -1091,9 +1095,9 @@ static void
gen_setxv
(
codegen_scope
*
s
,
uint8_t
op
,
uint16_t
dst
,
mrb_sym
sym
,
int
val
)
{
int
idx
=
new_sym
(
s
,
sym
);
if
(
!
val
)
{
if
(
!
val
&&
!
no_peephole
(
s
)
)
{
struct
mrb_insn_data
data
=
mrb_last_insn
(
s
);
if
(
!
no_peephole
(
s
)
&&
data
.
insn
==
OP_MOVE
&&
data
.
a
==
dst
)
{
if
(
data
.
insn
==
OP_MOVE
&&
data
.
a
==
dst
)
{
dst
=
data
.
b
;
rewind_pc
(
s
);
}
...
...
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