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
6a7f133d
Commit
6a7f133d
authored
May 16, 2014
by
ksss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include/mruby/opcode.h fix operation doc
src/vm.c fix operation doc [ci skip]
parent
41b46ca1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
63 deletions
+64
-63
include/mruby/opcode.h
include/mruby/opcode.h
+34
-34
src/vm.c
src/vm.c
+30
-29
No files found.
include/mruby/opcode.h
View file @
6a7f133d
...
@@ -55,26 +55,26 @@ enum {
...
@@ -55,26 +55,26 @@ enum {
------------------------------------------------------------------------*/
------------------------------------------------------------------------*/
OP_NOP
=
0
,
/* */
OP_NOP
=
0
,
/* */
OP_MOVE
,
/* A B R(A) := R(B) */
OP_MOVE
,
/* A B R(A) := R(B) */
OP_LOADL
,
/* A Bx R(A) :=
Lit(Bx)
*/
OP_LOADL
,
/* A Bx R(A) :=
Pool(Bx)
*/
OP_LOADI
,
/* A sBx R(A) := sBx */
OP_LOADI
,
/* A sBx R(A) := sBx */
OP_LOADSYM
,
/* A Bx R(A) := Sym
(Bx)
*/
OP_LOADSYM
,
/* A Bx R(A) := Sym
s(Bx)
*/
OP_LOADNIL
,
/* A R(A) := nil */
OP_LOADNIL
,
/* A R(A) := nil */
OP_LOADSELF
,
/* A R(A) := self */
OP_LOADSELF
,
/* A R(A) := self */
OP_LOADT
,
/* A R(A) := true */
OP_LOADT
,
/* A R(A) := true */
OP_LOADF
,
/* A R(A) := false */
OP_LOADF
,
/* A R(A) := false */
OP_GETGLOBAL
,
/* A Bx R(A) := getglobal(Sym
(Bx))
*/
OP_GETGLOBAL
,
/* A Bx R(A) := getglobal(Sym
s(Bx))
*/
OP_SETGLOBAL
,
/* A Bx setglobal(Sym
(Bx), R(A))
*/
OP_SETGLOBAL
,
/* A Bx setglobal(Sym
s(Bx), R(A))
*/
OP_GETSPECIAL
,
/*A Bx R(A) := Special[Bx] */
OP_GETSPECIAL
,
/*A Bx R(A) := Special[Bx] */
OP_SETSPECIAL
,
/*A Bx Special[Bx] := R(A) */
OP_SETSPECIAL
,
/*A Bx Special[Bx] := R(A) */
OP_GETIV
,
/* A Bx R(A) := ivget(Sym
(Bx))
*/
OP_GETIV
,
/* A Bx R(A) := ivget(Sym
s(Bx))
*/
OP_SETIV
,
/* A Bx ivset(Sym
(Bx),R(A))
*/
OP_SETIV
,
/* A Bx ivset(Sym
s(Bx),R(A))
*/
OP_GETCV
,
/* A Bx R(A) := cvget(Sym
(Bx))
*/
OP_GETCV
,
/* A Bx R(A) := cvget(Sym
s(Bx))
*/
OP_SETCV
,
/* A Bx cvset(Sym
(Bx),R(A))
*/
OP_SETCV
,
/* A Bx cvset(Sym
s(Bx),R(A))
*/
OP_GETCONST
,
/* A Bx R(A) := constget(Sym
(Bx))
*/
OP_GETCONST
,
/* A Bx R(A) := constget(Sym
s(Bx))
*/
OP_SETCONST
,
/* A Bx constset(Sym
(Bx),R(A))
*/
OP_SETCONST
,
/* A Bx constset(Sym
s(Bx),R(A))
*/
OP_GETMCNST
,
/* A Bx R(A) := R(A)::Sym
(Bx)
*/
OP_GETMCNST
,
/* A Bx R(A) := R(A)::Sym
s(Bx)
*/
OP_SETMCNST
,
/* A Bx R(A+1)::Sym
(Bx) := R(A)
*/
OP_SETMCNST
,
/* A Bx R(A+1)::Sym
s(Bx) := R(A)
*/
OP_GETUPVAR
,
/* A B C R(A) := uvget(B,C) */
OP_GETUPVAR
,
/* A B C R(A) := uvget(B,C) */
OP_SETUPVAR
,
/* A B C uvset(B,C,R(A)) */
OP_SETUPVAR
,
/* A B C uvset(B,C,R(A)) */
...
@@ -88,31 +88,31 @@ enum {
...
@@ -88,31 +88,31 @@ enum {
OP_EPUSH
,
/* Bx ensure_push(SEQ[Bx]) */
OP_EPUSH
,
/* Bx ensure_push(SEQ[Bx]) */
OP_EPOP
,
/* A A.times{ensure_pop().call} */
OP_EPOP
,
/* A A.times{ensure_pop().call} */
OP_SEND
,
/* A B C R(A) := call(R(A),
mSym
(B),R(A+1),...,R(A+C)) */
OP_SEND
,
/* A B C R(A) := call(R(A),
Syms
(B),R(A+1),...,R(A+C)) */
OP_SENDB
,
/* A B C R(A) := call(R(A),
mSym
(B),R(A+1),...,R(A+C),&R(A+C+1))*/
OP_SENDB
,
/* A B C R(A) := call(R(A),
Syms
(B),R(A+1),...,R(A+C),&R(A+C+1))*/
OP_FSEND
,
/* A B C R(A) := fcall(R(A),
mSym
(B),R(A+1),...,R(A+C-1)) */
OP_FSEND
,
/* A B C R(A) := fcall(R(A),
Syms
(B),R(A+1),...,R(A+C-1)) */
OP_CALL
,
/* A
B C R(A) := self.call(R(A),.., R(A+C))
*/
OP_CALL
,
/* A
R(A) := self.call(frame.argc, frame.argv)
*/
OP_SUPER
,
/* A
B C R(A) := super(R(A+1),... ,R(A+C-
1)) */
OP_SUPER
,
/* A
C R(A) := super(R(A+1),... ,R(A+C+
1)) */
OP_ARGARY
,
/* A Bx R(A) := argument array (16=6:1:5:4) */
OP_ARGARY
,
/* A Bx R(A) := argument array (16=6:1:5:4) */
OP_ENTER
,
/* Ax arg setup according to flags (23=5:5:1:5:5:1:1) */
OP_ENTER
,
/* Ax arg setup according to flags (23=5:5:1:5:5:1:1) */
OP_KARG
,
/* A B C R(A) := kdict[
mSym(B)]; if C kdict.rm(mSym
(B)) */
OP_KARG
,
/* A B C R(A) := kdict[
Syms(B)]; if C kdict.rm(Syms
(B)) */
OP_KDICT
,
/* A C R(A) := kdict */
OP_KDICT
,
/* A C R(A) := kdict */
OP_RETURN
,
/* A B return R(A) (B=normal,in-block return/break) */
OP_RETURN
,
/* A B return R(A) (B=normal,in-block return/break) */
OP_TAILCALL
,
/* A B C return call(R(A),
mSym
(B),*R(C)) */
OP_TAILCALL
,
/* A B C return call(R(A),
Syms
(B),*R(C)) */
OP_BLKPUSH
,
/* A Bx R(A) := block (16=6:1:5:4) */
OP_BLKPUSH
,
/* A Bx R(A) := block (16=6:1:5:4) */
OP_ADD
,
/* A B C R(A) := R(A)+R(A+1) (
mSyms[B]=:+,C=1)
*/
OP_ADD
,
/* A B C R(A) := R(A)+R(A+1) (
Syms[B]=:+,C=1)
*/
OP_ADDI
,
/* A B C R(A) := R(A)+C (
mSyms[B]=:+)
*/
OP_ADDI
,
/* A B C R(A) := R(A)+C (
Syms[B]=:+)
*/
OP_SUB
,
/* A B C R(A) := R(A)-R(A+1) (
mSyms[B]=:-,C=1)
*/
OP_SUB
,
/* A B C R(A) := R(A)-R(A+1) (
Syms[B]=:-,C=1)
*/
OP_SUBI
,
/* A B C R(A) := R(A)-C (
mSyms[B]=:-)
*/
OP_SUBI
,
/* A B C R(A) := R(A)-C (
Syms[B]=:-)
*/
OP_MUL
,
/* A B C R(A) := R(A)*R(A+1) (
mSyms[B]=:*,C=1)
*/
OP_MUL
,
/* A B C R(A) := R(A)*R(A+1) (
Syms[B]=:*,C=1)
*/
OP_DIV
,
/* A B C R(A) := R(A)/R(A+1) (
mSyms[B]=:/,C=1)
*/
OP_DIV
,
/* A B C R(A) := R(A)/R(A+1) (
Syms[B]=:/,C=1)
*/
OP_EQ
,
/* A B C R(A) := R(A)==R(A+1) (
mSyms[B]=:==,C=1)
*/
OP_EQ
,
/* A B C R(A) := R(A)==R(A+1) (
Syms[B]=:==,C=1)
*/
OP_LT
,
/* A B C R(A) := R(A)<R(A+1) (
mSyms[B]=:<,C=1)
*/
OP_LT
,
/* A B C R(A) := R(A)<R(A+1) (
Syms[B]=:<,C=1)
*/
OP_LE
,
/* A B C R(A) := R(A)<=R(A+1) (
mSyms[B]=:<=,C=1)
*/
OP_LE
,
/* A B C R(A) := R(A)<=R(A+1) (
Syms[B]=:<=,C=1)
*/
OP_GT
,
/* A B C R(A) := R(A)>R(A+1) (
mSyms[B]=:>,C=1)
*/
OP_GT
,
/* A B C R(A) := R(A)>R(A+1) (
Syms[B]=:>,C=1)
*/
OP_GE
,
/* A B C R(A) := R(A)>=R(A+1) (
mSyms[B]=:>=,C=1)
*/
OP_GE
,
/* A B C R(A) := R(A)>=R(A+1) (
Syms[B]=:>=,C=1)
*/
OP_ARRAY
,
/* A B C R(A) := ary_new(R(B),R(B+1)..R(B+C)) */
OP_ARRAY
,
/* A B C R(A) := ary_new(R(B),R(B+1)..R(B+C)) */
OP_ARYCAT
,
/* A B ary_cat(R(A),R(B)) */
OP_ARYCAT
,
/* A B ary_cat(R(A),R(B)) */
...
@@ -129,14 +129,14 @@ enum {
...
@@ -129,14 +129,14 @@ enum {
OP_RANGE
,
/* A B C R(A) := range_new(R(B),R(B+1),C) */
OP_RANGE
,
/* A B C R(A) := range_new(R(B),R(B+1),C) */
OP_OCLASS
,
/* A R(A) := ::Object */
OP_OCLASS
,
/* A R(A) := ::Object */
OP_CLASS
,
/* A B R(A) := newclass(R(A),
mSym
(B),R(A+1)) */
OP_CLASS
,
/* A B R(A) := newclass(R(A),
Syms
(B),R(A+1)) */
OP_MODULE
,
/* A B R(A) := newmodule(R(A),
mSym
(B)) */
OP_MODULE
,
/* A B R(A) := newmodule(R(A),
Syms
(B)) */
OP_EXEC
,
/* A Bx R(A) := blockexec(R(A),SEQ[Bx]) */
OP_EXEC
,
/* A Bx R(A) := blockexec(R(A),SEQ[Bx]) */
OP_METHOD
,
/* A B R(A).newmethod(
mSym
(B),R(A+1)) */
OP_METHOD
,
/* A B R(A).newmethod(
Syms
(B),R(A+1)) */
OP_SCLASS
,
/* A B R(A) := R(B).singleton_class */
OP_SCLASS
,
/* A B R(A) := R(B).singleton_class */
OP_TCLASS
,
/* A R(A) := target_class */
OP_TCLASS
,
/* A R(A) := target_class */
OP_DEBUG
,
/* A
print R(A)
*/
OP_DEBUG
,
/* A
B C print R(A),R(B),R(C)
*/
OP_STOP
,
/* stop VM */
OP_STOP
,
/* stop VM */
OP_ERR
,
/* Bx raise RuntimeError with message Lit(Bx) */
OP_ERR
,
/* Bx raise RuntimeError with message Lit(Bx) */
...
...
src/vm.c
View file @
6a7f133d
...
@@ -724,13 +724,13 @@ RETRY_TRY_BLOCK:
...
@@ -724,13 +724,13 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_LOADI
)
{
CASE
(
OP_LOADI
)
{
/* A
Bx
R(A) := sBx */
/* A
sBx
R(A) := sBx */
SET_INT_VALUE
(
regs
[
GETARG_A
(
i
)],
GETARG_sBx
(
i
));
SET_INT_VALUE
(
regs
[
GETARG_A
(
i
)],
GETARG_sBx
(
i
));
NEXT
;
NEXT
;
}
}
CASE
(
OP_LOADSYM
)
{
CASE
(
OP_LOADSYM
)
{
/* A B
R(A) := Sym(B
) */
/* A B
x R(A) := Syms(Bx
) */
SET_SYM_VALUE
(
regs
[
GETARG_A
(
i
)],
syms
[
GETARG_Bx
(
i
)]);
SET_SYM_VALUE
(
regs
[
GETARG_A
(
i
)],
syms
[
GETARG_Bx
(
i
)]);
NEXT
;
NEXT
;
}
}
...
@@ -754,13 +754,13 @@ RETRY_TRY_BLOCK:
...
@@ -754,13 +754,13 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_GETGLOBAL
)
{
CASE
(
OP_GETGLOBAL
)
{
/* A B
R(A) := getglobal(Sym(B
)) */
/* A B
x R(A) := getglobal(Syms(Bx
)) */
regs
[
GETARG_A
(
i
)]
=
mrb_gv_get
(
mrb
,
syms
[
GETARG_Bx
(
i
)]);
regs
[
GETARG_A
(
i
)]
=
mrb_gv_get
(
mrb
,
syms
[
GETARG_Bx
(
i
)]);
NEXT
;
NEXT
;
}
}
CASE
(
OP_SETGLOBAL
)
{
CASE
(
OP_SETGLOBAL
)
{
/* setglobal(Sym
(b
), R(A)) */
/* setglobal(Sym
s(Bx
), R(A)) */
mrb_gv_set
(
mrb
,
syms
[
GETARG_Bx
(
i
)],
regs
[
GETARG_A
(
i
)]);
mrb_gv_set
(
mrb
,
syms
[
GETARG_Bx
(
i
)],
regs
[
GETARG_A
(
i
)]);
NEXT
;
NEXT
;
}
}
...
@@ -784,13 +784,13 @@ RETRY_TRY_BLOCK:
...
@@ -784,13 +784,13 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_SETIV
)
{
CASE
(
OP_SETIV
)
{
/* ivset(Sym
(B
),R(A)) */
/* ivset(Sym
s(Bx
),R(A)) */
mrb_vm_iv_set
(
mrb
,
syms
[
GETARG_Bx
(
i
)],
regs
[
GETARG_A
(
i
)]);
mrb_vm_iv_set
(
mrb
,
syms
[
GETARG_Bx
(
i
)],
regs
[
GETARG_A
(
i
)]);
NEXT
;
NEXT
;
}
}
CASE
(
OP_GETCV
)
{
CASE
(
OP_GETCV
)
{
/* A B
R(A) := ivget(Sym(B
)) */
/* A B
x R(A) := cvget(Syms(Bx
)) */
ERR_PC_SET
(
mrb
,
pc
);
ERR_PC_SET
(
mrb
,
pc
);
regs
[
GETARG_A
(
i
)]
=
mrb_vm_cv_get
(
mrb
,
syms
[
GETARG_Bx
(
i
)]);
regs
[
GETARG_A
(
i
)]
=
mrb_vm_cv_get
(
mrb
,
syms
[
GETARG_Bx
(
i
)]);
ERR_PC_CLR
(
mrb
);
ERR_PC_CLR
(
mrb
);
...
@@ -798,13 +798,13 @@ RETRY_TRY_BLOCK:
...
@@ -798,13 +798,13 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_SETCV
)
{
CASE
(
OP_SETCV
)
{
/*
ivset(Sym(B
),R(A)) */
/*
cvset(Syms(Bx
),R(A)) */
mrb_vm_cv_set
(
mrb
,
syms
[
GETARG_Bx
(
i
)],
regs
[
GETARG_A
(
i
)]);
mrb_vm_cv_set
(
mrb
,
syms
[
GETARG_Bx
(
i
)],
regs
[
GETARG_A
(
i
)]);
NEXT
;
NEXT
;
}
}
CASE
(
OP_GETCONST
)
{
CASE
(
OP_GETCONST
)
{
/* A B
R(A) := constget(Sym(B
)) */
/* A B
x R(A) := constget(Syms(Bx
)) */
mrb_value
val
;
mrb_value
val
;
ERR_PC_SET
(
mrb
,
pc
);
ERR_PC_SET
(
mrb
,
pc
);
...
@@ -816,13 +816,13 @@ RETRY_TRY_BLOCK:
...
@@ -816,13 +816,13 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_SETCONST
)
{
CASE
(
OP_SETCONST
)
{
/* A B
constset(Sym(B
),R(A)) */
/* A B
x constset(Syms(Bx
),R(A)) */
mrb_vm_const_set
(
mrb
,
syms
[
GETARG_Bx
(
i
)],
regs
[
GETARG_A
(
i
)]);
mrb_vm_const_set
(
mrb
,
syms
[
GETARG_Bx
(
i
)],
regs
[
GETARG_A
(
i
)]);
NEXT
;
NEXT
;
}
}
CASE
(
OP_GETMCNST
)
{
CASE
(
OP_GETMCNST
)
{
/* A B
C R(A) := R(C)::Sym(B
) */
/* A B
x R(A) := R(A)::Syms(Bx
) */
mrb_value
val
;
mrb_value
val
;
int
a
=
GETARG_A
(
i
);
int
a
=
GETARG_A
(
i
);
...
@@ -835,7 +835,7 @@ RETRY_TRY_BLOCK:
...
@@ -835,7 +835,7 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_SETMCNST
)
{
CASE
(
OP_SETMCNST
)
{
/* A B
C R(A+1)::Sym(B
) := R(A) */
/* A B
x R(A+1)::Syms(Bx
) := R(A) */
int
a
=
GETARG_A
(
i
);
int
a
=
GETARG_A
(
i
);
mrb_const_set
(
mrb
,
regs
[
a
+
1
],
syms
[
GETARG_Bx
(
i
)],
regs
[
a
]);
mrb_const_set
(
mrb
,
regs
[
a
+
1
],
syms
[
GETARG_Bx
(
i
)],
regs
[
a
]);
...
@@ -861,7 +861,6 @@ RETRY_TRY_BLOCK:
...
@@ -861,7 +861,6 @@ RETRY_TRY_BLOCK:
CASE
(
OP_SETUPVAR
)
{
CASE
(
OP_SETUPVAR
)
{
/* A B C uvset(B,C,R(A)) */
/* A B C uvset(B,C,R(A)) */
/* A B C R(A) := uvget(B,C) */
int
up
=
GETARG_C
(
i
);
int
up
=
GETARG_C
(
i
);
struct
REnv
*
e
=
uvenv
(
mrb
,
up
);
struct
REnv
*
e
=
uvenv
(
mrb
,
up
);
...
@@ -891,7 +890,7 @@ RETRY_TRY_BLOCK:
...
@@ -891,7 +890,7 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_JMPNOT
)
{
CASE
(
OP_JMPNOT
)
{
/* A sBx if R(A) pc+=sBx */
/* A sBx if
!
R(A) pc+=sBx */
if
(
!
mrb_test
(
regs
[
GETARG_A
(
i
)]))
{
if
(
!
mrb_test
(
regs
[
GETARG_A
(
i
)]))
{
pc
+=
GETARG_sBx
(
i
);
pc
+=
GETARG_sBx
(
i
);
JUMP
;
JUMP
;
...
@@ -918,6 +917,7 @@ RETRY_TRY_BLOCK:
...
@@ -918,6 +917,7 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_POPERR
)
{
CASE
(
OP_POPERR
)
{
/* A A.times{rescue_pop()} */
int
a
=
GETARG_A
(
i
);
int
a
=
GETARG_A
(
i
);
while
(
a
--
)
{
while
(
a
--
)
{
...
@@ -962,7 +962,7 @@ RETRY_TRY_BLOCK:
...
@@ -962,7 +962,7 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_LOADNIL
)
{
CASE
(
OP_LOADNIL
)
{
/* A
B
R(A) := nil */
/* A R(A) := nil */
int
a
=
GETARG_A
(
i
);
int
a
=
GETARG_A
(
i
);
SET_NIL_VALUE
(
regs
[
a
]);
SET_NIL_VALUE
(
regs
[
a
]);
...
@@ -970,12 +970,13 @@ RETRY_TRY_BLOCK:
...
@@ -970,12 +970,13 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_SENDB
)
{
CASE
(
OP_SENDB
)
{
/* A B C R(A) := call(R(A),Syms(B),R(A+1),...,R(A+C),&R(A+C+1))*/
/* fall through */
/* fall through */
};
};
L_SEND:
L_SEND:
CASE
(
OP_SEND
)
{
CASE
(
OP_SEND
)
{
/* A B C R(A) := call(R(A),Sym
(B),R(A+1),... ,R(A+C-1
)) */
/* A B C R(A) := call(R(A),Sym
s(B),R(A+1),...,R(A+C
)) */
int
a
=
GETARG_A
(
i
);
int
a
=
GETARG_A
(
i
);
int
n
=
GETARG_C
(
i
);
int
n
=
GETARG_C
(
i
);
struct
RProc
*
m
;
struct
RProc
*
m
;
...
@@ -1077,7 +1078,7 @@ RETRY_TRY_BLOCK:
...
@@ -1077,7 +1078,7 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_FSEND
)
{
CASE
(
OP_FSEND
)
{
/* A B C R(A) := fcall(R(A),Sym
(B),R(A+1),... ,R(A+C
)) */
/* A B C R(A) := fcall(R(A),Sym
s(B),R(A+1),... ,R(A+C-1
)) */
NEXT
;
NEXT
;
}
}
...
@@ -1141,7 +1142,7 @@ RETRY_TRY_BLOCK:
...
@@ -1141,7 +1142,7 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_SUPER
)
{
CASE
(
OP_SUPER
)
{
/* A
B C R(A) := super(R(A+1),... ,R(A+C-
1)) */
/* A
C R(A) := super(R(A+1),... ,R(A+C+
1)) */
mrb_value
recv
;
mrb_value
recv
;
mrb_callinfo
*
ci
=
mrb
->
c
->
ci
;
mrb_callinfo
*
ci
=
mrb
->
c
->
ci
;
struct
RProc
*
m
;
struct
RProc
*
m
;
...
@@ -1268,7 +1269,7 @@ RETRY_TRY_BLOCK:
...
@@ -1268,7 +1269,7 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_ENTER
)
{
CASE
(
OP_ENTER
)
{
/* Ax arg setup according to flags (2
4
=5:5:1:5:5:1:1) */
/* Ax arg setup according to flags (2
3
=5:5:1:5:5:1:1) */
/* number of optional arguments times OP_JMP should follow */
/* number of optional arguments times OP_JMP should follow */
mrb_aspec
ax
=
GETARG_Ax
(
i
);
mrb_aspec
ax
=
GETARG_Ax
(
i
);
int
m1
=
(
ax
>>
18
)
&
0x1f
;
int
m1
=
(
ax
>>
18
)
&
0x1f
;
...
@@ -1356,7 +1357,7 @@ RETRY_TRY_BLOCK:
...
@@ -1356,7 +1357,7 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_KARG
)
{
CASE
(
OP_KARG
)
{
/* A B C R(A) := kdict[Sym
(B)]; if C kdict.rm(Sym
(B)) */
/* A B C R(A) := kdict[Sym
s(B)]; if C kdict.rm(Syms
(B)) */
/* if C == 2; raise unless kdict.empty? */
/* if C == 2; raise unless kdict.empty? */
/* OP_JMP should follow to skip init code */
/* OP_JMP should follow to skip init code */
NEXT
;
NEXT
;
...
@@ -1371,7 +1372,7 @@ RETRY_TRY_BLOCK:
...
@@ -1371,7 +1372,7 @@ RETRY_TRY_BLOCK:
i
=
MKOP_AB
(
OP_RETURN
,
GETARG_A
(
i
),
OP_R_NORMAL
);
i
=
MKOP_AB
(
OP_RETURN
,
GETARG_A
(
i
),
OP_R_NORMAL
);
/* fall through */
/* fall through */
CASE
(
OP_RETURN
)
{
CASE
(
OP_RETURN
)
{
/* A
return R(A
) */
/* A
B return R(A) (B=normal,in-block return/break
) */
if
(
mrb
->
exc
)
{
if
(
mrb
->
exc
)
{
mrb_callinfo
*
ci
;
mrb_callinfo
*
ci
;
int
eidx
;
int
eidx
;
...
@@ -1509,7 +1510,7 @@ RETRY_TRY_BLOCK:
...
@@ -1509,7 +1510,7 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_TAILCALL
)
{
CASE
(
OP_TAILCALL
)
{
/* A B C return call(R(A),Sym
(B),R(A+1),... ,R(A+C-
1)) */
/* A B C return call(R(A),Sym
s(B),R(A+1),... ,R(A+C+
1)) */
int
a
=
GETARG_A
(
i
);
int
a
=
GETARG_A
(
i
);
int
n
=
GETARG_C
(
i
);
int
n
=
GETARG_C
(
i
);
struct
RProc
*
m
;
struct
RProc
*
m
;
...
@@ -1944,7 +1945,7 @@ RETRY_TRY_BLOCK:
...
@@ -1944,7 +1945,7 @@ RETRY_TRY_BLOCK:
} while(0)
} while(0)
CASE
(
OP_EQ
)
{
CASE
(
OP_EQ
)
{
/* A B C R(A) := R(A)
<
R(A+1) (Syms[B]=:==,C=1)*/
/* A B C R(A) := R(A)
==
R(A+1) (Syms[B]=:==,C=1)*/
int
a
=
GETARG_A
(
i
);
int
a
=
GETARG_A
(
i
);
if
(
mrb_obj_eq
(
mrb
,
regs
[
a
],
regs
[
a
+
1
]))
{
if
(
mrb_obj_eq
(
mrb
,
regs
[
a
],
regs
[
a
+
1
]))
{
SET_TRUE_VALUE
(
regs
[
a
]);
SET_TRUE_VALUE
(
regs
[
a
]);
...
@@ -1970,14 +1971,14 @@ RETRY_TRY_BLOCK:
...
@@ -1970,14 +1971,14 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_GT
)
{
CASE
(
OP_GT
)
{
/* A B C R(A) := R(A)
<R(A+1) (Syms[B]=:<
,C=1)*/
/* A B C R(A) := R(A)
>R(A+1) (Syms[B]=:>
,C=1)*/
int
a
=
GETARG_A
(
i
);
int
a
=
GETARG_A
(
i
);
OP_CMP
(
>
);
OP_CMP
(
>
);
NEXT
;
NEXT
;
}
}
CASE
(
OP_GE
)
{
CASE
(
OP_GE
)
{
/* A B C R(A) := R(A)
<=R(A+1) (Syms[B]=:<
=,C=1)*/
/* A B C R(A) := R(A)
>=R(A+1) (Syms[B]=:>
=,C=1)*/
int
a
=
GETARG_A
(
i
);
int
a
=
GETARG_A
(
i
);
OP_CMP
(
>=
);
OP_CMP
(
>=
);
NEXT
;
NEXT
;
...
@@ -2123,7 +2124,7 @@ RETRY_TRY_BLOCK:
...
@@ -2123,7 +2124,7 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_CLASS
)
{
CASE
(
OP_CLASS
)
{
/* A B R(A) := newclass(R(A),Sym(B),R(A+1)) */
/* A B R(A) := newclass(R(A),Sym
s
(B),R(A+1)) */
struct
RClass
*
c
=
0
;
struct
RClass
*
c
=
0
;
int
a
=
GETARG_A
(
i
);
int
a
=
GETARG_A
(
i
);
mrb_value
base
,
super
;
mrb_value
base
,
super
;
...
@@ -2141,7 +2142,7 @@ RETRY_TRY_BLOCK:
...
@@ -2141,7 +2142,7 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_MODULE
)
{
CASE
(
OP_MODULE
)
{
/* A B R(A) := newmodule(R(A),Sym(B)) */
/* A B R(A) := newmodule(R(A),Sym
s
(B)) */
struct
RClass
*
c
=
0
;
struct
RClass
*
c
=
0
;
int
a
=
GETARG_A
(
i
);
int
a
=
GETARG_A
(
i
);
mrb_value
base
;
mrb_value
base
;
...
@@ -2202,7 +2203,7 @@ RETRY_TRY_BLOCK:
...
@@ -2202,7 +2203,7 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_METHOD
)
{
CASE
(
OP_METHOD
)
{
/* A B R(A).newmethod(Sym(B),R(A+1)) */
/* A B R(A).newmethod(Sym
s
(B),R(A+1)) */
int
a
=
GETARG_A
(
i
);
int
a
=
GETARG_A
(
i
);
struct
RClass
*
c
=
mrb_class_ptr
(
regs
[
a
]);
struct
RClass
*
c
=
mrb_class_ptr
(
regs
[
a
]);
...
@@ -2219,7 +2220,7 @@ RETRY_TRY_BLOCK:
...
@@ -2219,7 +2220,7 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_TCLASS
)
{
CASE
(
OP_TCLASS
)
{
/* A
B
R(A) := target_class */
/* A
R(A) := target_class */
if
(
!
mrb
->
c
->
ci
->
target_class
)
{
if
(
!
mrb
->
c
->
ci
->
target_class
)
{
mrb_value
exc
=
mrb_exc_new_str_lit
(
mrb
,
E_TYPE_ERROR
,
"no target class or module"
);
mrb_value
exc
=
mrb_exc_new_str_lit
(
mrb
,
E_TYPE_ERROR
,
"no target class or module"
);
mrb
->
exc
=
mrb_obj_ptr
(
exc
);
mrb
->
exc
=
mrb_obj_ptr
(
exc
);
...
@@ -2238,7 +2239,7 @@ RETRY_TRY_BLOCK:
...
@@ -2238,7 +2239,7 @@ RETRY_TRY_BLOCK:
}
}
CASE
(
OP_DEBUG
)
{
CASE
(
OP_DEBUG
)
{
/* A
debug print R(A),R(B),R(C) */
/* A
B C
debug print R(A),R(B),R(C) */
#ifdef ENABLE_DEBUG
#ifdef ENABLE_DEBUG
mrb
->
debug_op_hook
(
mrb
,
irep
,
pc
,
regs
);
mrb
->
debug_op_hook
(
mrb
,
irep
,
pc
,
regs
);
#else
#else
...
...
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