rubynode 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +4 -0
- data/README +4 -4
- data/doc/index.html +3 -3
- data/ext/rubynode_ext/ruby_src/1.8.5_2007-09-24/eval.c +44 -0
- data/ext/rubynode_ext/ruby_src/1.8.5_2007-09-24/gc.c +272 -0
- data/ext/rubynode_ext/ruby_src/1.8.5_2007-09-24/node.h +378 -0
- data/ext/rubynode_ext/ruby_src/1.8.6_2007-09-24/eval.c +44 -0
- data/ext/rubynode_ext/ruby_src/1.8.6_2007-09-24/gc.c +272 -0
- data/ext/rubynode_ext/ruby_src/1.8.6_2007-09-24/node.h +474 -0
- data/lib/rubynode.rb +1 -1
- metadata +48 -33
data/Changelog
CHANGED
data/README
CHANGED
@@ -26,10 +26,10 @@ Installation
|
|
26
26
|
RubyNode generates some of its C source code from Ruby's source code, because
|
27
27
|
the node types and other details differ between Ruby versions.
|
28
28
|
|
29
|
-
For the official releases of Ruby 1.8.4, 1.8.5 (including patchlevels 2, 12,
|
30
|
-
and
|
31
|
-
included in the package. To compile RubyNode for any other Ruby
|
32
|
-
will need that version's source tar ball extracted somewhere.
|
29
|
+
For the official releases of Ruby 1.8.4, 1.8.5 (including patchlevels 2, 12,
|
30
|
+
35, 52 and 114) and 1.8.6 (including patchlevel 36 and 111) the needed source
|
31
|
+
files are included in the package. To compile RubyNode for any other Ruby
|
32
|
+
version, you will need that version's source tar ball extracted somewhere.
|
33
33
|
|
34
34
|
So, for Ruby 1.8.4, 1.8.5 and 1.8.6 just run (as root):
|
35
35
|
|
data/doc/index.html
CHANGED
@@ -47,9 +47,9 @@ the node types and other details differ between Ruby versions.</p>
|
|
47
47
|
|
48
48
|
|
49
49
|
<p>For the official releases of Ruby 1.8.4, 1.8.5 (including patchlevels 2, 12,
|
50
|
-
35 and
|
51
|
-
included in the package. To compile RubyNode for any other Ruby
|
52
|
-
will need that version’s source tar ball extracted somewhere.</p>
|
50
|
+
35, 52 and 114) and 1.8.6 (including patchlevel 36 and 111) the needed source
|
51
|
+
files are included in the package. To compile RubyNode for any other Ruby
|
52
|
+
version, you will need that version’s source tar ball extracted somewhere.</p>
|
53
53
|
|
54
54
|
|
55
55
|
<p>So, for <strong>Ruby 1.8.4</strong>, <strong>1.8.5</strong> and <strong>1.8.6</strong> just run (as root):</p>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
eval.c -
|
4
|
+
|
5
|
+
$Author: shyouhei $
|
6
|
+
$Date: 2007/01/27 15:45:49 $
|
7
|
+
created at: Thu Jun 10 14:22:17 JST 1993
|
8
|
+
|
9
|
+
Copyright (C) 1993-2003 Yukihiro Matsumoto
|
10
|
+
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
|
11
|
+
Copyright (C) 2000 Information-technology Promotion Agency, Japan
|
12
|
+
|
13
|
+
**********************************************************************/
|
14
|
+
|
15
|
+
/* extract from eval.c from ruby 1.8.5 */
|
16
|
+
|
17
|
+
struct BLOCK {
|
18
|
+
NODE *var;
|
19
|
+
NODE *body;
|
20
|
+
VALUE self;
|
21
|
+
struct FRAME frame;
|
22
|
+
struct SCOPE *scope;
|
23
|
+
VALUE klass;
|
24
|
+
NODE *cref;
|
25
|
+
int iter;
|
26
|
+
int vmode;
|
27
|
+
int flags;
|
28
|
+
int uniq;
|
29
|
+
struct RVarmap *dyna_vars;
|
30
|
+
VALUE orig_thread;
|
31
|
+
VALUE wrapper;
|
32
|
+
VALUE block_obj;
|
33
|
+
struct BLOCK *outer;
|
34
|
+
struct BLOCK *prev;
|
35
|
+
};
|
36
|
+
|
37
|
+
struct METHOD {
|
38
|
+
VALUE klass, rklass;
|
39
|
+
VALUE recv;
|
40
|
+
ID id, oid;
|
41
|
+
int safe_level;
|
42
|
+
NODE *body;
|
43
|
+
};
|
44
|
+
|
@@ -0,0 +1,272 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
gc.c -
|
4
|
+
|
5
|
+
$Author: matz $
|
6
|
+
$Date: 2006/08/25 08:12:46 $
|
7
|
+
created at: Tue Oct 5 09:44:46 JST 1993
|
8
|
+
|
9
|
+
Copyright (C) 1993-2003 Yukihiro Matsumoto
|
10
|
+
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
|
11
|
+
Copyright (C) 2000 Information-technology Promotion Agency, Japan
|
12
|
+
|
13
|
+
**********************************************************************/
|
14
|
+
|
15
|
+
/* extract from gc.c from ruby 1.8.5 */
|
16
|
+
|
17
|
+
static void
|
18
|
+
gc_mark_children(ptr, lev)
|
19
|
+
VALUE ptr;
|
20
|
+
int lev;
|
21
|
+
{
|
22
|
+
register RVALUE *obj = RANY(ptr);
|
23
|
+
|
24
|
+
goto marking; /* skip */
|
25
|
+
|
26
|
+
again:
|
27
|
+
obj = RANY(ptr);
|
28
|
+
if (rb_special_const_p(ptr)) return; /* special const not marked */
|
29
|
+
if (obj->as.basic.flags == 0) return; /* free cell */
|
30
|
+
if (obj->as.basic.flags & FL_MARK) return; /* already marked */
|
31
|
+
obj->as.basic.flags |= FL_MARK;
|
32
|
+
|
33
|
+
marking:
|
34
|
+
if (FL_TEST(obj, FL_EXIVAR)) {
|
35
|
+
rb_mark_generic_ivar(ptr);
|
36
|
+
}
|
37
|
+
|
38
|
+
switch (obj->as.basic.flags & T_MASK) {
|
39
|
+
case T_NIL:
|
40
|
+
case T_FIXNUM:
|
41
|
+
rb_bug("rb_gc_mark() called for broken object");
|
42
|
+
break;
|
43
|
+
|
44
|
+
case T_NODE:
|
45
|
+
mark_source_filename(obj->as.node.nd_file);
|
46
|
+
switch (nd_type(obj)) {
|
47
|
+
case NODE_IF: /* 1,2,3 */
|
48
|
+
case NODE_FOR:
|
49
|
+
case NODE_ITER:
|
50
|
+
case NODE_CREF:
|
51
|
+
case NODE_WHEN:
|
52
|
+
case NODE_MASGN:
|
53
|
+
case NODE_RESCUE:
|
54
|
+
case NODE_RESBODY:
|
55
|
+
case NODE_CLASS:
|
56
|
+
gc_mark((VALUE)obj->as.node.u2.node, lev);
|
57
|
+
/* fall through */
|
58
|
+
case NODE_BLOCK: /* 1,3 */
|
59
|
+
case NODE_ARRAY:
|
60
|
+
case NODE_DSTR:
|
61
|
+
case NODE_DXSTR:
|
62
|
+
case NODE_DREGX:
|
63
|
+
case NODE_DREGX_ONCE:
|
64
|
+
case NODE_FBODY:
|
65
|
+
case NODE_ENSURE:
|
66
|
+
case NODE_CALL:
|
67
|
+
case NODE_DEFS:
|
68
|
+
case NODE_OP_ASGN1:
|
69
|
+
gc_mark((VALUE)obj->as.node.u1.node, lev);
|
70
|
+
/* fall through */
|
71
|
+
case NODE_SUPER: /* 3 */
|
72
|
+
case NODE_FCALL:
|
73
|
+
case NODE_DEFN:
|
74
|
+
case NODE_NEWLINE:
|
75
|
+
ptr = (VALUE)obj->as.node.u3.node;
|
76
|
+
goto again;
|
77
|
+
|
78
|
+
case NODE_WHILE: /* 1,2 */
|
79
|
+
case NODE_UNTIL:
|
80
|
+
case NODE_AND:
|
81
|
+
case NODE_OR:
|
82
|
+
case NODE_CASE:
|
83
|
+
case NODE_SCLASS:
|
84
|
+
case NODE_DOT2:
|
85
|
+
case NODE_DOT3:
|
86
|
+
case NODE_FLIP2:
|
87
|
+
case NODE_FLIP3:
|
88
|
+
case NODE_MATCH2:
|
89
|
+
case NODE_MATCH3:
|
90
|
+
case NODE_OP_ASGN_OR:
|
91
|
+
case NODE_OP_ASGN_AND:
|
92
|
+
case NODE_MODULE:
|
93
|
+
case NODE_ALIAS:
|
94
|
+
case NODE_VALIAS:
|
95
|
+
case NODE_ARGS:
|
96
|
+
gc_mark((VALUE)obj->as.node.u1.node, lev);
|
97
|
+
/* fall through */
|
98
|
+
case NODE_METHOD: /* 2 */
|
99
|
+
case NODE_NOT:
|
100
|
+
case NODE_GASGN:
|
101
|
+
case NODE_LASGN:
|
102
|
+
case NODE_DASGN:
|
103
|
+
case NODE_DASGN_CURR:
|
104
|
+
case NODE_IASGN:
|
105
|
+
case NODE_CVDECL:
|
106
|
+
case NODE_CVASGN:
|
107
|
+
case NODE_COLON3:
|
108
|
+
case NODE_OPT_N:
|
109
|
+
case NODE_EVSTR:
|
110
|
+
case NODE_UNDEF:
|
111
|
+
ptr = (VALUE)obj->as.node.u2.node;
|
112
|
+
goto again;
|
113
|
+
|
114
|
+
case NODE_HASH: /* 1 */
|
115
|
+
case NODE_LIT:
|
116
|
+
case NODE_STR:
|
117
|
+
case NODE_XSTR:
|
118
|
+
case NODE_DEFINED:
|
119
|
+
case NODE_MATCH:
|
120
|
+
case NODE_RETURN:
|
121
|
+
case NODE_BREAK:
|
122
|
+
case NODE_NEXT:
|
123
|
+
case NODE_YIELD:
|
124
|
+
case NODE_COLON2:
|
125
|
+
case NODE_SPLAT:
|
126
|
+
case NODE_TO_ARY:
|
127
|
+
case NODE_SVALUE:
|
128
|
+
ptr = (VALUE)obj->as.node.u1.node;
|
129
|
+
goto again;
|
130
|
+
|
131
|
+
case NODE_SCOPE: /* 2,3 */
|
132
|
+
case NODE_BLOCK_PASS:
|
133
|
+
case NODE_CDECL:
|
134
|
+
gc_mark((VALUE)obj->as.node.u3.node, lev);
|
135
|
+
ptr = (VALUE)obj->as.node.u2.node;
|
136
|
+
goto again;
|
137
|
+
|
138
|
+
case NODE_ZARRAY: /* - */
|
139
|
+
case NODE_ZSUPER:
|
140
|
+
case NODE_CFUNC:
|
141
|
+
case NODE_VCALL:
|
142
|
+
case NODE_GVAR:
|
143
|
+
case NODE_LVAR:
|
144
|
+
case NODE_DVAR:
|
145
|
+
case NODE_IVAR:
|
146
|
+
case NODE_CVAR:
|
147
|
+
case NODE_NTH_REF:
|
148
|
+
case NODE_BACK_REF:
|
149
|
+
case NODE_REDO:
|
150
|
+
case NODE_RETRY:
|
151
|
+
case NODE_SELF:
|
152
|
+
case NODE_NIL:
|
153
|
+
case NODE_TRUE:
|
154
|
+
case NODE_FALSE:
|
155
|
+
case NODE_ATTRSET:
|
156
|
+
case NODE_BLOCK_ARG:
|
157
|
+
case NODE_POSTEXE:
|
158
|
+
break;
|
159
|
+
case NODE_ALLOCA:
|
160
|
+
mark_locations_array((VALUE*)obj->as.node.u1.value,
|
161
|
+
obj->as.node.u3.cnt);
|
162
|
+
ptr = (VALUE)obj->as.node.u2.node;
|
163
|
+
goto again;
|
164
|
+
|
165
|
+
default: /* unlisted NODE */
|
166
|
+
if (is_pointer_to_heap(obj->as.node.u1.node)) {
|
167
|
+
gc_mark((VALUE)obj->as.node.u1.node, lev);
|
168
|
+
}
|
169
|
+
if (is_pointer_to_heap(obj->as.node.u2.node)) {
|
170
|
+
gc_mark((VALUE)obj->as.node.u2.node, lev);
|
171
|
+
}
|
172
|
+
if (is_pointer_to_heap(obj->as.node.u3.node)) {
|
173
|
+
gc_mark((VALUE)obj->as.node.u3.node, lev);
|
174
|
+
}
|
175
|
+
}
|
176
|
+
return; /* no need to mark class. */
|
177
|
+
}
|
178
|
+
|
179
|
+
gc_mark(obj->as.basic.klass, lev);
|
180
|
+
switch (obj->as.basic.flags & T_MASK) {
|
181
|
+
case T_ICLASS:
|
182
|
+
case T_CLASS:
|
183
|
+
case T_MODULE:
|
184
|
+
mark_tbl(obj->as.klass.m_tbl, lev);
|
185
|
+
mark_tbl(obj->as.klass.iv_tbl, lev);
|
186
|
+
ptr = obj->as.klass.super;
|
187
|
+
goto again;
|
188
|
+
|
189
|
+
case T_ARRAY:
|
190
|
+
if (FL_TEST(obj, ELTS_SHARED)) {
|
191
|
+
ptr = obj->as.array.aux.shared;
|
192
|
+
goto again;
|
193
|
+
}
|
194
|
+
else {
|
195
|
+
long i, len = obj->as.array.len;
|
196
|
+
VALUE *ptr = obj->as.array.ptr;
|
197
|
+
|
198
|
+
for (i=0; i < len; i++) {
|
199
|
+
gc_mark(*ptr++, lev);
|
200
|
+
}
|
201
|
+
}
|
202
|
+
break;
|
203
|
+
|
204
|
+
case T_HASH:
|
205
|
+
mark_hash(obj->as.hash.tbl, lev);
|
206
|
+
ptr = obj->as.hash.ifnone;
|
207
|
+
goto again;
|
208
|
+
|
209
|
+
case T_STRING:
|
210
|
+
#define STR_ASSOC FL_USER3 /* copied from string.c */
|
211
|
+
if (FL_TEST(obj, ELTS_SHARED|STR_ASSOC)) {
|
212
|
+
ptr = obj->as.string.aux.shared;
|
213
|
+
goto again;
|
214
|
+
}
|
215
|
+
break;
|
216
|
+
|
217
|
+
case T_DATA:
|
218
|
+
if (obj->as.data.dmark) (*obj->as.data.dmark)(DATA_PTR(obj));
|
219
|
+
break;
|
220
|
+
|
221
|
+
case T_OBJECT:
|
222
|
+
mark_tbl(obj->as.object.iv_tbl, lev);
|
223
|
+
break;
|
224
|
+
|
225
|
+
case T_FILE:
|
226
|
+
case T_REGEXP:
|
227
|
+
case T_FLOAT:
|
228
|
+
case T_BIGNUM:
|
229
|
+
case T_BLKTAG:
|
230
|
+
break;
|
231
|
+
|
232
|
+
case T_MATCH:
|
233
|
+
if (obj->as.match.str) {
|
234
|
+
ptr = obj->as.match.str;
|
235
|
+
goto again;
|
236
|
+
}
|
237
|
+
break;
|
238
|
+
|
239
|
+
case T_VARMAP:
|
240
|
+
gc_mark(obj->as.varmap.val, lev);
|
241
|
+
ptr = (VALUE)obj->as.varmap.next;
|
242
|
+
goto again;
|
243
|
+
|
244
|
+
case T_SCOPE:
|
245
|
+
if (obj->as.scope.local_vars && (obj->as.scope.flags & SCOPE_MALLOC)) {
|
246
|
+
int n = obj->as.scope.local_tbl[0]+1;
|
247
|
+
VALUE *vars = &obj->as.scope.local_vars[-1];
|
248
|
+
|
249
|
+
while (n--) {
|
250
|
+
gc_mark(*vars++, lev);
|
251
|
+
}
|
252
|
+
}
|
253
|
+
break;
|
254
|
+
|
255
|
+
case T_STRUCT:
|
256
|
+
{
|
257
|
+
long len = obj->as.rstruct.len;
|
258
|
+
VALUE *ptr = obj->as.rstruct.ptr;
|
259
|
+
|
260
|
+
while (len--) {
|
261
|
+
gc_mark(*ptr++, lev);
|
262
|
+
}
|
263
|
+
}
|
264
|
+
break;
|
265
|
+
|
266
|
+
default:
|
267
|
+
rb_bug("rb_gc_mark(): unknown data type 0x%lx(0x%lx) %s",
|
268
|
+
obj->as.basic.flags & T_MASK, obj,
|
269
|
+
is_pointer_to_heap(obj) ? "corrupted object" : "non object");
|
270
|
+
}
|
271
|
+
}
|
272
|
+
|