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
@@ -0,0 +1,16 @@
1
+ /* CC0 (Public domain) - see ccan/licenses/CC0 file for details */
2
+ #ifndef CCAN_STR_H
3
+ #define CCAN_STR_H
4
+ /**
5
+ * stringify - Turn expression into a string literal
6
+ * @expr: any C expression
7
+ *
8
+ * Example:
9
+ * #define PRINT_COND_IF_FALSE(cond) \
10
+ * ((cond) || printf("%s is false!", stringify(cond)))
11
+ */
12
+ #define stringify(expr) stringify_1(expr)
13
+ /* Double-indirection required to stringify expansions */
14
+ #define stringify_1(expr) #expr
15
+
16
+ #endif /* CCAN_STR_H */
@@ -0,0 +1,51 @@
1
+ /**********************************************************************
2
+
3
+ constant.h -
4
+
5
+ $Author$
6
+ created at: Sun Nov 15 00:09:33 2009
7
+
8
+ Copyright (C) 2009 Yusuke Endoh
9
+
10
+ **********************************************************************/
11
+ #ifndef CONSTANT_H
12
+ #define CONSTANT_H
13
+
14
+ typedef enum {
15
+ CONST_DEPRECATED = 0x100,
16
+
17
+ CONST_VISIBILITY_MASK = 0xff,
18
+ CONST_PUBLIC = 0x00,
19
+ CONST_PRIVATE,
20
+ CONST_VISIBILITY_MAX
21
+ } rb_const_flag_t;
22
+
23
+ #define RB_CONST_PRIVATE_P(ce) \
24
+ (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PRIVATE)
25
+ #define RB_CONST_PUBLIC_P(ce) \
26
+ (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PUBLIC)
27
+
28
+ #define RB_CONST_DEPRECATED_P(ce) \
29
+ ((ce)->flag & CONST_DEPRECATED)
30
+
31
+ typedef struct rb_const_entry_struct {
32
+ rb_const_flag_t flag;
33
+ int line;
34
+ const VALUE value; /* should be mark */
35
+ const VALUE file; /* should be mark */
36
+ } rb_const_entry_t;
37
+
38
+ VALUE rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj);
39
+ VALUE rb_mod_public_constant(int argc, const VALUE *argv, VALUE obj);
40
+ VALUE rb_mod_deprecate_constant(int argc, const VALUE *argv, VALUE obj);
41
+ void rb_free_const_table(struct rb_id_table *tbl);
42
+ VALUE rb_public_const_get(VALUE klass, ID id);
43
+ VALUE rb_public_const_get_at(VALUE klass, ID id);
44
+ VALUE rb_public_const_get_from(VALUE klass, ID id);
45
+ int rb_public_const_defined(VALUE klass, ID id);
46
+ int rb_public_const_defined_at(VALUE klass, ID id);
47
+ int rb_public_const_defined_from(VALUE klass, ID id);
48
+ rb_const_entry_t *rb_const_lookup(VALUE klass, ID id);
49
+ int rb_autoloading_value(VALUE mod, ID id, VALUE *value, rb_const_flag_t *flag);
50
+
51
+ #endif /* CONSTANT_H */
@@ -0,0 +1,109 @@
1
+ /**********************************************************************
2
+
3
+ debug_counter.h -
4
+
5
+ created at: Tue Feb 21 16:51:18 2017
6
+
7
+ Copyright (C) 2017 Koichi Sasada
8
+
9
+ **********************************************************************/
10
+
11
+ #ifndef USE_DEBUG_COUNTER
12
+ #define USE_DEBUG_COUNTER 0
13
+ #endif
14
+
15
+ #ifdef RB_DEBUG_COUNTER
16
+
17
+ /* method search */
18
+ RB_DEBUG_COUNTER(mc_inline_hit)
19
+ RB_DEBUG_COUNTER(mc_inline_miss)
20
+ RB_DEBUG_COUNTER(mc_global_hit)
21
+ RB_DEBUG_COUNTER(mc_global_miss)
22
+ RB_DEBUG_COUNTER(mc_global_state_miss)
23
+ RB_DEBUG_COUNTER(mc_class_serial_miss)
24
+ RB_DEBUG_COUNTER(mc_cme_complement)
25
+ RB_DEBUG_COUNTER(mc_cme_complement_hit)
26
+ RB_DEBUG_COUNTER(mc_search_super)
27
+
28
+ /* ivar access */
29
+ RB_DEBUG_COUNTER(ivar_get_ic_hit)
30
+ RB_DEBUG_COUNTER(ivar_get_ic_miss)
31
+ RB_DEBUG_COUNTER(ivar_get_ic_miss_serial)
32
+ RB_DEBUG_COUNTER(ivar_get_ic_miss_unset)
33
+ RB_DEBUG_COUNTER(ivar_get_ic_miss_noobject)
34
+ RB_DEBUG_COUNTER(ivar_set_ic_hit)
35
+ RB_DEBUG_COUNTER(ivar_set_ic_miss)
36
+ RB_DEBUG_COUNTER(ivar_set_ic_miss_serial)
37
+ RB_DEBUG_COUNTER(ivar_set_ic_miss_unset)
38
+ RB_DEBUG_COUNTER(ivar_set_ic_miss_oorange)
39
+ RB_DEBUG_COUNTER(ivar_set_ic_miss_noobject)
40
+ RB_DEBUG_COUNTER(ivar_get_base)
41
+ RB_DEBUG_COUNTER(ivar_set_base)
42
+
43
+ /* lvar access */
44
+ RB_DEBUG_COUNTER(lvar_get)
45
+ RB_DEBUG_COUNTER(lvar_get_dynamic)
46
+ RB_DEBUG_COUNTER(lvar_set)
47
+ RB_DEBUG_COUNTER(lvar_set_dynamic)
48
+ RB_DEBUG_COUNTER(lvar_set_slowpath)
49
+
50
+ /* object counts */
51
+ RB_DEBUG_COUNTER(obj_free)
52
+
53
+ RB_DEBUG_COUNTER(obj_str_ptr)
54
+ RB_DEBUG_COUNTER(obj_str_embed)
55
+ RB_DEBUG_COUNTER(obj_str_shared)
56
+ RB_DEBUG_COUNTER(obj_str_nofree)
57
+ RB_DEBUG_COUNTER(obj_str_fstr)
58
+
59
+ RB_DEBUG_COUNTER(obj_ary_ptr)
60
+ RB_DEBUG_COUNTER(obj_ary_embed)
61
+
62
+ RB_DEBUG_COUNTER(obj_obj_ptr)
63
+ RB_DEBUG_COUNTER(obj_obj_embed)
64
+
65
+ /* load */
66
+ RB_DEBUG_COUNTER(load_files)
67
+ RB_DEBUG_COUNTER(load_path_is_not_realpath)
68
+
69
+ #endif
70
+
71
+ #ifndef RUBY_DEBUG_COUNTER_H
72
+ #define RUBY_DEBUG_COUNTER_H 1
73
+
74
+ #if !defined(__GNUC__) && USE_DEBUG_COUNTER
75
+ #error "USE_DEBUG_COUNTER is not supported by other than __GNUC__"
76
+ #endif
77
+
78
+ enum rb_debug_counter_type {
79
+ #define RB_DEBUG_COUNTER(name) RB_DEBUG_COUNTER_##name,
80
+ #include "debug_counter.h"
81
+ RB_DEBUG_COUNTER_MAX
82
+ #undef RB_DEBUG_COUNTER
83
+ };
84
+
85
+ #if USE_DEBUG_COUNTER
86
+ #include "ruby/ruby.h"
87
+
88
+ extern size_t rb_debug_counter[];
89
+
90
+ inline static int
91
+ rb_debug_counter_add(enum rb_debug_counter_type type, int add, int cond)
92
+ {
93
+ if (cond) {
94
+ rb_debug_counter[(int)type] += add;
95
+ }
96
+ return cond;
97
+ }
98
+
99
+ #define RB_DEBUG_COUNTER_INC(type) rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, 1)
100
+ #define RB_DEBUG_COUNTER_INC_UNLESS(type, cond) (!rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, !(cond)))
101
+ #define RB_DEBUG_COUNTER_INC_IF(type, cond) rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, (cond))
102
+
103
+ #else
104
+ #define RB_DEBUG_COUNTER_INC(type) ((void)0)
105
+ #define RB_DEBUG_COUNTER_INC_UNLESS(type, cond) (cond)
106
+ #define RB_DEBUG_COUNTER_INC_IF(type, cond) (cond)
107
+ #endif
108
+
109
+ #endif /* RUBY_DEBUG_COUNTER_H */
@@ -28,14 +28,17 @@
28
28
  # define _(args) ()
