source: EcnlProtoTool/trunk/mruby-2.1.1/include/mruby/ops.h@ 439

Last change on this file since 439 was 439, checked in by coas-nagasima, 4 years ago

mrubyを2.1.1に更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 6.4 KB
Line 
1/* operand types:
2 + Z: no operand (Z,Z,Z,Z)
3 + B: 8bit (B,S,B,B)
4 + BB: 8+8bit (BB,SB,BS,SS)
5 + BBB: 8+8+8bit (BBB,SBB,BSB,SSB)
6 + BS: 8+16bit (BS,SS,BS,BS)
7 + S: 16bit (S,S,S,S)
8 + W: 24bit (W,W,W,W)
9*/
10
11/*-----------------------------------------------------------------------
12operation code operands semantics
13------------------------------------------------------------------------*/
14OPCODE(NOP, Z) /* no operation */
15OPCODE(MOVE, BB) /* R(a) = R(b) */
16OPCODE(LOADL, BB) /* R(a) = Pool(b) */
17OPCODE(LOADI, BB) /* R(a) = mrb_int(b) */
18OPCODE(LOADINEG, BB) /* R(a) = mrb_int(-b) */
19OPCODE(LOADI__1, B) /* R(a) = mrb_int(-1) */
20OPCODE(LOADI_0, B) /* R(a) = mrb_int(0) */
21OPCODE(LOADI_1, B) /* R(a) = mrb_int(1) */
22OPCODE(LOADI_2, B) /* R(a) = mrb_int(2) */
23OPCODE(LOADI_3, B) /* R(a) = mrb_int(3) */
24OPCODE(LOADI_4, B) /* R(a) = mrb_int(4) */
25OPCODE(LOADI_5, B) /* R(a) = mrb_int(5) */
26OPCODE(LOADI_6, B) /* R(a) = mrb_int(6) */
27OPCODE(LOADI_7, B) /* R(a) = mrb_int(7) */
28OPCODE(LOADSYM, BB) /* R(a) = Syms(b) */
29OPCODE(LOADNIL, B) /* R(a) = nil */
30OPCODE(LOADSELF, B) /* R(a) = self */
31OPCODE(LOADT, B) /* R(a) = true */
32OPCODE(LOADF, B) /* R(a) = false */
33OPCODE(GETGV, BB) /* R(a) = getglobal(Syms(b)) */
34OPCODE(SETGV, BB) /* setglobal(Syms(b), R(a)) */
35OPCODE(GETSV, BB) /* R(a) = Special[Syms(b)] */
36OPCODE(SETSV, BB) /* Special[Syms(b)] = R(a) */
37OPCODE(GETIV, BB) /* R(a) = ivget(Syms(b)) */
38OPCODE(SETIV, BB) /* ivset(Syms(b),R(a)) */
39OPCODE(GETCV, BB) /* R(a) = cvget(Syms(b)) */
40OPCODE(SETCV, BB) /* cvset(Syms(b),R(a)) */
41OPCODE(GETCONST, BB) /* R(a) = constget(Syms(b)) */
42OPCODE(SETCONST, BB) /* constset(Syms(b),R(a)) */
43OPCODE(GETMCNST, BB) /* R(a) = R(a)::Syms(b) */
44OPCODE(SETMCNST, BB) /* R(a+1)::Syms(b) = R(a) */
45OPCODE(GETUPVAR, BBB) /* R(a) = uvget(b,c) */
46OPCODE(SETUPVAR, BBB) /* uvset(b,c,R(a)) */
47OPCODE(JMP, S) /* pc=a */
48OPCODE(JMPIF, BS) /* if R(a) pc=b */
49OPCODE(JMPNOT, BS) /* if !R(a) pc=b */
50OPCODE(JMPNIL, BS) /* if R(a)==nil pc=b */
51OPCODE(ONERR, S) /* rescue_push(a) */
52OPCODE(EXCEPT, B) /* R(a) = exc */
53OPCODE(RESCUE, BB) /* R(b) = R(a).isa?(R(b)) */
54OPCODE(POPERR, B) /* a.times{rescue_pop()} */
55OPCODE(RAISE, B) /* raise(R(a)) */
56OPCODE(EPUSH, B) /* ensure_push(SEQ[a]) */
57OPCODE(EPOP, B) /* A.times{ensure_pop().call} */
58OPCODE(SENDV, BB) /* R(a) = call(R(a),Syms(b),*R(a+1)) */
59OPCODE(SENDVB, BB) /* R(a) = call(R(a),Syms(b),*R(a+1),&R(a+2)) */
60OPCODE(SEND, BBB) /* R(a) = call(R(a),Syms(b),R(a+1),...,R(a+c)) */
61OPCODE(SENDB, BBB) /* R(a) = call(R(a),Syms(b),R(a+1),...,R(a+c),&R(a+c+1)) */
62OPCODE(CALL, Z) /* R(0) = self.call(frame.argc, frame.argv) */
63OPCODE(SUPER, BB) /* R(a) = super(R(a+1),... ,R(a+b+1)) */
64OPCODE(ARGARY, BS) /* R(a) = argument array (16=m5:r1:m5:d1:lv4) */
65OPCODE(ENTER, W) /* arg setup according to flags (23=m5:o5:r1:m5:k5:d1:b1) */
66OPCODE(KEY_P, BB) /* R(a) = kdict.key?(Syms(b)) # todo */
67OPCODE(KEYEND, Z) /* raise unless kdict.empty? # todo */
68OPCODE(KARG, BB) /* R(a) = kdict[Syms(b)]; kdict.delete(Syms(b)) # todo */
69OPCODE(RETURN, B) /* return R(a) (normal) */
70OPCODE(RETURN_BLK, B) /* return R(a) (in-block return) */
71OPCODE(BREAK, B) /* break R(a) */
72OPCODE(BLKPUSH, BS) /* R(a) = block (16=m5:r1:m5:d1:lv4) */
73OPCODE(ADD, B) /* R(a) = R(a)+R(a+1) */
74OPCODE(ADDI, BB) /* R(a) = R(a)+mrb_int(b) */
75OPCODE(SUB, B) /* R(a) = R(a)-R(a+1) */
76OPCODE(SUBI, BB) /* R(a) = R(a)-mrb_int(b) */
77OPCODE(MUL, B) /* R(a) = R(a)*R(a+1) */
78OPCODE(DIV, B) /* R(a) = R(a)/R(a+1) */
79OPCODE(EQ, B) /* R(a) = R(a)==R(a+1) */
80OPCODE(LT, B) /* R(a) = R(a)<R(a+1) */
81OPCODE(LE, B) /* R(a) = R(a)<=R(a+1) */
82OPCODE(GT, B) /* R(a) = R(a)>R(a+1) */
83OPCODE(GE, B) /* R(a) = R(a)>=R(a+1) */
84OPCODE(ARRAY, BB) /* R(a) = ary_new(R(a),R(a+1)..R(a+b)) */
85OPCODE(ARRAY2, BBB) /* R(a) = ary_new(R(b),R(b+1)..R(b+c)) */
86OPCODE(ARYCAT, B) /* ary_cat(R(a),R(a+1)) */
87OPCODE(ARYPUSH, B) /* ary_push(R(a),R(a+1)) */
88OPCODE(ARYDUP, B) /* R(a) = ary_dup(R(a)) */
89OPCODE(AREF, BBB) /* R(a) = R(b)[c] */
90OPCODE(ASET, BBB) /* R(a)[c] = R(b) */
91OPCODE(APOST, BBB) /* *R(a),R(a+1)..R(a+c) = R(a)[b..] */
92OPCODE(INTERN, B) /* R(a) = intern(R(a)) */
93OPCODE(STRING, BB) /* R(a) = str_dup(Lit(b)) */
94OPCODE(STRCAT, B) /* str_cat(R(a),R(a+1)) */
95OPCODE(HASH, BB) /* R(a) = hash_new(R(a),R(a+1)..R(a+b)) */
96OPCODE(HASHADD, BB) /* R(a) = hash_push(R(a),R(a+1)..R(a+b)) */
97OPCODE(HASHCAT, B) /* R(a) = hash_cat(R(a),R(a+1)) */
98OPCODE(LAMBDA, BB) /* R(a) = lambda(SEQ[b],L_LAMBDA) */
99OPCODE(BLOCK, BB) /* R(a) = lambda(SEQ[b],L_BLOCK) */
100OPCODE(METHOD, BB) /* R(a) = lambda(SEQ[b],L_METHOD) */
101OPCODE(RANGE_INC, B) /* R(a) = range_new(R(a),R(a+1),FALSE) */
102OPCODE(RANGE_EXC, B) /* R(a) = range_new(R(a),R(a+1),TRUE) */
103OPCODE(OCLASS, B) /* R(a) = ::Object */
104OPCODE(CLASS, BB) /* R(a) = newclass(R(a),Syms(b),R(a+1)) */
105OPCODE(MODULE, BB) /* R(a) = newmodule(R(a),Syms(b)) */
106OPCODE(EXEC, BB) /* R(a) = blockexec(R(a),SEQ[b]) */
107OPCODE(DEF, BB) /* R(a).newmethod(Syms(b),R(a+1)) */
108OPCODE(ALIAS, BB) /* alias_method(target_class,Syms(a),Syms(b)) */
109OPCODE(UNDEF, B) /* undef_method(target_class,Syms(a)) */
110OPCODE(SCLASS, B) /* R(a) = R(a).singleton_class */
111OPCODE(TCLASS, B) /* R(a) = target_class */
112OPCODE(DEBUG, BBB) /* print a,b,c */
113OPCODE(ERR, B) /* raise(LocalJumpError, Lit(a)) */
114OPCODE(EXT1, Z) /* make 1st operand 16bit */
115OPCODE(EXT2, Z) /* make 2nd operand 16bit */
116OPCODE(EXT3, Z) /* make 1st and 2nd operands 16bit */
117OPCODE(STOP, Z) /* stop VM */
Note: See TracBrowser for help on using the repository browser.