datadog-ruby_core_source 3.5.4 → 3.5.5
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/datadog-ruby_core_source.gemspec +1 -1
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/build_assert/build_assert.h +40 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/check_type/check_type.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/container_of/container_of.h +142 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/list/list.h +788 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ccan/str/str.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/id.h +252 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/internal.h +2465 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/iseq.h +304 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/method.h +229 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/node.h +449 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ruby_assert.h +60 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/ruby_atomic.h +244 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/thread_pthread.h +75 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/thread_win32.h +36 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/vm_core.h +1902 -0
- data/lib/datadog/ruby_core_source/ruby-2.6.0-p0/vm_opts.h +70 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/build_assert/build_assert.h +40 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/check_type/check_type.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/container_of/container_of.h +142 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/list/list.h +788 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ccan/str/str.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/id.h +290 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/internal.h +2697 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/iseq.h +312 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/method.h +229 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/node.h +476 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ruby_assert.h +15 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/ruby_atomic.h +244 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/thread_pthread.h +75 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/thread_win32.h +36 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/vm_core.h +1968 -0
- data/lib/datadog/ruby_core_source/ruby-2.7.0-p0/vm_opts.h +72 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/build_assert/build_assert.h +40 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/check_type/check_type.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/container_of/container_of.h +142 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/list/list.h +788 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ccan/str/str.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/id.h +290 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/id_table.h +36 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/array.h +119 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/class.h +174 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/compilers.h +108 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/gc.h +161 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/imemo.h +243 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/serial.h +24 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/static_assert.h +17 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/vm.h +136 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal/warnings.h +17 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/internal.h +107 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/iseq.h +305 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/method.h +245 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/node.h +484 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ractor_core.h +343 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ruby_assert.h +15 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/ruby_atomic.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/thread_pthread.h +115 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/thread_win32.h +61 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/vm_core.h +2023 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/vm_debug.h +116 -0
- data/lib/datadog/ruby_core_source/ruby-3.0.0-p0/vm_opts.h +73 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/build_assert/build_assert.h +40 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/check_type/check_type.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/container_of/container_of.h +142 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/list/list.h +788 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ccan/str/str.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/darray.h +198 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/id.h +293 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/id_table.h +36 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/array.h +113 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/class.h +196 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/compilers.h +107 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/gc.h +186 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/imemo.h +243 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/serial.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/static_assert.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/vm.h +133 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal/warnings.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/internal.h +109 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/iseq.h +322 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/method.h +253 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/node.h +510 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ractor_core.h +346 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ruby_assert.h +14 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/ruby_atomic.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/thread_pthread.h +115 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/vm_core.h +2107 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/vm_debug.h +124 -0
- data/lib/datadog/ruby_core_source/ruby-3.1.0-p0/vm_opts.h +73 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/build_assert/build_assert.h +40 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/check_type/check_type.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/container_of/container_of.h +142 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/list/list.h +789 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ccan/str/str.h +17 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/id.h +299 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/id_table.h +39 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/array.h +163 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/basic_operators.h +64 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/class.h +182 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/compilers.h +107 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/gc.h +192 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/imemo.h +242 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/serial.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/static_assert.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/vm.h +134 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal/warnings.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/internal.h +113 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/iseq.h +329 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/method.h +254 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/node.h +514 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ractor_core.h +342 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ruby_assert.h +14 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/ruby_atomic.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/shape.h +232 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/thread_none.h +20 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/thread_pthread.h +133 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/vm_core.h +2106 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/vm_debug.h +122 -0
- data/lib/datadog/ruby_core_source/ruby-3.2.0-p0/vm_opts.h +73 -0
- data/lib/datadog/ruby_core_source/version.rb +1 -1
- metadata +122 -4
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#ifndef INTERNAL_COMPILERS_H /*-*-C-*-vi:se ft=c:*/
|
|
2
|
+
#define INTERNAL_COMPILERS_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 absorbing C compipler differences.
|
|
11
|
+
*/
|
|
12
|
+
#include "ruby/internal/compiler_since.h"
|
|
13
|
+
#include "ruby/internal/has/attribute.h"
|
|
14
|
+
#include "ruby/internal/has/builtin.h"
|
|
15
|
+
#include "ruby/internal/has/c_attribute.h"
|
|
16
|
+
#include "ruby/internal/has/declspec_attribute.h"
|
|
17
|
+
#include "ruby/internal/has/extension.h"
|
|
18
|
+
#include "ruby/internal/has/feature.h"
|
|
19
|
+
#include "ruby/internal/has/warning.h"
|
|
20
|
+
#include "ruby/backward/2/gcc_version_since.h"
|
|
21
|
+
|
|
22
|
+
#define MSC_VERSION_SINCE(_) RBIMPL_COMPILER_SINCE(MSVC, (_) / 100, (_) % 100, 0)
|
|
23
|
+
#define MSC_VERSION_BEFORE(_) RBIMPL_COMPILER_BEFORE(MSVC, (_) / 100, (_) % 100, 0)
|
|
24
|
+
|
|
25
|
+
#ifndef __has_attribute
|
|
26
|
+
# define __has_attribute(...) RBIMPL_HAS_ATTRIBUTE(__VA_ARGS__)
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
#ifndef __has_c_attribute
|
|
30
|
+
# /* As of writing everything that lacks __has_c_attribute also completely
|
|
31
|
+
# * lacks C2x attributes as well. Might change in future? */
|
|
32
|
+
# define __has_c_attribute(...) 0
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
#ifndef __has_declspec_attribute
|
|
36
|
+
# define __has_declspec_attribute(...) RBIMPL_HAS_DECLSPEC_ATTRIBUTE(__VA_ARGS__)
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
#ifndef __has_builtin
|
|
40
|
+
# define __has_builtin(...) RBIMPL_HAS_BUILTIN(__VA_ARGS__)
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#ifndef __has_feature
|
|
44
|
+
# define __has_feature(...) RBIMPL_HAS_FEATURE(__VA_ARGS__)
|
|
45
|
+
#endif
|
|
46
|
+
|
|
47
|
+
#ifndef __has_extension
|
|
48
|
+
# define __has_extension(...) RBIMPL_HAS_EXTENSION(__VA_ARGS__)
|
|
49
|
+
#endif
|
|
50
|
+
|
|
51
|
+
#ifndef __has_warning
|
|
52
|
+
# define __has_warning(...) RBIMPL_HAS_WARNING(__VA_ARGS__)
|
|
53
|
+
#endif
|
|
54
|
+
|
|
55
|
+
#ifndef __GNUC__
|
|
56
|
+
# define __extension__ /* void */
|
|
57
|
+
#endif
|
|
58
|
+
|
|
59
|
+
#ifndef MAYBE_UNUSED
|
|
60
|
+
# define MAYBE_UNUSED(x) x
|
|
61
|
+
#endif
|
|
62
|
+
|
|
63
|
+
#ifndef WARN_UNUSED_RESULT
|
|
64
|
+
# define WARN_UNUSED_RESULT(x) x
|
|
65
|
+
#endif
|
|
66
|
+
|
|
67
|
+
#define RB_OBJ_BUILTIN_TYPE(obj) rb_obj_builtin_type(obj)
|
|
68
|
+
#define OBJ_BUILTIN_TYPE(obj) RB_OBJ_BUILTIN_TYPE(obj)
|
|
69
|
+
#ifdef __GNUC__
|
|
70
|
+
#define rb_obj_builtin_type(obj) \
|
|
71
|
+
__extension__({ \
|
|
72
|
+
VALUE arg_obj = (obj); \
|
|
73
|
+
RB_SPECIAL_CONST_P(arg_obj) ? -1 : \
|
|
74
|
+
(int)RB_BUILTIN_TYPE(arg_obj); \
|
|
75
|
+
})
|
|
76
|
+
#else
|
|
77
|
+
# include "ruby/ruby.h"
|
|
78
|
+
static inline int
|
|
79
|
+
rb_obj_builtin_type(VALUE obj)
|
|
80
|
+
{
|
|
81
|
+
return RB_SPECIAL_CONST_P(obj) ? -1 :
|
|
82
|
+
(int)RB_BUILTIN_TYPE(obj);
|
|
83
|
+
}
|
|
84
|
+
#endif
|
|
85
|
+
|
|
86
|
+
/* A macro for defining a flexible array, like: VALUE ary[FLEX_ARY_LEN]; */
|
|
87
|
+
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
|
88
|
+
# define FLEX_ARY_LEN /* VALUE ary[]; */
|
|
89
|
+
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
|
90
|
+
# define FLEX_ARY_LEN 0 /* VALUE ary[0]; */
|
|
91
|
+
#else
|
|
92
|
+
# define FLEX_ARY_LEN 1 /* VALUE ary[1]; */
|
|
93
|
+
#endif
|
|
94
|
+
|
|
95
|
+
/*
|
|
96
|
+
* For declaring bitfields out of non-unsigned int types:
|
|
97
|
+
* struct date {
|
|
98
|
+
* BITFIELD(enum months, month, 4);
|
|
99
|
+
* ...
|
|
100
|
+
* };
|
|
101
|
+
*/
|
|
102
|
+
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
|
103
|
+
# define BITFIELD(type, name, size) type name : size
|
|
104
|
+
#else
|
|
105
|
+
# define BITFIELD(type, name, size) unsigned int name : size
|
|
106
|
+
#endif
|
|
107
|
+
|
|
108
|
+
#endif /* INTERNAL_COMPILERS_H */
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#ifndef INTERNAL_GC_H /*-*-C-*-vi:se ft=c:*/
|
|
2
|
+
#define INTERNAL_GC_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 GC.
|
|
11
|
+
*/
|
|
12
|
+
#include "ruby/internal/config.h"
|
|
13
|
+
|
|
14
|
+
#include <stddef.h> /* for size_t */
|
|
15
|
+
|
|
16
|
+
#include "internal/compilers.h" /* for __has_attribute */
|
|
17
|
+
#include "ruby/ruby.h" /* for rb_event_flag_t */
|
|
18
|
+
|
|
19
|
+
struct rb_execution_context_struct; /* in vm_core.h */
|
|
20
|
+
struct rb_objspace; /* in vm_core.h */
|
|
21
|
+
|
|
22
|
+
#ifdef NEWOBJ_OF
|
|
23
|
+
# undef NEWOBJ_OF
|
|
24
|
+
# undef RB_NEWOBJ_OF
|
|
25
|
+
# undef RB_OBJ_WRITE
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
/* optimized version of NEWOBJ() */
|
|
29
|
+
#define RB_NEWOBJ_OF(var, T, c, f) \
|
|
30
|
+
T *(var) = (T *)(((f) & FL_WB_PROTECTED) ? \
|
|
31
|
+
rb_wb_protected_newobj_of((c), (f) & ~FL_WB_PROTECTED) : \
|
|
32
|
+
rb_wb_unprotected_newobj_of((c), (f)))
|
|
33
|
+
|
|
34
|
+
#define RB_EC_NEWOBJ_OF(ec, var, T, c, f) \
|
|
35
|
+
T *(var) = (T *)(((f) & FL_WB_PROTECTED) ? \
|
|
36
|
+
rb_ec_wb_protected_newobj_of((ec), (c), (f) & ~FL_WB_PROTECTED) : \
|
|
37
|
+
rb_wb_unprotected_newobj_of((c), (f)))
|
|
38
|
+
|
|
39
|
+
#define NEWOBJ_OF(var, T, c, f) RB_NEWOBJ_OF((var), T, (c), (f))
|
|
40
|
+
#define RB_OBJ_GC_FLAGS_MAX 6 /* used in ext/objspace */
|
|
41
|
+
|
|
42
|
+
#ifndef USE_UNALIGNED_MEMBER_ACCESS
|
|
43
|
+
# define UNALIGNED_MEMBER_ACCESS(expr) (expr)
|
|
44
|
+
#elif ! USE_UNALIGNED_MEMBER_ACCESS
|
|
45
|
+
# define UNALIGNED_MEMBER_ACCESS(expr) (expr)
|
|
46
|
+
#elif ! (__has_warning("-Waddress-of-packed-member") || GCC_VERSION_SINCE(9, 0, 0))
|
|
47
|
+
# define UNALIGNED_MEMBER_ACCESS(expr) (expr)
|
|
48
|
+
#else
|
|
49
|
+
# include "internal/warnings.h"
|
|
50
|
+
# define UNALIGNED_MEMBER_ACCESS(expr) __extension__({ \
|
|
51
|
+
COMPILER_WARNING_PUSH; \
|
|
52
|
+
COMPILER_WARNING_IGNORED(-Waddress-of-packed-member); \
|
|
53
|
+
__typeof__(expr) unaligned_member_access_result = (expr); \
|
|
54
|
+
COMPILER_WARNING_POP; \
|
|
55
|
+
unaligned_member_access_result; \
|
|
56
|
+
})
|
|
57
|
+
#endif
|
|
58
|
+
|
|
59
|
+
#define UNALIGNED_MEMBER_PTR(ptr, mem) UNALIGNED_MEMBER_ACCESS(&(ptr)->mem)
|
|
60
|
+
#define RB_OBJ_WRITE(a, slot, b) \
|
|
61
|
+
rb_obj_write((VALUE)(a), UNALIGNED_MEMBER_ACCESS((VALUE *)(slot)), \
|
|
62
|
+
(VALUE)(b), __FILE__, __LINE__)
|
|
63
|
+
|
|
64
|
+
/* gc.c */
|
|
65
|
+
extern VALUE *ruby_initial_gc_stress_ptr;
|
|
66
|
+
extern int ruby_disable_gc;
|
|
67
|
+
RUBY_ATTR_MALLOC void *ruby_mimmalloc(size_t size);
|
|
68
|
+
void ruby_mimfree(void *ptr);
|
|
69
|
+
void rb_objspace_set_event_hook(const rb_event_flag_t event);
|
|
70
|
+
VALUE rb_objspace_gc_enable(struct rb_objspace *);
|
|
71
|
+
VALUE rb_objspace_gc_disable(struct rb_objspace *);
|
|
72
|
+
void ruby_gc_set_params(void);
|
|
73
|
+
void rb_copy_wb_protected_attribute(VALUE dest, VALUE obj);
|
|
74
|
+
#if __has_attribute(alloc_align)
|
|
75
|
+
__attribute__((__alloc_align__(1)))
|
|
76
|
+
#endif
|
|
77
|
+
RUBY_ATTR_MALLOC void *rb_aligned_malloc(size_t, size_t) RUBY_ATTR_ALLOC_SIZE((2));
|
|
78
|
+
size_t rb_size_mul_or_raise(size_t, size_t, VALUE); /* used in compile.c */
|
|
79
|
+
size_t rb_size_mul_add_or_raise(size_t, size_t, size_t, VALUE); /* used in iseq.h */
|
|
80
|
+
RUBY_ATTR_MALLOC void *rb_xmalloc_mul_add(size_t, size_t, size_t);
|
|
81
|
+
void *rb_xrealloc_mul_add(const void *, size_t, size_t, size_t);
|
|
82
|
+
RUBY_ATTR_MALLOC void *rb_xmalloc_mul_add_mul(size_t, size_t, size_t, size_t);
|
|
83
|
+
RUBY_ATTR_MALLOC void *rb_xcalloc_mul_add_mul(size_t, size_t, size_t, size_t);
|
|
84
|
+
static inline void *ruby_sized_xrealloc_inlined(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2));
|
|
85
|
+
static inline void *ruby_sized_xrealloc2_inlined(void *ptr, size_t new_count, size_t elemsiz, size_t old_count) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2, 3));
|
|
86
|
+
static inline void ruby_sized_xfree_inlined(void *ptr, size_t size);
|
|
87
|
+
VALUE rb_class_allocate_instance(VALUE klass);
|
|
88
|
+
|
|
89
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
|
90
|
+
/* gc.c (export) */
|
|
91
|
+
const char *rb_objspace_data_type_name(VALUE obj);
|
|
92
|
+
VALUE rb_wb_protected_newobj_of(VALUE, VALUE);
|
|
93
|
+
VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE);
|
|
94
|
+
VALUE rb_ec_wb_protected_newobj_of(struct rb_execution_context_struct *ec, VALUE klass, VALUE flags);
|
|
95
|
+
size_t rb_obj_memsize_of(VALUE);
|
|
96
|
+
void rb_gc_verify_internal_consistency(void);
|
|
97
|
+
size_t rb_obj_gc_flags(VALUE, ID[], size_t);
|
|
98
|
+
void rb_gc_mark_values(long n, const VALUE *values);
|
|
99
|
+
void rb_gc_mark_vm_stack_values(long n, const VALUE *values);
|
|
100
|
+
void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2));
|
|
101
|
+
void *ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2, 3));
|
|
102
|
+
void ruby_sized_xfree(void *x, size_t size);
|
|
103
|
+
RUBY_SYMBOL_EXPORT_END
|
|
104
|
+
|
|
105
|
+
MJIT_SYMBOL_EXPORT_BEGIN
|
|
106
|
+
int rb_ec_stack_check(struct rb_execution_context_struct *ec);
|
|
107
|
+
void rb_gc_writebarrier_remember(VALUE obj);
|
|
108
|
+
const char *rb_obj_info(VALUE obj);
|
|
109
|
+
MJIT_SYMBOL_EXPORT_END
|
|
110
|
+
|
|
111
|
+
#if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32)
|
|
112
|
+
|
|
113
|
+
static inline void *
|
|
114
|
+
ruby_sized_xrealloc_inlined(void *ptr, size_t new_size, size_t old_size)
|
|
115
|
+
{
|
|
116
|
+
return ruby_xrealloc(ptr, new_size);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
static inline void *
|
|
120
|
+
ruby_sized_xrealloc2_inlined(void *ptr, size_t new_count, size_t elemsiz, size_t old_count)
|
|
121
|
+
{
|
|
122
|
+
return ruby_xrealloc2(ptr, new_count, elemsiz);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
static inline void
|
|
126
|
+
ruby_sized_xfree_inlined(void *ptr, size_t size)
|
|
127
|
+
{
|
|
128
|
+
ruby_xfree(ptr);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
# define SIZED_REALLOC_N(x, y, z, w) REALLOC_N(x, y, z)
|
|
132
|
+
|
|
133
|
+
#else
|
|
134
|
+
|
|
135
|
+
static inline void *
|
|
136
|
+
ruby_sized_xrealloc_inlined(void *ptr, size_t new_size, size_t old_size)
|
|
137
|
+
{
|
|
138
|
+
return ruby_sized_xrealloc(ptr, new_size, old_size);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static inline void *
|
|
142
|
+
ruby_sized_xrealloc2_inlined(void *ptr, size_t new_count, size_t elemsiz, size_t old_count)
|
|
143
|
+
{
|
|
144
|
+
return ruby_sized_xrealloc2(ptr, new_count, elemsiz, old_count);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
static inline void
|
|
148
|
+
ruby_sized_xfree_inlined(void *ptr, size_t size)
|
|
149
|
+
{
|
|
150
|
+
ruby_sized_xfree(ptr, size);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
# define SIZED_REALLOC_N(v, T, m, n) \
|
|
154
|
+
((v) = (T *)ruby_sized_xrealloc2((void *)(v), (m), sizeof(T), (n)))
|
|
155
|
+
|
|
156
|
+
#endif /* HAVE_MALLOC_USABLE_SIZE */
|
|
157
|
+
|
|
158
|
+
#define ruby_sized_xrealloc ruby_sized_xrealloc_inlined
|
|
159
|
+
#define ruby_sized_xrealloc2 ruby_sized_xrealloc2_inlined
|
|
160
|
+
#define ruby_sized_xfree ruby_sized_xfree_inlined
|
|
161
|
+
#endif /* INTERNAL_GC_H */
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
#ifndef INTERNAL_IMEMO_H /*-*-C-*-vi:se ft=c:*/
|
|
2
|
+
#define INTERNAL_IMEMO_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 IMEMO: Internal memo object.
|
|
11
|
+
*/
|
|
12
|
+
#include "ruby/internal/config.h"
|
|
13
|
+
#include <stddef.h> /* for size_t */
|
|
14
|
+
#include "internal/array.h" /* for rb_ary_tmp_new_fill */
|
|
15
|
+
#include "internal/gc.h" /* for RB_OBJ_WRITE */
|
|
16
|
+
#include "ruby/internal/stdbool.h" /* for bool */
|
|
17
|
+
#include "ruby/ruby.h" /* for rb_block_call_func_t */
|
|
18
|
+
|
|
19
|
+
#ifndef IMEMO_DEBUG
|
|
20
|
+
# define IMEMO_DEBUG 0
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
#define IMEMO_MASK 0x0f
|
|
24
|
+
|
|
25
|
+
/* FL_USER0 to FL_USER3 is for type */
|
|
26
|
+
#define IMEMO_FL_USHIFT (FL_USHIFT + 4)
|
|
27
|
+
#define IMEMO_FL_USER0 FL_USER4
|
|
28
|
+
#define IMEMO_FL_USER1 FL_USER5
|
|
29
|
+
#define IMEMO_FL_USER2 FL_USER6
|
|
30
|
+
#define IMEMO_FL_USER3 FL_USER7
|
|
31
|
+
#define IMEMO_FL_USER4 FL_USER8
|
|
32
|
+
#define IMEMO_FL_USER5 FL_USER9
|
|
33
|
+
|
|
34
|
+
enum imemo_type {
|
|
35
|
+
imemo_env = 0,
|
|
36
|
+
imemo_cref = 1, /*!< class reference */
|
|
37
|
+
imemo_svar = 2, /*!< special variable */
|
|
38
|
+
imemo_throw_data = 3,
|
|
39
|
+
imemo_ifunc = 4, /*!< iterator function */
|
|
40
|
+
imemo_memo = 5,
|
|
41
|
+
imemo_ment = 6,
|
|
42
|
+
imemo_iseq = 7,
|
|
43
|
+
imemo_tmpbuf = 8,
|
|
44
|
+
imemo_ast = 9,
|
|
45
|
+
imemo_parser_strterm = 10,
|
|
46
|
+
imemo_callinfo = 11,
|
|
47
|
+
imemo_callcache = 12,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/* CREF (Class REFerence) is defined in method.h */
|
|
51
|
+
|
|
52
|
+
/*! SVAR (Special VARiable) */
|
|
53
|
+
struct vm_svar {
|
|
54
|
+
VALUE flags;
|
|
55
|
+
const VALUE cref_or_me; /*!< class reference or rb_method_entry_t */
|
|
56
|
+
const VALUE lastline;
|
|
57
|
+
const VALUE backref;
|
|
58
|
+
const VALUE others;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/*! THROW_DATA */
|
|
62
|
+
struct vm_throw_data {
|
|
63
|
+
VALUE flags;
|
|
64
|
+
VALUE reserved;
|
|
65
|
+
const VALUE throw_obj;
|
|
66
|
+
const struct rb_control_frame_struct *catch_frame;
|
|
67
|
+
int throw_state;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
#define THROW_DATA_CONSUMED IMEMO_FL_USER0
|
|
71
|
+
|
|
72
|
+
/* IFUNC (Internal FUNCtion) */
|
|
73
|
+
|
|
74
|
+
struct vm_ifunc_argc {
|
|
75
|
+
#if SIZEOF_INT * 2 > SIZEOF_VALUE
|
|
76
|
+
signed int min: (SIZEOF_VALUE * CHAR_BIT) / 2;
|
|
77
|
+
signed int max: (SIZEOF_VALUE * CHAR_BIT) / 2;
|
|
78
|
+
#else
|
|
79
|
+
int min, max;
|
|
80
|
+
#endif
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/*! IFUNC (Internal FUNCtion) */
|
|
84
|
+
struct vm_ifunc {
|
|
85
|
+
VALUE flags;
|
|
86
|
+
VALUE reserved;
|
|
87
|
+
rb_block_call_func_t func;
|
|
88
|
+
const void *data;
|
|
89
|
+
struct vm_ifunc_argc argc;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
struct rb_imemo_tmpbuf_struct {
|
|
93
|
+
VALUE flags;
|
|
94
|
+
VALUE reserved;
|
|
95
|
+
VALUE *ptr; /* malloc'ed buffer */
|
|
96
|
+
struct rb_imemo_tmpbuf_struct *next; /* next imemo */
|
|
97
|
+
size_t cnt; /* buffer size in VALUE */
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/*! MEMO
|
|
101
|
+
*
|
|
102
|
+
* @see imemo_type
|
|
103
|
+
* */
|
|
104
|
+
struct MEMO {
|
|
105
|
+
VALUE flags;
|
|
106
|
+
VALUE reserved;
|
|
107
|
+
const VALUE v1;
|
|
108
|
+
const VALUE v2;
|
|
109
|
+
union {
|
|
110
|
+
long cnt;
|
|
111
|
+
long state;
|
|
112
|
+
const VALUE value;
|
|
113
|
+
void (*func)(void);
|
|
114
|
+
} u3;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/* ment is in method.h */
|
|
118
|
+
|
|
119
|
+
#define THROW_DATA_P(err) imemo_throw_data_p((VALUE)err)
|
|
120
|
+
#define MEMO_CAST(m) ((struct MEMO *)(m))
|
|
121
|
+
#define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
|
|
122
|
+
#define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
|
|
123
|
+
#define NEW_MEMO_FOR(type, value) \
|
|
124
|
+
((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value))
|
|
125
|
+
#define NEW_PARTIAL_MEMO_FOR(type, value, member) \
|
|
126
|
+
((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), \
|
|
127
|
+
rb_ary_set_len((value), offsetof(type, member) / sizeof(VALUE)), \
|
|
128
|
+
MEMO_FOR(type, value))
|
|
129
|
+
|
|
130
|
+
typedef struct rb_imemo_tmpbuf_struct rb_imemo_tmpbuf_t;
|
|
131
|
+
VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0);
|
|
132
|
+
rb_imemo_tmpbuf_t *rb_imemo_tmpbuf_parser_heap(void *buf, rb_imemo_tmpbuf_t *old_heap, size_t cnt);
|
|
133
|
+
struct vm_ifunc *rb_vm_ifunc_new(rb_block_call_func_t func, const void *data, int min_argc, int max_argc);
|
|
134
|
+
void rb_strterm_mark(VALUE obj);
|
|
135
|
+
static inline enum imemo_type imemo_type(VALUE imemo);
|
|
136
|
+
static inline int imemo_type_p(VALUE imemo, enum imemo_type imemo_type);
|
|
137
|
+
static inline bool imemo_throw_data_p(VALUE imemo);
|
|
138
|
+
static inline struct vm_ifunc *rb_vm_ifunc_proc_new(rb_block_call_func_t func, const void *data);
|
|
139
|
+
static inline VALUE rb_imemo_tmpbuf_auto_free_pointer(void);
|
|
140
|
+
static inline void *RB_IMEMO_TMPBUF_PTR(VALUE v);
|
|
141
|
+
static inline void *rb_imemo_tmpbuf_set_ptr(VALUE v, void *ptr);
|
|
142
|
+
static inline VALUE rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(VALUE str);
|
|
143
|
+
static inline void MEMO_V1_SET(struct MEMO *m, VALUE v);
|
|
144
|
+
static inline void MEMO_V2_SET(struct MEMO *m, VALUE v);
|
|
145
|
+
|
|
146
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
|
147
|
+
#if IMEMO_DEBUG
|
|
148
|
+
VALUE rb_imemo_new_debug(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0, const char *file, int line);
|
|
149
|
+
#define rb_imemo_new(type, v1, v2, v3, v0) rb_imemo_new_debug(type, v1, v2, v3, v0, __FILE__, __LINE__)
|
|
150
|
+
#else
|
|
151
|
+
VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0);
|
|
152
|
+
#endif
|
|
153
|
+
const char *rb_imemo_name(enum imemo_type type);
|
|
154
|
+
RUBY_SYMBOL_EXPORT_END
|
|
155
|
+
|
|
156
|
+
static inline enum imemo_type
|
|
157
|
+
imemo_type(VALUE imemo)
|
|
158
|
+
{
|
|
159
|
+
return (RBASIC(imemo)->flags >> FL_USHIFT) & IMEMO_MASK;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
static inline int
|
|
163
|
+
imemo_type_p(VALUE imemo, enum imemo_type imemo_type)
|
|
164
|
+
{
|
|
165
|
+
if (LIKELY(!RB_SPECIAL_CONST_P(imemo))) {
|
|
166
|
+
/* fixed at compile time if imemo_type is given. */
|
|
167
|
+
const VALUE mask = (IMEMO_MASK << FL_USHIFT) | RUBY_T_MASK;
|
|
168
|
+
const VALUE expected_type = (imemo_type << FL_USHIFT) | T_IMEMO;
|
|
169
|
+
/* fixed at runtime. */
|
|
170
|
+
return expected_type == (RBASIC(imemo)->flags & mask);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
return 0;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
#define IMEMO_TYPE_P(v, t) imemo_type_p((VALUE)v, t)
|
|
178
|
+
|
|
179
|
+
static inline bool
|
|
180
|
+
imemo_throw_data_p(VALUE imemo)
|
|
181
|
+
{
|
|
182
|
+
return RB_TYPE_P(imemo, T_IMEMO);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
static inline struct vm_ifunc *
|
|
186
|
+
rb_vm_ifunc_proc_new(rb_block_call_func_t func, const void *data)
|
|
187
|
+
{
|
|
188
|
+
return rb_vm_ifunc_new(func, data, 0, UNLIMITED_ARGUMENTS);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
static inline VALUE
|
|
192
|
+
rb_imemo_tmpbuf_auto_free_pointer(void)
|
|
193
|
+
{
|
|
194
|
+
return rb_imemo_new(imemo_tmpbuf, 0, 0, 0, 0);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
static inline void *
|
|
198
|
+
RB_IMEMO_TMPBUF_PTR(VALUE v)
|
|
199
|
+
{
|
|
200
|
+
const struct rb_imemo_tmpbuf_struct *p = (const void *)v;
|
|
201
|
+
return p->ptr;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
static inline void *
|
|
205
|
+
rb_imemo_tmpbuf_set_ptr(VALUE v, void *ptr)
|
|
206
|
+
{
|
|
207
|
+
return ((rb_imemo_tmpbuf_t *)v)->ptr = ptr;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
static inline VALUE
|
|
211
|
+
rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(VALUE str)
|
|
212
|
+
{
|
|
213
|
+
const void *src;
|
|
214
|
+
VALUE imemo;
|
|
215
|
+
rb_imemo_tmpbuf_t *tmpbuf;
|
|
216
|
+
void *dst;
|
|
217
|
+
size_t len;
|
|
218
|
+
|
|
219
|
+
SafeStringValue(str);
|
|
220
|
+
/* create tmpbuf to keep the pointer before xmalloc */
|
|
221
|
+
imemo = rb_imemo_tmpbuf_auto_free_pointer();
|
|
222
|
+
tmpbuf = (rb_imemo_tmpbuf_t *)imemo;
|
|
223
|
+
len = RSTRING_LEN(str);
|
|
224
|
+
src = RSTRING_PTR(str);
|
|
225
|
+
dst = ruby_xmalloc(len);
|
|
226
|
+
memcpy(dst, src, len);
|
|
227
|
+
tmpbuf->ptr = dst;
|
|
228
|
+
return imemo;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
static inline void
|
|
232
|
+
MEMO_V1_SET(struct MEMO *m, VALUE v)
|
|
233
|
+
{
|
|
234
|
+
RB_OBJ_WRITE(m, &m->v1, v);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
static inline void
|
|
238
|
+
MEMO_V2_SET(struct MEMO *m, VALUE v)
|
|
239
|
+
{
|
|
240
|
+
RB_OBJ_WRITE(m, &m->v2, v);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
#endif /* INTERNAL_IMEMO_H */
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#ifndef INTERNAL_SERIAL_H /*-*-C-*-vi:se ft=c:*/
|
|
2
|
+
#define INTERNAL_SERIAL_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 rb_serial_t.
|
|
11
|
+
*/
|
|
12
|
+
#include "ruby/internal/config.h" /* for HAVE_LONG_LONG */
|
|
13
|
+
#include "ruby/defines.h" /* for LONG_LONG */
|
|
14
|
+
|
|
15
|
+
#ifndef HAVE_LONG_LONG
|
|
16
|
+
# error need C99+
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
typedef unsigned LONG_LONG rb_serial_t;
|
|
20
|
+
#define SERIALT2NUM ULL2NUM
|
|
21
|
+
#define PRI_SERIALT_PREFIX PRI_LL_PREFIX
|
|
22
|
+
#define SIZEOF_SERIAL_T SIZEOF_LONG_LONG
|
|
23
|
+
|
|
24
|
+
#endif /* INTERNAL_SERIAL_H */
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#ifndef INTERNAL_STATIC_ASSERT_H /*-*-C-*-vi:se ft=c:*/
|
|
2
|
+
#define INTERNAL_STATIC_ASSERT_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 C11 shim for _Static_assert.
|
|
11
|
+
*/
|
|
12
|
+
#include "ruby/internal/static_assert.h"
|
|
13
|
+
#ifndef STATIC_ASSERT
|
|
14
|
+
# define STATIC_ASSERT RBIMPL_STATIC_ASSERT
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#endif /* INTERNAL_STATIC_ASSERT_H */
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
#ifndef INTERNAL_VM_H /*-*-C-*-vi:se ft=c:*/
|
|
2
|
+
#define INTERNAL_VM_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 RubyVM.
|
|
11
|
+
*/
|
|
12
|
+
#include "ruby/internal/stdbool.h" /* for bool */
|
|
13
|
+
#include "internal/serial.h" /* for rb_serial_t */
|
|
14
|
+
#include "internal/static_assert.h" /* for STATIC_ASSERT */
|
|
15
|
+
#include "ruby/ruby.h" /* for ID */
|
|
16
|
+
#include "ruby/st.h" /* for st_table */
|
|
17
|
+
|
|
18
|
+
#ifdef rb_funcallv
|
|
19
|
+
# undef rb_funcallv
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
#ifdef rb_method_basic_definition_p
|
|
23
|
+
# undef rb_method_basic_definition_p
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
struct rb_callable_method_entry_struct; /* in method.h */
|
|
27
|
+
struct rb_method_definition_struct; /* in method.h */
|
|
28
|
+
struct rb_execution_context_struct; /* in vm_core.h */
|
|
29
|
+
struct rb_control_frame_struct; /* in vm_core.h */
|
|
30
|
+
struct rb_callinfo; /* in vm_core.h */
|
|
31
|
+
|
|
32
|
+
enum method_missing_reason {
|
|
33
|
+
MISSING_NOENTRY = 0x00,
|
|
34
|
+
MISSING_PRIVATE = 0x01,
|
|
35
|
+
MISSING_PROTECTED = 0x02,
|
|
36
|
+
MISSING_FCALL = 0x04,
|
|
37
|
+
MISSING_VCALL = 0x08,
|
|
38
|
+
MISSING_SUPER = 0x10,
|
|
39
|
+
MISSING_MISSING = 0x20,
|
|
40
|
+
MISSING_NONE = 0x40
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/* vm_insnhelper.h */
|
|
44
|
+
rb_serial_t rb_next_class_serial(void);
|
|
45
|
+
|
|
46
|
+
/* vm.c */
|
|
47
|
+
VALUE rb_obj_is_thread(VALUE obj);
|
|
48
|
+
void rb_vm_mark(void *ptr);
|
|
49
|
+
void rb_vm_each_stack_value(void *ptr, void (*cb)(VALUE, void*), void *ctx);
|
|
50
|
+
PUREFUNC(VALUE rb_vm_top_self(void));
|
|
51
|
+
void rb_vm_inc_const_missing_count(void);
|
|
52
|
+
const void **rb_vm_get_insns_address_table(void);
|
|
53
|
+
VALUE rb_source_location(int *pline);
|
|
54
|
+
const char *rb_source_location_cstr(int *pline);
|
|
55
|
+
MJIT_STATIC void rb_vm_pop_cfunc_frame(void);
|
|
56
|
+
int rb_vm_add_root_module(VALUE module);
|
|
57
|
+
void rb_vm_check_redefinition_by_prepend(VALUE klass);
|
|
58
|
+
int rb_vm_check_optimizable_mid(VALUE mid);
|
|
59
|
+
VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements);
|
|
60
|
+
MJIT_STATIC VALUE ruby_vm_special_exception_copy(VALUE);
|
|
61
|
+
PUREFUNC(st_table *rb_vm_fstring_table(void));
|
|
62
|
+
|
|
63
|
+
MJIT_SYMBOL_EXPORT_BEGIN
|
|
64
|
+
VALUE vm_exec(struct rb_execution_context_struct *, bool); /* used in JIT-ed code */
|
|
65
|
+
MJIT_SYMBOL_EXPORT_END
|
|
66
|
+
|
|
67
|
+
/* vm_eval.c */
|
|
68
|
+
VALUE rb_current_realfilepath(void);
|
|
69
|
+
VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE);
|
|
70
|
+
typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE);
|
|
71
|
+
VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv,
|
|
72
|
+
rb_check_funcall_hook *hook, VALUE arg);
|
|
73
|
+
VALUE rb_check_funcall_with_hook_kw(VALUE recv, ID mid, int argc, const VALUE *argv,
|
|
74
|
+
rb_check_funcall_hook *hook, VALUE arg, int kw_splat);
|
|
75
|
+
const char *rb_type_str(enum ruby_value_type type);
|
|
76
|
+
VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE);
|
|
77
|
+
VALUE rb_check_funcall_basic_kw(VALUE, ID, VALUE, int, const VALUE*, int);
|
|
78
|
+
VALUE rb_yield_1(VALUE val);
|
|
79
|
+
VALUE rb_yield_force_blockarg(VALUE values);
|
|
80
|
+
VALUE rb_lambda_call(VALUE obj, ID mid, int argc, const VALUE *argv,
|
|
81
|
+
rb_block_call_func_t bl_proc, int min_argc, int max_argc,
|
|
82
|
+
VALUE data2);
|
|
83
|
+
|
|
84
|
+
MJIT_SYMBOL_EXPORT_BEGIN
|
|
85
|
+
VALUE rb_vm_call0(struct rb_execution_context_struct *ec, VALUE recv, ID id, int argc, const VALUE *argv, const struct rb_callable_method_entry_struct *me, int kw_splat);
|
|
86
|
+
VALUE rb_vm_call_kw(struct rb_execution_context_struct *ec, VALUE recv, VALUE id, int argc, const VALUE *argv, const struct rb_callable_method_entry_struct *me, int kw_splat);
|
|
87
|
+
VALUE rb_make_no_method_exception(VALUE exc, VALUE format, VALUE obj, int argc, const VALUE *argv, int priv);
|
|
88
|
+
MJIT_SYMBOL_EXPORT_END
|
|
89
|
+
|
|
90
|
+
/* vm_insnhelper.c */
|
|
91
|
+
VALUE rb_equal_opt(VALUE obj1, VALUE obj2);
|
|
92
|
+
VALUE rb_eql_opt(VALUE obj1, VALUE obj2);
|
|
93
|
+
|
|
94
|
+
struct rb_iseq_struct;
|
|
95
|
+
MJIT_SYMBOL_EXPORT_BEGIN
|
|
96
|
+
const struct rb_callcache *rb_vm_search_method_slowpath(const struct rb_callinfo *ci, VALUE klass);
|
|
97
|
+
MJIT_SYMBOL_EXPORT_END
|
|
98
|
+
|
|
99
|
+
/* vm_method.c */
|
|
100
|
+
struct rb_execution_context_struct;
|
|
101
|
+
MJIT_SYMBOL_EXPORT_BEGIN
|
|
102
|
+
int rb_ec_obj_respond_to(struct rb_execution_context_struct *ec, VALUE klass, VALUE obj, ID id, int priv);
|
|
103
|
+
MJIT_SYMBOL_EXPORT_END
|
|
104
|
+
|
|
105
|
+
/* vm_dump.c */
|
|
106
|
+
void rb_print_backtrace(void);
|
|
107
|
+
|
|
108
|
+
/* vm_backtrace.c */
|
|
109
|
+
VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval);
|
|
110
|
+
VALUE rb_vm_thread_backtrace_locations(int argc, const VALUE *argv, VALUE thval);
|
|
111
|
+
VALUE rb_vm_backtrace(int argc, const VALUE * argv, struct rb_execution_context_struct * ec);
|
|
112
|
+
VALUE rb_vm_backtrace_locations(int argc, const VALUE * argv, struct rb_execution_context_struct * ec);
|
|
113
|
+
VALUE rb_make_backtrace(void);
|
|
114
|
+
void rb_backtrace_print_as_bugreport(void);
|
|
115
|
+
int rb_backtrace_p(VALUE obj);
|
|
116
|
+
VALUE rb_backtrace_to_str_ary(VALUE obj);
|
|
117
|
+
VALUE rb_backtrace_to_location_ary(VALUE obj);
|
|
118
|
+
void rb_backtrace_each(VALUE (*iter)(VALUE recv, VALUE str), VALUE output);
|
|
119
|
+
|
|
120
|
+
MJIT_SYMBOL_EXPORT_BEGIN
|
|
121
|
+
VALUE rb_ec_backtrace_object(const struct rb_execution_context_struct *ec);
|
|
122
|
+
void rb_backtrace_use_iseq_first_lineno_for_last_location(VALUE self);
|
|
123
|
+
MJIT_SYMBOL_EXPORT_END
|
|
124
|
+
|
|
125
|
+
#define RUBY_DTRACE_CREATE_HOOK(name, arg) \
|
|
126
|
+
RUBY_DTRACE_HOOK(name##_CREATE, arg)
|
|
127
|
+
#define RUBY_DTRACE_HOOK(name, arg) \
|
|
128
|
+
do { \
|
|
129
|
+
if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
|
|
130
|
+
int dtrace_line; \
|
|
131
|
+
const char *dtrace_file = rb_source_location_cstr(&dtrace_line); \
|
|
132
|
+
if (!dtrace_file) dtrace_file = ""; \
|
|
133
|
+
RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \
|
|
134
|
+
} \
|
|
135
|
+
} while (0)
|
|
136
|
+
#endif /* INTERNAL_VM_H */
|