debase-ruby_core_source 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +5 -0
  4. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/addr2line.h +20 -0
  5. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/builtin.h +117 -0
  6. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ccan/build_assert/build_assert.h +40 -0
  7. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ccan/check_type/check_type.h +63 -0
  8. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ccan/container_of/container_of.h +142 -0
  9. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ccan/list/list.h +789 -0
  10. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ccan/str/str.h +17 -0
  11. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/constant.h +53 -0
  12. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/darray.h +179 -0
  13. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/debug_counter.h +426 -0
  14. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/dln.h +31 -0
  15. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/encindex.h +70 -0
  16. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/eval_intern.h +339 -0
  17. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/hrtime.h +227 -0
  18. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/id.h +299 -0
  19. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/id_table.h +39 -0
  20. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/insns.inc +249 -0
  21. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/insns_info.inc +9159 -0
  22. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/array.h +162 -0
  23. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/basic_operators.h +63 -0
  24. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/bignum.h +244 -0
  25. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/bits.h +564 -0
  26. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/class.h +221 -0
  27. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/cmdlineopt.h +61 -0
  28. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/compar.h +29 -0
  29. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/compile.h +35 -0
  30. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/compilers.h +107 -0
  31. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/complex.h +29 -0
  32. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/cont.h +32 -0
  33. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/dir.h +16 -0
  34. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/enc.h +19 -0
  35. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/encoding.h +32 -0
  36. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/enum.h +18 -0
  37. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/enumerator.h +21 -0
  38. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/error.h +191 -0
  39. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/eval.h +32 -0
  40. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/file.h +38 -0
  41. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/fixnum.h +184 -0
  42. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/gc.h +333 -0
  43. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/hash.h +216 -0
  44. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/imemo.h +241 -0
  45. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/inits.h +50 -0
  46. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/io.h +38 -0
  47. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/load.h +18 -0
  48. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/loadpath.h +16 -0
  49. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/math.h +23 -0
  50. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/missing.h +18 -0
  51. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/numeric.h +273 -0
  52. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/object.h +59 -0
  53. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/parse.h +25 -0
  54. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/proc.h +30 -0
  55. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/process.h +138 -0
  56. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/ractor.h +6 -0
  57. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/random.h +16 -0
  58. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/range.h +40 -0
  59. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/rational.h +71 -0
  60. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/re.h +28 -0
  61. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/sanitizers.h +186 -0
  62. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/serial.h +23 -0
  63. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/signal.h +21 -0
  64. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/static_assert.h +16 -0
  65. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/string.h +145 -0
  66. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/struct.h +152 -0
  67. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/symbol.h +42 -0
  68. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/thread.h +61 -0
  69. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/time.h +34 -0
  70. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/transcode.h +20 -0
  71. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/util.h +27 -0
  72. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/variable.h +88 -0
  73. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/vm.h +124 -0
  74. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal/warnings.h +16 -0
  75. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/internal.h +112 -0
  76. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/iseq.h +334 -0
  77. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/known_errors.inc +791 -0
  78. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/method.h +254 -0
  79. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/node.h +514 -0
  80. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/node_name.inc +210 -0
  81. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/opt_sc.inc +109 -0
  82. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/optinsn.inc +128 -0
  83. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/optunifs.inc +43 -0
  84. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/parse.h +230 -0
  85. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/probes_helper.h +42 -0
  86. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ractor_core.h +387 -0
  87. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/regenc.h +254 -0
  88. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/regint.h +996 -0
  89. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/regparse.h +370 -0
  90. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/revision.h +5 -0
  91. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/rjit.h +103 -0
  92. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/rjit_c.h +165 -0
  93. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ruby_assert.h +14 -0
  94. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/ruby_atomic.h +23 -0
  95. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/shape.h +232 -0
  96. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/siphash.h +48 -0
  97. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/symbol.h +119 -0
  98. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/thread_none.h +20 -0
  99. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/thread_pthread.h +128 -0
  100. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/thread_win32.h +63 -0
  101. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/timev.h +58 -0
  102. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/transcode_data.h +138 -0
  103. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/transient_heap.h +65 -0
  104. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/variable.h +30 -0
  105. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/version.h +65 -0
  106. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm.inc +5497 -0
  107. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_call_iseq_optimized.inc +244 -0
  108. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_callinfo.h +574 -0
  109. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_core.h +2107 -0
  110. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_debug.h +122 -0
  111. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_exec.h +198 -0
  112. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_insnhelper.h +274 -0
  113. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_opts.h +72 -0
  114. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vm_sync.h +137 -0
  115. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/vmtc.inc +243 -0
  116. data/lib/debase/ruby_core_source/ruby-3.3.0-preview1/yjit.h +72 -0
  117. data/lib/debase/ruby_core_source/version.rb +1 -1
  118. metadata +116 -3
