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
fd10c723
Unverified
Commit
fd10c723
authored
Jun 05, 2020
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `OP_EXT[123]` from operands.
parent
ce7508e0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
112 additions
and
293 deletions
+112
-293
doc/opcode.md
doc/opcode.md
+0
-11
include/mruby/opcode.h
include/mruby/opcode.h
+0
-27
include/mruby/ops.h
include/mruby/ops.h
+0
-3
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
+5
-83
src/codedump.c
src/codedump.c
+104
-135
src/vm.c
src/vm.c
+3
-34
No files found.
doc/opcode.md
View file @
fd10c723
...
@@ -20,14 +20,6 @@ sign) of operands.
...
@@ -20,14 +20,6 @@ sign) of operands.
*
sS: signed 16bit
*
sS: signed 16bit
*
W: 24bit
*
W: 24bit
First two byte operands may be extended to 16bit. When those byte
operands are bigger than 256, the instruction will be prefixed by
`OP_EXT1`
(means 1st operand is 16bit) or
`OP_EXT2`
(means 2nd operand
is 16bit) or
`OP_EXT3`
(means 1st and 2nd operands are 16bit).
For instructions marked by
`'`
,
`OP_EXT1`
can be prefixed. For those
with
`"`
, either
`OP_EXT1`
or
`OP_EXT2`
or
`OP_EXT2`
can be prefixed.
## table.1 Instruction Table
## table.1 Instruction Table
| Instruction Name | Operand type | Semantics |
| Instruction Name | Operand type | Semantics |
...
@@ -133,8 +125,5 @@ with `"`, either `OP_EXT1` or `OP_EXT2` or `OP_EXT2` can be prefixed.
...
@@ -133,8 +125,5 @@ with `"`, either `OP_EXT1` or `OP_EXT2` or `OP_EXT2` can be prefixed.
| OP_TCLASS' | B | R(a) = target_class |
| OP_TCLASS' | B | R(a) = target_class |
| OP_DEBUG" | BBB | print a,b,c |
| OP_DEBUG" | BBB | print a,b,c |
| OP_ERR' | B | raise(LocalJumpError, Lit(a)) |
| OP_ERR' | B | raise(LocalJumpError, Lit(a)) |
| OP_EXT1 | - | make 1st operand 16bit |
| OP_EXT2 | - | make 2nd operand 16bit |
| OP_EXT3 | - | make 1st and 2nd operands 16bit |
| OP_STOP | - | stop VM |
| OP_STOP | - | stop VM |
|------------------|--------------|--------------------------------------------------------|
|------------------|--------------|--------------------------------------------------------|
include/mruby/opcode.h
View file @
fd10c723
...
@@ -39,31 +39,4 @@ enum mrb_insn {
...
@@ -39,31 +39,4 @@ enum mrb_insn {
#define FETCH_S() do {a=READ_S();} while (0)
#define FETCH_S() do {a=READ_S();} while (0)
#define FETCH_W() do {a=READ_W();} while (0)
#define FETCH_W() do {a=READ_W();} while (0)
/* with OP_EXT1 (1st 16bit) */
#define FETCH_Z_1() FETCH_Z()
#define FETCH_B_1() FETCH_S()
#define FETCH_BB_1() do {a=READ_S(); b=READ_B();} while (0)
#define FETCH_BBB_1() do {a=READ_S(); b=READ_B(); c=READ_B();} while (0)
#define FETCH_BS_1() do {a=READ_S(); b=READ_S();} while (0)
#define FETCH_S_1() FETCH_S()
#define FETCH_W_1() FETCH_W()
/* with OP_EXT2 (2nd 16bit) */
#define FETCH_Z_2() FETCH_Z()
#define FETCH_B_2() FETCH_B()
#define FETCH_BB_2() do {a=READ_B(); b=READ_S();} while (0)
#define FETCH_BBB_2() do {a=READ_B(); b=READ_S(); c=READ_B();} while (0)
#define FETCH_BS_2() FETCH_BS()
#define FETCH_S_2() FETCH_S()
#define FETCH_W_2() FETCH_W()
/* with OP_EXT3 (1st & 2nd 16bit) */
#define FETCH_Z_3() FETCH_Z()
#define FETCH_B_3() FETCH_B()
#define FETCH_BB_3() do {a=READ_S(); b=READ_S();} while (0)
#define FETCH_BBB_3() do {a=READ_S(); b=READ_S(); c=READ_B();} while (0)
#define FETCH_BS_3() do {a=READ_S(); b=READ_S();} while (0)
#define FETCH_S_3() FETCH_S()
#define FETCH_W_3() FETCH_W()
#endif
/* MRUBY_OPCODE_H */
#endif
/* MRUBY_OPCODE_H */
include/mruby/ops.h
View file @
fd10c723
...
@@ -111,8 +111,5 @@ OPCODE(SCLASS, B) /* R(a) = R(a).singleton_class */
...
@@ -111,8 +111,5 @@ OPCODE(SCLASS, B) /* R(a) = R(a).singleton_class */
OPCODE
(
TCLASS
,
B
)
/* R(a) = target_class */
OPCODE
(
TCLASS
,
B
)
/* R(a) = target_class */
OPCODE
(
DEBUG
,
BBB
)
/* print a,b,c */
OPCODE
(
DEBUG
,
BBB
)
/* print a,b,c */
OPCODE
(
ERR
,
B
)
/* raise(LocalJumpError, Lit(a)) */
OPCODE
(
ERR
,
B
)
/* raise(LocalJumpError, Lit(a)) */
OPCODE
(
EXT1
,
Z
)
/* make 1st operand 16bit */
OPCODE
(
EXT2
,
Z
)
/* make 2nd operand 16bit */
OPCODE
(
EXT3
,
Z
)
/* make 1st and 2nd operands 16bit */
OPCODE
(
STOP
,
Z
)
/* stop VM */
OPCODE
(
STOP
,
Z
)
/* stop VM */
OPCODE
(
LOADI16
,
BS
)
/* R(a) = mrb_int(b) */
OPCODE
(
LOADI16
,
BS
)
/* R(a) = mrb_int(b) */
mrbgems/mruby-compiler/core/codegen.c
View file @
fd10c723
...
@@ -217,9 +217,7 @@ genop_1(codegen_scope *s, mrb_code i, uint16_t a)
...
@@ -217,9 +217,7 @@ genop_1(codegen_scope *s, mrb_code i, uint16_t a)
{
{
s
->
lastpc
=
s
->
pc
;
s
->
lastpc
=
s
->
pc
;
if
(
a
>
0xff
)
{
if
(
a
>
0xff
)
{
gen_B
(
s
,
OP_EXT1
);
codegen_error
(
s
,
"too big operand"
);
gen_B
(
s
,
i
);
gen_S
(
s
,
a
);
}
}
else
{
else
{
gen_B
(
s
,
i
);
gen_B
(
s
,
i
);
...
@@ -231,23 +229,8 @@ static void
...
@@ -231,23 +229,8 @@ static void
genop_2
(
codegen_scope
*
s
,
mrb_code
i
,
uint16_t
a
,
uint16_t
b
)
genop_2
(
codegen_scope
*
s
,
mrb_code
i
,
uint16_t
a
,
uint16_t
b
)
{
{
s
->
lastpc
=
s
->
pc
;
s
->
lastpc
=
s
->
pc
;
if
(
a
>
0xff
&&
b
>
0xff
)
{
if
(
a
>
0xff
||
b
>
0xff
)
{
gen_B
(
s
,
OP_EXT3
);
codegen_error
(
s
,
"too big operand"
);
gen_B
(
s
,
i
);
gen_S
(
s
,
a
);
gen_S
(
s
,
b
);
}
else
if
(
b
>
0xff
)
{
gen_B
(
s
,
OP_EXT2
);
gen_B
(
s
,
i
);
gen_B
(
s
,
(
uint8_t
)
a
);
gen_S
(
s
,
b
);
}
else
if
(
a
>
0xff
)
{
gen_B
(
s
,
OP_EXT1
);
gen_B
(
s
,
i
);
gen_S
(
s
,
a
);
gen_B
(
s
,
(
uint8_t
)
b
);
}
}
else
{
else
{
gen_B
(
s
,
i
);
gen_B
(
s
,
i
);
...
@@ -309,32 +292,6 @@ mrb_decode_insn(const mrb_code *pc)
...
@@ -309,32 +292,6 @@ mrb_decode_insn(const mrb_code *pc)
#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x (); break;
#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x (); break;
#include "mruby/ops.h"
#include "mruby/ops.h"
#undef OPCODE
#undef OPCODE
}
switch
(
insn
)
{
case
OP_EXT1
:
insn
=
READ_B
();
switch
(
insn
)
{
#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x ## _1 (); break;
#include "mruby/ops.h"
#undef OPCODE
}
break
;
case
OP_EXT2
:
insn
=
READ_B
();
switch
(
insn
)
{
#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x ## _2 (); break;
#include "mruby/ops.h"
#undef OPCODE
}
break
;
case
OP_EXT3
:
insn
=
READ_B
();
switch
(
insn
)
{
#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x ## _3 (); break;
#include "mruby/ops.h"
#undef OPCODE
}
break
;
default:
default:
break
;
break
;
}
}
...
@@ -391,11 +348,8 @@ genjmp2(codegen_scope *s, mrb_code i, uint16_t a, int pc, int val)
...
@@ -391,11 +348,8 @@ genjmp2(codegen_scope *s, mrb_code i, uint16_t a, int pc, int val)
s
->
lastpc
=
s
->
pc
;
s
->
lastpc
=
s
->
pc
;
if
(
a
>
0xff
)
{
if
(
a
>
0xff
)
{
gen_B
(
s
,
OP_EXT1
);
codegen_error
(
s
,
"too big operand"
);
gen_B
(
s
,
i
);
pos
=
0
;
gen_S
(
s
,
a
);
pos
=
s
->
pc
;
gen_S
(
s
,
pc
);
}
}
else
{
else
{
gen_B
(
s
,
i
);
gen_B
(
s
,
i
);
...
@@ -3314,35 +3268,3 @@ uint8_t mrb_insn_size[] = {
...
@@ -3314,35 +3268,3 @@ uint8_t mrb_insn_size[] = {
#undef SB
#undef SB
#undef BBB
#undef BBB
};
};
/* EXT1 instruction sizes */
uint8_t
mrb_insn_size1
[]
=
{
#define B 3
#define BB 4
#define BBB 5
#define BS 5
#define SB 5
#define OPCODE(_,x) x,
#include "mruby/ops.h"
#undef OPCODE
#undef B
};
/* EXT2 instruction sizes */
uint8_t
mrb_insn_size2
[]
=
{
#define B 2
#define OPCODE(_,x) x,
#include "mruby/ops.h"
#undef OPCODE
#undef BB
#undef BBB
#undef BS
#undef SB
};
/* EXT3 instruction sizes */
#define BB 5
#define BBB 6
#define BS 4
#define SB 5
uint8_t
mrb_insn_size3
[]
=
{
#define OPCODE(_,x) x,
#include "mruby/ops.h"
};
src/codedump.c
View file @
fd10c723
...
@@ -63,7 +63,7 @@ print_header(mrb_state *mrb, const mrb_irep *irep, ptrdiff_t i)
...
@@ -63,7 +63,7 @@ print_header(mrb_state *mrb, const mrb_irep *irep, ptrdiff_t i)
printf
(
"%03d "
,
(
int
)
i
);
printf
(
"%03d "
,
(
int
)
i
);
}
}
#define CASE(insn,ops) case insn: FETCH_ ## ops ();
L_ ## insn
#define CASE(insn,ops) case insn: FETCH_ ## ops ();
static
void
static
void
codedump
(
mrb_state
*
mrb
,
const
mrb_irep
*
irep
)
codedump
(
mrb_state
*
mrb
,
const
mrb_irep
*
irep
)
...
@@ -107,14 +107,14 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
...
@@ -107,14 +107,14 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
print_header
(
mrb
,
irep
,
i
);
print_header
(
mrb
,
irep
,
i
);
ins
=
READ_B
();
ins
=
READ_B
();
switch
(
ins
)
{
switch
(
ins
)
{
CASE
(
OP_NOP
,
Z
)
:
CASE
(
OP_NOP
,
Z
)
;
printf
(
"OP_NOP
\n
"
);
printf
(
"OP_NOP
\n
"
);
break
;
break
;
CASE
(
OP_MOVE
,
BB
)
:
CASE
(
OP_MOVE
,
BB
)
;
printf
(
"OP_MOVE
\t
R%d
\t
R%d
\t
"
,
a
,
b
);
printf
(
"OP_MOVE
\t
R%d
\t
R%d
\t
"
,
a
,
b
);
print_lv_ab
(
mrb
,
irep
,
a
,
b
);
print_lv_ab
(
mrb
,
irep
,
a
,
b
);
break
;
break
;
CASE
(
OP_LOADL
,
BB
)
:
CASE
(
OP_LOADL
,
BB
)
;
switch
(
irep
->
pool
[
b
].
tt
)
{
switch
(
irep
->
pool
[
b
].
tt
)
{
case
IREP_TT_FLOAT
:
case
IREP_TT_FLOAT
:
printf
(
"OP_LOADL
\t
R%d
\t
L(%d)
\t
; %f"
,
a
,
b
,
(
double
)
irep
->
pool
[
b
].
u
.
f
);
printf
(
"OP_LOADL
\t
R%d
\t
L(%d)
\t
; %f"
,
a
,
b
,
(
double
)
irep
->
pool
[
b
].
u
.
f
);
...
@@ -133,144 +133,144 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
...
@@ -133,144 +133,144 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
}
}
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_LOADI
,
BB
)
:
CASE
(
OP_LOADI
,
BB
)
;
printf
(
"OP_LOADI
\t
R%d
\t
%d
\t
"
,
a
,
b
);
printf
(
"OP_LOADI
\t
R%d
\t
%d
\t
"
,
a
,
b
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_LOADINEG
,
BB
)
:
CASE
(
OP_LOADINEG
,
BB
)
;
printf
(
"OP_LOADI
\t
R%d
\t
-%d
\t
"
,
a
,
b
);
printf
(
"OP_LOADI
\t
R%d
\t
-%d
\t
"
,
a
,
b
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_LOADI16
,
BS
)
:
CASE
(
OP_LOADI16
,
BS
)
;
printf
(
"OP_LOADI16
\t
R%d
\t
%d
\t
"
,
a
,
(
int
)(
int16_t
)
b
);
printf
(
"OP_LOADI16
\t
R%d
\t
%d
\t
"
,
a
,
(
int
)(
int16_t
)
b
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_LOADI__1
,
B
)
:
CASE
(
OP_LOADI__1
,
B
)
;
printf
(
"OP_LOADI__1
\t
R%d
\t\t
"
,
a
);
printf
(
"OP_LOADI__1
\t
R%d
\t\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_LOADI_0
,
B
)
:
goto
L_LOADI
;
CASE
(
OP_LOADI_0
,
B
)
;
goto
L_LOADI
;
CASE
(
OP_LOADI_1
,
B
)
:
goto
L_LOADI
;
CASE
(
OP_LOADI_1
,
B
)
;
goto
L_LOADI
;
CASE
(
OP_LOADI_2
,
B
)
:
goto
L_LOADI
;
CASE
(
OP_LOADI_2
,
B
)
;
goto
L_LOADI
;
CASE
(
OP_LOADI_3
,
B
)
:
goto
L_LOADI
;
CASE
(
OP_LOADI_3
,
B
)
;
goto
L_LOADI
;
CASE
(
OP_LOADI_4
,
B
)
:
goto
L_LOADI
;
CASE
(
OP_LOADI_4
,
B
)
;
goto
L_LOADI
;
CASE
(
OP_LOADI_5
,
B
)
:
goto
L_LOADI
;
CASE
(
OP_LOADI_5
,
B
)
;
goto
L_LOADI
;
CASE
(
OP_LOADI_6
,
B
)
:
goto
L_LOADI
;
CASE
(
OP_LOADI_6
,
B
)
;
goto
L_LOADI
;
CASE
(
OP_LOADI_7
,
B
)
:
CASE
(
OP_LOADI_7
,
B
)
;
L_LOADI:
L_LOADI:
printf
(
"OP_LOADI_%d
\t
R%d
\t\t
"
,
ins
-
(
int
)
OP_LOADI_0
,
a
);
printf
(
"OP_LOADI_%d
\t
R%d
\t\t
"
,
ins
-
(
int
)
OP_LOADI_0
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_LOADSYM
,
BB
)
:
CASE
(
OP_LOADSYM
,
BB
)
;
printf
(
"OP_LOADSYM
\t
R%d
\t
:%s
\t
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_LOADSYM
\t
R%d
\t
:%s
\t
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_LOADNIL
,
B
)
:
CASE
(
OP_LOADNIL
,
B
)
;
printf
(
"OP_LOADNIL
\t
R%d
\t\t
"
,
a
);
printf
(
"OP_LOADNIL
\t
R%d
\t\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_LOADSELF
,
B
)
:
CASE
(
OP_LOADSELF
,
B
)
;
printf
(
"OP_LOADSELF
\t
R%d
\t\t
"
,
a
);
printf
(
"OP_LOADSELF
\t
R%d
\t\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_LOADT
,
B
)
:
CASE
(
OP_LOADT
,
B
)
;
printf
(
"OP_LOADT
\t
R%d
\t\t
"
,
a
);
printf
(
"OP_LOADT
\t
R%d
\t\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_LOADF
,
B
)
:
CASE
(
OP_LOADF
,
B
)
;
printf
(
"OP_LOADF
\t
R%d
\t\t
"
,
a
);
printf
(
"OP_LOADF
\t
R%d
\t\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_GETGV
,
BB
)
:
CASE
(
OP_GETGV
,
BB
)
;
printf
(
"OP_GETGV
\t
R%d
\t
:%s"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_GETGV
\t
R%d
\t
:%s"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_SETGV
,
BB
)
:
CASE
(
OP_SETGV
,
BB
)
;
printf
(
"OP_SETGV
\t
:
%s
\t
R%d"
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
a
);
printf
(
"OP_SETGV
\t
;
%s
\t
R%d"
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_GETSV
,
BB
)
:
CASE
(
OP_GETSV
,
BB
)
;
printf
(
"OP_GETSV
\t
R%d
\t
:%s"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_GETSV
\t
R%d
\t
:%s"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_SETSV
,
BB
)
:
CASE
(
OP_SETSV
,
BB
)
;
printf
(
"OP_SETSV
\t
:%s
\t
R%d"
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
a
);
printf
(
"OP_SETSV
\t
:%s
\t
R%d"
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_GETCONST
,
BB
)
:
CASE
(
OP_GETCONST
,
BB
)
;
printf
(
"OP_GETCONST
\t
R%d
\t
:%s"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_GETCONST
\t
R%d
\t
:%s"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_SETCONST
,
BB
)
:
CASE
(
OP_SETCONST
,
BB
)
;
printf
(
"OP_SETCONST
\t
:%s
\t
R%d"
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
a
);
printf
(
"OP_SETCONST
\t
:%s
\t
R%d"
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_GETMCNST
,
BB
)
:
CASE
(
OP_GETMCNST
,
BB
)
;
printf
(
"OP_GETMCNST
\t
R%d
\t
R%d::%s"
,
a
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_GETMCNST
\t
R%d
\t
R%d::%s"
,
a
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_SETMCNST
,
BB
)
:
CASE
(
OP_SETMCNST
,
BB
)
;
printf
(
"OP_SETMCNST
\t
R%d::%s
\t
R%d"
,
a
+
1
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
a
);
printf
(
"OP_SETMCNST
\t
R%d::%s
\t
R%d"
,
a
+
1
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_GETIV
,
BB
)
:
CASE
(
OP_GETIV
,
BB
)
;
printf
(
"OP_GETIV
\t
R%d
\t
%s"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_GETIV
\t
R%d
\t
%s"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_SETIV
,
BB
)
:
CASE
(
OP_SETIV
,
BB
)
;
printf
(
"OP_SETIV
\t
%s
\t
R%d"
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
a
);
printf
(
"OP_SETIV
\t
%s
\t
R%d"
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_GETUPVAR
,
BBB
)
:
CASE
(
OP_GETUPVAR
,
BBB
)
;
printf
(
"OP_GETUPVAR
\t
R%d
\t
%d
\t
%d"
,
a
,
b
,
c
);
printf
(
"OP_GETUPVAR
\t
R%d
\t
%d
\t
%d"
,
a
,
b
,
c
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_SETUPVAR
,
BBB
)
:
CASE
(
OP_SETUPVAR
,
BBB
)
;
printf
(
"OP_SETUPVAR
\t
R%d
\t
%d
\t
%d"
,
a
,
b
,
c
);
printf
(
"OP_SETUPVAR
\t
R%d
\t
%d
\t
%d"
,
a
,
b
,
c
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_GETCV
,
BB
)
:
CASE
(
OP_GETCV
,
BB
)
;
printf
(
"OP_GETCV
\t
R%d
\t
%s"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_GETCV
\t
R%d
\t
%s"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_SETCV
,
BB
)
:
CASE
(
OP_SETCV
,
BB
)
;
printf
(
"OP_SETCV
\t
%s
\t
R%d"
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
a
);
printf
(
"OP_SETCV
\t
%s
\t
R%d"
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_JMP
,
S
)
:
CASE
(
OP_JMP
,
S
)
;
printf
(
"OP_JMP
\t\t
%03d
\n
"
,
a
);
printf
(
"OP_JMP
\t\t
%03d
\n
"
,
a
);
break
;
break
;
CASE
(
OP_JMPIF
,
BS
)
:
CASE
(
OP_JMPIF
,
BS
)
;
printf
(
"OP_JMPIF
\t
R%d
\t
%03d
\t
"
,
a
,
b
);
printf
(
"OP_JMPIF
\t
R%d
\t
%03d
\t
"
,
a
,
b
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_JMPNOT
,
BS
)
:
CASE
(
OP_JMPNOT
,
BS
)
;
printf
(
"OP_JMPNOT
\t
R%d
\t
%03d
\t
"
,
a
,
b
);
printf
(
"OP_JMPNOT
\t
R%d
\t
%03d
\t
"
,
a
,
b
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_JMPNIL
,
BS
)
:
CASE
(
OP_JMPNIL
,
BS
)
;
printf
(
"OP_JMPNIL
\t
R%d
\t
%03d
\t
"
,
a
,
b
);
printf
(
"OP_JMPNIL
\t
R%d
\t
%03d
\t
"
,
a
,
b
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_SENDV
,
BB
)
:
CASE
(
OP_SENDV
,
BB
)
;
printf
(
"OP_SENDV
\t
R%d
\t
:%s
\n
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_SENDV
\t
R%d
\t
:%s
\n
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
break
;
break
;
CASE
(
OP_SENDVB
,
BB
)
:
CASE
(
OP_SENDVB
,
BB
)
;
printf
(
"OP_SENDVB
\t
R%d
\t
:%s
\n
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_SENDVB
\t
R%d
\t
:%s
\n
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
break
;
break
;
CASE
(
OP_SEND
,
BBB
)
:
CASE
(
OP_SEND
,
BBB
)
;
printf
(
"OP_SEND
\t
R%d
\t
:%s
\t
%d
\n
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
c
);
printf
(
"OP_SEND
\t
R%d
\t
:%s
\t
%d
\n
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
c
);
break
;
break
;
CASE
(
OP_SENDB
,
BBB
)
:
CASE
(
OP_SENDB
,
BBB
)
;
printf
(
"OP_SENDB
\t
R%d
\t
:%s
\t
%d
\n
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
c
);
printf
(
"OP_SENDB
\t
R%d
\t
:%s
\t
%d
\n
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]),
c
);
break
;
break
;
CASE
(
OP_CALL
,
Z
)
:
CASE
(
OP_CALL
,
Z
)
;
printf
(
"OP_CALL
\n
"
);
printf
(
"OP_CALL
\n
"
);
break
;
break
;
CASE
(
OP_SUPER
,
BB
)
:
CASE
(
OP_SUPER
,
BB
)
;
printf
(
"OP_SUPER
\t
R%d
\t
%d
\n
"
,
a
,
b
);
printf
(
"OP_SUPER
\t
R%d
\t
%d
\n
"
,
a
,
b
);
break
;
break
;
CASE
(
OP_ARGARY
,
BS
)
:
CASE
(
OP_ARGARY
,
BS
)
;
printf
(
"OP_ARGARY
\t
R%d
\t
%d:%d:%d:%d (%d)"
,
a
,
printf
(
"OP_ARGARY
\t
R%d
\t
%d:%d:%d:%d (%d)"
,
a
,
(
b
>>
11
)
&
0x3f
,
(
b
>>
11
)
&
0x3f
,
(
b
>>
10
)
&
0x1
,
(
b
>>
10
)
&
0x1
,
...
@@ -279,7 +279,7 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
...
@@ -279,7 +279,7 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
(
b
>>
0
)
&
0xf
);
(
b
>>
0
)
&
0xf
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_ENTER
,
W
)
:
CASE
(
OP_ENTER
,
W
)
;
printf
(
"OP_ENTER
\t
%d:%d:%d:%d:%d:%d:%d
\n
"
,
printf
(
"OP_ENTER
\t
%d:%d:%d:%d:%d:%d:%d
\n
"
,
MRB_ASPEC_REQ
(
a
),
MRB_ASPEC_REQ
(
a
),
MRB_ASPEC_OPT
(
a
),
MRB_ASPEC_OPT
(
a
),
...
@@ -289,30 +289,30 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
...
@@ -289,30 +289,30 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
MRB_ASPEC_KDICT
(
a
),
MRB_ASPEC_KDICT
(
a
),
MRB_ASPEC_BLOCK
(
a
));
MRB_ASPEC_BLOCK
(
a
));
break
;
break
;
CASE
(
OP_KEY_P
,
BB
)
:
CASE
(
OP_KEY_P
,
BB
)
;
printf
(
"OP_KEY_P
\t
R%d
\t
:%s
\t
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_KEY_P
\t
R%d
\t
:%s
\t
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_KEYEND
,
Z
)
:
CASE
(
OP_KEYEND
,
Z
)
;
printf
(
"OP_KEYEND
\n
"
);
printf
(
"OP_KEYEND
\n
"
);
break
;
break
;
CASE
(
OP_KARG
,
BB
)
:
CASE
(
OP_KARG
,
BB
)
;
printf
(
"OP_KARG
\t
R%d
\t
:%s
\t
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_KARG
\t
R%d
\t
:%s
\t
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_RETURN
,
B
)
:
CASE
(
OP_RETURN
,
B
)
;
printf
(
"OP_RETURN
\t
R%d
\t\t
"
,
a
);
printf
(
"OP_RETURN
\t
R%d
\t\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_RETURN_BLK
,
B
)
:
CASE
(
OP_RETURN_BLK
,
B
)
;
printf
(
"OP_RETURN_BLK
\t
R%d
\t\t
"
,
a
);
printf
(
"OP_RETURN_BLK
\t
R%d
\t\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_BREAK
,
B
)
:
CASE
(
OP_BREAK
,
B
)
;
printf
(
"OP_BREAK
\t
R%d
\t\t
"
,
a
);
printf
(
"OP_BREAK
\t
R%d
\t\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_BLKPUSH
,
BS
)
:
CASE
(
OP_BLKPUSH
,
BS
)
;
printf
(
"OP_BLKPUSH
\t
R%d
\t
%d:%d:%d:%d (%d)"
,
a
,
printf
(
"OP_BLKPUSH
\t
R%d
\t
%d:%d:%d:%d (%d)"
,
a
,
(
b
>>
11
)
&
0x3f
,
(
b
>>
11
)
&
0x3f
,
(
b
>>
10
)
&
0x1
,
(
b
>>
10
)
&
0x1
,
...
@@ -321,100 +321,100 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
...
@@ -321,100 +321,100 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
(
b
>>
0
)
&
0xf
);
(
b
>>
0
)
&
0xf
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_LAMBDA
,
BB
)
:
CASE
(
OP_LAMBDA
,
BB
)
;
printf
(
"OP_LAMBDA
\t
R%d
\t
I(%d:%p)
\n
"
,
a
,
b
,
irep
->
reps
[
b
]);
printf
(
"OP_LAMBDA
\t
R%d
\t
I(%d:%p)
\n
"
,
a
,
b
,
irep
->
reps
[
b
]);
break
;
break
;
CASE
(
OP_BLOCK
,
BB
)
:
CASE
(
OP_BLOCK
,
BB
)
;
printf
(
"OP_BLOCK
\t
R%d
\t
I(%d:%p)
\n
"
,
a
,
b
,
irep
->
reps
[
b
]);
printf
(
"OP_BLOCK
\t
R%d
\t
I(%d:%p)
\n
"
,
a
,
b
,
irep
->
reps
[
b
]);
break
;
break
;
CASE
(
OP_METHOD
,
BB
)
:
CASE
(
OP_METHOD
,
BB
)
;
printf
(
"OP_METHOD
\t
R%d
\t
I(%d:%p)
\n
"
,
a
,
b
,
irep
->
reps
[
b
]);
printf
(
"OP_METHOD
\t
R%d
\t
I(%d:%p)
\n
"
,
a
,
b
,
irep
->
reps
[
b
]);
break
;
break
;
CASE
(
OP_RANGE_INC
,
B
)
:
CASE
(
OP_RANGE_INC
,
B
)
;
printf
(
"OP_RANGE_INC
\t
R%d
\n
"
,
a
);
printf
(
"OP_RANGE_INC
\t
R%d
\n
"
,
a
);
break
;
break
;
CASE
(
OP_RANGE_EXC
,
B
)
:
CASE
(
OP_RANGE_EXC
,
B
)
;
printf
(
"OP_RANGE_EXC
\t
R%d
\n
"
,
a
);
printf
(
"OP_RANGE_EXC
\t
R%d
\n
"
,
a
);
break
;
break
;
CASE
(
OP_DEF
,
BB
)
:
CASE
(
OP_DEF
,
BB
)
;
printf
(
"OP_DEF
\t
R%d
\t
:%s
\n
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_DEF
\t
R%d
\t
:%s
\n
"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
break
;
break
;
CASE
(
OP_UNDEF
,
B
)
:
CASE
(
OP_UNDEF
,
B
)
;
printf
(
"OP_UNDEF
\t
:%s
\n
"
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
a
]));
printf
(
"OP_UNDEF
\t
:%s
\n
"
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
a
]));
break
;
break
;
CASE
(
OP_ALIAS
,
BB
)
:
CASE
(
OP_ALIAS
,
BB
)
;
printf
(
"OP_ALIAS
\t
:%s
\t
%s
\n
"
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
a
]),
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_ALIAS
\t
:%s
\t
%s
\n
"
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
a
]),
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
break
;
break
;
CASE
(
OP_ADD
,
B
)
:
CASE
(
OP_ADD
,
B
)
;
printf
(
"OP_ADD
\t
R%d
\t\n
"
,
a
);
printf
(
"OP_ADD
\t
R%d
\t\n
"
,
a
);
break
;
break
;
CASE
(
OP_ADDI
,
BB
)
:
CASE
(
OP_ADDI
,
BB
)
;
printf
(
"OP_ADDI
\t
R%d
\t
%d
\n
"
,
a
,
b
);
printf
(
"OP_ADDI
\t
R%d
\t
%d
\n
"
,
a
,
b
);
break
;
break
;
CASE
(
OP_SUB
,
B
)
:
CASE
(
OP_SUB
,
B
)
;
printf
(
"OP_SUB
\t
R%d
\t\n
"
,
a
);
printf
(
"OP_SUB
\t
R%d
\t\n
"
,
a
);
break
;
break
;
CASE
(
OP_SUBI
,
BB
)
:
CASE
(
OP_SUBI
,
BB
)
;
printf
(
"OP_SUBI
\t
R%d
\t
%d
\n
"
,
a
,
b
);
printf
(
"OP_SUBI
\t
R%d
\t
%d
\n
"
,
a
,
b
);
break
;
break
;
CASE
(
OP_MUL
,
B
)
:
CASE
(
OP_MUL
,
B
)
;
printf
(
"OP_MUL
\t
R%d
\t\n
"
,
a
);
printf
(
"OP_MUL
\t
R%d
\t\n
"
,
a
);
break
;
break
;
CASE
(
OP_DIV
,
B
)
:
CASE
(
OP_DIV
,
B
)
;
printf
(
"OP_DIV
\t
R%d
\t\n
"
,
a
);
printf
(
"OP_DIV
\t
R%d
\t\n
"
,
a
);
break
;
break
;
CASE
(
OP_LT
,
B
)
:
CASE
(
OP_LT
,
B
)
;
printf
(
"OP_LT
\t\t
R%d
\t\n
"
,
a
);
printf
(
"OP_LT
\t\t
R%d
\t\n
"
,
a
);
break
;
break
;
CASE
(
OP_LE
,
B
)
:
CASE
(
OP_LE
,
B
)
;
printf
(
"OP_LE
\t\t
R%d
\t\n
"
,
a
);
printf
(
"OP_LE
\t\t
R%d
\t\n
"
,
a
);
break
;
break
;
CASE
(
OP_GT
,
B
)
:
CASE
(
OP_GT
,
B
)
;
printf
(
"OP_GT
\t\t
R%d
\t\n
"
,
a
);
printf
(
"OP_GT
\t\t
R%d
\t\n
"
,
a
);
break
;
break
;
CASE
(
OP_GE
,
B
)
:
CASE
(
OP_GE
,
B
)
;
printf
(
"OP_GE
\t\t
R%d
\t\n
"
,
a
);
printf
(
"OP_GE
\t\t
R%d
\t\n
"
,
a
);
break
;
break
;
CASE
(
OP_EQ
,
B
)
:
CASE
(
OP_EQ
,
B
)
;
printf
(
"OP_EQ
\t\t
R%d
\t\n
"
,
a
);
printf
(
"OP_EQ
\t\t
R%d
\t\n
"
,
a
);
break
;
break
;
CASE
(
OP_ARRAY
,
BB
)
:
CASE
(
OP_ARRAY
,
BB
)
;
printf
(
"OP_ARRAY
\t
R%d
\t
%d
\t
"
,
a
,
b
);
printf
(
"OP_ARRAY
\t
R%d
\t
%d
\t
"
,
a
,
b
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_ARRAY2
,
BBB
)
:
CASE
(
OP_ARRAY2
,
BBB
)
;
printf
(
"OP_ARRAY
\t
R%d
\t
R%d
\t
%d
\t
"
,
a
,
b
,
c
);
printf
(
"OP_ARRAY
\t
R%d
\t
R%d
\t
%d
\t
"
,
a
,
b
,
c
);
print_lv_ab
(
mrb
,
irep
,
a
,
b
);
print_lv_ab
(
mrb
,
irep
,
a
,
b
);
break
;
break
;
CASE
(
OP_ARYCAT
,
B
)
:
CASE
(
OP_ARYCAT
,
B
)
;
printf
(
"OP_ARYCAT
\t
R%d
\t
"
,
a
);
printf
(
"OP_ARYCAT
\t
R%d
\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_ARYPUSH
,
B
)
:
CASE
(
OP_ARYPUSH
,
B
)
;
printf
(
"OP_ARYPUSH
\t
R%d
\t
"
,
a
);
printf
(
"OP_ARYPUSH
\t
R%d
\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_ARYDUP
,
B
)
:
CASE
(
OP_ARYDUP
,
B
)
;
printf
(
"OP_ARYDUP
\t
R%d
\t
"
,
a
);
printf
(
"OP_ARYDUP
\t
R%d
\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_AREF
,
BBB
)
:
CASE
(
OP_AREF
,
BBB
)
;
printf
(
"OP_AREF
\t
R%d
\t
R%d
\t
%d"
,
a
,
b
,
c
);
printf
(
"OP_AREF
\t
R%d
\t
R%d
\t
%d"
,
a
,
b
,
c
);
print_lv_ab
(
mrb
,
irep
,
a
,
b
);
print_lv_ab
(
mrb
,
irep
,
a
,
b
);
break
;
break
;
CASE
(
OP_ASET
,
BBB
)
:
CASE
(
OP_ASET
,
BBB
)
;
printf
(
"OP_ASET
\t
R%d
\t
R%d
\t
%d"
,
a
,
b
,
c
);
printf
(
"OP_ASET
\t
R%d
\t
R%d
\t
%d"
,
a
,
b
,
c
);
print_lv_ab
(
mrb
,
irep
,
a
,
b
);
print_lv_ab
(
mrb
,
irep
,
a
,
b
);
break
;
break
;
CASE
(
OP_APOST
,
BBB
)
:
CASE
(
OP_APOST
,
BBB
)
;
printf
(
"OP_APOST
\t
R%d
\t
%d
\t
%d"
,
a
,
b
,
c
);
printf
(
"OP_APOST
\t
R%d
\t
%d
\t
%d"
,
a
,
b
,
c
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_INTERN
,
B
)
:
CASE
(
OP_INTERN
,
B
)
;
printf
(
"OP_INTERN
\t
R%d"
,
a
);
printf
(
"OP_INTERN
\t
R%d"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_STRING
,
BB
)
:
CASE
(
OP_STRING
,
BB
)
;
if
((
irep
->
pool
[
b
].
tt
&
IREP_TT_NFLAG
)
==
0
)
{
if
((
irep
->
pool
[
b
].
tt
&
IREP_TT_NFLAG
)
==
0
)
{
printf
(
"OP_STRING
\t
R%d
\t
L(%d)
\t
; %s"
,
a
,
b
,
irep
->
pool
[
b
].
u
.
str
);
printf
(
"OP_STRING
\t
R%d
\t
L(%d)
\t
; %s"
,
a
,
b
,
irep
->
pool
[
b
].
u
.
str
);
}
}
...
@@ -423,48 +423,48 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
...
@@ -423,48 +423,48 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
}
}
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_STRCAT
,
B
)
:
CASE
(
OP_STRCAT
,
B
)
;
printf
(
"OP_STRCAT
\t
R%d
\t
"
,
a
);
printf
(
"OP_STRCAT
\t
R%d
\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_HASH
,
BB
)
:
CASE
(
OP_HASH
,
BB
)
;
printf
(
"OP_HASH
\t
R%d
\t
%d
\t
"
,
a
,
b
);
printf
(
"OP_HASH
\t
R%d
\t
%d
\t
"
,
a
,
b
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_HASHADD
,
BB
)
:
CASE
(
OP_HASHADD
,
BB
)
;
printf
(
"OP_HASHADD
\t
R%d
\t
%d
\t
"
,
a
,
b
);
printf
(
"OP_HASHADD
\t
R%d
\t
%d
\t
"
,
a
,
b
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_HASHCAT
,
B
)
:
CASE
(
OP_HASHCAT
,
B
)
;
printf
(
"OP_HASHCAT
\t
R%d
\t
"
,
a
);
printf
(
"OP_HASHCAT
\t
R%d
\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_OCLASS
,
B
)
:
CASE
(
OP_OCLASS
,
B
)
;
printf
(
"OP_OCLASS
\t
R%d
\t\t
"
,
a
);
printf
(
"OP_OCLASS
\t
R%d
\t\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_CLASS
,
BB
)
:
CASE
(
OP_CLASS
,
BB
)
;
printf
(
"OP_CLASS
\t
R%d
\t
:%s"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_CLASS
\t
R%d
\t
:%s"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_MODULE
,
BB
)
:
CASE
(
OP_MODULE
,
BB
)
;
printf
(
"OP_MODULE
\t
R%d
\t
:%s"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
printf
(
"OP_MODULE
\t
R%d
\t
:%s"
,
a
,
mrb_sym_dump
(
mrb
,
irep
->
syms
[
b
]));
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_EXEC
,
BB
)
:
CASE
(
OP_EXEC
,
BB
)
;
printf
(
"OP_EXEC
\t
R%d
\t
I(%d:%p)"
,
a
,
b
,
irep
->
reps
[
b
]);
printf
(
"OP_EXEC
\t
R%d
\t
I(%d:%p)"
,
a
,
b
,
irep
->
reps
[
b
]);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_SCLASS
,
B
)
:
CASE
(
OP_SCLASS
,
B
)
;
printf
(
"OP_SCLASS
\t
R%d
\t
"
,
a
);
printf
(
"OP_SCLASS
\t
R%d
\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_TCLASS
,
B
)
:
CASE
(
OP_TCLASS
,
B
)
;
printf
(
"OP_TCLASS
\t
R%d
\t\t
"
,
a
);
printf
(
"OP_TCLASS
\t
R%d
\t\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_ERR
,
B
)
:
CASE
(
OP_ERR
,
B
)
;
if
((
irep
->
pool
[
a
].
tt
&
IREP_TT_NFLAG
)
==
0
)
{
if
((
irep
->
pool
[
a
].
tt
&
IREP_TT_NFLAG
)
==
0
)
{
printf
(
"OP_ERR
\t
%s
\n
"
,
irep
->
pool
[
a
].
u
.
str
);
printf
(
"OP_ERR
\t
%s
\n
"
,
irep
->
pool
[
a
].
u
.
str
);
}
}
...
@@ -472,70 +472,39 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
...
@@ -472,70 +472,39 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
printf
(
"OP_ERR
\t
L(%d)
\n
"
,
a
);
printf
(
"OP_ERR
\t
L(%d)
\n
"
,
a
);
}
}
break
;
break
;
CASE
(
OP_EPUSH
,
B
)
:
CASE
(
OP_EPUSH
,
B
)
;
printf
(
"OP_EPUSH
\t\t
:I(%d:%p)
\n
"
,
a
,
irep
->
reps
[
a
]);
printf
(
"OP_EPUSH
\t\t
:I(%d:%p)
\n
"
,
a
,
irep
->
reps
[
a
]);
break
;
break
;
CASE
(
OP_ONERR
,
S
)
:
CASE
(
OP_ONERR
,
S
)
;
printf
(
"OP_ONERR
\t
%03d
\n
"
,
a
);
printf
(
"OP_ONERR
\t
%03d
\n
"
,
a
);
break
;
break
;
CASE
(
OP_EXCEPT
,
B
)
:
CASE
(
OP_EXCEPT
,
B
)
;
printf
(
"OP_EXCEPT
\t
R%d
\t\t
"
,
a
);
printf
(
"OP_EXCEPT
\t
R%d
\t\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_RESCUE
,
BB
)
:
CASE
(
OP_RESCUE
,
BB
)
;
printf
(
"OP_RESCUE
\t
R%d
\t
R%d"
,
a
,
b
);
printf
(
"OP_RESCUE
\t
R%d
\t
R%d"
,
a
,
b
);
print_lv_ab
(
mrb
,
irep
,
a
,
b
);
print_lv_ab
(
mrb
,
irep
,
a
,
b
);
break
;
break
;
CASE
(
OP_RAISE
,
B
)
:
CASE
(
OP_RAISE
,
B
)
;
printf
(
"OP_RAISE
\t
R%d
\t\t
"
,
a
);
printf
(
"OP_RAISE
\t
R%d
\t\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
break
;
CASE
(
OP_POPERR
,
B
)
:
CASE
(
OP_POPERR
,
B
)
;
printf
(
"OP_POPERR
\t
%d
\t\t\n
"
,
a
);
printf
(
"OP_POPERR
\t
%d
\t\t\n
"
,
a
);
break
;
break
;
CASE
(
OP_EPOP
,
B
)
:
CASE
(
OP_EPOP
,
B
)
;
printf
(
"OP_EPOP
\t
%d
\n
"
,
a
);
printf
(
"OP_EPOP
\t
%d
\n
"
,
a
);
break
;
break
;
CASE
(
OP_DEBUG
,
BBB
)
:
CASE
(
OP_DEBUG
,
BBB
)
;
printf
(
"OP_DEBUG
\t
%d
\t
%d
\t
%d
\n
"
,
a
,
b
,
c
);
printf
(
"OP_DEBUG
\t
%d
\t
%d
\t
%d
\n
"
,
a
,
b
,
c
);
break
;
break
;
CASE
(
OP_STOP
,
Z
)
:
CASE
(
OP_STOP
,
Z
)
;
printf
(
"OP_STOP
\n
"
);
printf
(
"OP_STOP
\n
"
);
break
;
break
;
CASE
(
OP_EXT1
,
Z
)
:
ins
=
READ_B
();
printf
(
"OP_EXT1
\n
"
);
print_header
(
mrb
,
irep
,
pc
-
irep
->
iseq
-
2
);
switch
(
ins
)
{
#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x ## _1 (); goto L_OP_ ## i;
#include "mruby/ops.h"
#undef OPCODE
}
break
;
CASE
(
OP_EXT2
,
Z
)
:
ins
=
READ_B
();
printf
(
"OP_EXT2
\n
"
);
print_header
(
mrb
,
irep
,
pc
-
irep
->
iseq
-
2
);
switch
(
ins
)
{
#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x ## _2 (); goto L_OP_ ## i;
#include "mruby/ops.h"
#undef OPCODE
}
break
;
CASE
(
OP_EXT3
,
Z
)
:
ins
=
READ_B
();
printf
(
"OP_EXT3
\n
"
);
print_header
(
mrb
,
irep
,
pc
-
irep
->
iseq
-
2
);
switch
(
ins
)
{
#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x ## _3 (); goto L_OP_ ## i;
#include "mruby/ops.h"
#undef OPCODE
}
break
;
default:
default:
printf
(
"OP_unknown (0x%x)
\n
"
,
ins
);
printf
(
"OP_unknown (0x%x)
\n
"
,
ins
);
break
;
break
;
...
...
src/vm.c
View file @
fd10c723
...
@@ -901,7 +901,7 @@ argnum_error(mrb_state *mrb, mrb_int num)
...
@@ -901,7 +901,7 @@ argnum_error(mrb_state *mrb, mrb_int num)
#ifndef DIRECT_THREADED
#ifndef DIRECT_THREADED
#define INIT_DISPATCH for (;;) { insn = BYTECODE_DECODER(*pc); CODE_FETCH_HOOK(mrb, irep, pc, regs); switch (insn) {
#define INIT_DISPATCH for (;;) { insn = BYTECODE_DECODER(*pc); CODE_FETCH_HOOK(mrb, irep, pc, regs); switch (insn) {
#define CASE(insn,ops) case insn: pc0=pc++; FETCH_ ## ops ();
; L_ ## insn ## _BODY:
#define CASE(insn,ops) case insn: pc0=pc++; FETCH_ ## ops ();
#define NEXT break
#define NEXT break
#define JUMP NEXT
#define JUMP NEXT
#define END_DISPATCH }}
#define END_DISPATCH }}
...
@@ -909,7 +909,7 @@ argnum_error(mrb_state *mrb, mrb_int num)
...
@@ -909,7 +909,7 @@ argnum_error(mrb_state *mrb, mrb_int num)
#else
#else
#define INIT_DISPATCH JUMP; return mrb_nil_value();
#define INIT_DISPATCH JUMP; return mrb_nil_value();
#define CASE(insn,ops) L_ ## insn: pc0=pc++; FETCH_ ## ops ();
L_ ## insn ## _BODY:
#define CASE(insn,ops) L_ ## insn: pc0=pc++; FETCH_ ## ops ();
#define NEXT insn=BYTECODE_DECODER(*pc); CODE_FETCH_HOOK(mrb, irep, pc, regs); goto *optable[insn]
#define NEXT insn=BYTECODE_DECODER(*pc); CODE_FETCH_HOOK(mrb, irep, pc, regs); goto *optable[insn]
#define JUMP NEXT
#define JUMP NEXT
...
@@ -1512,7 +1512,7 @@ RETRY_TRY_BLOCK:
...
@@ -1512,7 +1512,7 @@ RETRY_TRY_BLOCK:
mrb
->
c
->
stack
[
0
]
=
mrb_nil_value
();
mrb
->
c
->
stack
[
0
]
=
mrb_nil_value
();
a
=
0
;
a
=
0
;
c
=
OP_R_NORMAL
;
c
=
OP_R_NORMAL
;
goto
L_
OP_RETURN_BODY
;
goto
L_
RETURN
;
}
}
pool
=
irep
->
pool
;
pool
=
irep
->
pool
;
syms
=
irep
->
syms
;
syms
=
irep
->
syms
;
...
@@ -2733,37 +2733,6 @@ RETRY_TRY_BLOCK:
...
@@ -2733,37 +2733,6 @@ RETRY_TRY_BLOCK:
goto
L_RAISE
;
goto
L_RAISE
;
}
}
CASE
(
OP_EXT1
,
Z
)
{
insn
=
READ_B
();
switch
(
insn
)
{
#define OPCODE(insn,ops) case OP_ ## insn: FETCH_ ## ops ## _1(); goto L_OP_ ## insn ## _BODY;
#include "mruby/ops.h"
#undef OPCODE
}
pc
--
;
NEXT
;
}
CASE
(
OP_EXT2
,
Z
)
{
insn
=
READ_B
();
switch
(
insn
)
{
#define OPCODE(insn,ops) case OP_ ## insn: FETCH_ ## ops ## _2(); goto L_OP_ ## insn ## _BODY;
#include "mruby/ops.h"
#undef OPCODE
}
pc
--
;
NEXT
;
}
CASE
(
OP_EXT3
,
Z
)
{
uint8_t
insn
=
READ_B
();
switch
(
insn
)
{
#define OPCODE(insn,ops) case OP_ ## insn: FETCH_ ## ops ## _3(); goto L_OP_ ## insn ## _BODY;
#include "mruby/ops.h"
#undef OPCODE
}
pc
--
;
NEXT
;
}
CASE
(
OP_STOP
,
Z
)
{
CASE
(
OP_STOP
,
Z
)
{
/* stop VM */
/* stop VM */
L_STOP:
L_STOP:
...
...
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