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-11-29 08:33:55 +03:00
|
|
|
RubyVM::MJIT::C = Object.new # forward declaration for mjit/compiler
|
2022-11-27 02:10:58 +03:00
|
|
|
require "mjit/c_type"
|
|
|
|
require "mjit/instruction"
|
|
|
|
require "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
|