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
0d7b4dec
Unverified
Commit
0d7b4dec
authored
May 24, 2020
by
dearblue
Committed by
Yukihiro "Matz" Matsumoto
Oct 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed push/pop instructions for rescue/ensure
`OP_PUSHERR`, `OP_POPERR`, `OP_EPUSH` and `OP_EPOP` are removed.
parent
f467b02d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
106 deletions
+0
-106
doc/opcode.md
doc/opcode.md
+0
-4
include/mruby/ops.h
include/mruby/ops.h
+0
-4
src/codedump.c
src/codedump.c
+0
-12
src/vm.c
src/vm.c
+0
-86
No files found.
doc/opcode.md
View file @
0d7b4dec
...
...
@@ -62,13 +62,9 @@ sign) of operands.
| OP_JMPIF | BS | if R(a) pc=b |
| OP_JMPNOT | BS | if !R(a) pc=b |
| OP_JMPNIL | BS | if R(a)==nil pc=b |
| OP_ONERR | S | rescue_push(a) |
| OP_EXCEPT | B | R(a) = exc |
| OP_RESCUE | BB | R(b) = R(a).isa?(R(b)) |
| OP_POPERR | B | a.times{rescue_pop()} |
| OP_RAISEIF | B | raise(R(a)) if R(a) |
| OP_EPUSH | B | ensure_push(SEQ[a]) |
| OP_EPOP | B | A.times{ensure_pop().call} |
| OP_SENDV | BB | R(a) = call(R(a),Syms(b),
*
R(a+1)) |
| OP_SENDVB | BB | R(a) = call(R(a),Syms(b),
*
R(a+1),&R(a+2)) |
| OP_SEND | BBB | R(a) = call(R(a),Syms(b),R(a+1),...,R(a+c)) |
...
...
include/mruby/ops.h
View file @
0d7b4dec
...
...
@@ -49,13 +49,9 @@ OPCODE(JMP, S) /* pc=a */
OPCODE
(
JMPIF
,
BS
)
/* if R(a) pc=b */
OPCODE
(
JMPNOT
,
BS
)
/* if !R(a) pc=b */
OPCODE
(
JMPNIL
,
BS
)
/* if R(a)==nil pc=b */
OPCODE
(
ONERR
,
S
)
/* rescue_push(a) */
OPCODE
(
EXCEPT
,
B
)
/* R(a) = exc */
OPCODE
(
RESCUE
,
BB
)
/* R(b) = R(a).isa?(R(b)) */
OPCODE
(
POPERR
,
B
)
/* a.times{rescue_pop()} */
OPCODE
(
RAISEIF
,
B
)
/* raise(R(a)) if R(a) */
OPCODE
(
EPUSH
,
B
)
/* ensure_push(SEQ[a]) */
OPCODE
(
EPOP
,
B
)
/* A.times{ensure_pop().call} */
OPCODE
(
SENDV
,
BB
)
/* R(a) = call(R(a),Syms(b),*R(a+1)) */
OPCODE
(
SENDVB
,
BB
)
/* R(a) = call(R(a),Syms(b),*R(a+1),&R(a+2)) */
OPCODE
(
SEND
,
BBB
)
/* R(a) = call(R(a),Syms(b),R(a+1),...,R(a+c)) */
...
...
src/codedump.c
View file @
0d7b4dec
...
...
@@ -493,12 +493,6 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
printf
(
"OP_ERR
\t
L(%d)
\n
"
,
a
);
}
break
;
CASE
(
OP_EPUSH
,
B
);
printf
(
"OP_EPUSH
\t\t
:I(%d:%p)
\n
"
,
a
,
irep
->
reps
[
a
]);
break
;
CASE
(
OP_ONERR
,
S
);
printf
(
"OP_ONERR
\t
%03d
\n
"
,
a
);
break
;
CASE
(
OP_EXCEPT
,
B
);
printf
(
"OP_EXCEPT
\t
R%d
\t\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
...
...
@@ -511,12 +505,6 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
printf
(
"OP_RAISEIF
\t
R%d
\t\t
"
,
a
);
print_lv_a
(
mrb
,
irep
,
a
);
break
;
CASE
(
OP_POPERR
,
B
);
printf
(
"OP_POPERR
\t
%d
\t\t\n
"
,
a
);
break
;
CASE
(
OP_EPOP
,
B
);
printf
(
"OP_EPOP
\t
%d
\n
"
,
a
);
break
;
CASE
(
OP_DEBUG
,
BBB
);
printf
(
"OP_DEBUG
\t
%d
\t
%d
\t
%d
\n
"
,
a
,
b
,
c
);
...
...
src/vm.c
View file @
0d7b4dec
...
...
@@ -1231,29 +1231,6 @@ RETRY_TRY_BLOCK:
NEXT
;
}
CASE
(
OP_ONERR
,
S
)
{
/* check rescue stack */
if
(
mrb
->
c
->
ci
->
ridx
==
UINT16_MAX
-
1
)
{
mrb_value
exc
=
mrb_exc_new_str_lit
(
mrb
,
E_RUNTIME_ERROR
,
"too many nested rescues"
);
mrb_exc_set
(
mrb
,
exc
);
goto
L_RAISE
;
}
/* expand rescue stack */
if
(
mrb
->
c
->
rsize
<=
mrb
->
c
->
ci
->
ridx
)
{
if
(
mrb
->
c
->
rsize
==
0
)
mrb
->
c
->
rsize
=
RESCUE_STACK_INIT_SIZE
;
else
{
mrb
->
c
->
rsize
*=
2
;
if
(
mrb
->
c
->
rsize
<=
mrb
->
c
->
ci
->
ridx
)
{
mrb
->
c
->
rsize
=
UINT16_MAX
;
}
}
mrb
->
c
->
rescue
=
(
uint16_t
*
)
mrb_realloc
(
mrb
,
mrb
->
c
->
rescue
,
sizeof
(
uint16_t
)
*
mrb
->
c
->
rsize
);
}
/* push rescue stack */
mrb
->
c
->
rescue
[
mrb
->
c
->
ci
->
ridx
++
]
=
a
;
NEXT
;
}
CASE
(
OP_EXCEPT
,
B
)
{
mrb_value
exc
;
...
...
@@ -1300,11 +1277,6 @@ RETRY_TRY_BLOCK:
NEXT
;
}
CASE
(
OP_POPERR
,
B
)
{
mrb
->
c
->
ci
->
ridx
-=
a
;
NEXT
;
}
CASE
(
OP_RAISEIF
,
B
)
{
mrb_value
exc
=
regs
[
a
];
if
(
mrb_break_p
(
exc
))
{
...
...
@@ -1318,64 +1290,6 @@ RETRY_TRY_BLOCK:
NEXT
;
}
CASE
(
OP_EPUSH
,
B
)
{
struct
RProc
*
p
;
p
=
mrb_closure_new
(
mrb
,
irep
->
reps
[
a
]);
/* check ensure stack */
if
(
mrb
->
c
->
eidx
==
UINT16_MAX
-
1
)
{
mrb_value
exc
=
mrb_exc_new_str_lit
(
mrb
,
E_RUNTIME_ERROR
,
"too many nested ensures"
);
mrb_exc_set
(
mrb
,
exc
);
goto
L_RAISE
;
}
/* expand ensure stack */
if
(
mrb
->
c
->
esize
<=
mrb
->
c
->
eidx
+
1
)
{
if
(
mrb
->
c
->
esize
==
0
)
mrb
->
c
->
esize
=
ENSURE_STACK_INIT_SIZE
;
else
{
mrb
->
c
->
esize
*=
2
;
if
(
mrb
->
c
->
esize
<=
mrb
->
c
->
eidx
)
{
mrb
->
c
->
esize
=
UINT16_MAX
;
}
}
mrb
->
c
->
ensure
=
(
struct
RProc
**
)
mrb_realloc
(
mrb
,
mrb
->
c
->
ensure
,
sizeof
(
struct
RProc
*
)
*
mrb
->
c
->
esize
);
}
/* push ensure stack */
mrb
->
c
->
ensure
[
mrb
->
c
->
eidx
++
]
=
p
;
mrb
->
c
->
ensure
[
mrb
->
c
->
eidx
]
=
NULL
;
mrb_gc_arena_restore
(
mrb
,
ai
);
NEXT
;
}
CASE
(
OP_EPOP
,
B
)
{
mrb_callinfo
*
ci
=
mrb
->
c
->
ci
;
unsigned
int
n
,
epos
=
ci
->
epos
;
mrb_value
self
=
regs
[
0
];
struct
RClass
*
target_class
=
ci
->
target_class
;
if
(
mrb
->
c
->
eidx
<=
epos
)
{
NEXT
;
}
if
(
a
>
(
int
)
mrb
->
c
->
eidx
-
epos
)
a
=
mrb
->
c
->
eidx
-
epos
;
for
(
n
=
0
;
n
<
a
;
n
++
)
{
int
nregs
=
irep
->
nregs
;
proc
=
mrb
->
c
->
ensure
[
epos
+
n
];
mrb
->
c
->
ensure
[
epos
+
n
]
=
NULL
;
if
(
proc
==
NULL
)
continue
;
irep
=
proc
->
body
.
irep
;
ci
=
cipush
(
mrb
,
pc
,
nregs
,
nregs
,
target_class
,
proc
,
ci
->
mid
,
0
);
mrb_stack_extend
(
mrb
,
irep
->
nregs
);
regs
[
0
]
=
self
;
pc
=
irep
->
iseq
;
}
pool
=
irep
->
pool
;
syms
=
irep
->
syms
;
mrb
->
c
->
eidx
=
epos
;
JUMP
;
}
CASE
(
OP_SENDV
,
BB
)
{
c
=
CALL_MAXARGS
;
goto
L_SEND
;
...
...
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