29
29
  #endif
30
30
 
31
- #if defined __GNUC__ && __GNUC__ >= 4
32
- #pragma GCC visibility push(default)
31
+ RUBY_SYMBOL_EXPORT_BEGIN
32
+
33
+ #ifndef DLN_FIND_EXTRA_ARG
34
+ #define DLN_FIND_EXTRA_ARG
35
+ #endif
36
+ #ifndef DLN_FIND_EXTRA_ARG_DECL
37
+ #define DLN_FIND_EXTRA_ARG_DECL
33
38
  #endif
34
39
 
35
- DEPRECATED(char *dln_find_exe(const char*,const char*));
36
- DEPRECATED(char *dln_find_file(const char*,const char*));
37
- char *dln_find_exe_r(const char*,const char*,char*,size_t);
38
- char *dln_find_file_r(const char*,const char*,char*,size_t);
40
+ char *dln_find_exe_r(const char*,const char*,char*,size_t DLN_FIND_EXTRA_ARG_DECL);
41
+ char *dln_find_file_r(const char*,const char*,char*,size_t DLN_FIND_EXTRA_ARG_DECL);
39
42
 
40
43
  #ifdef USE_DLN_A_OUT
41
44
  extern char *dln_argv0;
@@ -43,8 +46,6 @@ extern char *dln_argv0;
43
46
 
