ruby-internal 0.7.1 → 0.7.2
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/ext/internal/binding/block.h +12 -0
- data/ext/internal/method/method.h +20 -0
- data/ext/internal/module/classpath.c +42 -0
- data/ext/internal/module/classpath.h +17 -0
- data/ext/internal/node/block.h +12 -0
- data/ext/internal/node/global_entry.h +10 -0
- data/ext/internal/node/node_type_descrip.c +149 -0
- data/ext/internal/node/nodeinfo.c +5582 -0
- data/ext/internal/node/nodeinfo.h +70 -0
- data/ext/internal/proc/block.h +12 -0
- data/ext/internal/tag/tag.h +6 -0
- data/ext/internal/vm/instruction/insns_info.c +5936 -0
- data/ext/internal/vm/instruction/insns_info.h +890 -0
- data/ext/internal/vm/iseq/iseq.c +77 -64
- metadata +15 -2
@@ -0,0 +1,890 @@
|
|
1
|
+
#ifndef insns_info__h_
|
2
|
+
#define insns_info__h_
|
3
|
+
|
4
|
+
#include "ruby.h"
|
5
|
+
|
6
|
+
#ifdef RUBY_VM
|
7
|
+
|
8
|
+
#include "vm_core.h"
|
9
|
+
|
10
|
+
#ifdef HAVE_VM_H
|
11
|
+
#include "vm.h"
|
12
|
+
#endif
|
13
|
+
|
14
|
+
/** -*-c-*-
|
15
|
+
This file contains YARV instructions list.
|
16
|
+
|
17
|
+
----
|
18
|
+
This file is auto generated by insns2vm.rb
|
19
|
+
DO NOT TOUCH!
|
20
|
+
|
21
|
+
If you want to fix something, you must edit 'template/insns.inc.tmpl'
|
22
|
+
or insns2vm.rb
|
23
|
+
*/
|
24
|
+
|
25
|
+
|
26
|
+
/* BIN : Basic Instruction Name */
|
27
|
+
#define BIN(n) YARVINSN_##n
|
28
|
+
|
29
|
+
enum ruby_vminsn_type {
|
30
|
+
BIN(nop) = 0,
|
31
|
+
|
32
|
+
BIN(getlocal) = 1,
|
33
|
+
|
34
|
+
BIN(setlocal) = 2,
|
35
|
+
|
36
|
+
BIN(getspecial) = 3,
|
37
|
+
|
38
|
+
BIN(setspecial) = 4,
|
39
|
+
|
40
|
+
BIN(getdynamic) = 5,
|
41
|
+
|
42
|
+
BIN(setdynamic) = 6,
|
43
|
+
|
44
|
+
BIN(getinstancevariable) = 7,
|
45
|
+
|
46
|
+
BIN(setinstancevariable) = 8,
|
47
|
+
|
48
|
+
BIN(getclassvariable) = 9,
|
49
|
+
|
50
|
+
BIN(setclassvariable) = 10,
|
51
|
+
|
52
|
+
BIN(getconstant) = 11,
|
53
|
+
|
54
|
+
BIN(setconstant) = 12,
|
55
|
+
|
56
|
+
BIN(getglobal) = 13,
|
57
|
+
|
58
|
+
BIN(setglobal) = 14,
|
59
|
+
|
60
|
+
BIN(putnil) = 15,
|
61
|
+
|
62
|
+
BIN(putself) = 16,
|
63
|
+
|
64
|
+
BIN(putobject) = 17,
|
65
|
+
|
66
|
+
BIN(putspecialobject) = 18,
|
67
|
+
|
68
|
+
BIN(putiseq) = 19,
|
69
|
+
|
70
|
+
BIN(putstring) = 20,
|
71
|
+
|
72
|
+
BIN(concatstrings) = 21,
|
73
|
+
|
74
|
+
BIN(tostring) = 22,
|
75
|
+
|
76
|
+
BIN(toregexp) = 23,
|
77
|
+
|
78
|
+
BIN(newarray) = 24,
|
79
|
+
|
80
|
+
BIN(duparray) = 25,
|
81
|
+
|
82
|
+
BIN(expandarray) = 26,
|
83
|
+
|
84
|
+
BIN(concatarray) = 27,
|
85
|
+
|
86
|
+
BIN(splatarray) = 28,
|
87
|
+
|
88
|
+
BIN(checkincludearray) = 29,
|
89
|
+
|
90
|
+
BIN(newhash) = 30,
|
91
|
+
|
92
|
+
BIN(newrange) = 31,
|
93
|
+
|
94
|
+
BIN(pop) = 32,
|
95
|
+
|
96
|
+
BIN(dup) = 33,
|
97
|
+
|
98
|
+
BIN(dupn) = 34,
|
99
|
+
|
100
|
+
BIN(swap) = 35,
|
101
|
+
|
102
|
+
BIN(reput) = 36,
|
103
|
+
|
104
|
+
BIN(topn) = 37,
|
105
|
+
|
106
|
+
BIN(setn) = 38,
|
107
|
+
|
108
|
+
BIN(adjuststack) = 39,
|
109
|
+
|
110
|
+
BIN(defined) = 40,
|
111
|
+
|
112
|
+
BIN(trace) = 41,
|
113
|
+
|
114
|
+
BIN(defineclass) = 42,
|
115
|
+
|
116
|
+
BIN(send) = 43,
|
117
|
+
|
118
|
+
BIN(invokesuper) = 44,
|
119
|
+
|
120
|
+
BIN(invokeblock) = 45,
|
121
|
+
|
122
|
+
BIN(leave) = 46,
|
123
|
+
|
124
|
+
BIN(finish) = 47,
|
125
|
+
|
126
|
+
BIN(throw) = 48,
|
127
|
+
|
128
|
+
BIN(jump) = 49,
|
129
|
+
|
130
|
+
BIN(branchif) = 50,
|
131
|
+
|
132
|
+
BIN(branchunless) = 51,
|
133
|
+
|
134
|
+
BIN(getinlinecache) = 52,
|
135
|
+
|
136
|
+
BIN(onceinlinecache) = 53,
|
137
|
+
|
138
|
+
BIN(setinlinecache) = 54,
|
139
|
+
|
140
|
+
BIN(opt_case_dispatch) = 55,
|
141
|
+
|
142
|
+
BIN(opt_checkenv) = 56,
|
143
|
+
|
144
|
+
BIN(opt_plus) = 57,
|
145
|
+
|
146
|
+
BIN(opt_minus) = 58,
|
147
|
+
|
148
|
+
BIN(opt_mult) = 59,
|
149
|
+
|
150
|
+
BIN(opt_div) = 60,
|
151
|
+
|
152
|
+
BIN(opt_mod) = 61,
|
153
|
+
|
154
|
+
BIN(opt_eq) = 62,
|
155
|
+
|
156
|
+
BIN(opt_neq) = 63,
|
157
|
+
|
158
|
+
BIN(opt_lt) = 64,
|
159
|
+
|
160
|
+
BIN(opt_le) = 65,
|
161
|
+
|
162
|
+
BIN(opt_gt) = 66,
|
163
|
+
|
164
|
+
BIN(opt_ge) = 67,
|
165
|
+
|
166
|
+
BIN(opt_ltlt) = 68,
|
167
|
+
|
168
|
+
BIN(opt_aref) = 69,
|
169
|
+
|
170
|
+
BIN(opt_aset) = 70,
|
171
|
+
|
172
|
+
BIN(opt_length) = 71,
|
173
|
+
|
174
|
+
BIN(opt_succ) = 72,
|
175
|
+
|
176
|
+
BIN(opt_not) = 73,
|
177
|
+
|
178
|
+
BIN(opt_regexpmatch1) = 74,
|
179
|
+
|
180
|
+
BIN(opt_regexpmatch2) = 75,
|
181
|
+
|
182
|
+
BIN(opt_call_c_function) = 76,
|
183
|
+
|
184
|
+
BIN(bitblt) = 77,
|
185
|
+
|
186
|
+
BIN(answer) = 78,
|
187
|
+
|
188
|
+
VM_INSTRUCTION_SIZE = 79
|
189
|
+
};
|
190
|
+
|
191
|
+
/** -*-c-*-
|
192
|
+
This file contains instruction information for yarv instruction sequence.
|
193
|
+
|
194
|
+
----
|
195
|
+
This file is auto generated by insns2vm.rb
|
196
|
+
DO NOT TOUCH!
|
197
|
+
|
198
|
+
If you want to fix something, you must edit 'template/insns_info.inc.tmpl'
|
199
|
+
or insns2vm.rb
|
200
|
+
*/
|
201
|
+
|
202
|
+
#define TS_OFFSET 'O'
|
203
|
+
#define TS_NUM 'N'
|
204
|
+
#define TS_LINDEX 'L'
|
205
|
+
#define TS_DINDEX 'D'
|
206
|
+
#define TS_VALUE 'V'
|
207
|
+
#define TS_ID 'I'
|
208
|
+
#define TS_GENTRY 'G'
|
209
|
+
#define TS_IC 'C'
|
210
|
+
#define TS_CDHASH 'H'
|
211
|
+
#define TS_ISEQ 'S'
|
212
|
+
#define TS_VARIABLE '.'
|
213
|
+
#define TS_FUNCPTR 'F'
|
214
|
+
|
215
|
+
static const char *const insn_name_info[] = {
|
216
|
+
"nop",
|
217
|
+
"getlocal",
|
218
|
+
"setlocal",
|
219
|
+
"getspecial",
|
220
|
+
"setspecial",
|
221
|
+
"getdynamic",
|
222
|
+
"setdynamic",
|
223
|
+
"getinstancevariable",
|
224
|
+
"setinstancevariable",
|
225
|
+
"getclassvariable",
|
226
|
+
"setclassvariable",
|
227
|
+
"getconstant",
|
228
|
+
"setconstant",
|
229
|
+
"getglobal",
|
230
|
+
"setglobal",
|
231
|
+
"putnil",
|
232
|
+
"putself",
|
233
|
+
"putobject",
|
234
|
+
"putspecialobject",
|
235
|
+
"putiseq",
|
236
|
+
"putstring",
|
237
|
+
"concatstrings",
|
238
|
+
"tostring",
|
239
|
+
"toregexp",
|
240
|
+
"newarray",
|
241
|
+
"duparray",
|
242
|
+
"expandarray",
|
243
|
+
"concatarray",
|
244
|
+
"splatarray",
|
245
|
+
"checkincludearray",
|
246
|
+
"newhash",
|
247
|
+
"newrange",
|
248
|
+
"pop",
|
249
|
+
"dup",
|
250
|
+
"dupn",
|
251
|
+
"swap",
|
252
|
+
"reput",
|
253
|
+
"topn",
|
254
|
+
"setn",
|
255
|
+
"adjuststack",
|
256
|
+
"defined",
|
257
|
+
"trace",
|
258
|
+
"defineclass",
|
259
|
+
"send",
|
260
|
+
"invokesuper",
|
261
|
+
"invokeblock",
|
262
|
+
"leave",
|
263
|
+
"finish",
|
264
|
+
"throw",
|
265
|
+
"jump",
|
266
|
+
"branchif",
|
267
|
+
"branchunless",
|
268
|
+
"getinlinecache",
|
269
|
+
"onceinlinecache",
|
270
|
+
"setinlinecache",
|
271
|
+
"opt_case_dispatch",
|
272
|
+
"opt_checkenv",
|
273
|
+
"opt_plus",
|
274
|
+
"opt_minus",
|
275
|
+
"opt_mult",
|
276
|
+
"opt_div",
|
277
|
+
"opt_mod",
|
278
|
+
"opt_eq",
|
279
|
+
"opt_neq",
|
280
|
+
"opt_lt",
|
281
|
+
"opt_le",
|
282
|
+
"opt_gt",
|
283
|
+
"opt_ge",
|
284
|
+
"opt_ltlt",
|
285
|
+
"opt_aref",
|
286
|
+
"opt_aset",
|
287
|
+
"opt_length",
|
288
|
+
"opt_succ",
|
289
|
+
"opt_not",
|
290
|
+
"opt_regexpmatch1",
|
291
|
+
"opt_regexpmatch2",
|
292
|
+
"opt_call_c_function",
|
293
|
+
"bitblt",
|
294
|
+
"answer",
|
295
|
+
|
296
|
+
};
|
297
|
+
|
298
|
+
static const char *const insn_operand_info[] = {
|
299
|
+
"",
|
300
|
+
"L",
|
301
|
+
"L",
|
302
|
+
"VN",
|
303
|
+
"V",
|
304
|
+
"DN",
|
305
|
+
"DN",
|
306
|
+
"I",
|
307
|
+
"I",
|
308
|
+
"I",
|
309
|
+
"I",
|
310
|
+
"I",
|
311
|
+
"I",
|
312
|
+
"G",
|
313
|
+
"G",
|
314
|
+
"",
|
315
|
+
"",
|
316
|
+
"V",
|
317
|
+
"N",
|
318
|
+
"S",
|
319
|
+
"V",
|
320
|
+
"N",
|
321
|
+
"",
|
322
|
+
"NN",
|
323
|
+
"N",
|
324
|
+
"V",
|
325
|
+
"NN",
|
326
|
+
"",
|
327
|
+
"V",
|
328
|
+
"V",
|
329
|
+
"N",
|
330
|
+
"N",
|
331
|
+
"",
|
332
|
+
"",
|
333
|
+
"N",
|
334
|
+
"",
|
335
|
+
"",
|
336
|
+
"N",
|
337
|
+
"N",
|
338
|
+
"N",
|
339
|
+
"NVV",
|
340
|
+
"N",
|
341
|
+
"ISN",
|
342
|
+
"INSNC",
|
343
|
+
"NSN",
|
344
|
+
"NN",
|
345
|
+
"",
|
346
|
+
"",
|
347
|
+
"N",
|
348
|
+
"O",
|
349
|
+
"O",
|
350
|
+
"O",
|
351
|
+
"CO",
|
352
|
+
"CO",
|
353
|
+
"O",
|
354
|
+
"HO",
|
355
|
+
"",
|
356
|
+
"",
|
357
|
+
"",
|
358
|
+
"",
|
359
|
+
"",
|
360
|
+
"",
|
361
|
+
"C",
|
362
|
+
"CC",
|
363
|
+
"",
|
364
|
+
"",
|
365
|
+
"",
|
366
|
+
"",
|
367
|
+
"",
|
368
|
+
"",
|
369
|
+
"",
|
370
|
+
"",
|
371
|
+
"",
|
372
|
+
"C",
|
373
|
+
"V",
|
374
|
+
"",
|
375
|
+
"F",
|
376
|
+
"",
|
377
|
+
"",
|
378
|
+
|
379
|
+
};
|
380
|
+
|
381
|
+
static const int insn_len_info[] = {
|
382
|
+
1,
|
383
|
+
2,
|
384
|
+
2,
|
385
|
+
3,
|
386
|
+
2,
|
387
|
+
3,
|
388
|
+
3,
|
389
|
+
2,
|
390
|
+
2,
|
391
|
+
2,
|
392
|
+
2,
|
393
|
+
2,
|
394
|
+
2,
|
395
|
+
2,
|
396
|
+
2,
|
397
|
+
1,
|
398
|
+
1,
|
399
|
+
2,
|
400
|
+
2,
|
401
|
+
2,
|
402
|
+
2,
|
403
|
+
2,
|
404
|
+
1,
|
405
|
+
3,
|
406
|
+
2,
|
407
|
+
2,
|
408
|
+
3,
|
409
|
+
1,
|
410
|
+
2,
|
411
|
+
2,
|
412
|
+
2,
|
413
|
+
2,
|
414
|
+
1,
|
415
|
+
1,
|
416
|
+
2,
|
417
|
+
1,
|
418
|
+
1,
|
419
|
+
2,
|
420
|
+
2,
|
421
|
+
2,
|
422
|
+
4,
|
423
|
+
2,
|
424
|
+
4,
|
425
|
+
6,
|
426
|
+
4,
|
427
|
+
3,
|
428
|
+
1,
|
429
|
+
1,
|
430
|
+
2,
|
431
|
+
2,
|
432
|
+
2,
|
433
|
+
2,
|
434
|
+
3,
|
435
|
+
3,
|
436
|
+
2,
|
437
|
+
3,
|
438
|
+
1,
|
439
|
+
1,
|
440
|
+
1,
|
441
|
+
1,
|
442
|
+
1,
|
443
|
+
1,
|
444
|
+
2,
|
445
|
+
3,
|
446
|
+
1,
|
447
|
+
1,
|
448
|
+
1,
|
449
|
+
1,
|
450
|
+
1,
|
451
|
+
1,
|
452
|
+
1,
|
453
|
+
1,
|
454
|
+
1,
|
455
|
+
2,
|
456
|
+
2,
|
457
|
+
1,
|
458
|
+
2,
|
459
|
+
1,
|
460
|
+
1,
|
461
|
+
|
462
|
+
};
|
463
|
+
|
464
|
+
#ifdef USE_INSN_RET_NUM
|
465
|
+
static const int insn_stack_push_num_info[] = {
|
466
|
+
0,
|
467
|
+
1,
|
468
|
+
0,
|
469
|
+
1,
|
470
|
+
0,
|
471
|
+
1,
|
472
|
+
0,
|
473
|
+
1,
|
474
|
+
0,
|
475
|
+
1,
|
476
|
+
0,
|
477
|
+
1,
|
478
|
+
0,
|
479
|
+
1,
|
480
|
+
0,
|
481
|
+
1,
|
482
|
+
1,
|
483
|
+
1,
|
484
|
+
1,
|
485
|
+
1,
|
486
|
+
1,
|
487
|
+
1,
|
488
|
+
1,
|
489
|
+
1,
|
490
|
+
1,
|
491
|
+
1,
|
492
|
+
1,
|
493
|
+
1,
|
494
|
+
1,
|
495
|
+
2,
|
496
|
+
1,
|
497
|
+
1,
|
498
|
+
0,
|
499
|
+
2,
|
500
|
+
1,
|
501
|
+
2,
|
502
|
+
1,
|
503
|
+
1,
|
504
|
+
1,
|
505
|
+
1,
|
506
|
+
1,
|
507
|
+
0,
|
508
|
+
1,
|
509
|
+
1,
|
510
|
+
1,
|
511
|
+
1,
|
512
|
+
1,
|
513
|
+
1,
|
514
|
+
1,
|
515
|
+
0,
|
516
|
+
0,
|
517
|
+
0,
|
518
|
+
1,
|
519
|
+
1,
|
520
|
+
1,
|
521
|
+
0,
|
522
|
+
0,
|
523
|
+
1,
|
524
|
+
1,
|
525
|
+
1,
|
526
|
+
1,
|
527
|
+
1,
|
528
|
+
1,
|
529
|
+
1,
|
530
|
+
1,
|
531
|
+
1,
|
532
|
+
1,
|
533
|
+
1,
|
534
|
+
1,
|
535
|
+
1,
|
536
|
+
1,
|
537
|
+
1,
|
538
|
+
1,
|
539
|
+
1,
|
540
|
+
1,
|
541
|
+
1,
|
542
|
+
0,
|
543
|
+
1,
|
544
|
+
1,
|
545
|
+
|
546
|
+
};
|
547
|
+
#endif
|
548
|
+
|
549
|
+
#ifdef USE_INSN_STACK_INCREASE
|
550
|
+
static int
|
551
|
+
insn_stack_increase(int depth, int insn, VALUE *opes)
|
552
|
+
{
|
553
|
+
switch(insn){
|
554
|
+
case BIN(nop):{
|
555
|
+
return depth + 0;
|
556
|
+
}
|
557
|
+
case BIN(getlocal):{
|
558
|
+
return depth + 1;
|
559
|
+
}
|
560
|
+
case BIN(setlocal):{
|
561
|
+
return depth + -1;
|
562
|
+
}
|
563
|
+
case BIN(getspecial):{
|
564
|
+
return depth + 1;
|
565
|
+
}
|
566
|
+
case BIN(setspecial):{
|
567
|
+
return depth + -1;
|
568
|
+
}
|
569
|
+
case BIN(getdynamic):{
|
570
|
+
return depth + 1;
|
571
|
+
}
|
572
|
+
case BIN(setdynamic):{
|
573
|
+
return depth + -1;
|
574
|
+
}
|
575
|
+
case BIN(getinstancevariable):{
|
576
|
+
return depth + 1;
|
577
|
+
}
|
578
|
+
case BIN(setinstancevariable):{
|
579
|
+
return depth + -1;
|
580
|
+
}
|
581
|
+
case BIN(getclassvariable):{
|
582
|
+
return depth + 1;
|
583
|
+
}
|
584
|
+
case BIN(setclassvariable):{
|
585
|
+
return depth + -1;
|
586
|
+
}
|
587
|
+
case BIN(getconstant):{
|
588
|
+
return depth + 0;
|
589
|
+
}
|
590
|
+
case BIN(setconstant):{
|
591
|
+
return depth + -2;
|
592
|
+
}
|
593
|
+
case BIN(getglobal):{
|
594
|
+
return depth + 1;
|
595
|
+
}
|
596
|
+
case BIN(setglobal):{
|
597
|
+
return depth + -1;
|
598
|
+
}
|
599
|
+
case BIN(putnil):{
|
600
|
+
return depth + 1;
|
601
|
+
}
|
602
|
+
case BIN(putself):{
|
603
|
+
return depth + 1;
|
604
|
+
}
|
605
|
+
case BIN(putobject):{
|
606
|
+
return depth + 1;
|
607
|
+
}
|
608
|
+
case BIN(putspecialobject):{
|
609
|
+
return depth + 1;
|
610
|
+
}
|
611
|
+
case BIN(putiseq):{
|
612
|
+
return depth + 1;
|
613
|
+
}
|
614
|
+
case BIN(putstring):{
|
615
|
+
return depth + 1;
|
616
|
+
}
|
617
|
+
case BIN(concatstrings):{
|
618
|
+
int inc = 0;
|
619
|
+
rb_num_t num = FIX2INT(opes[0]);
|
620
|
+
inc += 1 - num;;
|
621
|
+
return depth + inc;
|
622
|
+
}
|
623
|
+
case BIN(tostring):{
|
624
|
+
return depth + 0;
|
625
|
+
}
|
626
|
+
case BIN(toregexp):{
|
627
|
+
int inc = 0;
|
628
|
+
rb_num_t cnt = FIX2INT(opes[1]);
|
629
|
+
inc += 1 - cnt;;
|
630
|
+
return depth + inc;
|
631
|
+
}
|
632
|
+
case BIN(newarray):{
|
633
|
+
int inc = 0;
|
634
|
+
rb_num_t num = FIX2INT(opes[0]);
|
635
|
+
inc += 1 - num;;
|
636
|
+
return depth + inc;
|
637
|
+
}
|
638
|
+
case BIN(duparray):{
|
639
|
+
return depth + 1;
|
640
|
+
}
|
641
|
+
case BIN(expandarray):{
|
642
|
+
int inc = 0;
|
643
|
+
rb_num_t num = FIX2INT(opes[0]);
|
644
|
+
rb_num_t flag = FIX2INT(opes[1]);
|
645
|
+
inc += num - 1 + (flag & 1 ? 1 : 0);;
|
646
|
+
return depth + inc;
|
647
|
+
}
|
648
|
+
case BIN(concatarray):{
|
649
|
+
return depth + -1;
|
650
|
+
}
|
651
|
+
case BIN(splatarray):{
|
652
|
+
return depth + 0;
|
653
|
+
}
|
654
|
+
case BIN(checkincludearray):{
|
655
|
+
return depth + 0;
|
656
|
+
}
|
657
|
+
case BIN(newhash):{
|
658
|
+
int inc = 0;
|
659
|
+
rb_num_t num = FIX2INT(opes[0]);
|
660
|
+
inc += 1 - num;;
|
661
|
+
return depth + inc;
|
662
|
+
}
|
663
|
+
case BIN(newrange):{
|
664
|
+
return depth + -1;
|
665
|
+
}
|
666
|
+
case BIN(pop):{
|
667
|
+
return depth + -1;
|
668
|
+
}
|
669
|
+
case BIN(dup):{
|
670
|
+
return depth + 1;
|
671
|
+
}
|
672
|
+
case BIN(dupn):{
|
673
|
+
int inc = 0;
|
674
|
+
rb_num_t n = FIX2INT(opes[0]);
|
675
|
+
inc += n;;
|
676
|
+
return depth + inc;
|
677
|
+
}
|
678
|
+
case BIN(swap):{
|
679
|
+
return depth + 0;
|
680
|
+
}
|
681
|
+
case BIN(reput):{
|
682
|
+
int inc = 0;
|
683
|
+
inc += 0;;
|
684
|
+
return depth + inc;
|
685
|
+
}
|
686
|
+
case BIN(topn):{
|
687
|
+
int inc = 0;
|
688
|
+
inc += 1;;
|
689
|
+
return depth + inc;
|
690
|
+
}
|
691
|
+
case BIN(setn):{
|
692
|
+
int inc = 0;
|
693
|
+
inc += 0;
|
694
|
+
return depth + inc;
|
695
|
+
}
|
696
|
+
case BIN(adjuststack):{
|
697
|
+
int inc = 0;
|
698
|
+
rb_num_t n = FIX2INT(opes[0]);
|
699
|
+
inc -= n;
|
700
|
+
return depth + inc;
|
701
|
+
}
|
702
|
+
case BIN(defined):{
|
703
|
+
return depth + 0;
|
704
|
+
}
|
705
|
+
case BIN(trace):{
|
706
|
+
return depth + 0;
|
707
|
+
}
|
708
|
+
case BIN(defineclass):{
|
709
|
+
return depth + -1;
|
710
|
+
}
|
711
|
+
case BIN(send):{
|
712
|
+
int inc = 0;
|
713
|
+
rb_num_t op_argc = FIX2INT(opes[1]);
|
714
|
+
rb_num_t op_flag = FIX2INT(opes[3]);
|
715
|
+
inc += - (op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));;
|
716
|
+
return depth + inc;
|
717
|
+
}
|
718
|
+
case BIN(invokesuper):{
|
719
|
+
int inc = 0;
|
720
|
+
rb_num_t op_argc = FIX2INT(opes[0]);
|
721
|
+
rb_num_t op_flag = FIX2INT(opes[2]);
|
722
|
+
inc += - (op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));;
|
723
|
+
return depth + inc;
|
724
|
+
}
|
725
|
+
case BIN(invokeblock):{
|
726
|
+
int inc = 0;
|
727
|
+
rb_num_t num = FIX2INT(opes[0]);
|
728
|
+
inc += 1 - num;;
|
729
|
+
return depth + inc;
|
730
|
+
}
|
731
|
+
case BIN(leave):{
|
732
|
+
return depth + 0;
|
733
|
+
}
|
734
|
+
case BIN(finish):{
|
735
|
+
return depth + 0;
|
736
|
+
}
|
737
|
+
case BIN(throw):{
|
738
|
+
return depth + 0;
|
739
|
+
}
|
740
|
+
case BIN(jump):{
|
741
|
+
return depth + 0;
|
742
|
+
}
|
743
|
+
case BIN(branchif):{
|
744
|
+
return depth + -1;
|
745
|
+
}
|
746
|
+
case BIN(branchunless):{
|
747
|
+
return depth + -1;
|
748
|
+
}
|
749
|
+
case BIN(getinlinecache):{
|
750
|
+
return depth + 1;
|
751
|
+
}
|
752
|
+
case BIN(onceinlinecache):{
|
753
|
+
return depth + 1;
|
754
|
+
}
|
755
|
+
case BIN(setinlinecache):{
|
756
|
+
return depth + 0;
|
757
|
+
}
|
758
|
+
case BIN(opt_case_dispatch):{
|
759
|
+
int inc = 0;
|
760
|
+
inc += -1;;
|
761
|
+
return depth + inc;
|
762
|
+
}
|
763
|
+
case BIN(opt_checkenv):{
|
764
|
+
return depth + 0;
|
765
|
+
}
|
766
|
+
case BIN(opt_plus):{
|
767
|
+
return depth + -1;
|
768
|
+
}
|
769
|
+
case BIN(opt_minus):{
|
770
|
+
return depth + -1;
|
771
|
+
}
|
772
|
+
case BIN(opt_mult):{
|
773
|
+
return depth + -1;
|
774
|
+
}
|
775
|
+
case BIN(opt_div):{
|
776
|
+
return depth + -1;
|
777
|
+
}
|
778
|
+
case BIN(opt_mod):{
|
779
|
+
return depth + -1;
|
780
|
+
}
|
781
|
+
case BIN(opt_eq):{
|
782
|
+
return depth + -1;
|
783
|
+
}
|
784
|
+
case BIN(opt_neq):{
|
785
|
+
return depth + -1;
|
786
|
+
}
|
787
|
+
case BIN(opt_lt):{
|
788
|
+
return depth + -1;
|
789
|
+
}
|
790
|
+
case BIN(opt_le):{
|
791
|
+
return depth + -1;
|
792
|
+
}
|
793
|
+
case BIN(opt_gt):{
|
794
|
+
return depth + -1;
|
795
|
+
}
|
796
|
+
case BIN(opt_ge):{
|
797
|
+
return depth + -1;
|
798
|
+
}
|
799
|
+
case BIN(opt_ltlt):{
|
800
|
+
return depth + -1;
|
801
|
+
}
|
802
|
+
case BIN(opt_aref):{
|
803
|
+
return depth + -1;
|
804
|
+
}
|
805
|
+
case BIN(opt_aset):{
|
806
|
+
return depth + -2;
|
807
|
+
}
|
808
|
+
case BIN(opt_length):{
|
809
|
+
return depth + 0;
|
810
|
+
}
|
811
|
+
case BIN(opt_succ):{
|
812
|
+
return depth + 0;
|
813
|
+
}
|
814
|
+
case BIN(opt_not):{
|
815
|
+
return depth + 0;
|
816
|
+
}
|
817
|
+
case BIN(opt_regexpmatch1):{
|
818
|
+
return depth + 0;
|
819
|
+
}
|
820
|
+
case BIN(opt_regexpmatch2):{
|
821
|
+
return depth + -1;
|
822
|
+
}
|
823
|
+
case BIN(opt_call_c_function):{
|
824
|
+
return depth + 0;
|
825
|
+
}
|
826
|
+
case BIN(bitblt):{
|
827
|
+
return depth + 1;
|
828
|
+
}
|
829
|
+
case BIN(answer):{
|
830
|
+
return depth + 1;
|
831
|
+
}
|
832
|
+
|
833
|
+
default:
|
834
|
+
rb_bug("insn_sp_increase: unreachable");
|
835
|
+
}
|
836
|
+
return 0;
|
837
|
+
}
|
838
|
+
#endif
|
839
|
+
|
840
|
+
/* some utilities */
|
841
|
+
|
842
|
+
static int
|
843
|
+
insn_len(int insn)
|
844
|
+
{
|
845
|
+
return insn_len_info[insn];
|
846
|
+
}
|
847
|
+
|
848
|
+
static const char *
|
849
|
+
insn_name(int insn)
|
850
|
+
{
|
851
|
+
return insn_name_info[insn];
|
852
|
+
}
|
853
|
+
|
854
|
+
static const char *
|
855
|
+
insn_op_types(int insn)
|
856
|
+
{
|
857
|
+
return insn_operand_info[insn];
|
858
|
+
}
|
859
|
+
|
860
|
+
static int
|
861
|
+
insn_op_type(int insn, int pos)
|
862
|
+
{
|
863
|
+
int len = insn_len(insn) - 1;
|
864
|
+
if(pos < len){
|
865
|
+
return insn_operand_info[insn][pos];
|
866
|
+
}
|
867
|
+
else{
|
868
|
+
return 0;
|
869
|
+
}
|
870
|
+
}
|
871
|
+
|
872
|
+
#ifdef USE_INSN_RET_NUM
|
873
|
+
static int
|
874
|
+
insn_ret_num(int insn)
|
875
|
+
{
|
876
|
+
return insn_stack_push_num_info[insn];
|
877
|
+
}
|
878
|
+
#endif
|
879
|
+
void
|
880
|
+
make_compile_option(rb_compile_option_t *option, VALUE opt);
|
881
|
+
void
|
882
|
+
make_compile_option_value(rb_compile_option_t *option);
|
883
|
+
|
884
|
+
extern VALUE instruction_class[VM_INSTRUCTION_SIZE];
|
885
|
+
void define_instruction_subclasses(VALUE rb_cInstruction);
|
886
|
+
|
887
|
+
#endif
|
888
|
+
|
889
|
+
#endif
|
890
|
+
|