zscan 2.0.8 → 2.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/ext/pack/pack-27.c +1 -0
  3. data/ext/pack/pack.c +1 -0
  4. data/ext/pack/ruby/backward/2/assume.h +43 -0
  5. data/ext/pack/ruby/backward/2/attributes.h +157 -0
  6. data/ext/pack/ruby/backward/2/bool.h +37 -0
  7. data/ext/pack/ruby/backward/2/extern.h +46 -0
  8. data/ext/pack/ruby/backward/2/gcc_version_since.h +38 -0
  9. data/ext/pack/ruby/backward/2/inttypes.h +132 -0
  10. data/ext/pack/ruby/backward/2/limits.h +100 -0
  11. data/ext/pack/ruby/backward/2/long_long.h +65 -0
  12. data/ext/pack/ruby/backward/2/r_cast.h +27 -0
  13. data/ext/pack/ruby/backward/2/rmodule.h +31 -0
  14. data/ext/pack/ruby/backward/2/stdalign.h +30 -0
  15. data/ext/pack/ruby/backward/2/stdarg.h +47 -0
  16. data/ext/pack/ruby/backward/classext.h +25 -0
  17. data/ext/pack/ruby/backward/rubyio.h +18 -0
  18. data/ext/pack/ruby/backward/rubysig.h +26 -0
  19. data/ext/pack/ruby/backward/st.h +18 -0
  20. data/ext/pack/ruby/backward/util.h +18 -0
  21. data/ext/pack/ruby/internal/anyargs.h +375 -0
  22. data/ext/pack/ruby/internal/arithmetic.h +38 -0
  23. data/ext/pack/ruby/internal/arithmetic/char.h +58 -0
  24. data/ext/pack/ruby/internal/arithmetic/double.h +39 -0
  25. data/ext/pack/ruby/internal/arithmetic/fixnum.h +44 -0
  26. data/ext/pack/ruby/internal/arithmetic/gid_t.h +34 -0
  27. data/ext/pack/ruby/internal/arithmetic/int.h +163 -0
  28. data/ext/pack/ruby/internal/arithmetic/intptr_t.h +42 -0
  29. data/ext/pack/ruby/internal/arithmetic/long.h +244 -0
  30. data/ext/pack/ruby/internal/arithmetic/long_long.h +53 -0
  31. data/ext/pack/ruby/internal/arithmetic/mode_t.h +34 -0
  32. data/ext/pack/ruby/internal/arithmetic/off_t.h +49 -0
  33. data/ext/pack/ruby/internal/arithmetic/pid_t.h +34 -0
  34. data/ext/pack/ruby/internal/arithmetic/short.h +54 -0
  35. data/ext/pack/ruby/internal/arithmetic/size_t.h +51 -0
  36. data/ext/pack/ruby/internal/arithmetic/st_data_t.h +59 -0
  37. data/ext/pack/ruby/internal/arithmetic/uid_t.h +34 -0
  38. data/ext/pack/ruby/internal/assume.h +90 -0
  39. data/ext/pack/ruby/internal/attr/alloc_size.h +32 -0
  40. data/ext/pack/ruby/internal/attr/artificial.h +46 -0
  41. data/ext/pack/ruby/internal/attr/cold.h +37 -0
  42. data/ext/pack/ruby/internal/attr/const.h +46 -0
  43. data/ext/pack/ruby/internal/attr/constexpr.h +85 -0
  44. data/ext/pack/ruby/internal/attr/deprecated.h +59 -0
  45. data/ext/pack/ruby/internal/attr/diagnose_if.h +42 -0
  46. data/ext/pack/ruby/internal/attr/enum_extensibility.h +32 -0
  47. data/ext/pack/ruby/internal/attr/error.h +32 -0
  48. data/ext/pack/ruby/internal/attr/flag_enum.h +33 -0
  49. data/ext/pack/ruby/internal/attr/forceinline.h +40 -0
  50. data/ext/pack/ruby/internal/attr/format.h +38 -0
  51. data/ext/pack/ruby/internal/attr/maybe_unused.h +38 -0
  52. data/ext/pack/ruby/internal/attr/noalias.h +58 -0
  53. data/ext/pack/ruby/internal/attr/nodiscard.h +45 -0
  54. data/ext/pack/ruby/internal/attr/noexcept.h +91 -0
  55. data/ext/pack/ruby/internal/attr/noinline.h +35 -0
  56. data/ext/pack/ruby/internal/attr/nonnull.h +32 -0
  57. data/ext/pack/ruby/internal/attr/noreturn.h +48 -0
  58. data/ext/pack/ruby/internal/attr/pure.h +43 -0
  59. data/ext/pack/ruby/internal/attr/restrict.h +45 -0
  60. data/ext/pack/ruby/internal/attr/returns_nonnull.h +37 -0
  61. data/ext/pack/ruby/internal/attr/warning.h +32 -0
  62. data/ext/pack/ruby/internal/attr/weakref.h +32 -0
  63. data/ext/pack/ruby/internal/cast.h +53 -0
  64. data/ext/pack/ruby/internal/compiler_is.h +45 -0
  65. data/ext/pack/ruby/internal/compiler_is/apple.h +41 -0
  66. data/ext/pack/ruby/internal/compiler_is/clang.h +38 -0
  67. data/ext/pack/ruby/internal/compiler_is/gcc.h +46 -0
  68. data/ext/pack/ruby/internal/compiler_is/intel.h +41 -0
  69. data/ext/pack/ruby/internal/compiler_is/msvc.h +57 -0
  70. data/ext/pack/ruby/internal/compiler_is/sunpro.h +55 -0
  71. data/ext/pack/ruby/internal/compiler_since.h +61 -0
  72. data/ext/pack/ruby/internal/config.h +131 -0
  73. data/ext/pack/ruby/internal/constant_p.h +37 -0
  74. data/ext/pack/ruby/internal/core.h +35 -0
  75. data/ext/pack/ruby/internal/core/rarray.h +275 -0
  76. data/ext/pack/ruby/internal/core/rbasic.h +85 -0
  77. data/ext/pack/ruby/internal/core/rbignum.h +51 -0
  78. data/ext/pack/ruby/internal/core/rclass.h +47 -0
  79. data/ext/pack/ruby/internal/core/rdata.h +174 -0
  80. data/ext/pack/ruby/internal/core/rfile.h +36 -0
  81. data/ext/pack/ruby/internal/core/rhash.h +62 -0
  82. data/ext/pack/ruby/internal/core/rmatch.h +73 -0
  83. data/ext/pack/ruby/internal/core/robject.h +97 -0
  84. data/ext/pack/ruby/internal/core/rregexp.h +84 -0
  85. data/ext/pack/ruby/internal/core/rstring.h +215 -0
  86. data/ext/pack/ruby/internal/core/rstruct.h +73 -0
  87. data/ext/pack/ruby/internal/core/rtypeddata.h +184 -0
  88. data/ext/pack/ruby/internal/ctype.h +203 -0
  89. data/ext/pack/ruby/internal/dllexport.h +92 -0
  90. data/ext/pack/ruby/internal/dosish.h +63 -0
  91. data/ext/pack/ruby/internal/error.h +74 -0
  92. data/ext/pack/ruby/internal/eval.h +50 -0
  93. data/ext/pack/ruby/internal/event.h +75 -0
  94. data/ext/pack/ruby/internal/fl_type.h +469 -0
  95. data/ext/pack/ruby/internal/gc.h +35 -0
  96. data/ext/pack/ruby/internal/glob.h +35 -0
  97. data/ext/pack/ruby/internal/globals.h +159 -0
  98. data/ext/pack/ruby/internal/has/attribute.h +164 -0
  99. data/ext/pack/ruby/internal/has/builtin.h +105 -0
  100. data/ext/pack/ruby/internal/has/c_attribute.h +38 -0
  101. data/ext/pack/ruby/internal/has/cpp_attribute.h +79 -0
  102. data/ext/pack/ruby/internal/has/declspec_attribute.h +48 -0
  103. data/ext/pack/ruby/internal/has/extension.h +33 -0
  104. data/ext/pack/ruby/internal/has/feature.h +31 -0
  105. data/ext/pack/ruby/internal/has/warning.h +31 -0
  106. data/ext/pack/ruby/internal/intern/array.h +78 -0
  107. data/ext/pack/ruby/internal/intern/bignum.h +105 -0
  108. data/ext/pack/ruby/internal/intern/class.h +57 -0
  109. data/ext/pack/ruby/internal/intern/compar.h +34 -0
  110. data/ext/pack/ruby/internal/intern/complex.h +60 -0
  111. data/ext/pack/ruby/internal/intern/cont.h +40 -0
  112. data/ext/pack/ruby/internal/intern/dir.h +33 -0
  113. data/ext/pack/ruby/internal/intern/enum.h +33 -0
  114. data/ext/pack/ruby/internal/intern/enumerator.h +79 -0
  115. data/ext/pack/ruby/internal/intern/error.h +82 -0
  116. data/ext/pack/ruby/internal/intern/eval.h +59 -0
  117. data/ext/pack/ruby/internal/intern/file.h +44 -0
  118. data/ext/pack/ruby/internal/intern/gc.h +57 -0
  119. data/ext/pack/ruby/internal/intern/hash.h +59 -0
  120. data/ext/pack/ruby/internal/intern/io.h +70 -0
  121. data/ext/pack/ruby/internal/intern/load.h +39 -0
  122. data/ext/pack/ruby/internal/intern/marshal.h +35 -0
  123. data/ext/pack/ruby/internal/intern/numeric.h +42 -0
  124. data/ext/pack/ruby/internal/intern/object.h +90 -0
  125. data/ext/pack/ruby/internal/intern/parse.h +64 -0
  126. data/ext/pack/ruby/internal/intern/proc.h +53 -0
  127. data/ext/pack/ruby/internal/intern/process.h +46 -0
  128. data/ext/pack/ruby/internal/intern/random.h +45 -0
  129. data/ext/pack/ruby/internal/intern/range.h +35 -0
  130. data/ext/pack/ruby/internal/intern/rational.h +46 -0
  131. data/ext/pack/ruby/internal/intern/re.h +50 -0
  132. data/ext/pack/ruby/internal/intern/ruby.h +37 -0
  133. data/ext/pack/ruby/internal/intern/select.h +52 -0
  134. data/ext/pack/ruby/internal/intern/select/largesize.h +103 -0
  135. data/ext/pack/ruby/internal/intern/select/posix.h +82 -0
  136. data/ext/pack/ruby/internal/intern/select/win32.h +124 -0
  137. data/ext/pack/ruby/internal/intern/signal.h +40 -0
  138. data/ext/pack/ruby/internal/intern/sprintf.h +43 -0
  139. data/ext/pack/ruby/internal/intern/string.h +290 -0
  140. data/ext/pack/ruby/internal/intern/struct.h +47 -0
  141. data/ext/pack/ruby/internal/intern/thread.h +76 -0
  142. data/ext/pack/ruby/internal/intern/time.h +52 -0
  143. data/ext/pack/ruby/internal/intern/variable.h +83 -0
  144. data/ext/pack/ruby/internal/intern/vm.h +77 -0
  145. data/ext/pack/ruby/internal/interpreter.h +94 -0
  146. data/ext/pack/ruby/internal/iterator.h +65 -0
  147. data/ext/pack/ruby/internal/memory.h +286 -0
  148. data/ext/pack/ruby/internal/method.h +39 -0
  149. data/ext/pack/ruby/internal/module.h +39 -0
  150. data/ext/pack/ruby/internal/newobj.h +73 -0
  151. data/ext/pack/ruby/internal/rgengc.h +199 -0
  152. data/ext/pack/ruby/internal/scan_args.h +394 -0
  153. data/ext/pack/ruby/internal/special_consts.h +204 -0
  154. data/ext/pack/ruby/internal/static_assert.h +77 -0
  155. data/ext/pack/ruby/internal/stdalign.h +124 -0
  156. data/ext/pack/ruby/internal/stdbool.h +51 -0
  157. data/ext/pack/ruby/internal/symbol.h +114 -0
  158. data/ext/pack/ruby/internal/token_paste.h +75 -0
  159. data/ext/pack/ruby/internal/value.h +66 -0
  160. data/ext/pack/ruby/internal/value_type.h +354 -0
  161. data/ext/pack/ruby/internal/variable.h +62 -0
  162. data/ext/pack/ruby/internal/warning_push.h +91 -0
  163. data/ext/pack/ruby/internal/xmalloc.h +201 -0
  164. data/lib/zscan.rb +1 -1
  165. data/readme.md +2 -0
  166. data/zscan.gemspec +1 -1
  167. metadata +162 -2
