зеркало из https://github.com/github/ruby.git
MJIT: Make it parsable by Solargraph (#6827)
* Revert "Revert "MJIT: Make it parsable by Solargraph""
This reverts commit 8e18761da1
.
* Call rb_gc_register_mark_object
This commit is contained in:
Родитель
acb76663ba
Коммит
9c13fc614c
1788
lib/mjit/compiler.rb
1788
lib/mjit/compiler.rb
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
5
mjit.c
5
mjit.c
|
@ -1324,7 +1324,7 @@ static VALUE rb_mMJIT = 0;
|
|||
// RubyVM::MJIT::C
|
||||
VALUE rb_mMJITC = 0;
|
||||
// RubyVM::MJIT::Compiler
|
||||
VALUE rb_mMJITCompiler = 0;
|
||||
VALUE rb_cMJITCompiler = 0;
|
||||
|
||||
// [experimental] Call custom RubyVM::MJIT.compile if defined
|
||||
static void
|
||||
|
@ -1765,8 +1765,9 @@ mjit_init(const struct mjit_options *opts)
|
|||
mjit_enabled = false;
|
||||
return;
|
||||
}
|
||||
rb_mMJITCompiler = rb_const_get(rb_mMJIT, rb_intern("Compiler"));
|
||||
rb_mMJITC = rb_const_get(rb_mMJIT, rb_intern("C"));
|
||||
rb_cMJITCompiler = rb_funcall(rb_const_get(rb_mMJIT, rb_intern("Compiler")), rb_intern("new"), 0);
|
||||
rb_gc_register_mark_object(rb_cMJITCompiler);
|
||||
|
||||
mjit_call_p = true;
|
||||
mjit_pid = getpid();
|
||||
|
|
1
mjit.rb
1
mjit.rb
|
@ -20,6 +20,7 @@ if RubyVM::MJIT.enabled?
|
|||
return # miniruby doesn't support MJIT
|
||||
end
|
||||
|
||||
RubyVM::MJIT::C = Object.new # forward declaration for mjit/compiler
|
||||
require "mjit/c_type"
|
||||
require "mjit/instruction"
|
||||
require "mjit/compiler"
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
# Part of this file is generated by tool/mjit/bindgen.rb.
|
||||
# Run `make mjit-bindgen` to update code between "MJIT bindgen begin" and "MJIT bindgen end".
|
||||
module RubyVM::MJIT
|
||||
C = Object.new
|
||||
|
||||
# This `class << C` section is for calling C functions. For importing variables
|
||||
# or macros as is, please consider using tool/mjit/bindgen.rb instead.
|
||||
class << C
|
||||
|
@ -769,4 +767,4 @@ module RubyVM::MJIT
|
|||
end
|
||||
|
||||
### MJIT bindgen end ###
|
||||
end if RubyVM::MJIT.enabled?
|
||||
end if RubyVM::MJIT.enabled? && RubyVM::MJIT.const_defined?(:C) # not defined for miniruby
|
||||
|
|
|
@ -122,8 +122,8 @@ mjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname, int id)
|
|||
bool original_call_p = mjit_call_p;
|
||||
mjit_call_p = false; // Avoid impacting JIT metrics by itself
|
||||
|
||||
extern VALUE rb_mMJITCompiler;
|
||||
VALUE src = rb_funcall(rb_mMJITCompiler, rb_intern("compile"), 3,
|
||||
extern VALUE rb_cMJITCompiler;
|
||||
VALUE src = rb_funcall(rb_cMJITCompiler, rb_intern("compile"), 3,
|
||||
rb_ptr("rb_iseq_t", iseq), rb_str_new_cstr(funcname), INT2NUM(id));
|
||||
if (!NIL_P(src)) {
|
||||
fprintf(f, "%s", RSTRING_PTR(src));
|
||||
|
|
Загрузка…
Ссылка в новой задаче