binding_of_caller 0.7.2 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +5 -5
  2. data/.gemtest +0 -0
  3. data/.github/workflows/test.yml +108 -0
  4. data/.gitignore +12 -7
  5. data/.yardopts +0 -0
  6. data/Gemfile +6 -1
  7. data/LICENSE +0 -0
  8. data/README.md +17 -5
  9. data/Rakefile +4 -132
  10. data/binding_of_caller.gemspec +33 -35
  11. data/lib/binding_of_caller/jruby_interpreted.rb +123 -0
  12. data/lib/binding_of_caller/{mri2.rb → mri.rb} +8 -14
  13. data/lib/binding_of_caller/rubinius.rb +21 -28
  14. data/lib/binding_of_caller/version.rb +1 -1
  15. data/lib/binding_of_caller.rb +9 -10
  16. metadata +33 -109
  17. data/.travis.yml +0 -23
  18. data/HISTORY +0 -0
  19. data/examples/example.rb +0 -41
  20. data/ext/binding_of_caller/binding_of_caller.c +0 -225
  21. data/ext/binding_of_caller/extconf.rb +0 -33
  22. data/ext/binding_of_caller/ruby_headers/192/debug.h +0 -36
  23. data/ext/binding_of_caller/ruby_headers/192/dln.h +0 -41
  24. data/ext/binding_of_caller/ruby_headers/192/eval_intern.h +0 -232
  25. data/ext/binding_of_caller/ruby_headers/192/id.h +0 -173
  26. data/ext/binding_of_caller/ruby_headers/192/iseq.h +0 -104
  27. data/ext/binding_of_caller/ruby_headers/192/method.h +0 -103
  28. data/ext/binding_of_caller/ruby_headers/192/node.h +0 -483
  29. data/ext/binding_of_caller/ruby_headers/192/regenc.h +0 -211
  30. data/ext/binding_of_caller/ruby_headers/192/regint.h +0 -841
  31. data/ext/binding_of_caller/ruby_headers/192/regparse.h +0 -354
  32. data/ext/binding_of_caller/ruby_headers/192/rubys_gc.h +0 -77
  33. data/ext/binding_of_caller/ruby_headers/192/thread_pthread.h +0 -27
  34. data/ext/binding_of_caller/ruby_headers/192/thread_win32.h +0 -33
  35. data/ext/binding_of_caller/ruby_headers/192/timev.h +0 -21
  36. data/ext/binding_of_caller/ruby_headers/192/transcode_data.h +0 -109
  37. data/ext/binding_of_caller/ruby_headers/192/version.h +0 -55
  38. data/ext/binding_of_caller/ruby_headers/192/vm_core.h +0 -703
  39. data/ext/binding_of_caller/ruby_headers/192/vm_exec.h +0 -184
  40. data/ext/binding_of_caller/ruby_headers/192/vm_insnhelper.h +0 -208
  41. data/ext/binding_of_caller/ruby_headers/192/vm_opts.h +0 -51
  42. data/ext/binding_of_caller/ruby_headers/193/addr2line.h +0 -21
  43. data/ext/binding_of_caller/ruby_headers/193/atomic.h +0 -56
  44. data/ext/binding_of_caller/ruby_headers/193/constant.h +0 -34
  45. data/ext/binding_of_caller/ruby_headers/193/debug.h +0 -41
  46. data/ext/binding_of_caller/ruby_headers/193/dln.h +0 -50
  47. data/ext/binding_of_caller/ruby_headers/193/encdb.h +0 -167
  48. data/ext/binding_of_caller/ruby_headers/193/eval_intern.h +0 -234
  49. data/ext/binding_of_caller/ruby_headers/193/id.h +0 -175
  50. data/ext/binding_of_caller/ruby_headers/193/internal.h +0 -227
  51. data/ext/binding_of_caller/ruby_headers/193/iseq.h +0 -125
  52. data/ext/binding_of_caller/ruby_headers/193/method.h +0 -105
  53. data/ext/binding_of_caller/ruby_headers/193/node.h +0 -503
  54. data/ext/binding_of_caller/ruby_headers/193/parse.h +0 -186
  55. data/ext/binding_of_caller/ruby_headers/193/regenc.h +0 -219
  56. data/ext/binding_of_caller/ruby_headers/193/regint.h +0 -851
  57. data/ext/binding_of_caller/ruby_headers/193/regparse.h +0 -362
  58. data/ext/binding_of_caller/ruby_headers/193/revision.h +0 -1
  59. data/ext/binding_of_caller/ruby_headers/193/rubys_gc.h +0 -98
  60. data/ext/binding_of_caller/ruby_headers/193/thread_pthread.h +0 -51
  61. data/ext/binding_of_caller/ruby_headers/193/thread_win32.h +0 -40
  62. data/ext/binding_of_caller/ruby_headers/193/timev.h +0 -21
  63. data/ext/binding_of_caller/ruby_headers/193/transcode_data.h +0 -117
  64. data/ext/binding_of_caller/ruby_headers/193/transdb.h +0 -189
  65. data/ext/binding_of_caller/ruby_headers/193/version.h +0 -52
  66. data/ext/binding_of_caller/ruby_headers/193/vm_core.h +0 -755
  67. data/ext/binding_of_caller/ruby_headers/193/vm_exec.h +0 -184
  68. data/ext/binding_of_caller/ruby_headers/193/vm_insnhelper.h +0 -220
  69. data/ext/binding_of_caller/ruby_headers/193/vm_opts.h +0 -51
  70. data/test/test_binding_of_caller.rb +0 -161