44
47
  void *dln_load(const char*);
45
48
 
46
- #if defined __GNUC__ && __GNUC__ >= 4
47
- #pragma GCC visibility pop
48
- #endif
49
+ RUBY_SYMBOL_EXPORT_END
49
50
 
50
51
  #endif
@@ -0,0 +1,69 @@
1
+ /**********************************************************************
2
+
3
+ encindex.h -
4
+
5
+ $Author$
6
+ created at: Tue Sep 15 13:21:14 JST 2015
7
+
8
+ Copyright (C) 2015 Yukihiro Matsumoto
9
+
10
+ **********************************************************************/
11
+
12
+ #ifndef RUBY_ENCINDEX_H
13
+ #define RUBY_ENCINDEX_H 1
14
+ #if defined(__cplusplus)
15
+ extern "C" {
16
+ #if 0
17
+ } /* satisfy cc-mode */
18
+ #endif
19
+ #endif
20
+
21
+ enum ruby_preserved_encindex {
22
+ RUBY_ENCINDEX_ASCII,
23
+ RUBY_ENCINDEX_UTF_8,
24
+ RUBY_ENCINDEX_US_ASCII,
25
+
26
+ /* preserved indexes */
27
+ RUBY_ENCINDEX_UTF_16BE,
28
+ RUBY_ENCINDEX_UTF_16LE,
29
+ RUBY_ENCINDEX_UTF_32BE,
30
+ RUBY_ENCINDEX_UTF_32LE,
31
+ RUBY_ENCINDEX_UTF_16,
32
+ RUBY_ENCINDEX_UTF_32,
33
+ RUBY_ENCINDEX_UTF8_MAC,
34
+
35
+ /* for old options of regexp */
36
+ RUBY_ENCINDEX_EUC_JP,
37
+ RUBY_ENCINDEX_Windows_31J,
38
+
39
+ RUBY_ENCINDEX_BUILTIN_MAX
40
+ };
41
+
42
+ #define ENCINDEX_ASCII RUBY_ENCINDEX_ASCII
43
+ #define ENCINDEX_UTF_8 RUBY_ENCINDEX_UTF_8
44
+ #define ENCINDEX_US_ASCII RUBY_ENCINDEX_US_ASCII
45
+ #define ENCINDEX_UTF_16BE RUBY_ENCINDEX_UTF_16BE
46
+ #define ENCINDEX_UTF_16LE RUBY_ENCINDEX_UTF_16LE
47
+ #define ENCINDEX_UTF_32BE RUBY_ENCINDEX_UTF_32BE
48
+ #define ENCINDEX_UTF_32LE RUBY_ENCINDEX_UTF_32LE
49
+ #define ENCINDEX_UTF_16 RUBY_ENCINDEX_UTF_16
50
+ #define ENCINDEX_UTF_32 RUBY_ENCINDEX_UTF_32
51
+ #define ENCINDEX_UTF8_MAC RUBY_ENCINDEX_UTF8_MAC
52
+ #define ENCINDEX_EUC_JP RUBY_ENCINDEX_EUC_JP
53
+ #define ENCINDEX_Windows_31J RUBY_ENCINDEX_Windows_31J
54
+ #define ENCINDEX_BUILTIN_MAX RUBY_ENCINDEX_BUILTIN_MAX
55
+
56
+ #define rb_ascii8bit_encindex() RUBY_ENCINDEX_ASCII
57
+ #define rb_utf8_encindex() RUBY_ENCINDEX_UTF_8
58
+ #define rb_usascii_encindex() RUBY_ENCINDEX_US_ASCII
59
+
60
+ int rb_enc_find_index2(const char *name, long len);
61
+
62
+ #if defined(__cplusplus)
63
+ #if 0
64
+ { /* satisfy cc-mode */
65
+ #endif
66
+ } /* extern "C" { */
67
+ #endif
68
+
69
+ #endif /* RUBY_ENCINDEX_H */
@@ -0,0 +1,334 @@
1
+ #ifndef RUBY_EVAL_INTERN_H
2
+ #define RUBY_EVAL_INTERN_H
3
+
4
+ #include "ruby/ruby.h"
5
+ #include "vm_core.h"
6
+
7
+ static inline void
8
+ vm_passed_block_handler_set(rb_execution_context_t *ec, VALUE block_handler)
9
+ {
10
+ vm_block_handler_verify(block_handler);
11
+ ec->passed_block_handler = block_handler;
12
+ }
13
+
14
+ static inline void
15
+ pass_passed_block_handler(rb_execution_context_t *ec)
16
+ {
17
+ VALUE block_handler = rb_vm_frame_block_handler(ec->cfp);
18
+ vm_block_handler_verify(block_handler);
19
+ vm_passed_block_handler_set(ec, block_handler);
20
+ VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_PASSED);
21
+ }
22
+
23
+ #define PASS_PASSED_BLOCK_HANDLER_EC(ec) pass_passed_block_handler(ec)
24
+ #define PASS_PASSED_BLOCK_HANDLER() pass_passed_block_handler(GET_EC())
25
+
26
+ #ifdef HAVE_STDLIB_H
27
+ #include <stdlib.h>
28
+ #endif
29
+ #ifndef EXIT_SUCCESS
30
+ #define EXIT_SUCCESS 0
31
+ #endif
32
+ #ifndef EXIT_FAILURE
33
+ #define EXIT_FAILURE 1
34
+ #endif
35
+
36
+ #include <stdio.h>
37
+ #include <setjmp.h>
38
+
39
+ #ifdef __APPLE__
40
+ # ifdef HAVE_CRT_EXTERNS_H
41
+ # include <crt_externs.h>
42
+ # else
43
+ # include "missing/crt_externs.h"
44
+ # endif
45
+ #endif
46
+
47
+ #ifndef HAVE_STRING_H
48
+ char *strrchr(const char *, const char);
49
+ #endif
50
+
51
+ #ifdef HAVE_UNISTD_H
52
+ #include <unistd.h>
53
+ #endif
54
+
55
+ #ifdef HAVE_NET_SOCKET_H
56
+ #include <net/socket.h>
57
+ #endif
58
+
59
+ #define ruby_setjmp(env) RUBY_SETJMP(env)
60
+ #define ruby_longjmp(env,val) RUBY_LONGJMP((env),(val))
61
+ #ifdef __CYGWIN__
62
+ # ifndef _setjmp
63
+ int _setjmp(jmp_buf);
64
+ # endif
65
+ # ifndef _longjmp
66
+ NORETURN(void _longjmp(jmp_buf, int));
67
+ # endif
68
+ #endif
69
+
70
+ #include <sys/types.h>
71
+ #include <signal.h>
72
+ #include <errno.h>
73
+
74
+ #ifdef HAVE_SYS_SELECT_H
75
+ #include <sys/select.h>
76
+ #endif
77
+
78
+ /*
79
+ Solaris sys/select.h switches select to select_large_fdset to support larger
80
+ file descriptors if FD_SETSIZE is larger than 1024 on 32bit environment.
81
+ But Ruby doesn't change FD_SETSIZE because fd_set is allocated dynamically.
82
+ So following definition is required to use select_large_fdset.
83
+ */
84
+ #ifdef HAVE_SELECT_LARGE_FDSET
85
+ #define select(n, r, w, e, t) select_large_fdset((n), (r), (w), (e), (t))
86
+ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval *);
87
+ #endif
88
+
89
+ #ifdef HAVE_SYS_PARAM_H
90
+ #include <sys/param.h>
91
+ #endif
92
+
93
+ #include <sys/stat.h>
94
+
95
+ #ifdef _MSC_VER
96
+ #define SAVE_ROOT_JMPBUF_BEFORE_STMT \
97
+ __try {
98
+ #define SAVE_ROOT_JMPBUF_AFTER_STMT \
99
+ } \
100
+ __except (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW ? \
101
+ (rb_ec_raised_set(GET_EC(), RAISED_STACKOVERFLOW), \
102
+ raise(SIGSEGV), \
103
+ EXCEPTION_EXECUTE_HANDLER) : \
104
+ EXCEPTION_CONTINUE_SEARCH) { \
105
+ /* never reaches here */ \
106
+ }
107
+ #elif defined(__MINGW32__)
108
+ LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
109
+ #define SAVE_ROOT_JMPBUF_BEFORE_STMT \
110
+ do { \
111
+ PVOID _handler = AddVectoredExceptionHandler(1, rb_w32_stack_overflow_handler);
112
+
113
+ #define SAVE_ROOT_JMPBUF_AFTER_STMT \
114
+ RemoveVectoredExceptionHandler(_handler); \
115
+ } while (0);
116
+ #else
117
+ #define SAVE_ROOT_JMPBUF_BEFORE_STMT
118
+ #define SAVE_ROOT_JMPBUF_AFTER_STMT
119
+ #endif
120
+
121
+ #define SAVE_ROOT_JMPBUF(th, stmt) do \
122
+ if (ruby_setjmp((th)->root_jmpbuf) == 0) { \
123
+ SAVE_ROOT_JMPBUF_BEFORE_STMT \
124
+ stmt; \
125
+ SAVE_ROOT_JMPBUF_AFTER_STMT \
126
+ } \
127
+ else { \
128
+ rb_fiber_start(); \
129
+ } while (0)
130
+
131
+ #define EC_PUSH_TAG(ec) do { \
132
+ rb_execution_context_t * const _ec = (ec); \
133
+ struct rb_vm_tag _tag; \
134
+ _tag.state = TAG_NONE; \
135
+ _tag.tag = Qundef; \
136
+ _tag.prev = _ec->tag;
137
+
138
+ #define EC_POP_TAG() \
139
+ _ec->tag = _tag.prev; \
140
+ } while (0)
141
+
142
+ #define EC_TMPPOP_TAG() \
143
+ _ec->tag = _tag.prev
144
+
145
+ #define EC_REPUSH_TAG() (void)(_ec->tag = &_tag)
146
+
147
+ #if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ >= 6 && __GNUC_MINOR__ <= 8) || __clang__
148
+ /* This macro prevents GCC 4.6--4.8 from emitting maybe-uninitialized warnings.
149
+ * This macro also prevents Clang from dumping core in EC_EXEC_TAG().
150
+ * (I confirmed Clang 4.0.1 and 5.0.0.)
151
+ */
152
+ # define VAR_FROM_MEMORY(var) __extension__(*(__typeof__(var) volatile *)&(var))
153
+ # define VAR_INITIALIZED(var) ((var) = VAR_FROM_MEMORY(var))
154
+ # define VAR_NOCLOBBERED(var) volatile var
155
+ #else
156
+ # define VAR_FROM_MEMORY(var) (var)
157
+ # define VAR_INITIALIZED(var) ((void)&(var))
158
+ # define VAR_NOCLOBBERED(var) var
159
+ #endif
160
+
161
+ #if defined(USE_UNALIGNED_MEMBER_ACCESS) && USE_UNALIGNED_MEMBER_ACCESS && \
162
+ defined(__clang__)
163
+ # define UNALIGNED_MEMBER_ACCESS(expr) __extension__({ \
164
+ _Pragma("GCC diagnostic push"); \
165
+ _Pragma("GCC diagnostic ignored \"-Waddress-of-packed-member\""); \
166
+ typeof(expr) unaligned_member_access_result = (expr); \
167
+ _Pragma("GCC diagnostic pop"); \
168
+ unaligned_member_access_result; \
169
+ })
170
+ #else
171
+ # define UNALIGNED_MEMBER_ACCESS(expr) expr
172
+ #endif
173
+ #define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
174
+
175
+ #undef RB_OBJ_WRITE
176
+ #define RB_OBJ_WRITE(a, slot, b) UNALIGNED_MEMBER_ACCESS(rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__))
177
+
178
+ /* clear ec->tag->state, and return the value */
179
+ static inline int
180
+ rb_ec_tag_state(const rb_execution_context_t *ec)
181
+ {
182
+ enum ruby_tag_type state = ec->tag->state;
183
+ ec->tag->state = TAG_NONE;
184
+ return state;
185
+ }
186
+
187
+ NORETURN(static inline void rb_ec_tag_jump(const rb_execution_context_t *ec, enum ruby_tag_type st));
188
+ static inline void
189
+ rb_ec_tag_jump(const rb_execution_context_t *ec, enum ruby_tag_type st)
190
+ {
191
+ ec->tag->state = st;
192
+ ruby_longjmp(ec->tag->buf, 1);
193
+ }
194
+
195
+ /*
196
+ setjmp() in assignment expression rhs is undefined behavior
197
+ [ISO/IEC 9899:1999] 7.13.1.1
198
+ */
199
+ #define EC_EXEC_TAG() \
200
+ (ruby_setjmp(_tag.buf) ? rb_ec_tag_state(VAR_FROM_MEMORY(_ec)) : (EC_REPUSH_TAG(), 0))
201
+
202
+ #define EC_JUMP_TAG(ec, st) rb_ec_tag_jump(ec, st)
203
+
204
+ #define INTERNAL_EXCEPTION_P(exc) FIXNUM_P(exc)
205
+
206
+ /* CREF operators */
207
+
208
+ #define CREF_FL_PUSHED_BY_EVAL IMEMO_FL_USER1
209
+ #define CREF_FL_OMOD_SHARED IMEMO_FL_USER2
210
+
211
+ static inline VALUE
212
+ CREF_CLASS(const rb_cref_t *cref)
213
+ {
214
+ return cref->klass;
215
+ }
216
+
217
+ static inline rb_cref_t *
218
+ CREF_NEXT(const rb_cref_t *cref)
219
+ {
220
+ return cref->next;
221
+ }
222
+
223
+ static inline const rb_scope_visibility_t *
224
+ CREF_SCOPE_VISI(const rb_cref_t *cref)
225
+ {
226
+ return &cref->scope_visi;
227
+ }
228
+
229
+ static inline VALUE
230
+ CREF_REFINEMENTS(const rb_cref_t *cref)
231
+ {
232
+ return cref->refinements;
233
+ }
234
+
235
+ static inline void
236
+ CREF_REFINEMENTS_SET(rb_cref_t *cref, VALUE refs)
237
+ {
238
+ RB_OBJ_WRITE(cref, &cref->refinements, refs);
239
+ }
240
+
241
+ static inline int
242
+ CREF_PUSHED_BY_EVAL(const rb_cref_t *cref)
243
+ {
244
+ return cref->flags & CREF_FL_PUSHED_BY_EVAL;
245
+ }
246
+
247
+ static inline void
248
+ CREF_PUSHED_BY_EVAL_SET(rb_cref_t *cref)
249
+ {
250
+ cref->flags |= CREF_FL_PUSHED_BY_EVAL;
251
+ }
252
+
253
+ static inline int
254
+ CREF_OMOD_SHARED(const rb_cref_t *cref)
255
+ {
256
+ return cref->flags & CREF_FL_OMOD_SHARED;
257
+ }
258
+
259
+ static inline void
260
+ CREF_OMOD_SHARED_SET(rb_cref_t *cref)
261
+ {
262
+ cref->flags |= CREF_FL_OMOD_SHARED;
263
+ }
264
+
265
+ static inline void
266
+ CREF_OMOD_SHARED_UNSET(rb_cref_t *cref)
267
+ {
268
+ cref->flags &= ~CREF_FL_OMOD_SHARED;
269
+ }
270
+
271
+ void rb_thread_cleanup(void);
272
+ void rb_thread_wait_other_threads(void);
273
+
274
+ enum {
275
+ RAISED_EXCEPTION = 1,
276
+ RAISED_STACKOVERFLOW = 2,
277
+ RAISED_NOMEMORY = 4
278
+ };
279
+ #define rb_ec_raised_set(ec, f) ((ec)->raised_flag |= (f))
280
+ #define rb_ec_raised_reset(ec, f) ((ec)->raised_flag &= ~(f))
281
+ #define rb_ec_raised_p(ec, f) (((ec)->raised_flag & (f)) != 0)
282
+ #define rb_ec_raised_clear(ec) ((ec)->raised_flag = 0)
283
+ int rb_ec_set_raised(rb_execution_context_t *ec);
284
+ int rb_ec_reset_raised(rb_execution_context_t *ec);
285
+ int rb_ec_stack_check(rb_execution_context_t *ec);
286
+
287
+ VALUE rb_f_eval(int argc, const VALUE *argv, VALUE self);
288
+ VALUE rb_make_exception(int argc, const VALUE *argv);
289
+
290
+ NORETURN(void rb_method_name_error(VALUE, VALUE));
291
+
292
+ NORETURN(void rb_fiber_start(void));
293
+
294
+ NORETURN(void rb_print_undef(VALUE, ID, rb_method_visibility_t));
295
+ NORETURN(void rb_print_undef_str(VALUE, VALUE));
296
+ NORETURN(void rb_print_inaccessible(VALUE, ID, rb_method_visibility_t));
297
+ NORETURN(void rb_vm_localjump_error(const char *,VALUE, int));
298
+ #if 0
299
+ NORETURN(void rb_vm_jump_tag_but_local_jump(int));
300
+ #endif
301
+
302
+ VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val);
303
+ rb_cref_t *rb_vm_cref(void);
304
+ rb_cref_t *rb_vm_cref_replace_with_duplicated_cref(void);
305
+ VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, VALUE block_handler, VALUE filename);
306
+ void rb_vm_set_progname(VALUE filename);
307
+ void rb_thread_terminate_all(void);
308
+ VALUE rb_vm_cbase(void);
309
+
310
+ /* vm_backtrace.c */
311
+ VALUE rb_ec_backtrace_object(const rb_execution_context_t *ec);
312
+ VALUE rb_ec_backtrace_str_ary(const rb_execution_context_t *ec, long lev, long n);
313
+
314
+ #ifndef CharNext /* defined as CharNext[AW] on Windows. */
315
+ # ifdef HAVE_MBLEN
316
+ # define CharNext(p) ((p) + mblen((p), RUBY_MBCHAR_MAXSIZE))
317
+ # else
318
+ # define CharNext(p) ((p) + 1)
319
+ # endif
320
+ #endif
321
+
322
+ #if defined DOSISH || defined __CYGWIN__
323
+ static inline void
324
+ translit_char(char *p, int from, int to)
325
+ {
326
+ while (*p) {
327
+ if ((unsigned char)*p == from)
328
+ *p = to;
329
+ p = CharNext(p);
330
+ }
331
+ }
332
+ #endif
333
+
334
+ #endif /* RUBY_EVAL_INTERN_H */
@@ -2,10 +2,10 @@
2
2
  #ifndef RUBY_GC_H