@@ -0,0 +1,55 @@
1
+ #ifndef RBIMPL_COMPILER_IS_SUNPRO_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_COMPILER_IS_SUNPRO_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Defines #RBIMPL_COMPILER_IS_SunPro.
22
+ */
23
+ #if ! (defined(__SUNPRO_C) || defined(__SUNPRO_CC))
24
+ # define RBIMPL_COMPILER_IS_SunPro 0
25
+
26
+ #elif defined(__SUNPRO_C) && __SUNPRO_C >= 0x5100
27
+ # define RBIMPL_COMPILER_IS_SunPro 1
28
+ # /* __SUNPRO_C = 0xXYYZ */
29
+ # define RBIMPL_COMPILER_VERSION_MAJOR (__SUNPRO_C >> 12)
30
+ # define RBIMPL_COMPILER_VERSION_MINOR ((__SUNPRO_C >> 8 & 0xF) * 10 + (__SUNPRO_C >> 4 & 0xF))
31
+ # define RBIMPL_COMPILER_VERSION_PATCH (__SUNPRO_C & 0xF)
32
+
33
+ #elif defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5100
34
+ # define RBIMPL_COMPILER_IS_SunPro 1
35
+ # /* __SUNPRO_CC = 0xXYYZ */
36
+ # define RBIMPL_COMPILER_VERSION_MAJOR (__SUNPRO_CC >> 12)
37
+ # define RBIMPL_COMPILER_VERSION_MINOR ((__SUNPRO_CC >> 8 & 0xF) * 10 + (__SUNPRO_CC >> 4 & 0xF))
38
+ # define RBIMPL_COMPILER_VERSION_PATCH (__SUNPRO_CC & 0xF)
39
+
40
+ #elif defined(__SUNPRO_C)
41
+ # define RBIMPL_COMPILER_IS_SunPro 1
42
+ # /* __SUNPRO_C = 0xXYZ */
43
+ # define RBIMPL_COMPILER_VERSION_MAJOR (__SUNPRO_C >> 8)
44
+ # define RBIMPL_COMPILER_VERSION_MINOR (__SUNPRO_C >> 4 & 0xF)
45
+ # define RBIMPL_COMPILER_VERSION_PATCH (__SUNPRO_C & 0xF)
46
+
47
+ #else
48
+ # define RBIMPL_COMPILER_IS_SunPro 1
49
+ # /* __SUNPRO_CC = 0xXYZ */
50
+ # define RBIMPL_COMPILER_VERSION_MAJOR (__SUNPRO_CC >> 8)
51
+ # define RBIMPL_COMPILER_VERSION_MINOR (__SUNPRO_CC >> 4 & 0xF)
52
+ # define RBIMPL_COMPILER_VERSION_PATCH (__SUNPRO_CC & 0xF)
53
+ #endif
54
+
55
+ #endif /* RBIMPL_COMPILER_IS_SUNPRO_H */
@@ -0,0 +1,61 @@
1
+ #ifndef RBIMPL_COMPILER_SINCE_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_COMPILER_SINCE_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Defines #RBIMPL_COMPILER_SINCE.
22
+ */
23
+ #include "ruby/internal/compiler_is.h"
24
+
25
+ /**
26
+ * @brief Checks if the compiler is of given brand and is newer than or equal
27
+ * to the passed version.
28
+ * @param cc Compiler brand, like `MSVC`.
29
+ * @param x Major version.
30
+ * @param y Minor version.
31
+ * @param z Patchlevel.
32
+ * @retval true cc >= x.y.z.
33
+ * @retval false oherwise.
34
+ */
35
+ #define RBIMPL_COMPILER_SINCE(cc, x, y, z) \
36
+ (RBIMPL_COMPILER_IS(cc) && \
37
+ ((RBIMPL_COMPILER_VERSION_MAJOR > (x)) || \
38
+ ((RBIMPL_COMPILER_VERSION_MAJOR == (x)) && \
39
+ ((RBIMPL_COMPILER_VERSION_MINOR > (y)) || \
40
+ ((RBIMPL_COMPILER_VERSION_MINOR == (y)) && \
41
+ (RBIMPL_COMPILER_VERSION_PATCH >= (z)))))))
42
+
43
+ /**
44
+ * @brief Checks if the compiler is of given brand and is older than the
45
+ * passed version.
46
+ * @param cc Compiler brand, like `MSVC`.
47
+ * @param x Major version.
48
+ * @param y Minor version.
49
+ * @param z Patchlevel.
50
+ * @retval true cc < x.y.z.
51
+ * @retval false oherwise.
52
+ */
53
+ #define RBIMPL_COMPILER_BEFORE(cc, x, y, z) \
54
+ (RBIMPL_COMPILER_IS(cc) && \
55
+ ((RBIMPL_COMPILER_VERSION_MAJOR < (x)) || \
56
+ ((RBIMPL_COMPILER_VERSION_MAJOR == (x)) && \
57
+ ((RBIMPL_COMPILER_VERSION_MINOR < (y)) || \
58
+ ((RBIMPL_COMPILER_VERSION_MINOR == (y)) && \
59
+ (RBIMPL_COMPILER_VERSION_PATCH < (z)))))))
60
+
61
+ #endif /* RBIMPL_COMPILER_SINCE_H */
@@ -0,0 +1,131 @@
1
+ #ifndef RBIMPL_CONFIG_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_CONFIG_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Thin wrapper to ruby/config.h
22
+ */
23
+ #include "ruby/config.h"
24
+
25
+ #ifdef RUBY_EXTCONF_H
26
+ # include RUBY_EXTCONF_H
27
+ #endif
28
+
29
+ #include "ruby/internal/compiler_since.h"
30
+
31
+ #if defined(__cplusplus)
32
+ #/* __builtin_choose_expr and __builtin_types_compatible aren't available
33
+ # * on C++. See https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */
34
+ # undef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P
35
+ # undef HAVE_BUILTIN___BUILTIN_TYPES_COMPATIBLE_P
36
+
37
+ # undef HAVE_PROTOTYPES
38
+ # define HAVE_PROTOTYPES 1
39
+
40
+ # undef HAVE_STDARG_PROTOTYPES
41
+ # define HAVE_STDARG_PROTOTYPES 1
42
+
43
+ /* HAVE_VA_ARGS_MACRO is for C. C++ situations might be different. */
44
+ # undef HAVE_VA_ARGS_MACRO
45
+ # if __cplusplus >= 201103L
46
+ # define HAVE_VA_ARGS_MACRO
47
+ # elif defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__
48
+ # define HAVE_VA_ARGS_MACRO
49
+ # elif defined(__INTEL_CXX11_MODE__)
50
+ # define HAVE_VA_ARGS_MACRO
51
+ # elif RBIMPL_COMPILER_SINCE(MSVC, 16, 0, 0)
52
+ # define HAVE_VA_ARGS_MACRO
53
+ # else
54
+ # /* NG, not known. */
55
+ # endif
56
+ #endif
57
+
58
+ #if RBIMPL_COMPILER_BEFORE(GCC, 4, 9, 0)
59
+ # /* See https://bugs.ruby-lang.org/issues/14221 */
60
+ # undef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P
61
+ #endif
62
+
63
+ #if RBIMPL_COMPILER_BEFORE(GCC, 5, 0, 0)
64
+ # /* GCC 4.9.2 reportedly has this feature and is broken. The function is not
65
+ # * officially documented below. Seems we should not use it.
66
+ # * https://gcc.gnu.org/onlinedocs/gcc-4.9.4/gcc/Other-Builtins.html */
67
+ # undef HAVE_BUILTIN___BUILTIN_ALLOCA_WITH_ALIGN
68
+ #endif
69
+
70
+ #ifndef STRINGIZE0
71
+ # define STRINGIZE(expr) STRINGIZE0(expr)
72
+ # define STRINGIZE0(expr) #expr
73
+ #endif
74
+
75
+ #ifdef AC_APPLE_UNIVERSAL_BUILD
76
+ # undef WORDS_BIGENDIAN
77
+ # ifdef __BIG_ENDIAN__
78
+ # define WORDS_BIGENDIAN
79
+ # endif
80
+ #endif
81
+
82
+ #ifndef DLEXT_MAXLEN
83
+ # define DLEXT_MAXLEN 4
84
+ #endif
85
+
86
+ #ifndef RUBY_PLATFORM
87
+ # define RUBY_PLATFORM "unknown-unknown"
88
+ #endif
89
+
90
+ #ifdef UNALIGNED_WORD_ACCESS
91
+ # /* Take that. */
92
+ #elif defined(__i386)
93
+ # define UNALIGNED_WORD_ACCESS 1
94
+ #elif defined(__i386__)
95
+ # define UNALIGNED_WORD_ACCESS 1
96
+ #elif defined(_M_IX86)
97
+ # define UNALIGNED_WORD_ACCESS 1
98
+ #elif defined(__x86_64)
99
+ # define UNALIGNED_WORD_ACCESS 1
100
+ #elif defined(__x86_64__)
101
+ # define UNALIGNED_WORD_ACCESS 1
102
+ #elif defined(_M_AMD64)
103
+ # define UNALIGNED_WORD_ACCESS 1
104
+ #elif defined(__powerpc64__)
105
+ # define UNALIGNED_WORD_ACCESS 1
106
+ #elif defined(__mc68020__)
107
+ # define UNALIGNED_WORD_ACCESS 1
108
+ #else
109
+ # define UNALIGNED_WORD_ACCESS 0
110
+ #endif
111
+
112
+ /* Detection of __VA_OPT__ */
113
+ #if ! defined(HAVE_VA_ARGS_MACRO)
114
+ # undef HAVE___VA_OPT__
115
+
116
+ #else
117
+ # /* Idea taken from: https://stackoverflow.com/a/48045656 */
118
+ # define RBIMPL_TEST3(q, w, e, ...) e
119
+ # define RBIMPL_TEST2(...) RBIMPL_TEST3(__VA_OPT__(,),1,0,0)
120
+ # define RBIMPL_TEST1() RBIMPL_TEST2("ruby")
121
+ # if RBIMPL_TEST1()
122
+ # define HAVE___VA_OPT__
123
+ # else
124
+ # undef HAVE___VA_OPT__
125
+ # endif
126
+ # undef RBIMPL_TEST1
127
+ # undef RBIMPL_TEST2
128
+ # undef RBIMPL_TEST3
129
+ #endif /* HAVE_VA_ARGS_MACRO */
130
+
131
+ #endif /* RBIMPL_CONFIG_H */
@@ -0,0 +1,37 @@
1
+ #ifndef RBIMPL_CONSTANT_P_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_CONSTANT_P_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Defines #RBIMPL_CONSTANT_P.
22
+ *
23
+ * Note that __builtin_constant_p can be applicable inside of inline functions,
24
+ * according to GCC manual. Clang lacks that feature, though.
25
+ *
26
+ * @see https://bugs.llvm.org/show_bug.cgi?id=4898
27
+ * @see https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
28
+ */
29
+ #include "ruby/internal/has/builtin.h"
30
+
31
+ #if RBIMPL_HAS_BUILTIN(__builtin_constant_p)
32
+ # define RBIMPL_CONSTANT_P(expr) __builtin_constant_p(expr)
33
+ #else
34
+ # define RBIMPL_CONSTANT_P(expr) 0
35
+ #endif
36
+
37
+ #endif /* RBIMPL_CONSTANT_P_H */
@@ -0,0 +1,35 @@
1
+ #ifndef RBIMPL_CORE_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_CORE_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Core data structures, definitions and manupulations.
22
+ */
23
+ #include "ruby/internal/core/rarray.h"
24
+ #include "ruby/internal/core/rbasic.h"
25
+ #include "ruby/internal/core/rbignum.h"
26
+ #include "ruby/internal/core/rclass.h"
27
+ #include "ruby/internal/core/rdata.h"
28
+ #include "ruby/internal/core/rfile.h"
29
+ #include "ruby/internal/core/rhash.h"
30
+ #include "ruby/internal/core/robject.h"
31
+ #include "ruby/internal/core/rregexp.h"
32
+ #include "ruby/internal/core/rstring.h"
33
+ #include "ruby/internal/core/rstruct.h"
34
+ #include "ruby/internal/core/rtypeddata.h"
35
+ #endif /* RBIMPL_CORE_H */
@@ -0,0 +1,275 @@
1
+ #ifndef RBIMPL_RARRAY_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_RARRAY_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Defines struct ::RArray.
22
+ */
23
+ #include "ruby/internal/arithmetic/long.h"
24
+ #include "ruby/internal/attr/artificial.h"
25
+ #include "ruby/internal/attr/constexpr.h"
26
+ #include "ruby/internal/attr/maybe_unused.h"
27
+ #include "ruby/internal/attr/pure.h"
28
+ #include "ruby/internal/cast.h"
29
+ #include "ruby/internal/core/rbasic.h"
30
+ #include "ruby/internal/dllexport.h"
31
+ #include "ruby/internal/fl_type.h"
32
+ #include "ruby/internal/rgengc.h"
33
+ #include "ruby/internal/stdbool.h"
34
+ #include "ruby/internal/value.h"
35
+ #include "ruby/internal/value_type.h"
36
+ #include "ruby/assert.h"
37
+
38
+ #ifndef USE_TRANSIENT_HEAP
39
+ # define USE_TRANSIENT_HEAP 1
40
+ #endif
41
+
42
+ #define RARRAY(obj) RBIMPL_CAST((struct RArray *)(obj))
43
+ #define RARRAY_EMBED_FLAG RARRAY_EMBED_FLAG
44
+ #define RARRAY_EMBED_LEN_MASK RARRAY_EMBED_LEN_MASK
45
+ #define RARRAY_EMBED_LEN_MAX RARRAY_EMBED_LEN_MAX
46
+ #define RARRAY_EMBED_LEN_SHIFT RARRAY_EMBED_LEN_SHIFT
47
+ #if USE_TRANSIENT_HEAP
48
+ # define RARRAY_TRANSIENT_FLAG RARRAY_TRANSIENT_FLAG
49
+ #else
50
+ # define RARRAY_TRANSIENT_FLAG 0
51
+ #endif
52
+ #define RARRAY_LEN rb_array_len
53
+ #define RARRAY_CONST_PTR rb_array_const_ptr
54
+ #define RARRAY_CONST_PTR_TRANSIENT rb_array_const_ptr_transient
55
+
56
+ /** @cond INTERNAL_MACRO */
57
+ #if defined(__fcc__) || defined(__fcc_version) || \
58
+ defined(__FCC__) || defined(__FCC_VERSION)
59
+ /* workaround for old version of Fujitsu C Compiler (fcc) */
60
+ # define FIX_CONST_VALUE_PTR(x) ((const VALUE *)(x))
61
+ #else
62
+ # define FIX_CONST_VALUE_PTR(x) (x)
63
+ #endif
64
+
65
+ #define RARRAY_EMBED_LEN RARRAY_EMBED_LEN
66
+ #define RARRAY_LENINT RARRAY_LENINT
67
+ #define RARRAY_TRANSIENT_P RARRAY_TRANSIENT_P
68
+ #define RARRAY_ASET RARRAY_ASET
69
+ #define RARRAY_PTR RARRAY_PTR
70
+ /** @endcond */
71
+
72
+ enum ruby_rarray_flags {
73
+ RARRAY_EMBED_FLAG = RUBY_FL_USER1,
74
+ /* RUBY_FL_USER2 is for ELTS_SHARED */
75
+ RARRAY_EMBED_LEN_MASK = RUBY_FL_USER4 | RUBY_FL_USER3
76
+ #if USE_TRANSIENT_HEAP
77
+ ,
78
+ RARRAY_TRANSIENT_FLAG = RUBY_FL_USER13
79
+ #endif
80
+ };
81
+
82
+ enum ruby_rarray_consts {
83
+ RARRAY_EMBED_LEN_SHIFT = RUBY_FL_USHIFT + 3,
84
+ RARRAY_EMBED_LEN_MAX = RBIMPL_EMBED_LEN_MAX_OF(VALUE)
85
+ };
86
+
87
+ struct RArray {
88
+ struct RBasic basic;
89
+ union {
90
+ struct {
91
+ long len;
92
+ union {
93
+ long capa;
94
+ #if defined(__clang__) /* <- clang++ is sane */ || \
95
+ !defined(__cplusplus) /* <- C99 is sane */ || \
96
+ (__cplusplus > 199711L) /* <- C++11 is sane */
97
+ const
98
+ #endif
99
+ VALUE shared_root;
100
+ } aux;
101
+ const VALUE *ptr;
102
+ } heap;
103
+ const VALUE ary[RARRAY_EMBED_LEN_MAX];
104
+ } as;
105
+ };
106
+
107
+ RBIMPL_SYMBOL_EXPORT_BEGIN()
108
+ VALUE *rb_ary_ptr_use_start(VALUE ary);
109
+ void rb_ary_ptr_use_end(VALUE a);
110
+ #if USE_TRANSIENT_HEAP
111
+ void rb_ary_detransient(VALUE a);
112
+ #endif
113
+ RBIMPL_SYMBOL_EXPORT_END()
114
+
115
+ RBIMPL_ATTR_PURE_ON_NDEBUG()
116
+ RBIMPL_ATTR_ARTIFICIAL()
117
+ static inline long
118
+ RARRAY_EMBED_LEN(VALUE ary)
119
+ {
120
+ RBIMPL_ASSERT_TYPE(ary, RUBY_T_ARRAY);
121
+ RBIMPL_ASSERT_OR_ASSUME(RB_FL_ANY_RAW(ary, RARRAY_EMBED_FLAG));
122
+
123
+ VALUE f = RBASIC(ary)->flags;
124
+ f &= RARRAY_EMBED_LEN_MASK;
125
+ f >>= RARRAY_EMBED_LEN_SHIFT;
126
+ return RBIMPL_CAST((long)f);
127
+ }
128
+
129
+ RBIMPL_ATTR_PURE_ON_NDEBUG()
130
+ static inline long
131
+ rb_array_len(VALUE a)
132
+ {
133
+ RBIMPL_ASSERT_TYPE(a, RUBY_T_ARRAY);
134
+
135
+ if (RB_FL_ANY_RAW(a, RARRAY_EMBED_FLAG)) {
136
+ return RARRAY_EMBED_LEN(a);
137
+ }
138
+ else {
139
+ return RARRAY(a)->as.heap.len;
140
+ }
141
+ }
142
+
143
+ RBIMPL_ATTR_ARTIFICIAL()
144
+ static inline int
145
+ RARRAY_LENINT(VALUE ary)
146
+ {
147
+ return rb_long2int(RARRAY_LEN(ary));
148
+ }
149
+
150
+ RBIMPL_ATTR_PURE_ON_NDEBUG()
151
+ RBIMPL_ATTR_ARTIFICIAL()
152
+ static inline bool
153
+ RARRAY_TRANSIENT_P(VALUE ary)
154
+ {
155
+ RBIMPL_ASSERT_TYPE(ary, RUBY_T_ARRAY);
156
+
157
+ #if USE_TRANSIENT_HEAP
158
+ return RB_FL_ANY_RAW(ary, RARRAY_TRANSIENT_FLAG);
159
+ #else
160
+ return false;
161
+ #endif
162
+ }
163
+
164
+ RBIMPL_ATTR_PURE_ON_NDEBUG()
165
+ /* internal function. do not use this function */
166
+ static inline const VALUE *
167
+ rb_array_const_ptr_transient(VALUE a)
168
+ {
169
+ RBIMPL_ASSERT_TYPE(a, RUBY_T_ARRAY);
170
+
171
+ if (RB_FL_ANY_RAW(a, RARRAY_EMBED_FLAG)) {
172
+ return FIX_CONST_VALUE_PTR(RARRAY(a)->as.ary);
173
+ }
174
+ else {
175
+ return FIX_CONST_VALUE_PTR(RARRAY(a)->as.heap.ptr);
176
+ }
177
+ }
178
+
179
+ #if ! USE_TRANSIENT_HEAP
180
+ RBIMPL_ATTR_PURE_ON_NDEBUG()
181
+ #endif
182
+ /* internal function. do not use this function */
183
+ static inline const VALUE *
184
+ rb_array_const_ptr(VALUE a)
185
+ {
186
+ RBIMPL_ASSERT_TYPE(a, RUBY_T_ARRAY);
187
+
188
+ #if USE_TRANSIENT_HEAP
189
+ if (RARRAY_TRANSIENT_P(a)) {
190
+ rb_ary_detransient(a);
191
+ }
192
+ #endif
193
+ return rb_array_const_ptr_transient(a);
194
+ }
195
+
196
+ /* internal function. do not use this function */
197
+ static inline VALUE *
198
+ rb_array_ptr_use_start(VALUE a,
199
+ RBIMPL_ATTR_MAYBE_UNUSED()
200
+ int allow_transient)
201
+ {
202
+ RBIMPL_ASSERT_TYPE(a, RUBY_T_ARRAY);
203
+
204
+ #if USE_TRANSIENT_HEAP
205
+ if (!allow_transient) {
206
+ if (RARRAY_TRANSIENT_P(a)) {
207
+ rb_ary_detransient(a);
208
+ }
209
+ }
210
+ #endif
211
+
212
+ return rb_ary_ptr_use_start(a);
213
+ }
214
+
215
+ /* internal function. do not use this function */
216
+ static inline void
217
+ rb_array_ptr_use_end(VALUE a,
218
+ RBIMPL_ATTR_MAYBE_UNUSED()
219
+ int allow_transient)
220
+ {
221
+ RBIMPL_ASSERT_TYPE(a, RUBY_T_ARRAY);
222
+ rb_ary_ptr_use_end(a);
223
+ }
224
+
225
+ #define RBIMPL_RARRAY_STMT(flag, ary, var, expr) do { \
226
+ RBIMPL_ASSERT_TYPE((ary), RUBY_T_ARRAY); \
227
+ const VALUE rbimpl_ary = (ary); \
228
+ VALUE *var = rb_array_ptr_use_start(rbimpl_ary, (flag)); \
229
+ expr; \
230
+ rb_array_ptr_use_end(rbimpl_ary, (flag)); \
231
+ } while (0)
232
+
233
+ #define RARRAY_PTR_USE_START(a) rb_array_ptr_use_start(a, 0)
234
+ #define RARRAY_PTR_USE_END(a) rb_array_ptr_use_end(a, 0)
235
+ #define RARRAY_PTR_USE(ary, ptr_name, expr) \
236
+ RBIMPL_RARRAY_STMT(0, ary, ptr_name, expr)
237
+
238
+ #define RARRAY_PTR_USE_START_TRANSIENT(a) rb_array_ptr_use_start(a, 1)
239
+ #define RARRAY_PTR_USE_END_TRANSIENT(a) rb_array_ptr_use_end(a, 1)
240
+ #define RARRAY_PTR_USE_TRANSIENT(ary, ptr_name, expr) \
241
+ RBIMPL_RARRAY_STMT(1, ary, ptr_name, expr)
242
+
243
+ static inline VALUE *
244
+ RARRAY_PTR(VALUE ary)
245
+ {
246
+ RBIMPL_ASSERT_TYPE(ary, RUBY_T_ARRAY);
247
+
248
+ VALUE tmp = RB_OBJ_WB_UNPROTECT_FOR(ARRAY, ary);
249
+ return RBIMPL_CAST((VALUE *)RARRAY_CONST_PTR(tmp));
250
+ }
251
+
252
+ static inline void
253
+ RARRAY_ASET(VALUE ary, long i, VALUE v)
254
+ {
255
+ RARRAY_PTR_USE_TRANSIENT(ary, ptr,
256
+ RB_OBJ_WRITE(ary, &ptr[i], v));
257
+ }
258
+
259
+ /* RARRAY_AREF is used as a lvalue. Cannot be a function. */
260
+ #if 0
261
+ RBIMPL_ATTR_PURE_ON_NDEBUG()
262
+ RBIMPL_ATTR_ARTIFICIAL()
263
+ static inline VALUE
264
+ RARRAY_AREF(VALUE ary, long i)
265
+ {
266
+ RBIMPL_ASSERT_TYPE(ary, RUBY_T_ARRAY);
267
+
268
+ return RARRAY_CONST_PTR_TRANSIENT(ary)[i];
269
+ }
270
+ #else
271
+ # undef RARRAY_AREF
272
+ # define RARRAY_AREF(a, i) RARRAY_CONST_PTR_TRANSIENT(a)[i]
273
+ #endif
274
+
275
+ #endif /* RBIMPL_RARRAY_H */