2022-06-15 20:19:33 +03:00
|
|
|
module RubyVM::MJIT
|
|
|
|
def self.enabled?
|
|
|
|
Primitive.cexpr! 'RBOOL(mjit_enabled)'
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.pause(wait: true)
|
|
|
|
Primitive.cexpr! 'mjit_pause(RTEST(wait))'
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.resume
|
|
|
|
Primitive.cexpr! 'mjit_resume()'
|
|
|
|
end
|
|
|
|
end
|
2022-11-27 02:10:58 +03:00
|
|
|
|
|
|
|
if RubyVM::MJIT.enabled?
|
|
|
|
begin
|
|
|
|
require 'fiddle'
|
|
|
|
require 'fiddle/import'
|
|
|
|
rescue LoadError
|
|
|
|
return # miniruby doesn't support MJIT
|
|
|
|
end
|
|
|
|
|
2022-12-22 09:46:15 +03:00
|
|
|
RubyVM::MJIT::C = Object.new # forward declaration for ruby_vm/mjit/compiler
|
|
|
|
require 'ruby_vm/mjit/c_type'
|
|
|
|
require 'ruby_vm/mjit/instruction'
|
|
|
|
require 'ruby_vm/mjit/compiler'
|
2022-11-28 01:50:10 +03:00
|
|
|
|
|
|
|
module RubyVM::MJIT
|
2022-11-28 09:14:48 +03:00
|
|
|
private_constant(*constants)
|
2022-11-28 01:50:10 +03:00
|
|
|
end
|
2022-11-27 02:10:58 +03:00
|
|
|
end
|