debase-ruby_core_source 0.10.12 → 0.10.13
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/lib/debase/ruby_core_source/ruby-3.1.0-preview1/addr2line.h +20 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/builtin.h +83 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/ccan/build_assert/build_assert.h +40 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/ccan/check_type/check_type.h +63 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/ccan/container_of/container_of.h +142 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/ccan/list/list.h +788 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/ccan/str/str.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/constant.h +55 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/darray.h +198 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/debug_counter.h +467 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/dln.h +31 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/encindex.h +70 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/eval_intern.h +304 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/gc.h +142 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/hrtime.h +168 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/id.h +293 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/id_table.h +36 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/insns.inc +247 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/insns_info.inc +8978 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/array.h +113 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/bignum.h +246 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/bits.h +565 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/class.h +188 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/compar.h +49 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/compile.h +35 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/compilers.h +107 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/complex.h +29 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/cont.h +24 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/dir.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/enc.h +19 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/encoding.h +30 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/enum.h +18 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/enumerator.h +21 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/error.h +191 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/eval.h +32 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/file.h +38 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/fixnum.h +184 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/gc.h +175 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/hash.h +243 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/imemo.h +243 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/inits.h +50 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/io.h +38 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/load.h +18 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/loadpath.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/math.h +23 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/missing.h +18 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/numeric.h +271 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/object.h +83 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/parse.h +23 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/proc.h +32 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/process.h +137 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/random.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/range.h +40 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/rational.h +72 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/re.h +30 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/sanitizers.h +190 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/serial.h +23 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/signal.h +21 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/static_assert.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/string.h +141 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/struct.h +153 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/symbol.h +40 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/thread.h +53 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/time.h +34 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/transcode.h +20 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/util.h +27 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/variable.h +83 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/vm.h +132 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal/warnings.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/internal.h +109 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/iseq.h +320 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/known_errors.inc +791 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/method.h +245 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/mjit.h +231 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/mjit_compile.inc +8265 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/node.h +499 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/node_name.inc +210 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/opt_sc.inc +107 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/optinsn.inc +128 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/optunifs.inc +43 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/parse.h +214 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/probes_helper.h +44 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/ractor_core.h +346 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/regenc.h +254 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/regint.h +942 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/regparse.h +370 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/revision.h +2 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/ruby_assert.h +14 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/ruby_atomic.h +23 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/siphash.h +48 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/symbol.h +119 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/thread_pthread.h +115 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/thread_win32.h +61 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/timev.h +57 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/transcode_data.h +138 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/transient_heap.h +65 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/variable.h +21 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/version.h +88 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm.inc +5415 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_call_iseq_optimized.inc +244 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_callinfo.h +454 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_core.h +2103 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_debug.h +119 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_exec.h +197 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_insnhelper.h +265 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_opts.h +73 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vm_sync.h +137 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/vmtc.inc +241 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit.h +63 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit_asm.h +392 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit_codegen.h +19 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit_core.h +302 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/yjit_iface.h +38 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +116 -3
@@ -0,0 +1,188 @@
|
|
1
|
+
#ifndef INTERNAL_CLASS_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_CLASS_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
|
+
* @brief Internal header for Class.
|
10
|
+
*/
|
11
|
+
#include "id_table.h" /* for struct rb_id_table */
|
12
|
+
#include "internal/gc.h" /* for RB_OBJ_WRITE */
|
13
|
+
#include "internal/serial.h" /* for rb_serial_t */
|
14
|
+
#include "ruby/internal/stdbool.h" /* for bool */
|
15
|
+
#include "ruby/intern.h" /* for rb_alloc_func_t */
|
16
|
+
#include "ruby/ruby.h" /* for struct RBasic */
|
17
|
+
|
18
|
+
#ifdef RCLASS_SUPER
|
19
|
+
# undef RCLASS_SUPER
|
20
|
+
#endif
|
21
|
+
|
22
|
+
struct rb_subclass_entry {
|
23
|
+
VALUE klass;
|
24
|
+
struct rb_subclass_entry *next;
|
25
|
+
};
|
26
|
+
|
27
|
+
struct rb_iv_index_tbl_entry {
|
28
|
+
uint32_t index;
|
29
|
+
rb_serial_t class_serial;
|
30
|
+
VALUE class_value;
|
31
|
+
};
|
32
|
+
|
33
|
+
struct rb_cvar_class_tbl_entry {
|
34
|
+
uint32_t index;
|
35
|
+
rb_serial_t global_cvar_state;
|
36
|
+
VALUE class_value;
|
37
|
+
};
|
38
|
+
|
39
|
+
struct rb_classext_struct {
|
40
|
+
struct st_table *iv_index_tbl; // ID -> struct rb_iv_index_tbl_entry
|
41
|
+
struct st_table *iv_tbl;
|
42
|
+
#if SIZEOF_SERIAL_T == SIZEOF_VALUE /* otherwise m_tbl is in struct RClass */
|
43
|
+
struct rb_id_table *m_tbl;
|
44
|
+
#endif
|
45
|
+
struct rb_id_table *const_tbl;
|
46
|
+
struct rb_id_table *callable_m_tbl;
|
47
|
+
struct rb_id_table *cc_tbl; /* ID -> [[ci, cc1], cc2, ...] */
|
48
|
+
struct rb_id_table *cvc_tbl;
|
49
|
+
struct rb_subclass_entry *subclasses;
|
50
|
+
struct rb_subclass_entry **parent_subclasses;
|
51
|
+
/**
|
52
|
+
* In the case that this is an `ICLASS`, `module_subclasses` points to the link
|
53
|
+
* in the module's `subclasses` list that indicates that the klass has been
|
54
|
+
* included. Hopefully that makes sense.
|
55
|
+
*/
|
56
|
+
struct rb_subclass_entry **module_subclasses;
|
57
|
+
#if SIZEOF_SERIAL_T != SIZEOF_VALUE /* otherwise class_serial is in struct RClass */
|
58
|
+
rb_serial_t class_serial;
|
59
|
+
#endif
|
60
|
+
const VALUE origin_;
|
61
|
+
const VALUE refined_class;
|
62
|
+
rb_alloc_func_t allocator;
|
63
|
+
const VALUE includer;
|
64
|
+
};
|
65
|
+
|
66
|
+
struct RClass {
|
67
|
+
struct RBasic basic;
|
68
|
+
VALUE super;
|
69
|
+
struct rb_classext_struct *ptr;
|
70
|
+
#if SIZEOF_SERIAL_T == SIZEOF_VALUE
|
71
|
+
/* Class serial is as wide as VALUE. Place it here. */
|
72
|
+
rb_serial_t class_serial;
|
73
|
+
#else
|
74
|
+
/* Class serial does not fit into struct RClass. Place m_tbl instead. */
|
75
|
+
struct rb_id_table *m_tbl;
|
76
|
+
#endif
|
77
|
+
};
|
78
|
+
|
79
|
+
typedef struct rb_subclass_entry rb_subclass_entry_t;
|
80
|
+
typedef struct rb_classext_struct rb_classext_t;
|
81
|
+
|
82
|
+
#define RCLASS_EXT(c) (RCLASS(c)->ptr)
|
83
|
+
#define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl)
|
84
|
+
#define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl)
|
85
|
+
#if SIZEOF_SERIAL_T == SIZEOF_VALUE
|
86
|
+
# define RCLASS_M_TBL(c) (RCLASS_EXT(c)->m_tbl)
|
87
|
+
#else
|
88
|
+
# define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
|
89
|
+
#endif
|
90
|
+
#define RCLASS_CALLABLE_M_TBL(c) (RCLASS_EXT(c)->callable_m_tbl)
|
91
|
+
#define RCLASS_CC_TBL(c) (RCLASS_EXT(c)->cc_tbl)
|
92
|
+
#define RCLASS_CVC_TBL(c) (RCLASS_EXT(c)->cvc_tbl)
|
93
|
+
#define RCLASS_IV_INDEX_TBL(c) (RCLASS_EXT(c)->iv_index_tbl)
|
94
|
+
#define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin_)
|
95
|
+
#define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class)
|
96
|
+
#if SIZEOF_SERIAL_T == SIZEOF_VALUE
|
97
|
+
# define RCLASS_SERIAL(c) (RCLASS(c)->class_serial)
|
98
|
+
#else
|
99
|
+
# define RCLASS_SERIAL(c) (RCLASS_EXT(c)->class_serial)
|
100
|
+
#endif
|
101
|
+
#define RCLASS_INCLUDER(c) (RCLASS_EXT(c)->includer)
|
102
|
+
#define RCLASS_PARENT_SUBCLASSES(c) (RCLASS_EXT(c)->parent_subclasses)
|
103
|
+
#define RCLASS_MODULE_SUBCLASSES(c) (RCLASS_EXT(c)->module_subclasses)
|
104
|
+
#define RCLASS_ALLOCATOR(c) (RCLASS_EXT(c)->allocator)
|
105
|
+
#define RCLASS_SUBCLASSES(c) (RCLASS_EXT(c)->subclasses)
|
106
|
+
|
107
|
+
#define RICLASS_IS_ORIGIN FL_USER5
|
108
|
+
#define RCLASS_CLONED FL_USER6
|
109
|
+
#define RICLASS_ORIGIN_SHARED_MTBL FL_USER8
|
110
|
+
|
111
|
+
/* class.c */
|
112
|
+
void rb_class_subclass_add(VALUE super, VALUE klass);
|
113
|
+
void rb_class_remove_from_super_subclasses(VALUE);
|
114
|
+
int rb_singleton_class_internal_p(VALUE sklass);
|
115
|
+
VALUE rb_class_boot(VALUE);
|
116
|
+
VALUE rb_class_s_alloc(VALUE klass);
|
117
|
+
VALUE rb_module_s_alloc(VALUE klass);
|
118
|
+
void rb_module_set_initialized(VALUE module);
|
119
|
+
void rb_module_check_initializable(VALUE module);
|
120
|
+
VALUE rb_make_metaclass(VALUE, VALUE);
|
121
|
+
VALUE rb_include_class_new(VALUE, VALUE);
|
122
|
+
void rb_class_foreach_subclass(VALUE klass, void (*f)(VALUE, VALUE), VALUE);
|
123
|
+
void rb_class_detach_subclasses(VALUE);
|
124
|
+
void rb_class_detach_module_subclasses(VALUE);
|
125
|
+
void rb_class_remove_from_module_subclasses(VALUE);
|
126
|
+
VALUE rb_obj_methods(int argc, const VALUE *argv, VALUE obj);
|
127
|
+
VALUE rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj);
|
128
|
+
VALUE rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj);
|
129
|
+
VALUE rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj);
|
130
|
+
VALUE rb_special_singleton_class(VALUE);
|
131
|
+
VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach);
|
132
|
+
VALUE rb_singleton_class_get(VALUE obj);
|
133
|
+
void rb_undef_methods_from(VALUE klass, VALUE super);
|
134
|
+
|
135
|
+
static inline void RCLASS_SET_ORIGIN(VALUE klass, VALUE origin);
|
136
|
+
static inline void RICLASS_SET_ORIGIN_SHARED_MTBL(VALUE iclass);
|
137
|
+
static inline VALUE RCLASS_SUPER(VALUE klass);
|
138
|
+
static inline VALUE RCLASS_SET_SUPER(VALUE klass, VALUE super);
|
139
|
+
static inline void RCLASS_SET_INCLUDER(VALUE iclass, VALUE klass);
|
140
|
+
|
141
|
+
MJIT_SYMBOL_EXPORT_BEGIN
|
142
|
+
VALUE rb_class_inherited(VALUE, VALUE);
|
143
|
+
VALUE rb_keyword_error_new(const char *, VALUE);
|
144
|
+
MJIT_SYMBOL_EXPORT_END
|
145
|
+
|
146
|
+
static inline void
|
147
|
+
RCLASS_SET_ORIGIN(VALUE klass, VALUE origin)
|
148
|
+
{
|
149
|
+
RB_OBJ_WRITE(klass, &RCLASS_ORIGIN(klass), origin);
|
150
|
+
if (klass != origin) FL_SET(origin, RICLASS_IS_ORIGIN);
|
151
|
+
}
|
152
|
+
|
153
|
+
static inline void
|
154
|
+
RICLASS_SET_ORIGIN_SHARED_MTBL(VALUE iclass)
|
155
|
+
{
|
156
|
+
FL_SET(iclass, RICLASS_ORIGIN_SHARED_MTBL);
|
157
|
+
}
|
158
|
+
|
159
|
+
static inline bool
|
160
|
+
RICLASS_OWNS_M_TBL_P(VALUE iclass)
|
161
|
+
{
|
162
|
+
return FL_TEST_RAW(iclass, RICLASS_IS_ORIGIN | RICLASS_ORIGIN_SHARED_MTBL) == RICLASS_IS_ORIGIN;
|
163
|
+
}
|
164
|
+
|
165
|
+
static inline void
|
166
|
+
RCLASS_SET_INCLUDER(VALUE iclass, VALUE klass)
|
167
|
+
{
|
168
|
+
RB_OBJ_WRITE(iclass, &RCLASS_INCLUDER(iclass), klass);
|
169
|
+
}
|
170
|
+
|
171
|
+
static inline VALUE
|
172
|
+
RCLASS_SUPER(VALUE klass)
|
173
|
+
{
|
174
|
+
return RCLASS(klass)->super;
|
175
|
+
}
|
176
|
+
|
177
|
+
static inline VALUE
|
178
|
+
RCLASS_SET_SUPER(VALUE klass, VALUE super)
|
179
|
+
{
|
180
|
+
if (super) {
|
181
|
+
rb_class_remove_from_super_subclasses(klass);
|
182
|
+
rb_class_subclass_add(super, klass);
|
183
|
+
}
|
184
|
+
RB_OBJ_WRITE(klass, &RCLASS(klass)->super, super);
|
185
|
+
return super;
|
186
|
+
}
|
187
|
+
|
188
|
+
#endif /* INTERNAL_CLASS_H */
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#ifndef INTERNAL_COMPAR_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_COMPAR_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
|
+
* @brief Internal header for Comparable.
|
10
|
+
*/
|
11
|
+
#include "internal/vm.h" /* for rb_method_basic_definition_p */
|
12
|
+
|
13
|
+
#define STRING_P(s) (RB_TYPE_P((s), T_STRING) && CLASS_OF(s) == rb_cString)
|
14
|
+
|
15
|
+
enum {
|
16
|
+
cmp_opt_Integer,
|
17
|
+
cmp_opt_String,
|
18
|
+
cmp_opt_Float,
|
19
|
+
cmp_optimizable_count
|
20
|
+
};
|
21
|
+
|
22
|
+
struct cmp_opt_data {
|
23
|
+
unsigned int opt_methods;
|
24
|
+
unsigned int opt_inited;
|
25
|
+
};
|
26
|
+
|
27
|
+
#define NEW_CMP_OPT_MEMO(type, value) \
|
28
|
+
NEW_PARTIAL_MEMO_FOR(type, value, cmp_opt)
|
29
|
+
#define CMP_OPTIMIZABLE_BIT(type) (1U << TOKEN_PASTE(cmp_opt_,type))
|
30
|
+
#define CMP_OPTIMIZABLE(data, type) \
|
31
|
+
(((data).opt_inited & CMP_OPTIMIZABLE_BIT(type)) ? \
|
32
|
+
((data).opt_methods & CMP_OPTIMIZABLE_BIT(type)) : \
|
33
|
+
(((data).opt_inited |= CMP_OPTIMIZABLE_BIT(type)), \
|
34
|
+
rb_method_basic_definition_p(TOKEN_PASTE(rb_c,type), id_cmp) && \
|
35
|
+
((data).opt_methods |= CMP_OPTIMIZABLE_BIT(type))))
|
36
|
+
|
37
|
+
#define OPTIMIZED_CMP(a, b, data) \
|
38
|
+
((FIXNUM_P(a) && FIXNUM_P(b) && CMP_OPTIMIZABLE(data, Integer)) ? \
|
39
|
+
(((long)a > (long)b) ? 1 : ((long)a < (long)b) ? -1 : 0) : \
|
40
|
+
(STRING_P(a) && STRING_P(b) && CMP_OPTIMIZABLE(data, String)) ? \
|
41
|
+
rb_str_cmp(a, b) : \
|
42
|
+
(RB_FLOAT_TYPE_P(a) && RB_FLOAT_TYPE_P(b) && CMP_OPTIMIZABLE(data, Float)) ? \
|
43
|
+
rb_float_cmp(a, b) : \
|
44
|
+
rb_cmpint(rb_funcallv(a, id_cmp, 1, &b), a, b))
|
45
|
+
|
46
|
+
/* compar.c */
|
47
|
+
VALUE rb_invcmp(VALUE, VALUE);
|
48
|
+
|
49
|
+
#endif /* INTERNAL_COMPAR_H */
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#ifndef INTERNAL_COMPILE_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_COMPILE_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
|
+
* @brief Internal header for the compiler.
|
10
|
+
*/
|
11
|
+
#include "ruby/internal/config.h"
|
12
|
+
#include <stddef.h> /* for size_t */
|
13
|
+
#include "ruby/ruby.h" /* for rb_event_flag_t */
|
14
|
+
|
15
|
+
struct rb_iseq_struct; /* in vm_core.h */
|
16
|
+
|
17
|
+
/* compile.c */
|
18
|
+
int rb_dvar_defined(ID, const struct rb_iseq_struct *);
|
19
|
+
int rb_local_defined(ID, const struct rb_iseq_struct *);
|
20
|
+
const char *rb_insns_name(int i);
|
21
|
+
VALUE rb_insns_name_array(void);
|
22
|
+
int rb_iseq_cdhash_cmp(VALUE val, VALUE lit);
|
23
|
+
st_index_t rb_iseq_cdhash_hash(VALUE a);
|
24
|
+
|
25
|
+
/* iseq.c */
|
26
|
+
int rb_vm_insn_addr2insn(const void *);
|
27
|
+
int rb_vm_insn_decode(const VALUE encoded);
|
28
|
+
extern bool ruby_vm_keep_script_lines;
|
29
|
+
|
30
|
+
MJIT_SYMBOL_EXPORT_BEGIN
|
31
|
+
/* iseq.c (export) */
|
32
|
+
rb_event_flag_t rb_iseq_event_flags(const struct rb_iseq_struct *iseq, size_t pos);
|
33
|
+
MJIT_SYMBOL_EXPORT_END
|
34
|
+
|
35
|
+
#endif /* INTERNAL_COMPILE_H */
|
@@ -0,0 +1,107 @@
|
|
1
|
+
#ifndef INTERNAL_COMPILERS_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_COMPILERS_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
|
+
* @brief Internal header absorbing C compiler differences.
|
10
|
+
*/
|
11
|
+
#include "ruby/internal/compiler_since.h"
|
12
|
+
#include "ruby/internal/has/attribute.h"
|
13
|
+
#include "ruby/internal/has/builtin.h"
|
14
|
+
#include "ruby/internal/has/c_attribute.h"
|
15
|
+
#include "ruby/internal/has/declspec_attribute.h"
|
16
|
+
#include "ruby/internal/has/extension.h"
|
17
|
+
#include "ruby/internal/has/feature.h"
|
18
|
+
#include "ruby/internal/has/warning.h"
|
19
|
+
#include "ruby/backward/2/gcc_version_since.h"
|
20
|
+
|
21
|
+
#define MSC_VERSION_SINCE(_) RBIMPL_COMPILER_SINCE(MSVC, (_) / 100, (_) % 100, 0)
|
22
|
+
#define MSC_VERSION_BEFORE(_) RBIMPL_COMPILER_BEFORE(MSVC, (_) / 100, (_) % 100, 0)
|
23
|
+
|
24
|
+
#ifndef __has_attribute
|
25
|
+
# define __has_attribute(...) RBIMPL_HAS_ATTRIBUTE(__VA_ARGS__)
|
26
|
+
#endif
|
27
|
+
|
28
|
+
#ifndef __has_c_attribute
|
29
|
+
# /* As of writing everything that lacks __has_c_attribute also completely
|
30
|
+
# * lacks C2x attributes as well. Might change in future? */
|
31
|
+
# define __has_c_attribute(...) 0
|
32
|
+
#endif
|
33
|
+
|
34
|
+
#ifndef __has_declspec_attribute
|
35
|
+
# define __has_declspec_attribute(...) RBIMPL_HAS_DECLSPEC_ATTRIBUTE(__VA_ARGS__)
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#ifndef __has_builtin
|
39
|
+
# define __has_builtin(...) RBIMPL_HAS_BUILTIN(__VA_ARGS__)
|
40
|
+
#endif
|
41
|
+
|
42
|
+
#ifndef __has_feature
|
43
|
+
# define __has_feature(...) RBIMPL_HAS_FEATURE(__VA_ARGS__)
|
44
|
+
#endif
|
45
|
+
|
46
|
+
#ifndef __has_extension
|
47
|
+
# define __has_extension(...) RBIMPL_HAS_EXTENSION(__VA_ARGS__)
|
48
|
+
#endif
|
49
|
+
|
50
|
+
#ifndef __has_warning
|
51
|
+
# define __has_warning(...) RBIMPL_HAS_WARNING(__VA_ARGS__)
|
52
|
+
#endif
|
53
|
+
|
54
|
+
#ifndef __GNUC__
|
55
|
+
# define __extension__ /* void */
|
56
|
+
#endif
|
57
|
+
|
58
|
+
#ifndef MAYBE_UNUSED
|
59
|
+
# define MAYBE_UNUSED(x) x
|
60
|
+
#endif
|
61
|
+
|
62
|
+
#ifndef WARN_UNUSED_RESULT
|
63
|
+
# define WARN_UNUSED_RESULT(x) x
|
64
|
+
#endif
|
65
|
+
|
66
|
+
#define RB_OBJ_BUILTIN_TYPE(obj) rb_obj_builtin_type(obj)
|
67
|
+
#define OBJ_BUILTIN_TYPE(obj) RB_OBJ_BUILTIN_TYPE(obj)
|
68
|
+
#ifdef __GNUC__
|
69
|
+
#define rb_obj_builtin_type(obj) \
|
70
|
+
__extension__({ \
|
71
|
+
VALUE arg_obj = (obj); \
|
72
|
+
RB_SPECIAL_CONST_P(arg_obj) ? -1 : \
|
73
|
+
(int)RB_BUILTIN_TYPE(arg_obj); \
|
74
|
+
})
|
75
|
+
#else
|
76
|
+
# include "ruby/ruby.h"
|
77
|
+
static inline int
|
78
|
+
rb_obj_builtin_type(VALUE obj)
|
79
|
+
{
|
80
|
+
return RB_SPECIAL_CONST_P(obj) ? -1 :
|
81
|
+
(int)RB_BUILTIN_TYPE(obj);
|
82
|
+
}
|
83
|
+
#endif
|
84
|
+
|
85
|
+
/* A macro for defining a flexible array, like: VALUE ary[FLEX_ARY_LEN]; */
|
86
|
+
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
87
|
+
# define FLEX_ARY_LEN /* VALUE ary[]; */
|
88
|
+
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
89
|
+
# define FLEX_ARY_LEN 0 /* VALUE ary[0]; */
|
90
|
+
#else
|
91
|
+
# define FLEX_ARY_LEN 1 /* VALUE ary[1]; */
|
92
|
+
#endif
|
93
|
+
|
94
|
+
/*
|
95
|
+
* For declaring bitfields out of non-unsigned int types:
|
96
|
+
* struct date {
|
97
|
+
* BITFIELD(enum months, month, 4);
|
98
|
+
* ...
|
99
|
+
* };
|
100
|
+
*/
|
101
|
+
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
102
|
+
# define BITFIELD(type, name, size) type name : size
|
103
|
+
#else
|
104
|
+
# define BITFIELD(type, name, size) unsigned int name : size
|
105
|
+
#endif
|
106
|
+
|
107
|
+
#endif /* INTERNAL_COMPILERS_H */
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#ifndef INTERNAL_COMPLEX_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_COMPLEX_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
|
+
* @brief Internal header for Complex.
|
10
|
+
*/
|
11
|
+
#include "ruby/internal/value.h" /* for struct RBasic */
|
12
|
+
|
13
|
+
struct RComplex {
|
14
|
+
struct RBasic basic;
|
15
|
+
VALUE real;
|
16
|
+
VALUE imag;
|
17
|
+
};
|
18
|
+
|
19
|
+
#define RCOMPLEX(obj) ((struct RComplex *)(obj))
|
20
|
+
|
21
|
+
/* shortcut macro for internal only */
|
22
|
+
#define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &RCOMPLEX(cmp)->real, (r))
|
23
|
+
#define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &RCOMPLEX(cmp)->imag, (i))
|
24
|
+
|
25
|
+
/* complex.c */
|
26
|
+
VALUE rb_dbl_complex_new_polar_pi(double abs, double ang);
|
27
|
+
st_index_t rb_complex_hash(VALUE comp);
|
28
|
+
|
29
|
+
#endif /* INTERNAL_COMPLEX_H */
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#ifndef INTERNAL_CONT_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_CONT_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
|
+
* @brief Internal header for Fiber.
|
10
|
+
*/
|
11
|
+
#include "ruby/ruby.h" /* for VALUE */
|
12
|
+
|
13
|
+
struct rb_thread_struct; /* in vm_core.h */
|
14
|
+
struct rb_fiber_struct; /* in cont.c */
|
15
|
+
|
16
|
+
/* cont.c */
|
17
|
+
void rb_fiber_reset_root_local_storage(struct rb_thread_struct *);
|
18
|
+
void ruby_register_rollback_func_for_ensure(VALUE (*ensure_func)(VALUE), VALUE (*rollback_func)(VALUE));
|
19
|
+
void rb_fiber_init_mjit_cont(struct rb_fiber_struct *fiber);
|
20
|
+
|
21
|
+
VALUE rb_fiberptr_self(struct rb_fiber_struct *fiber);
|
22
|
+
unsigned int rb_fiberptr_blocking(struct rb_fiber_struct *fiber);
|
23
|
+
|
24
|
+
#endif /* INTERNAL_CONT_H */
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#ifndef INTERNAL_DIR_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_DIR_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
|
+
* @brief Internal header for Dir.
|
10
|
+
*/
|
11
|
+
#include "ruby/ruby.h" /* for VALUE */
|
12
|
+
|
13
|
+
/* dir.c */
|
14
|
+
VALUE rb_dir_getwd_ospath(void);
|
15
|
+
|
16
|
+
#endif /* INTERNAL_DIR_H */
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#ifndef INTERNAL_ENC_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_ENC_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
|
+
* @brief Internal header for Encoding.
|
10
|
+
*/
|
11
|
+
#include "ruby/encoding.h" /* for rb_encoding */
|
12
|
+
|
13
|
+
/* us_ascii.c */
|
14
|
+
extern rb_encoding OnigEncodingUS_ASCII;
|
15
|
+
|
16
|
+
/* utf_8.c */
|
17
|
+
extern rb_encoding OnigEncodingUTF_8;
|
18
|
+
|
19
|
+
#endif /* INTERNAL_ENC_H */
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#ifndef INTERNAL_ENCODING_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_ENCODING_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
|
+
* @brief Internal header for Encoding.
|
10
|
+
*/
|
11
|
+
#include "ruby/ruby.h" /* for ID */
|
12
|
+
#include "ruby/encoding.h" /* for rb_encoding */
|
13
|
+
|
14
|
+
#define rb_enc_autoload_p(enc) (!rb_enc_mbmaxlen(enc))
|
15
|
+
|
16
|
+
/* encoding.c */
|
17
|
+
ID rb_id_encoding(void);
|
18
|
+
rb_encoding *rb_enc_get_from_index(int index);
|
19
|
+
rb_encoding *rb_enc_check_str(VALUE str1, VALUE str2);
|
20
|
+
int rb_encdb_replicate(const char *alias, const char *orig);
|
21
|
+
int rb_encdb_alias(const char *alias, const char *orig);
|
22
|
+
int rb_enc_autoload(rb_encoding *enc);
|
23
|
+
int rb_encdb_dummy(const char *name);
|
24
|
+
void rb_encdb_declare(const char *name);
|
25
|
+
void rb_enc_set_base(const char *name, const char *orig);
|
26
|
+
int rb_enc_set_dummy(int index);
|
27
|
+
void rb_encdb_set_unicode(int index);
|
28
|
+
PUREFUNC(int rb_data_is_encoding(VALUE obj));
|
29
|
+
|
30
|
+
#endif /* INTERNAL_ENCODING_H */
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#ifndef INTERNAL_ENUM_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_ENUM_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
|
+
* @brief Internal header for Enumerable.
|
10
|
+
*/
|
11
|
+
#include "ruby/ruby.h" /* for VALUE */
|
12
|
+
|
13
|
+
/* enum.c */
|
14
|
+
extern VALUE rb_cArithSeq;
|
15
|
+
VALUE rb_f_send(int argc, VALUE *argv, VALUE recv);
|
16
|
+
VALUE rb_nmin_run(VALUE obj, VALUE num, int by, int rev, int ary);
|
17
|
+
|
18
|
+
#endif /* INTERNAL_ENUM_H */
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#ifndef INTERNAL_ENUMERATOR_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_ENUMERATOR_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
|
+
* @brief Internal header for Enumerator.
|
10
|
+
*/
|
11
|
+
#include "ruby/ruby.h" /* for VALUE */
|
12
|
+
#include "ruby/intern.h" /* for rb_enumerator_size_func */
|
13
|
+
|
14
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
15
|
+
/* enumerator.c (export) */
|
16
|
+
VALUE rb_arith_seq_new(VALUE obj, VALUE meth, int argc, VALUE const *argv,
|
17
|
+
rb_enumerator_size_func *size_fn,
|
18
|
+
VALUE beg, VALUE end, VALUE step, int excl);
|
19
|
+
RUBY_SYMBOL_EXPORT_END
|
20
|
+
|
21
|
+
#endif /* INTERNAL_ENUMERATOR_H */
|