@@ -1,232 +0,0 @@
1
- #ifndef RUBY_EVAL_INTERN_H
2
- #define RUBY_EVAL_INTERN_H
3
-
4
- #include "ruby/ruby.h"
5
- #include "vm_core.h"
6
-
7
- #define PASS_PASSED_BLOCK_TH(th) do { \
8
- (th)->passed_block = GC_GUARDED_PTR_REF((rb_block_t *)(th)->cfp->lfp[0]); \
9
- (th)->cfp->flag |= VM_FRAME_FLAG_PASSED; \
10
- } while (0)
11
-
12
- #define PASS_PASSED_BLOCK() do { \
13
- rb_thread_t * const __th__ = GET_THREAD(); \
14
- PASS_PASSED_BLOCK_TH(__th__); \
15
- } while (0)
16
-
17
- #ifdef HAVE_STDLIB_H
18
- #include <stdlib.h>
19
- #endif
20
- #ifndef EXIT_SUCCESS
21
- #define EXIT_SUCCESS 0
22
- #endif
23
- #ifndef EXIT_FAILURE
24
- #define EXIT_FAILURE 1
25
- #endif
26
-
27
- #include <stdio.h>
28
- #include <setjmp.h>
29
-
30
- #ifdef __APPLE__
31
- #include <crt_externs.h>
32
- #endif
33
-
34
- /* Make alloca work the best possible way. */
35
- #ifdef __GNUC__
36
- # ifndef atarist
37
- # ifndef alloca
38
- # define alloca __builtin_alloca
39
- # endif
40
- # endif /* atarist */
41
- #else
42
- # ifdef HAVE_ALLOCA_H
43
- # include <alloca.h>
44
- # else
45
- # ifdef _AIX
46
- #pragma alloca
47
- # else
48
- # ifndef alloca /* predefined by HP cc +Olibcalls */
49
- void *alloca();
50
- # endif
51
- # endif /* AIX */
52
- # endif /* HAVE_ALLOCA_H */
53
- #endif /* __GNUC__ */
54
-
55
- #ifndef HAVE_STRING_H
56
- char *strrchr(const char *, const char);
57
- #endif
58
-
59
- #ifdef HAVE_UNISTD_H
60
- #include <unistd.h>
61
- #endif
62
-
63
- #ifdef HAVE_NET_SOCKET_H
64
- #include <net/socket.h>
65
- #endif
66
-
67
- #define ruby_setjmp(env) RUBY_SETJMP(env)
68
- #define ruby_longjmp(env,val) RUBY_LONGJMP(env,val)
69
- #ifdef __CYGWIN__
70
- # ifndef _setjmp
71
- int _setjmp(jmp_buf);
72
- # endif
73
- # ifndef _longjmp
74
- NORETURN(void _longjmp(jmp_buf, int));
75
- # endif
76
- #endif
77
-
78
- #include <sys/types.h>
79
- #include <signal.h>
80
- #include <errno.h>
81
-
82
- #ifdef HAVE_SYS_SELECT_H
83
- #include <sys/select.h>
84
- #endif
85
-
86
- /*
87
- Solaris sys/select.h switches select to select_large_fdset to support larger
88
- file descriptors if FD_SETSIZE is larger than 1024 on 32bit environment.
89
- But Ruby doesn't change FD_SETSIZE because fd_set is allocated dynamically.
90
- So following definition is required to use select_large_fdset.
91
- */
92
- #ifdef HAVE_SELECT_LARGE_FDSET
93
- #define select(n, r, w, e, t) select_large_fdset(n, r, w, e, t)
94
- #endif
95
-
96
- #ifdef HAVE_SYS_PARAM_H
97
- #include <sys/param.h>
98
- #endif
99
-
100
- #include <sys/stat.h>
101
-
102
- #define SAVE_ROOT_JMPBUF(th, stmt) do \
103
- if (ruby_setjmp((th)->root_jmpbuf) == 0) { \
104
- stmt; \
105
- } \
106
- else { \
107
- rb_fiber_start(); \
108
- } while (0)
109
-
110
- #define TH_PUSH_TAG(th) do { \
111
- rb_thread_t * const _th = th; \
112
- struct rb_vm_tag _tag; \
113
- _tag.tag = 0; \
114
- _tag.prev = _th->tag; \
115
- _th->tag = &_tag;
116
-
117
- #define TH_POP_TAG() \
118
- _th->tag = _tag.prev; \
119
- } while (0)
120
-
121
- #define TH_POP_TAG2() \
122
- _th->tag = _tag.prev
123
-
124
- #define PUSH_TAG() TH_PUSH_TAG(GET_THREAD())
125
- #define POP_TAG() TH_POP_TAG()
126
-
127
- #define TH_EXEC_TAG() ruby_setjmp(_th->tag->buf)
128
-
129
- #define EXEC_TAG() \
130
- TH_EXEC_TAG()
131
-
132
- #define TH_JUMP_TAG(th, st) do { \
133
- ruby_longjmp(th->tag->buf,(st)); \
134
- } while (0)
135
-
136
- #define JUMP_TAG(st) TH_JUMP_TAG(GET_THREAD(), st)
137
-
138
- enum ruby_tag_type {
139
- RUBY_TAG_RETURN = 0x1,
140
- RUBY_TAG_BREAK = 0x2,
141
- RUBY_TAG_NEXT = 0x3,
142
- RUBY_TAG_RETRY = 0x4,
143
- RUBY_TAG_REDO = 0x5,
144
- RUBY_TAG_RAISE = 0x6,
145
- RUBY_TAG_THROW = 0x7,
146
- RUBY_TAG_FATAL = 0x8,
147
- RUBY_TAG_MASK = 0xf
148
- };
149
- #define TAG_RETURN RUBY_TAG_RETURN
150
- #define TAG_BREAK RUBY_TAG_BREAK
151
- #define TAG_NEXT RUBY_TAG_NEXT
152
- #define TAG_RETRY RUBY_TAG_RETRY
153
- #define TAG_REDO RUBY_TAG_REDO
154
- #define TAG_RAISE RUBY_TAG_RAISE
155
- #define TAG_THROW RUBY_TAG_THROW
156
- #define TAG_FATAL RUBY_TAG_FATAL
157
- #define TAG_MASK RUBY_TAG_MASK
158
-
159
- #define NEW_THROW_OBJECT(val, pt, st) \
160
- ((VALUE)rb_node_newnode(NODE_LIT, (VALUE)(val), (VALUE)(pt), (VALUE)(st)))
161
- #define SET_THROWOBJ_CATCH_POINT(obj, val) \
162
- (RNODE((obj))->u2.value = (val))
163
- #define SET_THROWOBJ_STATE(obj, val) \
164
- (RNODE((obj))->u3.value = (val))
165
-
166
- #define GET_THROWOBJ_VAL(obj) ((VALUE)RNODE((obj))->u1.value)
167
- #define GET_THROWOBJ_CATCH_POINT(obj) ((VALUE*)RNODE((obj))->u2.value)
168
- #define GET_THROWOBJ_STATE(obj) ((int)RNODE((obj))->u3.value)
169
-
170
- #define SCOPE_TEST(f) (rb_vm_cref()->nd_visi & (f))
171
- #define SCOPE_CHECK(f) (rb_vm_cref()->nd_visi == (f))
172
- #define SCOPE_SET(f) (rb_vm_cref()->nd_visi = (f))
173
-
174
- #define CHECK_STACK_OVERFLOW(cfp, margin) do \
175
- if (((VALUE *)(cfp)->sp) + (margin) + sizeof(rb_control_frame_t) >= ((VALUE *)cfp)) { \
176
- rb_exc_raise(sysstack_error); \
177
- } \
178
- while (0)
179
-
180
- void rb_thread_cleanup(void);
181
- void rb_thread_wait_other_threads(void);
182
-
183
- enum {
184
- RAISED_EXCEPTION = 1,
185
- RAISED_STACKOVERFLOW = 2,
186
- RAISED_NOMEMORY = 4
187
- };
188
- int rb_threadptr_set_raised(rb_thread_t *th);
189
- int rb_threadptr_reset_raised(rb_thread_t *th);
190
- #define rb_thread_raised_set(th, f) ((th)->raised_flag |= (f))
191
- #define rb_thread_raised_reset(th, f) ((th)->raised_flag &= ~(f))
192
- #define rb_thread_raised_p(th, f) (((th)->raised_flag & (f)) != 0)
193
- #define rb_thread_raised_clear(th) ((th)->raised_flag = 0)
194
-
195
- VALUE rb_f_eval(int argc, VALUE *argv, VALUE self);
196
- VALUE rb_make_exception(int argc, VALUE *argv);
197
-
198
- NORETURN(void rb_fiber_start(void));
199
-
200
- NORETURN(void rb_print_undef(VALUE, ID, int));
201
- NORETURN(void rb_vm_localjump_error(const char *,VALUE, int));
202
- NORETURN(void rb_vm_jump_tag_but_local_jump(int, VALUE));
203
- NORETURN(void rb_raise_method_missing(rb_thread_t *th, int argc, VALUE *argv,
204
- VALUE obj, int call_status));
205
-
206
- VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val);
207
- NODE *rb_vm_cref(void);
208
- VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, const rb_block_t *blockptr, VALUE filename, VALUE filepath);
209
- void rb_vm_set_progname(VALUE filename);
210
- void rb_thread_terminate_all(void);
211
- VALUE rb_vm_top_self();
212
- VALUE rb_vm_cbase(void);
213
- int rb_vm_get_sourceline(const rb_control_frame_t *);
214
- void rb_trap_restore_mask(void);
215
-
216
- #ifndef CharNext /* defined as CharNext[AW] on Windows. */
217
- #define CharNext(p) ((p) + mblen(p, RUBY_MBCHAR_MAXSIZE))
218
- #endif
219
-
220
- #if defined DOSISH || defined __CYGWIN__
221
- static inline void
222
- translit_char(char *p, int from, int to)
223
- {
224
- while (*p) {
225
- if ((unsigned char)*p == from)
226
- *p = to;
227
- p = CharNext(p);
228
- }
229
- }
230
- #endif
231
-
232
- #endif /* RUBY_EVAL_INTERN_H */
@@ -1,173 +0,0 @@
1
- /* DO NOT EDIT THIS FILE DIRECTLY */
2
- /**********************************************************************
3
-
4
- id.h -
5
-
6
- $Author$
7
- created at: Sun Oct 19 21:12:51 2008
8
-
9
- Copyright (C) 2007 Koichi Sasada
10
-
11
- **********************************************************************/
12
-
13
- #ifndef RUBY_ID_H
14
- #define RUBY_ID_H
15
-
16
- #define ID_SCOPE_SHIFT 3
17
- #define ID_SCOPE_MASK 0x07
18
- #define ID_LOCAL 0x00
19
- #define ID_INSTANCE 0x01
20
- #define ID_GLOBAL 0x03
21
- #define ID_ATTRSET 0x04
22
- #define ID_CONST 0x05
23
- #define ID_CLASS 0x06
24
- #define ID_JUNK 0x07
25
- #define ID_INTERNAL ID_JUNK
26
-
27
- #ifdef USE_PARSE_H
28
- #include "parse.h"
29
- #endif
30
-
31
- #define symIFUNC ID2SYM(idIFUNC)
32
- #define symCFUNC ID2SYM(idCFUNC)
33
-
34
- #if !defined tLAST_TOKEN && defined YYTOKENTYPE
35
- #define tLAST_TOKEN tLAST_TOKEN
36
- #endif
37
-
38
- enum ruby_method_ids {
39
- #ifndef tLAST_TOKEN
40
- tUPLUS = 321,
41
- tUMINUS = 322,
42
- tPOW = 323,
43
- tCMP = 324,
44
- tEQ = 325,
45
- tEQQ = 326,
46
- tNEQ = 327,
47
- tGEQ = 328,
48
- tLEQ = 329,
49
- tANDOP = 330,
50
- tOROP = 331,
51
- tMATCH = 332,
52
- tNMATCH = 333,
53
- tDOT2 = 334,
54
- tDOT3 = 335,
55
- tAREF = 336,
56
- tASET = 337,
57
- tLSHFT = 338,
58
- tRSHFT = 339,
59
- tLAMBDA = 352,
60
- idNULL = 365,
61
- idRespond_to = 366,
62
- idIFUNC = 367,
63
- idCFUNC = 368,
64
- id_core_set_method_alias = 369,
65
- id_core_set_variable_alias = 370,
66
- id_core_undef_method = 371,
67
- id_core_define_method = 372,
68
- id_core_define_singleton_method = 373,
69
- id_core_set_postexe = 374,
70
- tLAST_TOKEN = 375,
71
- #endif
72
- idDot2 = tDOT2,
73
- idDot3 = tDOT3,
74
- idUPlus = tUPLUS,
75
- idUMinus = tUMINUS,
76
- idPow = tPOW,
77
- idCmp = tCMP,
78
- idPLUS = '+',
79
- idMINUS = '-',
80
- idMULT = '*',
81
- idDIV = '/',
82
- idMOD = '%',
83
- idLT = '<',
84
- idLTLT = tLSHFT,
85
- idLE = tLEQ,
86
- idGT = '>',
87
- idGE = tGEQ,
88
- idEq = tEQ,
89
- idEqq = tEQQ,
90
- idNeq = tNEQ,
91
- idNot = '!',
92
- idBackquote = '`',
93
- idEqTilde = tMATCH,
94
- idNeqTilde = tNMATCH,
95
- idAREF = tAREF,
96
- idASET = tASET,
97
- idLAST_TOKEN = tLAST_TOKEN >> ID_SCOPE_SHIFT,
98
- tIntern,
99
- tMethodMissing,
100
- tLength,
101
- tSize,
102
- tGets,
103
- tSucc,
104
- tEach,
105
- tLambda,
106
- tSend,
107
- t__send__,
108
- tInitialize,
109
- tUScore,
110
- #if SUPPORT_JOKE
111
- tBitblt,
112
- tAnswer,
113
- #endif
114
- tLAST_ID,
115
- #define TOKEN2ID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_LOCAL)
116
- #if SUPPORT_JOKE
117
- TOKEN2ID(Bitblt),
118
- TOKEN2ID(Answer),
119
- #endif
120
- TOKEN2ID(Intern),
121
- TOKEN2ID(MethodMissing),
122
- TOKEN2ID(Length),
123
- TOKEN2ID(Size),
124
- TOKEN2ID(Gets),
125
- TOKEN2ID(Succ),
126
- TOKEN2ID(Each),
127
- TOKEN2ID(Lambda),
128
- TOKEN2ID(Send),
129
- TOKEN2ID(__send__),
130
- TOKEN2ID(Initialize),
131
- TOKEN2ID(UScore),
132
- TOKEN2ID(LAST_ID)
133
- };
134
-
135
- #ifdef tLAST_TOKEN
136
- struct ruby_method_ids_check {
137
- #define ruby_method_id_check_for(name, value) \
138
- int checking_for_##name[name == value ? 1 : -1]
139
- ruby_method_id_check_for(tUPLUS, 321);
140
- ruby_method_id_check_for(tUMINUS, 322);
141
- ruby_method_id_check_for(tPOW, 323);
142
- ruby_method_id_check_for(tCMP, 324);
143
- ruby_method_id_check_for(tEQ, 325);
144
- ruby_method_id_check_for(tEQQ, 326);
145
- ruby_method_id_check_for(tNEQ, 327);
146
- ruby_method_id_check_for(tGEQ, 328);
147
- ruby_method_id_check_for(tLEQ, 329);
148
- ruby_method_id_check_for(tANDOP, 330);
149
- ruby_method_id_check_for(tOROP, 331);
150
- ruby_method_id_check_for(tMATCH, 332);
151
- ruby_method_id_check_for(tNMATCH, 333);
152
- ruby_method_id_check_for(tDOT2, 334);
153
- ruby_method_id_check_for(tDOT3, 335);
154
- ruby_method_id_check_for(tAREF, 336);
155
- ruby_method_id_check_for(tASET, 337);
156
- ruby_method_id_check_for(tLSHFT, 338);
157
- ruby_method_id_check_for(tRSHFT, 339);
158
- ruby_method_id_check_for(tLAMBDA, 352);
159
- ruby_method_id_check_for(idNULL, 365);
160
- ruby_method_id_check_for(idRespond_to, 366);
161
- ruby_method_id_check_for(idIFUNC, 367);
162
- ruby_method_id_check_for(idCFUNC, 368);
163
- ruby_method_id_check_for(id_core_set_method_alias, 369);
164
- ruby_method_id_check_for(id_core_set_variable_alias, 370);
165
- ruby_method_id_check_for(id_core_undef_method, 371);
166
- ruby_method_id_check_for(id_core_define_method, 372);
167
- ruby_method_id_check_for(id_core_define_singleton_method, 373);
168
- ruby_method_id_check_for(id_core_set_postexe, 374);
169
- ruby_method_id_check_for(tLAST_TOKEN, 375);
170
- };
171
- #endif
172
-
173
- #endif /* RUBY_ID_H */
@@ -1,104 +0,0 @@
1
- /**********************************************************************
2
-
3
- iseq.h -
4
-
5
- $Author$
6
- created at: 04/01/01 23:36:57 JST
7
-
8
- Copyright (C) 2004-2008 Koichi Sasada
9
-
10
- **********************************************************************/
11
-
12
- #ifndef RUBY_COMPILE_H
13
- #define RUBY_COMPILE_H
14
-
15
- /* compile.c */
16
- VALUE rb_iseq_compile_node(VALUE self, NODE *node);
17
- int rb_iseq_translate_threaded_code(rb_iseq_t *iseq);
18
- VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
19
- VALUE exception, VALUE body);
20
-
21
- /* iseq.c */
22
- VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
23
- struct st_table *ruby_insn_make_insn_table(void);
24
-
25
- #define ISEQ_TYPE_TOP INT2FIX(1)
26
- #define ISEQ_TYPE_METHOD INT2FIX(2)
27
- #define ISEQ_TYPE_BLOCK INT2FIX(3)
28
- #define ISEQ_TYPE_CLASS INT2FIX(4)
29
- #define ISEQ_TYPE_RESCUE INT2FIX(5)
30
- #define ISEQ_TYPE_ENSURE INT2FIX(6)
31
- #define ISEQ_TYPE_EVAL INT2FIX(7)
32
- #define ISEQ_TYPE_MAIN INT2FIX(8)
33
- #define ISEQ_TYPE_DEFINED_GUARD INT2FIX(9)
34
-
35
- #define CATCH_TYPE_RESCUE ((int)INT2FIX(1))
36
- #define CATCH_TYPE_ENSURE ((int)INT2FIX(2))
37
- #define CATCH_TYPE_RETRY ((int)INT2FIX(3))
38
- #define CATCH_TYPE_BREAK ((int)INT2FIX(4))
39
- #define CATCH_TYPE_REDO ((int)INT2FIX(5))
40
- #define CATCH_TYPE_NEXT ((int)INT2FIX(6))
41
-
42
- struct iseq_insn_info_entry {
43
- unsigned short position;
44
- unsigned short line_no;
45
- unsigned short sp;
46
- };
47
-
48
- struct iseq_catch_table_entry {
49
- VALUE type;
50
- VALUE iseq;
51
- unsigned long start;
52
- unsigned long end;
53
- unsigned long cont;
54
- unsigned long sp;
55
- };
56
-
57
- #define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)
58
-
59
- struct iseq_compile_data_storage {
60
- struct iseq_compile_data_storage *next;
61
- unsigned long pos;
62
- unsigned long size;
63
- char *buff;
64
- };
65
-
66
- struct iseq_compile_data {
67
- /* GC is needed */
68
- VALUE err_info;
69
- VALUE mark_ary;
70
- VALUE catch_table_ary; /* Array */
71
-
72
- /* GC is not needed */
73
- struct iseq_label_data *start_label;
74
- struct iseq_label_data *end_label;
75
- struct iseq_label_data *redo_label;
76
- VALUE current_block;
77
- VALUE ensure_node;
78
- VALUE for_iseq;
79
- struct iseq_compile_data_ensure_node_stack *ensure_node_stack;
80
- int loopval_popped; /* used by NODE_BREAK */
81
- int cached_const;
82
- struct iseq_compile_data_storage *storage_head;
83
- struct iseq_compile_data_storage *storage_current;
84
- int last_line;
85
- int last_coverable_line;
86
- int flip_cnt;
87
- int label_no;
88
- int node_level;
89
- const rb_compile_option_t *option;
90
- };
91
-
92
- /* defined? */
93
- #define DEFINED_IVAR INT2FIX(1)
94
- #define DEFINED_IVAR2 INT2FIX(2)
95
- #define DEFINED_GVAR INT2FIX(3)
96
- #define DEFINED_CVAR INT2FIX(4)
97
- #define DEFINED_CONST INT2FIX(5)
98
- #define DEFINED_METHOD INT2FIX(6)
99
- #define DEFINED_YIELD INT2FIX(7)
100
- #define DEFINED_REF INT2FIX(8)
101
- #define DEFINED_ZSUPER INT2FIX(9)
102
- #define DEFINED_FUNC INT2FIX(10)
103
-
104
- #endif /* RUBY_COMPILE_H */
@@ -1,103 +0,0 @@
1
- /**********************************************************************
2
-
3
- method.h -
4
-
5
- $Author$
6
- created at: Wed Jul 15 20:02:33 2009
7
-
8
- Copyright (C) 2009 Koichi Sasada
9
-
10
- **********************************************************************/
11
- #ifndef METHOD_H
12
- #define METHOD_H
13
-
14
- typedef enum {
15
- NOEX_PUBLIC = 0x00,
16
- NOEX_NOSUPER = 0x01,
17
- NOEX_PRIVATE = 0x02,
18
- NOEX_PROTECTED = 0x04,
19
- NOEX_MASK = 0x06,
20
- NOEX_BASIC = 0x08,
21
- NOEX_UNDEF = NOEX_NOSUPER,
22
- NOEX_MODFUNC = 0x12,
23
- NOEX_SUPER = 0x20,
24
- NOEX_VCALL = 0x40,
25
- NOEX_RESPONDS = 0x80
26
- } rb_method_flag_t;
27
-
28
- #define NOEX_SAFE(n) ((int)((n) >> 8) & 0x0F)
29
- #define NOEX_WITH(n, s) ((s << 8) | (n) | (ruby_running ? 0 : NOEX_BASIC))
30
- #define NOEX_WITH_SAFE(n) NOEX_WITH(n, rb_safe_level())
31
-
32
- /* method data type */
33
-
34
- typedef enum {
35
- VM_METHOD_TYPE_ISEQ,
36
- VM_METHOD_TYPE_CFUNC,
37
- VM_METHOD_TYPE_ATTRSET,
38
- VM_METHOD_TYPE_IVAR,
39
- VM_METHOD_TYPE_BMETHOD,
40
- VM_METHOD_TYPE_ZSUPER,
41
- VM_METHOD_TYPE_UNDEF,
42
- VM_METHOD_TYPE_NOTIMPLEMENTED,
43
- VM_METHOD_TYPE_OPTIMIZED, /* Kernel#send, Proc#call, etc */
44
- VM_METHOD_TYPE_MISSING /* wrapper for method_missing(id) */
45
- } rb_method_type_t;
46
-
47
- typedef struct rb_method_cfunc_struct {
48
- VALUE (*func)(ANYARGS);
49
- int argc;
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
- void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_flag_t noex);
91
- rb_method_entry_t *rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_flag_t noex);
92
- rb_method_entry_t *rb_method_entry(VALUE klass, ID id);
93
-
94
- rb_method_entry_t *rb_method_entry_get_without_cache(VALUE klass, ID id);
95
- rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_flag_t noex);
96
-
97
- int rb_method_entry_arity(const rb_method_entry_t *me);
98
-
99
- void rb_mark_method_entry(const rb_method_entry_t *me);
100
- void rb_free_method_entry(rb_method_entry_t *me);
101
- void rb_sweep_method_entry(void *vm);
102
-
103
- #endif /* METHOD_H */