nodewrap 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +59 -0
- data/LEGAL +6 -0
- data/LGPL +515 -0
- data/LICENSE +6 -0
- data/README +31 -0
- data/TODO +9 -0
- data/example/README +5 -0
- data/example/simple_client.rb +12 -0
- data/example/simple_server.rb +11 -0
- data/example/triangle_client.rb +7 -0
- data/example/triangle_server.rb +24 -0
- data/ext/MANIFEST +11 -0
- data/ext/builtins.h +25 -0
- data/ext/cached/ruby-1.6.3/COPYING +340 -0
- data/ext/cached/ruby-1.6.3/README +3 -0
- data/ext/cached/ruby-1.6.3/classpath.c +3 -0
- data/ext/cached/ruby-1.6.3/classpath.h +8 -0
- data/ext/cached/ruby-1.6.3/evalinfo.h +62 -0
- data/ext/cached/ruby-1.6.3/global_entry.h +15 -0
- data/ext/cached/ruby-1.6.3/insns_info.c +40 -0
- data/ext/cached/ruby-1.6.3/insns_info.h +19 -0
- data/ext/cached/ruby-1.6.3/node_type_descrip.c +150 -0
- data/ext/cached/ruby-1.6.3/nodeinfo.c +3182 -0
- data/ext/cached/ruby-1.6.3/nodeinfo.h +66 -0
- data/ext/cached/ruby-1.6.4/COPYING +340 -0
- data/ext/cached/ruby-1.6.4/README +3 -0
- data/ext/cached/ruby-1.6.4/classpath.c +3 -0
- data/ext/cached/ruby-1.6.4/classpath.h +8 -0
- data/ext/cached/ruby-1.6.4/evalinfo.h +62 -0
- data/ext/cached/ruby-1.6.4/global_entry.h +15 -0
- data/ext/cached/ruby-1.6.4/insns_info.c +40 -0
- data/ext/cached/ruby-1.6.4/insns_info.h +19 -0
- data/ext/cached/ruby-1.6.4/node_type_descrip.c +150 -0
- data/ext/cached/ruby-1.6.4/nodeinfo.c +3182 -0
- data/ext/cached/ruby-1.6.4/nodeinfo.h +66 -0
- data/ext/cached/ruby-1.6.5/COPYING +56 -0
- data/ext/cached/ruby-1.6.5/GPL +340 -0
- data/ext/cached/ruby-1.6.5/LEGAL +325 -0
- data/ext/cached/ruby-1.6.5/LGPL +504 -0
- data/ext/cached/ruby-1.6.5/README +3 -0
- data/ext/cached/ruby-1.6.5/classpath.c +3 -0
- data/ext/cached/ruby-1.6.5/classpath.h +8 -0
- data/ext/cached/ruby-1.6.5/evalinfo.h +63 -0
- data/ext/cached/ruby-1.6.5/global_entry.h +15 -0
- data/ext/cached/ruby-1.6.5/insns_info.c +40 -0
- data/ext/cached/ruby-1.6.5/insns_info.h +19 -0
- data/ext/cached/ruby-1.6.5/node_type_descrip.c +150 -0
- data/ext/cached/ruby-1.6.5/nodeinfo.c +3182 -0
- data/ext/cached/ruby-1.6.5/nodeinfo.h +66 -0
- data/ext/cached/ruby-1.6.7/COPYING +56 -0
- data/ext/cached/ruby-1.6.7/GPL +340 -0
- data/ext/cached/ruby-1.6.7/LEGAL +308 -0
- data/ext/cached/ruby-1.6.7/LGPL +504 -0
- data/ext/cached/ruby-1.6.7/README +3 -0
- data/ext/cached/ruby-1.6.7/classpath.c +3 -0
- data/ext/cached/ruby-1.6.7/classpath.h +8 -0
- data/ext/cached/ruby-1.6.7/evalinfo.h +63 -0
- data/ext/cached/ruby-1.6.7/global_entry.h +15 -0
- data/ext/cached/ruby-1.6.7/insns_info.c +40 -0
- data/ext/cached/ruby-1.6.7/insns_info.h +19 -0
- data/ext/cached/ruby-1.6.7/node_type_descrip.c +150 -0
- data/ext/cached/ruby-1.6.7/nodeinfo.c +3182 -0
- data/ext/cached/ruby-1.6.7/nodeinfo.h +66 -0
- data/ext/cached/ruby-1.6.8/COPYING +56 -0
- data/ext/cached/ruby-1.6.8/GPL +340 -0
- data/ext/cached/ruby-1.6.8/LEGAL +308 -0
- data/ext/cached/ruby-1.6.8/LGPL +504 -0
- data/ext/cached/ruby-1.6.8/README +3 -0
- data/ext/cached/ruby-1.6.8/classpath.c +3 -0
- data/ext/cached/ruby-1.6.8/classpath.h +8 -0
- data/ext/cached/ruby-1.6.8/evalinfo.h +63 -0
- data/ext/cached/ruby-1.6.8/global_entry.h +15 -0
- data/ext/cached/ruby-1.6.8/insns_info.c +40 -0
- data/ext/cached/ruby-1.6.8/insns_info.h +19 -0
- data/ext/cached/ruby-1.6.8/node_type_descrip.c +150 -0
- data/ext/cached/ruby-1.6.8/nodeinfo.c +3182 -0
- data/ext/cached/ruby-1.6.8/nodeinfo.h +66 -0
- data/ext/cached/ruby-1.8.0/COPYING +56 -0
- data/ext/cached/ruby-1.8.0/GPL +340 -0
- data/ext/cached/ruby-1.8.0/LEGAL +371 -0
- data/ext/cached/ruby-1.8.0/LGPL +504 -0
- data/ext/cached/ruby-1.8.0/README +3 -0
- data/ext/cached/ruby-1.8.0/classpath.c +27 -0
- data/ext/cached/ruby-1.8.0/classpath.h +14 -0
- data/ext/cached/ruby-1.8.0/evalinfo.h +65 -0
- data/ext/cached/ruby-1.8.0/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.0/insns_info.c +40 -0
- data/ext/cached/ruby-1.8.0/insns_info.h +19 -0
- data/ext/cached/ruby-1.8.0/node_type_descrip.c +150 -0
- data/ext/cached/ruby-1.8.0/nodeinfo.c +3199 -0
- data/ext/cached/ruby-1.8.0/nodeinfo.h +66 -0
- data/ext/cached/ruby-1.8.1/COPYING +56 -0
- data/ext/cached/ruby-1.8.1/GPL +340 -0
- data/ext/cached/ruby-1.8.1/LEGAL +371 -0
- data/ext/cached/ruby-1.8.1/LGPL +504 -0
- data/ext/cached/ruby-1.8.1/README +3 -0
- data/ext/cached/ruby-1.8.1/classpath.c +27 -0
- data/ext/cached/ruby-1.8.1/classpath.h +14 -0
- data/ext/cached/ruby-1.8.1/evalinfo.h +59 -0
- data/ext/cached/ruby-1.8.1/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.1/insns_info.c +40 -0
- data/ext/cached/ruby-1.8.1/insns_info.h +19 -0
- data/ext/cached/ruby-1.8.1/node_type_descrip.c +150 -0
- data/ext/cached/ruby-1.8.1/nodeinfo.c +3199 -0
- data/ext/cached/ruby-1.8.1/nodeinfo.h +66 -0
- data/ext/cached/ruby-1.8.2/COPYING +56 -0
- data/ext/cached/ruby-1.8.2/GPL +340 -0
- data/ext/cached/ruby-1.8.2/LEGAL +371 -0
- data/ext/cached/ruby-1.8.2/LGPL +504 -0
- data/ext/cached/ruby-1.8.2/README +3 -0
- data/ext/cached/ruby-1.8.2/classpath.c +45 -0
- data/ext/cached/ruby-1.8.2/classpath.h +17 -0
- data/ext/cached/ruby-1.8.2/evalinfo.h +60 -0
- data/ext/cached/ruby-1.8.2/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.2/insns_info.c +40 -0
- data/ext/cached/ruby-1.8.2/insns_info.h +19 -0
- data/ext/cached/ruby-1.8.2/node_type_descrip.c +150 -0
- data/ext/cached/ruby-1.8.2/nodeinfo.c +3199 -0
- data/ext/cached/ruby-1.8.2/nodeinfo.h +66 -0
- data/ext/cached/ruby-1.8.3/COPYING +56 -0
- data/ext/cached/ruby-1.8.3/GPL +340 -0
- data/ext/cached/ruby-1.8.3/LEGAL +370 -0
- data/ext/cached/ruby-1.8.3/LGPL +504 -0
- data/ext/cached/ruby-1.8.3/README +3 -0
- data/ext/cached/ruby-1.8.3/classpath.c +45 -0
- data/ext/cached/ruby-1.8.3/classpath.h +17 -0
- data/ext/cached/ruby-1.8.3/evalinfo.h +61 -0
- data/ext/cached/ruby-1.8.3/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.3/insns_info.c +40 -0
- data/ext/cached/ruby-1.8.3/insns_info.h +19 -0
- data/ext/cached/ruby-1.8.3/node_type_descrip.c +150 -0
- data/ext/cached/ruby-1.8.3/nodeinfo.c +3199 -0
- data/ext/cached/ruby-1.8.3/nodeinfo.h +66 -0
- data/ext/cached/ruby-1.8.4/COPYING +56 -0
- data/ext/cached/ruby-1.8.4/GPL +340 -0
- data/ext/cached/ruby-1.8.4/LEGAL +370 -0
- data/ext/cached/ruby-1.8.4/LGPL +504 -0
- data/ext/cached/ruby-1.8.4/README +3 -0
- data/ext/cached/ruby-1.8.4/classpath.c +45 -0
- data/ext/cached/ruby-1.8.4/classpath.h +17 -0
- data/ext/cached/ruby-1.8.4/evalinfo.h +61 -0
- data/ext/cached/ruby-1.8.4/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.4/insns_info.c +40 -0
- data/ext/cached/ruby-1.8.4/insns_info.h +19 -0
- data/ext/cached/ruby-1.8.4/node_type_descrip.c +150 -0
- data/ext/cached/ruby-1.8.4/nodeinfo.c +3199 -0
- data/ext/cached/ruby-1.8.4/nodeinfo.h +66 -0
- data/ext/cached/ruby-1.8.5/COPYING +56 -0
- data/ext/cached/ruby-1.8.5/GPL +340 -0
- data/ext/cached/ruby-1.8.5/LEGAL +370 -0
- data/ext/cached/ruby-1.8.5/LGPL +504 -0
- data/ext/cached/ruby-1.8.5/README +3 -0
- data/ext/cached/ruby-1.8.5/classpath.c +45 -0
- data/ext/cached/ruby-1.8.5/classpath.h +17 -0
- data/ext/cached/ruby-1.8.5/evalinfo.h +61 -0
- data/ext/cached/ruby-1.8.5/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.5/insns_info.c +40 -0
- data/ext/cached/ruby-1.8.5/insns_info.h +19 -0
- data/ext/cached/ruby-1.8.5/node_type_descrip.c +150 -0
- data/ext/cached/ruby-1.8.5/nodeinfo.c +3187 -0
- data/ext/cached/ruby-1.8.5/nodeinfo.h +64 -0
- data/ext/cached/ruby-1.8.6/COPYING +56 -0
- data/ext/cached/ruby-1.8.6/GPL +340 -0
- data/ext/cached/ruby-1.8.6/LEGAL +370 -0
- data/ext/cached/ruby-1.8.6/LGPL +504 -0
- data/ext/cached/ruby-1.8.6/README +3 -0
- data/ext/cached/ruby-1.8.6/classpath.c +45 -0
- data/ext/cached/ruby-1.8.6/classpath.h +17 -0
- data/ext/cached/ruby-1.8.6/evalinfo.h +61 -0
- data/ext/cached/ruby-1.8.6/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.6/insns_info.c +40 -0
- data/ext/cached/ruby-1.8.6/insns_info.h +19 -0
- data/ext/cached/ruby-1.8.6/node_type_descrip.c +150 -0
- data/ext/cached/ruby-1.8.6/nodeinfo.c +3187 -0
- data/ext/cached/ruby-1.8.6/nodeinfo.h +64 -0
- data/ext/classpath.c +42 -0
- data/ext/classpath.c.rpp +28 -0
- data/ext/classpath.h +17 -0
- data/ext/classpath.h.rpp +35 -0
- data/ext/evalinfo.h +21 -0
- data/ext/evalinfo.h.rpp +49 -0
- data/ext/extconf.rb +68 -0
- data/ext/generate.rb +201 -0
- data/ext/generate_cached.rb +49 -0
- data/ext/global_entry.h +10 -0
- data/ext/global_entry.h.rpp +25 -0
- data/ext/insns_info.c +6079 -0
- data/ext/insns_info.c.rpp +210 -0
- data/ext/insns_info.h +819 -0
- data/ext/insns_info.h.rpp +50 -0
- data/ext/node_type_descrip.c +148 -0
- data/ext/node_type_descrip.c.rpp +72 -0
- data/ext/node_type_descrip.h +17 -0
- data/ext/node_type_descrip.rb +169 -0
- data/ext/nodeinfo.c +3164 -0
- data/ext/nodeinfo.c.rpp +519 -0
- data/ext/nodeinfo.h +67 -0
- data/ext/nodeinfo.h.rpp +27 -0
- data/ext/nodewrap.c +2576 -0
- data/ext/nodewrap.h +20 -0
- data/ext/read_node_h.rb +19 -0
- data/ext/ruby_source_dir.rb +15 -0
- data/ext/ruby_version.h +12 -0
- data/ext/ruby_version_code.rb +16 -0
- data/ext/rubypp.rb +97 -0
- data/ext/test.rb +15 -0
- data/generate_rdoc.rb +33 -0
- data/install.rb +1022 -0
- data/lib/as_code.rb +347 -0
- data/lib/as_expression.rb +657 -0
- data/lib/bytedecoder.rb +848 -0
- data/lib/classtree.rb +54 -0
- data/lib/methodsig.rb +266 -0
- data/lib/node_to_a.rb +34 -0
- data/lib/nodepp.rb +71 -0
- data/lib/nwdebug.rb +18 -0
- data/lib/nwdump.rb +53 -0
- data/lib/nwobfusc.rb +57 -0
- data/lib/procsig.rb +182 -0
- data/lib/test.rb +8 -0
- data/metaconfig +10 -0
- data/post-config.rb +53 -0
- data/post-setup.rb +9 -0
- data/pre-config.rb +1 -0
- data/run_tests.rb +48 -0
- data/test/expression_samples.rb +158 -0
- data/test/node_samples.rb +122 -0
- data/test/test.rb +39 -0
- data/test/test2.rb +7 -0
- data/test/test3.rb +5 -0
- data/test/test4.rb +5 -0
- data/test/test_as_code.rb +249 -0
- data/test/test_as_expression.rb +222 -0
- data/test/test_methodsig.rb +189 -0
- data/test/test_nodewrap.rb +369 -0
- metadata +286 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
#include "insns_info.h"
|
|
2
|
+
#include "ruby_version.h"
|
|
3
|
+
|
|
4
|
+
#ifdef RUBY_HAS_YARV
|
|
5
|
+
|
|
6
|
+
#ruby <<END
|
|
7
|
+
require 'ruby_source_dir'
|
|
8
|
+
insns_location = "#{RUBY_SOURCE_DIR}/insns.inc"
|
|
9
|
+
insns_info_location = "#{RUBY_SOURCE_DIR}/insns_info.inc"
|
|
10
|
+
insns_def_location = "#{RUBY_SOURCE_DIR}/insns.def"
|
|
11
|
+
iseq_c_location = "#{RUBY_SOURCE_DIR}/iseq.c"
|
|
12
|
+
|
|
13
|
+
INSTRUCTION_NAMES = []
|
|
14
|
+
record_instruction_names = false
|
|
15
|
+
|
|
16
|
+
[ insns_location, insns_info_location ].each do |file|
|
|
17
|
+
next if not File.exist?(file)
|
|
18
|
+
|
|
19
|
+
File.open(file) do |input|
|
|
20
|
+
while (line = input.gets) != nil do
|
|
21
|
+
line.chomp!
|
|
22
|
+
if line =~ /^\}/ then
|
|
23
|
+
record_instruction_names = false
|
|
24
|
+
end
|
|
25
|
+
if record_instruction_names then
|
|
26
|
+
name = line.chomp(',').gsub(/"/, '').lstrip.upcase
|
|
27
|
+
INSTRUCTION_NAMES.push(name) if name != ''
|
|
28
|
+
end
|
|
29
|
+
if line =~ /static.*insn_name_info.*=/ then
|
|
30
|
+
record_instruction_names = true
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
write = false
|
|
37
|
+
|
|
38
|
+
[ iseq_c_location ].each do |file|
|
|
39
|
+
next if not File.exist?(file)
|
|
40
|
+
|
|
41
|
+
File.open(file) do |input|
|
|
42
|
+
while (line = input.gets) != nil do
|
|
43
|
+
line.chomp!
|
|
44
|
+
case line
|
|
45
|
+
when /^make_compile_option\(/
|
|
46
|
+
puts 'void'
|
|
47
|
+
write = true
|
|
48
|
+
when /^static.*COMPILE_OPTION_DEFAULT.*=/
|
|
49
|
+
write = true
|
|
50
|
+
when /^static.*COMPILE_OPTION_FALSE;/
|
|
51
|
+
puts line
|
|
52
|
+
end
|
|
53
|
+
puts line if write
|
|
54
|
+
if line =~ /^\}/ then
|
|
55
|
+
write = false
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
INSTRUCTION_OPERAND_NAMES = {}
|
|
62
|
+
|
|
63
|
+
[ insns_def_location ].each do |file|
|
|
64
|
+
next if not File.exist?(file)
|
|
65
|
+
|
|
66
|
+
File.open(file) do |input|
|
|
67
|
+
while (line = input.gets) != nil do
|
|
68
|
+
line.chomp!
|
|
69
|
+
case line
|
|
70
|
+
when /^DEFINE_INSN/
|
|
71
|
+
name = input.gets.chomp
|
|
72
|
+
operand_line = input.gets.chomp
|
|
73
|
+
operand_line.gsub!(/\((.*)\)/, '\1')
|
|
74
|
+
operands = operand_line.split(',')
|
|
75
|
+
operand_names = operands.map { |x| x.split[1] }
|
|
76
|
+
INSTRUCTION_OPERAND_NAMES[name] = operand_names
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
nil
|
|
83
|
+
END
|
|
84
|
+
|
|
85
|
+
VALUE instruction_class[YARV_MAX_INSTRUCTION_SIZE];
|
|
86
|
+
|
|
87
|
+
static ID operand_type_name_of(int operand_type)
|
|
88
|
+
{
|
|
89
|
+
char const * retval = "????";
|
|
90
|
+
|
|
91
|
+
switch(operand_type)
|
|
92
|
+
{
|
|
93
|
+
case TS_ISEQ: retval = "iseq"; break;
|
|
94
|
+
case TS_GENTRY: retval = "gentry"; break;
|
|
95
|
+
case TS_OFFSET: retval = "operand"; break;
|
|
96
|
+
case TS_DINDEX: retval = "dindex"; break;
|
|
97
|
+
case TS_VARIABLE: retval = "variable"; break;
|
|
98
|
+
case TS_CDHASH: retval = "cdhash"; break;
|
|
99
|
+
case TS_IC: retval = "ic"; break;
|
|
100
|
+
case TS_ID: retval = "id"; break;
|
|
101
|
+
case TS_VALUE: retval = "value"; break;
|
|
102
|
+
case TS_LINDEX: retval = "lindex"; break;
|
|
103
|
+
case TS_NUM: retval = "num"; break;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return rb_intern(retval);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
#ruby <<END
|
|
110
|
+
INSTRUCTION_NAMES.each_with_index do |name, index|
|
|
111
|
+
$operand_names = INSTRUCTION_OPERAND_NAMES[name.downcase]
|
|
112
|
+
|
|
113
|
+
# 1 #<VM::Instruction::TRACE:0x402d991c @length=2, @operands=[1],
|
|
114
|
+
# @instruction=45, @operand_types=[:num], @name=:trace>
|
|
115
|
+
puts <<-END
|
|
116
|
+
/*
|
|
117
|
+
* call-seq:
|
|
118
|
+
* insn.length => Integer
|
|
119
|
+
*
|
|
120
|
+
* Returns the length of the instruction.
|
|
121
|
+
*/
|
|
122
|
+
static VALUE insn_#{name}_length(VALUE self)
|
|
123
|
+
{
|
|
124
|
+
return LONG2NUM(insn_len(#{index}));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/*
|
|
128
|
+
* call-seq:
|
|
129
|
+
* insn.to_i => Integer
|
|
130
|
+
*
|
|
131
|
+
* Returns the numeric instruction number.
|
|
132
|
+
*/
|
|
133
|
+
static VALUE insn_#{name}_to_i(VALUE self)
|
|
134
|
+
{
|
|
135
|
+
return NUM2LONG(#{index});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/*
|
|
139
|
+
* call-seq:
|
|
140
|
+
* insn.operand_types => Array of Symbol
|
|
141
|
+
*
|
|
142
|
+
* Returns an array containing the types of the operands.
|
|
143
|
+
*/
|
|
144
|
+
static VALUE insn_#{name}_operand_types(VALUE self)
|
|
145
|
+
{
|
|
146
|
+
VALUE operand_types = rb_ary_new();
|
|
147
|
+
char * s;
|
|
148
|
+
|
|
149
|
+
for(s = insn_op_types(#{index}); *s != '\\0'; ++s)
|
|
150
|
+
{
|
|
151
|
+
rb_ary_push(operand_types, ID2SYM(operand_type_name_of(*s)));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return operand_types;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/*
|
|
158
|
+
* call-seq:
|
|
159
|
+
* insn.name => Symbol
|
|
160
|
+
*
|
|
161
|
+
* Returns the name of the instruction.
|
|
162
|
+
*/
|
|
163
|
+
static VALUE insn_#{name}_name(VALUE self)
|
|
164
|
+
{
|
|
165
|
+
return rb_intern("#{name}");
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/*
|
|
169
|
+
* call-seq:
|
|
170
|
+
* insn.name => Symbol
|
|
171
|
+
*
|
|
172
|
+
* Returns the name of the operands for this instruction.
|
|
173
|
+
*/
|
|
174
|
+
static VALUE insn_#{name}_operand_names(VALUE self)
|
|
175
|
+
{
|
|
176
|
+
VALUE v[] = {
|
|
177
|
+
#{$operand_names.map { |x| "ID2SYM(rb_intern(\"#{x}\"))" }.join(', ')}
|
|
178
|
+
};
|
|
179
|
+
return rb_ary_new4(#{$operand_names.size}, v);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
END
|
|
183
|
+
end
|
|
184
|
+
nil
|
|
185
|
+
END
|
|
186
|
+
|
|
187
|
+
void define_instruction_subclasses(VALUE rb_cInstruction)
|
|
188
|
+
{
|
|
189
|
+
/* For rdoc: rb_cVM = rb_define_class("VM", rb_cObject); */
|
|
190
|
+
/* For rdoc: rb_cInstruction = rb_define_class_under(rb_cVM, "Instruction", rb_cObject); */
|
|
191
|
+
|
|
192
|
+
#ruby <<END
|
|
193
|
+
INSTRUCTION_NAMES.each_with_index do |name, index|
|
|
194
|
+
puts <<-END
|
|
195
|
+
{
|
|
196
|
+
VALUE rb_cInstruction_#{name} = instruction_class[#{index}] = rb_define_class_under(rb_cInstruction, "#{name}", rb_cInstruction);
|
|
197
|
+
rb_define_method(rb_cInstruction_#{name}, "length", insn_#{name}_length, 0);
|
|
198
|
+
rb_define_method(rb_cInstruction_#{name}, "to_i", insn_#{name}_to_i, 0);
|
|
199
|
+
rb_define_method(rb_cInstruction_#{name}, "operand_types", insn_#{name}_operand_types, 0);
|
|
200
|
+
rb_define_method(rb_cInstruction_#{name}, "operand_names", insn_#{name}_operand_names, 0);
|
|
201
|
+
rb_define_method(rb_cInstruction_#{name}, "name", insn_#{name}_name, 0);
|
|
202
|
+
}
|
|
203
|
+
END
|
|
204
|
+
end
|
|
205
|
+
nil
|
|
206
|
+
END
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
#endif
|
|
210
|
+
|
data/ext/insns_info.h
ADDED
|
@@ -0,0 +1,819 @@
|
|
|
1
|
+
#ifndef insns_info__h_
|
|
2
|
+
#define insns_info__h_
|
|
3
|
+
|
|
4
|
+
#include "ruby_version.h"
|
|
5
|
+
|
|
6
|
+
#ifdef RUBY_HAS_YARV
|
|
7
|
+
|
|
8
|
+
#include "vm.h"
|
|
9
|
+
#include "ruby.h"
|
|
10
|
+
#include "yarvcore.h"
|
|
11
|
+
|
|
12
|
+
/** -*-c-*-
|
|
13
|
+
This file contains YARV instructions list.
|
|
14
|
+
|
|
15
|
+
----
|
|
16
|
+
This file is auto generated by insns2vm.rb
|
|
17
|
+
DO NOT TOUCH!
|
|
18
|
+
|
|
19
|
+
If you want to fix something, you must edit 'template/insns.inc.tmpl'
|
|
20
|
+
or insns2vm.rb
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/* BIN : Basic Instruction Name */
|
|
25
|
+
#define BIN(n) YARVINSN_##n
|
|
26
|
+
|
|
27
|
+
enum{
|
|
28
|
+
BIN(nop) = 0,
|
|
29
|
+
BIN(getlocal) = 1,
|
|
30
|
+
BIN(setlocal) = 2,
|
|
31
|
+
BIN(getspecial) = 3,
|
|
32
|
+
BIN(setspecial) = 4,
|
|
33
|
+
BIN(getdynamic) = 5,
|
|
34
|
+
BIN(setdynamic) = 6,
|
|
35
|
+
BIN(getinstancevariable) = 7,
|
|
36
|
+
BIN(setinstancevariable) = 8,
|
|
37
|
+
BIN(getclassvariable) = 9,
|
|
38
|
+
BIN(setclassvariable) = 10,
|
|
39
|
+
BIN(getconstant) = 11,
|
|
40
|
+
BIN(setconstant) = 12,
|
|
41
|
+
BIN(getglobal) = 13,
|
|
42
|
+
BIN(setglobal) = 14,
|
|
43
|
+
BIN(putnil) = 15,
|
|
44
|
+
BIN(putself) = 16,
|
|
45
|
+
BIN(putundef) = 17,
|
|
46
|
+
BIN(putobject) = 18,
|
|
47
|
+
BIN(putstring) = 19,
|
|
48
|
+
BIN(concatstrings) = 20,
|
|
49
|
+
BIN(tostring) = 21,
|
|
50
|
+
BIN(toregexp) = 22,
|
|
51
|
+
BIN(newarray) = 23,
|
|
52
|
+
BIN(duparray) = 24,
|
|
53
|
+
BIN(expandarray) = 25,
|
|
54
|
+
BIN(concatarray) = 26,
|
|
55
|
+
BIN(splatarray) = 27,
|
|
56
|
+
BIN(checkincludearray) = 28,
|
|
57
|
+
BIN(newhash) = 29,
|
|
58
|
+
BIN(newrange) = 30,
|
|
59
|
+
BIN(putnot) = 31,
|
|
60
|
+
BIN(pop) = 32,
|
|
61
|
+
BIN(dup) = 33,
|
|
62
|
+
BIN(dupn) = 34,
|
|
63
|
+
BIN(swap) = 35,
|
|
64
|
+
BIN(reput) = 36,
|
|
65
|
+
BIN(topn) = 37,
|
|
66
|
+
BIN(setn) = 38,
|
|
67
|
+
BIN(emptstack) = 39,
|
|
68
|
+
BIN(definemethod) = 40,
|
|
69
|
+
BIN(alias) = 41,
|
|
70
|
+
BIN(undef) = 42,
|
|
71
|
+
BIN(defined) = 43,
|
|
72
|
+
BIN(postexe) = 44,
|
|
73
|
+
BIN(trace) = 45,
|
|
74
|
+
BIN(defineclass) = 46,
|
|
75
|
+
BIN(send) = 47,
|
|
76
|
+
BIN(invokesuper) = 48,
|
|
77
|
+
BIN(invokeblock) = 49,
|
|
78
|
+
BIN(leave) = 50,
|
|
79
|
+
BIN(finish) = 51,
|
|
80
|
+
BIN(throw) = 52,
|
|
81
|
+
BIN(jump) = 53,
|
|
82
|
+
BIN(branchif) = 54,
|
|
83
|
+
BIN(branchunless) = 55,
|
|
84
|
+
BIN(getinlinecache) = 56,
|
|
85
|
+
BIN(onceinlinecache) = 57,
|
|
86
|
+
BIN(setinlinecache) = 58,
|
|
87
|
+
BIN(opt_case_dispatch) = 59,
|
|
88
|
+
BIN(opt_checkenv) = 60,
|
|
89
|
+
BIN(opt_plus) = 61,
|
|
90
|
+
BIN(opt_minus) = 62,
|
|
91
|
+
BIN(opt_mult) = 63,
|
|
92
|
+
BIN(opt_div) = 64,
|
|
93
|
+
BIN(opt_mod) = 65,
|
|
94
|
+
BIN(opt_eq) = 66,
|
|
95
|
+
BIN(opt_lt) = 67,
|
|
96
|
+
BIN(opt_le) = 68,
|
|
97
|
+
BIN(opt_gt) = 69,
|
|
98
|
+
BIN(opt_ge) = 70,
|
|
99
|
+
BIN(opt_ltlt) = 71,
|
|
100
|
+
BIN(opt_aref) = 72,
|
|
101
|
+
BIN(opt_aset) = 73,
|
|
102
|
+
BIN(opt_length) = 74,
|
|
103
|
+
BIN(opt_succ) = 75,
|
|
104
|
+
BIN(opt_regexpmatch1) = 76,
|
|
105
|
+
BIN(opt_regexpmatch2) = 77,
|
|
106
|
+
BIN(opt_call_native_compiled) = 78,
|
|
107
|
+
BIN(bitblt) = 79,
|
|
108
|
+
BIN(answer) = 80,
|
|
109
|
+
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
#define YARV_MAX_INSTRUCTION_SIZE 81
|
|
113
|
+
|
|
114
|
+
/** -*-c-*-
|
|
115
|
+
This file contains instruction information for yarv instruction sequence.
|
|
116
|
+
|
|
117
|
+
----
|
|
118
|
+
This file is auto generated by insns2vm.rb
|
|
119
|
+
DO NOT TOUCH!
|
|
120
|
+
|
|
121
|
+
If you want to fix something, you must edit 'template/insns_info.inc.tmpl'
|
|
122
|
+
or insns2vm.rb
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
#define TS_ISEQ 'S'
|
|
126
|
+
#define TS_GENTRY 'G'
|
|
127
|
+
#define TS_OFFSET 'O'
|
|
128
|
+
#define TS_DINDEX 'D'
|
|
129
|
+
#define TS_VARIABLE '.'
|
|
130
|
+
#define TS_CDHASH 'H'
|
|
131
|
+
#define TS_IC 'C'
|
|
132
|
+
#define TS_ID 'I'
|
|
133
|
+
#define TS_VALUE 'V'
|
|
134
|
+
#define TS_LINDEX 'L'
|
|
135
|
+
#define TS_NUM 'N'
|
|
136
|
+
|
|
137
|
+
static char *insn_name_info[] = {
|
|
138
|
+
"nop",
|
|
139
|
+
"getlocal",
|
|
140
|
+
"setlocal",
|
|
141
|
+
"getspecial",
|
|
142
|
+
"setspecial",
|
|
143
|
+
"getdynamic",
|
|
144
|
+
"setdynamic",
|
|
145
|
+
"getinstancevariable",
|
|
146
|
+
"setinstancevariable",
|
|
147
|
+
"getclassvariable",
|
|
148
|
+
"setclassvariable",
|
|
149
|
+
"getconstant",
|
|
150
|
+
"setconstant",
|
|
151
|
+
"getglobal",
|
|
152
|
+
"setglobal",
|
|
153
|
+
"putnil",
|
|
154
|
+
"putself",
|
|
155
|
+
"putundef",
|
|
156
|
+
"putobject",
|
|
157
|
+
"putstring",
|
|
158
|
+
"concatstrings",
|
|
159
|
+
"tostring",
|
|
160
|
+
"toregexp",
|
|
161
|
+
"newarray",
|
|
162
|
+
"duparray",
|
|
163
|
+
"expandarray",
|
|
164
|
+
"concatarray",
|
|
165
|
+
"splatarray",
|
|
166
|
+
"checkincludearray",
|
|
167
|
+
"newhash",
|
|
168
|
+
"newrange",
|
|
169
|
+
"putnot",
|
|
170
|
+
"pop",
|
|
171
|
+
"dup",
|
|
172
|
+
"dupn",
|
|
173
|
+
"swap",
|
|
174
|
+
"reput",
|
|
175
|
+
"topn",
|
|
176
|
+
"setn",
|
|
177
|
+
"emptstack",
|
|
178
|
+
"definemethod",
|
|
179
|
+
"alias",
|
|
180
|
+
"undef",
|
|
181
|
+
"defined",
|
|
182
|
+
"postexe",
|
|
183
|
+
"trace",
|
|
184
|
+
"defineclass",
|
|
185
|
+
"send",
|
|
186
|
+
"invokesuper",
|
|
187
|
+
"invokeblock",
|
|
188
|
+
"leave",
|
|
189
|
+
"finish",
|
|
190
|
+
"throw",
|
|
191
|
+
"jump",
|
|
192
|
+
"branchif",
|
|
193
|
+
"branchunless",
|
|
194
|
+
"getinlinecache",
|
|
195
|
+
"onceinlinecache",
|
|
196
|
+
"setinlinecache",
|
|
197
|
+
"opt_case_dispatch",
|
|
198
|
+
"opt_checkenv",
|
|
199
|
+
"opt_plus",
|
|
200
|
+
"opt_minus",
|
|
201
|
+
"opt_mult",
|
|
202
|
+
"opt_div",
|
|
203
|
+
"opt_mod",
|
|
204
|
+
"opt_eq",
|
|
205
|
+
"opt_lt",
|
|
206
|
+
"opt_le",
|
|
207
|
+
"opt_gt",
|
|
208
|
+
"opt_ge",
|
|
209
|
+
"opt_ltlt",
|
|
210
|
+
"opt_aref",
|
|
211
|
+
"opt_aset",
|
|
212
|
+
"opt_length",
|
|
213
|
+
"opt_succ",
|
|
214
|
+
"opt_regexpmatch1",
|
|
215
|
+
"opt_regexpmatch2",
|
|
216
|
+
"opt_call_native_compiled",
|
|
217
|
+
"bitblt",
|
|
218
|
+
"answer",
|
|
219
|
+
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
static char *insn_operand_info[] = {
|
|
223
|
+
"",
|
|
224
|
+
"L",
|
|
225
|
+
"L",
|
|
226
|
+
"NN",
|
|
227
|
+
"N",
|
|
228
|
+
"DN",
|
|
229
|
+
"DN",
|
|
230
|
+
"I",
|
|
231
|
+
"I",
|
|
232
|
+
"I",
|
|
233
|
+
"I",
|
|
234
|
+
"I",
|
|
235
|
+
"I",
|
|
236
|
+
"G",
|
|
237
|
+
"G",
|
|
238
|
+
"",
|
|
239
|
+
"",
|
|
240
|
+
"",
|
|
241
|
+
"V",
|
|
242
|
+
"V",
|
|
243
|
+
"N",
|
|
244
|
+
"",
|
|
245
|
+
"N",
|
|
246
|
+
"N",
|
|
247
|
+
"V",
|
|
248
|
+
"NN",
|
|
249
|
+
"",
|
|
250
|
+
"V",
|
|
251
|
+
"V",
|
|
252
|
+
"N",
|
|
253
|
+
"N",
|
|
254
|
+
"",
|
|
255
|
+
"",
|
|
256
|
+
"",
|
|
257
|
+
"N",
|
|
258
|
+
"",
|
|
259
|
+
"",
|
|
260
|
+
"N",
|
|
261
|
+
"N",
|
|
262
|
+
"",
|
|
263
|
+
"ISN",
|
|
264
|
+
"VII",
|
|
265
|
+
"I",
|
|
266
|
+
"NVV",
|
|
267
|
+
"S",
|
|
268
|
+
"N",
|
|
269
|
+
"ISN",
|
|
270
|
+
"INSNC",
|
|
271
|
+
"NSN",
|
|
272
|
+
"NN",
|
|
273
|
+
"",
|
|
274
|
+
"",
|
|
275
|
+
"N",
|
|
276
|
+
"O",
|
|
277
|
+
"O",
|
|
278
|
+
"O",
|
|
279
|
+
"CO",
|
|
280
|
+
"CO",
|
|
281
|
+
"O",
|
|
282
|
+
"HO",
|
|
283
|
+
"",
|
|
284
|
+
"",
|
|
285
|
+
"",
|
|
286
|
+
"",
|
|
287
|
+
"",
|
|
288
|
+
"",
|
|
289
|
+
"",
|
|
290
|
+
"",
|
|
291
|
+
"",
|
|
292
|
+
"",
|
|
293
|
+
"",
|
|
294
|
+
"",
|
|
295
|
+
"",
|
|
296
|
+
"",
|
|
297
|
+
"",
|
|
298
|
+
"",
|
|
299
|
+
"V",
|
|
300
|
+
"",
|
|
301
|
+
"",
|
|
302
|
+
"",
|
|
303
|
+
"",
|
|
304
|
+
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
static int insn_len_info[] = {
|
|
308
|
+
1,
|
|
309
|
+
2,
|
|
310
|
+
2,
|
|
311
|
+
3,
|
|
312
|
+
2,
|
|
313
|
+
3,
|
|
314
|
+
3,
|
|
315
|
+
2,
|
|
316
|
+
2,
|
|
317
|
+
2,
|
|
318
|
+
2,
|
|
319
|
+
2,
|
|
320
|
+
2,
|
|
321
|
+
2,
|
|
322
|
+
2,
|
|
323
|
+
1,
|
|
324
|
+
1,
|
|
325
|
+
1,
|
|
326
|
+
2,
|
|
327
|
+
2,
|
|
328
|
+
2,
|
|
329
|
+
1,
|
|
330
|
+
2,
|
|
331
|
+
2,
|
|
332
|
+
2,
|
|
333
|
+
3,
|
|
334
|
+
1,
|
|
335
|
+
2,
|
|
336
|
+
2,
|
|
337
|
+
2,
|
|
338
|
+
2,
|
|
339
|
+
1,
|
|
340
|
+
1,
|
|
341
|
+
1,
|
|
342
|
+
2,
|
|
343
|
+
1,
|
|
344
|
+
1,
|
|
345
|
+
2,
|
|
346
|
+
2,
|
|
347
|
+
1,
|
|
348
|
+
4,
|
|
349
|
+
4,
|
|
350
|
+
2,
|
|
351
|
+
4,
|
|
352
|
+
2,
|
|
353
|
+
2,
|
|
354
|
+
4,
|
|
355
|
+
6,
|
|
356
|
+
4,
|
|
357
|
+
3,
|
|
358
|
+
1,
|
|
359
|
+
1,
|
|
360
|
+
2,
|
|
361
|
+
2,
|
|
362
|
+
2,
|
|
363
|
+
2,
|
|
364
|
+
3,
|
|
365
|
+
3,
|
|
366
|
+
2,
|
|
367
|
+
3,
|
|
368
|
+
1,
|
|
369
|
+
1,
|
|
370
|
+
1,
|
|
371
|
+
1,
|
|
372
|
+
1,
|
|
373
|
+
1,
|
|
374
|
+
1,
|
|
375
|
+
1,
|
|
376
|
+
1,
|
|
377
|
+
1,
|
|
378
|
+
1,
|
|
379
|
+
1,
|
|
380
|
+
1,
|
|
381
|
+
1,
|
|
382
|
+
1,
|
|
383
|
+
1,
|
|
384
|
+
2,
|
|
385
|
+
1,
|
|
386
|
+
1,
|
|
387
|
+
1,
|
|
388
|
+
1,
|
|
389
|
+
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
static int insn_stack_push_num_info[] = {
|
|
393
|
+
0,
|
|
394
|
+
1,
|
|
395
|
+
0,
|
|
396
|
+
1,
|
|
397
|
+
0,
|
|
398
|
+
1,
|
|
399
|
+
0,
|
|
400
|
+
1,
|
|
401
|
+
0,
|
|
402
|
+
1,
|
|
403
|
+
0,
|
|
404
|
+
1,
|
|
405
|
+
0,
|
|
406
|
+
1,
|
|
407
|
+
0,
|
|
408
|
+
1,
|
|
409
|
+
1,
|
|
410
|
+
1,
|
|
411
|
+
1,
|
|
412
|
+
1,
|
|
413
|
+
1,
|
|
414
|
+
1,
|
|
415
|
+
1,
|
|
416
|
+
1,
|
|
417
|
+
1,
|
|
418
|
+
1,
|
|
419
|
+
1,
|
|
420
|
+
1,
|
|
421
|
+
2,
|
|
422
|
+
1,
|
|
423
|
+
1,
|
|
424
|
+
1,
|
|
425
|
+
0,
|
|
426
|
+
2,
|
|
427
|
+
1,
|
|
428
|
+
2,
|
|
429
|
+
1,
|
|
430
|
+
1,
|
|
431
|
+
1,
|
|
432
|
+
1,
|
|
433
|
+
0,
|
|
434
|
+
0,
|
|
435
|
+
0,
|
|
436
|
+
1,
|
|
437
|
+
0,
|
|
438
|
+
0,
|
|
439
|
+
1,
|
|
440
|
+
1,
|
|
441
|
+
1,
|
|
442
|
+
1,
|
|
443
|
+
1,
|
|
444
|
+
1,
|
|
445
|
+
1,
|
|
446
|
+
0,
|
|
447
|
+
0,
|
|
448
|
+
0,
|
|
449
|
+
1,
|
|
450
|
+
1,
|
|
451
|
+
1,
|
|
452
|
+
0,
|
|
453
|
+
0,
|
|
454
|
+
1,
|
|
455
|
+
1,
|
|
456
|
+
1,
|
|
457
|
+
1,
|
|
458
|
+
1,
|
|
459
|
+
1,
|
|
460
|
+
1,
|
|
461
|
+
1,
|
|
462
|
+
1,
|
|
463
|
+
1,
|
|
464
|
+
1,
|
|
465
|
+
1,
|
|
466
|
+
1,
|
|
467
|
+
1,
|
|
468
|
+
1,
|
|
469
|
+
1,
|
|
470
|
+
1,
|
|
471
|
+
0,
|
|
472
|
+
1,
|
|
473
|
+
1,
|
|
474
|
+
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
static int
|
|
478
|
+
insn_stack_increase(int depth, int insn, VALUE *opes)
|
|
479
|
+
{
|
|
480
|
+
switch(insn){
|
|
481
|
+
case BIN(nop):{
|
|
482
|
+
return depth + 0;
|
|
483
|
+
}
|
|
484
|
+
case BIN(getlocal):{
|
|
485
|
+
return depth + 1;
|
|
486
|
+
}
|
|
487
|
+
case BIN(setlocal):{
|
|
488
|
+
return depth + -1;
|
|
489
|
+
}
|
|
490
|
+
case BIN(getspecial):{
|
|
491
|
+
return depth + 1;
|
|
492
|
+
}
|
|
493
|
+
case BIN(setspecial):{
|
|
494
|
+
return depth + -1;
|
|
495
|
+
}
|
|
496
|
+
case BIN(getdynamic):{
|
|
497
|
+
return depth + 1;
|
|
498
|
+
}
|
|
499
|
+
case BIN(setdynamic):{
|
|
500
|
+
return depth + -1;
|
|
501
|
+
}
|
|
502
|
+
case BIN(getinstancevariable):{
|
|
503
|
+
return depth + 1;
|
|
504
|
+
}
|
|
505
|
+
case BIN(setinstancevariable):{
|
|
506
|
+
return depth + -1;
|
|
507
|
+
}
|
|
508
|
+
case BIN(getclassvariable):{
|
|
509
|
+
return depth + 1;
|
|
510
|
+
}
|
|
511
|
+
case BIN(setclassvariable):{
|
|
512
|
+
return depth + -1;
|
|
513
|
+
}
|
|
514
|
+
case BIN(getconstant):{
|
|
515
|
+
return depth + 0;
|
|
516
|
+
}
|
|
517
|
+
case BIN(setconstant):{
|
|
518
|
+
return depth + -2;
|
|
519
|
+
}
|
|
520
|
+
case BIN(getglobal):{
|
|
521
|
+
return depth + 1;
|
|
522
|
+
}
|
|
523
|
+
case BIN(setglobal):{
|
|
524
|
+
return depth + -1;
|
|
525
|
+
}
|
|
526
|
+
case BIN(putnil):{
|
|
527
|
+
return depth + 1;
|
|
528
|
+
}
|
|
529
|
+
case BIN(putself):{
|
|
530
|
+
return depth + 1;
|
|
531
|
+
}
|
|
532
|
+
case BIN(putundef):{
|
|
533
|
+
return depth + 1;
|
|
534
|
+
}
|
|
535
|
+
case BIN(putobject):{
|
|
536
|
+
return depth + 1;
|
|
537
|
+
}
|
|
538
|
+
case BIN(putstring):{
|
|
539
|
+
return depth + 1;
|
|
540
|
+
}
|
|
541
|
+
case BIN(concatstrings):{
|
|
542
|
+
int inc = 0;
|
|
543
|
+
unsigned long num = FIX2INT(opes[0]);
|
|
544
|
+
inc += 1 - num;;
|
|
545
|
+
return depth + inc;
|
|
546
|
+
}
|
|
547
|
+
case BIN(tostring):{
|
|
548
|
+
return depth + 0;
|
|
549
|
+
}
|
|
550
|
+
case BIN(toregexp):{
|
|
551
|
+
return depth + 0;
|
|
552
|
+
}
|
|
553
|
+
case BIN(newarray):{
|
|
554
|
+
int inc = 0;
|
|
555
|
+
unsigned long num = FIX2INT(opes[0]);
|
|
556
|
+
inc += 1 - num;;
|
|
557
|
+
return depth + inc;
|
|
558
|
+
}
|
|
559
|
+
case BIN(duparray):{
|
|
560
|
+
return depth + 1;
|
|
561
|
+
}
|
|
562
|
+
case BIN(expandarray):{
|
|
563
|
+
int inc = 0;
|
|
564
|
+
unsigned long num = FIX2INT(opes[0]);
|
|
565
|
+
unsigned long flag = FIX2INT(opes[1]);
|
|
566
|
+
inc += (num > 0) ? num - 1 + (flag ? 1 : 0) : num + 1 - (flag ? 1 : 0);;
|
|
567
|
+
return depth + inc;
|
|
568
|
+
}
|
|
569
|
+
case BIN(concatarray):{
|
|
570
|
+
return depth + -1;
|
|
571
|
+
}
|
|
572
|
+
case BIN(splatarray):{
|
|
573
|
+
return depth + 0;
|
|
574
|
+
}
|
|
575
|
+
case BIN(checkincludearray):{
|
|
576
|
+
return depth + 0;
|
|
577
|
+
}
|
|
578
|
+
case BIN(newhash):{
|
|
579
|
+
int inc = 0;
|
|
580
|
+
unsigned long num = FIX2INT(opes[0]);
|
|
581
|
+
inc += 1 - num;;
|
|
582
|
+
return depth + inc;
|
|
583
|
+
}
|
|
584
|
+
case BIN(newrange):{
|
|
585
|
+
return depth + -1;
|
|
586
|
+
}
|
|
587
|
+
case BIN(putnot):{
|
|
588
|
+
return depth + 0;
|
|
589
|
+
}
|
|
590
|
+
case BIN(pop):{
|
|
591
|
+
return depth + -1;
|
|
592
|
+
}
|
|
593
|
+
case BIN(dup):{
|
|
594
|
+
return depth + 1;
|
|
595
|
+
}
|
|
596
|
+
case BIN(dupn):{
|
|
597
|
+
int inc = 0;
|
|
598
|
+
unsigned long n = FIX2INT(opes[0]);
|
|
599
|
+
inc += n;;
|
|
600
|
+
return depth + inc;
|
|
601
|
+
}
|
|
602
|
+
case BIN(swap):{
|
|
603
|
+
return depth + 0;
|
|
604
|
+
}
|
|
605
|
+
case BIN(reput):{
|
|
606
|
+
int inc = 0;
|
|
607
|
+
inc += 0;;
|
|
608
|
+
return depth + inc;
|
|
609
|
+
}
|
|
610
|
+
case BIN(topn):{
|
|
611
|
+
int inc = 0;
|
|
612
|
+
unsigned long n = FIX2INT(opes[0]);
|
|
613
|
+
inc += 1;;
|
|
614
|
+
return depth + inc;
|
|
615
|
+
}
|
|
616
|
+
case BIN(setn):{
|
|
617
|
+
int inc = 0;
|
|
618
|
+
unsigned long n = FIX2INT(opes[0]);
|
|
619
|
+
inc += 0;
|
|
620
|
+
return depth + inc;
|
|
621
|
+
}
|
|
622
|
+
case BIN(emptstack):{
|
|
623
|
+
int inc = 0;
|
|
624
|
+
inc = 0; depth = 0;;
|
|
625
|
+
return depth + inc;
|
|
626
|
+
}
|
|
627
|
+
case BIN(definemethod):{
|
|
628
|
+
return depth + -1;
|
|
629
|
+
}
|
|
630
|
+
case BIN(alias):{
|
|
631
|
+
return depth + 0;
|
|
632
|
+
}
|
|
633
|
+
case BIN(undef):{
|
|
634
|
+
return depth + 0;
|
|
635
|
+
}
|
|
636
|
+
case BIN(defined):{
|
|
637
|
+
return depth + 0;
|
|
638
|
+
}
|
|
639
|
+
case BIN(postexe):{
|
|
640
|
+
return depth + 0;
|
|
641
|
+
}
|
|
642
|
+
case BIN(trace):{
|
|
643
|
+
return depth + 0;
|
|
644
|
+
}
|
|
645
|
+
case BIN(defineclass):{
|
|
646
|
+
return depth + -1;
|
|
647
|
+
}
|
|
648
|
+
case BIN(send):{
|
|
649
|
+
int inc = 0;
|
|
650
|
+
unsigned long op_argc = FIX2INT(opes[1]);
|
|
651
|
+
unsigned long op_flag = FIX2INT(opes[3]);
|
|
652
|
+
inc += - (op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));;
|
|
653
|
+
return depth + inc;
|
|
654
|
+
}
|
|
655
|
+
case BIN(invokesuper):{
|
|
656
|
+
int inc = 0;
|
|
657
|
+
unsigned long op_argc = FIX2INT(opes[0]);
|
|
658
|
+
unsigned long flag = FIX2INT(opes[2]);
|
|
659
|
+
inc += - op_argc;;
|
|
660
|
+
return depth + inc;
|
|
661
|
+
}
|
|
662
|
+
case BIN(invokeblock):{
|
|
663
|
+
int inc = 0;
|
|
664
|
+
unsigned long num = FIX2INT(opes[0]);
|
|
665
|
+
unsigned long flag = FIX2INT(opes[1]);
|
|
666
|
+
inc += 1 - num;;
|
|
667
|
+
return depth + inc;
|
|
668
|
+
}
|
|
669
|
+
case BIN(leave):{
|
|
670
|
+
return depth + 0;
|
|
671
|
+
}
|
|
672
|
+
case BIN(finish):{
|
|
673
|
+
return depth + 0;
|
|
674
|
+
}
|
|
675
|
+
case BIN(throw):{
|
|
676
|
+
return depth + 0;
|
|
677
|
+
}
|
|
678
|
+
case BIN(jump):{
|
|
679
|
+
return depth + 0;
|
|
680
|
+
}
|
|
681
|
+
case BIN(branchif):{
|
|
682
|
+
return depth + -1;
|
|
683
|
+
}
|
|
684
|
+
case BIN(branchunless):{
|
|
685
|
+
return depth + -1;
|
|
686
|
+
}
|
|
687
|
+
case BIN(getinlinecache):{
|
|
688
|
+
return depth + 1;
|
|
689
|
+
}
|
|
690
|
+
case BIN(onceinlinecache):{
|
|
691
|
+
return depth + 1;
|
|
692
|
+
}
|
|
693
|
+
case BIN(setinlinecache):{
|
|
694
|
+
return depth + 0;
|
|
695
|
+
}
|
|
696
|
+
case BIN(opt_case_dispatch):{
|
|
697
|
+
int inc = 0;
|
|
698
|
+
inc += -1;;
|
|
699
|
+
return depth + inc;
|
|
700
|
+
}
|
|
701
|
+
case BIN(opt_checkenv):{
|
|
702
|
+
return depth + 0;
|
|
703
|
+
}
|
|
704
|
+
case BIN(opt_plus):{
|
|
705
|
+
return depth + -1;
|
|
706
|
+
}
|
|
707
|
+
case BIN(opt_minus):{
|
|
708
|
+
return depth + -1;
|
|
709
|
+
}
|
|
710
|
+
case BIN(opt_mult):{
|
|
711
|
+
return depth + -1;
|
|
712
|
+
}
|
|
713
|
+
case BIN(opt_div):{
|
|
714
|
+
return depth + -1;
|
|
715
|
+
}
|
|
716
|
+
case BIN(opt_mod):{
|
|
717
|
+
return depth + -1;
|
|
718
|
+
}
|
|
719
|
+
case BIN(opt_eq):{
|
|
720
|
+
return depth + -1;
|
|
721
|
+
}
|
|
722
|
+
case BIN(opt_lt):{
|
|
723
|
+
return depth + -1;
|
|
724
|
+
}
|
|
725
|
+
case BIN(opt_le):{
|
|
726
|
+
return depth + -1;
|
|
727
|
+
}
|
|
728
|
+
case BIN(opt_gt):{
|
|
729
|
+
return depth + -1;
|
|
730
|
+
}
|
|
731
|
+
case BIN(opt_ge):{
|
|
732
|
+
return depth + -1;
|
|
733
|
+
}
|
|
734
|
+
case BIN(opt_ltlt):{
|
|
735
|
+
return depth + -1;
|
|
736
|
+
}
|
|
737
|
+
case BIN(opt_aref):{
|
|
738
|
+
return depth + -1;
|
|
739
|
+
}
|
|
740
|
+
case BIN(opt_aset):{
|
|
741
|
+
return depth + -2;
|
|
742
|
+
}
|
|
743
|
+
case BIN(opt_length):{
|
|
744
|
+
return depth + 0;
|
|
745
|
+
}
|
|
746
|
+
case BIN(opt_succ):{
|
|
747
|
+
return depth + 0;
|
|
748
|
+
}
|
|
749
|
+
case BIN(opt_regexpmatch1):{
|
|
750
|
+
return depth + 0;
|
|
751
|
+
}
|
|
752
|
+
case BIN(opt_regexpmatch2):{
|
|
753
|
+
return depth + -1;
|
|
754
|
+
}
|
|
755
|
+
case BIN(opt_call_native_compiled):{
|
|
756
|
+
return depth + 0;
|
|
757
|
+
}
|
|
758
|
+
case BIN(bitblt):{
|
|
759
|
+
return depth + 1;
|
|
760
|
+
}
|
|
761
|
+
case BIN(answer):{
|
|
762
|
+
return depth + 1;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
default:
|
|
766
|
+
rb_bug("insn_sp_increase: unreachable");
|
|
767
|
+
}
|
|
768
|
+
return 0;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/* some utilities */
|
|
772
|
+
|
|
773
|
+
static int
|
|
774
|
+
insn_len(int insn)
|
|
775
|
+
{
|
|
776
|
+
return insn_len_info[insn];
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
static char *
|
|
780
|
+
insn_name(int insn)
|
|
781
|
+
{
|
|
782
|
+
return insn_name_info[insn];
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
static char *
|
|
786
|
+
insn_op_types(int insn)
|
|
787
|
+
{
|
|
788
|
+
return insn_operand_info[insn];
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
static int
|
|
792
|
+
insn_op_type(int insn, int pos)
|
|
793
|
+
{
|
|
794
|
+
int len = insn_len(insn) - 1;
|
|
795
|
+
if(pos < len){
|
|
796
|
+
return insn_operand_info[insn][pos];
|
|
797
|
+
}
|
|
798
|
+
else{
|
|
799
|
+
return 0;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
static int
|
|
804
|
+
insn_ret_num(int insn)
|
|
805
|
+
{
|
|
806
|
+
return insn_stack_push_num_info[insn];
|
|
807
|
+
}
|
|
808
|
+
void
|
|
809
|
+
make_compile_option(rb_compile_option_t *option, VALUE opt);
|
|
810
|
+
void
|
|
811
|
+
make_compile_option_value(rb_compile_option_t *option);
|
|
812
|
+
|
|
813
|
+
extern VALUE instruction_class[YARV_MAX_INSTRUCTION_SIZE];
|
|
814
|
+
void define_instruction_subclasses(VALUE rb_cInstruction);
|
|
815
|
+
|
|
816
|
+
#endif
|
|
817
|
+
|
|
818
|
+
#endif
|
|
819
|
+
|