datadog-ruby_core_source 3.5.4 → 3.5.6
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/README.md +0 -2
- 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/ruby-4.1.0-preview1/ccan/build_assert/build_assert.h +40 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ccan/check_type/check_type.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ccan/container_of/container_of.h +142 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ccan/list/list.h +791 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ccan/str/str.h +17 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/constant.h +53 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/debug_counter.h +428 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/hrtime.h +237 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/id.h +365 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/id_table.h +74 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/array.h +158 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/basic_operators.h +67 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/bits.h +647 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/box.h +103 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/class.h +797 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/compilers.h +104 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/coverage.h +51 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/gc.h +411 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/imemo.h +302 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/sanitizers.h +346 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/serial.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/set_table.h +77 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/static_assert.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/time.h +34 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/variable.h +81 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/vm.h +144 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal/warnings.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/internal.h +106 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/iseq.h +439 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/method.h +279 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/node.h +122 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/parser_st.h +161 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/parser_value.h +116 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/arena.h +37 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/ast.h +10371 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/buffer.h +52 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/comments.h +43 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/align.h +36 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/exported.h +24 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/filesystem.h +32 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/nodiscard.h +22 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/nonnull.h +18 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/constant_pool.h +81 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/diagnostic.h +93 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/errors_format.h +53 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/excludes.h +29 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/integer.h +41 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/json.h +32 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/line_offset_list.h +61 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/magic_comments.h +35 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/node.h +94 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/options.h +335 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/parser.h +348 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/prettyprint.h +31 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/prism.h +131 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/serialize.h +115 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/source.h +155 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/stream.h +28 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/string_query.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/stringy.h +72 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism/version.h +38 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/prism_compile.h +204 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ractor_core.h +421 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ruby_assert.h +14 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/ruby_atomic.h +115 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/rubyparser.h +1389 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/shape.h +733 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/thread_none.h +25 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/thread_pthread.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/thread_sched.h +271 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/vm_core.h +2509 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/vm_debug.h +124 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/vm_opts.h +65 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/vm_sync.h +160 -0
- data/lib/datadog/ruby_core_source/ruby-4.1.0-preview1/zjit.h +221 -0
- data/lib/datadog/ruby_core_source/version.rb +1 -1
- metadata +197 -4
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#ifndef RUBY_DEBUG_H
|
|
2
|
+
#define RUBY_DEBUG_H
|
|
3
|
+
/**********************************************************************
|
|
4
|
+
|
|
5
|
+
vm_debug.h - YARV Debug function interface
|
|
6
|
+
|
|
7
|
+
$Author$
|
|
8
|
+
created at: 04/08/25 02:33:49 JST
|
|
9
|
+
|
|
10
|
+
Copyright (C) 2004-2007 Koichi Sasada
|
|
11
|
+
|
|
12
|
+
**********************************************************************/
|
|
13
|
+
|
|
14
|
+
#include "ruby/ruby.h"
|
|
15
|
+
|
|
16
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
|
17
|
+
|
|
18
|
+
#define dpv(h,v) ruby_debug_print_value(-1, 0, (h), (v))
|
|
19
|
+
#define dp(v) ruby_debug_print_value(-1, 0, "", (v))
|
|
20
|
+
#define dpi(i) ruby_debug_print_id(-1, 0, "", (i))
|
|
21
|
+
#define dpn(n) ruby_debug_print_node(-1, 0, "", (n))
|
|
22
|
+
|
|
23
|
+
struct RNode;
|
|
24
|
+
|
|
25
|
+
VALUE ruby_debug_print_value(int level, int debug_level, const char *header, VALUE v);
|
|
26
|
+
void ruby_debug_print_v(VALUE v);
|
|
27
|
+
ID ruby_debug_print_id(int level, int debug_level, const char *header, ID id);
|
|
28
|
+
struct RNode *ruby_debug_print_node(int level, int debug_level, const char *header, const struct RNode *node);
|
|
29
|
+
void ruby_debug_print_n(const struct RNode *node);
|
|
30
|
+
int ruby_debug_print_indent(int level, int debug_level, int indent_level);
|
|
31
|
+
void ruby_debug_gc_check_func(void);
|
|
32
|
+
void ruby_set_debug_option(const char *str);
|
|
33
|
+
|
|
34
|
+
RUBY_SYMBOL_EXPORT_END
|
|
35
|
+
|
|
36
|
+
#ifndef USE_RUBY_DEBUG_LOG
|
|
37
|
+
#define USE_RUBY_DEBUG_LOG 0
|
|
38
|
+
#endif
|
|
39
|
+
|
|
40
|
+
/* RUBY_DEBUG_LOG: Logging debug information mechanism
|
|
41
|
+
*
|
|
42
|
+
* This feature provides a mechanism to store logging information
|
|
43
|
+
* to a file, stderr or memory space with simple macros.
|
|
44
|
+
*
|
|
45
|
+
* The following information will be stored.
|
|
46
|
+
* * (1) __FILE__, __LINE__ in C
|
|
47
|
+
* * (2) __FILE__, __LINE__ in Ruby
|
|
48
|
+
* * (3) __func__ in C (message title)
|
|
49
|
+
* * (4) given string with sprintf format
|
|
50
|
+
* * (5) Thread number (if multiple threads are running)
|
|
51
|
+
*
|
|
52
|
+
* This feature is enabled only USE_RUBY_DEBUG_LOG is enabled.
|
|
53
|
+
* Release version should not enable it.
|
|
54
|
+
*
|
|
55
|
+
* Running with the `RUBY_DEBUG_LOG` environment variable enables
|
|
56
|
+
* this feature.
|
|
57
|
+
*
|
|
58
|
+
* # logging into a file
|
|
59
|
+
* RUBY_DEBUG_LOG=/path/to/file STDERR
|
|
60
|
+
*
|
|
61
|
+
* # logging into STDERR
|
|
62
|
+
* RUBY_DEBUG_LOG=stderr
|
|
63
|
+
*
|
|
64
|
+
* # logging into memory space (check with a debugger)
|
|
65
|
+
* # It will help if the timing is important.
|
|
66
|
+
* RUBY_DEBUG_LOG=mem
|
|
67
|
+
*
|
|
68
|
+
* RUBY_DEBUG_LOG_FILTER environment variable can specify the filter string.
|
|
69
|
+
* If "(3) __func__ in C (message title)" contains the specified string, the
|
|
70
|
+
* information will be stored (example: RUBY_DEBUG_LOG_FILTER=str will enable
|
|
71
|
+
* only on str related information).
|
|
72
|
+
*
|
|
73
|
+
* In a MRI source code, you can use the following macros:
|
|
74
|
+
* * RUBY_DEBUG_LOG(fmt, ...): Above (1) to (4) will be logged.
|
|
75
|
+
* * RUBY_DEBUG_LOG2(file, line, fmt, ...):
|
|
76
|
+
* Same as RUBY_DEBUG_LOG(), but (1) will be replaced with given file, line.
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
extern enum ruby_debug_log_mode {
|
|
80
|
+
ruby_debug_log_disabled = 0x00,
|
|
81
|
+
ruby_debug_log_memory = 0x01,
|
|
82
|
+
ruby_debug_log_stderr = 0x02,
|
|
83
|
+
ruby_debug_log_file = 0x04,
|
|
84
|
+
} ruby_debug_log_mode;
|
|
85
|
+
|
|
86
|
+
RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 4, 5)
|
|
87
|
+
void ruby_debug_log(const char *file, int line, const char *func_name, const char *fmt, ...);
|
|
88
|
+
void ruby_debug_log_print(unsigned int n);
|
|
89
|
+
bool ruby_debug_log_filter(const char *func_name, const char *file_name);
|
|
90
|
+
|
|
91
|
+
// convenient macro to log even if the USE_RUBY_DEBUG_LOG macro is not specified.
|
|
92
|
+
// You can use this macro for temporary usage (you should not commit it).
|
|
93
|
+
#define _RUBY_DEBUG_LOG(...) ruby_debug_log(__FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING, "" __VA_ARGS__)
|
|
94
|
+
|
|
95
|
+
#if RBIMPL_COMPILER_IS(GCC) && defined(__OPTIMIZE__)
|
|
96
|
+
# define ruby_debug_log(...) \
|
|
97
|
+
RB_GNUC_EXTENSION_BLOCK( \
|
|
98
|
+
RBIMPL_WARNING_PUSH(); \
|
|
99
|
+
RBIMPL_WARNING_IGNORED(-Wformat-zero-length); \
|
|
100
|
+
ruby_debug_log(__VA_ARGS__); \
|
|
101
|
+
RBIMPL_WARNING_POP())
|
|
102
|
+
#endif
|
|
103
|
+
|
|
104
|
+
#if USE_RUBY_DEBUG_LOG
|
|
105
|
+
# define RUBY_DEBUG_LOG_ENABLED(func_name, file_name) \
|
|
106
|
+
(ruby_debug_log_mode && ruby_debug_log_filter(func_name, file_name))
|
|
107
|
+
|
|
108
|
+
#define RUBY_DEBUG_LOG(...) do { \
|
|
109
|
+
if (RUBY_DEBUG_LOG_ENABLED(RUBY_FUNCTION_NAME_STRING, __FILE__)) \
|
|
110
|
+
ruby_debug_log(__FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING, "" __VA_ARGS__); \
|
|
111
|
+
} while (0)
|
|
112
|
+
|
|
113
|
+
#define RUBY_DEBUG_LOG2(file, line, ...) do { \
|
|
114
|
+
if (RUBY_DEBUG_LOG_ENABLED(RUBY_FUNCTION_NAME_STRING, file)) \
|
|
115
|
+
ruby_debug_log(file, line, RUBY_FUNCTION_NAME_STRING, "" __VA_ARGS__); \
|
|
116
|
+
} while (0)
|
|
117
|
+
|
|
118
|
+
#else // USE_RUBY_DEBUG_LOG
|
|
119
|
+
// do nothing
|
|
120
|
+
#define RUBY_DEBUG_LOG(...)
|
|
121
|
+
#define RUBY_DEBUG_LOG2(file, line, ...)
|
|
122
|
+
#endif // USE_RUBY_DEBUG_LOG
|
|
123
|
+
|
|
124
|
+
#endif /* RUBY_DEBUG_H */
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#ifndef RUBY_VM_OPTS_H/*-*-c-*-*/
|
|
2
|
+
#define RUBY_VM_OPTS_H
|
|
3
|
+
/**********************************************************************
|
|
4
|
+
|
|
5
|
+
vm_opts.h - VM optimize option
|
|
6
|
+
|
|
7
|
+
$Author$
|
|
8
|
+
|
|
9
|
+
Copyright (C) 2004-2007 Koichi Sasada
|
|
10
|
+
|
|
11
|
+
**********************************************************************/
|
|
12
|
+
|
|
13
|
+
/* Compile options.
|
|
14
|
+
* You can change these options at runtime by VM::CompileOption.
|
|
15
|
+
* Following definitions are default values.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#define OPT_TAILCALL_OPTIMIZATION 0
|
|
19
|
+
#define OPT_PEEPHOLE_OPTIMIZATION 1
|
|
20
|
+
#define OPT_SPECIALISED_INSTRUCTION 1
|
|
21
|
+
#define OPT_INLINE_CONST_CACHE 1
|
|
22
|
+
#define OPT_FROZEN_STRING_LITERAL -1
|
|
23
|
+
#define OPT_DEBUG_FROZEN_STRING_LITERAL 0
|
|
24
|
+
|
|
25
|
+
/* Build Options.
|
|
26
|
+
* You can't change these options at runtime.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/* C compiler dependent */
|
|
30
|
+
|
|
31
|
+
/*
|
|
32
|
+
* 0: direct (using labeled goto using GCC special)
|
|
33
|
+
* 1: token (switch/case)
|
|
34
|
+
* 2: call (function call for each insn dispatch)
|
|
35
|
+
*/
|
|
36
|
+
#ifndef OPT_THREADED_CODE
|
|
37
|
+
#define OPT_THREADED_CODE 0
|
|
38
|
+
#endif
|
|
39
|
+
|
|
40
|
+
#define OPT_DIRECT_THREADED_CODE (OPT_THREADED_CODE == 0)
|
|
41
|
+
#define OPT_TOKEN_THREADED_CODE (OPT_THREADED_CODE == 1)
|
|
42
|
+
#define OPT_CALL_THREADED_CODE (OPT_THREADED_CODE == 2)
|
|
43
|
+
|
|
44
|
+
/* VM running option */
|
|
45
|
+
#define OPT_CHECKED_RUN 1
|
|
46
|
+
#define OPT_INLINE_METHOD_CACHE 1
|
|
47
|
+
|
|
48
|
+
#ifndef OPT_IC_FOR_IVAR
|
|
49
|
+
#define OPT_IC_FOR_IVAR 1
|
|
50
|
+
#endif
|
|
51
|
+
|
|
52
|
+
/* architecture independent, affects generated code */
|
|
53
|
+
#define OPT_OPERANDS_UNIFICATION 1
|
|
54
|
+
#define OPT_INSTRUCTIONS_UNIFICATION 0
|
|
55
|
+
|
|
56
|
+
/* misc */
|
|
57
|
+
#ifndef OPT_SUPPORT_JOKE
|
|
58
|
+
#define OPT_SUPPORT_JOKE 0
|
|
59
|
+
#endif
|
|
60
|
+
|
|
61
|
+
#ifndef VM_COLLECT_USAGE_DETAILS
|
|
62
|
+
#define VM_COLLECT_USAGE_DETAILS 0
|
|
63
|
+
#endif
|
|
64
|
+
|
|
65
|
+
#endif /* RUBY_VM_OPTS_H */
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
#ifndef RUBY_VM_SYNC_H
|
|
2
|
+
#define RUBY_VM_SYNC_H
|
|
3
|
+
|
|
4
|
+
#include "vm_debug.h"
|
|
5
|
+
#include "debug_counter.h"
|
|
6
|
+
|
|
7
|
+
#if USE_RUBY_DEBUG_LOG
|
|
8
|
+
#define LOCATION_ARGS const char *file, int line
|
|
9
|
+
#define LOCATION_PARAMS file, line
|
|
10
|
+
#define APPEND_LOCATION_ARGS , const char *file, int line
|
|
11
|
+
#define APPEND_LOCATION_PARAMS , file, line
|
|
12
|
+
#else
|
|
13
|
+
#define LOCATION_ARGS void
|
|
14
|
+
#define LOCATION_PARAMS
|
|
15
|
+
#define APPEND_LOCATION_ARGS
|
|
16
|
+
#define APPEND_LOCATION_PARAMS
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
bool rb_vm_locked_p(void);
|
|
20
|
+
void rb_vm_lock_body(LOCATION_ARGS);
|
|
21
|
+
void rb_vm_unlock_body(LOCATION_ARGS);
|
|
22
|
+
|
|
23
|
+
struct rb_ractor_struct;
|
|
24
|
+
NOINLINE(void rb_vm_lock_enter_body_cr(struct rb_ractor_struct *cr, unsigned int *lev APPEND_LOCATION_ARGS));
|
|
25
|
+
NOINLINE(void rb_vm_lock_enter_body_nb(unsigned int *lev APPEND_LOCATION_ARGS));
|
|
26
|
+
NOINLINE(void rb_vm_lock_enter_body(unsigned int *lev APPEND_LOCATION_ARGS));
|
|
27
|
+
void rb_vm_lock_leave_body_nb(unsigned int *lev APPEND_LOCATION_ARGS);
|
|
28
|
+
void rb_vm_lock_leave_body(unsigned int *lev APPEND_LOCATION_ARGS);
|
|
29
|
+
void rb_vm_barrier(void);
|
|
30
|
+
|
|
31
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
|
32
|
+
VALUE rb_vm_lock_with_barrier(VALUE (*func)(void *args), void *args);
|
|
33
|
+
RUBY_SYMBOL_EXPORT_END
|
|
34
|
+
|
|
35
|
+
#if RUBY_DEBUG
|
|
36
|
+
// GET_VM()
|
|
37
|
+
#include "vm_core.h"
|
|
38
|
+
#endif
|
|
39
|
+
|
|
40
|
+
RUBY_EXTERN struct rb_ractor_struct *ruby_single_main_ractor; // ractor.c
|
|
41
|
+
|
|
42
|
+
static inline bool
|
|
43
|
+
rb_multi_ractor_p(void)
|
|
44
|
+
{
|
|
45
|
+
if (LIKELY(ruby_single_main_ractor)) {
|
|
46
|
+
// 0 on boot time.
|
|
47
|
+
RUBY_ASSERT(GET_VM()->ractor.cnt <= 1);
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// multi-ractor mode can run ractor.cnt == 1
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static inline void
|
|
57
|
+
rb_vm_lock(const char *file, int line)
|
|
58
|
+
{
|
|
59
|
+
RB_DEBUG_COUNTER_INC(vm_sync_lock);
|
|
60
|
+
|
|
61
|
+
if (rb_multi_ractor_p()) {
|
|
62
|
+
rb_vm_lock_body(LOCATION_PARAMS);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static inline void
|
|
67
|
+
rb_vm_unlock(const char *file, int line)
|
|
68
|
+
{
|
|
69
|
+
if (rb_multi_ractor_p()) {
|
|
70
|
+
rb_vm_unlock_body(LOCATION_PARAMS);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static inline void
|
|
75
|
+
rb_vm_lock_enter(unsigned int *lev, const char *file, int line)
|
|
76
|
+
{
|
|
77
|
+
RB_DEBUG_COUNTER_INC(vm_sync_lock_enter);
|
|
78
|
+
|
|
79
|
+
if (rb_multi_ractor_p()) {
|
|
80
|
+
rb_vm_lock_enter_body(lev APPEND_LOCATION_PARAMS);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static inline void
|
|
85
|
+
rb_vm_lock_enter_nb(unsigned int *lev, const char *file, int line)
|
|
86
|
+
{
|
|
87
|
+
RB_DEBUG_COUNTER_INC(vm_sync_lock_enter_nb);
|
|
88
|
+
|
|
89
|
+
if (rb_multi_ractor_p()) {
|
|
90
|
+
rb_vm_lock_enter_body_nb(lev APPEND_LOCATION_PARAMS);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
static inline void
|
|
95
|
+
rb_vm_lock_leave_nb(unsigned int *lev, const char *file, int line)
|
|
96
|
+
{
|
|
97
|
+
if (rb_multi_ractor_p()) {
|
|
98
|
+
rb_vm_lock_leave_body_nb(lev APPEND_LOCATION_PARAMS);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static inline void
|
|
103
|
+
rb_vm_lock_leave(unsigned int *lev, const char *file, int line)
|
|
104
|
+
{
|
|
105
|
+
if (rb_multi_ractor_p()) {
|
|
106
|
+
rb_vm_lock_leave_body(lev APPEND_LOCATION_PARAMS);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
static inline void
|
|
111
|
+
rb_vm_lock_enter_cr(struct rb_ractor_struct *cr, unsigned int *levp, const char *file, int line)
|
|
112
|
+
{
|
|
113
|
+
RB_DEBUG_COUNTER_INC(vm_sync_lock_enter_cr);
|
|
114
|
+
rb_vm_lock_enter_body_cr(cr, levp APPEND_LOCATION_PARAMS);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static inline void
|
|
118
|
+
rb_vm_lock_leave_cr(struct rb_ractor_struct *cr, unsigned int *levp, const char *file, int line)
|
|
119
|
+
{
|
|
120
|
+
rb_vm_lock_leave_body(levp APPEND_LOCATION_PARAMS);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#define RB_VM_LOCKED_P() rb_vm_locked_p()
|
|
124
|
+
|
|
125
|
+
#define RB_VM_LOCK() rb_vm_lock(__FILE__, __LINE__)
|
|
126
|
+
#define RB_VM_UNLOCK() rb_vm_unlock(__FILE__, __LINE__)
|
|
127
|
+
|
|
128
|
+
#define RB_VM_LOCK_ENTER_CR_LEV(cr, levp) rb_vm_lock_enter_cr(cr, levp, __FILE__, __LINE__)
|
|
129
|
+
#define RB_VM_LOCK_LEAVE_CR_LEV(cr, levp) rb_vm_lock_leave_cr(cr, levp, __FILE__, __LINE__)
|
|
130
|
+
#define RB_VM_LOCK_ENTER_LEV(levp) rb_vm_lock_enter(levp, __FILE__, __LINE__)
|
|
131
|
+
#define RB_VM_LOCK_LEAVE_LEV(levp) rb_vm_lock_leave(levp, __FILE__, __LINE__)
|
|
132
|
+
|
|
133
|
+
#define RB_VM_LOCK_ENTER() { unsigned int _lev; RB_VM_LOCK_ENTER_LEV(&_lev);
|
|
134
|
+
#define RB_VM_LOCK_LEAVE() RB_VM_LOCK_LEAVE_LEV(&_lev); }
|
|
135
|
+
#define RB_VM_LOCKING() \
|
|
136
|
+
for (unsigned int vm_locking_level, vm_locking_do = (RB_VM_LOCK_ENTER_LEV(&vm_locking_level), 1); \
|
|
137
|
+
vm_locking_do; RB_VM_LOCK_LEAVE_LEV(&vm_locking_level), vm_locking_do = 0)
|
|
138
|
+
|
|
139
|
+
#define RB_VM_LOCK_ENTER_LEV_NB(levp) rb_vm_lock_enter_nb(levp, __FILE__, __LINE__)
|
|
140
|
+
#define RB_VM_LOCK_LEAVE_LEV_NB(levp) rb_vm_lock_leave_nb(levp, __FILE__, __LINE__)
|
|
141
|
+
#define RB_VM_LOCK_ENTER_NO_BARRIER() { unsigned int _lev; RB_VM_LOCK_ENTER_LEV_NB(&_lev);
|
|
142
|
+
#define RB_VM_LOCK_LEAVE_NO_BARRIER() RB_VM_LOCK_LEAVE_LEV_NB(&_lev); }
|
|
143
|
+
#define RB_VM_LOCKING_NO_BARRIER() \
|
|
144
|
+
for (unsigned int vm_locking_level, vm_locking_do = (RB_VM_LOCK_ENTER_LEV_NB(&vm_locking_level), 1); \
|
|
145
|
+
vm_locking_do; RB_VM_LOCK_LEAVE_LEV_NB(&vm_locking_level), vm_locking_do = 0)
|
|
146
|
+
|
|
147
|
+
#if RUBY_DEBUG > 0
|
|
148
|
+
void RUBY_ASSERT_vm_locking(void);
|
|
149
|
+
void RUBY_ASSERT_vm_locking_with_barrier(void);
|
|
150
|
+
void RUBY_ASSERT_vm_unlocking(void);
|
|
151
|
+
#define ASSERT_vm_locking() RUBY_ASSERT_vm_locking()
|
|
152
|
+
#define ASSERT_vm_locking_with_barrier() RUBY_ASSERT_vm_locking_with_barrier()
|
|
153
|
+
#define ASSERT_vm_unlocking() RUBY_ASSERT_vm_unlocking()
|
|
154
|
+
#else
|
|
155
|
+
#define ASSERT_vm_locking()
|
|
156
|
+
#define ASSERT_vm_locking_with_barrier()
|
|
157
|
+
#define ASSERT_vm_unlocking()
|
|
158
|
+
#endif
|
|
159
|
+
|
|
160
|
+
#endif // RUBY_VM_SYNC_H
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
#ifndef ZJIT_H
|
|
2
|
+
#define ZJIT_H 1
|
|
3
|
+
//
|
|
4
|
+
// This file contains definitions ZJIT exposes to the CRuby codebase
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
#include "shape.h" // for shape_id_t
|
|
8
|
+
|
|
9
|
+
// ZJIT_STATS controls whether to support runtime counters in the interpreter
|
|
10
|
+
#ifndef ZJIT_STATS
|
|
11
|
+
# define ZJIT_STATS (USE_ZJIT && RUBY_DEBUG)
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
// JITFrame is defined here as the single source of truth and imported into
|
|
15
|
+
// Rust via bindgen. C code reads fields directly; Rust uses an impl block.
|
|
16
|
+
typedef struct zjit_jit_frame {
|
|
17
|
+
// Program counter for this frame, used for backtraces and GC.
|
|
18
|
+
// NULL for C frames (they don't have a Ruby PC).
|
|
19
|
+
const VALUE *pc;
|
|
20
|
+
// The ISEQ this frame belongs to. Marked via rb_execution_context_mark.
|
|
21
|
+
// NULL for C frames.
|
|
22
|
+
const rb_iseq_t *iseq;
|
|
23
|
+
// Whether to materialize block_code when this frame is materialized.
|
|
24
|
+
// True when the ISEQ doesn't contain send/invokesuper/invokeblock
|
|
25
|
+
// (which write block_code themselves), so we must restore it.
|
|
26
|
+
// Always false for C frames.
|
|
27
|
+
bool materialize_block_code;
|
|
28
|
+
|
|
29
|
+
// Number of stack map entries in stack[].
|
|
30
|
+
uint32_t stack_size;
|
|
31
|
+
// Flexible array of stack map entries, executed in order by
|
|
32
|
+
// zjit_materialize_frames(). See the ZJIT_STACK_MAP_* opcodes above.
|
|
33
|
+
VALUE stack[];
|
|
34
|
+
} zjit_jit_frame_t;
|
|
35
|
+
|
|
36
|
+
#if USE_ZJIT
|
|
37
|
+
// Stack map entries are opcodes for zjit_materialize_frames(), which walks them
|
|
38
|
+
// in order while moving a cursor down the VM stack. An untagged entry is an
|
|
39
|
+
// immediate Ruby VALUE to store; the tagged forms below copy from the native
|
|
40
|
+
// stack, skip slots, or move the cursor. Stack maps never contain heap VALUEs,
|
|
41
|
+
// so these tags are available: they are not Qfalse (0), and their low 3 bits
|
|
42
|
+
// are zero, so RB_SPECIAL_CONST_P is false. Tags must stay non-zero multiples
|
|
43
|
+
// of 8 for that to hold.
|
|
44
|
+
#define ZJIT_STACK_MAP_VREG_TAG 0x08
|
|
45
|
+
#define ZJIT_STACK_MAP_SKIP_TAG 0x10
|
|
46
|
+
#define ZJIT_STACK_MAP_BASE_PTR_TAG 0x18
|
|
47
|
+
#define ZJIT_STACK_MAP_TAG_MASK 0xff
|
|
48
|
+
#define ZJIT_STACK_MAP_SHIFT 8
|
|
49
|
+
|
|
50
|
+
// The BASE_PTR payload packs two fields above the tag byte: the slot index in
|
|
51
|
+
// bits 8..=31 and the operand stack size in bits 32..=63.
|
|
52
|
+
#define ZJIT_STACK_MAP_BASE_PTR_SIZE_SHIFT 32
|
|
53
|
+
#define ZJIT_STACK_MAP_BASE_PTR_INDEX_MASK 0xffffff
|
|
54
|
+
|
|
55
|
+
static inline bool
|
|
56
|
+
ZJIT_STACK_MAP_VREG_P(VALUE entry)
|
|
57
|
+
{
|
|
58
|
+
return (entry & ZJIT_STACK_MAP_TAG_MASK) == ZJIT_STACK_MAP_VREG_TAG;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static inline size_t
|
|
62
|
+
ZJIT_STACK_MAP_VREG_INDEX(VALUE entry)
|
|
63
|
+
{
|
|
64
|
+
return entry >> ZJIT_STACK_MAP_SHIFT;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static inline bool
|
|
68
|
+
ZJIT_STACK_MAP_SKIP_P(VALUE entry)
|
|
69
|
+
{
|
|
70
|
+
return (entry & ZJIT_STACK_MAP_TAG_MASK) == ZJIT_STACK_MAP_SKIP_TAG;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static inline size_t
|
|
74
|
+
ZJIT_STACK_MAP_SKIP_SIZE(VALUE entry)
|
|
75
|
+
{
|
|
76
|
+
return entry >> ZJIT_STACK_MAP_SHIFT;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Anchor the write cursor using the SP register the JIT saved on its native
|
|
80
|
+
// stack, instead of cfp->sp. cfp->sp is not a reliable starting point for a
|
|
81
|
+
// frame that is in the middle of a non-leaf C call, as e.g. raising
|
|
82
|
+
// ArgumentError can push through and move cfp->sp, then use the stack map.
|
|
83
|
+
// gen_prepare_non_leaf_call() emits this opcode, always as stack[0], so the
|
|
84
|
+
// entries after decode to the right place.
|
|
85
|
+
static inline bool
|
|
86
|
+
ZJIT_STACK_MAP_BASE_PTR_P(VALUE entry)
|
|
87
|
+
{
|
|
88
|
+
return (entry & ZJIT_STACK_MAP_TAG_MASK) == ZJIT_STACK_MAP_BASE_PTR_TAG;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// VALUE index from cfp->jit_return down to the native stack slot holding the
|
|
92
|
+
// saved SP register, i.e. base_ptr is `((VALUE **)cfp->jit_return)[-index]`.
|
|
93
|
+
// There is one such slot per compiled function, so the index depends on the
|
|
94
|
+
// frame's inlining depth.
|
|
95
|
+
static inline size_t
|
|
96
|
+
ZJIT_STACK_MAP_BASE_PTR_SLOT_INDEX(VALUE entry)
|
|
97
|
+
{
|
|
98
|
+
return (entry >> ZJIT_STACK_MAP_SHIFT) & ZJIT_STACK_MAP_BASE_PTR_INDEX_MASK;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Number of VM stack slots above base_ptr, i.e. the frame's operand stack
|
|
102
|
+
// depth. The cursor is set to `base_ptr + this`.
|
|
103
|
+
static inline size_t
|
|
104
|
+
ZJIT_STACK_MAP_BASE_PTR_STACK_SIZE(VALUE entry)
|
|
105
|
+
{
|
|
106
|
+
return entry >> ZJIT_STACK_MAP_BASE_PTR_SIZE_SHIFT;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
extern void *rb_zjit_entry;
|
|
110
|
+
extern bool rb_zjit_compiling_p;
|
|
111
|
+
extern const zjit_jit_frame_t rb_zjit_c_frame;
|
|
112
|
+
extern unsigned int rb_zjit_call_threshold;
|
|
113
|
+
extern unsigned int rb_zjit_profile_threshold;
|
|
114
|
+
void rb_zjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception);
|
|
115
|
+
void rb_zjit_profile_insn(uint32_t insn, rb_execution_context_t *ec);
|
|
116
|
+
void rb_zjit_profile_enable(const rb_iseq_t *iseq);
|
|
117
|
+
void rb_zjit_bop_redefined(int redefined_flag, enum ruby_basic_operators bop);
|
|
118
|
+
void rb_zjit_cme_invalidate(const rb_callable_method_entry_t *cme);
|
|
119
|
+
void rb_zjit_cme_free(const rb_callable_method_entry_t *cme);
|
|
120
|
+
void rb_zjit_klass_free(VALUE klass);
|
|
121
|
+
void rb_zjit_invalidate_no_ep_escape(const rb_iseq_t *iseq);
|
|
122
|
+
void rb_zjit_constant_state_changed(ID id);
|
|
123
|
+
void rb_zjit_iseq_mark(void *payload);
|
|
124
|
+
void rb_zjit_iseq_update_references(void *payload);
|
|
125
|
+
void rb_zjit_mark_all_writable(void);
|
|
126
|
+
void rb_zjit_mark_all_executable(void);
|
|
127
|
+
void rb_zjit_iseq_free(const rb_iseq_t *iseq);
|
|
128
|
+
void rb_zjit_invalidate_single_ractor(void);
|
|
129
|
+
void rb_zjit_tracing_invalidate_all(void);
|
|
130
|
+
void rb_zjit_invalidate_newobj_hook(void);
|
|
131
|
+
void rb_zjit_invalidate_no_singleton_class(VALUE klass);
|
|
132
|
+
void rb_zjit_invalidate_root_box(void);
|
|
133
|
+
void rb_zjit_jit_frame_update_references(zjit_jit_frame_t *jit_frame);
|
|
134
|
+
void rb_zjit_materialize_frames(const rb_execution_context_t *ec, rb_control_frame_t *cfp);
|
|
135
|
+
void rb_zjit_materialize_frames_for_longjmp(const rb_execution_context_t *ec, rb_control_frame_t *cfp);
|
|
136
|
+
size_t rb_zjit_hash_new_size(VALUE *flags_out, size_t size);
|
|
137
|
+
VALUE rb_zjit_new_obj_shape(VALUE flags, size_t alloc_size);
|
|
138
|
+
bool rb_zjit_class_allocate_instance_fastpath(VALUE klass, size_t *size_out, VALUE *flags_out);
|
|
139
|
+
bool rb_zjit_str_resurrect_fastpath(VALUE str, bool chilled, size_t *size_out, VALUE *flags_out, rb_len_t *len_out, size_t *byte_size_out);
|
|
140
|
+
bool rb_zjit_array_dup_can_fastpath(VALUE ary, size_t *alloc_size_out, VALUE *flags_out, rb_len_t *len_out);
|
|
141
|
+
bool rb_zjit_array_new_can_fastpath(rb_len_t len, size_t *alloc_size_out, VALUE *flags_out);
|
|
142
|
+
bool rb_zjit_hash_dup_can_fastpath(VALUE hash, size_t *alloc_size_out, VALUE *flags_out, VALUE *ifnone_out, rb_len_t *bound_out);
|
|
143
|
+
void rb_zjit_range_new_fastpath(bool exclude_end, size_t *alloc_size_out, VALUE *flags_out);
|
|
144
|
+
void rb_zjit_array_new_fastpath(size_t *alloc_size_out, VALUE *flags_out);
|
|
145
|
+
bool rb_zjit_newobj_hook_enabled_p(void);
|
|
146
|
+
|
|
147
|
+
// Special value for cfp->jit_return that means "this is a C method frame, use
|
|
148
|
+
// rb_zjit_c_frame as the JITFrame". We don't control the native stack layout
|
|
149
|
+
// for C frames, so there's no per-call JITFrame storage; we set this sentinel
|
|
150
|
+
// instead of a heap-allocated JITFrame pointer.
|
|
151
|
+
#define ZJIT_JIT_RETURN_C_FRAME 0x1
|
|
152
|
+
|
|
153
|
+
static inline const zjit_jit_frame_t *
|
|
154
|
+
CFP_ZJIT_FRAME(const rb_control_frame_t *cfp)
|
|
155
|
+
{
|
|
156
|
+
if ((VALUE)cfp->jit_return == ZJIT_JIT_RETURN_C_FRAME) {
|
|
157
|
+
return &rb_zjit_c_frame;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
// Read JITFrame from this frame's stack slot. cfp->jit_return points at
|
|
161
|
+
// the slot reserved for this frame's inlining depth, so distinct frames in
|
|
162
|
+
// the same JIT function read distinct slots. An initial frame describing
|
|
163
|
+
// the entry PC + iseq is written by gen_entry_point() for the top-level
|
|
164
|
+
// frame and by gen_push_inline_frame() for inlined frames. That entry
|
|
165
|
+
// PC is correct only at the frame's start; because the PC this frame reports
|
|
166
|
+
// must track where execution currently is, later gen_save_pc_for_gc() calls
|
|
167
|
+
// rewrite the slot with the live PC as execution advances through the frame,
|
|
168
|
+
// before any non-leaf C call.
|
|
169
|
+
return (const zjit_jit_frame_t *)((VALUE *)cfp->jit_return)[-1];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
#else
|
|
173
|
+
#define rb_zjit_entry 0
|
|
174
|
+
#define rb_zjit_compiling_p false
|
|
175
|
+
static inline void rb_zjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception) {}
|
|
176
|
+
static inline void rb_zjit_profile_insn(uint32_t insn, rb_execution_context_t *ec) {}
|
|
177
|
+
static inline void rb_zjit_profile_enable(const rb_iseq_t *iseq) {}
|
|
178
|
+
static inline void rb_zjit_bop_redefined(int redefined_flag, enum ruby_basic_operators bop) {}
|
|
179
|
+
static inline void rb_zjit_cme_invalidate(const rb_callable_method_entry_t *cme) {}
|
|
180
|
+
static inline void rb_zjit_invalidate_no_ep_escape(const rb_iseq_t *iseq) {}
|
|
181
|
+
static inline void rb_zjit_constant_state_changed(ID id) {}
|
|
182
|
+
static inline void rb_zjit_invalidate_single_ractor(void) {}
|
|
183
|
+
static inline void rb_zjit_tracing_invalidate_all(void) {}
|
|
184
|
+
static inline void rb_zjit_invalidate_newobj_hook(void) {}
|
|
185
|
+
static inline void rb_zjit_invalidate_no_singleton_class(VALUE klass) {}
|
|
186
|
+
static inline void rb_zjit_invalidate_root_box(void) {}
|
|
187
|
+
static inline void rb_zjit_jit_frame_update_references(zjit_jit_frame_t *jit_frame) {}
|
|
188
|
+
static inline void rb_zjit_materialize_frames(const rb_execution_context_t *ec, rb_control_frame_t *cfp) {}
|
|
189
|
+
static inline void rb_zjit_materialize_frames_for_longjmp(const rb_execution_context_t *ec, rb_control_frame_t *cfp) {}
|
|
190
|
+
static inline const zjit_jit_frame_t *CFP_ZJIT_FRAME(const rb_control_frame_t *cfp) { return NULL; }
|
|
191
|
+
#endif // #if USE_ZJIT
|
|
192
|
+
|
|
193
|
+
#define rb_zjit_enabled_p (rb_zjit_entry != 0)
|
|
194
|
+
|
|
195
|
+
// Return true if a given CFP has ZJIT's JITFrame.
|
|
196
|
+
static inline bool
|
|
197
|
+
CFP_ZJIT_FRAME_P(const rb_control_frame_t *cfp)
|
|
198
|
+
{
|
|
199
|
+
if (!rb_zjit_enabled_p) return false;
|
|
200
|
+
return cfp->jit_return != NULL;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
static inline const VALUE*
|
|
204
|
+
CFP_PC(const rb_control_frame_t *cfp)
|
|
205
|
+
{
|
|
206
|
+
if (CFP_ZJIT_FRAME_P(cfp)) {
|
|
207
|
+
return CFP_ZJIT_FRAME(cfp)->pc;
|
|
208
|
+
}
|
|
209
|
+
return cfp->pc;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
static inline const rb_iseq_t*
|
|
213
|
+
CFP_ISEQ(const rb_control_frame_t *cfp)
|
|
214
|
+
{
|
|
215
|
+
if (CFP_ZJIT_FRAME_P(cfp)) {
|
|
216
|
+
return CFP_ZJIT_FRAME(cfp)->iseq;
|
|
217
|
+
}
|
|
218
|
+
return cfp->_iseq;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
#endif // #ifndef ZJIT_H
|