debase-ruby_core_source 0.10.15 → 0.10.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/debase-ruby_core_source.gemspec +1 -1
  4. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/addr2line.h +1 -1
  5. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/build_assert/build_assert.h +40 -0
  6. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/check_type/check_type.h +63 -0
  7. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/container_of/container_of.h +142 -0
  8. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/list/list.h +773 -0
  9. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/str/str.h +16 -0
  10. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/constant.h +51 -0
  11. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/debug_counter.h +109 -0
  12. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/dln.h +10 -9
  13. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/encindex.h +69 -0
  14. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/eval_intern.h +334 -0
  15. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/gc.h +27 -10
  16. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/id.h +250 -0
  17. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/id_table.h +31 -0
  18. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/insns.inc +217 -0
  19. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/insns_info.inc +1570 -0
  20. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/internal.h +2036 -0
  21. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/iseq.h +308 -0
  22. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/known_errors.inc +16 -1
  23. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/method.h +218 -0
  24. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/node.h +115 -79
  25. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/node_name.inc +12 -22
  26. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/opt_sc.inc +1601 -0
  27. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/optinsn.inc +103 -0
  28. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/optunifs.inc +28 -83
  29. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/parse.h +74 -60
  30. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/probes_helper.h +43 -0
  31. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/regenc.h +254 -0
  32. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/regint.h +299 -211
  33. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/regparse.h +45 -37
  34. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/revision.h +1 -0
  35. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ruby_assert.h +54 -0
  36. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/ruby_atomic.h +84 -26
  37. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/siphash.h +1 -1
  38. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/symbol.h +108 -0
  39. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/thread_pthread.h +14 -11
  40. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/thread_win32.h +2 -6
  41. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/timev.h +42 -0
  42. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/transcode_data.h +34 -12
  43. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/version.h +73 -0
  44. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm.inc +3667 -0
  45. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_call_iseq_optimized.inc +213 -0
  46. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_core.h +1768 -0
  47. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550/debug.h → ruby-2.5.4-p155/vm_debug.h} +4 -8
  48. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/vm_exec.h +38 -30
  49. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_insnhelper.h +255 -0
  50. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/vm_opts.h +14 -9
  51. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vmtc.inc +214 -0
  52. data/lib/debase/ruby_core_source/version.rb +1 -1
  53. metadata +52 -42
  54. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/constant.h +0 -34
  55. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/encdb.h +0 -167
  56. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/eval_intern.h +0 -234
  57. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/id.h +0 -177
  58. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/insns.inc +0 -179
  59. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/insns_info.inc +0 -695
  60. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/internal.h +0 -242
  61. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/iseq.h +0 -126
  62. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/method.h +0 -105
  63. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/opt_sc.inc +0 -670
  64. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/optinsn.inc +0 -30
  65. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/regenc.h +0 -219
  66. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/revision.h +0 -1
  67. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/timev.h +0 -21
  68. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/transdb.h +0 -189
  69. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/version.h +0 -52
  70. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm.inc +0 -3054
  71. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm_core.h +0 -763
  72. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm_insnhelper.h +0 -220
  73. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vmtc.inc +0 -97
@@ -1,10 +1,11 @@
1
- #ifndef ONIGURUMA_REGPARSE_H
2
- #define ONIGURUMA_REGPARSE_H
1
+ #ifndef ONIGMO_REGPARSE_H
2
+ #define ONIGMO_REGPARSE_H
3
3
  /**********************************************************************
4
- regparse.h - Oniguruma (regular expression library)
4
+ regparse.h - Onigmo (Oniguruma-mod) (regular expression library)
5
5
  **********************************************************************/
6
6
  /*-
7
7
  * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
8
+ * Copyright (c) 2011-2016 K.Takata <kentkt AT csc DOT jp>
8
9
  * All rights reserved.
9
10
  *
10
11
  * Redistribution and use in source and binary forms, with or without
@@ -31,9 +32,7 @@
31
32
 
32
33
  #include "regint.h"
33
34
 
34
- #if defined __GNUC__ && __GNUC__ >= 4
35
- #pragma GCC visibility push(default)
36
- #endif
35
+ RUBY_SYMBOL_EXPORT_BEGIN
37
36
 
38
37
  /* node type */
39
38
  #define NT_STR 0
@@ -68,7 +67,11 @@
68
67
  BIT_NT_CANY | BIT_NT_BREF)) != 0)
69
68
 
70
69
  #define NTYPE(node) ((node)->u.base.type)
71
- #define SET_NTYPE(node, ntype) (node)->u.base.type = (ntype)
70
+ #define SET_NTYPE(node, ntype) \
71
+ do { \
72
+ int value = ntype; \
73
+ memcpy(&((node)->u.base.type), &value, sizeof(int)); \
74
+ } while (0)
72
75
 
73
76
  #define NSTR(node) (&((node)->u.str))
