debase-ruby_core_source 0.9.9 → 0.9.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/addr2line.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/ccan/list/list.h +28 -166
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/constant.h +3 -10
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/dln.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/eval_intern.h +49 -89
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/gc.h +1 -8
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/id.h +5 -15
- data/lib/debase/ruby_core_source/ruby-2.2.8-p477/insns.inc +107 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/insns_info.inc +45 -89
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/internal.h +164 -666
- data/lib/debase/ruby_core_source/ruby-2.2.8-p477/iseq.h +158 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/known_errors.inc +0 -0
- data/lib/debase/ruby_core_source/ruby-2.2.8-p477/method.h +144 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/node.h +42 -18
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/node_name.inc +6 -2
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/opt_sc.inc +0 -40
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/optinsn.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/optunifs.inc +0 -5
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/parse.h +8 -28
- data/lib/debase/ruby_core_source/ruby-2.2.8-p477/probes_helper.h +67 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/regenc.h +16 -16
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/regint.h +10 -33
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/regparse.h +1 -5
- data/lib/debase/ruby_core_source/ruby-2.2.8-p477/revision.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/ruby_atomic.h +5 -68
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/siphash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/symbol.h +13 -33
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/thread_pthread.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/thread_win32.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/timev.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/transcode_data.h +7 -23
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/version.h +10 -31
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/vm.inc +497 -542
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/vm_core.h +305 -784
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/vm_debug.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.2.8-p477}/vm_exec.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.2.8-p477}/vm_insnhelper.h +56 -50
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/vm_opts.h +7 -8
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.2.8-p477}/vmtc.inc +0 -5
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/addr2line.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/ccan/list/list.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/constant.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/dln.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/encindex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/eval_intern.h +3 -4
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/gc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/id.h +0 -9
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/id_table.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/insns.inc +46 -48
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/insns_info.inc +0 -20
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/internal.h +58 -290
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/iseq.h +15 -18
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/known_errors.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/method.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/node.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/node_name.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/opt_sc.inc +0 -16
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/optinsn.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/optunifs.inc +0 -2
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/parse.h +8 -27
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/probes_helper.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/regenc.h +14 -14
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/regint.h +0 -8
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/regparse.h +0 -0
- data/lib/debase/ruby_core_source/ruby-2.3.5-p376/revision.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/ruby_atomic.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/siphash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/symbol.h +3 -3
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/thread_pthread.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/thread_win32.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/timev.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/transcode_data.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.3.5-p376}/version.h +9 -27
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm.inc +255 -264
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm_call_iseq_optimized.inc +5 -5
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm_core.h +37 -28
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/vm_debug.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/vm_exec.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm_insnhelper.h +32 -16
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.3.5-p376}/vm_opts.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.3.5-p376}/vmtc.inc +0 -2
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/addr2line.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/ccan/list/list.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/constant.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/dln.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/encindex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/eval_intern.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/gc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/id.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/id_table.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/insns.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/insns_info.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/internal.h +116 -51
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/iseq.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/known_errors.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/method.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/node.h +2 -2
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/node_name.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/opt_sc.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/optinsn.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/optunifs.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/parse.h +8 -27
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/probes_helper.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/regenc.h +79 -67
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/regint.h +187 -244
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/regparse.h +30 -27
- data/lib/debase/ruby_core_source/ruby-2.4.2-p198/revision.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/ruby_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/ruby_atomic.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/siphash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/symbol.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/thread_pthread.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/thread_win32.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/timev.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/transcode_data.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/version.h +6 -6
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm.inc +37 -34
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/vm_call_iseq_optimized.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm_core.h +9 -7
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm_debug.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm_exec.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview3 → ruby-2.4.2-p198}/vm_insnhelper.h +30 -14
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview2 → ruby-2.4.2-p198}/vm_opts.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.4.0-preview1 → ruby-2.4.2-p198}/vmtc.inc +0 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +138 -143
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview1/method.h +0 -213
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview1/revision.h +0 -1
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview2/revision.h +0 -1
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview2/ruby_assert.h +0 -54
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/encindex.h +0 -67
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/id_table.h +0 -31
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/insns.inc +0 -112
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/iseq.h +0 -252
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/probes_helper.h +0 -43
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/revision.h +0 -1
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/ruby_assert.h +0 -54
- data/lib/debase/ruby_core_source/ruby-2.4.0-preview3/vm_call_iseq_optimized.inc +0 -212
@@ -23,25 +23,31 @@ extern "C" {
|
|
23
23
|
#endif
|
24
24
|
#endif
|
25
25
|
|
26
|
-
|
27
|
-
#
|
26
|
+
/* likely */
|
27
|
+
#if __GNUC__ >= 3
|
28
|
+
#define LIKELY(x) (__builtin_expect((x), 1))
|
29
|
+
#define UNLIKELY(x) (__builtin_expect((x), 0))
|
30
|
+
#else /* __GNUC__ >= 3 */
|
31
|
+
#define LIKELY(x) (x)
|
32
|
+
#define UNLIKELY(x) (x)
|
33
|
+
#endif /* __GNUC__ >= 3 */
|
28
34
|
|
29
35
|
#ifndef __has_attribute
|
30
36
|
# define __has_attribute(x) 0
|
31
37
|
#endif
|
32
38
|
|
33
|
-
#if __has_attribute(
|
34
|
-
#define UNINITIALIZED_VAR(x) x __attribute__((
|
39
|
+
#if __has_attribute(unused)
|
40
|
+
#define UNINITIALIZED_VAR(x) x __attribute__((unused))
|
35
41
|
#elif defined(__GNUC__) && __GNUC__ >= 3
|
36
42
|
#define UNINITIALIZED_VAR(x) x = x
|
37
43
|
#else
|
38
44
|
#define UNINITIALIZED_VAR(x) x
|
39
45
|
#endif
|
40
46
|
|
41
|
-
#if __has_attribute(
|
42
|
-
#define WARN_UNUSED_RESULT(x) x __attribute__((
|
43
|
-
#elif
|
44
|
-
#define WARN_UNUSED_RESULT(x) x __attribute__((
|
47
|
+
#if __has_attribute(warn_unused_result)
|
48
|
+
#define WARN_UNUSED_RESULT(x) x __attribute__((warn_unused_result))
|
49
|
+
#elif defined(__GNUC__) && (__GNUC__ * 1000 + __GNUC_MINOR__) >= 3004
|
50
|
+
#define WARN_UNUSED_RESULT(x) x __attribute__((warn_unused_result))
|
45
51
|
#else
|
46
52
|
#define WARN_UNUSED_RESULT(x) x
|
47
53
|
#endif
|
@@ -61,6 +67,12 @@ extern "C" {
|
|
61
67
|
|
62
68
|
#define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
|
63
69
|
|
70
|
+
#define GCC_VERSION_SINCE(major, minor, patchlevel) \
|
71
|
+
(defined(__GNUC__) && !defined(__INTEL_COMPILER) && \
|
72
|
+
((__GNUC__ > (major)) || \
|
73
|
+
(__GNUC__ == (major) && __GNUC_MINOR__ > (minor)) || \
|
74
|
+
(__GNUC__ == (major) && __GNUC_MINOR__ == (minor) && __GNUC_PATCHLEVEL__ >= (patchlevel))))
|
75
|
+
|
64
76
|
#ifndef __has_feature
|
65
77
|
# define __has_feature(x) 0
|
66
78
|
#endif
|
@@ -254,156 +266,6 @@ nlz_int128(uint128_t x)
|
|
254
266
|
}
|
255
267
|
#endif
|
256
268
|
|
257
|
-
static inline int
|
258
|
-
nlz_intptr(uintptr_t x) {
|
259
|
-
#if SIZEOF_VOIDP == 8
|
260
|
-
return nlz_long_long(x);
|
261
|
-
#elif SIZEOF_VOIDP == 4
|
262
|
-
return nlz_int(x);
|
263
|
-
#endif
|
264
|
-
}
|
265
|
-
|
266
|
-
static inline int
|
267
|
-
rb_popcount32(uint32_t x) {
|
268
|
-
#ifdef HAVE_BUILTIN___BUILTIN_POPCOUNT
|
269
|
-
return __builtin_popcount(x);
|
270
|
-
#else
|
271
|
-
x = (x & 0x55555555) + (x >> 1 & 0x55555555);
|
272
|
-
x = (x & 0x33333333) + (x >> 2 & 0x33333333);
|
273
|
-
x = (x & 0x0f0f0f0f) + (x >> 4 & 0x0f0f0f0f);
|
274
|
-
x = (x & 0x001f001f) + (x >> 8 & 0x001f001f);
|
275
|
-
return (x & 0x0000003f) + (x >>16 & 0x0000003f);
|
276
|
-
#endif
|
277
|
-
}
|
278
|
-
|
279
|
-
static inline int
|
280
|
-
rb_popcount64(uint64_t x) {
|
281
|
-
#ifdef HAVE_BUILTIN___BUILTIN_POPCOUNT
|
282
|
-
return __builtin_popcountll(x);
|
283
|
-
#else
|
284
|
-
x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);
|
285
|
-
x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
|
286
|
-
x = (x & 0x0707070707070707) + (x >> 4 & 0x0707070707070707);
|
287
|
-
x = (x & 0x001f001f001f001f) + (x >> 8 & 0x001f001f001f001f);
|
288
|
-
x = (x & 0x0000003f0000003f) + (x >>16 & 0x0000003f0000003f);
|
289
|
-
return (x & 0x7f) + (x >>32 & 0x7f);
|
290
|
-
#endif
|
291
|
-
}
|
292
|
-
|
293
|
-
static inline int
|
294
|
-
rb_popcount_intptr(uintptr_t x) {
|
295
|
-
#if SIZEOF_VOIDP == 8
|
296
|
-
return rb_popcount64(x);
|
297
|
-
#elif SIZEOF_VOIDP == 4
|
298
|
-
return rb_popcount32(x);
|
299
|
-
#endif
|
300
|
-
}
|
301
|
-
|
302
|
-
static inline int
|
303
|
-
ntz_int32(uint32_t x) {
|
304
|
-
#ifdef HAVE_BUILTIN___BUILTIN_CTZ
|
305
|
-
return __builtin_ctz(x);
|
306
|
-
#else
|
307
|
-
return rb_popcount32((~x) & (x-1));
|
308
|
-
#endif
|
309
|
-
}
|
310
|
-
|
311
|
-
static inline int
|
312
|
-
ntz_int64(uint64_t x) {
|
313
|
-
#ifdef HAVE_BUILTIN___BUILTIN_CTZLL
|
314
|
-
return __builtin_ctzll(x);
|
315
|
-
#else
|
316
|
-
return rb_popcount64((~x) & (x-1));
|
317
|
-
#endif
|
318
|
-
}
|
319
|
-
|
320
|
-
static inline int
|
321
|
-
ntz_intptr(uintptr_t x) {
|
322
|
-
#if SIZEOF_VOIDP == 8
|
323
|
-
return ntz_int64(x);
|
324
|
-
#elif SIZEOF_VOIDP == 4
|
325
|
-
return ntz_int32(x);
|
326
|
-
#endif
|
327
|
-
}
|
328
|
-
|
329
|
-
#if HAVE_LONG_LONG && SIZEOF_LONG * 2 <= SIZEOF_LONG_LONG
|
330
|
-
# define DLONG LONG_LONG
|
331
|
-
# define DL2NUM(x) LL2NUM(x)
|
332
|
-
#elif defined(HAVE_INT128_T)
|
333
|
-
# define DLONG int128_t
|
334
|
-
# define DL2NUM(x) (RB_FIXABLE(x) ? LONG2FIX(x) : rb_int128t2big(x))
|
335
|
-
VALUE rb_int128t2big(int128_t n);
|
336
|
-
#endif
|
337
|
-
|
338
|
-
/* arguments must be Fixnum */
|
339
|
-
static inline VALUE
|
340
|
-
rb_fix_mul_fix(VALUE x, VALUE y)
|
341
|
-
{
|
342
|
-
long lx = FIX2LONG(x);
|
343
|
-
long ly = FIX2LONG(y);
|
344
|
-
#ifdef DLONG
|
345
|
-
return DL2NUM((DLONG)lx * (DLONG)ly);
|
346
|
-
#else
|
347
|
-
if (MUL_OVERFLOW_FIXNUM_P(lx, ly)) {
|
348
|
-
return rb_big_mul(rb_int2big(lx), rb_int2big(ly));
|
349
|
-
}
|
350
|
-
else {
|
351
|
-
return LONG2FIX(lx * ly);
|
352
|
-
}
|
353
|
-
#endif
|
354
|
-
}
|
355
|
-
|
356
|
-
/*
|
357
|
-
* This behaves different from C99 for negative arguments.
|
358
|
-
* Note that div may overflow fixnum.
|
359
|
-
*/
|
360
|
-
static inline void
|
361
|
-
rb_fix_divmod_fix(VALUE a, VALUE b, VALUE *divp, VALUE *modp)
|
362
|
-
{
|
363
|
-
/* assume / and % comply C99.
|
364
|
-
* ldiv(3) won't be inlined by GCC and clang.
|
365
|
-
* I expect / and % are compiled as single idiv.
|
366
|
-
*/
|
367
|
-
long x = FIX2LONG(a);
|
368
|
-
long y = FIX2LONG(b);
|
369
|
-
long div, mod;
|
370
|
-
if (x == FIXNUM_MIN && y == -1) {
|
371
|
-
if (divp) *divp = LONG2NUM(-FIXNUM_MIN);
|
372
|
-
if (modp) *modp = LONG2FIX(0);
|
373
|
-
return;
|
374
|
-
}
|
375
|
-
div = x / y;
|
376
|
-
mod = x % y;
|
377
|
-
if (y > 0 ? mod < 0 : mod > 0) {
|
378
|
-
mod += y;
|
379
|
-
div -= 1;
|
380
|
-
}
|
381
|
-
if (divp) *divp = LONG2FIX(div);
|
382
|
-
if (modp) *modp = LONG2FIX(mod);
|
383
|
-
}
|
384
|
-
|
385
|
-
/* div() for Ruby
|
386
|
-
* This behaves different from C99 for negative arguments.
|
387
|
-
*/
|
388
|
-
static inline VALUE
|
389
|
-
rb_fix_div_fix(VALUE x, VALUE y)
|
390
|
-
{
|
391
|
-
VALUE div;
|
392
|
-
rb_fix_divmod_fix(x, y, &div, NULL);
|
393
|
-
return div;
|
394
|
-
}
|
395
|
-
|
396
|
-
/* mod() for Ruby
|
397
|
-
* This behaves different from C99 for negative arguments.
|
398
|
-
*/
|
399
|
-
static inline VALUE
|
400
|
-
rb_fix_mod_fix(VALUE x, VALUE y)
|
401
|
-
{
|
402
|
-
VALUE mod;
|
403
|
-
rb_fix_divmod_fix(x, y, NULL, &mod);
|
404
|
-
return mod;
|
405
|
-
}
|
406
|
-
|
407
269
|
#if defined(HAVE_UINT128_T)
|
408
270
|
# define bit_length(x) \
|
409
271
|
(sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
|
@@ -421,6 +283,52 @@ rb_fix_mod_fix(VALUE x, VALUE y)
|
|
421
283
|
SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)))
|
422
284
|
#endif
|
423
285
|
|
286
|
+
struct rb_deprecated_classext_struct {
|
287
|
+
char conflict[sizeof(VALUE) * 3];
|
288
|
+
};
|
289
|
+
|
290
|
+
struct rb_subclass_entry;
|
291
|
+
typedef struct rb_subclass_entry rb_subclass_entry_t;
|
292
|
+
|
293
|
+
struct rb_subclass_entry {
|
294
|
+
VALUE klass;
|
295
|
+
rb_subclass_entry_t *next;
|
296
|
+
};
|
297
|
+
|
298
|
+
#if defined(HAVE_LONG_LONG)
|
299
|
+
typedef unsigned LONG_LONG rb_serial_t;
|
300
|
+
#define SERIALT2NUM ULL2NUM
|
301
|
+
#elif defined(HAVE_UINT64_T)
|
302
|
+
typedef uint64_t rb_serial_t;
|
303
|
+
#define SERIALT2NUM SIZET2NUM
|
304
|
+
#else
|
305
|
+
typedef unsigned long rb_serial_t;
|
306
|
+
#define SERIALT2NUM ULONG2NUM
|
307
|
+
#endif
|
308
|
+
|
309
|
+
struct rb_classext_struct {
|
310
|
+
struct st_table *iv_index_tbl;
|
311
|
+
struct st_table *iv_tbl;
|
312
|
+
struct st_table *const_tbl;
|
313
|
+
rb_subclass_entry_t *subclasses;
|
314
|
+
rb_subclass_entry_t **parent_subclasses;
|
315
|
+
/**
|
316
|
+
* In the case that this is an `ICLASS`, `module_subclasses` points to the link
|
317
|
+
* in the module's `subclasses` list that indicates that the klass has been
|
318
|
+
* included. Hopefully that makes sense.
|
319
|
+
*/
|
320
|
+
rb_subclass_entry_t **module_subclasses;
|
321
|
+
rb_serial_t class_serial;
|
322
|
+
VALUE origin;
|
323
|
+
VALUE refined_class;
|
324
|
+
rb_alloc_func_t allocator;
|
325
|
+
};
|
326
|
+
|
327
|
+
struct method_table_wrapper {
|
328
|
+
st_table *tbl;
|
329
|
+
size_t serial;
|
330
|
+
};
|
331
|
+
|
424
332
|
#ifndef BDIGIT
|
425
333
|
# if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
|
426
334
|
# define BDIGIT unsigned int
|
@@ -502,7 +410,6 @@ struct RBignum {
|
|
502
410
|
: (RBASIC(b)->flags &= ~BIGNUM_SIGN_BIT))
|
503
411
|
#define BIGNUM_POSITIVE_P(b) BIGNUM_SIGN(b)
|
504
412
|
#define BIGNUM_NEGATIVE_P(b) (!BIGNUM_SIGN(b))
|
505
|
-
#define BIGNUM_NEGATE(b) (RBASIC(b)->flags ^= BIGNUM_SIGN_BIT)
|
506
413
|
|
507
414
|
#define BIGNUM_EMBED_FLAG FL_USER2
|
508
415
|
#define BIGNUM_EMBED_LEN_MASK (FL_USER5|FL_USER4|FL_USER3)
|
@@ -528,8 +435,6 @@ struct RRational {
|
|
528
435
|
};
|
529
436
|
|
530
437
|
#define RRATIONAL(obj) (R_CAST(RRational)(obj))
|
531
|
-
#define RRATIONAL_SET_NUM(rat, n) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->num,(n))
|
532
|
-
#define RRATIONAL_SET_DEN(rat, d) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->den,(d))
|
533
438
|
|
534
439
|
struct RFloat {
|
535
440
|
struct RBasic basic;
|
@@ -576,132 +481,28 @@ struct RHash {
|
|
576
481
|
extern void ruby_init_setproctitle(int argc, char *argv[]);
|
577
482
|
#endif
|
578
483
|
|
579
|
-
#define RSTRUCT_EMBED_LEN_MAX RSTRUCT_EMBED_LEN_MAX
|
580
|
-
#define RSTRUCT_EMBED_LEN_MASK RSTRUCT_EMBED_LEN_MASK
|
581
|
-
#define RSTRUCT_EMBED_LEN_SHIFT RSTRUCT_EMBED_LEN_SHIFT
|
582
|
-
enum {
|
583
|
-
RSTRUCT_EMBED_LEN_MAX = 3,
|
584
|
-
RSTRUCT_EMBED_LEN_MASK = (RUBY_FL_USER2|RUBY_FL_USER1),
|
585
|
-
RSTRUCT_EMBED_LEN_SHIFT = (RUBY_FL_USHIFT+1),
|
586
|
-
|
587
|
-
RSTRUCT_ENUM_END
|
588
|
-
};
|
589
|
-
|
590
|
-
struct RStruct {
|
591
|
-
struct RBasic basic;
|
592
|
-
union {
|
593
|
-
struct {
|
594
|
-
long len;
|
595
|
-
const VALUE *ptr;
|
596
|
-
} heap;
|
597
|
-
const VALUE ary[RSTRUCT_EMBED_LEN_MAX];
|
598
|
-
} as;
|
599
|
-
};
|
600
|
-
|
601
|
-
#undef RSTRUCT_LEN
|
602
|
-
#undef RSTRUCT_PTR
|
603
|
-
#undef RSTRUCT_SET
|
604
|
-
#undef RSTRUCT_GET
|
605
|
-
#define RSTRUCT_EMBED_LEN(st) \
|
606
|
-
(long)((RBASIC(st)->flags >> RSTRUCT_EMBED_LEN_SHIFT) & \
|
607
|
-
(RSTRUCT_EMBED_LEN_MASK >> RSTRUCT_EMBED_LEN_SHIFT))
|
608
|
-
#define RSTRUCT_LEN(st) rb_struct_len(st)
|
609
|
-
#define RSTRUCT_LENINT(st) rb_long2int(RSTRUCT_LEN(st))
|
610
|
-
#define RSTRUCT_CONST_PTR(st) rb_struct_const_ptr(st)
|
611
|
-
#define RSTRUCT_PTR(st) ((VALUE *)RSTRUCT_CONST_PTR(RB_OBJ_WB_UNPROTECT_FOR(STRUCT, st)))
|
612
|
-
#define RSTRUCT_SET(st, idx, v) RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v))
|
613
|
-
#define RSTRUCT_GET(st, idx) (RSTRUCT_CONST_PTR(st)[idx])
|
614
|
-
#define RSTRUCT(obj) (R_CAST(RStruct)(obj))
|
615
|
-
|
616
|
-
static inline long
|
617
|
-
rb_struct_len(VALUE st)
|
618
|
-
{
|
619
|
-
return (RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ?
|
620
|
-
RSTRUCT_EMBED_LEN(st) : RSTRUCT(st)->as.heap.len;
|
621
|
-
}
|
622
|
-
|
623
|
-
static inline const VALUE *
|
624
|
-
rb_struct_const_ptr(VALUE st)
|
625
|
-
{
|
626
|
-
return FIX_CONST_VALUE_PTR((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ?
|
627
|
-
RSTRUCT(st)->as.ary : RSTRUCT(st)->as.heap.ptr);
|
628
|
-
}
|
629
|
-
|
630
484
|
/* class.c */
|
631
|
-
|
632
|
-
struct rb_deprecated_classext_struct {
|
633
|
-
char conflict[sizeof(VALUE) * 3];
|
634
|
-
};
|
635
|
-
|
636
|
-
struct rb_subclass_entry;
|
637
|
-
typedef struct rb_subclass_entry rb_subclass_entry_t;
|
638
|
-
|
639
|
-
struct rb_subclass_entry {
|
640
|
-
VALUE klass;
|
641
|
-
rb_subclass_entry_t *next;
|
642
|
-
};
|
643
|
-
|
644
|
-
#if defined(HAVE_LONG_LONG)
|
645
|
-
typedef unsigned LONG_LONG rb_serial_t;
|
646
|
-
#define SERIALT2NUM ULL2NUM
|
647
|
-
#elif defined(HAVE_UINT64_T)
|
648
|
-
typedef uint64_t rb_serial_t;
|
649
|
-
#define SERIALT2NUM SIZET2NUM
|
650
|
-
#else
|
651
|
-
typedef unsigned long rb_serial_t;
|
652
|
-
#define SERIALT2NUM ULONG2NUM
|
653
|
-
#endif
|
654
|
-
|
655
|
-
struct rb_classext_struct {
|
656
|
-
struct st_table *iv_index_tbl;
|
657
|
-
struct st_table *iv_tbl;
|
658
|
-
struct rb_id_table *const_tbl;
|
659
|
-
struct rb_id_table *callable_m_tbl;
|
660
|
-
rb_subclass_entry_t *subclasses;
|
661
|
-
rb_subclass_entry_t **parent_subclasses;
|
662
|
-
/**
|
663
|
-
* In the case that this is an `ICLASS`, `module_subclasses` points to the link
|
664
|
-
* in the module's `subclasses` list that indicates that the klass has been
|
665
|
-
* included. Hopefully that makes sense.
|
666
|
-
*/
|
667
|
-
rb_subclass_entry_t **module_subclasses;
|
668
|
-
rb_serial_t class_serial;
|
669
|
-
const VALUE origin_;
|
670
|
-
VALUE refined_class;
|
671
|
-
rb_alloc_func_t allocator;
|
672
|
-
};
|
673
|
-
|
674
|
-
typedef struct rb_classext_struct rb_classext_t;
|
675
|
-
|
676
|
-
#undef RClass
|
677
|
-
struct RClass {
|
678
|
-
struct RBasic basic;
|
679
|
-
VALUE super;
|
680
|
-
rb_classext_t *ptr;
|
681
|
-
struct rb_id_table *m_tbl;
|
682
|
-
};
|
683
|
-
|
684
485
|
void rb_class_subclass_add(VALUE super, VALUE klass);
|
685
486
|
void rb_class_remove_from_super_subclasses(VALUE);
|
686
|
-
int rb_singleton_class_internal_p(VALUE sklass);
|
687
487
|
|
688
488
|
#define RCLASS_EXT(c) (RCLASS(c)->ptr)
|
689
489
|
#define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl)
|
690
490
|
#define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl)
|
691
|
-
#define
|
692
|
-
#define
|
491
|
+
#define RCLASS_M_TBL_WRAPPER(c) (RCLASS(c)->m_tbl_wrapper)
|
492
|
+
#define RCLASS_M_TBL(c) (RCLASS_M_TBL_WRAPPER(c) ? RCLASS_M_TBL_WRAPPER(c)->tbl : 0)
|
693
493
|
#define RCLASS_IV_INDEX_TBL(c) (RCLASS_EXT(c)->iv_index_tbl)
|
694
|
-
#define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->
|
494
|
+
#define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin)
|
695
495
|
#define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class)
|
696
496
|
#define RCLASS_SERIAL(c) (RCLASS_EXT(c)->class_serial)
|
697
497
|
|
698
|
-
#define RICLASS_IS_ORIGIN FL_USER5
|
699
|
-
|
700
498
|
static inline void
|
701
|
-
|
499
|
+
RCLASS_M_TBL_INIT(VALUE c)
|
702
500
|
{
|
703
|
-
|
704
|
-
|
501
|
+
struct method_table_wrapper *wrapper;
|
502
|
+
wrapper = ALLOC(struct method_table_wrapper);
|
503
|
+
wrapper->tbl = st_init_numtable();
|
504
|
+
wrapper->serial = 0;
|
505
|
+
RCLASS_M_TBL_WRAPPER(c) = wrapper;
|
705
506
|
}
|
706
507
|
|
707
508
|
#undef RCLASS_SUPER
|
@@ -721,162 +522,6 @@ RCLASS_SET_SUPER(VALUE klass, VALUE super)
|
|
721
522
|
RB_OBJ_WRITE(klass, &RCLASS(klass)->super, super);
|
722
523
|
return super;
|
723
524
|
}
|
724
|
-
/* IMEMO: Internal memo object */
|
725
|
-
|
726
|
-
#ifndef IMEMO_DEBUG
|
727
|
-
#define IMEMO_DEBUG 0
|
728
|
-
#endif
|
729
|
-
|
730
|
-
struct RIMemo {
|
731
|
-
VALUE flags;
|
732
|
-
VALUE v0;
|
733
|
-
VALUE v1;
|
734
|
-
VALUE v2;
|
735
|
-
VALUE v3;
|
736
|
-
};
|
737
|
-
|
738
|
-
enum imemo_type {
|
739
|
-
imemo_env = 0,
|
740
|
-
imemo_cref = 1,
|
741
|
-
imemo_svar = 2,
|
742
|
-
imemo_throw_data = 3,
|
743
|
-
imemo_ifunc = 4,
|
744
|
-
imemo_memo = 5,
|
745
|
-
imemo_ment = 6,
|
746
|
-
imemo_iseq = 7,
|
747
|
-
imemo_mask = 0x07
|
748
|
-
};
|
749
|
-
|
750
|
-
static inline enum imemo_type
|
751
|
-
imemo_type(VALUE imemo)
|
752
|
-
{
|
753
|
-
return (RBASIC(imemo)->flags >> FL_USHIFT) & imemo_mask;
|
754
|
-
}
|
755
|
-
|
756
|
-
/* FL_USER0 to FL_USER2 is for type */
|
757
|
-
#define IMEMO_FL_USHIFT (FL_USHIFT + 3)
|
758
|
-
#define IMEMO_FL_USER0 FL_USER3
|
759
|
-
#define IMEMO_FL_USER1 FL_USER4
|
760
|
-
#define IMEMO_FL_USER2 FL_USER5
|
761
|
-
#define IMEMO_FL_USER3 FL_USER6
|
762
|
-
#define IMEMO_FL_USER4 FL_USER7
|
763
|
-
|
764
|
-
/* CREF in method.h */
|
765
|
-
|
766
|
-
/* SVAR */
|
767
|
-
|
768
|
-
struct vm_svar {
|
769
|
-
VALUE flags;
|
770
|
-
const VALUE cref_or_me;
|
771
|
-
const VALUE lastline;
|
772
|
-
const VALUE backref;
|
773
|
-
const VALUE others;
|
774
|
-
};
|
775
|
-
|
776
|
-
/* THROW_DATA */
|
777
|
-
|
778
|
-
struct vm_throw_data {
|
779
|
-
VALUE flags;
|
780
|
-
VALUE reserved;
|
781
|
-
const VALUE throw_obj;
|
782
|
-
const struct rb_control_frame_struct *catch_frame;
|
783
|
-
VALUE throw_state;
|
784
|
-
};
|
785
|
-
|
786
|
-
#define THROW_DATA_P(err) RB_TYPE_P((err), T_IMEMO)
|
787
|
-
|
788
|
-
/* IFUNC */
|
789
|
-
|
790
|
-
struct vm_ifunc {
|
791
|
-
VALUE flags;
|
792
|
-
VALUE reserved;
|
793
|
-
VALUE (*func)(ANYARGS);
|
794
|
-
const void *data;
|
795
|
-
ID id;
|
796
|
-
};
|
797
|
-
|
798
|
-
#define IFUNC_NEW(a, b, c) ((struct vm_ifunc *)rb_imemo_new(imemo_ifunc, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
|
799
|
-
|
800
|
-
/* MEMO */
|
801
|
-
|
802
|
-
struct MEMO {
|
803
|
-
VALUE flags;
|
804
|
-
VALUE reserved;
|
805
|
-
const VALUE v1;
|
806
|
-
const VALUE v2;
|
807
|
-
union {
|
808
|
-
long cnt;
|
809
|
-
long state;
|
810
|
-
const VALUE value;
|
811
|
-
VALUE (*func)(ANYARGS);
|
812
|
-
} u3;
|
813
|
-
};
|
814
|
-
|
815
|
-
#define MEMO_V1_SET(m, v) RB_OBJ_WRITE((m), &(m)->v1, (v))
|
816
|
-
#define MEMO_V2_SET(m, v) RB_OBJ_WRITE((m), &(m)->v2, (v))
|
817
|
-
|
818
|
-
#define MEMO_CAST(m) ((struct MEMO *)m)
|
819
|
-
|
820
|
-
#define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
|
821
|
-
|
822
|
-
#define roomof(x, y) (((x) + (y) - 1) / (y))
|
823
|
-
#define type_roomof(x, y) roomof(sizeof(x), sizeof(y))
|
824
|
-
#define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
|
825
|
-
#define NEW_MEMO_FOR(type, value) \
|
826
|
-
((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value))
|
827
|
-
#define NEW_PARTIAL_MEMO_FOR(type, value, member) \
|
828
|
-
((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), \
|
829
|
-
rb_ary_set_len((value), offsetof(type, member) / sizeof(VALUE)), \
|
830
|
-
MEMO_FOR(type, value))
|
831
|
-
|
832
|
-
#define STRING_P(s) (RB_TYPE_P((s), T_STRING) && CLASS_OF(s) == rb_cString)
|
833
|
-
|
834
|
-
#ifdef RUBY_INTEGER_UNIFICATION
|
835
|
-
# define rb_cFixnum rb_cInteger
|
836
|
-
# define rb_cBignum rb_cInteger
|
837
|
-
#endif
|
838
|
-
|
839
|
-
enum {
|
840
|
-
cmp_opt_Fixnum,
|
841
|
-
cmp_opt_String,
|
842
|
-
cmp_optimizable_count
|
843
|
-
};
|
844
|
-
|
845
|
-
struct cmp_opt_data {
|
846
|
-
int opt_methods;
|
847
|
-
int opt_inited;
|
848
|
-
};
|
849
|
-
|
850
|
-
#define NEW_CMP_OPT_MEMO(type, value) \
|
851
|
-
NEW_PARTIAL_MEMO_FOR(type, value, cmp_opt)
|
852
|
-
#define CMP_OPTIMIZABLE_BIT(type) (1U << TOKEN_PASTE(cmp_opt_,type))
|
853
|
-
#define CMP_OPTIMIZABLE(data, type) \
|
854
|
-
(((data).opt_inited & CMP_OPTIMIZABLE_BIT(type)) ? \
|
855
|
-
((data).opt_methods & CMP_OPTIMIZABLE_BIT(type)) : \
|
856
|
-
(((data).opt_inited |= CMP_OPTIMIZABLE_BIT(type)), \
|
857
|
-
rb_method_basic_definition_p(TOKEN_PASTE(rb_c,type), id_cmp) && \
|
858
|
-
((data).opt_methods |= CMP_OPTIMIZABLE_BIT(type))))
|
859
|
-
|
860
|
-
#define OPTIMIZED_CMP(a, b, data) \
|
861
|
-
((FIXNUM_P(a) && FIXNUM_P(b) && CMP_OPTIMIZABLE(data, Fixnum)) ? \
|
862
|
-
(((long)a > (long)b) ? 1 : ((long)a < (long)b) ? -1 : 0) : \
|
863
|
-
(STRING_P(a) && STRING_P(b) && CMP_OPTIMIZABLE(data, String)) ? \
|
864
|
-
rb_str_cmp(a, b) : \
|
865
|
-
rb_cmpint(rb_funcallv(a, id_cmp, 1, &b), a, b))
|
866
|
-
|
867
|
-
/* ment is in method.h */
|
868
|
-
|
869
|
-
/* global variable */
|
870
|
-
|
871
|
-
struct rb_global_entry {
|
872
|
-
struct rb_global_variable *var;
|
873
|
-
ID id;
|
874
|
-
};
|
875
|
-
|
876
|
-
struct rb_global_entry *rb_global_entry(ID);
|
877
|
-
VALUE rb_gvar_get(struct rb_global_entry *);
|
878
|
-
VALUE rb_gvar_set(struct rb_global_entry *, VALUE);
|
879
|
-
VALUE rb_gvar_defined(struct rb_global_entry *);
|
880
525
|
|
881
526
|
struct vtm; /* defined by timev.h */
|
882
527
|
|
@@ -885,7 +530,6 @@ VALUE rb_ary_last(int, const VALUE *, VALUE);
|
|
885
530
|
void rb_ary_set_len(VALUE, long);
|
886
531
|
void rb_ary_delete_same(VALUE, VALUE);
|
887
532
|
VALUE rb_ary_tmp_new_fill(long capa);
|
888
|
-
VALUE rb_ary_at(VALUE, VALUE);
|
889
533
|
size_t rb_ary_memsize(VALUE);
|
890
534
|
#ifdef __GNUC__
|
891
535
|
#define rb_ary_new_from_args(n, ...) \
|
@@ -902,30 +546,11 @@ size_t rb_ary_memsize(VALUE);
|
|
902
546
|
extern const char ruby_digitmap[];
|
903
547
|
VALUE rb_big_fdiv(VALUE x, VALUE y);
|
904
548
|
VALUE rb_big_uminus(VALUE x);
|
905
|
-
VALUE rb_big_hash(VALUE);
|
906
|
-
VALUE rb_big_odd_p(VALUE);
|
907
|
-
VALUE rb_big_even_p(VALUE);
|
908
|
-
size_t rb_big_size(VALUE);
|
909
549
|
VALUE rb_integer_float_cmp(VALUE x, VALUE y);
|
910
550
|
VALUE rb_integer_float_eq(VALUE x, VALUE y);
|
911
|
-
VALUE rb_cstr_parse_inum(const char *str, ssize_t len, char **endp, int base);
|
912
|
-
VALUE rb_big_comp(VALUE x);
|
913
|
-
VALUE rb_big_aref(VALUE x, VALUE y);
|
914
|
-
VALUE rb_big_abs(VALUE x);
|
915
|
-
VALUE rb_big_size_m(VALUE big);
|
916
|
-
VALUE rb_big_bit_length(VALUE big);
|
917
|
-
VALUE rb_big_remainder(VALUE x, VALUE y);
|
918
|
-
VALUE rb_big_gt(VALUE x, VALUE y);
|
919
|
-
VALUE rb_big_ge(VALUE x, VALUE y);
|
920
|
-
VALUE rb_big_lt(VALUE x, VALUE y);
|
921
|
-
VALUE rb_big_le(VALUE x, VALUE y);
|
922
551
|
|
923
552
|
/* class.c */
|
924
|
-
VALUE
|
925
|
-
VALUE rb_class_inherited(VALUE, VALUE);
|
926
|
-
VALUE rb_make_metaclass(VALUE, VALUE);
|
927
|
-
VALUE rb_include_class_new(VALUE, VALUE);
|
928
|
-
void rb_class_foreach_subclass(VALUE klass, void (*f)(VALUE, VALUE), VALUE);
|
553
|
+
void rb_class_foreach_subclass(VALUE klass, void(*f)(VALUE));
|
929
554
|
void rb_class_detach_subclasses(VALUE);
|
930
555
|
void rb_class_detach_module_subclasses(VALUE);
|
931
556
|
void rb_class_remove_from_module_subclasses(VALUE);
|
@@ -939,24 +564,17 @@ VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach);
|
|
939
564
|
VALUE rb_singleton_class_get(VALUE obj);
|
940
565
|
void Init_class_hierarchy(void);
|
941
566
|
|
942
|
-
int rb_class_has_methods(VALUE c);
|
943
|
-
|
944
567
|
/* compar.c */
|
945
568
|
VALUE rb_invcmp(VALUE, VALUE);
|
946
569
|
|
947
570
|
/* compile.c */
|
948
|
-
|
949
|
-
int
|
950
|
-
int
|
951
|
-
|
571
|
+
int rb_dvar_defined(ID);
|
572
|
+
int rb_local_defined(ID);
|
573
|
+
int rb_parse_in_eval(void);
|
574
|
+
int rb_parse_in_main(void);
|
575
|
+
const char * rb_insns_name(int i);
|
952
576
|
VALUE rb_insns_name_array(void);
|
953
577
|
|
954
|
-
/* complex.c */
|
955
|
-
VALUE rb_complex_plus(VALUE, VALUE);
|
956
|
-
VALUE rb_complex_mul(VALUE, VALUE);
|
957
|
-
VALUE rb_complex_abs(VALUE x);
|
958
|
-
VALUE rb_complex_sqrt(VALUE x);
|
959
|
-
|
960
578
|
/* cont.c */
|
961
579
|
VALUE rb_obj_is_fiber(VALUE);
|
962
580
|
void rb_fiber_reset_root_local_storage(VALUE);
|
@@ -970,10 +588,33 @@ void Init_enc(void);
|
|
970
588
|
void Init_ext(void);
|
971
589
|
|
972
590
|
/* encoding.c */
|
591
|
+
enum ruby_preserved_encindex {
|
592
|
+
ENCINDEX_ASCII,
|
593
|
+
ENCINDEX_UTF_8,
|
594
|
+
ENCINDEX_US_ASCII,
|
595
|
+
|
596
|
+
/* preserved indexes */
|
597
|
+
ENCINDEX_UTF_16BE,
|
598
|
+
ENCINDEX_UTF_16LE,
|
599
|
+
ENCINDEX_UTF_32BE,
|
600
|
+
ENCINDEX_UTF_32LE,
|
601
|
+
ENCINDEX_UTF_16,
|
602
|
+
ENCINDEX_UTF_32,
|
603
|
+
ENCINDEX_UTF8_MAC,
|
604
|
+
|
605
|
+
/* for old options of regexp */
|
606
|
+
ENCINDEX_EUC_JP,
|
607
|
+
ENCINDEX_Windows_31J,
|
608
|
+
|
609
|
+
ENCINDEX_BUILTIN_MAX
|
610
|
+
};
|
611
|
+
|
612
|
+
#define rb_ascii8bit_encindex() ENCINDEX_ASCII
|
613
|
+
#define rb_utf8_encindex() ENCINDEX_UTF_8
|
614
|
+
#define rb_usascii_encindex() ENCINDEX_US_ASCII
|
973
615
|
ID rb_id_encoding(void);
|
974
|
-
|
616
|
+
void rb_gc_mark_encodings(void);
|
975
617
|
rb_encoding *rb_enc_get_from_index(int index);
|
976
|
-
rb_encoding *rb_enc_check_str(VALUE str1, VALUE str2);
|
977
618
|
int rb_encdb_replicate(const char *alias, const char *orig);
|
978
619
|
int rb_encdb_alias(const char *alias, const char *orig);
|
979
620
|
int rb_encdb_dummy(const char *name);
|
@@ -981,19 +622,15 @@ void rb_encdb_declare(const char *name);
|
|
981
622
|
void rb_enc_set_base(const char *name, const char *orig);
|
982
623
|
int rb_enc_set_dummy(int index);
|
983
624
|
void rb_encdb_set_unicode(int index);
|
984
|
-
PUREFUNC(int rb_data_is_encoding(VALUE obj));
|
985
625
|
|
986
626
|
/* enum.c */
|
987
627
|
VALUE rb_f_send(int argc, VALUE *argv, VALUE recv);
|
988
|
-
VALUE rb_nmin_run(VALUE obj, VALUE num, int by, int rev, int ary);
|
989
628
|
|
990
629
|
/* error.c */
|
991
630
|
extern VALUE rb_eEAGAIN;
|
992
631
|
extern VALUE rb_eEWOULDBLOCK;
|
993
632
|
extern VALUE rb_eEINPROGRESS;
|
994
|
-
void
|
995
|
-
PRINTF_ARGS(void rb_compile_error_str(VALUE file, int line, void *enc, const char *fmt, ...), 4, 5);
|
996
|
-
VALUE rb_syntax_error_append(VALUE, VALUE, int, int, rb_encoding*, const char*, va_list);
|
633
|
+
NORETURN(PRINTF_ARGS(void rb_compile_bug(const char*, int, const char*, ...), 3, 4));
|
997
634
|
VALUE rb_check_backtrace(VALUE);
|
998
635
|
NORETURN(void rb_async_bug_errno(const char *,int));
|
999
636
|
const char *rb_builtin_type_name(int t);
|
@@ -1001,13 +638,6 @@ const char *rb_builtin_class_name(VALUE x);
|
|
1001
638
|
PRINTF_ARGS(void rb_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
1002
639
|
PRINTF_ARGS(void rb_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
1003
640
|
PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
1004
|
-
VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method);
|
1005
|
-
#define rb_name_err_raise_str(mesg, recv, name) \
|
1006
|
-
rb_exc_raise(rb_name_err_new(mesg, recv, name))
|
1007
|
-
#define rb_name_err_raise(mesg, recv, name) \
|
1008
|
-
rb_name_err_raise_str(rb_fstring_cstr(mesg), (recv), (name))
|
1009
|
-
NORETURN(void ruby_only_for_internal_use(const char *));
|
1010
|
-
#define ONLY_FOR_INTERNAL_USE(func) ruby_only_for_internal_use(func)
|
1011
641
|
|
1012
642
|
/* eval.c */
|
1013
643
|
VALUE rb_refinement_module_get_refined_class(VALUE module);
|
@@ -1031,7 +661,6 @@ VALUE rb_file_expand_path_internal(VALUE, VALUE, int, int, VALUE);
|
|
1031
661
|
VALUE rb_get_path_check_to_string(VALUE, int);
|
1032
662
|
VALUE rb_get_path_check_convert(VALUE, VALUE, int);
|
1033
663
|
void Init_File(void);
|
1034
|
-
int ruby_is_fd_loadable(int fd);
|
1035
664
|
|
1036
665
|
#ifdef RUBY_FUNCTION_NAME_STRING
|
1037
666
|
# if defined __GNUC__ && __GNUC__ >= 4
|
@@ -1078,29 +707,19 @@ void ruby_sized_xfree(void *x, size_t size);
|
|
1078
707
|
|
1079
708
|
void rb_gc_resurrect(VALUE ptr);
|
1080
709
|
|
1081
|
-
/* optimized version of NEWOBJ() */
|
1082
|
-
#undef NEWOBJF_OF
|
1083
|
-
#undef RB_NEWOBJ_OF
|
1084
|
-
#define RB_NEWOBJ_OF(obj,type,klass,flags) \
|
1085
|
-
type *(obj) = (type*)(((flags) & FL_WB_PROTECTED) ? \
|
1086
|
-
rb_wb_protected_newobj_of(klass, (flags) & ~FL_WB_PROTECTED) : \
|
1087
|
-
rb_wb_unprotected_newobj_of(klass, flags))
|
1088
|
-
#define NEWOBJ_OF(obj,type,klass,flags) RB_NEWOBJ_OF(obj,type,klass,flags)
|
1089
|
-
|
1090
710
|
/* hash.c */
|
1091
711
|
struct st_table *rb_hash_tbl_raw(VALUE hash);
|
1092
712
|
VALUE rb_hash_has_key(VALUE hash, VALUE key);
|
1093
|
-
VALUE rb_hash_default_value(VALUE hash, VALUE key);
|
1094
713
|
VALUE rb_hash_set_default_proc(VALUE hash, VALUE proc);
|
1095
714
|
long rb_objid_hash(st_index_t index);
|
715
|
+
VALUE rb_ident_hash_new(void);
|
1096
716
|
st_table *rb_init_identtable(void);
|
1097
717
|
st_table *rb_init_identtable_with_size(st_index_t size);
|
718
|
+
VALUE rb_hash_compare_by_id_p(VALUE hash);
|
1098
719
|
|
1099
720
|
#define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
|
1100
721
|
VALUE rb_hash_keys(VALUE hash);
|
1101
722
|
VALUE rb_hash_values(VALUE hash);
|
1102
|
-
VALUE rb_hash_rehash(VALUE hash);
|
1103
|
-
int rb_hash_add_new_element(VALUE hash, VALUE key, VALUE val);
|
1104
723
|
#define HASH_DELETED FL_USER1
|
1105
724
|
#define HASH_PROC_DEFAULT FL_USER2
|
1106
725
|
|
@@ -1112,9 +731,20 @@ const char *ruby_get_inplace_mode(void);
|
|
1112
731
|
void ruby_set_inplace_mode(const char *);
|
1113
732
|
ssize_t rb_io_bufread(VALUE io, void *buf, size_t size);
|
1114
733
|
void rb_stdio_set_default_encoding(void);
|
734
|
+
void rb_write_error_str(VALUE mesg);
|
1115
735
|
VALUE rb_io_flush_raw(VALUE, int);
|
1116
736
|
size_t rb_io_memsize(const rb_io_t *);
|
1117
737
|
|
738
|
+
/* iseq.c */
|
739
|
+
VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase);
|
740
|
+
VALUE rb_iseq_path(VALUE iseqval);
|
741
|
+
VALUE rb_iseq_absolute_path(VALUE iseqval);
|
742
|
+
VALUE rb_iseq_label(VALUE iseqval);
|
743
|
+
VALUE rb_iseq_base_label(VALUE iseqval);
|
744
|
+
VALUE rb_iseq_first_lineno(VALUE iseqval);
|
745
|
+
VALUE rb_iseq_klass(VALUE iseqval); /* completely temporary fucntion */
|
746
|
+
VALUE rb_iseq_method_name(VALUE self);
|
747
|
+
|
1118
748
|
/* load.c */
|
1119
749
|
VALUE rb_get_load_path(void);
|
1120
750
|
VALUE rb_get_expanded_load_path(void);
|
@@ -1137,7 +767,9 @@ VALUE rb_math_hypot(VALUE, VALUE);
|
|
1137
767
|
VALUE rb_math_log(int argc, const VALUE *argv);
|
1138
768
|
VALUE rb_math_sin(VALUE);
|
1139
769
|
VALUE rb_math_sinh(VALUE);
|
770
|
+
#if 0
|
1140
771
|
VALUE rb_math_sqrt(VALUE);
|
772
|
+
#endif
|
1141
773
|
|
1142
774
|
/* newline.c */
|
1143
775
|
void Init_newline(void);
|
@@ -1150,17 +782,7 @@ double ruby_float_mod(double x, double y);
|
|
1150
782
|
int rb_num_negative_p(VALUE);
|
1151
783
|
VALUE rb_int_succ(VALUE num);
|
1152
784
|
VALUE rb_int_pred(VALUE num);
|
1153
|
-
VALUE rb_int_uminus(VALUE num);
|
1154
|
-
VALUE rb_int_plus(VALUE x, VALUE y);
|
1155
|
-
VALUE rb_int_minus(VALUE x, VALUE y);
|
1156
|
-
VALUE rb_int_mul(VALUE x, VALUE y);
|
1157
|
-
VALUE rb_int_idiv(VALUE x, VALUE y);
|
1158
|
-
VALUE rb_int_modulo(VALUE x, VALUE y);
|
1159
|
-
VALUE rb_int_round(VALUE num, int ndigits);
|
1160
|
-
VALUE rb_int2str(VALUE num, int base);
|
1161
785
|
VALUE rb_dbl_hash(double d);
|
1162
|
-
VALUE rb_fix_plus(VALUE x, VALUE y);
|
1163
|
-
VALUE rb_int_ge(VALUE x, VALUE y);
|
1164
786
|
|
1165
787
|
#if USE_FLONUM
|
1166
788
|
#define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n)))
|
@@ -1168,41 +790,31 @@ VALUE rb_int_ge(VALUE x, VALUE y);
|
|
1168
790
|
#endif
|
1169
791
|
|
1170
792
|
static inline double
|
1171
|
-
|
793
|
+
rb_float_value_inline(VALUE v)
|
1172
794
|
{
|
1173
795
|
#if USE_FLONUM
|
1174
|
-
if (v
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
796
|
+
if (FLONUM_P(v)) {
|
797
|
+
if (v != (VALUE)0x8000000000000002) { /* LIKELY */
|
798
|
+
union {
|
799
|
+
double d;
|
800
|
+
VALUE v;
|
801
|
+
} t;
|
802
|
+
|
803
|
+
VALUE b63 = (v >> 63);
|
804
|
+
/* e: xx1... -> 011... */
|
805
|
+
/* xx0... -> 100... */
|
806
|
+
/* ^b63 */
|
807
|
+
t.v = RUBY_BIT_ROTR((2 - b63) | (v & ~0x03), 3);
|
808
|
+
return t.d;
|
809
|
+
}
|
810
|
+
else {
|
811
|
+
return 0.0;
|
812
|
+
}
|
1186
813
|
}
|
1187
814
|
#endif
|
1188
|
-
return 0.0;
|
1189
|
-
}
|
1190
|
-
|
1191
|
-
static inline double
|
1192
|
-
rb_float_noflonum_value(VALUE v)
|
1193
|
-
{
|
1194
815
|
return ((struct RFloat *)v)->float_value;
|
1195
816
|
}
|
1196
817
|
|
1197
|
-
static inline double
|
1198
|
-
rb_float_value_inline(VALUE v)
|
1199
|
-
{
|
1200
|
-
if (FLONUM_P(v)) {
|
1201
|
-
return rb_float_flonum_value(v);
|
1202
|
-
}
|
1203
|
-
return rb_float_noflonum_value(v);
|
1204
|
-
}
|
1205
|
-
|
1206
818
|
static inline VALUE
|
1207
819
|
rb_float_new_inline(double d)
|
1208
820
|
{
|
@@ -1238,20 +850,17 @@ rb_float_new_inline(double d)
|
|
1238
850
|
|
1239
851
|
/* object.c */
|
1240
852
|
void rb_obj_copy_ivar(VALUE dest, VALUE obj);
|
1241
|
-
|
1242
|
-
CONSTFUNC(VALUE rb_obj_not(VALUE obj));
|
853
|
+
VALUE rb_obj_equal(VALUE obj1, VALUE obj2);
|
1243
854
|
VALUE rb_class_search_ancestor(VALUE klass, VALUE super);
|
1244
855
|
NORETURN(void rb_undefined_alloc(VALUE klass));
|
1245
|
-
double rb_num_to_dbl(VALUE val);
|
1246
|
-
VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound);
|
1247
856
|
|
1248
857
|
struct RBasicRaw {
|
1249
858
|
VALUE flags;
|
1250
859
|
VALUE klass;
|
1251
860
|
};
|
1252
861
|
|
1253
|
-
#define RBASIC_CLEAR_CLASS(obj)
|
1254
|
-
#define RBASIC_SET_CLASS_RAW(obj, cls)
|
862
|
+
#define RBASIC_CLEAR_CLASS(obj) (((struct RBasicRaw *)((VALUE)(obj)))->klass = 0)
|
863
|
+
#define RBASIC_SET_CLASS_RAW(obj, cls) (((struct RBasicRaw *)((VALUE)(obj)))->klass = (cls))
|
1255
864
|
#define RBASIC_SET_CLASS(obj, cls) do { \
|
1256
865
|
VALUE _obj_ = (obj); \
|
1257
866
|
RB_OBJ_WRITE(_obj_, &((struct RBasicRaw *)(_obj_))->klass, cls); \
|
@@ -1263,8 +872,6 @@ struct RBasicRaw {
|
|
1263
872
|
#endif
|
1264
873
|
VALUE rb_parser_get_yydebug(VALUE);
|
1265
874
|
VALUE rb_parser_set_yydebug(VALUE, VALUE);
|
1266
|
-
VALUE rb_parser_set_context(VALUE, const struct rb_block *, int);
|
1267
|
-
void *rb_parser_load_file(VALUE parser, VALUE name);
|
1268
875
|
int rb_is_const_name(VALUE name);
|
1269
876
|
int rb_is_class_name(VALUE name);
|
1270
877
|
int rb_is_global_name(VALUE name);
|
@@ -1273,14 +880,14 @@ int rb_is_attrset_name(VALUE name);
|
|
1273
880
|
int rb_is_local_name(VALUE name);
|
1274
881
|
int rb_is_method_name(VALUE name);
|
1275
882
|
int rb_is_junk_name(VALUE name);
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
883
|
+
int rb_is_const_sym(VALUE sym);
|
884
|
+
int rb_is_class_sym(VALUE sym);
|
885
|
+
int rb_is_global_sym(VALUE sym);
|
886
|
+
int rb_is_instance_sym(VALUE sym);
|
887
|
+
int rb_is_attrset_sym(VALUE sym);
|
888
|
+
int rb_is_local_sym(VALUE sym);
|
889
|
+
int rb_is_method_sym(VALUE sym);
|
890
|
+
int rb_is_junk_sym(VALUE sym);
|
1284
891
|
ID rb_make_internal_id(void);
|
1285
892
|
void rb_gc_free_dsymbol(VALUE);
|
1286
893
|
ID rb_id_attrget(ID id);
|
@@ -1289,8 +896,7 @@ ID rb_id_attrget(ID id);
|
|
1289
896
|
VALUE rb_proc_location(VALUE self);
|
1290
897
|
st_index_t rb_hash_proc(st_index_t hash, VALUE proc);
|
1291
898
|
int rb_block_arity(void);
|
1292
|
-
VALUE
|
1293
|
-
VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val);
|
899
|
+
VALUE rb_block_clear_env_self(VALUE proc);
|
1294
900
|
|
1295
901
|
/* process.c */
|
1296
902
|
#define RB_MAX_GROUPS (65536)
|
@@ -1348,7 +954,6 @@ rb_pid_t rb_fork_ruby(int *status);
|
|
1348
954
|
void rb_last_status_clear(void);
|
1349
955
|
|
1350
956
|
/* rational.c */
|
1351
|
-
VALUE rb_rational_plus(VALUE self, VALUE other);
|
1352
957
|
VALUE rb_lcm(VALUE x, VALUE y);
|
1353
958
|
VALUE rb_rational_reciprocal(VALUE x);
|
1354
959
|
VALUE rb_cstr_to_rat(const char *, int);
|
@@ -1358,8 +963,6 @@ VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourcel
|
|
1358
963
|
VALUE rb_reg_check_preprocess(VALUE);
|
1359
964
|
long rb_reg_search0(VALUE, VALUE, long, int, int);
|
1360
965
|
void rb_backref_set_string(VALUE string, long pos, long len);
|
1361
|
-
int rb_match_count(VALUE match);
|
1362
|
-
int rb_match_nth_defined(int nth, VALUE match);
|
1363
966
|
|
1364
967
|
/* signal.c */
|
1365
968
|
extern int ruby_enable_coredump;
|
@@ -1368,52 +971,26 @@ int rb_sigaltstack_size(void);
|
|
1368
971
|
|
1369
972
|
/* strftime.c */
|
1370
973
|
#ifdef RUBY_ENCODING_H
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
974
|
+
size_t rb_strftime_timespec(char *s, size_t maxsize, const char *format, rb_encoding *enc,
|
975
|
+
const struct vtm *vtm, struct timespec *ts, int gmt);
|
976
|
+
size_t rb_strftime(char *s, size_t maxsize, const char *format, rb_encoding *enc,
|
977
|
+
const struct vtm *vtm, VALUE timev, int gmt);
|
1375
978
|
#endif
|
1376
979
|
|
1377
980
|
/* string.c */
|
1378
981
|
void Init_frozen_strings(void);
|
1379
982
|
VALUE rb_fstring(VALUE);
|
1380
983
|
VALUE rb_fstring_new(const char *ptr, long len);
|
1381
|
-
#define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str))
|
1382
|
-
#define rb_fstring_literal(str) rb_fstring_lit(str)
|
1383
|
-
VALUE rb_fstring_cstr(const char *str);
|
1384
|
-
#ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
|
1385
|
-
# define rb_fstring_cstr(str) RB_GNUC_EXTENSION_BLOCK( \
|
1386
|
-
(__builtin_constant_p(str)) ? \
|
1387
|
-
rb_fstring_new((str), (long)strlen(str)) : \
|
1388
|
-
rb_fstring_cstr(str) \
|
1389
|
-
)
|
1390
|
-
#endif
|
1391
|
-
#ifdef RUBY_ENCODING_H
|
1392
|
-
VALUE rb_fstring_enc_new(const char *ptr, long len, rb_encoding *enc);
|
1393
|
-
#define rb_fstring_enc_lit(str, enc) rb_fstring_enc_new((str), rb_strlen_lit(str), (enc))
|
1394
|
-
#define rb_fstring_enc_literal(str, enc) rb_fstring_enc_lit(str, enc)
|
1395
|
-
VALUE rb_fstring_enc_cstr(const char *ptr, rb_encoding *enc);
|
1396
|
-
# ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
|
1397
|
-
# define rb_fstring_enc_cstr(str, enc) RB_GNUC_EXTENSION_BLOCK( \
|
1398
|
-
(__builtin_constant_p(str)) ? \
|
1399
|
-
rb_fstring_enc_new((str), (long)strlen(str), (enc)) : \
|
1400
|
-
rb_fstring_enc_cstr(str, enc) \
|
1401
|
-
)
|
1402
|
-
# endif
|
1403
|
-
#endif
|
1404
984
|
int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p);
|
1405
985
|
int rb_str_symname_p(VALUE);
|
1406
986
|
VALUE rb_str_quote_unprintable(VALUE);
|
1407
987
|
VALUE rb_id_quote_unprintable(ID);
|
1408
988
|
#define QUOTE(str) rb_str_quote_unprintable(str)
|
1409
989
|
#define QUOTE_ID(id) rb_id_quote_unprintable(id)
|
1410
|
-
|
1411
|
-
void rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen);
|
990
|
+
void rb_str_fill_terminator(VALUE str, const int termlen);
|
1412
991
|
VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg);
|
1413
992
|
#ifdef RUBY_ENCODING_H
|
1414
993
|
VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc);
|
1415
|
-
VALUE rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len,
|
1416
|
-
rb_encoding *from, int ecflags, VALUE ecopts);
|
1417
994
|
VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl);
|
1418
995
|
#endif
|
1419
996
|
#define STR_NOEMBED FL_USER1
|
@@ -1423,36 +1000,9 @@ VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl);
|
|
1423
1000
|
#define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT)
|
1424
1001
|
#define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN)
|
1425
1002
|
size_t rb_str_memsize(VALUE);
|
1426
|
-
VALUE rb_sym_proc_call(ID mid, int argc, const VALUE *argv, VALUE passed_proc);
|
1427
|
-
VALUE rb_sym_to_proc(VALUE sym);
|
1428
|
-
|
1429
|
-
/* symbol.c */
|
1430
|
-
#ifdef RUBY_ENCODING_H
|
1431
|
-
VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc);
|
1432
|
-
VALUE rb_sym_intern_cstr(const char *ptr, rb_encoding *enc);
|
1433
|
-
#ifdef __GNUC__
|
1434
|
-
#define rb_sym_intern_cstr(ptr, enc) __extension__ ( \
|
1435
|
-
{ \
|
1436
|
-
(__builtin_constant_p(ptr)) ? \
|
1437
|
-
rb_sym_intern((ptr), (long)strlen(ptr), (enc)) : \
|
1438
|
-
rb_sym_intern_cstr((ptr), (enc)); \
|
1439
|
-
})
|
1440
|
-
#endif
|
1441
|
-
#endif
|
1442
|
-
VALUE rb_sym_intern_ascii(const char *ptr, long len);
|
1443
|
-
VALUE rb_sym_intern_ascii_cstr(const char *ptr);
|
1444
|
-
#ifdef __GNUC__
|
1445
|
-
#define rb_sym_intern_ascii_cstr(ptr) __extension__ ( \
|
1446
|
-
{ \
|
1447
|
-
(__builtin_constant_p(ptr)) ? \
|
1448
|
-
rb_sym_intern_ascii((ptr), (long)strlen(ptr)) : \
|
1449
|
-
rb_sym_intern_ascii_cstr(ptr); \
|
1450
|
-
})
|
1451
|
-
#endif
|
1452
1003
|
|
1453
1004
|
/* struct.c */
|
1454
1005
|
VALUE rb_struct_init_copy(VALUE copy, VALUE s);
|
1455
|
-
VALUE rb_struct_lookup(VALUE s, VALUE idx);
|
1456
1006
|
|
1457
1007
|
/* time.c */
|
1458
1008
|
struct timeval rb_time_timeval(VALUE);
|
@@ -1467,7 +1017,6 @@ VALUE rb_thread_shield_new(void);
|
|
1467
1017
|
VALUE rb_thread_shield_wait(VALUE self);
|
1468
1018
|
VALUE rb_thread_shield_release(VALUE self);
|
1469
1019
|
VALUE rb_thread_shield_destroy(VALUE self);
|
1470
|
-
int rb_thread_to_be_killed(VALUE thread);
|
1471
1020
|
void rb_mutex_allow_trap(VALUE self, int val);
|
1472
1021
|
VALUE rb_uninterruptible(VALUE (*b_proc)(ANYARGS), VALUE data);
|
1473
1022
|
VALUE rb_mutex_owned_p(VALUE self);
|
@@ -1475,7 +1024,6 @@ void ruby_kill(rb_pid_t pid, int sig);
|
|
1475
1024
|
|
1476
1025
|
/* thread_pthread.c, thread_win32.c */
|
1477
1026
|
void Init_native_thread(void);
|
1478
|
-
int rb_divert_reserved_fd(int fd);
|
1479
1027
|
|
1480
1028
|
/* transcode.c */
|
1481
1029
|
extern VALUE rb_cEncodingConverter;
|
@@ -1492,16 +1040,10 @@ char *ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign
|
|
1492
1040
|
extern rb_encoding OnigEncodingUTF_8;
|
1493
1041
|
|
1494
1042
|
/* variable.c */
|
1495
|
-
void rb_gc_mark_global_tbl(void);
|
1496
1043
|
size_t rb_generic_ivar_memsize(VALUE);
|
1497
|
-
VALUE rb_search_class_path(VALUE);
|
1498
|
-
VALUE rb_attr_delete(VALUE, ID);
|
1499
|
-
VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
|
1500
|
-
void rb_autoload_str(VALUE mod, ID id, VALUE file);
|
1501
|
-
void rb_deprecate_constant(VALUE mod, const char *name);
|
1502
1044
|
|
1503
1045
|
/* version.c */
|
1504
|
-
extern
|
1046
|
+
extern VALUE ruby_engine_name;
|
1505
1047
|
|
1506
1048
|
/* vm_insnhelper.h */
|
1507
1049
|
rb_serial_t rb_next_class_serial(void);
|
@@ -1511,22 +1053,18 @@ VALUE rb_obj_is_thread(VALUE obj);
|
|
1511
1053
|
void rb_vm_mark(void *ptr);
|
1512
1054
|
void Init_BareVM(void);
|
1513
1055
|
void Init_vm_objects(void);
|
1514
|
-
|
1056
|
+
VALUE rb_vm_top_self(void);
|
1515
1057
|
void rb_thread_recycle_stack_release(VALUE *);
|
1516
1058
|
void rb_vm_change_state(void);
|
1517
1059
|
void rb_vm_inc_const_missing_count(void);
|
1518
1060
|
void rb_thread_mark(void *th);
|
1519
1061
|
const void **rb_vm_get_insns_address_table(void);
|
1520
1062
|
VALUE rb_sourcefilename(void);
|
1521
|
-
VALUE rb_source_location(int *pline);
|
1522
|
-
const char *rb_source_loc(int *pline);
|
1523
1063
|
void rb_vm_pop_cfunc_frame(void);
|
1524
1064
|
int rb_vm_add_root_module(ID id, VALUE module);
|
1525
1065
|
void rb_vm_check_redefinition_by_prepend(VALUE klass);
|
1526
1066
|
VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements);
|
1527
1067
|
VALUE ruby_vm_sysstack_error_copy(void);
|
1528
|
-
PUREFUNC(st_table *rb_vm_fstring_table(void));
|
1529
|
-
|
1530
1068
|
|
1531
1069
|
/* vm_dump.c */
|
1532
1070
|
void rb_print_backtrace(void);
|
@@ -1538,9 +1076,7 @@ VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, V
|
|
1538
1076
|
typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE);
|
1539
1077
|
VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv,
|
1540
1078
|
rb_check_funcall_hook *hook, VALUE arg);
|
1541
|
-
VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE);
|
1542
1079
|
VALUE rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, int *stateptr);
|
1543
|
-
VALUE rb_yield_1(VALUE val);
|
1544
1080
|
|
1545
1081
|
/* vm_insnhelper.c */
|
1546
1082
|
VALUE rb_equal_opt(VALUE obj1, VALUE obj2);
|
@@ -1592,29 +1128,17 @@ VALUE rb_str2big_gmp(VALUE arg, int base, int badcheck);
|
|
1592
1128
|
|
1593
1129
|
/* error.c (export) */
|
1594
1130
|
int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
|
1595
|
-
NORETURN(void rb_unexpected_type(VALUE,int));
|
1596
|
-
#undef Check_Type
|
1597
|
-
#define Check_Type(v, t) \
|
1598
|
-
(!RB_TYPE_P((VALUE)(v), (t)) || \
|
1599
|
-
((t) == RUBY_T_DATA && RTYPEDDATA_P(v)) ? \
|
1600
|
-
rb_unexpected_type((VALUE)(v), (t)) : (void)0)
|
1601
1131
|
|
1602
1132
|
/* file.c (export) */
|
1603
|
-
#ifdef HAVE_READLINK
|
1604
|
-
VALUE rb_readlink(VALUE path, rb_encoding *enc);
|
1605
|
-
#endif
|
1606
1133
|
#ifdef __APPLE__
|
1607
1134
|
VALUE rb_str_normalize_ospath(const char *ptr, long len);
|
1608
1135
|
#endif
|
1609
1136
|
|
1610
1137
|
/* hash.c (export) */
|
1611
1138
|
VALUE rb_hash_delete_entry(VALUE hash, VALUE key);
|
1612
|
-
VALUE rb_ident_hash_new(void);
|
1613
1139
|
|
1614
1140
|
/* io.c (export) */
|
1615
1141
|
void rb_maygvl_fd_fix_cloexec(int fd);
|
1616
|
-
int rb_gc_for_fd(int err);
|
1617
|
-
void rb_write_error_str(VALUE mesg);
|
1618
1142
|
|
1619
1143
|
/* numeric.c (export) */
|
1620
1144
|
VALUE rb_int_positive_pow(long x, unsigned long y);
|
@@ -1626,8 +1150,7 @@ VALUE rb_execarg_new(int argc, const VALUE *argv, int accept_shell);
|
|
1626
1150
|
struct rb_execarg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
|
1627
1151
|
VALUE rb_execarg_init(int argc, const VALUE *argv, int accept_shell, VALUE execarg_obj);
|
1628
1152
|
int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val);
|
1629
|
-
void
|
1630
|
-
void rb_execarg_parent_end(VALUE execarg_obj);
|
1153
|
+
void rb_execarg_fixup(VALUE execarg_obj);
|
1631
1154
|
int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char* errmsg, size_t errmsg_buflen);
|
1632
1155
|
VALUE rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash);
|
1633
1156
|
void rb_execarg_setenv(VALUE execarg_obj, VALUE env);
|
@@ -1644,52 +1167,27 @@ VALUE rb_gcd_gmp(VALUE x, VALUE y);
|
|
1644
1167
|
VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc);
|
1645
1168
|
#endif
|
1646
1169
|
|
1647
|
-
/* thread.c (export) */
|
1648
|
-
int ruby_thread_has_gvl_p(void); /* for ext/fiddle/closure.c */
|
1649
|
-
|
1650
1170
|
/* util.c (export) */
|
1651
1171
|
extern const signed char ruby_digit36_to_number_table[];
|
1652
|
-
extern const char ruby_hexdigits[];
|
1653
1172
|
extern unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow);
|
1654
1173
|
|
1655
1174
|
/* variable.c (export) */
|
1175
|
+
void rb_gc_mark_global_tbl(void);
|
1656
1176
|
void rb_mark_generic_ivar(VALUE);
|
1177
|
+
void rb_mark_generic_ivar_tbl(void);
|
1657
1178
|
VALUE rb_const_missing(VALUE klass, VALUE name);
|
1658
|
-
|
1179
|
+
|
1180
|
+
int rb_st_insert_id_and_value(VALUE obj, st_table *tbl, ID key, VALUE value);
|
1659
1181
|
st_table *rb_st_copy(VALUE obj, struct st_table *orig_tbl);
|
1660
1182
|
|
1661
1183
|
/* gc.c (export) */
|
1662
|
-
VALUE rb_wb_protected_newobj_of(VALUE, VALUE);
|
1663
|
-
VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE);
|
1664
|
-
|
1665
1184
|
size_t rb_obj_memsize_of(VALUE);
|
1666
|
-
void rb_gc_verify_internal_consistency(void);
|
1667
|
-
|
1668
1185
|
#define RB_OBJ_GC_FLAGS_MAX 5
|
1669
1186
|
size_t rb_obj_gc_flags(VALUE, ID[], size_t);
|
1670
1187
|
void rb_gc_mark_values(long n, const VALUE *values);
|
1671
1188
|
|
1672
|
-
#if IMEMO_DEBUG
|
1673
|
-
VALUE rb_imemo_new_debug(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0, const char *file, int line);
|
1674
|
-
#define rb_imemo_new(type, v1, v2, v3, v0) rb_imemo_new_debug(type, v1, v2, v3, v0, __FILE__, __LINE__)
|
1675
|
-
#else
|
1676
|
-
VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0);
|
1677
|
-
#endif
|
1678
|
-
|
1679
1189
|
RUBY_SYMBOL_EXPORT_END
|
1680
1190
|
|
1681
|
-
#define RUBY_DTRACE_CREATE_HOOK(name, arg) \
|
1682
|
-
RUBY_DTRACE_HOOK(name##_CREATE, arg)
|
1683
|
-
#define RUBY_DTRACE_HOOK(name, arg) \
|
1684
|
-
do { \
|
1685
|
-
if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
|
1686
|
-
int dtrace_line; \
|
1687
|
-
const char *dtrace_file = rb_source_loc(&dtrace_line); \
|
1688
|
-
if (!dtrace_file) dtrace_file = ""; \
|
1689
|
-
RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \
|
1690
|
-
} \
|
1691
|
-
} while (0)
|
1692
|
-
|
1693
1191
|
#if defined(__cplusplus)
|
1694
1192
|
#if 0
|
1695
1193
|
{ /* satisfy cc-mode */
|