This commit is contained in:
Noah Gibbs 2021-10-01 12:17:09 +01:00 коммит произвёл Alan Wu
Родитель f36a5a98c0
Коммит be06112d48
8 изменённых файлов: 203 добавлений и 12 удалений

185
common.mk
Просмотреть файл

@ -2529,6 +2529,7 @@ class.$(OBJEXT): {$(VPATH)}class.c
class.$(OBJEXT): {$(VPATH)}config.h
class.$(OBJEXT): {$(VPATH)}constant.h
class.$(OBJEXT): {$(VPATH)}darray.h
class.$(OBJEXT): {$(VPATH)}debug_counter.h
class.$(OBJEXT): {$(VPATH)}defines.h
class.$(OBJEXT): {$(VPATH)}encoding.h
class.$(OBJEXT): {$(VPATH)}id.h
@ -6032,6 +6033,190 @@ gc.$(OBJEXT): {$(VPATH)}vm_debug.h
gc.$(OBJEXT): {$(VPATH)}vm_opts.h
gc.$(OBJEXT): {$(VPATH)}vm_sync.h
gc.$(OBJEXT): {$(VPATH)}yjit.h
golf_prelude.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
golf_prelude.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
golf_prelude.$(OBJEXT): $(CCAN_DIR)/list/list.h
golf_prelude.$(OBJEXT): $(CCAN_DIR)/str/str.h
golf_prelude.$(OBJEXT): $(hdrdir)/ruby.h
golf_prelude.$(OBJEXT): $(hdrdir)/ruby/ruby.h
golf_prelude.$(OBJEXT): $(top_srcdir)/internal/array.h
golf_prelude.$(OBJEXT): $(top_srcdir)/internal/compilers.h
golf_prelude.$(OBJEXT): $(top_srcdir)/internal/gc.h
golf_prelude.$(OBJEXT): $(top_srcdir)/internal/imemo.h
golf_prelude.$(OBJEXT): $(top_srcdir)/internal/serial.h
golf_prelude.$(OBJEXT): $(top_srcdir)/internal/static_assert.h
golf_prelude.$(OBJEXT): $(top_srcdir)/internal/vm.h
golf_prelude.$(OBJEXT): $(top_srcdir)/internal/warnings.h
golf_prelude.$(OBJEXT): {$(VPATH)}assert.h
golf_prelude.$(OBJEXT): {$(VPATH)}atomic.h
golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/assume.h
golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/attributes.h
golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/bool.h
golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/gcc_version_since.h
golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/inttypes.h
golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/limits.h
golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/long_long.h
golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/stdalign.h
golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/stdarg.h
golf_prelude.$(OBJEXT): {$(VPATH)}config.h
golf_prelude.$(OBJEXT): {$(VPATH)}darray.h
golf_prelude.$(OBJEXT): {$(VPATH)}defines.h
golf_prelude.$(OBJEXT): {$(VPATH)}golf_prelude.c
golf_prelude.$(OBJEXT): {$(VPATH)}golf_prelude.rb
golf_prelude.$(OBJEXT): {$(VPATH)}id.h
golf_prelude.$(OBJEXT): {$(VPATH)}intern.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/anyargs.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/char.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/double.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/fixnum.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/gid_t.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/int.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/intptr_t.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/long.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/long_long.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/mode_t.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/off_t.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/pid_t.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/short.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/size_t.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/st_data_t.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/uid_t.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/assume.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/alloc_size.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/artificial.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/cold.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/const.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/constexpr.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/deprecated.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/diagnose_if.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/enum_extensibility.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/error.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/flag_enum.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/forceinline.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/format.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/maybe_unused.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/noalias.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/nodiscard.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/noexcept.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/noinline.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/nonnull.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/noreturn.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/pure.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/restrict.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/returns_nonnull.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/warning.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/weakref.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/cast.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_is.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_is/apple.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_is/clang.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_is/gcc.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_is/intel.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_is/msvc.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_is/sunpro.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_since.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/config.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/constant_p.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/core.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rarray.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rbasic.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rbignum.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rclass.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rdata.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rfile.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rhash.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/robject.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rregexp.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rstring.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rstruct.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rtypeddata.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/ctype.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/dllexport.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/dosish.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/error.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/eval.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/event.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/fl_type.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/gc.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/glob.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/globals.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/attribute.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/builtin.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/c_attribute.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/cpp_attribute.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/declspec_attribute.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/extension.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/feature.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/warning.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/array.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/bignum.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/class.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/compar.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/complex.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/cont.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/dir.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/enum.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/enumerator.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/error.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/eval.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/file.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/gc.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/hash.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/io.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/load.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/marshal.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/numeric.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/object.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/parse.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/proc.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/process.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/random.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/range.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/rational.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/re.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/ruby.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/select.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/select/largesize.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/signal.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/sprintf.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/string.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/struct.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/thread.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/time.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/variable.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/vm.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/interpreter.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/iterator.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/memory.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/method.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/module.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/newobj.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/rgengc.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/scan_args.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/special_consts.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/static_assert.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/stdalign.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/stdbool.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/symbol.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/value.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/value_type.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/variable.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/warning_push.h
golf_prelude.$(OBJEXT): {$(VPATH)}internal/xmalloc.h
golf_prelude.$(OBJEXT): {$(VPATH)}iseq.h
golf_prelude.$(OBJEXT): {$(VPATH)}method.h
golf_prelude.$(OBJEXT): {$(VPATH)}missing.h
golf_prelude.$(OBJEXT): {$(VPATH)}node.h
golf_prelude.$(OBJEXT): {$(VPATH)}ruby_assert.h
golf_prelude.$(OBJEXT): {$(VPATH)}ruby_atomic.h
golf_prelude.$(OBJEXT): {$(VPATH)}st.h
golf_prelude.$(OBJEXT): {$(VPATH)}subst.h
golf_prelude.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h
golf_prelude.$(OBJEXT): {$(VPATH)}thread_native.h
golf_prelude.$(OBJEXT): {$(VPATH)}vm_core.h
golf_prelude.$(OBJEXT): {$(VPATH)}vm_opts.h
goruby.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h
goruby.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h
goruby.$(OBJEXT): $(CCAN_DIR)/list/list.h