74
77
  #define NCCLASS(node) (&((node)->u.cclass))
@@ -91,6 +94,8 @@
91
94
  #define ENCLOSE_MEMORY (1<<0)
92
95
  #define ENCLOSE_OPTION (1<<1)
93
96
  #define ENCLOSE_STOP_BACKTRACK (1<<2)
97
+ #define ENCLOSE_CONDITION (1<<3)
98
+ #define ENCLOSE_ABSENT (1<<4)
94
99
 
95
100
  #define NODE_STR_MARGIN 16
96
101
  #define NODE_STR_BUF_SIZE 24 /* sizeof(CClassNode) - sizeof(int)*4 */
@@ -100,7 +105,7 @@
100
105
  #define NSTR_AMBIG (1<<1)
101
106
  #define NSTR_DONT_GET_OPT_INFO (1<<2)
102
107
 
103
- #define NSTRING_LEN(node) (OnigDistance)((node)->u.str.end - (node)->u.str.s)
108
+ #define NSTRING_LEN(node) (OnigDistance )((node)->u.str.end - (node)->u.str.s)
104
109
  #define NSTRING_SET_RAW(node) (node)->u.str.flag |= NSTR_RAW
105
110
  #define NSTRING_CLEAR_RAW(node) (node)->u.str.flag &= ~NSTR_RAW
106
111
  #define NSTRING_SET_AMBIG(node) (node)->u.str.flag |= NSTR_AMBIG
@@ -150,6 +155,7 @@
150
155
  #define IS_ENCLOSE_STOP_BT_SIMPLE_REPEAT(en) \
151
156
  (((en)->state & NST_STOP_BT_SIMPLE_REPEAT) != 0)
152
157
  #define IS_ENCLOSE_NAMED_GROUP(en) (((en)->state & NST_NAMED_GROUP) != 0)
158
+ #define IS_ENCLOSE_NAME_REF(en) (((en)->state & NST_NAME_REF) != 0)
153
159
 
154
160
  #define SET_CALL_RECURSION(node) (node)->u.call.state |= NST_RECURSION
155
161
  #define IS_CALL_RECURSION(cn) (((cn)->state & NST_RECURSION) != 0)
