debase-ruby_core_source 3.2.2 → 3.3.0
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/CHANGELOG.md +10 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/addr2line.h +3 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ccan/list/list.h +4 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/dln.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/eval_intern.h +4 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/insns.inc +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/insns_info.inc +280 -198
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/array.h +8 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/bits.h +6 -6
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/class.h +53 -3
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/cmdlineopt.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/cont.h +3 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/encoding.h +3 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/error.h +3 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/gc.h +3 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/hash.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/imemo.h +0 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/object.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/parse.h +7 -32
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/random.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/string.h +0 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/symbol.h +3 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/thread.h +4 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/transcode.h +3 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/variable.h +5 -4
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/vm.h +9 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/iseq.h +5 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/method.h +7 -7
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/node.h +22 -19
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/node_name.inc +4 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/optunifs.inc +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/parse.h +16 -5
- data/lib/debase/ruby_core_source/ruby-3.3.0-p0/parser_node.h +32 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-p0/prism_compile.h +29 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ractor_core.h +7 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/regint.h +8 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/regparse.h +2 -1
- data/lib/debase/ruby_core_source/ruby-3.3.0-p0/revision.h +5 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/rjit.h +6 -8
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/rjit_c.h +0 -1
- data/lib/debase/ruby_core_source/ruby-3.3.0-p0/rubyparser.h +1403 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/shape.h +32 -32
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/symbol.h +1 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/thread_none.h +1 -0
- data/lib/debase/ruby_core_source/ruby-3.3.0-p0/thread_pthread.h +166 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/thread_win32.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/variable.h +11 -2
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/version.h +8 -4
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm.inc +225 -185
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_callinfo.h +12 -1
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_core.h +128 -16
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_insnhelper.h +4 -14
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vmtc.inc +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/yjit.h +10 -8
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +121 -120
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_node.h +0 -133
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/revision.h +0 -5
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/rubyparser.h +0 -628
- data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/thread_pthread.h +0 -126
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/builtin.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/constant.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/darray.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/debug_counter.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/encindex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/hrtime.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/id.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/id_table.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/basic_operators.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/bignum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/compar.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/compile.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/compilers.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/complex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/dir.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/enc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/enum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/enumerator.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/eval.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/file.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/fixnum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/inits.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/io.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/load.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/loadpath.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/math.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/missing.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/numeric.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/proc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/process.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/ractor.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/range.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/rational.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/re.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/ruby_parser.h +2 -2
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/sanitizers.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/serial.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/signal.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/static_assert.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/struct.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/time.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/util.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal/warnings.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/internal.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/known_errors.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/optinsn.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/parser_bits.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/parser_st.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/parser_value.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/probes_helper.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/regenc.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ruby_assert.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/ruby_atomic.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/siphash.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/timev.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/transcode_data.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_call_iseq_optimized.inc +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_debug.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_exec.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_opts.h +0 -0
- /data/lib/debase/ruby_core_source/{ruby-3.3.0-preview2 → ruby-3.3.0-p0}/vm_sync.h +0 -0
|
@@ -43,6 +43,7 @@ enum vm_call_flag_bits {
|
|
|
43
43
|
|
|
44
44
|
struct rb_callinfo_kwarg {
|
|
45
45
|
int keyword_len;
|
|
46
|
+
int references;
|
|
46
47
|
VALUE keywords[];
|
|
47
48
|
};
|
|
48
49
|
|
|
@@ -199,6 +200,9 @@ vm_ci_dump(const struct rb_callinfo *ci)
|
|
|
199
200
|
static inline const struct rb_callinfo *
|
|
200
201
|
vm_ci_new_(ID mid, unsigned int flag, unsigned int argc, const struct rb_callinfo_kwarg *kwarg, const char *file, int line)
|
|
201
202
|
{
|
|
203
|
+
if (kwarg) {
|
|
204
|
+
((struct rb_callinfo_kwarg *)kwarg)->references++;
|
|
205
|
+
}
|
|
202
206
|
if (USE_EMBED_CI && VM_CI_EMBEDDABLE_P(mid, flag, argc, kwarg)) {
|
|
203
207
|
RB_DEBUG_COUNTER_INC(ci_packed);
|
|
204
208
|
return vm_ci_new_id(mid, flag, argc, kwarg);
|
|
@@ -296,6 +300,7 @@ struct rb_callcache {
|
|
|
296
300
|
#define VM_CALLCACHE_UNMARKABLE FL_FREEZE
|
|
297
301
|
#define VM_CALLCACHE_ON_STACK FL_EXIVAR
|
|
298
302
|
|
|
303
|
+
/* VM_CALLCACHE_IVAR used for IVAR/ATTRSET/STRUCT_AREF/STRUCT_ASET methods */
|
|
299
304
|
#define VM_CALLCACHE_IVAR IMEMO_FL_USER0
|
|
300
305
|
#define VM_CALLCACHE_BF IMEMO_FL_USER1
|
|
301
306
|
#define VM_CALLCACHE_SUPER IMEMO_FL_USER2
|
|
@@ -483,6 +488,12 @@ vm_cc_call_set(const struct rb_callcache *cc, vm_call_handler call)
|
|
|
483
488
|
*(vm_call_handler *)&cc->call_ = call;
|
|
484
489
|
}
|
|
485
490
|
|
|
491
|
+
static inline void
|
|
492
|
+
set_vm_cc_ivar(const struct rb_callcache *cc)
|
|
493
|
+
{
|
|
494
|
+
*(VALUE *)&cc->flags |= VM_CALLCACHE_IVAR;
|
|
495
|
+
}
|
|
496
|
+
|
|
486
497
|
static inline void
|
|
487
498
|
vm_cc_attr_index_set(const struct rb_callcache *cc, attr_index_t index, shape_id_t dest_shape_id)
|
|
488
499
|
{
|
|
@@ -494,7 +505,7 @@ vm_cc_attr_index_set(const struct rb_callcache *cc, attr_index_t index, shape_id
|
|
|
494
505
|
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
|
495
506
|
VM_ASSERT(cc != vm_cc_empty());
|
|
496
507
|
*attr_value = (attr_index_t)(index + 1) | ((uintptr_t)(dest_shape_id) << SHAPE_FLAG_SHIFT);
|
|
497
|
-
|
|
508
|
+
set_vm_cc_ivar(cc);
|
|
498
509
|
}
|
|
499
510
|
|
|
500
511
|
static inline bool
|
|
@@ -524,6 +524,8 @@ struct rb_iseq_constant_body {
|
|
|
524
524
|
#if USE_YJIT
|
|
525
525
|
// YJIT stores some data on each iseq.
|
|
526
526
|
void *yjit_payload;
|
|
527
|
+
// Used to estimate how frequently this ISEQ gets called
|
|
528
|
+
uint64_t yjit_calls_at_interv;
|
|
527
529
|
#endif
|
|
528
530
|
};
|
|
529
531
|
|
|
@@ -634,15 +636,51 @@ typedef struct rb_vm_struct {
|
|
|
634
636
|
struct rb_ractor_struct *lock_owner;
|
|
635
637
|
unsigned int lock_rec;
|
|
636
638
|
|
|
637
|
-
// barrier
|
|
638
|
-
bool barrier_waiting;
|
|
639
|
-
unsigned int barrier_cnt;
|
|
640
|
-
rb_nativethread_cond_t barrier_cond;
|
|
641
|
-
|
|
642
639
|
// join at exit
|
|
643
640
|
rb_nativethread_cond_t terminate_cond;
|
|
644
641
|
bool terminate_waiting;
|
|
642
|
+
|
|
643
|
+
#ifndef RUBY_THREAD_PTHREAD_H
|
|
644
|
+
bool barrier_waiting;
|
|
645
|
+
unsigned int barrier_cnt;
|
|
646
|
+
rb_nativethread_cond_t barrier_cond;
|
|
647
|
+
#endif
|
|
645
648
|
} sync;
|
|
649
|
+
|
|
650
|
+
// ractor scheduling
|
|
651
|
+
struct {
|
|
652
|
+
rb_nativethread_lock_t lock;
|
|
653
|
+
struct rb_ractor_struct *lock_owner;
|
|
654
|
+
bool locked;
|
|
655
|
+
|
|
656
|
+
rb_nativethread_cond_t cond; // GRQ
|
|
657
|
+
unsigned int snt_cnt; // count of shared NTs
|
|
658
|
+
unsigned int dnt_cnt; // count of dedicated NTs
|
|
659
|
+
|
|
660
|
+
unsigned int running_cnt;
|
|
661
|
+
|
|
662
|
+
unsigned int max_cpu;
|
|
663
|
+
struct ccan_list_head grq; // // Global Ready Queue
|
|
664
|
+
unsigned int grq_cnt;
|
|
665
|
+
|
|
666
|
+
// running threads
|
|
667
|
+
struct ccan_list_head running_threads;
|
|
668
|
+
|
|
669
|
+
// threads which switch context by timeslice
|
|
670
|
+
struct ccan_list_head timeslice_threads;
|
|
671
|
+
|
|
672
|
+
struct ccan_list_head zombie_threads;
|
|
673
|
+
|
|
674
|
+
// true if timeslice timer is not enable
|
|
675
|
+
bool timeslice_wait_inf;
|
|
676
|
+
|
|
677
|
+
// barrier
|
|
678
|
+
rb_nativethread_cond_t barrier_complete_cond;
|
|
679
|
+
rb_nativethread_cond_t barrier_release_cond;
|
|
680
|
+
bool barrier_waiting;
|
|
681
|
+
unsigned int barrier_waiting_cnt;
|
|
682
|
+
unsigned int barrier_serial;
|
|
683
|
+
} sched;
|
|
646
684
|
} ractor;
|
|
647
685
|
|
|
648
686
|
#ifdef USE_SIGALTSTACK
|
|
@@ -688,9 +726,8 @@ typedef struct rb_vm_struct {
|
|
|
688
726
|
/* relation table of ensure - rollback for callcc */
|
|
689
727
|
struct st_table *ensure_rollback_table;
|
|
690
728
|
|
|
691
|
-
/* postponed_job (async-signal-safe,
|
|
692
|
-
struct
|
|
693
|
-
rb_atomic_t postponed_job_index;
|
|
729
|
+
/* postponed_job (async-signal-safe, and thread-safe) */
|
|
730
|
+
struct rb_postponed_job_queue *postponed_job_queue;
|
|
694
731
|
|
|
695
732
|
int src_encoding_index;
|
|
696
733
|
|
|
@@ -846,6 +883,61 @@ typedef RUBY_JMP_BUF rb_jmpbuf_t;
|
|
|
846
883
|
typedef void *rb_jmpbuf_t[5];
|
|
847
884
|
#endif
|
|
848
885
|
|
|
886
|
+
/*
|
|
887
|
+
`rb_vm_tag_jmpbuf_t` type represents a buffer used to
|
|
888
|
+
long jump to a C frame associated with `rb_vm_tag`.
|
|
889
|
+
|
|
890
|
+
Use-site of `rb_vm_tag_jmpbuf_t` is responsible for calling the
|
|
891
|
+
following functions:
|
|
892
|
+
- `rb_vm_tag_jmpbuf_init` once `rb_vm_tag_jmpbuf_t` is allocated.
|
|
893
|
+
- `rb_vm_tag_jmpbuf_deinit` once `rb_vm_tag_jmpbuf_t` is no longer necessary.
|
|
894
|
+
|
|
895
|
+
`RB_VM_TAG_JMPBUF_GET` transforms a `rb_vm_tag_jmpbuf_t` into a
|
|
896
|
+
`rb_jmpbuf_t` to be passed to `rb_setjmp/rb_longjmp`.
|
|
897
|
+
*/
|
|
898
|
+
#if defined(__wasm__) && !defined(__EMSCRIPTEN__)
|
|
899
|
+
/*
|
|
900
|
+
WebAssembly target with Asyncify-based SJLJ needs
|
|
901
|
+
to capture the execution context by unwind/rewind-ing
|
|
902
|
+
call frames into a jump buffer. The buffer space tends
|
|
903
|
+
to be considerably large unlike other architectures'
|
|
904
|
+
register-based buffers.
|
|
905
|
+
Therefore, we allocates the buffer on the heap on such
|
|
906
|
+
environments.
|
|
907
|
+
*/
|
|
908
|
+
typedef rb_jmpbuf_t *rb_vm_tag_jmpbuf_t;
|
|
909
|
+
|
|
910
|
+
#define RB_VM_TAG_JMPBUF_GET(buf) (*buf)
|
|
911
|
+
|
|
912
|
+
static inline void
|
|
913
|
+
rb_vm_tag_jmpbuf_init(rb_vm_tag_jmpbuf_t *jmpbuf)
|
|
914
|
+
{
|
|
915
|
+
*jmpbuf = ruby_xmalloc(sizeof(rb_jmpbuf_t));
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
static inline void
|
|
919
|
+
rb_vm_tag_jmpbuf_deinit(const rb_vm_tag_jmpbuf_t *jmpbuf)
|
|
920
|
+
{
|
|
921
|
+
ruby_xfree(*jmpbuf);
|
|
922
|
+
}
|
|
923
|
+
#else
|
|
924
|
+
typedef rb_jmpbuf_t rb_vm_tag_jmpbuf_t;
|
|
925
|
+
|
|
926
|
+
#define RB_VM_TAG_JMPBUF_GET(buf) (buf)
|
|
927
|
+
|
|
928
|
+
static inline void
|
|
929
|
+
rb_vm_tag_jmpbuf_init(rb_vm_tag_jmpbuf_t *jmpbuf)
|
|
930
|
+
{
|
|
931
|
+
// no-op
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
static inline void
|
|
935
|
+
rb_vm_tag_jmpbuf_deinit(const rb_vm_tag_jmpbuf_t *jmpbuf)
|
|
936
|
+
{
|
|
937
|
+
// no-op
|
|
938
|
+
}
|
|
939
|
+
#endif
|
|
940
|
+
|
|
849
941
|
/*
|
|
850
942
|
the members which are written in EC_PUSH_TAG() should be placed at
|
|
851
943
|
the beginning and the end, so that entire region is accessible.
|
|
@@ -853,7 +945,7 @@ typedef void *rb_jmpbuf_t[5];
|
|
|
853
945
|
struct rb_vm_tag {
|
|
854
946
|
VALUE tag;
|
|
855
947
|
VALUE retval;
|
|
856
|
-
|
|
948
|
+
rb_vm_tag_jmpbuf_t buf;
|
|
857
949
|
struct rb_vm_tag *prev;
|
|
858
950
|
enum ruby_tag_type state;
|
|
859
951
|
unsigned int lock_rec;
|
|
@@ -861,7 +953,7 @@ struct rb_vm_tag {
|
|
|
861
953
|
|
|
862
954
|
STATIC_ASSERT(rb_vm_tag_buf_offset, offsetof(struct rb_vm_tag, buf) > 0);
|
|
863
955
|
STATIC_ASSERT(rb_vm_tag_buf_end,
|
|
864
|
-
offsetof(struct rb_vm_tag, buf) + sizeof(
|
|
956
|
+
offsetof(struct rb_vm_tag, buf) + sizeof(rb_vm_tag_jmpbuf_t) <
|
|
865
957
|
sizeof(struct rb_vm_tag));
|
|
866
958
|
|
|
867
959
|
struct rb_unblock_callback {
|
|
@@ -1059,6 +1151,7 @@ typedef struct rb_thread_struct {
|
|
|
1059
1151
|
|
|
1060
1152
|
/* misc */
|
|
1061
1153
|
VALUE name;
|
|
1154
|
+
void **specific_storage;
|
|
1062
1155
|
|
|
1063
1156
|
struct rb_ext_config ext_config;
|
|
1064
1157
|
} rb_thread_t;
|
|
@@ -1678,13 +1771,13 @@ VALUE rb_proc_alloc(VALUE klass);
|
|
|
1678
1771
|
VALUE rb_proc_dup(VALUE self);
|
|
1679
1772
|
|
|
1680
1773
|
/* for debug */
|
|
1681
|
-
extern
|
|
1682
|
-
extern
|
|
1683
|
-
extern
|
|
1774
|
+
extern bool rb_vmdebug_stack_dump_raw(const rb_execution_context_t *ec, const rb_control_frame_t *cfp, FILE *);
|
|
1775
|
+
extern bool rb_vmdebug_debug_print_pre(const rb_execution_context_t *ec, const rb_control_frame_t *cfp, const VALUE *_pc, FILE *);
|
|
1776
|
+
extern bool rb_vmdebug_debug_print_post(const rb_execution_context_t *ec, const rb_control_frame_t *cfp, FILE *);
|
|
1684
1777
|
|
|
1685
|
-
#define SDR() rb_vmdebug_stack_dump_raw(GET_EC(), GET_EC()->cfp)
|
|
1686
|
-
#define SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_EC(), (cfp))
|
|
1687
|
-
|
|
1778
|
+
#define SDR() rb_vmdebug_stack_dump_raw(GET_EC(), GET_EC()->cfp, stderr)
|
|
1779
|
+
#define SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_EC(), (cfp), stderr)
|
|
1780
|
+
bool rb_vm_bugreport(const void *, FILE *);
|
|
1688
1781
|
typedef void (*ruby_sighandler_t)(int);
|
|
1689
1782
|
RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 4, 5)
|
|
1690
1783
|
NORETURN(void rb_bug_for_fatal_signal(ruby_sighandler_t default_sighandler, int sig, const void *, const char *fmt, ...));
|
|
@@ -1739,6 +1832,7 @@ rb_vm_living_threads_init(rb_vm_t *vm)
|
|
|
1739
1832
|
ccan_list_head_init(&vm->waiting_fds);
|
|
1740
1833
|
ccan_list_head_init(&vm->workqueue);
|
|
1741
1834
|
ccan_list_head_init(&vm->ractor.set);
|
|
1835
|
+
ccan_list_head_init(&vm->ractor.sched.zombie_threads);
|
|
1742
1836
|
}
|
|
1743
1837
|
|
|
1744
1838
|
typedef int rb_backtrace_iter_func(void *, VALUE, int, VALUE);
|
|
@@ -1839,6 +1933,20 @@ rb_current_execution_context(bool expect_ec)
|
|
|
1839
1933
|
#else
|
|
1840
1934
|
rb_execution_context_t *ec = ruby_current_ec;
|
|
1841
1935
|
#endif
|
|
1936
|
+
|
|
1937
|
+
/* On the shared objects, `__tls_get_addr()` is used to access the TLS
|
|
1938
|
+
* and the address of the `ruby_current_ec` can be stored on a function
|
|
1939
|
+
* frame. However, this address can be mis-used after native thread
|
|
1940
|
+
* migration of a coroutine.
|
|
1941
|
+
* 1) Get `ptr =&ruby_current_ec` op NT1 and store it on the frame.
|
|
1942
|
+
* 2) Context switch and resume it on the NT2.
|
|
1943
|
+
* 3) `ptr` is used on NT2 but it accesses to the TLS on NT1.
|
|
1944
|
+
* This assertion checks such misusage.
|
|
1945
|
+
*
|
|
1946
|
+
* To avoid accidents, `GET_EC()` should be called once on the frame.
|
|
1947
|
+
* Note that inlining can produce the problem.
|
|
1948
|
+
*/
|
|
1949
|
+
VM_ASSERT(ec == rb_current_ec_noinline());
|
|
1842
1950
|
#else
|
|
1843
1951
|
rb_execution_context_t *ec = native_tls_get(ruby_current_ec_key);
|
|
1844
1952
|
#endif
|
|
@@ -2062,6 +2170,10 @@ rb_exec_event_hook_script_compiled(rb_execution_context_t *ec, const rb_iseq_t *
|
|
|
2062
2170
|
}
|
|
2063
2171
|
|
|
2064
2172
|
void rb_vm_trap_exit(rb_vm_t *vm);
|
|
2173
|
+
void rb_vm_postponed_job_atfork(void); /* vm_trace.c */
|
|
2174
|
+
void rb_vm_postponed_job_free(void); /* vm_trace.c */
|
|
2175
|
+
size_t rb_vm_memsize_postponed_job_queue(void); /* vm_trace.c */
|
|
2176
|
+
void rb_vm_postponed_job_queue_init(rb_vm_t *vm); /* vm_trace.c */
|
|
2065
2177
|
|
|
2066
2178
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
2067
2179
|
|
|
@@ -16,23 +16,13 @@ RUBY_EXTERN rb_serial_t ruby_vm_constant_cache_invalidations;
|
|
|
16
16
|
RUBY_EXTERN rb_serial_t ruby_vm_constant_cache_misses;
|
|
17
17
|
RUBY_EXTERN rb_serial_t ruby_vm_global_cvar_state;
|
|
18
18
|
|
|
19
|
-
#
|
|
20
|
-
# define RJIT_STATS RUBY_DEBUG
|
|
21
|
-
#endif
|
|
22
|
-
|
|
23
|
-
#if USE_YJIT // We want vm_insns_count on any YJIT-enabled build
|
|
19
|
+
#if USE_YJIT || USE_RJIT // We want vm_insns_count on any JIT-enabled build.
|
|
24
20
|
// Increment vm_insns_count for --yjit-stats. We increment this even when
|
|
25
21
|
// --yjit or --yjit-stats is not used because branching to skip it is slower.
|
|
26
22
|
// We also don't use ATOMIC_INC for performance, allowing inaccuracy on Ractors.
|
|
27
|
-
#define
|
|
28
|
-
#else
|
|
29
|
-
#define YJIT_COLLECT_USAGE_INSN(insn) // none
|
|
30
|
-
#endif
|
|
31
|
-
|
|
32
|
-
#if RJIT_STATS
|
|
33
|
-
#define RJIT_COLLECT_USAGE_INSN(insn) rb_rjit_collect_vm_usage_insn(insn)
|
|
23
|
+
#define JIT_COLLECT_USAGE_INSN(insn) rb_vm_insns_count++
|
|
34
24
|
#else
|
|
35
|
-
#define
|
|
25
|
+
#define JIT_COLLECT_USAGE_INSN(insn) // none
|
|
36
26
|
#endif
|
|
37
27
|
|
|
38
28
|
#if VM_COLLECT_USAGE_DETAILS
|
|
@@ -40,7 +30,7 @@ RUBY_EXTERN rb_serial_t ruby_vm_global_cvar_state;
|
|
|
40
30
|
#define COLLECT_USAGE_OPERAND(insn, n, op) vm_collect_usage_operand((insn), (n), ((VALUE)(op)))
|
|
41
31
|
#define COLLECT_USAGE_REGISTER(reg, s) vm_collect_usage_register((reg), (s))
|
|
42
32
|
#else
|
|
43
|
-
#define COLLECT_USAGE_INSN(insn)
|
|
33
|
+
#define COLLECT_USAGE_INSN(insn) JIT_COLLECT_USAGE_INSN(insn)
|
|
44
34
|
#define COLLECT_USAGE_OPERAND(insn, n, op) // none
|
|
45
35
|
#define COLLECT_USAGE_REGISTER(reg, s) // none
|
|
46
36
|
#endif
|
|
@@ -69,6 +69,7 @@ static const void *const insns_address_table[] = {
|
|
|
69
69
|
LABEL_PTR(expandarray),
|
|
70
70
|
LABEL_PTR(concatarray),
|
|
71
71
|
LABEL_PTR(splatarray),
|
|
72
|
+
LABEL_PTR(splatkw),
|
|
72
73
|
LABEL_PTR(newhash),
|
|
73
74
|
LABEL_PTR(newrange),
|
|
74
75
|
LABEL_PTR(pop),
|
|
@@ -170,6 +171,7 @@ static const void *const insns_address_table[] = {
|
|
|
170
171
|
LABEL_PTR(trace_expandarray),
|
|
171
172
|
LABEL_PTR(trace_concatarray),
|
|
172
173
|
LABEL_PTR(trace_splatarray),
|
|
174
|
+
LABEL_PTR(trace_splatkw),
|
|
173
175
|
LABEL_PTR(trace_newhash),
|
|
174
176
|
LABEL_PTR(trace_newrange),
|
|
175
177
|
LABEL_PTR(trace_pop),
|
|
@@ -25,15 +25,17 @@
|
|
|
25
25
|
#endif
|
|
26
26
|
|
|
27
27
|
// Expose these as declarations since we are building YJIT.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
extern uint64_t rb_yjit_call_threshold;
|
|
29
|
+
extern uint64_t rb_yjit_cold_threshold;
|
|
30
|
+
extern uint64_t rb_yjit_live_iseq_count;
|
|
31
|
+
extern bool rb_yjit_enabled_p;
|
|
32
|
+
void rb_yjit_incr_counter(const char *counter_name);
|
|
31
33
|
void rb_yjit_invalidate_all_method_lookup_assumptions(void);
|
|
32
34
|
void rb_yjit_cme_invalidate(rb_callable_method_entry_t *cme);
|
|
33
35
|
void rb_yjit_collect_binding_alloc(void);
|
|
34
36
|
void rb_yjit_collect_binding_set(void);
|
|
35
37
|
void rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception);
|
|
36
|
-
void rb_yjit_init(
|
|
38
|
+
void rb_yjit_init(bool yjit_enabled);
|
|
37
39
|
void rb_yjit_bop_redefined(int redefined_flag, enum ruby_basic_operators bop);
|
|
38
40
|
void rb_yjit_constant_state_changed(ID id);
|
|
39
41
|
void rb_yjit_iseq_mark(void *payload);
|
|
@@ -42,20 +44,20 @@ void rb_yjit_iseq_free(void *payload);
|
|
|
42
44
|
void rb_yjit_before_ractor_spawn(void);
|
|
43
45
|
void rb_yjit_constant_ic_update(const rb_iseq_t *const iseq, IC ic, unsigned insn_idx);
|
|
44
46
|
void rb_yjit_tracing_invalidate_all(void);
|
|
47
|
+
void rb_yjit_show_usage(int help, int highlight, unsigned int width, int columns);
|
|
45
48
|
|
|
46
49
|
#else
|
|
47
50
|
// !USE_YJIT
|
|
48
51
|
// In these builds, YJIT could never be turned on. Provide dummy implementations.
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
static inline
|
|
52
|
-
static inline bool rb_yjit_threshold_hit(const rb_iseq_t *const iseq, unsigned long total_calls) { return false; }
|
|
53
|
+
#define rb_yjit_enabled_p false
|
|
54
|
+
static inline void rb_yjit_incr_counter(const char *counter_name) {}
|
|
53
55
|
static inline void rb_yjit_invalidate_all_method_lookup_assumptions(void) {}
|
|
54
56
|
static inline void rb_yjit_cme_invalidate(rb_callable_method_entry_t *cme) {}
|
|
55
57
|
static inline void rb_yjit_collect_binding_alloc(void) {}
|
|
56
58
|
static inline void rb_yjit_collect_binding_set(void) {}
|
|
57
59
|
static inline void rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec, bool jit_exception) {}
|
|
58
|
-
static inline void rb_yjit_init(
|
|
60
|
+
static inline void rb_yjit_init(bool yjit_enabled) {}
|
|
59
61
|
static inline void rb_yjit_bop_redefined(int redefined_flag, enum ruby_basic_operators bop) {}
|
|
60
62
|
static inline void rb_yjit_constant_state_changed(ID id) {}
|
|
61
63
|
static inline void rb_yjit_iseq_mark(void *payload) {}
|