module Bootsnap::CompileCache::ISeq
Attributes
Public Class Methods
Source
# File lib/bootsnap/compile_cache/iseq.rb, line 12 def cache_dir=(cache_dir) @cache_dir = cache_dir.end_with?("/") ? "#{cache_dir}iseq" : "#{cache_dir}-iseq" end
Source
# File lib/bootsnap/compile_cache/iseq.rb, line 101 def self.compile_option_updated option = RubyVM::InstructionSequence.compile_option crc = Zlib.crc32(option.inspect) Bootsnap::CompileCache::Native.compile_option_crc32 = crc end
Source
# File lib/bootsnap/compile_cache/iseq.rb, line 59 def self.fetch(path, cache_dir: ISeq.cache_dir) Bootsnap::CompileCache::Native.fetch( cache_dir, path.to_s, Bootsnap::CompileCache::ISeq, nil, ) end
Source
# File lib/bootsnap/compile_cache/iseq.rb, line 76 def self.input_to_output(_data, _kwargs) nil # ruby handles this end
Source
# File lib/bootsnap/compile_cache/iseq.rb, line 27 def self.input_to_storage(_, path) iseq = begin RubyVM::InstructionSequence.compile_file(path) rescue SyntaxError return UNCOMPILABLE # syntax error end begin iseq.to_binary rescue TypeError UNCOMPILABLE # ruby bug #18250 end end
Source
# File lib/bootsnap/compile_cache/iseq.rb, line 108 def self.install!(cache_dir) Bootsnap::CompileCache::ISeq.cache_dir = cache_dir Bootsnap::CompileCache::ISeq.compile_option_updated class << RubyVM::InstructionSequence prepend(InstructionSequenceMixin) end end
Source
# File lib/bootsnap/compile_cache/iseq.rb, line 68 def self.precompile(path) Bootsnap::CompileCache::Native.precompile( cache_dir, path.to_s, Bootsnap::CompileCache::ISeq, ) end
Source
# File lib/bootsnap/compile_cache/iseq.rb, line 48 def self.storage_to_output(binary, _args) RubyVM::InstructionSequence.load_from_binary(binary) rescue RuntimeError => error if error.message == "broken binary format" $stderr.puts("[Bootsnap::CompileCache] warning: rejecting broken binary") nil else raise end end