debase-ruby_core_source 0.10.6 → 0.10.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +1 -1
  4. data/Rakefile +6 -3
  5. data/debase-ruby_core_source.gemspec +2 -1
  6. data/lib/debase/ruby_core_source.rb +1 -1
  7. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/addr2line.h +21 -0
  8. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/builtin.h +78 -0
  9. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/build_assert/build_assert.h +40 -0
  10. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/check_type/check_type.h +63 -0
  11. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/container_of/container_of.h +142 -0
  12. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/list/list.h +788 -0
  13. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/str/str.h +16 -0
  14. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/constant.h +50 -0
  15. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/debug_counter.h +390 -0
  16. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/dln.h +51 -0
  17. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/encindex.h +69 -0
  18. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/eval_intern.h +312 -0
  19. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/gc.h +131 -0
  20. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/hrtime.h +168 -0
  21. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/id.h +290 -0
  22. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/id_table.h +34 -0
  23. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/insns.inc +253 -0
  24. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/insns_info.inc +9197 -0
  25. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/internal.h +2697 -0
  26. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/iseq.h +312 -0
  27. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/known_errors.inc +791 -0
  28. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/method.h +229 -0
  29. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/mjit.h +177 -0
  30. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/mjit_compile.inc +7779 -0
  31. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/node.h +476 -0
  32. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/node_name.inc +208 -0
  33. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/opt_sc.inc +109 -0
  34. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/optinsn.inc +128 -0
  35. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/optunifs.inc +43 -0
  36. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/parse.h +210 -0
  37. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/probes_helper.h +42 -0
  38. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/regenc.h +254 -0
  39. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/regint.h +938 -0
  40. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/regparse.h +370 -0
  41. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/revision.h +2 -0
  42. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ruby_assert.h +15 -0
  43. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ruby_atomic.h +244 -0
  44. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/siphash.h +48 -0
  45. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/symbol.h +119 -0
  46. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/thread_pthread.h +75 -0
  47. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/thread_win32.h +36 -0
  48. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/timev.h +56 -0
  49. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/transcode_data.h +139 -0
  50. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/transient_heap.h +62 -0
  51. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/variable.h +9 -0
  52. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/version.h +77 -0
  53. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm.inc +5466 -0
  54. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_call_iseq_optimized.inc +237 -0
  55. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_core.h +1968 -0
  56. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_debug.h +34 -0
  57. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_exec.h +193 -0
  58. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_insnhelper.h +267 -0
  59. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_opts.h +72 -0
  60. data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vmtc.inc +247 -0
  61. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/addr2line.h +20 -0
  62. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/builtin.h +83 -0
  63. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/build_assert/build_assert.h +40 -0
  64. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/check_type/check_type.h +63 -0
  65. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/container_of/container_of.h +142 -0
  66. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/list/list.h +788 -0
  67. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/str/str.h +16 -0
  68. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/constant.h +55 -0
  69. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/debug_counter.h +423 -0
  70. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/dln.h +36 -0
  71. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/encindex.h +70 -0
  72. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/eval_intern.h +312 -0
  73. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/gc.h +140 -0
  74. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/hrtime.h +168 -0
  75. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/id.h +290 -0
  76. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/id_table.h +36 -0
  77. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/insns.inc +249 -0
  78. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/insns_info.inc +8979 -0
  79. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal.h +107 -0
  80. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/array.h +114 -0
  81. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/bignum.h +246 -0
  82. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/bits.h +566 -0
  83. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/class.h +168 -0
  84. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/compar.h +50 -0
  85. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/compile.h +32 -0
  86. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/compilers.h +108 -0
  87. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/complex.h +29 -0
  88. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/cont.h +25 -0
  89. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/dir.h +17 -0
  90. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/enc.h +20 -0
  91. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/encoding.h +28 -0
  92. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/enum.h +19 -0
  93. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/enumerator.h +22 -0
  94. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/error.h +131 -0
  95. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/eval.h +33 -0
  96. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/file.h +39 -0
  97. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/fixnum.h +185 -0
  98. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/gc.h +154 -0
  99. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/hash.h +240 -0
  100. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/imemo.h +243 -0
  101. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/inits.h +51 -0
  102. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/io.h +35 -0
  103. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/load.h +19 -0
  104. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/loadpath.h +17 -0
  105. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/math.h +24 -0
  106. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/missing.h +19 -0
  107. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/mjit.h +29 -0
  108. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/numeric.h +252 -0
  109. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/object.h +83 -0
  110. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/parse.h +23 -0
  111. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/proc.h +32 -0
  112. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/process.h +136 -0
  113. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/random.h +17 -0
  114. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/range.h +37 -0
  115. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/rational.h +69 -0
  116. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/re.h +29 -0
  117. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/sanitizers.h +191 -0
  118. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/scheduler.h +35 -0
  119. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/serial.h +24 -0
  120. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/signal.h +22 -0
  121. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/static_assert.h +17 -0
  122. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/string.h +135 -0
  123. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/struct.h +154 -0
  124. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/symbol.h +41 -0
  125. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/thread.h +60 -0
  126. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/time.h +35 -0
  127. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/transcode.h +21 -0
  128. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/util.h +31 -0
  129. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/variable.h +83 -0
  130. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/vm.h +135 -0
  131. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/warnings.h +17 -0
  132. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/iseq.h +304 -0
  133. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/known_errors.inc +791 -0
  134. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/method.h +245 -0
  135. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/mjit.h +197 -0
  136. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/mjit_compile.inc +8082 -0
  137. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/node.h +484 -0
  138. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/node_name.inc +210 -0
  139. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/opt_sc.inc +109 -0
  140. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/optinsn.inc +128 -0
  141. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/optunifs.inc +43 -0
  142. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/parse.h +211 -0
  143. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/probes_helper.h +44 -0
  144. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ractor.h +271 -0
  145. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ractor_pub.h +50 -0
  146. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/regenc.h +254 -0
  147. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/regint.h +938 -0
  148. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/regparse.h +370 -0
  149. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/revision.h +2 -0
  150. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ruby_assert.h +15 -0
  151. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ruby_atomic.h +236 -0
  152. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/siphash.h +48 -0
  153. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/symbol.h +119 -0
  154. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/thread_pthread.h +106 -0
  155. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/thread_win32.h +66 -0
  156. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/timev.h +57 -0
  157. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/transcode_data.h +138 -0
  158. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/transient_heap.h +61 -0
  159. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/variable.h +21 -0
  160. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/version.h +89 -0
  161. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm.inc +5360 -0
  162. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_call_iseq_optimized.inc +244 -0
  163. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_callinfo.h +457 -0
  164. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_core.h +1952 -0
  165. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_debug.h +116 -0
  166. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_exec.h +196 -0
  167. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_insnhelper.h +260 -0
  168. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_opts.h +73 -0
  169. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_sync.h +97 -0
  170. data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vmtc.inc +243 -0
  171. data/lib/debase/ruby_core_source/version.rb +1 -1
  172. metadata +183 -5
