debase-ruby_core_source 0.10.13 → 0.10.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/debase-ruby_core_source.gemspec +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/addr2line.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/builtin.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/ccan/build_assert/build_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/ccan/check_type/check_type.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/ccan/container_of/container_of.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/ccan/list/list.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/ccan/str/str.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/constant.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/darray.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/debug_counter.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/dln.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/encindex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/eval_intern.h +32 -1
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/gc.h +0 -1
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/hrtime.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/id.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/id_table.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/insns.inc +4 -2
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/insns_info.inc +309 -224
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/array.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/bignum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/bits.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/class.h +13 -5
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/compar.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/compile.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/compilers.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/complex.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/cont.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/dir.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/enc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/encoding.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/enum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/enumerator.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/error.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/eval.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/file.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/fixnum.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/gc.h +12 -1
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/hash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/imemo.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/inits.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/io.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/load.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/loadpath.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/math.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/missing.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/numeric.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/object.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/parse.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/proc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/process.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/random.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/range.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/rational.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/re.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/sanitizers.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/serial.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/signal.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/static_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/string.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/struct.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/symbol.h +1 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/thread.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/time.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/transcode.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/util.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/variable.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/vm.h +2 -1
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal/warnings.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/internal.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/iseq.h +3 -1
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/known_errors.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/method.h +14 -6
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/mjit.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/mjit_compile.inc +64 -7
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/node.h +28 -17
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/node_name.inc +0 -2
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/opt_sc.inc +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/optinsn.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/optunifs.inc +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/parse.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/probes_helper.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/ractor_core.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/regenc.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/regint.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/regparse.h +0 -0
- data/lib/debase/ruby_core_source/ruby-3.1.0-p0/revision.h +2 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/ruby_assert.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/ruby_atomic.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/siphash.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/symbol.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/thread_pthread.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/thread_win32.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/timev.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/transcode_data.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/transient_heap.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/variable.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/version.h +4 -4
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm.inc +338 -283
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_call_iseq_optimized.inc +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_callinfo.h +41 -8
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_core.h +6 -2
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_debug.h +8 -3
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_exec.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_insnhelper.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_opts.h +0 -0
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_sync.h +1 -1
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vmtc.inc +4 -2
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/yjit.h +11 -1
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/yjit_asm.h +21 -5
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/yjit_codegen.h +5 -1
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/yjit_core.h +11 -6
- data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/yjit_iface.h +0 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +116 -116
- data/lib/debase/ruby_core_source/ruby-3.1.0-preview1/revision.h +0 -2
data/lib/debase/ruby_core_source/{ruby-3.1.0-preview1 → ruby-3.1.0-p0}/vm_call_iseq_optimized.inc
RENAMED
File without changes
|
@@ -290,6 +290,7 @@ struct rb_callcache {
|
|
290
290
|
};
|
291
291
|
|
292
292
|
#define VM_CALLCACHE_UNMARKABLE IMEMO_FL_USER0
|
293
|
+
#define VM_CALLCACHE_ON_STACK IMEMO_FL_USER1
|
293
294
|
|
294
295
|
static inline const struct rb_callcache *
|
295
296
|
vm_cc_new(VALUE klass,
|
@@ -305,7 +306,8 @@ vm_cc_new(VALUE klass,
|
|
305
306
|
(struct rb_callcache) { \
|
306
307
|
.flags = T_IMEMO | \
|
307
308
|
(imemo_callcache << FL_USHIFT) | \
|
308
|
-
VM_CALLCACHE_UNMARKABLE
|
309
|
+
VM_CALLCACHE_UNMARKABLE | \
|
310
|
+
VM_CALLCACHE_ON_STACK, \
|
309
311
|
.klass = clazz, \
|
310
312
|
.cme_ = cme, \
|
311
313
|
.call_ = call, \
|
@@ -321,10 +323,21 @@ vm_cc_class_check(const struct rb_callcache *cc, VALUE klass)
|
|
321
323
|
return cc->klass == klass;
|
322
324
|
}
|
323
325
|
|
326
|
+
static inline int
|
327
|
+
vm_cc_markable(const struct rb_callcache *cc)
|
328
|
+
{
|
329
|
+
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
330
|
+
return FL_TEST_RAW((VALUE)cc, VM_CALLCACHE_UNMARKABLE) == 0;
|
331
|
+
}
|
332
|
+
|
324
333
|
static inline const struct rb_callable_method_entry_struct *
|
325
334
|
vm_cc_cme(const struct rb_callcache *cc)
|
326
335
|
{
|
327
336
|
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
337
|
+
VM_ASSERT(cc->call_ == NULL || // not initialized yet
|
338
|
+
!vm_cc_markable(cc) ||
|
339
|
+
cc->cme_ != NULL);
|
340
|
+
|
328
341
|
return cc->cme_;
|
329
342
|
}
|
330
343
|
|
@@ -332,6 +345,7 @@ static inline vm_call_handler
|
|
332
345
|
vm_cc_call(const struct rb_callcache *cc)
|
333
346
|
{
|
334
347
|
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
348
|
+
VM_ASSERT(cc->call_ != NULL);
|
335
349
|
return cc->call_;
|
336
350
|
}
|
337
351
|
|
@@ -349,13 +363,6 @@ vm_cc_cmethod_missing_reason(const struct rb_callcache *cc)
|
|
349
363
|
return cc->aux_.method_missing_reason;
|
350
364
|
}
|
351
365
|
|
352
|
-
static inline int
|
353
|
-
vm_cc_markable(const struct rb_callcache *cc)
|
354
|
-
{
|
355
|
-
VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache));
|
356
|
-
return FL_TEST_RAW((VALUE)cc, VM_CALLCACHE_UNMARKABLE) == 0;
|
357
|
-
}
|
358
|
-
|
359
366
|
static inline bool
|
360
367
|
vm_cc_invalidated_p(const struct rb_callcache *cc)
|
361
368
|
{
|
@@ -381,6 +388,7 @@ vm_cc_valid_p(const struct rb_callcache *cc, const rb_callable_method_entry_t *c
|
|
381
388
|
}
|
382
389
|
|
383
390
|
extern const struct rb_callcache *rb_vm_empty_cc(void);
|
391
|
+
extern const struct rb_callcache *rb_vm_empty_cc_for_super(void);
|
384
392
|
#define vm_cc_empty() rb_vm_empty_cc()
|
385
393
|
|
386
394
|
/* callcache: mutate */
|
@@ -441,11 +449,36 @@ struct rb_class_cc_entries {
|
|
441
449
|
};
|
442
450
|
|
443
451
|
#if VM_CHECK_MODE > 0
|
452
|
+
|
453
|
+
const rb_callable_method_entry_t *rb_vm_lookup_overloaded_cme(const rb_callable_method_entry_t *cme);
|
454
|
+
void rb_vm_dump_overloaded_cme_table(void);
|
455
|
+
|
444
456
|
static inline bool
|
445
457
|
vm_ccs_p(const struct rb_class_cc_entries *ccs)
|
446
458
|
{
|
447
459
|
return ccs->debug_sig == ~(VALUE)ccs;
|
448
460
|
}
|
461
|
+
|
462
|
+
static inline bool
|
463
|
+
vm_cc_check_cme(const struct rb_callcache *cc, const rb_callable_method_entry_t *cme)
|
464
|
+
{
|
465
|
+
if (vm_cc_cme(cc) == cme ||
|
466
|
+
(cme->def->iseq_overload && vm_cc_cme(cc) == rb_vm_lookup_overloaded_cme(cme))) {
|
467
|
+
return true;
|
468
|
+
}
|
469
|
+
else {
|
470
|
+
#if 1
|
471
|
+
// debug print
|
472
|
+
|
473
|
+
fprintf(stderr, "iseq_overload:%d\n", (int)cme->def->iseq_overload);
|
474
|
+
rp(cme);
|
475
|
+
rp(vm_cc_cme(cc));
|
476
|
+
rb_vm_lookup_overloaded_cme(cme);
|
477
|
+
#endif
|
478
|
+
return false;
|
479
|
+
}
|
480
|
+
}
|
481
|
+
|
449
482
|
#endif
|
450
483
|
|
451
484
|
// gc.c
|
@@ -482,6 +482,8 @@ struct rb_iseq_constant_body {
|
|
482
482
|
bool builtin_inline_p;
|
483
483
|
struct rb_id_table *outer_variables;
|
484
484
|
|
485
|
+
const rb_iseq_t *mandatory_only_iseq;
|
486
|
+
|
485
487
|
#if USE_MJIT
|
486
488
|
/* The following fields are MJIT related info. */
|
487
489
|
VALUE (*jit_func)(struct rb_execution_context_struct *,
|
@@ -607,8 +609,9 @@ void rb_objspace_call_finalizer(struct rb_objspace *);
|
|
607
609
|
typedef struct rb_hook_list_struct {
|
608
610
|
struct rb_event_hook_struct *hooks;
|
609
611
|
rb_event_flag_t events;
|
610
|
-
unsigned int need_clean;
|
611
612
|
unsigned int running;
|
613
|
+
bool need_clean;
|
614
|
+
bool is_local;
|
612
615
|
} rb_hook_list_t;
|
613
616
|
|
614
617
|
|
@@ -711,6 +714,7 @@ typedef struct rb_vm_struct {
|
|
711
714
|
int builtin_inline_index;
|
712
715
|
|
713
716
|
struct rb_id_table *negative_cme_table;
|
717
|
+
st_table *overloaded_cme_table; // cme -> overloaded_cme
|
714
718
|
|
715
719
|
#ifndef VM_GLOBAL_CC_CACHE_TABLE_SIZE
|
716
720
|
#define VM_GLOBAL_CC_CACHE_TABLE_SIZE 1023
|
@@ -1103,7 +1107,7 @@ RUBY_SYMBOL_EXPORT_BEGIN
|
|
1103
1107
|
/* node -> iseq */
|
1104
1108
|
rb_iseq_t *rb_iseq_new (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent, enum iseq_type);
|
1105
1109
|
rb_iseq_t *rb_iseq_new_top (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent);
|
1106
|
-
rb_iseq_t *rb_iseq_new_main (const rb_ast_body_t *ast, VALUE path, VALUE realpath, const rb_iseq_t *parent);
|
1110
|
+
rb_iseq_t *rb_iseq_new_main (const rb_ast_body_t *ast, VALUE path, VALUE realpath, const rb_iseq_t *parent, int opt);
|
1107
1111
|
rb_iseq_t *rb_iseq_new_eval (const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth);
|
1108
1112
|
rb_iseq_t *rb_iseq_new_with_opt(const rb_ast_body_t *ast, VALUE name, VALUE path, VALUE realpath, VALUE first_lineno, const rb_iseq_t *parent, int isolated_depth,
|
1109
1113
|
enum iseq_type, const rb_compile_option_t*);
|
@@ -12,7 +12,6 @@
|
|
12
12
|
**********************************************************************/
|
13
13
|
|
14
14
|
#include "ruby/ruby.h"
|
15
|
-
#include "node.h"
|
16
15
|
|
17
16
|
RUBY_SYMBOL_EXPORT_BEGIN
|
18
17
|
|
@@ -21,15 +20,21 @@ RUBY_SYMBOL_EXPORT_BEGIN
|
|
21
20
|
#define dpi(i) ruby_debug_print_id(-1, 0, "", (i))
|
22
21
|
#define dpn(n) ruby_debug_print_node(-1, 0, "", (n))
|
23
22
|
|
23
|
+
struct RNode;
|
24
|
+
|
24
25
|
VALUE ruby_debug_print_value(int level, int debug_level, const char *header, VALUE v);
|
25
26
|
ID ruby_debug_print_id(int level, int debug_level, const char *header, ID id);
|
26
|
-
|
27
|
+
struct RNode *ruby_debug_print_node(int level, int debug_level, const char *header, const struct RNode *node);
|
27
28
|
int ruby_debug_print_indent(int level, int debug_level, int indent_level);
|
28
29
|
void ruby_debug_gc_check_func(void);
|
29
30
|
void ruby_set_debug_option(const char *str);
|
30
31
|
|
31
32
|
RUBY_SYMBOL_EXPORT_END
|
32
33
|
|
34
|
+
#ifndef RUBY_DEVEL
|
35
|
+
# define RUBY_DEVEL 0
|
36
|
+
#endif
|
37
|
+
|
33
38
|
#if RUBY_DEVEL
|
34
39
|
#ifndef USE_RUBY_DEBUG_LOG
|
35
40
|
#define USE_RUBY_DEBUG_LOG 0
|
@@ -96,7 +101,7 @@ bool ruby_debug_log_filter(const char *func_name);
|
|
96
101
|
// You can use this macro for temporary usage (you should not commit it).
|
97
102
|
#define _RUBY_DEBUG_LOG(...) ruby_debug_log(__FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING, "" __VA_ARGS__)
|
98
103
|
|
99
|
-
#if USE_RUBY_DEBUG_LOG
|
104
|
+
#if defined(USE_RUBY_DEBUG_LOG) && USE_RUBY_DEBUG_LOG
|
100
105
|
# define RUBY_DEBUG_LOG_ENABLED(func_name) \
|
101
106
|
(ruby_debug_log_mode && ruby_debug_log_filter(func_name))
|
102
107
|
|
File without changes
|
File without changes
|
File without changes
|
@@ -4,7 +4,7 @@
|
|
4
4
|
#include "vm_debug.h"
|
5
5
|
#include "debug_counter.h"
|
6
6
|
|
7
|
-
#if USE_RUBY_DEBUG_LOG
|
7
|
+
#if defined(USE_RUBY_DEBUG_LOG) && USE_RUBY_DEBUG_LOG
|
8
8
|
#define LOCATION_ARGS const char *file, int line
|
9
9
|
#define LOCATION_PARAMS file, line
|
10
10
|
#define APPEND_LOCATION_ARGS , const char *file, int line
|
@@ -58,7 +58,7 @@ static const void *const insns_address_table[] = {
|
|
58
58
|
LABEL_PTR(putspecialobject),
|
59
59
|
LABEL_PTR(putstring),
|
60
60
|
LABEL_PTR(concatstrings),
|
61
|
-
LABEL_PTR(
|
61
|
+
LABEL_PTR(anytostring),
|
62
62
|
LABEL_PTR(toregexp),
|
63
63
|
LABEL_PTR(intern),
|
64
64
|
LABEL_PTR(newarray),
|
@@ -86,6 +86,7 @@ static const void *const insns_address_table[] = {
|
|
86
86
|
LABEL_PTR(definesmethod),
|
87
87
|
LABEL_PTR(send),
|
88
88
|
LABEL_PTR(opt_send_without_block),
|
89
|
+
LABEL_PTR(objtostring),
|
89
90
|
LABEL_PTR(opt_str_freeze),
|
90
91
|
LABEL_PTR(opt_nil_p),
|
91
92
|
LABEL_PTR(opt_str_uminus),
|
@@ -158,7 +159,7 @@ static const void *const insns_address_table[] = {
|
|
158
159
|
LABEL_PTR(trace_putspecialobject),
|
159
160
|
LABEL_PTR(trace_putstring),
|
160
161
|
LABEL_PTR(trace_concatstrings),
|
161
|
-
LABEL_PTR(
|
162
|
+
LABEL_PTR(trace_anytostring),
|
162
163
|
LABEL_PTR(trace_toregexp),
|
163
164
|
LABEL_PTR(trace_intern),
|
164
165
|
LABEL_PTR(trace_newarray),
|
@@ -186,6 +187,7 @@ static const void *const insns_address_table[] = {
|
|
186
187
|
LABEL_PTR(trace_definesmethod),
|
187
188
|
LABEL_PTR(trace_send),
|
188
189
|
LABEL_PTR(trace_opt_send_without_block),
|
190
|
+
LABEL_PTR(trace_objtostring),
|
189
191
|
LABEL_PTR(trace_opt_str_freeze),
|
190
192
|
LABEL_PTR(trace_opt_nil_p),
|
191
193
|
LABEL_PTR(trace_opt_str_uminus),
|
@@ -15,6 +15,13 @@
|
|
15
15
|
# define YJIT_STATS RUBY_DEBUG
|
16
16
|
#endif
|
17
17
|
|
18
|
+
// We generate x86 assembly and rely on mmap(2).
|
19
|
+
#if defined(__x86_64__) && !defined(_WIN32)
|
20
|
+
# define YJIT_SUPPORTED_P 1
|
21
|
+
#else
|
22
|
+
# define YJIT_SUPPORTED_P 0
|
23
|
+
#endif
|
24
|
+
|
18
25
|
struct rb_yjit_options {
|
19
26
|
// Enable compilation with YJIT
|
20
27
|
bool yjit_enabled;
|
@@ -29,6 +36,9 @@ struct rb_yjit_options {
|
|
29
36
|
// Generate versions greedily until the limit is hit
|
30
37
|
bool greedy_versioning;
|
31
38
|
|
39
|
+
// Disable the propagation of type information
|
40
|
+
bool no_type_prop;
|
41
|
+
|
32
42
|
// Maximum number of versions per block
|
33
43
|
// 1 means always create generic versions
|
34
44
|
unsigned max_versions;
|
@@ -57,7 +67,7 @@ void rb_yjit_iseq_mark(const struct rb_iseq_constant_body *body);
|
|
57
67
|
void rb_yjit_iseq_update_references(const struct rb_iseq_constant_body *body);
|
58
68
|
void rb_yjit_iseq_free(const struct rb_iseq_constant_body *body);
|
59
69
|
void rb_yjit_before_ractor_spawn(void);
|
60
|
-
void rb_yjit_constant_ic_update(const rb_iseq_t *iseq, IC ic);
|
70
|
+
void rb_yjit_constant_ic_update(const rb_iseq_t *const iseq, IC ic);
|
61
71
|
void rb_yjit_tracing_invalidate_all(void);
|
62
72
|
|
63
73
|
#endif // #ifndef YJIT_H
|
@@ -26,12 +26,13 @@ typedef struct LabelRef
|
|
26
26
|
typedef struct CodeBlock
|
27
27
|
{
|
28
28
|
// Memory block
|
29
|
-
|
29
|
+
// Users are advised to not use this directly.
|
30
|
+
uint8_t *mem_block_;
|
30
31
|
|
31
32
|
// Memory block size
|
32
33
|
uint32_t mem_size;
|
33
34
|
|
34
|
-
|
35
|
+
// Current writing position
|
35
36
|
uint32_t write_pos;
|
36
37
|
|
37
38
|
// Table of registered label addresses
|
@@ -50,13 +51,25 @@ typedef struct CodeBlock
|
|
50
51
|
// Number of references to labels
|
51
52
|
uint32_t num_refs;
|
52
53
|
|
53
|
-
|
54
|
+
|
55
|
+
// Keep track of the current aligned write position.
|
56
|
+
// Used for changing protection when writing to the JIT buffer
|
57
|
+
uint32_t current_aligned_write_pos;
|
58
|
+
|
59
|
+
// Set if the assembler is unable to output some instructions,
|
60
|
+
// for example, when there is not enough space or when a jump
|
61
|
+
// target is too far away.
|
62
|
+
bool dropped_bytes;
|
54
63
|
|
55
64
|
// Flag to enable or disable comments
|
56
65
|
bool has_asm;
|
57
66
|
|
67
|
+
|
58
68
|
} codeblock_t;
|
59
69
|
|
70
|
+
// 1 is not aligned so this won't match any pages
|
71
|
+
#define ALIGNED_WRITE_POSITION_NONE 1
|
72
|
+
|
60
73
|
enum OpndType
|
61
74
|
{
|
62
75
|
OPND_NONE,
|
@@ -252,8 +265,8 @@ static inline void cb_init(codeblock_t *cb, uint8_t *mem_block, uint32_t mem_siz
|
|
252
265
|
static inline void cb_align_pos(codeblock_t *cb, uint32_t multiple);
|
253
266
|
static inline void cb_set_pos(codeblock_t *cb, uint32_t pos);
|
254
267
|
static inline void cb_set_write_ptr(codeblock_t *cb, uint8_t *code_ptr);
|
255
|
-
static inline uint8_t *cb_get_ptr(codeblock_t *cb, uint32_t index);
|
256
|
-
static inline uint8_t *cb_get_write_ptr(codeblock_t *cb);
|
268
|
+
static inline uint8_t *cb_get_ptr(const codeblock_t *cb, uint32_t index);
|
269
|
+
static inline uint8_t *cb_get_write_ptr(const codeblock_t *cb);
|
257
270
|
static inline void cb_write_byte(codeblock_t *cb, uint8_t byte);
|
258
271
|
static inline void cb_write_bytes(codeblock_t *cb, uint32_t num_bytes, ...);
|
259
272
|
static inline void cb_write_int(codeblock_t *cb, uint64_t val, uint32_t num_bits);
|
@@ -261,6 +274,9 @@ static inline uint32_t cb_new_label(codeblock_t *cb, const char *name);
|
|
261
274
|
static inline void cb_write_label(codeblock_t *cb, uint32_t label_idx);
|
262
275
|
static inline void cb_label_ref(codeblock_t *cb, uint32_t label_idx);
|
263
276
|
static inline void cb_link_labels(codeblock_t *cb);
|
277
|
+
static inline void cb_mark_all_writeable(codeblock_t *cb);
|
278
|
+
static inline void cb_mark_position_writeable(codeblock_t *cb, uint32_t write_pos);
|
279
|
+
static inline void cb_mark_all_executable(codeblock_t *cb);
|
264
280
|
|
265
281
|
// Encode individual instructions into a code block
|
266
282
|
static inline void add(codeblock_t *cb, x86opnd_t opnd0, x86opnd_t opnd1);
|
@@ -10,9 +10,13 @@ typedef enum codegen_status {
|
|
10
10
|
// Code generation function signature
|
11
11
|
typedef codegen_status_t (*codegen_fn)(jitstate_t *jit, ctx_t *ctx, codeblock_t *cb);
|
12
12
|
|
13
|
+
static void jit_ensure_block_entry_exit(jitstate_t *jit);
|
14
|
+
|
13
15
|
static uint8_t *yjit_entry_prologue(codeblock_t *cb, const rb_iseq_t *iseq);
|
14
16
|
|
15
|
-
static
|
17
|
+
static block_t *gen_single_block(blockid_t blockid, const ctx_t *start_ctx, rb_execution_context_t *ec);
|
18
|
+
|
19
|
+
static void gen_code_for_exit_from_stub(void);
|
16
20
|
|
17
21
|
static void yjit_init_codegen(void);
|
18
22
|
|
@@ -192,11 +192,12 @@ typedef struct yjit_branch_entry
|
|
192
192
|
struct yjit_block_version *block;
|
193
193
|
|
194
194
|
// Positions where the generated code starts and ends
|
195
|
-
uint8_t*
|
196
|
-
uint8_t*
|
195
|
+
uint8_t *start_addr;
|
196
|
+
uint8_t *end_addr;
|
197
197
|
|
198
198
|
// Context right after the branch instruction
|
199
|
-
|
199
|
+
// Unused for now.
|
200
|
+
// ctx_t src_ctx;
|
200
201
|
|
201
202
|
// Branch target blocks and their contexts
|
202
203
|
blockid_t targets[2];
|
@@ -204,7 +205,7 @@ typedef struct yjit_branch_entry
|
|
204
205
|
struct yjit_block_version *blocks[2];
|
205
206
|
|
206
207
|
// Jump target addresses
|
207
|
-
uint8_t*
|
208
|
+
uint8_t *dst_addrs[2];
|
208
209
|
|
209
210
|
// Branch code generation function
|
210
211
|
branchgen_fn gen_fn;
|
@@ -241,8 +242,8 @@ typedef struct yjit_block_version
|
|
241
242
|
ctx_t ctx;
|
242
243
|
|
243
244
|
// Positions where the generated code starts and ends
|
244
|
-
uint8_t*
|
245
|
-
uint8_t*
|
245
|
+
uint8_t *start_addr;
|
246
|
+
uint8_t *end_addr;
|
246
247
|
|
247
248
|
// List of incoming branches (from predecessors)
|
248
249
|
branch_array_t incoming;
|
@@ -258,6 +259,10 @@ typedef struct yjit_block_version
|
|
258
259
|
// block in the system.
|
259
260
|
cme_dependency_array_t cme_dependencies;
|
260
261
|
|
262
|
+
// Code address of an exit for `ctx` and `blockid`. Used for block
|
263
|
+
// invalidation.
|
264
|
+
uint8_t *entry_exit;
|
265
|
+
|
261
266
|
// Index one past the last instruction in the iseq
|
262
267
|
uint32_t end_idx;
|
263
268
|
|
File without changes
|