module Bootsnap::CompileCache::ISeq
Attributes
cache_dir[R]
Public Class Methods
cache_dir=(cache_dir)
click to toggle source
# File lib/bootsnap/compile_cache/iseq.rb, line 11 def cache_dir=(cache_dir) @cache_dir = cache_dir.end_with?("/") ? "#{cache_dir}iseq" : "#{cache_dir}-iseq" end
compile_option_updated()
click to toggle source
# File lib/bootsnap/compile_cache/iseq.rb, line 100 def self.compile_option_updated option = RubyVM::InstructionSequence.compile_option crc = Zlib.crc32(option.inspect) Bootsnap::CompileCache::Native.compile_option_crc32 = crc end
fetch(path, cache_dir: ISeq.cache_dir)
click to toggle source
# File lib/bootsnap/compile_cache/iseq.rb, line 58 def self.fetch(path, cache_dir: ISeq.cache_dir) Bootsnap::CompileCache::Native.fetch( cache_dir, path.to_s, Bootsnap::CompileCache::ISeq, nil, ) end
input_to_output(_data, _kwargs)
click to toggle source
# File lib/bootsnap/compile_cache/iseq.rb, line 75 def self.input_to_output(_data, _kwargs) nil # ruby handles this end
input_to_storage(_, path)
click to toggle source
# File lib/bootsnap/compile_cache/iseq.rb, line 26 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 return UNCOMPILABLE # ruby bug #18250 end end
install!(cache_dir)
click to toggle source
# File lib/bootsnap/compile_cache/iseq.rb, line 107 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
precompile(path)
click to toggle source
# File lib/bootsnap/compile_cache/iseq.rb, line 67 def self.precompile(path) Bootsnap::CompileCache::Native.precompile( cache_dir, path.to_s, Bootsnap::CompileCache::ISeq, ) end
storage_to_output(binary, _args)
click to toggle source
# File lib/bootsnap/compile_cache/iseq.rb, line 47 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