List of YARV instructions

Ruby 1.9 compiles Ruby scripts into sequences of these instructions.

Note: These are not public API; may changed in future Ruby versions.
No.PopsParametersPushesDescriptionLOCComments
1nop nop1
2getlocal lindex_t idxvalget local variable value (which is pointed by idx).1
3valsetlocal lindex_t idxset local variable value (which is pointed by idx) as val.1
4getspecial key, rb_num_t typevalget special local variable ($~, $_, ..) value.1
5objsetspecial keyset special local variable ($~, $_, ...) value as obj.1
6getdynamic dindex_t idx, rb_num_t levelvalget block local variable(which is pointed by idx and level).6
7valsetdynamic dindex_t idx, rb_num_t levelset block local variable(which is pointed by 'idx') as val.6
8getinstancevariable ID id, IC icvalget instance variable id of obj.1
9valsetinstancevariable ID id, IC icset instance variable id of obj as val.1
10getclassvariable ID idvalget class variable id of klass as val.2
11valsetclassvariable ID idset class variable id of klass as val.2
12klassgetconstant ID idval1
13cbase, valsetconstant ID id3
14getglobal GENTRY entryvalget global variable id.1
15valsetglobal GENTRY entryset global variable id as val.1
16putnil valput nil to stack.1
17putself valput self.1
18putobject valvalput some object.1
19putspecialobject rb_num_t value_typevalput special object. "value_type" is for expansion.13
20putiseq ISEQ iseqretput iseq value.1
21putstring strvalput string val. string will be copied.1
22...concatstrings rb_num_t numvalput concatenate strings8
23valtostring valto_str1
24...toregexp rb_num_t opt, rb_num_t cntvalto Regexp9
25...newarray rb_num_t numvalput new array.2
26duparray aryvaldup array1
27ary, ...expandarray rb_num_t num, rb_num_t flag...expand array to num objects.1
28ary2st, ary1concatarray aryconcat two arrays16
29arysplatarray flagobjsplat array5
30ary, objcheckincludearray flagresult, objcheck value is included in ary27
31...newhash rb_num_t numvalput new Hash.9
32high, lownewrange rb_num_t flagvalput new Range object.(Range.new(low, high, flag))1
33valpop pop from stack.2
34valdup val2, val1duplicate stack top.1
35...dupn rb_num_t n...duplicate stack top n elements6
36obj, valswap val, objswap top 2 vals1
37val, ...reput valfor stack caching.1
38...topn rb_num_t nvalget nth stack value from stack top1
39val, ...setn rb_num_t nvalset Nth stack entry to stack top1
40...adjuststack rb_num_t n...empt current stack1
41vdefined rb_num_t type, obj, needstrvaldefined?100
42trace rb_num_t nftrace3
43super, cbasedefineclass ID id, ISEQ class_iseq, rb_num_t define_typeval80
44...send ID op_id, rb_num_t op_argc, ISEQ blockiseq, rb_num_t op_flag, IC icvalobj.send(id, args..) # args.size => num13
45...invokesuper rb_num_t op_argc, ISEQ blockiseq, rb_num_t op_flagvalsuper(args) # args.size => num19
46...invokeblock rb_num_t num, rb_num_t flagvalyield(args) # args.size => num, flag shows expand argument or not5
47valleave valreturn from this scope.10
48valfinish valreturn from this vm loop6
49throwobjthrow rb_num_t throw_statevallongjump4
50jump OFFSET dstset PC to (PC + dst).2
51valbranchif OFFSET dstif val is not false or nil, set PC to (PC + dst).4
52valbranchunless OFFSET dstif val is false or nil, set PC to (PC + dst).4
53getinlinecache OFFSET dst, IC icvalinline cache8
54onceinlinecache OFFSET dst, IC icvalinline cache (once)16
55valsetinlinecache IC icvalset inline cache6
56key, ...opt_case_dispatch CDHASH hash, OFFSET else_offsetcase dispatcher23
57opt_checkenv check environment6
58obj, recvopt_plus IC icvaloptimized X+Y.63
59obj, recvopt_minus IC icvaloptimized X-Y.36
60obj, recvopt_mult IC icvaloptimized X*Y.40
61obj, recvopt_div IC icvaloptimized X/Y.51
62obj, recvopt_mod IC icvaloptimized X%Y.66
63obj, recvopt_eq IC icvaloptimized X==Y.8
64obj, recvopt_neq IC ic, IC ic_eqvaloptimized X!=Y.18
65obj, recvopt_lt IC icvaloptimized X<Y.37
66obj, recvopt_le IC icvaloptimized X<=Y.17
67obj, recvopt_gt IC icvaloptimized X>Y.37
68obj, recvopt_ge IC icvaloptimized X>=Y.16
69obj, recvopt_ltlt IC icval<<21
70obj, recvopt_aref IC icval[]17
71set, obj, recvopt_aset IC icvalrecv[obj] = set21
72recvopt_length IC icvaloptimized length20
73recvopt_size IC icvaloptimized size20
74recvopt_succ IC icvaloptimized succ34
75recvopt_not IC icvaloptimized not10
76objopt_regexpmatch1 rvaloptimized regexp match1
77obj1, obj2opt_regexpmatch2 valoptimized regexp match 26
78opt_call_c_function rb_insn_func_t funcptrcall native compiled method10
79bitblt retBLT1
80answer retThe Answer to Life, the Universe, and Everything1