debase-ruby_core_source 0.10.7 → 0.10.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +1 -1
- data/Rakefile +6 -3
- data/debase-ruby_core_source.gemspec +2 -1
- data/lib/debase/ruby_core_source.rb +0 -1
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/addr2line.h +0 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/builtin.h +78 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/ccan/list/list.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/constant.h +0 -4
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/debug_counter.h +21 -9
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/dln.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/encindex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/eval_intern.h +1 -3
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/gc.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/hrtime.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/id.h +1 -3
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/id_table.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/insns.inc +6 -2
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/insns_info.inc +1471 -1888
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/internal.h +106 -91
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/iseq.h +5 -5
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/known_errors.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/method.h +1 -4
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/mjit.h +3 -5
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/mjit_compile.inc +768 -872
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/node.h +4 -11
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/node_name.inc +0 -2
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/opt_sc.inc +109 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/optinsn.inc +0 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/optunifs.inc +43 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/parse.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/probes_helper.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/regenc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/regint.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/regparse.h +0 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/revision.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/ruby_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/ruby_atomic.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/siphash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/symbol.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/thread_pthread.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/thread_win32.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/timev.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/transcode_data.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/transient_heap.h +0 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/variable.h +9 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/version.h +4 -4
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/vm.inc +604 -407
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/vm_call_iseq_optimized.inc +49 -49
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/vm_core.h +42 -29
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/vm_debug.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/vm_exec.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/vm_insnhelper.h +16 -4
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/vm_opts.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-2.7.0-p0}/vmtc.inc +6 -2
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/addr2line.h +20 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/builtin.h +83 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ccan/build_assert/build_assert.h +40 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ccan/check_type/check_type.h +63 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ccan/container_of/container_of.h +142 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ccan/list/list.h +788 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ccan/str/str.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/constant.h +55 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/debug_counter.h +457 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/dln.h +36 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/encindex.h +70 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/eval_intern.h +323 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/gc.h +140 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/hrtime.h +168 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/id.h +290 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/id_table.h +36 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/insns.inc +249 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/insns_info.inc +8983 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal.h +107 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/array.h +119 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/bignum.h +246 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/bits.h +566 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/class.h +174 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/compar.h +50 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/compile.h +32 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/compilers.h +108 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/complex.h +29 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/cont.h +25 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/dir.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/enc.h +20 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/encoding.h +28 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/enum.h +19 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/enumerator.h +22 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/error.h +124 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/eval.h +33 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/file.h +39 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/fixnum.h +185 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/gc.h +161 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/hash.h +241 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/imemo.h +243 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/inits.h +51 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/io.h +35 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/load.h +19 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/loadpath.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/math.h +24 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/missing.h +19 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/numeric.h +255 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/object.h +83 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/parse.h +23 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/proc.h +33 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/process.h +136 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/random.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/range.h +41 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/rational.h +71 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/re.h +29 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/sanitizers.h +191 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/scheduler.h +44 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/serial.h +24 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/signal.h +22 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/static_assert.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/string.h +140 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/struct.h +154 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/symbol.h +41 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/thread.h +54 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/time.h +35 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/transcode.h +21 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/util.h +31 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/variable.h +84 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/vm.h +136 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/internal/warnings.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/iseq.h +305 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/known_errors.inc +791 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/method.h +245 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/mjit.h +220 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/mjit_compile.inc +8240 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/node.h +484 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/node_name.inc +210 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/opt_sc.inc +0 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/optinsn.inc +128 -0
- data/lib/debase/ruby_core_source/{ruby-2.7.0-preview2 → ruby-3.0.0-p0}/optunifs.inc +0 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/parse.h +211 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/probes_helper.h +44 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ractor_core.h +343 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/regenc.h +254 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/regint.h +938 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/regparse.h +370 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/revision.h +2 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ruby_assert.h +15 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/ruby_atomic.h +23 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/siphash.h +48 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/symbol.h +119 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/thread_pthread.h +115 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/thread_win32.h +61 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/timev.h +57 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/transcode_data.h +138 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/transient_heap.h +65 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/variable.h +22 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/version.h +89 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm.inc +5355 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_call_iseq_optimized.inc +244 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_callinfo.h +456 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_core.h +2023 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_debug.h +116 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_exec.h +196 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_insnhelper.h +257 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_opts.h +73 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vm_sync.h +136 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-p0/vmtc.inc +243 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +181 -57
- data/lib/debase/ruby_core_source/ruby-2.7.0-preview2/revision.h +0 -2
@@ -0,0 +1,107 @@
|
|
1
|
+
#ifndef RUBY_INTERNAL_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define RUBY_INTERNAL_H 1
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author $Author$
|
6
|
+
* @date Tue May 17 11:42:20 JST 2011
|
7
|
+
* @copyright Copyright (C) 2011 Yukihiro Matsumoto
|
8
|
+
* @copyright This file is a part of the programming language Ruby.
|
9
|
+
* Permission is hereby granted, to either redistribute and/or
|
10
|
+
* modify this file, provided that the conditions mentioned in the
|
11
|
+
* file COPYING are met. Consult the file for details.
|
12
|
+
*/
|
13
|
+
#include "ruby/internal/config.h"
|
14
|
+
|
15
|
+
#ifdef __cplusplus
|
16
|
+
# error not for C++
|
17
|
+
#endif
|
18
|
+
|
19
|
+
#define LIKELY(x) RB_LIKELY(x)
|
20
|
+
#define UNLIKELY(x) RB_UNLIKELY(x)
|
21
|
+
|
22
|
+
#define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
|
23
|
+
#define roomof(x, y) (((x) + (y) - 1) / (y))
|
24
|
+
#define type_roomof(x, y) roomof(sizeof(x), sizeof(y))
|
25
|
+
|
26
|
+
/* Prevent compiler from reordering access */
|
27
|
+
#define ACCESS_ONCE(type,x) (*((volatile type *)&(x)))
|
28
|
+
|
29
|
+
#include "ruby/ruby.h"
|
30
|
+
|
31
|
+
/* Following macros were formerly defined in this header but moved to somewhere
|
32
|
+
* else. In order to detect them we undef here. */
|
33
|
+
|
34
|
+
/* internal/array.h */
|
35
|
+
#undef RARRAY_AREF
|
36
|
+
|
37
|
+
/* internal/class.h */
|
38
|
+
#undef RClass
|
39
|
+
#undef RCLASS_SUPER
|
40
|
+
|
41
|
+
/* internal/gc.h */
|
42
|
+
#undef NEWOBJ_OF
|
43
|
+
#undef RB_NEWOBJ_OF
|
44
|
+
#undef RB_OBJ_WRITE
|
45
|
+
|
46
|
+
/* internal/hash.h */
|
47
|
+
#undef RHASH_IFNONE
|
48
|
+
#undef RHASH_SIZE
|
49
|
+
#undef RHASH_TBL
|
50
|
+
#undef RHASH_EMPTY_P
|
51
|
+
|
52
|
+
/* internal/object.h */
|
53
|
+
#undef ROBJECT_IV_INDEX_TBL
|
54
|
+
|
55
|
+
/* internal/struct.h */
|
56
|
+
#undef RSTRUCT_LEN
|
57
|
+
#undef RSTRUCT_PTR
|
58
|
+
#undef RSTRUCT_SET
|
59
|
+
#undef RSTRUCT_GET
|
60
|
+
|
61
|
+
/* Also, we keep the following macros here. They are expected to be
|
62
|
+
* overridden in each headers. */
|
63
|
+
|
64
|
+
/* internal/array.h */
|
65
|
+
#define rb_ary_new_from_args(...) rb_nonexistent_symbol(__VA_ARGS__)
|
66
|
+
|
67
|
+
/* internal/io.h */
|
68
|
+
#define rb_io_fptr_finalize(...) rb_nonexistent_symbol(__VA_ARGS__)
|
69
|
+
|
70
|
+
/* internal/string.h */
|
71
|
+
#define rb_fstring_cstr(...) rb_nonexistent_symbol(__VA_ARGS__)
|
72
|
+
|
73
|
+
/* internal/symbol.h */
|
74
|
+
#define rb_sym_intern_ascii_cstr(...) rb_nonexistent_symbol(__VA_ARGS__)
|
75
|
+
|
76
|
+
/* internal/vm.h */
|
77
|
+
#define rb_funcallv(...) rb_nonexistent_symbol(__VA_ARGS__)
|
78
|
+
#define rb_method_basic_definition_p(...) rb_nonexistent_symbol(__VA_ARGS__)
|
79
|
+
|
80
|
+
|
81
|
+
/* MRI debug support */
|
82
|
+
|
83
|
+
/* gc.c */
|
84
|
+
void rb_obj_info_dump(VALUE obj);
|
85
|
+
void rb_obj_info_dump_loc(VALUE obj, const char *file, int line, const char *func);
|
86
|
+
|
87
|
+
/* debug.c */
|
88
|
+
|
89
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
90
|
+
void ruby_debug_breakpoint(void);
|
91
|
+
PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
|
92
|
+
RUBY_SYMBOL_EXPORT_END
|
93
|
+
|
94
|
+
// show obj data structure without any side-effect
|
95
|
+
#define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)
|
96
|
+
|
97
|
+
// same as rp, but add message header
|
98
|
+
#define rp_m(msg, obj) do { \
|
99
|
+
fprintf(stderr, "%s", (msg)); \
|
100
|
+
rb_obj_info_dump((VALUE)obj); \
|
101
|
+
} while (0)
|
102
|
+
|
103
|
+
// `ruby_debug_breakpoint()` does nothing,
|
104
|
+
// but breakpoint is set in run.gdb, so `make gdb` can stop here.
|
105
|
+
#define bp() ruby_debug_breakpoint()
|
106
|
+
|
107
|
+
#endif /* RUBY_INTERNAL_H */
|
@@ -0,0 +1,119 @@
|
|
1
|
+
#ifndef INTERNAL_ARRAY_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_ARRAY_H
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
6
|
+
* @copyright This file is a part of the programming language Ruby.
|
7
|
+
* Permission is hereby granted, to either redistribute and/or
|
8
|
+
* modify this file, provided that the conditions mentioned in the
|
9
|
+
* file COPYING are met. Consult the file for details.
|
10
|
+
* @brief Internal header for Array.
|
11
|
+
*/
|
12
|
+
#include "ruby/internal/config.h"
|
13
|
+
#include <stddef.h> /* for size_t */
|
14
|
+
#include "internal/static_assert.h" /* for STATIC_ASSERT */
|
15
|
+
#include "ruby/internal/stdbool.h" /* for bool */
|
16
|
+
#include "ruby/ruby.h" /* for RARRAY_LEN */
|
17
|
+
|
18
|
+
#ifndef ARRAY_DEBUG
|
19
|
+
# define ARRAY_DEBUG (0+RUBY_DEBUG)
|
20
|
+
#endif
|
21
|
+
|
22
|
+
#define RARRAY_PTR_IN_USE_FLAG FL_USER14
|
23
|
+
|
24
|
+
/* array.c */
|
25
|
+
VALUE rb_ary_last(int, const VALUE *, VALUE);
|
26
|
+
void rb_ary_set_len(VALUE, long);
|
27
|
+
void rb_ary_delete_same(VALUE, VALUE);
|
28
|
+
VALUE rb_ary_tmp_new_fill(long capa);
|
29
|
+
VALUE rb_ary_at(VALUE, VALUE);
|
30
|
+
size_t rb_ary_memsize(VALUE);
|
31
|
+
VALUE rb_to_array_type(VALUE obj);
|
32
|
+
void rb_ary_cancel_sharing(VALUE ary);
|
33
|
+
|
34
|
+
static inline VALUE rb_ary_entry_internal(VALUE ary, long offset);
|
35
|
+
static inline bool ARY_PTR_USING_P(VALUE ary);
|
36
|
+
static inline void RARY_TRANSIENT_SET(VALUE ary);
|
37
|
+
static inline void RARY_TRANSIENT_UNSET(VALUE ary);
|
38
|
+
|
39
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
40
|
+
/* array.c (export) */
|
41
|
+
void rb_ary_detransient(VALUE a);
|
42
|
+
VALUE *rb_ary_ptr_use_start(VALUE ary);
|
43
|
+
void rb_ary_ptr_use_end(VALUE ary);
|
44
|
+
RUBY_SYMBOL_EXPORT_END
|
45
|
+
|
46
|
+
MJIT_SYMBOL_EXPORT_BEGIN
|
47
|
+
VALUE rb_ary_tmp_new_from_values(VALUE, long, const VALUE *);
|
48
|
+
VALUE rb_check_to_array(VALUE ary);
|
49
|
+
VALUE rb_ary_behead(VALUE, long);
|
50
|
+
VALUE rb_ary_aref1(VALUE ary, VALUE i);
|
51
|
+
|
52
|
+
struct rb_execution_context_struct;
|
53
|
+
VALUE rb_ec_ary_new_from_values(struct rb_execution_context_struct *ec, long n, const VALUE *elts);
|
54
|
+
MJIT_SYMBOL_EXPORT_END
|
55
|
+
|
56
|
+
static inline VALUE
|
57
|
+
rb_ary_entry_internal(VALUE ary, long offset)
|
58
|
+
{
|
59
|
+
long len = RARRAY_LEN(ary);
|
60
|
+
const VALUE *ptr = RARRAY_CONST_PTR_TRANSIENT(ary);
|
61
|
+
if (len == 0) return Qnil;
|
62
|
+
if (offset < 0) {
|
63
|
+
offset += len;
|
64
|
+
if (offset < 0) return Qnil;
|
65
|
+
}
|
66
|
+
else if (len <= offset) {
|
67
|
+
return Qnil;
|
68
|
+
}
|
69
|
+
return ptr[offset];
|
70
|
+
}
|
71
|
+
|
72
|
+
static inline bool
|
73
|
+
ARY_PTR_USING_P(VALUE ary)
|
74
|
+
{
|
75
|
+
return FL_TEST_RAW(ary, RARRAY_PTR_IN_USE_FLAG);
|
76
|
+
}
|
77
|
+
|
78
|
+
static inline void
|
79
|
+
RARY_TRANSIENT_SET(VALUE ary)
|
80
|
+
{
|
81
|
+
#if USE_TRANSIENT_HEAP
|
82
|
+
FL_SET_RAW(ary, RARRAY_TRANSIENT_FLAG);
|
83
|
+
#endif
|
84
|
+
}
|
85
|
+
|
86
|
+
static inline void
|
87
|
+
RARY_TRANSIENT_UNSET(VALUE ary)
|
88
|
+
{
|
89
|
+
#if USE_TRANSIENT_HEAP
|
90
|
+
FL_UNSET_RAW(ary, RARRAY_TRANSIENT_FLAG);
|
91
|
+
#endif
|
92
|
+
}
|
93
|
+
|
94
|
+
#undef rb_ary_new_from_args
|
95
|
+
#if RBIMPL_HAS_WARNING("-Wgnu-zero-variadic-macro-arguments")
|
96
|
+
# /* Skip it; clang -pedantic doesn't like the following */
|
97
|
+
#elif defined(__GNUC__) && defined(HAVE_VA_ARGS_MACRO)
|
98
|
+
#define rb_ary_new_from_args(n, ...) \
|
99
|
+
__extension__ ({ \
|
100
|
+
const VALUE args_to_new_ary[] = {__VA_ARGS__}; \
|
101
|
+
if (__builtin_constant_p(n)) { \
|
102
|
+
STATIC_ASSERT(rb_ary_new_from_args, numberof(args_to_new_ary) == (n)); \
|
103
|
+
} \
|
104
|
+
rb_ary_new_from_values(numberof(args_to_new_ary), args_to_new_ary); \
|
105
|
+
})
|
106
|
+
#endif
|
107
|
+
|
108
|
+
#undef RARRAY_AREF
|
109
|
+
RBIMPL_ATTR_PURE_UNLESS_DEBUG()
|
110
|
+
RBIMPL_ATTR_ARTIFICIAL()
|
111
|
+
static inline VALUE
|
112
|
+
RARRAY_AREF(VALUE ary, long i)
|
113
|
+
{
|
114
|
+
RBIMPL_ASSERT_TYPE(ary, RUBY_T_ARRAY);
|
115
|
+
|
116
|
+
return RARRAY_CONST_PTR_TRANSIENT(ary)[i];
|
117
|
+
}
|
118
|
+
|
119
|
+
#endif /* INTERNAL_ARRAY_H */
|
@@ -0,0 +1,246 @@
|
|
1
|
+
#ifndef INTERNAL_BIGNUM_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_BIGNUM_H
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
6
|
+
* @copyright This file is a part of the programming language Ruby.
|
7
|
+
* Permission is hereby granted, to either redistribute and/or
|
8
|
+
* modify this file, provided that the conditions mentioned in the
|
9
|
+
* file COPYING are met. Consult the file for details.
|
10
|
+
* @brief Internal header for Bignums.
|
11
|
+
*/
|
12
|
+
#include "ruby/internal/config.h" /* for HAVE_LIBGMP */
|
13
|
+
#include <stddef.h> /* for size_t */
|
14
|
+
|
15
|
+
#ifdef HAVE_SYS_TYPES_H
|
16
|
+
# include <sys/types.h> /* for ssize_t (note: on Windows ssize_t is */
|
17
|
+
#endif /* `#define`d in ruby/config.h) */
|
18
|
+
|
19
|
+
#include "ruby/internal/stdbool.h" /* for bool */
|
20
|
+
#include "ruby/ruby.h" /* for struct RBasic */
|
21
|
+
|
22
|
+
#ifndef BDIGIT
|
23
|
+
# if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
|
24
|
+
# define BDIGIT unsigned int
|
25
|
+
# define SIZEOF_BDIGIT SIZEOF_INT
|
26
|
+
# define BDIGIT_DBL unsigned LONG_LONG
|
27
|
+
# define BDIGIT_DBL_SIGNED LONG_LONG
|
28
|
+
# define PRI_BDIGIT_PREFIX ""
|
29
|
+
# define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX
|
30
|
+
# elif SIZEOF_INT*2 <= SIZEOF_LONG
|
31
|
+
# define BDIGIT unsigned int
|
32
|
+
# define SIZEOF_BDIGIT SIZEOF_INT
|
33
|
+
# define BDIGIT_DBL unsigned long
|
34
|
+
# define BDIGIT_DBL_SIGNED long
|
35
|
+
# define PRI_BDIGIT_PREFIX ""
|
36
|
+
# define PRI_BDIGIT_DBL_PREFIX "l"
|
37
|
+
# elif SIZEOF_SHORT*2 <= SIZEOF_LONG
|
38
|
+
# define BDIGIT unsigned short
|
39
|
+
# define SIZEOF_BDIGIT SIZEOF_SHORT
|
40
|
+
# define BDIGIT_DBL unsigned long
|
41
|
+
# define BDIGIT_DBL_SIGNED long
|
42
|
+
# define PRI_BDIGIT_PREFIX "h"
|
43
|
+
# define PRI_BDIGIT_DBL_PREFIX "l"
|
44
|
+
# else
|
45
|
+
# define BDIGIT unsigned short
|
46
|
+
# define SIZEOF_BDIGIT (SIZEOF_LONG/2)
|
47
|
+
# define SIZEOF_ACTUAL_BDIGIT SIZEOF_LONG
|
48
|
+
# define BDIGIT_DBL unsigned long
|
49
|
+
# define BDIGIT_DBL_SIGNED long
|
50
|
+
# define PRI_BDIGIT_PREFIX "h"
|
51
|
+
# define PRI_BDIGIT_DBL_PREFIX "l"
|
52
|
+
# endif
|
53
|
+
#endif
|
54
|
+
|
55
|
+
#ifndef SIZEOF_ACTUAL_BDIGIT
|
56
|
+
# define SIZEOF_ACTUAL_BDIGIT SIZEOF_BDIGIT
|
57
|
+
#endif
|
58
|
+
|
59
|
+
#ifdef PRI_BDIGIT_PREFIX
|
60
|
+
# define PRIdBDIGIT PRI_BDIGIT_PREFIX"d"
|
61
|
+
# define PRIiBDIGIT PRI_BDIGIT_PREFIX"i"
|
62
|
+
# define PRIoBDIGIT PRI_BDIGIT_PREFIX"o"
|
63
|
+
# define PRIuBDIGIT PRI_BDIGIT_PREFIX"u"
|
64
|
+
# define PRIxBDIGIT PRI_BDIGIT_PREFIX"x"
|
65
|
+
# define PRIXBDIGIT PRI_BDIGIT_PREFIX"X"
|
66
|
+
#endif
|
67
|
+
|
68
|
+
#ifdef PRI_BDIGIT_DBL_PREFIX
|
69
|
+
# define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d"
|
70
|
+
# define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i"
|
71
|
+
# define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o"
|
72
|
+
# define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u"
|
73
|
+
# define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x"
|
74
|
+
# define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X"
|
75
|
+
#endif
|
76
|
+
|
77
|
+
#define RBIGNUM(obj) ((struct RBignum *)(obj))
|
78
|
+
#define BIGNUM_SIGN_BIT FL_USER1
|
79
|
+
#define BIGNUM_EMBED_FLAG ((VALUE)FL_USER2)
|
80
|
+
#define BIGNUM_EMBED_LEN_NUMBITS 3
|
81
|
+
#define BIGNUM_EMBED_LEN_MASK \
|
82
|
+
(~(~(VALUE)0U << BIGNUM_EMBED_LEN_NUMBITS) << BIGNUM_EMBED_LEN_SHIFT)
|
83
|
+
#define BIGNUM_EMBED_LEN_SHIFT \
|
84
|
+
(FL_USHIFT+3) /* bit offset of BIGNUM_EMBED_LEN_MASK */
|
85
|
+
#ifndef BIGNUM_EMBED_LEN_MAX
|
86
|
+
# if (SIZEOF_VALUE*RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1
|
87
|
+
# define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT)
|
88
|
+
# else
|
89
|
+
# define BIGNUM_EMBED_LEN_MAX ((1 << BIGNUM_EMBED_LEN_NUMBITS)-1)
|
90
|
+
# endif
|
91
|
+
#endif
|
92
|
+
|
93
|
+
enum rb_int_parse_flags {
|
94
|
+
RB_INT_PARSE_SIGN = 0x01,
|
95
|
+
RB_INT_PARSE_UNDERSCORE = 0x02,
|
96
|
+
RB_INT_PARSE_PREFIX = 0x04,
|
97
|
+
RB_INT_PARSE_ALL = 0x07,
|
98
|
+
RB_INT_PARSE_DEFAULT = 0x07,
|
99
|
+
};
|
100
|
+
|
101
|
+
struct RBignum {
|
102
|
+
struct RBasic basic;
|
103
|
+
union {
|
104
|
+
struct {
|
105
|
+
size_t len;
|
106
|
+
BDIGIT *digits;
|
107
|
+
} heap;
|
108
|
+
BDIGIT ary[BIGNUM_EMBED_LEN_MAX];
|
109
|
+
} as;
|
110
|
+
};
|
111
|
+
|
112
|
+
/* bignum.c */
|
113
|
+
extern const char ruby_digitmap[];
|
114
|
+
double rb_big_fdiv_double(VALUE x, VALUE y);
|
115
|
+
VALUE rb_big_uminus(VALUE x);
|
116
|
+
VALUE rb_big_hash(VALUE);
|
117
|
+
VALUE rb_big_odd_p(VALUE);
|
118
|
+
VALUE rb_big_even_p(VALUE);
|
119
|
+
size_t rb_big_size(VALUE);
|
120
|
+
VALUE rb_integer_float_cmp(VALUE x, VALUE y);
|
121
|
+
VALUE rb_integer_float_eq(VALUE x, VALUE y);
|
122
|
+
VALUE rb_str_convert_to_inum(VALUE str, int base, int badcheck, int raise_exception);
|
123
|
+
VALUE rb_big_comp(VALUE x);
|
124
|
+
VALUE rb_big_aref(VALUE x, VALUE y);
|
125
|
+
VALUE rb_big_abs(VALUE x);
|
126
|
+
VALUE rb_big_size_m(VALUE big);
|
127
|
+
VALUE rb_big_bit_length(VALUE big);
|
128
|
+
VALUE rb_big_remainder(VALUE x, VALUE y);
|
129
|
+
VALUE rb_big_gt(VALUE x, VALUE y);
|
130
|
+
VALUE rb_big_ge(VALUE x, VALUE y);
|
131
|
+
VALUE rb_big_lt(VALUE x, VALUE y);
|
132
|
+
VALUE rb_big_le(VALUE x, VALUE y);
|
133
|
+
VALUE rb_int_powm(int const argc, VALUE * const argv, VALUE const num);
|
134
|
+
static inline bool BIGNUM_SIGN(VALUE b);
|
135
|
+
static inline bool BIGNUM_POSITIVE_P(VALUE b);
|
136
|
+
static inline bool BIGNUM_NEGATIVE_P(VALUE b);
|
137
|
+
static inline void BIGNUM_SET_SIGN(VALUE b, bool sign);
|
138
|
+
static inline void BIGNUM_NEGATE(VALUE b);
|
139
|
+
static inline size_t BIGNUM_LEN(VALUE b);
|
140
|
+
static inline BDIGIT *BIGNUM_DIGITS(VALUE b);
|
141
|
+
static inline int BIGNUM_LENINT(VALUE b);
|
142
|
+
static inline bool BIGNUM_EMBED_P(VALUE b);
|
143
|
+
|
144
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
145
|
+
/* bignum.c (export) */
|
146
|
+
VALUE rb_big_mul_normal(VALUE x, VALUE y);
|
147
|
+
VALUE rb_big_mul_balance(VALUE x, VALUE y);
|
148
|
+
VALUE rb_big_mul_karatsuba(VALUE x, VALUE y);
|
149
|
+
VALUE rb_big_mul_toom3(VALUE x, VALUE y);
|
150
|
+
VALUE rb_big_sq_fast(VALUE x);
|
151
|
+
VALUE rb_big_divrem_normal(VALUE x, VALUE y);
|
152
|
+
VALUE rb_big2str_poweroftwo(VALUE x, int base);
|
153
|
+
VALUE rb_big2str_generic(VALUE x, int base);
|
154
|
+
VALUE rb_str2big_poweroftwo(VALUE arg, int base, int badcheck);
|
155
|
+
VALUE rb_str2big_normal(VALUE arg, int base, int badcheck);
|
156
|
+
VALUE rb_str2big_karatsuba(VALUE arg, int base, int badcheck);
|
157
|
+
#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
|
158
|
+
VALUE rb_big_mul_gmp(VALUE x, VALUE y);
|
159
|
+
VALUE rb_big_divrem_gmp(VALUE x, VALUE y);
|
160
|
+
VALUE rb_big2str_gmp(VALUE x, int base);
|
161
|
+
VALUE rb_str2big_gmp(VALUE arg, int base, int badcheck);
|
162
|
+
#endif
|
163
|
+
VALUE rb_int_parse_cstr(const char *str, ssize_t len, char **endp, size_t *ndigits, int base, int flags);
|
164
|
+
RUBY_SYMBOL_EXPORT_END
|
165
|
+
|
166
|
+
MJIT_SYMBOL_EXPORT_BEGIN
|
167
|
+
#if defined(HAVE_INT128_T)
|
168
|
+
VALUE rb_int128t2big(int128_t n);
|
169
|
+
#endif
|
170
|
+
MJIT_SYMBOL_EXPORT_END
|
171
|
+
|
172
|
+
/* sign: positive:1, negative:0 */
|
173
|
+
static inline bool
|
174
|
+
BIGNUM_SIGN(VALUE b)
|
175
|
+
{
|
176
|
+
return FL_TEST_RAW(b, BIGNUM_SIGN_BIT);
|
177
|
+
}
|
178
|
+
|
179
|
+
static inline bool
|
180
|
+
BIGNUM_POSITIVE_P(VALUE b)
|
181
|
+
{
|
182
|
+
return BIGNUM_SIGN(b);
|
183
|
+
}
|
184
|
+
|
185
|
+
static inline bool
|
186
|
+
BIGNUM_NEGATIVE_P(VALUE b)
|
187
|
+
{
|
188
|
+
return ! BIGNUM_POSITIVE_P(b);
|
189
|
+
}
|
190
|
+
|
191
|
+
static inline void
|
192
|
+
BIGNUM_SET_SIGN(VALUE b, bool sign)
|
193
|
+
{
|
194
|
+
if (sign) {
|
195
|
+
FL_SET_RAW(b, BIGNUM_SIGN_BIT);
|
196
|
+
}
|
197
|
+
else {
|
198
|
+
FL_UNSET_RAW(b, BIGNUM_SIGN_BIT);
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
static inline void
|
203
|
+
BIGNUM_NEGATE(VALUE b)
|
204
|
+
{
|
205
|
+
FL_REVERSE_RAW(b, BIGNUM_SIGN_BIT);
|
206
|
+
}
|
207
|
+
|
208
|
+
static inline size_t
|
209
|
+
BIGNUM_LEN(VALUE b)
|
210
|
+
{
|
211
|
+
if (! BIGNUM_EMBED_P(b)) {
|
212
|
+
return RBIGNUM(b)->as.heap.len;
|
213
|
+
}
|
214
|
+
else {
|
215
|
+
size_t ret = RBASIC(b)->flags;
|
216
|
+
ret &= BIGNUM_EMBED_LEN_MASK;
|
217
|
+
ret >>= BIGNUM_EMBED_LEN_SHIFT;
|
218
|
+
return ret;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
|
222
|
+
static inline int
|
223
|
+
BIGNUM_LENINT(VALUE b)
|
224
|
+
{
|
225
|
+
return rb_long2int(BIGNUM_LEN(b));
|
226
|
+
}
|
227
|
+
|
228
|
+
/* LSB:BIGNUM_DIGITS(b)[0], MSB:BIGNUM_DIGITS(b)[BIGNUM_LEN(b)-1] */
|
229
|
+
static inline BDIGIT *
|
230
|
+
BIGNUM_DIGITS(VALUE b)
|
231
|
+
{
|
232
|
+
if (BIGNUM_EMBED_P(b)) {
|
233
|
+
return RBIGNUM(b)->as.ary;
|
234
|
+
}
|
235
|
+
else {
|
236
|
+
return RBIGNUM(b)->as.heap.digits;
|
237
|
+
}
|
238
|
+
}
|
239
|
+
|
240
|
+
static inline bool
|
241
|
+
BIGNUM_EMBED_P(VALUE b)
|
242
|
+
{
|
243
|
+
return FL_TEST_RAW(b, BIGNUM_EMBED_FLAG);
|
244
|
+
}
|
245
|
+
|
246
|
+
#endif /* INTERNAL_BIGNUM_H */
|