@@ -0,0 +1,124 @@
1
+ #ifndef INTERNAL_VM_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_VM_H
3
+ /**
4
+ * @author Ruby developers <ruby-core@ruby-lang.org>
5
+ * @copyright This file is a part of the programming language Ruby.
6
+ * Permission is hereby granted, to either redistribute and/or
7
+ * modify this file, provided that the conditions mentioned in the
8
+ * file COPYING are met. Consult the file for details.
9
+ * @brief Internal header for RubyVM.
10
+ */
11
+ #include "ruby/internal/stdbool.h" /* for bool */
12
+ #include "internal/serial.h" /* for rb_serial_t */
13
+ #include "internal/static_assert.h" /* for STATIC_ASSERT */
14
+ #include "ruby/ruby.h" /* for ID */
15
+ #include "ruby/st.h" /* for st_table */
16
+
17
+ #ifdef rb_funcallv
18
+ # undef rb_funcallv
19
+ #endif
20
+
21
+ #ifdef rb_method_basic_definition_p
22
+ # undef rb_method_basic_definition_p
23
+ #endif
24
+
25
+ struct rb_callable_method_entry_struct; /* in method.h */
26
+ struct rb_method_definition_struct; /* in method.h */
27
+ struct rb_execution_context_struct; /* in vm_core.h */
28
+ struct rb_control_frame_struct; /* in vm_core.h */
29
+ struct rb_callinfo; /* in vm_core.h */
30
+
31
+ enum method_missing_reason {
32
+ MISSING_NOENTRY = 0x00,
33
+ MISSING_PRIVATE = 0x01,
34
+ MISSING_PROTECTED = 0x02,
35
+ MISSING_FCALL = 0x04,
36
+ MISSING_VCALL = 0x08,
37
+ MISSING_SUPER = 0x10,
38
+ MISSING_MISSING = 0x20,
39
+ MISSING_NONE = 0x40
40
+ };
41
+
42
+ /* vm_insnhelper.h */
43
+ VALUE rb_vm_push_frame_fname(struct rb_execution_context_struct *ec, VALUE fname);
44
+
45
+ /* vm.c */
46
+ VALUE rb_obj_is_thread(VALUE obj);
47
+ void rb_vm_mark(void *ptr);
48
+ void rb_vm_each_stack_value(void *ptr, void (*cb)(VALUE, void*), void *ctx);
49
+ PUREFUNC(VALUE rb_vm_top_self(void));
50
+ const void **rb_vm_get_insns_address_table(void);
51
+ VALUE rb_source_location(int *pline);
52
+ const char *rb_source_location_cstr(int *pline);
53
+ void rb_vm_pop_cfunc_frame(void);
54
+ int rb_vm_add_root_module(VALUE module);
55
+ void rb_vm_check_redefinition_by_prepend(VALUE klass);
56
+ int rb_vm_check_optimizable_mid(VALUE mid);
57
+ VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements);
58
+ VALUE ruby_vm_special_exception_copy(VALUE);
59
+ PUREFUNC(st_table *rb_vm_fstring_table(void));
60
+
61
+ /* vm_eval.c */
62
+ VALUE rb_current_realfilepath(void);
63
+ VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE);
64
+ typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE);
65
+ VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv,
66
+ rb_check_funcall_hook *hook, VALUE arg);
67
+ VALUE rb_check_funcall_with_hook_kw(VALUE recv, ID mid, int argc, const VALUE *argv,
68
+ rb_check_funcall_hook *hook, VALUE arg, int kw_splat);
69
+ const char *rb_type_str(enum ruby_value_type type);
70
+ VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE);
71
+ VALUE rb_check_funcall_basic_kw(VALUE, ID, VALUE, int, const VALUE*, int);
72
+ VALUE rb_yield_1(VALUE val);
73
+ VALUE rb_yield_force_blockarg(VALUE values);
74
+ VALUE rb_lambda_call(VALUE obj, ID mid, int argc, const VALUE *argv,
75
+ rb_block_call_func_t bl_proc, int min_argc, int max_argc,
76
+ VALUE data2);
77
+ void rb_check_stack_overflow(void);
78
+
79
+ /* vm_insnhelper.c */
80
+ VALUE rb_equal_opt(VALUE obj1, VALUE obj2);
81
+ VALUE rb_eql_opt(VALUE obj1, VALUE obj2);
82
+
83
+ struct rb_iseq_struct;
84
+ const struct rb_callcache *rb_vm_search_method_slowpath(const struct rb_callinfo *ci, VALUE klass);
85
+
86
+ /* vm_method.c */
87
+ struct rb_execution_context_struct;
88
+ int rb_ec_obj_respond_to(struct rb_execution_context_struct *ec, VALUE obj, ID id, int priv);
89
+
90
+ void rb_clear_constant_cache(void);
91
+
92
+ /* vm_dump.c */
93
+ void rb_print_backtrace(void);
94
+
95
+ /* vm_backtrace.c */
96
+ VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval);
97
+ VALUE rb_vm_thread_backtrace_locations(int argc, const VALUE *argv, VALUE thval);
98
+ VALUE rb_vm_backtrace(int argc, const VALUE * argv, struct rb_execution_context_struct * ec);
99
+ VALUE rb_vm_backtrace_locations(int argc, const VALUE * argv, struct rb_execution_context_struct * ec);
100
+ VALUE rb_make_backtrace(void);
101
+ void rb_backtrace_print_as_bugreport(void);
102
+ int rb_backtrace_p(VALUE obj);
103
+ VALUE rb_backtrace_to_str_ary(VALUE obj);
104
+ VALUE rb_backtrace_to_location_ary(VALUE obj);
105
+ void rb_backtrace_each(VALUE (*iter)(VALUE recv, VALUE str), VALUE output);
106
+ int rb_frame_info_p(VALUE obj);
107
+ int rb_get_node_id_from_frame_info(VALUE obj);
108
+ const struct rb_iseq_struct *rb_get_iseq_from_frame_info(VALUE obj);
109
+
110
+ VALUE rb_ec_backtrace_object(const struct rb_execution_context_struct *ec);
111
+ void rb_backtrace_use_iseq_first_lineno_for_last_location(VALUE self);
112
+
113
+ #define RUBY_DTRACE_CREATE_HOOK(name, arg) \
114
+ RUBY_DTRACE_HOOK(name##_CREATE, arg)
115
+ #define RUBY_DTRACE_HOOK(name, arg) \
116
+ do { \
117
+ if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
118
+ int dtrace_line; \
119
+ const char *dtrace_file = rb_source_location_cstr(&dtrace_line); \
120
+ if (!dtrace_file) dtrace_file = ""; \
121
+ RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \
122
+ } \
123
+ } while (0)
124
+ #endif /* INTERNAL_VM_H */
@@ -0,0 +1,16 @@
1
+ #ifndef INTERNAL_WARNINGS_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_WARNINGS_H
3
+ /**
4
+ * @author Ruby developers <ruby-core@ruby-lang.org>
5
+ * @copyright This file is a part of the programming language Ruby.
6
+ * Permission is hereby granted, to either redistribute and/or
7
+ * modify this file, provided that the conditions mentioned in the
8
+ * file COPYING are met. Consult the file for details.
9
+ * @brief Internal header to suppress / mandate warnings.
10
+ */
11
+ #include "ruby/internal/warning_push.h"
12
+ #define COMPILER_WARNING_PUSH RBIMPL_WARNING_PUSH()
13
+ #define COMPILER_WARNING_POP RBIMPL_WARNING_POP()
14
+ #define COMPILER_WARNING_ERROR(flag) RBIMPL_WARNING_ERROR(flag)
15
+ #define COMPILER_WARNING_IGNORED(flag) RBIMPL_WARNING_IGNORED(flag)
16
+ #endif /* INTERNAL_WARNINGS_H */
@@ -0,0 +1,112 @@
1
+ #ifndef RUBY_INTERNAL_H /*-*-C-*-vi:se ft=c:*/
2
+ #define RUBY_INTERNAL_H 1
3
+ /**
4
+ * @author $Author$
5
+ * @date Tue May 17 11:42:20 JST 2011
6
+ * @copyright Copyright (C) 2011 Yukihiro Matsumoto
7
+ * @copyright This file is a part of the programming language Ruby.
8
+ * Permission is hereby granted, to either redistribute and/or
9
+ * modify this file, provided that the conditions mentioned in the
10
+ * file COPYING are met. Consult the file for details.
11
+ */
12
+ #include "ruby/internal/config.h"
13
+
14
+ #ifdef __cplusplus
15
+ # error not for C++
16
+ #endif
17
+
18
+ #define LIKELY(x) RB_LIKELY(x)
19
+ #define UNLIKELY(x) RB_UNLIKELY(x)
20
+
21
+ #define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
22
+ #define roomof(x, y) (((x) + (y) - 1) / (y))
23
+ #define type_roomof(x, y) roomof(sizeof(x), sizeof(y))
24
+
25
+ /* Prevent compiler from reordering access */
26
+ #define ACCESS_ONCE(type,x) (*((volatile type *)&(x)))
27
+
28
+ #define UNDEF_P RB_UNDEF_P
29
+ #define NIL_OR_UNDEF_P RB_NIL_OR_UNDEF_P
30
+
31
+ #include "ruby/ruby.h"
32
+
33
+ /* Following macros were formerly defined in this header but moved to somewhere
34
+ * else. In order to detect them we undef here. */
35
+
36
+ /* internal/array.h */
37
+ #undef RARRAY_AREF
38
+
39
+ /* internal/class.h */
40
+ #undef RClass
41
+ #undef RCLASS_SUPER
42
+
43
+ /* internal/gc.h */
44
+ #undef NEWOBJ_OF
45
+ #undef RB_NEWOBJ_OF
46
+
47
+ /* internal/hash.h */
48
+ #undef RHASH_IFNONE
49
+ #undef RHASH_SIZE
50
+ #undef RHASH_TBL
51
+ #undef RHASH_EMPTY_P
52
+
53
+ /* internal/struct.h */
54
+ #undef RSTRUCT_LEN
55
+ #undef RSTRUCT_PTR
56
+ #undef RSTRUCT_SET
57
+ #undef RSTRUCT_GET
58
+
59
+ /* Also, we keep the following macros here. They are expected to be
60
+ * overridden in each headers. */
61
+
62
+ /* internal/array.h */
63
+ #define rb_ary_new_from_args(...) rb_nonexistent_symbol(__VA_ARGS__)
64
+
65
+ /* internal/io.h */
66
+ #define rb_io_fptr_finalize(...) rb_nonexistent_symbol(__VA_ARGS__)
67
+
68
+ /* internal/string.h */
69
+ #define rb_fstring_cstr(...) rb_nonexistent_symbol(__VA_ARGS__)
70
+
71
+ /* internal/symbol.h */
72
+ #define rb_sym_intern_ascii_cstr(...) rb_nonexistent_symbol(__VA_ARGS__)
73
+
74
+ /* internal/vm.h */
75
+ #define rb_funcallv(...) rb_nonexistent_symbol(__VA_ARGS__)
76
+ #define rb_method_basic_definition_p(...) rb_nonexistent_symbol(__VA_ARGS__)
77
+
78
+
79
+ /* MRI debug support */
80
+
81
+ /* gc.c */
82
+ void rb_obj_info_dump(VALUE obj);
83
+ void rb_obj_info_dump_loc(VALUE obj, const char *file, int line, const char *func);
84
+
85
+ /* debug.c */
86
+
87
+ RUBY_SYMBOL_EXPORT_BEGIN
88
+ void ruby_debug_breakpoint(void);
89
+ PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
90
+ RUBY_SYMBOL_EXPORT_END
91
+
92
+ // show obj data structure without any side-effect
93
+ #define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)
94
+
95
+ // same as rp, but add message header
96
+ #define rp_m(msg, obj) do { \
97
+ fputs((msg), stderr); \
98
+ rb_obj_info_dump((VALUE)(obj)); \
99
+ } while (0)
100
+
101
+ // `ruby_debug_breakpoint()` does nothing,
102
+ // but breakpoint is set in run.gdb, so `make gdb` can stop here.
103
+ #define bp() ruby_debug_breakpoint()
104
+
105
+ #define RBOOL(v) ((v) ? Qtrue : Qfalse)
106
+ #define RB_BIGNUM_TYPE_P(x) RB_TYPE_P((x), T_BIGNUM)
107
+
108
+ #ifndef __MINGW32__
109
+ #undef memcpy
110
+ #define memcpy ruby_nonempty_memcpy
111
+ #endif
112
+ #endif /* RUBY_INTERNAL_H */
@@ -0,0 +1,334 @@
1
+ #ifndef RUBY_ISEQ_H
2
+ #define RUBY_ISEQ_H 1
3
+ /**********************************************************************
4
+
5
+ iseq.h -
6
+
7
+ $Author$
8
+ created at: 04/01/01 23:36:57 JST
9
+
10
+ Copyright (C) 2004-2008 Koichi Sasada
11
+
12
+ **********************************************************************/
13
+ #include "internal/gc.h"
14
+ #include "shape.h"
15
+ #include "vm_core.h"
16
+
17
+ RUBY_EXTERN const int ruby_api_version[];
18
+ #define ISEQ_MAJOR_VERSION ((unsigned int)ruby_api_version[0])
19
+ #define ISEQ_MINOR_VERSION ((unsigned int)ruby_api_version[1])
20
+
21
+ #define ISEQ_MBITS_SIZE sizeof(iseq_bits_t)
22
+ #define ISEQ_MBITS_BITLENGTH (ISEQ_MBITS_SIZE * CHAR_BIT)
23
+ #define ISEQ_MBITS_SET(buf, i) (buf[(i) / ISEQ_MBITS_BITLENGTH] |= ((iseq_bits_t)1 << ((i) % ISEQ_MBITS_BITLENGTH)))
24
+ #define ISEQ_MBITS_SET_P(buf, i) ((buf[(i) / ISEQ_MBITS_BITLENGTH] >> ((i) % ISEQ_MBITS_BITLENGTH)) & 0x1)
25
+ #define ISEQ_MBITS_BUFLEN(size) roomof(size, ISEQ_MBITS_BITLENGTH)
26
+
27
+ #ifndef USE_ISEQ_NODE_ID
28
+ #define USE_ISEQ_NODE_ID 1
29
+ #endif
30
+
31
+ #ifndef rb_iseq_t
32
+ typedef struct rb_iseq_struct rb_iseq_t;
33
+ #define rb_iseq_t rb_iseq_t
34
+ #endif
35
+ typedef void (*rb_iseq_callback)(const rb_iseq_t *, void *);
36
+
37
+ extern const ID rb_iseq_shared_exc_local_tbl[];
38
+
39
+ #define ISEQ_COVERAGE(iseq) ISEQ_BODY(iseq)->variable.coverage
40
+ #define ISEQ_COVERAGE_SET(iseq, cov) RB_OBJ_WRITE(iseq, &ISEQ_BODY(iseq)->variable.coverage, cov)
41
+ #define ISEQ_LINE_COVERAGE(iseq) RARRAY_AREF(ISEQ_COVERAGE(iseq), COVERAGE_INDEX_LINES)
42
+ #define ISEQ_BRANCH_COVERAGE(iseq) RARRAY_AREF(ISEQ_COVERAGE(iseq), COVERAGE_INDEX_BRANCHES)
43
+
44
+ #define ISEQ_PC2BRANCHINDEX(iseq) ISEQ_BODY(iseq)->variable.pc2branchindex
45
+ #define ISEQ_PC2BRANCHINDEX_SET(iseq, h) RB_OBJ_WRITE(iseq, &ISEQ_BODY(iseq)->variable.pc2branchindex, h)
46
+
47
+ #define ISEQ_FLIP_CNT(iseq) ISEQ_BODY(iseq)->variable.flip_count
48
+
49
+ static inline rb_snum_t
50
+ ISEQ_FLIP_CNT_INCREMENT(const rb_iseq_t *iseq)
51
+ {
52
+ rb_snum_t cnt = ISEQ_BODY(iseq)->variable.flip_count;
53
+ ISEQ_BODY(iseq)->variable.flip_count += 1;
54
+ return cnt;
55
+ }
56
+
57
+ static inline VALUE *
58
+ ISEQ_ORIGINAL_ISEQ(const rb_iseq_t *iseq)
59
+ {
60
+ return ISEQ_BODY(iseq)->variable.original_iseq;
61
+ }
62
+
63
+ static inline void
64
+ ISEQ_ORIGINAL_ISEQ_CLEAR(const rb_iseq_t *iseq)
65
+ {
66
+ void *ptr = ISEQ_BODY(iseq)->variable.original_iseq;
67
+ ISEQ_BODY(iseq)->variable.original_iseq = NULL;
68
+ if (ptr) {
69
+ ruby_xfree(ptr);
70
+ }
71
+ }
72
+
73
+ static inline VALUE *
74
+ ISEQ_ORIGINAL_ISEQ_ALLOC(const rb_iseq_t *iseq, long size)
75
+ {
76
+ return ISEQ_BODY(iseq)->variable.original_iseq =
77
+ ALLOC_N(VALUE, size);
78
+ }
79
+
80
+ #define ISEQ_TRACE_EVENTS (RUBY_EVENT_LINE | \
81
+ RUBY_EVENT_CLASS | \
82
+ RUBY_EVENT_END | \
83
+ RUBY_EVENT_CALL | \
84
+ RUBY_EVENT_RETURN| \
85
+ RUBY_EVENT_C_CALL| \
86
+ RUBY_EVENT_C_RETURN| \
87
+ RUBY_EVENT_B_CALL| \
88
+ RUBY_EVENT_B_RETURN| \
89
+ RUBY_EVENT_COVERAGE_LINE| \
90
+ RUBY_EVENT_COVERAGE_BRANCH)
91
+
92
+ #define ISEQ_NOT_LOADED_YET IMEMO_FL_USER1
93
+ #define ISEQ_USE_COMPILE_DATA IMEMO_FL_USER2
94
+ #define ISEQ_TRANSLATED IMEMO_FL_USER3
95
+
96
+ #define ISEQ_EXECUTABLE_P(iseq) (FL_TEST_RAW(((VALUE)iseq), ISEQ_NOT_LOADED_YET | ISEQ_USE_COMPILE_DATA) == 0)
97
+
98
+ struct iseq_compile_data {
99
+ /* GC is needed */
100
+ const VALUE err_info;
101
+ const VALUE catch_table_ary; /* Array */
102
+
103
+ /* GC is not needed */
104
+ struct iseq_label_data *start_label;
105
+ struct iseq_label_data *end_label;
106
+ struct iseq_label_data *redo_label;
107
+ const rb_iseq_t *current_block;
108
+ struct iseq_compile_data_ensure_node_stack *ensure_node_stack;
109
+ struct {
110
+ struct iseq_compile_data_storage *storage_head;
111
+ struct iseq_compile_data_storage *storage_current;
112
+ } node;
113
+ struct {
114
+ struct iseq_compile_data_storage *storage_head;
115
+ struct iseq_compile_data_storage *storage_current;
116
+ } insn;
117
+ bool in_rescue;
118
+ int loopval_popped; /* used by NODE_BREAK */
119
+ int last_line;
120
+ int label_no;
121
+ int node_level;
122
+ int isolated_depth;
123
+ unsigned int ci_index;
124
+ unsigned int ic_index;
125
+ const rb_compile_option_t *option;
126
+ struct rb_id_table *ivar_cache_table;
127
+ const struct rb_builtin_function *builtin_function_table;
128
+ const NODE *root_node;
129
+ bool catch_except_p; // If a frame of this ISeq may catch exception, set true.
130
+ #if OPT_SUPPORT_JOKE
131
+ st_table *labels_table;
132
+ #endif
133
+ };
134
+
135
+ static inline struct iseq_compile_data *
136
+ ISEQ_COMPILE_DATA(const rb_iseq_t *iseq)
137
+ {
138
+ if (iseq->flags & ISEQ_USE_COMPILE_DATA) {
139
+ return iseq->aux.compile_data;
140
+ }
141
+ else {
142
+ return NULL;
143
+ }
144
+ }
145
+
146
+ static inline void
147
+ ISEQ_COMPILE_DATA_ALLOC(rb_iseq_t *iseq)
148
+ {
149
+ iseq->aux.compile_data = ZALLOC(struct iseq_compile_data);
150
+ iseq->flags |= ISEQ_USE_COMPILE_DATA;
151
+ }
152
+
153
+ static inline void
154
+ ISEQ_COMPILE_DATA_CLEAR(rb_iseq_t *iseq)
155
+ {
156
+ iseq->flags &= ~ISEQ_USE_COMPILE_DATA;
157
+ iseq->aux.compile_data = NULL;
158
+ }
159
+
160
+ static inline rb_iseq_t *
161
+ iseq_imemo_alloc(void)
162
+ {
163
+ return (rb_iseq_t *)rb_imemo_new(imemo_iseq, 0, 0, 0, 0);
164
+ }
165
+
166
+ VALUE rb_iseq_ibf_dump(const rb_iseq_t *iseq, VALUE opt);
167
+ void rb_ibf_load_iseq_complete(rb_iseq_t *iseq);
168
+ const rb_iseq_t *rb_iseq_ibf_load(VALUE str);
169
+ const rb_iseq_t *rb_iseq_ibf_load_bytes(const char *cstr, size_t);
170
+ VALUE rb_iseq_ibf_load_extra_data(VALUE str);
171
+ void rb_iseq_init_trace(rb_iseq_t *iseq);
172
+ int rb_iseq_add_local_tracepoint_recursively(const rb_iseq_t *iseq, rb_event_flag_t turnon_events, VALUE tpval, unsigned int target_line, bool target_bmethod);
173
+ int rb_iseq_remove_local_tracepoint_recursively(const rb_iseq_t *iseq, VALUE tpval);
174
+ const rb_iseq_t *rb_iseq_load_iseq(VALUE fname);
175
+
176
+ #if VM_INSN_INFO_TABLE_IMPL == 2
177
+ unsigned int *rb_iseq_insns_info_decode_positions(const struct rb_iseq_constant_body *body);
178
+ #endif
179
+
180
+ int rb_vm_insn_addr2opcode(const void *addr);
181
+
182
+ RUBY_SYMBOL_EXPORT_BEGIN
183
+
184
+ /* compile.c */
185
+ VALUE rb_iseq_compile_node(rb_iseq_t *iseq, const NODE *node);
186
+ VALUE rb_iseq_compile_callback(rb_iseq_t *iseq, const struct rb_iseq_new_with_callback_callback_func * ifunc);
187
+ VALUE *rb_iseq_original_iseq(const rb_iseq_t *iseq);
188
+ void rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE misc,
189
+ VALUE locals, VALUE args,
190
+ VALUE exception, VALUE body);
191
+ void rb_iseq_mark_and_move_insn_storage(struct iseq_compile_data_storage *arena);
192
+
193
+ VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
194
+ VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc);
195
+ unsigned int rb_iseq_line_no(const rb_iseq_t *iseq, size_t pos);
196
+ #ifdef USE_ISEQ_NODE_ID
197
+ int rb_iseq_node_id(const rb_iseq_t *iseq, size_t pos);
198
+ #endif
199
+ void rb_iseq_trace_set(const rb_iseq_t *iseq, rb_event_flag_t turnon_events);
200
+ void rb_iseq_trace_set_all(rb_event_flag_t turnon_events);
201
+ void rb_iseq_insns_info_encode_positions(const rb_iseq_t *iseq);
202
+
203
+ struct rb_iseq_constant_body *rb_iseq_constant_body_alloc(void);
204
+ VALUE rb_iseqw_new(const rb_iseq_t *iseq);
205
+ const rb_iseq_t *rb_iseqw_to_iseq(VALUE iseqw);
206
+
207
+ VALUE rb_iseq_absolute_path(const rb_iseq_t *iseq); /* obsolete */
208
+ int rb_iseq_from_eval_p(const rb_iseq_t *iseq);
209
+ VALUE rb_iseq_type(const rb_iseq_t *iseq);
210
+ VALUE rb_iseq_label(const rb_iseq_t *iseq);
211
+ VALUE rb_iseq_base_label(const rb_iseq_t *iseq);
212
+ VALUE rb_iseq_first_lineno(const rb_iseq_t *iseq);
213
+ VALUE rb_iseq_method_name(const rb_iseq_t *iseq);
214
+ void rb_iseq_code_location(const rb_iseq_t *iseq, int *first_lineno, int *first_column, int *last_lineno, int *last_column);
215
+
216
+ void rb_iseq_remove_coverage_all(void);
217
+
218
+ /* proc.c */
219
+ const rb_iseq_t *rb_method_iseq(VALUE body);
220
+ const rb_iseq_t *rb_proc_get_iseq(VALUE proc, int *is_proc);
221
+
222
+ struct rb_compile_option_struct {
223
+ unsigned int inline_const_cache: 1;
224
+ unsigned int peephole_optimization: 1;
225
+ unsigned int tailcall_optimization: 1;
226
+ unsigned int specialized_instruction: 1;
227
+ unsigned int operands_unification: 1;
228
+ unsigned int instructions_unification: 1;
229
+ unsigned int stack_caching: 1;
230
+ unsigned int frozen_string_literal: 1;
231
+ unsigned int debug_frozen_string_literal: 1;
232
+ unsigned int coverage_enabled: 1;
233
+ int debug_level;
234
+ };
235
+
236
+ struct iseq_insn_info_entry {
237
+ int line_no;
238
+ #ifdef USE_ISEQ_NODE_ID
239
+ int node_id;
240
+ #endif
241
+ rb_event_flag_t events;
242
+ };
243
+
244
+ /*
245
+ * iseq type:
246
+ * CATCH_TYPE_RESCUE, CATCH_TYPE_ENSURE:
247
+ * use iseq as continuation.
248
+ *
249
+ * CATCH_TYPE_BREAK (iter):
250
+ * use iseq as key.
251
+ *
252
+ * CATCH_TYPE_BREAK (while), CATCH_TYPE_RETRY,
253
+ * CATCH_TYPE_REDO, CATCH_TYPE_NEXT:
254
+ * NULL.
255
+ */
256
+ enum rb_catch_type {
257
+ CATCH_TYPE_RESCUE = INT2FIX(1),
258
+ CATCH_TYPE_ENSURE = INT2FIX(2),
259
+ CATCH_TYPE_RETRY = INT2FIX(3),
260
+ CATCH_TYPE_BREAK = INT2FIX(4),
261
+ CATCH_TYPE_REDO = INT2FIX(5),
262
+ CATCH_TYPE_NEXT = INT2FIX(6)
263
+ };
264
+
265
+ struct iseq_catch_table_entry {
266
+ enum rb_catch_type type;
267
+ rb_iseq_t *iseq;
268
+
269
+ unsigned int start;
270
+ unsigned int end;
271
+ unsigned int cont;
272
+ unsigned int sp;
273
+ };
274
+
275
+ RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN()
276
+ struct iseq_catch_table {
277
+ unsigned int size;
278
+ struct iseq_catch_table_entry entries[FLEX_ARY_LEN];
279
+ } RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END();
280
+
281
+ static inline int
282
+ iseq_catch_table_bytes(int n)
283
+ {
284
+ enum {
285
+ catch_table_entry_size = sizeof(struct iseq_catch_table_entry),
286
+ catch_table_entries_max = (INT_MAX - offsetof(struct iseq_catch_table, entries)) / catch_table_entry_size
287
+ };
288
+ if (n > catch_table_entries_max) rb_fatal("too large iseq_catch_table - %d", n);
289
+ return (int)(offsetof(struct iseq_catch_table, entries) +
290
+ n * catch_table_entry_size);
291
+ }
292
+
293
+ #define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)
294
+
295
+ struct iseq_compile_data_storage {
296
+ struct iseq_compile_data_storage *next;
297
+ unsigned int pos;
298
+ unsigned int size;
299
+ char buff[FLEX_ARY_LEN];
300
+ };
301
+
302
+ /* defined? */
303
+
304
+ enum defined_type {
305
+ DEFINED_NOT_DEFINED,
306
+ DEFINED_NIL = 1,
307
+ DEFINED_IVAR,
308
+ DEFINED_LVAR,
309
+ DEFINED_GVAR,
310
+ DEFINED_CVAR,
311
+ DEFINED_CONST,
312
+ DEFINED_METHOD,
313
+ DEFINED_YIELD,
314
+ DEFINED_ZSUPER,
315
+ DEFINED_SELF,
316
+ DEFINED_TRUE,
317
+ DEFINED_FALSE,
318
+ DEFINED_ASGN,
319
+ DEFINED_EXPR,
320
+ DEFINED_REF,
321
+ DEFINED_FUNC,
322
+ DEFINED_CONST_FROM
323
+ };
324
+
325
+ VALUE rb_iseq_defined_string(enum defined_type type);
326
+
327
+ /* vm.c */
328
+ VALUE rb_iseq_local_variables(const rb_iseq_t *iseq);
329
+
330
+ attr_index_t rb_estimate_iv_count(VALUE klass, const rb_iseq_t * initialize_iseq);
331
+
332
+ RUBY_SYMBOL_EXPORT_END
333
+
334
+ #endif /* RUBY_ISEQ_H */