rb-threadframe 0.40 → 0.41

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/NEWS CHANGED
@@ -1,3 +1,10 @@
1
+ Jan 13, 2012 (0.41)
2
+
3
+ - Patches redone for Ruby 1.9.3 p362
4
+ - Make pure Ruby gem.
5
+ NOTE: Until Ruby 1.9.2 patches are redone, this gem will not work on
6
+ Ruby 1.9.2. Use an older gem for that.
7
+
1
8
  Nov 25, 2012 (0.40)
2
9
  - Redone for Ruby 1.9.3 p327
3
10
  - RubyVM::ThreadFrame is now RubyVM::Frame. RubyVM::ThreadFrame is still
data/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  # rb-threadframe
2
2
 
3
- rb-threadframe is a set of patches to Ruby MRI 1.9.2 and 1.9.3 that
4
- adds introspection of call frames and adds other run-time support for debuggers and run-time introspection.
3
+ A set of patches to Ruby MRI 1.9.3 and 1.9.2 that adds run-time introspection, a call frame object, and other run-time support for things like debuggers.
5
4
 
6
- For MRI 1.9.2, there are additional routines are in a C extension. For MRI 1.9.3, everthing is in a patched Ruby. Necessary patches and some simple patch code are found in this repository though.
5
+ For MRI 1.9.2, there are additional routines are in a C extension. For MRI 1.9.3, everthing is in a patched Ruby. Necessary patches and some simple patch code are found in this repository though. See https://github.com/rocky/rb-threadframe/wiki/How-to-Install for how to install.
7
6
 
8
7
  ## Requirements
9
8
 
@@ -1,9 +1,11 @@
1
1
  # Boilerplate to pull shared object and helper routines.
2
- if RUBY_VERSION == '1.9.2'
3
- require_relative '../ext/thread_frame'
4
- end
5
2
  require_relative 'iseq_extra'
6
3
 
4
+ class RubyVM::Frame
5
+ VERSION = '0.41'
6
+ end
7
+
8
+
7
9
  RubyVM::ThreadFrame = RubyVM::Frame
8
10
  class Thread
9
11
  # For compatibility with old stuff
@@ -50,7 +50,6 @@ class TestThread < Test::Unit::TestCase
50
50
  # because the location is reported on a traceback
51
51
  # and that probably can't happen at PC 0.
52
52
  def bug_when_zero_pc
53
- skip "pc_offset= not implemented on 1.9.3" if '1.9.3' == RUBY_VERSION
54
53
  @not_first = true
55
54
  tf = RubyVM::Frame::current.prev
56
55
  pc_save = tf.pc_offset
@@ -91,9 +90,6 @@ class TestThread < Test::Unit::TestCase
91
90
  assert_equal(self, tf.self)
92
91
  assert_equal(0, tf.arity)
93
92
  assert_equal(0, tf.argc)
94
- ## FIXME: Should we allow this?
95
- ## assert tf.dfp(0)
96
- ## assert tf.lfp(0)
97
93
 
98
94
  # assert_raises IndexError do
99
95
  # x = tf.lfp(tf.iseq.local_size+1)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb-threadframe
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.40'
4
+ version: '0.41'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,17 +9,19 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-25 00:00:00.000000000 Z
12
+ date: 2013-01-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: ! '
14
+ description: ! 'A set of patches to Ruby MRI 1.9.3 and 1.9.2 that adds run-time introspection,
15
+ a call frame object, and other run-time support for things like debuggers.
15
16
 
16
- rb-threadframe gives introspection access for frames of a thread.
17
+
18
+ Necessary patches and some simple patch code are found in the git repository. See
19
+ https://github.com/rocky/rb-threadframe/wiki/How-to-Install for how to install.
17
20
 
18
21
  '
19
22
  email: rockyb@rubyforge.net
20
23
  executables: []
21
- extensions:
22
- - ext/extconf.rb
24
+ extensions: []
23
25
  extra_rdoc_files:
24
26
  - README.md
25
27
  - threadframe.rd
@@ -29,15 +31,8 @@ files:
29
31
  - Makefile
30
32
  - LICENSE
31
33
  - NEWS
32
- - include/thread_pthread.h
33
- - include/node.h
34
- - include/method_mini.h
35
- - include/ruby19_externs.h
36
- - include/vm_core_mini.h
37
34
  - lib/iseq_extra.rb
38
35
  - lib/thread_frame.rb
39
- - ext/1.9.3/thread_frame.c
40
- - ext/version.h
41
36
  - test/unit/test-trace.rb
42
37
  - test/unit/test-iseq-save.rb
43
38
  - test/unit/test-prev.rb
@@ -58,7 +53,6 @@ files:
58
53
  - test/unit/test-sp-size.rb
59
54
  - test/ruby/test_tracefunc_adds.rb
60
55
  - threadframe.rd
61
- - ext/extconf.rb
62
56
  homepage: http://github.com/rocky/rb-threadframe/tree/master
63
57
  licenses:
64
58
  - MIT
@@ -67,7 +61,7 @@ rdoc_options:
67
61
  - --main
68
62
  - README.md
69
63
  - --title
70
- - ThreadFrame 0.40 Documentation
64
+ - ThreadFrame 0.41 Documentation
71
65
  require_paths:
72
66
  - lib
73
67
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -87,5 +81,5 @@ rubyforge_project:
87
81
  rubygems_version: 1.8.23
88
82
  signing_key:
89
83
  specification_version: 3
90
- summary: Frame introspection
84
+ summary: Call stack introspection and run-time support for debuggers
91
85
  test_files: []
