rdx 0.9.0.pre
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.
- checksums.yaml +7 -0
- data/.rdx +20 -0
- data/README +19 -0
- data/bin/rdx +7 -0
- data/examples/minimal/.rdx +8 -0
- data/examples/minimal/README +10 -0
- data/examples/minimal/lib/other_conventions.rb +64 -0
- data/examples/minimal/lib/the_basics.rb +94 -0
- data/examples/minimal/lib/using_directives.rb +66 -0
- data/examples/minimal/rakefile +27 -0
- data/examples/ruby-2.0.0-p0/README +7 -0
- data/examples/ruby-2.0.0-p0/install/core/.rdx +6 -0
- data/examples/ruby-2.0.0-p0/install/core/README +19 -0
- data/examples/ruby-2.0.0-p0/install/core/Rakefile +61 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/array.c.diff +166 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/bignum.c.diff +11 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/class.c.diff +36 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/compar.c.diff +11 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/complex.c.diff +301 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/cont.c.diff +65 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/dir.c.diff +147 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/re.rdoc.diff +328 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/security.rdoc.diff +8 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/standard_library.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/assignment.rdoc.diff +160 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/calling_methods.rdoc.diff +130 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/control_expressions.rdoc.diff +254 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/exceptions.rdoc.diff +0 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/literals.rdoc.diff +54 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/methods.rdoc.diff +157 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/miscellaneous.rdoc.diff +91 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/modules_and_classes.rdoc.diff +161 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/precedence.rdoc.diff +8 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/doc/syntax/refinements.rdoc.diff +146 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/encoding.c.diff +276 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/enum.c.diff +281 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/enumerator.c.diff +479 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/error.c.diff +143 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/eval.c.diff +47 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/eval_jump.c.diff +23 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/file.c.diff +752 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/gc.c.diff +195 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/hash.c.diff +84 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/iseq.c.diff +354 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/load.c.diff +53 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/marshal.c.diff +98 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/math.c.diff +110 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/numeric.c.diff +103 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/object.c.diff +295 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/pack.c.diff +18 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/parse.y.diff +23 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/proc.c.diff +155 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/random.c.diff +126 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/range.c.diff +49 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/rational.c.diff +312 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/re.c.diff +207 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/ruby.c.diff +21 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/signal.c.diff +67 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/sprintf.c.diff +29 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/string.c.diff +73 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/struct.c.diff +20 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/time.c.diff +691 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/transcode.c.diff +435 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/variable.c.diff +62 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_backtrace.c.diff +164 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_eval.c.diff +99 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_method.c.diff +17 -0
- data/examples/ruby-2.0.0-p0/install/core/diffs/vm_trace.c.diff +393 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/.rdx +6 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/README +19 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/Rakefile +53 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/abbrev.rb.diff +77 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/base64.rb.diff +42 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/benchmark.rb.diff +144 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/cmath.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/forwardable.rb.diff +150 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/mathn.rb.diff +58 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/matrix.rb.diff +657 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/observer.rb.diff +31 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/optparse.rb.diff +147 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/ostruct.rb.diff +78 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/prime.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/pstore.rb.diff +110 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/scanf.rb.diff +100 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/securerandom.rb.diff +144 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/set.rb.diff +637 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/shellwords.rb.diff +66 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/singleton.rb.diff +37 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/tempfile.rb.diff +104 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/thread.rb.diff +38 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/time.rb.diff +140 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/tmpdir.rb.diff +52 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri.rb.diff +39 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/uri/common.rb.diff +237 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/weakref.rb.diff +36 -0
- data/examples/ruby-2.0.0-p0/install/stdlib/diffs/lib/yaml/store.rb.diff +27 -0
- data/examples/ruby-2.0.0-p0/rakefile +165 -0
- data/lib/rdx.rb +331 -0
- data/lib/rdx/assertions.rb +484 -0
- data/lib/rdx/binding.rb +151 -0
- data/lib/rdx/code_object.rb +598 -0
- data/lib/rdx/comment.rb +338 -0
- data/lib/rdx/convention.rb +1174 -0
- data/lib/rdx/directive.rb +1432 -0
- data/lib/rdx/example.rb +679 -0
- data/lib/rdx/generator.rb +112 -0
- data/lib/rdx/generator/rdoc.rb +1006 -0
- data/lib/rdx/options.rb +359 -0
- data/lib/rdx/plain_text.rb +65 -0
- data/lib/rdx/reporter.rb +421 -0
- data/lib/rdx/ruby_lex.rb +324 -0
- data/lib/rdx/runner.rb +309 -0
- data/lib/rdx/source_file.rb +94 -0
- data/lib/rdx/specification.rb +194 -0
- data/lib/rdx/statement.rb +248 -0
- data/lib/rdx/store.rb +119 -0
- data/lib/rdx/task.rb +361 -0
- data/lib/rdx/text.rb +688 -0
- data/lib/rdx/version.rb +15 -0
- data/rakefile +64 -0
- metadata +203 -0
@@ -0,0 +1,195 @@
|
|
1
|
+
--- core/orig/gc.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/gc.c 2015-06-28 10:29:22 +0000
|
3
|
+
@@ -1221,10 +1221,12 @@
|
4
|
+
* a = 102.7
|
5
|
+
* b = 95 # Won't be returned
|
6
|
+
* c = 12345678987654321
|
7
|
+
+ * ObjectSpace.each_object(Fixnum).to_a #=> []
|
8
|
+
* count = ObjectSpace.each_object(Numeric) {|x| p x }
|
9
|
+
* puts "Total count: #{count}"
|
10
|
+
*
|
11
|
+
- * <em>produces:</em>
|
12
|
+
+ * <em>produces something like:</em>
|
13
|
+
+ * :rdx: indicative_output
|
14
|
+
*
|
15
|
+
* 12345678987654321
|
16
|
+
* 102.7
|
17
|
+
@@ -1608,7 +1610,7 @@
|
18
|
+
*
|
19
|
+
* s = "I am a string" #=> "I am a string"
|
20
|
+
* r = ObjectSpace._id2ref(s.object_id) #=> "I am a string"
|
21
|
+
- * r == s #=> true
|
22
|
+
+ * r.equal?(s) #=> true
|
23
|
+
*
|
24
|
+
*/
|
25
|
+
|
26
|
+
@@ -1748,13 +1750,14 @@
|
27
|
+
* Counts objects for each type.
|
28
|
+
*
|
29
|
+
* It returns a hash, such as:
|
30
|
+
- * {
|
31
|
+
- * :TOTAL=>10000,
|
32
|
+
- * :FREE=>3011,
|
33
|
+
- * :T_OBJECT=>6,
|
34
|
+
- * :T_CLASS=>404,
|
35
|
+
- * # ...
|
36
|
+
- * }
|
37
|
+
+ * :rdx: off -
|
38
|
+
+ * {
|
39
|
+
+ * :TOTAL=>10000,
|
40
|
+
+ * :FREE=>3011,
|
41
|
+
+ * :T_OBJECT=>6,
|
42
|
+
+ * :T_CLASS=>404,
|
43
|
+
+ * # ...
|
44
|
+
+ * }
|
45
|
+
*
|
46
|
+
* The contents of the returned hash are implementation specific.
|
47
|
+
* It may be changed in future.
|
48
|
+
@@ -3141,18 +3144,19 @@
|
49
|
+
* Returns a Hash containing information about the GC.
|
50
|
+
*
|
51
|
+
* The hash includes information about internal statistics about GC such as:
|
52
|
+
- *
|
53
|
+
- * {
|
54
|
+
- * :count=>0,
|
55
|
+
- * :heap_used=>12,
|
56
|
+
- * :heap_length=>12,
|
57
|
+
- * :heap_increment=>0,
|
58
|
+
- * :heap_live_num=>7539,
|
59
|
+
- * :heap_free_num=>88,
|
60
|
+
- * :heap_final_num=>0,
|
61
|
+
- * :total_allocated_object=>7630,
|
62
|
+
- * :total_freed_object=>88
|
63
|
+
- * }
|
64
|
+
+ *
|
65
|
+
+ * GC.stat
|
66
|
+
+ * # -> {
|
67
|
+
+ * # :count=>0,
|
68
|
+
+ * # :heap_used=>12,
|
69
|
+
+ * # :heap_length=>12,
|
70
|
+
+ * # :heap_increment=>0,
|
71
|
+
+ * # :heap_live_num=>7539,
|
72
|
+
+ * # :heap_free_num=>88,
|
73
|
+
+ * # :heap_final_num=>0,
|
74
|
+
+ * # :total_allocated_object=>7630,
|
75
|
+
+ * # :total_freed_object=>88
|
76
|
+
+ * # }
|
77
|
+
*
|
78
|
+
* The contents of the hash are implementation specific and may be changed in
|
79
|
+
* the future.
|
80
|
+
@@ -3249,7 +3253,7 @@
|
81
|
+
* Enables garbage collection, returning +true+ if garbage
|
82
|
+
* collection was previously disabled.
|
83
|
+
*
|
84
|
+
- * GC.disable #=> false
|
85
|
+
+ * GC.disable # now GC disabled
|
86
|
+
* GC.enable #=> true
|
87
|
+
* GC.enable #=> false
|
88
|
+
*
|
89
|
+
@@ -3272,9 +3276,12 @@
|
90
|
+
* Disables garbage collection, returning +true+ if garbage
|
91
|
+
* collection was already disabled.
|
92
|
+
*
|
93
|
+
+ * GC.enable # now GC enabled
|
94
|
+
* GC.disable #=> false
|
95
|
+
* GC.disable #=> true
|
96
|
+
- *
|
97
|
+
+ *-- rdx
|
98
|
+
+ * GC.enable
|
99
|
+
+ *++
|
100
|
+
*/
|
101
|
+
|
102
|
+
VALUE
|
103
|
+
@@ -4133,17 +4140,18 @@
|
104
|
+
*
|
105
|
+
* For example:
|
106
|
+
*
|
107
|
+
- * [
|
108
|
+
- * {
|
109
|
+
- * :GC_TIME=>1.3000000000000858e-05,
|
110
|
+
- * :GC_INVOKE_TIME=>0.010634999999999999,
|
111
|
+
- * :HEAP_USE_SIZE=>289640,
|
112
|
+
- * :HEAP_TOTAL_SIZE=>588960,
|
113
|
+
- * :HEAP_TOTAL_OBJECTS=>14724,
|
114
|
+
- * :GC_IS_MARKED=>false
|
115
|
+
- * },
|
116
|
+
- * # ...
|
117
|
+
- * ]
|
118
|
+
+ * GC::Profiler.raw_data
|
119
|
+
+ * # -> [
|
120
|
+
+ * # {
|
121
|
+
+ * # :GC_TIME=>1.3000000000000858e-05,
|
122
|
+
+ * # :GC_INVOKE_TIME=>0.010634999999999999,
|
123
|
+
+ * # :HEAP_USE_SIZE=>289640,
|
124
|
+
+ * # :HEAP_TOTAL_SIZE=>588960,
|
125
|
+
+ * # :HEAP_TOTAL_OBJECTS=>14724,
|
126
|
+
+ * # :GC_IS_MARKED=>false
|
127
|
+
+ * # },
|
128
|
+
+ * # # ...
|
129
|
+
+ * # ]
|
130
|
+
*
|
131
|
+
* The keys mean:
|
132
|
+
*
|
133
|
+
@@ -4254,9 +4262,14 @@
|
134
|
+
* call-seq:
|
135
|
+
* GC::Profiler.result -> String
|
136
|
+
*
|
137
|
+
- * Returns a profile data report such as:
|
138
|
+
- *
|
139
|
+
- * GC 1 invokes.
|
140
|
+
+ * Returns a profile data report, such as:
|
141
|
+
+ *
|
142
|
+
+ * puts GC::Profiler.result
|
143
|
+
+ *
|
144
|
+
+ * produces something like:
|
145
|
+
+ * :rdx: indicative_output
|
146
|
+
+ *
|
147
|
+
+ * GC 1 ivokes.
|
148
|
+
* Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC time(ms)
|
149
|
+
* 1 0.012 159240 212940 10647 0.00000000000001530000
|
150
|
+
*/
|
151
|
+
@@ -4419,22 +4432,28 @@
|
152
|
+
* ObjectSpace also provides support for object finalizers, procs that will be
|
153
|
+
* called when a specific object is about to be destroyed by garbage
|
154
|
+
* collection.
|
155
|
+
- *
|
156
|
+
+ *
|
157
|
+
+ * :rdx: bug on x64-mingw32 seems that the last object defined (c) isn't marked in this cycle...
|
158
|
+
+ * :rdx: indicative_numbers
|
159
|
+
* include ObjectSpace
|
160
|
+
*
|
161
|
+
* a = "A"
|
162
|
+
* b = "B"
|
163
|
+
* c = "C"
|
164
|
+
- *
|
165
|
+
+ *
|
166
|
+
* define_finalizer(a, proc {|id| puts "Finalizer one on #{id}" })
|
167
|
+
- * define_finalizer(a, proc {|id| puts "Finalizer two on #{id}" })
|
168
|
+
- * define_finalizer(b, proc {|id| puts "Finalizer three on #{id}" })
|
169
|
+
+ * define_finalizer(b, proc {|id| puts "Finalizer two on #{id}" })
|
170
|
+
+ * define_finalizer(c, proc {|id| puts "Finalizer three on #{id}" })
|
171
|
+
+ * a = b = c = nil; # Now those strings are no more referenced,
|
172
|
+
+ * # but still alive until the next GC cycle...
|
173
|
+
+ * GC.start # Garbage unreferenced objects now
|
174
|
+
*
|
175
|
+
- * _produces:_
|
176
|
+
+ * <em>produces (your numbers may vary):</em>
|
177
|
+
+ * :rdx: output
|
178
|
+
*
|
179
|
+
- * Finalizer three on 537763470
|
180
|
+
* Finalizer one on 537763480
|
181
|
+
- * Finalizer two on 537763480
|
182
|
+
+ * Finalizer two on 537763460
|
183
|
+
+ * Finalzer three on 537763440
|
184
|
+
*
|
185
|
+
*/
|
186
|
+
|
187
|
+
@@ -4455,6 +4474,8 @@
|
188
|
+
*
|
189
|
+
* Example:
|
190
|
+
*
|
191
|
+
+ * :rdx: discard_output
|
192
|
+
+ *
|
193
|
+
* GC::Profiler.enable
|
194
|
+
*
|
195
|
+
* require 'rdoc/rdoc'
|
@@ -0,0 +1,84 @@
|
|
1
|
+
--- core/orig/hash.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/hash.c 2015-06-19 16:15:53 +0000
|
3
|
+
@@ -604,13 +604,7 @@
|
4
|
+
* is not found and a default value is not supplied.
|
5
|
+
*
|
6
|
+
* h = { "a" => 100, "b" => 200 }
|
7
|
+
- * h.fetch("z")
|
8
|
+
- *
|
9
|
+
- * <em>produces:</em>
|
10
|
+
- *
|
11
|
+
- * prog.rb:2:in `fetch': key not found (KeyError)
|
12
|
+
- * from prog.rb:2
|
13
|
+
- *
|
14
|
+
+ * h.fetch("z") # raises KeyError: key not found: "z"
|
15
|
+
*/
|
16
|
+
|
17
|
+
static VALUE
|
18
|
+
@@ -690,6 +684,7 @@
|
19
|
+
* exist in the hash. It is not possible to set the default to a
|
20
|
+
* <code>Proc</code> that will be executed on each key lookup.
|
21
|
+
*
|
22
|
+
+ * :rdx: no_warnings result_instance_of
|
23
|
+
* h = { "a" => 100, "b" => 200 }
|
24
|
+
* h.default = "Go fish"
|
25
|
+
* h["a"] #=> 100
|
26
|
+
@@ -718,6 +713,7 @@
|
27
|
+
* If <code>Hash::new</code> was invoked with a block, return that
|
28
|
+
* block, otherwise return <code>nil</code>.
|
29
|
+
*
|
30
|
+
+ * :rdx: no_warnings result_instance_of
|
31
|
+
* h = Hash.new {|h,k| h[k] = k*k } #=> {}
|
32
|
+
* p = h.default_proc #=> #<Proc:0x401b3d08@-:1>
|
33
|
+
* a = [] #=> []
|
34
|
+
@@ -741,6 +737,7 @@
|
35
|
+
*
|
36
|
+
* Sets the default proc to be executed on each failed key lookup.
|
37
|
+
*
|
38
|
+
+ * h = Hash.new
|
39
|
+
* h.default_proc = proc do |hash, key|
|
40
|
+
* hash[key] = key + key
|
41
|
+
* end
|
42
|
+
@@ -2926,7 +2923,11 @@
|
43
|
+
*
|
44
|
+
* Converts the environment variables into an array of names and value arrays.
|
45
|
+
*
|
46
|
+
- * ENV.to_a # => [["TERM" => "xterm-color"], ["SHELL" => "/bin/bash"], ...]
|
47
|
+
+ * ENV.to_a # -> [
|
48
|
+
+ * # ["TERM", "xterm-color"],
|
49
|
+
+ * # ["SHELL", "/bin/bash"],
|
50
|
+
+ * # # ...
|
51
|
+
+ * # ]
|
52
|
+
*
|
53
|
+
*/
|
54
|
+
static VALUE
|
55
|
+
@@ -3347,7 +3348,7 @@
|
56
|
+
*
|
57
|
+
* Accessing a value in a Hash requires using its key:
|
58
|
+
*
|
59
|
+
- * puts grades["Jane Doe"] # => 10
|
60
|
+
+ * grades["Jane Doe"] # => 0
|
61
|
+
*
|
62
|
+
* === Common Uses
|
63
|
+
*
|
64
|
+
@@ -3362,13 +3363,15 @@
|
65
|
+
* argument on a method call, no braces are needed, thus creating a really
|
66
|
+
* clean interface:
|
67
|
+
*
|
68
|
+
- * Person.create(name: "John Doe", age: 27)
|
69
|
+
- *
|
70
|
+
- * def self.create(params)
|
71
|
+
- * @name = params[:name]
|
72
|
+
- * @age = params[:age]
|
73
|
+
+ * class Person
|
74
|
+
+ * def self.create(params)
|
75
|
+
+ * @name = params[:name]
|
76
|
+
+ * @age = params[:age]
|
77
|
+
+ * end
|
78
|
+
* end
|
79
|
+
*
|
80
|
+
+ * Person.create(name: "John Doe", age: 27)
|
81
|
+
+
|
82
|
+
* === Hash Keys
|
83
|
+
*
|
84
|
+
* Two objects refer to the same hash key when their <code>hash</code> value
|
@@ -0,0 +1,354 @@
|
|
1
|
+
--- core/orig/iseq.c 2015-06-11 07:51:44 +0000
|
2
|
+
+++ core/patched/iseq.c 2015-06-25 17:35:23 +0000
|
3
|
+
@@ -648,7 +648,7 @@
|
4
|
+
* For details regarding valid compile options see ::compile_option=.
|
5
|
+
*
|
6
|
+
* RubyVM::InstructionSequence.compile("a = 1 + 2")
|
7
|
+
- * #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
|
8
|
+
+ * # > <RubyVM::InstructionSequence:<compiled>@<compiled>>
|
9
|
+
*
|
10
|
+
*/
|
11
|
+
static VALUE
|
12
|
+
@@ -678,12 +678,12 @@
|
13
|
+
*
|
14
|
+
* For details regarding valid compile options see ::compile_option=.
|
15
|
+
*
|
16
|
+
- * # /tmp/hello.rb
|
17
|
+
+ * # File: hello.rb
|
18
|
+
* puts "Hello, world!"
|
19
|
+
- *
|
20
|
+
+ * :rdx:
|
21
|
+
* # elsewhere
|
22
|
+
- * RubyVM::InstructionSequence.compile_file("/tmp/hello.rb")
|
23
|
+
- * #=> <RubyVM::InstructionSequence:<main>@/tmp/hello.rb>
|
24
|
+
+ * RubyVM::InstructionSequence.compile_file("hello.rb")
|
25
|
+
+ * # > <RubyVM::InstructionSequence:<main>@hello.rb>
|
26
|
+
*/
|
27
|
+
static VALUE
|
28
|
+
iseq_s_compile_file(int argc, VALUE *argv, VALUE self)
|
29
|
+
@@ -817,21 +817,21 @@
|
30
|
+
*
|
31
|
+
* For example, using irb:
|
32
|
+
*
|
33
|
+
- * iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
|
34
|
+
- * #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
|
35
|
+
- * iseq.path
|
36
|
+
- * #=> "<compiled>"
|
37
|
+
+ * iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
|
38
|
+
+ * # > <RubyVM::InstructionSequence:<compiled>@<compiled>>
|
39
|
+
+ * iseq.path
|
40
|
+
+ * #=> "<compiled>"
|
41
|
+
*
|
42
|
+
* Using ::compile_file:
|
43
|
+
*
|
44
|
+
- * # /tmp/method.rb
|
45
|
+
- * def hello
|
46
|
+
- * puts "hello, world"
|
47
|
+
- * end
|
48
|
+
- *
|
49
|
+
- * # in irb
|
50
|
+
- * > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
|
51
|
+
- * > iseq.path #=> /tmp/method.rb
|
52
|
+
+ * # File: method.rb
|
53
|
+
+ * def hello
|
54
|
+
+ * puts "hello, world"
|
55
|
+
+ * end
|
56
|
+
+ * :rdx:
|
57
|
+
+ * # in application
|
58
|
+
+ * iseq = RubyVM::InstructionSequence.compile_file('method.rb')
|
59
|
+
+ * iseq.path #=> 'method.rb'
|
60
|
+
*/
|
61
|
+
static VALUE
|
62
|
+
iseq_path(VALUE self)
|
63
|
+
@@ -847,15 +847,15 @@
|
64
|
+
* +nil+ if the iseq was evaluated from a string.
|
65
|
+
*
|
66
|
+
* For example, using ::compile_file:
|
67
|
+
- *
|
68
|
+
- * # /tmp/method.rb
|
69
|
+
- * def hello
|
70
|
+
- * puts "hello, world"
|
71
|
+
- * end
|
72
|
+
- *
|
73
|
+
- * # in irb
|
74
|
+
- * > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
|
75
|
+
- * > iseq.absolute_path #=> /tmp/method.rb
|
76
|
+
+ *
|
77
|
+
+ * # File: method.rb
|
78
|
+
+ * def hello
|
79
|
+
+ * puts "hello, world"
|
80
|
+
+ * end
|
81
|
+
+ * :rdx:
|
82
|
+
+ * # in application
|
83
|
+
+ * iseq = RubyVM::InstructionSequence.compile_file('method.rb')
|
84
|
+
+ * iseq.absolute_path #=> "#{Dir.pwd}/method.rb"
|
85
|
+
*/
|
86
|
+
static VALUE
|
87
|
+
iseq_absolute_path(VALUE self)
|
88
|
+
@@ -872,21 +872,21 @@
|
89
|
+
*
|
90
|
+
* For example, using irb:
|
91
|
+
*
|
92
|
+
- * iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
|
93
|
+
- * #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
|
94
|
+
- * iseq.label
|
95
|
+
- * #=> "<compiled>"
|
96
|
+
+ * iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
|
97
|
+
+ * # > <RubyVM::InstructionSequence:<compiled>@<compiled>>
|
98
|
+
+ * iseq.label
|
99
|
+
+ * #=> "<compiled>"
|
100
|
+
*
|
101
|
+
* Using ::compile_file:
|
102
|
+
*
|
103
|
+
- * # /tmp/method.rb
|
104
|
+
- * def hello
|
105
|
+
- * puts "hello, world"
|
106
|
+
- * end
|
107
|
+
- *
|
108
|
+
- * # in irb
|
109
|
+
- * > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
|
110
|
+
- * > iseq.label #=> <main>
|
111
|
+
+ * # File: method.rb
|
112
|
+
+ * def hello
|
113
|
+
+ * puts "hello, world"
|
114
|
+
+ * end
|
115
|
+
+ * :rdx:
|
116
|
+
+ * # in application
|
117
|
+
+ * iseq = RubyVM::InstructionSequence.compile_file('method.rb')
|
118
|
+
+ * iseq.label #=> "<main>"
|
119
|
+
*/
|
120
|
+
static VALUE
|
121
|
+
iseq_label(VALUE self)
|
122
|
+
@@ -900,21 +900,21 @@
|
123
|
+
*
|
124
|
+
* For example, using irb:
|
125
|
+
*
|
126
|
+
- * iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
|
127
|
+
- * #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
|
128
|
+
- * iseq.base_label
|
129
|
+
- * #=> "<compiled>"
|
130
|
+
+ * iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
|
131
|
+
+ * # > <RubyVM::InstructionSequence:<compiled>@<compiled>>
|
132
|
+
+ * iseq.base_label
|
133
|
+
+ * #=> "<compiled>"
|
134
|
+
*
|
135
|
+
* Using ::compile_file:
|
136
|
+
*
|
137
|
+
- * # /tmp/method.rb
|
138
|
+
- * def hello
|
139
|
+
- * puts "hello, world"
|
140
|
+
- * end
|
141
|
+
- *
|
142
|
+
- * # in irb
|
143
|
+
- * > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
|
144
|
+
- * > iseq.base_label #=> <main>
|
145
|
+
+ * # File: method.rb
|
146
|
+
+ * def hello
|
147
|
+
+ * puts "hello, world"
|
148
|
+
+ * end
|
149
|
+
+ * :rdx:
|
150
|
+
+ * # in application
|
151
|
+
+ * iseq = RubyVM::InstructionSequence.compile_file('method.rb')
|
152
|
+
+ * iseq.base_label #=> "<main>"
|
153
|
+
*/
|
154
|
+
static VALUE
|
155
|
+
iseq_base_label(VALUE self)
|
156
|
+
@@ -929,10 +929,10 @@
|
157
|
+
*
|
158
|
+
* For example, using irb:
|
159
|
+
*
|
160
|
+
- * iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
|
161
|
+
- * #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
|
162
|
+
- * iseq.first_lineno
|
163
|
+
- * #=> 1
|
164
|
+
+ * iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
|
165
|
+
+ * # > <RubyVM::InstructionSequence:<compiled>@<compiled>>
|
166
|
+
+ * iseq.first_lineno
|
167
|
+
+ * #=> 1
|
168
|
+
*/
|
169
|
+
static VALUE
|
170
|
+
iseq_first_lineno(VALUE self)
|
171
|
+
@@ -969,13 +969,13 @@
|
172
|
+
* A hash containing:
|
173
|
+
*
|
174
|
+
* [+:arg_size+]
|
175
|
+
- * the total number of arguments taken by the method or the block (0 if
|
176
|
+
- * _iseq_ doesn't represent a method or block)
|
177
|
+
+ * the total number of arguments taken by the method or the block (0 if
|
178
|
+
+ * _iseq_ doesn't represent a method or block)
|
179
|
+
* [+:local_size+]
|
180
|
+
- * the number of local variables + 1
|
181
|
+
+ * the number of local variables + 1
|
182
|
+
* [+:stack_max+]
|
183
|
+
- * used in calculating the stack depth at which a SystemStackError is
|
184
|
+
- * thrown.
|
185
|
+
+ * used in calculating the stack depth at which a SystemStackError is
|
186
|
+
+ * thrown.
|
187
|
+
*
|
188
|
+
* [#label]
|
189
|
+
* The name of the context (block, method, class, module, etc.) that this
|
190
|
+
@@ -1014,6 +1014,7 @@
|
191
|
+
* The arity if the method or block only has required arguments.
|
192
|
+
*
|
193
|
+
* Otherwise an array of:
|
194
|
+
+ * :rdx: off -
|
195
|
+
*
|
196
|
+
* [required_argc, [optional_arg_labels, ...],
|
197
|
+
* splat_index, post_splat_argc, post_splat_index,
|
198
|
+
@@ -1333,10 +1334,11 @@
|
199
|
+
*
|
200
|
+
* == disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
|
201
|
+
* 0000 trace 1 ( 1)
|
202
|
+
- * 0002 putobject 1
|
203
|
+
- * 0004 putobject 2
|
204
|
+
- * 0006 opt_plus <ic:1>
|
205
|
+
- * 0008 leave
|
206
|
+
+ * 0002 putobject_OP_INT2FIX_O_1_C_
|
207
|
+
+ * 0003 putobject 2
|
208
|
+
+ * 0005 opt_plus <callinfo!mid:+, argc:1, ARGS_SKIP>
|
209
|
+
+ * 0007 leave
|
210
|
+
+ *
|
211
|
+
*/
|
212
|
+
VALUE
|
213
|
+
rb_iseq_disasm(VALUE self)
|
214
|
+
@@ -1449,36 +1451,37 @@
|
215
|
+
* Returns the instruction sequence containing the given proc or method.
|
216
|
+
*
|
217
|
+
* For example, using irb:
|
218
|
+
+ * :rdx: no_warnings result_instance_of
|
219
|
+
*
|
220
|
+
- * # a proc
|
221
|
+
- * > p = proc { num = 1 + 2 }
|
222
|
+
- * > RubyVM::InstructionSequence.of(p)
|
223
|
+
- * > #=> <RubyVM::InstructionSequence:block in irb_binding@(irb)>
|
224
|
+
- *
|
225
|
+
- * # for a method
|
226
|
+
- * > def foo(bar); puts bar; end
|
227
|
+
- * > RubyVM::InstructionSequence.of(method(:foo))
|
228
|
+
- * > #=> <RubyVM::InstructionSequence:foo@(irb)>
|
229
|
+
+ * # a proc
|
230
|
+
+ * p = proc { num = 1 + 2 }
|
231
|
+
+ * RubyVM::InstructionSequence.of(p)
|
232
|
+
+ * #=> <RubyVM::InstructionSequence:block in irb_binding@(irb)>
|
233
|
+
+ *
|
234
|
+
+ * # for a method
|
235
|
+
+ * def foo(bar); puts bar; end
|
236
|
+
+ * RubyVM::InstructionSequence.of(method(:foo))
|
237
|
+
+ * #=> <RubyVM::InstructionSequence:foo@(irb)>
|
238
|
+
*
|
239
|
+
* Using ::compile_file:
|
240
|
+
*
|
241
|
+
- * # /tmp/iseq_of.rb
|
242
|
+
- * def hello
|
243
|
+
- * puts "hello, world"
|
244
|
+
- * end
|
245
|
+
- *
|
246
|
+
- * $a_global_proc = proc { str = 'a' + 'b' }
|
247
|
+
- *
|
248
|
+
- * # in irb
|
249
|
+
- * > require '/tmp/iseq_of.rb'
|
250
|
+
- *
|
251
|
+
- * # first the method hello
|
252
|
+
- * > RubyVM::InstructionSequence.of(method(:hello))
|
253
|
+
- * > #=> #<RubyVM::InstructionSequence:0x007fb73d7cb1d0>
|
254
|
+
- *
|
255
|
+
- * # then the global proc
|
256
|
+
- * > RubyVM::InstructionSequence.of($a_global_proc)
|
257
|
+
- * > #=> #<RubyVM::InstructionSequence:0x007fb73d7caf78>
|
258
|
+
+ * # File: iseq_of.rb
|
259
|
+
+ * def hello
|
260
|
+
+ * puts "hello, world"
|
261
|
+
+ * end
|
262
|
+
+ *
|
263
|
+
+ * $a_global_proc = proc { str = 'a' + 'b' }
|
264
|
+
+ *
|
265
|
+
+ * from the command line:
|
266
|
+
+ *
|
267
|
+
+ * $ ruby <<'EOS'
|
268
|
+
+ * > load File.expand_path('iseq_of.rb')
|
269
|
+
+ * > p RubyVM::InstructionSequence.of(method(:hello))
|
270
|
+
+ * > p RubyVM::InstructionSequence.of($a_global_proc)
|
271
|
+
+ * > EOS
|
272
|
+
+ * <RubyVM::InstructionSequence:hello@<relative_path>/iseq_of.rb>
|
273
|
+
+ * <RubyVM::InstructionSequence:block in <top (required)>@<relative_path>/iseq_of.rb>
|
274
|
+
+ *
|
275
|
+
*/
|
276
|
+
static VALUE
|
277
|
+
iseq_s_of(VALUE klass, VALUE body)
|
278
|
+
@@ -1511,47 +1514,51 @@
|
279
|
+
* human readable instructions for +body+.
|
280
|
+
*
|
281
|
+
* For a Method object:
|
282
|
+
- *
|
283
|
+
- * # /tmp/method.rb
|
284
|
+
+ *
|
285
|
+
+ * # File: method.rb
|
286
|
+
* def hello
|
287
|
+
* puts "hello, world"
|
288
|
+
* end
|
289
|
+
*
|
290
|
+
* puts RubyVM::InstructionSequence.disasm(method(:hello))
|
291
|
+
- *
|
292
|
+
- * Produces:
|
293
|
+
- *
|
294
|
+
- * == disasm: <RubyVM::InstructionSequence:hello@/tmp/method.rb>============
|
295
|
+
+ *
|
296
|
+
+ * Running the file we obtain:
|
297
|
+
+ *
|
298
|
+
+ * $ ruby method.rb
|
299
|
+
+ * == disasm: <RubyVM::InstructionSequence:hello@method.rb>================
|
300
|
+
* 0000 trace 8 ( 1)
|
301
|
+
* 0002 trace 1 ( 2)
|
302
|
+
- * 0004 putself
|
303
|
+
+ * 0004 putself
|
304
|
+
* 0005 putstring "hello, world"
|
305
|
+
- * 0007 send :puts, 1, nil, 8, <ic:0>
|
306
|
+
- * 0013 trace 16 ( 3)
|
307
|
+
- * 0015 leave ( 2)
|
308
|
+
- *
|
309
|
+
+ * 0007 opt_send_simple <callinfo!mid:puts, argc:1, FCALL|ARGS_SKIP>
|
310
|
+
+ * 0009 trace 16 ( 3)
|
311
|
+
+ * 0011 leave ( 2)
|
312
|
+
+ *
|
313
|
+
* For a Proc:
|
314
|
+
*
|
315
|
+
- * # /tmp/proc.rb
|
316
|
+
+ * # File: proc.rb
|
317
|
+
* p = proc { num = 1 + 2 }
|
318
|
+
* puts RubyVM::InstructionSequence.disasm(p)
|
319
|
+
+ *
|
320
|
+
+ * Then from command line:
|
321
|
+
*
|
322
|
+
- * Produces:
|
323
|
+
- *
|
324
|
+
- * == disasm: <RubyVM::InstructionSequence:block in <main>@/tmp/proc.rb>===
|
325
|
+
+ * $ ruby proc.rb
|
326
|
+
+ * == disasm: <RubyVM::InstructionSequence:block in <main>@proc.rb>========
|
327
|
+
* == catch table
|
328
|
+
- * | catch type: redo st: 0000 ed: 0012 sp: 0000 cont: 0000
|
329
|
+
- * | catch type: next st: 0000 ed: 0012 sp: 0000 cont: 0012
|
330
|
+
+ * | catch type: redo st: 0002 ed: 0012 sp: 0000 cont: 0002
|
331
|
+
+ * | catch type: next st: 0002 ed: 0012 sp: 0000 cont: 0012
|
332
|
+
* |------------------------------------------------------------------------
|
333
|
+
* local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1] s1)
|
334
|
+
- * [ 2] num
|
335
|
+
- * 0000 trace 1 ( 1)
|
336
|
+
- * 0002 putobject 1
|
337
|
+
- * 0004 putobject 2
|
338
|
+
- * 0006 opt_plus <ic:1>
|
339
|
+
- * 0008 dup
|
340
|
+
- * 0009 setlocal num, 0
|
341
|
+
- * 0012 leave
|
342
|
+
+ * [ 2] num
|
343
|
+
+ * 0000 trace 256 ( 1)
|
344
|
+
+ * 0002 trace 1
|
345
|
+
+ * 0004 putobject_OP_INT2FIX_O_1_C_
|
346
|
+
+ * 0005 putobject 2
|
347
|
+
+ * 0007 opt_plus <callinfo!mid:+, argc:1, ARGS_SKIP>
|
348
|
+
+ * 0009 dup
|
349
|
+
+ * 0010 setlocal_OP__WC__0 2
|
350
|
+
+ * 0012 trace 512
|
351
|
+
+ * 0014 leave
|
352
|
+
*
|
353
|
+
*/
|
354
|
+
|