3
3
  #define RUBY_GC_H 1
4
4
 
5
- #if defined(__x86_64__) && defined(__GNUC__)
6
- #define SET_MACHINE_STACK_END(p) __asm__ volatile ("movq\t%%rsp, %0" : "=r" (*(p)))
5
+ #if defined(__x86_64__) && !defined(_ILP32) && defined(__GNUC__)
6
+ #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p)))
7
7
  #elif defined(__i386) && defined(__GNUC__)
8
- #define SET_MACHINE_STACK_END(p) __asm__ volatile ("movl\t%%esp, %0" : "=r" (*(p)))
8
+ #define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movl\t%%esp, %0" : "=r" (*(p)))
9
9
  #else
10
10
  NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
11
11
  #define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p)
@@ -57,7 +57,10 @@ rb_gc_debug_body(const char *mode, const char *msg, int st, void *ptr)
57
57
  #define RUBY_GC_INFO if(0)printf
58
58
  #endif
59
59
 
60
- #define RUBY_MARK_UNLESS_NULL(ptr) if(RTEST(ptr)){rb_gc_mark(ptr);}
60
+ #define RUBY_MARK_UNLESS_NULL(ptr) do { \
61
+ VALUE markobj = (ptr); \
62
+ if (RTEST(markobj)) {rb_gc_mark(markobj);} \
63
+ } while (0)
61
64
  #define RUBY_FREE_UNLESS_NULL(ptr) if(ptr){ruby_xfree(ptr);(ptr)=NULL;}