@@ -192,8 +198,8 @@ typedef struct {
192
198
  int type;
193
199
  int regnum;
194
200
  OnigOptionType option;
195
- struct _Node* target;
196
201
  AbsAddrType call_addr;
202
+ struct _Node* target;
197
203
  /* for multiple call reference */
198
204
  OnigDistance min_len; /* min length (byte) */
199
205
  OnigDistance max_len; /* max length (byte) */
@@ -240,6 +246,7 @@ typedef struct {
240
246
  int type;
241
247
  struct _Node* target;
242
248
  int char_len;
249
+ int ascii_range;
243
250
  } AnchorNode;
244
251
 
245
252
  typedef struct {
@@ -252,6 +259,7 @@ typedef struct {
252
259
  NodeBase base;
253
260
  int ctype;
254
261
  int not;
262
+ int ascii_range;
255
263
  } CtypeNode;
256
264
 
257
265
  typedef struct _Node {
@@ -293,10 +301,10 @@ typedef struct {
293
301
  UChar* error;
294
302
  UChar* error_end;
295
303
  regex_t* reg; /* for reg->names only */
296
- int num_call;
297
304
  #ifdef USE_SUBEXP_CALL
298
305
  UnsetAddrList* unset_addr_list;
299
306
  #endif
307
+ int num_call;
300
308
  int num_mem;
301
309
  #ifdef USE_NAMED_GROUP
302
310
  int num_named;
@@ -310,9 +318,12 @@ typedef struct {
310
318
  int curr_max_regnum;
311
319
  int has_recursion;
312
320
  #endif
321
+ unsigned int parse_depth;
313
322
  int warnings_flag;
323
+ #ifdef RUBY
314
324
  const char* sourcefile;
315
325
  int sourceline;
326
+ #endif
316
327
  } ScanEnv;
317
328
 
318
329
 
@@ -325,38 +336,35 @@ typedef struct {
325
336
  int new_val;
326
337
  } GroupNumRemap;
327
338
 
328
- extern int onig_renumber_name_table P_((regex_t* reg, GroupNumRemap* map));
339
+ extern int onig_renumber_name_table(regex_t* reg, GroupNumRemap* map);
329
340
  #endif
330
341
 
331
- extern int onig_strncmp P_((const UChar* s1, const UChar* s2, int n));
332
- extern void onig_strcpy P_((UChar* dest, const UChar* src, const UChar* end));
333
- extern void onig_scan_env_set_error_string P_((ScanEnv* env, int ecode, UChar* arg, UChar* arg_end));
334
- extern int onig_scan_unsigned_number P_((UChar** src, const UChar* end, OnigEncoding enc));
335
- extern void onig_reduce_nested_quantifier P_((Node* pnode, Node* cnode));
336
- extern void onig_node_conv_to_str_node P_((Node* node, int raw));
337
- extern int onig_node_str_cat P_((Node* node, const UChar* s, const UChar* end));
338
- extern int onig_node_str_set P_((Node* node, const UChar* s, const UChar* end));
339
- extern void onig_node_free P_((Node* node));
340
- extern Node* onig_node_new_enclose P_((int type));
341
- extern Node* onig_node_new_anchor P_((int type));
342
- extern Node* onig_node_new_str P_((const UChar* s, const UChar* end));
343
- extern Node* onig_node_new_list P_((Node* left, Node* right));
344
- extern Node* onig_node_list_add P_((Node* list, Node* x));
345
- extern Node* onig_node_new_alt P_((Node* left, Node* right));
346
- extern void onig_node_str_clear P_((Node* node));
347
- extern int onig_free_node_list P_((void));
348
- extern int onig_names_free P_((regex_t* reg));
349
- extern int onig_parse_make_tree P_((Node** root, const UChar* pattern, const UChar* end, regex_t* reg, ScanEnv* env));
350
- extern int onig_free_shared_cclass_table P_((void));
342
+ extern int onig_strncmp(const UChar* s1, const UChar* s2, int n);
343
+ extern void onig_strcpy(UChar* dest, const UChar* src, const UChar* end);
344
+ extern void onig_scan_env_set_error_string(ScanEnv* env, int ecode, UChar* arg, UChar* arg_end);
345
+ extern int onig_scan_unsigned_number(UChar** src, const UChar* end, OnigEncoding enc);
346
+ extern void onig_reduce_nested_quantifier(Node* pnode, Node* cnode);
347
+ extern void onig_node_conv_to_str_node(Node* node, int raw);
348
+ extern int onig_node_str_cat(Node* node, const UChar* s, const UChar* end);
349
+ extern int onig_node_str_set(Node* node, const UChar* s, const UChar* end);
350
+ extern void onig_node_free(Node* node);
351
+ extern Node* onig_node_new_enclose(int type);
352
+ extern Node* onig_node_new_anchor(int type);
353
+ extern Node* onig_node_new_str(const UChar* s, const UChar* end);
354
+ extern Node* onig_node_new_list(Node* left, Node* right);
355
+ extern Node* onig_node_list_add(Node* list, Node* x);
356
+ extern Node* onig_node_new_alt(Node* left, Node* right);
357
+ extern void onig_node_str_clear(Node* node);
358
+ extern int onig_names_free(regex_t* reg);
359
+ extern int onig_parse_make_tree(Node** root, const UChar* pattern, const UChar* end, regex_t* reg, ScanEnv* env);
360
+ extern int onig_free_shared_cclass_table(void);
351
361
 
352
362
  #ifdef ONIG_DEBUG
353
- #ifdef USE_NAMED_GROUP
363
+ # ifdef USE_NAMED_GROUP
354
364
  extern int onig_print_names(FILE*, regex_t*);
355
- #endif
365
+ # endif
356
366
  #endif
357
367
 
358
- #if defined __GNUC__ && __GNUC__ >= 4
359
- #pragma GCC visibility pop
360
- #endif
368
+ RUBY_SYMBOL_EXPORT_END
361
369
 
362
- #endif /* ONIGURUMA_REGPARSE_H */
370
+ #endif /* ONIGMO_REGPARSE_H */
@@ -0,0 +1 @@
1
+ #define RUBY_REVISION 67245
@@ -0,0 +1,54 @@
1
+ #ifndef RUBY_ASSERT_H
2
+ #define RUBY_ASSERT_H
3
+
4
+ #include "ruby/ruby.h"
5
+
6
+ #if defined(__cplusplus)
7
+ extern "C" {
8
+ #if 0
9
+ } /* satisfy cc-mode */
10
+ #endif
11
+ #endif
12
+
13
+ NORETURN(void rb_assert_failure(const char *, int, const char *, const char *));
14
+ #ifdef RUBY_FUNCTION_NAME_STRING
15
+ # define RUBY_ASSERT_FAIL(expr) \
16
+ rb_assert_failure(__FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING, expr)
17
+ #else
18
+ # define RUBY_ASSERT_FAIL(expr) \
19
+ rb_assert_failure(__FILE__, __LINE__, NULL, expr)
20
+ #endif
21
+ #define RUBY_ASSERT_MESG(expr, mesg) \
22
+ ((expr) ? (void)0 : RUBY_ASSERT_FAIL(mesg))
23
+ #ifdef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P
24
+ # define RUBY_ASSERT_MESG_WHEN(cond, expr, mesg) \
25
+ __builtin_choose_expr( \
26
+ __builtin_constant_p(cond), \
27
+ __builtin_choose_expr(cond, RUBY_ASSERT_MESG(expr, mesg), (void)0), \
28
+ RUBY_ASSERT_MESG(!(cond) || (expr), mesg))
29
+ #else
30
+ # define RUBY_ASSERT_MESG_WHEN(cond, expr, mesg) \
31
+ RUBY_ASSERT_MESG(!(cond) || (expr), mesg)
32
+ #endif
33
+ #define RUBY_ASSERT(expr) RUBY_ASSERT_MESG_WHEN(!RUBY_NDEBUG+0, expr, #expr)
34
+ #define RUBY_ASSERT_WHEN(cond, expr) RUBY_ASSERT_MESG_WHEN(cond, expr, #expr)
35
+
36
+ #undef assert
37
+ #define assert RUBY_ASSERT
38
+
39
+ #ifndef RUBY_NDEBUG
40
+ # ifdef NDEBUG
41
+ # define RUBY_NDEBUG 1
42
+ # else
43
+ # define RUBY_NDEBUG 0
44
+ # endif
45
+ #endif
46
+
47
+ #if defined(__cplusplus)
48
+ #if 0
49
+ { /* satisfy cc-mode */
50
+ #endif
51
+ } /* extern "C" { */
52
+ #endif
53
+
54
+ #endif
@@ -7,24 +7,17 @@ typedef unsigned int rb_atomic_t;
7
7
  # define ATOMIC_SET(var, val) (void)__atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
8
8
  # define ATOMIC_INC(var) __atomic_fetch_add(&(var), 1, __ATOMIC_SEQ_CST)
9
9
  # define ATOMIC_DEC(var) __atomic_fetch_sub(&(var), 1, __ATOMIC_SEQ_CST)
10
- # define ATOMIC_OR(var, val) __atomic_or_fetch(&(var), (val), __ATOMIC_SEQ_CST)
10
+ # define ATOMIC_OR(var, val) __atomic_fetch_or(&(var), (val), __ATOMIC_SEQ_CST)
11
11
  # define ATOMIC_EXCHANGE(var, val) __atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
12
12
  # define ATOMIC_CAS(var, oldval, newval) \
13
- ({ __typeof__(oldval) oldvaldup = (oldval); /* oldval should not be modified */ \
13
+ ({ __typeof__(var) oldvaldup = (oldval); /* oldval should not be modified */ \
14
14
  __atomic_compare_exchange_n(&(var), &oldvaldup, (newval), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); \
15
15
  oldvaldup; })
16
16
 
17
17
  # define ATOMIC_SIZE_ADD(var, val) __atomic_fetch_add(&(var), (val), __ATOMIC_SEQ_CST)
18
18
  # define ATOMIC_SIZE_SUB(var, val) __atomic_fetch_sub(&(var), (val), __ATOMIC_SEQ_CST)
19
- # define ATOMIC_SIZE_INC(var) __atomic_fetch_add(&(var), 1, __ATOMIC_SEQ_CST)
20
- # define ATOMIC_SIZE_DEC(var) __atomic_fetch_sub(&(var), 1, __ATOMIC_SEQ_CST)
21
- # define ATOMIC_SIZE_EXCHANGE(var, val) __atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
22
- # define ATOMIC_SIZE_CAS(var, oldval, newval) \
23
- ({ size_t oldvaldup = (oldval); \
24
- __atomic_compare_exchange_n(&(var), &oldvaldup, (newval), 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); \
25
- oldvaldup; })
26
19
 
27
- # define ATOMIC_PTR_EXCHANGE(var, val) __atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
20
+ # define RUBY_ATOMIC_GENERIC_MACRO 1
28
21
 
29
22
  #elif defined HAVE_GCC_SYNC_BUILTINS
30
23
  /* @shyouhei hack to support atomic operations in case of gcc. Gcc
@@ -35,18 +28,14 @@ typedef unsigned int rb_atomic_t; /* Anything OK */
35
28
  # define ATOMIC_SET(var, val) (void)__sync_lock_test_and_set(&(var), (val))
36
29
  # define ATOMIC_INC(var) __sync_fetch_and_add(&(var), 1)
37
30
  # define ATOMIC_DEC(var) __sync_fetch_and_sub(&(var), 1)
38
- # define ATOMIC_OR(var, val) __sync_or_and_fetch(&(var), (val))
31
+ # define ATOMIC_OR(var, val) __sync_fetch_and_or(&(var), (val))
39
32
  # define ATOMIC_EXCHANGE(var, val) __sync_lock_test_and_set(&(var), (val))
40
33
  # define ATOMIC_CAS(var, oldval, newval) __sync_val_compare_and_swap(&(var), (oldval), (newval))
41
34
 
42
35
  # define ATOMIC_SIZE_ADD(var, val) __sync_fetch_and_add(&(var), (val))
43
36
  # define ATOMIC_SIZE_SUB(var, val) __sync_fetch_and_sub(&(var), (val))
44
- # define ATOMIC_SIZE_INC(var) __sync_fetch_and_add(&(var), 1)
45
- # define ATOMIC_SIZE_DEC(var) __sync_fetch_and_sub(&(var), 1)
46
- # define ATOMIC_SIZE_EXCHANGE(var, val) __sync_lock_test_and_set(&(var), (val))
47
- # define ATOMIC_PTR_EXCHANGE(var, val) __sync_lock_test_and_set(&(var), (val))
48
37
 
49
- # define ATOMIC_PTR_EXCHANGE(var, val) __sync_lock_test_and_set(&(var), (val))
38
+ # define RUBY_ATOMIC_GENERIC_MACRO 1
50
39
 
51
40
  #elif defined _WIN32
52
41
  #if defined _MSC_VER && _MSC_VER > 1200
@@ -77,7 +66,6 @@ rb_w32_atomic_or(volatile rb_atomic_t *var, rb_atomic_t val)
77
66
  #endif
78
67
  # define ATOMIC_EXCHANGE(var, val) InterlockedExchange(&(var), (val))
79
68
  # define ATOMIC_CAS(var, oldval, newval) InterlockedCompareExchange(&(var), (newval), (oldval))
80
-
81
69
  # if defined _MSC_VER && _MSC_VER <= 1200
82
70
  static inline rb_atomic_t
83
71
  rb_w32_atomic_cas(volatile rb_atomic_t *var, rb_atomic_t oldval, rb_atomic_t newval)
@@ -88,15 +76,15 @@ rb_w32_atomic_cas(volatile rb_atomic_t *var, rb_atomic_t oldval, rb_atomic_t new
88
76
  # define ATOMIC_CAS(var, oldval, newval) rb_w32_atomic_cas(&(var), (oldval), (newval))
89
77
  # endif
90
78
  # ifdef _M_AMD64
91
- # define ATOMIC_SIZE_ADD(var, val) InterlockedExchangeAdd64(&(var), (val))
92
- # define ATOMIC_SIZE_SUB(var, val) InterlockedExchangeAdd64(&(var), -(val))
79
+ # define ATOMIC_SIZE_ADD(var, val) InterlockedExchangeAdd64((LONG_LONG *)&(var), (val))
80
+ # define ATOMIC_SIZE_SUB(var, val) InterlockedExchangeAdd64((LONG_LONG *)&(var), -(LONG)(val))
93
81
  # define ATOMIC_SIZE_INC(var) InterlockedIncrement64(&(var))
94
82
  # define ATOMIC_SIZE_DEC(var) InterlockedDecrement64(&(var))
95
83
  # define ATOMIC_SIZE_EXCHANGE(var, val) InterlockedExchange64(&(var), (val))
96
- # define ATOMIC_SIZE_CAS(var, oldval, val) InterlockedCompareExchange64(&(var), (oldval), (val))
84
+ # define ATOMIC_SIZE_CAS(var, oldval, newval) InterlockedCompareExchange64(&(var), (newval), (oldval))
97
85
  # else
98
86
  # define ATOMIC_SIZE_ADD(var, val) InterlockedExchangeAdd((LONG *)&(var), (val))
99
- # define ATOMIC_SIZE_SUB(var, val) InterlockedExchangeAdd((LONG *)&(var), -(val))
87
+ # define ATOMIC_SIZE_SUB(var, val) InterlockedExchangeAdd((LONG *)&(var), -(LONG)(val))
100
88
  # define ATOMIC_SIZE_INC(var) InterlockedIncrement((LONG *)&(var))
101
89
  # define ATOMIC_SIZE_DEC(var) InterlockedDecrement((LONG *)&(var))
102
90
  # define ATOMIC_SIZE_EXCHANGE(var, val) InterlockedExchange((LONG *)&(var), (val))
@@ -130,7 +118,7 @@ typedef unsigned int rb_atomic_t;
130
118
 
131
119
  #else
132
120
  typedef int rb_atomic_t;
133
- #define NEED_RUBY_ATOMIC_EXCHANGE
121
+ #define NEED_RUBY_ATOMIC_OPS
134
122
  extern rb_atomic_t ruby_atomic_exchange(rb_atomic_t *ptr, rb_atomic_t val);
135
123
  extern rb_atomic_t ruby_atomic_compare_and_swap(rb_atomic_t *ptr,
136
124
  rb_atomic_t cmp,
@@ -145,11 +133,9 @@ extern rb_atomic_t ruby_atomic_compare_and_swap(rb_atomic_t *ptr,
145
133
 
146
134
  # define ATOMIC_SIZE_ADD(var, val) (void)((var) += (val))
147
135
  # define ATOMIC_SIZE_SUB(var, val) (void)((var) -= (val))
148
- # define ATOMIC_SIZE_INC(var) ((var)++)
149
- # define ATOMIC_SIZE_DEC(var) ((var)--)
150
- # define ATOMIC_SIZE_EXCHANGE(var, val) atomic_size_exchange(&(var), (val))
136
+ # define ATOMIC_SIZE_EXCHANGE(var, val) ruby_atomic_size_exchange(&(var), (val))
151
137
  static inline size_t
152
- atomic_size_exchange(size_t *ptr, size_t val)
138
+ ruby_atomic_size_exchange(size_t *ptr, size_t val)
153
139
  {
154
140
  size_t old = *ptr;
155
141
  *ptr = val;
@@ -157,18 +143,90 @@ atomic_size_exchange(size_t *ptr, size_t val)
157
143
  }
158
144
  #endif
159
145
 
146
+ #ifndef ATOMIC_SIZE_INC
147
+ # define ATOMIC_SIZE_INC(var) ATOMIC_INC(var)
148
+ #endif
149
+ #ifndef ATOMIC_SIZE_DEC
150
+ # define ATOMIC_SIZE_DEC(var) ATOMIC_DEC(var)
151
+ #endif
152
+ #ifndef ATOMIC_SIZE_EXCHANGE
153
+ # define ATOMIC_SIZE_EXCHANGE(var, val) ATOMIC_EXCHANGE(var, val)
154
+ #endif
160
155
  #ifndef ATOMIC_SIZE_CAS
161
156
  # define ATOMIC_SIZE_CAS(var, oldval, val) ATOMIC_CAS(var, oldval, val)
162
157
  #endif
163
158
 
159
+ #if RUBY_ATOMIC_GENERIC_MACRO
160
+ # ifndef ATOMIC_PTR_EXCHANGE
161
+ # define ATOMIC_PTR_EXCHANGE(var, val) ATOMIC_EXCHANGE(var, val)
162
+ # endif
163
+ # ifndef ATOMIC_PTR_CAS
164
+ # define ATOMIC_PTR_CAS(var, oldval, newval) ATOMIC_CAS(var, oldval, newval)
165
+ # endif
166
+
167
+ # ifndef ATOMIC_VALUE_EXCHANGE
168
+ # define ATOMIC_VALUE_EXCHANGE(var, val) ATOMIC_EXCHANGE(var, val)
169
+ # endif
170
+ # ifndef ATOMIC_VALUE_CAS
171
+ # define ATOMIC_VALUE_CAS(var, oldval, val) ATOMIC_CAS(var, oldval, val)
172
+ # endif
173
+ #endif
174
+
164
175
  #ifndef ATOMIC_PTR_EXCHANGE
165
176
  # if SIZEOF_VOIDP == SIZEOF_SIZE_T
166
177
  # define ATOMIC_PTR_EXCHANGE(var, val) (void *)ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))
178
+ # else
179
+ # define ATOMIC_PTR_EXCHANGE(var, val) ruby_atomic_ptr_exchange((const void **)&(var), (val))
180
+ static inline void *
181
+ ruby_atomic_ptr_exchange(const void **ptr, const void *val)
182
+ {
183
+ const void *const old = *ptr;
184
+ *ptr = val;
185
+ return (void *)old;
186
+ }
167
187
  # endif
168
188
  #endif
169
189
  #ifndef ATOMIC_PTR_CAS
170
190
  # if SIZEOF_VOIDP == SIZEOF_SIZE_T
171
191
  # define ATOMIC_PTR_CAS(var, oldval, val) (void *)ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val))
192
+ # else
193
+ # define ATOMIC_PTR_CAS(var, oldval, val) ruby_atomic_ptr_cas(&(var), (oldval), (val))
194
+ static inline void *
195
+ ruby_atomic_ptr_cas(const void **ptr, const void *oldval, const void *val)
196
+ {
197
+ const void *const old = *ptr;
198
+ if (old == oldval) *ptr = val;
199
+ return (void *)old;
200
+ }
201
+ # endif
202
+ #endif
203
+
204
+ #ifndef ATOMIC_VALUE_EXCHANGE
205
+ # if SIZEOF_VALUE == SIZEOF_SIZE_T
206
+ # define ATOMIC_VALUE_EXCHANGE(var, val) ATOMIC_SIZE_EXCHANGE(*(size_t *)&(var), (size_t)(val))
207
+ # else
208
+ # define ATOMIC_VALUE_EXCHANGE(var, val) ruby_atomic_value_exchange(&(var), (val))
209
+ static inline VALUE
210
+ ruby_atomic_value_exchange(VALUE *ptr, VALUE val)
211
+ {
212
+ const VALUE old = *ptr;
213
+ *ptr = val;
214
+ return old;
215
+ }
216
+ # endif
217
+ #endif
218
+ #ifndef ATOMIC_VALUE_CAS
219
+ # if SIZEOF_VALUE == SIZEOF_SIZE_T
220
+ # define ATOMIC_VALUE_CAS(var, oldval, val) ATOMIC_SIZE_CAS(*(size_t *)&(var), (size_t)(oldval), (size_t)(val))
221
+ # else
222
+ # define ATOMIC_VALUE_CAS(var, oldval, val) ruby_atomic_value_cas(&(var), (oldval), (val))
223
+ static inline VALUE
224
+ ruby_atomic_value_cas(VALUE *ptr, VALUE oldval, VALUE val)
225
+ {
226
+ const VALUE old = *ptr;
227
+ if (old == oldval) *ptr = val;
228
+ return old;
229
+ }
172
230
  # endif
173
231
  #endif
174
232
 
@@ -43,6 +43,6 @@ int sip_hash_digest_integer(sip_hash *h, const uint8_t *data, size_t data_len, u
43
43
  void sip_hash_free(sip_hash *h);
44
44
  void sip_hash_dump(sip_hash *h);
45
45
 
46
- uint64_t sip_hash24(const uint8_t key[16], const uint8_t *data, size_t len);
46
+ uint64_t sip_hash13(const uint8_t key[16], const uint8_t *data, size_t len);
47
47
 
48
48
  #endif
@@ -0,0 +1,108 @@
1
+ /**********************************************************************
2
+
3
+ symbol.h -
4
+
5
+ $Author$
6
+ created at: Tue Jul 8 15:49:54 JST 2014
7
+
8
+ Copyright (C) 2014 Yukihiro Matsumoto
9
+
10
+ **********************************************************************/
11
+
12
+ #ifndef RUBY_SYMBOL_H
13
+ #define RUBY_SYMBOL_H 1
14
+
15
+ #include "id.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) (R_CAST(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
+
57
+ static inline rb_id_serial_t
58
+ rb_id_to_serial(ID id)
59
+ {
60
+ if (is_notop_id(id)) {
61
+ return (rb_id_serial_t)(id >> ID_SCOPE_SHIFT);
62
+ }
63
+ else {
64
+ return (rb_id_serial_t)id;
65
+ }
66
+ }
67
+
68
+ static inline int
69
+ sym_type(VALUE sym)
70
+ {
71
+ ID id;
72
+ if (STATIC_SYM_P(sym)) {
73
+ id = RSHIFT(sym, RUBY_SPECIAL_SHIFT);
74
+ if (id<=tLAST_OP_ID) {
75
+ return -1;
76
+ }
77
+ }
78
+ else {
79
+ id = RSYMBOL(sym)->id;
80
+ }
81
+ return (int)(id&ID_SCOPE_MASK);
82
+ }
83
+
84
+ #define is_local_sym(sym) (sym_type(sym)==ID_LOCAL)
85
+ #define is_global_sym(sym) (sym_type(sym)==ID_GLOBAL)
86
+ #define is_instance_sym(sym) (sym_type(sym)==ID_INSTANCE)
87
+ #define is_attrset_sym(sym) (sym_type(sym)==ID_ATTRSET)
88
+ #define is_const_sym(sym) (sym_type(sym)==ID_CONST)
89
+ #define is_class_sym(sym) (sym_type(sym)==ID_CLASS)
90
+ #define is_junk_sym(sym) (sym_type(sym)==ID_JUNK)
91
+
92
+ RUBY_FUNC_EXPORTED const unsigned int ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];
93
+
94
+ static inline int
95
+ is_global_name_punct(const int c)
96
+ {
97
+ if (c <= 0x20 || 0x7e < c) return 0;
98
+ return (ruby_global_name_punct_bits[(c - 0x20) / 32] >> (c % 32)) & 1;
99
+ }
100
+
101
+ ID rb_intern_cstr_without_pindown(const char *, long, rb_encoding *);
102
+
103
+ RUBY_SYMBOL_EXPORT_BEGIN
104
+
105
+ size_t rb_sym_immortal_count(void);
106
+
107
+ RUBY_SYMBOL_EXPORT_END
108
+ #endif
@@ -11,39 +11,42 @@
11
11
  #ifndef RUBY_THREAD_PTHREAD_H
12
12
  #define RUBY_THREAD_PTHREAD_H
13
13
 
14
- #include <pthread.h>
15
14
  #ifdef HAVE_PTHREAD_NP_H
16
15
  #include <pthread_np.h>
17
16
  #endif
18
- typedef pthread_t rb_thread_id_t;
19
- typedef pthread_mutex_t rb_thread_lock_t;
17
+
18
+ #define RB_NATIVETHREAD_LOCK_INIT PTHREAD_MUTEX_INITIALIZER
19
+ #define RB_NATIVETHREAD_COND_INIT { PTHREAD_COND_INITIALIZER, }
20
20
 
21
21
  typedef struct rb_thread_cond_struct {
22
22
  pthread_cond_t cond;
23
23
  #ifdef HAVE_CLOCKID_T
24
24
  clockid_t clockid;
25
25
  #endif
26
- } rb_thread_cond_t;
26
+ } rb_nativethread_cond_t;
27
27
 
28
28
  typedef struct native_thread_data_struct {
29
- void *signal_thread_list;
30
- rb_thread_cond_t sleep_cond;
29
+ struct list_node ubf_list;
30
+ rb_nativethread_cond_t sleep_cond;
31
31
  } native_thread_data_t;
32
32
 
33
- #include <semaphore.h>
33
+ #undef except
34
+ #undef try
35
+ #undef leave
36
+ #undef finally
34
37
 
35
38
  typedef struct rb_global_vm_lock_struct {
36
39
  /* fast path */
37
40
  unsigned long acquired;
38
- pthread_mutex_t lock;
41
+ rb_nativethread_lock_t lock;
39
42
 
40
43
  /* slow path */
41
44
  volatile unsigned long waiting;
42
- rb_thread_cond_t cond;
45
+ rb_nativethread_cond_t cond;
43
46
 
44
47
  /* yield */
45
- rb_thread_cond_t switch_cond;
46
- rb_thread_cond_t switch_wait_cond;
48
+ rb_nativethread_cond_t switch_cond;
49
+ rb_nativethread_cond_t switch_wait_cond;
47
50
  int need_yield;
48
51
  int wait_yield;
49
52
  } rb_global_vm_lock_t;
@@ -2,7 +2,7 @@
2
2
 
3
3
  thread_win32.h -
4
4
 
5
- $Author: kosaki $
5
+ $Author: ko1 $
6
6
 
7
7
  Copyright (C) 2004-2007 Koichi Sasada
8
8
 
@@ -12,8 +12,6 @@
12
12
  #ifndef RUBY_THREAD_WIN32_H
13
13
  #define RUBY_THREAD_WIN32_H
14
14
 
15
- #include <windows.h>
16
-
17
15
  # ifdef __CYGWIN__
18
16
  # undef _WIN32
19
17
  # endif
@@ -21,12 +19,10 @@
21
19
  WINBASEAPI BOOL WINAPI
22
20
  TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
23
21
 
24
- typedef HANDLE rb_thread_id_t;
25
- typedef CRITICAL_SECTION rb_thread_lock_t;
26
22
  typedef struct rb_thread_cond_struct {
27
23
  struct cond_event_entry *next;
28
24
  struct cond_event_entry *prev;
29
- } rb_thread_cond_t;
25
+ } rb_nativethread_cond_t;
30
26
 
31
27
  typedef struct native_thread_data_struct {
32
28
  HANDLE interrupt_event;
@@ -0,0 +1,42 @@
1
+ #ifndef RUBY_TIMEV_H
2
+ #define RUBY_TIMEV_H
3
+
4
+ PACKED_STRUCT_UNALIGNED(struct vtm {
5
+ VALUE year; /* 2000 for example. Integer. */
6
+ VALUE subsecx; /* 0 <= subsecx < TIME_SCALE. possibly Rational. */
7
+ VALUE utc_offset; /* -3600 as -01:00 for example. possibly Rational. */
8
+ const char *zone; /* "JST", "EST", "EDT", etc. */
9
+ uint16_t yday:9; /* 1..366 */
10
+ uint8_t mon:4; /* 1..12 */
11
+ uint8_t mday:5; /* 1..31 */
12
+ uint8_t hour:5; /* 0..23 */
13
+ uint8_t min:6; /* 0..59 */
14
+ uint8_t sec:6; /* 0..60 */
15
+ uint8_t wday:3; /* 0:Sunday, 1:Monday, ..., 6:Saturday 7:init */
16
+ uint8_t isdst:2; /* 0:StandardTime 1:DayLightSavingTime 3:init */
17
+ });
18
+
19
+ #define TIME_SCALE 1000000000
20
+
21
+ #ifndef TYPEOF_TIMEVAL_TV_SEC
22
+ # define TYPEOF_TIMEVAL_TV_SEC time_t
23
+ #endif
24
+ #ifndef TYPEOF_TIMEVAL_TV_USEC
25
+ # if INT_MAX >= 1000000
26
+ # define TYPEOF_TIMEVAL_TV_USEC int
27
+ # else
28
+ # define TYPEOF_TIMEVAL_TV_USEC long
29
+ # endif
30
+ #endif
31
+
32
+ #if SIZEOF_TIME_T == SIZEOF_LONG
33
+ typedef unsigned long unsigned_time_t;
34
+ #elif SIZEOF_TIME_T == SIZEOF_INT
35
+ typedef unsigned int unsigned_time_t;
36
+ #elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
37
+ typedef unsigned LONG_LONG unsigned_time_t;
38
+ #else
39
+ # error cannot find integer type which size is same as time_t.
40
+ #endif
41
+
42
+ #endif