debase-ruby_core_source 0.10.6 → 0.10.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -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 +1 -1
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/addr2line.h +21 -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-p0/ccan/build_assert/build_assert.h +40 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/check_type/check_type.h +63 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/container_of/container_of.h +142 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/list/list.h +788 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ccan/str/str.h +16 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/constant.h +50 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/debug_counter.h +390 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/dln.h +51 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/encindex.h +69 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/eval_intern.h +312 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/gc.h +131 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/hrtime.h +168 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/id.h +290 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/id_table.h +34 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/insns.inc +253 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/insns_info.inc +9197 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/internal.h +2697 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/iseq.h +312 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/known_errors.inc +791 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/method.h +229 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/mjit.h +177 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/mjit_compile.inc +7779 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/node.h +476 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/node_name.inc +208 -0
- 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-p0/optinsn.inc +128 -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-p0/parse.h +210 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/probes_helper.h +42 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/regenc.h +254 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/regint.h +938 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/regparse.h +370 -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-p0/ruby_assert.h +15 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/ruby_atomic.h +244 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/siphash.h +48 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/symbol.h +119 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/thread_pthread.h +75 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/thread_win32.h +36 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/timev.h +56 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/transcode_data.h +139 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/transient_heap.h +62 -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-p0/version.h +77 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm.inc +5466 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_call_iseq_optimized.inc +237 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_core.h +1968 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_debug.h +34 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_exec.h +193 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_insnhelper.h +267 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vm_opts.h +72 -0
- data/lib/debase/ruby_core_source/ruby-2.7.0-p0/vmtc.inc +247 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/addr2line.h +20 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/builtin.h +83 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/build_assert/build_assert.h +40 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/check_type/check_type.h +63 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/container_of/container_of.h +142 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/list/list.h +788 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ccan/str/str.h +16 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/constant.h +55 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/debug_counter.h +423 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/dln.h +36 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/encindex.h +70 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/eval_intern.h +312 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/gc.h +140 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/hrtime.h +168 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/id.h +290 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/id_table.h +36 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/insns.inc +249 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/insns_info.inc +8979 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal.h +107 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/array.h +114 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/bignum.h +246 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/bits.h +566 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/class.h +168 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/compar.h +50 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/compile.h +32 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/compilers.h +108 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/complex.h +29 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/cont.h +25 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/dir.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/enc.h +20 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/encoding.h +28 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/enum.h +19 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/enumerator.h +22 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/error.h +131 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/eval.h +33 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/file.h +39 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/fixnum.h +185 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/gc.h +154 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/hash.h +240 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/imemo.h +243 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/inits.h +51 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/io.h +35 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/load.h +19 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/loadpath.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/math.h +24 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/missing.h +19 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/mjit.h +29 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/numeric.h +252 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/object.h +83 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/parse.h +23 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/proc.h +32 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/process.h +136 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/random.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/range.h +37 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/rational.h +69 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/re.h +29 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/sanitizers.h +191 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/scheduler.h +35 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/serial.h +24 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/signal.h +22 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/static_assert.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/string.h +135 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/struct.h +154 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/symbol.h +41 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/thread.h +60 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/time.h +35 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/transcode.h +21 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/util.h +31 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/variable.h +83 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/vm.h +135 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/internal/warnings.h +17 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/iseq.h +304 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/known_errors.inc +791 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/method.h +245 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/mjit.h +197 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/mjit_compile.inc +8082 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/node.h +484 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/node_name.inc +210 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/opt_sc.inc +109 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/optinsn.inc +128 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/optunifs.inc +43 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/parse.h +211 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/probes_helper.h +44 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ractor.h +271 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ractor_pub.h +50 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/regenc.h +254 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/regint.h +938 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/regparse.h +370 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/revision.h +2 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ruby_assert.h +15 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/ruby_atomic.h +236 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/siphash.h +48 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/symbol.h +119 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/thread_pthread.h +106 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/thread_win32.h +66 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/timev.h +57 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/transcode_data.h +138 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/transient_heap.h +61 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/variable.h +21 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/version.h +89 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm.inc +5360 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_call_iseq_optimized.inc +244 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_callinfo.h +457 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_core.h +1952 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_debug.h +116 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_exec.h +196 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_insnhelper.h +260 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_opts.h +73 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vm_sync.h +97 -0
- data/lib/debase/ruby_core_source/ruby-3.0.0-preview1/vmtc.inc +243 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +183 -5
@@ -0,0 +1,83 @@
|
|
1
|
+
#ifndef INTERNAL_OBJECT_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_OBJECT_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 Object.
|
11
|
+
*/
|
12
|
+
#include "ruby/ruby.h" /* for VALUE */
|
13
|
+
#include "internal/class.h" /* for RCLASS_IV_INDEX_TBL */
|
14
|
+
|
15
|
+
#ifdef ROBJECT_IV_INDEX_TBL
|
16
|
+
# undef ROBJECT_IV_INDEX_TBL
|
17
|
+
#endif
|
18
|
+
|
19
|
+
/* object.c */
|
20
|
+
VALUE rb_class_search_ancestor(VALUE klass, VALUE super);
|
21
|
+
NORETURN(void rb_undefined_alloc(VALUE klass));
|
22
|
+
double rb_num_to_dbl(VALUE val);
|
23
|
+
VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound);
|
24
|
+
VALUE rb_immutable_obj_clone(int, VALUE *, VALUE);
|
25
|
+
VALUE rb_check_convert_type_with_id(VALUE,int,const char*,ID);
|
26
|
+
int rb_bool_expected(VALUE, const char *);
|
27
|
+
static inline void RBASIC_CLEAR_CLASS(VALUE obj);
|
28
|
+
static inline void RBASIC_SET_CLASS_RAW(VALUE obj, VALUE klass);
|
29
|
+
static inline void RBASIC_SET_CLASS(VALUE obj, VALUE klass);
|
30
|
+
static inline struct st_table *ROBJECT_IV_INDEX_TBL_inline(VALUE obj);
|
31
|
+
|
32
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
33
|
+
/* object.c (export) */
|
34
|
+
int rb_opts_exception_p(VALUE opts, int default_value);
|
35
|
+
RUBY_SYMBOL_EXPORT_END
|
36
|
+
|
37
|
+
MJIT_SYMBOL_EXPORT_BEGIN
|
38
|
+
CONSTFUNC(VALUE rb_obj_equal(VALUE obj1, VALUE obj2));
|
39
|
+
CONSTFUNC(VALUE rb_obj_not(VALUE obj));
|
40
|
+
VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2);
|
41
|
+
void rb_obj_copy_ivar(VALUE dest, VALUE obj);
|
42
|
+
VALUE rb_false(VALUE obj);
|
43
|
+
VALUE rb_convert_type_with_id(VALUE v, int t, const char* nam, ID mid);
|
44
|
+
VALUE rb_obj_size(VALUE self, VALUE args, VALUE obj);
|
45
|
+
MJIT_SYMBOL_EXPORT_END
|
46
|
+
|
47
|
+
static inline void
|
48
|
+
RBASIC_SET_CLASS_RAW(VALUE obj, VALUE klass)
|
49
|
+
{
|
50
|
+
struct { VALUE flags; VALUE klass; } *ptr = (void *)obj;
|
51
|
+
ptr->klass = klass;
|
52
|
+
}
|
53
|
+
|
54
|
+
static inline void
|
55
|
+
RBASIC_CLEAR_CLASS(VALUE obj)
|
56
|
+
{
|
57
|
+
RBASIC_SET_CLASS_RAW(obj, 0);
|
58
|
+
}
|
59
|
+
|
60
|
+
static inline void
|
61
|
+
RBASIC_SET_CLASS(VALUE obj, VALUE klass)
|
62
|
+
{
|
63
|
+
VALUE oldv = RBASIC_CLASS(obj);
|
64
|
+
RBASIC_SET_CLASS_RAW(obj, klass);
|
65
|
+
RB_OBJ_WRITTEN(obj, oldv, klass);
|
66
|
+
}
|
67
|
+
|
68
|
+
RBIMPL_ATTR_PURE()
|
69
|
+
static inline struct st_table *
|
70
|
+
ROBJECT_IV_INDEX_TBL_inline(VALUE obj)
|
71
|
+
{
|
72
|
+
if (RB_FL_ANY_RAW(obj, ROBJECT_EMBED)) {
|
73
|
+
VALUE klass = rb_obj_class(obj);
|
74
|
+
return RCLASS_IV_INDEX_TBL(klass);
|
75
|
+
}
|
76
|
+
else {
|
77
|
+
const struct RObject *const ptr = ROBJECT(obj);
|
78
|
+
return ptr->as.heap.iv_index_tbl;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
#define ROBJECT_IV_INDEX_TBL ROBJECT_IV_INDEX_TBL_inline
|
82
|
+
|
83
|
+
#endif /* INTERNAL_OBJECT_H */
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#ifndef INTERNAL_PARSE_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_PARSE_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 the parser.
|
11
|
+
*/
|
12
|
+
#include "ruby/ruby.h" /* for VALUE */
|
13
|
+
struct rb_iseq_struct; /* in vm_core.h */
|
14
|
+
|
15
|
+
/* parse.y */
|
16
|
+
VALUE rb_parser_set_yydebug(VALUE, VALUE);
|
17
|
+
void *rb_parser_load_file(VALUE parser, VALUE name);
|
18
|
+
|
19
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
20
|
+
VALUE rb_parser_set_context(VALUE, const struct rb_iseq_struct *, int);
|
21
|
+
RUBY_SYMBOL_EXPORT_END
|
22
|
+
|
23
|
+
#endif /* INTERNAL_PARSE_H */
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#ifndef INTERNAL_PROC_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_PROC_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 Proc.
|
11
|
+
*/
|
12
|
+
#include "ruby/ruby.h" /* for rb_block_call_func_t */
|
13
|
+
#include "ruby/st.h" /* for st_index_t */
|
14
|
+
struct rb_block; /* in vm_core.h */
|
15
|
+
struct rb_iseq_struct; /* in vm_core.h */
|
16
|
+
|
17
|
+
/* proc.c */
|
18
|
+
VALUE rb_proc_location(VALUE self);
|
19
|
+
st_index_t rb_hash_proc(st_index_t hash, VALUE proc);
|
20
|
+
int rb_block_pair_yield_optimizable(void);
|
21
|
+
int rb_block_arity(void);
|
22
|
+
int rb_block_min_max_arity(int *max);
|
23
|
+
VALUE rb_block_to_s(VALUE self, const struct rb_block *block, const char *additional_info);
|
24
|
+
|
25
|
+
MJIT_SYMBOL_EXPORT_BEGIN
|
26
|
+
VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val);
|
27
|
+
VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val, int min_argc, int max_argc);
|
28
|
+
VALUE rb_iseq_location(const struct rb_iseq_struct *iseq);
|
29
|
+
VALUE rb_sym_to_proc(VALUE sym);
|
30
|
+
MJIT_SYMBOL_EXPORT_END
|
31
|
+
|
32
|
+
#endif /* INTERNAL_PROC_H */
|
@@ -0,0 +1,136 @@
|
|
1
|
+
#ifndef INTERNAL_PROCESS_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_PROCESS_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 Process.
|
11
|
+
*/
|
12
|
+
#include "ruby/internal/config.h" /* for rb_pid_t */
|
13
|
+
#include <stddef.h> /* for size_t */
|
14
|
+
|
15
|
+
#ifdef HAVE_SYS_TYPES_H
|
16
|
+
# include <sys/types.h> /* for mode_t */
|
17
|
+
#endif
|
18
|
+
|
19
|
+
#ifdef _WIN32
|
20
|
+
# include "ruby/win32.h" /* for mode_t */
|
21
|
+
#endif
|
22
|
+
|
23
|
+
#include "ruby/ruby.h" /* for VALUE */
|
24
|
+
#include "internal/imemo.h" /* for RB_IMEMO_TMPBUF_PTR */
|
25
|
+
#include "internal/warnings.h" /* for COMPILER_WARNING_PUSH */
|
26
|
+
|
27
|
+
#define RB_MAX_GROUPS (65536)
|
28
|
+
|
29
|
+
struct waitpid_state;
|
30
|
+
struct rb_execarg {
|
31
|
+
union {
|
32
|
+
struct {
|
33
|
+
VALUE shell_script;
|
34
|
+
} sh;
|
35
|
+
struct {
|
36
|
+
VALUE command_name;
|
37
|
+
VALUE command_abspath; /* full path string or nil */
|
38
|
+
VALUE argv_str;
|
39
|
+
VALUE argv_buf;
|
40
|
+
} cmd;
|
41
|
+
} invoke;
|
42
|
+
VALUE redirect_fds;
|
43
|
+
VALUE envp_str;
|
44
|
+
VALUE envp_buf;
|
45
|
+
VALUE dup2_tmpbuf;
|
46
|
+
unsigned use_shell : 1;
|
47
|
+
unsigned pgroup_given : 1;
|
48
|
+
unsigned umask_given : 1;
|
49
|
+
unsigned unsetenv_others_given : 1;
|
50
|
+
unsigned unsetenv_others_do : 1;
|
51
|
+
unsigned close_others_given : 1;
|
52
|
+
unsigned close_others_do : 1;
|
53
|
+
unsigned chdir_given : 1;
|
54
|
+
unsigned new_pgroup_given : 1;
|
55
|
+
unsigned new_pgroup_flag : 1;
|
56
|
+
unsigned uid_given : 1;
|
57
|
+
unsigned gid_given : 1;
|
58
|
+
unsigned exception : 1;
|
59
|
+
unsigned exception_given : 1;
|
60
|
+
struct waitpid_state *waitpid_state; /* for async process management */
|
61
|
+
rb_pid_t pgroup_pgid; /* asis(-1), new pgroup(0), specified pgroup (0<V). */
|
62
|
+
VALUE rlimit_limits; /* Qfalse or [[rtype, softlim, hardlim], ...] */
|
63
|
+
mode_t umask_mask;
|
64
|
+
rb_uid_t uid;
|
65
|
+
rb_gid_t gid;
|
66
|
+
int close_others_maxhint;
|
67
|
+
VALUE fd_dup2;
|
68
|
+
VALUE fd_close;
|
69
|
+
VALUE fd_open;
|
70
|
+
VALUE fd_dup2_child;
|
71
|
+
VALUE env_modification; /* Qfalse or [[k1,v1], ...] */
|
72
|
+
VALUE path_env;
|
73
|
+
VALUE chdir_dir;
|
74
|
+
};
|
75
|
+
|
76
|
+
/* process.c */
|
77
|
+
rb_pid_t rb_fork_ruby(int *status);
|
78
|
+
void rb_last_status_clear(void);
|
79
|
+
static inline char **ARGVSTR2ARGV(VALUE argv_str);
|
80
|
+
static inline size_t ARGVSTR2ARGC(VALUE argv_str);
|
81
|
+
|
82
|
+
#ifdef HAVE_PWD_H
|
83
|
+
VALUE rb_getlogin(void);
|
84
|
+
VALUE rb_getpwdirnam_for_login(VALUE login); /* read as: "get pwd db home dir by username for login" */
|
85
|
+
VALUE rb_getpwdiruid(void); /* read as: "get pwd db home dir for getuid()" */
|
86
|
+
#endif
|
87
|
+
|
88
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
89
|
+
/* process.c (export) */
|
90
|
+
int rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen);
|
91
|
+
rb_pid_t rb_fork_async_signal_safe(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fds, char *errmsg, size_t errmsg_buflen);
|
92
|
+
VALUE rb_execarg_new(int argc, const VALUE *argv, int accept_shell, int allow_exc_opt);
|
93
|
+
struct rb_execarg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
|
94
|
+
int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val);
|
95
|
+
void rb_execarg_parent_start(VALUE execarg_obj);
|
96
|
+
void rb_execarg_parent_end(VALUE execarg_obj);
|
97
|
+
int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char* errmsg, size_t errmsg_buflen);
|
98
|
+
VALUE rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash);
|
99
|
+
void rb_execarg_setenv(VALUE execarg_obj, VALUE env);
|
100
|
+
RUBY_SYMBOL_EXPORT_END
|
101
|
+
|
102
|
+
/* argv_str contains extra two elements.
|
103
|
+
* The beginning one is for /bin/sh used by exec_with_sh.
|
104
|
+
* The last one for terminating NULL used by execve.
|
105
|
+
* See rb_exec_fillarg() in process.c. */
|
106
|
+
static inline char **
|
107
|
+
ARGVSTR2ARGV(VALUE argv_str)
|
108
|
+
{
|
109
|
+
char **buf = RB_IMEMO_TMPBUF_PTR(argv_str);
|
110
|
+
return &buf[1];
|
111
|
+
}
|
112
|
+
|
113
|
+
static inline size_t
|
114
|
+
ARGVSTR2ARGC(VALUE argv_str)
|
115
|
+
{
|
116
|
+
size_t i = 0;
|
117
|
+
char *const *p = ARGVSTR2ARGV(argv_str);
|
118
|
+
while (p[i++])
|
119
|
+
;
|
120
|
+
return i - 1;
|
121
|
+
}
|
122
|
+
|
123
|
+
#ifdef HAVE_WORKING_FORK
|
124
|
+
COMPILER_WARNING_PUSH
|
125
|
+
#if __has_warning("-Wdeprecated-declarations") || RBIMPL_COMPILER_IS(GCC)
|
126
|
+
COMPILER_WARNING_IGNORED(-Wdeprecated-declarations)
|
127
|
+
#endif
|
128
|
+
static inline rb_pid_t
|
129
|
+
rb_fork(void)
|
130
|
+
{
|
131
|
+
return fork();
|
132
|
+
}
|
133
|
+
COMPILER_WARNING_POP
|
134
|
+
#endif
|
135
|
+
|
136
|
+
#endif /* INTERNAL_PROCESS_H */
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#ifndef INTERNAL_RANDOM_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_RANDOM_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 Random.
|
11
|
+
*/
|
12
|
+
#include <stddef.h> /* for size_t */
|
13
|
+
|
14
|
+
/* random.c */
|
15
|
+
int ruby_fill_random_bytes(void *, size_t, int);
|
16
|
+
|
17
|
+
#endif /* INTERNAL_RANDOM_H */
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#ifndef INTERNAL_RANGE_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_RANGE_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 Range.
|
11
|
+
*/
|
12
|
+
#include "internal/struct.h" /* for RSTRUCT */
|
13
|
+
|
14
|
+
/* range.c */
|
15
|
+
static inline VALUE RANGE_BEG(VALUE r);
|
16
|
+
static inline VALUE RANGE_END(VALUE r);
|
17
|
+
static inline VALUE RANGE_EXCL(VALUE r);
|
18
|
+
|
19
|
+
static inline VALUE
|
20
|
+
RANGE_BEG(VALUE r)
|
21
|
+
{
|
22
|
+
return RSTRUCT(r)->as.ary[0];
|
23
|
+
}
|
24
|
+
|
25
|
+
static inline VALUE
|
26
|
+
RANGE_END(VALUE r)
|
27
|
+
{
|
28
|
+
return RSTRUCT(r)->as.ary[1];
|
29
|
+
}
|
30
|
+
|
31
|
+
static inline VALUE
|
32
|
+
RANGE_EXCL(VALUE r)
|
33
|
+
{
|
34
|
+
return RSTRUCT(r)->as.ary[2];
|
35
|
+
}
|
36
|
+
|
37
|
+
#endif /* INTERNAL_RANGE_H */
|
@@ -0,0 +1,69 @@
|
|
1
|
+
#ifndef INTERNAL_RATIONAL_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_RATIONAL_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 Rational.
|
11
|
+
*/
|
12
|
+
#include "ruby/internal/config.h" /* for HAVE_LIBGMP */
|
13
|
+
#include "ruby/ruby.h" /* for struct RBasic */
|
14
|
+
#include "internal/gc.h" /* for RB_OBJ_WRITE */
|
15
|
+
#include "internal/numeric.h" /* for INT_POSITIVE_P */
|
16
|
+
#include "ruby_assert.h" /* for assert */
|
17
|
+
|
18
|
+
struct RRational {
|
19
|
+
struct RBasic basic;
|
20
|
+
VALUE num;
|
21
|
+
VALUE den;
|
22
|
+
};
|
23
|
+
|
24
|
+
#define RRATIONAL(obj) ((struct RRational *)(obj))
|
25
|
+
|
26
|
+
/* rational.c */
|
27
|
+
VALUE rb_rational_canonicalize(VALUE x);
|
28
|
+
VALUE rb_rational_uminus(VALUE self);
|
29
|
+
VALUE rb_rational_plus(VALUE self, VALUE other);
|
30
|
+
VALUE rb_rational_minus(VALUE self, VALUE other);
|
31
|
+
VALUE rb_rational_mul(VALUE self, VALUE other);
|
32
|
+
VALUE rb_lcm(VALUE x, VALUE y);
|
33
|
+
VALUE rb_rational_reciprocal(VALUE x);
|
34
|
+
VALUE rb_cstr_to_rat(const char *, int);
|
35
|
+
VALUE rb_rational_abs(VALUE self);
|
36
|
+
VALUE rb_rational_cmp(VALUE self, VALUE other);
|
37
|
+
VALUE rb_rational_pow(VALUE self, VALUE other);
|
38
|
+
VALUE rb_numeric_quo(VALUE x, VALUE y);
|
39
|
+
VALUE rb_float_numerator(VALUE x);
|
40
|
+
VALUE rb_float_denominator(VALUE x);
|
41
|
+
|
42
|
+
static inline void RATIONAL_SET_NUM(VALUE r, VALUE n);
|
43
|
+
static inline void RATIONAL_SET_DEN(VALUE r, VALUE d);
|
44
|
+
|
45
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
46
|
+
/* rational.c (export) */
|
47
|
+
VALUE rb_gcd(VALUE x, VALUE y);
|
48
|
+
VALUE rb_gcd_normal(VALUE self, VALUE other);
|
49
|
+
#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
|
50
|
+
VALUE rb_gcd_gmp(VALUE x, VALUE y);
|
51
|
+
#endif
|
52
|
+
RUBY_SYMBOL_EXPORT_END
|
53
|
+
|
54
|
+
static inline void
|
55
|
+
RATIONAL_SET_NUM(VALUE r, VALUE n)
|
56
|
+
{
|
57
|
+
assert(RB_INTEGER_TYPE_P(n));
|
58
|
+
RB_OBJ_WRITE(r, &RRATIONAL(r)->num, n);
|
59
|
+
}
|
60
|
+
|
61
|
+
static inline void
|
62
|
+
RATIONAL_SET_DEN(VALUE r, VALUE d)
|
63
|
+
{
|
64
|
+
assert(RB_INTEGER_TYPE_P(d));
|
65
|
+
assert(INT_POSITIVE_P(d));
|
66
|
+
RB_OBJ_WRITE(r, &RRATIONAL(r)->den, d);
|
67
|
+
}
|
68
|
+
|
69
|
+
#endif /* INTERNAL_RATIONAL_H */
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#ifndef INTERNAL_RE_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_RE_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 Regexp.
|
11
|
+
*/
|
12
|
+
#include "ruby/internal/stdbool.h" /* for bool */
|
13
|
+
#include "ruby/ruby.h" /* for VALUE */
|
14
|
+
|
15
|
+
/* re.c */
|
16
|
+
VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline);
|
17
|
+
VALUE rb_reg_check_preprocess(VALUE);
|
18
|
+
long rb_reg_search0(VALUE, VALUE, long, int, int);
|
19
|
+
VALUE rb_reg_match_p(VALUE re, VALUE str, long pos);
|
20
|
+
bool rb_reg_start_with_p(VALUE re, VALUE str);
|
21
|
+
void rb_backref_set_string(VALUE string, long pos, long len);
|
22
|
+
void rb_match_unbusy(VALUE);
|
23
|
+
int rb_match_count(VALUE match);
|
24
|
+
int rb_match_nth_defined(int nth, VALUE match);
|
25
|
+
MJIT_SYMBOL_EXPORT_BEGIN
|
26
|
+
VALUE rb_reg_new_ary(VALUE ary, int options);
|
27
|
+
MJIT_SYMBOL_EXPORT_END
|
28
|
+
|
29
|
+
#endif /* INTERNAL_RE_H */
|
@@ -0,0 +1,191 @@
|
|
1
|
+
#ifndef INTERNAL_SANITIZERS_H /*-*-C-*-vi:se ft=c:*/
|
2
|
+
#define INTERNAL_SANITIZERS_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 ASAN / MSAN / etc.
|
11
|
+
*/
|
12
|
+
#include "ruby/internal/config.h"
|
13
|
+
#include "internal/compilers.h" /* for __has_feature */
|
14
|
+
|
15
|
+
#ifdef HAVE_VALGRIND_MEMCHECK_H
|
16
|
+
# include <valgrind/memcheck.h>
|
17
|
+
#endif
|
18
|
+
|
19
|
+
#ifdef HAVE_SANITIZER_ASAN_INTERFACE_H
|
20
|
+
# include <sanitizer/asan_interface.h>
|
21
|
+
#endif
|
22
|
+
|
23
|
+
#ifdef HAVE_SANITIZER_MSAN_INTERFACE_H
|
24
|
+
# if __has_feature(memory_sanitizer)
|
25
|
+
# include <sanitizer/msan_interface.h>
|
26
|
+
# endif
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#include "ruby/internal/stdbool.h" /* for bool */
|
30
|
+
#include "ruby/ruby.h" /* for VALUE */
|
31
|
+
|
32
|
+
#if 0
|
33
|
+
#elif __has_feature(memory_sanitizer) && __has_feature(address_sanitizer)
|
34
|
+
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
|
35
|
+
__attribute__((__no_sanitize__("memory, address"), __noinline__)) x
|
36
|
+
#elif __has_feature(address_sanitizer)
|
37
|
+
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
|
38
|
+
__attribute__((__no_sanitize__("address"), __noinline__)) x
|
39
|
+
#elif defined(NO_SANITIZE_ADDRESS)
|
40
|
+
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
|
41
|
+
NO_SANITIZE_ADDRESS(NOINLINE(x))
|
42
|
+
#elif defined(NO_ADDRESS_SAFETY_ANALYSIS)
|
43
|
+
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
|
44
|
+
NO_ADDRESS_SAFETY_ANALYSIS(NOINLINE(x))
|
45
|
+
#else
|
46
|
+
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) x
|
47
|
+
#endif
|
48
|
+
|
49
|
+
#if defined(NO_SANITIZE) && RBIMPL_COMPILER_IS(GCC)
|
50
|
+
/* GCC warns about unknown sanitizer, which is annoying. */
|
51
|
+
# include "internal/warnings.h"
|
52
|
+
# undef NO_SANITIZE
|
53
|
+
# define NO_SANITIZE(x, y) \
|
54
|
+
COMPILER_WARNING_PUSH; \
|
55
|
+
COMPILER_WARNING_IGNORED(-Wattributes); \
|
56
|
+
__attribute__((__no_sanitize__(x))) y; \
|
57
|
+
COMPILER_WARNING_POP
|
58
|
+
#endif
|
59
|
+
|
60
|
+
#ifndef NO_SANITIZE
|
61
|
+
# define NO_SANITIZE(x, y) y
|
62
|
+
#endif
|
63
|
+
|
64
|
+
#if !__has_feature(address_sanitizer)
|
65
|
+
# define __asan_poison_memory_region(x, y)
|
66
|
+
# define __asan_unpoison_memory_region(x, y)
|
67
|
+
# define __asan_region_is_poisoned(x, y) 0
|
68
|
+
#endif
|
69
|
+
|
70
|
+
#if !__has_feature(memory_sanitizer)
|
71
|
+
# define __msan_allocated_memory(x, y) ((void)(x), (void)(y))
|
72
|
+
# define __msan_poison(x, y) ((void)(x), (void)(y))
|
73
|
+
# define __msan_unpoison(x, y) ((void)(x), (void)(y))
|
74
|
+
# define __msan_unpoison_string(x) ((void)(x))
|
75
|
+
#endif
|
76
|
+
|
77
|
+
#ifdef VALGRIND_MAKE_READABLE
|
78
|
+
# define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE((p), (n))
|
79
|
+
#endif
|
80
|
+
|
81
|
+
#ifdef VALGRIND_MAKE_WRITABLE
|
82
|
+
# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n))
|
83
|
+
#endif
|
84
|
+
|
85
|
+
#ifndef VALGRIND_MAKE_MEM_DEFINED
|
86
|
+
# define VALGRIND_MAKE_MEM_DEFINED(p, n) 0
|
87
|
+
#endif
|
88
|
+
|
89
|
+
#ifndef VALGRIND_MAKE_MEM_UNDEFINED
|
90
|
+
# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
|
91
|
+
#endif
|
92
|
+
|
93
|
+
#ifndef MJIT_HEADER
|
94
|
+
|
95
|
+
/*!
|
96
|
+
* This function asserts that a (continuous) memory region from ptr to size
|
97
|
+
* being "poisoned". Both read / write access to such memory region are
|
98
|
+
* prohibited until properly unpoisoned. The region must be previously
|
99
|
+
* allocated (do not pass a freed pointer here), but not necessarily be an
|
100
|
+
* entire object that the malloc returns. You can punch hole a part of a
|
101
|
+
* gigantic heap arena. This is handy when you do not free an allocated memory
|
102
|
+
* region to reuse later: poison when you keep it unused, and unpoison when you
|
103
|
+
* reuse.
|
104
|
+
*
|
105
|
+
* \param[in] ptr pointer to the beginning of the memory region to poison.
|
106
|
+
* \param[in] size the length of the memory region to poison.
|
107
|
+
*/
|
108
|
+
static inline void
|
109
|
+
asan_poison_memory_region(const volatile void *ptr, size_t size)
|
110
|
+
{
|
111
|
+
__msan_poison(ptr, size);
|
112
|
+
__asan_poison_memory_region(ptr, size);
|
113
|
+
}
|
114
|
+
|
115
|
+
/*!
|
116
|
+
* This is a variant of asan_poison_memory_region that takes a VALUE.
|
117
|
+
*
|
118
|
+
* \param[in] obj target object.
|
119
|
+
*/
|
120
|
+
static inline void
|
121
|
+
asan_poison_object(VALUE obj)
|
122
|
+
{
|
123
|
+
MAYBE_UNUSED(struct RVALUE *) ptr = (void *)obj;
|
124
|
+
asan_poison_memory_region(ptr, SIZEOF_VALUE);
|
125
|
+
}
|
126
|
+
|
127
|
+
#if !__has_feature(address_sanitizer)
|
128
|
+
#define asan_poison_object_if(ptr, obj) ((void)(ptr), (void)(obj))
|
129
|
+
#else
|
130
|
+
#define asan_poison_object_if(ptr, obj) do { \
|
131
|
+
if (ptr) asan_poison_object(obj); \
|
132
|
+
} while (0)
|
133
|
+
#endif
|
134
|
+
|
135
|
+
/*!
|
136
|
+
* This function predicates if the given object is fully addressable or not.
|
137
|
+
*
|
138
|
+
* \param[in] obj target object.
|
139
|
+
* \retval 0 the given object is fully addressable.
|
140
|
+
* \retval otherwise pointer to first such byte who is poisoned.
|
141
|
+
*/
|
142
|
+
static inline void *
|
143
|
+
asan_poisoned_object_p(VALUE obj)
|
144
|
+
{
|
145
|
+
MAYBE_UNUSED(struct RVALUE *) ptr = (void *)obj;
|
146
|
+
return __asan_region_is_poisoned(ptr, SIZEOF_VALUE);
|
147
|
+
}
|
148
|
+
|
149
|
+
/*!
|
150
|
+
* This function asserts that a (formally poisoned) memory region from ptr to
|
151
|
+
* size is now addressable. Write access to such memory region gets allowed.
|
152
|
+
* However read access might or might not be possible depending on situations,
|
153
|
+
* because the region can have contents of previous usages. That information
|
154
|
+
* should be passed by the malloc_p flag. If that is true, the contents of the
|
155
|
+
* region is _not_ fully defined (like the return value of malloc behaves).
|
156
|
+
* Reading from there is NG; write something first. If malloc_p is false on
|
157
|
+
* the other hand, that memory region is fully defined and can be read
|
158
|
+
* immediately.
|
159
|
+
*
|
160
|
+
* \param[in] ptr pointer to the beginning of the memory region to unpoison.
|
161
|
+
* \param[in] size the length of the memory region.
|
162
|
+
* \param[in] malloc_p if the memory region is like a malloc's return value or not.
|
163
|
+
*/
|
164
|
+
static inline void
|
165
|
+
asan_unpoison_memory_region(const volatile void *ptr, size_t size, bool malloc_p)
|
166
|
+
{
|
167
|
+
__asan_unpoison_memory_region(ptr, size);
|
168
|
+
if (malloc_p) {
|
169
|
+
__msan_allocated_memory(ptr, size);
|
170
|
+
}
|
171
|
+
else {
|
172
|
+
__msan_unpoison(ptr, size);
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
/*!
|
177
|
+
* This is a variant of asan_unpoison_memory_region that takes a VALUE.
|
178
|
+
*
|
179
|
+
* \param[in] obj target object.
|
180
|
+
* \param[in] malloc_p if the memory region is like a malloc's return value or not.
|
181
|
+
*/
|
182
|
+
static inline void
|
183
|
+
asan_unpoison_object(VALUE obj, bool newobj_p)
|
184
|
+
{
|
185
|
+
MAYBE_UNUSED(struct RVALUE *) ptr = (void *)obj;
|
186
|
+
asan_unpoison_memory_region(ptr, SIZEOF_VALUE, newobj_p);
|
187
|
+
}
|
188
|
+
|
189
|
+
#endif /* MJIT_HEADER */
|
190
|
+
|
191
|
+
#endif /* INTERNAL_SANITIZERS_H */
|