@@ -0,0 +1,48 @@
1
+ #ifndef SIPHASH_H
2
+ #define SIPHASH_H 1
3
+ #include <stdlib.h>
4
+ #ifdef HAVE_STDINT_H
5
+ #include <stdint.h>
6
+ #endif
7
+ #ifdef HAVE_INTTYPES_H
8
+ #include <inttypes.h>
9
+ #endif
10
+
11
+ #ifndef HAVE_UINT64_T
12
+ typedef struct {
13
+ uint32_t u32[2];
14
+ } sip_uint64_t;
15
+ #define uint64_t sip_uint64_t
16
+ #else
17
+ typedef uint64_t sip_uint64_t;
18
+ #endif
19
+
20
+ typedef struct {
21
+ int c;
22
+ int d;
23
+ uint64_t v[4];
24
+ uint8_t buf[sizeof(uint64_t)];
25
+ uint8_t buflen;
26
+ uint8_t msglen_byte;
27
+ } sip_state;
28
+
29
+ typedef struct sip_interface_st sip_interface;
30
+
31
+ typedef struct {
32
+ sip_state state[1];
33
+ const sip_interface *methods;
34
+ } sip_hash;
35
+
36
+ sip_hash *sip_hash_new(const uint8_t key[16], int c, int d);
37
+ sip_hash *sip_hash_init(sip_hash *h, const uint8_t key[16], int c, int d);
38
+ int sip_hash_update(sip_hash *h, const uint8_t *data, size_t len);
39
+ int sip_hash_final(sip_hash *h, uint8_t **digest, size_t *len);
40
+ int sip_hash_final_integer(sip_hash *h, uint64_t *digest);
41
+ int sip_hash_digest(sip_hash *h, const uint8_t *data, size_t data_len, uint8_t **digest, size_t *digest_len);
42
+ int sip_hash_digest_integer(sip_hash *h, const uint8_t *data, size_t data_len, uint64_t *digest);
43
+ void sip_hash_free(sip_hash *h);
44
+ void sip_hash_dump(sip_hash *h);
45
+
46
+ NO_SANITIZE("unsigned-integer-overflow", uint64_t sip_hash13(const uint8_t key[16], const uint8_t *data, size_t len));
47
+
48
+ #endif
@@ -0,0 +1,119 @@
1
+ #ifndef RUBY_SYMBOL_H
2
+ #define RUBY_SYMBOL_H 1
3
+ /**********************************************************************
4
+
5
+ symbol.h -
6
+
7
+ $Author$
8
+ created at: Tue Jul 8 15:49:54 JST 2014
9
+
10
+ Copyright (C) 2014 Yukihiro Matsumoto
11
+
12
+ **********************************************************************/
13
+
14
+ #include "id.h"
15
+ #include "ruby/encoding.h"
16
+
17
+ #define DYNAMIC_ID_P(id) (!(id&ID_STATIC_SYM)&&id>tLAST_OP_ID)
18
+ #define STATIC_ID2SYM(id) (((VALUE)(id)<<RUBY_SPECIAL_SHIFT)|SYMBOL_FLAG)
19
+
20
+ #ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
21
+ #define rb_id2sym(id) \
22
+ RB_GNUC_EXTENSION_BLOCK(__builtin_constant_p(id) && !DYNAMIC_ID_P(id) ? \
23
+ STATIC_ID2SYM(id) : rb_id2sym(id))
24
+ #endif
25
+
26
+ struct RSymbol {
27
+ struct RBasic basic;
28
+ st_index_t hashval;
29
+ VALUE fstr;
30
+ ID id;
31
+ };
32
+
33
+ #define RSYMBOL(obj) ((struct RSymbol *)(obj))
34
+
35
+ #define is_notop_id(id) ((id)>tLAST_OP_ID)
36
+ #define is_local_id(id) (id_type(id)==ID_LOCAL)
37
+ #define is_global_id(id) (id_type(id)==ID_GLOBAL)
38
+ #define is_instance_id(id) (id_type(id)==ID_INSTANCE)
39
+ #define is_attrset_id(id) ((id)==idASET||id_type(id)==ID_ATTRSET)
40
+ #define is_const_id(id) (id_type(id)==ID_CONST)
41
+ #define is_class_id(id) (id_type(id)==ID_CLASS)
42
+ #define is_junk_id(id) (id_type(id)==ID_JUNK)
43
+
44
+ static inline int
45
+ id_type(ID id)
46
+ {
47
+ if (is_notop_id(id)) {
48
+ return (int)(id&ID_SCOPE_MASK);
49
+ }
50
+ else {
51
+ return -1;
52
+ }
53
+ }
54
+
55
+ typedef uint32_t rb_id_serial_t;
56
+ static const uint32_t RB_ID_SERIAL_MAX = /* 256M on LP32 */
57
+ UINT32_MAX >>
58
+ ((sizeof(ID)-sizeof(rb_id_serial_t))*CHAR_BIT < RUBY_ID_SCOPE_SHIFT ?
59
+ RUBY_ID_SCOPE_SHIFT : 0);
60
+
61
+ typedef struct {
62
+ rb_id_serial_t last_id;
63
+ st_table *str_sym;
64
+ VALUE ids;
65
+ VALUE dsymbol_fstr_hash;
66
+ } rb_symbols_t;
67
+
68
+ static inline rb_id_serial_t
69
+ rb_id_to_serial(ID id)
70
+ {
71
+ if (is_notop_id(id)) {
72
+ return (rb_id_serial_t)(id >> ID_SCOPE_SHIFT);
73
+ }
74
+ else {
75
+ return (rb_id_serial_t)id;
76
+ }
77
+ }
78
+
79
+ static inline int
80
+ sym_type(VALUE sym)
81
+ {
82
+ ID id;
83
+ if (STATIC_SYM_P(sym)) {
84
+ id = RSHIFT(sym, RUBY_SPECIAL_SHIFT);
85
+ if (id<=tLAST_OP_ID) {
86
+ return -1;
87
+ }
88
+ }
89
+ else {
90
+ id = RSYMBOL(sym)->id;
91
+ }
92
+ return (int)(id&ID_SCOPE_MASK);
93
+ }
94
+
95
+ #define is_local_sym(sym) (sym_type(sym)==ID_LOCAL)
96
+ #define is_global_sym(sym) (sym_type(sym)==ID_GLOBAL)
97
+ #define is_instance_sym(sym) (sym_type(sym)==ID_INSTANCE)
98
+ #define is_attrset_sym(sym) (sym_type(sym)==ID_ATTRSET)
99
+ #define is_const_sym(sym) (sym_type(sym)==ID_CONST)
100
+ #define is_class_sym(sym) (sym_type(sym)==ID_CLASS)
101
+ #define is_junk_sym(sym) (sym_type(sym)==ID_JUNK)
102
+
103
+ RUBY_FUNC_EXPORTED const unsigned int ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
104
+
105
+ static inline int
106
+ is_global_name_punct(const int c)
107
+ {
108
+ if (c <= 0x20 || 0x7e < c) return 0;
109
+ return (ruby_global_name_punct_bits[(c - 0x20) / 32] >> (c % 32)) & 1;
110
+ }
111
+
112
+ int rb_enc_symname_type(const char *name, long len, rb_encoding *enc, unsigned int allowed_attrset);
113
+
114
+ RUBY_SYMBOL_EXPORT_BEGIN
115
+
116
+ size_t rb_sym_immortal_count(void);
117
+
118
+ RUBY_SYMBOL_EXPORT_END
119
+ #endif
@@ -0,0 +1,106 @@
1
+ #ifndef RUBY_THREAD_PTHREAD_H
2
+ #define RUBY_THREAD_PTHREAD_H
3
+ /**********************************************************************
4
+
5
+ thread_pthread.h -
6
+
7
+ $Author$
8
+
9
+ Copyright (C) 2004-2007 Koichi Sasada
10
+
11
+ **********************************************************************/
12
+
13
+ #ifdef HAVE_PTHREAD_NP_H
14
+ #include <pthread_np.h>
15
+ #endif
16
+
17
+ #define RB_NATIVETHREAD_LOCK_INIT PTHREAD_MUTEX_INITIALIZER
18
+ #define RB_NATIVETHREAD_COND_INIT PTHREAD_COND_INITIALIZER
19
+
20
+ typedef pthread_cond_t rb_nativethread_cond_t;
21
+
22
+ typedef struct native_thread_data_struct {
23
+ union {
24
+ struct list_node ubf;
25
+ struct list_node gvl;
26
+ } node;
27
+ #if defined(__GLIBC__) || defined(__FreeBSD__)
28
+ union
29
+ #else
30
+ /*
31
+ * assume the platform condvars are badly implemented and have a
32
+ * "memory" of which mutex they're associated with
33
+ */
34
+ struct
35
+ #endif
36
+ {
37
+ rb_nativethread_cond_t intr; /* th->interrupt_lock */
38
+ rb_nativethread_cond_t gvlq; /* vm->gvl.lock */
39
+ } cond;
40
+ } native_thread_data_t;
41
+
42
+ void rb_native_mutex_lock(rb_nativethread_lock_t *lock);
43
+ int rb_native_mutex_trylock(rb_nativethread_lock_t *lock);
44
+ void rb_native_mutex_unlock(rb_nativethread_lock_t *lock);
45
+ void rb_native_mutex_initialize(rb_nativethread_lock_t *lock);
46
+ void rb_native_mutex_destroy(rb_nativethread_lock_t *lock);
47
+ void rb_native_cond_signal(rb_nativethread_cond_t *cond);
48
+ void rb_native_cond_broadcast(rb_nativethread_cond_t *cond);
49
+ void rb_native_cond_wait(rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex);
50
+ void rb_native_cond_timedwait(rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex, unsigned long msec);
51
+ void rb_native_cond_initialize(rb_nativethread_cond_t *cond);
52
+ void rb_native_cond_destroy(rb_nativethread_cond_t *cond);
53
+
54
+ #undef except
55
+ #undef try
56
+ #undef leave
57
+ #undef finally
58
+
59
+ typedef struct rb_global_vm_lock_struct {
60
+ /* fast path */
61
+ const struct rb_thread_struct *owner;
62
+ rb_nativethread_lock_t lock; /* AKA vm->gvl.lock */
63
+
64
+ /*
65
+ * slow path, protected by vm->gvl.lock
66
+ * - @waitq - FIFO queue of threads waiting for GVL
67
+ * - @timer - it handles timeslices for @owner. It is any one thread
68
+ * in @waitq, there is no @timer if @waitq is empty, but always
69
+ * a @timer if @waitq has entries
70
+ * - @timer_err tracks timeslice limit, the timeslice only resets
71
+ * when pthread_cond_timedwait returns ETIMEDOUT, so frequent
72
+ * switching between contended/uncontended GVL won't reset the
73
+ * timer.
74
+ */
75
+ struct list_head waitq; /* <=> native_thread_data_t.node.ubf */
76
+ const struct rb_thread_struct *timer;
77
+ int timer_err;
78
+
79
+ /* yield */
80
+ rb_nativethread_cond_t switch_cond;
81
+ rb_nativethread_cond_t switch_wait_cond;
82
+ int need_yield;
83
+ int wait_yield;
84
+ } rb_global_vm_lock_t;
85
+
86
+ typedef pthread_key_t native_tls_key_t;
87
+
88
+ static inline void *
89
+ native_tls_get(native_tls_key_t key)
90
+ {
91
+ void *ptr = pthread_getspecific(key);
92
+ if (UNLIKELY(ptr == NULL)) {
93
+ rb_bug("pthread_getspecific returns NULL");
94
+ }
95
+ return ptr;
96
+ }
97
+
98
+ static inline void
99
+ native_tls_set(native_tls_key_t key, void *ptr)
100
+ {
101
+ if (UNLIKELY(pthread_setspecific(key, ptr) != 0)) {
102
+ rb_bug("pthread_setspecific error");
103
+ }
104
+ }
105
+
106
+ #endif /* RUBY_THREAD_PTHREAD_H */
@@ -0,0 +1,66 @@
1
+ #ifndef RUBY_THREAD_WIN32_H
2
+ #define RUBY_THREAD_WIN32_H
3
+ /**********************************************************************
4
+
5
+ thread_win32.h -
6
+
7
+ $Author$
8
+
9
+ Copyright (C) 2004-2007 Koichi Sasada
10
+
11
+ **********************************************************************/
12
+
13
+ /* interface */
14
+
15
+ # ifdef __CYGWIN__
16
+ # undef _WIN32
17
+ # endif
18
+
19
+ WINBASEAPI BOOL WINAPI
20
+ TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
21
+
22
+ typedef struct rb_thread_cond_struct {
23
+ struct cond_event_entry *next;
24
+ struct cond_event_entry *prev;
25
+ } rb_nativethread_cond_t;
26
+
27
+ typedef struct native_thread_data_struct {
28
+ HANDLE interrupt_event;
29
+ } native_thread_data_t;
30
+
31
+ typedef struct rb_global_vm_lock_struct {
32
+ HANDLE lock;
33
+ } rb_global_vm_lock_t;
34
+
35
+ typedef DWORD native_tls_key_t; // TLS index
36
+
37
+ static inline void *
38
+ native_tls_get(native_tls_key_t key)
39
+ {
40
+ void *ptr = TlsGetValue(key);
41
+ if (UNLIKELY(ptr == NULL)) {
42
+ rb_bug("TlsGetValue() returns NULL");
43
+ }
44
+ return ptr;
45
+ }
46
+
47
+ static inline void
48
+ native_tls_set(native_tls_key_t key, void *ptr)
49
+ {
50
+ if (UNLIKELY(TlsSetValue(key, ptr) == 0)) {
51
+ rb_bug("TlsSetValue() error");
52
+ }
53
+ }
54
+
55
+ void rb_native_mutex_lock(rb_nativethread_lock_t *lock);
56
+ void rb_native_mutex_unlock(rb_nativethread_lock_t *lock);
57
+ void rb_native_mutex_initialize(rb_nativethread_lock_t *lock);
58
+ void rb_native_mutex_destroy(rb_nativethread_lock_t *lock);
59
+ void rb_native_cond_signal(rb_nativethread_cond_t *cond);
60
+ void rb_native_cond_broadcast(rb_nativethread_cond_t *cond);
61
+ void rb_native_cond_wait(rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex);
62
+ void rb_native_cond_timedwait(rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex, unsigned long msec);
63
+ void rb_native_cond_initialize(rb_nativethread_cond_t *cond);
64
+ void rb_native_cond_destroy(rb_nativethread_cond_t *cond);
65
+
66
+ #endif /* RUBY_THREAD_WIN32_H */
@@ -0,0 +1,57 @@
1
+ #ifndef RUBY_TIMEV_H
2
+ #define RUBY_TIMEV_H
3
+ #include "ruby/ruby.h"
4
+
5
+ #if 0
6
+ struct vtm {/* dummy for TAGS */};
7
+ #endif
8
+ PACKED_STRUCT_UNALIGNED(struct vtm {
9
+ VALUE year; /* 2000 for example. Integer. */
10
+ VALUE subsecx; /* 0 <= subsecx < TIME_SCALE. possibly Rational. */
11
+ VALUE utc_offset; /* -3600 as -01:00 for example. possibly Rational. */
12
+ VALUE zone; /* "JST", "EST", "EDT", etc. as String */
13
+ unsigned int yday:9; /* 1..366 */
14
+ unsigned int mon:4; /* 1..12 */
15
+ unsigned int mday:5; /* 1..31 */
16
+ unsigned int hour:5; /* 0..23 */
17
+ unsigned int min:6; /* 0..59 */
18
+ unsigned int sec:6; /* 0..60 */
19
+ unsigned int wday:3; /* 0:Sunday, 1:Monday, ..., 6:Saturday 7:init */
20
+ unsigned int isdst:2; /* 0:StandardTime 1:DayLightSavingTime 3:init */
21
+ });
22
+
23
+ #define TIME_SCALE 1000000000
24
+
25
+ #ifndef TYPEOF_TIMEVAL_TV_SEC
26
+ # define TYPEOF_TIMEVAL_TV_SEC time_t
27
+ #endif
28
+ #ifndef TYPEOF_TIMEVAL_TV_USEC
29
+ # if INT_MAX >= 1000000
30
+ # define TYPEOF_TIMEVAL_TV_USEC int
31
+ # else
32
+ # define TYPEOF_TIMEVAL_TV_USEC long
33
+ # endif
34
+ #endif
35
+
36
+ #if SIZEOF_TIME_T == SIZEOF_LONG
37
+ typedef unsigned long unsigned_time_t;
38
+ #elif SIZEOF_TIME_T == SIZEOF_INT
39
+ typedef unsigned int unsigned_time_t;
40
+ #elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
41
+ typedef unsigned LONG_LONG unsigned_time_t;
42
+ #else
43
+ # error cannot find integer type which size is same as time_t.
44
+ #endif
45
+
46
+ /* strftime.c */
47
+ #ifdef RUBY_ENCODING_H
48
+ VALUE rb_strftime_timespec(const char *format, size_t format_len, rb_encoding *enc,
49
+ VALUE time, const struct vtm *vtm, struct timespec *ts, int gmt);
50
+ VALUE rb_strftime(const char *format, size_t format_len, rb_encoding *enc,
51
+ VALUE time, const struct vtm *vtm, VALUE timev, int gmt);
52
+ #endif
53
+
54
+ /* time.c */
55
+ VALUE rb_time_zone_abbreviation(VALUE zone, VALUE time);
56
+
57
+ #endif
@@ -0,0 +1,138 @@
1
+ #ifndef RUBY_TRANSCODE_DATA_H
2
+ #define RUBY_TRANSCODE_DATA_H 1
3
+ /**********************************************************************
4
+
5
+ transcode_data.h -
6
+
7
+ $Author$
8
+ created at: Mon 10 Dec 2007 14:01:47 JST 2007
9
+
10
+ Copyright (C) 2007 Martin Duerst
11
+
12
+ **********************************************************************/
13
+
14
+ #include "ruby/ruby.h"
15
+
16
+ RUBY_SYMBOL_EXPORT_BEGIN
17
+
18
+ #define WORDINDEX_SHIFT_BITS 2
19
+ #define WORDINDEX2INFO(widx) ((widx) << WORDINDEX_SHIFT_BITS)
20
+ #define INFO2WORDINDEX(info) ((info) >> WORDINDEX_SHIFT_BITS)
21
+ #define BYTE_LOOKUP_BASE(bl) ((bl)[0])
22
+ #define BYTE_LOOKUP_INFO(bl) ((bl)[1])
23
+
24
+ #define PType (unsigned int)
25
+
26
+ #define NOMAP (PType 0x01) /* direct map */
27
+ #define ONEbt (0x02) /* one byte payload */
28
+ #define TWObt (0x03) /* two bytes payload */
29
+ #define THREEbt (0x05) /* three bytes payload */
30
+ #define FOURbt (0x06) /* four bytes payload, UTF-8 only, macros start at getBT0 */
31
+ #define INVALID (PType 0x07) /* invalid byte sequence */
32
+ #define UNDEF (PType 0x09) /* legal but undefined */
33
+ #define ZERObt (PType 0x0A) /* zero bytes of payload, i.e. remove */
34
+ #define FUNii (PType 0x0B) /* function from info to info */
35
+ #define FUNsi (PType 0x0D) /* function from start to info */
36
+ #define FUNio (PType 0x0E) /* function from info to output */
37
+ #define FUNso (PType 0x0F) /* function from start to output */
38
+ #define STR1 (PType 0x11) /* string 4 <= len <= 259 bytes: 1byte length + content */
39
+ #define GB4bt (PType 0x12) /* GB18030 four bytes payload */
40
+ #define FUNsio (PType 0x13) /* function from start and info to output */
41
+
42
+ #define STR1_LENGTH(byte_addr) (unsigned int)(*(byte_addr) + 4)
43
+ #define STR1_BYTEINDEX(w) ((w) >> 6)
44
+ #define makeSTR1(bi) (((bi) << 6) | STR1)
45
+ #define makeSTR1LEN(len) ((len)-4)
46
+
47
+ #define o1(b1) (PType((((unsigned char)(b1))<<8)|ONEbt))
48
+ #define o2(b1,b2) (PType((((unsigned char)(b1))<<8)|\
49
+ (((unsigned char)(b2))<<16)|\
50
+ TWObt))
51
+ #define o3(b1,b2,b3) (PType(((((unsigned char)(b1))<<8)|\
52
+ (((unsigned char)(b2))<<16)|\
53
+ (((unsigned int)(unsigned char)(b3))<<24)|\
54
+ THREEbt)&\
55
+ 0xffffffffU))
56
+ #define o4(b0,b1,b2,b3) (PType(((((unsigned char)(b1))<<8)|\
57
+ (((unsigned char)(b2))<<16)|\
58
+ (((unsigned int)(unsigned char)(b3))<<24)|\
59
+ ((((unsigned char)(b0))&0x07)<<5)|\
60
+ FOURbt)&\
61
+ 0xffffffffU))
62
+ #define g4(b0,b1,b2,b3) (PType(((((unsigned char)(b0))<<8)|\
63
+ (((unsigned char)(b2))<<16)|\
64
+ ((((unsigned char)(b1))&0x0f)<<24)|\
65
+ ((((unsigned int)(unsigned char)(b3))&0x0f)<<28)|\
66
+ GB4bt)&\
67
+ 0xffffffffU))
68
+ #define funsio(diff) (PType((((unsigned int)(diff))<<8)|FUNsio))
69
+
70
+ #define getBT1(a) ((unsigned char)((a)>> 8))
71
+ #define getBT2(a) ((unsigned char)((a)>>16))
72
+ #define getBT3(a) ((unsigned char)((a)>>24))
73
+ #define getBT0(a) (((unsigned char)((a)>> 5)&0x07)|0xF0) /* for UTF-8 only!!! */
74
+
75
+ #define getGB4bt0(a) ((unsigned char)((a)>> 8))
76
+ #define getGB4bt1(a) (((unsigned char)((a)>>24)&0x0F)|0x30)
77
+ #define getGB4bt2(a) ((unsigned char)((a)>>16))
78
+ #define getGB4bt3(a) (((unsigned char)((a)>>28)&0x0F)|0x30)
79
+
80
+ #define o2FUNii(b1,b2) (PType((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|FUNii))
81
+
82
+ /* do we need these??? maybe not, can be done with simple tables */
83
+ #define ONETRAIL /* legal but undefined if one more trailing UTF-8 */
84
+ #define TWOTRAIL /* legal but undefined if two more trailing UTF-8 */
85
+ #define THREETRAIL /* legal but undefined if three more trailing UTF-8 */
86
+
87
+ typedef enum {
88
+ asciicompat_converter, /* ASCII-compatible -> ASCII-compatible */
89
+ asciicompat_decoder, /* ASCII-incompatible -> ASCII-compatible */
90
+ asciicompat_encoder /* ASCII-compatible -> ASCII-incompatible */
91
+ /* ASCII-incompatible -> ASCII-incompatible is intentionally omitted. */
92
+ } rb_transcoder_asciicompat_type_t;
93
+
94
+ typedef struct rb_transcoder rb_transcoder;
95
+
96
+ /* static structure, one per supported encoding pair */
97
+ struct rb_transcoder {
98
+ const char *src_encoding;
99
+ const char *dst_encoding;
100
+ unsigned int conv_tree_start;
101
+ const unsigned char *byte_array;
102
+ unsigned int byte_array_length;
103
+ const unsigned int *word_array;
104
+ unsigned int word_array_length;
105
+ int word_size;
106
+ int input_unit_length;
107
+ int max_input;
108
+ int max_output;
109
+ rb_transcoder_asciicompat_type_t asciicompat_type;
110
+ size_t state_size;
111
+ int (*state_init_func)(void*); /* ret==0:success ret!=0:failure(errno) */
112
+ int (*state_fini_func)(void*); /* ret==0:success ret!=0:failure(errno) */
113
+ VALUE (*func_ii)(void*, VALUE); /* info -> info */
114
+ VALUE (*func_si)(void*, const unsigned char*, size_t); /* start -> info */
115
+ ssize_t (*func_io)(void*, VALUE, const unsigned char*, size_t); /* info -> output */
116
+ ssize_t (*func_so)(void*, const unsigned char*, size_t, unsigned char*, size_t); /* start -> output */
117
+ ssize_t (*finish_func)(void*, unsigned char*, size_t); /* -> output */
118
+ ssize_t (*resetsize_func)(void*); /* -> len */
119
+ ssize_t (*resetstate_func)(void*, unsigned char*, size_t); /* -> output */
120
+ ssize_t (*func_sio)(void*, const unsigned char*, size_t, VALUE, unsigned char*, size_t); /* start -> output */
121
+ };
122
+
123
+ void rb_declare_transcoder(const char *enc1, const char *enc2, const char *lib);
124
+ void rb_register_transcoder(const rb_transcoder *);
125
+
126
+ /*
127
+ * To get rid of collision of initializer symbols in statically-linked encodings
128
+ * and transcoders
129
+ */
130
+ #if defined(EXTSTATIC) && EXTSTATIC
131
+ # define TRANS_INIT(name) void Init_trans_ ## name(void)
132
+ #else
133
+ # define TRANS_INIT(name) void Init_ ## name(void)
134
+ #endif
135
+
136
+ RUBY_SYMBOL_EXPORT_END
137
+
138
+ #endif /* RUBY_TRANSCODE_DATA_H */