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
69da192e
Unverified
Commit
69da192e
authored
Sep 10, 2021
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
codegen.c: `gen_move` refactoring.
parent
7df31d94
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
+6
-6
No files found.
mrbgems/mruby-compiler/core/codegen.c
View file @
69da192e
...
...
@@ -572,7 +572,7 @@ static void gen_int(codegen_scope *s, uint16_t dst, mrb_int i);
static
void
gen_move
(
codegen_scope
*
s
,
uint16_t
dst
,
uint16_t
src
,
int
nopeep
)
{
if
(
no_peephole
(
s
))
goto
normal
;
if
(
no
peep
||
no
_peephole
(
s
))
goto
normal
;
else
{
struct
mrb_insn_data
data
=
mrb_last_insn
(
s
);
...
...
@@ -586,7 +586,7 @@ gen_move(codegen_scope *s, uint16_t dst, uint16_t src, int nopeep)
case
OP_LOADI__1
:
case
OP_LOADI_0
:
case
OP_LOADI_1
:
case
OP_LOADI_2
:
case
OP_LOADI_3
:
case
OP_LOADI_4
:
case
OP_LOADI_5
:
case
OP_LOADI_6
:
case
OP_LOADI_7
:
if
(
nopeep
||
data
.
a
!=
src
||
data
.
a
<
s
->
nlocals
)
goto
normal
;
if
(
data
.
a
!=
src
||
data
.
a
<
s
->
nlocals
)
goto
normal
;
rewind_pc
(
s
);
genop_1
(
s
,
data
.
insn
,
dst
);
return
;
...
...
@@ -595,17 +595,17 @@ gen_move(codegen_scope *s, uint16_t dst, uint16_t src, int nopeep)
case
OP_GETGV
:
case
OP_GETSV
:
case
OP_GETIV
:
case
OP_GETCV
:
case
OP_GETCONST
:
case
OP_STRING
:
case
OP_LAMBDA
:
case
OP_BLOCK
:
case
OP_METHOD
:
case
OP_BLKPUSH
:
if
(
nopeep
||
data
.
a
!=
src
||
data
.
a
<
s
->
nlocals
)
goto
normal
;
if
(
data
.
a
!=
src
||
data
.
a
<
s
->
nlocals
)
goto
normal
;
rewind_pc
(
s
);
genop_2
(
s
,
data
.
insn
,
dst
,
data
.
b
);
return
;
case
OP_GETUPVAR
:
if
(
nopeep
||
data
.
a
!=
src
||
data
.
a
<
s
->
nlocals
)
goto
normal
;
if
(
data
.
a
!=
src
||
data
.
a
<
s
->
nlocals
)
goto
normal
;
rewind_pc
(
s
);
genop_3
(
s
,
data
.
insn
,
dst
,
data
.
b
,
data
.
c
);
return
;
case
OP_LOADI32
:
if
(
nopeep
||
data
.
a
!=
src
||
data
.
a
<
s
->
nlocals
)
goto
normal
;
if
(
data
.
a
!=
src
||
data
.
a
<
s
->
nlocals
)
goto
normal
;
else
{
uint32_t
i
=
(
uint32_t
)
data
.
b
<<
16
|
data
.
c
;
rewind_pc
(
s
);
...
...
@@ -613,7 +613,7 @@ gen_move(codegen_scope *s, uint16_t dst, uint16_t src, int nopeep)
}
return
;
case
OP_ADDI
:
case
OP_SUBI
:
if
(
nopeep
||
addr_pc
(
s
,
data
.
addr
)
==
s
->
lastlabel
||
data
.
a
!=
src
||
data
.
a
<
s
->
nlocals
)
goto
normal
;
if
(
addr_pc
(
s
,
data
.
addr
)
==
s
->
lastlabel
||
data
.
a
!=
src
||
data
.
a
<
s
->
nlocals
)
goto
normal
;
else
{
struct
mrb_insn_data
data0
=
mrb_decode_insn
(
mrb_prev_pc
(
s
,
data
.
addr
));
if
(
data0
.
insn
!=
OP_MOVE
||
data0
.
a
!=
data
.
a
||
data0
.
b
!=
dst
)
goto
normal
;
...
...
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