62
65
 
63
66
  #if STACK_GROW_DIRECTION > 0
@@ -83,17 +86,31 @@ int ruby_get_stack_grow_direction(volatile VALUE *addr);
83
86
  #endif
84
87
  #define IS_STACK_DIR_UPPER() STACK_DIR_UPPER(1,0)
85
88
 
86
- #if defined __GNUC__ && __GNUC__ >= 4
87
- #pragma GCC visibility push(default)
88
- #endif
89
+ const char *rb_obj_info(VALUE obj);
90
+ const char *rb_raw_obj_info(char *buff, const int buff_size, VALUE obj);
91
+ void rb_obj_info_dump(VALUE obj);
92
+
93
+ struct rb_thread_struct;
89
94
 
95
+ RUBY_SYMBOL_EXPORT_BEGIN
96
+
97
+ /* exports for objspace module */
90
98
  size_t rb_objspace_data_type_memsize(VALUE obj);
99
+ void rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *data);
100
+ void rb_objspace_reachable_objects_from_root(void (func)(const char *category, VALUE, void *), void *data);
101
+ int rb_objspace_markable_object_p(VALUE obj);
102
+ int rb_objspace_internal_object_p(VALUE obj);
103
+ int rb_objspace_marked_object_p(VALUE obj);
104
+ int rb_objspace_garbage_object_p(VALUE obj);
105
+
91
106
  void rb_objspace_each_objects(
92
107
  int (*callback)(void *start, void *end, size_t stride, void *data),
93
108
  void *data);
94
109
 
95
- #if defined __GNUC__ && __GNUC__ >= 4
96
- #pragma GCC visibility pop
97
- #endif
110
+ void rb_objspace_each_objects_without_setup(
111
+ int (*callback)(void *, void *, size_t, void *),
112
+ void *data);
113
+
114
+ RUBY_SYMBOL_EXPORT_END
98
115
 
99
116
  #endif /* RUBY_GC_H */