ruby-internal 0.7.2 → 0.7.3
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/bin/ruby-internal-node-dump +1 -1
- data/bin/ruby-internal-obfuscate +1 -1
- data/ext/internal/method/extconf.rb +4 -0
- data/ext/internal/method/internal_method.h +65 -0
- data/ext/internal/method/{method.h.rpp → internal_method.h.rpp} +21 -0
- data/ext/internal/method/method.c +69 -13
- data/ext/internal/module/classpath.c +12 -14
- data/ext/internal/module/extconf.rb +3 -2
- data/ext/internal/module/module.c +36 -15
- data/ext/internal/node/block.h.rpp +1 -0
- data/ext/internal/node/extconf.rb +0 -22
- data/ext/internal/node/global_entry.h +45 -3
- data/ext/internal/node/global_entry.h.rpp +12 -3
- data/ext/internal/node/node.c +42 -15
- data/ext/internal/node/node_type_descrip.c +16 -20
- data/ext/internal/node/node_type_descrip.c.rpp +1 -0
- data/ext/internal/node/nodeinfo.c +133 -281
- data/ext/internal/node/nodeinfo.c.rpp +8 -4
- data/ext/internal/node/nodeinfo.h.rpp +2 -1
- data/ext/internal/noex/noex.c +4 -0
- data/ext/internal/proc/proc.c +2 -2
- data/ext/internal/vm/constants/constants.c +2 -0
- data/ext/internal/vm/constants/extconf.rb +2 -0
- data/ext/internal/vm/control_frame/control_frame.c +21 -3
- data/ext/internal/vm/control_frame/extconf.rb +4 -0
- data/ext/internal/vm/inline_cache/inline_cache.c +12 -5
- data/ext/internal/vm/instruction/insns_info.c +141 -64
- data/ext/internal/vm/instruction/insns_info.c.rpp +3 -0
- data/ext/internal/vm/instruction/insns_info.h +80 -71
- data/ext/internal/vm/iseq/iseq.c +6 -6
- data/ext/internal/vm/iseq/iseq_load.inc.rpp +6 -3
- data/ext/mkmf-ruby-internal.rb +21 -1
- data/ext/ruby_source_dir.rb +6 -2
- data/post-setup.rb +1 -0
- data/pre-config.rb +9 -0
- data/run_tests.rb +1 -0
- data/test/test_method.rb +1 -1
- data/test/test_module.rb +1 -1
- metadata +309 -321
- data/ext/internal/method/method.h +0 -20
- data/ext/internal/yarv-headers/debug.h +0 -36
- data/ext/internal/yarv-headers/dln.h +0 -41
- data/ext/internal/yarv-headers/encdb.h +0 -147
- data/ext/internal/yarv-headers/eval_intern.h +0 -215
- data/ext/internal/yarv-headers/gc.h +0 -75
- data/ext/internal/yarv-headers/id.h +0 -163
- data/ext/internal/yarv-headers/iseq.h +0 -103
- data/ext/internal/yarv-headers/node.h +0 -516
- data/ext/internal/yarv-headers/parse.h +0 -188
- data/ext/internal/yarv-headers/regenc.h +0 -207
- data/ext/internal/yarv-headers/regint.h +0 -842
- data/ext/internal/yarv-headers/regparse.h +0 -351
- data/ext/internal/yarv-headers/revision.h +0 -1
- data/ext/internal/yarv-headers/thread_pthread.h +0 -24
- data/ext/internal/yarv-headers/thread_win32.h +0 -33
- data/ext/internal/yarv-headers/transcode_data.h +0 -106
- data/ext/internal/yarv-headers/transdb.h +0 -147
- data/ext/internal/yarv-headers/version.h +0 -54
- data/ext/internal/yarv-headers/vm_core.h +0 -646
- data/ext/internal/yarv-headers/vm_exec.h +0 -184
- data/ext/internal/yarv-headers/vm_insnhelper.h +0 -195
- data/ext/internal/yarv-headers/vm_opts.h +0 -51
- data/ext/rubypp.rb +0 -97
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
/** -*-c-*-
|
15
15
|
This file contains YARV instructions list.
|
16
|
-
|
16
|
+
|
17
17
|
----
|
18
18
|
This file is auto generated by insns2vm.rb
|
19
19
|
DO NOT TOUCH!
|
@@ -171,30 +171,32 @@ enum ruby_vminsn_type {
|
|
171
171
|
|
172
172
|
BIN(opt_length) = 71,
|
173
173
|
|
174
|
-
BIN(
|
174
|
+
BIN(opt_size) = 72,
|
175
|
+
|
176
|
+
BIN(opt_succ) = 73,
|
175
177
|
|
176
|
-
BIN(opt_not) =
|
178
|
+
BIN(opt_not) = 74,
|
177
179
|
|
178
|
-
BIN(opt_regexpmatch1) =
|
180
|
+
BIN(opt_regexpmatch1) = 75,
|
179
181
|
|
180
|
-
BIN(opt_regexpmatch2) =
|
182
|
+
BIN(opt_regexpmatch2) = 76,
|
181
183
|
|
182
|
-
BIN(opt_call_c_function) =
|
184
|
+
BIN(opt_call_c_function) = 77,
|
183
185
|
|
184
|
-
BIN(bitblt) =
|
186
|
+
BIN(bitblt) = 78,
|
185
187
|
|
186
|
-
BIN(answer) =
|
188
|
+
BIN(answer) = 79,
|
187
189
|
|
188
|
-
VM_INSTRUCTION_SIZE =
|
190
|
+
VM_INSTRUCTION_SIZE = 80
|
189
191
|
};
|
190
192
|
|
191
193
|
/** -*-c-*-
|
192
194
|
This file contains instruction information for yarv instruction sequence.
|
193
|
-
|
195
|
+
|
194
196
|
----
|
195
197
|
This file is auto generated by insns2vm.rb
|
196
198
|
DO NOT TOUCH!
|
197
|
-
|
199
|
+
|
198
200
|
If you want to fix something, you must edit 'template/insns_info.inc.tmpl'
|
199
201
|
or insns2vm.rb
|
200
202
|
*/
|
@@ -285,6 +287,7 @@ static const char *const insn_name_info[] = {
|
|
285
287
|
"opt_aref",
|
286
288
|
"opt_aset",
|
287
289
|
"opt_length",
|
290
|
+
"opt_size",
|
288
291
|
"opt_succ",
|
289
292
|
"opt_not",
|
290
293
|
"opt_regexpmatch1",
|
@@ -303,8 +306,8 @@ static const char *const insn_operand_info[] = {
|
|
303
306
|
"V",
|
304
307
|
"DN",
|
305
308
|
"DN",
|
306
|
-
"
|
307
|
-
"
|
309
|
+
"IC",
|
310
|
+
"IC",
|
308
311
|
"I",
|
309
312
|
"I",
|
310
313
|
"I",
|
@@ -348,27 +351,28 @@ static const char *const insn_operand_info[] = {
|
|
348
351
|
"O",
|
349
352
|
"O",
|
350
353
|
"O",
|
351
|
-
"
|
352
|
-
"
|
353
|
-
"
|
354
|
+
"OC",
|
355
|
+
"OC",
|
356
|
+
"C",
|
354
357
|
"HO",
|
355
358
|
"",
|
356
|
-
"",
|
357
|
-
"",
|
358
|
-
"",
|
359
|
-
"",
|
360
|
-
"",
|
359
|
+
"C",
|
360
|
+
"C",
|
361
|
+
"C",
|
362
|
+
"C",
|
363
|
+
"C",
|
361
364
|
"C",
|
362
365
|
"CC",
|
363
|
-
"",
|
364
|
-
"",
|
365
|
-
"",
|
366
|
-
"",
|
367
|
-
"",
|
368
|
-
"",
|
369
|
-
"",
|
370
|
-
"",
|
371
|
-
"",
|
366
|
+
"C",
|
367
|
+
"C",
|
368
|
+
"C",
|
369
|
+
"C",
|
370
|
+
"C",
|
371
|
+
"C",
|
372
|
+
"C",
|
373
|
+
"C",
|
374
|
+
"C",
|
375
|
+
"C",
|
372
376
|
"C",
|
373
377
|
"V",
|
374
378
|
"",
|
@@ -386,8 +390,8 @@ static const int insn_len_info[] = {
|
|
386
390
|
2,
|
387
391
|
3,
|
388
392
|
3,
|
389
|
-
|
390
|
-
|
393
|
+
3,
|
394
|
+
3,
|
391
395
|
2,
|
392
396
|
2,
|
393
397
|
2,
|
@@ -436,22 +440,23 @@ static const int insn_len_info[] = {
|
|
436
440
|
2,
|
437
441
|
3,
|
438
442
|
1,
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
443
|
+
2,
|
444
|
+
2,
|
445
|
+
2,
|
446
|
+
2,
|
447
|
+
2,
|
444
448
|
2,
|
445
449
|
3,
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
450
|
+
2,
|
451
|
+
2,
|
452
|
+
2,
|
453
|
+
2,
|
454
|
+
2,
|
455
|
+
2,
|
456
|
+
2,
|
457
|
+
2,
|
458
|
+
2,
|
459
|
+
2,
|
455
460
|
2,
|
456
461
|
2,
|
457
462
|
1,
|
@@ -539,6 +544,7 @@ static const int insn_stack_push_num_info[] = {
|
|
539
544
|
1,
|
540
545
|
1,
|
541
546
|
1,
|
547
|
+
1,
|
542
548
|
0,
|
543
549
|
1,
|
544
550
|
1,
|
@@ -616,7 +622,7 @@ insn_stack_increase(int depth, int insn, VALUE *opes)
|
|
616
622
|
}
|
617
623
|
case BIN(concatstrings):{
|
618
624
|
int inc = 0;
|
619
|
-
|
625
|
+
int num = FIX2INT(opes[0]);
|
620
626
|
inc += 1 - num;;
|
621
627
|
return depth + inc;
|
622
628
|
}
|
@@ -625,13 +631,13 @@ insn_stack_increase(int depth, int insn, VALUE *opes)
|
|
625
631
|
}
|
626
632
|
case BIN(toregexp):{
|
627
633
|
int inc = 0;
|
628
|
-
|
634
|
+
int cnt = FIX2INT(opes[1]);
|
629
635
|
inc += 1 - cnt;;
|
630
636
|
return depth + inc;
|
631
637
|
}
|
632
638
|
case BIN(newarray):{
|
633
639
|
int inc = 0;
|
634
|
-
|
640
|
+
int num = FIX2INT(opes[0]);
|
635
641
|
inc += 1 - num;;
|
636
642
|
return depth + inc;
|
637
643
|
}
|
@@ -640,8 +646,8 @@ insn_stack_increase(int depth, int insn, VALUE *opes)
|
|
640
646
|
}
|
641
647
|
case BIN(expandarray):{
|
642
648
|
int inc = 0;
|
643
|
-
|
644
|
-
|
649
|
+
int num = FIX2INT(opes[0]);
|
650
|
+
int flag = FIX2INT(opes[1]);
|
645
651
|
inc += num - 1 + (flag & 1 ? 1 : 0);;
|
646
652
|
return depth + inc;
|
647
653
|
}
|
@@ -656,7 +662,7 @@ insn_stack_increase(int depth, int insn, VALUE *opes)
|
|
656
662
|
}
|
657
663
|
case BIN(newhash):{
|
658
664
|
int inc = 0;
|
659
|
-
|
665
|
+
int num = FIX2INT(opes[0]);
|
660
666
|
inc += 1 - num;;
|
661
667
|
return depth + inc;
|
662
668
|
}
|
@@ -671,7 +677,7 @@ insn_stack_increase(int depth, int insn, VALUE *opes)
|
|
671
677
|
}
|
672
678
|
case BIN(dupn):{
|
673
679
|
int inc = 0;
|
674
|
-
|
680
|
+
int n = FIX2INT(opes[0]);
|
675
681
|
inc += n;;
|
676
682
|
return depth + inc;
|
677
683
|
}
|
@@ -695,7 +701,7 @@ insn_stack_increase(int depth, int insn, VALUE *opes)
|
|
695
701
|
}
|
696
702
|
case BIN(adjuststack):{
|
697
703
|
int inc = 0;
|
698
|
-
|
704
|
+
int n = FIX2INT(opes[0]);
|
699
705
|
inc -= n;
|
700
706
|
return depth + inc;
|
701
707
|
}
|
@@ -710,21 +716,21 @@ insn_stack_increase(int depth, int insn, VALUE *opes)
|
|
710
716
|
}
|
711
717
|
case BIN(send):{
|
712
718
|
int inc = 0;
|
713
|
-
|
714
|
-
|
715
|
-
inc += - (op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));;
|
719
|
+
int op_argc = FIX2INT(opes[1]);
|
720
|
+
int op_flag = FIX2INT(opes[3]);
|
721
|
+
inc += - (int)(op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));;
|
716
722
|
return depth + inc;
|
717
723
|
}
|
718
724
|
case BIN(invokesuper):{
|
719
725
|
int inc = 0;
|
720
|
-
|
721
|
-
|
722
|
-
inc += - (op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));;
|
726
|
+
int op_argc = FIX2INT(opes[0]);
|
727
|
+
int op_flag = FIX2INT(opes[2]);
|
728
|
+
inc += - (int)(op_argc + ((op_flag & VM_CALL_ARGS_BLOCKARG_BIT) ? 1 : 0));;
|
723
729
|
return depth + inc;
|
724
730
|
}
|
725
731
|
case BIN(invokeblock):{
|
726
732
|
int inc = 0;
|
727
|
-
|
733
|
+
int num = FIX2INT(opes[0]);
|
728
734
|
inc += 1 - num;;
|
729
735
|
return depth + inc;
|
730
736
|
}
|
@@ -808,6 +814,9 @@ insn_stack_increase(int depth, int insn, VALUE *opes)
|
|
808
814
|
case BIN(opt_length):{
|
809
815
|
return depth + 0;
|
810
816
|
}
|
817
|
+
case BIN(opt_size):{
|
818
|
+
return depth + 0;
|
819
|
+
}
|
811
820
|
case BIN(opt_succ):{
|
812
821
|
return depth + 0;
|
813
822
|
}
|
@@ -840,29 +849,29 @@ insn_stack_increase(int depth, int insn, VALUE *opes)
|
|
840
849
|
/* some utilities */
|
841
850
|
|
842
851
|
static int
|
843
|
-
insn_len(
|
852
|
+
insn_len(VALUE insn)
|
844
853
|
{
|
845
|
-
return insn_len_info[insn];
|
854
|
+
return insn_len_info[(int)insn];
|
846
855
|
}
|
847
856
|
|
848
857
|
static const char *
|
849
|
-
insn_name(
|
858
|
+
insn_name(VALUE insn)
|
850
859
|
{
|
851
|
-
return insn_name_info[insn];
|
860
|
+
return insn_name_info[(int)insn];
|
852
861
|
}
|
853
862
|
|
854
863
|
static const char *
|
855
|
-
insn_op_types(
|
864
|
+
insn_op_types(VALUE insn)
|
856
865
|
{
|
857
|
-
return insn_operand_info[insn];
|
866
|
+
return insn_operand_info[(int)insn];
|
858
867
|
}
|
859
868
|
|
860
869
|
static int
|
861
|
-
insn_op_type(
|
870
|
+
insn_op_type(VALUE insn, long pos)
|
862
871
|
{
|
863
872
|
int len = insn_len(insn) - 1;
|
864
873
|
if(pos < len){
|
865
|
-
return insn_operand_info[insn][pos];
|
874
|
+
return insn_operand_info[(int)insn][pos];
|
866
875
|
}
|
867
876
|
else{
|
868
877
|
return 0;
|
@@ -871,9 +880,9 @@ insn_op_type(int insn, int pos)
|
|
871
880
|
|
872
881
|
#ifdef USE_INSN_RET_NUM
|
873
882
|
static int
|
874
|
-
insn_ret_num(
|
883
|
+
insn_ret_num(VALUE insn)
|
875
884
|
{
|
876
|
-
return insn_stack_push_num_info[insn];
|
885
|
+
return insn_stack_push_num_info[(int)insn];
|
877
886
|
}
|
878
887
|
#endif
|
879
888
|
void
|
data/ext/internal/vm/iseq/iseq.c
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
#include "insns_info.inc"
|
3
3
|
|
4
4
|
#include "internal/node/ruby_internal_node.h"
|
5
|
+
#include "internal/node/global_entry.h"
|
5
6
|
#include "internal/module/module.h"
|
6
7
|
#include "internal/vm/instruction/instruction.h"
|
7
8
|
|
@@ -247,9 +248,12 @@ static VALUE operand_to_value(VALUE insn, int op_idx, VALUE operand)
|
|
247
248
|
|
248
249
|
case TS_LINDEX:
|
249
250
|
case TS_DINDEX:
|
250
|
-
case
|
251
|
+
case TS_OFFSET:
|
251
252
|
return INT2FIX(operand);
|
252
253
|
|
254
|
+
case TS_NUM:
|
255
|
+
return UINT2NUM(operand);
|
256
|
+
|
253
257
|
case TS_ISEQ:
|
254
258
|
{
|
255
259
|
rb_iseq_t * iseq = (rb_iseq_t *)operand;
|
@@ -269,10 +273,6 @@ static VALUE operand_to_value(VALUE insn, int op_idx, VALUE operand)
|
|
269
273
|
return ID2SYM(rb_intern(rb_id2name(entry->id)));
|
270
274
|
}
|
271
275
|
|
272
|
-
case TS_OFFSET:
|
273
|
-
/* TODO */
|
274
|
-
return Qnil;
|
275
|
-
|
276
276
|
case TS_VARIABLE:
|
277
277
|
/* TODO */
|
278
278
|
return Qnil;
|
@@ -549,7 +549,7 @@ void Init_iseq(void)
|
|
549
549
|
"end",
|
550
550
|
"cont",
|
551
551
|
"sp",
|
552
|
-
0);
|
552
|
+
(void *)0);
|
553
553
|
rb_const_set(rb_cISeq, rb_intern("CatchTableEntry"), rb_cCatchTableEntry);
|
554
554
|
|
555
555
|
rb_const_set(rb_cISeq, rb_intern("CATCH_TYPE_RESCUE"), CATCH_TYPE_RESCUE);
|
@@ -1,8 +1,9 @@
|
|
1
1
|
#ifndef ruby_internal_iseq_load__inc_
|
2
2
|
#define ruby_internal_iseq_load__inc_
|
3
3
|
|
4
|
-
#include "
|
5
|
-
#include "
|
4
|
+
#include "gc.h"
|
5
|
+
#include "iseq.h"
|
6
|
+
#include "vm_core.h"
|
6
7
|
|
7
8
|
#ruby <<END
|
8
9
|
ruby_version_code = RUBY_VERSION.gsub(/\./, '').to_i
|
@@ -19,9 +20,11 @@
|
|
19
20
|
File.open(iseq_c_location) do |input|
|
20
21
|
input.each_line do |line|
|
21
22
|
case line
|
22
|
-
when /^(iseq_load|iseq_alloc|iseq_mark|iseq_free|compile_data_free|make_compile_option|make_compile_option_value|prepare_iseq_build|cleanup_iseq_build|set_relation)/
|
23
|
+
when /^(iseq_load|iseq_alloc|iseq_mark|iseq_free|compile_data_free|make_compile_option|make_compile_option_value|prepare_iseq_build|cleanup_iseq_build|set_relation|iseq_memsize)/
|
23
24
|
write = true
|
24
25
|
puts prev_line
|
26
|
+
when /^static.*iseq_data_type.*=/
|
27
|
+
write = true
|
25
28
|
when /^static.*COMPILE_OPTION_DEFAULT.*=/
|
26
29
|
write = true
|
27
30
|
when /^static.*COMPILE_OPTION_FALSE.*=/
|
data/ext/mkmf-ruby-internal.rb
CHANGED
@@ -73,7 +73,7 @@ END
|
|
73
73
|
dest_file = rpp_file.sub(/\.rpp$/, '')
|
74
74
|
append_to_makefile << <<END
|
75
75
|
#{dest_file}: #{rpp_file} #{rb_files.join(' ')}
|
76
|
-
\
|
76
|
+
\trubypp #{rpp_file} #{dest_file}
|
77
77
|
END
|
78
78
|
end
|
79
79
|
|
@@ -109,3 +109,23 @@ if ruby_version_code >= 190 then
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
+
module Kernel
|
113
|
+
if not method_defined?(:try_const)
|
114
|
+
alias_method :try_const, :try_constant
|
115
|
+
end
|
116
|
+
|
117
|
+
if not method_defined?(:checking_message)
|
118
|
+
def checking_message(checking_for, headers = nil, opt = "")
|
119
|
+
return checking_for
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
if not method_defined?(:have_const)
|
124
|
+
def have_const(const, headers = nil, opt = "", &b)
|
125
|
+
checking_for checking_message([*const].compact.join(' '), headers, opt) do
|
126
|
+
try_const(const, headers, opt, &b)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
data/ext/ruby_source_dir.rb
CHANGED
@@ -2,9 +2,13 @@ wd = Dir.pwd()
|
|
2
2
|
metaconfig_dir = File.join(File.dirname(__FILE__), '..')
|
3
3
|
Dir.chdir metaconfig_dir
|
4
4
|
begin
|
5
|
-
|
5
|
+
$: << '.' # TODO: hack
|
6
|
+
require 'setup'
|
6
7
|
require 'rbconfig'
|
7
|
-
|
8
|
+
if not defined?(RbConfig) then
|
9
|
+
RbConfig = Config
|
10
|
+
end
|
11
|
+
config = ConfigTable.new(RbConfig::CONFIG)
|
8
12
|
config.load_standard_entries
|
9
13
|
config.load_script 'metaconfig'
|
10
14
|
config.load_savefile
|
data/post-setup.rb
CHANGED