@@ -1,22 +0,0 @@
1
- /* Ruby 1.9.3 doesn't need a C extension while 1.9.2 does. I can't figure
2
- out a way build a gem so that it loads the C extension conditionally.
3
- So instead we have a simple stupid stub extension.
4
-
5
- This as it is not elegant.
6
- */
7
-
8
- #include <ruby.h>
9
- #include <ruby/version.h>
10
- #include <string.h>
11
- void
12
- Init_thread_frame(void)
13
- {
14
- if (0 == strncmp("1.9.2", ruby_version, sizeof("1.9.2")))
15
- {
16
- rb_raise(rb_eLoadError,
17
- "Gem installed under Ruby 1.9.3 but this Ruby 1.9.2. Please reinstall 'rb-threadframe' gem under 1.9.2.");
18
- } else if (0 == strncmp("1.9.3", ruby_version, sizeof("1.9.3"))) {
19
- rb_raise(rb_eLoadError,
20
- "Under Ruby 1.9.3 there is no reason to load this thread_frame C extension.");
21
- }
22
- }
@@ -1,14 +0,0 @@
1
- require 'mkmf'
2
-
3
- fail "You need to install a threadframe-patched Ruby.
4
- See http://github.com/rocky/rb-threadframe/wiki/How-to-Install" unless
5
- RbConfig::CONFIG.member?('rb-threadframe')
6
-
7
- # Allow use customization of compile options. For example, the
8
- # following lines could be put in config_options:
9
- # CONFIG['optflags'] = '' # Or -O3
10
- # CONFIG['debugflags'] = '-g3 -ggdb'
11
- config_file = File.join(File.dirname(__FILE__), 'config_options.rb')
12
- load config_file if File.exist?(config_file)
13
-
14
- create_makefile("thread_frame", RUBY_VERSION)
@@ -1 +0,0 @@
1
- #define THREADFRAME_VERSION "0.40"
@@ -1,90 +0,0 @@
1
- /**********************************************************************
2
- From Ruby 1.9's method.h.
3
-
4
- Copyright (C) 2009 Koichi Sasada
5
-
6
- **********************************************************************/
7
- #ifndef METHOD_H
8
- #define METHOD_H
9
-
10
- typedef enum {
11
- NOEX_PUBLIC = 0x00,
12
- NOEX_NOSUPER = 0x01,
13
- NOEX_PRIVATE = 0x02,
14
- NOEX_PROTECTED = 0x04,
15
- NOEX_MASK = 0x06,
16
- NOEX_BASIC = 0x08,
17
- NOEX_UNDEF = NOEX_NOSUPER,
18
- NOEX_MODFUNC = 0x12,
19
- NOEX_SUPER = 0x20,
20
- NOEX_VCALL = 0x40,
21
- NOEX_RESPONDS = 0x80
22
- } rb_method_flag_t;
23
-
24
- #define NOEX_SAFE(n) ((int)((n) >> 8) & 0x0F)
25
- #define NOEX_WITH(n, s) ((s << 8) | (n) | (ruby_running ? 0 : NOEX_BASIC))
26
- #define NOEX_WITH_SAFE(n) NOEX_WITH(n, rb_safe_level())
27
-
28
- /* method data type */
29
-
30
- typedef enum {
31
- VM_METHOD_TYPE_ISEQ,
32
- VM_METHOD_TYPE_CFUNC,
33
- VM_METHOD_TYPE_ATTRSET,
34
- VM_METHOD_TYPE_IVAR,
35
- VM_METHOD_TYPE_BMETHOD,
36
- VM_METHOD_TYPE_ZSUPER,
37
- VM_METHOD_TYPE_UNDEF,
38
- VM_METHOD_TYPE_NOTIMPLEMENTED,
39
- VM_METHOD_TYPE_OPTIMIZED, /* Kernel#send, Proc#call, etc */
40
- VM_METHOD_TYPE_MISSING /* wrapper for method_missing(id) */
41
- } rb_method_type_t;
42
-
43
- typedef struct rb_method_cfunc_struct {
44
- VALUE (*func)(ANYARGS);
45
- int argc; /* This should probably be called "arity" since it is based
46
- on the static prototype, not the supplied arguments
47
- at runtime. */
48
- int actual_argc; /* This probably should be called argc. It is the
49
- argument count at runtime.*/
50
- } rb_method_cfunc_t;
51
-
52
- typedef struct rb_method_attr_struct {
53
- ID id;
54
- VALUE location;
55
- } rb_method_attr_t;
56
-
57
- /* typedef struct rb_iseq_struct rb_iseq_t; */
58
-
59
- typedef struct rb_method_definition_struct {
60
- rb_method_type_t type; /* method type */
61
- ID original_id;
62
- union {
63
- rb_iseq_t *iseq; /* should be mark */
64
- rb_method_cfunc_t cfunc;
65
- rb_method_attr_t attr;
66
- VALUE proc; /* should be mark */
67
- enum method_optimized_type {
68
- OPTIMIZED_METHOD_TYPE_SEND,
69
- OPTIMIZED_METHOD_TYPE_CALL
70
- } optimize_type;
71
- } body;
72
- int alias_count;
73
- } rb_method_definition_t;
74
-
75
- typedef struct rb_method_entry_struct {
76
- rb_method_flag_t flag;
77
- char mark;
78
- rb_method_definition_t *def;
79
- ID called_id;
80
- VALUE klass; /* should be mark */
81
- } rb_method_entry_t;
82
-
83
- struct unlinked_method_entry_list_entry {
84
- struct unlinked_method_entry_list_entry *next;
85
- rb_method_entry_t *me;
86
- };
87
-
88
- #define UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
89
-
90
- #endif /* METHOD_H */
@@ -1,483 +0,0 @@
1
- /**********************************************************************
2
-
3
- node.h -
4
-
5
- $Author: muraken $
6
- created at: Fri May 28 15:14:02 JST 1993
7
-
8
- Copyright (C) 1993-2007 Yukihiro Matsumoto
9
-
10
- **********************************************************************/
11
-
12
- #ifndef RUBY_NODE_H
13
- #define RUBY_NODE_H 1
14
-
15
- #if defined(__cplusplus)
16
- extern "C" {
17
- #if 0
18
- } /* satisfy cc-mode */
19
- #endif
20
- #endif
21
-
22
- enum node_type {
23
- NODE_SCOPE,
24
- #define NODE_SCOPE NODE_SCOPE
25
- NODE_BLOCK,
26
- #define NODE_BLOCK NODE_BLOCK
27
- NODE_IF,
28
- #define NODE_IF NODE_IF
29
- NODE_CASE,
30
- #define NODE_CASE NODE_CASE
31
- NODE_WHEN,
32
- #define NODE_WHEN NODE_WHEN
33
- NODE_OPT_N,
34
- #define NODE_OPT_N NODE_OPT_N
35
- NODE_WHILE,
36
- #define NODE_WHILE NODE_WHILE
37
- NODE_UNTIL,
38
- #define NODE_UNTIL NODE_UNTIL
39
- NODE_ITER,
40
- #define NODE_ITER NODE_ITER
41
- NODE_FOR,
42
- #define NODE_FOR NODE_FOR
43
- NODE_BREAK,
44
- #define NODE_BREAK NODE_BREAK
45
- NODE_NEXT,
46
- #define NODE_NEXT NODE_NEXT
47
- NODE_REDO,
48
- #define NODE_REDO NODE_REDO
49
- NODE_RETRY,
50
- #define NODE_RETRY NODE_RETRY
51
- NODE_BEGIN,
52
- #define NODE_BEGIN NODE_BEGIN
53
- NODE_RESCUE,
54
- #define NODE_RESCUE NODE_RESCUE
55
- NODE_RESBODY,
56
- #define NODE_RESBODY NODE_RESBODY
57
- NODE_ENSURE,
58
- #define NODE_ENSURE NODE_ENSURE
59
- NODE_AND,
60
- #define NODE_AND NODE_AND
61
- NODE_OR,
62
- #define NODE_OR NODE_OR
63
- NODE_MASGN,
64
- #define NODE_MASGN NODE_MASGN
65
- NODE_LASGN,
66
- #define NODE_LASGN NODE_LASGN
67
- NODE_DASGN,
68
- #define NODE_DASGN NODE_DASGN
69
- NODE_DASGN_CURR,
70
- #define NODE_DASGN_CURR NODE_DASGN_CURR
71
- NODE_GASGN,
72
- #define NODE_GASGN NODE_GASGN
73
- NODE_IASGN,
74
- #define NODE_IASGN NODE_IASGN
75
- NODE_IASGN2,
76
- #define NODE_IASGN2 NODE_IASGN2
77
- NODE_CDECL,
78
- #define NODE_CDECL NODE_CDECL
79
- NODE_CVASGN,
80
- #define NODE_CVASGN NODE_CVASGN
81
- NODE_CVDECL,
82
- #define NODE_CVDECL NODE_CVDECL
83
- NODE_OP_ASGN1,
84
- #define NODE_OP_ASGN1 NODE_OP_ASGN1
85
- NODE_OP_ASGN2,
86
- #define NODE_OP_ASGN2 NODE_OP_ASGN2
87
- NODE_OP_ASGN_AND,
88
- #define NODE_OP_ASGN_AND NODE_OP_ASGN_AND
89
- NODE_OP_ASGN_OR,
90
- #define NODE_OP_ASGN_OR NODE_OP_ASGN_OR
91
- NODE_CALL,
92
- #define NODE_CALL NODE_CALL
93
- NODE_FCALL,
94
- #define NODE_FCALL NODE_FCALL
95
- NODE_VCALL,
96
- #define NODE_VCALL NODE_VCALL
97
- NODE_SUPER,
98
- #define NODE_SUPER NODE_SUPER
99
- NODE_ZSUPER,
100
- #define NODE_ZSUPER NODE_ZSUPER
101
- NODE_ARRAY,
102
- #define NODE_ARRAY NODE_ARRAY
103
- NODE_ZARRAY,
104
- #define NODE_ZARRAY NODE_ZARRAY
105
- NODE_VALUES,
106
- #define NODE_VALUES NODE_VALUES
107
- NODE_HASH,
108
- #define NODE_HASH NODE_HASH
109
- NODE_RETURN,
110
- #define NODE_RETURN NODE_RETURN
111
- NODE_YIELD,
112
- #define NODE_YIELD NODE_YIELD
113
- NODE_LVAR,
114
- #define NODE_LVAR NODE_LVAR
115
- NODE_DVAR,
116
- #define NODE_DVAR NODE_DVAR
117
- NODE_GVAR,
118
- #define NODE_GVAR NODE_GVAR
119
- NODE_IVAR,
120
- #define NODE_IVAR NODE_IVAR
121
- NODE_CONST,
122
- #define NODE_CONST NODE_CONST
123
- NODE_CVAR,
124
- #define NODE_CVAR NODE_CVAR
125
- NODE_NTH_REF,
126
- #define NODE_NTH_REF NODE_NTH_REF
127
- NODE_BACK_REF,
128
- #define NODE_BACK_REF NODE_BACK_REF
129
- NODE_MATCH,
130
- #define NODE_MATCH NODE_MATCH
131
- NODE_MATCH2,
132
- #define NODE_MATCH2 NODE_MATCH2
133
- NODE_MATCH3,
134
- #define NODE_MATCH3 NODE_MATCH3
135
- NODE_LIT,
136
- #define NODE_LIT NODE_LIT
137
- NODE_STR,
138
- #define NODE_STR NODE_STR
139
- NODE_DSTR,
140
- #define NODE_DSTR NODE_DSTR
141
- NODE_XSTR,
142
- #define NODE_XSTR NODE_XSTR
143
- NODE_DXSTR,
144
- #define NODE_DXSTR NODE_DXSTR
145
- NODE_EVSTR,
146
- #define NODE_EVSTR NODE_EVSTR
147
- NODE_DREGX,
148
- #define NODE_DREGX NODE_DREGX
149
- NODE_DREGX_ONCE,
150
- #define NODE_DREGX_ONCE NODE_DREGX_ONCE
151
- NODE_ARGS,
152
- #define NODE_ARGS NODE_ARGS
153
- NODE_ARGS_AUX,
154
- #define NODE_ARGS_AUX NODE_ARGS_AUX
155
- NODE_OPT_ARG,
156
- #define NODE_OPT_ARG NODE_OPT_ARG
157
- NODE_POSTARG,
158
- #define NODE_POSTARG NODE_POSTARG
159
- NODE_ARGSCAT,
160
- #define NODE_ARGSCAT NODE_ARGSCAT
161
- NODE_ARGSPUSH,
162
- #define NODE_ARGSPUSH NODE_ARGSPUSH
163
- NODE_SPLAT,
164
- #define NODE_SPLAT NODE_SPLAT
165
- NODE_TO_ARY,
166
- #define NODE_TO_ARY NODE_TO_ARY
167
- NODE_BLOCK_ARG,
168
- #define NODE_BLOCK_ARG NODE_BLOCK_ARG
169
- NODE_BLOCK_PASS,
170
- #define NODE_BLOCK_PASS NODE_BLOCK_PASS
171
- NODE_DEFN,
172
- #define NODE_DEFN NODE_DEFN
173
- NODE_DEFS,
174
- #define NODE_DEFS NODE_DEFS
175
- NODE_ALIAS,
176
- #define NODE_ALIAS NODE_ALIAS
177
- NODE_VALIAS,
178
- #define NODE_VALIAS NODE_VALIAS
179
- NODE_UNDEF,
180
- #define NODE_UNDEF NODE_UNDEF
181
- NODE_CLASS,
182
- #define NODE_CLASS NODE_CLASS
183
- NODE_MODULE,
184
- #define NODE_MODULE NODE_MODULE
185
- NODE_SCLASS,
186
- #define NODE_SCLASS NODE_SCLASS
187
- NODE_COLON2,
188
- #define NODE_COLON2 NODE_COLON2
189
- NODE_COLON3,
190
- #define NODE_COLON3 NODE_COLON3
191
- NODE_DOT2,
192
- #define NODE_DOT2 NODE_DOT2
193
- NODE_DOT3,
194
- #define NODE_DOT3 NODE_DOT3
195
- NODE_FLIP2,
196
- #define NODE_FLIP2 NODE_FLIP2
197
- NODE_FLIP3,
198
- #define NODE_FLIP3 NODE_FLIP3
199
- NODE_SELF,
200
- #define NODE_SELF NODE_SELF
201
- NODE_NIL,
202
- #define NODE_NIL NODE_NIL
203
- NODE_TRUE,
204
- #define NODE_TRUE NODE_TRUE
205
- NODE_FALSE,
206
- #define NODE_FALSE NODE_FALSE
207
- NODE_ERRINFO,
208
- #define NODE_ERRINFO NODE_ERRINFO
209
- NODE_DEFINED,
210
- #define NODE_DEFINED NODE_DEFINED
211
- NODE_POSTEXE,
212
- #define NODE_POSTEXE NODE_POSTEXE
213
- NODE_ALLOCA,
214
- #define NODE_ALLOCA NODE_ALLOCA
215
- NODE_BMETHOD,
216
- #define NODE_BMETHOD NODE_BMETHOD
217
- NODE_MEMO,
218
- #define NODE_MEMO NODE_MEMO
219
- NODE_IFUNC,
220
- #define NODE_IFUNC NODE_IFUNC
221
- NODE_DSYM,
222
- #define NODE_DSYM NODE_DSYM
223
- NODE_ATTRASGN,
224
- #define NODE_ATTRASGN NODE_ATTRASGN
225
- NODE_PRELUDE,
226
- #define NODE_PRELUDE NODE_PRELUDE
227
- NODE_LAMBDA,
228
- #define NODE_LAMBDA NODE_LAMBDA
229
- NODE_OPTBLOCK,
230
- #define NODE_OPTBLOCK NODE_OPTBLOCK
231
- NODE_LAST
232
- #define NODE_LAST NODE_LAST
233
- };
234
-
235
- typedef struct RNode {
236
- unsigned long flags;
237
- char *nd_file;
238
- union {
239
- struct RNode *node;
240
- ID id;
241
- VALUE value;
242
- VALUE (*cfunc)(ANYARGS);
243
- ID *tbl;
244
- } u1;
245
- union {
246
- struct RNode *node;
247
- ID id;
248
- long argc;
249
- VALUE value;
250
- } u2;
251
- union {
252
- struct RNode *node;
253
- ID id;
254
- long state;
255
- struct rb_global_entry *entry;
256
- long cnt;
257
- VALUE value;
258
- } u3;
259
- } NODE;
260
-
261
- #define RNODE(obj) (R_CAST(RNode)(obj))
262
-
263
- /* 0..4:T_TYPES, 5:FL_MARK, 6:reserved, 7:NODE_FL_NEWLINE */
264
- #define NODE_FL_NEWLINE (((VALUE)1)<<7)
265
- #define NODE_FL_CREF_PUSHED_BY_EVAL NODE_FL_NEWLINE
266
-
267
- #define NODE_TYPESHIFT 8
268
- #define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
269
-
270
- #define nd_type(n) ((int) (((RNODE(n))->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
271
- #define nd_set_type(n,t) \
272
- RNODE(n)->flags=((RNODE(n)->flags&~NODE_TYPEMASK)|((((unsigned long)t)<<NODE_TYPESHIFT)&NODE_TYPEMASK))
273
-
274
- #define NODE_LSHIFT (NODE_TYPESHIFT+7)
275
- #define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
276
- #define nd_line(n) (int)(RNODE(n)->flags>>NODE_LSHIFT)
277
- #define nd_set_line(n,l) \
278
- RNODE(n)->flags=((RNODE(n)->flags&~(-1<<NODE_LSHIFT))|(((l)&NODE_LMASK)<<NODE_LSHIFT))
279
-
280
- #define nd_head u1.node
281
- #define nd_alen u2.argc
282
- #define nd_next u3.node
283
-
284
- #define nd_cond u1.node
285
- #define nd_body u2.node
286
- #define nd_else u3.node
287
-
288
- #define nd_orig u3.value
289
-
290
- #define nd_resq u2.node
291
- #define nd_ensr u3.node
292
-
293
- #define nd_1st u1.node
294
- #define nd_2nd u2.node
295
-
296
- #define nd_stts u1.node
297
-
298
- #define nd_entry u3.entry
299
- #define nd_vid u1.id
300
- #define nd_cflag u2.id
301
- #define nd_cval u3.value
302
-
303
- #define nd_oid u1.id
304
- #define nd_cnt u3.cnt
305
- #define nd_tbl u1.tbl
306
-
307
- #define nd_var u1.node
308
- #define nd_iter u3.node
309
-
310
- #define nd_value u2.node
311
- #define nd_aid u3.id
312
-
313
- #define nd_lit u1.value
314
-
315
- #define nd_frml u2.argc
316
- #define nd_rest u1.id
317
- #define nd_opt u1.node
318
- #define nd_pid u1.id
319
- #define nd_plen u2.argc
320
-
321
- #define nd_recv u1.node
322
- #define nd_mid u2.id
323
- #define nd_args u3.node
324
-
325
- #define nd_noex u3.id
326
- #define nd_defn u3.node
327
-
328
- #define nd_cfnc u1.cfunc
329
- #define nd_argc u2.argc
330
-
331
- #define nd_cpath u1.node
332
- #define nd_super u3.node
333
-
334
- #define nd_modl u1.id
335
- #define nd_clss u1.value
336
-
337
- #define nd_beg u1.node
338
- #define nd_end u2.node
339
- #define nd_state u3.state
340
- #define nd_rval u2.value
341
-
342
- #define nd_nth u2.argc
343
-
344
- #define nd_tag u1.id
345
- #define nd_tval u2.value
346
-
347
- #define nd_visi u2.argc
348
-
349
- #define NEW_NODE(t,a0,a1,a2) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
350
-
351
- #define NEW_DEFN(i,a,d,p) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d))
352
- #define NEW_DEFS(r,i,a,d) NEW_NODE(NODE_DEFS,r,i,NEW_SCOPE(a,d))
353
- #define NEW_IFUNC(f,c) NEW_NODE(NODE_IFUNC,f,c,0)
354
- #define NEW_SCOPE(a,b) NEW_NODE(NODE_SCOPE,local_tbl(),b,a)
355
- #define NEW_BLOCK(a) NEW_NODE(NODE_BLOCK,a,0,0)
356
- #define NEW_IF(c,t,e) NEW_NODE(NODE_IF,c,t,e)
357
- #define NEW_UNLESS(c,t,e) NEW_IF(c,e,t)
358
- #define NEW_CASE(h,b) NEW_NODE(NODE_CASE,h,b,0)
359
- #define NEW_WHEN(c,t,e) NEW_NODE(NODE_WHEN,c,t,e)
360
- #define NEW_OPT_N(b) NEW_NODE(NODE_OPT_N,0,b,0)
361
- #define NEW_WHILE(c,b,n) NEW_NODE(NODE_WHILE,c,b,n)
362
- #define NEW_UNTIL(c,b,n) NEW_NODE(NODE_UNTIL,c,b,n)
363
- #define NEW_FOR(v,i,b) NEW_NODE(NODE_FOR,v,b,i)
364
- #define NEW_ITER(a,b) NEW_NODE(NODE_ITER,0,NEW_SCOPE(a,b),0)
365
- #define NEW_LAMBDA(a) NEW_NODE(NODE_LAMBDA,a,0,0)
366
- #define NEW_BREAK(s) NEW_NODE(NODE_BREAK,s,0,0)
367
- #define NEW_NEXT(s) NEW_NODE(NODE_NEXT,s,0,0)
368
- #define NEW_REDO() NEW_NODE(NODE_REDO,0,0,0)
369
- #define NEW_RETRY() NEW_NODE(NODE_RETRY,0,0,0)
370
- #define NEW_BEGIN(b) NEW_NODE(NODE_BEGIN,0,b,0)
371
- #define NEW_RESCUE(b,res,e) NEW_NODE(NODE_RESCUE,b,res,e)
372
- #define NEW_RESBODY(a,ex,n) NEW_NODE(NODE_RESBODY,n,ex,a)
373
- #define NEW_ENSURE(b,en) NEW_NODE(NODE_ENSURE,b,0,en)
374
- #define NEW_RETURN(s) NEW_NODE(NODE_RETURN,s,0,0)
375
- #define NEW_YIELD(a,s) NEW_NODE(NODE_YIELD,a,0,s)
376
- #define NEW_LIST(a) NEW_ARRAY(a)
377
- #define NEW_ARRAY(a) NEW_NODE(NODE_ARRAY,a,1,0)
378
- #define NEW_ZARRAY() NEW_NODE(NODE_ZARRAY,0,0,0)
379
- #define NEW_HASH(a) NEW_NODE(NODE_HASH,a,0,0)
380
- #define NEW_MASGN(l,r) NEW_NODE(NODE_MASGN,l,0,r)
381
- #define NEW_GASGN(v,val) NEW_NODE(NODE_GASGN,v,val,rb_global_entry(v))
382
- #define NEW_LASGN(v,val) NEW_NODE(NODE_LASGN,v,val,0)
383
- #define NEW_DASGN(v,val) NEW_NODE(NODE_DASGN,v,val,0)
384
- #define NEW_DASGN_CURR(v,val) NEW_NODE(NODE_DASGN_CURR,v,val,0)
385
- #define NEW_IASGN(v,val) NEW_NODE(NODE_IASGN,v,val,0)
386
- #define NEW_IASGN2(v,val) NEW_NODE(NODE_IASGN2,v,val,0)
387
- #define NEW_CDECL(v,val,path) NEW_NODE(NODE_CDECL,v,val,path)
388
- #define NEW_CVASGN(v,val) NEW_NODE(NODE_CVASGN,v,val,0)
389
- #define NEW_CVDECL(v,val) NEW_NODE(NODE_CVDECL,v,val,0)
390
- #define NEW_OP_ASGN1(p,id,a) NEW_NODE(NODE_OP_ASGN1,p,id,a)
391
- #define NEW_OP_ASGN2(r,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o))
392
- #define NEW_OP_ASGN22(i,o) NEW_NODE(NODE_OP_ASGN2,i,o,rb_id_attrset(i))
393
- #define NEW_OP_ASGN_OR(i,val) NEW_NODE(NODE_OP_ASGN_OR,i,val,0)
394
- #define NEW_OP_ASGN_AND(i,val) NEW_NODE(NODE_OP_ASGN_AND,i,val,0)
395
- #define NEW_GVAR(v) NEW_NODE(NODE_GVAR,v,0,rb_global_entry(v))
396
- #define NEW_LVAR(v) NEW_NODE(NODE_LVAR,v,0,0)
397
- #define NEW_DVAR(v) NEW_NODE(NODE_DVAR,v,0,0)
398
- #define NEW_IVAR(v) NEW_NODE(NODE_IVAR,v,0,0)
399
- #define NEW_CONST(v) NEW_NODE(NODE_CONST,v,0,0)
400
- #define NEW_CVAR(v) NEW_NODE(NODE_CVAR,v,0,0)
401
- #define NEW_NTH_REF(n) NEW_NODE(NODE_NTH_REF,0,n,0)
402
- #define NEW_BACK_REF(n) NEW_NODE(NODE_BACK_REF,0,n,0)
403
- #define NEW_MATCH(c) NEW_NODE(NODE_MATCH,c,0,0)
404
- #define NEW_MATCH2(n1,n2) NEW_NODE(NODE_MATCH2,n1,n2,0)
405
- #define NEW_MATCH3(r,n2) NEW_NODE(NODE_MATCH3,r,n2,0)
406
- #define NEW_LIT(l) NEW_NODE(NODE_LIT,l,0,0)
407
- #define NEW_STR(s) NEW_NODE(NODE_STR,s,0,0)
408
- #define NEW_DSTR(s) NEW_NODE(NODE_DSTR,s,1,0)
409
- #define NEW_XSTR(s) NEW_NODE(NODE_XSTR,s,0,0)
410
- #define NEW_DXSTR(s) NEW_NODE(NODE_DXSTR,s,0,0)
411
- #define NEW_DSYM(s) NEW_NODE(NODE_DSYM,s,0,0)
412
- #define NEW_EVSTR(n) NEW_NODE(NODE_EVSTR,0,(n),0)
413
- #define NEW_CALL(r,m,a) NEW_NODE(NODE_CALL,r,m,a)
414
- #define NEW_FCALL(m,a) NEW_NODE(NODE_FCALL,0,m,a)
415
- #define NEW_VCALL(m) NEW_NODE(NODE_VCALL,0,m,0)
416
- #define NEW_SUPER(a) NEW_NODE(NODE_SUPER,0,0,a)
417
- #define NEW_ZSUPER() NEW_NODE(NODE_ZSUPER,0,0,0)
418
- #define NEW_ARGS(m,o) NEW_NODE(NODE_ARGS,o,m,0)
419
- #define NEW_ARGS_AUX(r,b) NEW_NODE(NODE_ARGS_AUX,r,b,0)
420
- #define NEW_OPT_ARG(i,v) NEW_NODE(NODE_OPT_ARG,i,v,0)
421
- #define NEW_POSTARG(i,v) NEW_NODE(NODE_POSTARG,i,v,0)
422
- #define NEW_ARGSCAT(a,b) NEW_NODE(NODE_ARGSCAT,a,b,0)
423
- #define NEW_ARGSPUSH(a,b) NEW_NODE(NODE_ARGSPUSH,a,b,0)
424
- #define NEW_SPLAT(a) NEW_NODE(NODE_SPLAT,a,0,0)
425
- #define NEW_TO_ARY(a) NEW_NODE(NODE_TO_ARY,a,0,0)
426
- #define NEW_BLOCK_ARG(v) NEW_NODE(NODE_BLOCK_ARG,v,0,local_cnt(v))
427
- #define NEW_BLOCK_PASS(b) NEW_NODE(NODE_BLOCK_PASS,0,b,0)
428
- #define NEW_ALIAS(n,o) NEW_NODE(NODE_ALIAS,n,o,0)
429
- #define NEW_VALIAS(n,o) NEW_NODE(NODE_VALIAS,n,o,0)
430
- #define NEW_UNDEF(i) NEW_NODE(NODE_UNDEF,0,i,0)
431
- #define NEW_CLASS(n,b,s) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(0,b),(s))
432
- #define NEW_SCLASS(r,b) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(0,b),0)
433
- #define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(0,b),0)
434
- #define NEW_COLON2(c,i) NEW_NODE(NODE_COLON2,c,i,0)
435
- #define NEW_COLON3(i) NEW_NODE(NODE_COLON3,0,i,0)
436
- #define NEW_DOT2(b,e) NEW_NODE(NODE_DOT2,b,e,0)
437
- #define NEW_DOT3(b,e) NEW_NODE(NODE_DOT3,b,e,0)
438
- #define NEW_SELF() NEW_NODE(NODE_SELF,0,0,0)
439
- #define NEW_NIL() NEW_NODE(NODE_NIL,0,0,0)
440
- #define NEW_TRUE() NEW_NODE(NODE_TRUE,0,0,0)
441
- #define NEW_FALSE() NEW_NODE(NODE_FALSE,0,0,0)
442
- #define NEW_ERRINFO() NEW_NODE(NODE_ERRINFO,0,0,0)
443
- #define NEW_DEFINED(e) NEW_NODE(NODE_DEFINED,e,0,0)
444
- #define NEW_PREEXE(b) NEW_SCOPE(b)
445
- #define NEW_POSTEXE(b) NEW_NODE(NODE_POSTEXE,0,b,0)
446
- #define NEW_BMETHOD(b) NEW_NODE(NODE_BMETHOD,0,0,b)
447
- #define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
448
- #define NEW_PRELUDE(p,b) NEW_NODE(NODE_PRELUDE,p,b,0)
449
- #define NEW_OPTBLOCK(a) NEW_NODE(NODE_OPTBLOCK,a,0,0)
450
-
451
- VALUE rb_parser_new(void);
452
- VALUE rb_parser_end_seen_p(VALUE);
453
- VALUE rb_parser_encoding(VALUE);
454
-
455
- NODE *rb_parser_compile_cstr(volatile VALUE, const char*, const char*, int, int);
456
- NODE *rb_parser_compile_string(volatile VALUE, const char*, VALUE, int);
457
- NODE *rb_parser_compile_file(volatile VALUE, const char*, VALUE, int);
458
-
459
- NODE *rb_compile_cstr(const char*, const char*, int, int);
460
- NODE *rb_compile_string(const char*, VALUE, int);
461
- NODE *rb_compile_file(const char*, VALUE, int);
462
-
463
- NODE *rb_node_newnode(enum node_type,VALUE,VALUE,VALUE);
464
- NODE *rb_node_newnode_longlife(enum node_type,VALUE,VALUE,VALUE);
465
-
466
- struct rb_global_entry {
467
- struct rb_global_variable *var;
468
- ID id;
469
- };
470
-
471
- struct rb_global_entry *rb_global_entry(ID);
472
- VALUE rb_gvar_get(struct rb_global_entry *);
473
- VALUE rb_gvar_set(struct rb_global_entry *, VALUE);
474
- VALUE rb_gvar_defined(struct rb_global_entry *);
475
-
476
- #if defined(__cplusplus)
477
- #if 0
478
- { /* satisfy cc-mode */
479
- #endif
480
- } /* extern "C" { */
481
- #endif
482
-
483
- #endif /* RUBY_NODE_H */
@@ -1,36 +0,0 @@
1
- /* Ruby 1.9 externs that we need.
2
-
3
- We assume all structure typedefs needed below have been defined
4
- previously.
5
-
6
- Routines marked "new" are not found in an unmodified Ruby 1.9.
7
- Routines marked remove "static" are static routines that need to be
8
- made extern.
9
- */
10
-
11
-
12
- /* From iseq */
13
- extern VALUE iseq_alloc_shared(VALUE klass); /* new */
14
- extern VALUE rb_cISeq;
15
- extern const char * ruby_node_name(int node);
16
- extern VALUE rb_iseq_arity(VALUE iseqval);
17
-
18
- /* From proc.c */
19
- extern int method_arity(VALUE method); /* removed "static" */
20
- extern VALUE rb_binding_frame_new(void *vth, void *vcfp); /* new */
21
-
22
-
23
- /* From thread.c */
24
- extern rb_control_frame_t * thread_control_frame(void *); /* new */
25
- extern VALUE rb_cThread; /* Thread class */
26
-
27
-
28
- extern VALUE rb_iseq_disasm_internal(rb_iseq_t *iseqdat); /* new */
29
- extern VALUE rb_cRubyVM; /* RubyVM class */
30
-
31
- /* From vm.c */
32
- extern int rb_vm_get_sourceline(const rb_control_frame_t *cfp);
33
- extern rb_control_frame_t * rb_vm_get_ruby_level_next_cfp(rb_thread_t *th, rb_control_frame_t *cfp);
34
-
35
- /* From node.c */
36
- extern VALUE rb_parser_dump_tree(NODE *node, int comment);
@@ -1,24 +0,0 @@
1
- /**********************************************************************
2
-
3
- thread_pthread.h -
4
-
5
- $Author$
6
-
7
- Copyright (C) 2004-2007 Koichi Sasada
8
-
9
- **********************************************************************/
10
-
11
- #ifndef RUBY_THREAD_PTHREAD_H
12
- #define RUBY_THREAD_PTHREAD_H
13
-
14
- #include <pthread.h>
15
- typedef pthread_t rb_thread_id_t;
16
- typedef pthread_mutex_t rb_thread_lock_t;
17
- typedef pthread_cond_t rb_thread_cond_t;
18
-
19
- typedef struct native_thread_data_struct {
20
- void *signal_thread_list;
21
- pthread_cond_t sleep_cond;
22
- } native_thread_data_t;
23
-
24
- #endif /* RUBY_THREAD_PTHREAD_H */
@@ -1,373 +0,0 @@
1
- /* Headers Exposing a little more of the 1.9 runtime and some
2
- method prototypes for extensions to the Thread class.
3
- */
4
- #include <ruby.h>
5
- #include <signal.h>
6
- #include "thread_pthread.h"
7
- #include "node.h"
8
-
9
- /* From vm_core.h: */
10
-
11
- /* Frame information: */
12
- #define VM_FRAME_MAGIC_METHOD 0x11
13
- #define VM_FRAME_MAGIC_BLOCK 0x21
14
- #define VM_FRAME_MAGIC_CLASS 0x31
15
- #define VM_FRAME_MAGIC_TOP 0x41
16
- #define VM_FRAME_MAGIC_FINISH 0x51
17
- #define VM_FRAME_MAGIC_CFUNC 0x61
18
- #define VM_FRAME_MAGIC_PROC 0x71
19
- #define VM_FRAME_MAGIC_IFUNC 0x81
20
- #define VM_FRAME_MAGIC_EVAL 0x91
21
- #define VM_FRAME_MAGIC_LAMBDA 0xa1
22
- #define VM_FRAME_MAGIC_MASK_BITS 8
23
- #define VM_FRAME_MAGIC_MASK (~(~0<<VM_FRAME_MAGIC_MASK_BITS))
24
-
25
- #define VM_FRAME_TYPE(cfp) ((cfp)->flag & VM_FRAME_MAGIC_MASK)
26
-
27
- #define VM_FRAME_TRACE_RETURN 0x01 /* Call trace hook on return. */
28
- #define VM_FRAME_TRACE_OFF 0x02 /* Turn of event hook tracing in this frame
29
- and any frames created from this one. */
30
-
31
- /* other frame flag */
32
- #define VM_FRAME_FLAG_PASSED 0x0100
33
-
34
- #define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp) (cfp+1)
35
- #define RUBYVM_CFUNC_FRAME_P(cfp) \
36
- (VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
37
- #define RUBY_VM_NEXT_CONTROL_FRAME(cfp) (cfp-1)
38
- #define RUBY_VM_END_CONTROL_FRAME(th) \
39
- ((rb_control_frame_t *)((th)->stack + (th)->stack_size))
40
- #define RUBY_VM_VALID_CONTROL_FRAME_P(cfp, ecfp) \
41
- ((void *)(ecfp) > (void *)(cfp))
42
- #define RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp) \
43
- (!RUBY_VM_VALID_CONTROL_FRAME_P((cfp), RUBY_VM_END_CONTROL_FRAME(th)))
44
-
45
- #define RUBY_VM_IFUNC_P(ptr) (BUILTIN_TYPE(ptr) == T_NODE)
46
- #define RUBY_VM_NORMAL_ISEQ_P(ptr) \
47
- (ptr && !RUBY_VM_IFUNC_P(ptr))
48
-
49
-
50
- #if 1
51
- #define GetCoreDataFromValue(obj, type, ptr) do { \
52
- ptr = (type*)DATA_PTR(obj); \
53
- } while (0)
54
- #else
55
- #define GetCoreDataFromValue(obj, type, ptr) Data_Get_Struct(obj, type, ptr)
56
- #endif
57
- #if 1
58
- #define GetCoreDataFromValue(obj, type, ptr) do { \
59
- ptr = (type*)DATA_PTR(obj); \
60
- } while (0)
61
- #else
62
- #define GetCoreDataFromValue(obj, type, ptr) Data_Get_Struct(obj, type, ptr)
63
- #endif
64
- #define GetISeqPtr(obj, ptr) \
65
- GetCoreDataFromValue(obj, rb_iseq_t, ptr)
66
-
67
- /* Opaque types (for now at least) */
68
- typedef struct iseq_catch_table_entry iseq_catch_table_entry_t;
69
-
70
- #ifndef NSIG
71
- # define NSIG (_SIGMAX + 1) /* For QNX */
72
- #endif
73
-
74
- #define RUBY_NSIG NSIG
75
-
76
- typedef struct rb_compile_option_struct {
77
- int inline_const_cache;
78
- int peephole_optimization;
79
- int tailcall_optimization;
80
- int specialized_instruction;
81
- int operands_unification;
82
- int instructions_unification;
83
- int stack_caching;
84
- int trace_instruction;
85
- int save_tree_node;
86
- int save_compile_opts;
87
- int debug_level;
88
- } rb_compile_option_t;
89
-
90
- /* Instruction sequence */
91
- typedef struct rb_iseq_struct {
92
- /***************/
93
- /* static data */
94
- /***************/
95
-
96
- VALUE type; /* instruction sequence type */
97
- VALUE name; /* String: iseq name */
98
- VALUE filename; /* file information where this sequence from */
99
- VALUE filepath; /* real file path or nil */
100
- VALUE *iseq; /* iseq (insn number and operands) */
101
- VALUE *iseq_encoded; /* encoded iseq */
102
- unsigned long iseq_size;
103
- VALUE mark_ary; /* Array: includes operands which should be GC marked */
104
- VALUE coverage; /* coverage array */
105
- unsigned short line_no;
106
-
107
- /* insn info, must be freed */
108
- struct iseq_insn_info_entry *insn_info_table;
109
- size_t insn_info_size;
110
-
111
- ID *local_table; /* must free */
112
- int local_table_size;
113
-
114
- /* method, class frame: sizeof(vars) + 1, block frame: sizeof(vars) */
115
- int local_size;
116
-
117
- struct iseq_inline_cache_entry *ic_entries;
118
- int ic_size;
119
-
120
- /**
121
- * argument information
122
- *
123
- * def m(a1, a2, ..., aM, # mandatory
124
- * b1=(...), b2=(...), ..., bN=(...), # optional
125
- * *c, # rest
126
- * d1, d2, ..., dO, # post
127
- * &e) # block
128
- * =>
129
- *
130
- * argc = M
131
- * arg_rest = M+N+1 // or -1 if no rest arg
132
- * arg_opts = N
133
- * arg_opts_tbl = [ (N entries) ]
134
- * arg_post_len = O // 0 if no post arguments
135
- * arg_post_start = M+N+2
136
- * arg_block = M+N + 1 + O + 1 // -1 if no block arg
137
- * arg_simple = 0 if not simple arguments.
138
- * = 1 if no opt, rest, post, block.
139
- * = 2 if ambiguous block parameter ({|a|}).
140
- * arg_size = argument size.
141
- */
142
-
143
- int argc;
144
- int arg_simple;
145
- int arg_rest;
146
- int arg_block;
147
- int arg_opts;
148
- int arg_post_len;
149
- int arg_post_start;
150
- int arg_size;
151
- VALUE *arg_opt_table;
152
-
153
- size_t stack_max; /* for stack overflow check */
154
-
155
- /* catch table */
156
- iseq_catch_table_entry_t *catch_table;
157
- int catch_table_size;
158
-
159
- /* for child iseq */
160
- struct rb_iseq_struct *parent_iseq;
161
- struct rb_iseq_struct *local_iseq;
162
-
163
- /****************/
164
- /* dynamic data */
165
- /****************/
166
-
167
- VALUE self;
168
- VALUE orig; /* non-NULL if its data have origin */
169
-
170
- /* block inlining */
171
- /*
172
- * NODE *node;
173
- * void *special_block_builder;
174
- * void *cached_special_block_builder;
175
- * VALUE cached_special_block;
176
- */
177
-
178
- /* klass/module nest information stack (cref) */
179
- NODE *cref_stack;
180
- VALUE klass;
181
-
182
- /* misc */
183
- ID defined_method_id; /* for define_method */
184
-
185
- /* used at compile time */
186
- struct iseq_compile_data *compile_data;
187
- /* Used to set a breakpoint at a VM instruction */
188
- unsigned char *breakpoints;
189
-
190
- /* If this instruction sequence came from eval, the string of the
191
- source as a String. */
192
- VALUE eval_source;
193
-
194
- /* If we are saving tree nodes (a compile option), then tree_node
195
- is the internal parse tree node representation for this
196
- instruction sequence.
197
- */
198
- NODE *tree_node;
199
- int in_use; /* Reference count of number of times and instruction
200
- sequence is in use such as via thread_frame object
201
- access or is stored in ISEQS__ or SCRIPT_ISEQS.
202
- */
203
- } rb_iseq_t;
204
-
205
- enum ruby_special_exceptions {
206
- ruby_error_reenter,
207
- ruby_error_nomemory,
208
- ruby_error_sysstack,
209
- ruby_special_error_count
210
- };
211
-
212
- typedef struct rb_vm_struct {
213
- VALUE self;
214
-
215
- rb_thread_lock_t global_vm_lock;
216
-
217
- struct rb_thread_struct *main_thread;
218
- struct rb_thread_struct *running_thread;
219
-
220
- st_table *living_threads;
221
- VALUE thgroup_default;
222
-
223
- int running;
224
- int thread_abort_on_exception;
225
- unsigned long trace_flag;
226
- volatile int sleeper;
227
-
228
- /* object management */
229
- VALUE mark_object_ary;
230
-
231
- VALUE special_exceptions[ruby_special_error_count];
232
-
233
- /* load */
234
- VALUE top_self;
235
- VALUE load_path;
236
- VALUE loaded_features;
237
- struct st_table *loading_table;
238
-
239
- /* signal */
240
- struct {
241
- VALUE cmd;
242
- int safe;
243
- } trap_list[RUBY_NSIG];
244
-
245
- /* hook */
246
- rb_event_hook_t *event_hooks;
247
-
248
- int src_encoding_index;
249
-
250
- VALUE verbose, debug, progname;
251
- VALUE coverages;
252
-
253
- struct unlinked_method_entry_list_entry *unlinked_method_entry_list;
254
-
255
- #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
256
- struct rb_objspace *objspace;
257
- #endif
258
- } rb_vm_t;
259
-
260
- #include "method_mini.h"
261
-
262
- typedef struct {
263
- VALUE *pc; /* cfp[0] */
264
- VALUE *sp; /* cfp[1] */
265
- VALUE *bp; /* cfp[2] */
266
- rb_iseq_t *iseq; /* cfp[3] */
267
- VALUE flag; /* cfp[4] */
268
- VALUE self; /* cfp[5] / block[0] */
269
- VALUE *lfp; /* cfp[6] / block[1] */
270
- VALUE *dfp; /* cfp[7] / block[2] */
271
- rb_iseq_t *block_iseq; /* cfp[8] / block[3] */
272
- VALUE proc; /* cfp[9] / block[4] */
273
- const rb_method_entry_t *me;/* cfp[10] */
274
- short int tracing; /* Bits to control per-frame event tracing.
275
- See VM_FRAME_TRACE_xxx defines.
276
- */
277
- } rb_control_frame_t;
278
-
279
- typedef struct rb_block_struct {
280
- VALUE self; /* share with method frame if it's only block */
281
- VALUE *lfp; /* share with method frame if it's only block */
282
- VALUE *dfp; /* share with method frame if it's only block */
283
- rb_iseq_t *iseq;
284
- VALUE proc;
285
- } rb_block_t;
286
-
287
- #define GetThreadPtr(obj, ptr) \
288
- GetCoreDataFromValue(obj, rb_thread_t, ptr)
289
-
290
- #define GetProcPtr(obj, ptr) \
291
- GetCoreDataFromValue(obj, rb_proc_t, ptr)
292
-
293
- typedef struct rb_thread_struct
294
- {
295
- VALUE self;
296
- rb_vm_t *vm;
297
-
298
- /* execution information */
299
- VALUE *stack; /* must free, must mark. rb: seems to be nil. */
300
- unsigned long stack_size; /* Number of stack (or rb_control_frame_t) entries */
301
- rb_control_frame_t *cfp;
302
-
303
- int safe_level;
304
- int raised_flag;
305
- VALUE last_status; /* $? */
306
-
307
- /* passing state */
308
- int state;
309
-
310
- /* tracer */
311
- rb_event_hook_t *event_hooks;
312
- rb_event_flag_t event_flags;
313
- int tracing; /* 0 if not tracing. If less than 0, skip that many
314
- C call/return pairs */
315
-
316
- int exec_event_tracing; /* 0 if not in rb_threadptr_evec_event_hooks. */
317
-
318
- /* misc */
319
- int method_missing_reason;
320
- int abort_on_exception;
321
-
322
- /* for rb_iterate */
323
- const rb_block_t *passed_block;
324
-
325
- /* for bmethod */
326
- const rb_method_entry_t *passed_me;
327
-
328
- /* for load(true) */
329
- VALUE top_self;
330
- VALUE top_wrapper;
331
-
332
- /* eval env */
333
- rb_block_t *base_block;
334
-
335
- VALUE *local_lfp;
336
- VALUE local_svar;
337
-
338
- /* Lot's of other stuff ...
339
- thread control ... */
340
- } rb_thread_t;
341
-
342
- typedef struct {
343
- rb_block_t block;
344
-
345
- VALUE envval; /* for GC mark */
346
- VALUE blockprocval;
347
- int safe_level;
348
- int is_from_method;
349
- int is_lambda;
350
- } rb_proc_t;
351
-
352
- #define GetEnvPtr(obj, ptr) \
353
- GetCoreDataFromValue(obj, rb_env_t, ptr)
354
-
355
- typedef struct {
356
- VALUE *env;
357
- int env_size;
358
- int local_size;
359
- VALUE prev_envval; /* for GC mark */
360
- rb_block_t block;
361
- } rb_env_t;
362
-
363
- #define GetBindingPtr(obj, ptr) \
364
- GetCoreDataFromValue(obj, rb_binding_t, ptr)
365
-
366
- typedef struct {
367
- VALUE env;
368
- VALUE filename;
369
- unsigned short line_no;
370
- } rb_binding_t;
371
-
372
- #define GET_THREAD() ruby_current_thread
373
- extern rb_thread_t *ruby_current_thread;