Просмотреть файл

@ -3454,6 +3454,7 @@ insn_set_specialized_instruction(rb_iseq_t *iseq, INSN *iobj, int insn_id)
{
iobj->insn_id = insn_id;
iobj->operand_size = insn_len(insn_id) - 1;
iobj->insn_info.events |= RUBY_EVENT_C_CALL | RUBY_EVENT_C_RETURN;
if (insn_id == BIN(opt_neq)) {
VALUE original_ci = iobj->operands[0];
@ -11142,7 +11143,6 @@ ibf_load_code(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t bytecod
for (op_index=0; types[op_index]; op_index++, code_index++) {
char type = types[op_index];
switch (type) {
case TS_CDHASH:
case TS_VALUE:
{
VALUE op = ibf_load_small_value(load, &reading_pos);

3
vm.c
Просмотреть файл

@ -1850,10 +1850,9 @@ rb_vm_check_redefinition_opt_method(const rb_method_entry_t *me, VALUE klass)
klass = RBASIC_CLASS(klass);
}
if (vm_redefinition_check_method_type(me->def)) {
if (st_lookup(vm_opt_method_table, (st_data_t)me, &bop)) {
if (st_lookup(vm_opt_method_def_table, (st_data_t)me->def, &bop)) {
int flag = vm_redefinition_check_flag(klass);
rb_yjit_bop_redefined(klass, me, (enum ruby_basic_operators)bop);
ruby_vm_redefined_flag[bop] |= flag;
}
}

3
yjit.h
Просмотреть файл

@ -57,6 +57,9 @@ struct rb_yjit_options {
// Capture and print out stats
bool gen_stats;
// Run backend tests
bool test_backend;
};
RUBY_SYMBOL_EXPORT_BEGIN

Просмотреть файл

@ -233,6 +233,10 @@ static const x86opnd_t R15B = { OPND_REG, 8, .as.reg = { REG_GP, 15 }};
#define NUM_C_ARG_REGS 6
#define C_ARG_REGS ( (x86opnd_t[]){ RDI, RSI, RDX, RCX, R8, R9 } )
// Compute the number of bits needed to store a signed or unsigned value
uint32_t sig_imm_size(int64_t imm);
uint32_t unsig_imm_size(uint64_t imm);
// Memory operand with base register and displacement/offset
x86opnd_t mem_opnd(uint32_t num_bits, x86opnd_t base_reg, int32_t disp);

Просмотреть файл

@ -714,8 +714,7 @@ yjit_gen_block(block_t *block, rb_execution_context_t *ec)
break;
}
// Move to the next instruction
p_last_op = p_desc;
// Move to the next instruction to compile
insn_idx += insn_len(opcode);
// If the instruction terminates this block
@ -3591,7 +3590,7 @@ gen_send_iseq(jitstate_t *jit, ctx_t *ctx, const struct rb_callinfo *ci, const r
(blockid_t){ iseq, start_pc_offset }
);
return true;
return YJIT_END_BLOCK;
}
const rb_callable_method_entry_t *

Просмотреть файл

@ -1,7 +1,8 @@
#ifndef YJIT_CORE_H
#define YJIT_CORE_H 1
#include "stddef.h"
#include <stddef.h>
#include <stdint.h>
#include "yjit_asm.h"
// Callee-saved regs

Просмотреть файл

@ -15,7 +15,7 @@
#include "yjit_core.h"
#include "darray.h"
#if HAVE_LIBCAPSTONE
#ifdef HAVE_LIBCAPSTONE
#include <capstone/capstone.h>
static VALUE cYjitDisasm;
static VALUE cYjitDisasmInsn;
@ -663,7 +663,7 @@ rb_yjit_before_ractor_spawn(void)
}
}
#if HAVE_LIBCAPSTONE
#ifdef HAVE_LIBCAPSTONE
static const rb_data_type_t yjit_disasm_type = {
"YJIT/Disasm",
{0, (void(*)(void *))cs_close, 0, },
@ -1153,7 +1153,7 @@ rb_yjit_init(struct rb_yjit_options *options)
rb_define_method(cYjitBlock, "outgoing_ids", outgoing_ids, 0);
// YJIT disassembler interface
#if HAVE_LIBCAPSTONE
#ifdef HAVE_LIBCAPSTONE
cYjitDisasm = rb_define_class_under(mYjit, "Disasm", rb_cObject);
rb_define_alloc_func(cYjitDisasm, yjit_disasm_init);
rb_define_method(cYjitDisasm, "disasm", yjit_disasm, 2);