sender 1.5.1 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +5 -0
- data/Manifest.txt +2 -24
- data/Rakefile +1 -0
- data/VERSION.rdoc +1 -1
- data/ext/sender/RubySourceSupport.c +0 -33
- data/ext/sender/RubySourceSupport.h +7 -1
- data/ext/sender/extconf.rb +19 -1
- data/ext/sender/rb_Kernel.c +9 -0
- data/ext/sender/{main.c → sender.c} +0 -0
- data/lib/VERSION.rdoc +1 -1
- data/lib/sender/sender.bundle +0 -0
- data/mkmf.log +69 -0
- data/sender.gemspec +6 -3
- metadata +20 -35
- data/Makefile +0 -181
- data/ext/sender/debug.h +0 -36
- data/ext/sender/dln.h +0 -41
- data/ext/sender/encdb.h +0 -147
- data/ext/sender/eval_intern.h +0 -215
- data/ext/sender/gc.h +0 -75
- data/ext/sender/id.h +0 -163
- data/ext/sender/iseq.h +0 -103
- data/ext/sender/node.h +0 -516
- data/ext/sender/parse.h +0 -189
- data/ext/sender/regenc.h +0 -207
- data/ext/sender/regint.h +0 -842
- data/ext/sender/regparse.h +0 -351
- data/ext/sender/revision.h +0 -1
- data/ext/sender/thread_pthread.h +0 -24
- data/ext/sender/thread_win32.h +0 -33
- data/ext/sender/transcode_data.h +0 -106
- data/ext/sender/transdb.h +0 -147
- data/ext/sender/version.h +0 -55
- data/ext/sender/vm_core.h +0 -647
- data/ext/sender/vm_exec.h +0 -184
- data/ext/sender/vm_insnhelper.h +0 -196
- data/ext/sender/vm_opts.h +0 -51
data/ext/sender/version.h
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
#define RUBY_VERSION "1.9.1"
|
2
|
-
#define RUBY_PATCHLEVEL 378
|
3
|
-
#define RUBY_VERSION_MAJOR 1
|
4
|
-
#define RUBY_VERSION_MINOR 9
|
5
|
-
#define RUBY_VERSION_TEENY 1
|
6
|
-
|
7
|
-
#define RUBY_RELEASE_YEAR 2010
|
8
|
-
#define RUBY_RELEASE_MONTH 1
|
9
|
-
#define RUBY_RELEASE_DAY 10
|
10
|
-
#define RUBY_RELEASE_DATE "2010-01-10"
|
11
|
-
|
12
|
-
#ifdef RUBY_EXTERN
|
13
|
-
RUBY_EXTERN const char ruby_version[];
|
14
|
-
RUBY_EXTERN const char ruby_release_date[];
|
15
|
-
RUBY_EXTERN const char ruby_platform[];
|
16
|
-
RUBY_EXTERN const int ruby_patchlevel;
|
17
|
-
RUBY_EXTERN const char ruby_description[];
|
18
|
-
RUBY_EXTERN const char ruby_copyright[];
|
19
|
-
#endif
|
20
|
-
|
21
|
-
#define RUBY_AUTHOR "Yukihiro Matsumoto"
|
22
|
-
#define RUBY_BIRTH_YEAR 1993
|
23
|
-
#define RUBY_BIRTH_MONTH 2
|
24
|
-
#define RUBY_BIRTH_DAY 24
|
25
|
-
|
26
|
-
#define RUBY_PATCHLEVEL_STR "p"STRINGIZE(RUBY_PATCHLEVEL)
|
27
|
-
|
28
|
-
#ifndef RUBY_REVISION
|
29
|
-
# include "revision.h"
|
30
|
-
#endif
|
31
|
-
# ifndef RUBY_REVISION
|
32
|
-
# define RUBY_REVISION 0
|
33
|
-
#endif
|
34
|
-
|
35
|
-
#if RUBY_REVISION
|
36
|
-
# ifdef RUBY_BRANCH_NAME
|
37
|
-
# define RUBY_REVISION_STR " "RUBY_BRANCH_NAME" "STRINGIZE(RUBY_REVISION)
|
38
|
-
# else
|
39
|
-
# define RUBY_REVISION_STR " revision "STRINGIZE(RUBY_REVISION)
|
40
|
-
# endif
|
41
|
-
#else
|
42
|
-
# define RUBY_REVISION_STR ""
|
43
|
-
#endif
|
44
|
-
|
45
|
-
# define RUBY_DESCRIPTION \
|
46
|
-
"ruby "RUBY_VERSION \
|
47
|
-
RUBY_PATCHLEVEL_STR \
|
48
|
-
" ("RUBY_RELEASE_DATE \
|
49
|
-
RUBY_REVISION_STR") " \
|
50
|
-
"["RUBY_PLATFORM"]"
|
51
|
-
# define RUBY_COPYRIGHT \
|
52
|
-
"ruby - Copyright (C) " \
|
53
|
-
STRINGIZE(RUBY_BIRTH_YEAR)"-" \
|
54
|
-
STRINGIZE(RUBY_RELEASE_YEAR)" " \
|
55
|
-
RUBY_AUTHOR
|
data/ext/sender/vm_core.h
DELETED
@@ -1,647 +0,0 @@
|
|
1
|
-
/**********************************************************************
|
2
|
-
|
3
|
-
vm_core.h -
|
4
|
-
|
5
|
-
$Author: yugui $
|
6
|
-
created at: 04/01/01 19:41:38 JST
|
7
|
-
|
8
|
-
Copyright (C) 2004-2007 Koichi Sasada
|
9
|
-
|
10
|
-
**********************************************************************/
|
11
|
-
|
12
|
-
#ifndef RUBY_VM_CORE_H
|
13
|
-
#define RUBY_VM_CORE_H
|
14
|
-
|
15
|
-
#define RUBY_VM_THREAD_MODEL 2
|
16
|
-
|
17
|
-
#include "ruby/ruby.h"
|
18
|
-
#include "ruby/st.h"
|
19
|
-
|
20
|
-
#include "node.h"
|
21
|
-
#include "debug.h"
|
22
|
-
#include "vm_opts.h"
|
23
|
-
#include "id.h"
|
24
|
-
|
25
|
-
#if defined(_WIN32)
|
26
|
-
#include "thread_win32.h"
|
27
|
-
#elif defined(HAVE_PTHREAD_H)
|
28
|
-
#include "thread_pthread.h"
|
29
|
-
#else
|
30
|
-
#error "unsupported thread type"
|
31
|
-
#endif
|
32
|
-
|
33
|
-
#include <setjmp.h>
|
34
|
-
#include <signal.h>
|
35
|
-
|
36
|
-
#ifndef NSIG
|
37
|
-
# define NSIG (_SIGMAX + 1) /* For QNX */
|
38
|
-
#endif
|
39
|
-
|
40
|
-
#define RUBY_NSIG NSIG
|
41
|
-
|
42
|
-
#ifdef HAVE_STDARG_PROTOTYPES
|
43
|
-
#include <stdarg.h>
|
44
|
-
#define va_init_list(a,b) va_start(a,b)
|
45
|
-
#else
|
46
|
-
#include <varargs.h>
|
47
|
-
#define va_init_list(a,b) va_start(a)
|
48
|
-
#endif
|
49
|
-
|
50
|
-
/*****************/
|
51
|
-
/* configuration */
|
52
|
-
/*****************/
|
53
|
-
|
54
|
-
/* gcc ver. check */
|
55
|
-
#if defined(__GNUC__) && __GNUC__ >= 2
|
56
|
-
|
57
|
-
#if OPT_TOKEN_THREADED_CODE
|
58
|
-
#if OPT_DIRECT_THREADED_CODE
|
59
|
-
#undef OPT_DIRECT_THREADED_CODE
|
60
|
-
#endif
|
61
|
-
#endif
|
62
|
-
|
63
|
-
#else /* defined(__GNUC__) && __GNUC__ >= 2 */
|
64
|
-
|
65
|
-
/* disable threaded code options */
|
66
|
-
#if OPT_DIRECT_THREADED_CODE
|
67
|
-
#undef OPT_DIRECT_THREADED_CODE
|
68
|
-
#endif
|
69
|
-
#if OPT_TOKEN_THREADED_CODE
|
70
|
-
#undef OPT_TOKEN_THREADED_CODE
|
71
|
-
#endif
|
72
|
-
#endif
|
73
|
-
|
74
|
-
/* call threaded code */
|
75
|
-
#if OPT_CALL_THREADED_CODE
|
76
|
-
#if OPT_DIRECT_THREADED_CODE
|
77
|
-
#undef OPT_DIRECT_THREADED_CODE
|
78
|
-
#endif /* OPT_DIRECT_THREADED_CODE */
|
79
|
-
#if OPT_STACK_CACHING
|
80
|
-
#undef OPT_STACK_CACHING
|
81
|
-
#endif /* OPT_STACK_CACHING */
|
82
|
-
#endif /* OPT_CALL_THREADED_CODE */
|
83
|
-
|
84
|
-
/* likely */
|
85
|
-
#if __GNUC__ >= 3
|
86
|
-
#define LIKELY(x) (__builtin_expect((x), 1))
|
87
|
-
#define UNLIKELY(x) (__builtin_expect((x), 0))
|
88
|
-
#else /* __GNUC__ >= 3 */
|
89
|
-
#define LIKELY(x) (x)
|
90
|
-
#define UNLIKELY(x) (x)
|
91
|
-
#endif /* __GNUC__ >= 3 */
|
92
|
-
|
93
|
-
typedef unsigned long rb_num_t;
|
94
|
-
|
95
|
-
struct iseq_compile_data_ensure_node_stack;
|
96
|
-
|
97
|
-
typedef struct rb_compile_option_struct {
|
98
|
-
int inline_const_cache;
|
99
|
-
int peephole_optimization;
|
100
|
-
int tailcall_optimization;
|
101
|
-
int specialized_instruction;
|
102
|
-
int operands_unification;
|
103
|
-
int instructions_unification;
|
104
|
-
int stack_caching;
|
105
|
-
int trace_instruction;
|
106
|
-
int debug_level;
|
107
|
-
} rb_compile_option_t;
|
108
|
-
|
109
|
-
#if 1
|
110
|
-
#define GetCoreDataFromValue(obj, type, ptr) do { \
|
111
|
-
ptr = (type*)DATA_PTR(obj); \
|
112
|
-
} while (0)
|
113
|
-
#else
|
114
|
-
#define GetCoreDataFromValue(obj, type, ptr) Data_Get_Struct(obj, type, ptr)
|
115
|
-
#endif
|
116
|
-
|
117
|
-
#define GetISeqPtr(obj, ptr) \
|
118
|
-
GetCoreDataFromValue(obj, rb_iseq_t, ptr)
|
119
|
-
|
120
|
-
struct rb_iseq_struct;
|
121
|
-
|
122
|
-
struct rb_iseq_struct {
|
123
|
-
/***************/
|
124
|
-
/* static data */
|
125
|
-
/***************/
|
126
|
-
|
127
|
-
VALUE type; /* instruction sequence type */
|
128
|
-
VALUE name; /* String: iseq name */
|
129
|
-
VALUE filename; /* file information where this sequence from */
|
130
|
-
VALUE *iseq; /* iseq (insn number and openrads) */
|
131
|
-
VALUE *iseq_encoded; /* encoded iseq */
|
132
|
-
unsigned long iseq_size;
|
133
|
-
VALUE mark_ary; /* Array: includes operands which should be GC marked */
|
134
|
-
VALUE coverage; /* coverage array */
|
135
|
-
unsigned short line_no;
|
136
|
-
|
137
|
-
/* insn info, must be freed */
|
138
|
-
struct iseq_insn_info_entry *insn_info_table;
|
139
|
-
unsigned long insn_info_size;
|
140
|
-
|
141
|
-
ID *local_table; /* must free */
|
142
|
-
int local_table_size;
|
143
|
-
|
144
|
-
/* method, class frame: sizeof(vars) + 1, block frame: sizeof(vars) */
|
145
|
-
int local_size;
|
146
|
-
|
147
|
-
/**
|
148
|
-
* argument information
|
149
|
-
*
|
150
|
-
* def m(a1, a2, ..., aM, # mandatory
|
151
|
-
* b1=(...), b2=(...), ..., bN=(...), # optinal
|
152
|
-
* *c, # rest
|
153
|
-
* d1, d2, ..., dO, # post
|
154
|
-
* &e) # block
|
155
|
-
* =>
|
156
|
-
*
|
157
|
-
* argc = M
|
158
|
-
* arg_rest = M+N+1 // or -1 if no rest arg
|
159
|
-
* arg_opts = N
|
160
|
-
* arg_opts_tbl = [ (N entries) ]
|
161
|
-
* arg_post_len = O // 0 if no post arguments
|
162
|
-
* arg_post_start = M+N+2
|
163
|
-
* arg_block = M+N + 1 + O + 1 // -1 if no block arg
|
164
|
-
* arg_simple = 0 if not simple arguments.
|
165
|
-
* = 1 if no opt, rest, post, block.
|
166
|
-
* = 2 if ambiguos block parameter ({|a|}).
|
167
|
-
* arg_size = argument size.
|
168
|
-
*/
|
169
|
-
|
170
|
-
int argc;
|
171
|
-
int arg_simple;
|
172
|
-
int arg_rest;
|
173
|
-
int arg_block;
|
174
|
-
int arg_opts;
|
175
|
-
int arg_post_len;
|
176
|
-
int arg_post_start;
|
177
|
-
int arg_size;
|
178
|
-
VALUE *arg_opt_table;
|
179
|
-
|
180
|
-
int stack_max; /* for stack overflow check */
|
181
|
-
|
182
|
-
/* catch table */
|
183
|
-
struct iseq_catch_table_entry *catch_table;
|
184
|
-
int catch_table_size;
|
185
|
-
|
186
|
-
/* for child iseq */
|
187
|
-
struct rb_iseq_struct *parent_iseq;
|
188
|
-
struct rb_iseq_struct *local_iseq;
|
189
|
-
|
190
|
-
/****************/
|
191
|
-
/* dynamic data */
|
192
|
-
/****************/
|
193
|
-
|
194
|
-
VALUE self;
|
195
|
-
VALUE orig; /* non-NULL if its data have origin */
|
196
|
-
|
197
|
-
/* block inlining */
|
198
|
-
/*
|
199
|
-
* NODE *node;
|
200
|
-
* void *special_block_builder;
|
201
|
-
* void *cached_special_block_builder;
|
202
|
-
* VALUE cached_special_block;
|
203
|
-
*/
|
204
|
-
|
205
|
-
/* klass/module nest information stack (cref) */
|
206
|
-
NODE *cref_stack;
|
207
|
-
VALUE klass;
|
208
|
-
|
209
|
-
/* misc */
|
210
|
-
ID defined_method_id; /* for define_method */
|
211
|
-
|
212
|
-
/* used at compile time */
|
213
|
-
struct iseq_compile_data *compile_data;
|
214
|
-
};
|
215
|
-
|
216
|
-
enum ruby_special_exceptions {
|
217
|
-
ruby_error_reenter,
|
218
|
-
ruby_error_nomemory,
|
219
|
-
ruby_error_sysstack,
|
220
|
-
ruby_special_error_count
|
221
|
-
};
|
222
|
-
|
223
|
-
typedef struct rb_iseq_struct rb_iseq_t;
|
224
|
-
|
225
|
-
#define GetVMPtr(obj, ptr) \
|
226
|
-
GetCoreDataFromValue(obj, rb_vm_t, ptr)
|
227
|
-
|
228
|
-
typedef struct rb_vm_struct {
|
229
|
-
VALUE self;
|
230
|
-
|
231
|
-
rb_thread_lock_t global_vm_lock;
|
232
|
-
|
233
|
-
struct rb_thread_struct *main_thread;
|
234
|
-
struct rb_thread_struct *running_thread;
|
235
|
-
|
236
|
-
st_table *living_threads;
|
237
|
-
VALUE thgroup_default;
|
238
|
-
|
239
|
-
int running;
|
240
|
-
int thread_abort_on_exception;
|
241
|
-
unsigned long trace_flag;
|
242
|
-
volatile int sleeper;
|
243
|
-
|
244
|
-
/* object management */
|
245
|
-
VALUE mark_object_ary;
|
246
|
-
|
247
|
-
VALUE special_exceptions[ruby_special_error_count];
|
248
|
-
|
249
|
-
/* load */
|
250
|
-
VALUE top_self;
|
251
|
-
VALUE load_path;
|
252
|
-
VALUE loaded_features;
|
253
|
-
struct st_table *loading_table;
|
254
|
-
|
255
|
-
/* signal */
|
256
|
-
struct {
|
257
|
-
VALUE cmd;
|
258
|
-
int safe;
|
259
|
-
} trap_list[RUBY_NSIG];
|
260
|
-
|
261
|
-
/* hook */
|
262
|
-
rb_event_hook_t *event_hooks;
|
263
|
-
|
264
|
-
int src_encoding_index;
|
265
|
-
|
266
|
-
VALUE verbose, debug, progname;
|
267
|
-
VALUE coverages;
|
268
|
-
|
269
|
-
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
|
270
|
-
struct rb_objspace *objspace;
|
271
|
-
#endif
|
272
|
-
} rb_vm_t;
|
273
|
-
|
274
|
-
typedef struct {
|
275
|
-
VALUE *pc; /* cfp[0] */
|
276
|
-
VALUE *sp; /* cfp[1] */
|
277
|
-
VALUE *bp; /* cfp[2] */
|
278
|
-
rb_iseq_t *iseq; /* cfp[3] */
|
279
|
-
VALUE flag; /* cfp[4] */
|
280
|
-
VALUE self; /* cfp[5] / block[0] */
|
281
|
-
VALUE *lfp; /* cfp[6] / block[1] */
|
282
|
-
VALUE *dfp; /* cfp[7] / block[2] */
|
283
|
-
rb_iseq_t *block_iseq; /* cfp[8] / block[3] */
|
284
|
-
VALUE proc; /* cfp[9] / block[4] */
|
285
|
-
ID method_id; /* cfp[10] saved in special case */
|
286
|
-
VALUE method_class; /* cfp[11] saved in special case */
|
287
|
-
} rb_control_frame_t;
|
288
|
-
|
289
|
-
typedef struct rb_block_struct {
|
290
|
-
VALUE self; /* share with method frame if it's only block */
|
291
|
-
VALUE *lfp; /* share with method frame if it's only block */
|
292
|
-
VALUE *dfp; /* share with method frame if it's only block */
|
293
|
-
rb_iseq_t *iseq;
|
294
|
-
VALUE proc;
|
295
|
-
} rb_block_t;
|
296
|
-
|
297
|
-
#define GetThreadPtr(obj, ptr) \
|
298
|
-
GetCoreDataFromValue(obj, rb_thread_t, ptr)
|
299
|
-
|
300
|
-
enum rb_thread_status {
|
301
|
-
THREAD_TO_KILL,
|
302
|
-
THREAD_RUNNABLE,
|
303
|
-
THREAD_STOPPED,
|
304
|
-
THREAD_STOPPED_FOREVER,
|
305
|
-
THREAD_KILLED
|
306
|
-
};
|
307
|
-
|
308
|
-
typedef RUBY_JMP_BUF rb_jmpbuf_t;
|
309
|
-
|
310
|
-
struct rb_vm_tag {
|
311
|
-
rb_jmpbuf_t buf;
|
312
|
-
VALUE tag;
|
313
|
-
VALUE retval;
|
314
|
-
struct rb_vm_tag *prev;
|
315
|
-
};
|
316
|
-
|
317
|
-
struct rb_vm_trap_tag {
|
318
|
-
struct rb_vm_trap_tag *prev;
|
319
|
-
};
|
320
|
-
|
321
|
-
#define RUBY_VM_VALUE_CACHE_SIZE 0x1000
|
322
|
-
#define USE_VALUE_CACHE 0
|
323
|
-
|
324
|
-
struct rb_unblock_callback {
|
325
|
-
rb_unblock_function_t *func;
|
326
|
-
void *arg;
|
327
|
-
};
|
328
|
-
|
329
|
-
struct rb_mutex_struct;
|
330
|
-
|
331
|
-
typedef struct rb_thread_struct
|
332
|
-
{
|
333
|
-
VALUE self;
|
334
|
-
rb_vm_t *vm;
|
335
|
-
|
336
|
-
/* execution information */
|
337
|
-
VALUE *stack; /* must free, must mark */
|
338
|
-
unsigned long stack_size;
|
339
|
-
rb_control_frame_t *cfp;
|
340
|
-
int safe_level;
|
341
|
-
int raised_flag;
|
342
|
-
VALUE last_status; /* $? */
|
343
|
-
|
344
|
-
/* passing state */
|
345
|
-
int state;
|
346
|
-
|
347
|
-
/* for rb_iterate */
|
348
|
-
rb_block_t *passed_block;
|
349
|
-
|
350
|
-
/* for load(true) */
|
351
|
-
VALUE top_self;
|
352
|
-
VALUE top_wrapper;
|
353
|
-
|
354
|
-
/* eval env */
|
355
|
-
rb_block_t *base_block;
|
356
|
-
|
357
|
-
VALUE *local_lfp;
|
358
|
-
VALUE local_svar;
|
359
|
-
|
360
|
-
/* thread control */
|
361
|
-
rb_thread_id_t thread_id;
|
362
|
-
enum rb_thread_status status;
|
363
|
-
int priority;
|
364
|
-
int slice;
|
365
|
-
|
366
|
-
native_thread_data_t native_thread_data;
|
367
|
-
void *blocking_region_buffer;
|
368
|
-
|
369
|
-
VALUE thgroup;
|
370
|
-
VALUE value;
|
371
|
-
|
372
|
-
VALUE errinfo;
|
373
|
-
VALUE thrown_errinfo;
|
374
|
-
int exec_signal;
|
375
|
-
|
376
|
-
int interrupt_flag;
|
377
|
-
rb_thread_lock_t interrupt_lock;
|
378
|
-
struct rb_unblock_callback unblock;
|
379
|
-
VALUE locking_mutex;
|
380
|
-
struct rb_mutex_struct *keeping_mutexes;
|
381
|
-
int transition_for_lock;
|
382
|
-
|
383
|
-
struct rb_vm_tag *tag;
|
384
|
-
struct rb_vm_trap_tag *trap_tag;
|
385
|
-
|
386
|
-
int parse_in_eval;
|
387
|
-
int mild_compile_error;
|
388
|
-
|
389
|
-
/* storage */
|
390
|
-
st_table *local_storage;
|
391
|
-
#if USE_VALUE_CACHE
|
392
|
-
VALUE value_cache[RUBY_VM_VALUE_CACHE_SIZE + 1];
|
393
|
-
VALUE *value_cache_ptr;
|
394
|
-
#endif
|
395
|
-
|
396
|
-
struct rb_thread_struct *join_list_next;
|
397
|
-
struct rb_thread_struct *join_list_head;
|
398
|
-
|
399
|
-
VALUE first_proc;
|
400
|
-
VALUE first_args;
|
401
|
-
VALUE (*first_func)(ANYARGS);
|
402
|
-
|
403
|
-
/* for GC */
|
404
|
-
VALUE *machine_stack_start;
|
405
|
-
VALUE *machine_stack_end;
|
406
|
-
size_t machine_stack_maxsize;
|
407
|
-
#ifdef __ia64
|
408
|
-
VALUE *machine_register_stack_start;
|
409
|
-
VALUE *machine_register_stack_end;
|
410
|
-
size_t machine_register_stack_maxsize;
|
411
|
-
#endif
|
412
|
-
jmp_buf machine_regs;
|
413
|
-
int mark_stack_len;
|
414
|
-
|
415
|
-
/* statistics data for profiler */
|
416
|
-
VALUE stat_insn_usage;
|
417
|
-
|
418
|
-
/* tracer */
|
419
|
-
rb_event_hook_t *event_hooks;
|
420
|
-
rb_event_flag_t event_flags;
|
421
|
-
int tracing;
|
422
|
-
|
423
|
-
/* fiber */
|
424
|
-
VALUE fiber;
|
425
|
-
VALUE root_fiber;
|
426
|
-
rb_jmpbuf_t root_jmpbuf;
|
427
|
-
|
428
|
-
/* misc */
|
429
|
-
int method_missing_reason;
|
430
|
-
int abort_on_exception;
|
431
|
-
} rb_thread_t;
|
432
|
-
|
433
|
-
/* iseq.c */
|
434
|
-
VALUE rb_iseq_new(NODE*, VALUE, VALUE, VALUE, VALUE);
|
435
|
-
VALUE rb_iseq_new_top(NODE *node, VALUE name, VALUE filename, VALUE parent);
|
436
|
-
VALUE rb_iseq_new_main(NODE *node, VALUE filename);
|
437
|
-
VALUE rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
|
438
|
-
VALUE rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, const rb_compile_option_t*);
|
439
|
-
VALUE rb_iseq_compile(VALUE src, VALUE file, VALUE line);
|
440
|
-
VALUE rb_iseq_disasm(VALUE self);
|
441
|
-
VALUE rb_iseq_disasm_insn(VALUE str, VALUE *iseqval, int pos, rb_iseq_t *iseq, VALUE child);
|
442
|
-
const char *ruby_node_name(int node);
|
443
|
-
int rb_iseq_first_lineno(rb_iseq_t *iseq);
|
444
|
-
|
445
|
-
RUBY_EXTERN VALUE rb_cISeq;
|
446
|
-
RUBY_EXTERN VALUE rb_cRubyVM;
|
447
|
-
RUBY_EXTERN VALUE rb_cEnv;
|
448
|
-
RUBY_EXTERN VALUE rb_mRubyVMFrozenCore;
|
449
|
-
|
450
|
-
/* each thread has this size stack : 128KB */
|
451
|
-
#define RUBY_VM_THREAD_STACK_SIZE (128 * 1024)
|
452
|
-
|
453
|
-
struct global_entry {
|
454
|
-
struct global_variable *var;
|
455
|
-
ID id;
|
456
|
-
};
|
457
|
-
|
458
|
-
#define GetProcPtr(obj, ptr) \
|
459
|
-
GetCoreDataFromValue(obj, rb_proc_t, ptr)
|
460
|
-
|
461
|
-
typedef struct {
|
462
|
-
rb_block_t block;
|
463
|
-
|
464
|
-
VALUE envval; /* for GC mark */
|
465
|
-
VALUE blockprocval;
|
466
|
-
int safe_level;
|
467
|
-
int is_from_method;
|
468
|
-
int is_lambda;
|
469
|
-
} rb_proc_t;
|
470
|
-
|
471
|
-
#define GetEnvPtr(obj, ptr) \
|
472
|
-
GetCoreDataFromValue(obj, rb_env_t, ptr)
|
473
|
-
|
474
|
-
typedef struct {
|
475
|
-
VALUE *env;
|
476
|
-
int env_size;
|
477
|
-
int local_size;
|
478
|
-
VALUE prev_envval; /* for GC mark */
|
479
|
-
rb_block_t block;
|
480
|
-
} rb_env_t;
|
481
|
-
|
482
|
-
#define GetBindingPtr(obj, ptr) \
|
483
|
-
GetCoreDataFromValue(obj, rb_binding_t, ptr)
|
484
|
-
|
485
|
-
typedef struct {
|
486
|
-
VALUE env;
|
487
|
-
} rb_binding_t;
|
488
|
-
|
489
|
-
|
490
|
-
/* used by compile time and send insn */
|
491
|
-
#define VM_CALL_ARGS_SPLAT_BIT (0x01 << 1)
|
492
|
-
#define VM_CALL_ARGS_BLOCKARG_BIT (0x01 << 2)
|
493
|
-
#define VM_CALL_FCALL_BIT (0x01 << 3)
|
494
|
-
#define VM_CALL_VCALL_BIT (0x01 << 4)
|
495
|
-
#define VM_CALL_TAILCALL_BIT (0x01 << 5)
|
496
|
-
#define VM_CALL_TAILRECURSION_BIT (0x01 << 6)
|
497
|
-
#define VM_CALL_SUPER_BIT (0x01 << 7)
|
498
|
-
#define VM_CALL_SEND_BIT (0x01 << 8)
|
499
|
-
|
500
|
-
#define VM_SPECIAL_OBJECT_VMCORE 0x01
|
501
|
-
#define VM_SPECIAL_OBJECT_CBASE 0x02
|
502
|
-
|
503
|
-
#define VM_FRAME_MAGIC_METHOD 0x11
|
504
|
-
#define VM_FRAME_MAGIC_BLOCK 0x21
|
505
|
-
#define VM_FRAME_MAGIC_CLASS 0x31
|
506
|
-
#define VM_FRAME_MAGIC_TOP 0x41
|
507
|
-
#define VM_FRAME_MAGIC_FINISH 0x51
|
508
|
-
#define VM_FRAME_MAGIC_CFUNC 0x61
|
509
|
-
#define VM_FRAME_MAGIC_PROC 0x71
|
510
|
-
#define VM_FRAME_MAGIC_IFUNC 0x81
|
511
|
-
#define VM_FRAME_MAGIC_EVAL 0x91
|
512
|
-
#define VM_FRAME_MAGIC_LAMBDA 0xa1
|
513
|
-
#define VM_FRAME_MAGIC_MASK_BITS 8
|
514
|
-
#define VM_FRAME_MAGIC_MASK (~(~0<<VM_FRAME_MAGIC_MASK_BITS))
|
515
|
-
|
516
|
-
#define VM_FRAME_TYPE(cfp) ((cfp)->flag & VM_FRAME_MAGIC_MASK)
|
517
|
-
|
518
|
-
/* other frame flag */
|
519
|
-
#define VM_FRAME_FLAG_PASSED 0x0100
|
520
|
-
|
521
|
-
|
522
|
-
#define RUBYVM_CFUNC_FRAME_P(cfp) \
|
523
|
-
(VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
|
524
|
-
|
525
|
-
|
526
|
-
/* inline (method|const) cache */
|
527
|
-
#define NEW_INLINE_CACHE_ENTRY() NEW_WHILE(Qundef, 0, 0)
|
528
|
-
#define ic_class u1.value
|
529
|
-
#define ic_method u2.node
|
530
|
-
#define ic_value u2.value
|
531
|
-
#define ic_vmstat u3.cnt
|
532
|
-
typedef NODE *IC;
|
533
|
-
|
534
|
-
void rb_vm_change_state(void);
|
535
|
-
|
536
|
-
typedef VALUE CDHASH;
|
537
|
-
|
538
|
-
#ifndef FUNC_FASTCALL
|
539
|
-
#define FUNC_FASTCALL(x) x
|
540
|
-
#endif
|
541
|
-
|
542
|
-
typedef rb_control_frame_t *
|
543
|
-
(FUNC_FASTCALL(*rb_insn_func_t))(rb_thread_t *, rb_control_frame_t *);
|
544
|
-
|
545
|
-
#define GC_GUARDED_PTR(p) ((VALUE)((VALUE)(p) | 0x01))
|
546
|
-
#define GC_GUARDED_PTR_REF(p) ((void *)(((VALUE)p) & ~0x03))
|
547
|
-
#define GC_GUARDED_PTR_P(p) (((VALUE)p) & 0x01)
|
548
|
-
|
549
|
-
#define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp) (cfp+1)
|
550
|
-
#define RUBY_VM_NEXT_CONTROL_FRAME(cfp) (cfp-1)
|
551
|
-
#define RUBY_VM_END_CONTROL_FRAME(th) \
|
552
|
-
((rb_control_frame_t *)((th)->stack + (th)->stack_size))
|
553
|
-
#define RUBY_VM_VALID_CONTROL_FRAME_P(cfp, ecfp) \
|
554
|
-
((void *)(ecfp) > (void *)(cfp))
|
555
|
-
#define RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp) \
|
556
|
-
(!RUBY_VM_VALID_CONTROL_FRAME_P((cfp), RUBY_VM_END_CONTROL_FRAME(th)))
|
557
|
-
|
558
|
-
#define RUBY_VM_IFUNC_P(ptr) (BUILTIN_TYPE(ptr) == T_NODE)
|
559
|
-
#define RUBY_VM_NORMAL_ISEQ_P(ptr) \
|
560
|
-
(ptr && !RUBY_VM_IFUNC_P(ptr))
|
561
|
-
|
562
|
-
#define RUBY_VM_CLASS_SPECIAL_P(ptr) (((VALUE)(ptr)) & 0x02)
|
563
|
-
|
564
|
-
#define RUBY_VM_GET_BLOCK_PTR_IN_CFP(cfp) ((rb_block_t *)(&(cfp)->self))
|
565
|
-
#define RUBY_VM_GET_CFP_FROM_BLOCK_PTR(b) \
|
566
|
-
((rb_control_frame_t *)((VALUE *)(b) - 5))
|
567
|
-
|
568
|
-
/* VM related object allocate functions */
|
569
|
-
VALUE rb_thread_alloc(VALUE klass);
|
570
|
-
VALUE rb_proc_alloc(VALUE klass);
|
571
|
-
|
572
|
-
/* for debug */
|
573
|
-
extern void rb_vmdebug_stack_dump_raw(rb_thread_t *, rb_control_frame_t *);
|
574
|
-
#define SDR() rb_vmdebug_stack_dump_raw(GET_THREAD(), GET_THREAD()->cfp)
|
575
|
-
#define SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_THREAD(), (cfp))
|
576
|
-
void rb_vm_bugreport(void);
|
577
|
-
|
578
|
-
|
579
|
-
/* functions about thread/vm execution */
|
580
|
-
|
581
|
-
VALUE rb_iseq_eval(VALUE iseqval);
|
582
|
-
VALUE rb_iseq_eval_main(VALUE iseqval);
|
583
|
-
void rb_enable_interrupt(void);
|
584
|
-
void rb_disable_interrupt(void);
|
585
|
-
int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, VALUE *klassp);
|
586
|
-
|
587
|
-
VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
|
588
|
-
int argc, const VALUE *argv, rb_block_t *blockptr);
|
589
|
-
VALUE rb_vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass);
|
590
|
-
VALUE rb_vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp);
|
591
|
-
|
592
|
-
void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
|
593
|
-
int ruby_thread_has_gvl_p(void);
|
594
|
-
rb_control_frame_t *rb_vm_get_ruby_level_next_cfp(rb_thread_t *th, rb_control_frame_t *cfp);
|
595
|
-
|
596
|
-
NOINLINE(void rb_gc_save_machine_context(rb_thread_t *));
|
597
|
-
|
598
|
-
#define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]
|
599
|
-
|
600
|
-
/* for thread */
|
601
|
-
|
602
|
-
#if RUBY_VM_THREAD_MODEL == 2
|
603
|
-
RUBY_EXTERN rb_thread_t *ruby_current_thread;
|
604
|
-
extern rb_vm_t *ruby_current_vm;
|
605
|
-
|
606
|
-
#define GET_VM() ruby_current_vm
|
607
|
-
#define GET_THREAD() ruby_current_thread
|
608
|
-
#define rb_thread_set_current_raw(th) (void)(ruby_current_thread = (th))
|
609
|
-
#define rb_thread_set_current(th) do { \
|
610
|
-
rb_thread_set_current_raw(th); \
|
611
|
-
th->vm->running_thread = th; \
|
612
|
-
} while (0)
|
613
|
-
|
614
|
-
#else
|
615
|
-
#error "unsupported thread model"
|
616
|
-
#endif
|
617
|
-
|
618
|
-
#define RUBY_VM_SET_INTERRUPT(th) ((th)->interrupt_flag |= 0x02)
|
619
|
-
#define RUBY_VM_SET_TIMER_INTERRUPT(th) ((th)->interrupt_flag |= 0x01)
|
620
|
-
#define RUBY_VM_SET_FINALIZER_INTERRUPT(th) ((th)->interrupt_flag |= 0x04)
|
621
|
-
#define RUBY_VM_INTERRUPTED(th) ((th)->interrupt_flag & 0x02)
|
622
|
-
|
623
|
-
void rb_thread_execute_interrupts(rb_thread_t *);
|
624
|
-
|
625
|
-
#define RUBY_VM_CHECK_INTS_TH(th) do { \
|
626
|
-
if (UNLIKELY(th->interrupt_flag)) { \
|
627
|
-
rb_thread_execute_interrupts(th); \
|
628
|
-
} \
|
629
|
-
} while (0)
|
630
|
-
|
631
|
-
#define RUBY_VM_CHECK_INTS() \
|
632
|
-
RUBY_VM_CHECK_INTS_TH(GET_THREAD())
|
633
|
-
|
634
|
-
/* tracer */
|
635
|
-
void
|
636
|
-
rb_threadptr_exec_event_hooks(rb_thread_t *th, rb_event_flag_t flag, VALUE self, ID id, VALUE klass);
|
637
|
-
|
638
|
-
#define EXEC_EVENT_HOOK(th, flag, self, id, klass) do { \
|
639
|
-
rb_event_flag_t wait_event__ = th->event_flags; \
|
640
|
-
if (UNLIKELY(wait_event__)) { \
|
641
|
-
if (wait_event__ & (flag | RUBY_EVENT_VM)) { \
|
642
|
-
rb_threadptr_exec_event_hooks(th, flag, self, id, klass); \
|
643
|
-
} \
|
644
|
-
} \
|
645
|
-
} while (0)
|
646
|
-
|
647
|
-
#endif /* RUBY_VM_CORE_H */
|