debase-ruby_core_source 3.4.1 → 4.0.0.preview2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/addr2line.h +22 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/builtin.h +125 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ccan/build_assert/build_assert.h +40 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ccan/check_type/check_type.h +63 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ccan/container_of/container_of.h +142 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ccan/list/list.h +791 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ccan/str/str.h +17 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/constant.h +53 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/darray.h +278 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/debug_counter.h +425 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/dln.h +33 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/encindex.h +70 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/eval_intern.h +331 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/hrtime.h +237 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/id.h +354 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/id_table.h +54 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/insns.inc +302 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/insns_info.inc +11241 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/array.h +154 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/basic_operators.h +65 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/bignum.h +245 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/bits.h +650 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/box.h +81 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/class.h +805 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/cmdlineopt.h +64 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/compar.h +29 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/compile.h +34 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/compilers.h +107 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/complex.h +29 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/concurrent_set.h +21 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/cont.h +35 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/dir.h +16 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/enc.h +19 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/encoding.h +39 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/enum.h +18 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/enumerator.h +21 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/error.h +251 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/eval.h +41 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/file.h +38 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/fixnum.h +185 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/gc.h +358 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/hash.h +194 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/imemo.h +322 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/inits.h +51 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/io.h +163 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/load.h +20 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/loadpath.h +16 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/math.h +23 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/missing.h +19 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/numeric.h +275 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/object.h +63 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/parse.h +131 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/proc.h +30 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/process.h +124 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/ractor.h +10 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/random.h +17 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/range.h +40 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/rational.h +71 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/re.h +33 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/ruby_parser.h +102 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/sanitizers.h +346 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/serial.h +23 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/set_table.h +70 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/signal.h +25 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/st.h +11 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/static_assert.h +16 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/string.h +203 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/struct.h +160 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/symbol.h +46 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/thread.h +112 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/time.h +37 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/transcode.h +23 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/util.h +27 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/variable.h +74 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/vm.h +136 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal/warnings.h +16 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/internal.h +105 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/iseq.h +357 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/known_errors.inc +1419 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/method.h +271 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/node.h +122 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/node_name.inc +224 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/optinsn.inc +128 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/optunifs.inc +41 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/parse.h +244 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/parser_bits.h +564 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/parser_node.h +32 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/parser_st.h +162 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/parser_value.h +106 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/ast.h +8233 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/defines.h +260 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/diagnostic.h +458 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/encoding.h +283 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/extension.h +19 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/node.h +129 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/options.h +485 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/pack.h +163 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/parser.h +936 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/prettyprint.h +34 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/prism.h +408 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/regexp.h +43 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/static_literals.h +121 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_buffer.h +236 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_char.h +204 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_constant_pool.h +218 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_integer.h +130 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_list.h +103 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_memchr.h +29 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_newline_list.h +113 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_string.h +200 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_strncasecmp.h +32 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_strpbrk.h +46 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism/version.h +29 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/prism_compile.h +106 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/probes_helper.h +42 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ractor_core.h +306 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/regenc.h +259 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/regint.h +1005 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/regparse.h +371 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/revision.h +5 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ruby_assert.h +14 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/ruby_atomic.h +66 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/rubyparser.h +1394 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/shape.h +444 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/siphash.h +48 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/symbol.h +116 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/thread_none.h +21 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/thread_pthread.h +175 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/thread_win32.h +58 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/timev.h +58 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/transcode_data.h +138 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/variable.h +27 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/version.h +69 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm.inc +6183 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_call_iseq_optimized.inc +244 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_callinfo.h +640 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_core.h +2350 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_debug.h +124 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_exec.h +210 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_insnhelper.h +277 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_opts.h +67 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vm_sync.h +156 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/vmtc.inc +289 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/yjit.h +81 -0
- data/lib/debase/ruby_core_source/ruby-4.0.0-preview2/zjit.h +47 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +148 -3
|
@@ -0,0 +1,175 @@
|
|
|
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
|
+
// TLS can not be accessed across .so on arm64 and perhaps ppc64le too.
|
|
21
|
+
#if defined(__arm64__) || defined(__aarch64__) || defined(__powerpc64__)
|
|
22
|
+
# define RB_THREAD_CURRENT_EC_NOINLINE
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
// this data should be protected by timer_th.waiting_lock
|
|
26
|
+
struct rb_thread_sched_waiting {
|
|
27
|
+
enum thread_sched_waiting_flag {
|
|
28
|
+
thread_sched_waiting_none = 0x00,
|
|
29
|
+
thread_sched_waiting_timeout = 0x01,
|
|
30
|
+
thread_sched_waiting_io_read = 0x02,
|
|
31
|
+
thread_sched_waiting_io_write = 0x08,
|
|
32
|
+
thread_sched_waiting_io_force = 0x40, // ignore readable
|
|
33
|
+
} flags;
|
|
34
|
+
|
|
35
|
+
struct {
|
|
36
|
+
// should be compat with hrtime.h
|
|
37
|
+
#ifdef MY_RUBY_BUILD_MAY_TIME_TRAVEL
|
|
38
|
+
int128_t timeout;
|
|
39
|
+
#else
|
|
40
|
+
uint64_t timeout;
|
|
41
|
+
#endif
|
|
42
|
+
int fd; // -1 for timeout only
|
|
43
|
+
int result;
|
|
44
|
+
} data;
|
|
45
|
+
|
|
46
|
+
// connected to timer_th.waiting
|
|
47
|
+
struct ccan_list_node node;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// per-Thead scheduler helper data
|
|
51
|
+
struct rb_thread_sched_item {
|
|
52
|
+
struct {
|
|
53
|
+
struct ccan_list_node ubf;
|
|
54
|
+
|
|
55
|
+
// connected to ractor->threads.sched.reqdyq
|
|
56
|
+
// locked by ractor->threads.sched.lock
|
|
57
|
+
struct ccan_list_node readyq;
|
|
58
|
+
|
|
59
|
+
// connected to vm->ractor.sched.timeslice_threads
|
|
60
|
+
// locked by vm->ractor.sched.lock
|
|
61
|
+
struct ccan_list_node timeslice_threads;
|
|
62
|
+
|
|
63
|
+
// connected to vm->ractor.sched.running_threads
|
|
64
|
+
// locked by vm->ractor.sched.lock
|
|
65
|
+
struct ccan_list_node running_threads;
|
|
66
|
+
|
|
67
|
+
// connected to vm->ractor.sched.zombie_threads
|
|
68
|
+
struct ccan_list_node zombie_threads;
|
|
69
|
+
} node;
|
|
70
|
+
|
|
71
|
+
struct rb_thread_sched_waiting waiting_reason;
|
|
72
|
+
|
|
73
|
+
bool finished;
|
|
74
|
+
bool malloc_stack;
|
|
75
|
+
void *context_stack;
|
|
76
|
+
struct coroutine_context *context;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
struct rb_native_thread {
|
|
80
|
+
rb_atomic_t serial;
|
|
81
|
+
struct rb_vm_struct *vm;
|
|
82
|
+
|
|
83
|
+
rb_nativethread_id_t thread_id;
|
|
84
|
+
|
|
85
|
+
#ifdef RB_THREAD_T_HAS_NATIVE_ID
|
|
86
|
+
int tid;
|
|
87
|
+
#endif
|
|
88
|
+
|
|
89
|
+
struct rb_thread_struct *running_thread;
|
|
90
|
+
|
|
91
|
+
// to control native thread
|
|
92
|
+
#if defined(__GLIBC__) || defined(__FreeBSD__)
|
|
93
|
+
union
|
|
94
|
+
#else
|
|
95
|
+
/*
|
|
96
|
+
* assume the platform condvars are badly implemented and have a
|
|
97
|
+
* "memory" of which mutex they're associated with
|
|
98
|
+
*/
|
|
99
|
+
struct
|
|
100
|
+
#endif
|
|
101
|
+
{
|
|
102
|
+
rb_nativethread_cond_t intr; /* th->interrupt_lock */
|
|
103
|
+
rb_nativethread_cond_t readyq; /* use sched->lock */
|
|
104
|
+
} cond;
|
|
105
|
+
|
|
106
|
+
#ifdef USE_SIGALTSTACK
|
|
107
|
+
void *altstack;
|
|
108
|
+
#endif
|
|
109
|
+
|
|
110
|
+
struct coroutine_context *nt_context;
|
|
111
|
+
int dedicated;
|
|
112
|
+
|
|
113
|
+
size_t machine_stack_maxsize;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
#undef except
|
|
117
|
+
#undef try
|
|
118
|
+
#undef leave
|
|
119
|
+
#undef finally
|
|
120
|
+
|
|
121
|
+
// per-Ractor
|
|
122
|
+
struct rb_thread_sched {
|
|
123
|
+
rb_nativethread_lock_t lock_;
|
|
124
|
+
#if VM_CHECK_MODE
|
|
125
|
+
struct rb_thread_struct *lock_owner;
|
|
126
|
+
#endif
|
|
127
|
+
struct rb_thread_struct *running; // running thread or NULL
|
|
128
|
+
bool is_running;
|
|
129
|
+
bool is_running_timeslice;
|
|
130
|
+
bool enable_mn_threads;
|
|
131
|
+
|
|
132
|
+
struct ccan_list_head readyq;
|
|
133
|
+
int readyq_cnt;
|
|
134
|
+
// ractor scheduling
|
|
135
|
+
struct ccan_list_node grq_node;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
#ifdef RB_THREAD_LOCAL_SPECIFIER
|
|
139
|
+
NOINLINE(void rb_current_ec_set(struct rb_execution_context_struct *));
|
|
140
|
+
|
|
141
|
+
# ifdef RB_THREAD_CURRENT_EC_NOINLINE
|
|
142
|
+
NOINLINE(struct rb_execution_context_struct *rb_current_ec(void));
|
|
143
|
+
# else
|
|
144
|
+
RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER struct rb_execution_context_struct *ruby_current_ec;
|
|
145
|
+
|
|
146
|
+
// for RUBY_DEBUG_LOG()
|
|
147
|
+
RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER rb_atomic_t ruby_nt_serial;
|
|
148
|
+
#define RUBY_NT_SERIAL 1
|
|
149
|
+
# endif
|
|
150
|
+
#else
|
|
151
|
+
typedef pthread_key_t native_tls_key_t;
|
|
152
|
+
|
|
153
|
+
static inline void *
|
|
154
|
+
native_tls_get(native_tls_key_t key)
|
|
155
|
+
{
|
|
156
|
+
// return value should be checked by caller
|
|
157
|
+
return pthread_getspecific(key);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
static inline void
|
|
161
|
+
native_tls_set(native_tls_key_t key, void *ptr)
|
|
162
|
+
{
|
|
163
|
+
if (UNLIKELY(pthread_setspecific(key, ptr) != 0)) {
|
|
164
|
+
rb_bug("pthread_setspecific error");
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
RUBY_EXTERN native_tls_key_t ruby_current_ec_key;
|
|
169
|
+
#endif
|
|
170
|
+
|
|
171
|
+
struct rb_ractor_struct;
|
|
172
|
+
void rb_ractor_sched_wait(struct rb_execution_context_struct *ec, struct rb_ractor_struct *cr, rb_unblock_function_t *ubf, void *ptr);
|
|
173
|
+
void rb_ractor_sched_wakeup(struct rb_ractor_struct *r, struct rb_thread_struct *th);
|
|
174
|
+
|
|
175
|
+
#endif /* RUBY_THREAD_PTHREAD_H */
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
#define USE_VM_CLOCK 1
|
|
20
|
+
|
|
21
|
+
WINBASEAPI BOOL WINAPI
|
|
22
|
+
TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
|
|
23
|
+
|
|
24
|
+
struct rb_native_thread {
|
|
25
|
+
HANDLE thread_id;
|
|
26
|
+
HANDLE interrupt_event;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
struct rb_thread_sched_item {
|
|
30
|
+
void *vm_stack;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
struct rb_thread_sched {
|
|
34
|
+
HANDLE lock;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
typedef DWORD native_tls_key_t; // TLS index
|
|
38
|
+
|
|
39
|
+
static inline void *
|
|
40
|
+
native_tls_get(native_tls_key_t key)
|
|
41
|
+
{
|
|
42
|
+
// return value should be checked by caller.
|
|
43
|
+
return TlsGetValue(key);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static inline void
|
|
47
|
+
native_tls_set(native_tls_key_t key, void *ptr)
|
|
48
|
+
{
|
|
49
|
+
if (UNLIKELY(TlsSetValue(key, ptr) == 0)) {
|
|
50
|
+
rb_bug("TlsSetValue() error");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
|
55
|
+
RUBY_EXTERN native_tls_key_t ruby_current_ec_key;
|
|
56
|
+
RUBY_SYMBOL_EXPORT_END
|
|
57
|
+
|
|
58
|
+
#endif /* RUBY_THREAD_WIN32_H */
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#ifndef RUBY_TIMEV_H
|
|
2
|
+
#define RUBY_TIMEV_H
|
|
3
|
+
#include "ruby/ruby.h"
|
|
4
|
+
|
|
5
|
+
struct vtm {
|
|
6
|
+
VALUE year; /* 2000 for example. Integer. */
|
|
7
|
+
VALUE subsecx; /* 0 <= subsecx < TIME_SCALE. possibly Rational. */
|
|
8
|
+
VALUE utc_offset; /* -3600 as -01:00 for example. possibly Rational. */
|
|
9
|
+
VALUE zone; /* "JST", "EST", "EDT", etc. as String */
|
|
10
|
+
unsigned int yday:9; /* 1..366 */
|
|
11
|
+
unsigned int mon:4; /* 1..12 */
|
|
12
|
+
unsigned int mday:5; /* 1..31 */
|
|
13
|
+
unsigned int hour:5; /* 0..23 */
|
|
14
|
+
unsigned int min:6; /* 0..59 */
|
|
15
|
+
unsigned int sec:6; /* 0..60 */
|
|
16
|
+
unsigned int wday:3; /* 0:Sunday, 1:Monday, ..., 6:Saturday 7:init */
|
|
17
|
+
unsigned int isdst:2; /* 0:StandardTime 1:DayLightSavingTime 3:init */
|
|
18
|
+
|
|
19
|
+
/* Flags for struct time_object */
|
|
20
|
+
unsigned int tzmode:3; /* 0:localtime 1:utc 2:fixoff 3:uninitialized */
|
|
21
|
+
unsigned int tm_got:1;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
#define TIME_SCALE 1000000000
|
|
25
|
+
|
|
26
|
+
#ifndef TYPEOF_TIMEVAL_TV_SEC
|
|
27
|
+
# define TYPEOF_TIMEVAL_TV_SEC time_t
|
|
28
|
+
#endif
|
|
29
|
+
#ifndef TYPEOF_TIMEVAL_TV_USEC
|
|
30
|
+
# if INT_MAX >= 1000000
|
|
31
|
+
# define TYPEOF_TIMEVAL_TV_USEC int
|
|
32
|
+
# else
|
|
33
|
+
# define TYPEOF_TIMEVAL_TV_USEC long
|
|
34
|
+
# endif
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
#if SIZEOF_TIME_T == SIZEOF_LONG
|
|
38
|
+
typedef unsigned long unsigned_time_t;
|
|
39
|
+
#elif SIZEOF_TIME_T == SIZEOF_INT
|
|
40
|
+
typedef unsigned int unsigned_time_t;
|
|
41
|
+
#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
|
|
42
|
+
typedef unsigned LONG_LONG unsigned_time_t;
|
|
43
|
+
#else
|
|
44
|
+
# error cannot find integer type which size is same as time_t.
|
|
45
|
+
#endif
|
|
46
|
+
|
|
47
|
+
/* strftime.c */
|
|
48
|
+
#ifdef RUBY_ENCODING_H
|
|
49
|
+
VALUE rb_strftime_timespec(const char *format, size_t format_len, rb_encoding *enc,
|
|
50
|
+
VALUE time, const struct vtm *vtm, struct timespec *ts, int gmt);
|
|
51
|
+
VALUE rb_strftime(const char *format, size_t format_len, rb_encoding *enc,
|
|
52
|
+
VALUE time, const struct vtm *vtm, VALUE timev, int gmt);
|
|
53
|
+
#endif
|
|
54
|
+
|
|
55
|
+
/* time.c */
|
|
56
|
+
VALUE rb_time_zone_abbreviation(VALUE zone, VALUE time);
|
|
57
|
+
|
|
58
|
+
#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 */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#ifndef RUBY_TOPLEVEL_VARIABLE_H /*-*-C-*-vi:se ft=c:*/
|
|
2
|
+
#define RUBY_TOPLEVEL_VARIABLE_H
|
|
3
|
+
/**
|
|
4
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
|
5
|
+
* @copyright This file is a part of the programming language Ruby.
|
|
6
|
+
* Permission is hereby granted, to either redistribute and/or
|
|
7
|
+
* modify this file, provided that the conditions mentioned in the
|
|
8
|
+
* file COPYING are met. Consult the file for details.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/* per-object */
|
|
12
|
+
|
|
13
|
+
#include "shape.h"
|
|
14
|
+
|
|
15
|
+
void rb_copy_complex_ivars(VALUE dest, VALUE obj, shape_id_t src_shape_id, st_table *fields_table);
|
|
16
|
+
VALUE rb_obj_fields(VALUE obj, ID field_name);
|
|
17
|
+
|
|
18
|
+
static inline VALUE
|
|
19
|
+
rb_obj_fields_no_ractor_check(VALUE obj)
|
|
20
|
+
{
|
|
21
|
+
return rb_obj_fields(obj, 0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
void rb_free_rb_global_tbl(void);
|
|
25
|
+
void rb_free_generic_fields_tbl_(void);
|
|
26
|
+
|
|
27
|
+
#endif /* RUBY_TOPLEVEL_VARIABLE_H */
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#ifndef RUBY_TOPLEVEL_VERSION_H /*-*-C-*-vi:se ft=c:*/
|
|
2
|
+
#define RUBY_TOPLEVEL_VERSION_H
|
|
3
|
+
/**
|
|
4
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
|
5
|
+
* @copyright This file is a part of the programming language Ruby.
|
|
6
|
+
* Permission is hereby granted, to either redistribute and/or
|
|
7
|
+
* modify this file, provided that the conditions mentioned in the
|
|
8
|
+
* file COPYING are met. Consult the file for details.
|
|
9
|
+
*/
|
|
10
|
+
# define RUBY_VERSION_MAJOR RUBY_API_VERSION_MAJOR
|
|
11
|
+
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
|
12
|
+
#define RUBY_VERSION_TEENY 0
|
|
13
|
+
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
|
14
|
+
#define RUBY_PATCHLEVEL -1
|
|
15
|
+
|
|
16
|
+
#include "ruby/version.h"
|
|
17
|
+
#include "ruby/internal/abi.h"
|
|
18
|
+
|
|
19
|
+
#ifndef RUBY_REVISION
|
|
20
|
+
#include "revision.h"
|
|
21
|
+
|
|
22
|
+
#ifndef TOKEN_PASTE
|
|
23
|
+
#define TOKEN_PASTE(x,y) x##y
|
|
24
|
+
#endif
|
|
25
|
+
#define ONLY_ONE_DIGIT(x) TOKEN_PASTE(10,x) < 1000
|
|
26
|
+
#define WITH_ZERO_PADDING(x) TOKEN_PASTE(0,x)
|
|
27
|
+
#define RUBY_BIRTH_YEAR_STR STRINGIZE(RUBY_BIRTH_YEAR)
|
|
28
|
+
#define RUBY_RELEASE_YEAR_STR STRINGIZE(RUBY_RELEASE_YEAR)
|
|
29
|
+
#if ONLY_ONE_DIGIT(RUBY_RELEASE_MONTH)
|
|
30
|
+
#define RUBY_RELEASE_MONTH_STR STRINGIZE(WITH_ZERO_PADDING(RUBY_RELEASE_MONTH))
|
|
31
|
+
#else
|
|
32
|
+
#define RUBY_RELEASE_MONTH_STR STRINGIZE(RUBY_RELEASE_MONTH)
|
|
33
|
+
#endif
|
|
34
|
+
#if ONLY_ONE_DIGIT(RUBY_RELEASE_DAY)
|
|
35
|
+
#define RUBY_RELEASE_DAY_STR STRINGIZE(WITH_ZERO_PADDING(RUBY_RELEASE_DAY))
|
|
36
|
+
#else
|
|
37
|
+
#define RUBY_RELEASE_DAY_STR STRINGIZE(RUBY_RELEASE_DAY)
|
|
38
|
+
#endif
|
|
39
|
+
|
|
40
|
+
#endif
|
|
41
|
+
|
|
42
|
+
#ifdef RUBY_ABI_VERSION
|
|
43
|
+
# define RUBY_ABI_VERSION_SUFFIX "+"STRINGIZE(RUBY_ABI_VERSION)
|
|
44
|
+
#else
|
|
45
|
+
# define RUBY_ABI_VERSION_SUFFIX ""
|
|
46
|
+
#endif
|
|
47
|
+
#if !defined RUBY_LIB_VERSION && defined RUBY_LIB_VERSION_STYLE
|
|
48
|
+
# if RUBY_LIB_VERSION_STYLE == 3
|
|
49
|
+
# define RUBY_LIB_VERSION STRINGIZE(RUBY_API_VERSION_MAJOR)"."STRINGIZE(RUBY_API_VERSION_MINOR) \
|
|
50
|
+
"."STRINGIZE(RUBY_API_VERSION_TEENY) RUBY_ABI_VERSION_SUFFIX
|
|
51
|
+
# elif RUBY_LIB_VERSION_STYLE == 2
|
|
52
|
+
# define RUBY_LIB_VERSION STRINGIZE(RUBY_API_VERSION_MAJOR)"."STRINGIZE(RUBY_API_VERSION_MINOR) \
|
|
53
|
+
RUBY_ABI_VERSION_SUFFIX
|
|
54
|
+
# endif
|
|
55
|
+
#endif
|
|
56
|
+
|
|
57
|
+
#if RUBY_PATCHLEVEL == -1
|
|
58
|
+
# ifdef RUBY_PATCHLEVEL_NAME
|
|
59
|
+
# define RUBY_PATCHLEVEL_STR STRINGIZE(RUBY_PATCHLEVEL_NAME)
|
|
60
|
+
# else
|
|
61
|
+
# define RUBY_PATCHLEVEL_STR "preview2"
|
|
62
|
+
# endif
|
|
63
|
+
#elif defined RUBY_ABI_VERSION
|
|
64
|
+
# error RUBY_ABI_VERSION is defined in non-development branch
|
|
65
|
+
#else
|
|
66
|
+
# define RUBY_PATCHLEVEL_STR ""
|
|
67
|
+
#endif
|
|
68
|
+
|
|
69
|
+
#endif /* RUBY_TOPLEVEL_VERSION_H */
|